agentix-cli 0.213.3 → 0.215.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/{agent-KUCECPSZ.js → agent-KOKQSRAH.js} +2 -2
- package/dist/{board-dashboard-RWX4F43G.js → board-dashboard-NVQUQSWI.js} +3 -3
- package/dist/{board-dashboard-RWX4F43G.js.map → board-dashboard-NVQUQSWI.js.map} +1 -1
- package/dist/chunk-4BYJN2A3.js +4 -0
- package/dist/chunk-4BYJN2A3.js.map +1 -0
- package/dist/{chunk-SPXXLPAS.js → chunk-4DCQIHWU.js} +2 -2
- package/dist/{chunk-SMZQLUJH.js → chunk-4ZD2C76P.js} +2 -2
- package/dist/{chunk-YR6GDF4W.js → chunk-7AFXLWWW.js} +87 -147
- package/dist/chunk-7AFXLWWW.js.map +1 -0
- package/dist/chunk-7YOLZGB5.js +2 -0
- package/dist/chunk-7YOLZGB5.js.map +1 -0
- package/dist/chunk-CSC45PA7.js +62 -0
- package/dist/chunk-CSC45PA7.js.map +1 -0
- package/dist/chunk-GGAEFVXL.js +42 -0
- package/dist/chunk-GGAEFVXL.js.map +1 -0
- package/dist/chunk-HVMUYEQP.js +4 -0
- package/dist/chunk-HVMUYEQP.js.map +1 -0
- package/dist/{chunk-SBFMNAJG.js → chunk-JLH73NRM.js} +88 -88
- package/dist/chunk-JLH73NRM.js.map +1 -0
- package/dist/{chunk-3GWIV2YO.js → chunk-OQNJIIR2.js} +2 -2
- package/dist/{chunk-3GWIV2YO.js.map → chunk-OQNJIIR2.js.map} +1 -1
- package/dist/{chunk-3327JD6L.js → chunk-Q7Y5VQGX.js} +2 -2
- package/dist/{chunk-UNVZUWOY.js → chunk-QMICGPM6.js} +3 -3
- package/dist/{chunk-UNVZUWOY.js.map → chunk-QMICGPM6.js.map} +1 -1
- package/dist/{chunk-D7B35QCZ.js → chunk-QOGZD6Z3.js} +323 -323
- package/dist/chunk-QOGZD6Z3.js.map +1 -0
- package/dist/chunk-Z5CMA4JN.js +6 -0
- package/dist/chunk-Z5CMA4JN.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/decision-approvals-SWZ4RWFI.js +2 -0
- package/dist/{doctor-TK7LVXJ6.js → doctor-GP2KVKWE.js} +2 -2
- package/dist/hub-V2AGLA7T.js +2 -0
- package/dist/index.d.ts +93 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{program-GXEVAQRW.js → program-WSGVQTFM.js} +255 -255
- package/dist/program-WSGVQTFM.js.map +1 -0
- package/dist/{query-runs-AENEZOM6.js → query-runs-2F6KHFBZ.js} +2 -2
- package/dist/{registry-D727ZQUP.js → registry-KRU6AWVW.js} +2 -2
- package/dist/timers-LAT4ZVXJ.js +2 -0
- package/dist/{tool-2VRNH43W.js → tool-ZCSGJ2ZF.js} +9 -9
- package/dist/tool-ZCSGJ2ZF.js.map +1 -0
- package/dist/wiki-IDLRJ6WL.js +2 -0
- package/dist/wiki-enrich-XWLDJAZI.js +2 -0
- package/package.json +1 -1
- package/dist/chunk-AFRHKA7B.js +0 -2
- package/dist/chunk-AFRHKA7B.js.map +0 -1
- package/dist/chunk-D7B35QCZ.js.map +0 -1
- package/dist/chunk-FR4DTMCA.js +0 -42
- package/dist/chunk-FR4DTMCA.js.map +0 -1
- package/dist/chunk-HPRLRD4P.js +0 -6
- package/dist/chunk-HPRLRD4P.js.map +0 -1
- package/dist/chunk-LIY5CHUV.js +0 -4
- package/dist/chunk-LIY5CHUV.js.map +0 -1
- package/dist/chunk-RMXG5GNW.js +0 -4
- package/dist/chunk-RMXG5GNW.js.map +0 -1
- package/dist/chunk-SBFMNAJG.js.map +0 -1
- package/dist/chunk-YR6GDF4W.js.map +0 -1
- package/dist/decision-approvals-NJS2ARAF.js +0 -2
- package/dist/hub-PPQGFC35.js +0 -2
- package/dist/program-GXEVAQRW.js.map +0 -1
- package/dist/timers-KK7GF77Y.js +0 -2
- package/dist/tool-2VRNH43W.js.map +0 -1
- package/dist/wiki-FP4JMCYP.js +0 -2
- package/dist/wiki-enrich-3SPIVYSG.js +0 -2
- /package/dist/{agent-KUCECPSZ.js.map → agent-KOKQSRAH.js.map} +0 -0
- /package/dist/{chunk-SPXXLPAS.js.map → chunk-4DCQIHWU.js.map} +0 -0
- /package/dist/{chunk-SMZQLUJH.js.map → chunk-4ZD2C76P.js.map} +0 -0
- /package/dist/{chunk-3327JD6L.js.map → chunk-Q7Y5VQGX.js.map} +0 -0
- /package/dist/{decision-approvals-NJS2ARAF.js.map → decision-approvals-SWZ4RWFI.js.map} +0 -0
- /package/dist/{doctor-TK7LVXJ6.js.map → doctor-GP2KVKWE.js.map} +0 -0
- /package/dist/{hub-PPQGFC35.js.map → hub-V2AGLA7T.js.map} +0 -0
- /package/dist/{query-runs-AENEZOM6.js.map → query-runs-2F6KHFBZ.js.map} +0 -0
- /package/dist/{registry-D727ZQUP.js.map → registry-KRU6AWVW.js.map} +0 -0
- /package/dist/{timers-KK7GF77Y.js.map → timers-LAT4ZVXJ.js.map} +0 -0
- /package/dist/{wiki-FP4JMCYP.js.map → wiki-IDLRJ6WL.js.map} +0 -0
- /package/dist/{wiki-enrich-3SPIVYSG.js.map → wiki-enrich-XWLDJAZI.js.map} +0 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{createHash as c}from"crypto";import{existsSync as l,mkdirSync as d,readFileSync as u,renameSync as f,writeFileSync as g}from"fs";import{dirname as A,resolve as v}from"path";function s(t){return v(t,"_decisions","approved.json")}function p(t){return c("sha256").update(`${t.meta.title??""}
|
|
2
|
+
${(t.content??"").trim()}`).digest("hex")}function r(t){let i=s(t);if(!l(i))return{};try{let e=JSON.parse(u(i,"utf-8"));return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function a(t,i){let e=s(t);d(A(e),{recursive:!0});let n=`${e}.${process.pid}.tmp`;g(n,JSON.stringify(i,null,2)+`
|
|
3
|
+
`),f(n,e)}function m(t,i){let e=i[t.path];return e?e.hash===p(t)?"approved":"changed":"waiting"}function y(t,i){return t.filter(e=>e.meta.type!=="decision"||m(e,i)==="approved")}function S(t,i,e){return e?y(t,r(i)):t}function k(t,i){return t.listArticles(i).filter(e=>e.meta.type==="decision"&&!e.path.includes("/_versions/"))}function w(t=process.env){return t.AGENTX_AGENT_ID?.trim()||t.AGENTX_TASK_ID?.trim()?"decision pages are approved by the owner from a terminal, not from inside an agent's run":null}function W(t,i,e={}){if(i.meta.type!=="decision")throw new Error(`${i.path} is not a decision page (type: ${i.meta.type??"none"})`);let n=r(t),o={hash:p(i),approvedAt:new Date(e.now??Date.now()).toISOString(),by:e.by||"owner",lastUpdated:i.meta.lastUpdated||void 0,...e.note?{note:e.note}:{}};return n[i.path]=o,a(t,n),o}function b(t,i){let e=r(t);return e[i]?(delete e[i],a(t,e),!0):!1}export{s as a,p as b,r as c,m as d,y as e,S as f,k as g,w as h,W as i,b as j};
|
|
4
|
+
//# sourceMappingURL=chunk-HVMUYEQP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/wiki/decision-approvals.ts"],"sourcesContent":["// --- Owner approval for decision pages (#1778) ---\n//\n// A fresh session puts the newest wiki `decision` pages ahead of the chat\n// history and says they win (agents/owner-decisions.ts, #1777). Until now\n// any write could make such a page: the absorb job types pages from raw\n// chat and cron entries (a client's message included), `wiki patch` and\n// `wiki interview` take an agent id from the caller, the daily\n// contributions can create pages, and mesh sync copies a peer's pages.\n// None of them asks the owner. So one unreviewed write could steer every\n// fresh session of that agent.\n//\n// The gate is off unless `wiki.decisionApprovals.required` is set. When on,\n// a decision page reaches that block only while its title and\n// body are exactly what the owner approved. The approval is kept outside\n// the pages, in `_decisions/approved.json` of the agent's wiki, which no\n// page write touches and the article index skips (`_` prefix). Any later\n// edit, by anyone, changes the hash, and the page waits for a new\n// approval. The owner approves from a terminal; the command refuses inside\n// an agent's run.\n\nimport { createHash } from \"crypto\"\nimport { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from \"fs\"\nimport { dirname, resolve } from \"path\"\nimport type { WikiArticle } from \"./types\"\n\nexport interface DecisionApproval {\n /** Hash of the title and body the owner approved. */\n hash: string\n approvedAt: string\n by: string\n /** The page's own `last_updated` when approved, for the listing. */\n lastUpdated?: string\n note?: string\n}\n\nexport type DecisionApprovals = Record<string, DecisionApproval>\n\n/** Where a wiki's approvals live. */\nexport function approvalsFile(wikiBaseDir: string): string {\n return resolve(wikiBaseDir, \"_decisions\", \"approved.json\")\n}\n\n/** What an approval covers: the title and the body, whitespace at the ends\n * ignored. Frontmatter dates and tags are not part of it. */\nexport function decisionHash(article: Pick<WikiArticle, \"meta\" | \"content\">): string {\n return createHash(\"sha256\")\n .update(`${article.meta.title ?? \"\"}\\n${(article.content ?? \"\").trim()}`)\n .digest(\"hex\")\n}\n\nexport function readApprovals(wikiBaseDir: string): DecisionApprovals {\n const file = approvalsFile(wikiBaseDir)\n if (!existsSync(file)) return {}\n try {\n const parsed = JSON.parse(readFileSync(file, \"utf-8\"))\n return parsed && typeof parsed === \"object\" && !Array.isArray(parsed) ? parsed as DecisionApprovals : {}\n } catch {\n return {} // unreadable: nothing counts as approved\n }\n}\n\nfunction writeApprovals(wikiBaseDir: string, all: DecisionApprovals): void {\n const file = approvalsFile(wikiBaseDir)\n mkdirSync(dirname(file), { recursive: true })\n const tmp = `${file}.${process.pid}.tmp`\n writeFileSync(tmp, JSON.stringify(all, null, 2) + \"\\n\")\n renameSync(tmp, file)\n}\n\nexport type DecisionState = \"approved\" | \"changed\" | \"waiting\"\n\n/** approved: the page is what the owner approved. changed: approved once,\n * edited since. waiting: never approved. */\nexport function decisionState(article: WikiArticle, approvals: DecisionApprovals): DecisionState {\n const a = approvals[article.path]\n if (!a) return \"waiting\"\n return a.hash === decisionHash(article) ? \"approved\" : \"changed\"\n}\n\n/** Decision pages as they may reach the owner-decisions block: approved\n * ones only. Other page types pass through unchanged. */\nexport function approvedDecisionsOnly(articles: WikiArticle[], approvals: DecisionApprovals): WikiArticle[] {\n return articles.filter((a) => a.meta.type !== \"decision\" || decisionState(a, approvals) === \"approved\")\n}\n\n/** What the owner-decisions block may read. With approvals not required\n * (the default, `wiki.decisionApprovals.required`), every page passes as\n * #1776 specifies; required, decision pages need the owner's approval. */\nexport function decisionsForBlock(articles: WikiArticle[], wikiBaseDir: string, required: boolean): WikiArticle[] {\n return required ? approvedDecisionsOnly(articles, readApprovals(wikiBaseDir)) : articles\n}\n\n/** The decision pages an agent's owner-decisions block considers: the pages\n * that agent may read (the wiki's access filter), old versions left out.\n * `wiki decisions list` and the block both read this set, so the list\n * never offers a page for approval that would not reach the agent (#1782). */\nexport function decisionPagesFor(store: { listArticles(agentId: string): WikiArticle[] }, agentId: string): WikiArticle[] {\n return store.listArticles(agentId).filter((a) => a.meta.type === \"decision\" && !a.path.includes(\"/_versions/\"))\n}\n\n/** Why the current process may not approve: inside an agent's run. */\nexport function approvalRefusal(env: NodeJS.ProcessEnv = process.env): string | null {\n if (env.AGENTX_AGENT_ID?.trim() || env.AGENTX_TASK_ID?.trim()) {\n return \"decision pages are approved by the owner from a terminal, not from inside an agent's run\"\n }\n return null\n}\n\nexport function approveDecision(\n wikiBaseDir: string,\n article: WikiArticle,\n opts: { by?: string; now?: number; note?: string } = {},\n): DecisionApproval {\n if (article.meta.type !== \"decision\") throw new Error(`${article.path} is not a decision page (type: ${article.meta.type ?? \"none\"})`)\n const all = readApprovals(wikiBaseDir)\n const approval: DecisionApproval = {\n hash: decisionHash(article),\n approvedAt: new Date(opts.now ?? Date.now()).toISOString(),\n by: opts.by || \"owner\",\n lastUpdated: article.meta.lastUpdated || undefined,\n ...(opts.note ? { note: opts.note } : {}),\n }\n all[article.path] = approval\n writeApprovals(wikiBaseDir, all)\n return approval\n}\n\n/** Remove an approval. True when there was one. */\nexport function revokeDecision(wikiBaseDir: string, path: string): boolean {\n const all = readApprovals(wikiBaseDir)\n if (!all[path]) return false\n delete all[path]\n writeApprovals(wikiBaseDir, all)\n return true\n}\n"],"mappings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AM,UAAU,CACxG,CAKO,SAASI,EAAkBD,EAAyBb,EAAqBe,EAAkC,CAChH,OAAOA,EAAWH,EAAsBC,EAAUV,EAAcH,CAAW,CAAC,EAAIa,CAClF,CAMO,SAASG,EAAiBC,EAAyDC,EAAgC,CACxH,OAAOD,EAAM,aAAaC,CAAO,EAAE,OAAQP,GAAMA,EAAE,KAAK,OAAS,YAAc,CAACA,EAAE,KAAK,SAAS,aAAa,CAAC,CAChH,CAGO,SAASQ,EAAgBC,EAAyB,QAAQ,IAAoB,CACnF,OAAIA,EAAI,iBAAiB,KAAK,GAAKA,EAAI,gBAAgB,KAAK,EACnD,2FAEF,IACT,CAEO,SAASC,EACdrB,EACAE,EACAoB,EAAqD,CAAC,EACpC,CAClB,GAAIpB,EAAQ,KAAK,OAAS,WAAY,MAAM,IAAI,MAAM,GAAGA,EAAQ,sCAAsCA,EAAQ,KAAK,MAAQ,SAAS,EACrI,IAAMK,EAAMJ,EAAcH,CAAW,EAC/BuB,EAA6B,CACjC,KAAMtB,EAAaC,CAAO,EAC1B,WAAY,IAAI,KAAKoB,EAAK,KAAO,KAAK,IAAI,CAAC,EAAE,YAAY,EACzD,GAAIA,EAAK,IAAM,QACf,YAAapB,EAAQ,KAAK,aAAe,OACzC,GAAIoB,EAAK,KAAO,CAAE,KAAMA,EAAK,IAAK,EAAI,CAAC,CACzC,EACA,OAAAf,EAAIL,EAAQ,IAAI,EAAIqB,EACpBjB,EAAeN,EAAaO,CAAG,EACxBgB,CACT,CAGO,SAASC,EAAexB,EAAqByB,EAAuB,CACzE,IAAMlB,EAAMJ,EAAcH,CAAW,EACrC,OAAKO,EAAIkB,CAAI,GACb,OAAOlB,EAAIkB,CAAI,EACfnB,EAAeN,EAAaO,CAAG,EACxB,IAHgB,EAIzB","names":["createHash","existsSync","mkdirSync","readFileSync","renameSync","writeFileSync","dirname","resolve","approvalsFile","wikiBaseDir","decisionHash","article","readApprovals","file","parsed","writeApprovals","all","tmp","decisionState","approvals","a","approvedDecisionsOnly","articles","decisionsForBlock","required","decisionPagesFor","store","agentId","approvalRefusal","env","approveDecision","opts","approval","revokeDecision","path"]}
|