agentix-cli 0.82.0 → 0.83.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/dist/{App-3AZUZJPW.js → App-CREMUAHS.js} +2 -2
- package/dist/{App-3AZUZJPW.js.map → App-CREMUAHS.js.map} +1 -1
- package/dist/ChatApp-YX3YNPNS.js +7 -0
- package/dist/{ChatApp-ACIKF3GC.js.map → ChatApp-YX3YNPNS.js.map} +1 -1
- package/dist/{agent-X2UYZ3ZE.js → agent-3PJF4PUE.js} +2 -2
- package/dist/{board-dashboard-65HGTFRC.js → board-dashboard-7B2GNISR.js} +311 -241
- package/dist/board-dashboard-7B2GNISR.js.map +1 -0
- package/dist/chunk-2QNT5JDS.js +4 -0
- package/dist/chunk-2QNT5JDS.js.map +1 -0
- package/dist/{chunk-6G72CCT2.js → chunk-2W3UVIEG.js} +2 -2
- package/dist/{chunk-ISRGFMQC.js → chunk-3AXSSYSY.js} +2 -2
- package/dist/chunk-4L244AW4.js +3 -0
- package/dist/chunk-4L244AW4.js.map +1 -0
- package/dist/{chunk-PLTX6YGD.js → chunk-AACJ62ID.js} +2 -2
- package/dist/chunk-ACFQBLPX.js +3 -0
- package/dist/chunk-ACFQBLPX.js.map +1 -0
- package/dist/{chunk-ONGL6EKZ.js → chunk-AK5J3DQY.js} +2 -2
- package/dist/{chunk-ONGL6EKZ.js.map → chunk-AK5J3DQY.js.map} +1 -1
- package/dist/{chunk-LQLMNBJS.js → chunk-AXQIFHOX.js} +2 -2
- package/dist/{chunk-UCKKAWLZ.js → chunk-BRK6M6LA.js} +2 -2
- package/dist/chunk-BRK6M6LA.js.map +1 -0
- package/dist/{chunk-AW3YGAVS.js → chunk-DND5VBG5.js} +204 -204
- package/dist/chunk-DND5VBG5.js.map +1 -0
- package/dist/chunk-EBDUPZ7C.js +750 -0
- package/dist/chunk-EBDUPZ7C.js.map +1 -0
- package/dist/{chunk-X7STXQOX.js → chunk-HJZFDQKD.js} +2 -2
- package/dist/{chunk-E3SVSIUU.js → chunk-IMFB2KTJ.js} +55 -58
- package/dist/chunk-IMFB2KTJ.js.map +1 -0
- package/dist/{chunk-CG3FSQ23.js → chunk-IUQOOSD4.js} +2 -2
- package/dist/chunk-JDXNHBGR.js +49 -0
- package/dist/chunk-JDXNHBGR.js.map +1 -0
- package/dist/{chunk-C4YY6746.js → chunk-K2NFNNDB.js} +2 -2
- package/dist/{chunk-ZUCJK5PL.js → chunk-KNSYKQKB.js} +2 -2
- package/dist/chunk-LQE73AZR.js +3 -0
- package/dist/chunk-LQE73AZR.js.map +1 -0
- package/dist/{chunk-E63BQ6VJ.js → chunk-MDYARXA4.js} +2 -2
- package/dist/chunk-PPUN7YHA.js +5 -0
- package/dist/chunk-PPUN7YHA.js.map +1 -0
- package/dist/{chunk-BM6ZLX6F.js → chunk-QZ3CLHGL.js} +2 -2
- package/dist/chunk-VZLIBDLH.js +3 -0
- package/dist/chunk-VZLIBDLH.js.map +1 -0
- package/dist/{chunk-6PTO6DWW.js → chunk-WGZPKQNI.js} +2 -2
- package/dist/chunk-WMIQHJB5.js +5 -0
- package/dist/{chunk-FSHQMXM3.js.map → chunk-WMIQHJB5.js.map} +1 -1
- package/dist/{chunk-KUUIIZEH.js → chunk-WYYNJTDC.js} +67 -67
- package/dist/chunk-WYYNJTDC.js.map +1 -0
- package/dist/{chunk-WIGJ5BVG.js → chunk-XGTZMJUI.js} +2 -2
- package/dist/chunk-XIYWXCNU.js +4 -0
- package/dist/chunk-XIYWXCNU.js.map +1 -0
- package/dist/chunk-ZNLBF4ED.js +5 -0
- package/dist/{chunk-CT36XINH.js.map → chunk-ZNLBF4ED.js.map} +1 -1
- package/dist/{chunk-5LD6TA4A.js → chunk-ZUINXZPI.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/client-K5ZISLAI.js +2 -0
- package/dist/config-ZBNH2DMN.js +2 -0
- package/dist/config-mutator-ENWFEDFU.js +2 -0
- package/dist/doctor-Y3GPTM3C.js +2 -0
- package/dist/{facts-5T5GRUTG.js → facts-ROUMKS7I.js} +2 -2
- package/dist/grants-N7XC7NLS.js +2 -0
- package/dist/hosts-NFNCYKGY.js +2 -0
- package/dist/index.d.ts +34 -6
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/pair-codes-EYGELBPD.js +2 -0
- package/dist/{program-R646G4NP.js → program-Y5BSOGQQ.js} +197 -186
- package/dist/program-Y5BSOGQQ.js.map +1 -0
- package/dist/promote-KLA3DBKX.js +2 -0
- package/dist/query-N3BRQU6S.js +2 -0
- package/dist/registry-GHOOAS2Z.js +2 -0
- package/dist/request-planner-ABXJ35NE.js +2 -0
- package/dist/{request-planner-L2S4KMMU.js.map → request-planner-ABXJ35NE.js.map} +1 -1
- package/dist/review-candidates-UFVMO3IT.js +4 -0
- package/dist/{review-candidates-R23QNJ2Q.js.map → review-candidates-UFVMO3IT.js.map} +1 -1
- package/dist/routing-GOOV7H7I.js +2 -0
- package/dist/schedule-tool-KKH32REI.js +2 -0
- package/dist/scheduler-NBRWUJAD.js +2 -0
- package/dist/scheduler-NBRWUJAD.js.map +1 -0
- package/dist/seat-E4FYHBIC.js +2 -0
- package/dist/seat-E4FYHBIC.js.map +1 -0
- package/dist/select-6QI65HKR.js +2 -0
- package/dist/{select-KCCT7OJZ.js.map → select-6QI65HKR.js.map} +1 -1
- package/dist/set-enabled-XPIHHOPT.js +2 -0
- package/dist/{set-enabled-FEUPS2WI.js.map → set-enabled-XPIHHOPT.js.map} +1 -1
- package/dist/store-7W2AP5H4.js +2 -0
- package/dist/store-7W2AP5H4.js.map +1 -0
- package/dist/token-store-YBSU2DTV.js +2 -0
- package/dist/token-store-YBSU2DTV.js.map +1 -0
- package/dist/{tool-YOXUNCTU.js → tool-IX7B5CYT.js} +2 -2
- package/dist/{tool-YOXUNCTU.js.map → tool-IX7B5CYT.js.map} +1 -1
- package/dist/{tool-WGPZW3SR.js → tool-UK5MDLBQ.js} +2 -2
- package/dist/{tool-WGPZW3SR.js.map → tool-UK5MDLBQ.js.map} +1 -1
- package/dist/wiki-XSK3IIZE.js +2 -0
- package/dist/wiki-XSK3IIZE.js.map +1 -0
- package/package.json +1 -1
- package/dist/ChatApp-ACIKF3GC.js +0 -7
- package/dist/board-dashboard-65HGTFRC.js.map +0 -1
- package/dist/chunk-AW3YGAVS.js.map +0 -1
- package/dist/chunk-CT36XINH.js +0 -5
- package/dist/chunk-E3SVSIUU.js.map +0 -1
- package/dist/chunk-FSHQMXM3.js +0 -5
- package/dist/chunk-KUUIIZEH.js.map +0 -1
- package/dist/chunk-UCKKAWLZ.js.map +0 -1
- package/dist/chunk-VQN36LEB.js +0 -51
- package/dist/chunk-VQN36LEB.js.map +0 -1
- package/dist/chunk-XMDA4JYK.js +0 -748
- package/dist/chunk-XMDA4JYK.js.map +0 -1
- package/dist/client-QE4D43K3.js +0 -2
- package/dist/config-ME774GIO.js +0 -2
- package/dist/config-mutator-2AUDHSVD.js +0 -2
- package/dist/doctor-GS2ZHLWU.js +0 -2
- package/dist/program-R646G4NP.js.map +0 -1
- package/dist/promote-ZJCGGVRD.js +0 -2
- package/dist/query-UMGPOBEJ.js +0 -2
- package/dist/registry-WD5B2DQQ.js +0 -2
- package/dist/request-planner-L2S4KMMU.js +0 -2
- package/dist/review-candidates-R23QNJ2Q.js +0 -4
- package/dist/routing-PUQUADQ6.js +0 -2
- package/dist/schedule-tool-3DAJU764.js +0 -2
- package/dist/scheduler-JTPIGC5K.js +0 -2
- package/dist/seat-O5IC5M5D.js +0 -2
- package/dist/select-KCCT7OJZ.js +0 -2
- package/dist/set-enabled-FEUPS2WI.js +0 -2
- package/dist/wiki-QSBAE5ZK.js +0 -2
- /package/dist/{agent-X2UYZ3ZE.js.map → agent-3PJF4PUE.js.map} +0 -0
- /package/dist/{chunk-6G72CCT2.js.map → chunk-2W3UVIEG.js.map} +0 -0
- /package/dist/{chunk-ISRGFMQC.js.map → chunk-3AXSSYSY.js.map} +0 -0
- /package/dist/{chunk-PLTX6YGD.js.map → chunk-AACJ62ID.js.map} +0 -0
- /package/dist/{chunk-LQLMNBJS.js.map → chunk-AXQIFHOX.js.map} +0 -0
- /package/dist/{chunk-X7STXQOX.js.map → chunk-HJZFDQKD.js.map} +0 -0
- /package/dist/{chunk-CG3FSQ23.js.map → chunk-IUQOOSD4.js.map} +0 -0
- /package/dist/{chunk-C4YY6746.js.map → chunk-K2NFNNDB.js.map} +0 -0
- /package/dist/{chunk-ZUCJK5PL.js.map → chunk-KNSYKQKB.js.map} +0 -0
- /package/dist/{chunk-E63BQ6VJ.js.map → chunk-MDYARXA4.js.map} +0 -0
- /package/dist/{chunk-BM6ZLX6F.js.map → chunk-QZ3CLHGL.js.map} +0 -0
- /package/dist/{chunk-6PTO6DWW.js.map → chunk-WGZPKQNI.js.map} +0 -0
- /package/dist/{chunk-WIGJ5BVG.js.map → chunk-XGTZMJUI.js.map} +0 -0
- /package/dist/{chunk-5LD6TA4A.js.map → chunk-ZUINXZPI.js.map} +0 -0
- /package/dist/{client-QE4D43K3.js.map → client-K5ZISLAI.js.map} +0 -0
- /package/dist/{config-ME774GIO.js.map → config-ZBNH2DMN.js.map} +0 -0
- /package/dist/{config-mutator-2AUDHSVD.js.map → config-mutator-ENWFEDFU.js.map} +0 -0
- /package/dist/{doctor-GS2ZHLWU.js.map → doctor-Y3GPTM3C.js.map} +0 -0
- /package/dist/{facts-5T5GRUTG.js.map → facts-ROUMKS7I.js.map} +0 -0
- /package/dist/{promote-ZJCGGVRD.js.map → grants-N7XC7NLS.js.map} +0 -0
- /package/dist/{query-UMGPOBEJ.js.map → hosts-NFNCYKGY.js.map} +0 -0
- /package/dist/{registry-WD5B2DQQ.js.map → pair-codes-EYGELBPD.js.map} +0 -0
- /package/dist/{routing-PUQUADQ6.js.map → promote-KLA3DBKX.js.map} +0 -0
- /package/dist/{schedule-tool-3DAJU764.js.map → query-N3BRQU6S.js.map} +0 -0
- /package/dist/{scheduler-JTPIGC5K.js.map → registry-GHOOAS2Z.js.map} +0 -0
- /package/dist/{seat-O5IC5M5D.js.map → routing-GOOV7H7I.js.map} +0 -0
- /package/dist/{wiki-QSBAE5ZK.js.map → schedule-tool-KKH32REI.js.map} +0 -0
|
@@ -0,0 +1,750 @@
|
|
|
1
|
+
import{c as le,d as ce,e as J,f as E,g as K,h as z}from"./chunk-O5U5NVLR.js";import{a as de}from"./chunk-CL53UVOF.js";import{e as ie,g as oe,n as se,p as q}from"./chunk-XIYWXCNU.js";import{a as re,b as ae}from"./chunk-WMIQHJB5.js";import{a as ne}from"./chunk-ZUINXZPI.js";import{K as ee,N as Ue,X as L,Z as te,_ as O,ba as j,s as F,w as Oe}from"./chunk-JDXNHBGR.js";import{existsSync as M,readFileSync as ve,writeFileSync as be,appendFileSync as Le,mkdirSync as je}from"fs";import{dirname as qe,resolve as P}from"path";import{fileURLToPath as Je}from"url";import{hostname as Ke}from"os";import{spawn as Ye}from"child_process";j();import{existsSync as ge,readFileSync as pe,writeFileSync as Y,copyFileSync as We}from"fs";import{resolve as me}from"path";function U(e,t={}){let n=t.configPath||me(process.cwd(),"agentx.json");if(!ge(n))throw new Error(`agentx.json not found at ${n}`);let r=JSON.parse(pe(n,"utf-8")),a=e(r),i=typeof a=="string"?{summary:a}:a,s=JSON.stringify(r,null,2)+`
|
|
2
|
+
`,l=n+".tmp";Y(l,s,"utf-8");try{JSON.parse(pe(l,"utf-8"))}catch(p){throw new Error(`config did not round-trip cleanly: ${p.message}`)}let o;return t.skipBackup||(o=`${n}.bak.${Date.now()}`,We(n,o)),Y(n,s,"utf-8"),t.skipReload||Be().catch(()=>{}),{summary:i.summary,payload:i.payload,backupPath:o}}function ue(e,t={}){let n=t.configPath||me(process.cwd(),"agentx.json");if(ge(n)&&!t.overwrite)throw new Error(`agentx.json already exists at ${n}. Pass overwrite=true to replace it.`);return Y(n,JSON.stringify(e,null,2)+`
|
|
3
|
+
`,"utf-8"),{file:n}}async function Be(){try{let t=O().dashboard.daemonUrl?.replace(/\/+$/,"")||"http://127.0.0.1:18800";await fetch(`${t}/reload`,{method:"POST"}).catch(()=>null)}catch{}}function fe(e,t){let n=e.configExists?e.agentCount===0?"Add your first agent":"Add another agent":"Set up your team",r=`<header class="ax-topbar">
|
|
4
|
+
<div class="ax-topbar__left">
|
|
5
|
+
<div class="ax-brand">
|
|
6
|
+
<span class="ax-brand__mark">AX</span>
|
|
7
|
+
<span class="ax-brand__name">AgentX</span>
|
|
8
|
+
<span class="ax-brand__subtitle">Setup</span>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="ax-topbar__right">
|
|
12
|
+
<a href="/glossary" class="ax-skip">? Glossary</a>
|
|
13
|
+
<a href="/live" class="ax-skip">Skip \u2014 open dashboard</a>
|
|
14
|
+
<div class="ax-theme-switch" role="tablist" aria-label="Theme">
|
|
15
|
+
<button data-theme-opt="dark">Dark</button>
|
|
16
|
+
<button data-theme-opt="light">Light</button>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</header>`,a=z(1,"Team basics",E({name:"nodeName",label:"Team name",hint:"(what you'd call this AgentX install)",value:t,placeholder:"My Team",required:!0})),i=z(2,"First agent",K([E({name:"agentName",label:"Agent name",value:"Assistant",placeholder:"Support Bot",required:!0}),E({name:"agentId",label:"Agent id",hint:"(lowercase, no spaces)",value:"assistant",pattern:"[a-z0-9][a-z0-9_-]*",required:!0})])+E({name:"triggerWords",label:"Trigger words",hint:"(comma or space separated \u2014 e.g. <code>@support, support</code>)",value:"@assistant, assistant",required:!0})+K([E({name:"tier",label:"AI engine",type:"select",options:[{value:"claude-code",label:"Claude Code (recommended)",selected:!0},{value:"codex-cli",label:"Codex CLI"},{value:"opencode",label:"OpenCode CLI"},{value:"sdk",label:"Anthropic API (BYO key)"},{value:"orchestrator",label:"Orchestrator (any provider)"}]}),E({name:"model",label:"Model",hint:"(optional)",value:"claude-sonnet-4-6",placeholder:"claude-sonnet-4-6"})])+E({name:"personality",label:"Personality / instructions",hint:"(optional \u2014 what this agent does, in plain English)",type:"textarea",placeholder:"You are a support agent for Acme Co. Answer customer questions about our product, be friendly, keep replies short."})),s=z(3,"First channel",`
|
|
20
|
+
<label class="ax-toggle"><input type="checkbox" id="enableTelegram" /> Connect Telegram now</label>
|
|
21
|
+
<div class="ax-optional" id="telegramFields">
|
|
22
|
+
${E({name:"telegramAccountId",label:"Account id",hint:"(a label you choose \u2014 e.g. <code>support</code>)",value:"default"})}
|
|
23
|
+
${E({name:"telegramBotToken",label:"Bot token",hint:'(from <a href="https://t.me/BotFather" target="_blank">@BotFather</a>)',placeholder:"123456:ABCdef..."})}
|
|
24
|
+
${E({name:"telegramBotUsername",label:"Bot username",hint:"(optional \u2014 e.g. <code>my_support_bot</code>)",placeholder:"my_support_bot"})}
|
|
25
|
+
</div>
|
|
26
|
+
`),l=z(4,"Anthropic API key",E({name:"anthropicApiKey",label:"API key",hint:"(optional \u2014 skip if you're using Claude Code)",type:"password",placeholder:"sk-ant-\u2026",extraAttrs:'autocomplete="off"'})+`<div class="ax-hint-block">
|
|
27
|
+
The key is stored in <code>.env</code> as <code>ANTHROPIC_API_KEY</code> and used to authenticate requests to Anthropic. Keep it private.
|
|
28
|
+
</div>`),o=e.configExists?`<div class="ax-banner">Existing install: <b>${e.agentCount}</b> agent(s), <b>${e.channelCount}</b> channel(s) already configured. This wizard will add to it.</div>`:"",p=`<div class="ax-wizard">
|
|
29
|
+
<h1 class="ax-wizard__h1">${de(n)}</h1>
|
|
30
|
+
<p class="ax-wizard__lead">Fill in the basics below. We'll write <code>agentx.json</code>, set up a folder for your first agent, and point you at the next step.</p>
|
|
31
|
+
|
|
32
|
+
${o}
|
|
33
|
+
|
|
34
|
+
<div id="msg" class="ax-msg"></div>
|
|
35
|
+
|
|
36
|
+
<form id="wizard" autocomplete="off">
|
|
37
|
+
${a}
|
|
38
|
+
${i}
|
|
39
|
+
${s}
|
|
40
|
+
${l}
|
|
41
|
+
<footer class="ax-actions">
|
|
42
|
+
${J("Save and continue",{type:"submit",primary:!0,id:"submitBtn"})}
|
|
43
|
+
${J("Skip, I'll do it later",{onclick:"window.location.href='/live'"})}
|
|
44
|
+
</footer>
|
|
45
|
+
</form>
|
|
46
|
+
</div>`;return ce({title:"AgentX \u2014 Setup",activeTab:"custom",subtitle:"Setup",customHeader:r,noMain:!0,body:p,css:He,scripts:Fe})}var He=`
|
|
47
|
+
/* Pre-dashboard topbar variant \u2014 no tab nav, the pills are the only chrome. */
|
|
48
|
+
.ax-topbar__right a.ax-skip {
|
|
49
|
+
padding: 4px 10px; border: 1px solid var(--ax-border-2); border-radius: 4px;
|
|
50
|
+
color: var(--ax-text-2); font-size: var(--ax-fs-xs); text-decoration: none;
|
|
51
|
+
}
|
|
52
|
+
.ax-topbar__right a.ax-skip:hover { color: var(--ax-accent); border-color: var(--ax-accent); }
|
|
53
|
+
|
|
54
|
+
/* Wizard frame */
|
|
55
|
+
.ax-wizard { max-width: 680px; margin: 0 auto; padding: 36px 22px 80px; }
|
|
56
|
+
.ax-wizard__h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.015em; }
|
|
57
|
+
.ax-wizard__lead { color: var(--ax-muted); margin: 0 0 24px; font-size: var(--ax-fs); line-height: 1.55; }
|
|
58
|
+
.ax-wizard__lead code { background: var(--ax-surface-2); padding: 1px 6px; border-radius: 3px; color: var(--ax-text); font-size: var(--ax-fs-sm); }
|
|
59
|
+
|
|
60
|
+
/* Info banner ("You already have N agents\u2026") */
|
|
61
|
+
.ax-banner {
|
|
62
|
+
background: color-mix(in oklch, var(--ax-accent) 10%, var(--ax-bg-elev));
|
|
63
|
+
border: 1px solid color-mix(in oklch, var(--ax-accent) 30%, var(--ax-border-2));
|
|
64
|
+
border-radius: var(--ax-radius);
|
|
65
|
+
padding: 10px 14px; margin-bottom: 18px;
|
|
66
|
+
color: var(--ax-text-2); font-size: var(--ax-fs-sm);
|
|
67
|
+
}
|
|
68
|
+
.ax-banner b { color: var(--ax-text); font-weight: 600; }
|
|
69
|
+
|
|
70
|
+
/* "Connect Telegram now" toggle + collapsible fields */
|
|
71
|
+
.ax-toggle { display: flex; align-items: center; gap: 8px; margin: 4px 0 6px; font-size: var(--ax-fs); color: var(--ax-text); cursor: pointer; user-select: none; }
|
|
72
|
+
.ax-toggle input { width: auto; accent-color: var(--ax-accent); }
|
|
73
|
+
.ax-optional { border-left: 2px solid var(--ax-border-2); padding-left: 14px; margin-top: 10px; display: none; }
|
|
74
|
+
.ax-optional.is-show { display: block; }
|
|
75
|
+
.ax-hint-block { font-size: var(--ax-fs-xs); color: var(--ax-muted); margin-top: 8px; line-height: 1.55; }
|
|
76
|
+
.ax-hint-block code { background: var(--ax-surface-2); padding: 1px 6px; border-radius: 3px; color: var(--ax-text); font-family: var(--ax-mono); font-size: var(--ax-fs-xs); }
|
|
77
|
+
|
|
78
|
+
/* Form footer */
|
|
79
|
+
.ax-actions {
|
|
80
|
+
display: flex; gap: 10px; padding: 20px 0 0; align-items: center;
|
|
81
|
+
border-top: 1px solid var(--ax-border); margin-top: 20px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Server-response messaging (success / error blocks) */
|
|
85
|
+
.ax-msg { margin: 14px 0; padding: 12px 16px; border-radius: var(--ax-radius); font-size: var(--ax-fs); display: none; }
|
|
86
|
+
.ax-msg.is-ok {
|
|
87
|
+
display: block;
|
|
88
|
+
background: color-mix(in oklch, var(--ax-accent) 12%, transparent);
|
|
89
|
+
color: var(--ax-accent);
|
|
90
|
+
border: 1px solid color-mix(in oklch, var(--ax-accent) 40%, transparent);
|
|
91
|
+
}
|
|
92
|
+
.ax-msg.is-err {
|
|
93
|
+
display: block;
|
|
94
|
+
background: color-mix(in oklch, var(--ax-err) 12%, transparent);
|
|
95
|
+
color: var(--ax-err);
|
|
96
|
+
border: 1px solid color-mix(in oklch, var(--ax-err) 40%, transparent);
|
|
97
|
+
}
|
|
98
|
+
.ax-next-steps { margin-top: 12px; padding-left: 20px; color: var(--ax-text-2); }
|
|
99
|
+
.ax-next-steps li { margin: 4px 0; }
|
|
100
|
+
.ax-next-steps code { background: var(--ax-surface-2); padding: 1px 6px; border-radius: 3px; color: var(--ax-text); font-family: var(--ax-mono); font-size: var(--ax-fs-sm); }
|
|
101
|
+
.ax-startd { margin-top: 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
|
|
102
|
+
.ax-startd__status { color: var(--ax-text-2); font-size: var(--ax-fs-sm); }
|
|
103
|
+
.ax-startd__status a { color: var(--ax-accent); }`,Fe=`<script>
|
|
104
|
+
document.getElementById('enableTelegram').addEventListener('change', (e) => {
|
|
105
|
+
document.getElementById('telegramFields').classList.toggle('is-show', e.target.checked);
|
|
106
|
+
});
|
|
107
|
+
document.getElementById('wizard').addEventListener('submit', async (e) => {
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
const f = e.target;
|
|
110
|
+
const msg = document.getElementById('msg');
|
|
111
|
+
const btn = document.getElementById('submitBtn');
|
|
112
|
+
msg.className = 'ax-msg'; msg.style.display = 'none';
|
|
113
|
+
btn.disabled = true; btn.textContent = 'Saving\u2026';
|
|
114
|
+
const telegramEnabled = document.getElementById('enableTelegram').checked;
|
|
115
|
+
const payload = {
|
|
116
|
+
nodeName: f.nodeName.value.trim(),
|
|
117
|
+
agent: {
|
|
118
|
+
id: f.agentId.value.trim(),
|
|
119
|
+
name: f.agentName.value.trim(),
|
|
120
|
+
triggerWords: f.triggerWords.value.trim(),
|
|
121
|
+
tier: f.tier.value,
|
|
122
|
+
model: f.model.value.trim() || undefined,
|
|
123
|
+
personality: f.personality.value.trim() || undefined,
|
|
124
|
+
},
|
|
125
|
+
anthropicApiKey: f.anthropicApiKey.value.trim() || undefined,
|
|
126
|
+
};
|
|
127
|
+
if (telegramEnabled) {
|
|
128
|
+
payload.telegram = {
|
|
129
|
+
accountId: f.telegramAccountId.value.trim() || 'default',
|
|
130
|
+
botToken: f.telegramBotToken.value.trim(),
|
|
131
|
+
botUsername: f.telegramBotUsername.value.trim() || undefined,
|
|
132
|
+
};
|
|
133
|
+
if (!payload.telegram.botToken) {
|
|
134
|
+
msg.className = 'ax-msg is-err'; msg.textContent = 'Bot token is required when Telegram is enabled.';
|
|
135
|
+
btn.disabled = false; btn.textContent = 'Save and continue'; return;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
try {
|
|
139
|
+
const r = await fetch('/api/setup', {
|
|
140
|
+
method: 'POST',
|
|
141
|
+
headers: { 'Content-Type': 'application/json', 'X-Requested-With': 'agentx-wizard' },
|
|
142
|
+
body: JSON.stringify(payload),
|
|
143
|
+
});
|
|
144
|
+
const data = await r.json();
|
|
145
|
+
if (!r.ok) throw new Error(data.error || ('HTTP ' + r.status));
|
|
146
|
+
const steps = data.nextSteps.map((s) => '<li>' + s.replace(/\\\`([^\\\`]+)\\\`/g, '<code>$1</code>') + '</li>').join('');
|
|
147
|
+
msg.className = 'ax-msg is-ok';
|
|
148
|
+
msg.innerHTML = '<b>' + data.summary + '</b><ol class="ax-next-steps">' + steps + '</ol>'
|
|
149
|
+
+ '<div class="ax-startd"><button type="button" id="startDaemonBtn" class="ax-btn ax-btn--primary">Start daemon now</button>'
|
|
150
|
+
+ ' <span id="startDaemonStatus" class="ax-startd__status"></span></div>';
|
|
151
|
+
btn.textContent = 'Done';
|
|
152
|
+
btn.disabled = true;
|
|
153
|
+
document.getElementById('startDaemonBtn').addEventListener('click', async () => {
|
|
154
|
+
const sb = document.getElementById('startDaemonBtn');
|
|
155
|
+
const ss = document.getElementById('startDaemonStatus');
|
|
156
|
+
sb.disabled = true; sb.textContent = 'Starting\u2026'; ss.textContent = '';
|
|
157
|
+
try {
|
|
158
|
+
const r = await fetch('/api/setup/start-daemon', { method: 'POST' });
|
|
159
|
+
const d = await r.json();
|
|
160
|
+
if (d.ok) {
|
|
161
|
+
sb.textContent = d.alreadyRunning ? 'Already running' : 'Daemon up';
|
|
162
|
+
ss.innerHTML = 'Open <a href="' + d.url + '" target="_blank" rel="noopener">' + d.url + '</a>';
|
|
163
|
+
} else {
|
|
164
|
+
sb.disabled = false; sb.textContent = 'Try again';
|
|
165
|
+
ss.textContent = d.error + (d.manualUrl ? ' Manual: ' + d.manualUrl : '');
|
|
166
|
+
}
|
|
167
|
+
} catch (e) {
|
|
168
|
+
sb.disabled = false; sb.textContent = 'Try again';
|
|
169
|
+
ss.textContent = e.message;
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
} catch (err) {
|
|
173
|
+
msg.className = 'ax-msg is-err'; msg.textContent = err.message;
|
|
174
|
+
btn.disabled = false; btn.textContent = 'Save and continue';
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
</script>`;j();function xe(e=process.cwd()){let t=P(e,"agentx.json");if(!M(t))return{configExists:!1,agentCount:0,channelCount:0};try{let n=JSON.parse(ve(t,"utf-8")),r=n.agents?Object.keys(n.agents).length:0,a=n.channels?Object.values(n.channels).filter(i=>i&&i.enabled).length:0;return{configExists:!0,agentCount:r,channelCount:a,nodeName:n.node?.name}}catch{return{configExists:!1,agentCount:0,channelCount:0}}}function Ge(e,t=process.cwd()){if(!e.nodeName?.trim())throw new Error("Team name is required.");if(!e.agent?.id?.trim())throw new Error("Agent id is required.");if(!/^[a-z0-9][a-z0-9_-]*$/.test(e.agent.id))throw new Error("Agent id must be lowercase (letters, digits, -, _) and start with a letter or digit.");if(!e.agent.name?.trim())throw new Error("Agent name is required.");let n=Xe(e.agent.triggerWords);if(n.length===0)throw new Error("At least one trigger word is required.");if(e.agent.tier!=="claude-code"&&e.agent.tier!=="codex-cli"&&e.agent.tier!=="opencode"&&e.agent.tier!=="sdk"&&e.agent.tier!=="orchestrator")throw new Error("AI engine must be claude-code, codex-cli, opencode, sdk, or orchestrator.");let r=P(t,"agentx.json"),a=P(t,".env"),i=P(t,"agents",e.agent.id),s=xe(t);je(i,{recursive:!0});let l=P(i,"CLAUDE.md");if(!M(l)){let f=e.agent.personality?.trim()||`You are ${e.agent.name}, an assistant on the ${e.nodeName} team.`;be(l,`# ${e.agent.name}
|
|
178
|
+
|
|
179
|
+
${f}
|
|
180
|
+
`)}let o=e.telegram?`TG_${e.agent.id.toUpperCase()}_BOT_TOKEN`:void 0,p;if(s.configExists)p=U(d=>{if(d.node=d.node||{},d.node.name||(d.node.name=e.nodeName),d.node.id||(d.node.id=ye(e.nodeName)||"team"),d.node.bind||(d.node.bind="127.0.0.1:18800"),d.node.defaultAgent=d.node.defaultAgent||e.agent.id,d.providers=d.providers||{},d.providers.claude||(d.providers.claude={apiKey:"${ANTHROPIC_API_KEY}"}),d.agents=d.agents||{},d.agents[e.agent.id])throw new Error(`Agent "${e.agent.id}" already exists.`);return d.agents[e.agent.id]=ke(e,i,n),e.telegram&&(d.channels=d.channels||{},d.channels.telegram=d.channels.telegram||{enabled:!0,accounts:{},policy:{dm:"pair",group:"mention-required"}},d.channels.telegram.enabled=!0,d.channels.telegram.accounts=d.channels.telegram.accounts||{},d.channels.telegram.accounts[e.telegram.accountId]=we(e,o)),{summary:`added agent "${e.agent.id}"`+(e.telegram?" + telegram account":"")}},{configPath:r}).backupPath;else{let f=Ve(e,i,n,o);ue(f,{configPath:r})}Qe(a,e,o);let g=[];return(e.anthropicApiKey||!M(P(t,".env")))&&g.push("Double-check the API keys in .env"),e.agent.tier==="claude-code"&&g.push("Run claude --version to confirm Claude Code is installed (needed for the claude-code engine)"),e.agent.tier==="codex-cli"&&g.push("Run codex --version to confirm Codex CLI is installed (needed for the codex-cli engine)"),e.agent.tier==="opencode"&&g.push("Run opencode --version to confirm OpenCode is installed and authenticated"),g.push("Start the daemon: agentx daemon start"),g.push("Open the dashboard: http://127.0.0.1:4202"),{summary:s.configExists?`Added agent "${e.agent.id}" to your team.`:`Initialized your team with first agent "${e.agent.id}".`,nextSteps:g,backupPath:p}}function Xe(e){return(e||"").split(/[,\s]+/).map(t=>t.trim()).filter(Boolean).filter((t,n,r)=>r.indexOf(t)===n)}function ye(e){return(e||"").toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,"")}function Ve(e,t,n,r){let i={node:{id:ye(e.nodeName)||"team",name:e.nodeName,bind:"127.0.0.1:18800",defaultAgent:e.agent.id},providers:{claude:{apiKey:"${ANTHROPIC_API_KEY}"}},agents:{[e.agent.id]:ke(e,t,n)},channels:{},crons:{},mesh:{enabled:!1,peers:[],discovery:"static",healthCheck:{interval:60,timeout:10}},dashboard:{enabled:!0,port:4202,bind:"127.0.0.1",daemonUrl:"http://localhost:18800"},boards:[]};return e.telegram&&r?i.channels.telegram={enabled:!0,accounts:{[e.telegram.accountId]:we(e,r)},policy:{dm:"pair",group:"mention-required"}}:i.channels.telegram={enabled:!1,accounts:{},policy:{dm:"pair",group:"mention-required"}},i}function ke(e,t,n){let r={name:e.agent.name,workspace:t,tier:e.agent.tier,mentions:n,maxConcurrent:2,permissionMode:"default"};return e.agent.model&&(r.model=e.agent.model),e.agent.personality?.trim()&&(r.systemPrompt=e.agent.personality.trim().slice(0,400)),r}function we(e,t){return e.telegram?.botUsername,{token:"${"+t+"}",agentBinding:e.agent.id}}function Qe(e,t,n){let r=M(e)?ve(e,"utf-8"):"",a=[];if(t.anthropicApiKey&&!r.includes("ANTHROPIC_API_KEY=")&&a.push(`ANTHROPIC_API_KEY=${t.anthropicApiKey}`),t.telegram&&n&&!r.includes(`${n}=`)&&a.push(`${n}=${t.telegram.botToken}`),!M(e)){be(e,[...["# AgentX environment variables","# (Never commit this file \u2014 it contains secrets.)",""],...a,""].join(`
|
|
181
|
+
`));return}if(a.length>0){let i=r.endsWith(`
|
|
182
|
+
`)?"":`
|
|
183
|
+
`;Le(e,i+a.join(`
|
|
184
|
+
`)+`
|
|
185
|
+
`)}}function Yt(e,t){let n=xe(),r=n.nodeName||Ke().replace(/\.local$/,""),a=fe(n,r);t.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),t.end(a)}async function Gt(e,t){let n="";await new Promise(a=>{e.on("data",i=>{n+=i}),e.on("end",()=>a())});let r;try{r=JSON.parse(n)}catch{t.writeHead(400,{"Content-Type":"application/json"}),t.end(JSON.stringify({error:"Invalid JSON"}));return}try{let a=Ge(r);t.writeHead(200,{"Content-Type":"application/json"}),t.end(JSON.stringify(a))}catch(a){t.writeHead(400,{"Content-Type":"application/json"}),t.end(JSON.stringify({error:a.message||"wizard failed"}))}}async function Xt(e,t){t.setHeader("Content-Type","application/json");let n;try{n=O().node?.bind||"127.0.0.1:18800"}catch(s){t.writeHead(400),t.end(JSON.stringify({ok:!1,error:`Config validation failed: ${s.message}`}));return}let r=`http://${n.replace(/^0\.0\.0\.0/,"127.0.0.1")}`;if(await he(r)){t.writeHead(200),t.end(JSON.stringify({ok:!0,url:r,alreadyRunning:!0}));return}let a=process.argv[1]||P(qe(Je(import.meta.url)),"cli.js");try{Ye(process.execPath,[a,"daemon","start"],{detached:!0,stdio:"ignore",cwd:process.cwd()}).unref()}catch(s){t.writeHead(500),t.end(JSON.stringify({ok:!1,error:`Failed to spawn daemon: ${s.message}`,manualUrl:r}));return}let i=Date.now()+12e3;for(;Date.now()<i;)if(await new Promise(s=>setTimeout(s,400)),await he(r)){t.writeHead(200),t.end(JSON.stringify({ok:!0,url:r,alreadyRunning:!1}));return}t.writeHead(504),t.end(JSON.stringify({ok:!1,error:"Daemon spawn succeeded but never bound the port within 12s \u2014 check `agentx daemon status` and the dotfile log for errors.",manualUrl:r}))}async function he(e){try{let t=await fetch(e,{method:"GET",signal:AbortSignal.timeout(800)});return t.status>0&&t.status<600}catch{return!1}}import{existsSync as Ze,readFileSync as et}from"fs";j();function tn(e){let t=re(e),n={};if(Ze(t))try{n=te(JSON.parse(et(t,"utf-8")))}catch{n={}}let r=L.safeParse(n?.approvals);return r.success?r.data:L.parse(void 0)}function nn(e){let t=e.indexOf(":");return t<=0||t===e.length-1?null:{channel:e.slice(0,t).trim(),chatId:e.slice(t+1).trim()}}async function rn(e,t={}){return ae(n=>{let r=n.approvals??={};e.defaultExpiryDays!==void 0&&(r.defaultExpiryDays=e.defaultExpiryDays),e.maxExpiryDays!==void 0&&(r.maxExpiryDays=e.maxExpiryDays),e.laterHours!==void 0&&(r.laterHours=e.laterHours),e.notifyAgent!==void 0&&(r.notifyAgent=e.notifyAgent);let a=r.digest??={};e.digestEnabled!==void 0&&(a.enabled=e.digestEnabled),e.digestTime!==void 0&&(a.time=e.digestTime),e.digestTimezone===null?delete a.timezone:e.digestTimezone!==void 0&&(a.timezone=e.digestTimezone),e.destination===null?delete a.destination:e.destination!==void 0&&(a.destination=e.destination);let i=r.popup??={};e.popupEnabled!==void 0&&(i.enabled=e.popupEnabled),e.popupSpeak!==void 0&&(i.speak=e.popupSpeak),e.popupVoice===null?delete i.voice:e.popupVoice!==void 0&&(i.voice=e.popupVoice),e.popupSound!==void 0&&(i.sound=e.popupSound),e.popupTimeoutSeconds!==void 0&&(i.timeoutSeconds=e.popupTimeoutSeconds),e.popupStyle!==void 0&&(i.style=e.popupStyle),e.popupTheme!==void 0&&(i.theme=e.popupTheme);let s=r.checkin??={};e.checkinEnabled!==void 0&&(s.enabled=e.checkinEnabled),e.checkinTimes!==void 0&&(s.times=e.checkinTimes),e.checkinDailyAt!==void 0&&(s.dailyAt=e.checkinDailyAt),e.checkinLists!==void 0&&(s.lists=e.checkinLists),e.checkinAgent===null?delete s.agent:e.checkinAgent!==void 0&&(s.agent=e.checkinAgent);let l=r.defaultExpiryDays??3,o=r.maxExpiryDays??30;if(l>o)throw new Error(`defaultExpiryDays (${l}) can't be more than maxExpiryDays (${o})`)},{configPath:t.configPath,reload:t.reload})}import{existsSync as G,mkdirSync as $e,readFileSync as X,renameSync as Ae,writeFileSync as Se,appendFileSync as tt}from"fs";import{dirname as Ie,resolve as Ee}from"path";import{randomBytes as Ce}from"crypto";var nt=".agentx/members.json",rt=".agentx/members-log.jsonl",Te=class{constructor(t=process.cwd(),n=Date.now,r=90){this.now=n;this.retentionDays=r;this.file=Ee(t,nt),this.logFile=Ee(t,rt)}file;logFile;prunedAt=0;devices(t){let n=this.load().devices;return t?n.filter(r=>r.personId===t):n}byToken(t){return this.load().devices.find(n=>n.tokenId===t)??null}add(t){let n=this.load();n.devices=n.devices.filter(r=>r.tokenId!==t.tokenId),n.devices.push(t),this.save(n)}update(t,n){let r=this.load(),a=r.devices.find(i=>i.tokenId===t);return a?(Object.assign(a,n),this.save(r),a):null}log(t){try{this.prune(),$e(Ie(this.logFile),{recursive:!0}),tt(this.logFile,JSON.stringify({at:new Date(this.now()).toISOString(),...t})+`
|
|
186
|
+
`,{mode:384})}catch{}}prune(t=!1){let n=this.now();if(!t&&n-this.prunedAt<36e5||(this.prunedAt=n,!G(this.logFile)))return 0;let r=n-this.retentionDays*864e5,a=X(this.logFile,"utf-8").split(`
|
|
187
|
+
`).filter(Boolean),i=a.filter(l=>{try{return Date.parse(JSON.parse(l).at)>=r}catch{return!1}});if(i.length===a.length)return 0;let s=`${this.logFile}.${process.pid}.${Ce(4).toString("hex")}.tmp`;return Se(s,i.length?i.join(`
|
|
188
|
+
`)+`
|
|
189
|
+
`:"",{encoding:"utf-8",mode:384}),Ae(s,this.logFile),a.length-i.length}events(t,n=50){if(!G(this.logFile))return[];let r=X(this.logFile,"utf-8").split(`
|
|
190
|
+
`).filter(Boolean),a=[];for(let i=r.length-1;i>=0&&a.length<n;i--)try{let s=JSON.parse(r[i]);(!t||s.person===t)&&a.push(s)}catch{}return a}load(){if(G(this.file))try{let t=JSON.parse(X(this.file,"utf-8"));if(t&&Array.isArray(t.devices))return t}catch{}return{devices:[]}}save(t){$e(Ie(this.file),{recursive:!0});let n=`${this.file}.${process.pid}.${Ce(4).toString("hex")}.tmp`;Se(n,JSON.stringify(t,null,2)+`
|
|
191
|
+
`,{encoding:"utf-8",mode:384}),Ae(n,this.file)}};import{createServer as at}from"http";var W=class{peers;cache=new Map;ttl=3e4;constructor(t){this.peers=t.map(n=>({url:n.replace(/\/$/,"")}))}async getRemoteAgents(){let t=[];return await Promise.all(this.peers.map(async n=>{try{let r=await this.fetchJson(`${n.url}/wiki/agents`);n.nodeId=r.nodeId;for(let a of r.agents||[])(a.totalEntries>0||a.totalArticles>0)&&t.push({...a,nodeId:r.nodeId,peerUrl:n.url})}catch{}})),t}async getRemoteArticles(t,n){try{return(await this.fetchJson(`${t}/wiki/articles?agent=${encodeURIComponent(n)}`)).articles||[]}catch{return[]}}async getRemoteArticle(t,n,r){try{let a=await this.fetchJson(`${t}/wiki/article?agent=${encodeURIComponent(n)}&path=${encodeURIComponent(r)}`);return{meta:{title:a.title,tags:a.tags||[],owner:a.owner,access:"public",created:a.created,lastUpdated:a.lastUpdated,sources:a.sources||[]},content:a.content,path:a.path}}catch{return null}}async fetchJson(t){let n=this.cache.get(t);if(n&&Date.now()-n.ts<this.ttl)return n.data;let r=await fetch(t,{signal:AbortSignal.timeout(5e3)});if(!r.ok)throw new Error(`HTTP ${r.status}`);let a=await r.json();return this.cache.set(t,{data:a,ts:Date.now()}),a}};function c(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function it(e){return e.replace(/<!--\s*tags?:[^>]*-->\s*\n?/gi,"")}function Re(e,t){return`<a href="${t?`/agent/${encodeURIComponent(t)}/tag/${encodeURIComponent(e)}`:`/tag/${encodeURIComponent(e)}`}" class="tag">${c(e)}</a>`}function D(e,t){return(e||[]).map(n=>Re(n,t)).join(" ")}function ot(e,t){if(!e)return;let n=t.get(e);if(n)return n;let r=new Set(t.values());if(r.has(e))return e;let a=e.endsWith(".md")?e:`${e}.md`;if(r.has(a))return a;let i=e.toLowerCase();for(let[s,l]of t)if(s.toLowerCase()===i)return l}function B(e,t,n=""){return le(it(e),{wikilink:(r,a)=>{let i=ot(r,t);return i?`<a href="${n}/article/${encodeURIComponent(i)}" class="wikilink">${a}</a>`:`<a href="${n}/search?q=${encodeURIComponent(r)}" class="wikilink broken" title="Not found \u2014 click to search">${a}</a>`}})}var st=`<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
192
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
193
|
+
<link href="https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,300..600;1,6..72,300..600&family=Inter+Tight:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">`,dt=`
|
|
194
|
+
:root {
|
|
195
|
+
--bg: #FAF8F3;
|
|
196
|
+
--bg-raised: #FFFFFF;
|
|
197
|
+
--bg-sunk: #F2EFE7;
|
|
198
|
+
--bg-hover: #EFEBE0;
|
|
199
|
+
--ink: #1A1915;
|
|
200
|
+
--ink-2: #3D3A32;
|
|
201
|
+
--muted: #6B6860;
|
|
202
|
+
--muted-2: #96918A;
|
|
203
|
+
--line: #E4DED0;
|
|
204
|
+
--line-2: #D1CAB8;
|
|
205
|
+
--accent: oklch(55% 0.14 45);
|
|
206
|
+
--accent-soft: oklch(55% 0.14 45 / 0.10);
|
|
207
|
+
--accent-hover: oklch(48% 0.14 45);
|
|
208
|
+
--cool: oklch(55% 0.08 230);
|
|
209
|
+
--cool-soft: oklch(55% 0.08 230 / 0.10);
|
|
210
|
+
--ok: oklch(55% 0.10 145);
|
|
211
|
+
--warn: oklch(60% 0.14 75);
|
|
212
|
+
--err: oklch(55% 0.16 20);
|
|
213
|
+
--font-display: 'Newsreader', Georgia, serif;
|
|
214
|
+
--font-ui: 'Inter Tight', -apple-system, system-ui, sans-serif;
|
|
215
|
+
--font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
|
|
216
|
+
--sidebar-w: 260px;
|
|
217
|
+
--topbar-h: 52px;
|
|
218
|
+
--radius: 6px;
|
|
219
|
+
--radius-sm: 4px;
|
|
220
|
+
--radius-lg: 10px;
|
|
221
|
+
--shadow-sm: 0 1px 2px rgba(26,25,21,0.04), 0 1px 1px rgba(26,25,21,0.03);
|
|
222
|
+
--shadow-md: 0 4px 12px rgba(26,25,21,0.06), 0 2px 4px rgba(26,25,21,0.04);
|
|
223
|
+
--shadow-lg: 0 12px 40px rgba(26,25,21,0.12), 0 4px 12px rgba(26,25,21,0.06);
|
|
224
|
+
}
|
|
225
|
+
[data-theme="dark"] {
|
|
226
|
+
--bg: #0F0E0C;
|
|
227
|
+
--bg-raised: #1A1815;
|
|
228
|
+
--bg-sunk: #07060A;
|
|
229
|
+
--bg-hover: #22201C;
|
|
230
|
+
--ink: #EBE7DD;
|
|
231
|
+
--ink-2: #C9C4B7;
|
|
232
|
+
--muted: #8B867B;
|
|
233
|
+
--muted-2: #5E5A52;
|
|
234
|
+
--line: #2A2822;
|
|
235
|
+
--line-2: #3A3830;
|
|
236
|
+
--accent: oklch(70% 0.16 45);
|
|
237
|
+
--accent-soft: oklch(70% 0.16 45 / 0.14);
|
|
238
|
+
--accent-hover: oklch(78% 0.16 45);
|
|
239
|
+
--cool: oklch(70% 0.10 230);
|
|
240
|
+
--cool-soft: oklch(70% 0.10 230 / 0.14);
|
|
241
|
+
--ok: oklch(70% 0.14 145);
|
|
242
|
+
--warn: oklch(75% 0.16 75);
|
|
243
|
+
--err: oklch(68% 0.18 20);
|
|
244
|
+
--shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
|
|
245
|
+
--shadow-md: 0 4px 12px rgba(0,0,0,0.5);
|
|
246
|
+
--shadow-lg: 0 12px 40px rgba(0,0,0,0.7);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
250
|
+
html, body {
|
|
251
|
+
background: var(--bg); color: var(--ink);
|
|
252
|
+
font-family: var(--font-ui); font-size: 14px; line-height: 1.55;
|
|
253
|
+
font-feature-settings: 'ss01','cv11';
|
|
254
|
+
-webkit-font-smoothing: antialiased; min-height: 100vh;
|
|
255
|
+
}
|
|
256
|
+
a { color: var(--accent); text-decoration: none; }
|
|
257
|
+
a:hover { color: var(--accent-hover); }
|
|
258
|
+
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
|
|
259
|
+
input, textarea, select { font: inherit; color: inherit; }
|
|
260
|
+
code, pre, .mono { font-family: var(--font-mono); font-size: 0.92em; }
|
|
261
|
+
.display { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.01em; }
|
|
262
|
+
|
|
263
|
+
/* \u2014\u2014\u2014 App shell \u2014\u2014\u2014 */
|
|
264
|
+
.app {
|
|
265
|
+
display: grid;
|
|
266
|
+
grid-template-columns: var(--sidebar-w) 1fr;
|
|
267
|
+
grid-template-rows: var(--topbar-h) 1fr;
|
|
268
|
+
min-height: 100vh;
|
|
269
|
+
}
|
|
270
|
+
.topbar {
|
|
271
|
+
grid-column: 1 / -1;
|
|
272
|
+
display: flex; align-items: center; gap: 16px; padding: 0 20px;
|
|
273
|
+
background: var(--bg); border-bottom: 1px solid var(--line);
|
|
274
|
+
position: sticky; top: 0; z-index: 20; backdrop-filter: blur(8px);
|
|
275
|
+
}
|
|
276
|
+
.topbar-logo {
|
|
277
|
+
display: flex; align-items: center; gap: 10px;
|
|
278
|
+
font-family: var(--font-display); font-size: 18px; color: var(--ink);
|
|
279
|
+
width: calc(var(--sidebar-w) - 20px); padding-right: 12px;
|
|
280
|
+
border-right: 1px solid var(--line); height: 100%;
|
|
281
|
+
text-decoration: none;
|
|
282
|
+
}
|
|
283
|
+
.topbar-logo .mark {
|
|
284
|
+
width: 22px; height: 22px; flex: 0 0 auto;
|
|
285
|
+
display: inline-flex; align-items: center; justify-content: center;
|
|
286
|
+
background: var(--accent); color: var(--bg-raised);
|
|
287
|
+
border-radius: 5px; font-family: var(--font-mono);
|
|
288
|
+
font-size: 11px; font-weight: 700;
|
|
289
|
+
}
|
|
290
|
+
.topbar-search {
|
|
291
|
+
flex: 1; max-width: 520px;
|
|
292
|
+
display: flex; align-items: center; gap: 8px; padding: 6px 12px;
|
|
293
|
+
background: var(--bg-raised); border: 1px solid var(--line);
|
|
294
|
+
border-radius: var(--radius); color: var(--muted);
|
|
295
|
+
transition: border-color 0.15s, background 0.15s;
|
|
296
|
+
}
|
|
297
|
+
.topbar-search:focus-within { border-color: var(--line-2); background: var(--bg-hover); }
|
|
298
|
+
.topbar-search input {
|
|
299
|
+
flex: 1; border: 0; outline: 0; background: transparent;
|
|
300
|
+
color: var(--ink); font: inherit;
|
|
301
|
+
}
|
|
302
|
+
.topbar-search input::placeholder { color: var(--muted); }
|
|
303
|
+
.topbar-search kbd {
|
|
304
|
+
font-family: var(--font-mono); font-size: 11px;
|
|
305
|
+
padding: 2px 6px; border: 1px solid var(--line); border-radius: 3px;
|
|
306
|
+
background: var(--bg); color: var(--muted);
|
|
307
|
+
}
|
|
308
|
+
.topbar-tools { margin-left: auto; display: flex; align-items: center; gap: 4px; }
|
|
309
|
+
.icon-btn {
|
|
310
|
+
width: 32px; height: 32px;
|
|
311
|
+
display: inline-flex; align-items: center; justify-content: center;
|
|
312
|
+
border-radius: var(--radius-sm); color: var(--muted);
|
|
313
|
+
transition: background 0.15s, color 0.15s;
|
|
314
|
+
}
|
|
315
|
+
.icon-btn:hover { background: var(--bg-hover); color: var(--ink); }
|
|
316
|
+
.icon-btn.active { color: var(--accent); background: var(--accent-soft); }
|
|
317
|
+
.icon-btn svg { width: 16px; height: 16px; }
|
|
318
|
+
|
|
319
|
+
/* \u2014\u2014\u2014 Sidebar \u2014\u2014\u2014 */
|
|
320
|
+
.sidebar {
|
|
321
|
+
grid-column: 1; grid-row: 2;
|
|
322
|
+
background: var(--bg); border-right: 1px solid var(--line);
|
|
323
|
+
padding: 16px 12px 40px; overflow-y: auto;
|
|
324
|
+
position: sticky; top: var(--topbar-h);
|
|
325
|
+
height: calc(100vh - var(--topbar-h));
|
|
326
|
+
}
|
|
327
|
+
.nav-section { margin-bottom: 20px; }
|
|
328
|
+
.nav-section-title {
|
|
329
|
+
display: flex; align-items: center; justify-content: space-between;
|
|
330
|
+
padding: 4px 10px; font-size: 11px; font-weight: 600;
|
|
331
|
+
text-transform: uppercase; letter-spacing: 0.06em;
|
|
332
|
+
color: var(--muted); margin-bottom: 2px;
|
|
333
|
+
}
|
|
334
|
+
.nav-item {
|
|
335
|
+
display: flex; align-items: center; gap: 8px;
|
|
336
|
+
padding: 5px 10px; color: var(--ink-2);
|
|
337
|
+
font-size: 13px; border-radius: var(--radius-sm);
|
|
338
|
+
line-height: 1.35; cursor: pointer;
|
|
339
|
+
transition: background 0.1s;
|
|
340
|
+
text-decoration: none;
|
|
341
|
+
}
|
|
342
|
+
.nav-item:hover { background: var(--bg-hover); color: var(--ink); }
|
|
343
|
+
.nav-item.active {
|
|
344
|
+
background: var(--accent-soft); color: var(--accent); font-weight: 500;
|
|
345
|
+
}
|
|
346
|
+
.nav-item .count {
|
|
347
|
+
margin-left: auto; font-family: var(--font-mono);
|
|
348
|
+
font-size: 11px; color: var(--muted);
|
|
349
|
+
}
|
|
350
|
+
.nav-item.active .count { color: var(--accent); }
|
|
351
|
+
.nav-agent-header {
|
|
352
|
+
display: flex; align-items: center; gap: 8px;
|
|
353
|
+
padding: 6px 10px; font-size: 13px; color: var(--ink);
|
|
354
|
+
cursor: pointer; border-radius: var(--radius-sm);
|
|
355
|
+
text-decoration: none;
|
|
356
|
+
}
|
|
357
|
+
.nav-agent-header:hover { color: var(--accent); background: var(--bg-hover); }
|
|
358
|
+
.nav-agent-header .name { font-weight: 500; }
|
|
359
|
+
.nav-agent-header .badge {
|
|
360
|
+
margin-left: auto; font-family: var(--font-mono);
|
|
361
|
+
font-size: 10.5px; color: var(--muted);
|
|
362
|
+
}
|
|
363
|
+
.nav-agent-type-label {
|
|
364
|
+
padding: 6px 8px 2px; font-size: 10px;
|
|
365
|
+
text-transform: uppercase; letter-spacing: 0.08em;
|
|
366
|
+
color: var(--muted-2); font-weight: 600;
|
|
367
|
+
}
|
|
368
|
+
.nav-agent-children {
|
|
369
|
+
padding-left: 14px; display: flex; flex-direction: column; gap: 1px;
|
|
370
|
+
margin-top: 2px; border-left: 1px dashed var(--line); margin-left: 10px;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/* \u2014\u2014\u2014 Main \u2014\u2014\u2014 */
|
|
374
|
+
.main {
|
|
375
|
+
grid-column: 2; grid-row: 2;
|
|
376
|
+
padding: 32px 48px 80px;
|
|
377
|
+
max-width: 1180px; width: 100%;
|
|
378
|
+
}
|
|
379
|
+
.main.article { max-width: 1100px; }
|
|
380
|
+
|
|
381
|
+
/* \u2014\u2014\u2014 Breadcrumb \u2014\u2014\u2014 */
|
|
382
|
+
.breadcrumb {
|
|
383
|
+
display: flex; align-items: center; gap: 6px;
|
|
384
|
+
font-size: 12.5px; color: var(--muted);
|
|
385
|
+
margin-bottom: 14px; font-family: var(--font-ui);
|
|
386
|
+
}
|
|
387
|
+
.breadcrumb a { color: var(--muted); }
|
|
388
|
+
.breadcrumb a:hover { color: var(--accent); }
|
|
389
|
+
.breadcrumb .sep { color: var(--muted-2); }
|
|
390
|
+
.breadcrumb .current { color: var(--ink-2); }
|
|
391
|
+
|
|
392
|
+
/* \u2014\u2014\u2014 Display heading \u2014\u2014\u2014 */
|
|
393
|
+
.page-head {
|
|
394
|
+
display: flex; align-items: flex-end; justify-content: space-between;
|
|
395
|
+
gap: 24px; padding-bottom: 16px;
|
|
396
|
+
border-bottom: 1px solid var(--line); margin-bottom: 28px;
|
|
397
|
+
}
|
|
398
|
+
.page-head h1 {
|
|
399
|
+
font-family: var(--font-display); font-size: 38px;
|
|
400
|
+
font-weight: 400; letter-spacing: -0.015em; line-height: 1.1;
|
|
401
|
+
}
|
|
402
|
+
.page-head .page-sub {
|
|
403
|
+
font-size: 13.5px; color: var(--muted);
|
|
404
|
+
margin-top: 6px; max-width: 60ch; line-height: 1.5;
|
|
405
|
+
}
|
|
406
|
+
.page-head .page-actions { display: flex; gap: 8px; flex: 0 0 auto; }
|
|
407
|
+
|
|
408
|
+
/* \u2014\u2014\u2014 Buttons \u2014\u2014\u2014 */
|
|
409
|
+
.btn {
|
|
410
|
+
display: inline-flex; align-items: center; gap: 6px;
|
|
411
|
+
padding: 6px 12px; font-size: 13px;
|
|
412
|
+
color: var(--ink-2); background: var(--bg-raised);
|
|
413
|
+
border: 1px solid var(--line); border-radius: var(--radius-sm);
|
|
414
|
+
transition: all 0.1s; text-decoration: none;
|
|
415
|
+
}
|
|
416
|
+
.btn:hover { background: var(--bg-hover); border-color: var(--line-2); color: var(--ink); }
|
|
417
|
+
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
|
|
418
|
+
.btn.primary:hover { background: var(--ink-2); color: var(--bg); }
|
|
419
|
+
.btn.ghost { background: transparent; border-color: transparent; }
|
|
420
|
+
.btn.ghost:hover { background: var(--bg-hover); }
|
|
421
|
+
.btn svg { width: 14px; height: 14px; }
|
|
422
|
+
|
|
423
|
+
/* \u2014\u2014\u2014 Stat strip \u2014\u2014\u2014 */
|
|
424
|
+
.stats, .stat-strip {
|
|
425
|
+
display: grid;
|
|
426
|
+
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
|
|
427
|
+
gap: 0;
|
|
428
|
+
background: var(--bg-raised); border: 1px solid var(--line);
|
|
429
|
+
border-radius: var(--radius); overflow: hidden;
|
|
430
|
+
margin-bottom: 28px;
|
|
431
|
+
}
|
|
432
|
+
.stat-card, .stat-cell {
|
|
433
|
+
padding: 16px 20px;
|
|
434
|
+
border-right: 1px solid var(--line);
|
|
435
|
+
display: flex; flex-direction: column; gap: 4px;
|
|
436
|
+
background: transparent; text-align: left;
|
|
437
|
+
}
|
|
438
|
+
.stat-card:last-child, .stat-cell:last-child { border-right: none; }
|
|
439
|
+
.stat-card .label, .stat-cell .label {
|
|
440
|
+
font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
|
|
441
|
+
color: var(--muted); font-weight: 600;
|
|
442
|
+
}
|
|
443
|
+
.stat-card .number, .stat-cell .number {
|
|
444
|
+
font-family: var(--font-display); font-size: 32px; font-weight: 400;
|
|
445
|
+
line-height: 1; color: var(--ink);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/* \u2014\u2014\u2014 Section heading \u2014\u2014\u2014 */
|
|
449
|
+
.section-head, h2.section {
|
|
450
|
+
display: flex; align-items: baseline; justify-content: space-between;
|
|
451
|
+
margin: 40px 0 14px;
|
|
452
|
+
}
|
|
453
|
+
.section-head h2 {
|
|
454
|
+
font-family: var(--font-display); font-size: 22px;
|
|
455
|
+
font-weight: 400; letter-spacing: -0.01em; color: var(--ink);
|
|
456
|
+
border: none; padding: 0;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/* \u2014\u2014\u2014 Agent grid (hub home) \u2014\u2014\u2014 */
|
|
460
|
+
.agent-grid {
|
|
461
|
+
display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
|
|
462
|
+
gap: 14px;
|
|
463
|
+
}
|
|
464
|
+
.agent-card {
|
|
465
|
+
background: var(--bg-raised); border: 1px solid var(--line);
|
|
466
|
+
border-radius: var(--radius); padding: 18px 20px;
|
|
467
|
+
display: flex; flex-direction: column; gap: 12px;
|
|
468
|
+
transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
|
|
469
|
+
}
|
|
470
|
+
.agent-card:hover {
|
|
471
|
+
border-color: var(--line-2); box-shadow: var(--shadow-md);
|
|
472
|
+
transform: translateY(-1px);
|
|
473
|
+
}
|
|
474
|
+
.agent-card h3 {
|
|
475
|
+
font-family: var(--font-display); font-size: 20px; font-weight: 400;
|
|
476
|
+
color: var(--ink); margin: 0;
|
|
477
|
+
}
|
|
478
|
+
.agent-card h3 a { color: inherit; text-decoration: none; }
|
|
479
|
+
.agent-card h3 a:hover { color: var(--accent); }
|
|
480
|
+
.agent-card .agent-stats {
|
|
481
|
+
display: flex; gap: 20px; font-size: 13px; color: var(--muted);
|
|
482
|
+
}
|
|
483
|
+
.agent-card .agent-stats strong {
|
|
484
|
+
color: var(--ink); font-weight: 600; font-family: var(--font-mono);
|
|
485
|
+
}
|
|
486
|
+
.agent-card .article-list {
|
|
487
|
+
display: flex; flex-direction: column; gap: 4px; margin-top: 4px; font-size: 13px;
|
|
488
|
+
}
|
|
489
|
+
.agent-card .article-row {
|
|
490
|
+
display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
|
|
491
|
+
padding: 2px 0;
|
|
492
|
+
}
|
|
493
|
+
.agent-card .article-row .article-title {
|
|
494
|
+
color: var(--ink-2); text-decoration: none; margin-left: 4px; flex: 1;
|
|
495
|
+
}
|
|
496
|
+
.agent-card .article-row .article-title:hover { color: var(--accent); }
|
|
497
|
+
|
|
498
|
+
/* \u2014\u2014\u2014 Tags \u2014\u2014\u2014 */
|
|
499
|
+
.tag {
|
|
500
|
+
display: inline-flex; align-items: center;
|
|
501
|
+
font-family: var(--font-mono); font-size: 11.5px;
|
|
502
|
+
padding: 1px 7px 2px; background: var(--bg-sunk);
|
|
503
|
+
color: var(--ink-2); border-radius: 3px;
|
|
504
|
+
line-height: 1.4; cursor: pointer;
|
|
505
|
+
transition: background 0.1s, color 0.1s;
|
|
506
|
+
text-decoration: none;
|
|
507
|
+
}
|
|
508
|
+
.tag:hover { background: var(--accent-soft); color: var(--accent); }
|
|
509
|
+
.tag.lg { font-size: 12.5px; padding: 3px 10px; }
|
|
510
|
+
|
|
511
|
+
/* \u2014\u2014\u2014 Article meta \u2014 inline dl below h1 \u2014\u2014\u2014 */
|
|
512
|
+
.meta {
|
|
513
|
+
background: var(--bg-raised); border: 1px solid var(--line);
|
|
514
|
+
border-radius: var(--radius); padding: 14px 18px;
|
|
515
|
+
margin-bottom: 24px; font-size: 13px;
|
|
516
|
+
display: grid; grid-template-columns: auto 1fr;
|
|
517
|
+
gap: 6px 18px;
|
|
518
|
+
}
|
|
519
|
+
.meta dt {
|
|
520
|
+
font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
|
|
521
|
+
color: var(--muted); font-weight: 600;
|
|
522
|
+
align-self: center;
|
|
523
|
+
}
|
|
524
|
+
.meta dd { color: var(--ink-2); font-family: var(--font-mono); font-size: 12.5px; }
|
|
525
|
+
|
|
526
|
+
/* \u2014\u2014\u2014 Prose body \u2014\u2014\u2014 */
|
|
527
|
+
.prose {
|
|
528
|
+
font-size: 15.5px; line-height: 1.65; color: var(--ink-2);
|
|
529
|
+
max-width: 68ch;
|
|
530
|
+
}
|
|
531
|
+
.main h1, .prose h1 {
|
|
532
|
+
font-family: var(--font-display); font-size: 40px;
|
|
533
|
+
font-weight: 400; letter-spacing: -0.015em; line-height: 1.1;
|
|
534
|
+
color: var(--ink); margin-bottom: 16px;
|
|
535
|
+
border: none; padding: 0;
|
|
536
|
+
}
|
|
537
|
+
.main h2, .prose h2 {
|
|
538
|
+
font-family: var(--font-display); font-size: 26px;
|
|
539
|
+
font-weight: 400; letter-spacing: -0.01em;
|
|
540
|
+
margin: 36px 0 12px; color: var(--ink);
|
|
541
|
+
padding-bottom: 4px; border-bottom: 1px solid var(--line);
|
|
542
|
+
}
|
|
543
|
+
.main h3, .prose h3 {
|
|
544
|
+
font-family: var(--font-display); font-size: 20px; font-weight: 500;
|
|
545
|
+
margin: 28px 0 8px; color: var(--ink);
|
|
546
|
+
}
|
|
547
|
+
.main h4, .prose h4 {
|
|
548
|
+
font-size: 15px; font-weight: 600; margin: 20px 0 6px; color: var(--ink);
|
|
549
|
+
}
|
|
550
|
+
.main p, .prose p { margin: 10px 0; }
|
|
551
|
+
.main ul, .prose ul, .main ol, .prose ol { margin: 10px 0 10px 22px; }
|
|
552
|
+
.main li, .prose li { margin: 4px 0; }
|
|
553
|
+
.main code, .prose code {
|
|
554
|
+
background: var(--bg-sunk); padding: 1px 5px; border-radius: 3px;
|
|
555
|
+
font-family: var(--font-mono);
|
|
556
|
+
}
|
|
557
|
+
.main pre, .prose pre {
|
|
558
|
+
background: var(--bg-sunk); border: 1px solid var(--line);
|
|
559
|
+
border-radius: var(--radius-sm); padding: 14px 16px;
|
|
560
|
+
overflow-x: auto; margin: 14px 0; font-size: 13px;
|
|
561
|
+
}
|
|
562
|
+
.main pre code, .prose pre code { background: none; padding: 0; }
|
|
563
|
+
.main blockquote, .prose blockquote {
|
|
564
|
+
border-left: 3px solid var(--accent);
|
|
565
|
+
padding: 4px 0 4px 14px; color: var(--muted);
|
|
566
|
+
font-style: italic; margin: 14px 0;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/* Wikilinks in prose */
|
|
570
|
+
.prose a.wikilink, .main a.wikilink {
|
|
571
|
+
color: var(--accent);
|
|
572
|
+
text-decoration: underline;
|
|
573
|
+
text-decoration-color: var(--accent-soft);
|
|
574
|
+
text-underline-offset: 3px;
|
|
575
|
+
text-decoration-thickness: 1.5px;
|
|
576
|
+
}
|
|
577
|
+
.prose a.wikilink:hover, .main a.wikilink:hover { text-decoration-color: var(--accent); }
|
|
578
|
+
.prose a.wikilink.broken, .main a.wikilink.broken {
|
|
579
|
+
color: var(--err); text-decoration-color: var(--err);
|
|
580
|
+
text-decoration-style: dashed;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/* \u2014\u2014\u2014 Tables \u2014\u2014\u2014 */
|
|
584
|
+
table {
|
|
585
|
+
width: 100%; border-collapse: collapse;
|
|
586
|
+
margin: 14px 0; font-size: 14px;
|
|
587
|
+
}
|
|
588
|
+
th, td {
|
|
589
|
+
border-bottom: 1px solid var(--line);
|
|
590
|
+
padding: 8px 12px; text-align: left;
|
|
591
|
+
}
|
|
592
|
+
th {
|
|
593
|
+
background: var(--bg-sunk); font-weight: 600;
|
|
594
|
+
color: var(--ink); font-size: 12.5px;
|
|
595
|
+
text-transform: uppercase; letter-spacing: 0.04em;
|
|
596
|
+
}
|
|
597
|
+
tr:hover td { background: var(--bg-hover); }
|
|
598
|
+
|
|
599
|
+
/* \u2014\u2014\u2014 Entry cards \u2014\u2014\u2014 */
|
|
600
|
+
.entry-card {
|
|
601
|
+
background: var(--bg-raised); border: 1px solid var(--line);
|
|
602
|
+
border-radius: var(--radius);
|
|
603
|
+
padding: 14px 18px; margin: 10px 0;
|
|
604
|
+
transition: border-color 0.15s, box-shadow 0.15s;
|
|
605
|
+
}
|
|
606
|
+
.entry-card:hover { border-color: var(--line-2); box-shadow: var(--shadow-sm); }
|
|
607
|
+
.entry-card .meta-line {
|
|
608
|
+
font-size: 11.5px; color: var(--muted);
|
|
609
|
+
margin-bottom: 6px; font-family: var(--font-mono);
|
|
610
|
+
}
|
|
611
|
+
.entry-card h3 {
|
|
612
|
+
font-family: var(--font-display); font-size: 19px; font-weight: 400;
|
|
613
|
+
color: var(--ink); margin: 4px 0 6px;
|
|
614
|
+
border: none; padding: 0;
|
|
615
|
+
}
|
|
616
|
+
.entry-card h3 a { color: inherit; }
|
|
617
|
+
.entry-card h3 a:hover { color: var(--accent); }
|
|
618
|
+
.entry-card p {
|
|
619
|
+
color: var(--ink-2); font-size: 13.5px;
|
|
620
|
+
line-height: 1.55; margin: 4px 0;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/* \u2014\u2014\u2014 Backlinks \u2014\u2014\u2014 */
|
|
624
|
+
.backlinks {
|
|
625
|
+
margin-top: 40px; padding: 16px 18px;
|
|
626
|
+
background: var(--bg-raised); border: 1px solid var(--line);
|
|
627
|
+
border-radius: var(--radius);
|
|
628
|
+
}
|
|
629
|
+
.backlinks h4 {
|
|
630
|
+
font-size: 11px; text-transform: uppercase;
|
|
631
|
+
letter-spacing: 0.08em; color: var(--muted);
|
|
632
|
+
font-weight: 600; margin-bottom: 8px;
|
|
633
|
+
}
|
|
634
|
+
.backlinks ul { list-style: none; padding: 0; margin: 0; }
|
|
635
|
+
.backlinks li { padding: 4px 0; font-size: 13.5px; }
|
|
636
|
+
|
|
637
|
+
/* \u2014\u2014\u2014 Health issues list \u2014\u2014\u2014 */
|
|
638
|
+
.health-list { display: flex; flex-direction: column; gap: 6px; }
|
|
639
|
+
.health-row {
|
|
640
|
+
display: grid; grid-template-columns: 96px 1fr 2fr;
|
|
641
|
+
gap: 14px; align-items: center;
|
|
642
|
+
padding: 10px 14px; background: var(--bg-raised);
|
|
643
|
+
border: 1px solid var(--line); border-radius: var(--radius-sm);
|
|
644
|
+
font-size: 13px;
|
|
645
|
+
}
|
|
646
|
+
.health-row .kind {
|
|
647
|
+
font-family: var(--font-mono); font-size: 10.5px;
|
|
648
|
+
text-transform: uppercase; letter-spacing: 0.06em;
|
|
649
|
+
color: var(--muted);
|
|
650
|
+
}
|
|
651
|
+
.health-row .article { color: var(--ink); font-weight: 500; }
|
|
652
|
+
.health-row .msg { color: var(--ink-2); }
|
|
653
|
+
|
|
654
|
+
@media (max-width: 900px) {
|
|
655
|
+
.app { grid-template-columns: 1fr; }
|
|
656
|
+
.topbar-logo { width: auto; border-right: none; }
|
|
657
|
+
.sidebar { display: none; }
|
|
658
|
+
.main { padding: 20px; grid-column: 1; }
|
|
659
|
+
}
|
|
660
|
+
`;function $(e,t,n,r=""){return`<!DOCTYPE html>
|
|
661
|
+
<html lang="en">
|
|
662
|
+
<head>
|
|
663
|
+
<meta charset="utf-8">
|
|
664
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
665
|
+
<title>${c(e)} \u2014 AgentX Wiki</title>
|
|
666
|
+
${st}
|
|
667
|
+
<style>${dt}</style>
|
|
668
|
+
<script>(function(){try{var t=localStorage.getItem('wiki-theme');if(t)document.documentElement.setAttribute('data-theme',t)}catch(e){}})();</script>
|
|
669
|
+
</head>
|
|
670
|
+
<body>
|
|
671
|
+
<div class="app">
|
|
672
|
+
<header class="topbar">
|
|
673
|
+
<a href="/" class="topbar-logo">
|
|
674
|
+
<span class="mark">W</span>
|
|
675
|
+
<span class="display">AgentX Wiki</span>
|
|
676
|
+
</a>
|
|
677
|
+
<form class="topbar-search" action="/search" method="get">
|
|
678
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>
|
|
679
|
+
<input type="search" name="q" placeholder="Search every wiki\u2026" value="${c(r)}" autocomplete="off" />
|
|
680
|
+
<kbd>\u2318K</kbd>
|
|
681
|
+
</form>
|
|
682
|
+
<div class="topbar-tools">
|
|
683
|
+
<button class="icon-btn" id="wiki-theme-toggle" title="Toggle theme" aria-label="Toggle theme">
|
|
684
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>
|
|
685
|
+
</button>
|
|
686
|
+
</div>
|
|
687
|
+
</header>
|
|
688
|
+
<nav class="sidebar">${t}</nav>
|
|
689
|
+
<main class="main">${n}</main>
|
|
690
|
+
</div>
|
|
691
|
+
<script>
|
|
692
|
+
(function(){
|
|
693
|
+
var btn = document.getElementById('wiki-theme-toggle');
|
|
694
|
+
if (!btn) return;
|
|
695
|
+
btn.addEventListener('click', function(){
|
|
696
|
+
var cur = document.documentElement.getAttribute('data-theme') === 'dark' ? '' : 'dark';
|
|
697
|
+
if (cur) document.documentElement.setAttribute('data-theme', 'dark');
|
|
698
|
+
else document.documentElement.removeAttribute('data-theme');
|
|
699
|
+
try { localStorage.setItem('wiki-theme', cur); } catch(e){}
|
|
700
|
+
});
|
|
701
|
+
// Cmd/Ctrl-K focuses search
|
|
702
|
+
document.addEventListener('keydown', function(e){
|
|
703
|
+
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 'k') {
|
|
704
|
+
e.preventDefault();
|
|
705
|
+
var inp = document.querySelector('.topbar-search input');
|
|
706
|
+
if (inp) inp.focus();
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
})();
|
|
710
|
+
</script>
|
|
711
|
+
</body>
|
|
712
|
+
</html>`}function V(e){let t=new Map;for(let n of e){let r=n.path.includes("/")?n.path.split("/").slice(0,-1).join("/"):"/",a=t.get(r)||[];a.push(n),t.set(r,a)}return new Map([...t].sort((n,r)=>n[0].localeCompare(r[0])))}function Q(e){return e==="/"?"Root":e.split("/").pop().replace(/-/g," ")}function C(e,t){let n='<div class="nav-section">';n+=`<a class="nav-item${t?"":" active"}" href="/">Home</a>`,n+='<a class="nav-item" href="/entries">All entries</a>',n+="</div>";for(let r of e){let a=`/agent/${encodeURIComponent(r.agentId)}`;n+='<div class="nav-section">',n+=`<a class="nav-agent-header" href="${a}">`,n+=`<span class="name">${c(r.agentId)}</span>`,n+=`<span class="badge">${r.totalArticles}</span>`,n+="</a>",n+='<div class="nav-agent-children">';let i=V(r.articles);for(let[s,l]of i){n+=`<div class="nav-agent-type-label">${Q(s)}</div>`;for(let o of l){let g=`${r.agentId}/${o.path}`===t;n+=`<a class="nav-item${g?" active":""}" href="${a}/article/${encodeURIComponent(o.path)}">${c(o.title)}</a>`}}n+="</div>",n+="</div>"}return n}function lt(e,t,n){let r=t||e.summary(),i=e.getSharedStore().listEntries().length,s=r.reduce((g,f)=>g+f.totalArticles,0),l=r.reduce((g,f)=>g+f.unabsorbed,0),o=new Set((n||[]).map(g=>g.agentId)),p=`<div class="page-head">
|
|
713
|
+
<div>
|
|
714
|
+
<h1>AgentX Wiki</h1>
|
|
715
|
+
<p class="page-sub">Agent-owned institutional knowledge, typed and cross-referenced. Everything here compiles from raw conversation entries through the nightly absorb pass.</p>
|
|
716
|
+
</div>
|
|
717
|
+
</div>`;if(p+='<div class="stat-strip">',p+=`<div class="stat-cell"><div class="label">Agents</div><div class="number">${r.length}</div></div>`,p+=`<div class="stat-cell"><div class="label">Articles</div><div class="number">${s}</div></div>`,p+=`<div class="stat-cell"><div class="label">Raw entries</div><div class="number">${i}</div></div>`,l>0&&(p+=`<div class="stat-cell"><div class="label">Unabsorbed</div><div class="number">${l}</div></div>`),n&&n.length>0){let g=new Set(n.map(f=>f.nodeId));p+=`<div class="stat-cell"><div class="label">Mesh nodes</div><div class="number">${g.size}</div></div>`}p+="</div>",p+='<div class="section-head"><h2>Agent wikis</h2></div>',p+='<div class="agent-grid">';for(let g of r){let f=g.unabsorbed>0?`<span class="tag" style="color:var(--warn);background:color-mix(in oklch, var(--warn) 12%, transparent)">${g.unabsorbed} unabsorbed</span>`:'<span class="tag" style="color:var(--ok);background:color-mix(in oklch, var(--ok) 12%, transparent)">up to date</span>',h=o.has(g.agentId)&&!e.listAgents().includes(g.agentId)?' <span class="tag" style="color:var(--cool);background:var(--cool-soft)">remote</span>':"";if(p+='<div class="agent-card">',p+=`<h3><a href="/agent/${encodeURIComponent(g.agentId)}">${c(g.agentId)}</a>${h}</h3>`,p+=`<div class="agent-stats">
|
|
718
|
+
<span><strong>${g.totalArticles}</strong> articles</span>
|
|
719
|
+
<span><strong>${g.totalEntries}</strong> entries</span>
|
|
720
|
+
${f}
|
|
721
|
+
</div>`,g.articles.length>0){p+='<div class="article-list">';for(let u of g.articles.slice(0,6)){let A=D((u.tags||[]).slice(0,2),g.agentId);p+=`<div class="article-row">${A} <a class="article-title" href="/agent/${encodeURIComponent(g.agentId)}/article/${encodeURIComponent(u.path)}">${c(u.title)}</a></div>`}g.articles.length>6&&(p+=`<div class="article-row"><a class="article-title" style="color:var(--muted)" href="/agent/${encodeURIComponent(g.agentId)}">+ ${g.articles.length-6} more \u2192</a></div>`),p+="</div>"}p+="</div>"}return p+="</div>",$("Hub",C(r),p)}function ct(e,t,n){let r=n||e.summary(),a=r.find(d=>d.agentId===t);if(!a)return $("Not Found",C(r),"<h1>Agent not found</h1>");let i=a.peerUrl!==void 0,s=e.getAgentEntries(t),l=a.articles||[],o=`<nav class="breadcrumb"><a href="/">Hub</a> <span class="sep">/</span> <span class="current">${c(t)}</span></nav>`;if(o+=`<div class="page-head"><div><h1>${c(t)}</h1>`,i&&(o+=`<p class="page-sub"><span class="tag" style="color:var(--cool);background:var(--cool-soft)">remote @ ${c(a.nodeId)}</span></p>`),o+="</div></div>",o+='<div class="stat-strip">',o+=`<div class="stat-cell"><div class="label">Articles</div><div class="number">${a.totalArticles}</div></div>`,o+=`<div class="stat-cell"><div class="label">Entries</div><div class="number">${a.totalEntries}</div></div>`,o+=`<div class="stat-cell"><div class="label">Unabsorbed</div><div class="number">${a.unabsorbed}</div></div>`,o+="</div>",l.length>0){o+='<div class="section-head"><h2>Articles</h2><span class="mono" style="font-size:12px;color:var(--muted)">'+l.length+" total</span></div>";let d=V(l);for(let[h,u]of d){o+=`<h3 class="display" style="font-size:17px;color:var(--muted);font-weight:500;margin:20px 0 8px">${Q(h)}</h3>`,o+='<div class="agent-card" style="padding:4px 14px"><div class="article-list">';for(let A of u)o+=`<div class="article-row">${D((A.tags||[]).slice(0,3),t)} <a class="article-title" href="/agent/${encodeURIComponent(t)}/article/${encodeURIComponent(A.path)}">${c(A.title)}</a></div>`;o+="</div></div>"}}let p=s.slice(-5).reverse();if(p.length>0){o+='<div class="section-head"><h2>Recent entries</h2><a class="btn ghost" href="/entries">See all \u2192</a></div>';for(let d of p)o+=`<div class="entry-card">
|
|
722
|
+
<div class="meta-line">${d.date} \xB7 via ${c(d.source)} \xB7 <code>${c(d.id)}</code></div>
|
|
723
|
+
<p>${c(d.content.slice(0,300))}${d.content.length>300?"\u2026":""}</p>
|
|
724
|
+
</div>`}let f=e.getAgentWiki(t).lint();if(f.length>0){o+=`<div class="section-head"><h2>Health issues</h2><span class="mono" style="font-size:12px;color:var(--warn)">${f.length}</span></div>`,o+='<div class="health-list">';for(let d of f)o+=`<div class="health-row">
|
|
725
|
+
<span class="kind">${c(d.type)}</span>
|
|
726
|
+
<span class="article">${c(d.article)}</span>
|
|
727
|
+
<span class="msg">${c(d.message)}</span>
|
|
728
|
+
</div>`;o+="</div>"}return $(t,C(r,t),o)}function pt(e,t,n,r){let a=e.getAgentWiki(t),i=a.readArticle(n);if(!i)return null;let s=r||e.summary(),l=a.rebuildIndex(),o=new Map;for(let h of l.articles)o.set(h.title,h.path);let p=`/agent/${encodeURIComponent(t)}`,f=a.buildBacklinks()[i.meta.title]||[],d=`<nav class="breadcrumb"><a href="/">Hub</a> <span class="sep">/</span> <a href="${p}">${c(t)}</a> <span class="sep">/</span> <span class="current">${c(i.meta.title)}</span></nav>`;if(d+=`<article class="prose"><h1>${c(i.meta.title)}</h1>`,d+='<dl class="meta">',i.meta.type&&(d+=`<dt>Type</dt><dd>${Re(i.meta.type,t)}</dd>`),i.meta.tags?.length&&(d+=`<dt>Tags</dt><dd>${D(i.meta.tags,t)}</dd>`),i.meta.owner&&(d+=`<dt>Owner</dt><dd>${c(i.meta.owner)}</dd>`),d+=`<dt>Created</dt><dd>${c(i.meta.created||"\u2014")}</dd>`,d+=`<dt>Updated</dt><dd>${c(i.meta.lastUpdated||"\u2014")}</dd>`,i.meta.sources?.length&&(d+=`<dt>Sources</dt><dd>${i.meta.sources.length} entries</dd>`),d+="</dl>",d+=B(i.content,o,p),f.length>0){d+='<div class="backlinks"><h4>Pages that link here</h4><ul>';for(let h of f){let u=a.readArticle(h);d+=`<li><a href="${p}/article/${encodeURIComponent(h)}">${c(u?.meta.title||h)}</a></li>`}d+="</ul></div>"}return d+="</article>",$(i.meta.title,C(s,`${t}/${n}`),d)}function gt(e,t){let n=t||e.summary(),a=e.getSharedStore().listEntries(),i='<nav class="breadcrumb"><a href="/">Hub</a> <span class="sep">/</span> <span class="current">Entries</span></nav>';i+='<div class="page-head"><div><h1>All raw entries</h1><p class="page-sub">Every conversation line that the ingest pipeline captured. Absorb compiles these into typed articles nightly.</p></div></div>';let s=new Map;for(let l of a){let o=s.get(l.date)||[];o.push(l),s.set(l.date,o)}for(let[l,o]of[...s].reverse()){i+=`<div class="section-head"><h2>${l}</h2><span class="mono" style="font-size:12px;color:var(--muted)">${o.length} entries</span></div>`;for(let p of o)i+=`<div class="entry-card">
|
|
729
|
+
<div class="meta-line">
|
|
730
|
+
<a href="/agent/${encodeURIComponent(p.agentId)}">${c(p.agentId)}</a>
|
|
731
|
+
\xB7 via ${c(p.source)} \xB7 <code>${c(p.id)}</code>
|
|
732
|
+
</div>
|
|
733
|
+
<p>${c(p.content.slice(0,400))}${p.content.length>400?"\u2026":""}</p>
|
|
734
|
+
</div>`}return $("All Entries",C(n),i)}function mt(e,t,n){let r=n||e.summary(),a='<nav class="breadcrumb"><a href="/">Hub</a> <span class="sep">/</span> <span class="current">Search</span></nav>';a+=`<div class="page-head"><div><h1>\u201C${c(t)}\u201D</h1><p class="page-sub">Full-text search across every agent's wiki.</p></div></div>`;let i=0,s=[];for(let l of r){let p=e.getAgentWiki(l.agentId).findRelevant(t,void 0,10);if(p.length>0){s.push(`<div class="section-head"><h2>${c(l.agentId)}</h2><span class="mono" style="font-size:12px;color:var(--muted)">${p.length} match${p.length===1?"":"es"}</span></div>`);for(let g of p){let f=`/agent/${encodeURIComponent(l.agentId)}`;s.push(`<div class="entry-card">
|
|
735
|
+
<div class="meta-line">${D((g.meta.tags||[]).slice(0,3),l.agentId)}</div>
|
|
736
|
+
<h3><a href="${f}/article/${encodeURIComponent(g.path)}">${c(g.meta.title)}</a></h3>
|
|
737
|
+
<p>${c(g.content.slice(0,240))}\u2026</p>
|
|
738
|
+
</div>`)}i+=p.length}}return a+=s.join(""),i===0&&(a+='<p style="color:var(--muted);margin-top:24px">No matching articles found.</p>'),$(`Search: ${t}`,C(r),a,t)}function ut(e,t,n){let r=n||e.summary(),a='<nav class="breadcrumb"><a href="/">Hub</a> <span class="sep">/</span> <span class="current">Tag</span></nav>';a+=`<div class="page-head"><div><h1>${c(t)}</h1><p class="page-sub">All articles tagged <span class="tag">${c(t)}</span>, across every agent.</p></div></div>`;let i=0;for(let s of r){let l;try{l=e.getAgentWiki(s.agentId)}catch{continue}let o=l.findByTags([t],void 0,100);if(o.length!==0){a+=`<div class="section-head"><h2>${c(s.agentId)}</h2><span class="mono" style="font-size:12px;color:var(--muted)">${o.length}</span></div>`;for(let p of o){let g=`/agent/${encodeURIComponent(s.agentId)}`;a+=`<div class="entry-card">
|
|
739
|
+
<div class="meta-line">${D((p.meta.tags||[]).slice(0,6),s.agentId)}</div>
|
|
740
|
+
<h3><a href="${g}/article/${encodeURIComponent(p.path)}">${c(p.meta.title)}</a></h3>
|
|
741
|
+
</div>`}i+=o.length}}return i===0&&(a+=`<p style="color:var(--muted);margin-top:24px">No articles tagged <code>${c(t)}</code>.</p>`),$(`Tag: ${t}`,C(r),a)}function ft(e,t,n,r){let a=r||e.summary(),i;try{i=e.getAgentWiki(t)}catch{return $(`Tag: ${n}`,C(a),`<h1>Agent not found: ${c(t)}</h1>`)}let s=i.findByTags([n],void 0,100),l=`/agent/${encodeURIComponent(t)}`,o=`<nav class="breadcrumb"><a href="/">Hub</a> <span class="sep">/</span> <a href="${l}">${c(t)}</a> <span class="sep">/</span> <span class="current">${c(n)}</span></nav>`;o+=`<div class="page-head"><div><h1>${c(n)}</h1><p class="page-sub">${s.length} article${s.length===1?"":"s"} tagged <code>${c(n)}</code> in <b>${c(t)}</b>.</p></div></div>`;for(let p of s)o+=`<div class="entry-card">
|
|
742
|
+
<div class="meta-line">${D((p.meta.tags||[]).slice(0,6),t)}</div>
|
|
743
|
+
<h3><a href="${l}/article/${encodeURIComponent(p.path)}">${c(p.meta.title)}</a></h3>
|
|
744
|
+
</div>`;return $(`${t} \xB7 ${n}`,C(a),o)}function _(e,t,n){let r=e.rebuildIndex(),a=V(r.articles.map(s=>({title:s.title,path:s.path,tags:s.tags}))),i='<div class="nav-section">';i+=`<div class="nav-section-title">${c(t)}</div>`,i+=`<a class="nav-item${n?"":" active"}" href="/">Home</a>`,i+='<a class="nav-item" href="/lint">Health check</a>',i+="</div>";for(let[s,l]of a){i+='<div class="nav-section">',i+=`<div class="nav-section-title">${Q(s)}</div>`;for(let o of l){let p=o.path===n;i+=`<a class="nav-item${p?" active":""}" href="/article/${encodeURIComponent(o.path)}">${c(o.title)}</a>`}i+="</div>"}return i}function ht(e){let{wikiDir:t,agentFilter:n,peerUrls:r=[],mode:a="graph",pathPrefix:i=""}=e,s=i.replace(/\/+$/,""),l=new ne(t,void 0,a),o=r.length>0?new W(r):null;return async(p,g)=>{let f=new URL(p.url||"/","http://localhost"),d=decodeURIComponent(f.pathname),h=s&&d.startsWith(s)?d.slice(s.length)||"/":d,u=null,A=200;try{if(h.startsWith("/remote/")&&o){let x=h.slice(8).split("/article/");if(x.length===2){let[y,v]=x,m=y.indexOf("/"),k=decodeURIComponent(y.slice(0,m)),b=y.slice(m+1),w=await o.getRemoteArticle(k,b,v);if(w){let R=await o.getRemoteAgents(),N=[...l.summary(),...R.map(I=>({...I,agentId:`${I.agentId} @${I.nodeId}`}))],S=`<div class="breadcrumb"><a href="/">Hub</a> / <span class="tag">remote</span> ${c(b)} @ ${c(k)}</div>`;S+=`<h1>${c(w.meta.title)}</h1>`,S+='<dl class="meta">',S+=`<dt>Tags</dt><dd>${(w.meta.tags||[]).map(I=>`<span class="tag">${I}</span>`).join(" ")}</dd>`,S+=`<dt>Owner</dt><dd>${c(w.meta.owner)}</dd>`,S+=`<dt>Source</dt><dd><span class="tag">remote</span> ${c(k)}</dd>`,S+=`<dt>Updated</dt><dd>${w.meta.lastUpdated}</dd>`,S+="</dl>";let T=new Map;S+=B(w.content,T),u=$(w.meta.title,C(N),S)}}}if(!u&&n){let x=l.getAgentWiki(n);if(h==="/"||h===""){let y=x.rebuildIndex(),v=l.getAgentEntries(n),m=`<h1>${c(n)}</h1>`;if(m+='<div class="stats">',m+=`<div class="stat-card"><div class="number">${y.articles.length}</div><div class="label">Articles</div></div>`,m+=`<div class="stat-card"><div class="number">${v.length}</div><div class="label">Entries</div></div>`,m+="</div>",y.articles.length>0){m+="<h2>Articles</h2><table><tr><th>Title</th><th>Type</th><th>Updated</th></tr>";for(let k of y.articles)m+=`<tr><td><a href="/article/${encodeURIComponent(k.path)}">${c(k.title)}</a></td><td><span class="tag">${(k.tags||[]).slice(0,3).join(", ")}</span></td><td>${k.lastUpdated||""}</td></tr>`;m+="</table>"}u=$(n,_(x,n),m)}else if(h.startsWith("/article/")){let y=h.slice(9),v=x.readArticle(y);if(v){let m=x.rebuildIndex(),k=new Map;for(let w of m.articles)k.set(w.title,w.path);let b=`<h1>${c(v.meta.title)}</h1>`;b+='<dl class="meta">',b+=`<dt>Tags</dt><dd>${(v.meta.tags||[]).map(w=>`<span class="tag">${w}</span>`).join(" ")}</dd>`,b+=`<dt>Updated</dt><dd>${v.meta.lastUpdated}</dd>`,v.meta.sources?.length&&(b+=`<dt>Sources</dt><dd>${v.meta.sources.length} entries</dd>`),b+="</dl>",b+=B(v.content,k),u=$(v.meta.title,_(x,n,y),b)}}else if(h==="/lint"){let y=x.lint(),v="<h1>Health Check</h1>";if(y.length===0)v+='<p style="color:green;">No issues.</p>';else{v+="<table><tr><th>Type</th><th>Article</th><th>Issue</th></tr>";for(let m of y)v+=`<tr><td><span class="tag">${m.type}</span></td><td>${c(m.article)}</td><td>${c(m.message)}</td></tr>`;v+="</table>"}u=$("Health Check",_(x,n),v)}else if(h==="/search"){let y=f.searchParams.get("q")||"",v=await x.findRelevantReranked(y,void 0,20),m=`<h1>Search: "${c(y)}"</h1>`;for(let k of v)m+=`<div class="entry-card"><h3><a href="/article/${encodeURIComponent(k.path)}">${c(k.meta.title)}</a></h3><p>${c(k.content.slice(0,200))}...</p></div>`;v.length===0&&(m+="<p>No results.</p>"),u=$(`Search: ${y}`,_(x,n),m)}else if(h.startsWith("/tag/")){let y=decodeURIComponent(h.slice(5)),v=x.findByTags([y],void 0,100),m=`<h1>Tag: <a class="tag" href="#">${c(y)}</a></h1>`;m+=`<p>${v.length} article${v.length===1?"":"s"} tagged <code>${c(y)}</code></p>`;for(let k of v)m+=`<div class="entry-card"><h3><a href="/article/${encodeURIComponent(k.path)}">${c(k.meta.title)}</a></h3><div class="meta-line">${D((k.meta.tags||[]).slice(0,6))}</div></div>`;v.length===0&&(m+="<p>No articles with this tag.</p>"),u=$(`Tag: ${y}`,_(x,n),m)}}else{let x=o?await o.getRemoteAgents():[],y=l.summary(),v=new Map(y.map(b=>[b.agentId,b])),m=[],k=new Set;for(let b of y){let w=x.find(R=>R.agentId===b.agentId);w&&w.totalArticles>b.totalArticles?m.push({...w,totalEntries:Math.max(b.totalEntries,w.totalEntries),unabsorbed:Math.max(b.unabsorbed,w.unabsorbed)}):m.push(b),k.add(b.agentId)}for(let b of x)k.has(b.agentId)||(m.push(b),k.add(b.agentId));if(h==="/"||h==="")u=lt(l,m,x);else if(h==="/entries")u=gt(l,m);else if(h==="/search")u=mt(l,f.searchParams.get("q")||"",m);else if(h.startsWith("/tag/"))u=ut(l,decodeURIComponent(h.slice(5)),m);else if(h.match(/^\/agent\/[^/]+\/tag\/.+/)){let b=h.match(/^\/agent\/([^/]+)\/tag\/(.+)$/);u=ft(l,decodeURIComponent(b[1]),decodeURIComponent(b[2]),m)}else if(h.startsWith("/agent/")){let b=h.slice(7),w=b.indexOf("/article/");if(w===-1)u=ct(l,b,m);else{let R=b.slice(0,w),N=b.slice(w+9);if(u=pt(l,R,N,m),!u&&o){let S=x.find(T=>T.agentId===R);if(S){let T=await o.getRemoteArticle(S.peerUrl,R,N);if(T){let I=`<div class="breadcrumb"><a href="/">Hub</a> / <span class="tag">remote @ ${c(S.nodeId)}</span> / ${c(R)}</div>`;I+=`<h1>${c(T.meta.title)}</h1>`,I+='<dl class="meta">',I+=`<dt>Tags</dt><dd>${(T.meta.tags||[]).map(Ne=>`<span class="tag">${Ne}</span>`).join(" ")}</dd>`,I+=`<dt>Source</dt><dd><span class="tag">remote</span> ${c(S.nodeId)}</dd>`,I+=`<dt>Updated</dt><dd>${T.meta.lastUpdated}</dd>`,I+="</dl>",I+=B(T.content,new Map),u=$(T.meta.title,C(m),I)}}}}}}if(!u){A=404;let x=n?_(l.getAgentWiki(n),n):C(l.summary());u=$("Not Found",x,"<h1>Page not found</h1>")}}catch(x){A=500,u=$("Error","",`<h1>Error</h1><pre>${c(x.message)}</pre>`)}g.writeHead(A,{"Content-Type":"text/html; charset=utf-8"}),g.end(s?vt(u,s):u)}}function vt(e,t){e=e.replace(/(\s(?:href|action)=")\/(?!\/)/g,`$1${t}/`),e=e.replace(new RegExp(`(${t})${t}/`,"g"),`${t}/`);let n=`<a href="/admin" style="position:fixed;top:10px;right:14px;z-index:9999;padding:5px 11px;background:rgba(0,0,0,0.55);color:#fff;font:12px/1.2 'IBM Plex Sans',system-ui,sans-serif;text-decoration:none;border-radius:6px;border:1px solid rgba(255,255,255,0.18);backdrop-filter:blur(6px)">\u2190 Dashboard</a>`;return e=e.replace(/<body([^>]*)>/,`<body$1>${n}`),e}function fn(e,t=4200,n,r=[],a="graph"){let i=ht({wikiDir:e,agentFilter:n,peerUrls:r,mode:a});at((l,o)=>{i(l,o)}).listen(t)}Oe();function bn(e,t,n=20){return e.prepare(`SELECT task_id, agent_id, channel, chat_id, status, started_at, message_preview
|
|
745
|
+
FROM task_traces
|
|
746
|
+
WHERE person = ? AND (channel IS NULL OR channel != 'a2a')
|
|
747
|
+
ORDER BY started_at DESC LIMIT ?`).all(t,Math.max(1,Math.min(n,500))).map(a=>({taskId:a.task_id,agentId:a.agent_id,channel:a.channel,chatId:a.chat_id,status:a.status,startedAt:a.started_at,messagePreview:a.message_preview}))}function xn(e,t){return e.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'requests'").get()?e.prepare("PRAGMA table_info(requests)").all().some(i=>i.name==="person")?e.prepare(`SELECT id, state, channel, agent_id, text, created_at FROM requests
|
|
748
|
+
WHERE person = ? AND state IN (${F.map(()=>"?").join(",")})
|
|
749
|
+
ORDER BY created_at`).all(t,...F).map(i=>({id:i.id,state:i.state,channel:i.channel,agentId:i.agent_id,text:i.text,createdAt:i.created_at})):[]:[]}Ue();var Z="member:",bt=90,xt="members",yt="tailscale-user-login",kt=400,wt=60*60*1e3;function $t(e){let t=e.scopes.find(n=>n.startsWith(Z));return t?t.slice(Z.length):null}function Pe(e,t){if(!e)return null;let n=t.verify(e),r=n?$t(n):null;return n&&r?{rec:n,personId:r}:null}function Sn(e,t){let n=e.people().find(l=>l.id===t);if(!n)return{ok:!1,error:`No person "${t}". Add them first: agentx people add ${t} --name "\u2026"`};let{token:r,record:a}=e.tokens.create({name:`${n.name} (machine not paired yet)`,scopes:[`${Z}${n.id}`],expiresInDays:bt}),{code:i,expiresAt:s}=e.codes.create({token:r,tokenId:a.id,name:n.id});return e.members.log({person:n.id,device:a.id,event:"invited"}),{ok:!0,code:i,expiresAt:s,tokenId:a.id,person:n}}var At="The private network says someone else is connecting from this machine. Ask the owner for a new code.",St="Too many machines are waiting for the owner's answer. Try again later.",De=(e,t)=>{let n=e.headers[t];return(Array.isArray(n)?n[0]:n||"").trim()};function _e(e){let t=e.socket?.remoteAddress||"";return t==="127.0.0.1"||t==="::1"||t==="::ffff:127.0.0.1"}function It(e){if(!_e(e))return null;let t=De(e,yt).toLowerCase();return t?t.slice(0,80):null}function Et(e){let t=e.socket?.remoteAddress||"unknown";if(!_e(e))return t;let n=De(e,"x-forwarded-for").split(",")[0].trim();return/^[0-9a-fA-F:.]{2,45}$/.test(n)?n:t}function Ct(e){return typeof e=="string"?e.replace(/[^\p{L}\p{N} ._'()-]/gu," ").replace(/\s+/g," ").trim().slice(0,60):""}function Tt(e){return e.identities.map(ee).filter(t=>!!t&&t.channel==="tailscale").map(t=>t.value)}async function In(e,t){let n=Date.now(),r=t.now??Date.now,a=t.log??(m=>console.log(m)),i=Et(e),s=t.limiter.retryAfter(i);if(s>0)return a(`[member] pair-code refused from ${i}: locked out for ${s}s more`),{status:429,body:{error:"too many attempts",retryAfter:s},retryAfter:s};let l=null,o="";try{let m=await se(e,2048);l=m.code,o=Ct(m.machine)}catch{}let p=t.codes.redeem(l),g=p?Pe(p.token,t.tokens):null;if(await Pt(n,t.minMs??kt),!p||!g)return t.limiter.fail(i),a(`[member] pair-code failed from ${i}`),{status:401,body:{error:q}};t.limiter.succeed(i);let{rec:f,personId:d}=g,h=t.people().find(m=>m.id===d);if(!h)return t.tokens.revoke(f.id),t.members.log({person:d,device:f.id,event:"refused",address:i,detail:"person no longer listed"}),a(`[member] pair-code for ${d} refused from ${i}: person no longer listed`),{status:403,body:{error:q}};let u=It(e),A=Tt(h);if(A.length&&(!u||!A.includes(u)))return t.tokens.revoke(f.id),t.members.log({person:d,device:f.id,event:"refused",address:i,detail:`network login ${u??"missing"}; expected ${A.join(" or ")}`}),a(`[member] ${d}: pairing from ${i} refused: the network says "${u??"nobody"}", expected ${A.join(" or ")}`),{status:403,body:{error:At}};let x=o||"Unnamed machine",y=h.name.slice(0,40),v=oe(t.root,{title:`New machine for ${y}`,ask:`From ${i}, ${u?`network login ${u}`:"no network login reported"}. Machine name, as typed there: "${x}". Let it see ${y}'s own work?`,recommend:`Yes if ${y} told you they just paired this machine. No if you did not expect it.`,if_silent:"discard",raised_by:xt},{now:r()});return v.ok?(t.members.add({tokenId:f.id,personId:d,name:x,state:"pending",cardId:v.card.id,address:i,...u?{network:u}:{},createdAt:new Date(r()).toISOString()}),t.members.log({person:d,device:f.id,event:"paired",address:i,detail:x}),a(`[member] ${d} paired "${x}" from ${i}; waiting for the owner (card ${v.card.id})`),{status:200,body:{person:d,name:x,state:"pending"},token:p.token}):(t.tokens.revoke(f.id),t.members.log({person:d,device:f.id,event:"refused",address:i,detail:v.error}),a(`[member] ${d}: pairing from ${i} refused: ${v.error}`),{status:503,body:{error:St}})}var H="this machine is not paired",Rt="waiting for the owner to approve this machine";function En(e,t,n){let r=t.now??Date.now,a=t.log??(g=>console.log(g)),i=Pe(e,t.tokens);if(!i)return{ok:!1,status:401,error:H};let{rec:s,personId:l}=i,o=t.members.byToken(s.id);if(!o||o.state==="removed"||o.personId!==l)return{ok:!1,status:401,error:H};if(t.people&&!t.people().some(g=>g.id===l))return ze(t,s.id,"person no longer listed"),a(`[member] ${l}: "${o.name}" ended: person no longer listed`),{ok:!1,status:401,error:H};if(o.state==="pending"){let g=o.cardId?ie(t.root,o.cardId):null,f=g?g.status==="decided"?g.verdict:g.status==="expired"?"no":null:null;if(f==="yes")o=t.members.update(s.id,{state:"active",approvedAt:new Date(r()).toISOString()})??o,t.members.log({person:l,device:s.id,event:"approved",detail:g?.decided_by}),a(`[member] ${l}: "${o.name}" approved`);else if(f==="no"){let d=g?.status==="expired"?"the owner did not answer in time":"the owner said no";return t.tokens.revoke(s.id),t.members.update(s.id,{state:"removed",removedAt:new Date(r()).toISOString(),removedReason:d}),t.members.log({person:l,device:s.id,event:"refused",detail:d}),a(`[member] ${l}: "${o.name}" refused: ${d}`),{ok:!1,status:401,error:H}}else return{ok:!1,status:403,error:Rt,waiting:!0}}let p=o.lastSeenAt?Date.parse(o.lastSeenAt):0;return n&&(r()-p>=wt||o.lastAddress!==n)&&(o=t.members.update(s.id,{lastSeenAt:new Date(r()).toISOString(),lastAddress:n})??o,t.members.log({person:l,device:s.id,event:"signed-in",address:n})),{ok:!0,device:o,personId:l,rec:s}}function ze(e,t,n="removed by the owner"){let r=e.members.byToken(t);if(!r)return null;e.tokens.revoke(t);let a=e.members.update(t,{state:"removed",removedAt:new Date((e.now??Date.now)()).toISOString(),removedReason:n});return e.members.log({person:r.personId,device:t,event:"removed",detail:n}),a}function Cn(e,t){return e.members.devices(t).filter(n=>n.state!=="removed").map(n=>ze(e,n.tokenId,"person removed by the owner")).filter(n=>!!n)}async function Pt(e,t){let n=e+t-Date.now();n>0&&await new Promise(r=>setTimeout(r,n))}var Me=["gitlab","github"];function Dt(e,t,n){let r=String(t||"").trim().toLowerCase();if(!Me.includes(r))throw new Error(`Request status works on ${Me.join(" and ")}, not on "${t}".`);e.requestStatus=e.requestStatus&&typeof e.requestStatus=="object"?e.requestStatus:{};let a=Array.isArray(e.requestStatus.channels)?e.requestStatus.channels.map(i=>String(i).toLowerCase()):[];return e.requestStatus.channels=n?[...new Set([...a,r])]:a.filter(i=>i!==r),`request status on ${r} is ${n?"on":"off"}`}function Pn(e){return Array.isArray(e?.requestStatus?.channels)?e.requestStatus.channels.map(t=>String(t).toLowerCase()):[]}function Dn(e){let{summary:t}=U(n=>Dt(n,e?.channel,!!e?.enabled));return{summary:t}}var _t="https://ntfy.sh";function zn(e){return{enabled:!!e?.enabled,server:e?.server||_t,topicSet:!!e?.topic,tokenSet:!!e?.token}}function Mn(e,t){let n={...e??{}};if("enabled"in t&&(n.enabled=!!t.enabled),"server"in t){let r=String(t.server).trim().replace(/\/+$/,"");if(!/^https?:\/\/\S+$/.test(r))throw new Error("ntfy server must be an http(s) URL");n.server=r}if("topic"in t){let r=String(t.topic).trim();if(!r)throw new Error("ntfy topic cannot be empty");n.topic=r}if("token"in t){let r=String(t.token??"").trim();r?n.token=r:delete n.token}if(n.enabled&&!n.topic)throw new Error("set a topic before enabling ntfy");return n}export{U as a,xe as b,Yt as c,Gt as d,Xt as e,tn as f,nn as g,rn as h,bn as i,xn as j,Te as k,bt as l,Sn as m,Et as n,In as o,En as p,ze as q,Cn as r,Me as s,Dt as t,Pn as u,Dn as v,zn as w,Mn as x,ht as y,fn as z};
|
|
750
|
+
//# sourceMappingURL=chunk-EBDUPZ7C.js.map
|