claude-code-session-manager 0.75.1 → 0.75.2
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/assets/{AgentLibrary-CGplUKxY.js → AgentLibrary-s1jRGOji.js} +1 -1
- package/dist/assets/{DataModel-DQ15KxVb.js → DataModel-DNefcWbk.js} +1 -1
- package/dist/assets/{History-v2TSC_6A.js → History-4sMk80yI.js} +1 -1
- package/dist/assets/{Hooks-Co7s6BNB.js → Hooks-CNUVwH5P.js} +1 -1
- package/dist/assets/{HostBilko-DJj8FWPK.js → HostBilko-BhkyvIhw.js} +1 -1
- package/dist/assets/{Library-DQaC9VQ1.js → Library-BpockanA.js} +1 -1
- package/dist/assets/{ListDetail-BwFRfAZm.js → ListDetail-Cre7h3U0.js} +1 -1
- package/dist/assets/{MarkdownEditor-C155gNpc.js → MarkdownEditor-x-FzvaXm.js} +1 -1
- package/dist/assets/{McpServers-BmLgE_gS.js → McpServers-CXAcQLMB.js} +1 -1
- package/dist/assets/{Memory-ISwNcS5j.js → Memory-CGBv1Rco.js} +1 -1
- package/dist/assets/{Panel-1adjEpj-.js → Panel-czEs21N2.js} +1 -1
- package/dist/assets/{Permissions-FrCz5cGa.js → Permissions-rGkLOpqI.js} +1 -1
- package/dist/assets/{Plugins-zUssKp_b.js → Plugins-BTmB_vgU.js} +2 -2
- package/dist/assets/{ProvenanceBadge-CAXqA_HX.js → ProvenanceBadge-dmCivDq5.js} +1 -1
- package/dist/assets/{SaveBar-D9cqms3Y.js → SaveBar-D80TNkAx.js} +1 -1
- package/dist/assets/{Scheduler-dNNc9S11.js → Scheduler-C6wHSZP7.js} +3 -3
- package/dist/assets/{ScopeSwitcher-1wBTne7S.js → ScopeSwitcher-DsaiYTgl.js} +1 -1
- package/dist/assets/{Settings-BT_expIg.js → Settings-m2fyU8Q5.js} +1 -1
- package/dist/assets/{SkillReferenceGraph-CVccq4Cu.js → SkillReferenceGraph-yS-lgBFU.js} +1 -1
- package/dist/assets/{Skills-xFpRY0ld.js → Skills-DtQgCs9-.js} +1 -1
- package/dist/assets/{SystemPrompt-CEk_71th.js → SystemPrompt-CLuVdoMA.js} +1 -1
- package/dist/assets/{TagLibrary-C2zhihQG.js → TagLibrary-DQXoI752.js} +1 -1
- package/dist/assets/{TiptapBody-CQKcHKaD.js → TiptapBody-BGKVXrvq.js} +1 -1
- package/dist/assets/{Toggle-CQ-IBb8m.js → Toggle-RFnEV71m.js} +1 -1
- package/dist/assets/{index-Dbo9R4e0.css → index-CMLnzdZC.css} +1 -1
- package/dist/assets/{index-BgbV3sKX.js → index-Ddrw7J7O.js} +4 -4
- package/dist/assets/{settingsSchema-D6ccSKqm.js → settingsSchema-LwuJXKD1.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/scripts/scheduler-mcp-server.cjs +16 -1
- package/src/main/__tests__/prdAdminRoutes.test.cjs +100 -0
- package/src/main/__tests__/queueHistory.test.cjs +7 -0
- package/src/main/__tests__/scheduleJobSchema.test.cjs +1 -1
- package/src/main/__tests__/scheduleJobStatusDrift.test.cjs +1 -1
- package/src/main/__tests__/scheduleJobTransitions.test.cjs +24 -0
- package/src/main/__tests__/scheduler-clear-queue-history.test.cjs +134 -0
- package/src/main/__tests__/scheduler-prd-missing-skip.test.cjs +5 -1
- package/src/main/ipcSchemas.cjs +10 -0
- package/src/main/lib/__tests__/schedulerBatchDepends.test.cjs +26 -0
- package/src/main/lib/prdAdminRoutes.cjs +12 -2
- package/src/main/lib/queueHistory.cjs +6 -4
- package/src/main/lib/scheduleJobSchema.cjs +1 -1
- package/src/main/lib/scheduleJobTransitions.cjs +19 -6
- package/src/main/lib/schedulerBatch.cjs +17 -1
- package/src/main/scheduler.cjs +89 -16
- package/src/preload/api.d.ts +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{ad as x,a4 as o,S as j,aq as P}from"./index-BgbV3sKX.js";function re({node:e,targetScope:t,onOverride:r,schema:n,rootLabel:m}){const[c,f]=x.useState(""),[d,l]=x.useState(!0),g=[],i=e.kind==="object"&&Object.keys(e.children).length===0,h=((n==null?void 0:n.rootKeys())??[]).length>0;return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"shrink-0 border-b border-line bg-bg-elev px-3 py-1.5 flex items-center gap-2 text-xs",children:[o.jsxs("span",{className:"text-fg-faint",children:["merged · overrides → ",o.jsx("span",{className:"text-fg-dim",children:j[t].label})]}),h&&o.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:d,onChange:s=>l(s.target.checked),className:"accent-accent"}),"show unset keys"]}),o.jsx("div",{className:"flex-1"}),o.jsx("input",{value:c,onChange:s=>f(s.target.value),placeholder:"filter keys or descriptions…",className:"bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg w-56"})]}),o.jsx("div",{className:"flex-1 overflow-auto px-3 py-2 font-mono text-xs",children:i&&!d?o.jsx("div",{className:"text-fg-faint italic px-2 py-4",children:"no settings resolved — all scope files empty or missing"}):o.jsx(O,{node:e,path:g,label:m??"(root)",targetScope:t,onOverride:r,filter:c,depth:0,schema:n,showGhosts:d,defaultOpen:!0})})]})}function O(e){return e.node.kind==="object"?o.jsx(D,{...e,node:e.node}):e.node.kind==="array"?o.jsx(R,{...e,node:e.node}):o.jsx($,{...e,node:e.node})}function L(e,t){return t.trim()?e.toLowerCase().includes(t.toLowerCase()):!0}function w(e,t,r){return!!(!r.trim()||e.some(n=>L(n,r))||t!=null&&t.description&&L(t.description,r))}function D({node:e,path:t,label:r,targetScope:n,onOverride:m,filter:c,depth:f,schema:d,showGhosts:l,defaultOpen:g}){const[i,b]=x.useState(g??f<2),h=(d==null?void 0:d.at(t))??null,s=new Set(Object.keys(e.children)),a=l?(h==null?void 0:h.knownChildren)??[]:[],u=Array.from(new Set([...s,...a])).sort(),p=x.useMemo(()=>c.trim()?u.filter(y=>{const v=(d==null?void 0:d.at([...t,y]))??null;return w([...t,y],v,c)?!0:s.has(y)?N(e.children[y],[...t,y],c,d):!1}):u,[u.join(","),c,e,t.join("."),d]);if(c.trim()&&p.length===0&&!w(t,h,c))return null;if(t.length===0)return o.jsx("div",{children:p.map(y=>k(y))});return o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-1 py-0.5 hover:bg-bg-elev/50 rounded cursor-pointer",style:{paddingLeft:f*14},onClick:()=>b(!i),children:[o.jsx("span",{className:"text-fg-faint w-3 shrink-0",children:i?"▾":"▸"}),o.jsx("span",{className:"text-fg",children:r}),o.jsxs("span",{className:"text-fg-faint",children:[" {",s.size,a.length>s.size?`/${new Set([...s,...a]).size}`:"","}"]}),(h==null?void 0:h.description)&&o.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:h.description,children:["— ",h.description]})]}),i&&p.map(y=>k(y))]});function k(y){if(s.has(y))return o.jsx(O,{node:e.children[y],path:[...t,y],label:y,targetScope:n,onOverride:m,filter:c,depth:f+1,schema:d,showGhosts:l},y);const v=(d==null?void 0:d.at([...t,y]))??null;return v?o.jsx(_,{path:[...t,y],label:y,info:v,targetScope:n,onSet:m,depth:f+1,filter:c},y):null}}function N(e,t,r,n){const m=(n==null?void 0:n.at(t))??null;if(w(t,m,r))return!0;if(e.kind!=="object")return!1;for(const c of Object.keys(e.children))if(N(e.children[c],[...t,c],r,n))return!0;return!1}function R({node:e,path:t,label:r,filter:n,depth:m,schema:c}){const[f,d]=x.useState(!0),l=(c==null?void 0:c.at(t))??null;return w(t,l,n)?o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-1 py-0.5 hover:bg-bg-elev/50 rounded cursor-pointer",style:{paddingLeft:m*14},onClick:()=>d(!f),children:[o.jsx("span",{className:"text-fg-faint w-3 shrink-0",children:f?"▾":"▸"}),o.jsx("span",{className:"text-fg",children:r}),o.jsxs("span",{className:"text-fg-faint",children:[" [",e.items.length,"]"]}),o.jsx(S,{tone:"warn",children:"accumulated"}),(l==null?void 0:l.description)&&o.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:l.description,children:["— ",l.description]})]}),f&&e.items.map((g,i)=>o.jsxs("div",{className:"flex items-start gap-2 py-0.5",style:{paddingLeft:(m+1)*14},children:[o.jsx("span",{className:"text-fg-faint w-3 shrink-0"}),o.jsxs("span",{className:"text-fg-faint",children:[i,":"]}),o.jsx("span",{className:"text-fg-dim truncate max-w-xl",children:E(g.value)}),o.jsx(M,{scope:g.fromScope})]},i))]}):null}function $({node:e,path:t,label:r,targetScope:n,onOverride:m,filter:c,depth:f,schema:d}){const[l,g]=x.useState(!1),i=(d==null?void 0:d.at(t))??null;if(!w(t,i,c))return null;const b=e.winner!==n,h=e.shadowed.length>0;return o.jsxs("div",{children:[o.jsxs("div",{className:"group flex items-center gap-2 py-0.5 hover:bg-bg-elev/50 rounded",style:{paddingLeft:f*14},children:[o.jsx("span",{className:`w-3 shrink-0 ${h?"text-fg-faint cursor-pointer":""}`,onClick:()=>h&&g(!l),children:h?l?"▾":"▸":""}),o.jsxs("span",{className:"text-fg",children:[r,":"]}),o.jsx("span",{className:"text-fg-dim truncate max-w-md",children:E(e.value)}),o.jsx(M,{scope:e.winner}),(i==null?void 0:i.deprecated)&&o.jsx(S,{tone:"warn",children:"deprecated"}),(i==null?void 0:i.default)!==void 0&&I(e.value,i.default)&&o.jsx(S,{tone:"dim",children:"= default"}),e.typeMismatch&&o.jsx("span",{className:"text-yellow-500/80",title:"shadowed scopes have a different value type",children:"⚠"}),(i==null?void 0:i.description)&&o.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:i.description,children:["— ",i.description]}),o.jsx("div",{className:"flex-1"}),(i==null?void 0:i.enum)&&o.jsx(T,{values:i.enum}),o.jsx("button",{disabled:!b,onClick:()=>m(t,e.value),className:`opacity-0 group-hover:opacity-100 px-1.5 py-0 text-[10px] border rounded transition-opacity ${b?"border-accent/50 text-accent hover:bg-accent hover:text-bg":"border-line text-fg-faint cursor-not-allowed"}`,title:b?`copy into ${j[n].label} draft`:`already winning in ${j[n].label}`,children:"override"})]}),l&&e.shadowed.map((s,a)=>o.jsxs("div",{className:"flex items-center gap-2 py-0.5 text-fg-faint line-through",style:{paddingLeft:(f+1)*14+12},children:[o.jsx("span",{children:"shadowed:"}),o.jsx("span",{className:"truncate max-w-xl",children:E(s.value)}),o.jsx(M,{scope:s.scope,dim:!0})]},a))]})}function _({path:e,label:t,info:r,targetScope:n,onSet:m,depth:c,filter:f}){if(!w(e,r,f))return null;const d=r.default!==void 0?r.default:H(r.type),l=Array.isArray(r.type)?r.type.join("|"):r.type??"?";return o.jsxs("div",{className:"group flex items-center gap-2 py-0.5 hover:bg-bg-elev/50 rounded opacity-60",style:{paddingLeft:c*14},children:[o.jsx("span",{className:"w-3 shrink-0"}),o.jsx("span",{className:"text-fg-dim",children:t}),o.jsx(S,{tone:"dim",children:l}),r.required&&o.jsx(S,{tone:"warn",children:"required"}),r.default!==void 0&&o.jsxs("span",{className:"text-fg-faint",children:["default: ",E(r.default)]}),r.description&&o.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:r.description,children:["— ",r.description]}),o.jsx("div",{className:"flex-1"}),r.enum&&o.jsx(T,{values:r.enum}),o.jsx("button",{onClick:()=>m(e,d),className:"opacity-0 group-hover:opacity-100 px-1.5 py-0 text-[10px] border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg transition-opacity",title:`write to ${j[n].label} draft`,children:"set"})]})}function I(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"?JSON.stringify(e)===JSON.stringify(t):!1}function H(e){switch(Array.isArray(e)?e[0]:e){case"boolean":return!1;case"integer":case"number":return 0;case"string":return"";case"array":return[];case"object":return{};case"null":return null;default:return null}}function E(e){if(typeof e=="string")return JSON.stringify(e);if(e===null)return"null";if(typeof e=="object"){const t=JSON.stringify(e);return t.length>100?t.slice(0,100)+"…":t}return String(e)}function M({scope:e,dim:t}){const r=e==="user"?"bg-bg-hi text-fg-dim border-line":e==="project"?"bg-blue-950/30 text-blue-400/80 border-blue-900/40":"bg-purple-950/30 text-purple-400/80 border-purple-900/40";return o.jsx("span",{className:`text-[10px] px-1 py-0 rounded border uppercase tracking-wide shrink-0 ${r} ${t?"opacity-60":""}`,children:j[e].label})}function S({children:e,tone:t="default"}){const r={default:"bg-bg-hi text-fg-dim border-line",warn:"bg-yellow-950/30 text-yellow-500/80 border-yellow-900/40",dim:"bg-bg-elev text-fg-faint border-line"}[t];return o.jsx("span",{className:`text-[10px] px-1 py-0 rounded border uppercase tracking-wide shrink-0 ${r}`,children:e})}function T({values:e}){const t=e.map(r=>String(r)).join(" | ");return o.jsxs("span",{className:"text-[10px] text-fg-faint truncate max-w-xs",title:`allowed: ${t}`,children:["∈ ",t.length>30?t.slice(0,30)+"…":t]})}function ie(e,t,r){const n=P(l=>l.files),m=P(l=>l.loadJson),c=P(l=>l.watchFile),f=P(l=>l.unwatchFile),d=x.useMemo(()=>{const l={};for(const g of e.scopes){const i=e.resolve(g,t??"",r);i&&(l[g]=i)}return l},[e,t,r]);return x.useEffect(()=>{const l=Object.values(d).filter(Boolean);return l.forEach(g=>{n[g]||m(g),c(g)}),()=>{l.forEach(g=>f(g))}},[JSON.stringify(d)]),d}const q=[];function C(e){return Array.isArray(e)?"array":e!==null&&typeof e=="object"?"object":"scalar"}function ne(e){const t=e.filter(r=>r.data!==void 0);return t.length===0?{kind:"object",children:{}}:U(t,[])}function U(e,t){const r=q.includes(t.join(".")),n=e.every(i=>C(i.data)==="object"),m=e.every(i=>C(i.data)==="array");if(n){const i=new Set;for(const h of e)for(const s of Object.keys(h.data))i.add(s);const b={};for(const h of i){const s=e.filter(a=>h in a.data).map(a=>({scope:a.scope,data:a.data[h]}));b[h]=U(s,[...t,h])}return{kind:"object",children:b}}if(m&&!r){const i=[];for(const b of[...e].reverse())for(const h of b.data)i.push({value:h,fromScope:b.scope,index:i.length});return{kind:"array",items:i}}const c=[...e].reverse(),f=c[0],d=c.slice(1).map(i=>({scope:i.scope,value:i.data})),l=C(f.data),g=d.some(i=>C(i.value)!==l);return{kind:"leaf",value:f.data,winner:f.scope,shadowed:d,...g?{typeMismatch:!0}:{}}}function B(e,t){if(t.length===0)return e;if(e.kind!=="object")return null;const[r,...n]=t,m=e.children[r];return m?B(m,n):null}function G(e,t,r){if(t.length===0)return r;const[n,...m]=t,c=e&&typeof e=="object"&&!Array.isArray(e)?{...e}:{};return c[n]=G(c[n],m,r),c}const F=["user","project","local"];function ae(e,t){const r=[];for(const n of F){const m=t[n];if(!m)continue;const c=e[m];if(!c||!c.exists)continue;const f=c.draftRaw??"";if(f.trim())try{r.push({scope:n,data:JSON.parse(f)})}catch{}}return r}const W="http://json-schema.org/draft-07/schema#",K="https://json.schemastore.org/claude-code-settings.json",J={permissionRule:{type:"string",description:`Tool permission rule.
|
|
1
|
+
import{ad as x,a4 as o,S as j,aq as P}from"./index-Ddrw7J7O.js";function re({node:e,targetScope:t,onOverride:r,schema:n,rootLabel:m}){const[c,f]=x.useState(""),[d,l]=x.useState(!0),g=[],i=e.kind==="object"&&Object.keys(e.children).length===0,h=((n==null?void 0:n.rootKeys())??[]).length>0;return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"shrink-0 border-b border-line bg-bg-elev px-3 py-1.5 flex items-center gap-2 text-xs",children:[o.jsxs("span",{className:"text-fg-faint",children:["merged · overrides → ",o.jsx("span",{className:"text-fg-dim",children:j[t].label})]}),h&&o.jsxs("label",{className:"flex items-center gap-1 text-fg-faint cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:d,onChange:s=>l(s.target.checked),className:"accent-accent"}),"show unset keys"]}),o.jsx("div",{className:"flex-1"}),o.jsx("input",{value:c,onChange:s=>f(s.target.value),placeholder:"filter keys or descriptions…",className:"bg-bg border border-line rounded px-2 py-0.5 text-xs text-fg w-56"})]}),o.jsx("div",{className:"flex-1 overflow-auto px-3 py-2 font-mono text-xs",children:i&&!d?o.jsx("div",{className:"text-fg-faint italic px-2 py-4",children:"no settings resolved — all scope files empty or missing"}):o.jsx(O,{node:e,path:g,label:m??"(root)",targetScope:t,onOverride:r,filter:c,depth:0,schema:n,showGhosts:d,defaultOpen:!0})})]})}function O(e){return e.node.kind==="object"?o.jsx(D,{...e,node:e.node}):e.node.kind==="array"?o.jsx(R,{...e,node:e.node}):o.jsx($,{...e,node:e.node})}function L(e,t){return t.trim()?e.toLowerCase().includes(t.toLowerCase()):!0}function w(e,t,r){return!!(!r.trim()||e.some(n=>L(n,r))||t!=null&&t.description&&L(t.description,r))}function D({node:e,path:t,label:r,targetScope:n,onOverride:m,filter:c,depth:f,schema:d,showGhosts:l,defaultOpen:g}){const[i,b]=x.useState(g??f<2),h=(d==null?void 0:d.at(t))??null,s=new Set(Object.keys(e.children)),a=l?(h==null?void 0:h.knownChildren)??[]:[],u=Array.from(new Set([...s,...a])).sort(),p=x.useMemo(()=>c.trim()?u.filter(y=>{const v=(d==null?void 0:d.at([...t,y]))??null;return w([...t,y],v,c)?!0:s.has(y)?N(e.children[y],[...t,y],c,d):!1}):u,[u.join(","),c,e,t.join("."),d]);if(c.trim()&&p.length===0&&!w(t,h,c))return null;if(t.length===0)return o.jsx("div",{children:p.map(y=>k(y))});return o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-1 py-0.5 hover:bg-bg-elev/50 rounded cursor-pointer",style:{paddingLeft:f*14},onClick:()=>b(!i),children:[o.jsx("span",{className:"text-fg-faint w-3 shrink-0",children:i?"▾":"▸"}),o.jsx("span",{className:"text-fg",children:r}),o.jsxs("span",{className:"text-fg-faint",children:[" {",s.size,a.length>s.size?`/${new Set([...s,...a]).size}`:"","}"]}),(h==null?void 0:h.description)&&o.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:h.description,children:["— ",h.description]})]}),i&&p.map(y=>k(y))]});function k(y){if(s.has(y))return o.jsx(O,{node:e.children[y],path:[...t,y],label:y,targetScope:n,onOverride:m,filter:c,depth:f+1,schema:d,showGhosts:l},y);const v=(d==null?void 0:d.at([...t,y]))??null;return v?o.jsx(_,{path:[...t,y],label:y,info:v,targetScope:n,onSet:m,depth:f+1,filter:c},y):null}}function N(e,t,r,n){const m=(n==null?void 0:n.at(t))??null;if(w(t,m,r))return!0;if(e.kind!=="object")return!1;for(const c of Object.keys(e.children))if(N(e.children[c],[...t,c],r,n))return!0;return!1}function R({node:e,path:t,label:r,filter:n,depth:m,schema:c}){const[f,d]=x.useState(!0),l=(c==null?void 0:c.at(t))??null;return w(t,l,n)?o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-1 py-0.5 hover:bg-bg-elev/50 rounded cursor-pointer",style:{paddingLeft:m*14},onClick:()=>d(!f),children:[o.jsx("span",{className:"text-fg-faint w-3 shrink-0",children:f?"▾":"▸"}),o.jsx("span",{className:"text-fg",children:r}),o.jsxs("span",{className:"text-fg-faint",children:[" [",e.items.length,"]"]}),o.jsx(S,{tone:"warn",children:"accumulated"}),(l==null?void 0:l.description)&&o.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:l.description,children:["— ",l.description]})]}),f&&e.items.map((g,i)=>o.jsxs("div",{className:"flex items-start gap-2 py-0.5",style:{paddingLeft:(m+1)*14},children:[o.jsx("span",{className:"text-fg-faint w-3 shrink-0"}),o.jsxs("span",{className:"text-fg-faint",children:[i,":"]}),o.jsx("span",{className:"text-fg-dim truncate max-w-xl",children:E(g.value)}),o.jsx(M,{scope:g.fromScope})]},i))]}):null}function $({node:e,path:t,label:r,targetScope:n,onOverride:m,filter:c,depth:f,schema:d}){const[l,g]=x.useState(!1),i=(d==null?void 0:d.at(t))??null;if(!w(t,i,c))return null;const b=e.winner!==n,h=e.shadowed.length>0;return o.jsxs("div",{children:[o.jsxs("div",{className:"group flex items-center gap-2 py-0.5 hover:bg-bg-elev/50 rounded",style:{paddingLeft:f*14},children:[o.jsx("span",{className:`w-3 shrink-0 ${h?"text-fg-faint cursor-pointer":""}`,onClick:()=>h&&g(!l),children:h?l?"▾":"▸":""}),o.jsxs("span",{className:"text-fg",children:[r,":"]}),o.jsx("span",{className:"text-fg-dim truncate max-w-md",children:E(e.value)}),o.jsx(M,{scope:e.winner}),(i==null?void 0:i.deprecated)&&o.jsx(S,{tone:"warn",children:"deprecated"}),(i==null?void 0:i.default)!==void 0&&I(e.value,i.default)&&o.jsx(S,{tone:"dim",children:"= default"}),e.typeMismatch&&o.jsx("span",{className:"text-yellow-500/80",title:"shadowed scopes have a different value type",children:"⚠"}),(i==null?void 0:i.description)&&o.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:i.description,children:["— ",i.description]}),o.jsx("div",{className:"flex-1"}),(i==null?void 0:i.enum)&&o.jsx(T,{values:i.enum}),o.jsx("button",{disabled:!b,onClick:()=>m(t,e.value),className:`opacity-0 group-hover:opacity-100 px-1.5 py-0 text-[10px] border rounded transition-opacity ${b?"border-accent/50 text-accent hover:bg-accent hover:text-bg":"border-line text-fg-faint cursor-not-allowed"}`,title:b?`copy into ${j[n].label} draft`:`already winning in ${j[n].label}`,children:"override"})]}),l&&e.shadowed.map((s,a)=>o.jsxs("div",{className:"flex items-center gap-2 py-0.5 text-fg-faint line-through",style:{paddingLeft:(f+1)*14+12},children:[o.jsx("span",{children:"shadowed:"}),o.jsx("span",{className:"truncate max-w-xl",children:E(s.value)}),o.jsx(M,{scope:s.scope,dim:!0})]},a))]})}function _({path:e,label:t,info:r,targetScope:n,onSet:m,depth:c,filter:f}){if(!w(e,r,f))return null;const d=r.default!==void 0?r.default:H(r.type),l=Array.isArray(r.type)?r.type.join("|"):r.type??"?";return o.jsxs("div",{className:"group flex items-center gap-2 py-0.5 hover:bg-bg-elev/50 rounded opacity-60",style:{paddingLeft:c*14},children:[o.jsx("span",{className:"w-3 shrink-0"}),o.jsx("span",{className:"text-fg-dim",children:t}),o.jsx(S,{tone:"dim",children:l}),r.required&&o.jsx(S,{tone:"warn",children:"required"}),r.default!==void 0&&o.jsxs("span",{className:"text-fg-faint",children:["default: ",E(r.default)]}),r.description&&o.jsxs("span",{className:"text-fg-faint truncate max-w-md",title:r.description,children:["— ",r.description]}),o.jsx("div",{className:"flex-1"}),r.enum&&o.jsx(T,{values:r.enum}),o.jsx("button",{onClick:()=>m(e,d),className:"opacity-0 group-hover:opacity-100 px-1.5 py-0 text-[10px] border border-accent/50 rounded text-accent hover:bg-accent hover:text-bg transition-opacity",title:`write to ${j[n].label} draft`,children:"set"})]})}function I(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"?JSON.stringify(e)===JSON.stringify(t):!1}function H(e){switch(Array.isArray(e)?e[0]:e){case"boolean":return!1;case"integer":case"number":return 0;case"string":return"";case"array":return[];case"object":return{};case"null":return null;default:return null}}function E(e){if(typeof e=="string")return JSON.stringify(e);if(e===null)return"null";if(typeof e=="object"){const t=JSON.stringify(e);return t.length>100?t.slice(0,100)+"…":t}return String(e)}function M({scope:e,dim:t}){const r=e==="user"?"bg-bg-hi text-fg-dim border-line":e==="project"?"bg-blue-950/30 text-blue-400/80 border-blue-900/40":"bg-purple-950/30 text-purple-400/80 border-purple-900/40";return o.jsx("span",{className:`text-[10px] px-1 py-0 rounded border uppercase tracking-wide shrink-0 ${r} ${t?"opacity-60":""}`,children:j[e].label})}function S({children:e,tone:t="default"}){const r={default:"bg-bg-hi text-fg-dim border-line",warn:"bg-yellow-950/30 text-yellow-500/80 border-yellow-900/40",dim:"bg-bg-elev text-fg-faint border-line"}[t];return o.jsx("span",{className:`text-[10px] px-1 py-0 rounded border uppercase tracking-wide shrink-0 ${r}`,children:e})}function T({values:e}){const t=e.map(r=>String(r)).join(" | ");return o.jsxs("span",{className:"text-[10px] text-fg-faint truncate max-w-xs",title:`allowed: ${t}`,children:["∈ ",t.length>30?t.slice(0,30)+"…":t]})}function ie(e,t,r){const n=P(l=>l.files),m=P(l=>l.loadJson),c=P(l=>l.watchFile),f=P(l=>l.unwatchFile),d=x.useMemo(()=>{const l={};for(const g of e.scopes){const i=e.resolve(g,t??"",r);i&&(l[g]=i)}return l},[e,t,r]);return x.useEffect(()=>{const l=Object.values(d).filter(Boolean);return l.forEach(g=>{n[g]||m(g),c(g)}),()=>{l.forEach(g=>f(g))}},[JSON.stringify(d)]),d}const q=[];function C(e){return Array.isArray(e)?"array":e!==null&&typeof e=="object"?"object":"scalar"}function ne(e){const t=e.filter(r=>r.data!==void 0);return t.length===0?{kind:"object",children:{}}:U(t,[])}function U(e,t){const r=q.includes(t.join(".")),n=e.every(i=>C(i.data)==="object"),m=e.every(i=>C(i.data)==="array");if(n){const i=new Set;for(const h of e)for(const s of Object.keys(h.data))i.add(s);const b={};for(const h of i){const s=e.filter(a=>h in a.data).map(a=>({scope:a.scope,data:a.data[h]}));b[h]=U(s,[...t,h])}return{kind:"object",children:b}}if(m&&!r){const i=[];for(const b of[...e].reverse())for(const h of b.data)i.push({value:h,fromScope:b.scope,index:i.length});return{kind:"array",items:i}}const c=[...e].reverse(),f=c[0],d=c.slice(1).map(i=>({scope:i.scope,value:i.data})),l=C(f.data),g=d.some(i=>C(i.value)!==l);return{kind:"leaf",value:f.data,winner:f.scope,shadowed:d,...g?{typeMismatch:!0}:{}}}function B(e,t){if(t.length===0)return e;if(e.kind!=="object")return null;const[r,...n]=t,m=e.children[r];return m?B(m,n):null}function G(e,t,r){if(t.length===0)return r;const[n,...m]=t,c=e&&typeof e=="object"&&!Array.isArray(e)?{...e}:{};return c[n]=G(c[n],m,r),c}const F=["user","project","local"];function ae(e,t){const r=[];for(const n of F){const m=t[n];if(!m)continue;const c=e[m];if(!c||!c.exists)continue;const f=c.draftRaw??"";if(f.trim())try{r.push({scope:n,data:JSON.parse(f)})}catch{}}return r}const W="http://json-schema.org/draft-07/schema#",K="https://json.schemastore.org/claude-code-settings.json",J={permissionRule:{type:"string",description:`Tool permission rule.
|
|
2
2
|
See https://code.claude.com/docs/en/settings#permission-rule-syntax
|
|
3
3
|
See https://code.claude.com/docs/en/settings#tools-available-to-claude for full list of tools available to Claude.`,pattern:"^((Agent|Bash|Edit|ExitPlanMode|Glob|Grep|KillShell|LSP|NotebookEdit|Read|Skill|TaskCreate|TaskGet|TaskList|TaskOutput|TaskStop|TaskUpdate|TodoWrite|ToolSearch|WebFetch|WebSearch|Write)(\\((?=.*[^)*?])[^)]+\\))?|mcp__.*)$",examples:["Bash","Bash(npm run build)","Bash(git commit *)","Bash(npm run *)","Bash(ls*)","Bash(git * main)","Edit","Edit(/src/**/*.ts)","Read(./.env)","Read(./secrets/**)","Read(//Users/alice/secrets/**)","Read(~/Documents/*.pdf)","Agent(Explore)","WebFetch","WebFetch(domain:example.com)","mcp__puppeteer","mcp__github__search_repositories"]},hookCommand:{anyOf:[{type:"object",description:"Bash command hook",additionalProperties:!1,required:["type","command"],properties:{type:{type:"string",description:"Hook type",const:"command"},command:{type:"string",description:"Shell command to execute",minLength:1},timeout:{type:"number",description:"Optional timeout in seconds",exclusiveMinimum:0},async:{type:"boolean",description:"Run this hook asynchronously without blocking Claude Code"},statusMessage:{type:"string",description:"Custom spinner message displayed while the hook runs"}}},{type:"object",description:"LLM prompt hook. See https://code.claude.com/docs/en/hooks#prompt-based-hooks",additionalProperties:!1,required:["type","prompt"],properties:{type:{type:"string",description:"Hook type",const:"prompt"},prompt:{type:"string",description:"Prompt to evaluate with LLM. Use $ARGUMENTS placeholder for hook input JSON.",minLength:1},model:{type:"string",description:"Model to use for evaluation. Defaults to a fast model"},timeout:{type:"number",description:"Optional timeout in seconds (default: 30)",exclusiveMinimum:0},statusMessage:{type:"string",description:"Custom spinner message displayed while the hook runs"}}},{type:"object",description:"Agent hook with multi-turn tool access for verification. See https://code.claude.com/docs/en/hooks#agent-based-hooks",additionalProperties:!1,required:["type","prompt"],properties:{type:{type:"string",description:"Hook type",const:"agent"},prompt:{type:"string",description:"Prompt describing what to verify. Use $ARGUMENTS placeholder for hook input JSON.",minLength:1},model:{type:"string",description:"Model to use for evaluation. Defaults to a fast model"},timeout:{type:"number",description:"Optional timeout in seconds (default: 60)",exclusiveMinimum:0},statusMessage:{type:"string",description:"Custom spinner message displayed while the hook runs"}}},{type:"object",description:"HTTP webhook hook. POST JSON to a URL and receive JSON response. See https://code.claude.com/docs/en/hooks#http-hooks",additionalProperties:!1,required:["type","url"],properties:{type:{type:"string",description:"Hook type",const:"http"},url:{type:"string",description:"URL to POST hook input JSON to. Endpoint must accept POST requests and return JSON.",minLength:1},headers:{type:"object",additionalProperties:{type:"string"},description:"Custom HTTP headers (e.g., Authorization: Bearer token). Values support $VAR_NAME or ${VAR_NAME} interpolation."},allowedEnvVars:{type:"array",items:{type:"string",minLength:1},description:"List of environment variable names permitted for interpolation in headers. If not set, no env var interpolation is allowed."},timeout:{type:"number",description:"Optional timeout in seconds (default: 30)",exclusiveMinimum:0},statusMessage:{type:"string",description:"Custom spinner message displayed while the hook runs"}}}]},hookMatcher:{type:"object",description:"Hook matcher configuration with multiple hooks",additionalProperties:!1,required:["hooks"],properties:{matcher:{type:"string",description:"Optional pattern to match event contexts, case-sensitive. Behavior depends on event type. See https://code.claude.com/docs/en/hooks#matcher-patterns for event-specific details and examples"},hooks:{type:"array",description:"Array of hooks to execute",items:{$ref:"#/$defs/hookCommand"}}}}},V="Configuration settings for Claude Code. Learn more: https://code.claude.com/docs/en/settings",z=!0,Y=!0,Z="object",X=JSON.parse(`{"$schema":{"type":"string","description":"JSON Schema reference for Claude Code settings"},"apiKeyHelper":{"type":"string","description":"Path to a script that outputs authentication values","examples":["/bin/generate_temp_api_key.sh"],"minLength":1},"autoMemoryEnabled":{"type":"boolean","description":"Enable automatic memory saves that capture useful context to .claude/memory/. Also configurable via CLAUDE_CODE_DISABLE_AUTO_MEMORY environment variable (set to 1 to disable, 0 to enable). See https://code.claude.com/docs/en/memory#auto-memory","default":true},"autoUpdatesChannel":{"type":"string","enum":["stable","latest"],"description":"Release channel to follow for updates. Use \\"stable\\" for a version that is typically about one week old and skips versions with major regressions, or \\"latest\\" (default) for the most recent release. Set DISABLE_AUTOUPDATER=1 to disable updates entirely.","default":"latest"},"awsCredentialExport":{"type":"string","description":"Path to a script that exports AWS credentials","examples":["/bin/generate_aws_grant.sh"],"minLength":1},"awsAuthRefresh":{"type":"string","description":"Path to a script that refreshes AWS authentication","examples":["aws sso login --profile myprofile"],"minLength":1},"claudeMdExcludes":{"type":"array","items":{"type":"string","minLength":1},"description":"Glob patterns for CLAUDE.md files to exclude from loading. Useful in monorepos to skip irrelevant instructions from other teams. Patterns match against absolute file paths. Arrays merge across settings layers. Managed policy CLAUDE.md files cannot be excluded. See https://code.claude.com/docs/en/memory#exclude-specific-claudemd-files","examples":[["**/monorepo/CLAUDE.md","/home/user/monorepo/other-team/.claude/rules/**"]]},"cleanupPeriodDays":{"type":"integer","minimum":0,"description":"Number of days to retain chat transcripts (0 to disable cleanup)","examples":[20,30,60],"default":30},"env":{"type":"object","additionalProperties":false,"description":"Environment variables to set for Claude Code sessions. Many environment variables provide settings dimensions not available as dedicated settings.json properties (e.g., thinking tokens, prompt caching, bash timeouts, shell configuration). See https://code.claude.com/docs/en/settings#environment-variables for the full list.\\nUNDOCUMENTED: CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS (plugin marketplace git timeout in ms, default 120000, see https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#2151).\\nUNDOCUMENTED: ENABLE_CLAUDEAI_MCP_SERVERS (set to false to opt out of claude.ai MCP servers, see https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#2163).","examples":[{"ANTHROPIC_MODEL":"claude-opus-4-1","ANTHROPIC_SMALL_FAST_MODEL":"claude-3-5-haiku-latest"}],"default":{},"patternProperties":{"^[A-Z_][A-Z0-9_]*$":{"type":"string","description":"Environment variable value"}}},"attribution":{"type":"object","description":"Customize attribution for git commits and pull requests. See https://code.claude.com/docs/en/settings#attribution-settings","additionalProperties":false,"properties":{"commit":{"type":"string","description":"Attribution for git commits, including any trailers. Empty string hides commit attribution"},"pr":{"type":"string","description":"Attribution for pull request descriptions. Empty string hides pull request attribution"}}},"includeGitInstructions":{"type":"boolean","description":"Include built-in git commit and PR workflow instructions in Claude's system prompt. Also configurable via CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS environment variable (set to 1 to disable). See https://code.claude.com/docs/en/settings#available-settings","default":true},"includeCoAuthoredBy":{"type":"boolean","description":"DEPRECATED. Use 'attribution' instead. Whether to include the co-authored-by Claude byline in git commits and pull requests (default: true)","default":true},"plansDirectory":{"type":"string","description":"Customize where plan files are stored. Path is relative to project root (default: ~/.claude/plans)","default":"~/.claude/plans","examples":["./plans"]},"respectGitignore":{"type":"boolean","description":"Control whether the @ file picker respects .gitignore patterns. When true (default), files matching .gitignore patterns are excluded from suggestions","default":true},"permissions":{"type":"object","properties":{"allow":{"type":"array","items":{"$ref":"#/$defs/permissionRule"},"description":"List of permission rules for allowed operations","uniqueItems":true},"deny":{"type":"array","items":{"$ref":"#/$defs/permissionRule"},"description":"List of permission rules for denied operations","uniqueItems":true},"ask":{"type":"array","items":{"$ref":"#/$defs/permissionRule"},"description":"List of permission rules that should always prompt for confirmation","uniqueItems":true},"defaultMode":{"type":"string","enum":["acceptEdits","bypassPermissions","default","delegate","dontAsk","plan"],"description":"Default permission mode.\\n\\"default\\": prompts on first use.\\n\\"acceptEdits\\": auto-accepts file edits.\\n\\"plan\\": read-only, no modifications.\\nUNDOCUMENTED. \\"delegate\\": coordination-only for agent team leads (agent teams are experimental; enable via CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS).\\n\\"dontAsk\\": auto-denies unless pre-approved via permissions.\\n\\"bypassPermissions\\": skips all prompts (use only in isolated environments).\\nSee https://code.claude.com/docs/en/permissions"},"disableBypassPermissionsMode":{"type":"string","enum":["disable"],"description":"Disable the ability to bypass permission prompts"},"additionalDirectories":{"type":"array","items":{"type":"string","minLength":1},"description":"Additional directories to include in the permission scope","examples":[["//Users/alice/Documents","~/projects"]],"uniqueItems":true}},"additionalProperties":false,"description":"Tool usage permissions configuration.\\nSee https://code.claude.com/docs/en/permissions and https://code.claude.com/docs/en/settings#permission-settings\\nSee https://code.claude.com/docs/en/settings#tools-available-to-claude for full list of tools available to Claude.","examples":[{"allow":["Bash(git add:*)"],"ask":["Bash(gh pr create:*)","Bash(git commit:*)"],"deny":["Read(*.env)","Bash(rm:*)","Bash(curl:*)"],"defaultMode":"default"}]},"language":{"type":"string","description":"Preferred language for Claude's responses","examples":["japanese","spanish","french"]},"model":{"type":"string","enum":["opus","sonnet","haiku","default"],"description":"Override the default model used by Claude Code. Accepts a short alias (opus|sonnet|haiku) or a full model ID. For finer control, use environment variables: ANTHROPIC_MODEL (runtime override), ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_HAIKU_MODEL (per-class pinning), CLAUDE_CODE_SUBAGENT_MODEL (subagent model). See https://code.claude.com/docs/en/model-config"},"availableModels":{"type":"array","items":{"type":"string"},"description":"Restrict which models users can select. When defined at multiple settings levels (user, project, etc.), arrays are merged and deduplicated. See https://code.claude.com/docs/en/model-config#restrict-model-selection","examples":[["sonnet","haiku"]]},"modelOverrides":{"type":"object","additionalProperties":{"type":"string"},"description":"Map Anthropic model IDs to provider-specific model IDs such as Bedrock inference profile ARNs, Vertex AI version names, or Foundry deployment names. Each model picker entry uses its mapped value when calling the provider API. Unknown keys are ignored. See https://code.claude.com/docs/en/model-config#override-model-ids-per-version","examples":[{"claude-opus-4-6":"arn:aws:bedrock:us-east-2:123456789012:application-inference-profile/opus-prod"}]},"effortLevel":{"type":"string","enum":["low","medium","high"],"description":"Control Opus 4.6 adaptive reasoning effort. Lower effort is faster and cheaper for straightforward tasks, higher effort provides deeper reasoning. Defaults vary by model and plan (Opus 4.6 defaults to medium for Max and Team subscribers). Use /effort auto to reset to model default. Also configurable via CLAUDE_CODE_EFFORT_LEVEL environment variable. See https://code.claude.com/docs/en/model-config#adjust-effort-level"},"fastMode":{"type":"boolean","description":"Enable fast mode for Opus 4.6 (research preview). Fast mode uses the same model with 2.5x faster output at higher per-token cost. Requires extra usage enabled. Alternatively, toggle with /fast command. See https://code.claude.com/docs/en/fast-mode","default":false},"fastModePerSessionOptIn":{"type":"boolean","description":"Require per-session opt-in for fast mode. When true, fast mode does not persist across sessions and users must enable it with /fast each session. Useful for controlling costs. See https://code.claude.com/docs/en/fast-mode","default":false},"feedbackSurveyRate":{"type":"number","minimum":0,"maximum":1,"description":"Probability (0–1) that the session quality survey appears when eligible. A value of 0.05 means 5% of eligible sessions. See https://code.claude.com/docs/en/settings","examples":[0.05]},"editorMode":{"type":"string","enum":["normal","vim"],"default":"normal","description":"Editor input mode for the Claude Code terminal prompt. 'vim' enables modal editing (Esc for normal mode, i for insert). See https://code.claude.com/docs/en/settings"},"skillOverrides":{"type":"object","additionalProperties":{"type":"string","enum":["on","name-only","user-invocable-only","off"]},"description":"Per-skill availability override map. Keys are skill names; values are one of 'on' (default), 'name-only' (skill name listed but not auto-loaded), 'user-invocable-only' (load only when user explicitly invokes), or 'off' (hidden). Requires Claude Code v2.1.129+. See https://code.claude.com/docs/en/settings","examples":[{"playwright-debug":"user-invocable-only","init":"off"}]},"disableAgentView":{"type":"boolean","default":false,"description":"Disable the Agent View feature (read-only inspection of sub-agent activity). Useful when administering managed deployments. Requires Claude Code v2.1.139+. See https://code.claude.com/docs/en/settings"},"disableRemoteControl":{"type":"boolean","default":false,"description":"Block the \`claude remote-control\` channel that allows external clients to drive this Claude Code instance. Recommended default for shared/CI environments. Requires Claude Code v2.1.128+. See https://code.claude.com/docs/en/settings"},"enableAllProjectMcpServers":{"type":"boolean","description":"Whether to automatically approve all MCP servers in the project. See https://code.claude.com/docs/en/mcp","examples":[true]},"enabledMcpjsonServers":{"type":"array","items":{"type":"string","minLength":1},"description":"List of approved MCP servers from .mcp.json. See https://code.claude.com/docs/en/mcp","examples":[["memory","github"]]},"disabledMcpjsonServers":{"type":"array","items":{"type":"string","minLength":1},"description":"List of rejected MCP servers from .mcp.json. See https://code.claude.com/docs/en/mcp","examples":[["filesystem"]]},"allowedMcpServers":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"serverName":{"type":"string","pattern":"^[a-zA-Z0-9_-]+$","description":"Name of the MCP server that users are allowed to configure"}},"required":["serverName"],"additionalProperties":false},{"type":"object","properties":{"serverCommand":{"type":"array","items":{"type":"string"},"description":"Exact command and arguments used to start stdio servers"}},"required":["serverCommand"],"additionalProperties":false},{"type":"object","properties":{"serverUrl":{"type":"string","description":"URL pattern for remote servers, supports wildcards (e.g., https://*.example.com/*)"}},"required":["serverUrl"],"additionalProperties":false}]},"description":"Enterprise allowlist of MCP servers that can be used. Applies to all scopes including enterprise servers from managed-mcp.json. If undefined, all servers are allowed. If empty array, no servers are allowed. Denylist takes precedence - if a server is on both lists, it is denied. See https://code.claude.com/docs/en/mcp#restriction-options"},"deniedMcpServers":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"serverName":{"type":"string","pattern":"^[a-zA-Z0-9_-]+$","description":"Name of the MCP server that is explicitly blocked"}},"required":["serverName"],"additionalProperties":false},{"type":"object","properties":{"serverCommand":{"type":"array","items":{"type":"string"},"description":"Exact command and arguments used to start stdio servers"}},"required":["serverCommand"],"additionalProperties":false},{"type":"object","properties":{"serverUrl":{"type":"string","description":"URL pattern for remote servers, supports wildcards (e.g., https://*.example.com/*)"}},"required":["serverUrl"],"additionalProperties":false}]},"description":"Enterprise denylist of MCP servers that are explicitly blocked. If a server is on the denylist, it will be blocked across all scopes including enterprise. Denylist takes precedence over allowlist - if a server is on both lists, it is denied. See https://code.claude.com/docs/en/mcp#restriction-options"},"httpHookAllowedEnvVars":{"type":"array","items":{"type":"string","minLength":1},"description":"Allowlist of environment variable names HTTP hooks may interpolate into headers. When set, each hook's effective allowedEnvVars is the intersection with this list. Undefined = no restriction. Arrays merge across settings sources. See https://code.claude.com/docs/en/settings#hook-configuration","examples":[["MY_TOKEN","HOOK_SECRET"]]},"hooks":{"type":"object","additionalProperties":false,"description":"Custom commands to run before/after tool executions. See https://code.claude.com/docs/en/hooks","examples":[{"PostToolUse":[{"matcher":"Edit|Write","hooks":[{"type":"command","command":"prettier --write","timeout":5}]}]}],"properties":{"PreToolUse":{"type":"array","description":"Hooks that run before tool calls","items":{"$ref":"#/$defs/hookMatcher"}},"PostToolUse":{"type":"array","description":"Hooks that run after tool completion","items":{"$ref":"#/$defs/hookMatcher"}},"PostToolUseFailure":{"type":"array","description":"Hooks that run after a tool fails","items":{"$ref":"#/$defs/hookMatcher"}},"PermissionRequest":{"type":"array","description":"Hooks that run when a permission dialog appears","items":{"$ref":"#/$defs/hookMatcher"}},"Notification":{"type":"array","description":"Hooks that trigger on notifications","items":{"$ref":"#/$defs/hookMatcher"}},"UserPromptSubmit":{"type":"array","description":"Hooks that run when a user submits a prompt","items":{"$ref":"#/$defs/hookMatcher"}},"Stop":{"type":"array","description":"Hooks that run when agents finish responding. Does not run on user interrupt","items":{"$ref":"#/$defs/hookMatcher"}},"SubagentStart":{"type":"array","description":"Hooks that run when a subagent is spawned","items":{"$ref":"#/$defs/hookMatcher"}},"SubagentStop":{"type":"array","description":"Hooks that run when subagents finish responding","items":{"$ref":"#/$defs/hookMatcher"}},"PreCompact":{"type":"array","description":"Hooks that run before the context is compacted","items":{"$ref":"#/$defs/hookMatcher"}},"PostCompact":{"type":"array","description":"Hooks that run after the context is compacted. See https://code.claude.com/docs/en/hooks","items":{"$ref":"#/$defs/hookMatcher"}},"Elicitation":{"type":"array","description":"Hooks that run when an MCP server requests user input during a tool call. See https://code.claude.com/docs/en/hooks","items":{"$ref":"#/$defs/hookMatcher"}},"ElicitationResult":{"type":"array","description":"Hooks that run after a user responds to an MCP elicitation, before the response is sent back to the server. See https://code.claude.com/docs/en/hooks","items":{"$ref":"#/$defs/hookMatcher"}},"TeammateIdle":{"type":"array","description":"Hooks that run when an agent team teammate is about to go idle. Exit code 2 sends feedback and keeps the teammate working. Does not support matchers. Agent teams are experimental. See https://code.claude.com/docs/en/hooks#teammateidle","items":{"$ref":"#/$defs/hookMatcher"}},"TaskCompleted":{"type":"array","description":"Hooks that run when a task is being marked as completed. Exit code 2 prevents completion and sends feedback. Does not support matchers. See https://code.claude.com/docs/en/hooks#taskcompleted","items":{"$ref":"#/$defs/hookMatcher"}},"Setup":{"type":"array","description":"UNDOCUMENTED. Hooks that run during repository initialization (--init, --init-only) or maintenance (--maintenance)","items":{"$ref":"#/$defs/hookMatcher"}},"InstructionsLoaded":{"type":"array","description":"Hooks that run when a CLAUDE.md or .claude/rules/*.md file is loaded into context. Fires at session start and when files are lazily loaded (e.g., nested traversal, path glob match). No decision control; used for audit logging and observability. Does not support matchers. See https://code.claude.com/docs/en/hooks#instructionsloaded","items":{"$ref":"#/$defs/hookMatcher"}},"ConfigChange":{"type":"array","description":"Hooks that run when settings, managed settings, or skill files change during a session. Supports matchers: user_settings, project_settings, local_settings, policy_settings, skills. Command handlers only. Exit code 2 blocks the change (except policy_settings which is audit-only). See https://code.claude.com/docs/en/hooks#configchange","items":{"$ref":"#/$defs/hookMatcher"}},"WorktreeCreate":{"type":"array","description":"Hooks that run when a worktree is created via --worktree or isolation: \\"worktree\\" in subagents. Command handlers only, no matchers. Hook must print absolute path to created worktree on stdout; non-zero exit fails creation. See https://code.claude.com/docs/en/hooks#worktreecreate","items":{"$ref":"#/$defs/hookMatcher"}},"WorktreeRemove":{"type":"array","description":"Hooks that run when a worktree is being removed at session exit or when a subagent finishes. Command handlers only, no matchers. Used for cleanup tasks; cannot block removal. See https://code.claude.com/docs/en/hooks#worktreeremove","items":{"$ref":"#/$defs/hookMatcher"}},"SessionStart":{"type":"array","description":"Hooks that run when a new session starts","items":{"$ref":"#/$defs/hookMatcher"}},"SessionEnd":{"type":"array","description":"Hooks that run when a session ends","items":{"$ref":"#/$defs/hookMatcher"}}}},"disableAllHooks":{"type":"boolean","description":"Disable all hooks and statusLine execution. When true in managed settings, user and project-level disableAllHooks cannot override it. See https://code.claude.com/docs/en/hooks#disable-or-remove-hooks"},"allowedHttpHookUrls":{"type":"array","items":{"type":"string","minLength":1},"description":"Allowlist of URL patterns that HTTP hooks may target. Supports * as a wildcard. When set, hooks with non-matching URLs are blocked. Undefined = no restriction, empty array = block all HTTP hooks. Arrays merge across settings sources. See https://code.claude.com/docs/en/settings#hook-configuration","examples":[["https://hooks.example.com/*","http://localhost:*"]]},"allowManagedHooksOnly":{"type":"boolean","description":"(Managed settings only) Prevent loading of user, project, and plugin hooks. Only allows managed hooks and SDK hooks. See https://code.claude.com/docs/en/settings#hook-configuration"},"allowManagedPermissionRulesOnly":{"type":"boolean","description":"(Managed settings only) Prevent user and project settings from defining allow, ask, or deny permission rules. Only rules in managed settings apply. See https://code.claude.com/docs/en/settings#permission-settings"},"statusLine":{"type":"object","properties":{"type":{"type":"string","description":"The type of status line handler; must be set to \\"command\\" to run a custom shell script that receives JSON session data via stdin.","const":"command"},"command":{"type":"string","description":"A shell command or path to a script that displays session information (context usage, costs, git status, etc.) by reading JSON data from stdin and writing output to stdout. See https://code.claude.com/docs/en/statusline"},"padding":{"type":"number","description":"Optional number of extra horizontal spacing characters added to the status line content; defaults to 0."}},"required":["type","command"],"additionalProperties":false,"description":"Custom status line display configuration. See https://code.claude.com/docs/en/statusline","examples":[{"type":"command","command":"~/.claude/statusline.sh"}]},"fileSuggestion":{"type":"object","properties":{"type":{"type":"string","description":"The type of file suggestion handler; must be set to \\"command\\" to execute a custom shell script that generates file suggestions for the @ file picker.","const":"command"},"command":{"type":"string","description":"Shell command to execute for file suggestions"}},"required":["type","command"],"additionalProperties":false,"description":"Configure a custom script for @ file autocomplete. See https://code.claude.com/docs/en/settings#file-suggestion-settings","examples":[{"type":"command","command":"~/.claude/file-suggestion.sh"}]},"enabledPlugins":{"type":"object","additionalProperties":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"boolean"},{"not":{}}]},"description":"Enabled plugins using plugin-id@marketplace-id format. Example: { \\"formatter@anthropic-tools\\": true }. See https://code.claude.com/docs/en/plugins"},"extraKnownMarketplaces":{"type":"object","additionalProperties":{"type":"object","properties":{"source":{"anyOf":[{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"url"},"url":{"type":"string","format":"uri","description":"Direct URL to marketplace.json file"}},"required":["source","url"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"hostPattern"},"hostPattern":{"type":"string","description":"Git host pattern to trust for repositories in source specifications"}},"required":["source","hostPattern"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"github"},"repo":{"type":"string","description":"GitHub repository in owner/repo format"},"ref":{"type":"string","description":"Git branch or tag to use (e.g., \\"main\\", \\"v1.0.0\\"). Defaults to repository default branch."},"path":{"type":"string","description":"Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"}},"required":["source","repo"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"git"},"url":{"type":"string","pattern":"\\\\.git$","description":"Full git repository URL"},"ref":{"type":"string","description":"Git branch or tag to use (e.g., \\"main\\", \\"v1.0.0\\"). Defaults to repository default branch."},"path":{"type":"string","description":"Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)"}},"required":["source","url"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"npm"},"package":{"type":"string","description":"NPM package containing marketplace.json"}},"required":["source","package"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"file"},"path":{"type":"string","description":"Local file path to marketplace.json"}},"required":["source","path"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"directory"},"path":{"type":"string","description":"Local directory containing .claude-plugin/marketplace.json"}},"required":["source","path"],"additionalProperties":false}],"description":"Where to fetch the marketplace from"},"installLocation":{"type":"string","description":"Local cache path where marketplace manifest is stored (auto-generated if not provided)"}},"required":["source"],"additionalProperties":false},"description":"Additional marketplaces to make available for this repository. Typically used in repository .claude/settings.json to ensure team members have required plugin sources. See https://code.claude.com/docs/en/plugin-marketplaces"},"strictKnownMarketplaces":{"type":"array","description":"(Managed settings only) Allowlist of plugin marketplaces users can add. Undefined = no restrictions, empty array = lockdown. Uses exact matching for source specifications. See https://code.claude.com/docs/en/settings#strictknownmarketplaces","items":{"anyOf":[{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"hostPattern"},"hostPattern":{"type":"string","description":"Git host pattern to trust for repositories in source specifications"}},"required":["source","hostPattern"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"github"},"repo":{"type":"string","description":"GitHub repository in owner/repo format"},"ref":{"type":"string","description":"Git branch, tag, or SHA"},"path":{"type":"string","description":"Subdirectory path"}},"required":["source","repo"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"git"},"url":{"type":"string","description":"Full git repository URL"},"ref":{"type":"string","description":"Git branch, tag, or SHA"},"path":{"type":"string","description":"Subdirectory path"}},"required":["source","url"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"url"},"url":{"type":"string","format":"uri","description":"Direct URL to marketplace.json"},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"HTTP headers for authenticated access"}},"required":["source","url"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"npm"},"package":{"type":"string","description":"NPM package name (supports scoped packages)"}},"required":["source","package"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"file"},"path":{"type":"string","description":"Absolute path to marketplace.json file"}},"required":["source","path"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"directory"},"path":{"type":"string","description":"Absolute path to directory containing .claude-plugin/marketplace.json"}},"required":["source","path"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","description":"Identifies the marketplace source type","const":"pathPattern"},"pathPattern":{"type":"string","description":"Regex pattern to match file or directory paths for marketplace sources"}},"required":["source","pathPattern"],"additionalProperties":false}]},"examples":[[{"source":"github","repo":"acme-corp/approved-plugins"},{"source":"npm","package":"@acme-corp/compliance-plugins"}]]},"skippedMarketplaces":{"type":"array","items":{"type":"string","minLength":1},"description":"List of marketplace names the user has chosen not to install when prompted"},"skippedPlugins":{"type":"array","items":{"type":"string","minLength":1},"description":"List of plugin IDs (plugin@marketplace format) the user has chosen not to install when prompted"},"forceLoginMethod":{"type":"string","enum":["claudeai","console"],"description":"Force a specific login method: \\"claudeai\\" for Claude Pro/Max, \\"console\\" for Console billing","examples":["claudeai"]},"forceLoginOrgUUID":{"type":"string","description":"Organization UUID to use for OAuth login","examples":["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"],"minLength":1},"otelHeadersHelper":{"type":"string","description":"Path to a script that outputs OpenTelemetry headers","minLength":1},"outputStyle":{"type":"string","description":"Controls the output style for assistant responses. Built-in styles: default, Explanatory, Learning. Custom styles can be added in ~/.claude/output-styles/ or .claude/output-styles/. See https://code.claude.com/docs/en/output-styles","examples":["default","Explanatory","Learning"],"minLength":1},"skipWebFetchPreflight":{"type":"boolean","description":"Skip the WebFetch blocklist check for enterprise environments with restrictive security policies"},"sandbox":{"type":"object","description":"Sandbox execution configuration. See https://code.claude.com/docs/en/sandboxing","properties":{"network":{"type":"object","description":"Configures network isolation settings for the sandboxed bash environment, including domain restrictions, Unix socket access, and custom proxy configuration.","properties":{"allowUnixSockets":{"type":"array","items":{"type":"string"},"description":"Allow Unix domain sockets for local IPC (SSH agent, Docker, etc.). Provide an array of specific paths. Defaults to blocking if not specified"},"allowLocalBinding":{"type":"boolean","description":"Allow binding to local network addresses (e.g., localhost ports). Defaults to false if not specified"},"httpProxyPort":{"type":"integer","minimum":1,"maximum":65535,"description":"HTTP proxy port to use for network filtering. If not specified, a proxy server will be started automatically"},"socksProxyPort":{"type":"integer","minimum":1,"maximum":65535,"description":"SOCKS proxy port to use for network filtering. If not specified, a proxy server will be started automatically"},"allowAllUnixSockets":{"type":"boolean","description":"Allow all Unix domain socket connections. If true, this overrides allowUnixSockets"},"allowedDomains":{"type":"array","items":{"type":"string","minLength":1},"description":"Allowlist of network domains for sandboxed commands. Supports wildcard patterns like *.example.com"},"allowManagedDomainsOnly":{"type":"boolean","description":"(Managed settings only) Only allowedDomains and WebFetch(domain:...) allow rules from managed settings are respected. User, project, local, and flag settings domains are ignored. Denied domains are still respected from all sources. Non-allowed domains are automatically blocked without user prompts."}},"additionalProperties":false},"ignoreViolations":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"},"description":"List of filesystem paths to ignore sandbox violations for when this command pattern matches"},"description":"Map of command patterns to filesystem paths to ignore violations for. Use \\"*\\" to match all commands"},"excludedCommands":{"type":"array","items":{"type":"string"},"description":"Commands that should never run in the sandbox (e.g., [\\"git\\", \\"docker\\"])"},"autoAllowBashIfSandboxed":{"type":"boolean","description":"Automatically allow bash commands without prompting when they run in the sandbox. Only applies to commands that will run sandboxed.","default":true},"enableWeakerNetworkIsolation":{"type":"boolean","description":"macOS only. Allow access to the system TLS trust service (com.apple.trustd.agent) in the sandbox. Required for Go-based tools like gh, gcloud, and terraform to verify TLS certificates when using httpProxyPort with a MITM proxy and custom CA. Reduces security by opening a potential data exfiltration path. Default: false. See https://code.claude.com/docs/en/settings#sandbox-settings","default":false},"enableWeakerNestedSandbox":{"type":"boolean","description":"Enable weaker sandbox mode for unprivileged docker environments where --proc mounting fails. This significantly reduces the strength of the sandbox and should only be used when this risk is acceptable.Default: false (secure)."},"allowUnsandboxedCommands":{"type":"boolean","description":"Allow commands to run outside the sandbox via the dangerouslyDisableSandbox parameter. When false, the dangerouslyDisableSandbox parameter is completely ignored and all commands must run sandboxed. Default: true."},"enabled":{"type":"boolean","description":"Enable sandboxed bash"},"filesystem":{"type":"object","description":"Filesystem access control for sandboxed commands. See https://code.claude.com/docs/en/sandboxing#filesystem-isolation","properties":{"allowWrite":{"type":"array","items":{"type":"string","minLength":1},"description":"Paths where subprocesses are allowed to write. Supports prefixes: // (absolute), ~/ (home directory), / (relative to settings file), ./ or no prefix (relative path)"},"denyWrite":{"type":"array","items":{"type":"string","minLength":1},"description":"Paths where subprocesses are explicitly denied write access. Takes precedence over allowWrite"},"denyRead":{"type":"array","items":{"type":"string","minLength":1},"description":"Paths where subprocesses are explicitly denied read access"},"allowRead":{"type":"array","items":{"type":"string","minLength":1},"description":"Paths to re-allow reading within denyRead regions. Takes precedence over denyRead for matching paths"},"allowManagedReadPathsOnly":{"type":"boolean","description":"When true (managed settings only), only allowRead paths from managed settings are used"}},"additionalProperties":false}},"additionalProperties":false},"spinnerVerbs":{"type":"object","description":"Customize the verbs shown in spinner progress messages","properties":{"mode":{"type":"string","enum":["append","replace"],"description":"How to combine custom verbs with default spinner verbs: 'append' adds custom verbs to the default list, 'replace' uses only custom verbs"},"verbs":{"type":"array","items":{"type":"string","minLength":1},"minItems":1,"description":"Custom verbs used in spinner progress text"}},"required":["verbs"],"additionalProperties":false},"spinnerTipsEnabled":{"type":"boolean","description":"Show tips in the spinner while Claude is working. Set to false to disable tips (default: true)","default":true},"spinnerTipsOverride":{"type":"object","description":"Customize the tips displayed in the spinner while Claude is working. See https://code.claude.com/docs/en/settings#available-settings","properties":{"excludeDefault":{"type":"boolean","description":"If true, only show custom tips. If false or absent, custom tips merge with built-in tips","default":false},"tips":{"type":"array","items":{"type":"string","minLength":1},"description":"Custom tip strings to display in the spinner","minItems":1}},"required":["tips"],"additionalProperties":false},"terminalProgressBarEnabled":{"type":"boolean","description":"Enable the terminal progress bar that shows progress in supported terminals like Windows Terminal and iTerm2 (default: true)","default":true},"showTurnDuration":{"type":"boolean","description":"Show turn duration messages after responses (e.g., \\"Cooked for 1m 6s\\"). Set to false to hide these messages (default: true)","default":true},"prefersReducedMotion":{"type":"boolean","description":"Reduce or disable UI animations (spinners, shimmer, flash effects) for accessibility","default":false},"alwaysThinkingEnabled":{"type":"boolean","description":"Enable extended thinking by default for all sessions. Typically configured via the /config command rather than editing directly. See https://code.claude.com/docs/en/common-workflows#use-extended-thinking-thinking-mode"},"companyAnnouncements":{"type":"array","items":{"type":"string","minLength":1},"description":"Company announcements to display at startup (one will be randomly selected if multiple are provided)"},"teammateMode":{"type":"string","enum":["auto","in-process","tmux"],"description":"How agent team teammates display: \\"auto\\" picks split panes in tmux or iTerm2, in-process otherwise. Agent teams are experimental and disabled by default. Enable them by adding CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS to your settings.json or environment. See https://code.claude.com/docs/en/agent-teams","default":"auto"},"worktree":{"type":"object","additionalProperties":false,"description":"Configuration for --worktree sessions. See https://code.claude.com/docs/en/settings","properties":{"sparsePaths":{"type":"array","items":{"type":"string","minLength":1},"description":"Directories to check out in each worktree via git sparse-checkout (cone mode). Only the listed paths are written to disk, which is faster in large monorepos.","examples":[["packages/my-app","shared/utils"]]}}},"pluginTrustMessage":{"type":"string","description":"(Managed settings only) Custom message appended to the plugin trust warning shown before installation. Use to provide organization-specific context about approved plugins. See https://code.claude.com/docs/en/settings#plugin-settings","minLength":1},"pluginConfigs":{"type":"object","additionalProperties":{"type":"object","properties":{"mcpServers":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{"type":"string"}}]}},"description":"User configuration values for MCP servers keyed by server name"}},"additionalProperties":false},"description":"Per-plugin configuration including MCP server user configs, keyed by plugin ID (plugin@marketplace format). See https://code.claude.com/docs/en/plugins"},"allowManagedMcpServersOnly":{"type":"boolean","description":"(Managed settings only) Only allowedMcpServers from managed settings are respected. deniedMcpServers still merges from all sources. Users can still add their own MCP servers, but only the admin-defined allowlist applies."},"blockedMarketplaces":{"type":"array","description":"(Managed settings only) Blocklist of marketplace sources. These exact sources are blocked from being added as marketplaces. The check happens before downloading, so blocked sources never touch the filesystem.","items":{"anyOf":[{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"url","description":"Block marketplace fetched from direct URL"},"url":{"type":"string","format":"uri","description":"Direct URL to marketplace.json file"},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"Custom HTTP headers (e.g., for authentication)"}},"required":["source","url"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"github","description":"Block marketplace from GitHub repository"},"repo":{"type":"string","description":"GitHub repository in owner/repo format"},"ref":{"type":"string","description":"Git branch or tag to use"},"path":{"type":"string","description":"Path to marketplace.json within repo"}},"required":["source","repo"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"git","description":"Block marketplace from git repository URL"},"url":{"type":"string","pattern":".*\\\\.git$","description":"Full git repository URL"},"ref":{"type":"string","description":"Git branch or tag to use"},"path":{"type":"string","description":"Path to marketplace.json within repo"}},"required":["source","url"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"npm","description":"Block marketplace from NPM package"},"package":{"type":"string","description":"NPM package containing marketplace.json"}},"required":["source","package"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"file","description":"Block marketplace from local file"},"path":{"type":"string","description":"Local file path to marketplace.json"}},"required":["source","path"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"directory","description":"Block marketplace from local directory"},"path":{"type":"string","description":"Local directory containing .claude-plugin/marketplace.json"}},"required":["source","path"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"hostPattern","description":"Block marketplace by host pattern matching"},"hostPattern":{"type":"string","description":"Regex pattern to match the host/domain extracted from any marketplace source type"}},"required":["source","hostPattern"]},{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","const":"pathPattern","description":"Block marketplace by file/directory path pattern matching"},"pathPattern":{"type":"string","description":"Regex pattern to match file or directory paths for marketplace sources"}},"required":["source","pathPattern"]}]}}}`),Q="Claude Code Settings",ee={$schema:W,$id:K,$defs:J,description:V,allowTrailingCommas:z,additionalProperties:Y,type:Z,properties:X,title:Q};function te(e){const t=e??{},r={...t.$defs??{},...t.definitions??{}},n=s=>{if(!s)return{};if(!s.$ref)return f(s);const a=/^#\/(\$defs|definitions)\/(.+)$/.exec(s.$ref);if(!a)return f(s);const u=r[a[2]];return u?n({...u,...d(s)}):f(s)},m=new Set(["__proto__","constructor","prototype"]),c=s=>{if(!s)return{};const a={};for(const[u,p]of Object.entries(s))m.has(u)||(a[u]=p);return a},f=s=>{if(!s.allOf||s.allOf.length===0)return s;const a={...s};delete a.allOf;for(const u of s.allOf){const p=n(u);Object.assign(a,{properties:{...c(a.properties),...c(p.properties)},required:se([...a.required??[],...p.required??[]])}),!a.description&&p.description&&(a.description=p.description),a.default===void 0&&p.default!==void 0&&(a.default=p.default),!a.type&&p.type&&(a.type=p.type)}return a},d=s=>{const{$ref:a,...u}=s;return u},l=(s,a)=>{let u=n(s);for(const p of a){if(!u)return null;if(/^\d+$/.test(p)){const v=Array.isArray(u.items)?u.items[Number(p)]:u.items;u=v?n(v):null;continue}const k=u.properties;if(k&&!m.has(p)&&p in k){u=n(k[p]);continue}const y=u.additionalProperties;if(y&&typeof y=="object"){u=n(y);continue}return null}return u},g=(s,a,u)=>{if(!s)return null;const p={};if(s.description&&(p.description=s.description),s.type&&(p.type=s.type),s.default!==void 0&&(p.default=s.default),s.enum&&(p.enum=s.enum),s.const!==void 0&&(p.const=s.const),s.deprecated&&(p.deprecated=!0),s.examples&&(p.examples=s.examples),s.properties&&(p.knownChildren=Object.keys(s.properties)),u&&(a!=null&&a.includes(u))&&(p.required=!0),s.items&&!Array.isArray(s.items)){const k=n(s.items),y=g(k,void 0,null);y&&(p.itemsInfo=y)}return(s.additionalProperties===!0||typeof s.additionalProperties=="object")&&(p.open=!0),p},i=s=>a=>{if(a.length===0)return g(n(s),void 0,null);const u=l(s,a.slice(0,-1));if(!u)return null;const p=a[a.length-1],k=l(u,[p]);return g(k,u.required,p)},b=s=>{const a=n(s);return Object.keys(a.properties??{})},h=s=>({at:i(s),rootKeys:()=>b(s),rootedAt:a=>{const u=l(s,a);return h(u??{})}});return h(t)}function se(e){return Array.from(new Set(e))}let A=null;function ce(){return A||(A=te(ee)),A}export{re as E,ce as a,B as g,ne as m,ae as p,G as s,ie as u};
|
package/dist/index.html
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
8
8
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
9
9
|
<link href="https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;0,6..72,700;1,6..72,400&family=Geist:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap" rel="stylesheet">
|
|
10
|
-
<script type="module" crossorigin src="./assets/index-
|
|
10
|
+
<script type="module" crossorigin src="./assets/index-Ddrw7J7O.js"></script>
|
|
11
11
|
<link rel="modulepreload" crossorigin href="./assets/monaco-editor-BW5C4Iv1.js">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="./assets/monaco-editor-BTnBOi8r.css">
|
|
13
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
13
|
+
<link rel="stylesheet" crossorigin href="./assets/index-CMLnzdZC.css">
|
|
14
14
|
</head>
|
|
15
15
|
<body class="bg-bg text-fg font-sans antialiased">
|
|
16
16
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-session-manager",
|
|
3
|
-
"version": "0.75.
|
|
3
|
+
"version": "0.75.2",
|
|
4
4
|
"description": "Local cockpit for the Claude Code CLI — multi-tab terminal, full config surface, scheduler, voice dictation, and live observability.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/main/index.cjs",
|
|
@@ -144,13 +144,19 @@ const TOOLS = [
|
|
|
144
144
|
name: 'scheduler_list_prds',
|
|
145
145
|
description: "THE ONLY SUPPORTED WAY to list scheduled PRDs (live + archived) via the session-manager app's admin API. "
|
|
146
146
|
+ 'Each entry includes its real job status (pending/running/completed/failed/needs_review, or null if not yet '
|
|
147
|
-
+ 'queued/reconciled). Optionally filter by project cwd, Epic id, and/or status.'
|
|
147
|
+
+ 'queued/reconciled). Optionally filter by project cwd, Epic id, and/or status. Results are paginated (default '
|
|
148
|
+
+ 'limit 100, max 500) sorted by slug ascending — check `hasMore`/`total` in the response before assuming you '
|
|
149
|
+
+ "received every PRD; page further with `offset`. Default fields are compact (no parallelGroup/estimateMinutes/"
|
|
150
|
+
+ 'sourcePromptId/epicId/archivedStatus) — pass fields:"full" to restore them.',
|
|
148
151
|
inputSchema: {
|
|
149
152
|
type: 'object',
|
|
150
153
|
properties: {
|
|
151
154
|
cwd: { type: 'string', description: 'Optional: only PRDs targeting this project cwd' },
|
|
152
155
|
epicId: { type: 'string', description: 'Optional: only PRDs belonging to this Epic id' },
|
|
153
156
|
status: { type: 'string', description: 'Optional: only PRDs whose job status equals this value' },
|
|
157
|
+
limit: { type: 'number', description: 'Optional: page size, default 100, max 500' },
|
|
158
|
+
offset: { type: 'number', description: 'Optional: page offset, default 0' },
|
|
159
|
+
fields: { type: 'string', enum: ['compact', 'full'], description: 'Optional: "full" restores secondary detail fields; default "compact"' },
|
|
154
160
|
},
|
|
155
161
|
},
|
|
156
162
|
},
|
|
@@ -353,8 +359,17 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
353
359
|
if (args?.cwd) qs.set('cwd', args.cwd);
|
|
354
360
|
if (args?.epicId) qs.set('epicId', args.epicId);
|
|
355
361
|
if (args?.status) qs.set('status', args.status);
|
|
362
|
+
if (args?.limit !== undefined) qs.set('limit', String(args.limit));
|
|
363
|
+
if (args?.offset !== undefined) qs.set('offset', String(args.offset));
|
|
364
|
+
if (args?.fields) qs.set('fields', args.fields);
|
|
356
365
|
const suffix = qs.toString() ? `?${qs.toString()}` : '';
|
|
357
366
|
const result = await adminRequest('GET', `/admin/scheduler/prds${suffix}`);
|
|
367
|
+
// Surface hasMore/total up front so an agent can't mistake a partial
|
|
368
|
+
// page for the full list (the 353KB/120s-timeout incident this
|
|
369
|
+
// pagination exists to fix).
|
|
370
|
+
if (result?.ok && result.hasMore) {
|
|
371
|
+
result.note = `partial list: returned ${result.prds.length} of ${result.total} PRDs (offset ${result.offset}, limit ${result.limit}) — pass a higher offset to see more`;
|
|
372
|
+
}
|
|
358
373
|
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
359
374
|
}
|
|
360
375
|
if (name === 'scheduler_get_prd') {
|
|
@@ -139,7 +139,107 @@ test('GET /admin/scheduler/prds lists a live PRD with status null (no queue row
|
|
|
139
139
|
const entry = res.json.prds.find((p) => p.slug === slug);
|
|
140
140
|
expect(entry).toBeTruthy();
|
|
141
141
|
expect(entry.status).toBe(null);
|
|
142
|
+
} finally {
|
|
143
|
+
await admin.stop();
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
test('GET /admin/scheduler/prds defaults to limit=100/offset=0, reports total/hasMore, omits secondary fields', async () => {
|
|
148
|
+
const cwd = projectCwd();
|
|
149
|
+
const epicId = 'epic-list-defaults';
|
|
150
|
+
const slug = uniqueSlug('list-prds-defaults');
|
|
151
|
+
await writePrdFixture({ cwd, epicId, slug });
|
|
152
|
+
|
|
153
|
+
const { admin, port, token } = await startAdmin();
|
|
154
|
+
try {
|
|
155
|
+
const res = await request(port, { path: `/admin/scheduler/prds?cwd=${encodeURIComponent(cwd)}`, token });
|
|
156
|
+
expect(res.status).toBe(200);
|
|
157
|
+
expect(res.json.ok).toBe(true);
|
|
158
|
+
expect(res.json.limit).toBe(100);
|
|
159
|
+
expect(res.json.offset).toBe(0);
|
|
160
|
+
expect(res.json.total).toBe(res.json.prds.length);
|
|
161
|
+
expect(res.json.hasMore).toBe(false);
|
|
162
|
+
const entry = res.json.prds.find((p) => p.slug === slug);
|
|
163
|
+
expect(entry).toBeTruthy();
|
|
164
|
+
expect('epicId' in entry).toBe(false);
|
|
165
|
+
expect('sourcePromptId' in entry).toBe(false);
|
|
166
|
+
} finally {
|
|
167
|
+
await admin.stop();
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
test('GET /admin/scheduler/prds?fields=full restores secondary fields', async () => {
|
|
172
|
+
const cwd = projectCwd();
|
|
173
|
+
const epicId = 'epic-list-full';
|
|
174
|
+
const slug = uniqueSlug('list-prds-full');
|
|
175
|
+
await writePrdFixture({ cwd, epicId, slug });
|
|
176
|
+
|
|
177
|
+
const { admin, port, token } = await startAdmin();
|
|
178
|
+
try {
|
|
179
|
+
const res = await request(port, { path: `/admin/scheduler/prds?cwd=${encodeURIComponent(cwd)}&fields=full`, token });
|
|
180
|
+
expect(res.status).toBe(200);
|
|
181
|
+
const entry = res.json.prds.find((p) => p.slug === slug);
|
|
142
182
|
expect(entry.epicId).toBe(epicId);
|
|
183
|
+
expect(entry.sourcePromptId).toBeTruthy();
|
|
184
|
+
} finally {
|
|
185
|
+
await admin.stop();
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
test('GET /admin/scheduler/prds pages disjointly by limit/offset in stable slug order', async () => {
|
|
190
|
+
const cwd = projectCwd();
|
|
191
|
+
const epicId = 'epic-list-paged';
|
|
192
|
+
const base = uniqueSlug('list-prds-paged');
|
|
193
|
+
const slugs = [];
|
|
194
|
+
for (let i = 0; i < 5; i++) {
|
|
195
|
+
const slug = `${base}-${i}`;
|
|
196
|
+
slugs.push(slug);
|
|
197
|
+
await writePrdFixture({ cwd, epicId, slug });
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const { admin, port, token } = await startAdmin();
|
|
201
|
+
try {
|
|
202
|
+
const qs = `cwd=${encodeURIComponent(cwd)}&epicId=${encodeURIComponent(epicId)}`;
|
|
203
|
+
const page1 = await request(port, { path: `/admin/scheduler/prds?${qs}&limit=2&offset=0`, token });
|
|
204
|
+
const page2 = await request(port, { path: `/admin/scheduler/prds?${qs}&limit=2&offset=2`, token });
|
|
205
|
+
const page3 = await request(port, { path: `/admin/scheduler/prds?${qs}&limit=2&offset=4`, token });
|
|
206
|
+
|
|
207
|
+
expect(page1.json.prds).toHaveLength(2);
|
|
208
|
+
expect(page1.json.total).toBe(5);
|
|
209
|
+
expect(page1.json.hasMore).toBe(true);
|
|
210
|
+
expect(page2.json.prds).toHaveLength(2);
|
|
211
|
+
expect(page2.json.hasMore).toBe(true);
|
|
212
|
+
expect(page3.json.prds).toHaveLength(1);
|
|
213
|
+
expect(page3.json.hasMore).toBe(false);
|
|
214
|
+
|
|
215
|
+
const seenSlugs = [...page1.json.prds, ...page2.json.prds, ...page3.json.prds].map((p) => p.slug);
|
|
216
|
+
expect(new Set(seenSlugs).size).toBe(5);
|
|
217
|
+
const expectedOrder = [...seenSlugs].sort((a, b) => a.localeCompare(b, undefined, { numeric: true }));
|
|
218
|
+
expect(seenSlugs).toEqual(expectedOrder);
|
|
219
|
+
} finally {
|
|
220
|
+
await admin.stop();
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
test('GET /admin/scheduler/prds rejects limit over the hard max with a 400', async () => {
|
|
225
|
+
const cwd = projectCwd();
|
|
226
|
+
const { admin, port, token } = await startAdmin();
|
|
227
|
+
try {
|
|
228
|
+
const res = await request(port, { path: `/admin/scheduler/prds?cwd=${encodeURIComponent(cwd)}&limit=501`, token });
|
|
229
|
+
expect(res.status).toBe(400);
|
|
230
|
+
expect(res.json.ok).toBe(false);
|
|
231
|
+
} finally {
|
|
232
|
+
await admin.stop();
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
test('GET /admin/scheduler/prds rejects a negative offset with a 400', async () => {
|
|
237
|
+
const cwd = projectCwd();
|
|
238
|
+
const { admin, port, token } = await startAdmin();
|
|
239
|
+
try {
|
|
240
|
+
const res = await request(port, { path: `/admin/scheduler/prds?cwd=${encodeURIComponent(cwd)}&offset=-1`, token });
|
|
241
|
+
expect(res.status).toBe(400);
|
|
242
|
+
expect(res.json.ok).toBe(false);
|
|
143
243
|
} finally {
|
|
144
244
|
await admin.stop();
|
|
145
245
|
}
|
|
@@ -91,6 +91,13 @@ test('partitionJobs: running and pending jobs never archive, regardless of age',
|
|
|
91
91
|
expect(hot.map((j) => j.slug).sort()).toEqual(['04-running', '05-pending']);
|
|
92
92
|
});
|
|
93
93
|
|
|
94
|
+
test('partitionJobs: old skipped job archives (never-ran rows must age out of the hot queue too)', () => {
|
|
95
|
+
const j = old({ slug: '03b-old-skipped', status: 'skipped', runId: 'run-3b' });
|
|
96
|
+
const { hot, toArchive } = queueHistory.partitionJobs([j], NOW);
|
|
97
|
+
expect(hot).toEqual([]);
|
|
98
|
+
expect(toArchive.map((x) => x.slug)).toEqual(['03b-old-skipped']);
|
|
99
|
+
});
|
|
100
|
+
|
|
94
101
|
test('partitionJobs: needs_review jobs never archive', () => {
|
|
95
102
|
const j = old({ slug: '06-review', status: 'needs_review', runId: 'run-6' });
|
|
96
103
|
const { hot, toArchive } = queueHistory.partitionJobs([j], NOW);
|
|
@@ -44,7 +44,7 @@ function validJob(overrides = {}) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
test('JOB_STATUSES matches ScheduleJobStatus', () => {
|
|
47
|
-
expect(JOB_STATUSES).toEqual(['pending', 'running', 'investigating', 'completed', 'failed', 'needs_review', 'quarantined']);
|
|
47
|
+
expect(JOB_STATUSES).toEqual(['pending', 'running', 'investigating', 'completed', 'skipped', 'failed', 'needs_review', 'quarantined']);
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
test('a valid full job record parses', () => {
|
|
@@ -39,7 +39,7 @@ function extractQuotedList(source, anchorRegex) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
test('JOB_STATUSES is the expected canonical list', () => {
|
|
42
|
-
expect(JOB_STATUSES).toEqual(['pending', 'running', 'investigating', 'completed', 'failed', 'needs_review', 'quarantined']);
|
|
42
|
+
expect(JOB_STATUSES).toEqual(['pending', 'running', 'investigating', 'completed', 'skipped', 'failed', 'needs_review', 'quarantined']);
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
function sorted(list) {
|
|
@@ -109,6 +109,7 @@ test('LEGAL_TRANSITIONS covers every real scheduler.cjs edge', () => {
|
|
|
109
109
|
['running', 'completed'],
|
|
110
110
|
['running', 'failed'],
|
|
111
111
|
['running', 'needs_review'],
|
|
112
|
+
['running', 'skipped'],
|
|
112
113
|
['running', 'pending'],
|
|
113
114
|
['investigating', 'failed'],
|
|
114
115
|
['investigating', 'needs_review'],
|
|
@@ -120,12 +121,35 @@ test('LEGAL_TRANSITIONS covers every real scheduler.cjs edge', () => {
|
|
|
120
121
|
['needs_review', 'pending'],
|
|
121
122
|
['needs_review', 'completed'],
|
|
122
123
|
['completed', 'pending'],
|
|
124
|
+
['skipped', 'pending'],
|
|
123
125
|
];
|
|
124
126
|
for (const [from, to] of mustBeLegal) {
|
|
125
127
|
expect(LEGAL_TRANSITIONS[from]).toContain(to);
|
|
126
128
|
}
|
|
127
129
|
});
|
|
128
130
|
|
|
131
|
+
test('running -> skipped is legal (a job whose PRD source vanished before dispatch never ran)', () => {
|
|
132
|
+
const slug = uniqueSlug('skip');
|
|
133
|
+
const job = { slug, cwd: '/tmp/proj', status: 'running' };
|
|
134
|
+
|
|
135
|
+
const ok = transitionJob(job, 'skipped', { reason: 'PRD source no longer exists on disk', source: 'spawnJob:skip-archived' });
|
|
136
|
+
|
|
137
|
+
expect(ok).toBe(true);
|
|
138
|
+
expect(job.status).toBe('skipped');
|
|
139
|
+
expect(job.statusHistory[0]).toMatchObject({ from: 'running', to: 'skipped' });
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
test('skipped is terminal: no transitions out except the explicit pending reset', () => {
|
|
143
|
+
expect(LEGAL_TRANSITIONS.skipped).toEqual(['pending']);
|
|
144
|
+
const slug = uniqueSlug('skip-terminal');
|
|
145
|
+
const job = { slug, cwd: '/tmp/proj', status: 'skipped' };
|
|
146
|
+
expect(transitionJob(job, 'running', { reason: 'nope', source: 'test' })).toBe(false);
|
|
147
|
+
expect(transitionJob(job, 'completed', { reason: 'nope', source: 'test' })).toBe(false);
|
|
148
|
+
expect(job.status).toBe('skipped');
|
|
149
|
+
expect(transitionJob(job, 'pending', { reason: 'reset', source: 'test' })).toBe(true);
|
|
150
|
+
expect(job.status).toBe('pending');
|
|
151
|
+
});
|
|
152
|
+
|
|
129
153
|
test('a genuinely nonsensical edge (completed -> running) is illegal', () => {
|
|
130
154
|
expect(LEGAL_TRANSITIONS.completed).not.toContain('running');
|
|
131
155
|
const slug = uniqueSlug('nonsense');
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scheduler-clear-queue-history.test.cjs — schedule:clear-queue must never
|
|
3
|
+
* drop a job row with zero audit trail. Before this PRD, the handler did
|
|
4
|
+
* `s.jobs = s.jobs.filter(...)` straight over every non-running victim with
|
|
5
|
+
* no history.jsonl write at all — a queue row (e.g. the 2026-08-30 sigma
|
|
6
|
+
* `788-pr-sweep-final-gate` incident) could vanish leaving no trace anywhere.
|
|
7
|
+
*
|
|
8
|
+
* Exercises `applyClearQueueVictims` (the core mutation extracted from the
|
|
9
|
+
* `schedule:clear-queue` IPC handler so it's testable without ipcMain/
|
|
10
|
+
* electron) directly against a synthetic state, then feeds its output
|
|
11
|
+
* through the REAL `queueHistory.appendHistory`. Job fixtures carry a real
|
|
12
|
+
* absolute `cwd` under a per-test mkdtemp dir (never the live operations
|
|
13
|
+
* root) because appendHistory routes each entry to its OWN project's
|
|
14
|
+
* `<cwd>/session-manager-operations/scheduler/state/history.jsonl` shard
|
|
15
|
+
* whenever the entry has a `cwd` — SM_HISTORY_PATH_OVERRIDE only affects
|
|
16
|
+
* cwd-less entries, and the AC here requires every entry to carry a cwd.
|
|
17
|
+
*
|
|
18
|
+
* Run: timeout 120 npx vitest run src/main/__tests__/scheduler-clear-queue-history.test.cjs
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
'use strict';
|
|
22
|
+
|
|
23
|
+
import { test, expect, beforeEach, afterEach } from 'vitest';
|
|
24
|
+
const fs = require('node:fs');
|
|
25
|
+
const os = require('node:os');
|
|
26
|
+
const path = require('node:path');
|
|
27
|
+
|
|
28
|
+
const queueHistory = require('../lib/queueHistory.cjs');
|
|
29
|
+
const { projectHistoryPath } = require('../lib/queueStore.cjs');
|
|
30
|
+
const scheduler = require('../scheduler.cjs');
|
|
31
|
+
|
|
32
|
+
let tmpCwd;
|
|
33
|
+
|
|
34
|
+
beforeEach(() => {
|
|
35
|
+
tmpCwd = fs.mkdtempSync(path.join(os.tmpdir(), 'sm-clear-queue-history-'));
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
afterEach(() => {
|
|
39
|
+
fs.rmSync(tmpCwd, { recursive: true, force: true });
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
function pendingJob(slug, overrides = {}) {
|
|
43
|
+
return { slug, cwd: tmpCwd, status: 'pending', runId: null, finishedAt: null, ...overrides };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function historyPath() {
|
|
47
|
+
return projectHistoryPath(tmpCwd);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function readHistoryRows() {
|
|
51
|
+
const text = fs.readFileSync(historyPath(), 'utf8').trim();
|
|
52
|
+
return text ? text.split('\n').map((l) => JSON.parse(l)) : [];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
test('applyClearQueueVictims transitions N pending jobs to skipped, drops them from state.jobs, and appendHistory writes N rows with source clear-queue', async () => {
|
|
56
|
+
const jobs = [pendingJob('101-a'), pendingJob('102-b'), pendingJob('103-c')];
|
|
57
|
+
const running = { slug: '104-running', cwd: tmpCwd, status: 'running', runId: 'run-104', finishedAt: null };
|
|
58
|
+
const state = { jobs: [...jobs, running] };
|
|
59
|
+
const victimSlugs = new Set(jobs.map((j) => j.slug));
|
|
60
|
+
const archiveNoteBySlug = new Map(jobs.map((j) => [j.slug, 'PRD file archived to /fake/archive/dir']));
|
|
61
|
+
|
|
62
|
+
const historyEntries = scheduler.applyClearQueueVictims(state, victimSlugs, archiveNoteBySlug, '/fake/archive/dir');
|
|
63
|
+
|
|
64
|
+
// Running job is untouched, exempt from clear-queue, and got no history row.
|
|
65
|
+
expect(state.jobs.map((j) => j.slug)).toEqual(['104-running']);
|
|
66
|
+
expect(historyEntries.map((e) => e.slug).sort()).toEqual(['101-a', '102-b', '103-c']);
|
|
67
|
+
for (const entry of historyEntries) {
|
|
68
|
+
expect(entry.status).toBe('skipped'); // NEVER 'completed' — a manually cleared job did not ship
|
|
69
|
+
expect(entry.cwd).toBe(tmpCwd);
|
|
70
|
+
expect(entry.finishedAt).toBeTruthy();
|
|
71
|
+
const last = entry.statusHistory[entry.statusHistory.length - 1];
|
|
72
|
+
expect(last.source).toBe('clear-queue');
|
|
73
|
+
expect(last.reason).toContain('/fake/archive/dir');
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const { appended } = await queueHistory.appendHistory(historyEntries);
|
|
77
|
+
expect(appended).toBe(3);
|
|
78
|
+
const onDisk = readHistoryRows();
|
|
79
|
+
expect(onDisk.length).toBe(3);
|
|
80
|
+
expect(onDisk.every((e) => e.status === 'skipped')).toBe(true);
|
|
81
|
+
expect(onDisk.every((e) => e.statusHistory.at(-1).source === 'clear-queue')).toBe(true);
|
|
82
|
+
|
|
83
|
+
// queue.json (state.jobs, what writeQueue serializes) no longer lists them.
|
|
84
|
+
expect(state.jobs.some((j) => victimSlugs.has(j.slug))).toBe(false);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test('running jobs are exempt from clear-queue and never appear in the returned history entries', () => {
|
|
88
|
+
const running = { slug: '201-running', cwd: tmpCwd, status: 'running', runId: 'run-201', finishedAt: null };
|
|
89
|
+
const state = { jobs: [running] };
|
|
90
|
+
const victimSlugs = new Set(); // schedule:clear-queue never includes running jobs as victims
|
|
91
|
+
|
|
92
|
+
const historyEntries = scheduler.applyClearQueueVictims(state, victimSlugs, new Map(), '/fake/archive/dir');
|
|
93
|
+
|
|
94
|
+
expect(historyEntries).toEqual([]);
|
|
95
|
+
expect(state.jobs).toEqual([running]);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test('a victim already terminal (completed) keeps its real status, not skipped, but still gets a clear-queue history row', () => {
|
|
99
|
+
const completed = { slug: '301-done', cwd: tmpCwd, status: 'completed', runId: 'run-301', finishedAt: '2026-08-29T00:00:00.000Z', statusHistory: [] };
|
|
100
|
+
const state = { jobs: [completed] };
|
|
101
|
+
const victimSlugs = new Set(['301-done']);
|
|
102
|
+
|
|
103
|
+
const historyEntries = scheduler.applyClearQueueVictims(state, victimSlugs, new Map(), '/fake/archive/dir');
|
|
104
|
+
|
|
105
|
+
expect(state.jobs).toEqual([]);
|
|
106
|
+
expect(historyEntries.length).toBe(1);
|
|
107
|
+
expect(historyEntries[0].status).toBe('completed'); // real outcome preserved, not overwritten to skipped
|
|
108
|
+
const last = historyEntries[0].statusHistory.at(-1);
|
|
109
|
+
expect(last.source).toBe('clear-queue');
|
|
110
|
+
expect(last.from).toBe('completed');
|
|
111
|
+
expect(last.to).toBe('completed');
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test('appendHistory dedupe: clearing an already-cleared queue twice does not double-write rows', async () => {
|
|
115
|
+
const jobs = [pendingJob('401-x'), pendingJob('402-y')];
|
|
116
|
+
const state = { jobs: [...jobs] };
|
|
117
|
+
const victimSlugs = new Set(jobs.map((j) => j.slug));
|
|
118
|
+
|
|
119
|
+
const historyEntries = scheduler.applyClearQueueVictims(state, victimSlugs, new Map(), '/fake/archive/dir');
|
|
120
|
+
expect(state.jobs).toEqual([]);
|
|
121
|
+
|
|
122
|
+
const r1 = await queueHistory.appendHistory(historyEntries);
|
|
123
|
+
expect(r1.appended).toBe(2);
|
|
124
|
+
|
|
125
|
+
// A crash-replay of the SAME batch through appendHistory (the dedupe
|
|
126
|
+
// queueHistory itself guards against) must not double-write — this is
|
|
127
|
+
// what protects a second clear-queue pass, or a retry after a crash
|
|
128
|
+
// between the mutate() and appendHistory calls, from duplicating rows.
|
|
129
|
+
const r2 = await queueHistory.appendHistory(historyEntries);
|
|
130
|
+
expect(r2.appended).toBe(0);
|
|
131
|
+
|
|
132
|
+
const onDisk = readHistoryRows();
|
|
133
|
+
expect(onDisk.length).toBe(2);
|
|
134
|
+
});
|
|
@@ -126,7 +126,11 @@ test("spawnJob's post-run handler retires a prd-missing skip as a plain completi
|
|
|
126
126
|
const state = JSON.parse(fs.readFileSync(queuePath, 'utf8'));
|
|
127
127
|
const row = state.jobs.find((j) => j.slug === slug);
|
|
128
128
|
expect(row).toBeDefined();
|
|
129
|
-
|
|
129
|
+
// A 'prd-missing' skip means no executor ever ran — it must land on the
|
|
130
|
+
// distinct 'skipped' status, never 'completed' (the status a genuine
|
|
131
|
+
// successful run produces), so unrun work can never masquerade as done.
|
|
132
|
+
expect(row.status).toBe('skipped');
|
|
133
|
+
expect(row.status).not.toBe('completed');
|
|
130
134
|
expect(row.exitCode).toBe(0);
|
|
131
135
|
expect(row.error).toBeNull();
|
|
132
136
|
// No verify pass ran and no RCA feedback fired: a verified run always
|