total-recall-brain 3.40.7 → 3.41.0
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/bin/total-recall-memory.mjs +0 -0
- package/bin/total-recall.mjs +9 -40
- package/docs/reference/cli-reference.md +65 -1
- package/frontend/dist/assets/{index-AGUes-VG.css → index-BG9NkVUy.css} +1 -1
- package/frontend/dist/assets/{index-Bt5iVPZj.js → index-BtuiZqwP.js} +20 -7
- package/frontend/dist/index.html +2 -2
- package/frontend/src/components/plugins/PluginPanel.tsx +31 -5
- package/frontend/src/components/plugins/card/CardEngine.tsx +15 -23
- package/frontend/src/components/plugins/card/CardScenes.tsx +52 -23
- package/frontend/src/components/plugins/card/card.css +2 -5
- package/frontend/src/components/plugins/card/contract.ts +13 -19
- package/frontend/src/components/plugins/card/format.ts +8 -1
- package/frontend/src/components/plugins/card/widgets.tsx +4 -35
- package/frontend/src/components/plugins/plugin-frame.ts +30 -3
- package/frontend/src/pages/PluginsPage.tsx +3 -2
- package/package.json +1 -1
- package/scaffold/.agent/skills/plugin/SKILL.md +110 -0
- package/scaffold/.agent/skills/plugin/evals/README.md +53 -0
- package/scaffold/.agent/skills/plugin/evals/cases/01-fabricated-seed.mjs +42 -0
- package/scaffold/.agent/skills/plugin/evals/cases/02-reassuring-default.mjs +39 -0
- package/scaffold/.agent/skills/plugin/evals/cases/03-declared-template.mjs +32 -0
- package/scaffold/.agent/skills/plugin/evals/cases/04-card-collects-credential.mjs +46 -0
- package/scaffold/.agent/skills/plugin/evals/cases/05-host-leak-in-scaffold.mjs +55 -0
- package/scaffold/.agent/skills/plugin/evals/cases/06-correct-plugin.mjs +92 -0
- package/scaffold/.agent/skills/plugin/evals/run.mjs +118 -0
- package/scaffold/.agent/skills/plugin/prompts/01-function.md +29 -0
- package/scaffold/.agent/skills/plugin/prompts/02-surfaces.md +43 -0
- package/scaffold/.agent/skills/plugin/prompts/03-scaffold.md +31 -0
- package/scaffold/.agent/skills/plugin/prompts/04-cli.md +49 -0
- package/scaffold/.agent/skills/plugin/prompts/05-credentials.md +41 -0
- package/scaffold/.agent/skills/plugin/prompts/06-card.md +46 -0
- package/scaffold/.agent/skills/plugin/prompts/07-scaffold.md +52 -0
- package/scaffold/.agent/skills/plugin/prompts/08-verify.md +43 -0
- package/scaffold/.agent/skills/plugin/references/anti-patterns.md +123 -0
- package/scaffold/.agent/skills/plugin/references/card.md +90 -0
- package/scaffold/.agent/skills/plugin/references/scaffold.md +120 -0
- package/scaffold/.agent/skills/plugin/references/surfaces.md +206 -0
- package/scaffold/.agent/skills/plugin/scripts/record.mjs +360 -0
- package/scaffold/.agent/skills/plugin/subagents/card-designer.md +60 -0
- package/scaffold/.agent/skills/plugin/subagents/plugin-reviewer.md +55 -0
- package/scaffold/.agent/skills/plugin/subagents/scaffold-extractor.md +71 -0
- package/scaffold/.agent/skills/total-recall/plugins/auth/package-lock.json +71 -1441
- package/scaffold/.agent/skills/total-recall/plugins/auth/package.json +7 -5
- package/scaffold/.agent/skills/total-recall/plugins/auth/plugin.json +3 -44
- package/scaffold/.agent/skills/total-recall/plugins/auth/scripts/agent-login-pty.py +185 -0
- package/scaffold/.agent/skills/total-recall/plugins/auth/src/cli-secret.mjs +20 -1
- package/scaffold/.agent/skills/total-recall/plugins/auth/src/host-secrets-store.mjs +15 -0
- package/scaffold/.agent/skills/total-recall/plugins/auth/src/secrets-env-export.mjs +6 -4
- package/scaffold/.agent/skills/total-recall/plugins/auth/src/secrets-remote-deploy.mjs +1 -0
- package/scaffold/.agent/skills/total-recall/plugins/cli-agents/plugin.json +0 -24
- package/scaffold/.agent/skills/total-recall/plugins/code-quality/package-lock.json +4 -4
- package/scaffold/.agent/skills/total-recall/plugins/code-quality/plugin.json +0 -21
- package/scaffold/.agent/skills/total-recall/plugins/composable-cli/package-lock.json +4 -4
- package/scaffold/.agent/skills/total-recall/plugins/composable-cli/plugin.json +0 -32
- package/scaffold/.agent/skills/total-recall/plugins/embeddings/package-lock.json +4 -4
- package/scaffold/.agent/skills/total-recall/plugins/embeddings/plugin.json +11 -0
- package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/README.md +5 -2
- package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/package-lock.json +4 -4
- package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/plugin.json +1 -28
- package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/ui/DESIGN.md +95 -13
- package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/ui/card.js +553 -340
- package/scaffold/.agent/skills/total-recall/plugins/mesh/plugin.json +0 -36
- package/scaffold/.agent/skills/total-recall/plugins/mesh/ui/card.js +383 -400
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/package-lock.json +4 -4
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/package.json +0 -1
- package/scaffold/.agent/skills/total-recall/plugins/openwiki/plugin.json +0 -28
- package/scaffold/.agent/skills/total-recall/plugins/security/package-lock.json +4 -4
- package/scaffold/.agent/skills/total-recall/plugins/security/plugin.json +0 -32
- package/scaffold/.agent/skills/total-recall/references/auth.md +3 -1
- package/scaffold/.agent/skills/total-recall/references/memory.md +4 -0
- package/scaffold/.agent/skills/total-recall/references/openwiki.md +2 -0
- package/scaffold/.agent/skills/total-recall/references/operations.md +12 -0
- package/src/cli/brain.mjs +4 -2
- package/src/cli/context-stats.mjs +104 -0
- package/src/cli/context.mjs +8 -0
- package/src/cli/daemon.mjs +10 -1
- package/src/cli/export.mjs +3 -2
- package/src/cli/ingest-okf.mjs +12 -15
- package/src/cli/init.mjs +0 -85
- package/src/cli/lint.mjs +3 -2
- package/src/cli/plugin/copies.mjs +68 -0
- package/src/cli/plugin/create.mjs +22 -24
- package/src/cli/plugin/index.mjs +49 -3
- package/src/cli/plugin/search.mjs +19 -2
- package/src/cli/rebuild.mjs +2 -0
- package/src/cli/remember.mjs +23 -0
- package/src/cli/status.mjs +10 -3
- package/src/cli/update.mjs +3 -2
- package/src/core/action-predictor.mjs +161 -0
- package/src/core/app-deploy/runtime-cli/node.mjs.tmpl +20 -3
- package/src/core/app-deploy/source.mjs +16 -9
- package/src/core/automatic-brain-updates.mjs +6 -3
- package/src/core/brain-registry.mjs +19 -2
- package/src/core/brain-state.mjs +23 -0
- package/src/core/cli-commands.mjs +1 -0
- package/src/core/cli-maintenance.mjs +1 -1
- package/src/core/cli-semantic-index.mjs +1 -1
- package/src/core/command-surface.mjs +3 -3
- package/src/core/composed-command-resolution.mjs +21 -0
- package/src/core/config.mjs +84 -0
- package/src/core/confined-memory.mjs +93 -0
- package/src/core/context-telemetry.mjs +214 -0
- package/src/core/daemon-control.mjs +14 -43
- package/src/core/fast-recall.mjs +1 -1
- package/src/core/memory-brain.mjs +2 -0
- package/src/core/plugin-activation.mjs +38 -6
- package/src/core/plugin-bundle.mjs +54 -0
- package/src/core/plugin-catalog.mjs +1 -1
- package/src/core/plugin-context.mjs +1 -1
- package/src/core/plugin-contracts/card.mjs +69 -37
- package/src/core/plugin-loader.mjs +5 -6
- package/src/core/plugin-runner.mjs +13 -6
- package/src/core/plugin-runtime.mjs +5 -4
- package/src/core/plugin-setup.mjs +5 -3
- package/src/core/plugin-state-store.mjs +12 -1
- package/src/core/plugin-state.mjs +46 -5
- package/src/core/plugin-store.mjs +78 -3
- package/src/core/plugin-tasks.mjs +3 -1
- package/src/core/plugin-updates.mjs +117 -0
- package/src/core/plugin-vendor.mjs +10 -4
- package/src/core/project-brain.mjs +14 -41
- package/src/core/project-id.mjs +4 -1
- package/src/core/required-plugins.mjs +151 -13
- package/src/core/skills-registry.mjs +27 -3
- package/src/core/ssss-kernel-bridge.mjs +3 -1
- package/src/core/startup-health.mjs +66 -16
- package/src/core/surface.mjs +51 -44
- package/src/core/testing/plugin-fixture.mjs +69 -0
- package/src/core/vault-files.mjs +13 -0
- package/src/core/vault.mjs +4 -30
- package/src/server/index.mjs +13 -1
- package/src/server/invoke-decision-child.mjs +49 -0
- package/src/server/invoke-execution.mjs +87 -0
- package/src/server/invoke-policy.mjs +64 -0
- package/src/server/invoke-read-child.mjs +26 -0
- package/src/server/invoke-targets.mjs +49 -0
- package/src/server/invoke-write-child.mjs +19 -0
- package/src/server/routes/invoke.mjs +314 -0
- package/src/server/routes/plugins.mjs +1 -1
- package/scaffold/.agent/skills/plugins/SKILL.md +0 -57
- package/scaffold/.agent/skills/plugins/references/card-design.md +0 -55
- package/scaffold/.agent/skills/plugins/references/distribution.md +0 -23
- package/scaffold/.agent/skills/plugins/references/manifest-contract.md +0 -90
- package/scaffold/.agent/skills/plugins/references/optimized/index.md +0 -9
- package/scaffold/.agent/skills/plugins/references/optimized/manifest.json +0 -35
- package/scaffold/.agent/skills/plugins/references/optimized/original.md +0 -58
- package/scaffold/.agent/skills/plugins/references/optimized/section-01.md +0 -5
- package/scaffold/.agent/skills/plugins/references/optimized/section-02.md +0 -25
- package/scaffold/.agent/skills/plugins/references/optimized/section-03.md +0 -12
- package/scaffold/.agent/skills/plugins/references/optimized/section-04.md +0 -7
- package/scaffold/.agent/skills/plugins/references/optimized/section-05.md +0 -5
- package/scaffold/.agent/skills/total-recall/openwiki/README.md +0 -10
- package/scaffold/.agent/skills/total-recall/openwiki/architecture.md +0 -5
- package/scaffold/.agent/skills/total-recall/openwiki/ide.md +0 -10
- package/scaffold/.agent/skills/total-recall/openwiki/memory.md +0 -11
- package/scaffold/.agent/skills/total-recall/openwiki/secrets.md +0 -7
- package/scaffold/.agent/skills/total-recall/openwiki/skills.md +0 -7
- package/scaffold/openwiki/README.md +0 -10
- package/scaffold/openwiki/architecture.md +0 -5
- package/scaffold/openwiki/ide.md +0 -10
- package/scaffold/openwiki/memory.md +0 -11
- package/scaffold/openwiki/secrets.md +0 -7
- package/scaffold/openwiki/skills.md +0 -7
- package/src/core/okf-adapter.mjs +0 -559
- package/templates/openwiki/README.md +0 -10
- package/templates/openwiki/architecture.md +0 -5
- package/templates/openwiki/ide.md +0 -10
- package/templates/openwiki/memory.md +0 -11
- package/templates/openwiki/secrets.md +0 -7
- package/templates/openwiki/skills.md +0 -7
|
@@ -5520,7 +5520,7 @@ description: "${j.trim()||`Custom system skill capability`}"
|
|
|
5520
5520
|
# ${n.charAt(0).toUpperCase()+n.slice(1)} — custom system skill
|
|
5521
5521
|
|
|
5522
5522
|
Configure triggers, options, and prompts inside this rules sheet to hot-recompile IDE capabilities.
|
|
5523
|
-
`;try{await vr(n,i,t),A(``),M(``),k(!1),S(`Skill "${n}" successfully created!`),setTimeout(()=>S(null),5e3),Fe(n)}catch(e){b(e.message||`Failed to create new skill.`)}},Ve=async e=>{if(e.preventDefault(),ne.trim()){oe(!0),b(null),ue(null);try{let e=await br(ne.trim());ie(e||[])}catch(e){b(e.message||`Registry query failed. Is the server connected?`)}finally{oe(!1)}}},He=async e=>{ce(e),b(null),S(null),ue(null);try{let t=await xr(e);t.success?(S(`✓ Skill "${t.skillName||e}" successfully installed, security audited, and compiled!`),setTimeout(()=>S(null),7e3),Fe(t.skillName)):t.reason&&t.reason.includes(`quarantined`)?ue({pkg:e,reason:t.reason||`Static security audit scanned critical dynamic string evaluations or commands injection vectors.`}):b(`❌ Installation failed: ${t.reason||`Unknown error`}`)}catch(e){b(e.message||`Dynamic installation handler failed.`)}finally{ce(null)}},Ue=async e=>{if(_e(t=>({...t,[e]:!t[e]})),!ve[e]&&a)try{let t=await _r(a.name,e,a.repo);ye(n=>({...n,[e]:t}))}catch(t){console.error(`Failed to fetch skill files`,t),b(t.message||`Failed to fetch skill files.`),ye(t=>({...t,[e]:[]}))}},We=async()=>{Ce(!0),we(null);try{let e=await mr(`node .agent/skills/tr-skill/scripts/enforce-skill-optimization.mjs`,15e3);we(e.output),e.success&&(S(`Enforcement scan completed.`),setTimeout(()=>S(null),5e3))}catch(e){we(e.message)}finally{Ce(!1)}},Ge=(0,_.useCallback)(async()=>{De(!0);try{let e=await Mr();Ee(e.items||[])}catch(e){b(e.message||`Failed to fetch research items.`)}finally{De(!1)}},[]);(0,_.useEffect)(()=>{d===`automation`&&Ge()},[d,Ge]);let Ke=async()=>{ke(!0),await new Promise(e=>setTimeout(e,1500)),ke(!1),S(`All skills are up to date.`),setTimeout(()=>S(null),5e3)},qe=async()=>{b(null);try{await Nr(`Skill reference material update cycle`,`medium`,`Auto-triggered by Skills Manager to refresh outdated skill references and evals`),S(`Research cycle queued successfully.`),setTimeout(()=>S(null),5e3),Ge()}catch(e){b(e.message||`Failed to queue research cycle.`)}},Je=[{id:`active`,label:`Skills by repo`,icon:`📂`},{id:`registry`,label:`skills.sh Registry Hub`,icon:`✨`},{id:`lifecycle`,label:`Lifecycle & Versioning`,icon:`📋`},{id:`network`,label:`P2P Skills Network`,icon:`🌐`},{id:`automation`,label:`Auto-Improvement`,icon:`⚡`}],Ye=e=>e.id||`${e.repo||`_`}::${e.name}`,Xe=e=>a?.name===e.name&&(a?.repo||``)===(e.repo||``),Ze=e=>{u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Qe=async(e,t)=>{e.stopPropagation();try{p(!0);let e=await Tr(t,!0);e.success?S(`Generated repo-expert. Modules: ${e.stats?.coreModules||0}`):b(e.message||`Failed to generate repo-expert`),setTimeout(()=>S(null),5e3)}catch(e){b(e instanceof Error?e.message:`Error generating repo-expert`)}finally{Fe(a?.name,a?.repo)}},$e=e=>(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8,flex:1,overflowY:`auto`},children:[r.length===0&&(0,R.jsx)(`p`,{style:{fontSize:12,color:`var(--text-tertiary)`,padding:8},children:`No project repos with skills found.`}),r.map(t=>{let n=l.has(t.repo),r=t.skills?.length||0;return(0,R.jsxs)(`div`,{style:{borderBottom:`1px solid var(--border)`},children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>Ze(t.repo),style:{width:`100%`,display:`flex`,justifyContent:`space-between`,alignItems:`center`,gap:8,padding:`10px 8px`,background:`transparent`,border:`none`,color:`inherit`,cursor:`pointer`,textAlign:`left`},children:[(0,R.jsxs)(`span`,{style:{fontSize:12,fontWeight:700},children:[n?`▾`:`▸`,` `,t.repo]}),(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,R.jsx)(`span`,{style:{fontSize:10,fontWeight:600,padding:`2px 8px`,borderRadius:99,background:r?`rgba(59,130,246,0.15)`:`rgba(148,163,184,0.1)`,color:r?`#93c5fd`:`var(--text-tertiary)`},children:r}),t.path&&(0,R.jsx)(`button`,{onClick:e=>void Qe(e,t.path),title:`Auto-generate repo-expert for this repository`,style:{background:`var(--bg-tertiary)`,border:`1px solid var(--border)`,color:`var(--text-secondary)`,borderRadius:`4px`,padding:`2px 6px`,fontSize:`10px`,cursor:`pointer`},children:`Generate Expert`})]})]}),n&&(0,R.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6,padding:`0 4px 10px`},children:r===0?(0,R.jsx)(`div`,{style:{fontSize:11,color:`var(--text-tertiary)`,padding:`4px 8px`},children:t.error||`No app skills (TR skills hidden)`}):t.skills.map(n=>{let r=Xe(n);return(0,R.jsxs)(`div`,{id:`${e}-skill-${n.repo}-${n.name}`,onClick:()=>void Ie(n),style:{background:r?`var(--accent-muted)`:`var(--bg-tertiary)`,border:r?`1px solid var(--accent)`:`1px solid var(--border)`,padding:`10px 12px`,borderRadius:8,cursor:`pointer`,transition:`all 0.15s ease`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,R.jsx)(`span`,{style:{fontSize:13,fontWeight:r?600:500,color:r?`var(--accent)`:`var(--text-primary)`},children:n.name}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,alignItems:`center`},children:[fe?.path&&t.repo===`Global`&&(0,R.jsx)(`input`,{type:`checkbox`,checked:!!fe?.skills?.some(e=>e.name===n.name),onClick:e=>e.stopPropagation(),onChange:async e=>{e.stopPropagation();let t=e.target.checked,r=fe?.path;if(r){if(t){w(!0),E(!0),O(null);try{let e=await Cr(n.name,r);O({skillName:n.name,targetRepo:r,original:e.original,preview:e.preview,signals:e.signals})}catch(e){b(e.message),w(!1)}finally{E(!1)}}else try{await Sr(n.name,r,!1),Fe()}catch(e){b(e.message)}}},style:{cursor:`pointer`},title:`Enable/Disable skill for this repo`}),(0,R.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ze(n)},style:{background:`none`,border:`none`,color:`var(--text-tertiary)`,fontSize:12,cursor:`pointer`,padding:`2px 6px`},title:`Delete skill`,children:`✖`})]})]}),n.source&&(0,R.jsx)(`div`,{style:{fontSize:10,color:`var(--text-tertiary)`,marginTop:4},children:n.source}),n.subSkills&&n.subSkills.length>0&&(0,R.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:4,marginTop:6},children:n.subSkills.slice(0,6).map(e=>(0,R.jsx)(`span`,{className:`badge`,style:{fontSize:9,padding:`1px 5px`,background:`var(--bg-elevated)`,color:`var(--text-secondary)`,border:`1px solid var(--border)`},children:e},e))})]},Ye(n))})})]},t.repo)})]});return(0,R.jsxs)(`div`,{className:`page`,style:{display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,R.jsxs)(`div`,{className:`page-header`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,flexWrap:`wrap`,gap:16},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h1`,{children:`Skills Manager`}),(0,R.jsx)(`p`,{children:`Track, edit, and deploy agent skills across any repo — registry-based, no hardcoded hosts`})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:10},children:[(0,R.jsx)(`button`,{className:`btn btn-sm btn-ghost`,onClick:()=>k(!ee),style:{border:`1px solid var(--border)`,background:`var(--bg-secondary)`},children:ee?`✖ Cancel`:`➕ Create Custom Skill`}),(0,R.jsx)(`button`,{className:`btn btn-sm`,onClick:Re,disabled:g,style:{background:g?`var(--bg-secondary)`:`linear-gradient(135deg, var(--accent), var(--accent-hover))`,color:`#fff`,border:`none`,fontWeight:500},children:g?`⏳ Compiling shims...`:`🔄 Hot-Recompile Shims`})]})]}),y&&(0,R.jsxs)(`div`,{className:`badge badge-error`,style:{marginBottom:20,display:`inline-flex`,padding:`6px 12px`,background:`rgba(239, 68, 68, 0.1)`,border:`1px solid #ef4444`,color:`#f87171`},children:[`⚠️ `,y]}),x&&(0,R.jsxs)(`div`,{className:`badge badge-success`,style:{marginBottom:20,display:`inline-flex`,padding:`6px 12px`,background:`rgba(16, 185, 129, 0.1)`,border:`1px solid #10b981`,color:`#34d399`},children:[`✓ `,x]}),le&&(0,R.jsxs)(`div`,{className:`badge badge-error`,style:{marginBottom:20,display:`flex`,flexDirection:`column`,alignItems:`flex-start`,padding:16,background:`rgba(239, 68, 68, 0.15)`,border:`1px solid #ef4444`,borderRadius:8,color:`#f87171`,gap:6},children:[(0,R.jsx)(`div`,{style:{fontWeight:700,fontSize:13},children:`🚨 SECURITY QUARANTINE PURGE ACTIVE!`}),(0,R.jsxs)(`div`,{style:{fontSize:12},children:[`Installation of package `,(0,R.jsx)(`strong`,{children:le.pkg}),` was blocked and files were hard purged.`]}),(0,R.jsxs)(`div`,{style:{fontSize:11,opacity:.85},children:[`Reason: `,le.reason]})]}),ee&&(0,R.jsxs)(`div`,{className:`card`,style:{marginBottom:24,padding:24,background:`rgba(18, 18, 26, 0.9)`,border:`1px solid var(--border)`,backdropFilter:`blur(10px)`},children:[(0,R.jsx)(`h3`,{style:{fontSize:14,fontWeight:600,borderBottom:`1px solid var(--border)`,paddingBottom:10,marginBottom:14},children:`➕ Create New Skill`}),(0,R.jsxs)(`form`,{onSubmit:Be,style:{display:`flex`,gap:16,flexWrap:`wrap`,alignItems:`flex-end`},children:[(0,R.jsxs)(`div`,{style:{flex:`1 1 200px`,display:`flex`,flexDirection:`column`,gap:6},children:[(0,R.jsx)(`label`,{htmlFor:`new_name`,style:{fontSize:11,fontWeight:500,color:`var(--text-secondary)`},children:`Skill Name (kebab-case)`}),(0,R.jsx)(`input`,{id:`new_name`,type:`text`,placeholder:`e.g. security-audit`,value:te,onChange:e=>A(e.target.value),required:!0,style:{background:`var(--bg-tertiary)`,color:`var(--text-primary)`,border:`1px solid var(--border)`,padding:`8px 12px`,borderRadius:6,outline:`none`,fontSize:12}})]}),(0,R.jsxs)(`div`,{style:{flex:`2 1 300px`,display:`flex`,flexDirection:`column`,gap:6},children:[(0,R.jsx)(`label`,{htmlFor:`new_desc`,style:{fontSize:11,fontWeight:500,color:`var(--text-secondary)`},children:`Brief Description / System Triggers`}),(0,R.jsx)(`input`,{id:`new_desc`,type:`text`,placeholder:`e.g. Audits security parameters, encryption costs, and Caddy forward gates`,value:j,onChange:e=>M(e.target.value),style:{background:`var(--bg-tertiary)`,color:`var(--text-primary)`,border:`1px solid var(--border)`,padding:`8px 12px`,borderRadius:6,outline:`none`,fontSize:12}})]}),(0,R.jsx)(`button`,{type:`submit`,style:{background:`linear-gradient(135deg, var(--accent), var(--accent-hover))`,color:`#fff`,padding:`8px 16px`,borderRadius:6,fontWeight:500,border:`none`,fontSize:12,cursor:`pointer`,height:33},children:`🚀 Initialize Skill`})]})]}),(0,R.jsx)(`div`,{style:{display:`flex`,gap:6,marginBottom:20,borderBottom:`1px solid var(--border)`,paddingBottom:10,flexWrap:`wrap`},children:Je.map(e=>(0,R.jsxs)(`button`,{id:`tab-${e.id}`,onClick:()=>f(e.id),style:{padding:`8px 14px`,borderRadius:8,border:`none`,background:d===e.id?`var(--accent)`:`var(--bg-tertiary)`,color:d===e.id?`#fff`:`var(--text-secondary)`,fontWeight:600,cursor:`pointer`,fontSize:11,transition:`all 0.15s ease`,whiteSpace:`nowrap`},children:[e.icon,` `,e.label]},e.id))}),d===`active`?(0,R.jsxs)(`div`,{style:{display:`flex`,flex:1,gap:24,minHeight:0,overflow:`hidden`,paddingBottom:16},children:[(0,R.jsx)(`div`,{style:{width:300,display:`flex`,flexDirection:`column`,gap:16,flexShrink:0,overflowY:`auto`},children:(0,R.jsxs)(`div`,{className:`card`,style:{padding:16,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`,flex:1,display:`flex`,flexDirection:`column`},children:[(0,R.jsx)(`h3`,{style:{fontSize:12,fontWeight:700,color:`var(--text-tertiary)`,textTransform:`uppercase`,letterSpacing:.5,borderBottom:`1px solid var(--border)`,paddingBottom:8,marginBottom:8},children:`Skills by repo`}),(0,R.jsxs)(`p`,{style:{fontSize:10,color:`var(--text-tertiary)`,margin:`0 0 10px`,lineHeight:1.4},children:[`Project skills only · total-recall / tr-* hidden · `,t.length,` skill`,t.length===1?``:`s`]}),$e(`active`)]})}),(0,R.jsx)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,minHeight:0},children:a?(0,R.jsxs)(`div`,{className:`card`,style:{flex:1,padding:24,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`,display:`flex`,flexDirection:`column`,minHeight:0},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,borderBottom:`1px solid var(--border)`,paddingBottom:12,marginBottom:16,flexShrink:0},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`h3`,{style:{fontSize:16,fontWeight:600,color:`var(--text-primary)`},children:[`📝 Editing Capability rules: `,a.name,`/SKILL.md`]}),(0,R.jsx)(`p`,{style:{fontSize:11,color:`var(--text-tertiary)`},children:`Hot-recompiled rules preserve immutable instructions and custom shims`})]}),(0,R.jsx)(`button`,{className:`btn btn-primary`,onClick:Le,disabled:m,style:{background:`linear-gradient(135deg, var(--accent), var(--accent-hover))`,color:`#fff`,fontWeight:500,borderRadius:6,padding:`8px 18px`,fontSize:12},children:m?`⏳ Saving...`:`💾 Save rules`})]}),(0,R.jsx)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,minHeight:0},children:(0,R.jsx)(`textarea`,{value:s,onChange:e=>c(e.target.value),style:{flex:1,width:`100%`,fontFamily:`var(--font-mono)`,fontSize:13,padding:16,background:`var(--bg-secondary)`,color:`var(--text-primary)`,border:`1px solid var(--border)`,borderRadius:8,resize:`none`,outline:`none`,lineHeight:1.6,whiteSpace:`pre`,overflowWrap:`normal`,overflowX:`auto`},spellCheck:!1})})]}):(0,R.jsx)(`div`,{className:`card`,style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`,color:`var(--text-secondary)`},children:`No skill selected. Click a skill in the registry to manage its rules sheet.`})})]}):d===`registry`?(0,R.jsxs)(`div`,{style:{display:`flex`,flex:1,flexDirection:`column`,minHeight:0,overflowY:`auto`,paddingBottom:16},children:[(0,R.jsxs)(`div`,{className:`card`,style:{padding:24,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`,marginBottom:20},children:[(0,R.jsx)(`h3`,{style:{fontSize:15,fontWeight:600,color:`var(--text-primary)`,marginBottom:8},children:`🔍 Discover AI Agent Skills from skills.sh`}),(0,R.jsx)(`p`,{style:{fontSize:12,color:`var(--text-secondary)`,marginBottom:16},children:`Query the absolute ratings list from the open-source registry. When you trigger installation, files are sandboxed, statically audited for command injection vulnerabilities, and automatically compiled.`}),(0,R.jsxs)(`form`,{onSubmit:Ve,style:{display:`flex`,gap:12},children:[(0,R.jsx)(`input`,{type:`text`,placeholder:`Search skills (e.g. git, typescript, prd...)`,value:ne,onChange:e=>N(e.target.value),style:{flex:1,background:`var(--bg-tertiary)`,color:`var(--text-primary)`,border:`1px solid var(--border)`,borderRadius:8,padding:`10px 16px`,fontSize:13,outline:`none`}}),(0,R.jsx)(`button`,{type:`submit`,disabled:ae,style:{background:`linear-gradient(135deg, var(--accent), var(--accent-hover))`,color:`#fff`,border:`none`,borderRadius:8,padding:`10px 24px`,fontWeight:600,fontSize:13,cursor:`pointer`},children:ae?`⏳ Sifting...`:`🔎 Query Registry`})]})]}),(0,R.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:ae?(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,padding:40,color:`var(--text-secondary)`},children:[(0,R.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--text-tertiary)`,strokeWidth:`2.5`,style:{animation:`spin 1s linear infinite`,marginBottom:12},children:(0,R.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`})}),(0,R.jsx)(`span`,{children:`Searching packages in registry catalog...`})]}):re.length>0?(0,R.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(320px, 1fr))`,gap:16},children:re.map(e=>{let t=se===e.name;return(0,R.jsxs)(`div`,{style:{background:`rgba(18, 18, 26, 0.4)`,border:`1px solid var(--border)`,borderRadius:10,padding:20,display:`flex`,flexDirection:`column`,justifyContent:`space-between`,gap:16},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,flexWrap:`wrap`,gap:8,marginBottom:8},children:[(0,R.jsx)(`span`,{style:{fontWeight:700,fontSize:14,color:`#fff`,wordBreak:`break-all`},children:e.name}),(0,R.jsxs)(`span`,{className:`badge`,style:{background:`rgba(59, 130, 246, 0.15)`,color:`#60a5fa`,border:`1px solid rgba(59, 130, 246, 0.2)`,fontSize:10,padding:`2px 8px`,borderRadius:20},children:[`⚡ `,e.installsStr,` installs`]})]}),(0,R.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,style:{fontSize:11,color:`var(--accent)`,textDecoration:`none`},onMouseEnter:e=>e.currentTarget.style.textDecoration=`underline`,onMouseLeave:e=>e.currentTarget.style.textDecoration=`none`,children:`🔗 View Registry Repository`})]}),(0,R.jsx)(`button`,{onClick:()=>void He(e.name),disabled:!!se,style:{width:`100%`,background:t?`var(--bg-tertiary)`:`linear-gradient(135deg, var(--accent), var(--accent-hover))`,color:t?`var(--text-secondary)`:`#fff`,border:`none`,borderRadius:8,padding:`10px 16px`,fontWeight:600,fontSize:12,cursor:se?`not-allowed`:`pointer`,transition:`all 0.15s ease`},children:t?`🛡️ Auditing & Installing...`:`➕ Install Capability`})]},e.name)})}):ne.trim()?(0,R.jsx)(`div`,{style:{textAlign:`center`,padding:40,border:`1px dashed var(--border)`,borderRadius:10,color:`var(--text-secondary)`},children:`No matching skills found in the skills.sh registry. Try a different query like "git" or "prd".`}):(0,R.jsx)(`div`,{style:{textAlign:`center`,padding:40,border:`1px dashed var(--border)`,borderRadius:10,color:`var(--text-tertiary)`,fontSize:12},children:`Enter a search query above to browse portable capabilities from the cloud registry.`})})]}):d===`lifecycle`?(0,R.jsxs)(`div`,{style:{display:`flex`,flex:1,gap:24,minHeight:0,overflow:`hidden`,paddingBottom:16},children:[C&&(0,R.jsx)(`div`,{style:{position:`fixed`,top:0,left:0,right:0,bottom:0,background:`rgba(0,0,0,0.7)`,zIndex:9999,display:`flex`,justifyContent:`center`,alignItems:`center`},children:(0,R.jsxs)(`div`,{className:`card`,style:{background:`var(--bg-primary)`,border:`1px solid var(--border)`,borderRadius:12,padding:24,width:`80%`,maxWidth:900,maxHeight:`90vh`,display:`flex`,flexDirection:`column`},children:[(0,R.jsx)(`h2`,{style:{marginTop:0,marginBottom:12},children:`Skill Adaptation Preview`}),T?(0,R.jsx)(`div`,{style:{flex:1,display:`flex`,justifyContent:`center`,alignItems:`center`},children:(0,R.jsxs)(`p`,{children:[`Generating adaptive preview for `,de||e,`...`]})}):D?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{style:{color:`var(--text-secondary)`,marginBottom:16,fontSize:13},children:[`This skill will be explicitly rewritten and bound to this project repository.`,(0,R.jsx)(`br`,{}),`Detected adaptation signals: `,(0,R.jsx)(`span`,{style:{color:`var(--accent)`,fontWeight:600},children:D.signals.join(` | `)||`None (Template copied as-is)`})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,flex:1,gap:16,overflow:`hidden`,minHeight:0},children:[(0,R.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,minHeight:0},children:[(0,R.jsx)(`h3`,{style:{fontSize:13,marginBottom:8},children:`Global Template`}),(0,R.jsx)(`textarea`,{readOnly:!0,value:D.original,style:{flex:1,width:`100%`,background:`var(--bg-secondary)`,border:`1px solid var(--border)`,color:`var(--text-tertiary)`,padding:12,borderRadius:8,fontFamily:`monospace`,fontSize:12,resize:`none`,whiteSpace:`pre-wrap`}})]}),(0,R.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,minHeight:0},children:[(0,R.jsx)(`h3`,{style:{fontSize:13,marginBottom:8,color:`var(--accent)`},children:`Adapted Target (SKILL.md)`}),(0,R.jsx)(`textarea`,{readOnly:!0,value:D.preview,style:{flex:1,width:`100%`,background:`var(--bg-secondary)`,border:`1px solid var(--border)`,color:`var(--text-primary)`,padding:12,borderRadius:8,fontFamily:`monospace`,fontSize:12,resize:`none`,whiteSpace:`pre-wrap`}})]})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:12,marginTop:24},children:[(0,R.jsx)(`button`,{className:`btn`,onClick:()=>w(!1),children:`Cancel`}),(0,R.jsx)(`button`,{className:`btn btn-primary`,onClick:async()=>{E(!0);try{await Sr(D.skillName,D.targetRepo,!0),w(!1),Fe()}catch(e){b(e.message)}finally{E(!1)}},children:`Deploy to Project`})]})]}):(0,R.jsx)(`p`,{children:`Failed to load preview data.`})]})}),(0,R.jsx)(`div`,{style:{width:280,display:`flex`,flexDirection:`column`,gap:16,flexShrink:0,overflowY:`auto`},children:(0,R.jsxs)(`div`,{className:`card`,style:{padding:16,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`,flex:1,display:`flex`,flexDirection:`column`},children:[(0,R.jsx)(`h3`,{style:{fontSize:12,fontWeight:700,color:`var(--text-tertiary)`,textTransform:`uppercase`,letterSpacing:.5,borderBottom:`1px solid var(--border)`,paddingBottom:8,marginBottom:12},children:`Skills by repo`}),$e(`lifecycle`)]})}),(0,R.jsx)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,gap:20,overflowY:`auto`,minHeight:0},children:a?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`card`,style:{padding:20,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`},children:(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:16,flexWrap:`wrap`},children:[(0,R.jsxs)(`h3`,{id:`lifecycle-version-title`,style:{fontSize:16,fontWeight:600,color:`var(--text-primary)`,margin:0},children:[a.name,a.repo?(0,R.jsxs)(`span`,{style:{fontSize:12,fontWeight:500,color:`var(--text-tertiary)`,marginLeft:8},children:[`· `,a.repo]}):null]}),(0,R.jsxs)(`span`,{id:`lifecycle-version-badge`,style:{background:`linear-gradient(135deg, var(--accent), var(--accent-hover))`,color:`#fff`,padding:`4px 14px`,borderRadius:20,fontSize:12,fontWeight:700,letterSpacing:.3},children:[`v`,pe]}),(0,R.jsxs)(`span`,{style:{fontSize:11,color:`var(--text-tertiary)`},children:[`Modified: `,new Date(a.modified).toLocaleDateString()]})]})}),(0,R.jsxs)(`div`,{className:`card`,style:{padding:20,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`},children:[(0,R.jsx)(`h3`,{id:`lifecycle-changelog-heading`,style:{fontSize:14,fontWeight:700,color:`var(--text-tertiary)`,textTransform:`uppercase`,letterSpacing:.5,marginBottom:16,borderBottom:`1px solid var(--border)`,paddingBottom:8},children:`📜 Changelog Timeline`}),me.length>0?(0,R.jsxs)(`div`,{style:{position:`relative`,paddingLeft:28},children:[(0,R.jsx)(`div`,{style:{position:`absolute`,left:5,top:6,bottom:6,width:2,background:`var(--border)`}}),me.map((e,t)=>(0,R.jsxs)(`div`,{style:{marginBottom:20,position:`relative`},children:[(0,R.jsx)(`div`,{style:{position:`absolute`,left:-28,top:4,width:12,height:12,borderRadius:`50%`,background:t===0?`var(--accent)`:`var(--text-tertiary)`,border:t===0?`2px solid var(--accent-hover)`:`2px solid var(--border)`,boxShadow:t===0?`0 0 8px rgba(var(--accent-rgb, 99, 102, 241), 0.4)`:`none`}}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:10,alignItems:`baseline`,marginBottom:6},children:[(0,R.jsxs)(`span`,{style:{fontSize:13,fontWeight:700,color:t===0?`var(--accent)`:`var(--text-primary)`},children:[`v`,e.version]}),e.date&&(0,R.jsx)(`span`,{style:{fontSize:11,color:`var(--text-tertiary)`},children:e.date})]}),(0,R.jsx)(`ul`,{style:{margin:0,paddingLeft:16,listStyle:`disc`},children:e.changes.map((e,t)=>(0,R.jsx)(`li`,{style:{fontSize:12,color:`var(--text-secondary)`,lineHeight:1.7},children:e},t))})]},`${e.version}-${t}`))]}):(0,R.jsxs)(`div`,{style:{padding:20,textAlign:`center`,color:`var(--text-tertiary)`,fontSize:12,border:`1px dashed var(--border)`,borderRadius:8},children:[`No changelog entries detected in SKILL.md. Add `,(0,R.jsx)(`code`,{children:`## v1.0.0 — 2025-01-01`}),` sections to enable version tracking.`]})]}),(0,R.jsxs)(`div`,{className:`card`,style:{padding:20,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:16,borderBottom:`1px solid var(--border)`,paddingBottom:8},children:[(0,R.jsx)(`h3`,{id:`lifecycle-health-heading`,style:{fontSize:14,fontWeight:700,color:`var(--text-tertiary)`,textTransform:`uppercase`,letterSpacing:.5,margin:0},children:`🩺 Health Checks`}),(0,R.jsx)(`button`,{id:`lifecycle-run-enforcement-btn`,onClick:()=>void We(),disabled:Se,style:{background:Se?`var(--bg-tertiary)`:`linear-gradient(135deg, #f59e0b, #d97706)`,color:`#fff`,border:`none`,borderRadius:6,padding:`6px 14px`,fontSize:11,fontWeight:600,cursor:Se?`not-allowed`:`pointer`},children:Se?`⏳ Running...`:`🛡️ Run Enforcement`})]}),(0,R.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(260px, 1fr))`,gap:10},children:he.map((e,t)=>(0,R.jsxs)(`div`,{id:`lifecycle-health-${t}`,style:{display:`flex`,alignItems:`center`,gap:10,padding:`10px 14px`,background:`var(--bg-tertiary)`,borderRadius:8,border:`1px solid ${e.passed?`rgba(16, 185, 129, 0.25)`:`rgba(239, 68, 68, 0.25)`}`},children:[(0,R.jsx)(`div`,{style:{width:10,height:10,borderRadius:`50%`,background:e.passed?`#10b981`:`#ef4444`,flexShrink:0,boxShadow:e.passed?`0 0 6px rgba(16, 185, 129, 0.4)`:`0 0 6px rgba(239, 68, 68, 0.4)`}}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{style:{fontSize:12,fontWeight:600,color:`var(--text-primary)`},children:e.label}),(0,R.jsx)(`div`,{style:{fontSize:10,color:`var(--text-tertiary)`},children:e.detail})]})]},t))}),P&&(0,R.jsx)(`pre`,{id:`lifecycle-enforcement-output`,style:{marginTop:16,padding:14,background:`var(--bg-secondary)`,border:`1px solid var(--border)`,borderRadius:8,fontSize:11,color:`var(--text-secondary)`,fontFamily:`var(--font-mono)`,whiteSpace:`pre-wrap`,maxHeight:200,overflowY:`auto`},children:P})]}),(0,R.jsxs)(`div`,{className:`card`,style:{padding:20,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`},children:[(0,R.jsx)(`h3`,{id:`lifecycle-subfiles-heading`,style:{fontSize:14,fontWeight:700,color:`var(--text-tertiary)`,textTransform:`uppercase`,letterSpacing:.5,marginBottom:16,borderBottom:`1px solid var(--border)`,paddingBottom:8},children:`📁 Sub-file Browser`}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:16,flexWrap:`wrap`},children:[(0,R.jsx)(`div`,{style:{flex:`1 1 300px`,display:`flex`,flexDirection:`column`,gap:8},children:[`scripts`,`references`,`evals`,`subagents`].map(e=>{let t=(a.subSkills||[]).map(e=>e.toLowerCase()).includes(e),n=ge[e];return(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`button`,{id:`lifecycle-subdir-${e}`,onClick:()=>Ue(e),style:{width:`100%`,display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`10px 14px`,background:`var(--bg-tertiary)`,border:`1px solid var(--border)`,borderRadius:8,cursor:`pointer`,color:t?`var(--text-primary)`:`var(--text-tertiary)`,fontSize:13,fontWeight:500,transition:`all 0.15s ease`},children:[(0,R.jsxs)(`span`,{children:[n?`▼`:`▶`,` `,e,`/`]}),(0,R.jsx)(`span`,{style:{width:8,height:8,borderRadius:`50%`,background:t?`#10b981`:`#ef4444`}})]}),n&&ve[e]&&(0,R.jsx)(`div`,{style:{paddingLeft:20,paddingTop:6,display:`flex`,flexDirection:`column`,gap:4},children:ve[e].length>0?ve[e].map(t=>(0,R.jsxs)(`div`,{onClick:()=>xe({name:`${e}/${t.name}`,content:`// Contents of ${a.name}/${e}/${t.name}\n// Size: ${t.size}\n// (Preview loaded from skill filesystem)`}),style:{display:`flex`,justifyContent:`space-between`,padding:`6px 10px`,background:`var(--bg-secondary)`,borderRadius:6,cursor:`pointer`,fontSize:11,color:`var(--text-secondary)`,transition:`background 0.1s ease`},onMouseEnter:e=>e.currentTarget.style.background=`var(--bg-elevated)`,onMouseLeave:e=>e.currentTarget.style.background=`var(--bg-secondary)`,children:[(0,R.jsxs)(`span`,{children:[`📄 `,t.name]}),(0,R.jsx)(`span`,{style:{color:`var(--text-tertiary)`},children:t.size})]},t.name)):(0,R.jsx)(`div`,{style:{fontSize:11,color:`var(--text-tertiary)`,padding:`4px 10px`},children:`Empty directory`})})]},e)})}),be&&(0,R.jsx)(`div`,{style:{flex:`1 1 300px`},children:(0,R.jsxs)(`div`,{style:{background:`var(--bg-secondary)`,border:`1px solid var(--border)`,borderRadius:8,overflow:`hidden`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`8px 14px`,background:`var(--bg-tertiary)`,borderBottom:`1px solid var(--border)`},children:[(0,R.jsx)(`span`,{style:{fontSize:12,fontWeight:600,color:`var(--text-primary)`},children:be.name}),(0,R.jsx)(`button`,{id:`lifecycle-close-preview-btn`,onClick:()=>xe(null),style:{background:`none`,border:`none`,color:`var(--text-tertiary)`,cursor:`pointer`,fontSize:14},children:`✖`})]}),(0,R.jsx)(`pre`,{style:{padding:14,fontSize:11,color:`var(--text-secondary)`,fontFamily:`var(--font-mono)`,margin:0,whiteSpace:`pre-wrap`,maxHeight:200,overflowY:`auto`},children:be.content})]})})]})]})]}):(0,R.jsx)(`div`,{className:`card`,style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`,color:`var(--text-secondary)`,fontSize:13},children:`Select a skill from the left panel to view its lifecycle details.`})})]}):d===`network`?(0,R.jsxs)(`div`,{style:{display:`flex`,flex:1,flexDirection:`column`,minHeight:0,overflowY:`auto`,paddingBottom:16},children:[(0,R.jsx)(`div`,{className:`card`,style:{padding:24,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`,marginBottom:20},children:(0,R.jsx)(`div`,{style:{display:`flex`,gap:20,flexWrap:`wrap`},children:[{label:`Connected Peers`,value:`—`,icon:`🔗`},{label:`Shared Skills`,value:`—`,icon:`📦`},{label:`Last Sync`,value:`Never`,icon:`🔄`}].map(e=>(0,R.jsxs)(`div`,{id:`network-stat-${e.label.toLowerCase().replace(/\s/g,`-`)}`,style:{flex:`1 1 140px`,background:`var(--bg-tertiary)`,border:`1px solid var(--border)`,borderRadius:10,padding:`16px 20px`,textAlign:`center`},children:[(0,R.jsx)(`div`,{style:{fontSize:22,marginBottom:4},children:e.icon}),(0,R.jsx)(`div`,{style:{fontSize:20,fontWeight:700,color:`var(--text-primary)`},children:e.value}),(0,R.jsx)(`div`,{style:{fontSize:11,color:`var(--text-tertiary)`,marginTop:2},children:e.label})]},e.label))})}),(0,R.jsxs)(`div`,{className:`card`,id:`network-coming-soon-panel`,style:{flex:1,position:`relative`,overflow:`hidden`,border:`1px solid var(--border)`,borderRadius:12},children:[(0,R.jsxs)(`div`,{style:{padding:40,filter:`blur(3px)`,opacity:.35,pointerEvents:`none`,userSelect:`none`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`center`,gap:24,alignItems:`center`,marginBottom:30,flexWrap:`wrap`},children:[(0,R.jsxs)(`div`,{style:{padding:`20px 30px`,background:`var(--bg-tertiary)`,borderRadius:12,border:`2px solid var(--accent)`,textAlign:`center`},children:[(0,R.jsx)(`div`,{style:{fontSize:28},children:`📂`}),(0,R.jsx)(`div`,{style:{fontSize:13,fontWeight:700,marginTop:6,color:`var(--text-primary)`},children:`Local Skills`})]}),(0,R.jsx)(`div`,{style:{fontSize:28,color:`var(--accent)`},children:`⇄`}),(0,R.jsxs)(`div`,{style:{padding:`20px 30px`,background:`var(--bg-tertiary)`,borderRadius:12,border:`2px solid var(--accent)`,textAlign:`center`},children:[(0,R.jsx)(`div`,{style:{fontSize:28},children:`🌐`}),(0,R.jsx)(`div`,{style:{fontSize:13,fontWeight:700,marginTop:6,color:`var(--text-primary)`},children:`P2P Network`})]}),(0,R.jsx)(`div`,{style:{fontSize:28,color:`var(--accent)`},children:`⇄`}),(0,R.jsxs)(`div`,{style:{padding:`20px 30px`,background:`var(--bg-tertiary)`,borderRadius:12,border:`2px solid var(--accent)`,textAlign:`center`},children:[(0,R.jsx)(`div`,{style:{fontSize:28},children:`👥`}),(0,R.jsx)(`div`,{style:{fontSize:13,fontWeight:700,marginTop:6,color:`var(--text-primary)`},children:`Remote Peers`})]})]}),(0,R.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:16},children:[`Auto-discovery`,`Version Negotiation`,`Conflict Resolution`,`Security Quarantine`].map(e=>(0,R.jsx)(`div`,{style:{background:`var(--bg-tertiary)`,padding:16,borderRadius:8,border:`1px solid var(--border)`},children:(0,R.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:`var(--text-primary)`},children:e})},e))})]}),(0,R.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,background:`rgba(10, 10, 18, 0.6)`,backdropFilter:`blur(2px)`,zIndex:10},children:(0,R.jsxs)(`div`,{style:{background:`rgba(18, 18, 26, 0.95)`,border:`1px solid var(--border)`,borderRadius:16,padding:`40px 48px`,textAlign:`center`,maxWidth:520,backdropFilter:`blur(20px)`,boxShadow:`0 8px 32px rgba(0, 0, 0, 0.4)`},children:[(0,R.jsx)(`div`,{style:{fontSize:48,marginBottom:16},children:`🚀`}),(0,R.jsx)(`h2`,{id:`network-coming-soon-title`,style:{fontSize:22,fontWeight:700,color:`var(--text-primary)`,marginBottom:12},children:`Coming Soon`}),(0,R.jsx)(`p`,{style:{fontSize:13,color:`var(--text-secondary)`,lineHeight:1.7,marginBottom:20},children:`Peer-to-peer skill sharing enables automatic discovery, sync, and versioning of skills across trusted Total Recall nodes.`}),(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`center`,alignItems:`center`,gap:12,marginBottom:24,flexWrap:`wrap`},children:[(0,R.jsx)(`div`,{style:{padding:`10px 16px`,background:`var(--bg-tertiary)`,borderRadius:8,border:`1px solid var(--accent)`,fontSize:12,fontWeight:600,color:`var(--accent)`},children:`📂 Local Skills`}),(0,R.jsx)(`span`,{style:{color:`var(--accent)`,fontSize:18,fontWeight:700},children:`↔`}),(0,R.jsx)(`div`,{style:{padding:`10px 16px`,background:`linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15))`,borderRadius:8,border:`1px solid var(--accent)`,fontSize:12,fontWeight:600,color:`var(--accent)`},children:`🌐 P2P Network`}),(0,R.jsx)(`span`,{style:{color:`var(--accent)`,fontSize:18,fontWeight:700},children:`↔`}),(0,R.jsx)(`div`,{style:{padding:`10px 16px`,background:`var(--bg-tertiary)`,borderRadius:8,border:`1px solid var(--accent)`,fontSize:12,fontWeight:600,color:`var(--accent)`},children:`👥 Remote Peers`})]}),(0,R.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:8,textAlign:`left`},children:[{icon:`🔍`,label:`Auto-discovery`},{icon:`🔄`,label:`Version negotiation`},{icon:`⚔️`,label:`Conflict resolution`},{icon:`🛡️`,label:`Security quarantine`}].map(e=>(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`8px 12px`,background:`var(--bg-tertiary)`,borderRadius:6,fontSize:11,color:`var(--text-secondary)`,fontWeight:500},children:[(0,R.jsx)(`span`,{children:e.icon}),` `,e.label]},e.label))})]})})]})]}):(0,R.jsxs)(`div`,{style:{display:`flex`,flex:1,flexDirection:`column`,minHeight:0,overflowY:`auto`,paddingBottom:16,gap:20},children:[(0,R.jsxs)(`div`,{className:`card`,style:{padding:24,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:16,borderBottom:`1px solid var(--border)`,paddingBottom:10,flexWrap:`wrap`,gap:10},children:[(0,R.jsx)(`h3`,{id:`automation-update-heading`,style:{fontSize:14,fontWeight:700,color:`var(--text-tertiary)`,textTransform:`uppercase`,letterSpacing:.5,margin:0},children:`🔄 Auto-Update Status`}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,R.jsx)(`button`,{id:`automation-check-updates-btn`,onClick:()=>void Ke(),disabled:Oe,style:{background:Oe?`var(--bg-tertiary)`:`var(--bg-elevated)`,color:Oe?`var(--text-tertiary)`:`var(--text-primary)`,border:`1px solid var(--border)`,borderRadius:6,padding:`6px 14px`,fontSize:11,fontWeight:600,cursor:Oe?`not-allowed`:`pointer`},children:Oe?`⏳ Checking...`:`🔎 Check All Updates`}),(0,R.jsx)(`button`,{id:`automation-update-all-btn`,disabled:!0,style:{background:`linear-gradient(135deg, var(--accent), var(--accent-hover))`,color:`#fff`,border:`none`,borderRadius:6,padding:`6px 14px`,fontSize:11,fontWeight:600,cursor:`not-allowed`,opacity:.5},children:`⬆️ Update All`})]})]}),(0,R.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:t.map(e=>(0,R.jsxs)(`div`,{id:`automation-update-${e.name}`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`10px 14px`,background:`var(--bg-tertiary)`,borderRadius:8,border:`1px solid var(--border)`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,R.jsx)(`span`,{style:{fontSize:13,fontWeight:600,color:`var(--text-primary)`},children:e.name}),(0,R.jsxs)(`span`,{style:{fontSize:10,color:`var(--text-tertiary)`,fontFamily:`var(--font-mono)`},children:[`v`,gZ(``)]})]}),(0,R.jsx)(`span`,{style:{fontSize:10,fontWeight:600,padding:`3px 10px`,borderRadius:12,background:`rgba(16, 185, 129, 0.1)`,color:`#10b981`,border:`1px solid rgba(16, 185, 129, 0.2)`},children:`✓ Up to date`})]},e.name))})]}),(0,R.jsxs)(`div`,{className:`card`,style:{padding:24,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:12,borderBottom:`1px solid var(--border)`,paddingBottom:10,flexWrap:`wrap`,gap:10},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{id:`automation-research-heading`,style:{fontSize:14,fontWeight:700,color:`var(--text-tertiary)`,textTransform:`uppercase`,letterSpacing:.5,margin:0},children:`🧠 Continuous Intelligence Loop`}),(0,R.jsx)(`p`,{style:{fontSize:11,color:`var(--text-tertiary)`,marginTop:4,margin:0},children:`Skills automatically trigger background research to update their reference material and improve evals`})]}),(0,R.jsx)(`button`,{id:`automation-trigger-research-btn`,onClick:()=>void qe(),style:{background:`linear-gradient(135deg, #8b5cf6, #7c3aed)`,color:`#fff`,border:`none`,borderRadius:6,padding:`6px 14px`,fontSize:11,fontWeight:600,cursor:`pointer`,flexShrink:0},children:`🔬 Trigger Research Cycle`})]}),F?(0,R.jsx)(`div`,{style:{textAlign:`center`,padding:20,color:`var(--text-tertiary)`,fontSize:12},children:`Loading research items...`}):Te.length>0?(0,R.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:Te.slice(0,8).map(e=>(0,R.jsxs)(`div`,{id:`automation-research-${e.id}`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`10px 14px`,background:`var(--bg-tertiary)`,borderRadius:8,border:`1px solid var(--border)`},children:[(0,R.jsxs)(`div`,{style:{flex:1},children:[(0,R.jsx)(`div`,{style:{fontSize:12,fontWeight:600,color:`var(--text-primary)`},children:e.topic}),(0,R.jsxs)(`div`,{style:{fontSize:10,color:`var(--text-tertiary)`,marginTop:2},children:[e.priority,` priority · `,new Date(e.created_at).toLocaleDateString()]})]}),(0,R.jsx)(`span`,{style:{fontSize:10,fontWeight:600,padding:`3px 10px`,borderRadius:12,background:e.status===`done`?`rgba(16, 185, 129, 0.1)`:e.status===`in_progress`?`rgba(59, 130, 246, 0.1)`:e.status===`failed`?`rgba(239, 68, 68, 0.1)`:`rgba(245, 158, 11, 0.1)`,color:e.status===`done`?`#10b981`:e.status===`in_progress`?`#60a5fa`:e.status===`failed`?`#ef4444`:`#f59e0b`,border:`1px solid ${e.status===`done`?`rgba(16, 185, 129, 0.2)`:e.status===`in_progress`?`rgba(59, 130, 246, 0.2)`:e.status===`failed`?`rgba(239, 68, 68, 0.2)`:`rgba(245, 158, 11, 0.2)`}`},children:e.status})]},e.id))}):(0,R.jsx)(`div`,{style:{padding:20,textAlign:`center`,color:`var(--text-tertiary)`,fontSize:12,border:`1px dashed var(--border)`,borderRadius:8},children:`No pending research items. Trigger a research cycle to auto-update skill references.`})]}),(0,R.jsxs)(`div`,{className:`card`,style:{padding:24,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:16,borderBottom:`1px solid var(--border)`,paddingBottom:8},children:[(0,R.jsx)(`h3`,{id:`automation-improvements-heading`,style:{margin:0,fontSize:14,fontWeight:700,color:`var(--text-tertiary)`,textTransform:`uppercase`,letterSpacing:.5},children:`💡 AI Skill Improvement Queue`}),(0,R.jsx)(`button`,{onClick:Pe,disabled:Me,style:{background:Me?`var(--bg-secondary)`:`linear-gradient(135deg, #10b981, #059669)`,color:`#fff`,border:`none`,borderRadius:6,padding:`6px 14px`,fontSize:11,fontWeight:600,cursor:Me?`not-allowed`:`pointer`,flexShrink:0},children:Me?`⏳ Auditing Skills...`:`🤖 Run AI Audit`})]}),Ae.length>0?(0,R.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:Ae.map((e,t)=>(0,R.jsxs)(`div`,{id:`automation-suggestion-${t}`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`10px 14px`,background:`var(--bg-tertiary)`,borderRadius:8,border:`1px solid var(--border)`,gap:12},children:[(0,R.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:2,flexWrap:`wrap`},children:[(0,R.jsx)(`span`,{style:{fontSize:12,fontWeight:600,color:`var(--text-primary)`},children:e.skillName}),(0,R.jsx)(`span`,{style:{fontSize:9,fontWeight:700,padding:`2px 8px`,borderRadius:10,textTransform:`uppercase`,letterSpacing:.3,background:e.problematic?`rgba(239, 68, 68, 0.1)`:`rgba(245, 158, 11, 0.1)`,color:e.problematic?`#f87171`:`#f59e0b`,border:`1px solid ${e.problematic?`rgba(239, 68, 68, 0.2)`:`rgba(245, 158, 11, 0.2)`}`},children:e.problematic?`Problematic`:`Outdated`})]}),(0,R.jsx)(`div`,{style:{fontSize:11,color:`var(--text-secondary)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.description})]}),(0,R.jsx)(`button`,{id:`automation-fix-${t}`,style:{background:`var(--bg-elevated)`,color:`var(--text-primary)`,border:`1px solid var(--border)`,borderRadius:6,padding:`5px 12px`,fontSize:10,fontWeight:600,cursor:`pointer`,flexShrink:0,transition:`all 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`var(--accent)`,e.currentTarget.style.color=`#fff`},onMouseLeave:e=>{e.currentTarget.style.background=`var(--bg-elevated)`,e.currentTarget.style.color=`var(--text-primary)`},children:`🔧 Fix`})]},t))}):(0,R.jsx)(`div`,{style:{padding:20,textAlign:`center`,color:`var(--text-tertiary)`,fontSize:12,border:`1px dashed var(--border)`,borderRadius:8},children:`No improvement suggestions. All skills are well-configured. ✨`})]})]})]})}function bZ({activeBrainId:e}){let[t,n]=(0,_.useState)([]),[r,i]=(0,_.useState)(!0),[a,o]=(0,_.useState)(null);(0,_.useEffect)(()=>{s()},[e]);async function s(){i(!0),o(null);try{let e=await L(Rn()+`/api/rules`);if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error||t.message||`HTTP ${e.status}`)}let t=await e.json();n(Array.isArray(t.rules)?t.rules:[])}catch(e){console.error(`Failed to fetch rules:`,e),o(e instanceof Error?e.message:`Failed to fetch rules`),n([])}finally{i(!1)}}let c=async e=>{if(window.confirm(`Are you sure you want to archive this rule?\n\n"${e.title}"`))try{await L(Rn()+`/api/memory/${e.slug}`,{method:`PATCH`,body:JSON.stringify({status:`archived`}),headers:{"Content-Type":`application/json`}}),s()}catch{alert(`Failed to archive rule`)}},l=async e=>{try{await L(Rn()+`/api/memory/${e.slug}`,{method:`PATCH`,body:JSON.stringify({status:`active`}),headers:{"Content-Type":`application/json`}}),s()}catch{alert(`Failed to restore rule`)}},u=t.filter(e=>e.category===`invariants`),d=t.filter(e=>e.category===`preferences`),f=t.filter(e=>e.category===`anti-patterns`),p=(e,t)=>{let n=e.status===`archived`,r=Math.min(5,Math.max(0,Number(e.importance)||0));return(0,R.jsxs)(`div`,{"data-testid":`rule-card`,style:{border:`1px solid ${n?`var(--border)`:t}`,opacity:n?.6:1,borderRadius:8,padding:16,marginBottom:12,background:`var(--bg-secondary)`,display:`flex`,flexDirection:`column`,gap:8},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,R.jsx)(`h4`,{style:{margin:0,fontSize:16,color:`var(--text-primary)`},children:e.title}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`center`},children:[(0,R.jsxs)(`span`,{style:{fontSize:12,color:`var(--text-tertiary)`,background:`var(--bg-primary)`,padding:`2px 6px`,borderRadius:4},children:[e.scope,` brain`]}),(0,R.jsx)(`span`,{style:{fontSize:12,color:`gold`},"aria-label":`Importance ${r} of 5`,children:`★`.repeat(r)+`☆`.repeat(5-r)})]})]}),(0,R.jsx)(`div`,{style:{fontSize:14,color:`var(--text-secondary)`,whiteSpace:`pre-wrap`},children:e.body||`(no body)`}),(0,R.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginTop:8},children:n?(0,R.jsx)(`button`,{onClick:()=>l(e),style:{padding:`4px 8px`,borderRadius:4,background:`var(--bg-primary)`,border:`1px solid var(--border)`,cursor:`pointer`,color:`var(--text-primary)`},children:`Restore`}):(0,R.jsx)(`button`,{onClick:()=>c(e),style:{padding:`4px 8px`,borderRadius:4,background:`var(--bg-primary)`,border:`1px solid var(--border)`,cursor:`pointer`,color:`var(--text-primary)`},children:`Archive`})})]},`${e.scope}:${e.slug}`)};return r?(0,R.jsx)(`div`,{style:{padding:20},"data-testid":`rules-loading`,children:`Loading rules...`}):(0,R.jsxs)(`div`,{style:{padding:40,maxWidth:1e3,margin:`0 auto`,height:`100%`,overflowY:`auto`},"data-testid":`rules-page`,children:[(0,R.jsxs)(`header`,{style:{marginBottom:40},children:[(0,R.jsx)(`h1`,{style:{margin:`0 0 8px 0`,fontSize:28,color:`var(--text-primary)`},children:`Agent Rules`}),(0,R.jsx)(`p`,{style:{margin:0,color:`var(--text-secondary)`,fontSize:16},children:`Manage invariants, preferences, and corrections across your active brains.`})]}),a&&(0,R.jsxs)(`div`,{"data-testid":`rules-error`,role:`alert`,style:{marginBottom:24,padding:12,borderRadius:8,border:`1px solid #ef4444`,background:`rgba(239, 68, 68, 0.08)`,color:`#ef4444`},children:[`Failed to load rules: `,a,(0,R.jsx)(`button`,{type:`button`,onClick:()=>s(),style:{marginLeft:12,padding:`2px 8px`,cursor:`pointer`},children:`Retry`})]}),(0,R.jsxs)(`section`,{style:{marginBottom:40},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:16},children:[(0,R.jsx)(`h2`,{style:{margin:0,color:`#ef4444`},children:`Invariants`}),(0,R.jsx)(`span`,{style:{background:`rgba(239, 68, 68, 0.1)`,color:`#ef4444`,padding:`2px 8px`,borderRadius:12,fontSize:12,fontWeight:`bold`},children:u.length})]}),u.map(e=>p(e,`rgba(239, 68, 68, 0.3)`)),u.length===0&&(0,R.jsx)(`p`,{style:{color:`var(--text-tertiary)`},children:`No invariants found.`})]}),(0,R.jsxs)(`section`,{style:{marginBottom:40},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:16},children:[(0,R.jsx)(`h2`,{style:{margin:0,color:`#3b82f6`},children:`Preferences`}),(0,R.jsx)(`span`,{style:{background:`rgba(59, 130, 246, 0.1)`,color:`#3b82f6`,padding:`2px 8px`,borderRadius:12,fontSize:12,fontWeight:`bold`},children:d.length})]}),d.map(e=>p(e,`rgba(59, 130, 246, 0.3)`)),d.length===0&&(0,R.jsx)(`p`,{style:{color:`var(--text-tertiary)`},children:`No preferences found.`})]}),(0,R.jsxs)(`section`,{style:{marginBottom:40},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:16},children:[(0,R.jsx)(`h2`,{style:{margin:0,color:`#f59e0b`},children:`Corrections`}),(0,R.jsx)(`span`,{style:{background:`rgba(245, 158, 11, 0.1)`,color:`#f59e0b`,padding:`2px 8px`,borderRadius:12,fontSize:12,fontWeight:`bold`},children:f.length})]}),f.map(e=>p(e,`rgba(245, 158, 11, 0.3)`)),f.length===0&&(0,R.jsx)(`p`,{style:{color:`var(--text-tertiary)`},children:`No corrections found.`})]})]})}function xZ(e){if(!e)return``;let t=e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`);return t=t.replace(/^### (.*$)/gim,`<h3>$1</h3>`),t=t.replace(/^## (.*$)/gim,`<h2>$1</h2>`),t=t.replace(/^# (.*$)/gim,`<h1>$1</h1>`),t=t.replace(/\*\*(.*?)\*\*/g,`<strong>$1</strong>`),t=t.replace(/\*(.*?)\*/g,`<em>$1</em>`),t=t.replace(/```([\s\S]*?)```/g,`<pre style="background:rgba(0,0,0,0.3);padding:12px;border-radius:6px;border:1px solid rgba(255,255,255,0.06);font-family:monospace;overflow-x:auto;margin:12px 0;"><code>$1</code></pre>`),t=t.replace(/`(.*?)`/g,`<code style="background:rgba(255,255,255,0.06);padding:2px 6px;border-radius:4px;font-family:monospace;">$1</code>`),t=t.replace(/^> (.*$)/gim,`<blockquote style="border-left:4px solid var(--purple-primary);padding-left:14px;color:var(--text-secondary);margin:16px 0;font-style:italic;">$1</blockquote>`),t=t.replace(/^- (.*$)/gim,`<li style="margin-left:20px;list-style-type:disc;">$1</li>`),t=t.replace(/\n/g,`<br />`),(0,R.jsx)(`div`,{dangerouslySetInnerHTML:{__html:t},className:`markdown-preview-block`})}function SZ(){let[e,t]=(0,_.useState)([]),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(``);return(0,_.useEffect)(()=>{async function e(){try{let e=await Jr();t(e.topics),e.topics.length>0&&r(e.topics[0].id)}catch(e){l(e.message||`Failed to load help topics`)}}e()},[]),(0,_.useEffect)(()=>{if(!n)return;async function e(){s(!0);try{let e=await Yr(n);a(e.content)}catch(e){l(e.message||`Failed to load help details`)}finally{s(!1)}}e()},[n]),(0,R.jsxs)(`div`,{className:`page`,style:{padding:`24px`,maxWidth:`1100px`,margin:`0 auto`},children:[(0,R.jsxs)(`div`,{className:`page-header`,style:{marginBottom:`24px`},children:[(0,R.jsx)(`h1`,{children:`Help & CLI Reference`}),(0,R.jsx)(`p`,{children:`Offline docs for portable memory: CLI commands, vault layout, dream, tasks, and IDE connect.`})]}),c&&(0,R.jsxs)(`div`,{className:`badge badge-error`,style:{marginBottom:`16px`},children:[`⚠️ `,c]}),(0,R.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`260px 1fr`,gap:`30px`,minHeight:`500px`},children:[(0,R.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`10px`},children:e.map(e=>(0,R.jsxs)(`button`,{onClick:()=>r(e.id),style:{textAlign:`left`,padding:`12px 16px`,borderRadius:`8px`,background:n===e.id?`var(--purple-primary)`:`rgba(255, 255, 255, 0.03)`,color:`#fff`,border:n===e.id?`1px solid var(--purple-border)`:`1px solid transparent`,cursor:`pointer`,transition:`all 0.2s`},children:[(0,R.jsx)(`div`,{style:{fontWeight:`bold`,fontSize:`14px`},children:e.title}),(0,R.jsx)(`div`,{style:{fontSize:`11px`,color:n===e.id?`rgba(255, 255, 255, 0.8)`:`var(--text-secondary)`,marginTop:`4px`},children:e.description})]},e.id))}),(0,R.jsx)(`div`,{style:{background:`var(--surface-bg)`,border:`1px solid var(--border)`,borderRadius:`12px`,padding:`30px`,overflowY:`auto`,maxHeight:`75vh`},children:o?(0,R.jsx)(`div`,{className:`skeleton`,style:{height:`400px`}}):(0,R.jsx)(`div`,{className:`markdown-body`,style:{color:`var(--text-primary)`,lineHeight:`1.7`,fontSize:`14px`},children:xZ(i)})})]})]})}function CZ({activeBrainId:e}){let[t,n]=(0,_.useState)([]),[r,i]=(0,_.useState)([]),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)(!0),[l,u]=(0,_.useState)([]);return(0,_.useEffect)(()=>{async function t(){c(!0);try{let[t,r,a]=await Promise.all([or(e).catch(()=>[]),Mr().catch(()=>({items:[]})),nr().catch(()=>[])]);n(t),i(r.items||[]),o(a)}catch(e){console.error(`Failed to load graph data`,e)}finally{c(!1)}}t()},[e]),(0,R.jsxs)(`div`,{className:`page`,style:{padding:0,height:`calc(100vh - 1px)`,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,R.jsxs)(`div`,{style:{padding:`16px 24px`,background:`rgba(18, 18, 26, 0.45)`,backdropFilter:`blur(16px)`,borderBottom:`1px solid var(--border)`,flexShrink:0},children:[(0,R.jsx)(`h1`,{style:{fontSize:`18px`,fontWeight:700,letterSpacing:`-0.02em`},children:`Memory Graph`}),(0,R.jsx)(`p`,{style:{fontSize:`12px`,color:`var(--text-secondary)`,marginTop:`2px`},children:`3D vault map — facts (blue), rules (cyan/rose), research (amber), sessions (teal).`})]}),(0,R.jsx)(`div`,{style:{flex:1,position:`relative`,overflow:`hidden`},children:s?(0,R.jsx)(`div`,{className:`skeleton`,style:{width:`100%`,height:`100%`}}):t.length===0&&r.length===0&&a.length===0?(0,R.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`,color:`var(--text-secondary)`},children:`No nodes found for graph`}):(0,R.jsx)(YY,{threads:a,memoryNodes:t,researchItems:r,onOpenThread:()=>{},onGroundMemoryNode:e=>{u(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},selectedGroundingNodes:l})})]})}var wZ=e=>JSON.stringify(e).replace(/</g,`\\u003c`);function TZ(e,t,n,r={},i=``,a={}){return`<!doctype html><html><head>
|
|
5523
|
+
`;try{await vr(n,i,t),A(``),M(``),k(!1),S(`Skill "${n}" successfully created!`),setTimeout(()=>S(null),5e3),Fe(n)}catch(e){b(e.message||`Failed to create new skill.`)}},Ve=async e=>{if(e.preventDefault(),ne.trim()){oe(!0),b(null),ue(null);try{let e=await br(ne.trim());ie(e||[])}catch(e){b(e.message||`Registry query failed. Is the server connected?`)}finally{oe(!1)}}},He=async e=>{ce(e),b(null),S(null),ue(null);try{let t=await xr(e);t.success?(S(`✓ Skill "${t.skillName||e}" successfully installed, security audited, and compiled!`),setTimeout(()=>S(null),7e3),Fe(t.skillName)):t.reason&&t.reason.includes(`quarantined`)?ue({pkg:e,reason:t.reason||`Static security audit scanned critical dynamic string evaluations or commands injection vectors.`}):b(`❌ Installation failed: ${t.reason||`Unknown error`}`)}catch(e){b(e.message||`Dynamic installation handler failed.`)}finally{ce(null)}},Ue=async e=>{if(_e(t=>({...t,[e]:!t[e]})),!ve[e]&&a)try{let t=await _r(a.name,e,a.repo);ye(n=>({...n,[e]:t}))}catch(t){console.error(`Failed to fetch skill files`,t),b(t.message||`Failed to fetch skill files.`),ye(t=>({...t,[e]:[]}))}},We=async()=>{Ce(!0),we(null);try{let e=await mr(`node .agent/skills/tr-skill/scripts/enforce-skill-optimization.mjs`,15e3);we(e.output),e.success&&(S(`Enforcement scan completed.`),setTimeout(()=>S(null),5e3))}catch(e){we(e.message)}finally{Ce(!1)}},Ge=(0,_.useCallback)(async()=>{De(!0);try{let e=await Mr();Ee(e.items||[])}catch(e){b(e.message||`Failed to fetch research items.`)}finally{De(!1)}},[]);(0,_.useEffect)(()=>{d===`automation`&&Ge()},[d,Ge]);let Ke=async()=>{ke(!0),await new Promise(e=>setTimeout(e,1500)),ke(!1),S(`All skills are up to date.`),setTimeout(()=>S(null),5e3)},qe=async()=>{b(null);try{await Nr(`Skill reference material update cycle`,`medium`,`Auto-triggered by Skills Manager to refresh outdated skill references and evals`),S(`Research cycle queued successfully.`),setTimeout(()=>S(null),5e3),Ge()}catch(e){b(e.message||`Failed to queue research cycle.`)}},Je=[{id:`active`,label:`Skills by repo`,icon:`📂`},{id:`registry`,label:`skills.sh Registry Hub`,icon:`✨`},{id:`lifecycle`,label:`Lifecycle & Versioning`,icon:`📋`},{id:`network`,label:`P2P Skills Network`,icon:`🌐`},{id:`automation`,label:`Auto-Improvement`,icon:`⚡`}],Ye=e=>e.id||`${e.repo||`_`}::${e.name}`,Xe=e=>a?.name===e.name&&(a?.repo||``)===(e.repo||``),Ze=e=>{u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Qe=async(e,t)=>{e.stopPropagation();try{p(!0);let e=await Tr(t,!0);e.success?S(`Generated repo-expert. Modules: ${e.stats?.coreModules||0}`):b(e.message||`Failed to generate repo-expert`),setTimeout(()=>S(null),5e3)}catch(e){b(e instanceof Error?e.message:`Error generating repo-expert`)}finally{Fe(a?.name,a?.repo)}},$e=e=>(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8,flex:1,overflowY:`auto`},children:[r.length===0&&(0,R.jsx)(`p`,{style:{fontSize:12,color:`var(--text-tertiary)`,padding:8},children:`No project repos with skills found.`}),r.map(t=>{let n=l.has(t.repo),r=t.skills?.length||0;return(0,R.jsxs)(`div`,{style:{borderBottom:`1px solid var(--border)`},children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>Ze(t.repo),style:{width:`100%`,display:`flex`,justifyContent:`space-between`,alignItems:`center`,gap:8,padding:`10px 8px`,background:`transparent`,border:`none`,color:`inherit`,cursor:`pointer`,textAlign:`left`},children:[(0,R.jsxs)(`span`,{style:{fontSize:12,fontWeight:700},children:[n?`▾`:`▸`,` `,t.repo]}),(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,R.jsx)(`span`,{style:{fontSize:10,fontWeight:600,padding:`2px 8px`,borderRadius:99,background:r?`rgba(59,130,246,0.15)`:`rgba(148,163,184,0.1)`,color:r?`#93c5fd`:`var(--text-tertiary)`},children:r}),t.path&&(0,R.jsx)(`button`,{onClick:e=>void Qe(e,t.path),title:`Auto-generate repo-expert for this repository`,style:{background:`var(--bg-tertiary)`,border:`1px solid var(--border)`,color:`var(--text-secondary)`,borderRadius:`4px`,padding:`2px 6px`,fontSize:`10px`,cursor:`pointer`},children:`Generate Expert`})]})]}),n&&(0,R.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6,padding:`0 4px 10px`},children:r===0?(0,R.jsx)(`div`,{style:{fontSize:11,color:`var(--text-tertiary)`,padding:`4px 8px`},children:t.error||`No app skills (TR skills hidden)`}):t.skills.map(n=>{let r=Xe(n);return(0,R.jsxs)(`div`,{id:`${e}-skill-${n.repo}-${n.name}`,onClick:()=>void Ie(n),style:{background:r?`var(--accent-muted)`:`var(--bg-tertiary)`,border:r?`1px solid var(--accent)`:`1px solid var(--border)`,padding:`10px 12px`,borderRadius:8,cursor:`pointer`,transition:`all 0.15s ease`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,R.jsx)(`span`,{style:{fontSize:13,fontWeight:r?600:500,color:r?`var(--accent)`:`var(--text-primary)`},children:n.name}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,alignItems:`center`},children:[fe?.path&&t.repo===`Global`&&(0,R.jsx)(`input`,{type:`checkbox`,checked:!!fe?.skills?.some(e=>e.name===n.name),onClick:e=>e.stopPropagation(),onChange:async e=>{e.stopPropagation();let t=e.target.checked,r=fe?.path;if(r){if(t){w(!0),E(!0),O(null);try{let e=await Cr(n.name,r);O({skillName:n.name,targetRepo:r,original:e.original,preview:e.preview,signals:e.signals})}catch(e){b(e.message),w(!1)}finally{E(!1)}}else try{await Sr(n.name,r,!1),Fe()}catch(e){b(e.message)}}},style:{cursor:`pointer`},title:`Enable/Disable skill for this repo`}),(0,R.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ze(n)},style:{background:`none`,border:`none`,color:`var(--text-tertiary)`,fontSize:12,cursor:`pointer`,padding:`2px 6px`},title:`Delete skill`,children:`✖`})]})]}),n.source&&(0,R.jsx)(`div`,{style:{fontSize:10,color:`var(--text-tertiary)`,marginTop:4},children:n.source}),n.subSkills&&n.subSkills.length>0&&(0,R.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:4,marginTop:6},children:n.subSkills.slice(0,6).map(e=>(0,R.jsx)(`span`,{className:`badge`,style:{fontSize:9,padding:`1px 5px`,background:`var(--bg-elevated)`,color:`var(--text-secondary)`,border:`1px solid var(--border)`},children:e},e))})]},Ye(n))})})]},t.repo)})]});return(0,R.jsxs)(`div`,{className:`page`,style:{display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,R.jsxs)(`div`,{className:`page-header`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,flexWrap:`wrap`,gap:16},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h1`,{children:`Skills Manager`}),(0,R.jsx)(`p`,{children:`Track, edit, and deploy agent skills across any repo — registry-based, no hardcoded hosts`})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:10},children:[(0,R.jsx)(`button`,{className:`btn btn-sm btn-ghost`,onClick:()=>k(!ee),style:{border:`1px solid var(--border)`,background:`var(--bg-secondary)`},children:ee?`✖ Cancel`:`➕ Create Custom Skill`}),(0,R.jsx)(`button`,{className:`btn btn-sm`,onClick:Re,disabled:g,style:{background:g?`var(--bg-secondary)`:`linear-gradient(135deg, var(--accent), var(--accent-hover))`,color:`#fff`,border:`none`,fontWeight:500},children:g?`⏳ Compiling shims...`:`🔄 Hot-Recompile Shims`})]})]}),y&&(0,R.jsxs)(`div`,{className:`badge badge-error`,style:{marginBottom:20,display:`inline-flex`,padding:`6px 12px`,background:`rgba(239, 68, 68, 0.1)`,border:`1px solid #ef4444`,color:`#f87171`},children:[`⚠️ `,y]}),x&&(0,R.jsxs)(`div`,{className:`badge badge-success`,style:{marginBottom:20,display:`inline-flex`,padding:`6px 12px`,background:`rgba(16, 185, 129, 0.1)`,border:`1px solid #10b981`,color:`#34d399`},children:[`✓ `,x]}),le&&(0,R.jsxs)(`div`,{className:`badge badge-error`,style:{marginBottom:20,display:`flex`,flexDirection:`column`,alignItems:`flex-start`,padding:16,background:`rgba(239, 68, 68, 0.15)`,border:`1px solid #ef4444`,borderRadius:8,color:`#f87171`,gap:6},children:[(0,R.jsx)(`div`,{style:{fontWeight:700,fontSize:13},children:`🚨 SECURITY QUARANTINE PURGE ACTIVE!`}),(0,R.jsxs)(`div`,{style:{fontSize:12},children:[`Installation of package `,(0,R.jsx)(`strong`,{children:le.pkg}),` was blocked and files were hard purged.`]}),(0,R.jsxs)(`div`,{style:{fontSize:11,opacity:.85},children:[`Reason: `,le.reason]})]}),ee&&(0,R.jsxs)(`div`,{className:`card`,style:{marginBottom:24,padding:24,background:`rgba(18, 18, 26, 0.9)`,border:`1px solid var(--border)`,backdropFilter:`blur(10px)`},children:[(0,R.jsx)(`h3`,{style:{fontSize:14,fontWeight:600,borderBottom:`1px solid var(--border)`,paddingBottom:10,marginBottom:14},children:`➕ Create New Skill`}),(0,R.jsxs)(`form`,{onSubmit:Be,style:{display:`flex`,gap:16,flexWrap:`wrap`,alignItems:`flex-end`},children:[(0,R.jsxs)(`div`,{style:{flex:`1 1 200px`,display:`flex`,flexDirection:`column`,gap:6},children:[(0,R.jsx)(`label`,{htmlFor:`new_name`,style:{fontSize:11,fontWeight:500,color:`var(--text-secondary)`},children:`Skill Name (kebab-case)`}),(0,R.jsx)(`input`,{id:`new_name`,type:`text`,placeholder:`e.g. security-audit`,value:te,onChange:e=>A(e.target.value),required:!0,style:{background:`var(--bg-tertiary)`,color:`var(--text-primary)`,border:`1px solid var(--border)`,padding:`8px 12px`,borderRadius:6,outline:`none`,fontSize:12}})]}),(0,R.jsxs)(`div`,{style:{flex:`2 1 300px`,display:`flex`,flexDirection:`column`,gap:6},children:[(0,R.jsx)(`label`,{htmlFor:`new_desc`,style:{fontSize:11,fontWeight:500,color:`var(--text-secondary)`},children:`Brief Description / System Triggers`}),(0,R.jsx)(`input`,{id:`new_desc`,type:`text`,placeholder:`e.g. Audits security parameters, encryption costs, and Caddy forward gates`,value:j,onChange:e=>M(e.target.value),style:{background:`var(--bg-tertiary)`,color:`var(--text-primary)`,border:`1px solid var(--border)`,padding:`8px 12px`,borderRadius:6,outline:`none`,fontSize:12}})]}),(0,R.jsx)(`button`,{type:`submit`,style:{background:`linear-gradient(135deg, var(--accent), var(--accent-hover))`,color:`#fff`,padding:`8px 16px`,borderRadius:6,fontWeight:500,border:`none`,fontSize:12,cursor:`pointer`,height:33},children:`🚀 Initialize Skill`})]})]}),(0,R.jsx)(`div`,{style:{display:`flex`,gap:6,marginBottom:20,borderBottom:`1px solid var(--border)`,paddingBottom:10,flexWrap:`wrap`},children:Je.map(e=>(0,R.jsxs)(`button`,{id:`tab-${e.id}`,onClick:()=>f(e.id),style:{padding:`8px 14px`,borderRadius:8,border:`none`,background:d===e.id?`var(--accent)`:`var(--bg-tertiary)`,color:d===e.id?`#fff`:`var(--text-secondary)`,fontWeight:600,cursor:`pointer`,fontSize:11,transition:`all 0.15s ease`,whiteSpace:`nowrap`},children:[e.icon,` `,e.label]},e.id))}),d===`active`?(0,R.jsxs)(`div`,{style:{display:`flex`,flex:1,gap:24,minHeight:0,overflow:`hidden`,paddingBottom:16},children:[(0,R.jsx)(`div`,{style:{width:300,display:`flex`,flexDirection:`column`,gap:16,flexShrink:0,overflowY:`auto`},children:(0,R.jsxs)(`div`,{className:`card`,style:{padding:16,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`,flex:1,display:`flex`,flexDirection:`column`},children:[(0,R.jsx)(`h3`,{style:{fontSize:12,fontWeight:700,color:`var(--text-tertiary)`,textTransform:`uppercase`,letterSpacing:.5,borderBottom:`1px solid var(--border)`,paddingBottom:8,marginBottom:8},children:`Skills by repo`}),(0,R.jsxs)(`p`,{style:{fontSize:10,color:`var(--text-tertiary)`,margin:`0 0 10px`,lineHeight:1.4},children:[`Project skills only · total-recall / tr-* hidden · `,t.length,` skill`,t.length===1?``:`s`]}),$e(`active`)]})}),(0,R.jsx)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,minHeight:0},children:a?(0,R.jsxs)(`div`,{className:`card`,style:{flex:1,padding:24,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`,display:`flex`,flexDirection:`column`,minHeight:0},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,borderBottom:`1px solid var(--border)`,paddingBottom:12,marginBottom:16,flexShrink:0},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`h3`,{style:{fontSize:16,fontWeight:600,color:`var(--text-primary)`},children:[`📝 Editing Capability rules: `,a.name,`/SKILL.md`]}),(0,R.jsx)(`p`,{style:{fontSize:11,color:`var(--text-tertiary)`},children:`Hot-recompiled rules preserve immutable instructions and custom shims`})]}),(0,R.jsx)(`button`,{className:`btn btn-primary`,onClick:Le,disabled:m,style:{background:`linear-gradient(135deg, var(--accent), var(--accent-hover))`,color:`#fff`,fontWeight:500,borderRadius:6,padding:`8px 18px`,fontSize:12},children:m?`⏳ Saving...`:`💾 Save rules`})]}),(0,R.jsx)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,minHeight:0},children:(0,R.jsx)(`textarea`,{value:s,onChange:e=>c(e.target.value),style:{flex:1,width:`100%`,fontFamily:`var(--font-mono)`,fontSize:13,padding:16,background:`var(--bg-secondary)`,color:`var(--text-primary)`,border:`1px solid var(--border)`,borderRadius:8,resize:`none`,outline:`none`,lineHeight:1.6,whiteSpace:`pre`,overflowWrap:`normal`,overflowX:`auto`},spellCheck:!1})})]}):(0,R.jsx)(`div`,{className:`card`,style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`,color:`var(--text-secondary)`},children:`No skill selected. Click a skill in the registry to manage its rules sheet.`})})]}):d===`registry`?(0,R.jsxs)(`div`,{style:{display:`flex`,flex:1,flexDirection:`column`,minHeight:0,overflowY:`auto`,paddingBottom:16},children:[(0,R.jsxs)(`div`,{className:`card`,style:{padding:24,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`,marginBottom:20},children:[(0,R.jsx)(`h3`,{style:{fontSize:15,fontWeight:600,color:`var(--text-primary)`,marginBottom:8},children:`🔍 Discover AI Agent Skills from skills.sh`}),(0,R.jsx)(`p`,{style:{fontSize:12,color:`var(--text-secondary)`,marginBottom:16},children:`Query the absolute ratings list from the open-source registry. When you trigger installation, files are sandboxed, statically audited for command injection vulnerabilities, and automatically compiled.`}),(0,R.jsxs)(`form`,{onSubmit:Ve,style:{display:`flex`,gap:12},children:[(0,R.jsx)(`input`,{type:`text`,placeholder:`Search skills (e.g. git, typescript, prd...)`,value:ne,onChange:e=>N(e.target.value),style:{flex:1,background:`var(--bg-tertiary)`,color:`var(--text-primary)`,border:`1px solid var(--border)`,borderRadius:8,padding:`10px 16px`,fontSize:13,outline:`none`}}),(0,R.jsx)(`button`,{type:`submit`,disabled:ae,style:{background:`linear-gradient(135deg, var(--accent), var(--accent-hover))`,color:`#fff`,border:`none`,borderRadius:8,padding:`10px 24px`,fontWeight:600,fontSize:13,cursor:`pointer`},children:ae?`⏳ Sifting...`:`🔎 Query Registry`})]})]}),(0,R.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:ae?(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,padding:40,color:`var(--text-secondary)`},children:[(0,R.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--text-tertiary)`,strokeWidth:`2.5`,style:{animation:`spin 1s linear infinite`,marginBottom:12},children:(0,R.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`})}),(0,R.jsx)(`span`,{children:`Searching packages in registry catalog...`})]}):re.length>0?(0,R.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(320px, 1fr))`,gap:16},children:re.map(e=>{let t=se===e.name;return(0,R.jsxs)(`div`,{style:{background:`rgba(18, 18, 26, 0.4)`,border:`1px solid var(--border)`,borderRadius:10,padding:20,display:`flex`,flexDirection:`column`,justifyContent:`space-between`,gap:16},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,flexWrap:`wrap`,gap:8,marginBottom:8},children:[(0,R.jsx)(`span`,{style:{fontWeight:700,fontSize:14,color:`#fff`,wordBreak:`break-all`},children:e.name}),(0,R.jsxs)(`span`,{className:`badge`,style:{background:`rgba(59, 130, 246, 0.15)`,color:`#60a5fa`,border:`1px solid rgba(59, 130, 246, 0.2)`,fontSize:10,padding:`2px 8px`,borderRadius:20},children:[`⚡ `,e.installsStr,` installs`]})]}),(0,R.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,style:{fontSize:11,color:`var(--accent)`,textDecoration:`none`},onMouseEnter:e=>e.currentTarget.style.textDecoration=`underline`,onMouseLeave:e=>e.currentTarget.style.textDecoration=`none`,children:`🔗 View Registry Repository`})]}),(0,R.jsx)(`button`,{onClick:()=>void He(e.name),disabled:!!se,style:{width:`100%`,background:t?`var(--bg-tertiary)`:`linear-gradient(135deg, var(--accent), var(--accent-hover))`,color:t?`var(--text-secondary)`:`#fff`,border:`none`,borderRadius:8,padding:`10px 16px`,fontWeight:600,fontSize:12,cursor:se?`not-allowed`:`pointer`,transition:`all 0.15s ease`},children:t?`🛡️ Auditing & Installing...`:`➕ Install Capability`})]},e.name)})}):ne.trim()?(0,R.jsx)(`div`,{style:{textAlign:`center`,padding:40,border:`1px dashed var(--border)`,borderRadius:10,color:`var(--text-secondary)`},children:`No matching skills found in the skills.sh registry. Try a different query like "git" or "prd".`}):(0,R.jsx)(`div`,{style:{textAlign:`center`,padding:40,border:`1px dashed var(--border)`,borderRadius:10,color:`var(--text-tertiary)`,fontSize:12},children:`Enter a search query above to browse portable capabilities from the cloud registry.`})})]}):d===`lifecycle`?(0,R.jsxs)(`div`,{style:{display:`flex`,flex:1,gap:24,minHeight:0,overflow:`hidden`,paddingBottom:16},children:[C&&(0,R.jsx)(`div`,{style:{position:`fixed`,top:0,left:0,right:0,bottom:0,background:`rgba(0,0,0,0.7)`,zIndex:9999,display:`flex`,justifyContent:`center`,alignItems:`center`},children:(0,R.jsxs)(`div`,{className:`card`,style:{background:`var(--bg-primary)`,border:`1px solid var(--border)`,borderRadius:12,padding:24,width:`80%`,maxWidth:900,maxHeight:`90vh`,display:`flex`,flexDirection:`column`},children:[(0,R.jsx)(`h2`,{style:{marginTop:0,marginBottom:12},children:`Skill Adaptation Preview`}),T?(0,R.jsx)(`div`,{style:{flex:1,display:`flex`,justifyContent:`center`,alignItems:`center`},children:(0,R.jsxs)(`p`,{children:[`Generating adaptive preview for `,de||e,`...`]})}):D?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{style:{color:`var(--text-secondary)`,marginBottom:16,fontSize:13},children:[`This skill will be explicitly rewritten and bound to this project repository.`,(0,R.jsx)(`br`,{}),`Detected adaptation signals: `,(0,R.jsx)(`span`,{style:{color:`var(--accent)`,fontWeight:600},children:D.signals.join(` | `)||`None (Template copied as-is)`})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,flex:1,gap:16,overflow:`hidden`,minHeight:0},children:[(0,R.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,minHeight:0},children:[(0,R.jsx)(`h3`,{style:{fontSize:13,marginBottom:8},children:`Global Template`}),(0,R.jsx)(`textarea`,{readOnly:!0,value:D.original,style:{flex:1,width:`100%`,background:`var(--bg-secondary)`,border:`1px solid var(--border)`,color:`var(--text-tertiary)`,padding:12,borderRadius:8,fontFamily:`monospace`,fontSize:12,resize:`none`,whiteSpace:`pre-wrap`}})]}),(0,R.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,minHeight:0},children:[(0,R.jsx)(`h3`,{style:{fontSize:13,marginBottom:8,color:`var(--accent)`},children:`Adapted Target (SKILL.md)`}),(0,R.jsx)(`textarea`,{readOnly:!0,value:D.preview,style:{flex:1,width:`100%`,background:`var(--bg-secondary)`,border:`1px solid var(--border)`,color:`var(--text-primary)`,padding:12,borderRadius:8,fontFamily:`monospace`,fontSize:12,resize:`none`,whiteSpace:`pre-wrap`}})]})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:12,marginTop:24},children:[(0,R.jsx)(`button`,{className:`btn`,onClick:()=>w(!1),children:`Cancel`}),(0,R.jsx)(`button`,{className:`btn btn-primary`,onClick:async()=>{E(!0);try{await Sr(D.skillName,D.targetRepo,!0),w(!1),Fe()}catch(e){b(e.message)}finally{E(!1)}},children:`Deploy to Project`})]})]}):(0,R.jsx)(`p`,{children:`Failed to load preview data.`})]})}),(0,R.jsx)(`div`,{style:{width:280,display:`flex`,flexDirection:`column`,gap:16,flexShrink:0,overflowY:`auto`},children:(0,R.jsxs)(`div`,{className:`card`,style:{padding:16,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`,flex:1,display:`flex`,flexDirection:`column`},children:[(0,R.jsx)(`h3`,{style:{fontSize:12,fontWeight:700,color:`var(--text-tertiary)`,textTransform:`uppercase`,letterSpacing:.5,borderBottom:`1px solid var(--border)`,paddingBottom:8,marginBottom:12},children:`Skills by repo`}),$e(`lifecycle`)]})}),(0,R.jsx)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,gap:20,overflowY:`auto`,minHeight:0},children:a?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`card`,style:{padding:20,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`},children:(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:16,flexWrap:`wrap`},children:[(0,R.jsxs)(`h3`,{id:`lifecycle-version-title`,style:{fontSize:16,fontWeight:600,color:`var(--text-primary)`,margin:0},children:[a.name,a.repo?(0,R.jsxs)(`span`,{style:{fontSize:12,fontWeight:500,color:`var(--text-tertiary)`,marginLeft:8},children:[`· `,a.repo]}):null]}),(0,R.jsxs)(`span`,{id:`lifecycle-version-badge`,style:{background:`linear-gradient(135deg, var(--accent), var(--accent-hover))`,color:`#fff`,padding:`4px 14px`,borderRadius:20,fontSize:12,fontWeight:700,letterSpacing:.3},children:[`v`,pe]}),(0,R.jsxs)(`span`,{style:{fontSize:11,color:`var(--text-tertiary)`},children:[`Modified: `,new Date(a.modified).toLocaleDateString()]})]})}),(0,R.jsxs)(`div`,{className:`card`,style:{padding:20,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`},children:[(0,R.jsx)(`h3`,{id:`lifecycle-changelog-heading`,style:{fontSize:14,fontWeight:700,color:`var(--text-tertiary)`,textTransform:`uppercase`,letterSpacing:.5,marginBottom:16,borderBottom:`1px solid var(--border)`,paddingBottom:8},children:`📜 Changelog Timeline`}),me.length>0?(0,R.jsxs)(`div`,{style:{position:`relative`,paddingLeft:28},children:[(0,R.jsx)(`div`,{style:{position:`absolute`,left:5,top:6,bottom:6,width:2,background:`var(--border)`}}),me.map((e,t)=>(0,R.jsxs)(`div`,{style:{marginBottom:20,position:`relative`},children:[(0,R.jsx)(`div`,{style:{position:`absolute`,left:-28,top:4,width:12,height:12,borderRadius:`50%`,background:t===0?`var(--accent)`:`var(--text-tertiary)`,border:t===0?`2px solid var(--accent-hover)`:`2px solid var(--border)`,boxShadow:t===0?`0 0 8px rgba(var(--accent-rgb, 99, 102, 241), 0.4)`:`none`}}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:10,alignItems:`baseline`,marginBottom:6},children:[(0,R.jsxs)(`span`,{style:{fontSize:13,fontWeight:700,color:t===0?`var(--accent)`:`var(--text-primary)`},children:[`v`,e.version]}),e.date&&(0,R.jsx)(`span`,{style:{fontSize:11,color:`var(--text-tertiary)`},children:e.date})]}),(0,R.jsx)(`ul`,{style:{margin:0,paddingLeft:16,listStyle:`disc`},children:e.changes.map((e,t)=>(0,R.jsx)(`li`,{style:{fontSize:12,color:`var(--text-secondary)`,lineHeight:1.7},children:e},t))})]},`${e.version}-${t}`))]}):(0,R.jsxs)(`div`,{style:{padding:20,textAlign:`center`,color:`var(--text-tertiary)`,fontSize:12,border:`1px dashed var(--border)`,borderRadius:8},children:[`No changelog entries detected in SKILL.md. Add `,(0,R.jsx)(`code`,{children:`## v1.0.0 — 2025-01-01`}),` sections to enable version tracking.`]})]}),(0,R.jsxs)(`div`,{className:`card`,style:{padding:20,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:16,borderBottom:`1px solid var(--border)`,paddingBottom:8},children:[(0,R.jsx)(`h3`,{id:`lifecycle-health-heading`,style:{fontSize:14,fontWeight:700,color:`var(--text-tertiary)`,textTransform:`uppercase`,letterSpacing:.5,margin:0},children:`🩺 Health Checks`}),(0,R.jsx)(`button`,{id:`lifecycle-run-enforcement-btn`,onClick:()=>void We(),disabled:Se,style:{background:Se?`var(--bg-tertiary)`:`linear-gradient(135deg, #f59e0b, #d97706)`,color:`#fff`,border:`none`,borderRadius:6,padding:`6px 14px`,fontSize:11,fontWeight:600,cursor:Se?`not-allowed`:`pointer`},children:Se?`⏳ Running...`:`🛡️ Run Enforcement`})]}),(0,R.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(260px, 1fr))`,gap:10},children:he.map((e,t)=>(0,R.jsxs)(`div`,{id:`lifecycle-health-${t}`,style:{display:`flex`,alignItems:`center`,gap:10,padding:`10px 14px`,background:`var(--bg-tertiary)`,borderRadius:8,border:`1px solid ${e.passed?`rgba(16, 185, 129, 0.25)`:`rgba(239, 68, 68, 0.25)`}`},children:[(0,R.jsx)(`div`,{style:{width:10,height:10,borderRadius:`50%`,background:e.passed?`#10b981`:`#ef4444`,flexShrink:0,boxShadow:e.passed?`0 0 6px rgba(16, 185, 129, 0.4)`:`0 0 6px rgba(239, 68, 68, 0.4)`}}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{style:{fontSize:12,fontWeight:600,color:`var(--text-primary)`},children:e.label}),(0,R.jsx)(`div`,{style:{fontSize:10,color:`var(--text-tertiary)`},children:e.detail})]})]},t))}),P&&(0,R.jsx)(`pre`,{id:`lifecycle-enforcement-output`,style:{marginTop:16,padding:14,background:`var(--bg-secondary)`,border:`1px solid var(--border)`,borderRadius:8,fontSize:11,color:`var(--text-secondary)`,fontFamily:`var(--font-mono)`,whiteSpace:`pre-wrap`,maxHeight:200,overflowY:`auto`},children:P})]}),(0,R.jsxs)(`div`,{className:`card`,style:{padding:20,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`},children:[(0,R.jsx)(`h3`,{id:`lifecycle-subfiles-heading`,style:{fontSize:14,fontWeight:700,color:`var(--text-tertiary)`,textTransform:`uppercase`,letterSpacing:.5,marginBottom:16,borderBottom:`1px solid var(--border)`,paddingBottom:8},children:`📁 Sub-file Browser`}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:16,flexWrap:`wrap`},children:[(0,R.jsx)(`div`,{style:{flex:`1 1 300px`,display:`flex`,flexDirection:`column`,gap:8},children:[`scripts`,`references`,`evals`,`subagents`].map(e=>{let t=(a.subSkills||[]).map(e=>e.toLowerCase()).includes(e),n=ge[e];return(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`button`,{id:`lifecycle-subdir-${e}`,onClick:()=>Ue(e),style:{width:`100%`,display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`10px 14px`,background:`var(--bg-tertiary)`,border:`1px solid var(--border)`,borderRadius:8,cursor:`pointer`,color:t?`var(--text-primary)`:`var(--text-tertiary)`,fontSize:13,fontWeight:500,transition:`all 0.15s ease`},children:[(0,R.jsxs)(`span`,{children:[n?`▼`:`▶`,` `,e,`/`]}),(0,R.jsx)(`span`,{style:{width:8,height:8,borderRadius:`50%`,background:t?`#10b981`:`#ef4444`}})]}),n&&ve[e]&&(0,R.jsx)(`div`,{style:{paddingLeft:20,paddingTop:6,display:`flex`,flexDirection:`column`,gap:4},children:ve[e].length>0?ve[e].map(t=>(0,R.jsxs)(`div`,{onClick:()=>xe({name:`${e}/${t.name}`,content:`// Contents of ${a.name}/${e}/${t.name}\n// Size: ${t.size}\n// (Preview loaded from skill filesystem)`}),style:{display:`flex`,justifyContent:`space-between`,padding:`6px 10px`,background:`var(--bg-secondary)`,borderRadius:6,cursor:`pointer`,fontSize:11,color:`var(--text-secondary)`,transition:`background 0.1s ease`},onMouseEnter:e=>e.currentTarget.style.background=`var(--bg-elevated)`,onMouseLeave:e=>e.currentTarget.style.background=`var(--bg-secondary)`,children:[(0,R.jsxs)(`span`,{children:[`📄 `,t.name]}),(0,R.jsx)(`span`,{style:{color:`var(--text-tertiary)`},children:t.size})]},t.name)):(0,R.jsx)(`div`,{style:{fontSize:11,color:`var(--text-tertiary)`,padding:`4px 10px`},children:`Empty directory`})})]},e)})}),be&&(0,R.jsx)(`div`,{style:{flex:`1 1 300px`},children:(0,R.jsxs)(`div`,{style:{background:`var(--bg-secondary)`,border:`1px solid var(--border)`,borderRadius:8,overflow:`hidden`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`8px 14px`,background:`var(--bg-tertiary)`,borderBottom:`1px solid var(--border)`},children:[(0,R.jsx)(`span`,{style:{fontSize:12,fontWeight:600,color:`var(--text-primary)`},children:be.name}),(0,R.jsx)(`button`,{id:`lifecycle-close-preview-btn`,onClick:()=>xe(null),style:{background:`none`,border:`none`,color:`var(--text-tertiary)`,cursor:`pointer`,fontSize:14},children:`✖`})]}),(0,R.jsx)(`pre`,{style:{padding:14,fontSize:11,color:`var(--text-secondary)`,fontFamily:`var(--font-mono)`,margin:0,whiteSpace:`pre-wrap`,maxHeight:200,overflowY:`auto`},children:be.content})]})})]})]})]}):(0,R.jsx)(`div`,{className:`card`,style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`,color:`var(--text-secondary)`,fontSize:13},children:`Select a skill from the left panel to view its lifecycle details.`})})]}):d===`network`?(0,R.jsxs)(`div`,{style:{display:`flex`,flex:1,flexDirection:`column`,minHeight:0,overflowY:`auto`,paddingBottom:16},children:[(0,R.jsx)(`div`,{className:`card`,style:{padding:24,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`,marginBottom:20},children:(0,R.jsx)(`div`,{style:{display:`flex`,gap:20,flexWrap:`wrap`},children:[{label:`Connected Peers`,value:`—`,icon:`🔗`},{label:`Shared Skills`,value:`—`,icon:`📦`},{label:`Last Sync`,value:`Never`,icon:`🔄`}].map(e=>(0,R.jsxs)(`div`,{id:`network-stat-${e.label.toLowerCase().replace(/\s/g,`-`)}`,style:{flex:`1 1 140px`,background:`var(--bg-tertiary)`,border:`1px solid var(--border)`,borderRadius:10,padding:`16px 20px`,textAlign:`center`},children:[(0,R.jsx)(`div`,{style:{fontSize:22,marginBottom:4},children:e.icon}),(0,R.jsx)(`div`,{style:{fontSize:20,fontWeight:700,color:`var(--text-primary)`},children:e.value}),(0,R.jsx)(`div`,{style:{fontSize:11,color:`var(--text-tertiary)`,marginTop:2},children:e.label})]},e.label))})}),(0,R.jsxs)(`div`,{className:`card`,id:`network-coming-soon-panel`,style:{flex:1,position:`relative`,overflow:`hidden`,border:`1px solid var(--border)`,borderRadius:12},children:[(0,R.jsxs)(`div`,{style:{padding:40,filter:`blur(3px)`,opacity:.35,pointerEvents:`none`,userSelect:`none`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`center`,gap:24,alignItems:`center`,marginBottom:30,flexWrap:`wrap`},children:[(0,R.jsxs)(`div`,{style:{padding:`20px 30px`,background:`var(--bg-tertiary)`,borderRadius:12,border:`2px solid var(--accent)`,textAlign:`center`},children:[(0,R.jsx)(`div`,{style:{fontSize:28},children:`📂`}),(0,R.jsx)(`div`,{style:{fontSize:13,fontWeight:700,marginTop:6,color:`var(--text-primary)`},children:`Local Skills`})]}),(0,R.jsx)(`div`,{style:{fontSize:28,color:`var(--accent)`},children:`⇄`}),(0,R.jsxs)(`div`,{style:{padding:`20px 30px`,background:`var(--bg-tertiary)`,borderRadius:12,border:`2px solid var(--accent)`,textAlign:`center`},children:[(0,R.jsx)(`div`,{style:{fontSize:28},children:`🌐`}),(0,R.jsx)(`div`,{style:{fontSize:13,fontWeight:700,marginTop:6,color:`var(--text-primary)`},children:`P2P Network`})]}),(0,R.jsx)(`div`,{style:{fontSize:28,color:`var(--accent)`},children:`⇄`}),(0,R.jsxs)(`div`,{style:{padding:`20px 30px`,background:`var(--bg-tertiary)`,borderRadius:12,border:`2px solid var(--accent)`,textAlign:`center`},children:[(0,R.jsx)(`div`,{style:{fontSize:28},children:`👥`}),(0,R.jsx)(`div`,{style:{fontSize:13,fontWeight:700,marginTop:6,color:`var(--text-primary)`},children:`Remote Peers`})]})]}),(0,R.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:16},children:[`Auto-discovery`,`Version Negotiation`,`Conflict Resolution`,`Security Quarantine`].map(e=>(0,R.jsx)(`div`,{style:{background:`var(--bg-tertiary)`,padding:16,borderRadius:8,border:`1px solid var(--border)`},children:(0,R.jsx)(`div`,{style:{fontSize:13,fontWeight:600,color:`var(--text-primary)`},children:e})},e))})]}),(0,R.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,background:`rgba(10, 10, 18, 0.6)`,backdropFilter:`blur(2px)`,zIndex:10},children:(0,R.jsxs)(`div`,{style:{background:`rgba(18, 18, 26, 0.95)`,border:`1px solid var(--border)`,borderRadius:16,padding:`40px 48px`,textAlign:`center`,maxWidth:520,backdropFilter:`blur(20px)`,boxShadow:`0 8px 32px rgba(0, 0, 0, 0.4)`},children:[(0,R.jsx)(`div`,{style:{fontSize:48,marginBottom:16},children:`🚀`}),(0,R.jsx)(`h2`,{id:`network-coming-soon-title`,style:{fontSize:22,fontWeight:700,color:`var(--text-primary)`,marginBottom:12},children:`Coming Soon`}),(0,R.jsx)(`p`,{style:{fontSize:13,color:`var(--text-secondary)`,lineHeight:1.7,marginBottom:20},children:`Peer-to-peer skill sharing enables automatic discovery, sync, and versioning of skills across trusted Total Recall nodes.`}),(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`center`,alignItems:`center`,gap:12,marginBottom:24,flexWrap:`wrap`},children:[(0,R.jsx)(`div`,{style:{padding:`10px 16px`,background:`var(--bg-tertiary)`,borderRadius:8,border:`1px solid var(--accent)`,fontSize:12,fontWeight:600,color:`var(--accent)`},children:`📂 Local Skills`}),(0,R.jsx)(`span`,{style:{color:`var(--accent)`,fontSize:18,fontWeight:700},children:`↔`}),(0,R.jsx)(`div`,{style:{padding:`10px 16px`,background:`linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15))`,borderRadius:8,border:`1px solid var(--accent)`,fontSize:12,fontWeight:600,color:`var(--accent)`},children:`🌐 P2P Network`}),(0,R.jsx)(`span`,{style:{color:`var(--accent)`,fontSize:18,fontWeight:700},children:`↔`}),(0,R.jsx)(`div`,{style:{padding:`10px 16px`,background:`var(--bg-tertiary)`,borderRadius:8,border:`1px solid var(--accent)`,fontSize:12,fontWeight:600,color:`var(--accent)`},children:`👥 Remote Peers`})]}),(0,R.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:8,textAlign:`left`},children:[{icon:`🔍`,label:`Auto-discovery`},{icon:`🔄`,label:`Version negotiation`},{icon:`⚔️`,label:`Conflict resolution`},{icon:`🛡️`,label:`Security quarantine`}].map(e=>(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`8px 12px`,background:`var(--bg-tertiary)`,borderRadius:6,fontSize:11,color:`var(--text-secondary)`,fontWeight:500},children:[(0,R.jsx)(`span`,{children:e.icon}),` `,e.label]},e.label))})]})})]})]}):(0,R.jsxs)(`div`,{style:{display:`flex`,flex:1,flexDirection:`column`,minHeight:0,overflowY:`auto`,paddingBottom:16,gap:20},children:[(0,R.jsxs)(`div`,{className:`card`,style:{padding:24,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:16,borderBottom:`1px solid var(--border)`,paddingBottom:10,flexWrap:`wrap`,gap:10},children:[(0,R.jsx)(`h3`,{id:`automation-update-heading`,style:{fontSize:14,fontWeight:700,color:`var(--text-tertiary)`,textTransform:`uppercase`,letterSpacing:.5,margin:0},children:`🔄 Auto-Update Status`}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,R.jsx)(`button`,{id:`automation-check-updates-btn`,onClick:()=>void Ke(),disabled:Oe,style:{background:Oe?`var(--bg-tertiary)`:`var(--bg-elevated)`,color:Oe?`var(--text-tertiary)`:`var(--text-primary)`,border:`1px solid var(--border)`,borderRadius:6,padding:`6px 14px`,fontSize:11,fontWeight:600,cursor:Oe?`not-allowed`:`pointer`},children:Oe?`⏳ Checking...`:`🔎 Check All Updates`}),(0,R.jsx)(`button`,{id:`automation-update-all-btn`,disabled:!0,style:{background:`linear-gradient(135deg, var(--accent), var(--accent-hover))`,color:`#fff`,border:`none`,borderRadius:6,padding:`6px 14px`,fontSize:11,fontWeight:600,cursor:`not-allowed`,opacity:.5},children:`⬆️ Update All`})]})]}),(0,R.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:t.map(e=>(0,R.jsxs)(`div`,{id:`automation-update-${e.name}`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`10px 14px`,background:`var(--bg-tertiary)`,borderRadius:8,border:`1px solid var(--border)`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,R.jsx)(`span`,{style:{fontSize:13,fontWeight:600,color:`var(--text-primary)`},children:e.name}),(0,R.jsxs)(`span`,{style:{fontSize:10,color:`var(--text-tertiary)`,fontFamily:`var(--font-mono)`},children:[`v`,gZ(``)]})]}),(0,R.jsx)(`span`,{style:{fontSize:10,fontWeight:600,padding:`3px 10px`,borderRadius:12,background:`rgba(16, 185, 129, 0.1)`,color:`#10b981`,border:`1px solid rgba(16, 185, 129, 0.2)`},children:`✓ Up to date`})]},e.name))})]}),(0,R.jsxs)(`div`,{className:`card`,style:{padding:24,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:12,borderBottom:`1px solid var(--border)`,paddingBottom:10,flexWrap:`wrap`,gap:10},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{id:`automation-research-heading`,style:{fontSize:14,fontWeight:700,color:`var(--text-tertiary)`,textTransform:`uppercase`,letterSpacing:.5,margin:0},children:`🧠 Continuous Intelligence Loop`}),(0,R.jsx)(`p`,{style:{fontSize:11,color:`var(--text-tertiary)`,marginTop:4,margin:0},children:`Skills automatically trigger background research to update their reference material and improve evals`})]}),(0,R.jsx)(`button`,{id:`automation-trigger-research-btn`,onClick:()=>void qe(),style:{background:`linear-gradient(135deg, #8b5cf6, #7c3aed)`,color:`#fff`,border:`none`,borderRadius:6,padding:`6px 14px`,fontSize:11,fontWeight:600,cursor:`pointer`,flexShrink:0},children:`🔬 Trigger Research Cycle`})]}),F?(0,R.jsx)(`div`,{style:{textAlign:`center`,padding:20,color:`var(--text-tertiary)`,fontSize:12},children:`Loading research items...`}):Te.length>0?(0,R.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:Te.slice(0,8).map(e=>(0,R.jsxs)(`div`,{id:`automation-research-${e.id}`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`10px 14px`,background:`var(--bg-tertiary)`,borderRadius:8,border:`1px solid var(--border)`},children:[(0,R.jsxs)(`div`,{style:{flex:1},children:[(0,R.jsx)(`div`,{style:{fontSize:12,fontWeight:600,color:`var(--text-primary)`},children:e.topic}),(0,R.jsxs)(`div`,{style:{fontSize:10,color:`var(--text-tertiary)`,marginTop:2},children:[e.priority,` priority · `,new Date(e.created_at).toLocaleDateString()]})]}),(0,R.jsx)(`span`,{style:{fontSize:10,fontWeight:600,padding:`3px 10px`,borderRadius:12,background:e.status===`done`?`rgba(16, 185, 129, 0.1)`:e.status===`in_progress`?`rgba(59, 130, 246, 0.1)`:e.status===`failed`?`rgba(239, 68, 68, 0.1)`:`rgba(245, 158, 11, 0.1)`,color:e.status===`done`?`#10b981`:e.status===`in_progress`?`#60a5fa`:e.status===`failed`?`#ef4444`:`#f59e0b`,border:`1px solid ${e.status===`done`?`rgba(16, 185, 129, 0.2)`:e.status===`in_progress`?`rgba(59, 130, 246, 0.2)`:e.status===`failed`?`rgba(239, 68, 68, 0.2)`:`rgba(245, 158, 11, 0.2)`}`},children:e.status})]},e.id))}):(0,R.jsx)(`div`,{style:{padding:20,textAlign:`center`,color:`var(--text-tertiary)`,fontSize:12,border:`1px dashed var(--border)`,borderRadius:8},children:`No pending research items. Trigger a research cycle to auto-update skill references.`})]}),(0,R.jsxs)(`div`,{className:`card`,style:{padding:24,background:`rgba(18, 18, 26, 0.5)`,border:`1px solid var(--border)`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:16,borderBottom:`1px solid var(--border)`,paddingBottom:8},children:[(0,R.jsx)(`h3`,{id:`automation-improvements-heading`,style:{margin:0,fontSize:14,fontWeight:700,color:`var(--text-tertiary)`,textTransform:`uppercase`,letterSpacing:.5},children:`💡 AI Skill Improvement Queue`}),(0,R.jsx)(`button`,{onClick:Pe,disabled:Me,style:{background:Me?`var(--bg-secondary)`:`linear-gradient(135deg, #10b981, #059669)`,color:`#fff`,border:`none`,borderRadius:6,padding:`6px 14px`,fontSize:11,fontWeight:600,cursor:Me?`not-allowed`:`pointer`,flexShrink:0},children:Me?`⏳ Auditing Skills...`:`🤖 Run AI Audit`})]}),Ae.length>0?(0,R.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:Ae.map((e,t)=>(0,R.jsxs)(`div`,{id:`automation-suggestion-${t}`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`10px 14px`,background:`var(--bg-tertiary)`,borderRadius:8,border:`1px solid var(--border)`,gap:12},children:[(0,R.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:2,flexWrap:`wrap`},children:[(0,R.jsx)(`span`,{style:{fontSize:12,fontWeight:600,color:`var(--text-primary)`},children:e.skillName}),(0,R.jsx)(`span`,{style:{fontSize:9,fontWeight:700,padding:`2px 8px`,borderRadius:10,textTransform:`uppercase`,letterSpacing:.3,background:e.problematic?`rgba(239, 68, 68, 0.1)`:`rgba(245, 158, 11, 0.1)`,color:e.problematic?`#f87171`:`#f59e0b`,border:`1px solid ${e.problematic?`rgba(239, 68, 68, 0.2)`:`rgba(245, 158, 11, 0.2)`}`},children:e.problematic?`Problematic`:`Outdated`})]}),(0,R.jsx)(`div`,{style:{fontSize:11,color:`var(--text-secondary)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.description})]}),(0,R.jsx)(`button`,{id:`automation-fix-${t}`,style:{background:`var(--bg-elevated)`,color:`var(--text-primary)`,border:`1px solid var(--border)`,borderRadius:6,padding:`5px 12px`,fontSize:10,fontWeight:600,cursor:`pointer`,flexShrink:0,transition:`all 0.15s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`var(--accent)`,e.currentTarget.style.color=`#fff`},onMouseLeave:e=>{e.currentTarget.style.background=`var(--bg-elevated)`,e.currentTarget.style.color=`var(--text-primary)`},children:`🔧 Fix`})]},t))}):(0,R.jsx)(`div`,{style:{padding:20,textAlign:`center`,color:`var(--text-tertiary)`,fontSize:12,border:`1px dashed var(--border)`,borderRadius:8},children:`No improvement suggestions. All skills are well-configured. ✨`})]})]})]})}function bZ({activeBrainId:e}){let[t,n]=(0,_.useState)([]),[r,i]=(0,_.useState)(!0),[a,o]=(0,_.useState)(null);(0,_.useEffect)(()=>{s()},[e]);async function s(){i(!0),o(null);try{let e=await L(Rn()+`/api/rules`);if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error||t.message||`HTTP ${e.status}`)}let t=await e.json();n(Array.isArray(t.rules)?t.rules:[])}catch(e){console.error(`Failed to fetch rules:`,e),o(e instanceof Error?e.message:`Failed to fetch rules`),n([])}finally{i(!1)}}let c=async e=>{if(window.confirm(`Are you sure you want to archive this rule?\n\n"${e.title}"`))try{await L(Rn()+`/api/memory/${e.slug}`,{method:`PATCH`,body:JSON.stringify({status:`archived`}),headers:{"Content-Type":`application/json`}}),s()}catch{alert(`Failed to archive rule`)}},l=async e=>{try{await L(Rn()+`/api/memory/${e.slug}`,{method:`PATCH`,body:JSON.stringify({status:`active`}),headers:{"Content-Type":`application/json`}}),s()}catch{alert(`Failed to restore rule`)}},u=t.filter(e=>e.category===`invariants`),d=t.filter(e=>e.category===`preferences`),f=t.filter(e=>e.category===`anti-patterns`),p=(e,t)=>{let n=e.status===`archived`,r=Math.min(5,Math.max(0,Number(e.importance)||0));return(0,R.jsxs)(`div`,{"data-testid":`rule-card`,style:{border:`1px solid ${n?`var(--border)`:t}`,opacity:n?.6:1,borderRadius:8,padding:16,marginBottom:12,background:`var(--bg-secondary)`,display:`flex`,flexDirection:`column`,gap:8},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,R.jsx)(`h4`,{style:{margin:0,fontSize:16,color:`var(--text-primary)`},children:e.title}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:8,alignItems:`center`},children:[(0,R.jsxs)(`span`,{style:{fontSize:12,color:`var(--text-tertiary)`,background:`var(--bg-primary)`,padding:`2px 6px`,borderRadius:4},children:[e.scope,` brain`]}),(0,R.jsx)(`span`,{style:{fontSize:12,color:`gold`},"aria-label":`Importance ${r} of 5`,children:`★`.repeat(r)+`☆`.repeat(5-r)})]})]}),(0,R.jsx)(`div`,{style:{fontSize:14,color:`var(--text-secondary)`,whiteSpace:`pre-wrap`},children:e.body||`(no body)`}),(0,R.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginTop:8},children:n?(0,R.jsx)(`button`,{onClick:()=>l(e),style:{padding:`4px 8px`,borderRadius:4,background:`var(--bg-primary)`,border:`1px solid var(--border)`,cursor:`pointer`,color:`var(--text-primary)`},children:`Restore`}):(0,R.jsx)(`button`,{onClick:()=>c(e),style:{padding:`4px 8px`,borderRadius:4,background:`var(--bg-primary)`,border:`1px solid var(--border)`,cursor:`pointer`,color:`var(--text-primary)`},children:`Archive`})})]},`${e.scope}:${e.slug}`)};return r?(0,R.jsx)(`div`,{style:{padding:20},"data-testid":`rules-loading`,children:`Loading rules...`}):(0,R.jsxs)(`div`,{style:{padding:40,maxWidth:1e3,margin:`0 auto`,height:`100%`,overflowY:`auto`},"data-testid":`rules-page`,children:[(0,R.jsxs)(`header`,{style:{marginBottom:40},children:[(0,R.jsx)(`h1`,{style:{margin:`0 0 8px 0`,fontSize:28,color:`var(--text-primary)`},children:`Agent Rules`}),(0,R.jsx)(`p`,{style:{margin:0,color:`var(--text-secondary)`,fontSize:16},children:`Manage invariants, preferences, and corrections across your active brains.`})]}),a&&(0,R.jsxs)(`div`,{"data-testid":`rules-error`,role:`alert`,style:{marginBottom:24,padding:12,borderRadius:8,border:`1px solid #ef4444`,background:`rgba(239, 68, 68, 0.08)`,color:`#ef4444`},children:[`Failed to load rules: `,a,(0,R.jsx)(`button`,{type:`button`,onClick:()=>s(),style:{marginLeft:12,padding:`2px 8px`,cursor:`pointer`},children:`Retry`})]}),(0,R.jsxs)(`section`,{style:{marginBottom:40},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:16},children:[(0,R.jsx)(`h2`,{style:{margin:0,color:`#ef4444`},children:`Invariants`}),(0,R.jsx)(`span`,{style:{background:`rgba(239, 68, 68, 0.1)`,color:`#ef4444`,padding:`2px 8px`,borderRadius:12,fontSize:12,fontWeight:`bold`},children:u.length})]}),u.map(e=>p(e,`rgba(239, 68, 68, 0.3)`)),u.length===0&&(0,R.jsx)(`p`,{style:{color:`var(--text-tertiary)`},children:`No invariants found.`})]}),(0,R.jsxs)(`section`,{style:{marginBottom:40},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:16},children:[(0,R.jsx)(`h2`,{style:{margin:0,color:`#3b82f6`},children:`Preferences`}),(0,R.jsx)(`span`,{style:{background:`rgba(59, 130, 246, 0.1)`,color:`#3b82f6`,padding:`2px 8px`,borderRadius:12,fontSize:12,fontWeight:`bold`},children:d.length})]}),d.map(e=>p(e,`rgba(59, 130, 246, 0.3)`)),d.length===0&&(0,R.jsx)(`p`,{style:{color:`var(--text-tertiary)`},children:`No preferences found.`})]}),(0,R.jsxs)(`section`,{style:{marginBottom:40},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,marginBottom:16},children:[(0,R.jsx)(`h2`,{style:{margin:0,color:`#f59e0b`},children:`Corrections`}),(0,R.jsx)(`span`,{style:{background:`rgba(245, 158, 11, 0.1)`,color:`#f59e0b`,padding:`2px 8px`,borderRadius:12,fontSize:12,fontWeight:`bold`},children:f.length})]}),f.map(e=>p(e,`rgba(245, 158, 11, 0.3)`)),f.length===0&&(0,R.jsx)(`p`,{style:{color:`var(--text-tertiary)`},children:`No corrections found.`})]})]})}function xZ(e){if(!e)return``;let t=e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`);return t=t.replace(/^### (.*$)/gim,`<h3>$1</h3>`),t=t.replace(/^## (.*$)/gim,`<h2>$1</h2>`),t=t.replace(/^# (.*$)/gim,`<h1>$1</h1>`),t=t.replace(/\*\*(.*?)\*\*/g,`<strong>$1</strong>`),t=t.replace(/\*(.*?)\*/g,`<em>$1</em>`),t=t.replace(/```([\s\S]*?)```/g,`<pre style="background:rgba(0,0,0,0.3);padding:12px;border-radius:6px;border:1px solid rgba(255,255,255,0.06);font-family:monospace;overflow-x:auto;margin:12px 0;"><code>$1</code></pre>`),t=t.replace(/`(.*?)`/g,`<code style="background:rgba(255,255,255,0.06);padding:2px 6px;border-radius:4px;font-family:monospace;">$1</code>`),t=t.replace(/^> (.*$)/gim,`<blockquote style="border-left:4px solid var(--purple-primary);padding-left:14px;color:var(--text-secondary);margin:16px 0;font-style:italic;">$1</blockquote>`),t=t.replace(/^- (.*$)/gim,`<li style="margin-left:20px;list-style-type:disc;">$1</li>`),t=t.replace(/\n/g,`<br />`),(0,R.jsx)(`div`,{dangerouslySetInnerHTML:{__html:t},className:`markdown-preview-block`})}function SZ(){let[e,t]=(0,_.useState)([]),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(``);return(0,_.useEffect)(()=>{async function e(){try{let e=await Jr();t(e.topics),e.topics.length>0&&r(e.topics[0].id)}catch(e){l(e.message||`Failed to load help topics`)}}e()},[]),(0,_.useEffect)(()=>{if(!n)return;async function e(){s(!0);try{let e=await Yr(n);a(e.content)}catch(e){l(e.message||`Failed to load help details`)}finally{s(!1)}}e()},[n]),(0,R.jsxs)(`div`,{className:`page`,style:{padding:`24px`,maxWidth:`1100px`,margin:`0 auto`},children:[(0,R.jsxs)(`div`,{className:`page-header`,style:{marginBottom:`24px`},children:[(0,R.jsx)(`h1`,{children:`Help & CLI Reference`}),(0,R.jsx)(`p`,{children:`Offline docs for portable memory: CLI commands, vault layout, dream, tasks, and IDE connect.`})]}),c&&(0,R.jsxs)(`div`,{className:`badge badge-error`,style:{marginBottom:`16px`},children:[`⚠️ `,c]}),(0,R.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`260px 1fr`,gap:`30px`,minHeight:`500px`},children:[(0,R.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`10px`},children:e.map(e=>(0,R.jsxs)(`button`,{onClick:()=>r(e.id),style:{textAlign:`left`,padding:`12px 16px`,borderRadius:`8px`,background:n===e.id?`var(--purple-primary)`:`rgba(255, 255, 255, 0.03)`,color:`#fff`,border:n===e.id?`1px solid var(--purple-border)`:`1px solid transparent`,cursor:`pointer`,transition:`all 0.2s`},children:[(0,R.jsx)(`div`,{style:{fontWeight:`bold`,fontSize:`14px`},children:e.title}),(0,R.jsx)(`div`,{style:{fontSize:`11px`,color:n===e.id?`rgba(255, 255, 255, 0.8)`:`var(--text-secondary)`,marginTop:`4px`},children:e.description})]},e.id))}),(0,R.jsx)(`div`,{style:{background:`var(--surface-bg)`,border:`1px solid var(--border)`,borderRadius:`12px`,padding:`30px`,overflowY:`auto`,maxHeight:`75vh`},children:o?(0,R.jsx)(`div`,{className:`skeleton`,style:{height:`400px`}}):(0,R.jsx)(`div`,{className:`markdown-body`,style:{color:`var(--text-primary)`,lineHeight:`1.7`,fontSize:`14px`},children:xZ(i)})})]})]})}function CZ({activeBrainId:e}){let[t,n]=(0,_.useState)([]),[r,i]=(0,_.useState)([]),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)(!0),[l,u]=(0,_.useState)([]);return(0,_.useEffect)(()=>{async function t(){c(!0);try{let[t,r,a]=await Promise.all([or(e).catch(()=>[]),Mr().catch(()=>({items:[]})),nr().catch(()=>[])]);n(t),i(r.items||[]),o(a)}catch(e){console.error(`Failed to load graph data`,e)}finally{c(!1)}}t()},[e]),(0,R.jsxs)(`div`,{className:`page`,style:{padding:0,height:`calc(100vh - 1px)`,display:`flex`,flexDirection:`column`,overflow:`hidden`},children:[(0,R.jsxs)(`div`,{style:{padding:`16px 24px`,background:`rgba(18, 18, 26, 0.45)`,backdropFilter:`blur(16px)`,borderBottom:`1px solid var(--border)`,flexShrink:0},children:[(0,R.jsx)(`h1`,{style:{fontSize:`18px`,fontWeight:700,letterSpacing:`-0.02em`},children:`Memory Graph`}),(0,R.jsx)(`p`,{style:{fontSize:`12px`,color:`var(--text-secondary)`,marginTop:`2px`},children:`3D vault map — facts (blue), rules (cyan/rose), research (amber), sessions (teal).`})]}),(0,R.jsx)(`div`,{style:{flex:1,position:`relative`,overflow:`hidden`},children:s?(0,R.jsx)(`div`,{className:`skeleton`,style:{width:`100%`,height:`100%`}}):t.length===0&&r.length===0&&a.length===0?(0,R.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`,color:`var(--text-secondary)`},children:`No nodes found for graph`}):(0,R.jsx)(YY,{threads:a,memoryNodes:t,researchItems:r,onOpenThread:()=>{},onGroundMemoryNode:e=>{u(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},selectedGroundingNodes:l})})]})}var wZ=e=>JSON.stringify(e).replace(/</g,`\\u003c`);function TZ(e){if(!Array.isArray(e))return[];let t=new Set;return e.slice(0,128).flatMap(e=>!e||typeof e!=`object`||typeof e.id!=`string`||!/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(e.id)||typeof e.label!=`string`||!e.label.trim()||e.label.length>160||/[\u0000-\u001f\u007f]/.test(e.label)||t.has(e.id)?[]:(t.add(e.id),[{id:e.id,label:e.label.trim()}]))}function EZ(e,t,n,r={},i=``,a={},o=[]){return`<!doctype html><html><head>
|
|
5524
5524
|
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'nonce-${n}' blob:; style-src 'unsafe-inline' https://fonts.googleapis.com; font-src https://fonts.gstatic.com data:; img-src data: https:; connect-src 'none'; frame-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'">
|
|
5525
5525
|
<meta name="referrer" content="no-referrer">
|
|
5526
5526
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
@@ -5531,15 +5531,27 @@ Configure triggers, options, and prompts inside this rules sheet to hot-recompil
|
|
|
5531
5531
|
const channel=${wZ(n)};
|
|
5532
5532
|
const pending=new Map();let sequence=0;
|
|
5533
5533
|
const send=(type,extra={})=>parent.postMessage({channel,type,...extra},'*');
|
|
5534
|
+
let ownerScreens=[];
|
|
5535
|
+
const sanitizeScreens=${TZ.toString()};
|
|
5536
|
+
function publishScreens(element){
|
|
5537
|
+
ownerScreens=sanitizeScreens(element.screens);
|
|
5538
|
+
send('screens',{screens:ownerScreens});
|
|
5539
|
+
if(ownerScreens.some(screen=>screen.id===element.screen))host.screenChanged(element.screen);
|
|
5540
|
+
}
|
|
5534
5541
|
window.addEventListener('contextmenu',event=>{event.preventDefault();send('contextmenu');});
|
|
5535
5542
|
for(const [name,value] of Object.entries(${wZ(r)}))document.documentElement.style.setProperty(name,value);
|
|
5536
5543
|
window.addEventListener('message',event=>{
|
|
5537
|
-
if(event.source!==parent||event.data?.channel!==channel
|
|
5544
|
+
if(event.source!==parent||event.data?.channel!==channel)return;
|
|
5545
|
+
if(event.data.type==='show-screen'){
|
|
5546
|
+
if(ownerScreens.some(screen=>screen.id===event.data.screen))window.dispatchEvent(new CustomEvent('plugin-show-screen',{detail:{pluginId:${wZ(i)},screen:event.data.screen}}));
|
|
5547
|
+
return;
|
|
5548
|
+
}
|
|
5549
|
+
if(event.data.type!=='result')return;
|
|
5538
5550
|
const request=pending.get(event.data.requestId);if(!request)return;
|
|
5539
5551
|
pending.delete(event.data.requestId);clearTimeout(request.timer);
|
|
5540
5552
|
if(event.data.error)request.reject(new Error(event.data.error));else request.resolve(event.data.result);
|
|
5541
5553
|
});
|
|
5542
|
-
const host=Object.freeze({pluginId:${wZ(i)},run(subcommand,args=[],options={}){return new Promise((resolve,reject)=>{
|
|
5554
|
+
const host=Object.freeze({pluginId:${wZ(i)},operations:Object.freeze(${wZ(o)}),screenChanged(screen){if(ownerScreens.some(item=>item.id===screen))send('screen-changed',{screen});},run(subcommand,args=[],options={}){return new Promise((resolve,reject)=>{
|
|
5543
5555
|
const requestId=String(++sequence);
|
|
5544
5556
|
const declared=${wZ(a)}[subcommand];
|
|
5545
5557
|
const timeout=Number.isInteger(declared)&&declared>=1&&declared<=600000?declared:30000;
|
|
@@ -5552,6 +5564,7 @@ try{
|
|
|
5552
5564
|
const tag=${wZ(t)};
|
|
5553
5565
|
if(!customElements.get(tag))throw new Error('The plugin did not register its declared interface');
|
|
5554
5566
|
const element=document.createElement(tag);element.host=host;document.body.append(element);
|
|
5567
|
+
publishScreens(element);
|
|
5555
5568
|
if(typeof element.load==='function'&&!element.hasAttribute('data-loaded')){try{element.load();}catch(_){}}
|
|
5556
5569
|
if('view' in element||tag==='domains-console'||tag==='stripe-panel'){
|
|
5557
5570
|
host.run('view').then(v=>{element.view=v;}).catch(()=>{
|
|
@@ -5584,7 +5597,7 @@ try{
|
|
|
5584
5597
|
new ResizeObserver(()=>send('height',{height:document.body.scrollHeight})).observe(document.body);
|
|
5585
5598
|
send('ready');
|
|
5586
5599
|
}catch{send('error',{message:'Could not open the plugin interface'});}
|
|
5587
|
-
<\/script></body></html>`}function EZ(e){let t=e?.cli;return Object.fromEntries((t?.subcommands||[]).filter(e=>Number.isInteger(e.timeout_ms)&&e.timeout_ms>=1&&e.timeout_ms<=6e5).map(e=>[e.name,e.timeout_ms]))}function DZ(e,t,n=new Set){if(!e||typeof e!=`object`)return!1;let r=e;return typeof r.requestId==`string`&&r.requestId.length<=64&&typeof r.subcommand==`string`&&t.has(r.subcommand)&&(r.stdin===void 0||n.has(r.subcommand)&&typeof r.stdin==`string`&&r.stdin.length>0&&new TextEncoder().encode(r.stdin).length<=65536)&&Array.isArray(r.args)&&r.args.length<=64&&r.args.every(e=>typeof e==`string`&&e.length<=8192)&&r.args.reduce((e,t)=>e+t.length,0)<=32768}function OZ(e){return e.manifest?.ui?.elements||e.ui?.elements||[]}function kZ({plugin:e,elementId:t,readOnly:n=!1}){let r=OZ(e).filter(e=>e.kind!==`settings`&&(!t||e.id===t)),[i,a]=(0,_.useState)(r[0]?.id||``),[o,s]=(0,_.useState)(``),c=(0,_.useRef)(null),[l,u]=(0,_.useState)(``),[d,f]=(0,_.useState)(240);return(0,_.useEffect)(()=>{let t=!1;s(``),u(``);let a=crypto.randomUUID(),o=e.manifest?.cli,l=new Set((o?.subcommands||[]).filter(e=>e.effect===`read`).map(e=>e.name)),d=new Set((e.cli?.subcommands||[]).filter(e=>!n||l.has(e.name)).map(e=>e.name)),p=new Set((o?.subcommands||[]).filter(e=>{let t=e.args?.filter(e=>e.secret===!0)||[];return t.length===1&&t[0].type===`string`&&t[0].flag===void 0}).map(e=>e.name)),m=0,h=async n=>{if(t||n.source!==c.current?.contentWindow||n.origin!==`null`||n.data?.channel!==a)return;let r=n.data;if(r.type===`contextmenu`&&window.dispatchEvent(new CustomEvent(`plugin-context-menu`,{detail:{pluginId:e.id}})),r.type===`height`&&Number.isFinite(r.height)&&f(Math.max(128,Math.min(1e3,r.height))),r.type===`error`&&s(`Could not open the plugin interface`),r.type!==`run`)return;let i=n.source,o=(e,n)=>{t||i.postMessage({channel:a,type:`result`,requestId:r.requestId,result:e,error:n},`*`)};if(!DZ(r,d,p)||m>=4)o(void 0,`Operation is not available`);else{m++,window.dispatchEvent(new CustomEvent(`plugin-command-activity`,{detail:{pluginId:e.id,requestId:r.requestId,command:r.subcommand,running:!0}}));try{let t=r.stdin===void 0?await gi(e.id,r.subcommand,[...r.args,`--json`]):await gi(e.id,r.subcommand,[...r.args,`--json`],{stdin:r.stdin});if(!t.success){o(void 0,r.stdin===void 0?t.output||t.error||`Operation failed`:`Credential operation failed`);return}o(r.stdin===void 0?JSON.parse(t.output||`{}`):{ok:!0})}catch{o(void 0,`Operation failed`)}finally{m--,window.dispatchEvent(new CustomEvent(`plugin-command-activity`,{detail:{pluginId:e.id,requestId:r.requestId,command:r.subcommand,running:!1}}))}}};window.addEventListener(`message`,h);let g=r.find(e=>e.id===i)||r[0];return g&&(async()=>{let n=await L(`${I}/api/plugins/${encodeURIComponent(e.id)}/ui/${encodeURIComponent(g.id)}`);if(!n.ok)throw Error(`Could not open ${e.name} (${n.status})`);let r=await n.text();if(r.length>1048576)throw Error(`The plugin interface is too large`);if(t)return;let i=getComputedStyle(window.document.documentElement),o={};for(let e of[`--text-primary`,`--text-secondary`,`--text-tertiary`,`--bg-primary`,`--bg-secondary`,`--border`,`--accent`,`--font-sans`,`--color-text`,`--color-surface`,`--color-border`,`--spacing-md`,`--radius-md`])o[e]=i.getPropertyValue(e);u(TZ(r,g.tag,a,o,e.id,EZ(e.manifest)))})().catch(e=>{t||s(e.message)}),()=>{t=!0,window.removeEventListener(`message`,h)}},[e.id,i,e.sha256,t,n]),(0,R.jsxs)(`section`,{children:[r.length>1&&(0,R.jsx)(`nav`,{style:{display:`flex`,gap:8},children:r.map(e=>(0,R.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>a(e.id),"aria-pressed":i===e.id,children:e.description||e.id},e.id))}),o&&(0,R.jsx)(`div`,{role:`alert`,className:`alert alert-error`,children:o}),r.length===0&&(0,R.jsx)(`p`,{children:`This plugin has not supplied its interface yet.`}),l&&(0,R.jsx)(`iframe`,{ref:c,title:`${e.name} interface`,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,allow:`camera 'none'; microphone 'none'; geolocation 'none'; clipboard-read 'none'; clipboard-write 'none'`,srcDoc:l,style:{width:`100%`,height:d,border:0}})]})}function AZ({plugin:e}){let[t,n]=(0,_.useState)(new Set),[r,i]=(0,_.useState)({}),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(``),[d,f]=(0,_.useState)([]),[p,m]=(0,_.useState)({});(0,_.useEffect)(()=>{let t=!1;return i({}),c(``),u(``),L(`${I}/api/plugins/auth/secrets`).then(async e=>{if(!e.ok)return[];let r=await e.json();!t&&Array.isArray(r)&&n(new Set(r.map(e=>e.key)))}).catch(e=>{t||u(e.message)}),L(`${I}/api/plugins/${encodeURIComponent(e.id)}/configuration`).then(async e=>{if(!e.ok)throw Error(`Could not load plugin settings`);let n=await e.json();t||(f(n.fields),m(Object.fromEntries(n.fields.map(e=>[e.name,n.values[e.name]??e.default??(e.type!==`boolean`&&``)]))))}).catch(e=>{t||u(e.message)}),()=>{t=!0}},[e.id]);async function h(t){o(t),u(``),c(``);try{let a=await L(e.manifest?.runtime&&e.manifest.runtime.modules?.credentials?`${I}/api/plugins/${encodeURIComponent(e.id)}/credentials`:`${I}/api/plugins/auth/secrets`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({key:t,value:r[t],tags:[`plugin:${e.id}`]})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error||`Failed to save secret`)}i(e=>({...e,[t]:``})),n(e=>new Set([...e,t])),c(`Credential saved. Open the plugin to verify the connection.`)}catch(e){u(e.message)}finally{o(``)}}async function g(){o(`configuration`),u(``),c(``);try{let t=await L(`${I}/api/plugins/${encodeURIComponent(e.id)}/configuration`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({values:p})}),n=await t.json();if(!t.ok)throw Error(n.error||`Could not save settings`);m(n.values),c(`Settings saved.`)}catch(e){u(e.message)}finally{o(``)}}return(0,R.jsxs)(`section`,{style:{marginBottom:24},children:[(0,R.jsx)(`h3`,{children:`Configuration`}),d.length>0?(0,R.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),g()},children:[d.map(e=>(0,R.jsxs)(`label`,{style:{display:`block`,marginBottom:12},children:[e.label,e.options?(0,R.jsxs)(`select`,{className:`select`,value:String(p[e.name]??``),onChange:t=>m(n=>({...n,[e.name]:e.type===`number`?Number(t.target.value):t.target.value})),children:[(0,R.jsx)(`option`,{value:``,children:`Choose…`}),e.options.map(e=>(0,R.jsx)(`option`,{value:String(e),children:String(e)},String(e)))]}):(0,R.jsx)(`input`,{className:`input`,type:e.type===`boolean`?`checkbox`:e.type===`number`?`number`:`text`,required:e.required,checked:e.type===`boolean`?!!p[e.name]:void 0,value:e.type===`boolean`?void 0:String(p[e.name]??``),onChange:t=>m(n=>({...n,[e.name]:e.type===`boolean`?t.target.checked:e.type===`number`?Number(t.target.value):t.target.value}))})]},e.name)),(0,R.jsx)(`button`,{className:`btn btn-sm btn-primary`,disabled:!!a,children:a===`configuration`?`Saving…`:`Save settings`})]}):(0,R.jsx)(`p`,{children:`No settings declared.`}),(0,R.jsx)(`h3`,{children:`Credentials`}),l&&(0,R.jsx)(`div`,{role:`alert`,className:`alert alert-error`,children:l}),s&&(0,R.jsx)(`p`,{role:`status`,children:s}),(e.secrets||[]).length===0&&(0,R.jsx)(`p`,{children:`No credentials required.`}),(e.secrets||[]).map((e,n)=>{let o=`Credential ${n+1}${e.required?` (required)`:` (optional)`}`;return(0,R.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),h(e.key)},style:{marginBottom:16},children:[(0,R.jsxs)(`label`,{style:{display:`block`,marginBottom:6},children:[o,` · `,t.has(e.key)?`Saved`:`Not saved`,(0,R.jsx)(`input`,{className:`input`,type:`password`,autoComplete:`new-password`,value:r[e.key]||``,placeholder:t.has(e.key)?`Paste a replacement`:`Paste credential`,onChange:t=>i(n=>({...n,[e.key]:t.target.value}))})]}),(0,R.jsx)(`button`,{className:`btn btn-sm btn-primary`,disabled:!r[e.key]?.trim()||!!a,children:a===e.key?`Saving…`:`Save credential`})]},e.key)})]})}var jZ=[`console`,`ledger`,`monitor`,`inbox`,`dashboard`,`workbench`,`vault`],MZ=[`system`,`inter`,`ibm-plex`,`space-grotesk`,`jetbrains-mono`,`dm-sans`,`outfit`,`fraunces`,`newsreader`,`chivo-mono`],NZ=/^#[0-9a-fA-F]{6}$/,PZ=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{};function FZ(e){let t=PZ(e);if(typeof t.name!=`string`||typeof t.label!=`string`)return null;let n=[`string`,`number`,`boolean`,`choice`].includes(t.type)?t.type:`string`;return{name:t.name,flag:typeof t.flag==`string`?t.flag:void 0,positional:t.positional===!0,label:t.label,type:n,options:Array.isArray(t.options)?t.options:void 0,required:t.required===!0,secret:t.secret===!0}}function IZ(e){let t=PZ(e.manifest),n=new Map;for(let r of e.cli?.subcommands||[]){let e=PZ(t.cli?.subcommands?.find(e=>e?.name===r.name));n.set(r.name,{name:r.name,description:r.description,args:(Array.isArray(e.args)?e.args:[]).map(FZ).filter(Boolean),effect:[`read`,`write`,`destructive`,`send`].includes(e.effect)?e.effect:`write`,output:e.output===`text`?`text`:`json`,timeoutMs:Number.isFinite(e.timeout_ms)?e.timeout_ms:void 0})}let r=PZ(t.branding),i={name:typeof r.name==`string`?r.name:e.name,color:NZ.test(r.color)?r.color:`#475569`,accent:NZ.test(r.accent)?r.accent:NZ.test(r.color)?r.color:`#0ea5e9`,font:MZ.includes(r.font)?r.font:`system`,density:[`compact`,`comfortable`,`spacious`].includes(r.density)?r.density:`comfortable`,radius:[`none`,`sm`,`md`,`lg`,`pill`].includes(r.radius)?r.radius:`md`,header:[`plain`,`ledger-rule`,`band`,`tab-strip`,`badge-left`].includes(r.header)?r.header:`plain`,badge:typeof r.badge==`string`?r.badge:void 0,logo:typeof r.logo==`string`?r.logo:void 0,provider:PZ(r.provider).name?{name:String(r.provider.name),url:typeof r.provider.url==`string`?r.provider.url:void 0}:void 0},a=PZ(t.status),o=typeof a.command==`string`&&n.has(a.command)?a.command:void 0,s=PZ(t.card_layout),c=Array.isArray(s.regions)?s.regions.filter(e=>e&&typeof e==`object`).slice(0,12):[],l=jZ.includes(s.template)?s.template:`console`;c.length===0&&((e.ui?.elements||t.ui?.elements||[]).some(e=>e.kind===`card`||e.kind===`panel`)&&c.push({widget:`live`}),o&&c.push({widget:`status`,title:`Status`}),c.push({widget:`actions`,title:`Commands`},{widget:`activity`,title:`Recent activity`}));let u=PZ(t.workspace),d=u&&(u.component||Array.isArray(u.tabs))?{component:typeof u.component==`string`?u.component:void 0,tabs:Array.isArray(u.tabs)?u.tabs.filter(e=>typeof e==`string`):void 0,permissions:Array.isArray(u.permissions)?u.permissions.filter(e=>typeof e==`string`):void 0}:void 0;return{id:e.id,title:i.name,description:e.description,template:l,regions:c,commands:n,branding:i,status:o?{command:o,refreshSeconds:Number.isInteger(a.refresh_seconds)?Math.min(86400,Math.max(5,a.refresh_seconds)):30}:void 0,distribution:PZ(t.distribution).tier?{tier:t.distribution.tier,license:t.distribution.license}:void 0,workspace:d}}var LZ=e=>e.args.filter(e=>!e.secret);function RZ(e,t){return LZ(e).filter(e=>e.required&&(t[e.name]===void 0||t[e.name]===``)).map(e=>e.label)}function zZ(e,t,n=[]){let r=[],i=[];for(let n of LZ(e)){let e=t[n.name];e!==void 0&&e!==``&&e!==!1&&(n.positional?r.push(String(e)):n.flag&&(n.type===`boolean`?i.push(n.flag):i.push(n.flag,String(e))))}return[...r,...i,...n,...e.output===`json`?[`--json`]:[]]}var BZ=e=>e.type===`boolean`?!1:e.type===`choice`&&e.options?.length&&e.required?e.options[0]:``,VZ=(0,_.createContext)(null),HZ=()=>{let e=(0,_.useContext)(VZ);if(!e)throw Error(`Card widgets must render inside a CardRunner`);return e};function UZ({card:e,children:t}){let[n,r]=(0,_.useState)([]),[i,a]=(0,_.useState)(new Set),[o,s]=(0,_.useState)(null),c=(0,_.useRef)(e);(0,_.useEffect)(()=>{c.current=e},[e]);let l=(0,_.useCallback)(async(e,t={},n=[],i)=>{let s=c.current.commands.get(e);if(!s)return{ok:!1,text:``,error:`${e} is not a declared command`,ms:0};if(o&&!o.permissions[s.effect])return{ok:!1,text:``,error:`The ${s.effect} command permission is off`,ms:0};if(i!==void 0&&o&&(o.agent!==`direct`||o.node!==`local`))return{ok:!1,text:``,error:`Credential operations run directly on this node`,ms:0};let l=performance.now();a(t=>new Set(t).add(e));let u;try{let r=zZ(s,t,n),a=i===void 0?o?{execution:o}:void 0:{stdin:i},d=a?await gi(c.current.id,e,r,a):await gi(c.current.id,e,r),f=d.output||``,p;if(s.output===`json`&&f.trim())try{p=JSON.parse(f)}catch{}u={ok:!!d.success,data:p,text:f,error:d.success?void 0:d.timedOut?`The command timed out`:d.error||`The command failed`,ms:Math.round(performance.now()-l)}}catch(e){u={ok:!1,text:``,error:e instanceof Error?e.message:`The command failed`,ms:Math.round(performance.now()-l)}}return a(t=>{let n=new Set(t);return n.delete(e),n}),r(t=>[{at:new Date().toISOString(),command:e,effect:s.effect,ok:u.ok,ms:u.ms},...t].slice(0,100)),u},[o]),u=(0,_.useMemo)(()=>({card:e,run:l,activity:n,busy:i,execution:o,setExecution:s}),[e,l,n,i,o]);return(0,R.jsx)(VZ.Provider,{value:u,children:t})}function WZ(e,t,n){let r=[`total-recall`,n||e.id,t.name];for(let e of t.args){if(e.secret)continue;let t=e.positional?`<${e.name}>`:`${e.flag}${e.type===`boolean`?``:` <${e.name}>`}`;r.push(e.required?t:`[${t}]`)}return t.output===`json`&&r.push(`--json`),r.join(` `)}var GZ=/^(ok|healthy|active|connected|ready|running|verified|delivered|sent|passed|pass|up|online|true|complete|completed)$/i,KZ=/^(error|failed|fail|down|offline|rejected|bounced|blocked|false|expired|denied)$/i,qZ=/^(warn|warning|pending|queued|degraded|unknown|stale|paused|partial|throttled)$/i,JZ=e=>{let t=String(e);return GZ.test(t)?`ok`:KZ.test(t)?`error`:qZ.test(t)?`warn`:`neutral`};function YZ(e,t=`text`){if(e==null||e===``)return`—`;if(typeof e==`object`)return JSON.stringify(e);let n=Number(e);switch(t){case`number`:return Number.isFinite(n)?n.toLocaleString():String(e);case`money`:return Number.isFinite(n)?n.toLocaleString(void 0,{style:`currency`,currency:`USD`}):String(e);case`percent`:return Number.isFinite(n)?`${Math.round((n<=1?n*100:n)*10)/10}%`:String(e);case`bytes`:{if(!Number.isFinite(n))return String(e);let t=[`B`,`KB`,`MB`,`GB`,`TB`],r=n,i=0;for(;r>=1024&&i<t.length-1;)r/=1024,i++;return`${i===0?r:r.toFixed(1)} ${t[i]}`}case`date`:case`datetime`:{let n=new Date(String(e));return Number.isNaN(n.getTime())?String(e):t===`date`?n.toLocaleDateString():n.toLocaleString()}default:return String(e)}}function XZ(e){if(Array.isArray(e))return e;for(let t of[`rows`,`items`,`results`,`data`,`entries`,`records`])if(Array.isArray(e?.[t]))return e[t];return[]}function ZZ(e){return!e||typeof e!=`object`||Array.isArray(e)?[]:Object.entries(e).filter(([,e])=>e===null||[`string`,`number`,`boolean`].includes(typeof e)).map(([e,t])=>[e,t===null?`—`:String(t)])}function QZ(e,t=[],n=0){let{run:r,busy:i}=HZ(),[a,o]=(0,_.useState)(null),s=JSON.stringify(t),c=(0,_.useCallback)(async()=>{e&&o(await r(e,{},JSON.parse(s)))},[e,s,r]);return(0,_.useEffect)(()=>{if(!e)return;let t=!0,i=()=>{r(e,{},JSON.parse(s)).then(e=>{t&&o(e)})};i();let a=n?setInterval(i,n*1e3):void 0;return()=>{t=!1,a&&clearInterval(a)}},[e,s,n,r]),{result:a,loading:!!e&&i.has(e),reload:c}}var $Z=({tone:e,children:t})=>(0,R.jsx)(`span`,{className:`card-pill card-pill-${e}`,children:t});function eQ({result:e}){return(0,R.jsx)(`p`,{role:`alert`,className:`card-error`,children:e.error||`No data`})}function tQ(){let{card:e}=HZ(),{result:t,loading:n,reload:r}=QZ(e.status?.command,[],e.status?.refreshSeconds);if(!e.status)return(0,R.jsx)(`p`,{className:`card-muted`,children:`This plugin declares no status command.`});let i=t?.data,a=ZZ(i),o=i?.state??(i?.ok===!1?`error`:i?.ok===!0?`ok`:void 0);return(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`card-row`,children:[t?t.ok?(0,R.jsx)($Z,{tone:JZ(o??`ok`),children:String(o??`Responding`)}):(0,R.jsx)($Z,{tone:`error`,children:`Unreachable`}):(0,R.jsx)($Z,{tone:`neutral`,children:`Checking…`}),(0,R.jsx)(`button`,{type:`button`,className:`card-link`,onClick:()=>void r(),disabled:n,children:n?`Refreshing…`:`Refresh`})]}),t&&!t.ok&&(0,R.jsx)(eQ,{result:t}),a.length>0&&(0,R.jsx)(`dl`,{className:`card-kv`,children:a.filter(([e])=>e!==`state`).map(([e,t])=>(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{children:e.replace(/_/g,` `)}),(0,R.jsx)(`dd`,{children:t})]},e))}),t?.ok&&!i&&t.text&&(0,R.jsx)(`pre`,{className:`card-pre`,children:t.text})]})}function nQ({command:e}){let{run:t,busy:n}=HZ(),r=LZ(e),[i,a]=(0,_.useState)(()=>Object.fromEntries(r.map(e=>[e.name,BZ(e)]))),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(``),f=e.args.filter(e=>e.secret),p=f.length===1&&f[0].type===`string`&&!f[0].flag,m=e.effect!==`read`,h=RZ(e,i);return(0,R.jsxs)(`form`,{className:`card-form`,onSubmit:async n=>{if(n.preventDefault(),m&&!c)return;let r=p?u:void 0;d(``),s(await t(e.name,i,[],r)),l(!1)},children:[r.map(e=>(0,R.jsxs)(`label`,{children:[e.label,e.required?` *`:``,e.type===`choice`?(0,R.jsxs)(`select`,{value:String(i[e.name]??``),onChange:t=>a({...i,[e.name]:t.target.value}),children:[!e.required&&(0,R.jsx)(`option`,{value:``,children:`Any`}),e.options?.map(e=>(0,R.jsx)(`option`,{value:String(e),children:String(e)},String(e)))]}):e.type===`boolean`?(0,R.jsx)(`input`,{type:`checkbox`,checked:!!i[e.name],onChange:t=>a({...i,[e.name]:t.target.checked})}):(0,R.jsx)(`input`,{type:e.type===`number`?`number`:`text`,value:String(i[e.name]??``),onChange:t=>a({...i,[e.name]:e.type===`number`&&t.target.value!==``?Number(t.target.value):t.target.value})})]},e.name)),p&&(0,R.jsxs)(`label`,{children:[f[0].label,(0,R.jsx)(`input`,{type:`password`,autoComplete:`new-password`,value:u,maxLength:65536,onChange:e=>d(e.target.value)})]}),f.length>0&&!p&&(0,R.jsx)(`p`,{className:`card-muted`,children:`Use connection settings for this credential operation.`}),m&&(0,R.jsxs)(`label`,{children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l(e.target.checked)}),`Confirm `,e.name]}),(0,R.jsx)(`button`,{className:`card-button`,disabled:h.length>0||n.has(e.name)||m&&!c||f.length>0&&(!p||!u),children:n.has(e.name)?`Running…`:e.effect===`read`?`Look up`:`Run command`}),o&&(o.ok?(0,R.jsx)(`pre`,{className:`card-pre`,children:o.data?JSON.stringify(o.data,null,2):o.text}):(0,R.jsx)(eQ,{result:o}))]})}function rQ({region:e}){let{card:t}=HZ(),n=t.id,r=e.commands||[...t.commands.keys()],[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(``);return(0,R.jsxs)(`ul`,{className:`card-commands`,children:[r.map(e=>t.commands.get(e)).filter(e=>!!e).map(e=>{let r=WZ(t,e,n);return(0,R.jsxs)(`li`,{children:[(0,R.jsxs)(`div`,{className:`card-row`,children:[(0,R.jsx)(`strong`,{children:e.name}),(0,R.jsx)($Z,{tone:e.effect===`read`?`ok`:e.effect===`write`?`neutral`:`warn`,children:e.effect}),(0,R.jsx)(`button`,{type:`button`,className:`card-link`,onClick:()=>a(i===e.name?``:e.name),children:i===e.name?`Close`:`Try`})]}),e.description&&(0,R.jsx)(`p`,{className:`card-muted`,children:e.description}),(0,R.jsxs)(`div`,{className:`card-row`,children:[(0,R.jsx)(`code`,{className:`card-code`,children:r}),(0,R.jsx)(`button`,{type:`button`,className:`card-link`,onClick:async()=>{try{await navigator.clipboard.writeText(r),s(e.name)}catch{s(``)}},children:o===e.name?`Copied`:`Copy`})]}),i===e.name&&(0,R.jsx)(nQ,{command:e})]},e.name)}),r.length===0&&(0,R.jsx)(`li`,{className:`card-muted`,children:`No commands declared.`})]})}function iQ({value:e,column:t}){return t.format===`status`?(0,R.jsx)($Z,{tone:JZ(e),children:YZ(e)}):(0,R.jsx)(R.Fragment,{children:YZ(e,t.format)})}function aQ({region:e}){let{result:t,loading:n}=QZ(e.source?.command,e.source?.args);if(!t)return(0,R.jsx)(`p`,{className:`card-muted`,children:n?`Loading…`:``});if(!t.ok)return(0,R.jsx)(eQ,{result:t});let{widget:r}=e;if(r===`log`)return(0,R.jsx)(`pre`,{className:`card-pre`,children:t.text||JSON.stringify(t.data,null,2)});if(r===`gauge`){let e=t.data||{},n=e.value??e.used??e.percent,r=e.max??e.total??(e.percent===void 0?void 0:100),i=Number(n),a=Number(r);if(n==null||r==null||!Number.isFinite(i)||!Number.isFinite(a)||a<=0||i<0||i>a)return(0,R.jsx)(`p`,{role:`status`,className:`card-muted`,children:`No valid usage measurement is available.`});let o=a>0?Math.max(0,Math.min(100,i/a*100)):0;return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`card-gauge`,role:`meter`,"aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":a,children:(0,R.jsx)(`span`,{style:{width:`${o}%`}})}),(0,R.jsxs)(`p`,{className:`card-muted`,children:[YZ(i,`number`),` of `,YZ(a,`number`)]})]})}if(r===`detail`)return(0,R.jsx)(`dl`,{className:`card-kv`,children:ZZ(t.data).map(([e,t])=>(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{children:e.replace(/_/g,` `)}),(0,R.jsx)(`dd`,{children:t})]},e))});let i=XZ(t.data);if(i.length===0)return(0,R.jsx)(`p`,{className:`card-muted`,children:`Nothing to show yet.`});if(r===`list`)return(0,R.jsx)(`ul`,{className:`card-list`,children:i.map((e,t)=>(0,R.jsx)(`li`,{children:String(typeof e==`object`&&e?e.title??e.name??e.id??JSON.stringify(e):e)},t))});let a=e.columns||Object.keys(i[0]||{}).slice(0,5).map(e=>({key:e,label:e}));return(0,R.jsx)(`div`,{className:`card-scroll`,children:(0,R.jsxs)(`table`,{className:`card-table`,children:[(0,R.jsx)(`thead`,{children:(0,R.jsx)(`tr`,{children:a.map(e=>(0,R.jsx)(`th`,{scope:`col`,children:e.label},e.key))})}),(0,R.jsx)(`tbody`,{children:i.map((e,t)=>(0,R.jsx)(`tr`,{children:a.map(t=>(0,R.jsx)(`td`,{children:(0,R.jsx)(iQ,{value:e?.[t.key],column:t})},t.key))},t))})]})})}function oQ({plugin:e}){return(0,R.jsx)(AZ,{plugin:e})}function sQ(){let{activity:e}=HZ();return e.length===0?(0,R.jsx)(`p`,{className:`card-muted`,children:`No commands have run from this card in this session.`}):(0,R.jsx)(`ul`,{className:`card-list`,children:e.slice(0,20).map((e,t)=>(0,R.jsxs)(`li`,{children:[(0,R.jsx)($Z,{tone:e.ok?`ok`:`error`,children:e.ok?`ok`:`failed`}),` `,e.command,` · `,e.ms,` ms · `,new Date(e.at).toLocaleTimeString()]},t))})}var cQ={system:`system-ui, -apple-system, "Segoe UI", sans-serif`,inter:`Inter, system-ui, sans-serif`,"ibm-plex":`"IBM Plex Sans", system-ui, sans-serif`,"space-grotesk":`"Space Grotesk", system-ui, sans-serif`,"jetbrains-mono":`"JetBrains Mono", ui-monospace, monospace`,"dm-sans":`"DM Sans", system-ui, sans-serif`,outfit:`Outfit, system-ui, sans-serif`,fraunces:`Fraunces, Georgia, serif`,newsreader:`Newsreader, Georgia, serif`,"chivo-mono":`"Chivo Mono", ui-monospace, monospace`},lQ={none:`0px`,sm:`3px`,md:`8px`,lg:`14px`,pill:`22px`},uQ={compact:`8px`,comfortable:`14px`,spacious:`22px`};function dQ(e){let[t,n,r]=[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)/255).map(e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4);return .2126*t+.7152*n+.0722*r}var fQ=(e,t)=>{let[n,r]=[dQ(e),dQ(t)].sort((e,t)=>t-e);return(n+.05)/(r+.05)},pQ=e=>fQ(e,`#ffffff`)>=fQ(e,`#111111`)?`#ffffff`:`#111111`;function mQ(e){return{"--card-color":e.color,"--card-accent":e.accent,"--card-on-color":pQ(e.color),"--card-on-accent":pQ(e.accent),"--card-font":cQ[e.font]||cQ.system,"--card-radius":lQ[e.radius],"--card-gap":uQ[e.density],fontFamily:`var(--card-font)`}}function hQ({plugin:e,card:t}){let n=t.workspace?.component,r=OZ(e).find(e=>e.id===n||e.tag===n);return r?t.workspace?.permissions?.length?(0,R.jsx)(`p`,{role:`status`,children:`This workspace requires device access that the host does not support yet.`}):(0,R.jsx)(kZ,{plugin:e,elementId:r.id}):(0,R.jsx)(`p`,{role:`status`,children:`This plugin has not supplied its workspace interface yet.`})}var gQ={agent:`direct`,node:`local`,permissions:{read:!0,write:!1,send:!1,destructive:!1}},_Q={read:`Read commands`,write:`Write commands`,send:`Send commands`,destructive:`Delete commands`},vQ;function yQ(){let{execution:e,setExecution:t,busy:n}=HZ(),r=e||gQ,[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)([]),[c,l]=(0,_.useState)([]),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(``),m=(0,_.useRef)(0),h=async e=>{let t=++m.current;d(!0),l([]),p(``);try{let n=await L(`${I}/api/plugins/execution-targets?node=${encodeURIComponent(e)}`),r=await n.json();if(!n.ok||!r.success)throw Error(r.error||`Could not inspect this node`);t===m.current&&l(r.agents||[])}catch(e){t===m.current&&p(e instanceof Error?e.message:`Could not inspect this node`)}finally{t===m.current&&d(!1)}},g=async()=>{if(a(!i),!i){d(!0),p(``);try{if(!vQ||Date.now()-vQ.at>6e4){let e=await L(`${I}/api/plugins/execution-targets`),t=await e.json();if(!e.ok||!t.success)throw Error(t.error||`CLI agents is unavailable`);vQ={at:Date.now(),data:t}}s(vQ.data.nodes||[]),await h(r.node)}catch(e){p(e instanceof Error?e.message:`CLI agents is unavailable`),d(!1)}}};return(0,R.jsxs)(`div`,{className:`card-execution`,children:[(0,R.jsx)(`button`,{type:`button`,className:`card-link`,onClick:()=>void g(),"aria-expanded":i,children:`Agent, node & permissions`}),i&&(0,R.jsxs)(`fieldset`,{className:`card-form`,disabled:u||n.size>0,children:[(0,R.jsx)(`legend`,{children:`Command execution`}),(0,R.jsxs)(`label`,{children:[`Mesh node`,(0,R.jsxs)(`select`,{value:r.node,onChange:e=>{let n=e.target.value;t({...r,node:n,agent:`direct`,cwd:void 0}),h(n)},children:[(0,R.jsx)(`option`,{value:`local`,children:`This node`}),o.filter(e=>!e.self).map(e=>(0,R.jsxs)(`option`,{value:e.id,disabled:!e.online||!e.accessConfigured,children:[e.name,e.online?e.accessConfigured?``:` · access needed`:` · offline`]},e.id))]})]}),(0,R.jsxs)(`label`,{children:[`CLI agent`,(0,R.jsxs)(`select`,{value:r.agent,onChange:e=>t({...r,agent:e.target.value,allowUnknownAuth:e.target.value!==`direct`}),children:[(0,R.jsx)(`option`,{value:`direct`,children:`Direct CLI`}),c.map(e=>(0,R.jsxs)(`option`,{value:e.id,disabled:!e.installed||!e.versionVerified||e.authenticated===!1,children:[e.name,e.installed?e.authenticated===!1?` · sign in needed`:e.authenticated===`unknown`?` · account unchecked`:``:` · not installed`]},e.id))]})]}),r.node!==`local`&&(0,R.jsxs)(`label`,{children:[`Workspace on selected node`,(0,R.jsx)(`input`,{value:r.cwd||``,placeholder:`/absolute/workspace`,onChange:e=>t({...r,cwd:e.target.value})})]}),(0,R.jsx)(`div`,{className:`card-permissions`,children:Object.keys(_Q).map(e=>(0,R.jsxs)(`label`,{children:[(0,R.jsx)(`input`,{type:`checkbox`,role:`switch`,checked:r.permissions[e],onChange:n=>t({...r,permissions:{...r.permissions,[e]:n.target.checked}})}),_Q[e]]},e))}),(0,R.jsx)(`button`,{type:`button`,className:`card-link`,onClick:()=>void h(r.node),children:`Refresh installed agents`})]}),u&&(0,R.jsx)(`p`,{role:`status`,className:`card-muted`,children:`Inspecting installed agents…`}),f&&(0,R.jsx)(`p`,{role:`alert`,className:`card-error`,children:f})]})}function bQ({plugin:e,children:t}){let{card:n,busy:r}=HZ(),[i,a]=(0,_.useState)(e.activation?.enabled!==!1);(0,_.useEffect)(()=>{a(e.activation?.enabled!==!1)},[e.id,e.activation?.enabled]);let[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)({}),[f,p]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let t=t=>{let n=t.detail;n?.pluginId===e.id&&d(e=>{let t={...e};return n.running?t[n.requestId]=n.command:delete t[n.requestId],t})},n=t=>{t.detail?.pluginId===e.id&&p(!0)};return window.addEventListener(`plugin-command-activity`,t),window.addEventListener(`plugin-context-menu`,n),()=>{window.removeEventListener(`plugin-command-activity`,t),window.removeEventListener(`plugin-context-menu`,n)}},[e.id]);let m=[...r,...Object.values(u)],h=(0,_.useRef)(null),g=[...n.commands.keys()],v=e.manifest?.card_face,y=(e.card_face?.quick_actions||v?.quick_actions||[]).filter(e=>g.includes(e.subcommand)),b=y.length?y.slice(0,6):g.filter(e=>![`on`,`off`].includes(e)).slice(0,6).map(e=>({subcommand:e,label:e})),x=()=>window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`,S=e=>{p(!1);let t=h.current?.children[g.indexOf(e)+1];t&&h.current&&h.current.scrollTo({left:t.offsetLeft,behavior:x()})},C=e=>h.current?.scrollBy({left:e*h.current.clientWidth,behavior:x()}),w=async()=>{s(!0),l(``);try{let t=await L(`${I}/api/plugins/${encodeURIComponent(e.id)}/activation`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:!i})}),n=await t.json();if(n.activation&&a(n.activation.enabled),!t.ok||!n.success)throw Error(n.compilation?.error||n.error||`Activation could not be changed`)}catch(e){l(e instanceof Error?e.message:`Activation could not be changed`)}finally{s(!1)}};return(0,R.jsxs)(`div`,{className:`card-scenes`,"data-state":i?`active`:`inactive`,"aria-busy":m.length>0||o,onContextMenu:e=>{e.preventDefault(),p(!0)},onKeyDown:e=>{e.key===`Escape`&&p(!1),e.key===`F10`&&e.shiftKey&&(e.preventDefault(),p(!0))},children:[(0,R.jsxs)(`div`,{className:`card-row card-scene-controls`,children:[(0,R.jsx)(`span`,{role:`status`,className:`card-pill`,children:m.length?`Running ${m.join(`, `)}`:i?`Active`:`Inactive`}),(0,R.jsx)(`button`,{type:`button`,className:`card-button`,role:`switch`,"aria-checked":i,"aria-label":`${n.title} on or off`,onClick:()=>void w(),disabled:o||m.length>0,children:o?`Updating…`:i?`Turn off`:`Turn on`}),(0,R.jsx)(`button`,{type:`button`,className:`card-link`,"aria-label":`Previous scene`,onClick:()=>C(-1),children:`←`}),(0,R.jsx)(`button`,{type:`button`,className:`card-link`,"aria-label":`Next scene`,onClick:()=>C(1),children:`→`}),(0,R.jsx)(`button`,{type:`button`,className:`card-link`,"aria-haspopup":`menu`,"aria-expanded":f,onClick:()=>p(!f),children:`Quick commands`})]}),f&&(0,R.jsxs)(`div`,{role:`menu`,"aria-label":`${n.title} common commands`,className:`card-context-menu`,children:[b.map(e=>(0,R.jsx)(`button`,{role:`menuitem`,type:`button`,className:`card-link`,onClick:()=>S(e.subcommand),children:e.label||e.subcommand},e.subcommand)),!b.length&&(0,R.jsx)(`span`,{children:`No commands declared.`})]}),c&&(0,R.jsx)(`p`,{role:`alert`,className:`card-error`,children:c}),(0,R.jsx)(yQ,{}),(0,R.jsxs)(`div`,{className:`card-scene-track`,ref:h,tabIndex:0,"aria-label":`${n.title} scenes`,children:[(0,R.jsx)(`section`,{className:`card-scene`,"aria-label":`Overview`,children:t}),g.map(e=>(0,R.jsx)(`section`,{className:`card-scene`,"aria-label":`${e} command scene`,children:(0,R.jsx)(rQ,{region:{widget:`actions`,commands:[e]}})},e))]})]})}function xQ(e){let[t,n]=(0,_.useState)(``);return(0,_.useEffect)(()=>{if(!e.branding.logo)return;let t=``,r=!1;return L(`${I}/api/plugins/${encodeURIComponent(e.id)}/logo`).then(e=>e.ok?e.blob():Promise.reject(Error(`no logo`))).then(e=>{r||(t=URL.createObjectURL(e),n(t))}).catch(()=>{r||n(``)}),()=>{r=!0,t&&URL.revokeObjectURL(t)}},[e.id,e.branding.logo]),t}function SQ({card:e,onOpenDrawer:t}){let n=xQ(e),{branding:r,distribution:i}=e,a=!!e.workspace;return(0,R.jsxs)(`header`,{className:`card-header card-header-${r.header}`,children:[(0,R.jsxs)(`div`,{className:`card-brand`,children:[n?(0,R.jsx)(`img`,{className:`card-logo`,src:n,alt:`${r.provider?.name||r.name} logo`}):(0,R.jsx)(`span`,{className:`card-logo-missing`,"aria-hidden":`true`}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{children:r.name}),r.badge&&(0,R.jsx)(`span`,{className:`card-badge`,children:r.badge}),i&&(0,R.jsxs)(`span`,{className:`card-badge card-badge-quiet`,children:[i.tier,` · `,i.license===`open`?`open source`:`service`]})]})]}),(0,R.jsx)(`button`,{type:`button`,className:`card-button card-button-quiet`,onClick:t,children:a?`Open workspace`:`Settings & usage`})]})}function CQ({region:e,plugin:t}){switch(e.widget){case`status`:return(0,R.jsx)(tQ,{});case`live`:return(0,R.jsx)(kZ,{plugin:t,elementId:OZ(t).find(e=>e.kind===`card`)?.id,readOnly:!0});case`actions`:case`form`:case`keypad`:return(0,R.jsx)(rQ,{region:e.command?{...e,commands:[e.command]}:e});case`table`:case`detail`:case`list`:case`gauge`:case`log`:return(0,R.jsx)(aQ,{region:e});case`settings`:case`credentials`:return(0,R.jsx)(oQ,{plugin:t});case`activity`:return(0,R.jsx)(sQ,{})}}function wQ({plugin:e,card:t,onClose:n}){let r=!!t.workspace,[i,a]=(0,_.useState)(r?`workspace`:`settings`),o=(0,_.useRef)(null),s=(0,_.useRef)(n);(0,_.useEffect)(()=>{s.current=n},[n]),(0,_.useEffect)(()=>{let e=document.activeElement instanceof HTMLElement?document.activeElement:null,t=()=>Array.from(o.current?.querySelectorAll(`button:not(:disabled), a[href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex="0"]`)||[]);t()[0]?.focus();let n=e=>{if(e.key===`Escape`){e.preventDefault(),s.current();return}if(e.key!==`Tab`)return;let n=t(),r=n[0],i=n[n.length-1];r?!o.current?.contains(document.activeElement)||e.shiftKey&&document.activeElement===r?(e.preventDefault(),(e.shiftKey?i:r).focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),r.focus()):(e.preventDefault(),o.current?.focus())};return window.addEventListener(`keydown`,n),()=>{window.removeEventListener(`keydown`,n),e?.isConnected&&e.focus()}},[]);let c=r?[`workspace`,`settings`,`commands`,`usage`]:[`settings`,`commands`,`usage`];return(0,R.jsxs)(`aside`,{ref:o,tabIndex:-1,className:`card-drawer`,role:`dialog`,"aria-modal":`true`,"aria-label":`${t.title} settings`,children:[(0,R.jsxs)(`div`,{className:`card-drawer-head`,children:[(0,R.jsx)(`strong`,{children:t.title}),(0,R.jsx)(`button`,{type:`button`,className:`card-link`,onClick:n,"aria-label":`Close`,children:`Close`})]}),(0,R.jsx)(`nav`,{className:`card-tabs`,role:`tablist`,children:c.map(e=>(0,R.jsx)(`button`,{role:`tab`,type:`button`,"aria-selected":i===e,onClick:()=>a(e),children:e===`workspace`?`Workspace`:e===`settings`?`Settings`:e===`commands`?`Commands`:`Session activity`},e))}),(0,R.jsxs)(`div`,{className:`card-drawer-body`,children:[i===`workspace`&&(0,R.jsx)(hQ,{plugin:e,card:t}),i===`settings`&&(0,R.jsx)(oQ,{plugin:e}),i===`commands`&&(0,R.jsx)(rQ,{region:{widget:`actions`}}),i===`usage`&&(0,R.jsx)(sQ,{})]})]})}function TQ({plugin:e}){let t=(0,_.useMemo)(()=>IZ(e),[e]),n=OZ(e).some(e=>e.kind===`card`||e.kind===`panel`),[r,i]=(0,_.useState)(!1);return(0,R.jsx)(UZ,{card:t,children:(0,R.jsxs)(`section`,{className:`card card-${t.template}${n?` card-owned`:``}`,style:mQ(t.branding),"data-density":t.branding.density,"aria-label":`${t.title} card`,children:[(0,R.jsx)(SQ,{card:t,onOpenDrawer:()=>i(!0)}),t.description&&(0,R.jsx)(`p`,{className:`card-muted card-description`,children:t.description}),(0,R.jsx)(bQ,{plugin:e,children:(0,R.jsx)(`div`,{className:`card-regions`,children:t.regions.filter(e=>![`actions`,`form`,`keypad`].includes(e.widget)).map((t,n)=>(0,R.jsxs)(`section`,{className:`card-region card-region-${t.widget}`,style:{gridColumn:`span ${Math.min(12,Math.max(1,t.span||12))}`},children:[t.title&&(0,R.jsx)(`h3`,{children:t.title}),(0,R.jsx)(CQ,{region:t,plugin:e})]},n))})}),t.branding.provider&&(0,R.jsxs)(`footer`,{className:`card-footer`,children:[t.branding.provider.url?(0,R.jsx)(`a`,{href:t.branding.provider.url,target:`_blank`,rel:`noreferrer noopener`,children:t.branding.provider.name}):t.branding.provider.name,` is a trademark of its owner. This plugin connects to the service with your own account.`]}),r&&(0,R.jsx)(wQ,{plugin:e,card:t,onClose:()=>i(!1)})]})})}var EQ={ok:`online`,offline:`offline`,unreachable:`unreachable`,not_configured:`mesh sync not configured`,unsupported:`no plugin sharing (older version)`,error:`error`},DQ={fontFamily:`var(--font-mono)`,fontSize:`12px`},OQ={color:`var(--text-secondary)`,fontSize:`13px`,lineHeight:1.5},kQ=new Set([`auth`,`mesh`,`openwiki`,`composable-cli`,`cli-agents`,`code-quality`,`security`,`embeddings`,`git-sentinel`]),AQ=`You are my coding agent. Author a bespoke Total Recall plugin for [DOMAIN] following the Total Recall Plugin Recipe:
|
|
5600
|
+
<\/script></body></html>`}function DZ(e){let t=e?.cli;return Object.fromEntries((t?.subcommands||[]).filter(e=>Number.isInteger(e.timeout_ms)&&e.timeout_ms>=1&&e.timeout_ms<=6e5).map(e=>[e.name,e.timeout_ms]))}function OZ(e,t,n=new Set){if(!e||typeof e!=`object`)return!1;let r=e;return typeof r.requestId==`string`&&r.requestId.length<=64&&typeof r.subcommand==`string`&&t.has(r.subcommand)&&(r.stdin===void 0||n.has(r.subcommand)&&typeof r.stdin==`string`&&r.stdin.length>0&&new TextEncoder().encode(r.stdin).length<=65536)&&Array.isArray(r.args)&&r.args.length<=64&&r.args.every(e=>typeof e==`string`&&e.length<=8192)&&r.args.reduce((e,t)=>e+t.length,0)<=32768}function kZ(e){return e.manifest?.ui?.elements||e.ui?.elements||[]}function AZ({plugin:e,elementId:t,readOnly:n=!1}){let r=kZ(e).filter(e=>e.kind!==`settings`&&(!t||e.id===t)),[i,a]=(0,_.useState)(r[0]?.id||``),[o,s]=(0,_.useState)(``),c=(0,_.useRef)(null),[l,u]=(0,_.useState)(``),[d,f]=(0,_.useState)(240);return(0,_.useEffect)(()=>{let t=!1;s(``),u(``);let a=crypto.randomUUID(),o=e.manifest?.cli,l=new Set((o?.subcommands||[]).filter(e=>e.effect===`read`).map(e=>e.name)),d=new Set((e.cli?.subcommands||[]).filter(e=>!n||l.has(e.name)).map(e=>e.name)),p=new Set((o?.subcommands||[]).filter(e=>{let t=e.args?.filter(e=>e.secret===!0)||[];return t.length===1&&t[0].type===`string`&&t[0].flag===void 0}).map(e=>e.name)),m=r.find(e=>e.id===i)||r[0],h=[],g=n=>{let r=n.detail;!t&&m?.kind===`card`&&r?.pluginId===e.id&&h.some(e=>e.id===r.screen)&&c.current?.contentWindow?.postMessage({channel:a,type:`show-screen`,screen:r.screen},`*`)},_=0,v=async n=>{if(t||n.source!==c.current?.contentWindow||n.origin!==`null`||n.data?.channel!==a)return;let r=n.data;if(r.type===`screens`){m?.kind===`card`&&(h=TZ(r.screens),window.dispatchEvent(new CustomEvent(`plugin-screens`,{detail:{pluginId:e.id,screens:h}})));return}if(r.type===`screen-changed`){m?.kind===`card`&&h.some(e=>e.id===r.screen)&&window.dispatchEvent(new CustomEvent(`plugin-screen-changed`,{detail:{pluginId:e.id,screen:r.screen}}));return}if(r.type===`contextmenu`&&window.dispatchEvent(new CustomEvent(`plugin-context-menu`,{detail:{pluginId:e.id}})),r.type===`height`&&Number.isFinite(r.height)&&f(Math.max(128,Math.min(1e3,r.height))),r.type===`error`&&s(`Could not open the plugin interface`),r.type!==`run`)return;let i=n.source,o=(e,n)=>{t||i.postMessage({channel:a,type:`result`,requestId:r.requestId,result:e,error:n},`*`)};if(!OZ(r,d,p)||_>=4)o(void 0,`Operation is not available`);else{_++,window.dispatchEvent(new CustomEvent(`plugin-command-activity`,{detail:{pluginId:e.id,requestId:r.requestId,command:r.subcommand,running:!0}}));try{let t=r.stdin===void 0?await gi(e.id,r.subcommand,[...r.args,`--json`]):await gi(e.id,r.subcommand,[...r.args,`--json`],{stdin:r.stdin});if(!t.success){o(void 0,r.stdin===void 0?t.output||t.error||`Operation failed`:`Credential operation failed`);return}o(r.stdin===void 0?JSON.parse(t.output||`{}`):{ok:!0})}catch{o(void 0,`Operation failed`)}finally{_--,window.dispatchEvent(new CustomEvent(`plugin-command-activity`,{detail:{pluginId:e.id,requestId:r.requestId,command:r.subcommand,running:!1}}))}}};return window.addEventListener(`message`,v),window.addEventListener(`plugin-show-screen`,g),m&&(async()=>{let n=await L(`${I}/api/plugins/${encodeURIComponent(e.id)}/ui/${encodeURIComponent(m.id)}`);if(!n.ok)throw Error(`Could not open ${e.name} (${n.status})`);let r=await n.text();if(r.length>1048576)throw Error(`The plugin interface is too large`);if(t)return;let i=getComputedStyle(window.document.documentElement),o={};for(let e of[`--text-primary`,`--text-secondary`,`--text-tertiary`,`--bg-primary`,`--bg-secondary`,`--border`,`--accent`,`--font-sans`,`--color-text`,`--color-surface`,`--color-border`,`--spacing-md`,`--radius-md`])o[e]=i.getPropertyValue(e);u(EZ(r,m.tag,a,o,e.id,DZ(e.manifest),[...d]))})().catch(e=>{t||s(e.message)}),()=>{t=!0,window.removeEventListener(`message`,v),window.removeEventListener(`plugin-show-screen`,g),m?.kind===`card`&&window.dispatchEvent(new CustomEvent(`plugin-screens`,{detail:{pluginId:e.id,screens:[]}}))}},[e.id,i,e.sha256,t,n]),(0,R.jsxs)(`section`,{children:[r.length>1&&(0,R.jsx)(`nav`,{style:{display:`flex`,gap:8},children:r.map(e=>(0,R.jsx)(`button`,{className:`btn btn-sm`,onClick:()=>a(e.id),"aria-pressed":i===e.id,children:e.description||e.id},e.id))}),o&&(0,R.jsx)(`div`,{role:`alert`,className:`alert alert-error`,children:o}),r.length===0&&(0,R.jsx)(`p`,{children:`This plugin has not supplied its interface yet.`}),l&&(0,R.jsx)(`iframe`,{ref:c,title:`${e.name} interface`,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,allow:`camera 'none'; microphone 'none'; geolocation 'none'; clipboard-read 'none'; clipboard-write 'none'`,srcDoc:l,style:{width:`100%`,height:d,border:0}})]})}function jZ({plugin:e}){let[t,n]=(0,_.useState)(new Set),[r,i]=(0,_.useState)({}),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(``),[d,f]=(0,_.useState)([]),[p,m]=(0,_.useState)({});(0,_.useEffect)(()=>{let t=!1;return i({}),c(``),u(``),L(`${I}/api/plugins/auth/secrets`).then(async e=>{if(!e.ok)return[];let r=await e.json();!t&&Array.isArray(r)&&n(new Set(r.map(e=>e.key)))}).catch(e=>{t||u(e.message)}),L(`${I}/api/plugins/${encodeURIComponent(e.id)}/configuration`).then(async e=>{if(!e.ok)throw Error(`Could not load plugin settings`);let n=await e.json();t||(f(n.fields),m(Object.fromEntries(n.fields.map(e=>[e.name,n.values[e.name]??e.default??(e.type!==`boolean`&&``)]))))}).catch(e=>{t||u(e.message)}),()=>{t=!0}},[e.id]);async function h(t){o(t),u(``),c(``);try{let a=await L(e.manifest?.runtime&&e.manifest.runtime.modules?.credentials?`${I}/api/plugins/${encodeURIComponent(e.id)}/credentials`:`${I}/api/plugins/auth/secrets`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({key:t,value:r[t],tags:[`plugin:${e.id}`]})});if(!a.ok){let e=await a.json().catch(()=>({}));throw Error(e.error||`Failed to save secret`)}i(e=>({...e,[t]:``})),n(e=>new Set([...e,t])),c(`Credential saved. Open the plugin to verify the connection.`)}catch(e){u(e.message)}finally{o(``)}}async function g(){o(`configuration`),u(``),c(``);try{let t=await L(`${I}/api/plugins/${encodeURIComponent(e.id)}/configuration`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({values:p})}),n=await t.json();if(!t.ok)throw Error(n.error||`Could not save settings`);m(n.values),c(`Settings saved.`)}catch(e){u(e.message)}finally{o(``)}}return(0,R.jsxs)(`section`,{style:{marginBottom:24},children:[(0,R.jsx)(`h3`,{children:`Configuration`}),d.length>0?(0,R.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),g()},children:[d.map(e=>(0,R.jsxs)(`label`,{style:{display:`block`,marginBottom:12},children:[e.label,e.options?(0,R.jsxs)(`select`,{className:`select`,value:String(p[e.name]??``),onChange:t=>m(n=>({...n,[e.name]:e.type===`number`?Number(t.target.value):t.target.value})),children:[(0,R.jsx)(`option`,{value:``,children:`Choose…`}),e.options.map(e=>(0,R.jsx)(`option`,{value:String(e),children:String(e)},String(e)))]}):(0,R.jsx)(`input`,{className:`input`,type:e.type===`boolean`?`checkbox`:e.type===`number`?`number`:`text`,required:e.required,checked:e.type===`boolean`?!!p[e.name]:void 0,value:e.type===`boolean`?void 0:String(p[e.name]??``),onChange:t=>m(n=>({...n,[e.name]:e.type===`boolean`?t.target.checked:e.type===`number`?Number(t.target.value):t.target.value}))})]},e.name)),(0,R.jsx)(`button`,{className:`btn btn-sm btn-primary`,disabled:!!a,children:a===`configuration`?`Saving…`:`Save settings`})]}):(0,R.jsx)(`p`,{children:`No settings declared.`}),(0,R.jsx)(`h3`,{children:`Credentials`}),l&&(0,R.jsx)(`div`,{role:`alert`,className:`alert alert-error`,children:l}),s&&(0,R.jsx)(`p`,{role:`status`,children:s}),(e.secrets||[]).length===0&&(0,R.jsx)(`p`,{children:`No credentials required.`}),(e.secrets||[]).map((e,n)=>{let o=`Credential ${n+1}${e.required?` (required)`:` (optional)`}`;return(0,R.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),h(e.key)},style:{marginBottom:16},children:[(0,R.jsxs)(`label`,{style:{display:`block`,marginBottom:6},children:[o,` · `,t.has(e.key)?`Saved`:`Not saved`,(0,R.jsx)(`input`,{className:`input`,type:`password`,autoComplete:`new-password`,value:r[e.key]||``,placeholder:t.has(e.key)?`Paste a replacement`:`Paste credential`,onChange:t=>i(n=>({...n,[e.key]:t.target.value}))})]}),(0,R.jsx)(`button`,{className:`btn btn-sm btn-primary`,disabled:!r[e.key]?.trim()||!!a,children:a===e.key?`Saving…`:`Save credential`})]},e.key)})]})}var MZ=[`system`,`inter`,`ibm-plex`,`space-grotesk`,`jetbrains-mono`,`dm-sans`,`outfit`,`fraunces`,`newsreader`,`chivo-mono`],NZ=/^#[0-9a-fA-F]{6}$/,PZ=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{};function FZ(e){let t=PZ(e);if(typeof t.name!=`string`||typeof t.label!=`string`)return null;let n=[`string`,`number`,`boolean`,`choice`].includes(t.type)?t.type:`string`;return{name:t.name,flag:typeof t.flag==`string`?t.flag:void 0,positional:t.positional===!0,label:t.label,type:n,options:Array.isArray(t.options)?t.options:void 0,required:t.required===!0,secret:t.secret===!0}}function IZ(e){let t=PZ(e.manifest),n=new Map;for(let r of e.cli?.subcommands||[]){let e=PZ(t.cli?.subcommands?.find(e=>e?.name===r.name));n.set(r.name,{name:r.name,description:r.description,args:(Array.isArray(e.args)?e.args:[]).map(FZ).filter(Boolean),effect:[`read`,`write`,`destructive`,`send`].includes(e.effect)?e.effect:`write`,output:e.output===`text`?`text`:`json`,timeoutMs:Number.isFinite(e.timeout_ms)?e.timeout_ms:void 0})}let r=PZ(t.branding),i={name:typeof r.name==`string`?r.name:e.name,color:NZ.test(r.color)?r.color:`#475569`,accent:NZ.test(r.accent)?r.accent:NZ.test(r.color)?r.color:`#0ea5e9`,font:MZ.includes(r.font)?r.font:`system`,density:[`compact`,`comfortable`,`spacious`].includes(r.density)?r.density:`comfortable`,radius:[`none`,`sm`,`md`,`lg`,`pill`].includes(r.radius)?r.radius:`md`,header:[`plain`,`ledger-rule`,`band`,`tab-strip`,`badge-left`].includes(r.header)?r.header:`plain`,badge:typeof r.badge==`string`?r.badge:void 0,logo:typeof r.logo==`string`?r.logo:void 0,provider:PZ(r.provider).name?{name:String(r.provider.name),url:typeof r.provider.url==`string`?r.provider.url:void 0}:void 0},a=PZ(t.status),o=typeof a.command==`string`&&n.has(a.command)?a.command:void 0,s=(Array.isArray(t.ui?.elements)?t.ui.elements:Array.isArray(e.ui?.elements)?e.ui.elements:[]).find(e=>e&&typeof e==`object`&&e.kind===`card`),c=s&&typeof s.id==`string`&&typeof s.tag==`string`&&typeof s.module==`string`?{id:s.id,tag:s.tag,module:s.module,description:typeof s.description==`string`?s.description:void 0}:void 0,l=PZ(t.workspace),u=l&&(l.component||Array.isArray(l.tabs))?{component:typeof l.component==`string`?l.component:void 0,tabs:Array.isArray(l.tabs)?l.tabs.filter(e=>typeof e==`string`):void 0,permissions:Array.isArray(l.permissions)?l.permissions.filter(e=>typeof e==`string`):void 0}:void 0;return{id:e.id,title:i.name,description:e.description,face:c,commands:n,branding:i,status:o?{command:o,refreshSeconds:Number.isInteger(a.refresh_seconds)?Math.min(86400,Math.max(5,a.refresh_seconds)):30}:void 0,distribution:PZ(t.distribution).tier?{tier:t.distribution.tier,license:t.distribution.license}:void 0,workspace:u}}var LZ=e=>e.args.filter(e=>!e.secret);function RZ(e,t){return LZ(e).filter(e=>e.required&&(t[e.name]===void 0||t[e.name]===``)).map(e=>e.label)}function zZ(e,t,n=[]){let r=[],i=[];for(let n of LZ(e)){let e=t[n.name];e!==void 0&&e!==``&&e!==!1&&(n.positional?r.push(String(e)):n.flag&&(n.type===`boolean`?i.push(n.flag):i.push(n.flag,String(e))))}return[...r,...i,...n,...e.output===`json`?[`--json`]:[]]}var BZ=e=>e.type===`boolean`?!1:e.type===`choice`&&e.options?.length&&e.required?e.options[0]:``,VZ=(0,_.createContext)(null),HZ=()=>{let e=(0,_.useContext)(VZ);if(!e)throw Error(`Card widgets must render inside a CardRunner`);return e};function UZ({card:e,children:t}){let[n,r]=(0,_.useState)([]),[i,a]=(0,_.useState)(new Set),[o,s]=(0,_.useState)(null),c=(0,_.useRef)(e);(0,_.useEffect)(()=>{c.current=e},[e]);let l=(0,_.useCallback)(async(e,t={},n=[],i)=>{let s=c.current.commands.get(e);if(!s)return{ok:!1,text:``,error:`${e} is not a declared command`,ms:0};if(o&&!o.permissions[s.effect])return{ok:!1,text:``,error:`The ${s.effect} command permission is off`,ms:0};if(i!==void 0&&o&&(o.agent!==`direct`||o.node!==`local`))return{ok:!1,text:``,error:`Credential operations run directly on this node`,ms:0};let l=performance.now();a(t=>new Set(t).add(e));let u;try{let r=zZ(s,t,n),a=i===void 0?o?{execution:o}:void 0:{stdin:i},d=a?await gi(c.current.id,e,r,a):await gi(c.current.id,e,r),f=d.output||``,p;if(s.output===`json`&&f.trim())try{p=JSON.parse(f)}catch{}u={ok:!!d.success,data:p,text:f,error:d.success?void 0:d.timedOut?`The command timed out`:d.error||`The command failed`,ms:Math.round(performance.now()-l)}}catch(e){u={ok:!1,text:``,error:e instanceof Error?e.message:`The command failed`,ms:Math.round(performance.now()-l)}}return a(t=>{let n=new Set(t);return n.delete(e),n}),r(t=>[{at:new Date().toISOString(),command:e,effect:s.effect,ok:u.ok,ms:u.ms},...t].slice(0,100)),u},[o]),u=(0,_.useMemo)(()=>({card:e,run:l,activity:n,busy:i,execution:o,setExecution:s}),[e,l,n,i,o]);return(0,R.jsx)(VZ.Provider,{value:u,children:t})}function WZ(e,t,n){let r=[`total-recall`,n||e.id,t.name];for(let e of t.args){if(e.secret)continue;let t=e.positional?`<${e.name}>`:`${e.flag}${e.type===`boolean`?``:` <${e.name}>`}`;r.push(e.required?t:`[${t}]`)}return t.output===`json`&&r.push(`--json`),r.join(` `)}var GZ=({tone:e,children:t})=>(0,R.jsx)(`span`,{className:`card-pill card-pill-${e}`,children:t});function KZ({result:e}){return(0,R.jsx)(`p`,{role:`alert`,className:`card-error`,children:e.error||`No data`})}function qZ({command:e}){let{run:t,busy:n}=HZ(),r=LZ(e),[i,a]=(0,_.useState)(()=>Object.fromEntries(r.map(e=>[e.name,BZ(e)]))),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(``),f=e.args.filter(e=>e.secret),p=f.length===1&&f[0].type===`string`&&!f[0].flag,m=e.effect!==`read`,h=RZ(e,i);return(0,R.jsxs)(`form`,{className:`card-form`,onSubmit:async n=>{if(n.preventDefault(),m&&!c)return;let r=p?u:void 0;d(``),s(await t(e.name,i,[],r)),l(!1)},children:[r.map(e=>(0,R.jsxs)(`label`,{children:[e.label,e.required?` *`:``,e.type===`choice`?(0,R.jsxs)(`select`,{value:String(i[e.name]??``),onChange:t=>a({...i,[e.name]:t.target.value}),children:[!e.required&&(0,R.jsx)(`option`,{value:``,children:`Any`}),e.options?.map(e=>(0,R.jsx)(`option`,{value:String(e),children:String(e)},String(e)))]}):e.type===`boolean`?(0,R.jsx)(`input`,{type:`checkbox`,checked:!!i[e.name],onChange:t=>a({...i,[e.name]:t.target.checked})}):(0,R.jsx)(`input`,{type:e.type===`number`?`number`:`text`,value:String(i[e.name]??``),onChange:t=>a({...i,[e.name]:e.type===`number`&&t.target.value!==``?Number(t.target.value):t.target.value})})]},e.name)),p&&(0,R.jsxs)(`label`,{children:[f[0].label,(0,R.jsx)(`input`,{type:`password`,autoComplete:`new-password`,value:u,maxLength:65536,onChange:e=>d(e.target.value)})]}),f.length>0&&!p&&(0,R.jsx)(`p`,{className:`card-muted`,children:`Use connection settings for this credential operation.`}),m&&(0,R.jsxs)(`label`,{children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l(e.target.checked)}),`Confirm `,e.name]}),(0,R.jsx)(`button`,{className:`card-button`,disabled:h.length>0||n.has(e.name)||m&&!c||f.length>0&&(!p||!u),children:n.has(e.name)?`Running…`:e.effect===`read`?`Look up`:`Run command`}),o&&(o.ok?(0,R.jsx)(`pre`,{className:`card-pre`,children:o.data?JSON.stringify(o.data,null,2):o.text}):(0,R.jsx)(KZ,{result:o}))]})}function JZ(){let{card:e}=HZ(),t=e.id,n=[...e.commands.keys()],[r,i]=(0,_.useState)(``),[a,o]=(0,_.useState)(``);return(0,R.jsxs)(`ul`,{className:`card-commands`,children:[n.map(t=>e.commands.get(t)).filter(e=>!!e).map(n=>{let s=WZ(e,n,t);return(0,R.jsxs)(`li`,{children:[(0,R.jsxs)(`div`,{className:`card-row`,children:[(0,R.jsx)(`strong`,{children:n.name}),(0,R.jsx)(GZ,{tone:n.effect===`read`?`ok`:n.effect===`write`?`neutral`:`warn`,children:n.effect}),(0,R.jsx)(`button`,{type:`button`,className:`card-link`,onClick:()=>i(r===n.name?``:n.name),children:r===n.name?`Close`:`Try`})]}),n.description&&(0,R.jsx)(`p`,{className:`card-muted`,children:n.description}),(0,R.jsxs)(`div`,{className:`card-row`,children:[(0,R.jsx)(`code`,{className:`card-code`,children:s}),(0,R.jsx)(`button`,{type:`button`,className:`card-link`,onClick:async()=>{try{await navigator.clipboard.writeText(s),o(n.name)}catch{o(``)}},children:a===n.name?`Copied`:`Copy`})]}),r===n.name&&(0,R.jsx)(qZ,{command:n})]},n.name)}),n.length===0&&(0,R.jsx)(`li`,{className:`card-muted`,children:`No commands declared.`})]})}function YZ({plugin:e}){return(0,R.jsx)(jZ,{plugin:e})}function XZ(){let{activity:e}=HZ();return e.length===0?(0,R.jsx)(`p`,{className:`card-muted`,children:`No commands have run from this card in this session.`}):(0,R.jsx)(`ul`,{className:`card-list`,children:e.slice(0,20).map((e,t)=>(0,R.jsxs)(`li`,{children:[(0,R.jsx)(GZ,{tone:e.ok?`ok`:`error`,children:e.ok?`ok`:`failed`}),` `,e.command,` · `,e.ms,` ms · `,new Date(e.at).toLocaleTimeString()]},t))})}var ZZ={system:`system-ui, -apple-system, "Segoe UI", sans-serif`,inter:`Inter, system-ui, sans-serif`,"ibm-plex":`"IBM Plex Sans", system-ui, sans-serif`,"space-grotesk":`"Space Grotesk", system-ui, sans-serif`,"jetbrains-mono":`"JetBrains Mono", ui-monospace, monospace`,"dm-sans":`"DM Sans", system-ui, sans-serif`,outfit:`Outfit, system-ui, sans-serif`,fraunces:`Fraunces, Georgia, serif`,newsreader:`Newsreader, Georgia, serif`,"chivo-mono":`"Chivo Mono", ui-monospace, monospace`},QZ={none:`0px`,sm:`3px`,md:`8px`,lg:`14px`,pill:`22px`},$Z={compact:`8px`,comfortable:`14px`,spacious:`22px`};function eQ(e){let[t,n,r]=[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)/255).map(e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4);return .2126*t+.7152*n+.0722*r}var tQ=(e,t)=>{let[n,r]=[eQ(e),eQ(t)].sort((e,t)=>t-e);return(n+.05)/(r+.05)},nQ=e=>tQ(e,`#ffffff`)>=tQ(e,`#111111`)?`#ffffff`:`#111111`;function rQ(e){return{"--card-color":e.color,"--card-accent":e.accent,"--card-on-color":nQ(e.color),"--card-on-accent":nQ(e.accent),"--card-font":ZZ[e.font]||ZZ.system,"--card-radius":QZ[e.radius],"--card-gap":$Z[e.density],fontFamily:`var(--card-font)`}}function iQ({plugin:e,card:t}){let n=t.workspace?.component,r=kZ(e).find(e=>e.id===n||e.tag===n);return r?t.workspace?.permissions?.length?(0,R.jsx)(`p`,{role:`status`,children:`This workspace requires device access that the host does not support yet.`}):(0,R.jsx)(AZ,{plugin:e,elementId:r.id}):(0,R.jsx)(`p`,{role:`status`,children:`This plugin has not supplied its workspace interface yet.`})}var aQ={agent:`direct`,node:`local`,permissions:{read:!0,write:!1,send:!1,destructive:!1}},oQ={read:`Read commands`,write:`Write commands`,send:`Send commands`,destructive:`Delete commands`},sQ;function cQ(){let{execution:e,setExecution:t,busy:n}=HZ(),r=e||aQ,[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)([]),[c,l]=(0,_.useState)([]),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(``),m=(0,_.useRef)(0),h=async e=>{let t=++m.current;d(!0),l([]),p(``);try{let n=await L(`${I}/api/plugins/execution-targets?node=${encodeURIComponent(e)}`),r=await n.json();if(!n.ok||!r.success)throw Error(r.error||`Could not inspect this node`);t===m.current&&l(r.agents||[])}catch(e){t===m.current&&p(e instanceof Error?e.message:`Could not inspect this node`)}finally{t===m.current&&d(!1)}},g=async()=>{if(a(!i),!i){d(!0),p(``);try{if(!sQ||Date.now()-sQ.at>6e4){let e=await L(`${I}/api/plugins/execution-targets`),t=await e.json();if(!e.ok||!t.success)throw Error(t.error||`CLI agents is unavailable`);sQ={at:Date.now(),data:t}}s(sQ.data.nodes||[]),await h(r.node)}catch(e){p(e instanceof Error?e.message:`CLI agents is unavailable`),d(!1)}}};return(0,R.jsxs)(`div`,{className:`card-execution`,children:[(0,R.jsx)(`button`,{type:`button`,className:`card-link`,onClick:()=>void g(),"aria-expanded":i,children:`Agent, node & permissions`}),i&&(0,R.jsxs)(`fieldset`,{className:`card-form`,disabled:u||n.size>0,children:[(0,R.jsx)(`legend`,{children:`Command execution`}),(0,R.jsxs)(`label`,{children:[`Mesh node`,(0,R.jsxs)(`select`,{value:r.node,onChange:e=>{let n=e.target.value;t({...r,node:n,agent:`direct`,cwd:void 0}),h(n)},children:[(0,R.jsx)(`option`,{value:`local`,children:`This node`}),o.filter(e=>!e.self).map(e=>(0,R.jsxs)(`option`,{value:e.id,disabled:!e.online||!e.accessConfigured,children:[e.name,e.online?e.accessConfigured?``:` · access needed`:` · offline`]},e.id))]})]}),(0,R.jsxs)(`label`,{children:[`CLI agent`,(0,R.jsxs)(`select`,{value:r.agent,onChange:e=>t({...r,agent:e.target.value,allowUnknownAuth:e.target.value!==`direct`}),children:[(0,R.jsx)(`option`,{value:`direct`,children:`Direct CLI`}),c.map(e=>(0,R.jsxs)(`option`,{value:e.id,disabled:!e.installed||!e.versionVerified||e.authenticated===!1,children:[e.name,e.installed?e.authenticated===!1?` · sign in needed`:e.authenticated===`unknown`?` · account unchecked`:``:` · not installed`]},e.id))]})]}),r.node!==`local`&&(0,R.jsxs)(`label`,{children:[`Workspace on selected node`,(0,R.jsx)(`input`,{value:r.cwd||``,placeholder:`/absolute/workspace`,onChange:e=>t({...r,cwd:e.target.value})})]}),(0,R.jsx)(`div`,{className:`card-permissions`,children:Object.keys(oQ).map(e=>(0,R.jsxs)(`label`,{children:[(0,R.jsx)(`input`,{type:`checkbox`,role:`switch`,checked:r.permissions[e],onChange:n=>t({...r,permissions:{...r.permissions,[e]:n.target.checked}})}),oQ[e]]},e))}),(0,R.jsx)(`button`,{type:`button`,className:`card-link`,onClick:()=>void h(r.node),children:`Refresh installed agents`})]}),u&&(0,R.jsx)(`p`,{role:`status`,className:`card-muted`,children:`Inspecting installed agents…`}),f&&(0,R.jsx)(`p`,{role:`alert`,className:`card-error`,children:f})]})}function lQ({plugin:e,children:t}){let{card:n,busy:r}=HZ(),[i,a]=(0,_.useState)(e.activation?.enabled!==!1);(0,_.useEffect)(()=>{a(e.activation?.enabled!==!1)},[e.id,e.activation?.enabled]);let[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)({}),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)([]),[g,v]=(0,_.useState)(``),y=(0,_.useRef)([]);(0,_.useEffect)(()=>{y.current=[],h([]),v(``),p(!1);let t=t=>{let n=t.detail;n?.pluginId===e.id&&d(e=>{let t={...e};return n.running?t[n.requestId]=n.command:delete t[n.requestId],t})},n=t=>{t.detail?.pluginId===e.id&&p(!0)},r=t=>{let n=t.detail;if(n?.pluginId!==e.id)return;let r=TZ(n.screens);y.current=r,h(r),v(e=>r.some(t=>t.id===e)?e:r[0]?.id||``)},i=t=>{let n=t.detail;n?.pluginId===e.id&&y.current.some(e=>e.id===n.screen)&&v(n.screen)};return window.addEventListener(`plugin-command-activity`,t),window.addEventListener(`plugin-context-menu`,n),window.addEventListener(`plugin-screens`,r),window.addEventListener(`plugin-screen-changed`,i),()=>{window.removeEventListener(`plugin-command-activity`,t),window.removeEventListener(`plugin-context-menu`,n),window.removeEventListener(`plugin-screens`,r),window.removeEventListener(`plugin-screen-changed`,i)}},[e.id]);let b=[...r,...Object.values(u)],x=t=>{m.some(e=>e.id===t)&&(p(!1),window.dispatchEvent(new CustomEvent(`plugin-show-screen`,{detail:{pluginId:e.id,screen:t}})))},S=e=>{if(m.length<2)return;let t=Math.max(0,m.findIndex(e=>e.id===g));x(m[(t+e+m.length)%m.length].id)},C=async()=>{s(!0),l(``);try{let t=await L(`${I}/api/plugins/${encodeURIComponent(e.id)}/activation`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:!i})}),n=await t.json();if(n.activation&&a(n.activation.enabled),!t.ok||!n.success)throw Error(n.compilation?.error||n.error||`Activation could not be changed`)}catch(e){l(e instanceof Error?e.message:`Activation could not be changed`)}finally{s(!1)}};return(0,R.jsxs)(`div`,{className:`card-scenes`,"data-state":i?`active`:`inactive`,"aria-busy":b.length>0||o,onContextMenu:e=>{e.preventDefault(),p(!0)},onKeyDown:e=>{e.key===`Escape`&&p(!1),e.key===`F10`&&e.shiftKey&&(e.preventDefault(),p(!0))},children:[(0,R.jsxs)(`div`,{className:`card-row card-scene-controls`,children:[(0,R.jsx)(`span`,{role:`status`,className:`card-pill`,children:b.length?`Running ${b.join(`, `)}`:i?`Active`:`Inactive`}),(0,R.jsx)(`button`,{type:`button`,className:`card-button`,role:`switch`,"aria-checked":i,"aria-label":`${n.title} on or off`,onClick:()=>void C(),disabled:o||b.length>0,children:o?`Updating…`:i?`Turn off`:`Turn on`}),(0,R.jsx)(`button`,{type:`button`,className:`card-link`,"aria-label":`Previous screen`,disabled:m.length<2,onClick:()=>S(-1),children:`←`}),(0,R.jsx)(`button`,{type:`button`,className:`card-link`,"aria-label":`Next screen`,disabled:m.length<2,onClick:()=>S(1),children:`→`}),m.length>0&&(0,R.jsx)(`span`,{className:`card-pill`,"aria-label":`Current screen`,children:m.find(e=>e.id===g)?.label}),m.length>0&&(0,R.jsx)(`button`,{type:`button`,className:`card-link`,"aria-haspopup":`menu`,"aria-expanded":f,onClick:()=>p(!f),children:`Screens`})]}),f&&m.length>0&&(0,R.jsx)(`div`,{role:`menu`,"aria-label":`${n.title} declared screens`,className:`card-context-menu`,children:m.map(e=>(0,R.jsx)(`button`,{role:`menuitem`,type:`button`,className:`card-link`,"aria-current":e.id===g?`page`:void 0,onClick:()=>x(e.id),children:e.label},e.id))}),c&&(0,R.jsx)(`p`,{role:`alert`,className:`card-error`,children:c}),(0,R.jsx)(cQ,{}),(0,R.jsx)(`div`,{className:`card-scene-track`,tabIndex:0,"aria-label":`${n.title} interface`,children:(0,R.jsx)(`section`,{className:`card-scene`,"aria-label":`Interface`,children:t})})]})}function uQ(e){let[t,n]=(0,_.useState)(``);return(0,_.useEffect)(()=>{if(!e.branding.logo)return;let t=``,r=!1;return L(`${I}/api/plugins/${encodeURIComponent(e.id)}/logo`).then(e=>e.ok?e.blob():Promise.reject(Error(`no logo`))).then(e=>{r||(t=URL.createObjectURL(e),n(t))}).catch(()=>{r||n(``)}),()=>{r=!0,t&&URL.revokeObjectURL(t)}},[e.id,e.branding.logo]),t}function dQ({card:e,onOpenDrawer:t}){let n=uQ(e),{branding:r,distribution:i}=e,a=!!e.workspace;return(0,R.jsxs)(`header`,{className:`card-header card-header-${r.header}`,children:[(0,R.jsxs)(`div`,{className:`card-brand`,children:[n?(0,R.jsx)(`img`,{className:`card-logo`,src:n,alt:`${r.provider?.name||r.name} logo`}):(0,R.jsx)(`span`,{className:`card-logo-missing`,"aria-hidden":`true`}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{children:r.name}),r.badge&&(0,R.jsx)(`span`,{className:`card-badge`,children:r.badge}),i&&(0,R.jsxs)(`span`,{className:`card-badge card-badge-quiet`,children:[i.tier,` · `,i.license===`open`?`open source`:`service`]})]})]}),(0,R.jsx)(`button`,{type:`button`,className:`card-button card-button-quiet`,onClick:t,children:a?`Open workspace`:`Settings & usage`})]})}function fQ({plugin:e,card:t,onClose:n}){let r=!!t.workspace,[i,a]=(0,_.useState)(r?`workspace`:`settings`),o=(0,_.useRef)(null),s=(0,_.useRef)(n);(0,_.useEffect)(()=>{s.current=n},[n]),(0,_.useEffect)(()=>{let e=document.activeElement instanceof HTMLElement?document.activeElement:null,t=()=>Array.from(o.current?.querySelectorAll(`button:not(:disabled), a[href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex="0"]`)||[]);t()[0]?.focus();let n=e=>{if(e.key===`Escape`){e.preventDefault(),s.current();return}if(e.key!==`Tab`)return;let n=t(),r=n[0],i=n[n.length-1];r?!o.current?.contains(document.activeElement)||e.shiftKey&&document.activeElement===r?(e.preventDefault(),(e.shiftKey?i:r).focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),r.focus()):(e.preventDefault(),o.current?.focus())};return window.addEventListener(`keydown`,n),()=>{window.removeEventListener(`keydown`,n),e?.isConnected&&e.focus()}},[]);let c=r?[`workspace`,`settings`,`commands`,`usage`]:[`settings`,`commands`,`usage`];return(0,R.jsxs)(`aside`,{ref:o,tabIndex:-1,className:`card-drawer`,role:`dialog`,"aria-modal":`true`,"aria-label":`${t.title} settings`,children:[(0,R.jsxs)(`div`,{className:`card-drawer-head`,children:[(0,R.jsx)(`strong`,{children:t.title}),(0,R.jsx)(`button`,{type:`button`,className:`card-link`,onClick:n,"aria-label":`Close`,children:`Close`})]}),(0,R.jsx)(`nav`,{className:`card-tabs`,role:`tablist`,children:c.map(e=>(0,R.jsx)(`button`,{role:`tab`,type:`button`,"aria-selected":i===e,onClick:()=>a(e),children:e===`workspace`?`Workspace`:e===`settings`?`Settings`:e===`commands`?`Commands`:`Session activity`},e))}),(0,R.jsxs)(`div`,{className:`card-drawer-body`,children:[i===`workspace`&&(0,R.jsx)(iQ,{plugin:e,card:t}),i===`settings`&&(0,R.jsx)(YZ,{plugin:e}),i===`commands`&&(0,R.jsx)(JZ,{}),i===`usage`&&(0,R.jsx)(XZ,{})]})]})}function pQ({plugin:e}){let t=(0,_.useMemo)(()=>IZ(e),[e]),[n,r]=(0,_.useState)(!1);return(0,R.jsx)(UZ,{card:t,children:(0,R.jsxs)(`section`,{className:`card card-bespoke${t.face?` card-owned`:``}`,style:rQ(t.branding),"data-density":t.branding.density,"aria-label":`${t.title} card`,children:[(0,R.jsx)(dQ,{card:t,onOpenDrawer:()=>r(!0)}),t.description&&(0,R.jsx)(`p`,{className:`card-muted card-description`,children:t.description}),(0,R.jsx)(lQ,{plugin:e,children:t.face?(0,R.jsx)(AZ,{plugin:e,elementId:t.face.id,readOnly:!0}):(0,R.jsxs)(`p`,{className:`card-error`,role:`alert`,children:[e.name,` has not supplied its card face.`]})}),t.branding.provider&&(0,R.jsxs)(`footer`,{className:`card-footer`,children:[t.branding.provider.url?(0,R.jsx)(`a`,{href:t.branding.provider.url,target:`_blank`,rel:`noreferrer noopener`,children:t.branding.provider.name}):t.branding.provider.name,` is a trademark of its owner. This plugin connects to the service with your own account.`]}),n&&(0,R.jsx)(fQ,{plugin:e,card:t,onClose:()=>r(!1)})]})})}var mQ={ok:`online`,offline:`offline`,unreachable:`unreachable`,not_configured:`mesh sync not configured`,unsupported:`no plugin sharing (older version)`,error:`error`},hQ={fontFamily:`var(--font-mono)`,fontSize:`12px`},gQ={color:`var(--text-secondary)`,fontSize:`13px`,lineHeight:1.5},_Q=new Set([`auth`,`mesh`,`openwiki`,`composable-cli`,`cli-agents`,`code-quality`,`security`,`embeddings`,`git-sentinel`]),vQ=`You are my coding agent. Author a bespoke Total Recall plugin for [DOMAIN] following the Total Recall Plugin Recipe:
|
|
5588
5601
|
|
|
5589
5602
|
1. Scaffold:
|
|
5590
5603
|
total-recall scaffold-plugin <id> --title "<Name>" --description "<Description>"
|
|
@@ -5605,9 +5618,9 @@ try{
|
|
|
5605
5618
|
|
|
5606
5619
|
4. Distribution:
|
|
5607
5620
|
- Private: keep in .agent/skills/total-recall/plugins/<id>
|
|
5608
|
-
- Store: publish via total-recall deploy-store <id>`;function jQ(e){let t=e.branding||{};return{icon:t.icon||``,color:t.color||`#3b82f6`,badge:t.badge||`Plugin`}}function MQ(e){return e?`${e.slice(0,12)}…`:`—`}function NQ(e){return e==null?`—`:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function PQ(e){switch(e.source.kind){case`peer`:return`from ${e.source.peer_hostname||`a peer`}`;case`bundled`:return`bundled`;case`git`:return`git`;case`public`:return`direct link`;case`link`:return`linked folder`;default:return`local folder`}}function FQ({useCases:e}){return e.length?(0,R.jsx)(`div`,{style:{display:`flex`,gap:`6px`,flexWrap:`wrap`},children:e.map(e=>(0,R.jsx)(`span`,{className:`badge`,style:{fontSize:`11px`},children:e},e))}):null}function IQ({label:e,children:t}){return(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`12px`,fontSize:`13px`,padding:`6px 0`,borderBottom:`1px solid var(--border)`},children:[(0,R.jsx)(`span`,{style:{width:`132px`,flexShrink:0,color:`var(--text-tertiary)`},children:e}),(0,R.jsx)(`span`,{style:{color:`var(--text-primary)`,minWidth:0,overflowWrap:`anywhere`},children:t})]})}function LQ({title:e,children:t}){return(0,R.jsxs)(`div`,{className:`card`,style:{textAlign:`center`,padding:`40px 24px`},children:[(0,R.jsx)(`div`,{style:{fontWeight:600,marginBottom:`6px`},children:e}),t&&(0,R.jsx)(`div`,{style:OQ,children:t})]})}function RQ({activeBrainId:e}){let[t,n]=Mn(),[r,i]=(0,_.useState)(`installed`),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(!0),[h,g]=(0,_.useState)(``),[v,y]=(0,_.useState)(``),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(null),[w,T]=(0,_.useState)(!1),[E,D]=(0,_.useState)(``),[O,ee]=(0,_.useState)(!1),[k,te]=(0,_.useState)(!1),[A,j]=(0,_.useState)(null),[M,ne]=(0,_.useState)(`preview`),[N,re]=(0,_.useState)(``),[ie,ae]=(0,_.useState)(``),[oe,se]=(0,_.useState)(null),[ce,le]=(0,_.useState)(``),[ue,de]=(0,_.useState)(!1),[fe,pe]=(0,_.useState)(`workspace`),[me,he]=(0,_.useState)(()=>{try{let e=localStorage.getItem(`tr_workspace_plugins`);if(e)return new Set(JSON.parse(e))}catch{}return new Set}),[ge,_e]=(0,_.useState)(!1),[ve,ye]=(0,_.useState)(null),[be,xe]=(0,_.useState)(``),[Se,Ce]=(0,_.useState)(`#3b82f6`),[P,we]=(0,_.useState)(``),[Te,Ee]=(0,_.useState)(null),F=(0,_.useRef)(null),De=(e,t)=>{if(t.touches.length!==1)return;let n=t.touches[0],r=n.clientX,i=n.clientY;F.current=setTimeout(()=>{if(`vibrate`in navigator)try{navigator.vibrate(50)}catch{}Ee({plugin:e,x:r,y:i})},500)},Oe=()=>{F.current&&=(clearTimeout(F.current),null)},ke=(e,t)=>{t.preventDefault(),t.stopPropagation(),Ee({plugin:e,x:t.clientX,y:t.clientY})};(0,_.useEffect)(()=>{let e=()=>Ee(null);return window.addEventListener(`pointerdown`,e),()=>window.removeEventListener(`pointerdown`,e)},[]);let Ae=(0,_.useCallback)(async()=>{m(!0);try{let[e,t]=await Promise.all([ai(),si()]);o(e),c(t)}finally{m(!1)}},[]),je=(0,_.useCallback)(async()=>{f(!0);try{u(await ci())}finally{f(!1)}},[]);(0,_.useEffect)(()=>{Ae()},[Ae,e]),(0,_.useEffect)(()=>{r===`mesh`&&l===null&&!d&&je()},[r,l,d,je]);let Me=(0,_.useMemo)(()=>{let e=new Set;for(let t of a)t.use_cases.forEach(t=>e.add(t));for(let t of s)t.use_cases.forEach(t=>e.add(t));for(let t of l?.peers||[])t.plugins.forEach(t=>t.use_cases.forEach(t=>e.add(t)));return Array.from(e).sort()},[a,s,l]),Ne=(0,_.useCallback)(e=>{if(v&&!e.use_cases.includes(v))return!1;let t=h.trim().toLowerCase();return!t||[e.id,e.name,e.description,...e.use_cases].some(e=>e.toLowerCase().includes(t))},[h,v]),Pe=(0,_.useCallback)(e=>!!(e.scope===`project`||kQ.has(e.id)||me.has(e.id)),[me]),Fe=async e=>{x(e.id);try{let t=new Set(me);t.add(e.id),he(t);try{localStorage.setItem(`tr_workspace_plugins`,JSON.stringify([...t]))}catch{}await mi(e.id,!0),C({type:`success`,message:`Added ${e.name} to workspace dashboard`}),await Ae()}catch(t){C({type:`error`,message:t?.message||`Could not activate ${e.name}`})}finally{x(null)}},Ie=async e=>{x(e.id);try{let t=new Set(me);t.delete(e.id),he(t);try{localStorage.setItem(`tr_workspace_plugins`,JSON.stringify([...t]))}catch{}await mi(e.id,!1),C({type:`success`,message:`Moved ${e.name} from workspace to Plugin Store`}),await Ae()}catch(t){C({type:`error`,message:t?.message||`Could not deactivate ${e.name}`})}finally{x(null)}},Le=()=>{navigator.clipboard?.writeText(AQ),C({type:`success`,message:`Copied Agent Plugin Recipe prompt to clipboard`})},Re=async(e,t={})=>{x(e),C(null);let n=await li({source:e,...t});return x(null),n.success?(C({type:`success`,message:n.message||`Installed ${e}`}),await Ae(),l&&je(),!0):(C({type:`error`,message:n.error||`Could not install ${e}`}),!1)},ze=async e=>{if(!window.confirm(`Remove "${e.name}" (${e.scope})?`))return;x(e.id);let t=await ui(e.id,e.scope===`global`);x(null),C(t.success?{type:`success`,message:`Removed ${e.name}`}:{type:`error`,message:t.error||`Remove failed`}),t.success&&(A?.id===e.id&&Ke(),Ae())},Be=async(e,t)=>{x(e.id);let n=await di(e.id,t);x(null),n.success?(n.plugin&&A?.id===e.id&&j(n.plugin),C({type:`success`,message:t?`${e.name} is shared. Its public link is in the details.`:`${e.name} is no longer shared`}),Ae()):C({type:`error`,message:n.error||`Could not change sharing`})},Ve=async e=>{x(e.id);let t=!e.locked,n=await pi(e.id,t);x(null),n.success?(n.plugin&&A?.id===e.id&&j(n.plugin),C({type:`success`,message:t?`${e.name} is locked against further editing.`:`${e.name} is unlocked for editing.`}),Ae()):C({type:`error`,message:n.error||`Could not update lock status`})},He=async e=>{x(e.id);let t=await hi(e.id,!0);x(null),t.success?(t.plugin&&A?.id===e.id&&j(t.plugin),C({type:`success`,message:`${e.name} deployed to the plugin store and locked as complete.`}),Ae()):C({type:`error`,message:t.error||`Could not deploy plugin to store`})},Ue=e=>{let t=jQ(e);ye(e),xe(t.icon),Ce(t.color),we(t.badge),_e(!0)},We=async()=>{if(!ve)return;if(ve.locked){C({type:`error`,message:`Plugin is locked. Unlock it before editing branding.`}),_e(!1);return}x(ve.id);let e=await fi(ve.id,{icon:be.trim()||void 0,color:Se.trim()||void 0,badge:P.trim()||void 0});x(null),_e(!1),e.success?(C({type:`success`,message:`Updated branding for ${ve.name}`}),await Ae(),A?.id===ve.id&&e.plugin&&j(e.plugin)):C({type:`error`,message:e.error||`Could not save branding`})},Ge=async(e,t=`preview`)=>{j(await oi(e.id)||e),ne(t),re(e.cli?.subcommands?.[0]?.name||``),ae(``),se(null),le(``),le(await _i(e.id))},Ke=()=>{if(j(null),t.has(`id`)){let e=new URLSearchParams(t);e.delete(`id`),n(e)}};(0,_.useEffect)(()=>{let e=t.get(`id`);if(!e||A?.id===e)return;let n=a.find(t=>t.id===e);n&&Ge(n)},[t,a]),(0,_.useEffect)(()=>{if(!A)return;let e=a.find(e=>e.id===A.id);e&&e!==A&&j(e)},[a]);let qe=async()=>{if(!A)return;x(`run:${A.id}`);let e=await gi(A.id,N,ie.trim()?ie.trim().split(/\s+/):[]);x(null),e.error?se({text:e.error,ok:!1}):se({text:(e.output||``).trim()||`(no output)`,ok:e.success})},Je=a.filter(Ne),Ye=Je.filter(Pe),Xe=fe===`workspace`?Ye:Je,Ze=(0,_.useMemo)(()=>{let e=new Map;for(let t of s){let n=a.find(e=>e.id===t.id);e.set(t.id,{id:t.id,name:t.name,version:t.version,description:t.description,use_cases:t.use_cases||[],installed:t.installed||!!n,inWorkspace:n?Pe(n):!1,sourcePlugin:n,branding:t.branding||(n?n.branding:void 0),cli:t.cli||(n?n.cli:null),tasks:t.tasks||(n?n.tasks:[]),secrets:n?.secrets||[]})}for(let t of a)e.has(t.id)||e.set(t.id,{id:t.id,name:t.name,version:t.version,description:t.description,use_cases:t.use_cases||[],installed:!0,inWorkspace:Pe(t),sourcePlugin:t,branding:t.branding,cli:t.cli,tasks:t.tasks,secrets:t.secrets||[]});return Array.from(e.values())},[s,a,Pe]).filter(Ne),Qe=(e,t,n)=>(0,R.jsxs)(`button`,{role:`tab`,"aria-selected":r===e,className:`btn btn-sm ${r===e?`btn-primary`:`btn-ghost`}`,onClick:()=>i(e),children:[t,n!==void 0&&(0,R.jsx)(`span`,{style:{opacity:.75,fontWeight:500,marginLeft:`4px`},children:n})]},e);return(0,R.jsxs)(`div`,{className:`page`,style:{maxWidth:`100%`,padding:`0 20px`,margin:`0 auto`,width:`100%`},children:[(0,R.jsxs)(`div`,{className:`page-header`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,gap:`16px`,flexWrap:`wrap`},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h1`,{children:`Plugins`}),(0,R.jsx)(`p`,{children:`Modular capability system for Total Recall and SSSS apps — memory categories, agent context, commands, and design-token UI. Customizable branding, locked release status, and direct store deployment are managed on each card.`})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`8px`},children:[(0,R.jsx)(`button`,{className:`btn btn-ghost`,onClick:()=>de(!0),children:`Agent Recipe`}),(0,R.jsx)(`button`,{className:`btn btn-primary`,onClick:()=>{T(!0),C(null)},children:`Install from source…`})]})]}),S&&(0,R.jsxs)(`div`,{className:`alert ${S.type===`success`?`alert-success`:`alert-error`}`,role:`status`,style:{display:`flex`,justifyContent:`space-between`,gap:`12px`,marginBottom:`20px`},children:[(0,R.jsx)(`span`,{children:S.message}),(0,R.jsx)(`button`,{onClick:()=>C(null),"aria-label":`Dismiss`,style:{background:`none`,border:`none`,color:`inherit`,cursor:`pointer`},children:`×`})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,gap:`12px`,flexWrap:`wrap`,marginBottom:`20px`},children:[(0,R.jsxs)(`div`,{role:`tablist`,style:{display:`flex`,gap:`8px`},children:[Qe(`installed`,`My Cards`,Ye.length),Qe(`bundled`,`Plugin Store (Bundled)`,Ze.length),Qe(`mesh`,`On the mesh`)]}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,flexWrap:`wrap`},children:[(0,R.jsx)(`input`,{className:`input`,placeholder:`Search plugins`,value:h,onChange:e=>g(e.target.value),"aria-label":`Search plugins`,style:{width:`220px`}}),(0,R.jsxs)(`select`,{className:`select`,value:v,onChange:e=>y(e.target.value),"aria-label":`Filter by use case`,style:{paddingRight:`32px`},children:[(0,R.jsx)(`option`,{value:``,children:`All use cases`}),Me.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]})]})]}),r===`installed`&&(p?(0,R.jsx)(`div`,{style:OQ,children:`Loading…`}):(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`16px`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,flexWrap:`wrap`,gap:`12px`},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{style:{fontWeight:600,fontSize:`15px`},children:fe===`workspace`?`Active Workspace Cards`:`All Installed Plugins`}),(0,R.jsx)(`div`,{style:OQ,children:fe===`workspace`?`Core runtime foundation and activated repository cards. Optional tools live in the Plugin Store.`:`All plugin packages installed on this host.`})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`6px`},children:[(0,R.jsxs)(`button`,{type:`button`,className:`btn btn-xs ${fe===`workspace`?`btn-primary`:`btn-ghost`}`,onClick:()=>pe(`workspace`),children:[`Workspace (`,Ye.length,`)`]}),(0,R.jsxs)(`button`,{type:`button`,className:`btn btn-xs ${fe===`all`?`btn-primary`:`btn-ghost`}`,onClick:()=>pe(`all`),children:[`All Installed (`,a.length,`)`]})]})]}),Xe.length===0?(0,R.jsx)(LQ,{title:fe===`workspace`?`No workspace cards active`:`No plugins installed`,children:fe===`workspace`?(0,R.jsxs)(R.Fragment,{children:[`Explore the `,(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>i(`bundled`),children:`Plugin Store`}),` to add capabilities or ask your agent to author one.`]}):(0,R.jsxs)(R.Fragment,{children:[`Start with a `,(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>i(`bundled`),children:`bundled plugin`}),` or see what your peers share.`]})}):(0,R.jsx)(`div`,{className:`card-grid`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(min(100%, 360px), 1fr))`,gap:`22px`},children:Xe.map(e=>(0,R.jsxs)(`div`,{onContextMenu:t=>ke(e,t),onTouchStart:t=>De(e,t),onTouchEnd:Oe,style:{display:`flex`,flexDirection:`column`,gap:`8px`},children:[(0,R.jsx)(TQ,{plugin:e}),(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`0 4px`,fontSize:`11px`,color:`var(--text-tertiary)`,flexWrap:`wrap`,gap:`6px`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`6px`,alignItems:`center`,flexWrap:`wrap`},children:[(0,R.jsx)(`span`,{className:`badge`,children:e.scope}),(0,R.jsx)(`span`,{className:`badge`,children:PQ(e)}),e.shared&&(0,R.jsx)(`span`,{className:`badge badge-accent`,children:`shared`}),!e.valid&&(0,R.jsx)(`span`,{className:`badge badge-error`,children:`invalid manifest`}),e.modified_since_install&&(0,R.jsx)(`span`,{className:`badge badge-warning`,children:`changed since install`})]}),!kQ.has(e.id)&&(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-xs`,onClick:()=>Ie(e),style:{fontSize:`11px`,color:`var(--text-secondary)`},title:`Move back to Plugin Store`,children:`Remove from Workspace`})]})]},`${e.scope}:${e.id}`))})]})),r===`bundled`&&(p?(0,R.jsx)(`div`,{style:OQ,children:`Loading…`}):(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`20px`},children:[(0,R.jsx)(`div`,{className:`card`,style:{background:`linear-gradient(135deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.85) 100%)`,border:`1px solid rgba(99, 102, 241, 0.3)`,padding:`20px`,display:`flex`,flexDirection:`column`,gap:`14px`},children:(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,gap:`16px`,flexWrap:`wrap`},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,marginBottom:`4px`},children:[(0,R.jsx)(`span`,{className:`badge`,style:{background:`rgba(99, 102, 241, 0.2)`,color:`#818cf8`,borderColor:`rgba(99, 102, 241, 0.4)`,fontSize:`11px`},children:`AGENT RECIPE ARCHITECTURE`}),(0,R.jsx)(`span`,{style:{fontSize:`11px`,color:`var(--text-tertiary)`},children:`Declarative Recipes · Private or Store`})]}),(0,R.jsx)(`h2`,{style:{fontSize:`18px`,fontWeight:700,margin:0,color:`#f8fafc`},children:`Build Bespoke Plugins with Your Coding Agent`}),(0,R.jsx)(`p`,{style:{...OQ,margin:`6px 0 0 0`,maxWidth:`640px`},children:`Total Recall plugins are not generated by closed system templates; your contextual coding agent (Antigravity, Claude, Codex, DSH) builds them from a declarative Recipe. Run them privately in your workspace or publish them to the Plugin Store.`})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,flexWrap:`wrap`},children:[(0,R.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,onClick:()=>de(!0),children:`View Agent Recipe`}),(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:Le,children:`Copy Agent Prompt`}),(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>{T(!0),C(null)},children:`Install from source…`})]})]})}),Ze.length===0?(0,R.jsx)(LQ,{title:`No plugins match in store`}):(0,R.jsx)(`div`,{className:`card-grid`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(min(100%, 340px), 1fr))`,gap:`16px`},children:Ze.map(e=>{let t=jQ(e);return(0,R.jsxs)(`div`,{className:`card`,style:{display:`flex`,flexDirection:`column`,gap:`10px`,borderTop:`3px solid ${t.color}`,background:`var(--bg-secondary)`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,gap:`8px`,alignItems:`flex-start`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`10px`,alignItems:`center`},children:[(0,R.jsx)(`div`,{style:{width:`34px`,height:`34px`,borderRadius:`8px`,background:`${t.color}20`,border:`1px solid ${t.color}40`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontWeight:700,fontSize:`12px`,color:t.color},children:t.icon||e.name.slice(0,2).toUpperCase()}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{style:{fontWeight:600,fontSize:`14px`,lineHeight:1.2},children:e.name}),(0,R.jsxs)(`div`,{style:{...DQ,color:`var(--text-tertiary)`,fontSize:`11px`},children:[e.id,` · v`,e.version]})]})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`flex-end`,gap:`4px`},children:[(0,R.jsx)(`span`,{className:`badge`,style:{background:`${t.color}15`,color:t.color,borderColor:`${t.color}35`,fontSize:`10px`},children:t.badge}),e.inWorkspace&&(0,R.jsx)(`span`,{className:`badge badge-success`,style:{fontSize:`10px`},children:`✓ In Workspace`})]})]}),(0,R.jsx)(`div`,{style:{...OQ,fontSize:`12px`,minHeight:`36px`},children:e.description}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`4px`,flexWrap:`wrap`,fontSize:`10px`},children:[e.cli&&(0,R.jsxs)(`span`,{className:`badge`,style:{fontFamily:`var(--font-mono)`},children:[`CLI (`,e.cli.subcommands?.length||1,`)`]}),e.tasks&&e.tasks.length>0&&(0,R.jsxs)(`span`,{className:`badge`,style:{fontFamily:`var(--font-mono)`},children:[e.tasks.length,` `,e.tasks.length===1?`task`:`tasks`]}),e.secrets&&e.secrets.length>0&&(0,R.jsxs)(`span`,{className:`badge`,style:{fontFamily:`var(--font-mono)`},children:[e.secrets.length,` `,e.secrets.length===1?`secret`:`secrets`]}),kQ.has(e.id)&&(0,R.jsx)(`span`,{className:`badge`,style:{background:`rgba(59, 130, 246, 0.15)`,color:`#60a5fa`},children:`Core Bundle`})]}),(0,R.jsx)(FQ,{useCases:e.use_cases}),(0,R.jsxs)(`div`,{style:{marginTop:`auto`,display:`flex`,justifyContent:`space-between`,alignItems:`center`,gap:`8px`,paddingTop:`8px`,borderTop:`1px solid var(--border)`},children:[(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>{e.sourcePlugin?Ge(e.sourcePlugin,`preview`):Ge({id:e.id,name:e.name,version:e.version,description:e.description,author:null,license:null,homepage:null,use_cases:e.use_cases,valid:!0,errors:[],scope:`global`,linked:!1,dir:``,shared:!1,mesh_shared:!1,share_url:null,source:{kind:`bundled`,ref:e.id},installed_at:null,sha256:null,installed_sha256:null,modified_since_install:!1,file_count:null,size_bytes:null,categories:[],tasks:e.tasks||[],openwiki_hubs:[],cli:e.cli,has_generator:!1,branding:e.branding},`preview`)},children:`Preview`}),(0,R.jsx)(`div`,{style:{display:`flex`,gap:`6px`},children:e.installed?e.inWorkspace?(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,disabled:b===e.id,onClick:()=>Ie(e.sourcePlugin||e),style:{fontSize:`11px`},children:`Remove from Workspace`}):(0,R.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,disabled:b===e.id,onClick:()=>Fe(e.sourcePlugin||e),children:b===e.id?`Adding…`:`+ Add to Workspace`}):(0,R.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,disabled:b===e.id,onClick:()=>Re(e.id),children:b===e.id?`Installing…`:`Install`})})]})]},e.id)})})]})),r===`mesh`&&(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`16px`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,gap:`12px`,flexWrap:`wrap`},children:[(0,R.jsx)(`p`,{style:{...OQ,margin:0},children:`Asked live from each node. Only plugins their owner chose to share appear here; content is hash-checked on install.`}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:je,disabled:d,children:d?`Asking peers…`:`Refresh`})]}),d&&!l?(0,R.jsx)(`div`,{style:OQ,children:`Asking peers…`}):l===null?(0,R.jsx)(LQ,{title:`Could not ask the mesh`,children:`The brain server did not answer the peer query.`}):l.mesh.available?l.peers.length===0?(0,R.jsx)(LQ,{title:`No other nodes on the mesh`}):(0,R.jsxs)(R.Fragment,{children:[!l.mesh.configured&&(0,R.jsxs)(`div`,{className:`alert alert-warning`,children:[`This node has no `,(0,R.jsx)(`code`,{style:DQ,children:`TR_MESH_SYNC_TOKEN`}),`, so it cannot query peers. Set the same token on each node.`]}),l.peers.map(e=>{let t=e.plugins.filter(Ne);return(0,R.jsxs)(`div`,{className:`card`,children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,gap:`12px`,alignItems:`center`,marginBottom:e.plugins.length?`12px`:0,flexWrap:`wrap`},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{style:{fontWeight:600},children:e.hostname}),` `,(0,R.jsx)(`span`,{style:{...DQ,color:`var(--text-tertiary)`},children:e.ip})]}),(0,R.jsxs)(`span`,{className:`badge ${e.status===`ok`?`badge-online`:e.status===`offline`?`badge-offline`:`badge-warning`}`,children:[EQ[e.status],e.status===`ok`?` · ${e.plugins.length} shared`:``]})]}),e.error&&e.status!==`ok`&&(0,R.jsx)(`div`,{style:{...OQ,fontSize:`12px`},children:e.error}),e.status===`ok`&&e.plugins.length===0&&(0,R.jsx)(`div`,{style:OQ,children:`Shares no plugins.`}),e.status===`ok`&&e.plugins.length>0&&t.length===0&&(0,R.jsx)(`div`,{style:OQ,children:`No shared plugins match the filter.`}),t.map(t=>{let n=`peer:${e.hostname}/${t.id}`;return(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,gap:`16px`,padding:`12px 0`,borderTop:`1px solid var(--border)`,flexWrap:`wrap`},children:[(0,R.jsxs)(`div`,{style:{minWidth:0,flex:`1 1 320px`,display:`flex`,flexDirection:`column`,gap:`6px`},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{style:{fontWeight:600},children:t.name}),` `,(0,R.jsxs)(`span`,{style:{...DQ,color:`var(--text-tertiary)`},children:[`v`,t.version]})]}),(0,R.jsx)(`div`,{style:OQ,children:t.description}),(0,R.jsx)(FQ,{useCases:t.use_cases}),(0,R.jsxs)(`div`,{style:{...DQ,color:`var(--text-tertiary)`},title:t.sha256,children:[`sha256 `,MQ(t.sha256),` · `,t.file_count,` files · `,NQ(t.size_bytes)]})]}),(0,R.jsx)(`div`,{style:{alignSelf:`center`},children:t.installed?(0,R.jsx)(`span`,{className:`badge ${t.same_as_installed?`badge-success`:`badge-warning`}`,children:t.same_as_installed?`installed (same content)`:`installed (different content)`}):(0,R.jsx)(`button`,{className:`btn btn-primary btn-sm`,disabled:b===n,onClick:()=>Re(n),children:b===n?`Installing…`:`Install`})})]},t.id)})]},e.hostname)})]}):(0,R.jsxs)(LQ,{title:`This node is not on a mesh`,children:[`Enroll it with `,(0,R.jsx)(`code`,{style:DQ,children:`npx total-recall mesh enroll`}),` to share plugins between your nodes.`]})]}),w&&(0,R.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Install plugin from source`,onClick:()=>T(!1),style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.6)`,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:1e3,padding:`16px`},children:(0,R.jsxs)(`form`,{className:`card`,onClick:e=>e.stopPropagation(),style:{width:`100%`,maxWidth:`520px`,display:`flex`,flexDirection:`column`,gap:`14px`},onSubmit:async e=>{e.preventDefault(),E.trim()&&await Re(E.trim(),{link:O,global:k})&&(T(!1),D(``))},children:[(0,R.jsx)(`div`,{style:{fontWeight:600,fontSize:`16px`},children:`Install from source`}),(0,R.jsxs)(`div`,{style:OQ,children:[`A bundled plugin id, `,(0,R.jsx)(`code`,{style:DQ,children:`peer:<host>/<id>`}),`, a git URL, or a folder on this machine containing `,(0,R.jsx)(`code`,{style:DQ,children:`plugin.json`}),`.`]}),(0,R.jsx)(`input`,{className:`input`,autoFocus:!0,value:E,onChange:e=>D(e.target.value),placeholder:`https://github.com/you/my-plugin.git`,"aria-label":`Plugin source`}),(0,R.jsxs)(`label`,{style:{...OQ,display:`flex`,gap:`8px`,alignItems:`center`},children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:O,onChange:e=>ee(e.target.checked)}),`Link a local folder instead of copying it (for plugin development)`]}),(0,R.jsxs)(`label`,{style:{...OQ,display:`flex`,gap:`8px`,alignItems:`center`},children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:k,onChange:e=>te(e.target.checked)}),`Install for every project on this machine`]}),(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:`8px`},children:[(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,onClick:()=>T(!1),children:`Cancel`}),(0,R.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,disabled:!E.trim()||b!==null,children:b?`Installing…`:`Install`})]})]})}),ge&&ve&&(0,R.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Customize Plugin Branding`,onClick:()=>_e(!1),style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.6)`,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:1e3,padding:`16px`},children:(0,R.jsxs)(`div`,{className:`card`,onClick:e=>e.stopPropagation(),style:{width:`100%`,maxWidth:`480px`,display:`flex`,flexDirection:`column`,gap:`16px`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,R.jsxs)(`div`,{style:{fontWeight:700,fontSize:`16px`},children:[`Customize Branding: `,ve.name]}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>_e(!1),children:`✕`})]}),ve.locked&&(0,R.jsx)(`div`,{className:`alert alert-warning`,style:{fontSize:`12px`},children:`[LOCKED] This plugin is marked complete and locked against editing. Unlock it to change branding.`}),(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`6px`},children:[(0,R.jsx)(`label`,{style:{fontSize:`12px`,color:`var(--text-secondary)`},children:`Wordmark Glyph / Tag`}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`8px`},children:[(0,R.jsx)(`input`,{className:`input`,value:be,onChange:e=>xe(e.target.value),style:{width:`90px`,textAlign:`center`,fontSize:`14px`,fontFamily:`var(--font-mono)`},disabled:ve.locked}),(0,R.jsx)(`div`,{style:{display:`flex`,gap:`4px`,flexWrap:`wrap`,alignItems:`center`},children:[`[TEL]`,`[DNS]`,`[SIGN]`,`[GATE]`,`[CLI]`,`[LAW]`,`[UI]`,`[SMS]`,`[FIND]`,`[GIT]`,`[OPS]`,`[WARN]`,`[CORE]`].map(e=>(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,style:{padding:`4px 6px`,fontSize:`11px`,fontFamily:`var(--font-mono)`},disabled:ve.locked,onClick:()=>xe(e),children:e},e))})]})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`6px`},children:[(0,R.jsx)(`label`,{style:{fontSize:`12px`,color:`var(--text-secondary)`},children:`Theme Color (Hex)`}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,alignItems:`center`},children:[(0,R.jsx)(`input`,{type:`color`,value:Se,onChange:e=>Ce(e.target.value),style:{width:`42px`,height:`38px`,border:`none`,cursor:`pointer`,background:`none`},disabled:ve.locked}),(0,R.jsx)(`input`,{className:`input`,value:Se,onChange:e=>Ce(e.target.value),style:{flex:1,fontFamily:`var(--font-mono)`},disabled:ve.locked})]})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`6px`},children:[(0,R.jsx)(`label`,{style:{fontSize:`12px`,color:`var(--text-secondary)`},children:`Domain Badge Text`}),(0,R.jsx)(`input`,{className:`input`,value:P,onChange:e=>we(e.target.value),placeholder:`e.g. Telephony, Quality, DNS`,disabled:ve.locked})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:`8px`,marginTop:`8px`},children:[(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,onClick:()=>_e(!1),children:`Cancel`}),(0,R.jsx)(`button`,{type:`button`,className:`btn btn-primary`,onClick:We,disabled:ve.locked||b!==null,children:`Save Branding`})]})]})}),ue&&(0,R.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Agent Plugin Recipe`,onClick:()=>de(!1),style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.65)`,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:1e3,padding:`16px`},children:(0,R.jsxs)(`div`,{className:`card`,onClick:e=>e.stopPropagation(),style:{width:`100%`,maxWidth:`680px`,maxHeight:`90vh`,overflowY:`auto`,display:`flex`,flexDirection:`column`,gap:`16px`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{style:{margin:0,fontSize:`17px`,fontWeight:700},children:`Agent Plugin Recipe`}),(0,R.jsx)(`div`,{style:{...OQ,fontSize:`12px`},children:`How your coding agent authors private or store plugins`})]}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>de(!1),children:`✕`})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`12px`,fontSize:`13px`},children:[(0,R.jsxs)(`div`,{style:{background:`var(--bg-tertiary)`,padding:`12px`,borderRadius:`8px`,border:`1px solid var(--border)`},children:[(0,R.jsx)(`div`,{style:{fontWeight:600,marginBottom:`4px`},children:`1. Command your agent`}),(0,R.jsx)(`div`,{style:OQ,children:`Copy and send this instruction to your coding agent (Antigravity, Claude, Codex, DSH):`}),(0,R.jsx)(`pre`,{style:{...DQ,background:`rgba(0,0,0,0.4)`,padding:`10px`,borderRadius:`6px`,marginTop:`8px`,whiteSpace:`pre-wrap`,overflowX:`auto`,fontSize:`11px`,color:`#a5b4fc`},children:AQ}),(0,R.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginTop:`8px`},children:(0,R.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,onClick:()=>Le(),children:`Copy Agent Prompt`})})]}),(0,R.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`12px`},children:[(0,R.jsxs)(`div`,{style:{background:`var(--bg-tertiary)`,padding:`12px`,borderRadius:`8px`,border:`1px solid var(--border)`},children:[(0,R.jsx)(`div`,{style:{fontWeight:600,color:`#38bdf8`,marginBottom:`4px`},children:`🔒 Private Plugins`}),(0,R.jsxs)(`div`,{style:{...OQ,fontSize:`12px`,lineHeight:1.4},children:[`Store directly inside `,(0,R.jsx)(`code`,{style:DQ,children:`.agent/skills/total-recall/plugins/<id>`}),` or link locally. Never shared outside this machine or project. Zero cloud exposure.`]})]}),(0,R.jsxs)(`div`,{style:{background:`var(--bg-tertiary)`,padding:`12px`,borderRadius:`8px`,border:`1px solid var(--border)`},children:[(0,R.jsx)(`div`,{style:{fontWeight:600,color:`#a855f7`,marginBottom:`4px`},children:`🌐 Plugin Store Distribution`}),(0,R.jsxs)(`div`,{style:{...OQ,fontSize:`12px`,lineHeight:1.4},children:[`Deploy to the store via `,(0,R.jsx)(`code`,{style:DQ,children:`total-recall deploy-store <id>`}),`. Cryptographically signed and distributed across the mesh for team consumption.`]})]})]}),(0,R.jsxs)(`div`,{style:{background:`rgba(16, 185, 129, 0.08)`,padding:`12px`,borderRadius:`8px`,border:`1px solid rgba(16, 185, 129, 0.2)`},children:[(0,R.jsx)(`div`,{style:{fontWeight:600,color:`#10b981`,marginBottom:`4px`},children:`Quality Invariants Enforced`}),(0,R.jsxs)(`ul`,{style:{margin:`4px 0 0 16px`,padding:0,fontSize:`12px`,color:`var(--text-secondary)`},children:[(0,R.jsx)(`li`,{children:`Guaranteed Title, Brand Glyph, Version, and Settings drawer trigger on every card`}),(0,R.jsx)(`li`,{children:`Authentic domain tools only — zero fake audio equalizers or fake skins`}),(0,R.jsx)(`li`,{children:`Touch-first ergonomics with minimum 44px tap targets`})]})]})]}),(0,R.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginTop:`8px`},children:(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,onClick:()=>de(!1),children:`Close`})})]})}),A&&(0,R.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":A.name,onClick:Ke,style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.6)`,display:`flex`,justifyContent:`flex-end`,zIndex:1e3},children:(0,R.jsx)(`div`,{onClick:e=>e.stopPropagation(),style:{width:`100%`,maxWidth:`680px`,height:`100%`,overflowY:`auto`,background:`var(--bg-secondary)`,borderLeft:`1px solid var(--border)`,padding:`24px`,display:`flex`,flexDirection:`column`,gap:`16px`},children:(()=>{let e=jQ(A),t=OZ(A).length>0;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,gap:`12px`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`12px`,alignItems:`center`},children:[(0,R.jsx)(`div`,{style:{width:`44px`,height:`44px`,borderRadius:`10px`,background:`${e.color}20`,border:`1px solid ${e.color}50`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:`22px`,flexShrink:0},children:e.icon}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{style:{fontSize:`18px`,fontWeight:700},children:A.name}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,alignItems:`center`,marginTop:`2px`},children:[(0,R.jsxs)(`span`,{style:{...DQ,color:`var(--text-tertiary)`},children:[A.id,` · v`,A.version]}),(0,R.jsx)(`span`,{className:`badge`,style:{background:`${e.color}15`,color:e.color,borderColor:`${e.color}40`,fontSize:`11px`},children:e.badge}),A.locked&&(0,R.jsx)(`span`,{className:`badge`,style:{background:`#2e1065`,color:`#c084fc`},children:`Locked`})]})]})]}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:Ke,"aria-label":`Close`,children:`Close`})]}),(0,R.jsx)(`div`,{style:OQ,children:A.description}),!A.valid&&(0,R.jsx)(`div`,{className:`alert alert-error`,children:A.errors.map(e=>(0,R.jsx)(`div`,{children:e},e))}),(0,R.jsxs)(`div`,{role:`tablist`,style:{display:`flex`,gap:`8px`,borderBottom:`1px solid var(--border)`,paddingBottom:`10px`},children:[t&&(0,R.jsxs)(`button`,{role:`tab`,"aria-selected":M===`preview`,className:`btn btn-sm ${M===`preview`?`btn-primary`:`btn-ghost`}`,onClick:()=>ne(`preview`),children:[`Open `,A.name]}),A.cli&&(0,R.jsx)(`button`,{role:`tab`,"aria-selected":M===`run`,className:`btn btn-sm ${M===`run`?`btn-primary`:`btn-ghost`}`,onClick:()=>ne(`run`),children:`Run CLI`}),(0,R.jsx)(`button`,{role:`tab`,"aria-selected":M===`details`,className:`btn btn-sm ${M===`details`?`btn-primary`:`btn-ghost`}`,onClick:()=>ne(`details`),children:`Settings`}),(0,R.jsx)(`button`,{role:`tab`,"aria-selected":M===`readme`,className:`btn btn-sm ${M===`readme`?`btn-primary`:`btn-ghost`}`,onClick:()=>ne(`readme`),children:`README`})]}),M===`preview`&&(0,R.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`12px`},children:(0,R.jsx)(kZ,{plugin:A})}),M===`run`&&A.cli&&(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`10px`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,flexWrap:`wrap`},children:[(0,R.jsx)(`select`,{className:`select`,value:N,onChange:e=>re(e.target.value),"aria-label":`Subcommand`,style:{paddingRight:`32px`},children:(A.cli.subcommands.length?A.cli.subcommands:[{name:``}]).map(e=>(0,R.jsx)(`option`,{value:e.name,children:e.name||`(default)`},e.name))}),(0,R.jsx)(`input`,{className:`input`,value:ie,onChange:e=>ae(e.target.value),placeholder:`extra arguments`,"aria-label":`Arguments`,style:{flex:1,minWidth:`160px`}}),(0,R.jsx)(`button`,{className:`btn btn-primary`,onClick:qe,disabled:b===`run:${A.id}`||!A.valid,children:b===`run:${A.id}`?`Running…`:`Run`})]}),(0,R.jsxs)(`div`,{style:{...OQ,fontSize:`12px`},children:[A.cli.subcommands.find(e=>e.name===N)?.description,` `,`Same as `,(0,R.jsxs)(`code`,{style:DQ,children:[`npx total-recall `,A.cli.command,` `,N,` `,ie]}),`. Runs in a separate process.`]}),oe&&(0,R.jsx)(`pre`,{style:{...DQ,margin:0,padding:`14px`,borderRadius:`var(--radius-sm)`,background:`var(--bg-primary)`,border:`1px solid ${oe.ok?`var(--border)`:`var(--error)`}`,whiteSpace:`pre-wrap`,maxHeight:`420px`,overflow:`auto`},children:oe.text})]}),M===`details`&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(AZ,{plugin:A}),(0,R.jsxs)(IQ,{label:`Scope`,children:[A.scope,A.linked?` (linked folder)`:``]}),(0,R.jsxs)(IQ,{label:`Source`,children:[PQ(A),` — `,(0,R.jsx)(`span`,{style:DQ,children:A.source.ref})]}),(0,R.jsx)(IQ,{label:`Installed`,children:A.installed_at?new Date(A.installed_at).toLocaleString():`no install record`}),(0,R.jsx)(IQ,{label:`Content sha256`,children:(0,R.jsx)(`span`,{style:DQ,children:A.sha256||`—`})}),A.modified_since_install&&(0,R.jsx)(IQ,{label:`At install`,children:(0,R.jsx)(`span`,{style:DQ,children:A.installed_sha256})}),(0,R.jsxs)(IQ,{label:`Files`,children:[A.file_count??`—`,` · `,NQ(A.size_bytes)]}),(0,R.jsx)(IQ,{label:`Shared`,children:A.shared?`yes`:`no`}),(0,R.jsx)(IQ,{label:`Lock Status`,children:A.locked?`Locked (Completed)`:`Unlocked (Editable)`}),(0,R.jsx)(IQ,{label:`Store Status`,children:A.store_deployed?`Published in Plugin Store`:`Not yet deployed to store`}),A.shared&&(0,R.jsx)(IQ,{label:`Public link`,children:A.share_url?(0,R.jsx)(`input`,{className:`input`,"aria-label":`Public plugin share link`,readOnly:!0,value:A.share_url,onFocus:e=>e.currentTarget.select()}):`Set TR_PUBLIC_BASE_URL to your public HTTPS origin to create a link.`}),(0,R.jsx)(IQ,{label:`Use cases`,children:A.use_cases.join(`, `)||`—`}),A.author&&(0,R.jsx)(IQ,{label:`Author`,children:A.author}),A.license&&(0,R.jsx)(IQ,{label:`License`,children:A.license}),(0,R.jsx)(IQ,{label:`Location`,children:(0,R.jsx)(`span`,{style:DQ,children:A.dir})}),(0,R.jsx)(IQ,{label:`Agent context`,children:A.has_generator?`adds a block to compiled instructions`:`—`}),(0,R.jsx)(IQ,{label:`Memory categories`,children:A.categories.length?A.categories.map(e=>e.name).join(`, `):`—`}),(0,R.jsx)(IQ,{label:`Scheduled tasks`,children:A.tasks.length===0?`—`:(0,R.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`6px`},children:A.tasks.map(e=>(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{style:DQ,children:e.schedule}),` `,e.command,` — `,e.intent,(0,R.jsxs)(`div`,{style:{color:`var(--text-tertiary)`,fontSize:`12px`},children:[`last run: `,e.last_run||`not yet`]})]},e.command))})}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,marginTop:`16px`,flexWrap:`wrap`},children:[(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>Ue(A),disabled:A.locked,children:`Customize Branding`}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>Ve(A),disabled:b===A.id,children:A.locked?`Unlock Editing`:`Lock When Complete`}),(0,R.jsx)(`button`,{className:`btn btn-primary btn-sm`,onClick:()=>He(A),disabled:b===A.id||!A.valid,children:A.store_deployed?`✓ Deployed to Store`:`Deploy to Plugin Store`}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,disabled:b===A.id||!A.valid&&!A.shared,onClick:()=>Be(A,!A.shared),children:A.shared?`Stop sharing`:`Share`}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,disabled:b===A.id,onClick:()=>ze(A),children:`Remove`})]})]}),M===`readme`&&(0,R.jsx)(`div`,{style:{fontSize:`14px`,lineHeight:1.6},children:ce?$X(ce):(0,R.jsx)(`span`,{style:OQ,children:`Loading…`})})]})})()})}),Te&&(0,R.jsxs)(`div`,{role:`menu`,"aria-label":`Plugin actions menu`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),style:{position:`fixed`,left:Math.max(12,Math.min(Te.x,window.innerWidth-264)),top:Math.max(12,Math.min(Te.y,window.innerHeight-380)),zIndex:2e3,width:`250px`,background:`var(--bg-secondary)`,border:`1px solid var(--border)`,borderRadius:`10px`,boxShadow:`0 12px 36px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.08)`,padding:`6px`,display:`flex`,flexDirection:`column`,gap:`2px`,backdropFilter:`blur(12px)`},children:[(0,R.jsxs)(`div`,{style:{padding:`8px 10px`,borderBottom:`1px solid var(--border)`,display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,R.jsx)(`div`,{style:{width:`8px`,height:`8px`,borderRadius:`50%`,background:jQ(Te.plugin).color}}),(0,R.jsxs)(`div`,{style:{minWidth:0},children:[(0,R.jsx)(`div`,{style:{fontWeight:600,fontSize:`13px`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:Te.plugin.name}),(0,R.jsxs)(`div`,{style:{...DQ,fontSize:`10px`,color:`var(--text-tertiary)`},children:[Te.plugin.id,` · v`,Te.plugin.version]})]})]}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,style:{justifyContent:`flex-start`,width:`100%`,padding:`8px 10px`,fontSize:`12px`,minHeight:`36px`},onClick:()=>{let e=Te.plugin;Ee(null),Ge(e,`preview`)},children:`Open UI Component`}),(0,R.jsxs)(`button`,{className:`btn btn-ghost btn-sm`,style:{justifyContent:`flex-start`,width:`100%`,padding:`8px 10px`,fontSize:`12px`,minHeight:`36px`},onClick:()=>{let e=Te.plugin;Ee(null),Ge(e,`run`)},children:[`Run CLI (`,Te.plugin.cli?.command||Te.plugin.id,`)`]}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,style:{justifyContent:`flex-start`,width:`100%`,padding:`8px 10px`,fontSize:`12px`,minHeight:`36px`},onClick:()=>{let e=Te.plugin;Ee(null),Ge(e,`details`)},children:`Configure & Settings`}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,style:{justifyContent:`flex-start`,width:`100%`,padding:`8px 10px`,fontSize:`12px`,minHeight:`36px`},onClick:()=>{let e=Te.plugin;Ee(null),Ge(e,`readme`)},children:`View Documentation`}),(0,R.jsx)(`div`,{style:{height:`1px`,background:`var(--border)`,margin:`4px 0`}}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,style:{justifyContent:`flex-start`,width:`100%`,padding:`8px 10px`,fontSize:`12px`,minHeight:`36px`},onClick:()=>{let e=Te.plugin;Ee(null),Be(e,!e.shared)},children:Te.plugin.shared?`Stop sharing on mesh`:`Share on mesh & link`}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,style:{justifyContent:`flex-start`,width:`100%`,padding:`8px 10px`,fontSize:`12px`,minHeight:`36px`},onClick:()=>{let e=Te.plugin;Ee(null),Ve(e)},children:Te.plugin.locked?`Unlock editing`:`Lock for release`}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,style:{justifyContent:`flex-start`,width:`100%`,padding:`8px 10px`,fontSize:`12px`,minHeight:`36px`},onClick:()=>{let e=Te.plugin;Ee(null),navigator.clipboard?.writeText(`npx total-recall ${e.cli?.command||e.id}`),C({type:`success`,message:`Copied "npx total-recall ${e.cli?.command||e.id}" to clipboard`})},children:`Copy CLI command`}),(0,R.jsx)(`div`,{style:{height:`1px`,background:`var(--border)`,margin:`4px 0`}}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,style:{justifyContent:`flex-start`,width:`100%`,padding:`8px 10px`,fontSize:`12px`,color:`var(--color-error, #f87171)`,minHeight:`36px`},onClick:()=>{let e=Te.plugin;Ee(null),ze(e)},children:`Uninstall plugin`})]})]})}function zQ(){return localStorage.getItem(`tr-onboarding-complete`)===`1`}var BQ=`tr-onboarding-v1`,VQ=[{id:`welcome`,title:`Welcome to Total Recall`,body:`Portable personal memory for any IDE. Your rules and facts live as Markdown files on disk — not a locked vendor database.`},{id:`import-env`,title:`Import your API keys`,body:`Scan the machine for keys already in .env files or the shell, or paste a .env block. Nothing is written until you choose what to import.`},{id:`remember`,title:`Save your first memory`,body:`Write a fact or preference into the vault. This is the core write path: remember → compile → IDEs see it.`},{id:`connect`,title:`Connect an IDE`,body:`Wire Claude Code, Cursor, Codex, Gemini, Aider, Obsidian, or any HTTP host. Injected blocks never overwrite your local rules outside TR markers.`},{id:`dream`,title:`Dream consolidates memory`,body:`Dream is sleep for your vault: ingest sessions, conflict-check, recompile surfaces, prune. Run it anytime; no always-on LLM required.`},{id:`done`,title:`You're set`,body:`Default loop: init → connect → remember/recall → dream. Optional: task queue, skill track any repo, daemon in the background.`}];function HQ(){try{return JSON.parse(localStorage.getItem(BQ)||`{}`)}catch{return{step:0}}}function UQ(e){localStorage.setItem(BQ,JSON.stringify(e)),e.complete&&localStorage.setItem(`tr-onboarding-complete`,`1`)}function WQ(e){let t={};for(let n of e.split(/\r?\n/)){let e=n.trim();if(!e||e.startsWith(`#`))continue;let r=e.startsWith(`export `)?e.slice(7).trim():e,i=r.indexOf(`=`);if(i<=0)continue;let a=r.slice(0,i).trim(),o=r.slice(i+1).trim();o=o.startsWith(`"`)&&o.endsWith(`"`)||o.startsWith(`'`)&&o.endsWith(`'`)?o.slice(1,-1):o.replace(/\s+#.*$/,``).trim(),a&&o&&(t[a]=o)}return t}function GQ(){let e=ft(),t=HQ(),[n,r]=(0,_.useState)(t.step||0),[i,a]=(0,_.useState)(t.fact||``),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)([]),[m,h]=(0,_.useState)(new Set),[g,v]=(0,_.useState)(``),[y,b]=(0,_.useState)({}),[x,S]=(0,_.useState)(``),[C,w]=(0,_.useState)(!1),[T,E]=(0,_.useState)(`scan`),D=VQ[Math.min(n,VQ.length-1)];(0,_.useEffect)(()=>{or().then(e=>{let t=e||[],n=t.some(e=>e.slug===`user-profile`||e.slug===`onboarding-first-memory`||(e.tags||[]).includes(`onboarding`)),r=n||t.length>=5;d(n||r),r&&!zQ()&&localStorage.setItem(`tr-onboarding-complete`,`1`)}).catch(()=>{})},[]),(0,_.useEffect)(()=>{if(D.id!==`import-env`||T!==`scan`)return;let e=!1;return Promise.resolve().then(()=>{w(!0),S(``)}),kr().then(t=>{if(e)return;p(t.candidates||[]);let n=new Set((t.candidates||[]).filter(e=>!e.already_set).map(e=>e.key));h(n)}).catch(t=>{e||S(t instanceof Error?t.message:`Scan failed`)}).finally(()=>{e||w(!1)}),()=>{e=!0}},[D.id,T]);function O(){let e=Math.min(n+1,VQ.length-1);r(e),UQ({step:e,fact:i}),s(``)}function ee(){let e=Math.max(n-1,0);r(e),UQ({step:e,fact:i}),s(``)}function k(e){h(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function te(){h(new Set(f.filter(e=>!e.already_set).map(e=>e.key)))}function A(){h(new Set)}async function j(){if(!g.trim())s(`Paste a .env block first.`);else{l(!0),S(``);try{let e=WQ(g);b(e);let t=await Ar(g);p(t.candidates||[]),h(new Set((t.candidates||[]).filter(e=>!e.already_set).map(e=>e.key))),s(t.count?`Found ${t.count} importable key(s) in paste.`:`No known API key names in paste.`)}catch(e){S(e instanceof Error?e.message:`Parse failed`)}finally{l(!1)}}}async function M(){let e=[...m];if(!e.length)s(`Select at least one key, or skip this step.`);else{l(!0),s(``);try{let t=T===`paste`&&Object.keys(y).length?await jr({keys:e,pairs:y,overwrite:!1}):await jr({keys:e,overwrite:!1});if(s(`Imported ${t.imported_count} secret(s)`+(t.skipped_count?`, skipped ${t.skipped_count} already set`:``)+`.`),T===`scan`){let e=await kr();p(e.candidates||[]),h(new Set)}else p(e=>e.map(e=>t.imported.some(t=>t.key===e.key)?{...e,already_set:!0}:e)),h(new Set)}catch(e){s(e instanceof Error?e.message:`Import failed`)}finally{l(!1)}}}async function ne(){if(!i.trim())s(`Write a short fact or preference first.`);else{l(!0),s(``);try{await ur({slug:`onboarding-first-memory`,category:`preferences`,title:`Onboarding first memory`,content:i.trim(),tags:[`onboarding`],importance:4});try{await Rr()}catch{}s(`Saved and queued surface compile.`),UQ({step:n,fact:i}),O()}catch(e){s(e instanceof Error?e.message:`Failed to save memory`)}finally{l(!1)}}}function N(){UQ({step:VQ.length-1,fact:i,complete:!0}),e(`/memory`)}let re=Math.round((n+1)/VQ.length*100);return(0,R.jsxs)(`div`,{className:`onboarding-shell`,children:[D.id===`welcome`&&(0,R.jsx)(`div`,{style:{marginBottom:28,borderRadius:16,padding:`16px 20px`,background:`linear-gradient(180deg, #f8fafc 0%, #e8eef9 100%)`,boxShadow:`0 1px 0 rgba(255,255,255,0.7) inset, 0 16px 40px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(148,163,184,0.2)`,display:`flex`,justifyContent:`center`},children:(0,R.jsx)(Fi,{variant:`lockup`,height:64,alt:`Total Recall`})}),(0,R.jsxs)(`div`,{style:{marginBottom:28},children:[(0,R.jsxs)(`div`,{style:{fontSize:11,color:`var(--text-tertiary)`,marginBottom:10,letterSpacing:`0.08em`,textTransform:`uppercase`,fontWeight:600},children:[`Onboarding · `,n+1,`/`,VQ.length]}),(0,R.jsx)(`div`,{className:`onboarding-progress`,children:(0,R.jsx)(`div`,{style:{width:`${re}%`}})})]}),(0,R.jsx)(`h1`,{style:{fontSize:28,fontWeight:700,margin:`0 0 12px`,letterSpacing:`-0.03em`,background:`linear-gradient(135deg, #f8fafc 0%, #93c5fd 100%)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:D.title}),(0,R.jsx)(`p`,{style:{fontSize:15.5,lineHeight:1.6,color:`var(--text-secondary)`,margin:`0 0 28px`},children:D.body}),D.id===`welcome`&&(0,R.jsxs)(`div`,{className:`loop-card`,style:{marginBottom:24},children:[`write\xA0\xA0→ remember / session ingest`,(0,R.jsx)(`br`,{}),`sleep\xA0\xA0→ dream (consolidate, conflict, compile)`,(0,R.jsx)(`br`,{}),`read\xA0\xA0\xA0→ recall + compiled surfaces`,(0,R.jsx)(`br`,{}),`async\xA0\xA0→ daemon tasks (any intent under policy)`]}),D.id===`import-env`&&(0,R.jsxs)(`div`,{style:{marginBottom:24},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,gap:8,marginBottom:14},children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>E(`scan`),style:T===`scan`?ZQ:QQ,children:`Scan machine`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>{E(`paste`),p([]),h(new Set)},style:T===`paste`?ZQ:QQ,children:`Paste .env`})]}),T===`paste`&&(0,R.jsxs)(`div`,{style:{marginBottom:14},children:[(0,R.jsx)(`textarea`,{value:g,onChange:e=>v(e.target.value),placeholder:`OPENAI_API_KEY=sk-...
|
|
5621
|
+
- Store: publish via total-recall deploy-store <id>`;function yQ(e){let t=e.branding||{};return{icon:t.icon||``,color:t.color||`#3b82f6`,badge:t.badge||`Plugin`}}function bQ(e){return e?`${e.slice(0,12)}…`:`—`}function xQ(e){return e==null?`—`:e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function SQ(e){switch(e.source.kind){case`peer`:return`from ${e.source.peer_hostname||`a peer`}`;case`bundled`:return`bundled`;case`git`:return`git`;case`public`:return`direct link`;case`link`:return`linked folder`;default:return`local folder`}}function CQ({useCases:e}){return e.length?(0,R.jsx)(`div`,{style:{display:`flex`,gap:`6px`,flexWrap:`wrap`},children:e.map(e=>(0,R.jsx)(`span`,{className:`badge`,style:{fontSize:`11px`},children:e},e))}):null}function wQ({label:e,children:t}){return(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`12px`,fontSize:`13px`,padding:`6px 0`,borderBottom:`1px solid var(--border)`},children:[(0,R.jsx)(`span`,{style:{width:`132px`,flexShrink:0,color:`var(--text-tertiary)`},children:e}),(0,R.jsx)(`span`,{style:{color:`var(--text-primary)`,minWidth:0,overflowWrap:`anywhere`},children:t})]})}function TQ({title:e,children:t}){return(0,R.jsxs)(`div`,{className:`card`,style:{textAlign:`center`,padding:`40px 24px`},children:[(0,R.jsx)(`div`,{style:{fontWeight:600,marginBottom:`6px`},children:e}),t&&(0,R.jsx)(`div`,{style:gQ,children:t})]})}function EQ({activeBrainId:e}){let[t,n]=Mn(),[r,i]=(0,_.useState)(`installed`),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(!0),[h,g]=(0,_.useState)(``),[v,y]=(0,_.useState)(``),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(null),[w,T]=(0,_.useState)(!1),[E,D]=(0,_.useState)(``),[O,ee]=(0,_.useState)(!1),[k,te]=(0,_.useState)(!1),[A,j]=(0,_.useState)(null),[M,ne]=(0,_.useState)(`preview`),[N,re]=(0,_.useState)(``),[ie,ae]=(0,_.useState)(``),[oe,se]=(0,_.useState)(null),[ce,le]=(0,_.useState)(``),[ue,de]=(0,_.useState)(!1),[fe,pe]=(0,_.useState)(`workspace`),[me,he]=(0,_.useState)(()=>{try{let e=localStorage.getItem(`tr_workspace_plugins`);if(e)return new Set(JSON.parse(e))}catch{}return new Set}),[ge,_e]=(0,_.useState)(!1),[ve,ye]=(0,_.useState)(null),[be,xe]=(0,_.useState)(``),[Se,Ce]=(0,_.useState)(`#3b82f6`),[P,we]=(0,_.useState)(``),[Te,Ee]=(0,_.useState)(null),F=(0,_.useRef)(null),De=(e,t)=>{if(t.touches.length!==1)return;let n=t.touches[0],r=n.clientX,i=n.clientY;F.current=setTimeout(()=>{if(`vibrate`in navigator)try{navigator.vibrate(50)}catch{}Ee({plugin:e,x:r,y:i})},500)},Oe=()=>{F.current&&=(clearTimeout(F.current),null)},ke=(e,t)=>{t.preventDefault(),t.stopPropagation(),Ee({plugin:e,x:t.clientX,y:t.clientY})};(0,_.useEffect)(()=>{let e=()=>Ee(null);return window.addEventListener(`pointerdown`,e),()=>window.removeEventListener(`pointerdown`,e)},[]);let Ae=(0,_.useCallback)(async()=>{m(!0);try{let[e,t]=await Promise.all([ai(),si()]);o(e),c(t)}finally{m(!1)}},[]),je=(0,_.useCallback)(async()=>{f(!0);try{u(await ci())}finally{f(!1)}},[]);(0,_.useEffect)(()=>{Ae()},[Ae,e]),(0,_.useEffect)(()=>{r===`mesh`&&l===null&&!d&&je()},[r,l,d,je]);let Me=(0,_.useMemo)(()=>{let e=new Set;for(let t of a)t.use_cases.forEach(t=>e.add(t));for(let t of s)t.use_cases.forEach(t=>e.add(t));for(let t of l?.peers||[])t.plugins.forEach(t=>t.use_cases.forEach(t=>e.add(t)));return Array.from(e).sort()},[a,s,l]),Ne=(0,_.useCallback)(e=>{if(v&&!e.use_cases.includes(v))return!1;let t=h.trim().toLowerCase();return!t||[e.id,e.name,e.description,...e.use_cases].some(e=>e.toLowerCase().includes(t))},[h,v]),Pe=(0,_.useCallback)(e=>!!(e.scope===`project`||_Q.has(e.id)||me.has(e.id)),[me]),Fe=async e=>{x(e.id);try{let t=new Set(me);t.add(e.id),he(t);try{localStorage.setItem(`tr_workspace_plugins`,JSON.stringify([...t]))}catch{}await mi(e.id,!0),C({type:`success`,message:`Added ${e.name} to workspace dashboard`}),await Ae()}catch(t){C({type:`error`,message:t?.message||`Could not activate ${e.name}`})}finally{x(null)}},Ie=async e=>{x(e.id);try{let t=new Set(me);t.delete(e.id),he(t);try{localStorage.setItem(`tr_workspace_plugins`,JSON.stringify([...t]))}catch{}await mi(e.id,!1),C({type:`success`,message:`Moved ${e.name} from workspace to Plugin Store`}),await Ae()}catch(t){C({type:`error`,message:t?.message||`Could not deactivate ${e.name}`})}finally{x(null)}},Le=()=>{navigator.clipboard?.writeText(vQ),C({type:`success`,message:`Copied Agent Plugin Recipe prompt to clipboard`})},Re=async(e,t={})=>{x(e),C(null);let n=await li({source:e,...t});return x(null),n.success?(C({type:`success`,message:n.message||`Installed ${e}`}),await Ae(),l&&je(),!0):(C({type:`error`,message:n.error||`Could not install ${e}`}),!1)},ze=async e=>{if(!window.confirm(`Remove "${e.name}" (${e.scope})?`))return;x(e.id);let t=await ui(e.id,e.scope===`global`);x(null),C(t.success?{type:`success`,message:`Removed ${e.name}`}:{type:`error`,message:t.error||`Remove failed`}),t.success&&(A?.id===e.id&&Ke(),Ae())},Be=async(e,t)=>{x(e.id);let n=await di(e.id,t);x(null),n.success?(n.plugin&&A?.id===e.id&&j(n.plugin),C({type:`success`,message:t?`${e.name} is shared. Its public link is in the details.`:`${e.name} is no longer shared`}),Ae()):C({type:`error`,message:n.error||`Could not change sharing`})},Ve=async e=>{x(e.id);let t=!e.locked,n=await pi(e.id,t);x(null),n.success?(n.plugin&&A?.id===e.id&&j(n.plugin),C({type:`success`,message:t?`${e.name} is locked against further editing.`:`${e.name} is unlocked for editing.`}),Ae()):C({type:`error`,message:n.error||`Could not update lock status`})},He=async e=>{x(e.id);let t=await hi(e.id,!0);x(null),t.success?(t.plugin&&A?.id===e.id&&j(t.plugin),C({type:`success`,message:`${e.name} deployed to the plugin store and locked as complete.`}),Ae()):C({type:`error`,message:t.error||`Could not deploy plugin to store`})},Ue=e=>{let t=yQ(e);ye(e),xe(t.icon),Ce(t.color),we(t.badge),_e(!0)},We=async()=>{if(!ve)return;if(ve.locked){C({type:`error`,message:`Plugin is locked. Unlock it before editing branding.`}),_e(!1);return}x(ve.id);let e=await fi(ve.id,{icon:be.trim()||void 0,color:Se.trim()||void 0,badge:P.trim()||void 0});x(null),_e(!1),e.success?(C({type:`success`,message:`Updated branding for ${ve.name}`}),await Ae(),A?.id===ve.id&&e.plugin&&j(e.plugin)):C({type:`error`,message:e.error||`Could not save branding`})},Ge=async(e,t=`preview`)=>{j(await oi(e.id)||e),ne(t),re(e.cli?.subcommands?.[0]?.name||``),ae(``),se(null),le(``),le(await _i(e.id))},Ke=()=>{if(j(null),t.has(`id`)){let e=new URLSearchParams(t);e.delete(`id`),n(e)}};(0,_.useEffect)(()=>{let e=t.get(`id`);if(!e||A?.id===e)return;let n=a.find(t=>t.id===e);n&&Ge(n)},[t,a]),(0,_.useEffect)(()=>{if(!A)return;let e=a.find(e=>e.id===A.id);e&&e!==A&&j(e)},[a]);let qe=async()=>{if(!A)return;x(`run:${A.id}`);let e=await gi(A.id,N,ie.trim()?ie.trim().split(/\s+/):[]);x(null),e.error?se({text:e.error,ok:!1}):se({text:(e.output||``).trim()||`(no output)`,ok:e.success})},Je=a.filter(Ne),Ye=Je.filter(Pe),Xe=fe===`workspace`?Ye:Je,Ze=(0,_.useMemo)(()=>{let e=new Map;for(let t of s){let n=a.find(e=>e.id===t.id);e.set(t.id,{id:t.id,name:t.name,version:t.version,description:t.description,use_cases:t.use_cases||[],installed:t.installed||!!n,inWorkspace:n?Pe(n):!1,sourcePlugin:n,branding:t.branding||(n?n.branding:void 0),cli:t.cli||(n?n.cli:null),tasks:t.tasks||(n?n.tasks:[]),secrets:n?.secrets||[]})}for(let t of a)e.has(t.id)||e.set(t.id,{id:t.id,name:t.name,version:t.version,description:t.description,use_cases:t.use_cases||[],installed:!0,inWorkspace:Pe(t),sourcePlugin:t,branding:t.branding,cli:t.cli,tasks:t.tasks,secrets:t.secrets||[]});return Array.from(e.values())},[s,a,Pe]).filter(Ne),Qe=(e,t,n)=>(0,R.jsxs)(`button`,{role:`tab`,"aria-selected":r===e,className:`btn btn-sm ${r===e?`btn-primary`:`btn-ghost`}`,onClick:()=>i(e),children:[t,n!==void 0&&(0,R.jsx)(`span`,{style:{opacity:.75,fontWeight:500,marginLeft:`4px`},children:n})]},e);return(0,R.jsxs)(`div`,{className:`page`,style:{maxWidth:`100%`,padding:`0 20px`,margin:`0 auto`,width:`100%`},children:[(0,R.jsxs)(`div`,{className:`page-header`,style:{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,gap:`16px`,flexWrap:`wrap`},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h1`,{children:`Plugins`}),(0,R.jsx)(`p`,{children:`Modular capability system for Total Recall and SSSS apps — memory categories, agent context, commands, and design-token UI. Customizable branding, locked release status, and direct store deployment are managed on each card.`})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`8px`},children:[(0,R.jsx)(`button`,{className:`btn btn-ghost`,onClick:()=>de(!0),children:`Agent Recipe`}),(0,R.jsx)(`button`,{className:`btn btn-primary`,onClick:()=>{T(!0),C(null)},children:`Install from source…`})]})]}),S&&(0,R.jsxs)(`div`,{className:`alert ${S.type===`success`?`alert-success`:`alert-error`}`,role:`status`,style:{display:`flex`,justifyContent:`space-between`,gap:`12px`,marginBottom:`20px`},children:[(0,R.jsx)(`span`,{children:S.message}),(0,R.jsx)(`button`,{onClick:()=>C(null),"aria-label":`Dismiss`,style:{background:`none`,border:`none`,color:`inherit`,cursor:`pointer`},children:`×`})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,gap:`12px`,flexWrap:`wrap`,marginBottom:`20px`},children:[(0,R.jsxs)(`div`,{role:`tablist`,style:{display:`flex`,gap:`8px`},children:[Qe(`installed`,`My Cards`,Ye.length),Qe(`bundled`,`Plugin Store (Bundled)`,Ze.length),Qe(`mesh`,`On the mesh`)]}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,flexWrap:`wrap`},children:[(0,R.jsx)(`input`,{className:`input`,placeholder:`Search plugins`,value:h,onChange:e=>g(e.target.value),"aria-label":`Search plugins`,style:{width:`220px`}}),(0,R.jsxs)(`select`,{className:`select`,value:v,onChange:e=>y(e.target.value),"aria-label":`Filter by use case`,style:{paddingRight:`32px`},children:[(0,R.jsx)(`option`,{value:``,children:`All use cases`}),Me.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]})]})]}),r===`installed`&&(p?(0,R.jsx)(`div`,{style:gQ,children:`Loading…`}):(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`16px`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,flexWrap:`wrap`,gap:`12px`},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{style:{fontWeight:600,fontSize:`15px`},children:fe===`workspace`?`Active Workspace Cards`:`All Installed Plugins`}),(0,R.jsx)(`div`,{style:gQ,children:fe===`workspace`?`Core runtime foundation and activated repository cards. Optional tools live in the Plugin Store.`:`All plugin packages installed on this host.`})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`6px`},children:[(0,R.jsxs)(`button`,{type:`button`,className:`btn btn-xs ${fe===`workspace`?`btn-primary`:`btn-ghost`}`,onClick:()=>pe(`workspace`),children:[`Workspace (`,Ye.length,`)`]}),(0,R.jsxs)(`button`,{type:`button`,className:`btn btn-xs ${fe===`all`?`btn-primary`:`btn-ghost`}`,onClick:()=>pe(`all`),children:[`All Installed (`,a.length,`)`]})]})]}),Xe.length===0?(0,R.jsx)(TQ,{title:fe===`workspace`?`No workspace cards active`:`No plugins installed`,children:fe===`workspace`?(0,R.jsxs)(R.Fragment,{children:[`Explore the `,(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>i(`bundled`),children:`Plugin Store`}),` to add capabilities or ask your agent to author one.`]}):(0,R.jsxs)(R.Fragment,{children:[`Start with a `,(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>i(`bundled`),children:`bundled plugin`}),` or see what your peers share.`]})}):(0,R.jsx)(`div`,{className:`card-grid`,style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, 720px), 1fr))`,gap:`22px`},children:Xe.map(e=>(0,R.jsxs)(`div`,{onContextMenu:t=>ke(e,t),onTouchStart:t=>De(e,t),onTouchEnd:Oe,style:{display:`flex`,flexDirection:`column`,gap:`8px`,minWidth:0},children:[(0,R.jsx)(pQ,{plugin:e}),(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`0 4px`,fontSize:`11px`,color:`var(--text-tertiary)`,flexWrap:`wrap`,gap:`6px`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`6px`,alignItems:`center`,flexWrap:`wrap`},children:[(0,R.jsx)(`span`,{className:`badge`,children:e.scope}),(0,R.jsx)(`span`,{className:`badge`,children:SQ(e)}),e.shared&&(0,R.jsx)(`span`,{className:`badge badge-accent`,children:`shared`}),!e.valid&&(0,R.jsx)(`span`,{className:`badge badge-error`,children:`invalid manifest`}),e.modified_since_install&&(0,R.jsx)(`span`,{className:`badge badge-warning`,children:`changed since install`})]}),!_Q.has(e.id)&&(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-xs`,onClick:()=>Ie(e),style:{fontSize:`11px`,color:`var(--text-secondary)`},title:`Move back to Plugin Store`,children:`Remove from Workspace`})]})]},`${e.scope}:${e.id}`))})]})),r===`bundled`&&(p?(0,R.jsx)(`div`,{style:gQ,children:`Loading…`}):(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`20px`},children:[(0,R.jsx)(`div`,{className:`card`,style:{background:`linear-gradient(135deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.85) 100%)`,border:`1px solid rgba(99, 102, 241, 0.3)`,padding:`20px`,display:`flex`,flexDirection:`column`,gap:`14px`},children:(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,gap:`16px`,flexWrap:`wrap`},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,marginBottom:`4px`},children:[(0,R.jsx)(`span`,{className:`badge`,style:{background:`rgba(99, 102, 241, 0.2)`,color:`#818cf8`,borderColor:`rgba(99, 102, 241, 0.4)`,fontSize:`11px`},children:`AGENT RECIPE ARCHITECTURE`}),(0,R.jsx)(`span`,{style:{fontSize:`11px`,color:`var(--text-tertiary)`},children:`Declarative Recipes · Private or Store`})]}),(0,R.jsx)(`h2`,{style:{fontSize:`18px`,fontWeight:700,margin:0,color:`#f8fafc`},children:`Build Bespoke Plugins with Your Coding Agent`}),(0,R.jsx)(`p`,{style:{...gQ,margin:`6px 0 0 0`,maxWidth:`640px`},children:`Total Recall plugins are not generated by closed system templates; your contextual coding agent (Antigravity, Claude, Codex, DSH) builds them from a declarative Recipe. Run them privately in your workspace or publish them to the Plugin Store.`})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,flexWrap:`wrap`},children:[(0,R.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,onClick:()=>de(!0),children:`View Agent Recipe`}),(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:Le,children:`Copy Agent Prompt`}),(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>{T(!0),C(null)},children:`Install from source…`})]})]})}),Ze.length===0?(0,R.jsx)(TQ,{title:`No plugins match in store`}):(0,R.jsx)(`div`,{className:`card-grid`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(min(100%, 340px), 1fr))`,gap:`16px`},children:Ze.map(e=>{let t=yQ(e);return(0,R.jsxs)(`div`,{className:`card`,style:{display:`flex`,flexDirection:`column`,gap:`10px`,borderTop:`3px solid ${t.color}`,background:`var(--bg-secondary)`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,gap:`8px`,alignItems:`flex-start`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`10px`,alignItems:`center`},children:[(0,R.jsx)(`div`,{style:{width:`34px`,height:`34px`,borderRadius:`8px`,background:`${t.color}20`,border:`1px solid ${t.color}40`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontWeight:700,fontSize:`12px`,color:t.color},children:t.icon||e.name.slice(0,2).toUpperCase()}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{style:{fontWeight:600,fontSize:`14px`,lineHeight:1.2},children:e.name}),(0,R.jsxs)(`div`,{style:{...hQ,color:`var(--text-tertiary)`,fontSize:`11px`},children:[e.id,` · v`,e.version]})]})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`flex-end`,gap:`4px`},children:[(0,R.jsx)(`span`,{className:`badge`,style:{background:`${t.color}15`,color:t.color,borderColor:`${t.color}35`,fontSize:`10px`},children:t.badge}),e.inWorkspace&&(0,R.jsx)(`span`,{className:`badge badge-success`,style:{fontSize:`10px`},children:`✓ In Workspace`})]})]}),(0,R.jsx)(`div`,{style:{...gQ,fontSize:`12px`,minHeight:`36px`},children:e.description}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`4px`,flexWrap:`wrap`,fontSize:`10px`},children:[e.cli&&(0,R.jsxs)(`span`,{className:`badge`,style:{fontFamily:`var(--font-mono)`},children:[`CLI (`,e.cli.subcommands?.length||1,`)`]}),e.tasks&&e.tasks.length>0&&(0,R.jsxs)(`span`,{className:`badge`,style:{fontFamily:`var(--font-mono)`},children:[e.tasks.length,` `,e.tasks.length===1?`task`:`tasks`]}),e.secrets&&e.secrets.length>0&&(0,R.jsxs)(`span`,{className:`badge`,style:{fontFamily:`var(--font-mono)`},children:[e.secrets.length,` `,e.secrets.length===1?`secret`:`secrets`]}),_Q.has(e.id)&&(0,R.jsx)(`span`,{className:`badge`,style:{background:`rgba(59, 130, 246, 0.15)`,color:`#60a5fa`},children:`Core Bundle`})]}),(0,R.jsx)(CQ,{useCases:e.use_cases}),(0,R.jsxs)(`div`,{style:{marginTop:`auto`,display:`flex`,justifyContent:`space-between`,alignItems:`center`,gap:`8px`,paddingTop:`8px`,borderTop:`1px solid var(--border)`},children:[(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>{e.sourcePlugin?Ge(e.sourcePlugin,`preview`):Ge({id:e.id,name:e.name,version:e.version,description:e.description,author:null,license:null,homepage:null,use_cases:e.use_cases,valid:!0,errors:[],scope:`global`,linked:!1,dir:``,shared:!1,mesh_shared:!1,share_url:null,source:{kind:`bundled`,ref:e.id},installed_at:null,sha256:null,installed_sha256:null,modified_since_install:!1,file_count:null,size_bytes:null,categories:[],tasks:e.tasks||[],openwiki_hubs:[],cli:e.cli,has_generator:!1,branding:e.branding},`preview`)},children:`Preview`}),(0,R.jsx)(`div`,{style:{display:`flex`,gap:`6px`},children:e.installed?e.inWorkspace?(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,disabled:b===e.id,onClick:()=>Ie(e.sourcePlugin||e),style:{fontSize:`11px`},children:`Remove from Workspace`}):(0,R.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,disabled:b===e.id,onClick:()=>Fe(e.sourcePlugin||e),children:b===e.id?`Adding…`:`+ Add to Workspace`}):(0,R.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,disabled:b===e.id,onClick:()=>Re(e.id),children:b===e.id?`Installing…`:`Install`})})]})]},e.id)})})]})),r===`mesh`&&(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`16px`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,gap:`12px`,flexWrap:`wrap`},children:[(0,R.jsx)(`p`,{style:{...gQ,margin:0},children:`Asked live from each node. Only plugins their owner chose to share appear here; content is hash-checked on install.`}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:je,disabled:d,children:d?`Asking peers…`:`Refresh`})]}),d&&!l?(0,R.jsx)(`div`,{style:gQ,children:`Asking peers…`}):l===null?(0,R.jsx)(TQ,{title:`Could not ask the mesh`,children:`The brain server did not answer the peer query.`}):l.mesh.available?l.peers.length===0?(0,R.jsx)(TQ,{title:`No other nodes on the mesh`}):(0,R.jsxs)(R.Fragment,{children:[!l.mesh.configured&&(0,R.jsxs)(`div`,{className:`alert alert-warning`,children:[`This node has no `,(0,R.jsx)(`code`,{style:hQ,children:`TR_MESH_SYNC_TOKEN`}),`, so it cannot query peers. Set the same token on each node.`]}),l.peers.map(e=>{let t=e.plugins.filter(Ne);return(0,R.jsxs)(`div`,{className:`card`,children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,gap:`12px`,alignItems:`center`,marginBottom:e.plugins.length?`12px`:0,flexWrap:`wrap`},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{style:{fontWeight:600},children:e.hostname}),` `,(0,R.jsx)(`span`,{style:{...hQ,color:`var(--text-tertiary)`},children:e.ip})]}),(0,R.jsxs)(`span`,{className:`badge ${e.status===`ok`?`badge-online`:e.status===`offline`?`badge-offline`:`badge-warning`}`,children:[mQ[e.status],e.status===`ok`?` · ${e.plugins.length} shared`:``]})]}),e.error&&e.status!==`ok`&&(0,R.jsx)(`div`,{style:{...gQ,fontSize:`12px`},children:e.error}),e.status===`ok`&&e.plugins.length===0&&(0,R.jsx)(`div`,{style:gQ,children:`Shares no plugins.`}),e.status===`ok`&&e.plugins.length>0&&t.length===0&&(0,R.jsx)(`div`,{style:gQ,children:`No shared plugins match the filter.`}),t.map(t=>{let n=`peer:${e.hostname}/${t.id}`;return(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,gap:`16px`,padding:`12px 0`,borderTop:`1px solid var(--border)`,flexWrap:`wrap`},children:[(0,R.jsxs)(`div`,{style:{minWidth:0,flex:`1 1 320px`,display:`flex`,flexDirection:`column`,gap:`6px`},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{style:{fontWeight:600},children:t.name}),` `,(0,R.jsxs)(`span`,{style:{...hQ,color:`var(--text-tertiary)`},children:[`v`,t.version]})]}),(0,R.jsx)(`div`,{style:gQ,children:t.description}),(0,R.jsx)(CQ,{useCases:t.use_cases}),(0,R.jsxs)(`div`,{style:{...hQ,color:`var(--text-tertiary)`},title:t.sha256,children:[`sha256 `,bQ(t.sha256),` · `,t.file_count,` files · `,xQ(t.size_bytes)]})]}),(0,R.jsx)(`div`,{style:{alignSelf:`center`},children:t.installed?(0,R.jsx)(`span`,{className:`badge ${t.same_as_installed?`badge-success`:`badge-warning`}`,children:t.same_as_installed?`installed (same content)`:`installed (different content)`}):(0,R.jsx)(`button`,{className:`btn btn-primary btn-sm`,disabled:b===n,onClick:()=>Re(n),children:b===n?`Installing…`:`Install`})})]},t.id)})]},e.hostname)})]}):(0,R.jsxs)(TQ,{title:`This node is not on a mesh`,children:[`Enroll it with `,(0,R.jsx)(`code`,{style:hQ,children:`npx total-recall mesh enroll`}),` to share plugins between your nodes.`]})]}),w&&(0,R.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Install plugin from source`,onClick:()=>T(!1),style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.6)`,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:1e3,padding:`16px`},children:(0,R.jsxs)(`form`,{className:`card`,onClick:e=>e.stopPropagation(),style:{width:`100%`,maxWidth:`520px`,display:`flex`,flexDirection:`column`,gap:`14px`},onSubmit:async e=>{e.preventDefault(),E.trim()&&await Re(E.trim(),{link:O,global:k})&&(T(!1),D(``))},children:[(0,R.jsx)(`div`,{style:{fontWeight:600,fontSize:`16px`},children:`Install from source`}),(0,R.jsxs)(`div`,{style:gQ,children:[`A bundled plugin id, `,(0,R.jsx)(`code`,{style:hQ,children:`peer:<host>/<id>`}),`, a git URL, or a folder on this machine containing `,(0,R.jsx)(`code`,{style:hQ,children:`plugin.json`}),`.`]}),(0,R.jsx)(`input`,{className:`input`,autoFocus:!0,value:E,onChange:e=>D(e.target.value),placeholder:`https://github.com/you/my-plugin.git`,"aria-label":`Plugin source`}),(0,R.jsxs)(`label`,{style:{...gQ,display:`flex`,gap:`8px`,alignItems:`center`},children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:O,onChange:e=>ee(e.target.checked)}),`Link a local folder instead of copying it (for plugin development)`]}),(0,R.jsxs)(`label`,{style:{...gQ,display:`flex`,gap:`8px`,alignItems:`center`},children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:k,onChange:e=>te(e.target.checked)}),`Install for every project on this machine`]}),(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:`8px`},children:[(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,onClick:()=>T(!1),children:`Cancel`}),(0,R.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,disabled:!E.trim()||b!==null,children:b?`Installing…`:`Install`})]})]})}),ge&&ve&&(0,R.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Customize Plugin Branding`,onClick:()=>_e(!1),style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.6)`,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:1e3,padding:`16px`},children:(0,R.jsxs)(`div`,{className:`card`,onClick:e=>e.stopPropagation(),style:{width:`100%`,maxWidth:`480px`,display:`flex`,flexDirection:`column`,gap:`16px`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,R.jsxs)(`div`,{style:{fontWeight:700,fontSize:`16px`},children:[`Customize Branding: `,ve.name]}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>_e(!1),children:`✕`})]}),ve.locked&&(0,R.jsx)(`div`,{className:`alert alert-warning`,style:{fontSize:`12px`},children:`[LOCKED] This plugin is marked complete and locked against editing. Unlock it to change branding.`}),(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`6px`},children:[(0,R.jsx)(`label`,{style:{fontSize:`12px`,color:`var(--text-secondary)`},children:`Wordmark Glyph / Tag`}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`8px`},children:[(0,R.jsx)(`input`,{className:`input`,value:be,onChange:e=>xe(e.target.value),style:{width:`90px`,textAlign:`center`,fontSize:`14px`,fontFamily:`var(--font-mono)`},disabled:ve.locked}),(0,R.jsx)(`div`,{style:{display:`flex`,gap:`4px`,flexWrap:`wrap`,alignItems:`center`},children:[`[TEL]`,`[DNS]`,`[SIGN]`,`[GATE]`,`[CLI]`,`[LAW]`,`[UI]`,`[SMS]`,`[FIND]`,`[GIT]`,`[OPS]`,`[WARN]`,`[CORE]`].map(e=>(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,style:{padding:`4px 6px`,fontSize:`11px`,fontFamily:`var(--font-mono)`},disabled:ve.locked,onClick:()=>xe(e),children:e},e))})]})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`6px`},children:[(0,R.jsx)(`label`,{style:{fontSize:`12px`,color:`var(--text-secondary)`},children:`Theme Color (Hex)`}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,alignItems:`center`},children:[(0,R.jsx)(`input`,{type:`color`,value:Se,onChange:e=>Ce(e.target.value),style:{width:`42px`,height:`38px`,border:`none`,cursor:`pointer`,background:`none`},disabled:ve.locked}),(0,R.jsx)(`input`,{className:`input`,value:Se,onChange:e=>Ce(e.target.value),style:{flex:1,fontFamily:`var(--font-mono)`},disabled:ve.locked})]})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`6px`},children:[(0,R.jsx)(`label`,{style:{fontSize:`12px`,color:`var(--text-secondary)`},children:`Domain Badge Text`}),(0,R.jsx)(`input`,{className:`input`,value:P,onChange:e=>we(e.target.value),placeholder:`e.g. Telephony, Quality, DNS`,disabled:ve.locked})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:`8px`,marginTop:`8px`},children:[(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,onClick:()=>_e(!1),children:`Cancel`}),(0,R.jsx)(`button`,{type:`button`,className:`btn btn-primary`,onClick:We,disabled:ve.locked||b!==null,children:`Save Branding`})]})]})}),ue&&(0,R.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Agent Plugin Recipe`,onClick:()=>de(!1),style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.65)`,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:1e3,padding:`16px`},children:(0,R.jsxs)(`div`,{className:`card`,onClick:e=>e.stopPropagation(),style:{width:`100%`,maxWidth:`680px`,maxHeight:`90vh`,overflowY:`auto`,display:`flex`,flexDirection:`column`,gap:`16px`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{style:{margin:0,fontSize:`17px`,fontWeight:700},children:`Agent Plugin Recipe`}),(0,R.jsx)(`div`,{style:{...gQ,fontSize:`12px`},children:`How your coding agent authors private or store plugins`})]}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>de(!1),children:`✕`})]}),(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`12px`,fontSize:`13px`},children:[(0,R.jsxs)(`div`,{style:{background:`var(--bg-tertiary)`,padding:`12px`,borderRadius:`8px`,border:`1px solid var(--border)`},children:[(0,R.jsx)(`div`,{style:{fontWeight:600,marginBottom:`4px`},children:`1. Command your agent`}),(0,R.jsx)(`div`,{style:gQ,children:`Copy and send this instruction to your coding agent (Antigravity, Claude, Codex, DSH):`}),(0,R.jsx)(`pre`,{style:{...hQ,background:`rgba(0,0,0,0.4)`,padding:`10px`,borderRadius:`6px`,marginTop:`8px`,whiteSpace:`pre-wrap`,overflowX:`auto`,fontSize:`11px`,color:`#a5b4fc`},children:vQ}),(0,R.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginTop:`8px`},children:(0,R.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,onClick:()=>Le(),children:`Copy Agent Prompt`})})]}),(0,R.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`12px`},children:[(0,R.jsxs)(`div`,{style:{background:`var(--bg-tertiary)`,padding:`12px`,borderRadius:`8px`,border:`1px solid var(--border)`},children:[(0,R.jsx)(`div`,{style:{fontWeight:600,color:`#38bdf8`,marginBottom:`4px`},children:`🔒 Private Plugins`}),(0,R.jsxs)(`div`,{style:{...gQ,fontSize:`12px`,lineHeight:1.4},children:[`Store directly inside `,(0,R.jsx)(`code`,{style:hQ,children:`.agent/skills/total-recall/plugins/<id>`}),` or link locally. Never shared outside this machine or project. Zero cloud exposure.`]})]}),(0,R.jsxs)(`div`,{style:{background:`var(--bg-tertiary)`,padding:`12px`,borderRadius:`8px`,border:`1px solid var(--border)`},children:[(0,R.jsx)(`div`,{style:{fontWeight:600,color:`#a855f7`,marginBottom:`4px`},children:`🌐 Plugin Store Distribution`}),(0,R.jsxs)(`div`,{style:{...gQ,fontSize:`12px`,lineHeight:1.4},children:[`Deploy to the store via `,(0,R.jsx)(`code`,{style:hQ,children:`total-recall deploy-store <id>`}),`. Cryptographically signed and distributed across the mesh for team consumption.`]})]})]}),(0,R.jsxs)(`div`,{style:{background:`rgba(16, 185, 129, 0.08)`,padding:`12px`,borderRadius:`8px`,border:`1px solid rgba(16, 185, 129, 0.2)`},children:[(0,R.jsx)(`div`,{style:{fontWeight:600,color:`#10b981`,marginBottom:`4px`},children:`Quality Invariants Enforced`}),(0,R.jsxs)(`ul`,{style:{margin:`4px 0 0 16px`,padding:0,fontSize:`12px`,color:`var(--text-secondary)`},children:[(0,R.jsx)(`li`,{children:`Guaranteed Title, Brand Glyph, Version, and Settings drawer trigger on every card`}),(0,R.jsx)(`li`,{children:`Authentic domain tools only — zero fake audio equalizers or fake skins`}),(0,R.jsx)(`li`,{children:`Touch-first ergonomics with minimum 44px tap targets`})]})]})]}),(0,R.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginTop:`8px`},children:(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,onClick:()=>de(!1),children:`Close`})})]})}),A&&(0,R.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":A.name,onClick:Ke,style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.6)`,display:`flex`,justifyContent:`flex-end`,zIndex:1e3},children:(0,R.jsx)(`div`,{onClick:e=>e.stopPropagation(),style:{width:`100%`,maxWidth:`680px`,height:`100%`,overflowY:`auto`,background:`var(--bg-secondary)`,borderLeft:`1px solid var(--border)`,padding:`24px`,display:`flex`,flexDirection:`column`,gap:`16px`},children:(()=>{let e=yQ(A),t=kZ(A).length>0;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,gap:`12px`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`12px`,alignItems:`center`},children:[(0,R.jsx)(`div`,{style:{width:`44px`,height:`44px`,borderRadius:`10px`,background:`${e.color}20`,border:`1px solid ${e.color}50`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:`22px`,flexShrink:0},children:e.icon}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{style:{fontSize:`18px`,fontWeight:700},children:A.name}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,alignItems:`center`,marginTop:`2px`},children:[(0,R.jsxs)(`span`,{style:{...hQ,color:`var(--text-tertiary)`},children:[A.id,` · v`,A.version]}),(0,R.jsx)(`span`,{className:`badge`,style:{background:`${e.color}15`,color:e.color,borderColor:`${e.color}40`,fontSize:`11px`},children:e.badge}),A.locked&&(0,R.jsx)(`span`,{className:`badge`,style:{background:`#2e1065`,color:`#c084fc`},children:`Locked`})]})]})]}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:Ke,"aria-label":`Close`,children:`Close`})]}),(0,R.jsx)(`div`,{style:gQ,children:A.description}),!A.valid&&(0,R.jsx)(`div`,{className:`alert alert-error`,children:A.errors.map(e=>(0,R.jsx)(`div`,{children:e},e))}),(0,R.jsxs)(`div`,{role:`tablist`,style:{display:`flex`,gap:`8px`,borderBottom:`1px solid var(--border)`,paddingBottom:`10px`},children:[t&&(0,R.jsxs)(`button`,{role:`tab`,"aria-selected":M===`preview`,className:`btn btn-sm ${M===`preview`?`btn-primary`:`btn-ghost`}`,onClick:()=>ne(`preview`),children:[`Open `,A.name]}),A.cli&&(0,R.jsx)(`button`,{role:`tab`,"aria-selected":M===`run`,className:`btn btn-sm ${M===`run`?`btn-primary`:`btn-ghost`}`,onClick:()=>ne(`run`),children:`Run CLI`}),(0,R.jsx)(`button`,{role:`tab`,"aria-selected":M===`details`,className:`btn btn-sm ${M===`details`?`btn-primary`:`btn-ghost`}`,onClick:()=>ne(`details`),children:`Settings`}),(0,R.jsx)(`button`,{role:`tab`,"aria-selected":M===`readme`,className:`btn btn-sm ${M===`readme`?`btn-primary`:`btn-ghost`}`,onClick:()=>ne(`readme`),children:`README`})]}),M===`preview`&&(0,R.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`12px`},children:(0,R.jsx)(AZ,{plugin:A})}),M===`run`&&A.cli&&(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`10px`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,flexWrap:`wrap`},children:[(0,R.jsx)(`select`,{className:`select`,value:N,onChange:e=>re(e.target.value),"aria-label":`Subcommand`,style:{paddingRight:`32px`},children:(A.cli.subcommands.length?A.cli.subcommands:[{name:``}]).map(e=>(0,R.jsx)(`option`,{value:e.name,children:e.name||`(default)`},e.name))}),(0,R.jsx)(`input`,{className:`input`,value:ie,onChange:e=>ae(e.target.value),placeholder:`extra arguments`,"aria-label":`Arguments`,style:{flex:1,minWidth:`160px`}}),(0,R.jsx)(`button`,{className:`btn btn-primary`,onClick:qe,disabled:b===`run:${A.id}`||!A.valid,children:b===`run:${A.id}`?`Running…`:`Run`})]}),(0,R.jsxs)(`div`,{style:{...gQ,fontSize:`12px`},children:[A.cli.subcommands.find(e=>e.name===N)?.description,` `,`Same as `,(0,R.jsxs)(`code`,{style:hQ,children:[`npx total-recall `,A.cli.command,` `,N,` `,ie]}),`. Runs in a separate process.`]}),oe&&(0,R.jsx)(`pre`,{style:{...hQ,margin:0,padding:`14px`,borderRadius:`var(--radius-sm)`,background:`var(--bg-primary)`,border:`1px solid ${oe.ok?`var(--border)`:`var(--error)`}`,whiteSpace:`pre-wrap`,maxHeight:`420px`,overflow:`auto`},children:oe.text})]}),M===`details`&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(jZ,{plugin:A}),(0,R.jsxs)(wQ,{label:`Scope`,children:[A.scope,A.linked?` (linked folder)`:``]}),(0,R.jsxs)(wQ,{label:`Source`,children:[SQ(A),` — `,(0,R.jsx)(`span`,{style:hQ,children:A.source.ref})]}),(0,R.jsx)(wQ,{label:`Installed`,children:A.installed_at?new Date(A.installed_at).toLocaleString():`no install record`}),(0,R.jsx)(wQ,{label:`Content sha256`,children:(0,R.jsx)(`span`,{style:hQ,children:A.sha256||`—`})}),A.modified_since_install&&(0,R.jsx)(wQ,{label:`At install`,children:(0,R.jsx)(`span`,{style:hQ,children:A.installed_sha256})}),(0,R.jsxs)(wQ,{label:`Files`,children:[A.file_count??`—`,` · `,xQ(A.size_bytes)]}),(0,R.jsx)(wQ,{label:`Shared`,children:A.shared?`yes`:`no`}),(0,R.jsx)(wQ,{label:`Lock Status`,children:A.locked?`Locked (Completed)`:`Unlocked (Editable)`}),(0,R.jsx)(wQ,{label:`Store Status`,children:A.store_deployed?`Published in Plugin Store`:`Not yet deployed to store`}),A.shared&&(0,R.jsx)(wQ,{label:`Public link`,children:A.share_url?(0,R.jsx)(`input`,{className:`input`,"aria-label":`Public plugin share link`,readOnly:!0,value:A.share_url,onFocus:e=>e.currentTarget.select()}):`Set TR_PUBLIC_BASE_URL to your public HTTPS origin to create a link.`}),(0,R.jsx)(wQ,{label:`Use cases`,children:A.use_cases.join(`, `)||`—`}),A.author&&(0,R.jsx)(wQ,{label:`Author`,children:A.author}),A.license&&(0,R.jsx)(wQ,{label:`License`,children:A.license}),(0,R.jsx)(wQ,{label:`Location`,children:(0,R.jsx)(`span`,{style:hQ,children:A.dir})}),(0,R.jsx)(wQ,{label:`Agent context`,children:A.has_generator?`adds a block to compiled instructions`:`—`}),(0,R.jsx)(wQ,{label:`Memory categories`,children:A.categories.length?A.categories.map(e=>e.name).join(`, `):`—`}),(0,R.jsx)(wQ,{label:`Scheduled tasks`,children:A.tasks.length===0?`—`:(0,R.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`6px`},children:A.tasks.map(e=>(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{style:hQ,children:e.schedule}),` `,e.command,` — `,e.intent,(0,R.jsxs)(`div`,{style:{color:`var(--text-tertiary)`,fontSize:`12px`},children:[`last run: `,e.last_run||`not yet`]})]},e.command))})}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,marginTop:`16px`,flexWrap:`wrap`},children:[(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>Ue(A),disabled:A.locked,children:`Customize Branding`}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>Ve(A),disabled:b===A.id,children:A.locked?`Unlock Editing`:`Lock When Complete`}),(0,R.jsx)(`button`,{className:`btn btn-primary btn-sm`,onClick:()=>He(A),disabled:b===A.id||!A.valid,children:A.store_deployed?`✓ Deployed to Store`:`Deploy to Plugin Store`}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,disabled:b===A.id||!A.valid&&!A.shared,onClick:()=>Be(A,!A.shared),children:A.shared?`Stop sharing`:`Share`}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,disabled:b===A.id,onClick:()=>ze(A),children:`Remove`})]})]}),M===`readme`&&(0,R.jsx)(`div`,{style:{fontSize:`14px`,lineHeight:1.6},children:ce?$X(ce):(0,R.jsx)(`span`,{style:gQ,children:`Loading…`})})]})})()})}),Te&&(0,R.jsxs)(`div`,{role:`menu`,"aria-label":`Plugin actions menu`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),style:{position:`fixed`,left:Math.max(12,Math.min(Te.x,window.innerWidth-264)),top:Math.max(12,Math.min(Te.y,window.innerHeight-380)),zIndex:2e3,width:`250px`,background:`var(--bg-secondary)`,border:`1px solid var(--border)`,borderRadius:`10px`,boxShadow:`0 12px 36px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.08)`,padding:`6px`,display:`flex`,flexDirection:`column`,gap:`2px`,backdropFilter:`blur(12px)`},children:[(0,R.jsxs)(`div`,{style:{padding:`8px 10px`,borderBottom:`1px solid var(--border)`,display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,R.jsx)(`div`,{style:{width:`8px`,height:`8px`,borderRadius:`50%`,background:yQ(Te.plugin).color}}),(0,R.jsxs)(`div`,{style:{minWidth:0},children:[(0,R.jsx)(`div`,{style:{fontWeight:600,fontSize:`13px`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},children:Te.plugin.name}),(0,R.jsxs)(`div`,{style:{...hQ,fontSize:`10px`,color:`var(--text-tertiary)`},children:[Te.plugin.id,` · v`,Te.plugin.version]})]})]}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,style:{justifyContent:`flex-start`,width:`100%`,padding:`8px 10px`,fontSize:`12px`,minHeight:`36px`},onClick:()=>{let e=Te.plugin;Ee(null),Ge(e,`preview`)},children:`Open UI Component`}),(0,R.jsxs)(`button`,{className:`btn btn-ghost btn-sm`,style:{justifyContent:`flex-start`,width:`100%`,padding:`8px 10px`,fontSize:`12px`,minHeight:`36px`},onClick:()=>{let e=Te.plugin;Ee(null),Ge(e,`run`)},children:[`Run CLI (`,Te.plugin.cli?.command||Te.plugin.id,`)`]}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,style:{justifyContent:`flex-start`,width:`100%`,padding:`8px 10px`,fontSize:`12px`,minHeight:`36px`},onClick:()=>{let e=Te.plugin;Ee(null),Ge(e,`details`)},children:`Configure & Settings`}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,style:{justifyContent:`flex-start`,width:`100%`,padding:`8px 10px`,fontSize:`12px`,minHeight:`36px`},onClick:()=>{let e=Te.plugin;Ee(null),Ge(e,`readme`)},children:`View Documentation`}),(0,R.jsx)(`div`,{style:{height:`1px`,background:`var(--border)`,margin:`4px 0`}}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,style:{justifyContent:`flex-start`,width:`100%`,padding:`8px 10px`,fontSize:`12px`,minHeight:`36px`},onClick:()=>{let e=Te.plugin;Ee(null),Be(e,!e.shared)},children:Te.plugin.shared?`Stop sharing on mesh`:`Share on mesh & link`}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,style:{justifyContent:`flex-start`,width:`100%`,padding:`8px 10px`,fontSize:`12px`,minHeight:`36px`},onClick:()=>{let e=Te.plugin;Ee(null),Ve(e)},children:Te.plugin.locked?`Unlock editing`:`Lock for release`}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,style:{justifyContent:`flex-start`,width:`100%`,padding:`8px 10px`,fontSize:`12px`,minHeight:`36px`},onClick:()=>{let e=Te.plugin;Ee(null),navigator.clipboard?.writeText(`npx total-recall ${e.cli?.command||e.id}`),C({type:`success`,message:`Copied "npx total-recall ${e.cli?.command||e.id}" to clipboard`})},children:`Copy CLI command`}),(0,R.jsx)(`div`,{style:{height:`1px`,background:`var(--border)`,margin:`4px 0`}}),(0,R.jsx)(`button`,{className:`btn btn-ghost btn-sm`,style:{justifyContent:`flex-start`,width:`100%`,padding:`8px 10px`,fontSize:`12px`,color:`var(--color-error, #f87171)`,minHeight:`36px`},onClick:()=>{let e=Te.plugin;Ee(null),ze(e)},children:`Uninstall plugin`})]})]})}function DQ(){return localStorage.getItem(`tr-onboarding-complete`)===`1`}var OQ=`tr-onboarding-v1`,kQ=[{id:`welcome`,title:`Welcome to Total Recall`,body:`Portable personal memory for any IDE. Your rules and facts live as Markdown files on disk — not a locked vendor database.`},{id:`import-env`,title:`Import your API keys`,body:`Scan the machine for keys already in .env files or the shell, or paste a .env block. Nothing is written until you choose what to import.`},{id:`remember`,title:`Save your first memory`,body:`Write a fact or preference into the vault. This is the core write path: remember → compile → IDEs see it.`},{id:`connect`,title:`Connect an IDE`,body:`Wire Claude Code, Cursor, Codex, Gemini, Aider, Obsidian, or any HTTP host. Injected blocks never overwrite your local rules outside TR markers.`},{id:`dream`,title:`Dream consolidates memory`,body:`Dream is sleep for your vault: ingest sessions, conflict-check, recompile surfaces, prune. Run it anytime; no always-on LLM required.`},{id:`done`,title:`You're set`,body:`Default loop: init → connect → remember/recall → dream. Optional: task queue, skill track any repo, daemon in the background.`}];function AQ(){try{return JSON.parse(localStorage.getItem(OQ)||`{}`)}catch{return{step:0}}}function jQ(e){localStorage.setItem(OQ,JSON.stringify(e)),e.complete&&localStorage.setItem(`tr-onboarding-complete`,`1`)}function MQ(e){let t={};for(let n of e.split(/\r?\n/)){let e=n.trim();if(!e||e.startsWith(`#`))continue;let r=e.startsWith(`export `)?e.slice(7).trim():e,i=r.indexOf(`=`);if(i<=0)continue;let a=r.slice(0,i).trim(),o=r.slice(i+1).trim();o=o.startsWith(`"`)&&o.endsWith(`"`)||o.startsWith(`'`)&&o.endsWith(`'`)?o.slice(1,-1):o.replace(/\s+#.*$/,``).trim(),a&&o&&(t[a]=o)}return t}function NQ(){let e=ft(),t=AQ(),[n,r]=(0,_.useState)(t.step||0),[i,a]=(0,_.useState)(t.fact||``),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)([]),[m,h]=(0,_.useState)(new Set),[g,v]=(0,_.useState)(``),[y,b]=(0,_.useState)({}),[x,S]=(0,_.useState)(``),[C,w]=(0,_.useState)(!1),[T,E]=(0,_.useState)(`scan`),D=kQ[Math.min(n,kQ.length-1)];(0,_.useEffect)(()=>{or().then(e=>{let t=e||[],n=t.some(e=>e.slug===`user-profile`||e.slug===`onboarding-first-memory`||(e.tags||[]).includes(`onboarding`)),r=n||t.length>=5;d(n||r),r&&!DQ()&&localStorage.setItem(`tr-onboarding-complete`,`1`)}).catch(()=>{})},[]),(0,_.useEffect)(()=>{if(D.id!==`import-env`||T!==`scan`)return;let e=!1;return Promise.resolve().then(()=>{w(!0),S(``)}),kr().then(t=>{if(e)return;p(t.candidates||[]);let n=new Set((t.candidates||[]).filter(e=>!e.already_set).map(e=>e.key));h(n)}).catch(t=>{e||S(t instanceof Error?t.message:`Scan failed`)}).finally(()=>{e||w(!1)}),()=>{e=!0}},[D.id,T]);function O(){let e=Math.min(n+1,kQ.length-1);r(e),jQ({step:e,fact:i}),s(``)}function ee(){let e=Math.max(n-1,0);r(e),jQ({step:e,fact:i}),s(``)}function k(e){h(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function te(){h(new Set(f.filter(e=>!e.already_set).map(e=>e.key)))}function A(){h(new Set)}async function j(){if(!g.trim())s(`Paste a .env block first.`);else{l(!0),S(``);try{let e=MQ(g);b(e);let t=await Ar(g);p(t.candidates||[]),h(new Set((t.candidates||[]).filter(e=>!e.already_set).map(e=>e.key))),s(t.count?`Found ${t.count} importable key(s) in paste.`:`No known API key names in paste.`)}catch(e){S(e instanceof Error?e.message:`Parse failed`)}finally{l(!1)}}}async function M(){let e=[...m];if(!e.length)s(`Select at least one key, or skip this step.`);else{l(!0),s(``);try{let t=T===`paste`&&Object.keys(y).length?await jr({keys:e,pairs:y,overwrite:!1}):await jr({keys:e,overwrite:!1});if(s(`Imported ${t.imported_count} secret(s)`+(t.skipped_count?`, skipped ${t.skipped_count} already set`:``)+`.`),T===`scan`){let e=await kr();p(e.candidates||[]),h(new Set)}else p(e=>e.map(e=>t.imported.some(t=>t.key===e.key)?{...e,already_set:!0}:e)),h(new Set)}catch(e){s(e instanceof Error?e.message:`Import failed`)}finally{l(!1)}}}async function ne(){if(!i.trim())s(`Write a short fact or preference first.`);else{l(!0),s(``);try{await ur({slug:`onboarding-first-memory`,category:`preferences`,title:`Onboarding first memory`,content:i.trim(),tags:[`onboarding`],importance:4});try{await Rr()}catch{}s(`Saved and queued surface compile.`),jQ({step:n,fact:i}),O()}catch(e){s(e instanceof Error?e.message:`Failed to save memory`)}finally{l(!1)}}}function N(){jQ({step:kQ.length-1,fact:i,complete:!0}),e(`/memory`)}let re=Math.round((n+1)/kQ.length*100);return(0,R.jsxs)(`div`,{className:`onboarding-shell`,children:[D.id===`welcome`&&(0,R.jsx)(`div`,{style:{marginBottom:28,borderRadius:16,padding:`16px 20px`,background:`linear-gradient(180deg, #f8fafc 0%, #e8eef9 100%)`,boxShadow:`0 1px 0 rgba(255,255,255,0.7) inset, 0 16px 40px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(148,163,184,0.2)`,display:`flex`,justifyContent:`center`},children:(0,R.jsx)(Fi,{variant:`lockup`,height:64,alt:`Total Recall`})}),(0,R.jsxs)(`div`,{style:{marginBottom:28},children:[(0,R.jsxs)(`div`,{style:{fontSize:11,color:`var(--text-tertiary)`,marginBottom:10,letterSpacing:`0.08em`,textTransform:`uppercase`,fontWeight:600},children:[`Onboarding · `,n+1,`/`,kQ.length]}),(0,R.jsx)(`div`,{className:`onboarding-progress`,children:(0,R.jsx)(`div`,{style:{width:`${re}%`}})})]}),(0,R.jsx)(`h1`,{style:{fontSize:28,fontWeight:700,margin:`0 0 12px`,letterSpacing:`-0.03em`,background:`linear-gradient(135deg, #f8fafc 0%, #93c5fd 100%)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:D.title}),(0,R.jsx)(`p`,{style:{fontSize:15.5,lineHeight:1.6,color:`var(--text-secondary)`,margin:`0 0 28px`},children:D.body}),D.id===`welcome`&&(0,R.jsxs)(`div`,{className:`loop-card`,style:{marginBottom:24},children:[`write\xA0\xA0→ remember / session ingest`,(0,R.jsx)(`br`,{}),`sleep\xA0\xA0→ dream (consolidate, conflict, compile)`,(0,R.jsx)(`br`,{}),`read\xA0\xA0\xA0→ recall + compiled surfaces`,(0,R.jsx)(`br`,{}),`async\xA0\xA0→ daemon tasks (any intent under policy)`]}),D.id===`import-env`&&(0,R.jsxs)(`div`,{style:{marginBottom:24},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,gap:8,marginBottom:14},children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>E(`scan`),style:T===`scan`?zQ:BQ,children:`Scan machine`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>{E(`paste`),p([]),h(new Set)},style:T===`paste`?zQ:BQ,children:`Paste .env`})]}),T===`paste`&&(0,R.jsxs)(`div`,{style:{marginBottom:14},children:[(0,R.jsx)(`textarea`,{value:g,onChange:e=>v(e.target.value),placeholder:`OPENAI_API_KEY=sk-...
|
|
5609
5622
|
ANTHROPIC_API_KEY=sk-ant-...
|
|
5610
|
-
GOOGLE_API_KEY=...`,rows:6,style:{width:`100%`,boxSizing:`border-box`,background:`var(--bg-primary)`,border:`1px solid var(--border)`,borderRadius:10,padding:12,color:`var(--text-primary)`,fontSize:12,fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`,resize:`vertical`}}),(0,R.jsx)(`button`,{type:`button`,disabled:c,onClick:j,style:{...JQ,marginTop:8},children:`Preview keys in paste`})]}),C&&(0,R.jsx)(`p`,{style:{fontSize:13,color:`var(--text-tertiary)`},children:`Scanning env sources…`}),x&&(0,R.jsx)(`p`,{style:{fontSize:13,color:`#f87171`,marginBottom:12},children:x}),!C&&f.length===0&&!x&&(0,R.jsx)(`div`,{style:{padding:14,borderRadius:10,border:`1px solid var(--border)`,background:`rgba(148,163,184,0.06)`,fontSize:13,color:`var(--text-secondary)`,marginBottom:12},children:T===`scan`?`No known API keys found in process.env or common .env paths (~/.agent/.env, project .env, …). Paste a .env or continue and set keys later with secret set.`:`Paste your .env and click Preview.`}),f.length>0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{style:{display:`flex`,gap:8,marginBottom:10,flexWrap:`wrap`},children:[(0,R.jsx)(`button`,{type:`button`,onClick:te,style:XQ,children:`Select new`}),(0,R.jsx)(`button`,{type:`button`,onClick:A,style:XQ,children:`Clear`}),(0,R.jsxs)(`span`,{style:{fontSize:12,color:`var(--text-tertiary)`,alignSelf:`center`},children:[m.size,` selected · values never shown raw`]})]}),(0,R.jsx)(`div`,{style:{maxHeight:280,overflowY:`auto`,border:`1px solid var(--border)`,borderRadius:12,marginBottom:12},children:f.map(e=>(0,R.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`10px 12px`,borderBottom:`1px solid var(--border)`,cursor:e.already_set?`default`:`pointer`,opacity:e.already_set?.55:1,background:m.has(e.key)?`rgba(59,130,246,0.08)`:`transparent`},children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:m.has(e.key),disabled:!!e.already_set,onChange:()=>k(e.key),style:{accentColor:`#3b82f6`}}),(0,R.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,R.jsxs)(`div`,{style:{fontSize:12,fontWeight:600,fontFamily:`ui-monospace, monospace`},children:[e.key,e.provider&&(0,R.jsx)(`span`,{style:{marginLeft:8,fontSize:10,color:`#93c5fd`,fontWeight:500},children:e.provider}),e.already_set&&(0,R.jsx)(`span`,{style:{marginLeft:8,fontSize:10,color:`#34d399`},children:`already set`})]}),(0,R.jsxs)(`div`,{style:{fontSize:11,color:`var(--text-tertiary)`,marginTop:2},children:[e.masked,` · `,e.source_label]})]})]},e.key+e.source_label))}),(0,R.jsx)(`button`,{type:`button`,disabled:c||m.size===0,onClick:M,style:{...qQ,opacity:c||m.size===0?.5:1,cursor:c||m.size===0?`not-allowed`:`pointer`},children:c?`Importing…`:`Import ${m.size} secret(s)`})]}),(0,R.jsxs)(`p`,{style:{marginTop:14,fontSize:12,color:`var(--text-tertiary)`},children:[`CLI: `,(0,R.jsx)(`code`,{children:`npx total-recall secret import-env --all`}),` · `,(0,R.jsx)(En,{to:`/keys`,style:{color:`var(--accent)`},children:`Secrets page`})]})]}),D.id===`remember`&&(0,R.jsxs)(`div`,{style:{marginBottom:24},children:[(0,R.jsx)(`label`,{style:{fontSize:12,fontWeight:600,color:`var(--text-tertiary)`,display:`block`,marginBottom:8},children:`First memory (fact or preference)`}),(0,R.jsx)(`textarea`,{value:i,onChange:e=>a(e.target.value),placeholder:`e.g. "I prefer short answers and single quotes in JS."`,rows:4,style:{width:`100%`,boxSizing:`border-box`,background:`var(--bg-primary)`,border:`1px solid var(--border)`,borderRadius:10,padding:12,color:`var(--text-primary)`,fontSize:14,resize:`vertical`}}),(0,R.jsx)(`button`,{type:`button`,disabled:c,onClick:ne,style:{...qQ,marginTop:12},children:c?`Saving…`:`Save to vault & continue`})]}),D.id===`connect`&&(0,R.jsxs)(`div`,{style:{marginBottom:24,display:`flex`,flexDirection:`column`,gap:10},children:[(0,R.jsx)(`code`,{style:KQ,children:`npx total-recall connect claude-code`}),(0,R.jsx)(`code`,{style:KQ,children:`npx total-recall connect cursor`}),(0,R.jsx)(`code`,{style:KQ,children:`npx total-recall connect http-api --brain http://localhost:3000`}),(0,R.jsx)(En,{to:`/integrations`,style:{fontSize:13,color:`var(--accent)`},children:`Open Integrations page →`})]}),D.id===`dream`&&(0,R.jsxs)(`div`,{style:{marginBottom:24,display:`flex`,flexDirection:`column`,gap:10},children:[(0,R.jsx)(`code`,{style:KQ,children:`npx total-recall dream`}),(0,R.jsx)(`code`,{style:KQ,children:`npx total-recall daemon start # optional background worker`}),(0,R.jsx)(`code`,{style:KQ,children:`npx total-recall task add "Extract decisions from last session" --cap vault:write`}),(0,R.jsx)(En,{to:`/tasks`,style:{fontSize:13,color:`var(--accent)`},children:`Open Tasks page →`})]}),D.id===`done`&&(0,R.jsxs)(`div`,{style:{marginBottom:24,padding:16,borderRadius:12,background:`rgba(34,197,94,0.08)`,border:`1px solid rgba(34,197,94,0.25)`,fontSize:14,color:`var(--text-secondary)`},children:[u?`Vault already has onboarding profile data — you can jump to Memory anytime.`:`Optional: chat with the assistant to run the full preference interview (user-profile.md).`,(0,R.jsxs)(`div`,{style:{marginTop:12,display:`flex`,gap:12,flexWrap:`wrap`},children:[(0,R.jsx)(En,{to:`/`,style:YQ,children:`Open Chat`}),(0,R.jsx)(En,{to:`/memory`,style:YQ,children:`Open Vault`}),(0,R.jsx)(En,{to:`/integrations`,style:YQ,children:`Connect IDE`})]})]}),o&&(0,R.jsx)(`p`,{style:{fontSize:13,color:o.startsWith(`Saved`)||o.startsWith(`Imported`)||o.startsWith(`Found`)?`#22c55e`:`#f59e0b`,marginBottom:16},children:o}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:10,justifyContent:`space-between`},children:[(0,R.jsx)(`button`,{type:`button`,onClick:ee,disabled:n===0,style:JQ,children:`Back`}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:10},children:[D.id!==`done`&&D.id!==`remember`&&(0,R.jsx)(`button`,{type:`button`,onClick:O,style:qQ,children:(D.id,`Continue`)}),D.id===`import-env`&&(0,R.jsx)(`button`,{type:`button`,onClick:O,style:JQ,children:`Skip for now`}),D.id===`remember`&&(0,R.jsx)(`button`,{type:`button`,onClick:O,style:JQ,children:`Skip for now`}),D.id===`done`&&(0,R.jsx)(`button`,{type:`button`,onClick:N,style:qQ,children:`Go to Memory`})]})]}),(0,R.jsxs)(`p`,{style:{marginTop:32,fontSize:12,color:`var(--text-tertiary)`},children:[`CLI-first: `,(0,R.jsx)(`code`,{children:`init → secret import-env --all → connect → remember → dream`})]}),n<VQ.length-1&&(0,R.jsx)(`button`,{type:`button`,onClick:N,style:{...JQ,marginTop:16,width:`100%`},children:`Skip onboarding → Memory`})]})}var KQ={display:`block`,background:`var(--bg-primary)`,border:`1px solid var(--border)`,borderRadius:8,padding:`10px 12px`,fontSize:12,color:`var(--text-secondary)`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`,overflowX:`auto`},qQ={background:`linear-gradient(135deg, #3b82f6 0%, #2563eb 55%, #1d4ed8 100%)`,color:`#fff`,border:`none`,borderRadius:12,padding:`11px 20px`,fontWeight:600,cursor:`pointer`,fontSize:14,boxShadow:`0 1px 0 rgba(255,255,255,0.15) inset, 0 8px 20px rgba(37, 99, 235, 0.28)`},JQ={background:`rgba(148, 163, 184, 0.06)`,color:`var(--text-secondary)`,border:`1px solid var(--border)`,borderRadius:12,padding:`11px 20px`,cursor:`pointer`,fontSize:14},YQ={...JQ,textDecoration:`none`,display:`inline-block`},XQ={...JQ,padding:`5px 10px`,fontSize:11},ZQ={...qQ,padding:`8px 14px`,fontSize:12},QQ={...JQ,padding:`8px 14px`,fontSize:12};async function $Q(e,t){let n=await e.text(),r=null;if(n)try{r=JSON.parse(n)}catch{r=null}if(!e.ok){let n=r,i=n&&(n.error||n.message)||`${t} failed: ${e.status}`;throw Error(typeof i==`string`?i:`${t} failed: ${e.status}`)}return r}function e$(e){if(Array.isArray(e))return e;if(e&&typeof e==`object`){let t=e;if(Array.isArray(t.rules))return t.rules;if(Array.isArray(t.history))return t.history;if(Array.isArray(t.entries))return t.entries}return[]}async function t$(){return e$(await $Q(await L(`${Rn()}/api/notifications/rules`),`GET /api/notifications/rules`))}async function n$(e){return $Q(await L(`${Rn()}/api/notifications/rules`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),`POST /api/notifications/rules`)}async function r$(e){await $Q(await L(`${Rn()}/api/notifications/rules/${encodeURIComponent(e)}`,{method:`DELETE`}),`DELETE /api/notifications/rules`)}async function i$(){return e$(await $Q(await L(`${Rn()}/api/notifications/history`),`GET /api/notifications/history`))}async function a$(){await $Q(await L(`${Rn()}/api/notifications/test`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})}),`POST /api/notifications/test`)}var o$=[{value:`node_offline`,label:`Node Offline`},{value:`leader_change`,label:`Leader Change`},{value:`webhook_failed`,label:`Webhook Failed`},{value:`secret_sync_failed`,label:`Secret Sync Failed`},{value:`daemon_error`,label:`Daemon Error`},{value:`research_complete`,label:`Research Complete`}],s$=[`desktop`,`webhook`,`email`],c$=[`critical`,`high`,`low`];function l$(){let[e,t]=(0,_.useState)([]),[n,r]=(0,_.useState)([]),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(`node_offline`),[m,h]=(0,_.useState)(`desktop`),[g,v]=(0,_.useState)(`high`),[y,b]=(0,_.useState)(!1);async function x(){l(!0),a(null);try{let[e,n]=await Promise.all([t$(),i$()]);t(e),r(n)}catch(e){a(e instanceof Error?e.message:`Failed to load notifications data`)}finally{l(!1)}}(0,_.useEffect)(()=>{setTimeout(()=>{x()},0);let e=setInterval(x,15e3);return()=>clearInterval(e)},[]);async function S(e){e.preventDefault();try{await n$({event:f,channel:m,priority:g,enabled:!0,quietHours:y}),d(!1),p(o$[0].value),h(`desktop`),v(`high`),b(!1),await x()}catch(e){a(e instanceof Error?e.message:`Failed to create notification rule`)}}async function C(e){if(confirm(`Delete this notification rule?`))try{await r$(e),await x()}catch(e){a(e instanceof Error?e.message:`Failed to delete notification rule`)}}async function w(){try{await a$(),s(`Test notification sent`),setTimeout(()=>s(null),3e3)}catch(e){a(e instanceof Error?e.message:`Failed to send test notification`)}}function T(e){let t=o$.find(t=>t.value===e);return t?t.label:e}return(0,R.jsxs)(`div`,{className:`page-container notifications-page`,"data-testid":`notifications-page`,children:[(0,R.jsxs)(`div`,{className:`page-header`,children:[(0,R.jsx)(`h1`,{children:`Notifications`}),(0,R.jsx)(`button`,{onClick:()=>d(!0),className:`btn btn-primary`,"data-testid":`add-rule-btn`,children:`Add Rule`})]}),i&&(0,R.jsxs)(`div`,{className:`alert alert-error`,role:`alert`,"data-testid":`notifications-error`,style:{marginBottom:`24px`},children:[i,(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,style:{marginLeft:12},onClick:()=>x(),children:`Retry`})]}),o&&(0,R.jsx)(`div`,{className:`alert alert-success`,style:{marginBottom:`24px`},children:o}),(0,R.jsxs)(`div`,{style:{marginBottom:`32px`},children:[(0,R.jsx)(`h2`,{style:{fontSize:`18px`,fontWeight:500,marginBottom:`16px`},children:`Notification Rules`}),(0,R.jsx)(`div`,{className:`card notif-rules-card`,children:(0,R.jsxs)(`table`,{className:`data-table`,children:[(0,R.jsx)(`thead`,{children:(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(`th`,{children:`Event`}),(0,R.jsx)(`th`,{children:`Channel`}),(0,R.jsx)(`th`,{children:`Priority`}),(0,R.jsx)(`th`,{children:`Enabled`}),(0,R.jsx)(`th`,{children:`Quiet Hours`}),(0,R.jsx)(`th`,{children:`Actions`})]})}),(0,R.jsxs)(`tbody`,{children:[e.map(e=>(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(`td`,{style:{fontWeight:500},children:T(e.event)}),(0,R.jsx)(`td`,{style:{textTransform:`capitalize`},children:e.channel}),(0,R.jsx)(`td`,{children:(0,R.jsx)(`span`,{className:`priority-badge ${e.priority}`,children:e.priority.toUpperCase()})}),(0,R.jsx)(`td`,{children:(0,R.jsx)(`span`,{className:`badge ${e.enabled?`badge-online`:`badge-offline`}`,children:e.enabled?`ON`:`OFF`})}),(0,R.jsx)(`td`,{children:(0,R.jsx)(`span`,{className:`badge ${e.quietHours?`badge-warning`:`badge-offline`}`,children:e.quietHours?`ACTIVE`:`OFF`})}),(0,R.jsx)(`td`,{children:(0,R.jsx)(`div`,{className:`notif-rules-actions`,children:(0,R.jsx)(`button`,{onClick:()=>C(e.id),className:`btn btn-ghost btn-sm`,style:{color:`var(--error)`},children:`Remove`})})})]},e.id)),e.length===0&&!c&&(0,R.jsx)(`tr`,{children:(0,R.jsx)(`td`,{colSpan:6,className:`notif-empty`,children:`No notification rules configured`})})]})]})})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`notif-history-header`,children:[(0,R.jsx)(`h2`,{children:`Recent Notifications`}),(0,R.jsx)(`button`,{onClick:w,className:`btn btn-ghost btn-sm`,children:`Send Test`})]}),(0,R.jsx)(`div`,{className:`card`,style:{padding:`16px`},children:n.length===0?(0,R.jsx)(`p`,{className:`notif-empty`,children:`No recent notifications`}):(0,R.jsx)(`div`,{className:`notif-history-list`,children:n.map(e=>(0,R.jsxs)(`div`,{className:`notif-history-entry`,children:[(0,R.jsxs)(`div`,{className:`notif-entry-content`,children:[(0,R.jsx)(`span`,{className:`notif-entry-title`,children:e.title}),(0,R.jsx)(`span`,{className:`notif-entry-message`,children:e.message})]}),(0,R.jsxs)(`div`,{className:`notif-entry-meta`,children:[(0,R.jsx)(`span`,{className:`notif-entry-time`,children:new Date(e.timestamp).toLocaleString()}),(0,R.jsx)(`span`,{className:`notif-status-badge ${e.status}`,children:e.status.toUpperCase()})]})]},e.id))})})]}),u&&(0,R.jsx)(`div`,{className:`modal-overlay`,onClick:()=>d(!1),children:(0,R.jsxs)(`div`,{className:`modal-content`,onClick:e=>e.stopPropagation(),children:[(0,R.jsx)(`div`,{className:`modal-title`,children:`Add Notification Rule`}),(0,R.jsxs)(`form`,{onSubmit:S,className:`modal-form`,children:[(0,R.jsxs)(`div`,{className:`form-group`,children:[(0,R.jsx)(`label`,{className:`form-label`,children:`Event`}),(0,R.jsx)(`select`,{value:f,onChange:e=>p(e.target.value),className:`select`,children:o$.map(e=>(0,R.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,R.jsxs)(`div`,{className:`form-group`,children:[(0,R.jsx)(`label`,{className:`form-label`,children:`Channel`}),(0,R.jsx)(`select`,{value:m,onChange:e=>h(e.target.value),className:`select`,children:s$.map(e=>(0,R.jsx)(`option`,{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),(0,R.jsxs)(`div`,{className:`form-group`,children:[(0,R.jsx)(`label`,{className:`form-label`,children:`Priority`}),(0,R.jsx)(`select`,{value:g,onChange:e=>v(e.target.value),className:`select`,children:c$.map(e=>(0,R.jsx)(`option`,{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),(0,R.jsx)(`div`,{className:`form-group`,children:(0,R.jsxs)(`div`,{className:`notif-quiet-hours-row`,children:[(0,R.jsx)(`div`,{className:`notif-toggle ${y?`active`:``}`,onClick:()=>b(!y),role:`switch`,"aria-checked":y,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),b(!y))}}),(0,R.jsx)(`span`,{className:`notif-quiet-hours-label`,children:`Enable Quiet Hours`})]})}),(0,R.jsxs)(`div`,{className:`modal-actions`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>d(!1),className:`btn btn-ghost`,children:`Cancel`}),(0,R.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,children:`Add Rule`})]})]})]})})]})}var u$={"/":"### Chat Interface\nWelcome to the interactive chat interface. Here you can talk directly to your active agent. Use `/skills` to invoke specialized tools.","/memory":`### Memory Vault
|
|
5623
|
+
GOOGLE_API_KEY=...`,rows:6,style:{width:`100%`,boxSizing:`border-box`,background:`var(--bg-primary)`,border:`1px solid var(--border)`,borderRadius:10,padding:12,color:`var(--text-primary)`,fontSize:12,fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`,resize:`vertical`}}),(0,R.jsx)(`button`,{type:`button`,disabled:c,onClick:j,style:{...IQ,marginTop:8},children:`Preview keys in paste`})]}),C&&(0,R.jsx)(`p`,{style:{fontSize:13,color:`var(--text-tertiary)`},children:`Scanning env sources…`}),x&&(0,R.jsx)(`p`,{style:{fontSize:13,color:`#f87171`,marginBottom:12},children:x}),!C&&f.length===0&&!x&&(0,R.jsx)(`div`,{style:{padding:14,borderRadius:10,border:`1px solid var(--border)`,background:`rgba(148,163,184,0.06)`,fontSize:13,color:`var(--text-secondary)`,marginBottom:12},children:T===`scan`?`No known API keys found in process.env or common .env paths (~/.agent/.env, project .env, …). Paste a .env or continue and set keys later with secret set.`:`Paste your .env and click Preview.`}),f.length>0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{style:{display:`flex`,gap:8,marginBottom:10,flexWrap:`wrap`},children:[(0,R.jsx)(`button`,{type:`button`,onClick:te,style:RQ,children:`Select new`}),(0,R.jsx)(`button`,{type:`button`,onClick:A,style:RQ,children:`Clear`}),(0,R.jsxs)(`span`,{style:{fontSize:12,color:`var(--text-tertiary)`,alignSelf:`center`},children:[m.size,` selected · values never shown raw`]})]}),(0,R.jsx)(`div`,{style:{maxHeight:280,overflowY:`auto`,border:`1px solid var(--border)`,borderRadius:12,marginBottom:12},children:f.map(e=>(0,R.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:10,padding:`10px 12px`,borderBottom:`1px solid var(--border)`,cursor:e.already_set?`default`:`pointer`,opacity:e.already_set?.55:1,background:m.has(e.key)?`rgba(59,130,246,0.08)`:`transparent`},children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:m.has(e.key),disabled:!!e.already_set,onChange:()=>k(e.key),style:{accentColor:`#3b82f6`}}),(0,R.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,R.jsxs)(`div`,{style:{fontSize:12,fontWeight:600,fontFamily:`ui-monospace, monospace`},children:[e.key,e.provider&&(0,R.jsx)(`span`,{style:{marginLeft:8,fontSize:10,color:`#93c5fd`,fontWeight:500},children:e.provider}),e.already_set&&(0,R.jsx)(`span`,{style:{marginLeft:8,fontSize:10,color:`#34d399`},children:`already set`})]}),(0,R.jsxs)(`div`,{style:{fontSize:11,color:`var(--text-tertiary)`,marginTop:2},children:[e.masked,` · `,e.source_label]})]})]},e.key+e.source_label))}),(0,R.jsx)(`button`,{type:`button`,disabled:c||m.size===0,onClick:M,style:{...FQ,opacity:c||m.size===0?.5:1,cursor:c||m.size===0?`not-allowed`:`pointer`},children:c?`Importing…`:`Import ${m.size} secret(s)`})]}),(0,R.jsxs)(`p`,{style:{marginTop:14,fontSize:12,color:`var(--text-tertiary)`},children:[`CLI: `,(0,R.jsx)(`code`,{children:`npx total-recall secret import-env --all`}),` · `,(0,R.jsx)(En,{to:`/keys`,style:{color:`var(--accent)`},children:`Secrets page`})]})]}),D.id===`remember`&&(0,R.jsxs)(`div`,{style:{marginBottom:24},children:[(0,R.jsx)(`label`,{style:{fontSize:12,fontWeight:600,color:`var(--text-tertiary)`,display:`block`,marginBottom:8},children:`First memory (fact or preference)`}),(0,R.jsx)(`textarea`,{value:i,onChange:e=>a(e.target.value),placeholder:`e.g. "I prefer short answers and single quotes in JS."`,rows:4,style:{width:`100%`,boxSizing:`border-box`,background:`var(--bg-primary)`,border:`1px solid var(--border)`,borderRadius:10,padding:12,color:`var(--text-primary)`,fontSize:14,resize:`vertical`}}),(0,R.jsx)(`button`,{type:`button`,disabled:c,onClick:ne,style:{...FQ,marginTop:12},children:c?`Saving…`:`Save to vault & continue`})]}),D.id===`connect`&&(0,R.jsxs)(`div`,{style:{marginBottom:24,display:`flex`,flexDirection:`column`,gap:10},children:[(0,R.jsx)(`code`,{style:PQ,children:`npx total-recall connect claude-code`}),(0,R.jsx)(`code`,{style:PQ,children:`npx total-recall connect cursor`}),(0,R.jsx)(`code`,{style:PQ,children:`npx total-recall connect http-api --brain http://localhost:3000`}),(0,R.jsx)(En,{to:`/integrations`,style:{fontSize:13,color:`var(--accent)`},children:`Open Integrations page →`})]}),D.id===`dream`&&(0,R.jsxs)(`div`,{style:{marginBottom:24,display:`flex`,flexDirection:`column`,gap:10},children:[(0,R.jsx)(`code`,{style:PQ,children:`npx total-recall dream`}),(0,R.jsx)(`code`,{style:PQ,children:`npx total-recall daemon start # optional background worker`}),(0,R.jsx)(`code`,{style:PQ,children:`npx total-recall task add "Extract decisions from last session" --cap vault:write`}),(0,R.jsx)(En,{to:`/tasks`,style:{fontSize:13,color:`var(--accent)`},children:`Open Tasks page →`})]}),D.id===`done`&&(0,R.jsxs)(`div`,{style:{marginBottom:24,padding:16,borderRadius:12,background:`rgba(34,197,94,0.08)`,border:`1px solid rgba(34,197,94,0.25)`,fontSize:14,color:`var(--text-secondary)`},children:[u?`Vault already has onboarding profile data — you can jump to Memory anytime.`:`Optional: chat with the assistant to run the full preference interview (user-profile.md).`,(0,R.jsxs)(`div`,{style:{marginTop:12,display:`flex`,gap:12,flexWrap:`wrap`},children:[(0,R.jsx)(En,{to:`/`,style:LQ,children:`Open Chat`}),(0,R.jsx)(En,{to:`/memory`,style:LQ,children:`Open Vault`}),(0,R.jsx)(En,{to:`/integrations`,style:LQ,children:`Connect IDE`})]})]}),o&&(0,R.jsx)(`p`,{style:{fontSize:13,color:o.startsWith(`Saved`)||o.startsWith(`Imported`)||o.startsWith(`Found`)?`#22c55e`:`#f59e0b`,marginBottom:16},children:o}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:10,justifyContent:`space-between`},children:[(0,R.jsx)(`button`,{type:`button`,onClick:ee,disabled:n===0,style:IQ,children:`Back`}),(0,R.jsxs)(`div`,{style:{display:`flex`,gap:10},children:[D.id!==`done`&&D.id!==`remember`&&(0,R.jsx)(`button`,{type:`button`,onClick:O,style:FQ,children:(D.id,`Continue`)}),D.id===`import-env`&&(0,R.jsx)(`button`,{type:`button`,onClick:O,style:IQ,children:`Skip for now`}),D.id===`remember`&&(0,R.jsx)(`button`,{type:`button`,onClick:O,style:IQ,children:`Skip for now`}),D.id===`done`&&(0,R.jsx)(`button`,{type:`button`,onClick:N,style:FQ,children:`Go to Memory`})]})]}),(0,R.jsxs)(`p`,{style:{marginTop:32,fontSize:12,color:`var(--text-tertiary)`},children:[`CLI-first: `,(0,R.jsx)(`code`,{children:`init → secret import-env --all → connect → remember → dream`})]}),n<kQ.length-1&&(0,R.jsx)(`button`,{type:`button`,onClick:N,style:{...IQ,marginTop:16,width:`100%`},children:`Skip onboarding → Memory`})]})}var PQ={display:`block`,background:`var(--bg-primary)`,border:`1px solid var(--border)`,borderRadius:8,padding:`10px 12px`,fontSize:12,color:`var(--text-secondary)`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`,overflowX:`auto`},FQ={background:`linear-gradient(135deg, #3b82f6 0%, #2563eb 55%, #1d4ed8 100%)`,color:`#fff`,border:`none`,borderRadius:12,padding:`11px 20px`,fontWeight:600,cursor:`pointer`,fontSize:14,boxShadow:`0 1px 0 rgba(255,255,255,0.15) inset, 0 8px 20px rgba(37, 99, 235, 0.28)`},IQ={background:`rgba(148, 163, 184, 0.06)`,color:`var(--text-secondary)`,border:`1px solid var(--border)`,borderRadius:12,padding:`11px 20px`,cursor:`pointer`,fontSize:14},LQ={...IQ,textDecoration:`none`,display:`inline-block`},RQ={...IQ,padding:`5px 10px`,fontSize:11},zQ={...FQ,padding:`8px 14px`,fontSize:12},BQ={...IQ,padding:`8px 14px`,fontSize:12};async function VQ(e,t){let n=await e.text(),r=null;if(n)try{r=JSON.parse(n)}catch{r=null}if(!e.ok){let n=r,i=n&&(n.error||n.message)||`${t} failed: ${e.status}`;throw Error(typeof i==`string`?i:`${t} failed: ${e.status}`)}return r}function HQ(e){if(Array.isArray(e))return e;if(e&&typeof e==`object`){let t=e;if(Array.isArray(t.rules))return t.rules;if(Array.isArray(t.history))return t.history;if(Array.isArray(t.entries))return t.entries}return[]}async function UQ(){return HQ(await VQ(await L(`${Rn()}/api/notifications/rules`),`GET /api/notifications/rules`))}async function WQ(e){return VQ(await L(`${Rn()}/api/notifications/rules`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}),`POST /api/notifications/rules`)}async function GQ(e){await VQ(await L(`${Rn()}/api/notifications/rules/${encodeURIComponent(e)}`,{method:`DELETE`}),`DELETE /api/notifications/rules`)}async function KQ(){return HQ(await VQ(await L(`${Rn()}/api/notifications/history`),`GET /api/notifications/history`))}async function qQ(){await VQ(await L(`${Rn()}/api/notifications/test`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})}),`POST /api/notifications/test`)}var JQ=[{value:`node_offline`,label:`Node Offline`},{value:`leader_change`,label:`Leader Change`},{value:`webhook_failed`,label:`Webhook Failed`},{value:`secret_sync_failed`,label:`Secret Sync Failed`},{value:`daemon_error`,label:`Daemon Error`},{value:`research_complete`,label:`Research Complete`}],YQ=[`desktop`,`webhook`,`email`],XQ=[`critical`,`high`,`low`];function ZQ(){let[e,t]=(0,_.useState)([]),[n,r]=(0,_.useState)([]),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(`node_offline`),[m,h]=(0,_.useState)(`desktop`),[g,v]=(0,_.useState)(`high`),[y,b]=(0,_.useState)(!1);async function x(){l(!0),a(null);try{let[e,n]=await Promise.all([UQ(),KQ()]);t(e),r(n)}catch(e){a(e instanceof Error?e.message:`Failed to load notifications data`)}finally{l(!1)}}(0,_.useEffect)(()=>{setTimeout(()=>{x()},0);let e=setInterval(x,15e3);return()=>clearInterval(e)},[]);async function S(e){e.preventDefault();try{await WQ({event:f,channel:m,priority:g,enabled:!0,quietHours:y}),d(!1),p(JQ[0].value),h(`desktop`),v(`high`),b(!1),await x()}catch(e){a(e instanceof Error?e.message:`Failed to create notification rule`)}}async function C(e){if(confirm(`Delete this notification rule?`))try{await GQ(e),await x()}catch(e){a(e instanceof Error?e.message:`Failed to delete notification rule`)}}async function w(){try{await qQ(),s(`Test notification sent`),setTimeout(()=>s(null),3e3)}catch(e){a(e instanceof Error?e.message:`Failed to send test notification`)}}function T(e){let t=JQ.find(t=>t.value===e);return t?t.label:e}return(0,R.jsxs)(`div`,{className:`page-container notifications-page`,"data-testid":`notifications-page`,children:[(0,R.jsxs)(`div`,{className:`page-header`,children:[(0,R.jsx)(`h1`,{children:`Notifications`}),(0,R.jsx)(`button`,{onClick:()=>d(!0),className:`btn btn-primary`,"data-testid":`add-rule-btn`,children:`Add Rule`})]}),i&&(0,R.jsxs)(`div`,{className:`alert alert-error`,role:`alert`,"data-testid":`notifications-error`,style:{marginBottom:`24px`},children:[i,(0,R.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,style:{marginLeft:12},onClick:()=>x(),children:`Retry`})]}),o&&(0,R.jsx)(`div`,{className:`alert alert-success`,style:{marginBottom:`24px`},children:o}),(0,R.jsxs)(`div`,{style:{marginBottom:`32px`},children:[(0,R.jsx)(`h2`,{style:{fontSize:`18px`,fontWeight:500,marginBottom:`16px`},children:`Notification Rules`}),(0,R.jsx)(`div`,{className:`card notif-rules-card`,children:(0,R.jsxs)(`table`,{className:`data-table`,children:[(0,R.jsx)(`thead`,{children:(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(`th`,{children:`Event`}),(0,R.jsx)(`th`,{children:`Channel`}),(0,R.jsx)(`th`,{children:`Priority`}),(0,R.jsx)(`th`,{children:`Enabled`}),(0,R.jsx)(`th`,{children:`Quiet Hours`}),(0,R.jsx)(`th`,{children:`Actions`})]})}),(0,R.jsxs)(`tbody`,{children:[e.map(e=>(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(`td`,{style:{fontWeight:500},children:T(e.event)}),(0,R.jsx)(`td`,{style:{textTransform:`capitalize`},children:e.channel}),(0,R.jsx)(`td`,{children:(0,R.jsx)(`span`,{className:`priority-badge ${e.priority}`,children:e.priority.toUpperCase()})}),(0,R.jsx)(`td`,{children:(0,R.jsx)(`span`,{className:`badge ${e.enabled?`badge-online`:`badge-offline`}`,children:e.enabled?`ON`:`OFF`})}),(0,R.jsx)(`td`,{children:(0,R.jsx)(`span`,{className:`badge ${e.quietHours?`badge-warning`:`badge-offline`}`,children:e.quietHours?`ACTIVE`:`OFF`})}),(0,R.jsx)(`td`,{children:(0,R.jsx)(`div`,{className:`notif-rules-actions`,children:(0,R.jsx)(`button`,{onClick:()=>C(e.id),className:`btn btn-ghost btn-sm`,style:{color:`var(--error)`},children:`Remove`})})})]},e.id)),e.length===0&&!c&&(0,R.jsx)(`tr`,{children:(0,R.jsx)(`td`,{colSpan:6,className:`notif-empty`,children:`No notification rules configured`})})]})]})})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`notif-history-header`,children:[(0,R.jsx)(`h2`,{children:`Recent Notifications`}),(0,R.jsx)(`button`,{onClick:w,className:`btn btn-ghost btn-sm`,children:`Send Test`})]}),(0,R.jsx)(`div`,{className:`card`,style:{padding:`16px`},children:n.length===0?(0,R.jsx)(`p`,{className:`notif-empty`,children:`No recent notifications`}):(0,R.jsx)(`div`,{className:`notif-history-list`,children:n.map(e=>(0,R.jsxs)(`div`,{className:`notif-history-entry`,children:[(0,R.jsxs)(`div`,{className:`notif-entry-content`,children:[(0,R.jsx)(`span`,{className:`notif-entry-title`,children:e.title}),(0,R.jsx)(`span`,{className:`notif-entry-message`,children:e.message})]}),(0,R.jsxs)(`div`,{className:`notif-entry-meta`,children:[(0,R.jsx)(`span`,{className:`notif-entry-time`,children:new Date(e.timestamp).toLocaleString()}),(0,R.jsx)(`span`,{className:`notif-status-badge ${e.status}`,children:e.status.toUpperCase()})]})]},e.id))})})]}),u&&(0,R.jsx)(`div`,{className:`modal-overlay`,onClick:()=>d(!1),children:(0,R.jsxs)(`div`,{className:`modal-content`,onClick:e=>e.stopPropagation(),children:[(0,R.jsx)(`div`,{className:`modal-title`,children:`Add Notification Rule`}),(0,R.jsxs)(`form`,{onSubmit:S,className:`modal-form`,children:[(0,R.jsxs)(`div`,{className:`form-group`,children:[(0,R.jsx)(`label`,{className:`form-label`,children:`Event`}),(0,R.jsx)(`select`,{value:f,onChange:e=>p(e.target.value),className:`select`,children:JQ.map(e=>(0,R.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,R.jsxs)(`div`,{className:`form-group`,children:[(0,R.jsx)(`label`,{className:`form-label`,children:`Channel`}),(0,R.jsx)(`select`,{value:m,onChange:e=>h(e.target.value),className:`select`,children:YQ.map(e=>(0,R.jsx)(`option`,{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),(0,R.jsxs)(`div`,{className:`form-group`,children:[(0,R.jsx)(`label`,{className:`form-label`,children:`Priority`}),(0,R.jsx)(`select`,{value:g,onChange:e=>v(e.target.value),className:`select`,children:XQ.map(e=>(0,R.jsx)(`option`,{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),(0,R.jsx)(`div`,{className:`form-group`,children:(0,R.jsxs)(`div`,{className:`notif-quiet-hours-row`,children:[(0,R.jsx)(`div`,{className:`notif-toggle ${y?`active`:``}`,onClick:()=>b(!y),role:`switch`,"aria-checked":y,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),b(!y))}}),(0,R.jsx)(`span`,{className:`notif-quiet-hours-label`,children:`Enable Quiet Hours`})]})}),(0,R.jsxs)(`div`,{className:`modal-actions`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>d(!1),className:`btn btn-ghost`,children:`Cancel`}),(0,R.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,children:`Add Rule`})]})]})]})})]})}var QQ={"/":"### Chat Interface\nWelcome to the interactive chat interface. Here you can talk directly to your active agent. Use `/skills` to invoke specialized tools.","/memory":`### Memory Vault
|
|
5611
5624
|
This page displays your active SSSS (Structured Semantic Syntax System) memory nodes. These nodes dynamically rebuild the prompt instructions injected into your IDEs.`,"/graph":`### Concept Graph
|
|
5612
5625
|
Visualize the semantic relationships between all of your nodes and architectural decisions across the entire workspace.`,"/tasks":`### Background Tasks
|
|
5613
5626
|
Manage and review long-running background tasks (like the Dream Cycle or asynchronous Research operations).`,"/integrations":"### IDE Integrations\nConfigure your IDE mappings. Any changes here will write the appropriate markdown files (e.g., `.cursorrules`, `CLAUDE.md`) directly into your repository.","/skills":`### Agent Skills
|
|
@@ -5615,4 +5628,4 @@ Review your currently active skills. Skills provide the underlying tooling capab
|
|
|
5615
5628
|
Explore auto-generated architectural diagrams and knowledge base documents inferred directly from your project codebase.`,"/keys":"### Keys & Usage\nConfigure your API keys (Anthropic, Google, OpenAI, etc.) and view your realtime USD token expenditures based on the `budget.yml` constraints.","/settings":`### Global Settings
|
|
5616
5629
|
Configure the daemon behavior, Sandbox enforcement, network bindings, and overarching agent execution priorities.`,"/help":`### Help Center
|
|
5617
5630
|
Detailed documentation regarding the CLI architecture, SSSS definitions, and internal mechanisms.`,"/onboarding":`### Setup Guide
|
|
5618
|
-
The primary deployment scaffolding tool. Select your target environment and initialize the memory database.`};function d$(){let[e,t]=(0,_.useState)(!1),n=lt(),[r,i]=(0,_.useState)(``);return(0,_.useEffect)(()=>{let e=n.pathname;setTimeout(()=>{i(u$[e]||`### ${e}\nNo specific documentation is available for this route yet.`)},0)},[n.pathname]),(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{onClick:()=>t(!0),style:{position:`fixed`,bottom:`24px`,right:`24px`,width:`48px`,height:`48px`,borderRadius:`24px`,backgroundColor:`var(--accent-primary, #6366f1)`,color:`#fff`,border:`none`,boxShadow:`0 4px 12px rgba(0,0,0,0.3)`,cursor:`pointer`,zIndex:9998,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:`24px`,fontWeight:`bold`},title:`Page Help`,children:`?`}),e&&(0,R.jsx)(`div`,{style:{position:`fixed`,top:0,left:0,right:0,bottom:0,backgroundColor:`rgba(0,0,0,0.5)`,zIndex:9999,display:`flex`,alignItems:`center`,justifyContent:`center`},onClick:()=>t(!1),children:(0,R.jsxs)(`div`,{style:{width:`500px`,maxWidth:`90vw`,maxHeight:`80vh`,backgroundColor:`var(--bg-primary, #1e1e1e)`,color:`var(--text-primary, #e5e5e5)`,padding:`2rem`,borderRadius:`12px`,overflowY:`auto`,boxShadow:`0 10px 25px rgba(0,0,0,0.5)`,lineHeight:1.6},onClick:e=>e.stopPropagation(),children:[(0,R.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`},children:(0,R.jsx)(`button`,{onClick:()=>t(!1),style:{background:`transparent`,border:`none`,color:`var(--text-secondary, #a3a3a3)`,cursor:`pointer`,fontSize:`18px`},children:`✕`})}),(0,R.jsx)(`div`,{style:{whiteSpace:`pre-wrap`},children:r})]})})]})}function f$({ok:e,label:t}){return(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:5,color:`var(--text-tertiary)`},children:[(0,R.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:e?`#22c55e`:`#ef4444`,boxShadow:e?`0 0 6px rgba(34,197,94,0.5)`:`0 0 6px rgba(239,68,68,0.5)`,display:`inline-block`,animation:e?void 0:`blink 1s ease-in-out infinite`}}),t]})}function p$(e){if(!e)return{color:`#94a3b8`,label:`Gate n/a`,title:`Fetch gate stats not available`};let t=e.total_errors||0,n=e.total_blocked||0,r=e.current_queue_depth||0,i=e.current_in_flight||0,a=`dispatched ${e.total_dispatched??0} · errors ${t} · blocked ${n} · in-flight ${i} · queue ${r}`;return t>0&&(e.total_completed||0)===0&&(e.total_dispatched||0)>0?{color:`#ef4444`,label:`Gate errors`,title:a}:t>5||r>10||n>20?{color:`#ef4444`,label:`Gate hot`,title:a}:t>0||r>0||n>0||i>(e.max_global_concurrency||6)*.75?{color:`#f59e0b`,label:`Gate busy`,title:a}:{color:`#22c55e`,label:`Gate ok`,title:a}}var m$=({isActive:e})=>`nav-link ${e?`active`:``}`;function h$({onLogout:e,health:t,activeBrainId:n,onBrainChange:r}){return(0,R.jsxs)(`aside`,{className:`sidebar`,children:[(0,R.jsxs)(`div`,{className:`sidebar-brand`,style:{display:`flex`,alignItems:`center`,gap:12,padding:`16px 14px`},children:[(0,R.jsx)(Fi,{animated:!0,height:44,alt:`Total Recall`}),(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,R.jsx)(`span`,{style:{fontSize:15,fontWeight:700,letterSpacing:`-0.02em`,color:`#f8fafc`},children:`Total Recall`}),(0,R.jsx)(`span`,{style:{fontSize:10,fontWeight:600,padding:`2px 5px`,borderRadius:4,background:`rgba(59,130,246,0.15)`,color:`#60a5fa`,border:`1px solid rgba(59,130,246,0.3)`},children:t?.version?`v${t.version}`:`Version unknown`})]}),(0,R.jsx)(`span`,{style:{fontSize:11,color:`var(--text-tertiary)`,letterSpacing:`0.01em`},children:`Portable memory · any IDE`})]})]}),(0,R.jsxs)(`nav`,{className:`sidebar-nav`,children:[(0,R.jsx)(`div`,{className:`nav-section-label`,children:`Memory`}),!zQ()&&(0,R.jsxs)(Dn,{to:`/onboarding`,className:m$,id:`nav-onboarding`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M12 2L2 7l10 5 10-5-10-5z`}),(0,R.jsx)(`path`,{d:`M2 17l10 5 10-5`}),(0,R.jsx)(`path`,{d:`M2 12l10 5 10-5`})]}),`Setup`]}),(0,R.jsxs)(Dn,{to:`/`,end:!0,className:m$,id:`nav-chat`,children:[(0,R.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,R.jsx)(`path`,{d:`M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z`})}),`Chat`]}),(0,R.jsxs)(Dn,{to:`/memory`,className:m$,id:`nav-memory`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,R.jsx)(`path`,{d:`M12 16v-4M12 8h.01`})]}),`Vault`]}),(0,R.jsxs)(Dn,{to:`/rules`,className:m$,id:`nav-rules`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16c0 1.1.9 2 2 2h12a2 2 0 0 0 2-2V8l-6-6z`}),(0,R.jsx)(`path`,{d:`M14 3v5h5M16 13H8M16 17H8M10 9H8`})]}),`Rules`]}),(0,R.jsxs)(Dn,{to:`/graph`,className:m$,id:`nav-graph`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`circle`,{cx:`5`,cy:`6`,r:`2`}),(0,R.jsx)(`circle`,{cx:`19`,cy:`6`,r:`2`}),(0,R.jsx)(`circle`,{cx:`12`,cy:`18`,r:`2`}),(0,R.jsx)(`path`,{d:`M7 7l4 9M17 7l-4 9`})]}),`Graph`]}),(0,R.jsxs)(Dn,{to:`/tasks`,className:m$,id:`nav-tasks`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M9 11l3 3L22 4`}),(0,R.jsx)(`path`,{d:`M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11`})]}),`Tasks`]}),(0,R.jsx)(`div`,{className:`nav-section-label`,children:`Connect`}),(0,R.jsxs)(Dn,{to:`/integrations`,className:m$,id:`nav-integrations`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71`}),(0,R.jsx)(`path`,{d:`M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71`})]}),`IDEs`]}),(0,R.jsxs)(Dn,{to:`/skills`,className:m$,id:`nav-skills`,children:[(0,R.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,R.jsx)(`path`,{d:`M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5`})}),`Skills`]}),(0,R.jsxs)(Dn,{to:`/plugins`,className:m$,id:`nav-plugins`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`}),(0,R.jsx)(`polyline`,{points:`3.27 6.96 12 12.01 20.73 6.96`}),(0,R.jsx)(`line`,{x1:`12`,y1:`22.08`,x2:`12`,y2:`12`})]}),`Plugins`]}),(0,R.jsx)(`div`,{className:`nav-section-label`,children:`Account`}),(0,R.jsxs)(Dn,{to:`/network`,className:m$,id:`nav-network`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`rect`,{x:`2`,y:`2`,width:`20`,height:`8`,rx:`2`,ry:`2`}),(0,R.jsx)(`rect`,{x:`2`,y:`14`,width:`20`,height:`8`,rx:`2`,ry:`2`}),(0,R.jsx)(`line`,{x1:`6`,y1:`6`,x2:`6.01`,y2:`6`}),(0,R.jsx)(`line`,{x1:`6`,y1:`18`,x2:`6.01`,y2:`18`})]}),`Network`]}),(0,R.jsxs)(Dn,{to:`/mesh`,className:m$,id:`nav-mesh`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M12 2L2 7l10 5 10-5-10-5z`}),(0,R.jsx)(`path`,{d:`M2 17l10 5 10-5`}),(0,R.jsx)(`path`,{d:`M2 12l10 5 10-5`})]}),`Mesh`]}),(0,R.jsxs)(Dn,{to:`/webhooks`,className:m$,id:`nav-webhooks`,children:[(0,R.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,R.jsx)(`path`,{d:`M22 12h-4l-3 9L9 3l-3 9H2`})}),`Webhooks`]}),(0,R.jsxs)(Dn,{to:`/secrets`,className:m$,id:`nav-secrets`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`rect`,{x:`3`,y:`11`,width:`18`,height:`11`,rx:`2`,ry:`2`}),(0,R.jsx)(`path`,{d:`M7 11V7a5 5 0 0110 0v4`})]}),`Secrets & Keys`]}),(0,R.jsxs)(Dn,{to:`/notifications`,className:m$,id:`nav-notifications`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M18 8A6 6 0 006 8c0 7-3 9-3 9h18s-3-2-3-9`}),(0,R.jsx)(`path`,{d:`M13.73 21a2 2 0 01-3.46 0`})]}),`Notifications`]}),(0,R.jsxs)(Dn,{to:`/settings`,className:m$,id:`nav-settings`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,R.jsx)(`path`,{d:`M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-4 0v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83-2.83l.06-.06A1.65 1.65 0 004.68 15a1.65 1.65 0 00-1.51-1H3a2 2 0 010-4h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 012.83-2.83l.06.06A1.65 1.65 0 009 4.68a1.65 1.65 0 001-1.51V3a2 2 0 014 0v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 2.83l-.06.06A1.65 1.65 0 0019.4 9a1.65 1.65 0 001.51 1H21a2 2 0 010 4h-.09a1.65 1.65 0 00-1.51 1z`})]}),`Settings`]}),(0,R.jsxs)(Dn,{to:`/help`,className:m$,id:`nav-help`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,R.jsx)(`path`,{d:`M9.09 9a3 3 0 015.83 1c0 2-3 3-3 3`}),(0,R.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}),`Help`]}),zQ()&&(0,R.jsxs)(Dn,{to:`/onboarding`,className:m$,id:`nav-onboarding-replay`,style:{opacity:.75},children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M12 2L2 7l10 5 10-5-10-5z`}),(0,R.jsx)(`path`,{d:`M2 17l10 5 10-5`}),(0,R.jsx)(`path`,{d:`M2 12l10 5 10-5`})]}),`Setup guide`]})]}),(0,R.jsxs)(`div`,{className:`sidebar-footer`,style:{display:`flex`,flexDirection:`column`,gap:8},children:[(0,R.jsx)(hZ,{activeBrainId:n,onBrainChange:r}),(0,R.jsxs)(`select`,{value:Rn(),onChange:e=>zn(e.target.value),title:`API host`,style:{width:`100%`,background:`rgba(148, 163, 184, 0.06)`,color:`var(--text-tertiary)`,border:`1px solid var(--border)`,borderRadius:8,padding:`5px 8px`,fontSize:10,outline:`none`},children:[(0,R.jsx)(`option`,{value:``,children:`Local API`}),void 0]}),(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,R.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4,fontSize:11},children:(()=>{let e=t?.daemon===`running`,n=t&&t.status!==`unreachable`,r=e&&n,i=p$(t?.fetch_gate);return t?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`style`,{children:`@keyframes blink { 0%,100%{opacity:1;} 50%{opacity:0.3;} }`}),r?(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:5,color:`var(--text-tertiary)`},children:[(0,R.jsx)(`span`,{className:`pulse`}),` All Systems Go`]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(f$,{ok:!!n,label:n?`Server online`:`Server offline`}),(0,R.jsx)(f$,{ok:e,label:e?`Daemon`:`Daemon `+(t?.daemon??`unknown`)})]}),(0,R.jsxs)(`div`,{"data-testid":`network-gate-indicator`,title:i.title,style:{display:`flex`,alignItems:`center`,gap:5,color:`var(--text-tertiary)`},children:[(0,R.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:i.color,boxShadow:`0 0 6px ${i.color}80`,display:`inline-block`}}),(0,R.jsx)(Dn,{to:`/network`,style:{color:`inherit`,textDecoration:`none`,fontSize:11},title:i.title,children:i.label})]})]}):(0,R.jsx)(`div`,{style:{color:`var(--text-tertiary)`},children:`Checking…`})})()}),(0,R.jsxs)(`button`,{id:`btn-logout`,onClick:e,title:`Sign out`,style:{background:`none`,border:`1px solid var(--border)`,borderRadius:6,cursor:`pointer`,color:`var(--text-tertiary)`,display:`flex`,alignItems:`center`,gap:5,padding:`4px 8px`,fontSize:11,transition:`color 0.15s, border-color 0.15s`},onMouseEnter:e=>{e.currentTarget.style.color=`#ef4444`,e.currentTarget.style.borderColor=`#ef4444`},onMouseLeave:e=>{e.currentTarget.style.color=`var(--text-tertiary)`,e.currentTarget.style.borderColor=`var(--border)`},children:[(0,R.jsxs)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M9 21H5a2 2 0 01-2-2V5a2 2 0 012-2h4`}),(0,R.jsx)(`polyline`,{points:`16 17 21 12 16 7`}),(0,R.jsx)(`line`,{x1:`21`,y1:`12`,x2:`9`,y2:`12`})]}),`Sign out`]})]})]})]})}function g$(){let e=lt();return!zQ()&&e.pathname!==`/onboarding`?(0,R.jsx)(Ft,{to:`/onboarding`,replace:!0}):null}function _$({activeBrainId:e,onBrainChange:t}){let n=lt(),r=n.pathname===`/`||n.pathname===`/chat`,[i,a]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{let e=()=>a(e=>!e);return window.addEventListener(`toggle-floating-chat`,e),()=>window.removeEventListener(`toggle-floating-chat`,e)},[]),(0,R.jsxs)(`main`,{className:`main-content`,style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`,position:`relative`},children:[(0,R.jsx)(g$,{}),(0,R.jsxs)(`div`,{style:i?{display:`flex`,position:`fixed`,bottom:20,right:20,width:400,height:600,zIndex:9999,backgroundColor:`var(--bg-primary)`,border:`1px solid var(--border)`,borderRadius:12,boxShadow:`0 8px 32px rgba(0, 0, 0, 0.4)`,overflow:`hidden`,flexDirection:`column`}:{display:r||i?`flex`:`none`,flex:1,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[i&&(0,R.jsxs)(`div`,{style:{padding:`8px`,background:`var(--bg-secondary)`,borderBottom:`1px solid var(--border)`,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,R.jsxs)(`span`,{style:{fontSize:12,fontWeight:600,display:`flex`,alignItems:`center`,gap:8},children:[(0,R.jsx)(`img`,{src:`/brand/total-recall-icon.svg`,alt:``,width:18,height:18,style:{borderRadius:4}}),`Total Recall`]}),(0,R.jsx)(`button`,{onClick:()=>a(!1),style:{background:`none`,border:`none`,cursor:`pointer`,color:`var(--text-tertiary)`},children:`✖`})]}),(0,R.jsx)(eX,{activeBrainId:e,onBrainChange:t})]}),(!r||i)&&(0,R.jsx)(`div`,{style:{flex:1,overflow:`auto`},children:(0,R.jsxs)(Rt,{children:[(0,R.jsx)(It,{path:`/`,element:(0,R.jsx)(Ft,{to:zQ()?`/memory`:`/onboarding`,replace:!0})}),(0,R.jsx)(It,{path:`/chat`,element:(0,R.jsx)(eX,{activeBrainId:e})}),(0,R.jsx)(It,{path:`/onboarding`,element:(0,R.jsx)(GQ,{})}),(0,R.jsx)(It,{path:`/memory`,element:(0,R.jsx)(rX,{activeBrainId:e})}),(0,R.jsx)(It,{path:`/rules`,element:(0,R.jsx)(bZ,{activeBrainId:e})}),(0,R.jsx)(It,{path:`/graph`,element:(0,R.jsx)(CZ,{activeBrainId:e})}),(0,R.jsx)(It,{path:`/tasks`,element:(0,R.jsx)(nZ,{})}),(0,R.jsx)(It,{path:`/skills`,element:(0,R.jsx)(yZ,{activeBrainId:e})}),(0,R.jsx)(It,{path:`/openwiki`,element:(0,R.jsx)(Ft,{to:`/plugins?id=openwiki`,replace:!0})}),(0,R.jsx)(It,{path:`/plugins`,element:(0,R.jsx)(RQ,{activeBrainId:e})}),(0,R.jsx)(It,{path:`/integrations`,element:(0,R.jsx)(iZ,{activeBrainId:e})}),(0,R.jsx)(It,{path:`/keys`,element:(0,R.jsx)(Ft,{to:`/secrets`,replace:!0})}),(0,R.jsx)(It,{path:`/settings`,element:(0,R.jsx)(VX,{activeBrainId:e})}),(0,R.jsx)(It,{path:`/network`,element:(0,R.jsx)(YX,{})}),(0,R.jsx)(It,{path:`/mesh`,element:(0,R.jsx)(Ft,{to:`/plugins?id=mesh`,replace:!0})}),(0,R.jsx)(It,{path:`/webhooks`,element:(0,R.jsx)(fZ,{})}),(0,R.jsx)(It,{path:`/secrets`,element:(0,R.jsx)(Ft,{to:`/plugins?id=auth`,replace:!0})}),(0,R.jsx)(It,{path:`/notifications`,element:(0,R.jsx)(l$,{})}),(0,R.jsx)(It,{path:`/help`,element:(0,R.jsx)(SZ,{})}),(0,R.jsx)(It,{path:`/vault`,element:(0,R.jsx)(Ft,{to:`/memory`,replace:!0})}),(0,R.jsx)(It,{path:`/inbox`,element:(0,R.jsx)(Ft,{to:`/tasks`,replace:!0})}),(0,R.jsx)(It,{path:`/automations`,element:(0,R.jsx)(Ft,{to:`/plugins?id=user-automations`,replace:!0})}),(0,R.jsx)(It,{path:`/files`,element:(0,R.jsx)(Ft,{to:`/memory`,replace:!0})}),(0,R.jsx)(It,{path:`/sandbox`,element:(0,R.jsx)(Ft,{to:`/memory`,replace:!0})}),(0,R.jsx)(It,{path:`/models`,element:(0,R.jsx)(Ft,{to:`/settings`,replace:!0})}),(0,R.jsx)(It,{path:`/health`,element:(0,R.jsx)(Ft,{to:`/settings`,replace:!0})}),(0,R.jsx)(It,{path:`/usage`,element:(0,R.jsx)(Ft,{to:`/settings`,replace:!0})}),(0,R.jsx)(It,{path:`/collab`,element:(0,R.jsx)(Ft,{to:`/memory`,replace:!0})}),(0,R.jsx)(It,{path:`/instructions`,element:(0,R.jsx)(Ft,{to:`/memory`,replace:!0})}),(0,R.jsx)(It,{path:`/design`,element:(0,R.jsx)(Ft,{to:`/memory`,replace:!0})}),(0,R.jsx)(It,{path:`/okf`,element:(0,R.jsx)(Ft,{to:`/memory`,replace:!0})}),(0,R.jsx)(It,{path:`*`,element:(0,R.jsx)(Ft,{to:`/memory`,replace:!0})})]})})]})}var v$=`total-recall-active-brain`;function y$(){let[e,t]=(0,_.useState)(`loading`),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(()=>localStorage.getItem(v$)||`global`);(0,_.useEffect)(()=>{localStorage.setItem(v$,i)},[i]),(0,_.useEffect)(()=>(Vn(()=>t(`unauthed`)),()=>{}),[]),(0,_.useEffect)(()=>{Gn().then(e=>t(e?`authed`:`unauthed`))},[]),(0,_.useEffect)(()=>{let e=!0,t=async()=>{try{let t=await Ir();e&&r(t)}catch{e&&r({status:`unreachable`,version:``,uptime_seconds:0,timestamp:``})}};t();let n=setInterval(t,1e4);return()=>{e=!1,clearInterval(n)}},[]);async function o(){await Xn(),t(`unauthed`)}function s(){t(`authed`)}return e===`loading`?(0,R.jsxs)(`div`,{style:{minHeight:`100vh`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`var(--bg-primary)`},children:[(0,R.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--text-tertiary)`,strokeWidth:`2.5`,strokeLinecap:`round`,style:{animation:`spin 0.8s linear infinite`},children:(0,R.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`})}),(0,R.jsx)(`style`,{children:`@keyframes spin { to { transform: rotate(360deg); } }`})]}):e===`unauthed`?(0,R.jsx)(Ii,{onAuthenticated:s}):(0,R.jsxs)(Tn,{children:[(0,R.jsxs)(`div`,{className:`app-layout`,children:[(0,R.jsx)(h$,{onLogout:o,health:n,activeBrainId:i,onBrainChange:a}),(0,R.jsx)(_$,{activeBrainId:i,onBrainChange:a})]}),(0,R.jsx)(d$,{})]})}`serviceWorker`in navigator&&window.addEventListener(`load`,()=>{navigator.serviceWorker.register(`/sw.js`).then(e=>{console.log(`ServiceWorker registration successful with scope: `,e.scope)},e=>{console.log(`ServiceWorker registration failed: `,e)})}),(0,v.createRoot)(document.getElementById(`root`)).render((0,R.jsx)(_.StrictMode,{children:(0,R.jsx)(y$,{})}));
|
|
5631
|
+
The primary deployment scaffolding tool. Select your target environment and initialize the memory database.`};function $Q(){let[e,t]=(0,_.useState)(!1),n=lt(),[r,i]=(0,_.useState)(``);return(0,_.useEffect)(()=>{let e=n.pathname;setTimeout(()=>{i(QQ[e]||`### ${e}\nNo specific documentation is available for this route yet.`)},0)},[n.pathname]),(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{onClick:()=>t(!0),style:{position:`fixed`,bottom:`24px`,right:`24px`,width:`48px`,height:`48px`,borderRadius:`24px`,backgroundColor:`var(--accent-primary, #6366f1)`,color:`#fff`,border:`none`,boxShadow:`0 4px 12px rgba(0,0,0,0.3)`,cursor:`pointer`,zIndex:9998,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:`24px`,fontWeight:`bold`},title:`Page Help`,children:`?`}),e&&(0,R.jsx)(`div`,{style:{position:`fixed`,top:0,left:0,right:0,bottom:0,backgroundColor:`rgba(0,0,0,0.5)`,zIndex:9999,display:`flex`,alignItems:`center`,justifyContent:`center`},onClick:()=>t(!1),children:(0,R.jsxs)(`div`,{style:{width:`500px`,maxWidth:`90vw`,maxHeight:`80vh`,backgroundColor:`var(--bg-primary, #1e1e1e)`,color:`var(--text-primary, #e5e5e5)`,padding:`2rem`,borderRadius:`12px`,overflowY:`auto`,boxShadow:`0 10px 25px rgba(0,0,0,0.5)`,lineHeight:1.6},onClick:e=>e.stopPropagation(),children:[(0,R.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`},children:(0,R.jsx)(`button`,{onClick:()=>t(!1),style:{background:`transparent`,border:`none`,color:`var(--text-secondary, #a3a3a3)`,cursor:`pointer`,fontSize:`18px`},children:`✕`})}),(0,R.jsx)(`div`,{style:{whiteSpace:`pre-wrap`},children:r})]})})]})}function e$({ok:e,label:t}){return(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:5,color:`var(--text-tertiary)`},children:[(0,R.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:e?`#22c55e`:`#ef4444`,boxShadow:e?`0 0 6px rgba(34,197,94,0.5)`:`0 0 6px rgba(239,68,68,0.5)`,display:`inline-block`,animation:e?void 0:`blink 1s ease-in-out infinite`}}),t]})}function t$(e){if(!e)return{color:`#94a3b8`,label:`Gate n/a`,title:`Fetch gate stats not available`};let t=e.total_errors||0,n=e.total_blocked||0,r=e.current_queue_depth||0,i=e.current_in_flight||0,a=`dispatched ${e.total_dispatched??0} · errors ${t} · blocked ${n} · in-flight ${i} · queue ${r}`;return t>0&&(e.total_completed||0)===0&&(e.total_dispatched||0)>0?{color:`#ef4444`,label:`Gate errors`,title:a}:t>5||r>10||n>20?{color:`#ef4444`,label:`Gate hot`,title:a}:t>0||r>0||n>0||i>(e.max_global_concurrency||6)*.75?{color:`#f59e0b`,label:`Gate busy`,title:a}:{color:`#22c55e`,label:`Gate ok`,title:a}}var n$=({isActive:e})=>`nav-link ${e?`active`:``}`;function r$({onLogout:e,health:t,activeBrainId:n,onBrainChange:r}){return(0,R.jsxs)(`aside`,{className:`sidebar`,children:[(0,R.jsxs)(`div`,{className:`sidebar-brand`,style:{display:`flex`,alignItems:`center`,gap:12,padding:`16px 14px`},children:[(0,R.jsx)(Fi,{animated:!0,height:44,alt:`Total Recall`}),(0,R.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,R.jsx)(`span`,{style:{fontSize:15,fontWeight:700,letterSpacing:`-0.02em`,color:`#f8fafc`},children:`Total Recall`}),(0,R.jsx)(`span`,{style:{fontSize:10,fontWeight:600,padding:`2px 5px`,borderRadius:4,background:`rgba(59,130,246,0.15)`,color:`#60a5fa`,border:`1px solid rgba(59,130,246,0.3)`},children:t?.version?`v${t.version}`:`Version unknown`})]}),(0,R.jsx)(`span`,{style:{fontSize:11,color:`var(--text-tertiary)`,letterSpacing:`0.01em`},children:`Portable memory · any IDE`})]})]}),(0,R.jsxs)(`nav`,{className:`sidebar-nav`,children:[(0,R.jsx)(`div`,{className:`nav-section-label`,children:`Memory`}),!DQ()&&(0,R.jsxs)(Dn,{to:`/onboarding`,className:n$,id:`nav-onboarding`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M12 2L2 7l10 5 10-5-10-5z`}),(0,R.jsx)(`path`,{d:`M2 17l10 5 10-5`}),(0,R.jsx)(`path`,{d:`M2 12l10 5 10-5`})]}),`Setup`]}),(0,R.jsxs)(Dn,{to:`/`,end:!0,className:n$,id:`nav-chat`,children:[(0,R.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,R.jsx)(`path`,{d:`M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z`})}),`Chat`]}),(0,R.jsxs)(Dn,{to:`/memory`,className:n$,id:`nav-memory`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,R.jsx)(`path`,{d:`M12 16v-4M12 8h.01`})]}),`Vault`]}),(0,R.jsxs)(Dn,{to:`/rules`,className:n$,id:`nav-rules`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M14 2H6a2 2 0 0 0-2 2v16c0 1.1.9 2 2 2h12a2 2 0 0 0 2-2V8l-6-6z`}),(0,R.jsx)(`path`,{d:`M14 3v5h5M16 13H8M16 17H8M10 9H8`})]}),`Rules`]}),(0,R.jsxs)(Dn,{to:`/graph`,className:n$,id:`nav-graph`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`circle`,{cx:`5`,cy:`6`,r:`2`}),(0,R.jsx)(`circle`,{cx:`19`,cy:`6`,r:`2`}),(0,R.jsx)(`circle`,{cx:`12`,cy:`18`,r:`2`}),(0,R.jsx)(`path`,{d:`M7 7l4 9M17 7l-4 9`})]}),`Graph`]}),(0,R.jsxs)(Dn,{to:`/tasks`,className:n$,id:`nav-tasks`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M9 11l3 3L22 4`}),(0,R.jsx)(`path`,{d:`M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11`})]}),`Tasks`]}),(0,R.jsx)(`div`,{className:`nav-section-label`,children:`Connect`}),(0,R.jsxs)(Dn,{to:`/integrations`,className:n$,id:`nav-integrations`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71`}),(0,R.jsx)(`path`,{d:`M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71`})]}),`IDEs`]}),(0,R.jsxs)(Dn,{to:`/skills`,className:n$,id:`nav-skills`,children:[(0,R.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,R.jsx)(`path`,{d:`M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5`})}),`Skills`]}),(0,R.jsxs)(Dn,{to:`/plugins`,className:n$,id:`nav-plugins`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`}),(0,R.jsx)(`polyline`,{points:`3.27 6.96 12 12.01 20.73 6.96`}),(0,R.jsx)(`line`,{x1:`12`,y1:`22.08`,x2:`12`,y2:`12`})]}),`Plugins`]}),(0,R.jsx)(`div`,{className:`nav-section-label`,children:`Account`}),(0,R.jsxs)(Dn,{to:`/network`,className:n$,id:`nav-network`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`rect`,{x:`2`,y:`2`,width:`20`,height:`8`,rx:`2`,ry:`2`}),(0,R.jsx)(`rect`,{x:`2`,y:`14`,width:`20`,height:`8`,rx:`2`,ry:`2`}),(0,R.jsx)(`line`,{x1:`6`,y1:`6`,x2:`6.01`,y2:`6`}),(0,R.jsx)(`line`,{x1:`6`,y1:`18`,x2:`6.01`,y2:`18`})]}),`Network`]}),(0,R.jsxs)(Dn,{to:`/mesh`,className:n$,id:`nav-mesh`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M12 2L2 7l10 5 10-5-10-5z`}),(0,R.jsx)(`path`,{d:`M2 17l10 5 10-5`}),(0,R.jsx)(`path`,{d:`M2 12l10 5 10-5`})]}),`Mesh`]}),(0,R.jsxs)(Dn,{to:`/webhooks`,className:n$,id:`nav-webhooks`,children:[(0,R.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,R.jsx)(`path`,{d:`M22 12h-4l-3 9L9 3l-3 9H2`})}),`Webhooks`]}),(0,R.jsxs)(Dn,{to:`/secrets`,className:n$,id:`nav-secrets`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`rect`,{x:`3`,y:`11`,width:`18`,height:`11`,rx:`2`,ry:`2`}),(0,R.jsx)(`path`,{d:`M7 11V7a5 5 0 0110 0v4`})]}),`Secrets & Keys`]}),(0,R.jsxs)(Dn,{to:`/notifications`,className:n$,id:`nav-notifications`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M18 8A6 6 0 006 8c0 7-3 9-3 9h18s-3-2-3-9`}),(0,R.jsx)(`path`,{d:`M13.73 21a2 2 0 01-3.46 0`})]}),`Notifications`]}),(0,R.jsxs)(Dn,{to:`/settings`,className:n$,id:`nav-settings`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,R.jsx)(`path`,{d:`M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-4 0v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83-2.83l.06-.06A1.65 1.65 0 004.68 15a1.65 1.65 0 00-1.51-1H3a2 2 0 010-4h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 012.83-2.83l.06.06A1.65 1.65 0 009 4.68a1.65 1.65 0 001-1.51V3a2 2 0 014 0v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 2.83l-.06.06A1.65 1.65 0 0019.4 9a1.65 1.65 0 001.51 1H21a2 2 0 010 4h-.09a1.65 1.65 0 00-1.51 1z`})]}),`Settings`]}),(0,R.jsxs)(Dn,{to:`/help`,className:n$,id:`nav-help`,children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,R.jsx)(`path`,{d:`M9.09 9a3 3 0 015.83 1c0 2-3 3-3 3`}),(0,R.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}),`Help`]}),DQ()&&(0,R.jsxs)(Dn,{to:`/onboarding`,className:n$,id:`nav-onboarding-replay`,style:{opacity:.75},children:[(0,R.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M12 2L2 7l10 5 10-5-10-5z`}),(0,R.jsx)(`path`,{d:`M2 17l10 5 10-5`}),(0,R.jsx)(`path`,{d:`M2 12l10 5 10-5`})]}),`Setup guide`]})]}),(0,R.jsxs)(`div`,{className:`sidebar-footer`,style:{display:`flex`,flexDirection:`column`,gap:8},children:[(0,R.jsx)(hZ,{activeBrainId:n,onBrainChange:r}),(0,R.jsxs)(`select`,{value:Rn(),onChange:e=>zn(e.target.value),title:`API host`,style:{width:`100%`,background:`rgba(148, 163, 184, 0.06)`,color:`var(--text-tertiary)`,border:`1px solid var(--border)`,borderRadius:8,padding:`5px 8px`,fontSize:10,outline:`none`},children:[(0,R.jsx)(`option`,{value:``,children:`Local API`}),void 0]}),(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,R.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4,fontSize:11},children:(()=>{let e=t?.daemon===`running`,n=t&&t.status!==`unreachable`,r=e&&n,i=t$(t?.fetch_gate);return t?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`style`,{children:`@keyframes blink { 0%,100%{opacity:1;} 50%{opacity:0.3;} }`}),r?(0,R.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:5,color:`var(--text-tertiary)`},children:[(0,R.jsx)(`span`,{className:`pulse`}),` All Systems Go`]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(e$,{ok:!!n,label:n?`Server online`:`Server offline`}),(0,R.jsx)(e$,{ok:e,label:e?`Daemon`:`Daemon `+(t?.daemon??`unknown`)})]}),(0,R.jsxs)(`div`,{"data-testid":`network-gate-indicator`,title:i.title,style:{display:`flex`,alignItems:`center`,gap:5,color:`var(--text-tertiary)`},children:[(0,R.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:i.color,boxShadow:`0 0 6px ${i.color}80`,display:`inline-block`}}),(0,R.jsx)(Dn,{to:`/network`,style:{color:`inherit`,textDecoration:`none`,fontSize:11},title:i.title,children:i.label})]})]}):(0,R.jsx)(`div`,{style:{color:`var(--text-tertiary)`},children:`Checking…`})})()}),(0,R.jsxs)(`button`,{id:`btn-logout`,onClick:e,title:`Sign out`,style:{background:`none`,border:`1px solid var(--border)`,borderRadius:6,cursor:`pointer`,color:`var(--text-tertiary)`,display:`flex`,alignItems:`center`,gap:5,padding:`4px 8px`,fontSize:11,transition:`color 0.15s, border-color 0.15s`},onMouseEnter:e=>{e.currentTarget.style.color=`#ef4444`,e.currentTarget.style.borderColor=`#ef4444`},onMouseLeave:e=>{e.currentTarget.style.color=`var(--text-tertiary)`,e.currentTarget.style.borderColor=`var(--border)`},children:[(0,R.jsxs)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,R.jsx)(`path`,{d:`M9 21H5a2 2 0 01-2-2V5a2 2 0 012-2h4`}),(0,R.jsx)(`polyline`,{points:`16 17 21 12 16 7`}),(0,R.jsx)(`line`,{x1:`21`,y1:`12`,x2:`9`,y2:`12`})]}),`Sign out`]})]})]})]})}function i$(){let e=lt();return!DQ()&&e.pathname!==`/onboarding`?(0,R.jsx)(Ft,{to:`/onboarding`,replace:!0}):null}function a$({activeBrainId:e,onBrainChange:t}){let n=lt(),r=n.pathname===`/`||n.pathname===`/chat`,[i,a]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{let e=()=>a(e=>!e);return window.addEventListener(`toggle-floating-chat`,e),()=>window.removeEventListener(`toggle-floating-chat`,e)},[]),(0,R.jsxs)(`main`,{className:`main-content`,style:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`,position:`relative`},children:[(0,R.jsx)(i$,{}),(0,R.jsxs)(`div`,{style:i?{display:`flex`,position:`fixed`,bottom:20,right:20,width:400,height:600,zIndex:9999,backgroundColor:`var(--bg-primary)`,border:`1px solid var(--border)`,borderRadius:12,boxShadow:`0 8px 32px rgba(0, 0, 0, 0.4)`,overflow:`hidden`,flexDirection:`column`}:{display:r||i?`flex`:`none`,flex:1,flexDirection:`column`,height:`100%`,overflow:`hidden`},children:[i&&(0,R.jsxs)(`div`,{style:{padding:`8px`,background:`var(--bg-secondary)`,borderBottom:`1px solid var(--border)`,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,R.jsxs)(`span`,{style:{fontSize:12,fontWeight:600,display:`flex`,alignItems:`center`,gap:8},children:[(0,R.jsx)(`img`,{src:`/brand/total-recall-icon.svg`,alt:``,width:18,height:18,style:{borderRadius:4}}),`Total Recall`]}),(0,R.jsx)(`button`,{onClick:()=>a(!1),style:{background:`none`,border:`none`,cursor:`pointer`,color:`var(--text-tertiary)`},children:`✖`})]}),(0,R.jsx)(eX,{activeBrainId:e,onBrainChange:t})]}),(!r||i)&&(0,R.jsx)(`div`,{style:{flex:1,overflow:`auto`},children:(0,R.jsxs)(Rt,{children:[(0,R.jsx)(It,{path:`/`,element:(0,R.jsx)(Ft,{to:DQ()?`/memory`:`/onboarding`,replace:!0})}),(0,R.jsx)(It,{path:`/chat`,element:(0,R.jsx)(eX,{activeBrainId:e})}),(0,R.jsx)(It,{path:`/onboarding`,element:(0,R.jsx)(NQ,{})}),(0,R.jsx)(It,{path:`/memory`,element:(0,R.jsx)(rX,{activeBrainId:e})}),(0,R.jsx)(It,{path:`/rules`,element:(0,R.jsx)(bZ,{activeBrainId:e})}),(0,R.jsx)(It,{path:`/graph`,element:(0,R.jsx)(CZ,{activeBrainId:e})}),(0,R.jsx)(It,{path:`/tasks`,element:(0,R.jsx)(nZ,{})}),(0,R.jsx)(It,{path:`/skills`,element:(0,R.jsx)(yZ,{activeBrainId:e})}),(0,R.jsx)(It,{path:`/openwiki`,element:(0,R.jsx)(Ft,{to:`/plugins?id=openwiki`,replace:!0})}),(0,R.jsx)(It,{path:`/plugins`,element:(0,R.jsx)(EQ,{activeBrainId:e})}),(0,R.jsx)(It,{path:`/integrations`,element:(0,R.jsx)(iZ,{activeBrainId:e})}),(0,R.jsx)(It,{path:`/keys`,element:(0,R.jsx)(Ft,{to:`/secrets`,replace:!0})}),(0,R.jsx)(It,{path:`/settings`,element:(0,R.jsx)(VX,{activeBrainId:e})}),(0,R.jsx)(It,{path:`/network`,element:(0,R.jsx)(YX,{})}),(0,R.jsx)(It,{path:`/mesh`,element:(0,R.jsx)(Ft,{to:`/plugins?id=mesh`,replace:!0})}),(0,R.jsx)(It,{path:`/webhooks`,element:(0,R.jsx)(fZ,{})}),(0,R.jsx)(It,{path:`/secrets`,element:(0,R.jsx)(Ft,{to:`/plugins?id=auth`,replace:!0})}),(0,R.jsx)(It,{path:`/notifications`,element:(0,R.jsx)(ZQ,{})}),(0,R.jsx)(It,{path:`/help`,element:(0,R.jsx)(SZ,{})}),(0,R.jsx)(It,{path:`/vault`,element:(0,R.jsx)(Ft,{to:`/memory`,replace:!0})}),(0,R.jsx)(It,{path:`/inbox`,element:(0,R.jsx)(Ft,{to:`/tasks`,replace:!0})}),(0,R.jsx)(It,{path:`/automations`,element:(0,R.jsx)(Ft,{to:`/plugins?id=user-automations`,replace:!0})}),(0,R.jsx)(It,{path:`/files`,element:(0,R.jsx)(Ft,{to:`/memory`,replace:!0})}),(0,R.jsx)(It,{path:`/sandbox`,element:(0,R.jsx)(Ft,{to:`/memory`,replace:!0})}),(0,R.jsx)(It,{path:`/models`,element:(0,R.jsx)(Ft,{to:`/settings`,replace:!0})}),(0,R.jsx)(It,{path:`/health`,element:(0,R.jsx)(Ft,{to:`/settings`,replace:!0})}),(0,R.jsx)(It,{path:`/usage`,element:(0,R.jsx)(Ft,{to:`/settings`,replace:!0})}),(0,R.jsx)(It,{path:`/collab`,element:(0,R.jsx)(Ft,{to:`/memory`,replace:!0})}),(0,R.jsx)(It,{path:`/instructions`,element:(0,R.jsx)(Ft,{to:`/memory`,replace:!0})}),(0,R.jsx)(It,{path:`/design`,element:(0,R.jsx)(Ft,{to:`/memory`,replace:!0})}),(0,R.jsx)(It,{path:`/okf`,element:(0,R.jsx)(Ft,{to:`/memory`,replace:!0})}),(0,R.jsx)(It,{path:`*`,element:(0,R.jsx)(Ft,{to:`/memory`,replace:!0})})]})})]})}var o$=`total-recall-active-brain`;function s$(){let[e,t]=(0,_.useState)(`loading`),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(()=>localStorage.getItem(o$)||`global`);(0,_.useEffect)(()=>{localStorage.setItem(o$,i)},[i]),(0,_.useEffect)(()=>(Vn(()=>t(`unauthed`)),()=>{}),[]),(0,_.useEffect)(()=>{Gn().then(e=>t(e?`authed`:`unauthed`))},[]),(0,_.useEffect)(()=>{let e=!0,t=async()=>{try{let t=await Ir();e&&r(t)}catch{e&&r({status:`unreachable`,version:``,uptime_seconds:0,timestamp:``})}};t();let n=setInterval(t,1e4);return()=>{e=!1,clearInterval(n)}},[]);async function o(){await Xn(),t(`unauthed`)}function s(){t(`authed`)}return e===`loading`?(0,R.jsxs)(`div`,{style:{minHeight:`100vh`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`var(--bg-primary)`},children:[(0,R.jsx)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`var(--text-tertiary)`,strokeWidth:`2.5`,strokeLinecap:`round`,style:{animation:`spin 0.8s linear infinite`},children:(0,R.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`})}),(0,R.jsx)(`style`,{children:`@keyframes spin { to { transform: rotate(360deg); } }`})]}):e===`unauthed`?(0,R.jsx)(Ii,{onAuthenticated:s}):(0,R.jsxs)(Tn,{children:[(0,R.jsxs)(`div`,{className:`app-layout`,children:[(0,R.jsx)(r$,{onLogout:o,health:n,activeBrainId:i,onBrainChange:a}),(0,R.jsx)(a$,{activeBrainId:i,onBrainChange:a})]}),(0,R.jsx)($Q,{})]})}`serviceWorker`in navigator&&window.addEventListener(`load`,()=>{navigator.serviceWorker.register(`/sw.js`).then(e=>{console.log(`ServiceWorker registration successful with scope: `,e.scope)},e=>{console.log(`ServiceWorker registration failed: `,e)})}),(0,v.createRoot)(document.getElementById(`root`)).render((0,R.jsx)(_.StrictMode,{children:(0,R.jsx)(s$,{})}));
|