geneseed 6.0.3 → 6.0.4
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/CHANGELOG.md +18 -0
- package/DESIGN.md +1 -1
- package/SHIPPED.md +1 -1
- package/adapters/opencode/plugins/geneseed-context.js +0 -42
- package/adapters/opencode/plugins/geneseed-learn.js +13 -4
- package/bin/geneseed-hook.mjs +5 -0
- package/docs/concepts/hooks.md +6 -6
- package/docs/guides/install-scripted.md +1 -1
- package/docs/reference/env-context.md +2 -1
- package/docs/reference/plugin-activity.md +1 -1
- package/docs/reference/profiles.md +1 -0
- package/docs/understand/a-day.md +1 -1
- package/docs/understand/machine-claude.md +1 -1
- package/docs/web-ui.md +2 -2
- package/harness.config.json +1 -1
- package/js/build/args.mjs +4 -3
- package/js/build/driver.mjs +8 -8
- package/js/build/emit-claude.mjs +59 -4
- package/js/build/generate.mjs +11 -2
- package/js/build/profile.mjs +10 -5
- package/js/build/render.mjs +3 -1
- package/js/build/source.mjs +12 -1
- package/js/cli-table.json +37 -0
- package/js/hosts/hooks-context.mjs +1 -56
- package/js/hosts/hooks-learn.mjs +435 -55
- package/js/hosts/installs.mjs +22 -2
- package/js/hosts/memory-files.mjs +89 -6
- package/js/hosts/native.mjs +23 -1
- package/js/hosts/settings.mjs +77 -4
- package/js/inspect/diff.mjs +3 -1
- package/js/inspect/doctor.mjs +37 -3
- package/js/inspect/status.mjs +38 -5
- package/js/inspect/validate.mjs +1 -1
- package/js/lib/proc.mjs +36 -0
- package/js/maintain/profiles.mjs +15 -4
- package/js/maintain/setup.mjs +31 -7
- package/js/maintain/update.mjs +1 -1
- package/js/web/actions.mjs +5 -3
- package/js/web/api.mjs +2 -2
- package/js/web/profiles-api.mjs +2 -2
- package/js/web/state.mjs +13 -2
- package/package.json +1 -1
- package/src/AGENT.md.tmpl +1 -1
- package/src/agents/memory-curator.md +3 -0
- package/src/doctrines/process.md +2 -2
- package/src/memory/README.md +24 -4
- package/src/skills/rule.md +9 -5
- package/web/dist/assets/{Activity-IAxWF2wK.js → Activity-BsMFA5Aa.js} +1 -1
- package/web/dist/assets/{ActivityDetail-CtC2DLvh.js → ActivityDetail-C66n3oul.js} +1 -1
- package/web/dist/assets/{Bonsai-BoKo68Kw.js → Bonsai-BCd-qt7W.js} +1 -1
- package/web/dist/assets/{CopyButton-C0VTiqmb.js → CopyButton-Dpl0PFja.js} +1 -1
- package/web/dist/assets/{Dashboard-CRGCp2cV.js → Dashboard-CQxdiv7F.js} +2 -2
- package/web/dist/assets/{Docs-DwOwzaD6.js → Docs-D0XlXuiA.js} +1 -1
- package/web/dist/assets/{Factories-DxHD2T-1.js → Factories-CPVBoWoA.js} +1 -1
- package/web/dist/assets/{GreenhouseView-D5VOmhmR.js → GreenhouseView-C_2auUA8.js} +1 -1
- package/web/dist/assets/Installs-CXqjmqms.js +3 -0
- package/web/dist/assets/{JournalView-gUSGysTm.js → JournalView-S-igd-Nv.js} +1 -1
- package/web/dist/assets/{Kits-DYQvykZ0.js → Kits-K6mu91rm.js} +1 -1
- package/web/dist/assets/{Laws-UVk0uojS.js → Laws-j5vKNwLT.js} +1 -1
- package/web/dist/assets/{LibRows-CwK63kjB.js → LibRows-1yTY0Kwn.js} +1 -1
- package/web/dist/assets/{Library-DdzyrwUK.js → Library-BQZnFdWs.js} +1 -1
- package/web/dist/assets/{Loops-yHga7xdr.js → Loops-B5DgxpLm.js} +1 -1
- package/web/dist/assets/Models-C-4Y4jvx.js +1 -0
- package/web/dist/assets/{OperatorHudView-D1lQF-ZY.js → OperatorHudView-_8NBAvkd.js} +1 -1
- package/web/dist/assets/Personal-Bf7zHDc6.js +2 -0
- package/web/dist/assets/{Settings-Brgec4M0.js → Settings-BTrA6MXv.js} +1 -1
- package/web/dist/assets/{Tabs-BHjxciOL.js → Tabs-BDhZImxa.js} +1 -1
- package/web/dist/assets/controls-CREglcUF.js +1 -0
- package/web/dist/assets/{index-BfyZCNu7.css → index-9iBqq7i2.css} +1 -1
- package/web/dist/assets/{index-BILaKHbH.js → index-BiKWWv7Z.js} +3 -3
- package/web/dist/index.html +2 -2
- package/web/dist/assets/Installs-B5hFSUeN.js +0 -3
- package/web/dist/assets/Models-DAgkQ4CE.js +0 -1
- package/web/dist/assets/Personal-DjhIfa9v.js +0 -2
- package/web/dist/assets/controls-CK7qHA8H.js +0 -1
package/web/dist/index.html
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<!-- The brand sprout as an inline SVG favicon (no extra asset to serve). -->
|
|
12
12
|
<link rel="icon" type="image/svg+xml"
|
|
13
13
|
href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.5v-9' stroke='%233AD4C4' stroke-width='2' stroke-linecap='round' fill='none'/%3E%3Cpath d='M12 13c0-4.5 3.2-7.5 7.5-7.5 0 4.5-3.2 7.5-7.5 7.5z' fill='%233AD4C4'/%3E%3Cpath d='M12 14.5c0-3.6-2.6-6-6-6 0 3.6 2.6 6 6 6z' fill='%233AD4C4' opacity='.42'/%3E%3C/svg%3E" />
|
|
14
|
-
<script type="module" crossorigin src="/assets/index-
|
|
14
|
+
<script type="module" crossorigin src="/assets/index-BiKWWv7Z.js"></script>
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-XKyaHtl9.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/react-C1iE8mnY.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/api-C8nMUU1i.js">
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<link rel="modulepreload" crossorigin href="/assets/sections-CtFz7HFH.js">
|
|
20
20
|
<link rel="modulepreload" crossorigin href="/assets/router-1EhRJy1C.js">
|
|
21
21
|
<link rel="modulepreload" crossorigin href="/assets/useLocalStorage-54tkqXN7.js">
|
|
22
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
22
|
+
<link rel="stylesheet" crossorigin href="/assets/index-9iBqq7i2.css">
|
|
23
23
|
</head>
|
|
24
24
|
<body>
|
|
25
25
|
<div id="root"></div>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./Tabs-BHjxciOL.js";import{At as i,B as a,Ct as o,G as s,H as c,J as l,K as u,Tt as d,Y as f,_t as p,et as m,gt as h,it as g,mt as _,nt as v,ot as y,pt as b,tt as x,ut as S,wt as C}from"./index-BILaKHbH.js";import{t as w}from"./api-C8nMUU1i.js";import{t as T}from"./EmptyState-CY5Pm2xy.js";import{i as E,n as D,r as O,t as k}from"./controls-CK7qHA8H.js";var A=e(t(),1),j=n();function M({host:e,theme:t,options:n,onAction:r,onClose:i,onNote:a}){let[o,s]=(0,A.useState)({path:``,host:e,theme:t,footprint:`lean`,posture:`peer`,mode:`direct`,trust:`balanced`}),[c,l]=(0,A.useState)(!1),[u,d]=(0,A.useState)(``),f=(e,t)=>s(n=>({...n,[e]:t})),p=async()=>{l(!0),a(``);try{let e=await w.pickFolder();e.path?(f(`path`,e.path),d(``)):e.error&&a(e.error)}catch(e){a(e.message)}finally{l(!1)}},m=async()=>{let e=o.path.trim();e?(d(``),a(``),await r?.(`deploy`,{host:o.host,path:e,theme:o.theme,footprint:o.footprint,posture:o.posture,mode:o.mode,trust:o.trust})&&i()):d(`Choose or type a folder to deploy into.`)};return(0,j.jsxs)(`div`,{className:`deploy-pop`,children:[(0,j.jsxs)(`div`,{className:`dp-row`,children:[(0,j.jsx)(`input`,{className:`inp dp-path`,type:`text`,placeholder:`/path/to/project, or click Browse…`,value:o.path,onChange:e=>{f(`path`,e.target.value),d(``)},onKeyDown:e=>e.key===`Enter`&&m(),"aria-label":`Folder to deploy into`,"aria-invalid":u?!0:void 0,"aria-describedby":u?`dp-path-err`:void 0}),(0,j.jsx)(`button`,{className:`btn ghost sm`,disabled:c,onClick:p,children:c?`Choosing…`:`Browse…`})]}),u?(0,j.jsx)(`p`,{id:`dp-path-err`,className:`tag bad note`,role:`alert`,children:u}):null,(0,j.jsxs)(`div`,{className:`dp-row`,children:[(0,j.jsxs)(`label`,{className:`dp-field`,children:[(0,j.jsx)(`span`,{children:`Deploy as`}),(0,j.jsx)(`select`,{className:`sel`,"aria-label":`host for the new install`,value:o.host,onChange:e=>f(`host`,e.target.value),children:S.map(e=>(0,j.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,j.jsx)(D,{value:o,options:n,onChange:f,who:`the new install`}),(0,j.jsx)(`button`,{className:`btn ghost sm`,onClick:m,children:`Deploy`}),(0,j.jsx)(`button`,{className:`btn ghost sm`,onClick:i,children:`Cancel`})]}),(0,j.jsxs)(`p`,{className:`sub dp-note`,children:[`Adds a per-repo harness (`,(0,j.jsx)(`code`,{children:b(o.host).deployAdds}),`) into the folder, non-destructively. It’s then tracked here even after you leave its directory.`]})]})}function N(){let{data:e,error:t,reload:n}=i(()=>w.excludes(),[]),[r,a]=(0,A.useState)(!1),[s,c]=(0,A.useState)([]),l=async(e,t)=>{a(!0);try{let n=await w.excludeMutate(e,t);c(n.messages||[])}catch(e){c(e.body?.messages||[e.message])}finally{a(!1),n()}};return t||!e?.installs?.length?null:(0,j.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,j.jsx)(`div`,{className:`card-head`,children:(0,j.jsx)(`h3`,{children:`Excluded folders`})}),(0,j.jsx)(`p`,{className:`sub mb-16`,children:`Sovereign repos: inside these folders every global harness goes dormant — hooks stay silent and the global preamble is not loaded.`}),(e.excludes||[]).map(e=>(0,j.jsxs)(`div`,{className:`row wrap between gap-12`,children:[(0,j.jsx)(`code`,{children:e.path}),(0,j.jsx)(`span`,{className:`mono muted`,children:e.hosts.map(e=>b(e).label).join(`, `)}),(0,j.jsx)(`button`,{className:`btn ghost sm`,disabled:r,"aria-label":`Stop excluding ${e.path}`,onClick:()=>l(`remove`,e.path),children:`Remove`})]},e.path)),(0,j.jsxs)(`button`,{className:`btn ghost sm`,disabled:r,onClick:async()=>{a(!0);try{let e=await w.pickFolder();e.path?await l(`add`,e.path):e.error&&c([e.error])}catch(e){c([e.message])}finally{a(!1)}},children:[(0,j.jsx)(o,{name:`folder`}),` Exclude a folder…`]}),s.map((e,t)=>(0,j.jsx)(`p`,{className:`sub`,children:e},t))]})}var P=`This project sees your machine-wide rules, profile and memory map, so what you taught one tool or repo applies here too.`,F=`About 1 500 tokens at every session start, growing with your rules. The hook budget is fixed at 9 000 characters, and the tier loads before this project's docs, so a large tier can push them down to a lazy listing.`,I=[`200k`,`1m`],L={"200k":`For a 200k-token model: each skill description is cut to 80 characters and the listing budget is 1.3% of the window, so every skill keeps its description.`,"1m":`For a 1M-token model: each skill description is cut to 120 characters, at the default budget of 1% of the window.`},R=[`claude`,`opencode`,`openclaude`];function z({targets:e,onReveal:t}){let n=e.flatMap(e=>e.servers);return(0,j.jsxs)(`div`,{className:`ip-block`,children:[(0,j.jsxs)(`span`,{className:`ip-label`,children:[`MCP servers `,(0,j.jsx)(`span`,{className:`mono dim`,children:n.length})]}),e.map(e=>(0,j.jsxs)(`div`,{className:`mcp-target`,children:[(0,j.jsxs)(`div`,{className:`mt-head`,children:[(0,j.jsx)(`code`,{title:e.path,children:e.label}),e.exists?(0,j.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:()=>t(e),"aria-label":`Open the folder holding ${e.label}`,title:`Open the folder holding ${e.path} to edit it`,children:`Open folder`}):null]}),e.exists?e.servers.length?e.servers.map(e=>(0,j.jsxs)(`div`,{className:`mcp-row`,children:[(0,j.jsx)(`span`,{className:`mono`,children:e.name}),(0,j.jsx)(`span`,{className:`tag ${e.state===`enabled`?`ok`:`warn`}`,children:e.state===`enabled`?`Enabled`:`Disabled`})]},e.name)):(0,j.jsx)(`p`,{className:`sub`,children:`None configured in this file.`}):(0,j.jsxs)(`p`,{className:`sub`,children:[`No MCP file yet (it would be `,(0,j.jsx)(`code`,{children:e.path}),`).`]})]},e.path))]})}var B=6;function V({leftovers:e}){let t=e?.kept||[],n=e?.stale||[],r=[...t,...n];return r.length?(0,j.jsxs)(`div`,{className:`ip-block ip-leftovers`,role:`group`,"aria-label":`Files a rebuild keeps`,children:[(0,j.jsxs)(`span`,{className:`ip-label`,children:[`Not Geneseed’s copy `,(0,j.jsx)(`span`,{className:`mono dim`,children:r.length})]}),t.length?(0,j.jsxs)(`p`,{className:`sub`,children:[t.length===1?`This file is yours`:`These files are yours`,` where Geneseed ships its own: you edited a shipped file, or had one under the same name. A rebuild keeps`,` `,t.length===1?`it`:`them`,`.`]}):null,n.length?(0,j.jsxs)(`p`,{className:`sub`,children:[n.length===1?`One retired skill was`:`${n.length} retired skills were`,` `,`left by an older version. A rebuild leaves `,n.length===1?`it`:`them`,` in place.`]}):null,(0,j.jsxs)(`ul`,{className:`ip-files`,children:[r.slice(0,B).map(e=>(0,j.jsx)(`li`,{children:(0,j.jsx)(`code`,{title:e,children:e})},e)),r.length>B?(0,j.jsxs)(`li`,{className:`dim`,children:[`and `,r.length-B,` more`]}):null]}),(0,j.jsxs)(`p`,{className:`sub`,children:[(0,j.jsx)(`strong`,{children:`Force rebuild…`}),` below replaces them with Geneseed’s copies. Skills and agents under your own names, memory, notebook, rules and profile are never touched. To keep a file of yours for good, exclude that skill instead.`]})]}):null}function H({stranded:e,canAct:t,busy:n,onPrune:r}){let i=e?.keys||[];return i.length?(0,j.jsxs)(`div`,{className:`ip-block ip-leftovers`,role:`group`,"aria-label":`Stranded permission gates`,children:[(0,j.jsxs)(`span`,{className:`ip-label`,children:[`Stranded gates `,(0,j.jsx)(`span`,{className:`mono dim`,children:i.length})]}),(0,j.jsxs)(`p`,{className:`sub`,children:[`These `,(0,j.jsx)(`code`,{children:`permission.bash`}),` entries in `,(0,j.jsx)(`code`,{children:`opencode.json`}),` still ask, but the rule behind them is off in this install. Geneseed has no record that it wrote them, so a rebuild leaves them.`]}),(0,j.jsxs)(`ul`,{className:`ip-files`,children:[i.slice(0,B).map(e=>(0,j.jsx)(`li`,{children:(0,j.jsx)(`code`,{title:e,children:e})},e)),i.length>B?(0,j.jsxs)(`li`,{className:`dim`,children:[`and `,i.length-B,` more`]}):null]}),e.commented?(0,j.jsx)(`p`,{className:`sub`,children:`This file has comments, so Geneseed does not rewrite it: delete these entries by hand.`}):t?(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,disabled:n,onClick:r,children:`Remove stranded gates…`}):null,(0,j.jsx)(`p`,{className:`sub`,children:`An entry you changed yourself is kept.`})]}):null}var U={active:[`Active`,`ok`],disabled:[`Disabled`,`warn`],absent:[`Not installed`,``]};function ee({inst:e,targets:t,choice:n,unchanged:r,options:i,onPick:a,canAct:o,busy:c,memory:l,onMemory:u,onApply:d,onToggleInstall:f,onRemove:p,onRevealMcp:m,onForce:h,onPrune:g,profileMatches:v,onSaveProfile:y}){let x=`${b(e.host).label} · ${e.scope}`,[S,C]=U[e.state]||U.absent,w=e.state===`active`,T=e.state===`absent`;return(0,j.jsxs)(`aside`,{className:`install-panel`,"aria-label":`${x} install`,children:[(0,j.jsx)(`span`,{className:`ip-eyebrow`,children:`Selected install`}),(0,j.jsxs)(`div`,{className:`ip-head`,children:[(0,j.jsx)(`h2`,{children:_(e)}),(0,j.jsx)(`span`,{className:`tag ${C}`,children:S})]}),(0,j.jsx)(`span`,{className:`ip-kind`,children:e.scope===`global`?`Global install`:`Per-project install · ${b(e.host).label}`}),(0,j.jsx)(`code`,{className:`ip-path`,children:e.path}),w&&v?.length?(0,j.jsxs)(`div`,{className:`row gap-8 wrap`,"aria-label":`Profile`,children:[(0,j.jsx)(`span`,{className:`ip-label`,children:`Profile`}),v.map(e=>(0,j.jsxs)(`span`,{className:`tag acc`,children:[`matches `,e]},e))]}):null,T?(0,j.jsxs)(`p`,{className:`sub`,children:[`Install Geneseed here as `,(0,j.jsx)(`strong`,{children:b(e.host).label}),`. Files are added non-destructively; deactivate or uninstall later.`]}):null,(w||T)&&o?(0,j.jsxs)(`div`,{className:`ip-picks`,children:[(0,j.jsx)(D,{value:n,options:i,onChange:a,who:x}),(0,j.jsxs)(`p`,{className:`sub`,children:[n.footprint===`lean`?`Lean footprint: terse rule lines and a pointer to the full file, about 40% smaller.`:`Full footprint: every rule’s complete text inline, the largest context.`,` `,`Every rule stays in force. `,(0,j.jsx)(`a`,{href:`#/docs/footprint`,children:`Learn more →`})]})]}):null,(w||T)&&o&&e.host===`claude`?(0,j.jsxs)(`div`,{className:`ip-block`,children:[(0,j.jsxs)(`label`,{className:`dp-field`,children:[(0,j.jsx)(`span`,{children:`Context window`}),(0,j.jsx)(O,{label:`context window for ${x}`,value:n.contextWindow||`200k`,options:I,onChange:e=>a(`contextWindow`,e)})]}),(0,j.jsx)(`p`,{className:`sub`,children:L[n.contextWindow||`200k`]})]}):null,w&&R.includes(e.host)?(0,j.jsx)(`div`,{className:`ip-block`,children:(0,j.jsxs)(`p`,{className:`sub`,"data-testid":`models-line`,children:[`Models: routing `,e.tiers||`off`,` · `,e.pins||0,` pin`,e.pins===1?``:`s`,` — `,(0,j.jsx)(`a`,{href:`#/models`,onClick:()=>s(`models`,e.id),children:`Open Models →`})]})}):null,(w||T)&&o&&e.scope!==`global`?(0,j.jsxs)(`div`,{className:`ip-block`,children:[(0,j.jsxs)(`label`,{className:`ip-switch`,children:[(0,j.jsx)(E,{on:!!n.sharedTier,label:`shared tier for ${x}`,onToggle:()=>a(`sharedTier`,!n.sharedTier)}),(0,j.jsx)(`span`,{children:`Read the machine-wide shared tier`})]}),(0,j.jsxs)(`p`,{className:`sub`,children:[(0,j.jsx)(`strong`,{children:`Benefit:`}),` `,P]}),(0,j.jsxs)(`p`,{className:`sub`,children:[(0,j.jsx)(`strong`,{children:`Cost:`}),` `,F]})]}):null,w?(0,j.jsx)(V,{leftovers:e.leftovers}):null,w?(0,j.jsx)(H,{stranded:e.strandedGates,canAct:o,busy:c,onPrune:g}):null,w&&t.length?(0,j.jsx)(z,{targets:t,onReveal:m}):null,w&&e.scope===`global`?(0,j.jsx)(N,{}):null,T?null:(0,j.jsxs)(`label`,{className:`ip-switch`,children:[(0,j.jsx)(E,{on:w,disabled:c,label:`activate ${x}`,onToggle:f}),(0,j.jsx)(`span`,{children:w?`Active: loads in every session`:`Disabled: files moved aside`})]}),(0,j.jsx)(`div`,{className:`ip-spacer`}),o?(0,j.jsxs)(`div`,{className:`ip-actions`,children:[T?(0,j.jsx)(`button`,{type:`button`,className:`btn`,onClick:d,children:`Install`}):w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{type:`button`,className:`btn`,disabled:r,onClick:d,children:`Apply and rebuild`}),y?(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:y,children:`Save as profile…`}):null,(0,j.jsx)(`button`,{type:`button`,className:`btn ghost danger-line`,disabled:c,onClick:h,children:`Force rebuild…`})]}):null,T?null:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`label`,{className:`field`,children:[(0,j.jsx)(`span`,{children:`On uninstall, memory and notebook`}),(0,j.jsxs)(`select`,{className:`sel`,value:l,onChange:e=>u(e.target.value),children:[(0,j.jsx)(`option`,{value:`keep`,children:`keep in place`}),(0,j.jsx)(`option`,{value:`archive`,children:`archive aside`}),(0,j.jsx)(`option`,{value:`delete`,children:`delete too`})]})]}),(0,j.jsx)(`button`,{type:`button`,className:`btn ghost danger-line`,"aria-label":`remove ${x} from ${e.path}`,disabled:c,onClick:p,children:`Uninstall…`})]})]}):null]})}var W={secretsGate:`secrets`,doneGate:`done`,deletionGate:`deletion`,ownershipGate:`ownership`,externalGate:`external`,testNote:`test note`,ownBranchPass:`own-branch pass`},G=e=>W[e]||e,K=e=>b(e).label,q=e=>`${K(e.host)} · ${e.scope===`global`?`global`:e.path}`,J=e=>e.startsWith(`gates.`)||/-gate$|consent|test-note/.test(e);function te(e){if(!e)return null;try{let t=JSON.parse(e)?.save;return t&&typeof t.host==`string`&&typeof t.path==`string`?t:null}catch{return null}}var ne=e=>`#/installs/profiles/${encodeURIComponent(JSON.stringify({save:{host:e.host,path:e.path}}))}`;function Y(e){let t=(e.gatesOff||[]).map(G);return t.length?t.length===1&&t[0]===`ownership`?{text:`All on, except ownership`,warn:!1}:{text:`Off: ${t.join(`, `)}`,warn:!0}:{text:`All on`,warn:!1}}function X({p:e,canAct:t,onApply:n}){let r=(0,j.jsxs)(`div`,{className:`panel-head prof-head`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h3`,{children:e.name}),e.description?(0,j.jsx)(`p`,{className:`sub`,children:e.description}):null]}),(0,j.jsx)(`span`,{className:`tag ${e.source===`personal`?`acc`:``}`,children:e.source===`personal`?`Personal`:`Shipped`})]});if(e.error)return(0,j.jsxs)(`article`,{className:`panel prof-card`,"aria-label":`profile ${e.name}`,children:[r,(0,j.jsx)(`p`,{className:`tag bad note`,children:e.error}),(0,j.jsxs)(`div`,{className:`kv`,children:[(0,j.jsx)(`span`,{className:`k`,children:`File`}),(0,j.jsx)(`code`,{className:`v`,children:e.file})]})]});let i=e.profile,a=Y(e);return(0,j.jsxs)(`article`,{className:`panel prof-card`,"aria-label":`profile ${e.name}`,children:[r,(0,j.jsxs)(`div`,{className:`prof-kv`,children:[(0,j.jsxs)(`div`,{className:`kv`,children:[(0,j.jsx)(`span`,{className:`k`,children:`Hosts`}),(0,j.jsx)(`span`,{className:`v row gap-8 wrap`,children:i.hosts.map(e=>(0,j.jsx)(`span`,{className:`tag human`,children:K(e)},e))})]}),(0,j.jsxs)(`div`,{className:`kv`,children:[(0,j.jsx)(`span`,{className:`k`,children:`Settings`}),(0,j.jsx)(`span`,{className:`v`,children:[i.theme,i.footprint,i.posture,i.mode,i.trust].join(` · `)})]}),(0,j.jsxs)(`div`,{className:`kv`,children:[(0,j.jsx)(`span`,{className:`k`,children:`Gates`}),(0,j.jsx)(`span`,{className:`v`,children:a.warn?(0,j.jsxs)(`span`,{className:`tag warn note`,children:[`! `,a.text]}):a.text})]}),(0,j.jsxs)(`div`,{className:`kv`,children:[(0,j.jsx)(`span`,{className:`k`,children:`Followed by`}),(0,j.jsx)(`span`,{className:`v`,children:e.matches?.length?e.matches.map(q).join(`, `):`No install`})]}),(0,j.jsxs)(`div`,{className:`kv`,children:[(0,j.jsx)(`span`,{className:`k`,children:`File`}),(0,j.jsx)(`code`,{className:`v`,children:e.file})]})]}),t?(0,j.jsx)(`div`,{className:`row gap-8`,children:(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>n(e.name),children:`Apply…`})}):null]})}function Z(e,t){if(!e.present)return`not on this machine`;let n=t===`global`?`global install`:`project install`;return e.state===`active`?`${n} · active`:e.state===`disabled`?`${n} · disabled`:t===`global`?`no global install yet`:`no install in this folder`}var Q=e=>e.present&&!e.refused;function re(e){return e.present?e.refused?[{text:e.refused,tone:`warn`}]:e.state===`active`?e.changes.length?e.changes.map(e=>({text:`${e.name} ${e.from} → ${e.to}`,tone:J(e.name)?`warn`:``})):[{text:`Already matches — rebuild only`,tone:`dim`}]:[{text:`New install`,tone:`dim`}]:[{text:`Install ${K(e.host)}, then apply again`,tone:`dim`}]}function ie({name:e,onAction:t,onClose:n}){let[r,a]=(0,A.useState)(`global`),[o,s]=(0,A.useState)(``),[c,l]=(0,A.useState)(``),[u,d]=(0,A.useState)({}),[f,p]=(0,A.useState)(!1),[h,_]=(0,A.useState)(``),v=r===`project`?c:null,y=JSON.stringify([e,r,v]),{data:b,error:S,loading:C}=i(()=>r===`project`&&!c?Promise.resolve(null):w.profiles(e,v).then(e=>({...e,askedFor:y})),[e,r,c]),T=!C&&b?.askedFor===y?b.preview:null,E=T?.rows||[],D=E.filter(e=>Q(e)&&!u[e.host]),O=T&&!T.error&&T.name===e&&T.scope===r&&(r===`global`||T.project),k=e=>{l(e.trim()),d({})},M=async()=>{p(!0),_(``);try{let e=await w.pickFolder();e.path?(s(e.path),k(e.path)):e.error&&_(e.error)}catch(e){_(e.message)}finally{p(!1)}},N=async()=>{await t?.(`profile-apply`,{name:e,hosts:D.map(e=>e.host),...r===`project`?{project:T.project}:{}})&&n()},P=E.filter(e=>e.layering&&!u[e.host]&&Q(e));return(0,j.jsxs)(`section`,{className:`panel prof-dialog`,"aria-label":`Apply profile`,children:[(0,j.jsxs)(`div`,{className:`panel-head`,children:[(0,j.jsxs)(`h2`,{children:[`Apply `,(0,j.jsx)(`span`,{className:`mono`,children:e})]}),(0,j.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Close`,onClick:n,children:`✕`})]}),(0,j.jsxs)(`fieldset`,{className:`prof-field`,children:[(0,j.jsx)(`legend`,{className:`ip-label`,children:`Where`}),(0,j.jsxs)(g,{"aria-label":`Where to apply`,children:[(0,j.jsx)(`button`,{type:`button`,className:r===`global`?`on`:``,"aria-pressed":r===`global`,onClick:()=>{a(`global`),d({})},children:`Global — every project on this machine`}),(0,j.jsx)(`button`,{type:`button`,className:r===`project`?`on`:``,"aria-pressed":r===`project`,onClick:()=>{a(`project`),d({})},children:`One project`})]}),r===`project`?(0,j.jsxs)(`div`,{className:`dp-row`,children:[(0,j.jsx)(`input`,{className:`inp dp-path`,type:`text`,placeholder:`/path/to/project, or click Browse…`,"aria-label":`Project folder`,value:o,onChange:e=>s(e.target.value),onBlur:()=>k(o),onKeyDown:e=>e.key===`Enter`&&k(o)}),(0,j.jsx)(`button`,{type:`button`,className:`btn ghost sm`,disabled:f,onClick:M,children:f?`Choosing…`:`Browse…`})]}):null]}),h?(0,j.jsx)(`p`,{className:`tag bad note`,role:`alert`,children:h}):null,(0,j.jsx)(m,{error:S}),T?.error?(0,j.jsx)(`p`,{className:`tag bad note`,role:`alert`,children:T.error}):null,C?(0,j.jsx)(x,{}):null,O?(0,j.jsxs)(`div`,{className:`prof-hosts`,role:`group`,"aria-label":`Hosts`,children:[(0,j.jsx)(`span`,{className:`ip-label`,children:`Hosts — the profile’s hosts are ticked; a host this machine lacks is shown, not offered`}),E.map(e=>(0,j.jsxs)(`div`,{className:`prof-host${e.present?``:` missing`}`,children:[(0,j.jsxs)(`label`,{className:`row gap-8`,children:[(0,j.jsx)(`input`,{type:`checkbox`,checked:Q(e)&&!u[e.host],disabled:!Q(e),onChange:()=>d(t=>({...t,[e.host]:!t[e.host]}))}),(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:K(e.host)}),` `,(0,j.jsx)(`span`,{className:`dim`,children:Z(e,r)})]})]}),(0,j.jsx)(`div`,{className:`prof-changes`,children:re(e).map(e=>(0,j.jsx)(`span`,{className:e.tone===`warn`?`warn-text`:e.tone,children:e.text},e.text))})]},e.host))]}):null,O&&r===`project`?(0,j.jsxs)(`p`,{className:`sub`,children:[`Project scope: the build writes into `,(0,j.jsx)(`code`,{children:T.project}),` for each ticked host. The profile’s `,(0,j.jsx)(`code`,{children:`sharedTier`}),` applies here only; a global apply ignores it.`]}):null,O&&P.length?P.map(e=>(0,j.jsxs)(`p`,{className:`tag warn note`,role:`note`,children:[`A global `,K(e.host),` install is active (`,e.layering.root,`): both root files load in this project. Global gates that still run there:`,` `,e.layering.gates.length?e.layering.gates.join(`, `):`none`,`.`,` `,(0,j.jsx)(`a`,{href:`#/docs/exclusions`,children:`Why →`})]},e.host)):null,(0,j.jsxs)(`div`,{className:`row gap-8`,children:[(0,j.jsxs)(`button`,{type:`button`,className:`btn`,disabled:!O||!D.length,onClick:N,children:[`Apply to `,D.length,` `,D.length===1?`host`:`hosts`]}),(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:n,children:`Cancel`}),(0,j.jsx)(`span`,{className:`dim`,children:`Runs as a background job; its log reports each host.`})]})]})}function ae({data:e,initial:t,onAction:n,onClose:r}){let i=e.installs||[],a=e=>`${e.host}|${e.path}`,o=t?i.find(e=>a(e)===a(t)):i[0],[s,c]=(0,A.useState)(o?a(o):``),[l,u]=(0,A.useState)(``),[d,f]=(0,A.useState)(`personal`),[p,m]=(0,A.useState)(!1),h=i.find(e=>a(e)===s),g=(h?.diff||[]).filter(e=>e.key!==`hosts`);return(0,j.jsxs)(`section`,{className:`panel prof-dialog`,"aria-label":`Save as profile`,children:[(0,j.jsxs)(`div`,{className:`panel-head`,children:[(0,j.jsx)(`h2`,{children:`Save an install as profile`}),(0,j.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Close`,onClick:r,children:`✕`})]}),i.length?(0,j.jsxs)(j.Fragment,{children:[t&&!o?(0,j.jsx)(`p`,{className:`tag warn note`,role:`status`,children:`The install you chose is no longer active here. Pick one below.`}):null,(0,j.jsxs)(`div`,{className:`dp-row`,children:[(0,j.jsxs)(`label`,{className:`field`,children:[(0,j.jsx)(`span`,{children:`From install`}),(0,j.jsxs)(`select`,{className:`sel`,value:s,onChange:e=>c(e.target.value),children:[s?null:(0,j.jsx)(`option`,{value:``,children:`Pick an install…`}),i.map(e=>(0,j.jsx)(`option`,{value:a(e),children:q(e)},a(e)))]})]}),(0,j.jsxs)(`label`,{className:`field`,children:[(0,j.jsx)(`span`,{children:`Name`}),(0,j.jsx)(`input`,{className:`inp`,type:`text`,value:l,placeholder:`my-profile`,onChange:e=>u(e.target.value)})]})]}),(0,j.jsxs)(`fieldset`,{className:`prof-field`,children:[(0,j.jsx)(`legend`,{className:`ip-label`,children:`Save to`}),(0,j.jsxs)(`label`,{className:`row gap-8`,children:[(0,j.jsx)(`input`,{type:`radio`,name:`prof-dest`,checked:d===`personal`,onChange:()=>f(`personal`)}),(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:`Personal`}),` — `,(0,j.jsx)(`code`,{children:e.personalDir}),`, beside your memory and rules. Survives updates, never shipped.`]})]}),(0,j.jsxs)(`label`,{className:`row gap-8`,children:[(0,j.jsx)(`input`,{type:`radio`,name:`prof-dest`,checked:d===`shipped`,disabled:!e.shippedWritable,onChange:()=>f(`shipped`)}),(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:`Shipped`}),` — `,(0,j.jsx)(`code`,{children:`profiles/`}),` in this clone, for everyone. Commit and open a pull request to share it.`,e.shippedWritable?``:` Disabled: this copy is not a git clone.`]})]}),(0,j.jsxs)(`label`,{className:`row gap-8`,children:[(0,j.jsx)(`input`,{type:`checkbox`,checked:p,onChange:()=>m(e=>!e)}),(0,j.jsx)(`span`,{children:`Replace a profile of this name in the same place`})]})]}),(0,j.jsxs)(`div`,{className:`prof-changes`,"aria-label":`Differs from ${e.base}`,children:[(0,j.jsxs)(`span`,{children:[`Differs from `,(0,j.jsx)(`strong`,{children:e.base}),g.length?``:`: nothing`]}),g.map(t=>(0,j.jsx)(`span`,{className:J(t.key)?`warn-text`:``,children:J(t.key)?`! gate ${G(t.key.slice(6))}: ${t.now} (${e.base}: ${t.base})`:`${t.key} ${t.now} (${e.base}: ${t.base})`},t.key))]}),(0,j.jsxs)(`div`,{className:`row gap-8`,children:[(0,j.jsx)(`button`,{type:`button`,className:`btn`,disabled:!h||!l.trim(),onClick:async()=>{await n?.(`profile-save`,{name:l.trim(),from:{host:h.host,path:h.path},...d===`shipped`?{shipped:!0}:{},...p?{force:!0}:{}})&&r()},children:`Save profile`}),(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:r,children:`Cancel`})]})]}):(0,j.jsx)(T,{children:`No active install to save. Install one on the Hosts tab first.`})]})}function oe({onAction:e,dataRev:t,item:n}){let r=te(n),{data:a,error:o,loading:s,reload:c}=i(()=>w.profiles(),[t],`profiles`),[l,u]=(0,A.useState)(r?{kind:`save`,from:r}:null);if(o)return(0,j.jsx)(m,{error:o,onRetry:c});if(s&&!a)return(0,j.jsx)(x,{});let d=a?.profiles||[],f=!!e;return(0,j.jsxs)(`div`,{className:`profiles`,children:[(0,j.jsxs)(`div`,{className:`inst-head`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{children:`Profiles`}),(0,j.jsx)(`p`,{className:`dim`,children:`A profile is a named set of build settings and the hosts it targets. Apply it globally or to one project.`})]}),f?(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>u({kind:`save`,from:null}),children:`Save an install as profile…`}):null]}),d.length?(0,j.jsx)(`div`,{className:`prof-grid`,children:d.map(e=>(0,j.jsx)(X,{p:e,canAct:f,onApply:e=>u({kind:`apply`,name:e})},`${e.source}:${e.name}`))}):(0,j.jsx)(T,{children:`No profile yet. Save an install as one to start.`}),l?.kind===`apply`?(0,j.jsx)(ie,{name:l.name,onAction:e,onClose:()=>u(null)},l.name):null,l?.kind===`save`&&a?(0,j.jsx)(ae,{data:a,initial:l.from,onAction:e,onClose:()=>u(null)}):null]})}function se({dataRev:e}){let{data:t,error:n,reload:r}=i(()=>w.migratePreview(),[e]);return(0,j.jsxs)(`section`,{className:`panel`,"aria-labelledby":`preview-h`,children:[(0,j.jsx)(`div`,{className:`panel-head`,children:(0,j.jsx)(`h2`,{id:`preview-h`,children:`Next rebuild`})}),n?(0,j.jsx)(m,{error:n,onRetry:r}):t?(0,j.jsxs)(j.Fragment,{children:[t.folds.length?(0,j.jsx)(`ul`,{className:`preview-list`,children:t.folds.map(e=>(0,j.jsxs)(`li`,{children:[(0,j.jsx)(`b`,{className:`mono`,children:e.host}),` `,e.summary||`nothing to fold`,e.failed.map(e=>(0,j.jsxs)(`div`,{className:`t-warn`,children:[`The fold would stop at `,e]},e))]},e.host))}):(0,j.jsx)(`p`,{className:`dim`,children:`No global install to fold.`}),t.orphans.length?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`h3`,{children:`Orphans`}),(0,j.jsx)(`p`,{className:`dim`,children:`No manifest owns these. An earlier build may have written them, or they may be yours. Nothing moves them: if one is not yours, move it by hand.`}),(0,j.jsx)(`ul`,{className:`preview-list mono`,children:t.orphans.map(e=>(0,j.jsx)(`li`,{children:e},e))})]}):null]}):(0,j.jsx)(x,{})]})}var ce=(e,t)=>`${e} ${t}`,le=[`claude`,`bob`,`openclaude`],ue={active:[`Active`,`ok`],disabled:[`Disabled`,`warn`]},$=/[\\/]\.claude[\\/]worktrees[\\/]/,de=e=>e.scope===`project`&&$.test(e.path);function fe(e,t){let n=e.drift?.stale??0,r={behind:`Behind ${t||`source`}`+(n?` · ${n} file${n===1?``:`s`}`:``),synced:`In sync`,unknown:`Not checked`}[e.verdict],i=e.diffable?C(e.drift):0,a=e.diffable?d(e.drift):0;return r+(i?` · ${i} edited`:``)+(a?` · ${a} kept`:``)}function pe({inst:e,fleet:t,version:n,onEdits:r}){if(t===void 0)return(0,j.jsx)(`span`,{className:`dim`,children:`…`});if(!t)return(0,j.jsx)(`span`,{className:`dim`,children:`—`});let i=t.drift?.stale??0,o=t.diffable?C(t.drift):0,s=t.diffable?d(t.drift):0;return(0,j.jsxs)(`div`,{className:`sync-cell`,children:[t.diffable&&i+o+s>0?(0,j.jsx)(a,{label:`Sync with source of ${_(e)}`,parts:[{key:`stale`,label:`behind source`,n:i,tone:`warn`},{key:`edited`,label:`local edits`,n:o,tone:`bad`},...s?[{key:`kept`,label:`kept edits`,n:s,tone:`muted`}]:[]]}):null,(0,j.jsx)(`span`,{className:`dim`,children:fe(t,n)}),t.diffable?null:(0,j.jsxs)(`span`,{className:`dim`,title:`Local edits are only checked for global installs`,children:[` `,`· not checkable`]}),o||s?(0,j.jsxs)(j.Fragment,{children:[` `,(0,j.jsx)(`a`,{href:`#/installs/edits`,onClick:t=>{t.preventDefault(),t.stopPropagation(),r(e)},children:`Local edits`})]}):null]})}function me({rows:e,project:t,currentId:n,onPick:r,label:i,fleet:a,onEdits:o,onDefault:s,busyKey:c}){let l=e=>a===void 0?void 0:a?.installs?.find(t=>t.id===e.id)||null;return(0,j.jsx)(`div`,{className:`tbl-scroll`,children:(0,j.jsxs)(`table`,{className:`tbl hosts-tbl`,"aria-label":i,children:[(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{scope:`col`,children:t?`Project`:`Host`}),(0,j.jsx)(`th`,{scope:`col`,children:`State`}),(0,j.jsx)(`th`,{scope:`col`,children:`Sync with source`}),(0,j.jsx)(`th`,{scope:`col`,children:(0,j.jsx)(`span`,{className:`sr-only`,children:`Selected`})})]})}),(0,j.jsx)(`tbody`,{children:e.map(e=>{let[i,u]=ue[e.state]||[`Not installed`,``],d=n===e.id,f=e.state===`absent`;return(0,j.jsxs)(`tr`,{className:`pickable${d?` on`:``}${f?` quiet`:``}`,onClick:()=>r(e.id),children:[(0,j.jsxs)(`td`,{children:[(0,j.jsx)(`button`,{type:`button`,className:`row-pick`,"aria-pressed":d,title:e.path,onClick:()=>r(e.id),children:_(e)}),(0,j.jsx)(`div`,{className:`mono path-cell`,title:e.path,children:t?b(e.host).label:e.path})]}),(0,j.jsxs)(`td`,{children:[(0,j.jsx)(`span`,{className:`tag ${u}`,children:i}),e.default?(0,j.jsxs)(j.Fragment,{children:[` `,(0,j.jsx)(`span`,{className:`tag`,title:`A page that names no install reads this one, and pickers start on it`,children:`Default`})]}):e.state===`active`&&s?(0,j.jsxs)(j.Fragment,{children:[` `,(0,j.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Make ${_(e)} the default install`,disabled:c===e.id,onClick:t=>{t.stopPropagation(),s(e)},children:`Make default`})]}):null,de(e)?(0,j.jsxs)(j.Fragment,{children:[` `,(0,j.jsx)(`span`,{className:`tag warn`,title:`Inside a .claude/worktrees folder: likely a finished worktree. Remove it from its panel.`,children:`Worktree leftover`})]}):null]}),(0,j.jsx)(`td`,{children:(0,j.jsx)(pe,{inst:e,fleet:l(e),version:a?.version,onEdits:o})}),(0,j.jsx)(`td`,{className:`pick-mark`,children:d?`Editing ›`:``})]},e.id)})})]})})}function he({themes:e,current:t}){if(!e.length||!t)return null;let n=[...e].sort((e,n)=>e.name===t?-1:+(n.name===t));return(0,j.jsxs)(`details`,{className:`panel voice-ref`,children:[(0,j.jsxs)(`summary`,{children:[(0,j.jsx)(`span`,{className:`vr-title`,children:`Voices`}),(0,j.jsxs)(`span`,{className:`mono dim`,children:[e.length,` to choose from, set per install`]})]}),(0,j.jsx)(`div`,{className:`vr-list`,children:n.map(e=>(0,j.jsxs)(`div`,{className:`voice-row${e.name===t?` current`:``}`,children:[(0,j.jsx)(`span`,{className:`vr-name`,children:e.name}),(0,j.jsx)(`span`,{className:`vr-desc`,children:e.tagline?`“${e.tagline}”`:e.blurb})]},e.name))})]})}function ge({setup:e,overview:t}){if(!e)return null;let n=e.installed_fp&&e.installed_fp===e.source_fp;return(0,j.jsxs)(`section`,{className:`panel`,"aria-labelledby":`checkout-h`,children:[(0,j.jsxs)(`div`,{className:`panel-head`,children:[(0,j.jsx)(`h2`,{id:`checkout-h`,children:`This checkout`}),(0,j.jsx)(`span`,{className:`mono ${n?`t-good`:`t-warn`}`,children:n?`in sync`:e.version_verdict})]}),(0,j.jsxs)(`dl`,{className:`kv-grid`,children:[(0,j.jsx)(`dt`,{children:`Source`}),(0,j.jsx)(`dd`,{className:`mono`,children:e.root}),(0,j.jsx)(`dt`,{children:`Version`}),(0,j.jsx)(`dd`,{className:`mono`,children:t?.version||`unknown`}),(0,j.jsx)(`dt`,{children:`Fingerprint`}),(0,j.jsx)(`dd`,{className:`mono`,children:e.source_fp})]})]})}function _e({onAction:e,themes:t=[],currentTheme:n,overview:r,setup:a,dataRev:c,onMutated:l}){let d=y(),{data:f,error:h,reload:g}=i(()=>w.installs(),[c]),{data:v,error:S,reload:C}=i(()=>w.mcp(),[c]),{data:E,error:D}=i(()=>w.fleet(),[c]),{data:O}=i(()=>w.profiles(),[c],`profiles`),N=D?null:E??void 0,[P,F]=(0,A.useState)(null),[I,L]=(0,A.useState)(``),[R,z]=(0,A.useState)({}),[B,V]=(0,A.useState)(!1),[H,U]=(0,A.useState)(!1),[W,G]=(0,A.useState)({id:``,value:`keep`}),K=e=>W.id===e?.id?W.value:`keep`,[q,J]=(0,A.useState)(()=>u(`hosts`)),te=(0,A.useMemo)(()=>{let e={};for(let t of v?.targets||[]){let n=ce(t.host||`opencode`,t.root);(e[n]||(e[n]=[])).push(t)}return e},[v]);if(h||S)return(0,j.jsx)(m,{error:h||S,onRetry:()=>{g(),C()}});if(!f||!v)return(0,j.jsx)(x,{});let Y={active:0,disabled:1,absent:2},X=[...f.installs].sort((e,t)=>(e.scope===`global`?0:1)-(t.scope===`global`?0:1)||(Y[e.state]??3)-(Y[t.state]??3)),Z=X.find(e=>e.id===q)||X.find(e=>e.default)||X.find(e=>e.state===`active`)||X[0],Q=e=>{let t=R[e.id]||{};return{theme:t.theme||e.theme||n||`neutral`,footprint:t.footprint||e.state!==`absent`&&e.footprint||`lean`,posture:t.posture||e.posture||`peer`,mode:t.mode||e.mode||`direct`,trust:t.trust||e.trust||`balanced`,sharedTier:t.sharedTier??!!e.sharedTier,contextWindow:t.contextWindow||e.contextWindow||`200k`,tiers:t.tiers||e.tiers||`off`}},re=(e,t,n)=>z(r=>({...r,[e.id]:{...r[e.id],[t]:n}})),ie=e=>{let t=Q(e);return t.theme===e.theme&&t.footprint===(e.footprint||`lean`)&&t.posture===(e.posture||`peer`)&&t.mode===(e.mode||`direct`)&&t.trust===(e.trust||`balanced`)&&(e.scope===`global`||t.sharedTier===!!e.sharedTier)&&t.contextWindow===(e.contextWindow||`200k`)&&t.tiers===(e.tiers||`off`)},ae={theme:t.map(e=>e.name),footprint:k,posture:f.postures||[],mode:f.modes||[],trust:f.trusts||[]},oe=async t=>{let{theme:n,footprint:r,posture:i,mode:a,trust:o,sharedTier:s,contextWindow:c,tiers:l}=Q(t),u=b(t.host).label,f=`${r} footprint, ${i} posture, ${a} mode, ${o} loop trust${l===`auto`||t.tiers===`auto`?`, model tiers ${l}`:``}`,p=t.state===`absent`?`Install Geneseed for ${u} into ${t.path} with the “${n}” voice (${f})? Files are added non-destructively (your own config is left untouched); deactivate or uninstall later.`:`Rebuild this ${u} install (voice “${n}”, ${f})? It rebuilds in place, non-destructive.`;await d(p,{title:t.state===`absent`?`Install Geneseed?`:`Rebuild this install?`,confirmLabel:t.state===`absent`?`Install`:`Rebuild`})&&e?.(`install`,{host:t.host,scope:t.scope,path:t.path,theme:n,footprint:r,posture:i,mode:a,trust:o,contextWindow:c,tiers:l,...t.scope===`global`?{}:{sharedTier:s}})},ue=(t,n)=>{let{theme:r,footprint:i,posture:a,mode:o,trust:s,sharedTier:c,contextWindow:l,tiers:u}=Q(t);e?.(`install`,{host:t.host,scope:t.scope,path:t.path,theme:r,footprint:i,posture:a,mode:o,trust:s,contextWindow:l,tiers:u,...t.scope===`global`?{}:{sharedTier:c},...n})},$=e=>e.slice(0,8).join(`, `)+(e.length>8?`, and ${e.length-8} more`:``),de=async e=>{let t=e.leftovers?.kept||[],n=e.leftovers?.stale||[],r=t.length||n.length?(t.length?`Replace with Geneseed’s copy: ${$(t)}. Your version of each is overwritten. `:``)+(n.length?`Remove: ${$(n)}. `:``)+`Nothing else is touched.`:`No file of yours is recorded here. A forced rebuild overwrites any file it finds at a path Geneseed ships, and removes retired leftovers. Skills and agents under your own names, memory, notebook, rules and profile are never touched.`;await d(r,{title:`Force rebuild this install?`,confirmLabel:`Force rebuild`,tone:`danger`})&&ue(e,{force:!0})},fe=async e=>{let t=e.strandedGates?.keys||[];await d(`Remove from opencode.json: ${$(t)}. Their rule is off in this install. An entry you changed yourself is kept; nothing else is touched.`,{title:`Remove stranded gates?`,confirmLabel:`Remove and rebuild`})&&ue(e,{pruneGates:!0})},pe=async e=>{if(e.state!==`active`||await d(`Deactivate this install? Files are moved aside, not deleted; reactivate any time.`,{title:`Deactivate this install?`,confirmLabel:`Deactivate`})){L(e.id),F(null);try{let t=await w.installToggle(e.host,e.path,e.state===`active`?`deactivate`:`activate`);if(!t.ok){let e=Array.isArray(t.failed)?t.failed.join(`, `):``;F({text:t.error||e&&`unrestored: ${e}`||`action failed`,tone:`bad`});return}l?.()}catch(e){F({text:e.message,tone:`bad`})}finally{L(``)}}},_e=async e=>{L(e.id),F(null);try{await w.setDefaultInstall(e.host,e.path),l?.()}catch(e){F({text:e.message,tone:`bad`})}finally{L(``)}},ve=(e,t)=>{let n=e.path.includes(`\\`)&&!e.path.includes(`/`)?`\\`:`/`,r=e.path.replace(/[\\/]+$/,``);return`${e.scope===`project`&&le.includes(e.host)?`${r}${n}.${e.host}`:r}${n}${t}`},ye=async e=>{let t=K(e),n=e.scope===`project`?` and de-lists it`:`; the row stays, marked “not installed”`,r=t===`delete`?`, and permanently deletes ${ve(e,`memory`)} and ${ve(e,`notebook`)}`:t===`archive`?`; memory and notebook are archived aside`:`; memory and notebook stay in place`;if(await d(`Uninstall ${b(e.host).label} · ${e.scope}? It deletes ${p(e.host,e.scope)}${n}${r}. This can’t be undone.`,{title:e.scope===`project`?`Remove this install?`:`Remove the global install?`,confirmLabel:t===`delete`?`Remove and delete memory`:`Remove`,tone:`danger`})){L(e.id),F(null);try{let n=await w.installRemove(e.host,e.path,t);if(!n.ok){F({text:n.error||`remove failed`,tone:`bad`});return}G({id:``,value:`keep`}),n.kept?.length&&F({text:`Removed. Kept ${n.kept.length} file(s) you edited: ${n.kept.join(`, `)} — they are yours now (the CLI geneseed uninstall --force deletes edited files too).`,tone:`ok`}),l?.()}catch(e){F({text:e.message,tone:`bad`})}finally{L(``)}}},be=async e=>{F(null);try{let t=await w.mcpReveal(e.path);F({text:`Opening ${t.dir}. If no window appeared, open that folder by hand.`,tone:``})}catch(e){F({text:e.message,tone:`bad`})}},xe=async()=>{let t=X.filter(e=>e.state===`active`).map(e=>`${_(e)} · ${e.scope}`);await d(`Rebuild every active install: ${t.join(`, `)||`none`}? Each is rebuilt in place from source with its own settings; files you edited are kept.`,{title:`Rebuild all active installs?`,confirmLabel:`Rebuild all`})&&e(`build-all`)},Se=X.find(e=>e.default)?.host||X.find(e=>e.state===`active`)?.host||X[0]?.host||`opencode`,Ce=X.filter(e=>e.scope===`global`),we=X.filter(e=>e.scope!==`global`),Te=e=>{J(e)},Ee=e=>{s(`edits`,e.id),window.location.hash=`#/installs/edits`};return(0,j.jsxs)(`div`,{className:`hosts`,children:[(0,j.jsxs)(`div`,{className:`hosts-main`,children:[(0,j.jsxs)(`div`,{className:`toolbar`,children:[(0,j.jsxs)(`span`,{className:`dim`,children:[X.filter(e=>e.state!==`absent`).length,` installed.`]}),(0,j.jsxs)(`div`,{className:`row gap-8`,children:[(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,"aria-expanded":H,onClick:()=>U(e=>!e),children:`Preview next rebuild`}),e?(0,j.jsxs)(`button`,{type:`button`,className:`btn ghost`,onClick:xe,children:[(0,j.jsx)(o,{name:`refresh`}),` Rebuild all`]}):null]})]}),H?(0,j.jsx)(se,{dataRev:c}):null,P?.tone===`bad`?(0,j.jsx)(`p`,{className:`tag bad note`,role:`alert`,children:P.text}):P?(0,j.jsx)(`p`,{className:`tag ${P.tone===`ok`?`ok `:``}note`,role:`status`,children:P.text}):null,(0,j.jsxs)(`section`,{className:`panel flush`,"aria-labelledby":`inst-global`,children:[(0,j.jsx)(`div`,{className:`inst-head`,children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{id:`inst-global`,children:`Global installs`}),(0,j.jsx)(`p`,{className:`dim`,children:`One per tool. Loaded in every folder, except excluded ones.`})]})}),(0,j.jsx)(me,{rows:Ce,currentId:Z?.id,onPick:Te,label:`Global installs`,fleet:N,onEdits:Ee,onDefault:e?_e:void 0,busyKey:I})]}),(0,j.jsxs)(`section`,{className:`panel flush`,"aria-labelledby":`inst-project`,children:[(0,j.jsxs)(`div`,{className:`inst-head`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{id:`inst-project`,children:`Per-project installs`}),(0,j.jsx)(`p`,{className:`dim`,children:`A repo with its own install. Inside it, only that install loads.`})]}),e?(0,j.jsxs)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>V(e=>!e),children:[(0,j.jsx)(o,{name:`folder`}),` Deploy to a repo…`]}):null]}),B?(0,j.jsx)(`div`,{className:`inst-deploy`,children:(0,j.jsx)(M,{host:Se,theme:n||`neutral`,options:ae,onAction:e,onClose:()=>V(!1),onNote:e=>F(e?{text:e,tone:`bad`}:null)})}):null,we.length?(0,j.jsx)(me,{rows:we,project:!0,currentId:Z?.id,onPick:Te,label:`Per-project installs`,fleet:N,onEdits:Ee,onDefault:e?_e:void 0,busyKey:I}):(0,j.jsx)(T,{children:`No repo has its own install yet. Deploy one to give a project its own rules and voice.`})]}),(0,j.jsx)(ge,{setup:a,overview:r}),(0,j.jsx)(he,{themes:t,current:r?.theme})]}),Z?(0,j.jsx)(ee,{inst:Z,targets:te[ce(Z.host,Z.path)]||[],choice:Q(Z),unchanged:ie(Z),options:ae,onPick:(e,t)=>re(Z,e,t),canAct:!!e,busy:I===Z.id,memory:K(Z),onMemory:e=>G({id:Z.id,value:e}),onApply:()=>oe(Z),onToggleInstall:()=>pe(Z),onRemove:()=>ye(Z),onRevealMcp:be,onForce:()=>de(Z),onPrune:()=>fe(Z),profileMatches:O?.installs?.find(e=>e.host===Z.host&&e.path===Z.path)?.matches,onSaveProfile:e?()=>{window.location.hash=ne(Z)}:void 0},Z.id):null]})}function ve(e){return e.startsWith(`@@`)||e.startsWith(`+++`)||e.startsWith(`---`)?`hunk`:e.startsWith(`+`)?`add`:e.startsWith(`-`)?`del`:`ctx`}var ye=300;function be(e){let t=f(e.dataRev),[n,r]=l(`edits`,t);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(v,{className:`page-pick`,installs:t,value:n,onChange:r}),t===null?(0,j.jsx)(x,{}):(0,j.jsx)(xe,{install:n,...e},n?.id||``)]})}function xe({install:e,onMutated:t,onAction:n,dataRev:r,overview:a}){let s=y(),{data:c,error:l,reload:u}=i(()=>w.diff(h(e)),[r]),[d,f]=(0,A.useState)(!1),[p,g]=(0,A.useState)(``),[_,v]=(0,A.useState)(()=>new Set),[b,S]=(0,A.useState)(()=>new Set),[C,E]=(0,A.useState)(null);if(c&&c!==C){E(c),v(new Set);let e=c.files.reduce((e,t)=>e+t.diff.length,0);S(new Set(e<=ye?c.files.map(e=>e.rel):[]))}let D=e=>v(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),O=()=>v(e=>e.size===N.length?new Set:new Set(N.map(e=>e.rel))),k=()=>n?.(`export`),M=async()=>{let n=[..._],r=n.filter(e=>c.files.find(t=>t.rel===e)?.status===`added`),i=r.length?`Restoring will DELETE ${r.length} deployed-only file(s):\n${r.join(`
|
|
2
|
-
`)}\n\n`:``;if(await s(`${i}Discard local edits and restore ${n.length} file(s) from source?`,{title:`Restore from source?`,confirmLabel:`Restore`,tone:`danger`})){f(!0);try{let r=await w.restore(n,h(e)),i=r.errors.length?` · ${r.errors.length} error(s): ${r.errors.join(`; `)}`:``;g(`Restored ${r.restored.length}, archived ${r.deleted.length}${i}`),await u(),t?.()}catch(e){g(e.message)}finally{f(!1)}}};if(l)return(0,j.jsx)(m,{error:l,onRetry:u});if(!c)return(0,j.jsx)(x,{});if(!c.deployed)return(0,j.jsx)(T,{title:`Nothing installed here`,children:`Nothing to compare.`});if(!c.diffable)return(0,j.jsx)(T,{title:`No local-edit check for this install`,docs:{href:`#/installs/hosts`,label:`See every install in Hosts`},children:`Local edits are only checked for global installs. Pick a global install above.`});let N=c.files.filter(e=>e.status!==`linked`&&e.status!==`stale`),P=c.files.filter(e=>e.status===`linked`),F=c.files.filter(e=>e.status===`stale`),I=N.filter(e=>e.status===`edited`).length,L=N.filter(e=>e.status===`added`).length,R=N.filter(e=>e.status===`missing`).length,z=e=>S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{className:`h`,children:`Local edits`}),c.target?(0,j.jsxs)(`p`,{className:`sub`,children:[`Comparing `,(0,j.jsx)(`code`,{children:c.target}),c.theme?` (${c.theme} voice)`:``,` with source`,` `,a?.version||`unknown`,`.`]}):null,I>0?(0,j.jsx)(`p`,{className:`sub`,children:`The agent refines its own deployed files in place. A rebuild keeps an edited file, which then stops receiving source updates — export it, then Restore to take the new source.`}):L+R>0?(0,j.jsx)(`p`,{className:`sub`,children:`These files differ from the source: added in the install, or missing from it.`}):null]}),(0,j.jsxs)(`div`,{className:`row gap-10`,children:[(0,j.jsxs)(`button`,{className:`btn ghost danger-line`,disabled:d||_.size===0,onClick:M,children:[`Restore`,_.size?` (${_.size})`:``]}),(0,j.jsxs)(`button`,{className:`btn`,disabled:d,onClick:k,children:[(0,j.jsx)(o,{name:`download`}),`Export improvements`]})]})]}),p?(0,j.jsx)(`p`,{className:`sub mb-14`,children:p}):null,P.length?(0,j.jsxs)(`p`,{className:`sub dim mb-14`,title:P.map(e=>e.rel).join(`
|
|
3
|
-
`),children:[P.length,` linked — yours, left alone`]}):null,N.length===0&&F.length===0?(0,j.jsx)(T,{title:`In sync`,children:`This install matches its source.`}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`row between mb-14`,children:[(0,j.jsxs)(`div`,{className:`row gap-10`,children:[(0,j.jsxs)(`span`,{className:`badge warn`,children:[(0,j.jsx)(`span`,{className:`dot`}),I,` edited`]}),(0,j.jsxs)(`span`,{className:`badge`,children:[(0,j.jsx)(`span`,{className:`dot`}),L,` added`]}),R>0&&(0,j.jsxs)(`span`,{className:`badge bad`,children:[(0,j.jsx)(`span`,{className:`dot`}),R,` missing`]}),F.length>0&&(0,j.jsxs)(`span`,{className:`badge`,children:[(0,j.jsx)(`span`,{className:`dot`}),F.length,` behind`]})]}),(0,j.jsxs)(`div`,{className:`row gap-10`,children:[(0,j.jsx)(`button`,{className:`btn ghost sm`,onClick:()=>S(new Set(c.files.map(e=>e.rel))),children:`Expand all`}),(0,j.jsx)(`button`,{className:`btn ghost sm`,onClick:()=>S(new Set),children:`Collapse all`}),N.length?(0,j.jsxs)(`label`,{className:`row gap-8 dim sel-all`,children:[(0,j.jsx)(`input`,{type:`checkbox`,checked:_.size===N.length,onChange:O}),`Select all`]}):null]})]}),(0,j.jsx)(`div`,{className:`stack gap-12`,children:N.map(e=>B(e,!0))}),F.length?(0,j.jsxs)(`div`,{className:`stack gap-12 diff-behind`,children:[(0,j.jsx)(`h3`,{children:`Behind source`}),(0,j.jsxs)(`div`,{className:`row between`,children:[(0,j.jsx)(`p`,{className:`sub`,children:`This install is built from older source. Rebuild to bring these files in sync.`}),(0,j.jsx)(`button`,{className:`btn ghost`,disabled:d,onClick:()=>n?.(`build-all`),"aria-label":`Rebuild all installs`,children:`Rebuild`})]}),F.map(e=>B(e,!1))]}):null]})]});function B(e,t){let n=b.has(e.rel),r=e.status===`edited`&&e.diverged===!1,i=r&&e.rel.endsWith(`.md`),a=e.status===`stale`||e.status===`added`?``:e.status===`missing`?`bad`:i?`warn`:r?``:`warn`,s=r?`source unchanged`:e.status===`stale`?`behind source`:e.status;return(0,j.jsxs)(`div`,{className:`card diff-file${n?` open`:``}`,children:[(0,j.jsxs)(`div`,{className:`diff-head`,children:[t?(0,j.jsx)(`input`,{type:`checkbox`,className:`chk`,checked:_.has(e.rel),onChange:()=>D(e.rel),onClick:e=>e.stopPropagation(),"aria-label":`Select ${e.rel}`}):null,(0,j.jsx)(`span`,{className:`fname`,children:e.rel}),(0,j.jsxs)(`span`,{className:`badge ${a}`,children:[(0,j.jsx)(`span`,{className:`dot`}),s]}),(0,j.jsxs)(`span`,{className:`dim mono diff-lines`,children:[e.diff.length,` lines`]}),(0,j.jsx)(`button`,{className:`iconbtn`,onClick:()=>z(e.rel),"aria-label":n?`Collapse ${e.rel}`:`Expand ${e.rel}`,"aria-expanded":n,children:(0,j.jsx)(o,{name:`chevron`})})]}),n&&(0,j.jsx)(`div`,{className:`diff-body`,children:e.diff.map((e,t)=>(0,j.jsx)(`div`,{className:`diff-line ${ve(e)}`,children:e},t))})]},e.rel)}}function Se({group:e,i:t}){let n=e.problems.length===0,[r,i]=(0,A.useState)(!n);return(0,j.jsxs)(`div`,{className:`card check rise ${n?``:`bad`} ${r?`open`:``}`,style:{"--i":t*.6},children:[(0,j.jsxs)(`button`,{className:`check-head`,onClick:()=>i(e=>!e),disabled:n,"aria-expanded":n?void 0:r,children:[(0,j.jsx)(`span`,{className:`feed-dot ${n?`ok`:`bad`}`}),(0,j.jsx)(`h3`,{children:e.label}),(0,j.jsxs)(`span`,{className:`badge ${n?`ok`:`bad`}`,children:[(0,j.jsx)(`span`,{className:`dot`}),n?`clean`:`${e.problems.length} problem${e.problems.length===1?``:`s`}`]}),!n&&(0,j.jsx)(o,{name:`chevron`,className:`chev glyph`})]}),!n&&r&&(0,j.jsx)(`div`,{className:`check-body`,children:e.problems.map(e=>(0,j.jsxs)(`div`,{className:`problem`,children:[(0,j.jsx)(`span`,{className:`x`,children:`✕`}),(0,j.jsx)(`span`,{children:e})]},e))})]})}function Ce({dataRev:e}){let t=f(e),[n,r]=l(`doctor`,t);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(v,{className:`page-pick`,installs:t,value:n,onChange:r}),t===null?(0,j.jsx)(x,{}):(0,j.jsx)(we,{install:n,dataRev:e},n?.id||``)]})}function we({install:e,dataRev:t}){let n=(0,A.useRef)(!1),{data:r,error:a,reload:s,setData:c}=i(()=>{let t=n.current;return n.current=!1,w.doctor(t,h(e))},[t]),l=()=>{n.current=!0,c(null),s()};if(a)return(0,j.jsx)(m,{error:a,onRetry:s});let u=r?r.groups.filter(e=>e.problems.length):[],d=r?r.groups.filter(e=>!e.problems.length):[];return(0,j.jsxs)(`div`,{className:`page-fill`,children:[(0,j.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{className:`h`,children:`Doctor`}),(0,j.jsx)(`p`,{className:`sub`,children:`Builds this install’s voice in a sandbox and validates the result: token resolution, link integrity, and parity.`})]}),(0,j.jsxs)(`button`,{className:`btn`,onClick:l,disabled:!r,children:[(0,j.jsx)(o,{name:`refresh`}),r?`Run doctor`:`Running…`]})]}),r?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`card pad-md mb-16 doc-summary`,children:(0,j.jsxs)(`div`,{className:`row wrap between gap-12`,children:[(0,j.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,j.jsxs)(`span`,{className:`dim mono`,children:[`validated `,r.themes.length,` voice`,r.themes.length===1?``:`s`]}),r.checked_at?(0,j.jsxs)(`span`,{className:`dim mono`,title:r.checked_at,children:[`checked `,r.checked_at.slice(11)]}):null,r.themes.map(e=>(0,j.jsx)(`span`,{className:`badge cap`,children:e},e))]}),r.ok?(0,j.jsxs)(`span`,{className:`badge ok`,children:[(0,j.jsx)(`span`,{className:`dot`}),`all clean`]}):(0,j.jsxs)(`span`,{className:`badge bad`,children:[(0,j.jsx)(`span`,{className:`dot`}),r.problems.length,` problem`,r.problems.length===1?``:`s`]})]})}),(0,j.jsxs)(`div`,{className:`stack gap-12`,children:[u.map((e,t)=>(0,j.jsx)(Se,{group:e,i:t},e.label)),d.length?(0,j.jsxs)(`details`,{className:`check-fold`,children:[(0,j.jsxs)(`summary`,{children:[d.length,` clean check`,d.length===1?``:`s`]}),(0,j.jsx)(`div`,{className:`stack gap-12`,children:d.map((e,t)=>(0,j.jsx)(Se,{group:e,i:u.length+t},e.label))})]}):null]})]}):(0,j.jsx)(x,{label:`Running every check (builds this install’s voice in a sandbox)…`})]})}function Te({tab:e=`hosts`,item:t,overview:n,setup:i,themes:a,onAction:o,onMutated:s,dataRev:l}){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c,{title:`Installs`,sub:`Where the harness lives on this machine, and how each copy is built.`}),(0,j.jsx)(r,{page:`installs`,current:e,label:`Installs`}),e===`hosts`&&(0,j.jsx)(_e,{onAction:o,themes:a,currentTheme:n?.theme,overview:n,setup:i,dataRev:l,onMutated:s}),e===`profiles`&&(0,j.jsx)(oe,{onAction:o,dataRev:l,item:t}),e===`edits`&&(0,j.jsx)(be,{onMutated:s,onAction:o,dataRev:l,overview:n}),e===`doctor`&&(0,j.jsx)(Ce,{dataRev:l})]})}export{Te as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-C8nMUU1i.js";import{At as i,H as a,J as o,Y as s,et as c,gt as l,ht as u,it as d,nt as f,ot as p,pt as m,tt as h}from"./index-BILaKHbH.js";var g=e(t(),1);function _(e,t){return e===`pin`?`pin`:e===`map`?`tiers map`:e==="default"?`tier default`:t===`auto`?`session model`:`routing off`}var ee=(e,t)=>!t||t===`inherit`||e.some(e=>e.id===t&&e.provider!==`in-use`);function te(e,t){return Object.hasOwn(e.map||{},t)?e.map[t]:e.defaults?.[t]??``}var v=e=>`${e.id} ${e.name} ${e.providerName} ${e.note||``}`.toLowerCase();function y(e,t){let n=(t||``).trim().toLowerCase(),r=[];for(let t of e.groups||[]){let i=(e.models||[]).filter(e=>e.provider===t.provider&&e.source===t.source),a=n?i.filter(e=>v(e).includes(n)):i;(!n||a.length)&&r.push({...t,rows:a})}return r}function b(e){return typeof e==`number`?e>=1e6?`${+(e/1e6).toFixed(1)}M`:e>=1e3?`${Math.round(e/1e3)}k`:String(e):``}function x(e){if(!e)return``;let t=e=>e==null?`?`:`$${+e.toFixed(2)}`;return`${t(e.input)} in / ${t(e.output)} out per 1M`}var S=n();function ne({open:e,title:t,data:n,current:r,onPick:i,onClose:a}){let o=(0,g.useRef)(null),s=(0,g.useId)(),[c,l]=(0,g.useState)(``),[u,d]=(0,g.useState)(r&&r!==`inherit`?r:``);(0,g.useEffect)(()=>{let t=o.current;t&&(e&&!t.open&&(typeof t.showModal==`function`?t.showModal():t.setAttribute(`open`,``)),!e&&t.open&&(typeof t.close==`function`?t.close():t.removeAttribute(`open`)))},[e]);let f=(e,t)=>t.id===r&&!(e.provider===`in-use`&&t.detected),p=e?y(n,c):[],m=u.trim();return(0,S.jsxs)(`dialog`,{ref:o,className:`confirm model-picker`,"aria-labelledby":`${s}-title`,onCancel:a,onClose:a,children:[(0,S.jsx)(`h3`,{className:`confirm-title`,id:`${s}-title`,children:t}),(0,S.jsx)(`input`,{className:`inp mp-search`,type:`search`,"aria-label":`Search models`,placeholder:`Search models`,value:c,onChange:e=>l(e.target.value)}),(0,S.jsxs)(`div`,{className:`mp-list`,children:[p.map(e=>(0,S.jsxs)(`section`,{className:`mp-group`,"aria-label":e.providerName,children:[(0,S.jsxs)(`header`,{className:`mp-head`,children:[(0,S.jsx)(`span`,{className:`mp-name`,children:e.providerName}),(0,S.jsx)(`span`,{className:`dim`,children:e.note}),e.available===!1?(0,S.jsx)(`span`,{className:`tag warn`,children:e.reason||`unavailable`}):null]}),e.rows.map(t=>(0,S.jsxs)(`button`,{type:`button`,className:`mp-row${f(e,t)?` on`:``}`,disabled:t.available===!1,"aria-pressed":f(e,t),onClick:()=>i(t.id),title:t.available===!1?t.reason:void 0,children:[(0,S.jsxs)(`span`,{className:`mp-id`,children:[t.id===`inherit`?`Session model (inherit)`:t.name===t.id?t.id:t.name,t.id!==`inherit`&&t.name!==t.id?(0,S.jsxs)(`span`,{className:`dim mono`,children:[` `,t.id]}):null]}),(0,S.jsxs)(`span`,{className:`mp-meta`,children:[t.id===`inherit`?null:(0,S.jsx)(`span`,{className:`tag ${t.local?`ok`:``}`,children:t.local?`local`:`remote`}),t.context?(0,S.jsxs)(`span`,{className:`tag`,children:[b(t.context),` ctx`]}):null,t.cost?(0,S.jsx)(`span`,{className:`tag`,children:x(t.cost)}):null,t.reasoning?(0,S.jsx)(`span`,{className:`tag acc`,children:`reasoning`}):null,t.variants?.length?(0,S.jsxs)(`span`,{className:`tag`,children:[`variants: `,t.variants.join(`, `)]}):null,t.detected===!1?(0,S.jsx)(`span`,{className:`tag warn`,children:`not detected`}):null,t.available===!1?(0,S.jsx)(`span`,{className:`tag warn`,children:t.reason||`unavailable`}):null]})]},`${e.provider}|${t.id}`))]},`${e.provider}|${e.source}|${e.note}`)),e&&!p.some(e=>e.rows.length)&&c?(0,S.jsxs)(`p`,{className:`sub`,children:[`No model matches “`,c,`”.`]}):null]}),(0,S.jsxs)(`form`,{className:`mp-custom`,onSubmit:e=>{e.preventDefault(),m&&i(m)},children:[(0,S.jsxs)(`label`,{className:`mp-custom-label`,children:[(0,S.jsx)(`span`,{className:`dim`,children:`Custom…`}),(0,S.jsx)(`input`,{className:`inp`,type:`text`,"aria-label":`Custom model id`,placeholder:`provider/model, or the id as the host knows it`,value:u,onChange:e=>d(e.target.value)})]}),(0,S.jsx)(`button`,{type:`submit`,className:`btn ghost sm`,disabled:!m,children:`Use this id`})]}),(0,S.jsx)(`div`,{className:`confirm-actions`,children:(0,S.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:a,children:`Cancel`})})]})}var re=[[`standard`,`Standard`],[`light`,`Light`]],ie={strong:`acc`,standard:``,light:`ok`},C={strong:0,standard:1,light:2},w=[`off`,`auto`];function T({dataRev:e,onAction:t}){let n=p(),v=s(e),[y,b]=o(`models`,v),{data:x,error:T,setData:E,reload:D}=i(()=>Promise.resolve().then(()=>r.agentModels(l(y))),[e,y?.id??``]),[O,k]=(0,g.useState)({}),[A,j]=(0,g.useState)({}),[M,N]=(0,g.useState)(null),[P,F]=(0,g.useState)(null),[I,L]=(0,g.useState)(!1),[R,z]=(0,g.useState)(``),[B,V]=(0,g.useState)(!1),[H,U]=(0,g.useState)(!1),[ae,oe]=(0,g.useState)(y?.id);y?.id!==ae&&(oe(y?.id),k({}),j({}),N(null),U(!1),z(``));let W=(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(f,{className:`page-pick`,installs:v,value:y,onChange:b}),(0,S.jsx)(a,{title:`Models`,sub:`The model each sub-agent runs on, per install. Strong agents always use your session model.`})]});if(v!==null&&v.length===0)return(0,S.jsxs)(`div`,{className:`lib-wrap`,children:[W,(0,S.jsxs)(`p`,{className:`sub`,"data-testid":`models-no-install`,children:[`No Geneseed install is active, so there is no agent model to set.`,` `,(0,S.jsx)(`a`,{href:`#/installs`,children:`Install one on Installs →`})]})]});if(T)return(0,S.jsxs)(`div`,{className:`lib-wrap`,children:[W,(0,S.jsx)(c,{error:T})]});if(!x||!y)return(0,S.jsxs)(`div`,{className:`lib-wrap`,children:[W,(0,S.jsx)(h,{})]});let G=m(x.host).label;if(!x.claude)return(0,S.jsxs)(`div`,{className:`lib-wrap`,children:[W,(0,S.jsxs)(`p`,{className:`sub`,children:[G,` takes no per-agent model, so there is nothing to set here for`,` `,u(y),`.`]})]});let K=x.file?.problem,q=M??x.tiers,J=x.models||[],Y=e=>O[e]!==void 0,X=e=>Y(e)?O[e]===null?x.defaults?.[e]??``:O[e]:te(x,e),se=e=>A[e.name]===void 0?e.pin:A[e.name],Z=Object.keys(O).length+Object.keys(A).length,ce=I?[...x.agents].sort((e,t)=>(C[e.tier]??9)-(C[t.tier]??9)||e.name.localeCompare(t.name)):x.agents,Q=e=>{if(!e)return`Session model`;let t=J.find(t=>t.id===e&&t.provider!==`in-use`);return t&&t.name!==t.id?`${t.name} (${e})`:e},$=e=>ee(J,e)?null:(0,S.jsx)(`span`,{className:`tag warn`,children:`not detected`}),le=e=>{let{kind:t,key:n}=P;if(F(null),U(!1),t===`tier`){let t=e===`inherit`?``:e;k(e=>({...e,[n]:t===(x.defaults?.[n]??void 0)?null:t}))}else j(t=>({...t,[n]:e===`inherit`?null:e}))},ue=async()=>{V(!0),z(``);try{let e=await r.agentModelsSave({tiers:O,agents:A},l(y));E({...x,...e}),D(),k({}),j({}),U(!0)}catch(e){z(e.message)}finally{V(!1)}},de=async()=>{await n(`Rebuild this ${G} install with model routing ${q}? The models are written into the agent files; it rebuilds in place, non-destructive.`,{title:`Rebuild this install?`,confirmLabel:`Rebuild`})&&t?.(`install`,{host:y.host,scope:y.scope,path:y.path,tiers:q})},fe=P?P.kind===`tier`?X(P.key)||`inherit`:(A[P.key]===void 0?x.agents.find(e=>e.name===P.key)?.pin:A[P.key])||`inherit`:null;return(0,S.jsxs)(`div`,{className:`lib-wrap models-page`,children:[W,(0,S.jsx)(c,{error:R,style:{margin:`0 0 var(--sp-3)`}}),K?(0,S.jsxs)(`p`,{className:`sub tiers-warn`,role:`alert`,children:[K,`.`]}):null,x.warnings.map(e=>(0,S.jsx)(`p`,{className:`sub tiers-warn`,role:`note`,children:e},e)),(0,S.jsxs)(`div`,{className:`panel models-routing`,children:[(0,S.jsxs)(`div`,{className:`panel-head`,children:[(0,S.jsx)(`h2`,{children:`Routing`}),(0,S.jsx)(d,{"aria-label":`Model routing for ${u(y)}`,children:w.map(e=>(0,S.jsx)(`button`,{type:`button`,className:q===e?`on`:``,"aria-pressed":q===e,onClick:()=>{N(e===x.tiers?null:e),U(!1)},children:e},e))})]}),(0,S.jsxs)(`p`,{className:`panel-note`,children:[q===`auto`?`Agents run on the model of their tier, unless you pin one. Applied at the next rebuild.`:`Every agent runs on your session model, unless you pin one.`,M===null?``:` Not rebuilt yet.`]})]}),(0,S.jsxs)(`div`,{className:`panel models-tiers`,role:`group`,"aria-label":`Models by tier`,children:[(0,S.jsx)(`div`,{className:`panel-head`,children:(0,S.jsx)(`h2`,{children:`Tiers`})}),(0,S.jsxs)(`div`,{className:`models-tier-row`,children:[(0,S.jsx)(`span`,{children:`Strong`}),(0,S.jsx)(`span`,{className:`dim`,children:`session model, always`})]}),re.map(([e,t])=>{let n=X(e);return(0,S.jsxs)(`div`,{className:`models-tier-row`,children:[(0,S.jsx)(`span`,{children:t}),(0,S.jsx)(`button`,{type:`button`,className:`btn ghost sm models-model`,disabled:!!K||B,"aria-label":`${t} tier model: ${Q(n)}. Change`,onClick:()=>F({kind:`tier`,key:e}),children:Q(n)}),$(n),Y(e)?(0,S.jsx)(`span`,{className:`tag acc`,children:`unsaved`}):null]},e)}),(0,S.jsx)(`p`,{className:`panel-note`,children:Object.keys(x.defaults||{}).length?`Host defaults: ${Object.entries(x.defaults).map(([e,t])=>`${e} ${t}`).join(`, `)}.`:`${G} has no default model for a tier: a tier routes once you pick one.`})]}),(0,S.jsx)(`div`,{className:`panel flush models-agents`,children:(0,S.jsxs)(`table`,{className:`ldg`,"aria-label":`Agents`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{scope:`col`,children:`Agent`}),(0,S.jsx)(`th`,{scope:`col`,"aria-sort":I?`ascending`:`none`,children:(0,S.jsxs)(`button`,{type:`button`,className:`btn ghost sm`,onClick:()=>L(e=>!e),children:[`Tier`,I?` ▲`:``]})}),(0,S.jsx)(`th`,{scope:`col`,children:`Runs on`}),(0,S.jsx)(`th`,{scope:`col`,children:`Because`}),(0,S.jsx)(`th`,{scope:`col`,children:`Pin`})]})}),(0,S.jsx)(`tbody`,{children:ce.map(e=>{let t=se(e);return(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`td`,{className:`mono`,children:e.name}),(0,S.jsx)(`td`,{children:e.tier?(0,S.jsx)(`span`,{className:`tag ${ie[e.tier]??``}`,children:e.tier}):(0,S.jsx)(`span`,{className:`tag`,title:`No Geneseed source: not tiered`,children:`not tiered`})}),(0,S.jsx)(`td`,{className:`mono`,children:e.model?Q(e.model):(0,S.jsx)(`span`,{className:`dim`,children:`session model`})}),(0,S.jsx)(`td`,{className:`dim`,children:_(e.from,x.tiers)}),(0,S.jsx)(`td`,{children:(0,S.jsxs)(`span`,{className:`row gap-8 wrap`,children:[(0,S.jsx)(`button`,{type:`button`,className:`btn ghost sm models-model`,disabled:!!K||B,"aria-label":`Pin a model for ${e.name}`,onClick:()=>F({kind:`pin`,key:e.name}),children:t?Q(t):`No pin`}),t?$(t):null,A[e.name]===void 0?null:(0,S.jsx)(`span`,{className:`tag acc`,children:`unsaved`}),t?(0,S.jsx)(`button`,{type:`button`,className:`btn ghost sm`,disabled:!!K||B,"aria-label":`Clear the pin of ${e.name}`,onClick:()=>{j(t=>({...t,[e.name]:null})),U(!1)},children:`Clear`}):null]})})]},e.name)})})]})}),(0,S.jsxs)(`div`,{className:`models-foot row gap-8 wrap`,children:[(0,S.jsx)(`span`,{className:`sub`,role:`status`,children:Z?`${Z} unsaved change${Z===1?``:`s`}`:H?`Saved. The agent files change at the next rebuild.`:`No unsaved changes.`}),(0,S.jsx)(`button`,{type:`button`,className:`btn`,disabled:!Z||!!K||B,onClick:ue,children:`Save`}),(0,S.jsx)(`button`,{type:`button`,className:`btn ghost`,disabled:Z>0||B,onClick:de,children:`Rebuild…`})]}),(0,S.jsx)(ne,{open:!!P,title:P?P.kind===`tier`?`${P.key} tier model`:`Model for ${P.key}`:``,data:x,current:fe,onPick:le,onClose:()=>F(null)},P?`${P.kind}:${P.key}`:`closed`)]})}export{T as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-C8nMUU1i.js";import{At as i,H as a,W as o,Y as s,et as c,gt as l,ht as u,it as d,nt as f,ot as p,q as m,tt as h}from"./index-BILaKHbH.js";import{t as g}from"./Tabs-BHjxciOL.js";import{t as _}from"./EmptyState-CY5Pm2xy.js";import{a as v,i as y}from"./router-1EhRJy1C.js";import{t as b}from"./Markdown-CxkA7940.js";import x,{installLabel as S}from"./Library-DdzyrwUK.js";var C=e(t(),1),w=e=>e(`Discard your unsaved edit?`,{title:`Unsaved edit`,confirmLabel:`Discard`,tone:`danger`}),T=`The file changed on disk — reloaded the fresh copy. Your draft is kept.`;function E({data:e,reload:t}){let n=p(),[r,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(!1),[l,u]=(0,C.useState)(``),d=e?.fingerprint||``,f=r!==null&&JSON.stringify(r)!==JSON.stringify(a),m=(0,C.useRef)(!1),h=e=>{i(e),o(e)},g=()=>i(null);return(0,C.useEffect)(()=>{if(!f)return;let e=e=>{e.preventDefault(),e.returnValue=``};window.addEventListener(`beforeunload`,e);let t=v(({to:e})=>(m.current||(m.current=!0,w(n).then(n=>{n&&(t(),i(null),y(e))}).finally(()=>{m.current=!1})),!1));return()=>{window.removeEventListener(`beforeunload`,e),t()}},[f,n]),{draft:r,setDraft:i,open:h,close:g,discard:async()=>f&&!await w(n)?!1:(g(),!0),dirty:f,busy:s,notice:l,setNotice:u,save:async(e,{conflict:n}={})=>{c(!0),u(``);try{return await e(d)||!0}catch(e){e.status===409?u(n??T):u(e.message);return}finally{c(!1),t()}}}}var D=n(),O=(e,t)=>`${e} ${t}${e===1?``:`s`}`,k=e=>`≈${e.toLocaleString(`en-US`)} tokens`,ee={title:``,body:``,scope:`project`,trial_until:``},A=[`project`,`global`],j=e=>e===`user`?`global`:e,M=/\r\n|[\n\r\v\f\x1c\x1d\x1e\x85\u2028\u2029]/,N=e=>e.startsWith(`## `)||/^##\s+R\d+\s*[—–-]+\s*\S/.test(e),te=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Your draft is kept — Save again.`,ne=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Try again.`;function P({value:e,onChange:t,onCancel:n,onSave:r,busy:i,writeTo:a=null}){let[o]=(0,C.useState)(e.scope),s=n=>r=>t({...e,[n]:r.target.value}),c=e.body.trim().split(M).some(N)?`A line cannot start with “## ” — user-rules.md reads it as a new rule heading. Use ### or plain text.`:``,l=!(e.title.trim()&&e.body.trim()),u=!l&&!c;return(0,D.jsxs)(`div`,{className:`rule-form`,children:[a,(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule title`}),(0,D.jsx)(`input`,{className:`lib-filter`,type:`text`,value:e.title,onChange:s(`title`),placeholder:`Title — short and imperative (e.g. No emoji in commit subjects)`,autoFocus:!0})]}),(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule body`}),(0,D.jsx)(`textarea`,{className:`rule-body-input`,value:e.body,onChange:s(`body`),rows:4,placeholder:`The rule, stated plainly and testably, in one short paragraph.`,"aria-invalid":c?!0:void 0,"aria-describedby":c?`rule-body-error`:void 0})]}),c?(0,D.jsx)(`p`,{id:`rule-body-error`,className:`sub sub-wide rule-notice`,role:`alert`,children:c}):null,(0,D.jsxs)(`div`,{className:`row wrap`,children:[(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule scope`}),(0,D.jsxs)(`select`,{className:`sel`,value:e.scope,onChange:s(`scope`),children:[(0,D.jsx)(`option`,{value:`project`,children:`scope: project (this repo, committable)`}),(0,D.jsx)(`option`,{value:`global`,children:`scope: global (every repository)`}),A.includes(o)?null:(0,D.jsxs)(`option`,{value:o,children:[`scope: `,o,` (as written in the file)`]})]})]}),(0,D.jsxs)(`label`,{className:`rule-trial-label`,children:[`trial until`,(0,D.jsx)(`input`,{className:`lib-filter rule-date`,type:`date`,value:e.trial_until,onChange:s(`trial_until`),"aria-label":`Trial until date (optional)`})]}),(0,D.jsxs)(`div`,{className:`row gap-8`,style:{marginLeft:`auto`},children:[(0,D.jsx)(`button`,{className:`btn sm`,disabled:!u||i,onClick:()=>r(e),"aria-describedby":l?`rule-form-hint`:void 0,children:i?`Saving…`:`Save rule`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:i,onClick:n,children:`Cancel`})]})]}),l?(0,D.jsx)(`p`,{id:`rule-form-hint`,className:`panel-note`,children:`A rule needs a title and a body.`}):null]})}function re({rule:e,tag:t,usual:n,isOpen:r,onToggle:i,onEdit:a,onDelete:o,onGraduate:s}){let c=t?` · ${t}`:``;return(0,D.jsxs)(`div`,{className:`rule-row ${r?`on`:``}`,children:[(0,D.jsxs)(`button`,{className:`rule-head`,onClick:i,"aria-expanded":r,"data-rule-head":e.key,children:[(0,D.jsxs)(`span`,{className:`rule-no`,children:[`R`,e.id]}),(0,D.jsx)(`span`,{className:`rule-title`,children:e.title}),j(e.scope)===n?null:(0,D.jsx)(`span`,{className:`rule-chip ${e.scope===`user`?`user`:``}`,children:e.scope}),e.status===`trial`&&(0,D.jsx)(`span`,{className:`rule-chip trial ${e.overdue?`overdue`:``}`,children:e.overdue?`review due`:`trial · ${e.trial_until}`}),(0,D.jsx)(`span`,{className:`rule-chip mono`,children:k(e.tokens)})]}),r&&(0,D.jsxs)(`div`,{className:`rule-expand`,children:[(0,D.jsx)(`p`,{children:e.body}),e.source?(0,D.jsxs)(`div`,{className:`rule-src`,children:[`source: `,e.source]}):null,(0,D.jsxs)(`div`,{className:`row gap-8`,style:{marginTop:10},children:[e.status===`trial`&&(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:s,title:`Adopt for good — drop the trial marker`,"aria-label":`Graduate R${e.id}${c}`,children:`Graduate`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:a,"aria-label":`Edit R${e.id}${c}`,children:`Edit`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:o,"aria-label":`Retire R${e.id}${c}`,children:`Retire`})]})]})]})}var F=(e,t)=>({approve:`Approve`,reject:`Reject`,host:`Use the ${e.choice?.host} file`,shared:`Use the shared file`,both:`Keep both`})[t];function I({choice:e}){let t=(e,t,n)=>(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`rule-src`,title:t,children:e}),(0,D.jsx)(`pre`,{className:`mono`,children:n??`(absent)`})]});return(0,D.jsxs)(`div`,{className:`rule-choice`,children:[t(`Shared file`,e.shared_path,e.shared_text),t(`${e.host} file`,e.host_path,e.host_text)]})}function ie({drafts:e,deciding:t,onDecide:n}){return e.length?(0,D.jsxs)(`section`,{className:`mb-16`,"aria-labelledby":`rules-pending`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`rules-pending`,children:`Pending`}),(0,D.jsx)(`span`,{className:`mono dim`,children:e.length})]}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Waiting in `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.draft.md`}),`. A pending rule still binds on its host, and only there. Decide each one here, or ask the agent to run its rule Rite.`]}),(0,D.jsx)(`div`,{className:`card rules-list`,children:e.map((e,r)=>(0,D.jsxs)(`div`,{className:`rule-row`,children:[(0,D.jsxs)(`div`,{className:`rule-head static`,children:[(0,D.jsx)(`span`,{className:`rule-title`,children:e.title}),e.host?(0,D.jsxs)(`span`,{className:`rule-chip mono`,children:[`binds on `,e.host]}):null]}),(0,D.jsxs)(`div`,{className:`rule-expand`,children:[e.body?(0,D.jsx)(`p`,{children:e.body}):null,e.choice?(0,D.jsx)(I,{choice:e.choice}):null,e.held?(0,D.jsx)(`p`,{className:`rule-src`,children:`The shared file already holds this rule. The next rebuild clears it.`}):null,e.decisions?.length?(0,D.jsx)(`div`,{className:`row gap-8`,style:{marginTop:10},children:e.decisions.map(r=>(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:t!==``,"aria-label":`${F(e,r)} · ${e.title}`,onClick:()=>n(e,r),children:F(e,r)},r))}):null]})]},e.key??r))})]}):null}function L({onChanged:e,dataRev:t,onAction:n}){let i=p(),{targets:a,sets:o,failed:s,reason:d,reload:g}=m(r.rules,t),[v,y]=(0,C.useState)(null),b=E({data:null,reload:g}),{draft:x,busy:S,notice:w}=b,[T,A]=(0,C.useState)(``),[M,N]=(0,C.useState)(null),F=(0,C.useRef)(null),[I,L]=(0,C.useState)(0),R=e=>{F.current=e,L(e=>e+1)},z=(0,C.useRef)(null),B=(0,C.useRef)(null);if((0,C.useEffect)(()=>{let e=F.current;if(F.current=null,e===null)return;let t=[...B.current?.querySelectorAll(`[data-rule-head]`)||[]];(e===`add`?z.current:t.find(t=>t.dataset.ruleHead===e))?.focus()},[I]),o&&!o.length&&d)return(0,D.jsx)(c,{error:d,onRetry:g});if(!o)return(0,D.jsx)(h,{});let V=a.length>1,H=e=>e?.id??``,U=e=>e?.shared?`shared`:u(e),W=o.flatMap(({inst:e,data:t})=>(t.rules||[]).map(t=>({...t,inst:e,key:`${H(e)}#${t.id}`}))),G=o.filter(e=>e.data.exists).map(e=>e.inst),K=G.length>0,q=x?.target,J=q!==void 0&&q!==`new`&&!W.some(e=>e.key===q&&e.title===x.title0),Y=q===`new`||J,X=x?.to!==void 0&&!G.some(e=>H(e)===x.to),Z=X?null:G.find(e=>H(e)===x?.to)??G[0]??null,ae=X?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`alert`,children:`The install this draft was for has no user-rules.md now, so it is not saved anywhere else. Cancel it, or copy the text into a new rule.`}):G.length>1?(0,D.jsx)(f,{installs:G,value:Z,onChange:e=>b.setDraft({...x,to:e.id}),tagOf:U}):V&&Z?(0,D.jsxs)(`p`,{className:`install-pick`,children:[(0,D.jsx)(`span`,{className:`dim`,children:`Install:`}),` `,(0,D.jsx)(`span`,{className:`mono`,children:U(Z)})]}):null,Q=async(t,n,i)=>{let a=o.find(e=>H(e.inst)===H(n))?.data.fingerprint||``,s=await b.save(()=>r.rulesMutate({...t,fingerprint:a},l(n)),{conflict:i?te:ne});return s&&i&&b.close(),e?.(),s},$=e=>b.setDraft({...x,form:e}),oe=async(e,t,n)=>{await Q(e,t,!0)&&R(n)},se=async e=>{await b.discard()&&R(e)},ce=async e=>{await i(`Retire rule R${e.id} — “${e.title}”${V?` from ${U(e.inst)}`:``}? It moves to user-rules-retired.md, which is never loaded.`,{title:`Retire this rule?`,confirmLabel:`Retire`,tone:`danger`})&&await Q({op:`delete`,id:e.id},e.inst)&&x===null&&R(`add`)},le=async e=>{await Q({op:`update`,id:e.id,title:e.title,body:e.body,scope:e.scope,source:e.source,trial_until:``},e.inst)&&R(e.key)},ue=(e,t)=>{let n=e.choice?.file;return t===`approve`?i(`Approve “${e.title}”? It moves to the shared file under a new number and binds every host on this machine. A rule may tighten a law, never repeal one: check that it does not.`,{title:`Approve this rule?`,confirmLabel:`Approve`}):t===`host`?i(`Make the ${e.choice.host} file the shared ${n}? The current shared file is replaced, and a copy goes to archived-${n}/ beside it.`,{title:`Replace the shared file?`,confirmLabel:`Replace`,tone:`danger`}):t!==`shared`||i(`Keep the shared ${n}? The ${e.choice.host} file moves to archived-${n}/ beside it, and that host returns to its seed at the next rebuild.`,{title:`Move the host file aside?`,confirmLabel:`Move aside`,tone:`danger`})},de=async(t,n)=>{if(await ue(t,n)){A(t.key),N(null),b.setNotice(``);try{let e=await r.rulesDecide({key:t.key,decision:n,fingerprint:t.fingerprint},l(t.inst));N({rebuild:e.rebuild,cleared:e.cleared??[]})}catch(e){let t=e.body?.cleared?.length?` Cleared: ${e.body.cleared.join(`, `)}.`:``;b.setNotice(e.status===409?`${e.body?.detail??e.message}${t} Reloaded the fresh copy.`:e.message)}finally{A(``),g(),e?.()}}},fe=async()=>{await i(`Rebuild every active install? Each is rebuilt in place from source with its own settings; files you edited are kept.`,{title:`Rebuild all active installs?`,confirmLabel:`Rebuild all`})&&n(`build-all`)},pe=o.flatMap(({inst:e,data:t})=>(t.warnings||[]).map(t=>V?`${U(e)}: ${t}`:t)),me=o.flatMap(({inst:e,data:t})=>(t.drafts||[]).map(n=>({...n,inst:e,fingerprint:t.draft_fingerprint}))),he=o.filter(e=>e.data.exists),ge=e=>e?.scope===`project`?`project`:`global`,_e=e=>!J&&q===e.key?(0,D.jsx)(`div`,{className:`rule-row on`,children:(0,D.jsx)(`div`,{className:`rule-expand`,style:{paddingTop:14},children:(0,D.jsx)(P,{value:x.form,onChange:$,busy:S,onCancel:()=>se(e.key),onSave:t=>oe({op:`update`,id:e.id,source:e.source,...t},e.inst,e.key)})})},e.key):(0,D.jsx)(re,{rule:e,tag:V?U(e.inst):null,usual:ge(e.inst),isOpen:v===e.key,onToggle:()=>y(v===e.key?null:e.key),onEdit:()=>{y(e.key),b.open({target:e.key,no:e.id,to:H(e.inst),title0:e.title,form:{title:e.title,body:e.body,scope:j(e.scope),trial_until:e.trial_until}})},onDelete:()=>ce(e),onGraduate:()=>le(e)},e.key);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsxs)(`div`,{className:`head-text`,children:[(0,D.jsx)(`h2`,{className:`h`,children:`Rules`}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Your standing rules, from `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),`. The agent obeys them in every session, so keep the set small. `,(0,D.jsx)(`a`,{href:`#/docs/rules`,children:`Docs`})]})]}),K&&x===null&&(0,D.jsx)(`button`,{className:`btn`,ref:z,onClick:()=>b.open({target:`new`,title0:``,form:ee}),children:`Add rule`})]}),w?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:w}):null,s.length?(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:[`Could not read user-rules.md of`,` `,s.map(e=>e?u(e):`the default install`).join(`, `),`.`]}):null,pe.map(e=>(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,children:[`format warning: `,e]},e)),M?(0,D.jsxs)(`p`,{className:`sub sub-wide`,role:`status`,children:[`Decided.`,` `,M.rebuild?`A rebuild removes the host copy.`:`The host file stays as it is.`,M.cleared.length?` Cleared: ${M.cleared.join(`, `)}.`:``,` `,M.rebuild&&n?(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:fe,children:`Rebuild all`}):null]}):null,(0,D.jsx)(ie,{drafts:me,deciding:T,onDecide:de}),Y&&(0,D.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,D.jsx)(`div`,{className:`eyebrow`,style:{marginBottom:10},children:`new rule`}),J?(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:[`Rule R`,x.no,` is no longer in user-rules.md (an agent session removed or renumbered it). Your draft is kept — Save adds it as a new rule.`]}):null,(0,D.jsx)(P,{value:x.form,onChange:$,busy:S,writeTo:ae,onCancel:()=>se(`add`),onSave:e=>!X&&G.length&&oe({op:`add`,...e},Z,`add`)})]}),K?W.length===0&&!Y?(0,D.jsx)(_,{title:`No rules yet`,children:`The file is seeded and loaded every session, and it is empty. Add your first standing rule here, ask the agent for one in a session (the rule skill), or promote a recurring fact from Memory.`}):(0,D.jsx)(`div`,{ref:B,children:he.map(({inst:e,data:t})=>(0,D.jsxs)(`section`,{className:`mb-16`,"aria-label":V?U(e):`Rules`,children:[(0,D.jsxs)(`div`,{className:`rules-file`,children:[V?(0,D.jsx)(`b`,{className:`mono`,children:U(e)}):null,(0,D.jsxs)(`span`,{className:`mono dim`,children:[O(t.rules.length,`rule`),` · `,k(t.stats.tokens),` every turn · scope `,ge(e),` unless marked`]})]}),t.rules.length?(0,D.jsx)(`div`,{className:`card rules-list`,children:W.filter(t=>t.inst===e).map(_e)}):null]},H(e)))}):(0,D.jsxs)(_,{title:`No user-rules.md here yet`,children:[`The build seeds it. Rebuild on the Overview, or run`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`geneseed update`}),`, and it appears, ready for your rules.`]})]})}var R=`PROFILE.md changed on disk since you opened it — reloaded the fresh copy. Your draft is kept — Save again.`,z=e=>e?.id??``;function B({onChanged:e,dataRev:t}){let{targets:n,sets:i,failed:a}=m(r.profile,t);if(!i)return(0,D.jsx)(h,{});let o=new Set(a.map(z)),s=new Set([...i.map(e=>z(e.inst)),...o]),c=n.filter(e=>s.has(z(e))).map(e=>({install:e,tag:n.length<2?null:e?.shared&&!o.has(z(e))?`shared`:u(e)}));return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`mb-16`,children:[(0,D.jsx)(`h2`,{className:`h`,children:`Profile`}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Who you are and how you like to work, from `,(0,D.jsx)(`code`,{className:`mono`,children:`PROFILE.md`}),`. It guides the agent and never binds it. `,(0,D.jsx)(`a`,{href:`#/docs/collaboration`,children:`Docs`})]})]}),c.map(({install:t,tag:n})=>(0,D.jsx)(V,{install:t,tag:n,onChanged:e},z(t)))]})}function V({install:e,tag:t,onChanged:n}){let{data:a,error:o,loading:s,reload:u,setData:f}=i(()=>r.profile(l(e)),[]),p=E({data:a,reload:u}),{draft:m,dirty:g,busy:v,notice:y}=p,[x,S]=(0,C.useState)(!1);if(a&&!x&&(S(!0),(a.text||``).trim()||p.open(a.text||``)),s&&!a)return(0,D.jsx)(h,{});if(o)return(0,D.jsxs)(`section`,{"aria-label":t?`Profile, ${t}`:void 0,children:[t?(0,D.jsx)(`span`,{className:`rule-chip mono`,children:t}):null,(0,D.jsx)(c,{error:o,onRetry:u})]});let w=m!==null,T=a?.text||``;return(0,D.jsxs)(`section`,{"aria-label":t?`Profile, ${t}`:void 0,children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsx)(`div`,{children:t?(0,D.jsx)(`span`,{className:`rule-chip mono`,children:t}):null}),(0,D.jsxs)(`div`,{className:`row`,children:[(0,D.jsxs)(d,{"aria-label":t?`Profile mode, ${t}`:`Profile mode`,children:[(0,D.jsx)(`button`,{className:w?``:`on`,"aria-pressed":!w,onClick:p.discard,children:`View`}),(0,D.jsx)(`button`,{className:w?`on`:``,"aria-pressed":w,onClick:()=>w||p.open(T),children:`Edit`})]}),w&&(0,D.jsx)(`button`,{className:`btn`,disabled:!g||v,onClick:async()=>{let t=await p.save(t=>r.profileSave({text:m,fingerprint:t},l(e)),{conflict:R});t&&(f(e=>({...e,text:m,seeded:!1,fingerprint:t.fingerprint||``})),p.setNotice(`Saved.`),p.close(),n?.())},children:v?`Saving…`:`Save`})]})]}),y?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:y}):null,w?(0,D.jsx)(`textarea`,{className:`rule-body-input`,style:{width:`100%`,minHeight:`60vh`,fontFamily:`var(--mono, monospace)`},value:m,onChange:e=>p.setDraft(e.target.value),spellCheck:!1,"aria-label":`Profile markdown`}):T.trim()?(0,D.jsxs)(D.Fragment,{children:[a?.seeded?(0,D.jsxs)(_,{title:`This is still the template`,children:[`Ask the agent to run the `,(0,D.jsx)(`code`,{className:`mono`,children:`profile`}),` skill — it interviews you and drafts this file with your consent.`]}):null,(0,D.jsx)(`div`,{className:`card pad-lg`,children:(0,D.jsx)(b,{body:T})})]}):(0,D.jsxs)(_,{title:`No profile yet`,children:[`Switch to Edit to write one, or ask the agent to run the`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`profile`}),` skill.`]})]})}var H=(e,t)=>`${e} ${t}${e===1?``:`s`}`,U=e=>e?(e.items||[]).length:null,W=/^- \[([^\]]*)\]\(topics\/[^)]+\.md\) — (\d+) facts?$/,G=e=>String(e||``).split(`
|
|
2
|
-
`).map(e=>W.exec(e.trim())).filter(Boolean).map(e=>({topic:e[1],n:Number(e[2])}));function K({topics:e,install:t,shared:n}){return e.length?(0,D.jsxs)(`section`,{className:`panel pm-topics`,"aria-labelledby":`pm-topics`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`pm-topics`,children:`Topics`}),t&&!n?(0,D.jsx)(`span`,{className:`mono dim`,children:S(t)}):null,(0,D.jsx)(`span`,{className:`mono dim`,children:H(e.length,`topic`)})]}),(0,D.jsx)(`ul`,{className:`hbars`,children:e.map(e=>(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`span`,{className:`hb-label`,children:e.topic}),(0,D.jsx)(`span`,{className:`mono hb-n`,children:H(e.n,`fact`)})]},e.topic))})]}):null}var q={memory:{title:`No facts yet`,body:(0,D.jsxs)(`div`,{className:`pm-first`,children:[(0,D.jsx)(`p`,{children:`The agent writes a fact when a session teaches it something durable: a decision, a correction, a trap. Say “remember that…” in any session, and it asks whether that belongs here or in your standing rules.`}),(0,D.jsxs)(`ul`,{children:[(0,D.jsx)(`li`,{children:`One fact per file, filed under a topic.`}),(0,D.jsx)(`li`,{children:`Stale facts move to Archived; nothing is deleted without you.`}),(0,D.jsx)(`li`,{children:`The store stays on this machine and out of git.`})]})]}),action:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`a`,{className:`btn ghost`,href:`#/docs/memory`,children:`How memory works`}),(0,D.jsx)(`a`,{className:`btn ghost`,href:`#/item/skill/rule`,children:`The rule skill`})]})},notebook:{title:`No notes yet`,body:`The notebook is the agent’s own scratch space: plans and notes it keeps for itself.`}};function J({tab:e=`rules`,item:t,dataRev:n,onCountsChanged:c,onAction:l}){let u=e=>Promise.resolve(e).catch(()=>null),d=s(n),{reload:f}=o(n),{data:p,error:m,reload:h}=i(()=>r.profile(),[n]),{data:v,reload:y}=i(()=>r.catalog(`memory`),[`memory`,n],`catalog`),{data:b}=i(()=>r.catalog(`notebook`),[`notebook`,n],`catalog`),S=U(v),{data:C}=i(()=>e===`memory`?u(r.item(`memory`,`MEMORY`)):Promise.resolve(null),[`memory-map`,e,n,S]),w=U(b),T={memory:S,notebook:w},E={profile:m?`read failed`:p?.seeded?`template`:null,memory:S,notebook:w},O=e===`memory`||e===`notebook`;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(a,{title:`Personal`,sub:`The only files you write. They survive updates, reinstalls and voice changes.`+(d?.some(e=>e.shared)?` Global installs share one copy of the rules, profile and memory; a project install keeps its own.`:``)}),(0,D.jsx)(g,{page:`personal`,current:e,badges:E,label:`Personal files`}),e===`rules`&&(0,D.jsx)(L,{onChanged:f,dataRev:n,onAction:l}),e===`profile`&&(0,D.jsx)(B,{onChanged:h,dataRev:n}),O&&T[e]===0&&!t?(0,D.jsx)(_,{title:q[e].title,action:q[e].action,children:q[e].body}):O?(0,D.jsxs)(D.Fragment,{children:[e===`memory`&&(0,D.jsx)(K,{topics:G(C?.body),install:C?.install,shared:C?.shared}),(0,D.jsx)(x,{lock:e,base:`#/personal/${e}`,selected:t,dataRev:n,onCountsChanged:c,onRulesChanged:()=>{f(),y()}},e)]}):null]})}export{J as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";e();var n=t();function r({label:e,value:t,options:r,onChange:i}){return r.length?(0,n.jsx)(`select`,{className:`sel`,"aria-label":e,value:t,onChange:e=>i(e.target.value),children:r.map(e=>(0,n.jsx)(`option`,{value:e,children:e},e))}):null}var i=[`lean`,`full`];function a({on:e,disabled:t,label:r,onToggle:i}){return(0,n.jsx)(`input`,{type:`checkbox`,role:`switch`,className:`sw-toggle${e?` on`:``}`,checked:e,"aria-checked":e,disabled:t,"aria-label":r,onChange:i,onKeyDown:e=>{e.key===`Enter`&&!t&&i()}})}var o=[{key:`theme`,name:`voice`,title:`Voice`},{key:`footprint`,name:`footprint`,title:`Footprint`},{key:`posture`,name:`posture`,title:`Posture`},{key:`mode`,name:`mode`,title:`Mode`},{key:`trust`,name:`trust`,title:`Loop trust`}];function s({value:e,options:t,onChange:i,who:a}){return o.map(o=>(0,n.jsxs)(`label`,{className:`dp-field`,children:[(0,n.jsx)(`span`,{children:o.title}),(0,n.jsx)(r,{label:`${o.name} for ${a}`,value:e[o.key],options:t[o.key],onChange:e=>i(o.key,e)})]},o.key))}export{a as i,s as n,r,i as t};
|