agentix-cli 0.203.0 → 0.205.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-FQRHQT5J.js → App-JDW5V4HT.js} +2 -2
- package/dist/{ChatApp-WBCGSGJM.js → ChatApp-SNM2PORO.js} +2 -2
- package/dist/{absorb-eval-3IU37HZQ.js → absorb-eval-WDAV4AI2.js} +2 -2
- package/dist/{adapter-URFSOOFE.js → adapter-C47BTKT6.js} +2 -2
- package/dist/{agent-P7XUCP3A.js → agent-EVMKJXJO.js} +2 -2
- package/dist/{board-dashboard-MHZJRW3Z.js → board-dashboard-VSDTP4Y7.js} +531 -452
- package/dist/board-dashboard-VSDTP4Y7.js.map +1 -0
- package/dist/{chunk-WKR2OSCH.js → chunk-245IOYDJ.js} +2 -2
- package/dist/{chunk-FOWRNDMJ.js → chunk-2LJZHKTY.js} +2 -2
- package/dist/{chunk-P65XGEB7.js → chunk-2P3SHT5I.js} +2 -2
- package/dist/{chunk-JUSQMQ7L.js → chunk-2VSK6FAR.js} +2 -2
- package/dist/chunk-2YDG5CSS.js +2 -0
- package/dist/chunk-2YDG5CSS.js.map +1 -0
- package/dist/{chunk-T7WY5BSJ.js → chunk-5STGF4MI.js} +40 -40
- package/dist/chunk-5STGF4MI.js.map +1 -0
- package/dist/{chunk-SY7R5N7U.js → chunk-AK46ORUI.js} +2 -2
- package/dist/{chunk-JKT5EFXT.js → chunk-CXFVIDJV.js} +2 -2
- package/dist/{chunk-ZPCSPEGO.js → chunk-CZVCT5ZV.js} +2 -2
- package/dist/{chunk-Y2D6FQBL.js → chunk-DOO4MUTS.js} +2 -2
- package/dist/{chunk-RIBANO2H.js → chunk-DUCYRNCT.js} +3 -3
- package/dist/chunk-DUCYRNCT.js.map +1 -0
- package/dist/{chunk-HX4R7RPR.js → chunk-DV42WUMD.js} +2 -2
- package/dist/{chunk-CAYY2IEV.js → chunk-EFGAPAYZ.js} +2 -2
- package/dist/{chunk-MAQFWGFT.js → chunk-ERVJLPS4.js} +2 -2
- package/dist/{chunk-5VD2J4JN.js → chunk-GWBFEVLO.js} +2 -2
- package/dist/{chunk-IAR5F3T5.js → chunk-IDGEDPRJ.js} +2 -2
- package/dist/chunk-IFNXMUEG.js +115 -0
- package/dist/chunk-IFNXMUEG.js.map +1 -0
- package/dist/{chunk-SLX3OHEW.js → chunk-IU63JGY3.js} +2 -2
- package/dist/{chunk-7QW4RECS.js → chunk-JSCVOB4G.js} +2 -2
- package/dist/{chunk-RUNCUVAH.js → chunk-JT5PIBCM.js} +2 -2
- package/dist/{chunk-EQPMQSJE.js → chunk-KRHVM26D.js} +2 -2
- package/dist/{chunk-WIGH5WMP.js → chunk-KWZ6NMXZ.js} +9 -9
- package/dist/{chunk-VGYW3Q7F.js → chunk-OLKYIKAZ.js} +2 -2
- package/dist/{chunk-RB7M2NPU.js → chunk-PQUK6XEW.js} +2 -2
- package/dist/{chunk-PSOE356C.js → chunk-PQX2VJUA.js} +2 -2
- package/dist/{chunk-TV5BDCQA.js → chunk-PTZNM2JU.js} +2 -2
- package/dist/{chunk-M4VYHPDS.js → chunk-PW3WG6JT.js} +2 -2
- package/dist/{chunk-EMWSFITR.js → chunk-QASIUKZJ.js} +2 -2
- package/dist/{chunk-N6NZBAWR.js → chunk-RXX4MYFL.js} +2 -2
- package/dist/{chunk-C2VZHIIX.js → chunk-S5A7QZVQ.js} +2 -2
- package/dist/{chunk-BIYEGA7Q.js → chunk-S6YN3IBM.js} +2 -2
- package/dist/{chunk-CJI26AJC.js → chunk-SKCOIP5R.js} +3 -3
- package/dist/{chunk-V3FSKTDF.js → chunk-UGRMFQAG.js} +2 -2
- package/dist/{chunk-XPZSEDE3.js → chunk-WDGATQV3.js} +4 -4
- package/dist/{chunk-XPZSEDE3.js.map → chunk-WDGATQV3.js.map} +1 -1
- package/dist/{chunk-QOEO27LF.js → chunk-WJMYBRM5.js} +2 -2
- package/dist/chunk-X6SXZDTY.js +969 -0
- package/dist/chunk-X6SXZDTY.js.map +1 -0
- package/dist/{chunk-WK54XQAJ.js → chunk-ZUHUCSGT.js} +336 -328
- package/dist/chunk-ZUHUCSGT.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/{client-EOQLSAUW.js → client-WN7YI7DE.js} +2 -2
- package/dist/{config-SZZQFIJF.js → config-QUXKGIZX.js} +2 -2
- package/dist/{config-mutate-66VDWR46.js → config-mutate-HJH24ITC.js} +2 -2
- package/dist/{config-mutator-OILDQCAJ.js → config-mutator-OLLQR3ZD.js} +2 -2
- package/dist/connect-OOPPXAOD.js +2 -0
- package/dist/connect-OOPPXAOD.js.map +1 -0
- package/dist/{contributions-LRQCDZCQ.js → contributions-LL7B4BP3.js} +2 -2
- package/dist/daemon-api-QCBFGT7S.js +2 -0
- package/dist/daemon-api-QCBFGT7S.js.map +1 -0
- package/dist/{doctor-QASDCIQ5.js → doctor-WJ5H7QQW.js} +2 -2
- package/dist/{enrich-NIUEEGPA.js → enrich-MZMIQ3SV.js} +2 -2
- package/dist/{event-levels-D6QSANGF.js → event-levels-PCFARGKL.js} +2 -2
- package/dist/{follow-up-tool-QOO2TIQS.js → follow-up-tool-I2HTKMP4.js} +2 -2
- package/dist/{grants-3UVDASRI.js → grants-5GIY7347.js} +2 -2
- package/dist/{hub-6TKU6CHO.js → hub-7ASBN76I.js} +2 -2
- package/dist/index.d.ts +26 -14
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/org-tool-JCGGJJU6.js +2 -0
- package/dist/org-tool-JCGGJJU6.js.map +1 -0
- package/dist/{program-3DRLVXOO.js → program-7VNYZPRO.js} +238 -238
- package/dist/program-7VNYZPRO.js.map +1 -0
- package/dist/{promote-D3KYLUBD.js → promote-NSPUPPHB.js} +2 -2
- package/dist/providers-D6IUAHQJ.js +2 -0
- package/dist/{query-D2TQ2PUO.js → query-VW63IHDI.js} +2 -2
- package/dist/{query-settings-ILDX3HDF.js → query-settings-RS7DJI4H.js} +2 -2
- package/dist/{registry-N3BY3HSI.js → registry-6KREAROB.js} +2 -2
- package/dist/{request-planner-CVCG5XQR.js → request-planner-HZWQIRZO.js} +2 -2
- package/dist/resolve-LOYZUE2D.js +2 -0
- package/dist/{review-candidates-CKUN4PSY.js → review-candidates-2TXOUASP.js} +2 -2
- package/dist/{routing-OCIRGUKK.js → routing-ZV4VSZDV.js} +2 -2
- package/dist/{rules-A5ES57QT.js → rules-FBOLGE2S.js} +2 -2
- package/dist/schedule-tool-D357NLXS.js +2 -0
- package/dist/{scheduler-D2Z7RSEE.js → scheduler-SAID6RKQ.js} +2 -2
- package/dist/{seat-Z3E2FLDA.js → seat-XHBWBSTS.js} +2 -2
- package/dist/{select-J4ES7Q67.js → select-QUCTTAH3.js} +2 -2
- package/dist/{set-enabled-S22TICYC.js → set-enabled-CGMXLFC6.js} +2 -2
- package/dist/{sprint-tool-NDF47EKV.js → sprint-tool-SWRYSX3Q.js} +2 -2
- package/dist/status-PVYFTNX2.js +2 -0
- package/dist/{tool-6NZIUXI7.js → tool-6G63ZQW4.js} +2 -2
- package/dist/{tool-RCCMOMEY.js → tool-DA25L4ND.js} +2 -2
- package/dist/{tool-52JRXZVA.js → tool-ELGOVIM5.js} +2 -2
- package/dist/{tool-Z2OVFGWW.js → tool-MMH2JNP7.js} +2 -2
- package/dist/{wiki-HQKFZZSX.js → wiki-4ZL4QXA7.js} +2 -2
- package/dist/wiki-enrich-N5MUKDVW.js +2 -0
- package/dist/workspace-setup-QXFJRNSK.js +2 -0
- package/package.json +1 -1
- package/dist/board-dashboard-MHZJRW3Z.js.map +0 -1
- package/dist/chunk-FCDMB2JA.js +0 -936
- package/dist/chunk-FCDMB2JA.js.map +0 -1
- package/dist/chunk-GDHSJH3T.js +0 -111
- package/dist/chunk-GDHSJH3T.js.map +0 -1
- package/dist/chunk-RIBANO2H.js.map +0 -1
- package/dist/chunk-T7WY5BSJ.js.map +0 -1
- package/dist/chunk-U2WAIDSM.js +0 -2
- package/dist/chunk-U2WAIDSM.js.map +0 -1
- package/dist/chunk-WK54XQAJ.js.map +0 -1
- package/dist/connect-JIWRIGVI.js +0 -2
- package/dist/connect-JIWRIGVI.js.map +0 -1
- package/dist/daemon-api-JBXTSPB6.js +0 -2
- package/dist/daemon-api-JBXTSPB6.js.map +0 -1
- package/dist/program-3DRLVXOO.js.map +0 -1
- package/dist/providers-P76CWTGQ.js +0 -2
- package/dist/resolve-JKXYBZ6R.js +0 -2
- package/dist/schedule-tool-YFMRYTEO.js +0 -2
- package/dist/status-PKHYFGZK.js +0 -2
- package/dist/wiki-enrich-7SZ5W2LF.js +0 -2
- package/dist/workspace-setup-W5UO2WZI.js +0 -2
- /package/dist/{App-FQRHQT5J.js.map → App-JDW5V4HT.js.map} +0 -0
- /package/dist/{ChatApp-WBCGSGJM.js.map → ChatApp-SNM2PORO.js.map} +0 -0
- /package/dist/{absorb-eval-3IU37HZQ.js.map → absorb-eval-WDAV4AI2.js.map} +0 -0
- /package/dist/{adapter-URFSOOFE.js.map → adapter-C47BTKT6.js.map} +0 -0
- /package/dist/{agent-P7XUCP3A.js.map → agent-EVMKJXJO.js.map} +0 -0
- /package/dist/{chunk-WKR2OSCH.js.map → chunk-245IOYDJ.js.map} +0 -0
- /package/dist/{chunk-FOWRNDMJ.js.map → chunk-2LJZHKTY.js.map} +0 -0
- /package/dist/{chunk-P65XGEB7.js.map → chunk-2P3SHT5I.js.map} +0 -0
- /package/dist/{chunk-JUSQMQ7L.js.map → chunk-2VSK6FAR.js.map} +0 -0
- /package/dist/{chunk-SY7R5N7U.js.map → chunk-AK46ORUI.js.map} +0 -0
- /package/dist/{chunk-JKT5EFXT.js.map → chunk-CXFVIDJV.js.map} +0 -0
- /package/dist/{chunk-ZPCSPEGO.js.map → chunk-CZVCT5ZV.js.map} +0 -0
- /package/dist/{chunk-Y2D6FQBL.js.map → chunk-DOO4MUTS.js.map} +0 -0
- /package/dist/{chunk-HX4R7RPR.js.map → chunk-DV42WUMD.js.map} +0 -0
- /package/dist/{chunk-CAYY2IEV.js.map → chunk-EFGAPAYZ.js.map} +0 -0
- /package/dist/{chunk-MAQFWGFT.js.map → chunk-ERVJLPS4.js.map} +0 -0
- /package/dist/{chunk-5VD2J4JN.js.map → chunk-GWBFEVLO.js.map} +0 -0
- /package/dist/{chunk-IAR5F3T5.js.map → chunk-IDGEDPRJ.js.map} +0 -0
- /package/dist/{chunk-SLX3OHEW.js.map → chunk-IU63JGY3.js.map} +0 -0
- /package/dist/{chunk-7QW4RECS.js.map → chunk-JSCVOB4G.js.map} +0 -0
- /package/dist/{chunk-RUNCUVAH.js.map → chunk-JT5PIBCM.js.map} +0 -0
- /package/dist/{chunk-EQPMQSJE.js.map → chunk-KRHVM26D.js.map} +0 -0
- /package/dist/{chunk-WIGH5WMP.js.map → chunk-KWZ6NMXZ.js.map} +0 -0
- /package/dist/{chunk-VGYW3Q7F.js.map → chunk-OLKYIKAZ.js.map} +0 -0
- /package/dist/{chunk-RB7M2NPU.js.map → chunk-PQUK6XEW.js.map} +0 -0
- /package/dist/{chunk-PSOE356C.js.map → chunk-PQX2VJUA.js.map} +0 -0
- /package/dist/{chunk-TV5BDCQA.js.map → chunk-PTZNM2JU.js.map} +0 -0
- /package/dist/{chunk-M4VYHPDS.js.map → chunk-PW3WG6JT.js.map} +0 -0
- /package/dist/{chunk-EMWSFITR.js.map → chunk-QASIUKZJ.js.map} +0 -0
- /package/dist/{chunk-N6NZBAWR.js.map → chunk-RXX4MYFL.js.map} +0 -0
- /package/dist/{chunk-C2VZHIIX.js.map → chunk-S5A7QZVQ.js.map} +0 -0
- /package/dist/{chunk-BIYEGA7Q.js.map → chunk-S6YN3IBM.js.map} +0 -0
- /package/dist/{chunk-CJI26AJC.js.map → chunk-SKCOIP5R.js.map} +0 -0
- /package/dist/{chunk-V3FSKTDF.js.map → chunk-UGRMFQAG.js.map} +0 -0
- /package/dist/{chunk-QOEO27LF.js.map → chunk-WJMYBRM5.js.map} +0 -0
- /package/dist/{client-EOQLSAUW.js.map → client-WN7YI7DE.js.map} +0 -0
- /package/dist/{config-SZZQFIJF.js.map → config-QUXKGIZX.js.map} +0 -0
- /package/dist/{config-mutate-66VDWR46.js.map → config-mutate-HJH24ITC.js.map} +0 -0
- /package/dist/{config-mutator-OILDQCAJ.js.map → config-mutator-OLLQR3ZD.js.map} +0 -0
- /package/dist/{contributions-LRQCDZCQ.js.map → contributions-LL7B4BP3.js.map} +0 -0
- /package/dist/{doctor-QASDCIQ5.js.map → doctor-WJ5H7QQW.js.map} +0 -0
- /package/dist/{enrich-NIUEEGPA.js.map → enrich-MZMIQ3SV.js.map} +0 -0
- /package/dist/{event-levels-D6QSANGF.js.map → event-levels-PCFARGKL.js.map} +0 -0
- /package/dist/{follow-up-tool-QOO2TIQS.js.map → follow-up-tool-I2HTKMP4.js.map} +0 -0
- /package/dist/{grants-3UVDASRI.js.map → grants-5GIY7347.js.map} +0 -0
- /package/dist/{hub-6TKU6CHO.js.map → hub-7ASBN76I.js.map} +0 -0
- /package/dist/{promote-D3KYLUBD.js.map → promote-NSPUPPHB.js.map} +0 -0
- /package/dist/{providers-P76CWTGQ.js.map → providers-D6IUAHQJ.js.map} +0 -0
- /package/dist/{query-D2TQ2PUO.js.map → query-VW63IHDI.js.map} +0 -0
- /package/dist/{query-settings-ILDX3HDF.js.map → query-settings-RS7DJI4H.js.map} +0 -0
- /package/dist/{registry-N3BY3HSI.js.map → registry-6KREAROB.js.map} +0 -0
- /package/dist/{request-planner-CVCG5XQR.js.map → request-planner-HZWQIRZO.js.map} +0 -0
- /package/dist/{resolve-JKXYBZ6R.js.map → resolve-LOYZUE2D.js.map} +0 -0
- /package/dist/{review-candidates-CKUN4PSY.js.map → review-candidates-2TXOUASP.js.map} +0 -0
- /package/dist/{routing-OCIRGUKK.js.map → routing-ZV4VSZDV.js.map} +0 -0
- /package/dist/{rules-A5ES57QT.js.map → rules-FBOLGE2S.js.map} +0 -0
- /package/dist/{schedule-tool-YFMRYTEO.js.map → schedule-tool-D357NLXS.js.map} +0 -0
- /package/dist/{scheduler-D2Z7RSEE.js.map → scheduler-SAID6RKQ.js.map} +0 -0
- /package/dist/{seat-Z3E2FLDA.js.map → seat-XHBWBSTS.js.map} +0 -0
- /package/dist/{select-J4ES7Q67.js.map → select-QUCTTAH3.js.map} +0 -0
- /package/dist/{set-enabled-S22TICYC.js.map → set-enabled-CGMXLFC6.js.map} +0 -0
- /package/dist/{sprint-tool-NDF47EKV.js.map → sprint-tool-SWRYSX3Q.js.map} +0 -0
- /package/dist/{status-PKHYFGZK.js.map → status-PVYFTNX2.js.map} +0 -0
- /package/dist/{tool-6NZIUXI7.js.map → tool-6G63ZQW4.js.map} +0 -0
- /package/dist/{tool-RCCMOMEY.js.map → tool-DA25L4ND.js.map} +0 -0
- /package/dist/{tool-52JRXZVA.js.map → tool-ELGOVIM5.js.map} +0 -0
- /package/dist/{tool-Z2OVFGWW.js.map → tool-MMH2JNP7.js.map} +0 -0
- /package/dist/{wiki-HQKFZZSX.js.map → wiki-4ZL4QXA7.js.map} +0 -0
- /package/dist/{wiki-enrich-7SZ5W2LF.js.map → wiki-enrich-N5MUKDVW.js.map} +0 -0
- /package/dist/{workspace-setup-W5UO2WZI.js.map → workspace-setup-QXFJRNSK.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import t from"chalk";import{spawn as S}from"child_process";import{resolve as j}from"path";var E=l=>l||j(process.cwd(),".agentx/wiki");function N(l){return async d=>{let{claudeCliEnv:e}=await import("./workspace-env-UOK5MMKD.js"),h=["-p","-","--output-format","json","--max-turns","1","--model",l,"--tools","","--strict-mcp-config","--mcp-config",'{"mcpServers":{}}',"--settings",'{"disableAllHooks":true}',"--setting-sources","","--no-session-persistence"],y=await new Promise(($,a)=>{let s=S("claude",h,{env:e(),stdio:["pipe","pipe","pipe"]}),p="",g="",i=setTimeout(()=>s.kill("SIGTERM"),24e4);s.stdout.on("data",r=>{p+=r}),s.stderr.on("data",r=>{g+=r}),s.on("error",r=>{clearTimeout(i),a(r)}),s.on("close",r=>{clearTimeout(i),r===0?$(p):a(new Error(`claude exited ${r}: ${g.trim().slice(0,200)}`))}),s.stdin.end(d)}),c=JSON.parse(y);if(c.is_error)throw new Error(`model error: ${String(c.result).slice(0,200)}`);return{text:String(c.result??""),costUsd:Number(c.total_cost_usd)||0}}}function I(l){l.command("enrich [entities...]").description("write a full overview, sourced typed facts and linked history on entity pages (person, organization, project, place, assets)").option("--dir <path>","wiki directory (default .agentx/wiki)").option("--types <list>","comma-separated entity types","person,organization,project,place,device,server,app,domain,account").option("--max <n>","most entities per run","10").option("--max-cost <usd>","stop before the next call once the run spent this much","1").option("--model <m>","model","sonnet").option("--force","redo entities whose sources did not change").option("--dry-run","show what would be written, write nothing").option("--create <title>","first create a page for a thing other pages only name, then enrich it (needs --as and --owner)").option("--as <type>","type of the page --create makes, e.g. organization").option("--owner <agent>","agent whose wiki gets the page --create makes").option("--json","print the run as JSON").action(async(d,e)=>{let{WikiHub:h}=await import("./hub-
|
|
1
|
+
import t from"chalk";import{spawn as S}from"child_process";import{resolve as j}from"path";var E=l=>l||j(process.cwd(),".agentx/wiki");function N(l){return async d=>{let{claudeCliEnv:e}=await import("./workspace-env-UOK5MMKD.js"),h=["-p","-","--output-format","json","--max-turns","1","--model",l,"--tools","","--strict-mcp-config","--mcp-config",'{"mcpServers":{}}',"--settings",'{"disableAllHooks":true}',"--setting-sources","","--no-session-persistence"],y=await new Promise(($,a)=>{let s=S("claude",h,{env:e(),stdio:["pipe","pipe","pipe"]}),p="",g="",i=setTimeout(()=>s.kill("SIGTERM"),24e4);s.stdout.on("data",r=>{p+=r}),s.stderr.on("data",r=>{g+=r}),s.on("error",r=>{clearTimeout(i),a(r)}),s.on("close",r=>{clearTimeout(i),r===0?$(p):a(new Error(`claude exited ${r}: ${g.trim().slice(0,200)}`))}),s.stdin.end(d)}),c=JSON.parse(y);if(c.is_error)throw new Error(`model error: ${String(c.result).slice(0,200)}`);return{text:String(c.result??""),costUsd:Number(c.total_cost_usd)||0}}}function I(l){l.command("enrich [entities...]").description("write a full overview, sourced typed facts and linked history on entity pages (person, organization, project, place, assets)").option("--dir <path>","wiki directory (default .agentx/wiki)").option("--types <list>","comma-separated entity types","person,organization,project,place,device,server,app,domain,account").option("--max <n>","most entities per run","10").option("--max-cost <usd>","stop before the next call once the run spent this much","1").option("--model <m>","model","sonnet").option("--force","redo entities whose sources did not change").option("--dry-run","show what would be written, write nothing").option("--create <title>","first create a page for a thing other pages only name, then enrich it (needs --as and --owner)").option("--as <type>","type of the page --create makes, e.g. organization").option("--owner <agent>","agent whose wiki gets the page --create makes").option("--json","print the run as JSON").action(async(d,e)=>{let{WikiHub:h}=await import("./hub-7ASBN76I.js"),{GraphCache:y}=await import("./graph-ZVKV3JBD.js"),{loadOntology:c}=await import("./load-Q3HCFXDT.js"),{loadRoster:$}=await import("./roster-BZGKG2ZA.js"),{ENRICH_TYPES:a,loadEnrichState:s,runEnrich:p,saveEnrichState:g}=await import("./enrich-MZMIQ3SV.js"),i=E(e.dir),r=e.types.split(",").map(o=>o.trim()).filter(Boolean),b=r.filter(o=>!a.includes(o));if(b.length){console.error(t.red(` not an entity type this job handles: ${b.join(", ")} (use ${a.join(", ")})`)),process.exitCode=1;return}let x=Number(e.max);if(!Number.isInteger(x)||x<1){console.error(t.red(" --max must be a whole number of entities, 1 or more")),process.exitCode=1;return}let w=Number(e.maxCost);if(!Number.isFinite(w)||w<=0){console.error(t.red(" --max-cost must be a positive number of dollars")),process.exitCode=1;return}let m=new h(i,()=>{});if(e.create){let{createEntityPage:o}=await import("./enrich-MZMIQ3SV.js");if(!e.as||!a.includes(e.as)||!e.owner){console.error(t.red(` --create needs --as <${a.join("|")}> and --owner <agent>`)),process.exitCode=1;return}if(m.syncedFrom(e.owner)){console.error(t.red(` ${e.owner}'s pages are copied from another node; pick an agent that runs here`)),process.exitCode=1;return}if(e.dryRun)console.log(t.dim(` --dry-run: would create "${e.create}" (${e.as}) in ${e.owner}'s wiki`));else{let f=o(m,e.create,e.as,e.owner,new Date().toISOString().slice(0,10));console.log(f?t.green(` created ${e.owner}/${f}`):t.dim(` ${e.owner} already has a page titled "${e.create}"`))}d=[...d,e.create],r.includes(e.as)||r.push(e.as)}let{ontology:v}=c(i),k=new y().get(m,v,$(i,m.listAgents([]),v.agent_names)),C=s(i),u=await p(m,k,N(e.model),{types:r,only:d,max:x,maxCostUsd:w,dryRun:!!e.dryRun,force:!!e.force,today:new Date().toISOString().slice(0,10),save:o=>g(i,o)},C);if(e.json){console.log(JSON.stringify(u,null,2));return}for(let o of u.outcomes){let f=o.status==="written"?t.green("\u2713"):o.status==="dry-run"?t.cyan("~"):t.yellow("\xB7");console.log(` ${f} ${o.title} ${t.dim(`${o.status} \xB7 ${o.page??"no page"} \xB7 overview ${o.overview?"yes":"no"} \xB7 ${o.statements} facts \xB7 ${o.links} links \xB7 $${o.costUsd.toFixed(3)}`)}`);for(let n of o.facts??[])console.log(t.dim(` fact: ${n.property} \u2192 ${n.value}${n.role?` (${n.role})`:""} \xB7 source ${n.source}`));for(let n of o.dropped.slice(0,6))console.log(t.dim(` dropped: ${n}`));o.preview&&console.log(t.dim(o.preview.split(`
|
|
2
2
|
`).slice(0,12).map(n=>` | ${n}`).join(`
|
|
3
3
|
`)))}u.outcomes.length===0&&console.log(t.dim(" nothing to do: no entity of these types changed since the last run (--force redoes them)")),console.log(t.dim(` spent $${u.costUsd.toFixed(3)} of $${w}${u.capped?" \xB7 stopped at the cap":""}`))})}export{N as a,I as b};
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
4
|
+
//# sourceMappingURL=chunk-DV42WUMD.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as
|
|
1
|
+
import{f as h}from"./chunk-QAWKN2N4.js";import{f as j,g}from"./chunk-DODL5POT.js";import{a as z}from"./chunk-IMLAPB7G.js";function E(o,t){return o.ontology.types.find(e=>e.id===t)?.lens??[{panel:"notes",source:"notes",show:1}]}function v(o,t,e){let a=o.ontology.properties.find(n=>n.id===t);return a?e?a.inverse??a.label:a.label:t.replace(/_/g," ")}function G(o,t){let e=o.until??o.date??o.since??"",a=t.until??t.date??t.since??"";return e!==a?a.localeCompare(e):o.label.localeCompare(t.label)}function R(o,t,e,a,n){let r=a?n:e.target?o.entities.get(e.target):void 0,i=[v(o,e.property,a)];return e.role&&i.unshift(e.role.length>40?`${e.role.slice(0,39)}\u2026`:e.role),{label:r?.title??e.value,entityId:r?.id,type:r?.type,chips:i,since:e.since,until:e.until,status:e.status,private:e.access==="private",statement:a?void 0:t.statements.indexOf(e),sub:e.note}}function H(o,t,e){let a=new Set(j(e)),n=e.types?new Set(e.types):null,r=[],i=new Set,s=x=>!n||!!x&&n.has(x.type);for(let x of t.statements){if(!a.has(x.property))continue;let d=x.target?o.entities.get(x.target):void 0;s(d)&&(r.push(R(o,t,x,!1)),d&&i.add(d.id))}for(let x of o.incoming.get(t.id)??[]){if(!a.has(x.property))continue;let d=o.entities.get(x.from);!d||!s(d)||(x.statement?r.push(R(o,t,x.statement,!0,d)):i.has(d.id)||r.push({label:d.title,entityId:d.id,type:d.type,chips:[v(o,"related",!0)],date:d.updated}),i.add(d.id))}if(a.has("related"))for(let x of o.outgoing.get(t.id)??[]){if(x.property!=="related"||i.has(x.to))continue;let d=o.entities.get(x.to);!d||!s(d)||(r.push({label:d.title,entityId:d.id,type:d.type,chips:[v(o,"related",!1)],date:d.updated}),i.add(d.id))}let c=r.filter(x=>!x.chips.includes(v(o,"related",!1))),p=r.filter(x=>x.chips.includes(v(o,"related",!1)));return[...c.sort(G),...p.sort(G)]}function I(o,t,e){let a=new Set;for(let r of o.outgoing.get(t.id)??[])a.add(r.to);for(let r of o.incoming.get(t.id)??[])a.add(r.from);let n=[];for(let r of a){let i=o.entities.get(r);i&&(!e||e.has(i.type))&&n.push(i)}return n.sort((r,i)=>(i.date||i.updated).localeCompare(r.date||r.updated))}function M(o){return{label:o.title,entityId:o.id,type:o.type,chips:[],date:o.date,importance:o.importance}}function T(o,t,e){let a=I(o,t,new Set(["event"])).map(M),n=new Set(e.importance??["major","normal","minor"]),r=a.filter(p=>n.has(p.importance??o.ontology.importance.default)),i=e.fold?a.filter(p=>p.importance===e.fold):[],s=[],c=e.rollup??o.ontology.importance.rollup;if(i.length>=c.min&&i[0].date){let p=Date.parse(i[0].date),x=i.filter(d=>d.date&&p-Date.parse(d.date)<=c.days*864e5);x.length>=c.min&&s.push(`${x.length} minor events in ${c.days} days up to ${i[0].date}`)}return{shown:r,folded:i,rollups:s}}function V(o,t){let e=o.statements.map((r,i)=>({st:r,i})).filter(({st:r})=>r.property==="reading"||!!r.metric).sort((r,i)=>(i.st.at??"").localeCompare(r.st.at??"")),a=new Set,n=[];for(let{st:r,i}of e){let s=r.metric??"reading";t&&a.has(s)||(a.add(s),n.push({label:`${s.replace(/_/g," ")}: ${r.value}`,chips:[],date:r.at,statement:i,private:r.access==="private"}))}return n}function B(o,t){return t(o.sources).sort((e,a)=>a.date.localeCompare(e.date)).map(e=>{let a=e.content.split(`
|
|
2
2
|
`).map(n=>n.trim()).find(Boolean)??"";return{label:a.length>120?`${a.slice(0,117)}\u2026`:a,chips:[],date:e.date,sub:`${e.date} \xB7 ${e.agentId} \xB7 ${e.source}`}})}function P(o,t,e,a){let n=g(e),r=[],i=[],s=[];if(n==="statements")r=H(o,t,e);else if(n==="linked")r=I(o,t,e.types?new Set(e.types):null).map(M);else if(n==="readings")r=V(t,!a.full&&e.latest!==!1);else if(n==="discussed")r=B(t,a.readEntries);else if(n==="history"){let p=T(o,t,e);r=a.full?I(o,t,new Set(["event"])).map(M):p.shown,i=a.full?[]:p.folded,s=p.rollups}let c=r.length;if(a.full){let p=a.pageSize??50,x=Math.max(1,a.page??1);r=r.slice((x-1)*p,x*p)}else r=r.slice(0,e.show??5);return{def:e,title:e.title??e.panel.replace(/_/g," "),items:r,total:c,folded:i,rollups:s,ownerOnly:e.access==="owner"}}function l(o){return String(o??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}var O={home:'<rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/>',person:'<circle cx="12" cy="8" r="4"/><path d="M4 21c0-4 4-6 8-6s8 2 8 6"/>',org:'<rect x="4" y="3" width="16" height="18" rx="2"/><path d="M9 7h2M13 7h2M9 11h2M13 11h2M9 15h2M13 15h2"/>',pin:'<path d="M12 21s-7-6.2-7-11a7 7 0 0 1 14 0c0 4.8-7 11-7 11z"/><circle cx="12" cy="10" r="2.5"/>',server:'<rect x="3" y="4" width="18" height="7" rx="2"/><rect x="3" y="13" width="18" height="7" rx="2"/><path d="M7 7.5h.01M7 16.5h.01"/>',device:'<rect x="4" y="5" width="16" height="11" rx="1.5"/><path d="M2 19h20"/>',app:'<rect x="4" y="4" width="16" height="16" rx="3"/><path d="M9 12h6M12 9v6"/>',globe:'<circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3c3 3.5 3 14.5 0 18M12 3c-3 3.5-3 14.5 0 18"/>',key:'<circle cx="8" cy="15" r="4"/><path d="M11 12l9-9M17 6l3 3"/>',agent:'<rect x="5" y="8" width="14" height="11" rx="3"/><path d="M12 4v4M9 13h.01M15 13h.01"/>',project:'<path d="M12 3l8 4.5v9L12 21l-8-4.5v-9z"/><path d="M4 7.5l8 4.5 8-4.5M12 12v9"/>',contract:'<path d="M7 3h7l5 5v13H7z"/><path d="M14 3v5h5M10 13h6M10 17h4"/>',law:'<path d="M12 3v18M5 21h14M6 7h12M6 7l-3 7a3 3 0 0 0 6 0zM18 7l-3 7a3 3 0 0 0 6 0z"/>',calendar:'<rect x="3" y="5" width="18" height="16" rx="2"/><path d="M3 10h18M8 3v4M16 3v4"/>',decision:'<path d="M12 3v18M12 8H6l-2 2 2 2h6M12 12h6l2 2-2 2h-6"/>',steps:'<path d="M9 6h11M9 12h11M9 18h11M4 6l1 1 2-2M4 12l1 1 2-2M4 18l1 1 2-2"/>',topic:'<path d="M4 7h16M4 12h10M4 17h7"/>',chat:'<path d="M4 5h16v11H9l-5 4z"/>',lock:'<rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V8a4 4 0 0 1 8 0v3"/>',arrow:'<path d="M5 12h14M13 6l6 6-6 6"/>',search:'<circle cx="11" cy="11" r="7"/><path d="M21 21l-4.3-4.3"/>',merge:'<circle cx="6" cy="6" r="2"/><circle cx="6" cy="18" r="2"/><circle cx="18" cy="12" r="2"/><path d="M6 8v8M8 6c6 0 8 2 8 6"/>'};function m(o){return`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${O[o??""]??O.topic}</svg>`}function u(o,t){return m(o.types.find(e=>e.id===t)?.icon)}function b(o,t){return o.types.find(e=>e.id===t)?.label??t??""}function f(o){return`/e/${encodeURIComponent(o)}`}function L(o){return`<nav class="ox-crumbs" aria-label="Breadcrumb">${[{label:"Wiki",href:"/"},...o].map((e,a,n)=>a===n.length-1||!e.href?`<b>${l(e.label)}</b>`:`<a href="${e.href}">${l(e.label)}</a>`).join('<span aria-hidden="true">/</span>')}</nav>`}function y(o){let t=["","Pillar","Overview","Panel","Statement"];return`<div class="ox-zoom" title="Zoom level">${[1,2,3,4].map(a=>`<span class="${a===o?"on":""}">Z${a}${a===o?` ${t[a]}`:""}</span>`).join("")}</div>`}function w(o,t){let e=o.ontology,a=`<a class="ox-nav${t.home?" on":""}" href="/">${m("home")}<span>Home</span></a>`,n=e.sidebar.pins.slice(0,e.sidebar.pins_max);if(n.length){a+='<div class="ox-side-h">Pinned</div>';for(let r of n){let i=o.names.get(h(r)),s=i?o.entities.get(i):void 0;s&&(a+=`<a class="ox-nav pin${t.entity===s.id?" on":""}" href="${f(s.id)}">${u(e,s.type)}<span>${l(s.title)}</span></a>`)}}a+='<div class="ox-side-h">Pillars</div>';for(let r of e.pillars)r.sidebar!==!1&&(a+=`<a class="ox-nav${t.pillar===r.id?" on":""}" href="/p/${encodeURIComponent(r.id)}">${m(r.icon)}<span>${l(r.label)}</span></a>`);return a+='<div class="ox-side-foot">Types, topics and agent wikis are one level down, on Home and the pillar pages.</div>',a}function $(o,t,e,a="",n=""){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
@@ -149,4 +149,4 @@ body>a[href="/admin"]+.ox-app .ox-top{padding-right:130px}
|
|
|
149
149
|
`;var F=()=>new Date().toISOString().slice(0,10);function q(o){return o?`<span class="ox-st ${l(o)}">${l(o)}</span>`:""}function K(o){return o.private?`<span class="l"><span class="ox-mask">\u2022\u2022\u2022\u2022</span> ${m("lock")}</span>`:o.entityId?`<a href="${f(o.entityId)}">${l(o.label)}</a>`:`<span class="l">${l(o.label)}</span>`}function J(o,t){if(t.sub)return t.sub;let e=[];return t.type&&e.push(b(o.ontology,t.type).toLowerCase()),t.since||t.until?e.push(`${t.since??"\u2026"} \u2192 ${t.until??"now"}`):t.date&&e.push(t.date),e.join(" \xB7 ")}function Y(o,t,e){let a=J(o,e),n=e.chips.map(i=>`<span class="ox-chip">${l(i)}</span>`).join(""),r=e.statement!==void 0&&e.statement>=0?`<a class="ox-sub" href="${f(t.id)}/s/${e.statement}" title="Where this comes from (Z4)">Z4</a>`:"";return`<div class="ox-row"><span class="ox-ic">${e.type?u(o.ontology,e.type):m(e.private?"lock":"topic")}</span><div class="t">${K(e)}${a?`<div class="ox-sub">${l(a)}</div>`:""}</div><div class="r">${n}${q(e.status)}${r}</div></div>`}function U(o){let t=o.importance??"normal";return`<div class="ox-ev"><span class="d">${l(o.date??"")}</span><span class="ox-st ${t}">${t}</span><span>${o.entityId?`<a href="${f(o.entityId)}">${l(o.label)}</a>`:l(o.label)}</span></div>`}function Q(o){let t=o.flatMap(s=>[s.since,s.until]).filter(s=>!!s).map(s=>Number(s.slice(0,4))).filter(Boolean),e=Number(F().slice(0,4)),a=Math.min(...t,e-1),n=Math.max(1,e+1-a),r=(s,c)=>{if(!s)return c?100:0;let[p,x]=[Number(s.slice(0,4)),Number(s.slice(5,7))||(c?12:1)];return Math.min(100,Math.max(0,(p-a+(x-1)/12)/n*100))},i=`<div class="ox-tl-axis"><span></span><span class="yrs"><span>${a}</span><span>${e}</span></span></div>`;for(let s of o){let c=r(s.since,!1),p=r(s.until,!0),x=`${s.since??"\u2026"} \u2192 ${s.until??"now"}`;i+=`<div class="ox-tl-row"><div class="who">${s.chips.map(l).join(", ")}<small>${s.entityId?`<a href="${f(s.entityId)}">${l(s.label)}</a>`:l(s.label)}</small></div><div class="ox-track"><i class="${s.until?"past":""}" style="left:${c.toFixed(1)}%;width:${Math.max(4,p-c).toFixed(1)}%" title="${l(x)}">${l(x)}</i></div></div>`}return i}function S(o,t,e,a,n=""){let r=!a&&(e.total>e.items.length||e.def.source==="notes"||e.folded.length)?`<a class="zin" href="${f(t.id)}/${encodeURIComponent(e.def.panel)}">all ${e.total||""} (Z3) \u2192</a>`:"",s=e.def.source==="notes"||e.def.panel==="notes"?`${t.pages.length} page${t.pages.length===1?"":"s"}`:`${e.total} ${e.total===1?"item":"items"}`,c=`<span class="note">${e.ownerOnly?`${m("lock")} private to the owner \xB7 `:""}${s}</span>`,p="";e.def.source==="notes"||e.def.panel==="notes"?p=n||'<div class="ox-empty">No notes.</div>':e.items.length===0?p='<div class="ox-empty">Nothing recorded yet.</div>':e.def.display==="timeline"&&e.items.some(d=>d.since)?p=Q(e.items):e.def.source==="history"||e.items.every(d=>d.type==="event")?p=e.items.map(U).join(""):p=e.items.map(d=>Y(o,t,d)).join("");for(let d of e.rollups)p+=`<div class="ox-fold">\u21BB Recurring: ${l(d)}</div>`;return e.folded.length&&(p+=`<details class="ox-fold"><summary>+ ${e.folded.length} minor event${e.folded.length===1?"":"s"}</summary>${e.folded.slice(0,20).map(U).join("")}</details>`),`<section class="ox-card${e.def.display==="timeline"||e.def.source==="notes"||e.def.panel==="notes"?" wide":""}"><div class="ox-card-h"><h2>${l(e.title)}</h2>${c}${r}</div>${p}</section>`}function C(o,t){return z(t.replace(/<!--\s*tags?:[^>]*-->\s*\n?/gi,"").replace(/<!-- \/overview -->\s*\n?/g,""),{wikilink:(e,a)=>{let n=o.names.get(h(e));return n?`<a href="${f(n)}" class="wikilink">${a}</a>`:`<a href="/find?q=${encodeURIComponent(e)}" class="wikilink broken" title="No page yet">${a}</a>`}})}function k(o){return o.replace(/^---\n[\s\S]*?\n---\n?/,"").trim()}var X=/^##[ \t]+Overview[ \t]*$/im,N="<!-- /overview -->";function D(o){let t=X.exec(o);if(!t)return;let e=t.index+t[0].length,a=o.slice(e),n=a.indexOf(N),r=a.search(/^#{1,2}[ \t]/m),i=[n,r].filter(p=>p>=0),s=e+(i.length?Math.min(...i):a.length),c=n>=0&&e+n===s?s+N.length:s;return{start:t.index,textStart:e,end:s,after:c}}function ee(o){let t=k(o),e=D(t);return(e?t.slice(e.textStart,e.end).trim():"")||void 0}function te(o){let t=[...o.pages].sort((e,a)=>(a.article.meta.lastUpdated||"").localeCompare(e.article.meta.lastUpdated||""));for(let e of t){let a=ee(e.article.content);if(a)return a}}function oe(o,t){if(o.length<=t)return o;let e=o.slice(0,t),a=Math.max(...[". ","! ","? ","\u061F ","\u3002"].map(n=>e.lastIndexOf(n)));return a>t/3?e.slice(0,a+1):`${e.replace(/\s+\S*$/,"")}\u2026`}function ne(o,t=360){let n=(k(o.pages[0]?.article.content??"").split(/\n\s*\n/).map(r=>r.trim()).find(r=>r&&!r.startsWith("#")&&!r.startsWith("|")&&!r.startsWith("```"))??"").replace(/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,(r,i,s)=>s??i).replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/^[-*]\s+/gm,"").replace(/[*_`]/g,"").replace(/\s+/g," ").trim();return oe(n,t)}function ae(o,t){return o.ontology.pillars.find(e=>e.id===t.pillar)}function W(o,t,e=[]){let a=ae(o,t);return L([{label:a?.label??t.pillar,href:`/p/${encodeURIComponent(t.pillar)}`},{label:b(o.ontology,t.type),href:`/p/${encodeURIComponent(t.pillar)}?kind=${encodeURIComponent(t.type)}`},{label:t.title,href:e.length?f(t.id):void 0},...e])}function _(o,t,e){if(!e){let a=t.pages[0];if(!a)return"";let n=k(a.article.content),r=D(n),i=(r?n.slice(0,r.start)+n.slice(r.after):n).trim(),s=i.length>1600?`${i.slice(0,1600).replace(/\n[^\n]*$/,"")}
|
|
150
150
|
|
|
151
151
|
\u2026`:i;return`<div class="ox-prose">${C(o,s)}</div>`}return t.pages.map(a=>`<div class="ox-sub">from ${l(a.agentId)} \xB7 ${l(a.article.path)} \xB7 updated ${l(a.article.meta.lastUpdated||"\u2014")}</div><div class="ox-prose">${C(o,k(a.article.content))}</div>`).join('<hr style="border:0;border-top:1px solid var(--edge);margin:16px 0">')}function re(o,t,e){let a=o.ontology.types.find(i=>i.id===t.type),n=`<span class="ox-lbl">Lens for this type</span><div class="ox-annot"><b>${l(a?.label??t.type)}</b> opens with:<ol>`;n+=e.map(i=>`<li>${l(i.title??i.panel)}</li>`).join(""),n+=`</ol><span class="ox-sub">from ontology.yaml \xB7 types.${l(t.type)}.lens</span></div>`,n+='<span class="ox-lbl" style="margin-top:20px">Zoom in</span>';for(let i of e)n+=`<div class="ox-row"><span class="ox-ic">${m(g(i)==="history"?"calendar":g(i)==="discussed"?"chat":"arrow")}</span><div class="t"><a href="${f(t.id)}/${encodeURIComponent(i.panel)}">${l(i.title??i.panel)}</a><div class="ox-sub">Z3 \xB7 in full</div></div></div>`;n+='<span class="ox-lbl" style="margin-top:20px">Provenance</span>';let r=new Map;for(let i of t.pages)r.set(i.agentId,(r.get(i.agentId)??0)+1);for(let[i,s]of r){let c=t.pages.find(p=>p.agentId===i);n+=`<div class="ox-row"><span class="ox-ic">${m("agent")}</span><div class="t"><a href="/agent/${encodeURIComponent(i)}/article/${encodeURIComponent(c.article.path)}">${l(i)}</a><div class="ox-sub">${s} page${s===1?"":"s"} \xB7 ${t.statements.filter(p=>p.page.agentId===i).length} statements</div></div></div>`}return t.pages.length>1&&(n+=`<div class="ox-row"><span class="ox-ic">${m("merge")}</span><div class="t"><span class="l">${t.pages.length} pages merged</span><div class="ox-sub">same name, one entity</div></div></div>`),n}function ve(o,t){let{g:e}=o,a=E(e,t.type),n=e.ontology.types.find(p=>p.id===t.type),r=e.ontology.sidebar.pins.some(p=>e.names.get(h(p))===t.id),i=`<div class="ox-bar">${W(e,t)}${y(2)}</div>`;i+=`<div class="ox-head"><div class="ox-avatar">${u(e.ontology,t.type)}</div><div><h1>${l(t.title)}</h1><div class="ox-chips">`,i+=`<span class="ox-chip type">${u(e.ontology,t.type)}${l(n?.label??t.type)}</span>`,n?.schema&&(i+=`<span class="ox-chip mono">${l(n.schema.includes(" ")||n.schema.includes(":")?n.schema:`schema.org/${n.schema}`)}</span>`),t.type==="event"&&(i+=`<span class="ox-st ${t.importance}">${t.importance}</span>`),r&&(i+='<span class="ox-chip">pinned</span>'),t.pages.length>1&&(i+=`<span class="ox-chip">${m("merge")}merged from ${t.pages.length} pages</span>`),i+="</div></div></div>",t.review&&(i+=`<div class="ox-card ox-sub" style="border-color:var(--warn,#d97706)">Check the type: ${l(t.review)}</div>`);let s=te(t),c=s?"":ne(t);if((s||c)&&a[0]?.panel!=="notes"){let p=s?`<div class="ox-summary ox-prose">${C(e,s)}</div>`:`<p class="ox-summary">${l(c)}</p>`;i+=`<section class="ox-card">${p}<div class="ox-meta"><span>updated ${l(t.updated||"\u2014")}</span><span>sources: ${t.sources.length}</span><span>${t.statements.length} statements</span></div></section>`}i+='<div class="ox-grid2">';for(let p of a){let x=P(e,t,p,{full:!1,readEntries:o.readEntries}),d=g(p)==="notes";i+=S(e,t,x,!1,d?_(e,t,!1):"")}return i+="</div>",$(t.title,w(e,{pillar:t.pillar,entity:t.id}),i,re(e,t,a))}function be(o,t,e,a){let{g:n}=o,r=E(n,t.type).find(d=>d.panel===e);if(!r)return null;let i=P(n,t,r,{full:!0,page:a,pageSize:50,readEntries:o.readEntries}),s=r.title??r.panel,c=`<div class="ox-bar">${W(n,t,[{label:s}])}${y(3)}</div>`;c+=`<div class="ox-head"><div class="ox-avatar">${u(n.ontology,t.type)}</div><div><h1>${l(s)}</h1><p>${l(t.title)} \xB7 ${i.total} item${i.total===1?"":"s"}</p></div></div>`;let p=g(r)==="notes";c+=S(n,t,i,!0,p?_(n,t,!0):"");let x=Math.ceil(i.total/50);if(x>1){let d=`${f(t.id)}/${encodeURIComponent(e)}`;c+=`<div class="ox-pager">${a>1?`<a href="${d}?page=${a-1}">\u2190 newer</a>`:""}<span>page ${a} of ${x}</span>${a<x?`<a href="${d}?page=${a+1}">older \u2192</a>`:""}</div>`}return $(`${s} \xB7 ${t.title}`,w(n,{pillar:t.pillar,entity:t.id}),c)}function ye(o,t,e){let{g:a}=o,n=t.statements[e];if(!n)return null;let r=a.ontology.properties.find(d=>d.id===n.property),i=n.target?a.entities.get(n.target):void 0,s=n.page.article.meta,c=[["Subject",`<a href="${f(t.id)}">${l(t.title)}</a>`],["Property",`${l(r?.label??n.property)}${r?.wikidata?` <span class="ox-sub">wikidata ${l(r.wikidata)}</span>`:""}`],["Value",i?`<a href="${f(i.id)}">${l(i.title)}</a>`:l(n.value)]];n.role&&c.push(["Role",l(n.role)]),n.metric&&c.push(["Metric",l(n.metric)]),(n.since||n.until)&&c.push(["True",`${l(n.since??"\u2026")} \u2192 ${l(n.until??"now")}`]),n.at&&c.push(["Measured",l(n.at)]),c.push(["Recorded",l(s.lastUpdated||s.created||"\u2014")]),c.push(["Source",l(n.source??(s.sources.length?`${s.sources.length} conversation entries`:"not given"))]),c.push(["Written by",`${l(n.page.agentId)} \xB7 <a href="/agent/${encodeURIComponent(n.page.agentId)}/article/${encodeURIComponent(n.page.article.path)}">${l(n.page.article.path)}</a>`]),c.push(["Status",n.status?`<span class="ox-st ${l(n.status)}">${l(n.status)}</span>`:"not set"]),n.confirmed_by&&c.push(["Confirmed by",l(n.confirmed_by)]),n.checked_at&&c.push(["Checked",l(n.checked_at)]),c.push(["Access",l(n.access??s.access)]),n.note&&c.push(["Note",l(n.note)]);let p=o.versions(n.page.agentId,n.page.article.path);c.push(["Past versions",p.length?p.slice(0,8).map(d=>l(d.timestamp)).join("<br>"):"none saved"]);let x=`<div class="ox-bar">${W(a,t,[{label:r?.label??n.property}])}${y(4)}</div>`;return x+=`<div class="ox-head"><div class="ox-avatar">${m("key")}</div><div><h1>${l(r?.label??n.property)}</h1><p>${l(t.title)} \u2192 ${l(i?.title??n.value)}</p></div></div>`,x+=`<section class="ox-card">${c.map(([d,A])=>`<div class="ox-kv"><span class="k">${d}</span><span>${A}</span></div>`).join("")}</section>`,$(`${r?.label??n.property} \xB7 ${t.title}`,w(a,{pillar:t.pillar,entity:t.id}),x)}export{I as a,l as b,m as c,u as d,b as e,f,L as g,y as h,w as i,$ as j,k,N as l,D as m,ne as n,ve as o,be as p,ye as q};
|
|
152
|
-
//# sourceMappingURL=chunk-
|
|
152
|
+
//# sourceMappingURL=chunk-EFGAPAYZ.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{d as h}from"./chunk-
|
|
1
|
+
import{d as h}from"./chunk-QASIUKZJ.js";var d=["main contact","primary contact","point of contact","billing contact","technical contact","decision maker"],f=/[\w.+-]+@[\w-]+(?:\.[\w-]+)+/g,w=/\b(role|title|position|job)\s*\**\s*[::]\s*\**\s*([^\n;|]+)/gi;function L(t,c,e=[]){let l=[c,...e].join(`
|
|
2
2
|
`),a=l.toLowerCase(),i=h(t,l);for(let s of p(t.match(f)??[]))a.includes(s.toLowerCase())||i.push(`email ${s}`);let m=t.toLowerCase();for(let s of d)m.includes(s)&&!a.includes(s)&&i.push(`marker "${s}"`);for(let s of t.matchAll(w)){let n=s[2].replace(/\*+/g,"").trim();n&&!a.includes(n.toLowerCase())&&i.push(`${s[1].toLowerCase()} "${n}"`)}return p(i)}function p(t){return[...new Set(t)]}var $=.9,g=/^\s*(?:wait\b|here(?:'s| is) the (?:updated|modified|patched|revised)|i (?:must|need to|will|should) (?:output|return|write)|(?:okay|ok|sure)[,.!]\s|let me\b|as requested\b)/im;function k(t,c){let e=[],l=t.split(`
|
|
3
3
|
`).filter(o=>o.trim()).length,a=c.split(`
|
|
4
4
|
`).filter(o=>o.trim()).length;l>=5&&a<Math.floor(l*$)&&e.push(`the article shrinks from ${l} to ${a} lines`);let i=c.match(g);i&&!t.match(g)&&e.push(`it contains the model's own commentary ("${i[0].trim().slice(0,40)}")`);let m=o=>{let r=new Map;for(let u of o.split(`
|
|
5
5
|
`))/^#{1,6} /.test(u)&&r.set(u.trim(),(r.get(u.trim())??0)+1);return r},s=m(t);for(let[o,r]of m(c))r>1&&r>(s.get(o)??0)&&e.push(`the heading "${o}" appears ${r} times`);let n=L(t,c);return n.length&&e.push(`it drops ${n.length} fact(s): ${n.slice(0,6).join(", ")}${n.length>6?", \u2026":""}`),e}export{L as a,k as b};
|
|
6
|
-
//# sourceMappingURL=chunk-
|
|
6
|
+
//# sourceMappingURL=chunk-ERVJLPS4.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as E}from"./chunk-IMLAPB7G.js";import{n as x}from"./chunk-
|
|
1
|
+
import{a as E}from"./chunk-IMLAPB7G.js";import{n as x}from"./chunk-WDGATQV3.js";import{d as se}from"./chunk-QPABR72X.js";import{b as ae}from"./chunk-KP7KDLZ2.js";import{ia as ne,ja as re,la as oe,ma as ie,sa as I,xa as Je}from"./chunk-DUCYRNCT.js";import{accessSync as Qe,closeSync as Ye,constants as Ze,existsSync as pe,openSync as et,readFileSync as tt,readSync as nt,statSync as rt}from"node:fs";import{dirname as T,join as C}from"node:path";import{fileURLToPath as ot}from"node:url";import{homedir as it}from"node:os";import{join as ue,win32 as F}from"path";function $(e){return e==="darwin"?"macos":e==="win32"?"windows":null}var j="agentx-helper.exe";function Ke(e){return F.join(e,"Programs","AgentX",j)}var le="AgentX Helper.app";function B(e){return ue(e,"Applications",le,"Contents/MacOS/agentx-mac-helper")}function ze(e,t){let n=t.AGENTX_DESKTOP_HELPER?.trim();if(n)return n;let r=t.AGENTX_MAC_HELPER?.trim();return r&&$(e)==="macos"?r:void 0}function ce(e){let t=ze(e.platform,e.env);if(t)return t;let n=$(e.platform);if(n==="macos"){let r=B(e.home);return e.exists(r)||!e.root?r:ue(e.root,"apps/mac-helper/build",le,"Contents/MacOS/agentx-mac-helper")}if(n==="windows"){let r=e.env.LOCALAPPDATA||F.join(e.home,"AppData","Local"),o=Ke(r);return e.exists(o)||!e.root?o:F.join(e.root,"apps","win-helper","build",j)}return null}function Ve(e){let t=$(e);return t==="macos"?"Run agentx desktop install (or build it with apps/mac-helper/build.sh).":t==="windows"?`Put ${j} in %LOCALAPPDATA%\\Programs\\AgentX, or set AGENTX_DESKTOP_HELPER to its path.`:"AgentX has no desktop helper for this system yet."}function Xt(e){let t=$(e);if(t==="macos")return"helper not built \u2014 run apps/mac-helper/build.sh (or agentx desktop install)";if(t==="windows"){let n=Ve(e);return`Windows helper not found \u2014 ${n[0].toLowerCase()}${n.slice(1,-1)}`}return`computer use (point, teach, act) is not available on ${e} yet \u2014 macOS now, Windows in progress (#1594)`}var X="tn.acme.agentx.voice",Yt="AgentX Desktop.app",Zt="AgentX Helper.app";function en(e,t,n){return e!=="darwin"||t!=="arm64"||Number(n.split(".")[0])<23?"AgentX Desktop currently requires Apple Silicon and macOS 14 or newer.":null}function tn(e,t){if(t&&!Object.hasOwn(e,t))throw new Error(`Unknown agent: ${t}. Run agentx agent list.`);let n=t||Object.keys(e)[0];if(!n)throw new Error("No agents configured. Run agentx setup first.");return n}function U(e){return`'${e.replace(/'/g,"'\\''")}'`}var de="/usr/bin:/bin:/usr/sbin:/sbin";function nn(e,t){return t||[...new Set([...e?[T(e)]:[],...de.split(":")])].join(":")}function O(e){let t={amp:"&",lt:"<",gt:">",quot:'"',apos:"'"};return e.replace(/&(amp|lt|gt|quot|apos);/g,(n,r)=>t[r])}function rn(e){let t=e.match(/<key>PATH<\/key>\s*<string>([^<]*)<\/string>/);return t?O(t[1]):de}var on=e=>/agentx\.voice.*\.plist$/.test(e);function sn(e,t){let n=null,r=[];for(let{file:o,plist:i}of[...t].sort((s,l)=>s.file<l.file?-1:1)){let s=i.match(/<key>Label<\/key>\s*<string>([^<]*)<\/string>/)?.[1],l=i.match(/<key>ProgramArguments<\/key>\s*<array>\s*<string>([^<]*)<\/string>/)?.[1];!s||!l||!O(l).endsWith("/Contents/MacOS/AgentXVoice")||(n?r.push({file:o,label:O(s)}):n={file:o,label:O(s)})}return{keep:n??{file:C(e,`${X}.plist`),label:X},remove:r}}function me(e,t,n){for(let r of t.split(":"))if(r&&n(C(r,e)))return C(r,e);return null}function an(e){try{if(Qe(e,Ze.X_OK),!rt(e).isFile())return!1;let t=et(e,"r"),n=Buffer.alloc(2);try{nt(t,n,0,2,0)}finally{Ye(t)}return n.toString("latin1")!=="#!"}catch{return!1}}function un(e){let t=r=>r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),n={PATH:e.path,...e.agent?{AGENTX_VOICE_AGENT:e.agent}:{},AGENTX_DAEMON_URL:e.url,AGENTX_MAC_HELPER:e.helper,AGENTX_PASTE_COMMAND:`cd ${U(e.cwd)} && ${U(e.node)} ${U(e.cli)} paste`};return`<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
3
|
<plist version="1.0"><dict>
|
|
4
4
|
<key>Label</key><string>${t(e.label??X)}</string>
|
|
@@ -35,4 +35,4 @@ function run(argv) {
|
|
|
35
35
|
`),Dt(r,n)}var Ft=5*6e4;function Wr(e,t,n=Date.now()){let r=ee(e),o=r.checkedAt?Date.parse(r.checkedAt):NaN;return!r.cards||!(n-o<=Ft)?!1:r.items[`card:${t}`]?.state!=="failed"}var te=24*36e5;function Ue(e,t,n){let r=e+t.dueAfterMinutes*6e4;return new Date(n!==void 0&&Number.isFinite(n)?Math.max(e,Math.min(r,n)):r)}function jt(e,t,n,r){let o=Date.parse(e.expires),i=[w(e.ask,x.ask)];return e.choices?.length&&i.push(...e.choices.map((s,l)=>`${l+1}. ${s}`)),e.recommend&&i.push(`Recommended: ${w(e.recommend,x.recommend)}`),i.push(`Answer: ${n}`,`agentx: card=${e.id}`),{key:`card:${e.id}`,title:w(e.title,x.title),notes:i.join(`
|
|
36
36
|
`),due:Ue(r,t,o),priority:Number.isFinite(o)&&o-r<=te?"high":"none"}}function Bt(e,t,n,r){let o=[w(e.question||e.text,x.ask),`Asked of ${e.agentId}.`,`Answer: ${n}`,`agentx: request=${e.id}`],i=e.dueAt??void 0;return{key:`request:${e.id}`,title:Y(e,x.title).headline,notes:o.join(`
|
|
37
37
|
`),due:Ue(r,t,i),priority:i!==void 0&&i-r<=te?"high":"none"}}async function qr(e){let{root:t,settings:n,tasks:r,log:o}=e,i=e.now??Date.now(),s=new Date(i).toISOString(),l={created:0,completed:0,dismissed:0,failed:0},a=ee(t);delete a.lastError;let c=u=>{a.lastError={at:s,message:u}},g=new Map;try{if(n.include.includes("card"))for(let u of e.cards())u.status==="pending"&&Date.parse(u.expires)>i&&g.set(`card:${u.id}`,jt(u,n,e.answerUrl,i));if(n.include.includes("request"))for(let u of e.requests())u.state==="waiting_owner"&&g.set(`request:${u.id}`,Bt(u,n,e.answerUrl,i))}catch(u){return o(`[mirror] could not read what is waiting: ${u?.message??u}`),c(String(u?.message??u)),Fe(t,a),l}let D=!0,h=new Map,Xe=async u=>{if(!h.has(u))try{h.set(u,new Set((await r.listOpen(u)).map(p=>p.id)))}catch(p){o(`[mirror] could not read list "${u}": ${p?.message??p}`),c(String(p?.message??p)),h.set(u,null),D=!1}return h.get(u)};for(let[u,p]of Object.entries(a.items)){if(p.state!=="open"||!p.id)continue;let d=await Xe(p.list);if(d)if(g.has(u))d.has(p.id)||(a.items[u]={...p,state:"dismissed",at:s},l.dismissed++,o(`[mirror] ${u}: its task was ticked off or deleted; it stays on the Desk and is not mirrored again`));else{if(d.has(p.id))try{await r.complete(p.id)}catch(S){o(`[mirror] ${u}: could not complete its task: ${S?.message??S}`),c(String(S?.message??S));continue}a.items[u]={...p,state:"completed",at:s},l.completed++}}let R=null,W="",q=0,v=[];for(let[u,p]of g){let d=a.items[u];if(d&&(d.state==="open"||d.state==="dismissed")||d?.state==="failed"&&d.failures>=Z)continue;if(R===null)try{await r.ensureList(n.list),R=!0}catch(f){o(`[mirror] could not make list "${n.list}": ${f?.message??f}`),W=String(f?.message??f),c(W),R=!1}let S=d?.state==="failed"?d.failures:0;try{if(R===!1)throw new Error(W);let{id:f}=await r.add({list:n.list,title:p.title,notes:p.notes,due:p.due,priority:p.priority});a.items[u]={id:f,list:n.list,state:"open",at:s,createdAt:s,failures:0},l.created++}catch(f){let P=String(f?.message??f);u.startsWith("card:")&&q++;let H=S+1;a.items[u]={list:n.list,state:"failed",at:s,failures:H,lastError:P},c(P),l.failed++,o(`[mirror] ${u}: could not add to Reminders (${H}/${Z}): ${P}`),H===Z&&v.push({title:p.title,message:P})}}q&&o(`[mirror] ${q} card(s) could not be added to Reminders; the Mac popup shows them instead`);let Ge=a.failureToldAt?Date.parse(a.failureToldAt):NaN;if(v.length&&!(i-Ge<te)){let u=v[0],p=v.length>1?` (and ${v.length-1} more)`:"";try{await e.notify("Could not add to Reminders",`${u.title}${p}: ${w(u.message,200)}. Still on the Desk.`),a.failureToldAt=s}catch(d){o(`[mirror] could not tell the owner: ${d?.message??d}`)}}D&&(a.checkedAt=s,a.cards=n.include.includes("card"));for(let[u,p]of Object.entries(a.items))p.state!=="open"&&!g.has(u)&&i-Date.parse(p.at)>Ht&&delete a.items[u];return Fe(t,a),l}var je=5*6e4;function Hr(e,t,n,r,o=Date.now()){let i=ee(e),s=a=>{let c=a?Date.parse(a):NaN;return c>=n&&c<r},l={from:new Date(n).toISOString(),to:new Date(r).toISOString(),raised:0,created:{cards:0,requests:0},missed:[],closedFast:0,tooNew:0};for(let[a,c]of Object.entries(i.items))!c.id||!s(c.createdAt)||(a.startsWith("card:")?l.created.cards++:l.created.requests++);for(let a of t){if(!s(a.created_at))continue;l.raised++;let c=i.items[`card:${a.id}`];if(c?.id)continue;let g=Date.parse(a.created_at);if((a.status==="pending"?NaN:Date.parse(a.decided_at??""))-g<=je){l.closedFast++;continue}if(a.status==="pending"&&o-g<=je){l.tooNew++;continue}let h=c?.state==="failed"?`could not be added (${c.failures}x): ${c.lastError??"unknown error"}`:"no pass reached it";l.missed.push({id:a.id,title:a.title,reason:h})}return l}function Fr(e){let t=[e.closedFast?`closed within 5 min: ${e.closedFast}`:"",e.tooNew?`raised in the last 5 min: ${e.tooNew}`:""].filter(Boolean);return`cards raised ${e.raised} / Reminders created ${e.created.cards+e.created.requests} (${e.created.cards} cards, ${e.created.requests} requests) / missed ${e.missed.length}${t.length?` \xB7 ${t.join(" \xB7 ")}`:""}`}export{Nr as a,Me as b,V as c,Q as d,Ar as e,br as f,Tt as g,vr as h,kr as i,Rr as j,Y as k,w as l,Ct as m,Or as n,$ as o,ce as p,Ve as q,Xt as r,Yt as s,Zt as t,en as u,tn as v,nn as w,rn as x,on as y,sn as z,me as A,an as B,un as C,ln as D,cn as E,st as F,k as G,Se as H,z as I,Le as J,fr as K,gr as L,yr as M,ee as N,Wr as O,qr as P,Hr as Q,Fr as R};
|
|
38
|
-
//# sourceMappingURL=chunk-
|
|
38
|
+
//# sourceMappingURL=chunk-GWBFEVLO.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as W,c as K}from"./chunk-
|
|
1
|
+
import{b as W,c as K}from"./chunk-2P3SHT5I.js";import{h as z,j as Z}from"./chunk-3UOTLMXD.js";import{a as I,b as V}from"./chunk-FCPTN6NF.js";import{a as H,b as De}from"./chunk-7I7IEX4S.js";import{d as Y}from"./chunk-QIJLFPWE.js";import{execFile as tt}from"child_process";import{writeFileSync as Ee,mkdirSync as P,existsSync as D,readFileSync as nt}from"fs";import{resolve as _}from"path";var Ne=["off","shadow","authoritative"],xe={telegram:"INTENT_LEDGER_MODE_TELEGRAM",slack:"INTENT_LEDGER_MODE_SLACK",whatsapp:"INTENT_LEDGER_MODE_WHATSAPP",discord:"INTENT_LEDGER_MODE_DISCORD",gitlab:"INTENT_LEDGER_MODE_GITLAB",github:"INTENT_LEDGER_MODE_GITHUB",workflow:"INTENT_LEDGER_MODE_WORKFLOW",cron:"INTENT_LEDGER_MODE_CRON",mesh:"INTENT_LEDGER_MODE_MESH"},Se="INTENT_LEDGER_MODE";function q(n,e=process.env){let t=Q(e[xe[n]]);if(t)return t;let r=Q(e[Se]);return r||"off"}function Q(n){if(typeof n!="string")return null;let e=n.trim().toLowerCase();return Ne.includes(e)?e:null}V();import we from"better-sqlite3";import{existsSync as ut,mkdirSync as $e}from"fs";import{dirname as Oe,resolve as Le}from"path";var T=class{db;path;constructor(e={}){this.path=Le(process.cwd(),e.path??".agentx/intent/ledger.sqlite"),$e(Oe(this.path),{recursive:!0}),this.db=new we(this.path),this.db.pragma("journal_mode = WAL"),this.db.pragma("synchronous = NORMAL"),this.db.pragma("foreign_keys = ON"),Ce(this.db)}close(){this.db.close()}schemaVersion(){return this.db.prepare("SELECT MAX(v) AS v FROM schema_version").get().v??0}recordEvent(e){if(e.sourceEventId!==null){let r=this.findEventBySourceId(e.source,e.sourceEventId);if(r)return r}let t={id:e.id??I(e.ts),ts:e.ts,source:e.source,sourceEventId:e.sourceEventId,project:e.project,subject:e.subject,intent:e.intent,rawJson:e.rawJson};return this.db.prepare(`INSERT INTO intent_events (id, ts, source, source_event_id, project, subject, intent, raw_json)
|
|
2
2
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`).run(t.id,t.ts,t.source,t.sourceEventId,t.project,t.subject,t.intent,t.rawJson),t}findEventBySourceId(e,t){let r=this.db.prepare(`SELECT id, ts, source, source_event_id, project, subject, intent, raw_json
|
|
3
3
|
FROM intent_events WHERE source = ? AND source_event_id = ?`).get(e,t);return r?j(r):null}getEventById(e){let t=this.db.prepare(`SELECT id, ts, source, source_event_id, project, subject, intent, raw_json
|
|
4
4
|
FROM intent_events WHERE id = ?`).get(e);return t?j(t):null}recordDecision(e){this.db.prepare(`INSERT INTO intent_decisions (event_id, decided_at, decided_by, agent_id, outcome, reason)
|
|
@@ -142,4 +142,4 @@ ${k(O(ye(c.block,F(o.brief,i.prompt)),i.report),i.expectExitZero)}`,i.maxOutputT
|
|
|
142
142
|
`);return t.length<=e?t.join(`
|
|
143
143
|
`):t.slice(-e).join(`
|
|
144
144
|
`)}function st(n,e,t){return new Promise((r,i)=>{tt("/bin/sh",["-c",n],{timeout:e,maxBuffer:8*1024*1024,...t?{env:t}:{}},(o,s,a)=>{if(o&&o.killed){i(new Error(`command timed out after ${Math.round(e/1e3)}s`));return}r({stdout:String(s??""),stderr:String(a??""),code:o?typeof o.code=="number"?o.code:1:0})})})}export{T as a,te as b,St as c,wt as d,Ye as e,$t as f,Ot as g,w as h,de as i,q as j,pt as k,re as l,se as m,At as n,et as o,it as p,Ie as q,Te as r,Re as s,B as t,U as u};
|
|
145
|
-
//# sourceMappingURL=chunk-
|
|
145
|
+
//# sourceMappingURL=chunk-IDGEDPRJ.js.map
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import{f as D}from"./chunk-36X7D4JA.js";import{existsSync as f,mkdirSync as z,writeFileSync as $,readFileSync as _}from"fs";import{resolve as m}from"path";import{createHash as Ie}from"crypto";import{readFileSync as re,existsSync as ie,unlinkSync as ae,readdirSync as Ze}from"fs";import{resolve as L}from"path";function tt(t,n){let s={},o=e=>{let r=L(t,e);if(ie(r))try{return re(r,"utf-8").trim()||void 0}catch{return}};if(n){let e=o(`SOUL.${n}.md`);e?(s.soul=e,s.soulProfile=n):s.soul=o("SOUL.md")}else s.soul=o("SOUL.md");if(s.identity=o("IDENTITY.md"),s.user=o("USER.md"),s.agents=o("AGENTS.md"),s.bootstrap=o("BOOTSTRAP.md"),s.bootstrap)try{ae(L(t,"BOOTSTRAP.md"))}catch{}return s}function nt(t){let n=[];return t.identity&&n.push(`[Identity]
|
|
2
|
+
${t.identity}`),t.soul&&n.push(`[Personality & Boundaries]
|
|
3
|
+
${t.soul}`),t.user&&n.push(`[User Profile]
|
|
4
|
+
${t.user}`),t.bootstrap&&n.push(`[First-Run Instructions \u2014 one time only]
|
|
5
|
+
${t.bootstrap}`),n.length===0?"":n.join(`
|
|
6
|
+
|
|
7
|
+
`)}function U(t){return`# ${t.name}
|
|
8
|
+
|
|
9
|
+
> Agent ID: \`${t.id}\` | Tier: ${t.tier||"claude-code"}
|
|
10
|
+
|
|
11
|
+
## Role
|
|
12
|
+
|
|
13
|
+
${t.role||"AI agent managed by AgentX orchestrator."}
|
|
14
|
+
|
|
15
|
+
## Setup
|
|
16
|
+
|
|
17
|
+
This workspace is managed by AgentX. The agent runs via:
|
|
18
|
+
\`\`\`bash
|
|
19
|
+
# Direct execution
|
|
20
|
+
agentx daemon send ${t.id} "your task here"
|
|
21
|
+
|
|
22
|
+
# Or via any connected channel (Telegram, WhatsApp, GitLab)
|
|
23
|
+
\`\`\`
|
|
24
|
+
|
|
25
|
+
## Code Style
|
|
26
|
+
|
|
27
|
+
- Follow existing patterns in the codebase
|
|
28
|
+
- Use the language and framework conventions already present
|
|
29
|
+
- Keep changes minimal and focused
|
|
30
|
+
|
|
31
|
+
## Testing
|
|
32
|
+
|
|
33
|
+
Run tests before committing:
|
|
34
|
+
\`\`\`bash
|
|
35
|
+
npm test # or the project's test command
|
|
36
|
+
\`\`\`
|
|
37
|
+
|
|
38
|
+
## PR Guidelines
|
|
39
|
+
|
|
40
|
+
- One logical change per commit
|
|
41
|
+
- Reference issue numbers when applicable
|
|
42
|
+
- Keep PR descriptions concise
|
|
43
|
+
|
|
44
|
+
## AgentX Integration
|
|
45
|
+
|
|
46
|
+
This agent is part of an AgentX mesh. It can:
|
|
47
|
+
- Receive tasks from messaging channels (Telegram, WhatsApp, Discord)
|
|
48
|
+
- Respond to GitLab @mentions on issues and MRs
|
|
49
|
+
- Delegate to other agents by mentioning their handles
|
|
50
|
+
- Send cross-channel messages via the /send API
|
|
51
|
+
- Access its wiki knowledge base for context
|
|
52
|
+
`}function st(t){let n=t.match(/\/soul\s+(\w+)/i);return n?n[1].toLowerCase():/\/soul\s*$/i.test(t)?"default":null}import{execFile as ce}from"child_process";import{existsSync as C}from"fs";import{resolve as ue}from"path";var N=["mcp__codegraph__codegraph_search","mcp__codegraph__codegraph_context","mcp__codegraph__codegraph_callers","mcp__codegraph__codegraph_callees","mcp__codegraph__codegraph_impact","mcp__codegraph__codegraph_node","mcp__codegraph__codegraph_status","mcp__codegraph__codegraph_files"],I={command:"codegraph",args:["serve","--mcp"]};function j(){return["## CodeGraph","","This workspace has CodeGraph initialized \u2014 a semantic code-knowledge-graph indexed via tree-sitter. Use it instead of grep/find/Read for exploration.","","**ALWAYS spawn an Explore subagent for `codegraph_explore` / `codegraph_context`** \u2014 those tools return large source sections that would otherwise bloat the main session. Include this in the Explore prompt:","","> Use `codegraph_explore` as your PRIMARY tool \u2014 one call returns full source from all relevant files. Do not re-Read files codegraph_explore already returned. Fall back to grep/glob/Read only if codegraph returned no results.","","**In the main session, use these lightweight codegraph tools directly:**","","| Tool | Use for |","|---|---|","| `codegraph_search` | Find symbols by name across the codebase |","| `codegraph_callers` / `codegraph_callees` | Trace call flow |","| `codegraph_impact` | Check what's affected before editing a symbol |","| `codegraph_node` | Get a single symbol's details |","| `codegraph_files` | Indexed file structure (faster than ls) |","| `codegraph_status` | Index health |",""].join(`
|
|
53
|
+
`)}function ct(t){let n=t.mcp??{};return!t.codegraph||n.codegraph?n:{...n,codegraph:{command:I.command,args:[...I.args]}}}var le=".codegraph",pe=10*60*1e3,M=2;function de(t){let n=Date.now();return new Promise((s,o)=>{ce("codegraph",["init","--index","--quiet",t],{timeout:pe,maxBuffer:4*1024*1024},e=>{e?o(e):s(Date.now()-n)})})}async function ut(t,n=console.error){let s=[];for(let[r,a]of Object.entries(t))a.codegraph&&(a.tier!=="claude-code"&&a.tier!=="codex-cli"||C(a.workspace)&&(C(ue(a.workspace,le))||s.push({agentId:r,workspace:a.workspace})));if(s.length===0)return;n(`codegraph: indexing ${s.length} workspace(s) in background (max ${M} parallel)`);let o=0,e=[];for(let r=0;r<Math.min(M,s.length);r++)e.push((async()=>{for(;;){let a=o++;if(a>=s.length)return;let{agentId:i,workspace:u}=s[a];try{let l=await de(u);n(` codegraph: indexed ${i} in ${(l/1e3).toFixed(1)}s`)}catch(l){let d=l?.code==="ENOENT"?" (codegraph CLI not on PATH; install with `npm i -g @colbymchenry/codegraph`)":"";n(` codegraph: ${i} index failed: ${l?.message??l}${d}`)}}})());await Promise.allSettled(e)}import{appendFileSync as he,existsSync as H,mkdirSync as q,readdirSync as G,realpathSync as ge,statSync as me,unlinkSync as fe,utimesSync as ye,writeFileSync as be}from"fs";import{createHash as W}from"crypto";import{resolve as k,sep as ke}from"path";var T="/observation/pack";function gt(t=process.cwd()){return k(t,".agentx/observations")}function J(t,n){return k(t,encodeURIComponent(n).replace(/\./g,"%2E"))}function K(t){return t==="bypassPermissions"}function F(t){try{return ge(t)}catch{return k(t)}}function xe(t,n){return n.some(s=>{try{return new RegExp(`^(?:${s})$`).test(t)}catch{return s===t}})}var $e=2e3;function R(t,n,s){return t.subarray(n,s).toString("utf-8").replace(/^�+|�+$/g,"")}function we(t,n,s){let o=Buffer.from(t,"utf-8"),e=R(o,0,s.headBytes),r=s.tailBytes>0?R(o,o.length-s.tailBytes,o.length):"",a=o.length-s.headBytes-s.tailBytes,i=t.split(`
|
|
54
|
+
`).length,l=o.length/i>$e?"Its lines are very long, so read it by byte range (for example head -c or tail -c, or jq for JSON) for the part you need.":"Read that file with offset and limit (line numbers), or grep it, for the part you need. Do not cat it whole: that is packed again.";return[`[ObservationPack: this result is ${o.length} bytes (${i} lines). Only its first ${s.headBytes} and last ${s.tailBytes} bytes are shown.`,`The exact original is saved at ${n}`,`${l} Do not guess at what is not shown.]`,e,`[... ${a} bytes not shown ...]`,r].join(`
|
|
55
|
+
`)}function _e(t){let n=t;return!!n&&typeof n=="object"&&n.type==="text"&&typeof n.file?.content=="string"}function A(t){if(t==="")return 0;let n=1;for(let s=t.indexOf(`
|
|
56
|
+
`);s!==-1;s=t.indexOf(`
|
|
57
|
+
`,s+1))n++;return t.endsWith(`
|
|
58
|
+
`)&&n--,n}function Re(t,n,s){let o=Buffer.from(t,"utf-8"),e=A(t),r=R(o,0,s.headBytes),a=r.lastIndexOf(`
|
|
59
|
+
`);r=a===-1?r:r.slice(0,a+1);let i=s.tailBytes>0?R(o,o.length-s.tailBytes,o.length):"",u=i.indexOf(`
|
|
60
|
+
`);i=u===-1?i:i.slice(u+1);let l=a===-1?0:A(r),d=u===-1?0:A(i),c=n.startLine,p=c+e-1,h=c+l,g=p-d,w=o.length-Buffer.byteLength(r,"utf-8")-Buffer.byteLength(i,"utf-8"),te=typeof n.totalLines=="number"&&n.totalLines>e?` (${n.totalLines} lines in all)`:"",ne=h===g?`Line ${h} (${w} bytes) is`:`Lines ${h} to ${g} (${w} bytes) are`,b=[l===0&&r!==""?c:null,d===0&&i!==""?p:null].filter(S=>S!==null),se=b.length===0?"":b.length===1||b[0]===b[1]?` (line ${b[0]} only in part)`:` (lines ${b[0]} and ${b[1]} only in part)`,oe=d>0?` Lines ${g+1} to ${p} follow; the numbers beside them are not the file's.`:"";return[r,`[ObservationPack: this read is ${o.length} bytes, lines ${c} to ${p} of ${n.path}${te}.`,`${ne} not shown${se}.${oe}`,"Read the file again with offset and limit for the lines you need, or Grep it. Do not guess at what is not shown.]",i].filter(S=>S!=="").join(`
|
|
61
|
+
`)}function Oe(t,n){let s=W("sha256").update(n).digest("hex"),o=k(t,`${s}.txt`);if(H(o)){let e=new Date;ye(o,e,e)}else q(t,{recursive:!0,mode:448}),be(o,n,{mode:384});return{sha:s,path:o}}function Se(t,n,s){if(!n.enabled)return null;let o=t.tool_name;if(!o||!xe(o,n.tools))return null;let e=t.tool_input?.file_path;if(typeof e=="string"&&F(e).startsWith(F(s)+ke)||n.limitBytes<=n.headBytes+n.tailBytes)return null;if(o==="Read"){let i=t.tool_response;if(!_e(i))return null;let u=i.file.content,l=Buffer.byteLength(u,"utf-8");if(l<=n.limitBytes)return null;let d=typeof e=="string"?e:i.file.filePath??"the file you read",c=t.tool_input?.offset,p=typeof i.file.startLine=="number"&&i.file.startLine>=1?i.file.startLine:typeof c=="number"&&c>=1?c:1,h=Re(u,{path:d,startLine:p,totalLines:i.file.totalLines},n),g=W("sha256").update(u).digest("hex");return{updated:{...i,file:{...i.file,content:h}},packs:[{sha:g,path:d,bytes:l,keptBytes:Buffer.byteLength(h,"utf-8")}]}}let r=[],a=i=>{if(typeof i=="string"){let u=Buffer.byteLength(i,"utf-8");if(u<=n.limitBytes)return i;let{sha:l,path:d}=Oe(s,i),c=we(i,d,n);return r.push({sha:l,path:d,bytes:u,keptBytes:Buffer.byteLength(c,"utf-8")}),c}if(Array.isArray(i))return i.map(a);if(i&&typeof i=="object"){let u=i;return u.type==="image"||u.type==="audio"||u.isImage===!0||typeof u.persistedOutputPath=="string"?i:Object.fromEntries(Object.entries(u).map(([l,d])=>[l,l==="blob"?d:a(d)]))}return i};try{let i=a(t.tool_response);return r.length>0?{updated:i,packs:r}:null}catch{return null}}function mt(t,n,s){let o=t&&typeof t=="object"?Se(t,n,s.dir):null;if(!o)return"";try{let e=new Date().toISOString(),r=o.packs.map(a=>JSON.stringify({at:e,agent:s.agentId,session:t.session_id,tool:t.tool_name,sha:a.sha,bytes:a.bytes,keptBytes:a.keptBytes}));q(s.dir,{recursive:!0,mode:448}),he(k(s.dir,"index.jsonl"),r.join(`
|
|
62
|
+
`)+`
|
|
63
|
+
`,{mode:384})}catch{}return JSON.stringify({hookSpecificOutput:{hookEventName:"PostToolUse",updatedToolOutput:o.updated}})}function ft(t,n,s=Date.now()){if(n<=0||!H(t))return 0;let o=s-n*864e5,e=0;for(let r of G(t,{withFileTypes:!0})){if(!r.isDirectory())continue;let a=k(t,r.name);for(let i of G(a)){if(!i.endsWith(".txt"))continue;let u=k(a,i);try{me(u).mtimeMs<o&&(fe(u),e++)}catch{}}}return e}import{mkdirSync as Ae,renameSync as Te,writeFileSync as Pe}from"fs";import{dirname as Ee,resolve as ve}from"path";var Be="AGENTX_GUARD_ERROR",E=75,De={connectS:1,maxTimeS:55,deadlineMs:3e3};function Y(t){return ve(t,".agentx/bin/agentx-guard")}function xt(t,n,s){let o=Y(t);Ae(Ee(o),{recursive:!0});let e=`#!/bin/sh
|
|
64
|
+
[ -f ${y(s)} ] || exit 127
|
|
65
|
+
exec ${y(n)} ${y(s)} "$@"
|
|
66
|
+
`,r=`${o}.${process.pid}.tmp`;return Pe(r,e,{mode:493}),Te(r,o),o}function y(t){return`'${t.replace(/'/g,"'\\''")}'`}var x="[A-Za-z0-9_./~@:=-]+",P=`(start|restart|status)( +(-d|--detach|--when-idle|(-c|--config|--port)( +|=)${x}))*`,X="([0-9]+|\\$\\(id -u\\)|\\$UID)",Le=[`agentx +daemon +${P}`,`(node +)?(${x}/)?cli\\.js +daemon +${P}`,`npx +tsx +(${x}/)?cli\\.ts +daemon +${P}`,`launchctl +kickstart( +-k)? +gui/${X}/${x}`,`launchctl +(bootstrap|bootout) +gui/${X} +${x}`,`systemctl +--user +(start|restart|status) +${x}`,`sudo +systemctl +(start|restart|status) +${x}`].map(t=>`(${t})`).join("|");function Ue(t){return JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:t}})}var Ce="[agentx-guard] Refused: the AgentX guard could not check this call (the daemon is not answering and the local check failed). Only `agentx daemon start|restart|status` and the launchctl/systemctl forms that start the daemon run until it answers.";function V(t){let n=t.budget??De,s=t.agentId?`?agent=${encodeURIComponent(t.agentId)}`:"",o=`http://127.0.0.1:${t.port}/guard/check${s}`,e=`guard check --rules-only --deadline-ms ${n.deadlineMs} --root ${y(t.root)}${t.agentId?` --agent ${y(t.agentId)}`:""}`,r=["p=$(cat)",`out=$(printf '%s' "$p" | curl -sf --connect-timeout ${n.connectS} --max-time ${n.maxTimeS} -H 'Content-Type: application/json' --data-binary @- '${o}' 2>/dev/null) && { printf '%s' "$out"; exit 0; }`,`out=$(printf '%s' "$p" | ${y(t.cliPath??Y(t.root))} ${e} 2>/dev/null) || out=$(printf '%s' "$p" | agentx ${e} 2>/dev/null)`,`[ $? -eq 0 ] && [ "$out" != ${Be} ] && { printf '%s' "$out"; exit 0; }`];return t.required&&r.push('[ "$AGENTX_GUARD" = required ] || exit 0',`c=$(printf '%s' "$p" | grep -o '"command" *: *"[^"\\\\]*"')`,`if printf '%s' "$p" | grep -q '"tool_name" *: *"Bash"' && [ "$(printf '%s\\n' "$c" | grep -c .)" = 1 ] && printf '%s\\n' "$c" | sed 's/^"command" *: *"//; s/"$//; s/^ *//; s/ *$//' | grep -Eqx ${y(Le)}; then exit 0; fi`,`printf '%s' ${y(Ue(Ce))}`),r.push("exit 0"),r.join(`
|
|
67
|
+
`)}var v="<!-- agentx-managed: hash=",B=" -->";function Q(t){return Ie("sha256").update(t.systemPrompt??"").update("\0").update(t.codegraph?"cg:1":"cg:0").digest("hex").slice(0,16)}function Me(t){return`${v}${Q(t)}${B}`}function Ne(t){let n=t.split(`
|
|
68
|
+
`,1)[0]??"";return!n.startsWith(v)||!n.endsWith(B)?null:n.slice(v.length,n.length-B.length)}function Z(t,n){let s=`${t} ${n.systemPrompt||""} ${n.name}`.toLowerCase();return/cod(e|ing|er)|develop|engineer|program/.test(s)?"coding":/pm|project.?manag|product|scrum/.test(s)?"pm":/devops|deploy|infra|ops|sre|ci.?cd/.test(s)?"devops":/qa|test|quality|forensic/.test(s)?"qa":"general"}function je(t,n,s){let o=Z(t,n),e=[];switch(e.push(Me(n)),e.push(`# ${n.name}`),e.push(""),e.push("@AGENTS.md"),e.push(""),n.systemPrompt&&n.systemPrompt.trim().length>0&&(e.push("## Role"),e.push(""),e.push(n.systemPrompt.trimEnd()),e.push("")),e.push("## Commands"),e.push(""),f(m(n.workspace,"package.json"))?(e.push("```bash"),e.push("npm install # install dependencies"),e.push("npm test # run tests"),e.push("npm run build # build project"),e.push("```")):f(m(n.workspace,"requirements.txt"))&&(e.push("```bash"),e.push("pip install -r requirements.txt"),e.push("pytest"),e.push("```")),e.push(""),e.push("## Conventions"),e.push(""),o){case"coding":e.push("- Write tests for new code before committing"),e.push("- Keep functions small and focused"),e.push("- Follow existing patterns in the codebase"),e.push("- Run tests before pushing");break;case"pm":e.push("- Keep responses concise (3-5 lines main message)"),e.push("- Reference issues with #IID and MRs with !IID"),e.push("- Update issue labels and milestones when relevant"),e.push("- Summarize decisions, don't narrate process");break;case"devops":e.push("- Always check service status before making changes"),e.push("- Never run destructive commands without confirmation"),e.push("- Log all deployment actions"),e.push("- Verify changes in staging before production");break;case"qa":e.push("- Document reproduction steps for every bug"),e.push("- Include expected vs actual behavior"),e.push("- Check both happy path and edge cases"),e.push("- Attach screenshots when reporting UI issues");break;default:e.push("- Be concise \u2014 lead with the answer, skip preamble"),e.push("- Follow existing patterns in the codebase")}return e.push(""),e.push("## Cross-Channel Messaging"),e.push(""),e.push("You can send messages to any channel proactively:"),e.push("```bash"),e.push(`curl -X POST http://localhost:${s}/send \\`),e.push(' -H "Content-Type: application/json" \\'),e.push(` -d '{"channel":"telegram","chatId":"<id>","text":"<message>","agentId":"${t}"}'`),e.push("```"),e.push("Channels: telegram, whatsapp, gitlab, discord"),e.push(""),e.push("## Typed actions \u2014 prefer these over free-form Bash"),e.push(""),e.push("Daemon-shipped typed actions cover the common needs. Each call appears in `/traces` as a structured step (input + output schema), unlike opaque `Bash`/`curl`/`Read` calls."),e.push(""),e.push("```bash"),e.push("# List available actions + their schemas"),e.push("agentx actions builtin # \u2192 catalog"),e.push("agentx actions builtin <name> --schema # \u2192 input/output schema"),e.push(""),e.push("# Invoke an action with typed JSON input"),e.push(`agentx actions builtin http.fetch --input '{"url":"https://example.com/data"}'`),e.push(`agentx actions builtin http.post --input '{"url":"https://x.tld/hook","body":{"k":"v"}}'`),e.push(`agentx actions builtin file.read_lines --input '{"path":"data/prices.json"}'`),e.push(`agentx actions builtin file.write_jsonl --input '{"path":"leads.jsonl","record":{"name":"\u2026","email":"\u2026"}}'`),e.push(`agentx actions builtin extract.structured --input '{"prompt":"<text>","schema":{"type":"object",\u2026}}'`),e.push(`agentx actions builtin rag.lexical --input '{"agentId":"${t}","query":"\u2026","limit":5}'`),e.push(`agentx actions builtin agent.call --input '{"agentId":"<local-agent>","message":"\u2026"}'`),e.push(`agentx actions builtin mesh.delegate --input '{"peer":"<peer-name>","agent":"<peer-agent>","message":"\u2026"}'`),e.push("```"),e.push(""),e.push("Rule of thumb:"),e.push("- HTTP fetch/POST \u2192 `http.fetch` / `http.post` (not `Bash curl`)"),e.push("- Reading a file you'll parse \u2192 `file.read_lines` (not `Bash cat`)"),e.push("- Appending a structured record \u2192 `file.write_jsonl` (not `Bash echo >>` or `Write` with model-formatted JSON)"),e.push("- Extracting fields from text into a typed object \u2192 `extract.structured` (not asking the model to format JSON in its reply)"),e.push("- Searching a doc corpus \u2192 `rag.lexical` (not `Read` over every file)"),e.push("- Calling another agent on this daemon \u2192 `agent.call` (fresh session by default; not composing `Bash curl` to /task)"),e.push("- Calling an agent on a peer mesh node \u2192 `mesh.delegate` (cross-machine; same fresh-session default)"),e.push(""),n.codegraph&&e.push(j()),e.join(`
|
|
69
|
+
`)}var O=["Bash(npx prisma migrate reset*)","Bash(prisma migrate reset*)","Bash(npx prisma db push*)","Bash(prisma db push*)","Bash(dropdb*)"];function Ge(t,n,s=process.cwd()){return V({port:n,root:s,agentId:t,required:!0})}function Fe(t,n){let s=`http://127.0.0.1:${n}/guard/check?agent=${encodeURIComponent(t)}`,o=JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:"AgentX guard did not answer; tools of an MCP server with an allow list are refused until it does."}});return`out=$(curl -sf --max-time 3 -H 'Content-Type: application/json' --data-binary @- '${s}' 2>/dev/null) && printf '%s' "$out" || printf '%s' '${o}'`}function ee(t,n,s){let o=Ge(t,n),e=[{matcher:"Bash",hooks:[{type:"command",command:o,timeout:E}]},{matcher:"Write|Edit",hooks:[{type:"command",command:o,timeout:E}]}],r=D(s);return r&&e.push({matcher:r,hooks:[{type:"command",command:Fe(t,n),timeout:10}]}),e}function He(t){return Array.isArray(t?.hooks)&&t.hooks.some(n=>typeof n?.command=="string"&&(n.command.includes("/guard/check")||n.command.includes("guard check")))}function qe(t,n,s="19900"){let o={autoMemoryEnabled:!0,env:{CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:"1"}};if(n.permissionMode==="bypassPermissions"?o.permissions={deny:[...O]}:n.permissionMode==="plan"?o.permissions={deny:[...O,"Bash(rm -rf *)","Bash(drop *)","Bash(DELETE *)"]}:o.permissions={deny:[...O,"Bash(rm -rf /)","Bash(> /dev/sda*)","Bash(mkfs*)"]},n.codegraph){let r=o.permissions||{},a=Array.isArray(r.allow)?r.allow:[];r.allow=[...new Set([...a,...N])],o.permissions=r}let e={};return e.PreToolUse=ee(t,s,n.mcp),e.Notification=[{matcher:"",hooks:[{type:"command",command:`echo "[${t}] notification: $(jq -r '.type // "unknown"')" >> /tmp/agentx-${t}.log`}]}],e.PostToolUse=[{matcher:"Bash",hooks:[{type:"command",command:`jq -r '.tool_input.command // empty' >> /tmp/agentx-${t}-commands.log`}]}],e.SessionStart=[{matcher:"compact",hooks:[{type:"command",command:`echo "Reminder: You are ${n.name} (${t}). Follow the conventions in CLAUDE.md."`}]}],o.hooks=e,o}var We=`# Code Quality
|
|
70
|
+
|
|
71
|
+
- No console.log in production code (use a logger)
|
|
72
|
+
- Handle errors explicitly \u2014 no empty catch blocks
|
|
73
|
+
- Keep files under 300 lines
|
|
74
|
+
- Extract repeated logic into shared utilities
|
|
75
|
+
`;function Je(t,n){let s=Z(t,n),o=[];switch(s){case"coding":o.push({name:"testing.md",content:`---
|
|
76
|
+
paths:
|
|
77
|
+
- "**/*.test.{ts,tsx,js,jsx}"
|
|
78
|
+
- "**/*.spec.{ts,tsx,js,jsx}"
|
|
79
|
+
- "test/**/*"
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
# Testing Rules
|
|
83
|
+
|
|
84
|
+
- Every new function should have a corresponding test
|
|
85
|
+
- Test both happy path and error cases
|
|
86
|
+
- Use descriptive test names that explain what's being tested
|
|
87
|
+
- Mock external dependencies, not internal modules
|
|
88
|
+
`}),o.push({name:"code-quality.md",content:`# Code Quality
|
|
89
|
+
|
|
90
|
+
- No console.log in production code (use a logger)
|
|
91
|
+
- Handle errors explicitly \u2014 no empty catch blocks
|
|
92
|
+
- Extract repeated logic into shared utilities
|
|
93
|
+
`,replaces:[We]});break;case"devops":o.push({name:"deployment-safety.md",content:`# Deployment Safety
|
|
94
|
+
|
|
95
|
+
- Always verify staging before production
|
|
96
|
+
- Check disk space and memory before deploying
|
|
97
|
+
- Never expose secrets in logs or commits
|
|
98
|
+
- Use rollback-safe deployment strategies
|
|
99
|
+
`});break;case"pm":o.push({name:"communication.md",content:`# Communication Rules
|
|
100
|
+
|
|
101
|
+
- Keep GitLab comments under 5 lines for the main message
|
|
102
|
+
- Use <details> for verbose output (logs, commands, steps)
|
|
103
|
+
- Reference issues with #IID, merge requests with !IID
|
|
104
|
+
- Never mention Telegram handles on GitLab
|
|
105
|
+
`});break;case"qa":o.push({name:"bug-reports.md",content:`# Bug Report Format
|
|
106
|
+
|
|
107
|
+
Always include:
|
|
108
|
+
1. Steps to reproduce
|
|
109
|
+
2. Expected behavior
|
|
110
|
+
3. Actual behavior
|
|
111
|
+
4. Environment (browser, OS, version)
|
|
112
|
+
5. Screenshots if applicable
|
|
113
|
+
`});break}return o}function Ke(t,n,s="19900",o=console.error){let e=[],r=[],a=n.workspace;if(!f(a))return o(`Workspace not found: ${a}`),{created:e,skipped:r};if(n.tier!=="claude-code"&&n.tier!=="codex-cli")return{created:e,skipped:r};let i=(c,p)=>{f(c)?r.push(c):(z(m(c,".."),{recursive:!0}),$(c,p),e.push(c))},u=(c,p,h)=>{if(!f(c)){z(m(c,".."),{recursive:!0}),$(c,p),e.push(c);return}let g;try{g=_(c,"utf8")}catch{r.push(c);return}let w=Ne(g);if(w===null){r.push(c);return}if(w===h){r.push(c);return}$(c,p),e.push(`${c} (refreshed)`)};if(i(m(a,"AGENTS.md"),U({name:n.name,id:t,role:n.systemPrompt?.split(`
|
|
114
|
+
`)[0],workspace:a,tier:n.tier})),n.tier==="codex-cli")return e.length>0&&o(`[${t}] workspace setup: created ${e.length} file(s)`),{created:e,skipped:r};u(m(a,"CLAUDE.md"),je(t,n,s),Q(n));let l=m(a,".claude/settings.json");i(l,JSON.stringify(qe(t,n,s),null,2));let d=Je(t,n);for(let c of d){let p=m(a,".claude/rules",c.name);c.replaces&&f(p)&&c.replaces.includes(_(p,"utf8"))?($(p,c.content),e.push(p)):i(p,c.content)}return e.length>0&&o(`[${t}] workspace setup: created ${e.length} file(s)`),{created:e,skipped:r}}function Xe(t,n){let s=m(t,".claude/settings.json");if(!f(s))return!1;try{let o=JSON.parse(_(s,"utf-8")),e=!1;for(let[r,a]of Object.entries(n))if(typeof a=="object"&&a!==null&&!Array.isArray(a)){o[r]||(o[r]={});for(let[i,u]of Object.entries(a))o[r][i]===void 0&&(o[r][i]=u,e=!0)}else o[r]===void 0&&(o[r]=a,e=!0);return e&&$(s,JSON.stringify(o,null,2)),e}catch{return!1}}function Ye(t,n,s="19900",o){let e=m(t,".claude/settings.json");if(!f(e))return!1;try{let r=JSON.parse(_(e,"utf-8")),a=!1,i=r.permissions??={},u=Array.isArray(i.deny)?i.deny:i.deny=[];for(let p of O)u.includes(p)||(u.push(p),a=!0);let l=r.hooks??={},c=[...Array.isArray(l.PreToolUse)?l.PreToolUse.filter(p=>!He(p)):[],...ee(n,s,o)];return JSON.stringify(l.PreToolUse??null)!==JSON.stringify(c)&&(l.PreToolUse=c,a=!0),a&&$(e,JSON.stringify(r,null,2)),a}catch{return!1}}function Ve(t){return Array.isArray(t?.hooks)&&t.hooks.some(n=>typeof n?.command=="string"&&n.command.includes(T))}function ze(t,n,s,o){let e=m(t,".claude/settings.json");if(!f(e))return!1;try{let r=JSON.parse(_(e,"utf-8")),a=JSON.stringify(r),i=o.enabled&&o.tools.length>0,u=`Read(/${J(o.dir,n)}/**)`,l=Array.isArray(r.hooks?.PostToolUse)?r.hooks.PostToolUse:[],d=l.filter(h=>!Ve(h)),c=Array.isArray(r.permissions?.allow)?r.permissions.allow:[],p=c.filter(h=>h!==u);if(i){let g=`curl -s --max-time 5 -H 'Content-Type: application/json' --data-binary @- '${`http://127.0.0.1:${s}${T}?agent=${encodeURIComponent(n)}`}' 2>/dev/null || true`;d.push({matcher:o.tools.join("|"),hooks:[{type:"command",command:g,timeout:10}]}),p.push(u)}return(i||l.length>0)&&((r.hooks??={}).PostToolUse=d),(i||c.length>0)&&((r.permissions??={}).allow=p),JSON.stringify(r)===a?!1:($(e,JSON.stringify(r,null,2)),!0)}catch{return!1}}function Et(t,n="19900",s=console.error,o){let e=0,r=0,a=0,i=0,u=0,l=0;for(let[d,c]of Object.entries(t)){if(c.tier!=="claude-code"&&c.tier!=="codex-cli")continue;let p=Ke(d,c,n,s);if(e+=p.created.length,c.tier==="claude-code"&&Xe(c.workspace,{env:{CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:"1"}})&&r++,c.tier==="claude-code"&&Ye(c.workspace,d,n,c.mcp)&&a++,c.tier==="claude-code"&&o){let h=K(c.permissionMode);o.enabled&&!h&&l++;let g=o.enabled&&h;ze(c.workspace,d,n,{...o,enabled:g})&&(g?i++:u++)}}e>0&&s(`Workspace setup: ${e} file(s) created across agent workspaces`),r>0&&s(`Workspace patch: ${r} workspace(s) updated with agent teams support`),a>0&&s(`Guardrails: ${a} workspace(s) backfilled with deny list + PreToolUse guard hook`),i>0&&s(`ObservationPack: PostToolUse hook written to ${i} workspace(s)`),u>0&&s(`ObservationPack: PostToolUse hook removed from ${u} workspace(s)`),l>0&&s(`ObservationPack: ${l} agent(s) not packed: permissionMode is not "bypassPermissions", so they could not read a saved original back`)}export{tt as a,nt as b,st as c,ct as d,ut as e,T as f,gt as g,J as h,K as i,mt as j,ft as k,Be as l,E as m,xt as n,V as o,Ne as p,je as q,Fe as r,Ke as s,Ye as t,ze as u,Et as v};
|
|
115
|
+
//# sourceMappingURL=chunk-IFNXMUEG.js.map
|