agentix-cli 0.53.0 → 0.54.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-R62ZQVSF.js → App-VRTLAPRF.js} +2 -2
- package/dist/{ChatApp-AS567EFE.js → ChatApp-YENWPZT4.js} +2 -2
- package/dist/{agent-H4NB4BUA.js → agent-HVUGHYBF.js} +2 -2
- package/dist/{board-dashboard-E3MUVNVQ.js → board-dashboard-3XJVYDB3.js} +416 -180
- package/dist/board-dashboard-3XJVYDB3.js.map +1 -0
- package/dist/chunk-2D3RYIDU.js +3 -0
- package/dist/chunk-2D3RYIDU.js.map +1 -0
- package/dist/{chunk-CCMM5TP4.js → chunk-2TJYZF4E.js} +2 -2
- package/dist/{chunk-FSZXY53Z.js → chunk-33QV5O6P.js} +2 -2
- package/dist/{chunk-NF52Q3TV.js → chunk-37EABIOJ.js} +2 -2
- package/dist/chunk-3RCFUIYR.js +29 -0
- package/dist/chunk-3RCFUIYR.js.map +1 -0
- package/dist/{chunk-6OOK7Y4S.js → chunk-3W2KMI5O.js} +2 -2
- package/dist/{chunk-47EEUZBK.js → chunk-4FFWNPFX.js} +4 -4
- package/dist/chunk-4FFWNPFX.js.map +1 -0
- package/dist/{chunk-FS4WBYY3.js → chunk-4HNHHKJF.js} +2 -2
- package/dist/{chunk-SABOPOYX.js → chunk-6JHA3ZE6.js} +139 -139
- package/dist/chunk-6JHA3ZE6.js.map +1 -0
- package/dist/{chunk-QU6ZUKAD.js → chunk-BKDUCPZ3.js} +2 -2
- package/dist/{chunk-IDYP7G7Z.js → chunk-BMSPRUEJ.js} +33 -33
- package/dist/{chunk-IDYP7G7Z.js.map → chunk-BMSPRUEJ.js.map} +1 -1
- package/dist/{chunk-TH5KNJLA.js → chunk-ENRJ2QEH.js} +2 -2
- package/dist/{chunk-C5JXPMTW.js → chunk-HQMISQ7L.js} +2 -2
- package/dist/{chunk-7DPKPBRJ.js → chunk-KLDGJSR5.js} +2 -2
- package/dist/{ntfy-ZY2NPGBA.js → chunk-KZKDVIOE.js} +3 -3
- package/dist/chunk-KZKDVIOE.js.map +1 -0
- package/dist/{chunk-KB7YIM3W.js → chunk-M67AN4J7.js} +2 -2
- package/dist/{chunk-WKTFP3SK.js → chunk-NO2HOK4B.js} +2 -2
- package/dist/chunk-QD6IICK7.js +2 -0
- package/dist/chunk-QD6IICK7.js.map +1 -0
- package/dist/{chunk-OV35MJKS.js → chunk-QX4R5WY7.js} +2 -2
- package/dist/{chunk-PGJL5V6Y.js → chunk-QYHABRLM.js} +2 -2
- package/dist/{chunk-7OWXFLAM.js → chunk-TLFJVLVQ.js} +166 -160
- package/dist/chunk-TLFJVLVQ.js.map +1 -0
- package/dist/{chunk-OMTRHHZJ.js → chunk-UYMK3XNB.js} +44 -45
- package/dist/chunk-UYMK3XNB.js.map +1 -0
- package/dist/{chunk-VD4TMPJI.js → chunk-WLRHL2P7.js} +2 -2
- package/dist/chunk-WWMFNLKD.js +10 -0
- package/dist/chunk-WWMFNLKD.js.map +1 -0
- package/dist/{chunk-KJWBQZT7.js → chunk-XWU7O3S5.js} +2 -2
- package/dist/{chunk-KFG6WWFS.js → chunk-ZOJUHPD5.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/client-N4XQEAVL.js +2 -0
- package/dist/{compaction-NWPBPWY2.js → compaction-H5U32UU6.js} +2 -2
- package/dist/{config-3SW4V44Z.js → config-KHKIY6LI.js} +2 -2
- package/dist/config-mutator-ZZKFQ7HJ.js +2 -0
- package/dist/doctor-QICAXIQB.js +2 -0
- package/dist/index.d.ts +88 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/memory-extract-F76BE6KA.js +2 -0
- package/dist/ntfy-52EXHVMD.js +2 -0
- package/dist/program-ZWNGK3RB.js +2 -0
- package/dist/{promote-DJFMTLRC.js → promote-H6ZHJXTY.js} +2 -2
- package/dist/push-HEDA6P3B.js +2 -0
- package/dist/push-HEDA6P3B.js.map +1 -0
- package/dist/push-keys-2DTD7YNQ.js +2 -0
- package/dist/push-store-LXTYULUF.js +2 -0
- package/dist/query-FTE4FLYK.js +2 -0
- package/dist/registry-HDOFVNRK.js +2 -0
- package/dist/{request-planner-2H7HCUCZ.js → request-planner-ABD4WIGM.js} +2 -2
- package/dist/{review-candidates-U7R64OCS.js → review-candidates-B6574GOJ.js} +2 -2
- package/dist/{routing-LVQH6WOJ.js → routing-BGKZOHOA.js} +2 -2
- package/dist/schedule-tool-UDHXTKWV.js +2 -0
- package/dist/scheduler-NQM3HVUY.js +2 -0
- package/dist/scheduler-NQM3HVUY.js.map +1 -0
- package/dist/{seat-2KGFNCIW.js → seat-VGST5AQB.js} +2 -2
- package/dist/seat-VGST5AQB.js.map +1 -0
- package/dist/{select-XGK27RPP.js → select-Y7SBUCGJ.js} +2 -2
- package/dist/{set-enabled-7YGN2FAZ.js → set-enabled-ARKMDLXN.js} +2 -2
- package/dist/{tool-HKDIZ6I4.js → tool-5EVYUN2G.js} +2 -2
- package/dist/wiki-GREI2TSP.js +2 -0
- package/dist/wiki-GREI2TSP.js.map +1 -0
- package/package.json +3 -1
- package/dist/board-dashboard-E3MUVNVQ.js.map +0 -1
- package/dist/chunk-47EEUZBK.js.map +0 -1
- package/dist/chunk-7OWXFLAM.js.map +0 -1
- package/dist/chunk-D4HAR3L3.js +0 -28
- package/dist/chunk-D4HAR3L3.js.map +0 -1
- package/dist/chunk-HRBKSZ34.js +0 -2
- package/dist/chunk-HRBKSZ34.js.map +0 -1
- package/dist/chunk-OMTRHHZJ.js.map +0 -1
- package/dist/chunk-SABOPOYX.js.map +0 -1
- package/dist/client-XTQDYMOX.js +0 -2
- package/dist/config-mutator-H32FXUYJ.js +0 -2
- package/dist/doctor-J6RCHFVE.js +0 -2
- package/dist/memory-extract-MGGXIZTE.js +0 -2
- package/dist/ntfy-ZY2NPGBA.js.map +0 -1
- package/dist/program-SQTOPCQW.js +0 -2
- package/dist/query-UAZUMU4N.js +0 -2
- package/dist/registry-4OUBA2TY.js +0 -2
- package/dist/schedule-tool-2BONJVCJ.js +0 -2
- package/dist/scheduler-7CEXDECA.js +0 -2
- package/dist/wiki-6YT7B5HU.js +0 -2
- /package/dist/{App-R62ZQVSF.js.map → App-VRTLAPRF.js.map} +0 -0
- /package/dist/{ChatApp-AS567EFE.js.map → ChatApp-YENWPZT4.js.map} +0 -0
- /package/dist/{agent-H4NB4BUA.js.map → agent-HVUGHYBF.js.map} +0 -0
- /package/dist/{chunk-CCMM5TP4.js.map → chunk-2TJYZF4E.js.map} +0 -0
- /package/dist/{chunk-FSZXY53Z.js.map → chunk-33QV5O6P.js.map} +0 -0
- /package/dist/{chunk-NF52Q3TV.js.map → chunk-37EABIOJ.js.map} +0 -0
- /package/dist/{chunk-6OOK7Y4S.js.map → chunk-3W2KMI5O.js.map} +0 -0
- /package/dist/{chunk-FS4WBYY3.js.map → chunk-4HNHHKJF.js.map} +0 -0
- /package/dist/{chunk-QU6ZUKAD.js.map → chunk-BKDUCPZ3.js.map} +0 -0
- /package/dist/{chunk-TH5KNJLA.js.map → chunk-ENRJ2QEH.js.map} +0 -0
- /package/dist/{chunk-C5JXPMTW.js.map → chunk-HQMISQ7L.js.map} +0 -0
- /package/dist/{chunk-7DPKPBRJ.js.map → chunk-KLDGJSR5.js.map} +0 -0
- /package/dist/{chunk-KB7YIM3W.js.map → chunk-M67AN4J7.js.map} +0 -0
- /package/dist/{chunk-WKTFP3SK.js.map → chunk-NO2HOK4B.js.map} +0 -0
- /package/dist/{chunk-OV35MJKS.js.map → chunk-QX4R5WY7.js.map} +0 -0
- /package/dist/{chunk-PGJL5V6Y.js.map → chunk-QYHABRLM.js.map} +0 -0
- /package/dist/{chunk-VD4TMPJI.js.map → chunk-WLRHL2P7.js.map} +0 -0
- /package/dist/{chunk-KJWBQZT7.js.map → chunk-XWU7O3S5.js.map} +0 -0
- /package/dist/{chunk-KFG6WWFS.js.map → chunk-ZOJUHPD5.js.map} +0 -0
- /package/dist/{client-XTQDYMOX.js.map → client-N4XQEAVL.js.map} +0 -0
- /package/dist/{compaction-NWPBPWY2.js.map → compaction-H5U32UU6.js.map} +0 -0
- /package/dist/{config-3SW4V44Z.js.map → config-KHKIY6LI.js.map} +0 -0
- /package/dist/{config-mutator-H32FXUYJ.js.map → config-mutator-ZZKFQ7HJ.js.map} +0 -0
- /package/dist/{doctor-J6RCHFVE.js.map → doctor-QICAXIQB.js.map} +0 -0
- /package/dist/{memory-extract-MGGXIZTE.js.map → memory-extract-F76BE6KA.js.map} +0 -0
- /package/dist/{program-SQTOPCQW.js.map → ntfy-52EXHVMD.js.map} +0 -0
- /package/dist/{promote-DJFMTLRC.js.map → program-ZWNGK3RB.js.map} +0 -0
- /package/dist/{query-UAZUMU4N.js.map → promote-H6ZHJXTY.js.map} +0 -0
- /package/dist/{registry-4OUBA2TY.js.map → push-keys-2DTD7YNQ.js.map} +0 -0
- /package/dist/{routing-LVQH6WOJ.js.map → push-store-LXTYULUF.js.map} +0 -0
- /package/dist/{schedule-tool-2BONJVCJ.js.map → query-FTE4FLYK.js.map} +0 -0
- /package/dist/{scheduler-7CEXDECA.js.map → registry-HDOFVNRK.js.map} +0 -0
- /package/dist/{request-planner-2H7HCUCZ.js.map → request-planner-ABD4WIGM.js.map} +0 -0
- /package/dist/{review-candidates-U7R64OCS.js.map → review-candidates-B6574GOJ.js.map} +0 -0
- /package/dist/{seat-2KGFNCIW.js.map → routing-BGKZOHOA.js.map} +0 -0
- /package/dist/{wiki-6YT7B5HU.js.map → schedule-tool-UDHXTKWV.js.map} +0 -0
- /package/dist/{select-XGK27RPP.js.map → select-Y7SBUCGJ.js.map} +0 -0
- /package/dist/{set-enabled-7YGN2FAZ.js.map → set-enabled-ARKMDLXN.js.map} +0 -0
- /package/dist/{tool-HKDIZ6I4.js.map → tool-5EVYUN2G.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{c as
|
|
2
|
-
`,p=n+".tmp";L(p,
|
|
3
|
-
`,"utf-8"),{file:n}}async function
|
|
1
|
+
import{c as V,d as Q,e as Z,f as F,g as I,h as j,i as W}from"./chunk-KAFO5QZR.js";import{a as X,b as G}from"./chunk-4HNHHKJF.js";import{a as Y}from"./chunk-WLRHL2P7.js";import{j as D,l as K,m as _,p as M}from"./chunk-4FFWNPFX.js";import{existsSync as N,readFileSync as se,writeFileSync as le,appendFileSync as be,mkdirSync as ye}from"fs";import{dirname as ke,resolve as P}from"path";import{fileURLToPath as we}from"url";import{hostname as $e}from"os";import{spawn as Ae}from"child_process";M();import{existsSync as te,readFileSync as ee,writeFileSync as L,copyFileSync as he}from"fs";import{resolve as ne}from"path";function ae(e,t={}){let n=t.configPath||ne(process.cwd(),"agentx.json");if(!te(n))throw new Error(`agentx.json not found at ${n}`);let a=JSON.parse(ee(n,"utf-8")),r=e(a),i=typeof r=="string"?{summary:r}:r,c=JSON.stringify(a,null,2)+`
|
|
2
|
+
`,p=n+".tmp";L(p,c,"utf-8");try{JSON.parse(ee(p,"utf-8"))}catch(d){throw new Error(`config did not round-trip cleanly: ${d.message}`)}let o;return t.skipBackup||(o=`${n}.bak.${Date.now()}`,he(n,o)),L(n,c,"utf-8"),t.skipReload||fe().catch(()=>{}),{summary:i.summary,payload:i.payload,backupPath:o}}function re(e,t={}){let n=t.configPath||ne(process.cwd(),"agentx.json");if(te(n)&&!t.overwrite)throw new Error(`agentx.json already exists at ${n}. Pass overwrite=true to replace it.`);return L(n,JSON.stringify(e,null,2)+`
|
|
3
|
+
`,"utf-8"),{file:n}}async function fe(){try{let t=_().dashboard.daemonUrl?.replace(/\/+$/,"")||"http://127.0.0.1:18800";await fetch(`${t}/reload`,{method:"POST"}).catch(()=>null)}catch{}}function ie(e,t){let n=e.configExists?e.agentCount===0?"Add your first agent":"Add another agent":"Set up your team",a=`<header class="ax-topbar">
|
|
4
4
|
<div class="ax-topbar__left">
|
|
5
5
|
<div class="ax-brand">
|
|
6
6
|
<span class="ax-brand__mark">AX</span>
|
|
@@ -16,7 +16,7 @@ import{c as Q,d as Z,e as ee,f as F,g as I,h as j,i as W}from"./chunk-KAFO5QZR.j
|
|
|
16
16
|
<button data-theme-opt="light">Light</button>
|
|
17
17
|
</div>
|
|
18
18
|
</div>
|
|
19
|
-
</header>`,r=W(1,"Team basics",I({name:"nodeName",label:"Team name",hint:"(what you'd call this AgentX install)",value:t,placeholder:"My Team",required:!0})),i=W(2,"First agent",j([I({name:"agentName",label:"Agent name",value:"Assistant",placeholder:"Support Bot",required:!0}),I({name:"agentId",label:"Agent id",hint:"(lowercase, no spaces)",value:"assistant",pattern:"[a-z0-9][a-z0-9_-]*",required:!0})])+I({name:"triggerWords",label:"Trigger words",hint:"(comma or space separated \u2014 e.g. <code>@support, support</code>)",value:"@assistant, assistant",required:!0})+j([I({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)"}]}),I({name:"model",label:"Model",hint:"(optional)",value:"claude-sonnet-4-6",placeholder:"claude-sonnet-4-6"})])+I({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."})),
|
|
19
|
+
</header>`,r=W(1,"Team basics",I({name:"nodeName",label:"Team name",hint:"(what you'd call this AgentX install)",value:t,placeholder:"My Team",required:!0})),i=W(2,"First agent",j([I({name:"agentName",label:"Agent name",value:"Assistant",placeholder:"Support Bot",required:!0}),I({name:"agentId",label:"Agent id",hint:"(lowercase, no spaces)",value:"assistant",pattern:"[a-z0-9][a-z0-9_-]*",required:!0})])+I({name:"triggerWords",label:"Trigger words",hint:"(comma or space separated \u2014 e.g. <code>@support, support</code>)",value:"@assistant, assistant",required:!0})+j([I({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)"}]}),I({name:"model",label:"Model",hint:"(optional)",value:"claude-sonnet-4-6",placeholder:"claude-sonnet-4-6"})])+I({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."})),c=W(3,"First channel",`
|
|
20
20
|
<label class="ax-toggle"><input type="checkbox" id="enableTelegram" /> Connect Telegram now</label>
|
|
21
21
|
<div class="ax-optional" id="telegramFields">
|
|
22
22
|
${I({name:"telegramAccountId",label:"Account id",hint:"(a label you choose \u2014 e.g. <code>support</code>)",value:"default"})}
|
|
@@ -25,25 +25,25 @@ import{c as Q,d as Z,e as ee,f as F,g as I,h as j,i as W}from"./chunk-KAFO5QZR.j
|
|
|
25
25
|
</div>
|
|
26
26
|
`),p=W(4,"Anthropic API key",I({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
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>`),
|
|
29
|
-
<h1 class="ax-wizard__h1">${
|
|
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>`:"",d=`<div class="ax-wizard">
|
|
29
|
+
<h1 class="ax-wizard__h1">${Z(n)}</h1>
|
|
30
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
31
|
|
|
32
|
-
${
|
|
32
|
+
${o}
|
|
33
33
|
|
|
34
34
|
<div id="msg" class="ax-msg"></div>
|
|
35
35
|
|
|
36
36
|
<form id="wizard" autocomplete="off">
|
|
37
37
|
${r}
|
|
38
38
|
${i}
|
|
39
|
-
${
|
|
39
|
+
${c}
|
|
40
40
|
${p}
|
|
41
41
|
<footer class="ax-actions">
|
|
42
42
|
${F("Save and continue",{type:"submit",primary:!0,id:"submitBtn"})}
|
|
43
43
|
${F("Skip, I'll do it later",{onclick:"window.location.href='/live'"})}
|
|
44
44
|
</footer>
|
|
45
45
|
</form>
|
|
46
|
-
</div>`;return
|
|
46
|
+
</div>`;return Q({title:"AgentX \u2014 Setup",activeTab:"custom",subtitle:"Setup",customHeader:a,noMain:!0,body:d,css:ve,scripts:xe})}var ve=`
|
|
47
47
|
/* Pre-dashboard topbar variant \u2014 no tab nav, the pills are the only chrome. */
|
|
48
48
|
.ax-topbar__right a.ax-skip {
|
|
49
49
|
padding: 4px 10px; border: 1px solid var(--ax-border-2); border-radius: 4px;
|
|
@@ -100,7 +100,7 @@ import{c as Q,d as Z,e as ee,f as F,g as I,h as j,i as W}from"./chunk-KAFO5QZR.j
|
|
|
100
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
101
|
.ax-startd { margin-top: 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
|
|
102
102
|
.ax-startd__status { color: var(--ax-text-2); font-size: var(--ax-fs-sm); }
|
|
103
|
-
.ax-startd__status a { color: var(--ax-accent); }`,
|
|
103
|
+
.ax-startd__status a { color: var(--ax-accent); }`,xe=`<script>
|
|
104
104
|
document.getElementById('enableTelegram').addEventListener('change', (e) => {
|
|
105
105
|
document.getElementById('telegramFields').classList.toggle('is-show', e.target.checked);
|
|
106
106
|
});
|
|
@@ -174,18 +174,17 @@ document.getElementById('wizard').addEventListener('submit', async (e) => {
|
|
|
174
174
|
btn.disabled = false; btn.textContent = 'Save and continue';
|
|
175
175
|
}
|
|
176
176
|
});
|
|
177
|
-
</script>`;M();function
|
|
177
|
+
</script>`;M();function de(e=process.cwd()){let t=P(e,"agentx.json");if(!N(t))return{configExists:!1,agentCount:0,channelCount:0};try{let n=JSON.parse(se(t,"utf-8")),a=n.agents?Object.keys(n.agents).length:0,r=n.channels?Object.values(n.channels).filter(i=>i&&i.enabled).length:0;return{configExists:!0,agentCount:a,channelCount:r,nodeName:n.node?.name}}catch{return{configExists:!1,agentCount:0,channelCount:0}}}function Se(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=Ie(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 a=P(t,"agentx.json"),r=P(t,".env"),i=P(t,"agents",e.agent.id),c=de(t);ye(i,{recursive:!0});let p=P(i,"CLAUDE.md");if(!N(p)){let x=e.agent.personality?.trim()||`You are ${e.agent.name}, an assistant on the ${e.nodeName} team.`;le(p,`# ${e.agent.name}
|
|
178
178
|
|
|
179
179
|
${x}
|
|
180
|
-
`)}let
|
|
180
|
+
`)}let o=e.telegram?`TG_${e.agent.id.toUpperCase()}_BOT_TOKEN`:void 0,d;if(c.configExists)d=ae(l=>{if(l.node=l.node||{},l.node.name||(l.node.name=e.nodeName),l.node.id||(l.node.id=ce(e.nodeName)||"team"),l.node.bind||(l.node.bind="127.0.0.1:18800"),l.node.defaultAgent=l.node.defaultAgent||e.agent.id,l.providers=l.providers||{},l.providers.claude||(l.providers.claude={apiKey:"${ANTHROPIC_API_KEY}"}),l.agents=l.agents||{},l.agents[e.agent.id])throw new Error(`Agent "${e.agent.id}" already exists.`);return l.agents[e.agent.id]=pe(e,i,n),e.telegram&&(l.channels=l.channels||{},l.channels.telegram=l.channels.telegram||{enabled:!0,accounts:{},policy:{dm:"pair",group:"mention-required"}},l.channels.telegram.enabled=!0,l.channels.telegram.accounts=l.channels.telegram.accounts||{},l.channels.telegram.accounts[e.telegram.accountId]=ge(e,o)),{summary:`added agent "${e.agent.id}"`+(e.telegram?" + telegram account":"")}},{configPath:a}).backupPath;else{let x=Ce(e,i,n,o);re(x,{configPath:a})}Ee(r,e,o);let g=[];return(e.anthropicApiKey||!N(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:c.configExists?`Added agent "${e.agent.id}" to your team.`:`Initialized your team with first agent "${e.agent.id}".`,nextSteps:g,backupPath:d}}function Ie(e){return(e||"").split(/[,\s]+/).map(t=>t.trim()).filter(Boolean).filter((t,n,a)=>a.indexOf(t)===n)}function ce(e){return(e||"").toLowerCase().replace(/[^a-z0-9-]+/g,"-").replace(/^-+|-+$/g,"")}function Ce(e,t,n,a){let i={node:{id:ce(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]:pe(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&&a?i.channels.telegram={enabled:!0,accounts:{[e.telegram.accountId]:ge(e,a)},policy:{dm:"pair",group:"mention-required"}}:i.channels.telegram={enabled:!1,accounts:{},policy:{dm:"pair",group:"mention-required"}},i}function pe(e,t,n){let a={name:e.agent.name,workspace:t,tier:e.agent.tier,mentions:n,maxConcurrent:2,permissionMode:"default"};return e.agent.model&&(a.model=e.agent.model),e.agent.personality?.trim()&&(a.systemPrompt=e.agent.personality.trim().slice(0,400)),a}function ge(e,t){return e.telegram?.botUsername,{token:"${"+t+"}",agentBinding:e.agent.id}}function Ee(e,t,n){let a=N(e)?se(e,"utf-8"):"",r=[];if(t.anthropicApiKey&&!a.includes("ANTHROPIC_API_KEY=")&&r.push(`ANTHROPIC_API_KEY=${t.anthropicApiKey}`),t.telegram&&n&&!a.includes(`${n}=`)&&r.push(`${n}=${t.telegram.botToken}`),!N(e)){le(e,[...["# AgentX environment variables","# (Never commit this file \u2014 it contains secrets.)",""],...r,""].join(`
|
|
181
181
|
`));return}if(r.length>0){let i=a.endsWith(`
|
|
182
182
|
`)?"":`
|
|
183
|
-
|
|
183
|
+
`;be(e,i+r.join(`
|
|
184
184
|
`)+`
|
|
185
|
-
`)}}function
|
|
186
|
-
`,"utf-8")}create(t){if(!t.name?.trim())throw new Error("Token name is required.");if(!Array.isArray(t.scopes)||t.scopes.length===0)throw new Error("At least one scope is required.");for(let l of t.scopes)if(!Me(l))throw new Error(`Invalid scope: ${l}`);let n=ue(32).toString("hex"),a=J+n,r={id:"tok_"+ue(4).toString("hex"),name:t.name.trim(),prefix:J+n.slice(0,4),hash:fe(a),scopes:[...t.scopes],createdAt:new Date().toISOString(),expiresAt:t.expiresInDays?new Date(Date.now()+t.expiresInDays*86400*1e3).toISOString():void 0},i=this.load();return i.push(r),this.save(i),{token:a,record:r}}list(){return this.load()}revoke(t){let n=this.load(),a=n.find(r=>r.id===t);return a?(a.revokedAt=new Date().toISOString(),this.save(n),a):null}verify(t){if(!t||!t.startsWith(J))return null;let n=fe(t),a=this.load(),r=a.find(p=>p.hash===n);if(!r||r.revokedAt||r.expiresAt&&Date.parse(r.expiresAt)<Date.now())return null;let i=Date.now(),l=r.lastUsedAt?Date.parse(r.lastUsedAt):0;if(i-l>6e4){r.lastUsedAt=new Date(i).toISOString();try{this.save(a)}catch{}}return r}};function It(e,t){return!!(e.scopes.includes(t)||t.startsWith("agent:")&&e.scopes.includes("agent:*")||t==="dashboard:read"&&e.scopes.includes("dashboard:write"))}function Me(e){return e==="dashboard:read"||e==="dashboard:write"||e==="agent:*"||/^agent:[a-z0-9][a-z0-9_-]*$/.test(e)||e==="mesh:peer"||e==="app"}function fe(e){return"sha256:"+Ue("sha256").update(e).digest("hex")}function Ct(e){let t=e.headers.authorization,n=Array.isArray(t)?t[0]:t;if(n&&n.toLowerCase().startsWith("bearer "))return n.slice(7).trim();if(e.url)try{let r=new URL(e.url,"http://localhost").searchParams.get("token");if(r)return r}catch{}return null}import{existsSync as Fe,readFileSync as je}from"fs";M();function Pt(e){let t=G(e),n={};if(Fe(t))try{n=Y(JSON.parse(je(t,"utf-8")))}catch{n={}}let a=O.safeParse(n?.approvals);return a.success?a.data:O.parse(void 0)}function Ut(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 Wt(e,t={}){return V(n=>{let a=n.approvals??={};e.defaultExpiryDays!==void 0&&(a.defaultExpiryDays=e.defaultExpiryDays),e.maxExpiryDays!==void 0&&(a.maxExpiryDays=e.maxExpiryDays),e.laterHours!==void 0&&(a.laterHours=e.laterHours),e.notifyAgent!==void 0&&(a.notifyAgent=e.notifyAgent);let r=a.digest??={};e.digestEnabled!==void 0&&(r.enabled=e.digestEnabled),e.digestTime!==void 0&&(r.time=e.digestTime),e.digestTimezone===null?delete r.timezone:e.digestTimezone!==void 0&&(r.timezone=e.digestTimezone),e.destination===null?delete r.destination:e.destination!==void 0&&(r.destination=e.destination);let i=a.defaultExpiryDays??3,l=a.maxExpiryDays??30;if(i>l)throw new Error(`defaultExpiryDays (${i}) can't be more than maxExpiryDays (${l})`)},{configPath:t.configPath,reload:t.reload})}import{createServer as Le}from"http";var D=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 a=await this.fetchJson(`${n.url}/wiki/agents`);n.nodeId=a.nodeId;for(let r of a.agents||[])(r.totalEntries>0||r.totalArticles>0)&&t.push({...r,nodeId:a.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,a){try{let r=await this.fetchJson(`${t}/wiki/article?agent=${encodeURIComponent(n)}&path=${encodeURIComponent(a)}`);return{meta:{title:r.title,tags:r.tags||[],owner:r.owner,access:"public",created:r.created,lastUpdated:r.lastUpdated,sources:r.sources||[]},content:r.content,path:r.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 a=await fetch(t,{signal:AbortSignal.timeout(5e3)});if(!a.ok)throw new Error(`HTTP ${a.status}`);let r=await a.json();return this.cache.set(t,{data:r,ts:Date.now()}),r}};function o(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Je(e){return e.replace(/<!--\s*tags?:[^>]*-->\s*\n?/gi,"")}function ve(e,t){return`<a href="${t?`/agent/${encodeURIComponent(t)}/tag/${encodeURIComponent(e)}`:`/tag/${encodeURIComponent(e)}`}" class="tag">${o(e)}</a>`}function P(e,t){return(e||[]).map(n=>ve(n,t)).join(" ")}function qe(e,t){if(!e)return;let n=t.get(e);if(n)return n;let a=new Set(t.values());if(a.has(e))return e;let r=e.endsWith(".md")?e:`${e}.md`;if(a.has(r))return r;let i=e.toLowerCase();for(let[l,p]of t)if(l.toLowerCase()===i)return p}function H(e,t,n=""){return Q(Je(e),{wikilink:(a,r)=>{let i=qe(a,t);return i?`<a href="${n}/article/${encodeURIComponent(i)}" class="wikilink">${r}</a>`:`<a href="${n}/search?q=${encodeURIComponent(a)}" class="wikilink broken" title="Not found \u2014 click to search">${r}</a>`}})}var Ke=`<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
185
|
+
`)}}function ot(e,t){let n=de(),a=n.nodeName||$e().replace(/\.local$/,""),r=ie(n,a);t.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),t.end(r)}async function st(e,t){let n="";await new Promise(r=>{e.on("data",i=>{n+=i}),e.on("end",()=>r())});let a;try{a=JSON.parse(n)}catch{t.writeHead(400,{"Content-Type":"application/json"}),t.end(JSON.stringify({error:"Invalid JSON"}));return}try{let r=Se(a);t.writeHead(200,{"Content-Type":"application/json"}),t.end(JSON.stringify(r))}catch(r){t.writeHead(400,{"Content-Type":"application/json"}),t.end(JSON.stringify({error:r.message||"wizard failed"}))}}async function lt(e,t){t.setHeader("Content-Type","application/json");let n;try{n=_().node?.bind||"127.0.0.1:18800"}catch(c){t.writeHead(400),t.end(JSON.stringify({ok:!1,error:`Config validation failed: ${c.message}`}));return}let a=`http://${n.replace(/^0\.0\.0\.0/,"127.0.0.1")}`;if(await oe(a)){t.writeHead(200),t.end(JSON.stringify({ok:!0,url:a,alreadyRunning:!0}));return}let r=process.argv[1]||P(ke(we(import.meta.url)),"cli.js");try{Ae(process.execPath,[r,"daemon","start"],{detached:!0,stdio:"ignore",cwd:process.cwd()}).unref()}catch(c){t.writeHead(500),t.end(JSON.stringify({ok:!1,error:`Failed to spawn daemon: ${c.message}`,manualUrl:a}));return}let i=Date.now()+12e3;for(;Date.now()<i;)if(await new Promise(c=>setTimeout(c,400)),await oe(a)){t.writeHead(200),t.end(JSON.stringify({ok:!0,url:a,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:a}))}async function oe(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 Te}from"fs";M();function mt(e){let t=X(e),n={};if(ze(t))try{n=K(JSON.parse(Te(t,"utf-8")))}catch{n={}}let a=D.safeParse(n?.approvals);return a.success?a.data:D.parse(void 0)}function ut(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 ht(e,t={}){return G(n=>{let a=n.approvals??={};e.defaultExpiryDays!==void 0&&(a.defaultExpiryDays=e.defaultExpiryDays),e.maxExpiryDays!==void 0&&(a.maxExpiryDays=e.maxExpiryDays),e.laterHours!==void 0&&(a.laterHours=e.laterHours),e.notifyAgent!==void 0&&(a.notifyAgent=e.notifyAgent);let r=a.digest??={};e.digestEnabled!==void 0&&(r.enabled=e.digestEnabled),e.digestTime!==void 0&&(r.time=e.digestTime),e.digestTimezone===null?delete r.timezone:e.digestTimezone!==void 0&&(r.timezone=e.digestTimezone),e.destination===null?delete r.destination:e.destination!==void 0&&(r.destination=e.destination);let i=a.defaultExpiryDays??3,c=a.maxExpiryDays??30;if(i>c)throw new Error(`defaultExpiryDays (${i}) can't be more than maxExpiryDays (${c})`)},{configPath:t.configPath,reload:t.reload})}import{createServer as Pe}from"http";var H=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 a=await this.fetchJson(`${n.url}/wiki/agents`);n.nodeId=a.nodeId;for(let r of a.agents||[])(r.totalEntries>0||r.totalArticles>0)&&t.push({...r,nodeId:a.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,a){try{let r=await this.fetchJson(`${t}/wiki/article?agent=${encodeURIComponent(n)}&path=${encodeURIComponent(a)}`);return{meta:{title:r.title,tags:r.tags||[],owner:r.owner,access:"public",created:r.created,lastUpdated:r.lastUpdated,sources:r.sources||[]},content:r.content,path:r.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 a=await fetch(t,{signal:AbortSignal.timeout(5e3)});if(!a.ok)throw new Error(`HTTP ${a.status}`);let r=await a.json();return this.cache.set(t,{data:r,ts:Date.now()}),r}};function s(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Re(e){return e.replace(/<!--\s*tags?:[^>]*-->\s*\n?/gi,"")}function me(e,t){return`<a href="${t?`/agent/${encodeURIComponent(t)}/tag/${encodeURIComponent(e)}`:`/tag/${encodeURIComponent(e)}`}" class="tag">${s(e)}</a>`}function R(e,t){return(e||[]).map(n=>me(n,t)).join(" ")}function Ue(e,t){if(!e)return;let n=t.get(e);if(n)return n;let a=new Set(t.values());if(a.has(e))return e;let r=e.endsWith(".md")?e:`${e}.md`;if(a.has(r))return r;let i=e.toLowerCase();for(let[c,p]of t)if(c.toLowerCase()===i)return p}function O(e,t,n=""){return V(Re(e),{wikilink:(a,r)=>{let i=Ue(a,t);return i?`<a href="${n}/article/${encodeURIComponent(i)}" class="wikilink">${r}</a>`:`<a href="${n}/search?q=${encodeURIComponent(a)}" class="wikilink broken" title="Not found \u2014 click to search">${r}</a>`}})}var We=`<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
187
186
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
188
|
-
<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">`,
|
|
187
|
+
<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">`,Ne=`
|
|
189
188
|
:root {
|
|
190
189
|
--bg: #FAF8F3;
|
|
191
190
|
--bg-raised: #FFFFFF;
|
|
@@ -657,9 +656,9 @@ tr:hover td { background: var(--bg-hover); }
|
|
|
657
656
|
<head>
|
|
658
657
|
<meta charset="utf-8">
|
|
659
658
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
660
|
-
<title>${
|
|
661
|
-
${
|
|
662
|
-
<style>${
|
|
659
|
+
<title>${s(e)} \u2014 AgentX Wiki</title>
|
|
660
|
+
${We}
|
|
661
|
+
<style>${Ne}</style>
|
|
663
662
|
<script>(function(){try{var t=localStorage.getItem('wiki-theme');if(t)document.documentElement.setAttribute('data-theme',t)}catch(e){}})();</script>
|
|
664
663
|
</head>
|
|
665
664
|
<body>
|
|
@@ -671,7 +670,7 @@ tr:hover td { background: var(--bg-hover); }
|
|
|
671
670
|
</a>
|
|
672
671
|
<form class="topbar-search" action="/search" method="get">
|
|
673
672
|
<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>
|
|
674
|
-
<input type="search" name="q" placeholder="Search every wiki\u2026" value="${
|
|
673
|
+
<input type="search" name="q" placeholder="Search every wiki\u2026" value="${s(a)}" autocomplete="off" />
|
|
675
674
|
<kbd>\u2318K</kbd>
|
|
676
675
|
</form>
|
|
677
676
|
<div class="topbar-tools">
|
|
@@ -704,37 +703,37 @@ tr:hover td { background: var(--bg-hover); }
|
|
|
704
703
|
})();
|
|
705
704
|
</script>
|
|
706
705
|
</body>
|
|
707
|
-
</html>`}function q(e){let t=new Map;for(let n of e){let a=n.path.includes("/")?n.path.split("/").slice(0,-1).join("/"):"/",r=t.get(a)||[];r.push(n),t.set(a,r)}return new Map([...t].sort((n,a)=>n[0].localeCompare(a[0])))}function
|
|
706
|
+
</html>`}function q(e){let t=new Map;for(let n of e){let a=n.path.includes("/")?n.path.split("/").slice(0,-1).join("/"):"/",r=t.get(a)||[];r.push(n),t.set(a,r)}return new Map([...t].sort((n,a)=>n[0].localeCompare(a[0])))}function J(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 a of e){let r=`/agent/${encodeURIComponent(a.agentId)}`;n+='<div class="nav-section">',n+=`<a class="nav-agent-header" href="${r}">`,n+=`<span class="name">${s(a.agentId)}</span>`,n+=`<span class="badge">${a.totalArticles}</span>`,n+="</a>",n+='<div class="nav-agent-children">';let i=q(a.articles);for(let[c,p]of i){n+=`<div class="nav-agent-type-label">${J(c)}</div>`;for(let o of p){let g=`${a.agentId}/${o.path}`===t;n+=`<a class="nav-item${g?" active":""}" href="${r}/article/${encodeURIComponent(o.path)}">${s(o.title)}</a>`}}n+="</div>",n+="</div>"}return n}function Be(e,t,n){let a=t||e.summary(),i=e.getSharedStore().listEntries().length,c=a.reduce((g,x)=>g+x.totalArticles,0),p=a.reduce((g,x)=>g+x.unabsorbed,0),o=new Set((n||[]).map(g=>g.agentId)),d=`<div class="page-head">
|
|
708
707
|
<div>
|
|
709
708
|
<h1>AgentX Wiki</h1>
|
|
710
709
|
<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>
|
|
711
710
|
</div>
|
|
712
|
-
</div>`;if(
|
|
711
|
+
</div>`;if(d+='<div class="stat-strip">',d+=`<div class="stat-cell"><div class="label">Agents</div><div class="number">${a.length}</div></div>`,d+=`<div class="stat-cell"><div class="label">Articles</div><div class="number">${c}</div></div>`,d+=`<div class="stat-cell"><div class="label">Raw entries</div><div class="number">${i}</div></div>`,p>0&&(d+=`<div class="stat-cell"><div class="label">Unabsorbed</div><div class="number">${p}</div></div>`),n&&n.length>0){let g=new Set(n.map(x=>x.nodeId));d+=`<div class="stat-cell"><div class="label">Mesh nodes</div><div class="number">${g.size}</div></div>`}d+="</div>",d+='<div class="section-head"><h2>Agent wikis</h2></div>',d+='<div class="agent-grid">';for(let g of a){let x=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(d+='<div class="agent-card">',d+=`<h3><a href="/agent/${encodeURIComponent(g.agentId)}">${s(g.agentId)}</a>${h}</h3>`,d+=`<div class="agent-stats">
|
|
713
712
|
<span><strong>${g.totalArticles}</strong> articles</span>
|
|
714
713
|
<span><strong>${g.totalEntries}</strong> entries</span>
|
|
715
714
|
${x}
|
|
716
|
-
</div>`,g.articles.length>0){
|
|
717
|
-
<div class="meta-line">${
|
|
718
|
-
<p>${
|
|
719
|
-
</div>`}let x=e.getAgentWiki(t).lint();if(x.length>0){
|
|
720
|
-
<span class="kind">${
|
|
721
|
-
<span class="article">${
|
|
722
|
-
<span class="msg">${
|
|
723
|
-
</div>`;
|
|
715
|
+
</div>`,g.articles.length>0){d+='<div class="article-list">';for(let f of g.articles.slice(0,6)){let z=R((f.tags||[]).slice(0,2),g.agentId);d+=`<div class="article-row">${z} <a class="article-title" href="/agent/${encodeURIComponent(g.agentId)}/article/${encodeURIComponent(f.path)}">${s(f.title)}</a></div>`}g.articles.length>6&&(d+=`<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>`),d+="</div>"}d+="</div>"}return d+="</div>",$("Hub",C(a),d)}function _e(e,t,n){let a=n||e.summary(),r=a.find(l=>l.agentId===t);if(!r)return $("Not Found",C(a),"<h1>Agent not found</h1>");let i=r.peerUrl!==void 0,c=e.getAgentEntries(t),p=r.articles||[],o=`<nav class="breadcrumb"><a href="/">Hub</a> <span class="sep">/</span> <span class="current">${s(t)}</span></nav>`;if(o+=`<div class="page-head"><div><h1>${s(t)}</h1>`,i&&(o+=`<p class="page-sub"><span class="tag" style="color:var(--cool);background:var(--cool-soft)">remote @ ${s(r.nodeId)}</span></p>`),o+="</div></div>",o+='<div class="stat-strip">',o+=`<div class="stat-cell"><div class="label">Articles</div><div class="number">${r.totalArticles}</div></div>`,o+=`<div class="stat-cell"><div class="label">Entries</div><div class="number">${r.totalEntries}</div></div>`,o+=`<div class="stat-cell"><div class="label">Unabsorbed</div><div class="number">${r.unabsorbed}</div></div>`,o+="</div>",p.length>0){o+='<div class="section-head"><h2>Articles</h2><span class="mono" style="font-size:12px;color:var(--muted)">'+p.length+" total</span></div>";let l=q(p);for(let[h,f]of l){o+=`<h3 class="display" style="font-size:17px;color:var(--muted);font-weight:500;margin:20px 0 8px">${J(h)}</h3>`,o+='<div class="agent-card" style="padding:4px 14px"><div class="article-list">';for(let z of f)o+=`<div class="article-row">${R((z.tags||[]).slice(0,3),t)} <a class="article-title" href="/agent/${encodeURIComponent(t)}/article/${encodeURIComponent(z.path)}">${s(z.title)}</a></div>`;o+="</div></div>"}}let d=c.slice(-5).reverse();if(d.length>0){o+='<div class="section-head"><h2>Recent entries</h2><a class="btn ghost" href="/entries">See all \u2192</a></div>';for(let l of d)o+=`<div class="entry-card">
|
|
716
|
+
<div class="meta-line">${l.date} \xB7 via ${s(l.source)} \xB7 <code>${s(l.id)}</code></div>
|
|
717
|
+
<p>${s(l.content.slice(0,300))}${l.content.length>300?"\u2026":""}</p>
|
|
718
|
+
</div>`}let x=e.getAgentWiki(t).lint();if(x.length>0){o+=`<div class="section-head"><h2>Health issues</h2><span class="mono" style="font-size:12px;color:var(--warn)">${x.length}</span></div>`,o+='<div class="health-list">';for(let l of x)o+=`<div class="health-row">
|
|
719
|
+
<span class="kind">${s(l.type)}</span>
|
|
720
|
+
<span class="article">${s(l.article)}</span>
|
|
721
|
+
<span class="msg">${s(l.message)}</span>
|
|
722
|
+
</div>`;o+="</div>"}return $(t,C(a,t),o)}function He(e,t,n,a){let r=e.getAgentWiki(t),i=r.readArticle(n);if(!i)return null;let c=a||e.summary(),p=r.rebuildIndex(),o=new Map;for(let h of p.articles)o.set(h.title,h.path);let d=`/agent/${encodeURIComponent(t)}`,x=r.buildBacklinks()[i.meta.title]||[],l=`<nav class="breadcrumb"><a href="/">Hub</a> <span class="sep">/</span> <a href="${d}">${s(t)}</a> <span class="sep">/</span> <span class="current">${s(i.meta.title)}</span></nav>`;if(l+=`<article class="prose"><h1>${s(i.meta.title)}</h1>`,l+='<dl class="meta">',i.meta.type&&(l+=`<dt>Type</dt><dd>${me(i.meta.type,t)}</dd>`),i.meta.tags?.length&&(l+=`<dt>Tags</dt><dd>${R(i.meta.tags,t)}</dd>`),i.meta.owner&&(l+=`<dt>Owner</dt><dd>${s(i.meta.owner)}</dd>`),l+=`<dt>Created</dt><dd>${s(i.meta.created||"\u2014")}</dd>`,l+=`<dt>Updated</dt><dd>${s(i.meta.lastUpdated||"\u2014")}</dd>`,i.meta.sources?.length&&(l+=`<dt>Sources</dt><dd>${i.meta.sources.length} entries</dd>`),l+="</dl>",l+=O(i.content,o,d),x.length>0){l+='<div class="backlinks"><h4>Pages that link here</h4><ul>';for(let h of x){let f=r.readArticle(h);l+=`<li><a href="${d}/article/${encodeURIComponent(h)}">${s(f?.meta.title||h)}</a></li>`}l+="</ul></div>"}return l+="</article>",$(i.meta.title,C(c,`${t}/${n}`),l)}function Oe(e,t){let n=t||e.summary(),r=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 c=new Map;for(let p of r){let o=c.get(p.date)||[];o.push(p),c.set(p.date,o)}for(let[p,o]of[...c].reverse()){i+=`<div class="section-head"><h2>${p}</h2><span class="mono" style="font-size:12px;color:var(--muted)">${o.length} entries</span></div>`;for(let d of o)i+=`<div class="entry-card">
|
|
724
723
|
<div class="meta-line">
|
|
725
|
-
<a href="/agent/${encodeURIComponent(
|
|
726
|
-
\xB7 via ${
|
|
724
|
+
<a href="/agent/${encodeURIComponent(d.agentId)}">${s(d.agentId)}</a>
|
|
725
|
+
\xB7 via ${s(d.source)} \xB7 <code>${s(d.id)}</code>
|
|
727
726
|
</div>
|
|
728
|
-
<p>${
|
|
729
|
-
</div>`}return $("All Entries",C(n),i)}function
|
|
730
|
-
<div class="meta-line">${
|
|
731
|
-
<h3><a href="${x}/article/${encodeURIComponent(g.path)}">${
|
|
732
|
-
<p>${
|
|
733
|
-
</div>`)}i+=
|
|
734
|
-
<div class="meta-line">${
|
|
735
|
-
<h3><a href="${g}/article/${encodeURIComponent(
|
|
736
|
-
</div>`}i+=
|
|
737
|
-
<div class="meta-line">${
|
|
738
|
-
<h3><a href="${p}/article/${encodeURIComponent(
|
|
739
|
-
</div>`;return $(`${t} \xB7 ${n}`,C(r),
|
|
740
|
-
//# sourceMappingURL=chunk-
|
|
727
|
+
<p>${s(d.content.slice(0,400))}${d.content.length>400?"\u2026":""}</p>
|
|
728
|
+
</div>`}return $("All Entries",C(n),i)}function De(e,t,n){let a=n||e.summary(),r='<nav class="breadcrumb"><a href="/">Hub</a> <span class="sep">/</span> <span class="current">Search</span></nav>';r+=`<div class="page-head"><div><h1>\u201C${s(t)}\u201D</h1><p class="page-sub">Full-text search across every agent's wiki.</p></div></div>`;let i=0,c=[];for(let p of a){let d=e.getAgentWiki(p.agentId).findRelevant(t,void 0,10);if(d.length>0){c.push(`<div class="section-head"><h2>${s(p.agentId)}</h2><span class="mono" style="font-size:12px;color:var(--muted)">${d.length} match${d.length===1?"":"es"}</span></div>`);for(let g of d){let x=`/agent/${encodeURIComponent(p.agentId)}`;c.push(`<div class="entry-card">
|
|
729
|
+
<div class="meta-line">${R((g.meta.tags||[]).slice(0,3),p.agentId)}</div>
|
|
730
|
+
<h3><a href="${x}/article/${encodeURIComponent(g.path)}">${s(g.meta.title)}</a></h3>
|
|
731
|
+
<p>${s(g.content.slice(0,240))}\u2026</p>
|
|
732
|
+
</div>`)}i+=d.length}}return r+=c.join(""),i===0&&(r+='<p style="color:var(--muted);margin-top:24px">No matching articles found.</p>'),$(`Search: ${t}`,C(a),r,t)}function Me(e,t,n){let a=n||e.summary(),r='<nav class="breadcrumb"><a href="/">Hub</a> <span class="sep">/</span> <span class="current">Tag</span></nav>';r+=`<div class="page-head"><div><h1>${s(t)}</h1><p class="page-sub">All articles tagged <span class="tag">${s(t)}</span>, across every agent.</p></div></div>`;let i=0;for(let c of a){let p;try{p=e.getAgentWiki(c.agentId)}catch{continue}let o=p.findByTags([t],void 0,100);if(o.length!==0){r+=`<div class="section-head"><h2>${s(c.agentId)}</h2><span class="mono" style="font-size:12px;color:var(--muted)">${o.length}</span></div>`;for(let d of o){let g=`/agent/${encodeURIComponent(c.agentId)}`;r+=`<div class="entry-card">
|
|
733
|
+
<div class="meta-line">${R((d.meta.tags||[]).slice(0,6),c.agentId)}</div>
|
|
734
|
+
<h3><a href="${g}/article/${encodeURIComponent(d.path)}">${s(d.meta.title)}</a></h3>
|
|
735
|
+
</div>`}i+=o.length}}return i===0&&(r+=`<p style="color:var(--muted);margin-top:24px">No articles tagged <code>${s(t)}</code>.</p>`),$(`Tag: ${t}`,C(a),r)}function Fe(e,t,n,a){let r=a||e.summary(),i;try{i=e.getAgentWiki(t)}catch{return $(`Tag: ${n}`,C(r),`<h1>Agent not found: ${s(t)}</h1>`)}let c=i.findByTags([n],void 0,100),p=`/agent/${encodeURIComponent(t)}`,o=`<nav class="breadcrumb"><a href="/">Hub</a> <span class="sep">/</span> <a href="${p}">${s(t)}</a> <span class="sep">/</span> <span class="current">${s(n)}</span></nav>`;o+=`<div class="page-head"><div><h1>${s(n)}</h1><p class="page-sub">${c.length} article${c.length===1?"":"s"} tagged <code>${s(n)}</code> in <b>${s(t)}</b>.</p></div></div>`;for(let d of c)o+=`<div class="entry-card">
|
|
736
|
+
<div class="meta-line">${R((d.meta.tags||[]).slice(0,6),t)}</div>
|
|
737
|
+
<h3><a href="${p}/article/${encodeURIComponent(d.path)}">${s(d.meta.title)}</a></h3>
|
|
738
|
+
</div>`;return $(`${t} \xB7 ${n}`,C(r),o)}function U(e,t,n){let a=e.rebuildIndex(),r=q(a.articles.map(c=>({title:c.title,path:c.path,tags:c.tags}))),i='<div class="nav-section">';i+=`<div class="nav-section-title">${s(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[c,p]of r){i+='<div class="nav-section">',i+=`<div class="nav-section-title">${J(c)}</div>`;for(let o of p){let d=o.path===n;i+=`<a class="nav-item${d?" active":""}" href="/article/${encodeURIComponent(o.path)}">${s(o.title)}</a>`}i+="</div>"}return i}function je(e){let{wikiDir:t,agentFilter:n,peerUrls:a=[],mode:r="graph",pathPrefix:i=""}=e,c=i.replace(/\/+$/,""),p=new Y(t,void 0,r),o=a.length>0?new H(a):null;return async(d,g)=>{let x=new URL(d.url||"/","http://localhost"),l=decodeURIComponent(x.pathname),h=c&&l.startsWith(c)?l.slice(c.length)||"/":l,f=null,z=200;try{if(h.startsWith("/remote/")&&o){let y=h.slice(8).split("/article/");if(y.length===2){let[b,v]=y,m=b.indexOf("/"),k=decodeURIComponent(b.slice(0,m)),u=b.slice(m+1),w=await o.getRemoteArticle(k,u,v);if(w){let T=await o.getRemoteAgents(),B=[...p.summary(),...T.map(S=>({...S,agentId:`${S.agentId} @${S.nodeId}`}))],A=`<div class="breadcrumb"><a href="/">Hub</a> / <span class="tag">remote</span> ${s(u)} @ ${s(k)}</div>`;A+=`<h1>${s(w.meta.title)}</h1>`,A+='<dl class="meta">',A+=`<dt>Tags</dt><dd>${(w.meta.tags||[]).map(S=>`<span class="tag">${S}</span>`).join(" ")}</dd>`,A+=`<dt>Owner</dt><dd>${s(w.meta.owner)}</dd>`,A+=`<dt>Source</dt><dd><span class="tag">remote</span> ${s(k)}</dd>`,A+=`<dt>Updated</dt><dd>${w.meta.lastUpdated}</dd>`,A+="</dl>";let E=new Map;A+=O(w.content,E),f=$(w.meta.title,C(B),A)}}}if(!f&&n){let y=p.getAgentWiki(n);if(h==="/"||h===""){let b=y.rebuildIndex(),v=p.getAgentEntries(n),m=`<h1>${s(n)}</h1>`;if(m+='<div class="stats">',m+=`<div class="stat-card"><div class="number">${b.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>",b.articles.length>0){m+="<h2>Articles</h2><table><tr><th>Title</th><th>Type</th><th>Updated</th></tr>";for(let k of b.articles)m+=`<tr><td><a href="/article/${encodeURIComponent(k.path)}">${s(k.title)}</a></td><td><span class="tag">${(k.tags||[]).slice(0,3).join(", ")}</span></td><td>${k.lastUpdated||""}</td></tr>`;m+="</table>"}f=$(n,U(y,n),m)}else if(h.startsWith("/article/")){let b=h.slice(9),v=y.readArticle(b);if(v){let m=y.rebuildIndex(),k=new Map;for(let w of m.articles)k.set(w.title,w.path);let u=`<h1>${s(v.meta.title)}</h1>`;u+='<dl class="meta">',u+=`<dt>Tags</dt><dd>${(v.meta.tags||[]).map(w=>`<span class="tag">${w}</span>`).join(" ")}</dd>`,u+=`<dt>Updated</dt><dd>${v.meta.lastUpdated}</dd>`,v.meta.sources?.length&&(u+=`<dt>Sources</dt><dd>${v.meta.sources.length} entries</dd>`),u+="</dl>",u+=O(v.content,k),f=$(v.meta.title,U(y,n,b),u)}}else if(h==="/lint"){let b=y.lint(),v="<h1>Health Check</h1>";if(b.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 b)v+=`<tr><td><span class="tag">${m.type}</span></td><td>${s(m.article)}</td><td>${s(m.message)}</td></tr>`;v+="</table>"}f=$("Health Check",U(y,n),v)}else if(h==="/search"){let b=x.searchParams.get("q")||"",v=await y.findRelevantReranked(b,void 0,20),m=`<h1>Search: "${s(b)}"</h1>`;for(let k of v)m+=`<div class="entry-card"><h3><a href="/article/${encodeURIComponent(k.path)}">${s(k.meta.title)}</a></h3><p>${s(k.content.slice(0,200))}...</p></div>`;v.length===0&&(m+="<p>No results.</p>"),f=$(`Search: ${b}`,U(y,n),m)}else if(h.startsWith("/tag/")){let b=decodeURIComponent(h.slice(5)),v=y.findByTags([b],void 0,100),m=`<h1>Tag: <a class="tag" href="#">${s(b)}</a></h1>`;m+=`<p>${v.length} article${v.length===1?"":"s"} tagged <code>${s(b)}</code></p>`;for(let k of v)m+=`<div class="entry-card"><h3><a href="/article/${encodeURIComponent(k.path)}">${s(k.meta.title)}</a></h3><div class="meta-line">${R((k.meta.tags||[]).slice(0,6))}</div></div>`;v.length===0&&(m+="<p>No articles with this tag.</p>"),f=$(`Tag: ${b}`,U(y,n),m)}}else{let y=o?await o.getRemoteAgents():[],b=p.summary(),v=new Map(b.map(u=>[u.agentId,u])),m=[],k=new Set;for(let u of b){let w=y.find(T=>T.agentId===u.agentId);w&&w.totalArticles>u.totalArticles?m.push({...w,totalEntries:Math.max(u.totalEntries,w.totalEntries),unabsorbed:Math.max(u.unabsorbed,w.unabsorbed)}):m.push(u),k.add(u.agentId)}for(let u of y)k.has(u.agentId)||(m.push(u),k.add(u.agentId));if(h==="/"||h==="")f=Be(p,m,y);else if(h==="/entries")f=Oe(p,m);else if(h==="/search")f=De(p,x.searchParams.get("q")||"",m);else if(h.startsWith("/tag/"))f=Me(p,decodeURIComponent(h.slice(5)),m);else if(h.match(/^\/agent\/[^/]+\/tag\/.+/)){let u=h.match(/^\/agent\/([^/]+)\/tag\/(.+)$/);f=Fe(p,decodeURIComponent(u[1]),decodeURIComponent(u[2]),m)}else if(h.startsWith("/agent/")){let u=h.slice(7),w=u.indexOf("/article/");if(w===-1)f=_e(p,u,m);else{let T=u.slice(0,w),B=u.slice(w+9);if(f=He(p,T,B,m),!f&&o){let A=y.find(E=>E.agentId===T);if(A){let E=await o.getRemoteArticle(A.peerUrl,T,B);if(E){let S=`<div class="breadcrumb"><a href="/">Hub</a> / <span class="tag">remote @ ${s(A.nodeId)}</span> / ${s(T)}</div>`;S+=`<h1>${s(E.meta.title)}</h1>`,S+='<dl class="meta">',S+=`<dt>Tags</dt><dd>${(E.meta.tags||[]).map(ue=>`<span class="tag">${ue}</span>`).join(" ")}</dd>`,S+=`<dt>Source</dt><dd><span class="tag">remote</span> ${s(A.nodeId)}</dd>`,S+=`<dt>Updated</dt><dd>${E.meta.lastUpdated}</dd>`,S+="</dl>",S+=O(E.content,new Map),f=$(E.meta.title,C(m),S)}}}}}}if(!f){z=404;let y=n?U(p.getAgentWiki(n),n):C(p.summary());f=$("Not Found",y,"<h1>Page not found</h1>")}}catch(y){z=500,f=$("Error","",`<h1>Error</h1><pre>${s(y.message)}</pre>`)}g.writeHead(z,{"Content-Type":"text/html; charset=utf-8"}),g.end(c?Le(f,c):f)}}function Le(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 wt(e,t=4200,n,a=[],r="graph"){let i=je({wikiDir:e,agentFilter:n,peerUrls:a,mode:r});Pe((p,o)=>{i(p,o)}).listen(t)}var qe="https://ntfy.sh";function At(e){return{enabled:!!e?.enabled,server:e?.server||qe,topicSet:!!e?.topic,tokenSet:!!e?.token}}function St(e,t){let n={...e??{}};if("enabled"in t&&(n.enabled=!!t.enabled),"server"in t){let a=String(t.server).trim().replace(/\/+$/,"");if(!/^https?:\/\/\S+$/.test(a))throw new Error("ntfy server must be an http(s) URL");n.server=a}if("topic"in t){let a=String(t.topic).trim();if(!a)throw new Error("ntfy topic cannot be empty");n.topic=a}if("token"in t){let a=String(t.token??"").trim();a?n.token=a:delete n.token}if(n.enabled&&!n.topic)throw new Error("set a topic before enabling ntfy");return n}export{ae as a,de as b,ot as c,st as d,lt as e,mt as f,ut as g,ht as h,At as i,St as j,je as k,wt as l};
|
|
739
|
+
//# sourceMappingURL=chunk-UYMK3XNB.js.map
|