agentix-cli 0.121.0 → 0.121.1
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/{agent-TQQOAVMU.js → agent-KR4B2G24.js} +2 -2
- package/dist/{board-dashboard-FNMZAP7A.js → board-dashboard-WBIQPRHQ.js} +2 -2
- package/dist/{chunk-2NGXOYTS.js → chunk-D7LGD7ZI.js} +69 -69
- package/dist/chunk-D7LGD7ZI.js.map +1 -0
- package/dist/{chunk-I4IDZSGF.js → chunk-FIB5LD6R.js} +4 -4
- package/dist/{chunk-RMA7KKR7.js → chunk-HVYS5ZBQ.js} +2 -2
- package/dist/chunk-KFSA2ZI7.js +4 -0
- package/dist/chunk-KFSA2ZI7.js.map +1 -0
- package/dist/{chunk-MORRCYJE.js → chunk-MSYBNVY3.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +17 -2
- package/dist/index.js +1 -1
- package/dist/{program-OKPC77BN.js → program-4J6WMXLI.js} +128 -128
- package/dist/program-4J6WMXLI.js.map +1 -0
- package/dist/{registry-YHSHGJ4K.js → registry-XK2FTQZV.js} +2 -2
- package/dist/{wiki-F6EZBBUH.js → wiki-PAMLP6WO.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-2NGXOYTS.js.map +0 -1
- package/dist/chunk-DJQMG6TH.js +0 -4
- package/dist/chunk-DJQMG6TH.js.map +0 -1
- package/dist/program-OKPC77BN.js.map +0 -1
- /package/dist/{agent-TQQOAVMU.js.map → agent-KR4B2G24.js.map} +0 -0
- /package/dist/{board-dashboard-FNMZAP7A.js.map → board-dashboard-WBIQPRHQ.js.map} +0 -0
- /package/dist/{chunk-I4IDZSGF.js.map → chunk-FIB5LD6R.js.map} +0 -0
- /package/dist/{chunk-RMA7KKR7.js.map → chunk-HVYS5ZBQ.js.map} +0 -0
- /package/dist/{chunk-MORRCYJE.js.map → chunk-MSYBNVY3.js.map} +0 -0
- /package/dist/{registry-YHSHGJ4K.js.map → registry-XK2FTQZV.js.map} +0 -0
- /package/dist/{wiki-F6EZBBUH.js.map → wiki-PAMLP6WO.js.map} +0 -0
package/dist/chunk-DJQMG6TH.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as c}from"./chunk-IKBWV7YJ.js";import{resolve as o}from"path";import{existsSync as l,readdirSync as y,mkdirSync as h,readFileSync as u,writeFileSync as p,renameSync as m}from"fs";var f=class{baseDir;agentsDir;mode;sharedStore;agentStores=new Map;log;constructor(t=o(process.cwd(),".agentx/wiki"),e=console.error.bind(console,"[wiki-hub]"),r="graph"){this.baseDir=t,this.agentsDir=o(t,"agents"),this.mode=r,this.log=e,h(this.agentsDir,{recursive:!0}),this.sharedStore=new c(t,e)}getMode(){return this.mode}getAgentWiki(t){let e=`${t}:${this.mode}`;if(this.agentStores.has(e))return this.agentStores.get(e);let r=o(this.agentsDir,t,this.mode),s=new c(r,this.log);return this.agentStores.set(e,s),s}getBaseDir(){return this.baseDir}getSharedStore(){return this.sharedStore}listAgents(){let t=new Set,e=this.sharedStore.listEntries();for(let r of e)t.add(r.agentId);if(l(this.agentsDir))for(let r of y(this.agentsDir))!r.startsWith("_")&&!r.startsWith(".")&&t.add(r);return[...t].sort()}getAgentEntries(t){return this.sharedStore.listEntries({agentId:t})}getUnabsorbedEntries(t){return this.classifyEntries(t).pending}markProcessed(t,e,r){let s=new Set(r),a=this.readLedger(t),g=new Date().toISOString();for(let i of e)a.entries[i]={at:g,cited:s.has(i)};let n=this.ledgerPath(t);h(o(n,".."),{recursive:!0});let d=`${n}.tmp`;p(d,`${JSON.stringify(a,null,2)}
|
|
2
|
-
`),m(d,n)}summary(){return this.listAgents().map(e=>{let{all:r,cited:s,read:a,pending:g,articles:n}=this.classifyEntries(e);return{agentId:e,totalEntries:r.length,totalArticles:n.length,cited:s.length,readNotCited:a.length,unabsorbed:g.length,articles:n}})}classifyEntries(t){let e=this.getAgentEntries(t),r=this.getAgentWiki(t).rebuildIndex().articles,s=new Set;for(let i of r)if(i.sources)for(let S of i.sources)s.add(S);let a=this.readLedger(t).entries,g=[],n=[],d=[];for(let i of e)s.has(i.id)?g.push(i):a[i.id]?n.push(i):d.push(i);return{all:e,cited:g,read:n,pending:d,articles:r}}syncedFrom(t){let e=o(this.agentsDir,t,"_synced.json");if(!l(e))return null;try{return JSON.parse(u(e,"utf-8"))}catch(r){return this.log(`synced marker ${e} is not valid JSON: ${r.message}`),{node:"unknown",peerUrl:"",at:""}}}markSynced(t,e){let r=o(this.agentsDir,t,"_synced.json");h(o(r,".."),{recursive:!0});let s=`${r}.tmp`;p(s,`${JSON.stringify(e,null,2)}
|
|
3
|
-
`),m(s,r)}ledgerPath(t){return o(this.agentsDir,t,"_absorbed.json")}readLedger(t){let e=this.ledgerPath(t);if(!l(e))return{entries:{}};try{return{entries:JSON.parse(u(e,"utf-8")).entries??{}}}catch(r){throw new Error(`absorb ledger ${e} is not valid JSON: ${r.message}`)}}};export{f as a};
|
|
4
|
-
//# sourceMappingURL=chunk-DJQMG6TH.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/wiki/hub.ts"],"sourcesContent":["import { WikiStore } from \"./store\"\nimport { resolve } from \"path\"\nimport { existsSync, readdirSync, mkdirSync, readFileSync, writeFileSync, renameSync } from \"fs\"\nimport type { WikiEntry } from \"./types\"\n\nexport type WikiMode = \"flat\" | \"graph\" | \"unified\"\n\n/**\n * WikiHub: manages per-agent wikis with a shared raw entry pool.\n * Supports two compilation modes:\n * - flat: Karpathy pattern — tags, LLM-chosen paths, worldview, gap detection\n * - graph: Knowledge graph — kind, parent, hierarchy, events, entities\n *\n * Both modes share the same raw entries. Articles stored separately:\n * agents/<id>/flat/ ← Karpathy compilation\n * agents/<id>/graph/ ← Knowledge graph compilation\n */\nexport class WikiHub {\n private baseDir: string\n private agentsDir: string\n private mode: WikiMode\n private sharedStore: WikiStore\n private agentStores: Map<string, WikiStore> = new Map()\n private log: (...args: unknown[]) => void\n\n constructor(\n baseDir: string = resolve(process.cwd(), \".agentx/wiki\"),\n log: (...args: unknown[]) => void = console.error.bind(console, \"[wiki-hub]\"),\n mode: WikiMode = \"graph\",\n ) {\n this.baseDir = baseDir\n this.agentsDir = resolve(baseDir, \"agents\")\n this.mode = mode\n this.log = log\n\n mkdirSync(this.agentsDir, { recursive: true })\n this.sharedStore = new WikiStore(baseDir, log)\n }\n\n getMode(): WikiMode { return this.mode }\n\n /**\n * Get or create the wiki store for a specific agent (mode-aware).\n * flat: agents/<id>/flat/\n * graph: agents/<id>/graph/\n */\n getAgentWiki(agentId: string): WikiStore {\n const key = `${agentId}:${this.mode}`\n if (this.agentStores.has(key)) return this.agentStores.get(key)!\n\n const agentDir = resolve(this.agentsDir, agentId, this.mode)\n const store = new WikiStore(agentDir, this.log)\n this.agentStores.set(key, store)\n return store\n }\n\n /** The wiki root: shared sidecars (_facts.json, _questions.json) live here. */\n getBaseDir(): string {\n return this.baseDir\n }\n\n getSharedStore(): WikiStore {\n return this.sharedStore\n }\n\n listAgents(): string[] {\n const agents = new Set<string>()\n\n const entries = this.sharedStore.listEntries()\n for (const e of entries) agents.add(e.agentId)\n\n if (existsSync(this.agentsDir)) {\n for (const dir of readdirSync(this.agentsDir)) {\n if (!dir.startsWith(\"_\") && !dir.startsWith(\".\")) {\n agents.add(dir)\n }\n }\n }\n\n return [...agents].sort()\n }\n\n getAgentEntries(agentId: string): WikiEntry[] {\n return this.sharedStore.listEntries({ agentId })\n }\n\n /**\n * Entries absorb has not dealt with yet: no article cites them and no\n * successful absorb run has read them. Without the second check an\n * entry absorb read and chose not to cite came back on every run, and\n * a backfill kept re-reading the head of the queue (#762).\n */\n getUnabsorbedEntries(agentId: string): WikiEntry[] {\n return this.classifyEntries(agentId).pending\n }\n\n /**\n * Record every entry handed to the model in a successful absorb run,\n * cited or not. Callers must not call this for a failed run, so those\n * entries are offered again.\n */\n markProcessed(agentId: string, entryIds: string[], citedIds: Iterable<string>): void {\n const cited = new Set(citedIds)\n const ledger = this.readLedger(agentId)\n const at = new Date().toISOString()\n for (const id of entryIds) ledger.entries[id] = { at, cited: cited.has(id) }\n\n const file = this.ledgerPath(agentId)\n mkdirSync(resolve(file, \"..\"), { recursive: true })\n const tmp = `${file}.tmp`\n writeFileSync(tmp, `${JSON.stringify(ledger, null, 2)}\\n`)\n renameSync(tmp, file)\n }\n\n summary(): AgentWikiSummary[] {\n const agents = this.listAgents()\n return agents.map(agentId => {\n const { all, cited, read, pending, articles } = this.classifyEntries(agentId)\n return {\n agentId,\n totalEntries: all.length,\n totalArticles: articles.length,\n cited: cited.length,\n readNotCited: read.length,\n unabsorbed: pending.length,\n articles,\n }\n })\n }\n\n /** Split an agent's entries into cited by an article, read but not cited, and pending. */\n private classifyEntries(agentId: string) {\n const all = this.getAgentEntries(agentId)\n const articles = this.getAgentWiki(agentId).rebuildIndex().articles\n\n const citedIds = new Set<string>()\n for (const article of articles) {\n if (article.sources) {\n for (const s of article.sources) citedIds.add(s)\n }\n }\n const ledger = this.readLedger(agentId).entries\n\n const cited: WikiEntry[] = []\n const read: WikiEntry[] = []\n const pending: WikiEntry[] = []\n for (const e of all) {\n if (citedIds.has(e.id)) cited.push(e)\n else if (ledger[e.id]) read.push(e)\n else pending.push(e)\n }\n return { all, cited, read, pending, articles }\n }\n\n /**\n * The peer an agent's articles were copied from by `wiki sync --articles`,\n * or null for an agent this node absorbs itself. A copied agent is\n * read-only here: absorb and patch leave it to its home node.\n */\n syncedFrom(agentId: string): SyncedFrom | null {\n const file = resolve(this.agentsDir, agentId, \"_synced.json\")\n if (!existsSync(file)) return null\n try {\n return JSON.parse(readFileSync(file, \"utf-8\")) as SyncedFrom\n } catch (err) {\n // A damaged marker still means the agent lives elsewhere.\n this.log(`synced marker ${file} is not valid JSON: ${(err as Error).message}`)\n return { node: \"unknown\", peerUrl: \"\", at: \"\" }\n }\n }\n\n markSynced(agentId: string, from: SyncedFrom): void {\n const file = resolve(this.agentsDir, agentId, \"_synced.json\")\n mkdirSync(resolve(file, \"..\"), { recursive: true })\n const tmp = `${file}.tmp`\n writeFileSync(tmp, `${JSON.stringify(from, null, 2)}\\n`)\n renameSync(tmp, file)\n }\n\n /** agents/<id>/_absorbed.json — shared by every mode, like the raw entries. */\n private ledgerPath(agentId: string): string {\n return resolve(this.agentsDir, agentId, \"_absorbed.json\")\n }\n\n private readLedger(agentId: string): AbsorbLedger {\n const file = this.ledgerPath(agentId)\n if (!existsSync(file)) return { entries: {} }\n try {\n const parsed = JSON.parse(readFileSync(file, \"utf-8\")) as AbsorbLedger\n return { entries: parsed.entries ?? {} }\n } catch (err) {\n // Treating a damaged ledger as empty would let the next run\n // overwrite it and re-queue everything it recorded.\n throw new Error(`absorb ledger ${file} is not valid JSON: ${(err as Error).message}`)\n }\n }\n}\n\nexport interface SyncedFrom {\n /** The peer's node id. */\n node: string\n peerUrl: string\n /** When the last copy finished. */\n at: string\n}\n\ninterface AbsorbLedger {\n entries: Record<string, { at: string; cited: boolean }>\n}\n\nexport interface AgentWikiSummary {\n agentId: string\n totalEntries: number\n totalArticles: number\n /** Entries an article cites. */\n cited: number\n /** Entries a successful absorb run read and did not cite. */\n readNotCited: number\n /** Entries absorb has not read yet. */\n unabsorbed: number\n articles: Array<{ title: string; path: string; tags?: string[] }>\n}\n"],"mappings":"wCACA,OAAS,WAAAA,MAAe,OACxB,OAAS,cAAAC,EAAY,eAAAC,EAAa,aAAAC,EAAW,gBAAAC,EAAc,iBAAAC,EAAe,cAAAC,MAAkB,KAerF,IAAMC,EAAN,KAAc,CACX,QACA,UACA,KACA,YACA,YAAsC,IAAI,IAC1C,IAER,YACEC,EAAkBR,EAAQ,QAAQ,IAAI,EAAG,cAAc,EACvDS,EAAoC,QAAQ,MAAM,KAAK,QAAS,YAAY,EAC5EC,EAAiB,QACjB,CACA,KAAK,QAAUF,EACf,KAAK,UAAYR,EAAQQ,EAAS,QAAQ,EAC1C,KAAK,KAAOE,EACZ,KAAK,IAAMD,EAEXN,EAAU,KAAK,UAAW,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AS,cAAc,EAC5D,GAAI,CAACX,EAAWyB,CAAI,EAAG,OAAO,KAC9B,GAAI,CACF,OAAO,KAAK,MAAMtB,EAAasB,EAAM,OAAO,CAAC,CAC/C,OAASQ,EAAP,CAEA,YAAK,IAAI,iBAAiBR,wBAA4BQ,EAAc,SAAS,EACtE,CAAE,KAAM,UAAW,QAAS,GAAI,GAAI,EAAG,CAChD,CACF,CAEA,WAAWtB,EAAiBuB,EAAwB,CAClD,IAAMT,EAAO1B,EAAQ,KAAK,UAAWY,EAAS,cAAc,EAC5DT,EAAUH,EAAQ0B,EAAM,IAAI,EAAG,CAAE,UAAW,EAAK,CAAC,EAClD,IAAMC,EAAM,GAAGD,QACfrB,EAAcsB,EAAK,GAAG,KAAK,UAAUQ,EAAM,KAAM,CAAC;AAAA,CAAK,EACvD7B,EAAWqB,EAAKD,CAAI,CACtB,CAGQ,WAAWd,EAAyB,CAC1C,OAAOZ,EAAQ,KAAK,UAAWY,EAAS,gBAAgB,CAC1D,CAEQ,WAAWA,EAA+B,CAChD,IAAMc,EAAO,KAAK,WAAWd,CAAO,EACpC,GAAI,CAACX,EAAWyB,CAAI,EAAG,MAAO,CAAE,QAAS,CAAC,CAAE,EAC5C,GAAI,CAEF,MAAO,CAAE,QADM,KAAK,MAAMtB,EAAasB,EAAM,OAAO,CAAC,EAC5B,SAAW,CAAC,CAAE,CACzC,OAASQ,EAAP,CAGA,MAAM,IAAI,MAAM,iBAAiBR,wBAA4BQ,EAAc,SAAS,CACtF,CACF,CACF","names":["resolve","existsSync","readdirSync","mkdirSync","readFileSync","writeFileSync","renameSync","WikiHub","baseDir","log","mode","WikiStore","agentId","key","agentDir","store","agents","entries","e","dir","entryIds","citedIds","cited","ledger","at","id","file","tmp","all","read","pending","articles","article","s","err","from"]}
|