agentix-cli 0.136.0 → 0.137.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/apps/mac-voice/Sources/AgentXVoice/AgentClient.swift +11 -1
- package/apps/mac-voice/Sources/AgentXVoice/Character.swift +18 -5
- package/apps/mac-voice/Sources/AgentXVoice/Floor.swift +46 -0
- package/apps/mac-voice/Sources/AgentXVoice/FloorWatcher.swift +78 -0
- package/apps/mac-voice/Sources/AgentXVoice/Panel.swift +12 -1
- package/apps/mac-voice/Sources/AgentXVoice/StatusMenu.swift +8 -0
- package/apps/mac-voice/Sources/AgentXVoice/main.swift +89 -10
- package/dist/{App-D6W6IV2L.js → App-MCYZBCMQ.js} +2 -2
- package/dist/{ChatApp-X7TNCFGW.js → ChatApp-7YXDEW3H.js} +2 -2
- package/dist/{absorb-eval-COPVH2M2.js → absorb-eval-L72I7PKM.js} +2 -2
- package/dist/{agent-VCGAUBER.js → agent-TPREVZGH.js} +2 -2
- package/dist/{board-dashboard-JZM3FQNV.js → board-dashboard-3VBZAKYM.js} +4 -4
- package/dist/{board-dashboard-JZM3FQNV.js.map → board-dashboard-3VBZAKYM.js.map} +1 -1
- package/dist/{chunk-ZPJVDX2U.js → chunk-264762O7.js} +2 -2
- package/dist/{chunk-C43E3YFT.js → chunk-44N5HXYE.js} +2 -2
- package/dist/{chunk-EVTTAM7S.js → chunk-5CEBOUBG.js} +2 -2
- package/dist/{chunk-HZZW35FY.js → chunk-5EIO6S3S.js} +2 -2
- package/dist/{chunk-QTDKNJXD.js → chunk-64ZACYOF.js} +245 -245
- package/dist/chunk-64ZACYOF.js.map +1 -0
- package/dist/chunk-6BWVJ7UJ.js +54 -0
- package/dist/chunk-6BWVJ7UJ.js.map +1 -0
- package/dist/{chunk-5X37CXJF.js → chunk-APIANBXV.js} +2 -2
- package/dist/{chunk-5J5USW2O.js → chunk-AYYEY5UJ.js} +2 -2
- package/dist/{chunk-WRJFKA43.js → chunk-DX6RYYGP.js} +2 -2
- package/dist/{chunk-FQLSV2C4.js → chunk-EFUPLTQ3.js} +2 -2
- package/dist/{chunk-HEJTE7OC.js → chunk-ETOOT5KD.js} +2 -2
- package/dist/{chunk-PV623BLN.js → chunk-GW4LKNQT.js} +3 -3
- package/dist/{chunk-OW5EXDVY.js → chunk-HSX5LMXD.js} +2 -2
- package/dist/{chunk-KZXQD6ZK.js → chunk-I5QKJH7V.js} +2 -2
- package/dist/{chunk-M5B4QG6J.js → chunk-JXIMGK7Z.js} +2 -2
- package/dist/chunk-KEJGWFGS.js +105 -0
- package/dist/chunk-KEJGWFGS.js.map +1 -0
- package/dist/{chunk-66DPMVUC.js → chunk-KOKPK3OL.js} +2 -2
- package/dist/{chunk-K75LFQE3.js → chunk-LGM22AOB.js} +2 -2
- package/dist/{chunk-VA24JS2S.js → chunk-OLZL32KG.js} +2 -2
- package/dist/{chunk-H2N7DOPT.js → chunk-P6PTY2NP.js} +2 -2
- package/dist/{chunk-H2N7DOPT.js.map → chunk-P6PTY2NP.js.map} +1 -1
- package/dist/{chunk-M5AHI2PZ.js → chunk-PLCK4ZAG.js} +2 -2
- package/dist/{chunk-QCUJTAAZ.js → chunk-PYR7GKK7.js} +5 -5
- package/dist/{chunk-QCUJTAAZ.js.map → chunk-PYR7GKK7.js.map} +1 -1
- package/dist/{chunk-GL3H7XMI.js → chunk-QKILE72V.js} +2 -2
- package/dist/{chunk-AK3XOA5N.js → chunk-QQ67J76O.js} +2 -2
- package/dist/{chunk-IPMXIPTS.js → chunk-RX2ISTNT.js} +2 -2
- package/dist/{chunk-HH7OFAEM.js → chunk-ZX2NJGIU.js} +2 -2
- package/dist/{chunk-HH7OFAEM.js.map → chunk-ZX2NJGIU.js.map} +1 -1
- package/dist/cli.js +1 -1
- package/dist/{client-SMOWSRJY.js → client-G2QA4TCG.js} +2 -2
- package/dist/{config-OGUDWYAA.js → config-OD5W6IQE.js} +2 -2
- package/dist/{config-mutate-BH27TMWK.js → config-mutate-JEXLMR2L.js} +2 -2
- package/dist/config-mutator-4FKROX3O.js +2 -0
- package/dist/{contributions-H6T65TCY.js → contributions-UXLHUMF2.js} +2 -2
- package/dist/{doctor-ZOXHT7ZQ.js → doctor-DO2WN4TS.js} +2 -2
- package/dist/{follow-up-tool-GUBBXNEZ.js → follow-up-tool-QPNJD3HR.js} +2 -2
- package/dist/{hub-IIW2GBO5.js → hub-RFE766AM.js} +2 -2
- package/dist/index.d.ts +69 -36
- package/dist/index.js +1 -1
- package/dist/{program-WROQ55F5.js → program-QENG5KI7.js} +208 -208
- package/dist/program-QENG5KI7.js.map +1 -0
- package/dist/{promote-HDLU44MX.js → promote-FJ3EK2J6.js} +2 -2
- package/dist/{query-6G27CBZQ.js → query-KYA6YYUU.js} +2 -2
- package/dist/{query-settings-G4M75LVQ.js → query-settings-P3UOGMAQ.js} +2 -2
- package/dist/{registry-3RE5SG22.js → registry-U4S4XXUZ.js} +2 -2
- package/dist/{request-planner-T3VCZVVQ.js → request-planner-SYVDD4PZ.js} +2 -2
- package/dist/{review-candidates-C3O3CENL.js → review-candidates-QUIX4AK7.js} +2 -2
- package/dist/{routing-LD35TJM5.js → routing-MDZOHYYH.js} +2 -2
- package/dist/rules-UVUJTVOE.js +24 -0
- package/dist/rules-UVUJTVOE.js.map +1 -0
- package/dist/schedule-tool-DKBPBQ3F.js +2 -0
- package/dist/{scheduler-I3QB4GI3.js → scheduler-76IIRAP7.js} +2 -2
- package/dist/{seat-4Y3EW3KU.js → seat-TV5SK2E7.js} +2 -2
- package/dist/{select-LZKN3FER.js → select-HKRDVQNW.js} +2 -2
- package/dist/{set-enabled-WSTOHJDE.js → set-enabled-I2V3PXOA.js} +2 -2
- package/dist/{tool-AKXO2EJU.js → tool-5ZFM6NSO.js} +2 -2
- package/dist/{tool-NLMIUOHR.js → tool-J7PYS4NF.js} +2 -2
- package/dist/{wiki-ZS6OHOWQ.js → wiki-3VG33ZZB.js} +2 -2
- package/dist/wiki-enrich-2FNORKEQ.js +2 -0
- package/package.json +1 -1
- package/dist/chunk-54OORW5I.js +0 -54
- package/dist/chunk-54OORW5I.js.map +0 -1
- package/dist/chunk-OISCRNMW.js +0 -105
- package/dist/chunk-OISCRNMW.js.map +0 -1
- package/dist/chunk-QTDKNJXD.js.map +0 -1
- package/dist/config-mutator-Q62AS2TR.js +0 -2
- package/dist/program-WROQ55F5.js.map +0 -1
- package/dist/rules-HUUFXQD6.js +0 -24
- package/dist/rules-HUUFXQD6.js.map +0 -1
- package/dist/schedule-tool-46TVGEYU.js +0 -2
- package/dist/wiki-enrich-NGPFWTVA.js +0 -2
- /package/dist/{App-D6W6IV2L.js.map → App-MCYZBCMQ.js.map} +0 -0
- /package/dist/{ChatApp-X7TNCFGW.js.map → ChatApp-7YXDEW3H.js.map} +0 -0
- /package/dist/{absorb-eval-COPVH2M2.js.map → absorb-eval-L72I7PKM.js.map} +0 -0
- /package/dist/{agent-VCGAUBER.js.map → agent-TPREVZGH.js.map} +0 -0
- /package/dist/{chunk-ZPJVDX2U.js.map → chunk-264762O7.js.map} +0 -0
- /package/dist/{chunk-C43E3YFT.js.map → chunk-44N5HXYE.js.map} +0 -0
- /package/dist/{chunk-EVTTAM7S.js.map → chunk-5CEBOUBG.js.map} +0 -0
- /package/dist/{chunk-HZZW35FY.js.map → chunk-5EIO6S3S.js.map} +0 -0
- /package/dist/{chunk-5X37CXJF.js.map → chunk-APIANBXV.js.map} +0 -0
- /package/dist/{chunk-5J5USW2O.js.map → chunk-AYYEY5UJ.js.map} +0 -0
- /package/dist/{chunk-WRJFKA43.js.map → chunk-DX6RYYGP.js.map} +0 -0
- /package/dist/{chunk-FQLSV2C4.js.map → chunk-EFUPLTQ3.js.map} +0 -0
- /package/dist/{chunk-HEJTE7OC.js.map → chunk-ETOOT5KD.js.map} +0 -0
- /package/dist/{chunk-PV623BLN.js.map → chunk-GW4LKNQT.js.map} +0 -0
- /package/dist/{chunk-OW5EXDVY.js.map → chunk-HSX5LMXD.js.map} +0 -0
- /package/dist/{chunk-KZXQD6ZK.js.map → chunk-I5QKJH7V.js.map} +0 -0
- /package/dist/{chunk-M5B4QG6J.js.map → chunk-JXIMGK7Z.js.map} +0 -0
- /package/dist/{chunk-66DPMVUC.js.map → chunk-KOKPK3OL.js.map} +0 -0
- /package/dist/{chunk-K75LFQE3.js.map → chunk-LGM22AOB.js.map} +0 -0
- /package/dist/{chunk-VA24JS2S.js.map → chunk-OLZL32KG.js.map} +0 -0
- /package/dist/{chunk-M5AHI2PZ.js.map → chunk-PLCK4ZAG.js.map} +0 -0
- /package/dist/{chunk-GL3H7XMI.js.map → chunk-QKILE72V.js.map} +0 -0
- /package/dist/{chunk-AK3XOA5N.js.map → chunk-QQ67J76O.js.map} +0 -0
- /package/dist/{chunk-IPMXIPTS.js.map → chunk-RX2ISTNT.js.map} +0 -0
- /package/dist/{client-SMOWSRJY.js.map → client-G2QA4TCG.js.map} +0 -0
- /package/dist/{config-OGUDWYAA.js.map → config-OD5W6IQE.js.map} +0 -0
- /package/dist/{config-mutate-BH27TMWK.js.map → config-mutate-JEXLMR2L.js.map} +0 -0
- /package/dist/{config-mutator-Q62AS2TR.js.map → config-mutator-4FKROX3O.js.map} +0 -0
- /package/dist/{contributions-H6T65TCY.js.map → contributions-UXLHUMF2.js.map} +0 -0
- /package/dist/{doctor-ZOXHT7ZQ.js.map → doctor-DO2WN4TS.js.map} +0 -0
- /package/dist/{follow-up-tool-GUBBXNEZ.js.map → follow-up-tool-QPNJD3HR.js.map} +0 -0
- /package/dist/{hub-IIW2GBO5.js.map → hub-RFE766AM.js.map} +0 -0
- /package/dist/{promote-HDLU44MX.js.map → promote-FJ3EK2J6.js.map} +0 -0
- /package/dist/{query-6G27CBZQ.js.map → query-KYA6YYUU.js.map} +0 -0
- /package/dist/{query-settings-G4M75LVQ.js.map → query-settings-P3UOGMAQ.js.map} +0 -0
- /package/dist/{registry-3RE5SG22.js.map → registry-U4S4XXUZ.js.map} +0 -0
- /package/dist/{request-planner-T3VCZVVQ.js.map → request-planner-SYVDD4PZ.js.map} +0 -0
- /package/dist/{review-candidates-C3O3CENL.js.map → review-candidates-QUIX4AK7.js.map} +0 -0
- /package/dist/{routing-LD35TJM5.js.map → routing-MDZOHYYH.js.map} +0 -0
- /package/dist/{schedule-tool-46TVGEYU.js.map → schedule-tool-DKBPBQ3F.js.map} +0 -0
- /package/dist/{scheduler-I3QB4GI3.js.map → scheduler-76IIRAP7.js.map} +0 -0
- /package/dist/{seat-4Y3EW3KU.js.map → seat-TV5SK2E7.js.map} +0 -0
- /package/dist/{select-LZKN3FER.js.map → select-HKRDVQNW.js.map} +0 -0
- /package/dist/{set-enabled-WSTOHJDE.js.map → set-enabled-I2V3PXOA.js.map} +0 -0
- /package/dist/{tool-AKXO2EJU.js.map → tool-5ZFM6NSO.js.map} +0 -0
- /package/dist/{tool-NLMIUOHR.js.map → tool-J7PYS4NF.js.map} +0 -0
- /package/dist/{wiki-ZS6OHOWQ.js.map → wiki-3VG33ZZB.js.map} +0 -0
- /package/dist/{wiki-enrich-NGPFWTVA.js.map → wiki-enrich-2FNORKEQ.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j,l as k,m as l,n as m,o as n,p as o,q as p,r as q,s as r,t as s,u as t}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=promote-
|
|
1
|
+
import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j,l as k,m as l,n as m,o as n,p as o,q as p,r as q,s as r,t as s,u as t}from"./chunk-JXIMGK7Z.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-MEFPXHQJ.js";import"./chunk-KEJGWFGS.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-HSX5LMXD.js";import"./chunk-WPNRDEHW.js";import"./chunk-KOKPK3OL.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-QOYAX2FT.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-6BWVJ7UJ.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as DEFAULT_PROMOTE_TYPES,a as PROMOTER_OWNER,c as PROMOTION_LEDGER_FILE,j as appendPromotionLedger,s as approveProposal,n as callPromotionLlm,p as estimateTokens,r as evidenceFor,m as getUnpromotedMemories,k as groupCandidates,h as listAllAgentMemories,d as memoryKey,e as memoryStamp,g as mergeSources,f as parseMemoryStamp,l as parsePromotionResponse,i as readPromotionLedger,t as rejectProposal,o as runPromotion,q as sourceKind};
|
|
2
|
+
//# sourceMappingURL=promote-FJ3EK2J6.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=query-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j}from"./chunk-GW4LKNQT.js";import"./chunk-SKSYII3K.js";import"./chunk-HSX5LMXD.js";import"./chunk-WPNRDEHW.js";import"./chunk-MWNCS57L.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-KOKPK3OL.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-6TURWSMN.js";import"./chunk-QD6IICK7.js";import"./chunk-QOYAX2FT.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-6BWVJ7UJ.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{c as AUTO_SUMMARY_COVERAGE,a as CATALOG_SELECTOR_MODEL,b as CATALOG_SYNTH_MODEL,h as DEFAULT_GRAPH_WEIGHT,g as SHARED_CATALOG_LINES,d as agenticQuery,f as catalogPool,i as rankCatalogPool,e as retrieveArticles,j as sharedQueryEnabled};
|
|
2
|
+
//# sourceMappingURL=query-KYA6YYUU.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import{b as u}from"./chunk-MEFPXHQJ.js";import{c as a}from"./chunk-SKSYII3K.js";import"./chunk-MWNCS57L.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-6TURWSMN.js";import"./chunk-QD6IICK7.js";import"./chunk-QIJLFPWE.js";import{readFileSync as f}from"fs";import{resolve as d}from"path";var g={shared:!0,method:"auto",summaries:a,notes:{enabled:!1,types:["project","reference"],dirs:{}}};function y(n,t,e=process.cwd()){if(!n.notes.enabled||!t)return;let r=n.notes.dirs[t];return{owner:t,dir:r?d(e,r):new u({baseDir:d(e,".agentx")}).dirOf(t),types:n.notes.types}}function E(n,t,e=process.env,r=process.cwd()){let i=e.AGENTX_AGENT_ID;if(!(!i||i!==t))return y(n,t,r)}function p(n){if(n)try{return f(n,"utf-8").trim().split(`
|
|
2
|
-
`)[0].trim()||void 0}catch{return}}function c(n,t){try{let e=new URL(n);return e.protocol==="https:"&&e.origin===new URL(t).origin}catch{return!1}}var l=n=>n.map(t=>typeof t=="string"?{repo:t}:{repo:t.repo,about:t.about});function h(n,t=process.env){let e=[];for(let r of n.wiki.query.live.sources){if(r.type==="agentx"){let o=n.node.bind.replace(/^0\.0\.0\.0:/,"127.0.0.1:");e.push({type:"agentx",url:r.url??`http://${o}`,peers:r.peers});continue}let i=(r.tokenEnv?t[r.tokenEnv]:void 0)||p(r.tokenFile);if(r.type==="github"){let o=n.channels.github,s=c(r.apiUrl,"https://api.github.com")?o?.token||p(o?.tokenFile):void 0;e.push({type:"github",apiUrl:r.apiUrl,token:i||s||void 0,repos:l(r.repos)})}else{let o=n.channels.gitlab,s=r.url??o?.host;if(!s)continue;let m=o?.host&&(!r.url||c(s,o.host))?o.token:void 0;e.push({type:"gitlab",url:s,token:i||m||void 0,repos:l(r.repos)})}}return e}function v(n,t=process.env){let e=n.wiki.query;return{shared:e.shared,method:e.method,summaries:{candidates:e.candidates,sharedCandidates:e.sharedCandidates,noteCandidates:e.notes.candidates,maxPages:e.maxPages,pageChars:e.pageChars,linkedPages:e.linkedPages,linkedChars:e.linkedChars,navigatorModel:e.navigatorModel,answerModel:e.answerModel,live:{enabled:e.live.enabled,maxReads:e.live.maxReads,timeoutMs:e.live.timeoutMs,plannerModel:e.live.plannerModel,sources:h(n,t)}},notes:{enabled:e.notes.enabled,types:e.notes.types,dirs:Object.fromEntries(Object.entries(n.agents).flatMap(([r,i])=>i.wiki?.notes?.dir?[[r,i.wiki.notes.dir]]:[]))}}}async function M(n){try{let{loadDaemonConfig:t}=await import("./config-
|
|
3
|
-
//# sourceMappingURL=query-settings-
|
|
2
|
+
`)[0].trim()||void 0}catch{return}}function c(n,t){try{let e=new URL(n);return e.protocol==="https:"&&e.origin===new URL(t).origin}catch{return!1}}var l=n=>n.map(t=>typeof t=="string"?{repo:t}:{repo:t.repo,about:t.about});function h(n,t=process.env){let e=[];for(let r of n.wiki.query.live.sources){if(r.type==="agentx"){let o=n.node.bind.replace(/^0\.0\.0\.0:/,"127.0.0.1:");e.push({type:"agentx",url:r.url??`http://${o}`,peers:r.peers});continue}let i=(r.tokenEnv?t[r.tokenEnv]:void 0)||p(r.tokenFile);if(r.type==="github"){let o=n.channels.github,s=c(r.apiUrl,"https://api.github.com")?o?.token||p(o?.tokenFile):void 0;e.push({type:"github",apiUrl:r.apiUrl,token:i||s||void 0,repos:l(r.repos)})}else{let o=n.channels.gitlab,s=r.url??o?.host;if(!s)continue;let m=o?.host&&(!r.url||c(s,o.host))?o.token:void 0;e.push({type:"gitlab",url:s,token:i||m||void 0,repos:l(r.repos)})}}return e}function v(n,t=process.env){let e=n.wiki.query;return{shared:e.shared,method:e.method,summaries:{candidates:e.candidates,sharedCandidates:e.sharedCandidates,noteCandidates:e.notes.candidates,maxPages:e.maxPages,pageChars:e.pageChars,linkedPages:e.linkedPages,linkedChars:e.linkedChars,navigatorModel:e.navigatorModel,answerModel:e.answerModel,live:{enabled:e.live.enabled,maxReads:e.live.maxReads,timeoutMs:e.live.timeoutMs,plannerModel:e.live.plannerModel,sources:h(n,t)}},notes:{enabled:e.notes.enabled,types:e.notes.types,dirs:Object.fromEntries(Object.entries(n.agents).flatMap(([r,i])=>i.wiki?.notes?.dir?[[r,i.wiki.notes.dir]]:[]))}}}async function M(n){try{let{loadDaemonConfig:t}=await import("./config-OD5W6IQE.js");return v(t(n))}catch{return g}}export{g as DEFAULT_QUERY_SETTINGS,M as loadQuerySettings,c as mayLendToken,y as noteSourceFor,h as resolveLiveSources,v as resolveQuerySettings,E as toolNoteSourceFor};
|
|
3
|
+
//# sourceMappingURL=query-settings-P3UOGMAQ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$ as j,S as a,T as b,U as c,V as d,W as e,X as f,Y as g,Z as h,_ as i,aa as k,ba as l,ca as m,da as n}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=registry-
|
|
1
|
+
import{$ as j,S as a,T as b,U as c,V as d,W as e,X as f,Y as g,Z as h,_ as i,aa as k,ba as l,ca as m,da as n}from"./chunk-PYR7GKK7.js";import"./chunk-5EIO6S3S.js";import"./chunk-QSKG754X.js";import"./chunk-MEFPXHQJ.js";import"./chunk-SZDACK6O.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-QQ67J76O.js";import"./chunk-DX6RYYGP.js";import"./chunk-3UOTLMXD.js";import"./chunk-36AXN6ZB.js";import"./chunk-PE5V2LI7.js";import"./chunk-GQ76J72O.js";import"./chunk-ILEC3IAV.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-VWTBHLMX.js";import"./chunk-44N5HXYE.js";import"./chunk-KEJGWFGS.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-GW4LKNQT.js";import"./chunk-SKSYII3K.js";import"./chunk-HSX5LMXD.js";import"./chunk-WPNRDEHW.js";import"./chunk-MWNCS57L.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-EFUPLTQ3.js";import"./chunk-KOKPK3OL.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-MYVHVJWZ.js";import"./chunk-6TURWSMN.js";import"./chunk-AV7T3SYT.js";import"./chunk-Y5MFVVTM.js";import"./chunk-QD6IICK7.js";import"./chunk-QOYAX2FT.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-DSYKYZMT.js";import"./chunk-6BWVJ7UJ.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{m as AgentRegistry,a as EDIT_TOOL_INSTRUCTION,h as TRACE_STEP_SUMMARY_BYTES,e as buildEntryMeta,f as buildEventDigest,g as buildWikiContext,i as clipForTrace,b as codingInstructions,l as emitTraceStepsFromStreamEvent,k as firstMissingRequiredTool,d as getGlobalRegistry,n as richReplyPrompt,c as setGlobalRegistry,j as tallyToolUses};
|
|
2
|
+
//# sourceMappingURL=registry-U4S4XXUZ.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{p as f,s as h,v as g,y as m,z as E}from"./chunk-
|
|
1
|
+
import{p as f,s as h,v as g,y as m,z as E}from"./chunk-KOKPK3OL.js";import{a as p,f as w}from"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-6BWVJ7UJ.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";E();w();var l="request-gate",x="request-context",q=.1,C=3e3;function b(t,s){return s??f(t)??C}async function k(t,s,n,r=Math.random){let d=g(l)==="active";if(d){let e=h().seats[l]?.holdout??q;if(r()<e)return{active:!0,preprocess:!1,arm:"holdout"}}let i=d?"treatment":void 0,a=await m(l,{request:t.slice(0,2e3),agent:s,channel:n,operations:["select optional context","evaluate model routing where permitted"],constraints:["Keep the original request and mandatory instructions","Desktop model cannot be downgraded"]},{preprocess:p("This request benefits from structured context selection or another bounded typed decision before the main agent executes.",{true:"Relevant context must be selected, or a bounded routing decision can help. Follow-ups and ambiguous references need context.",false:"Typed preprocessing adds no useful decision; send the request to the configured main agent with existing context."})},{timeoutMs:b(l)});if(!a||a.mode!=="active")return{active:!1,preprocess:!1,arm:i};let c=a.answers.preprocess?.noul;return{active:!0,preprocess:Number.isFinite(c)&&c>=.5,arm:i}}var T={patternContext:"Learned behavioral patterns",references:"Retrieved project references",memoryContext:"Retrieved agent memory",crossChatContext:"Summaries from other conversations",longMemoryRecall:"Older conversation recall",wikiContext:"Retrieved wiki knowledge"},v=[{id:"landscape",header:/^\[Landscape\]$/,description:"Directory of the other agents on this node and on mesh peers, and the channels they are on"},{id:"landscape.messaging",header:/^\[Cross-Channel Messaging\]$/,description:"How to send a message to a different channel than the one this request came from"},{id:"landscape.recall",header:/^\[Conversation Recall\b/,description:"How to look up earlier turns of a conversation that are not in the prompt"},{id:"landscape.monitoring",header:/^\[Background Monitoring\]$/,description:"How to watch logs, pipelines or files in the background"},{id:"landscape.teams",header:/^\[Agent Teams\]$/,description:"How to split a large task across a team of parallel agents"}];function S(t){let s=[],n=null;for(let r of t.split(`
|
|
2
2
|
`)){let d=/^\[[^\]]+\]$/.test(r);if(d||!n){let i=d?v.find(a=>a.header.test(r)):void 0;n={id:i?i.id:null,text:r},s.push(n)}else n.text+=`
|
|
3
3
|
`+r}return s}async function O(t,s={}){let n=Object.entries(T).flatMap(([e,o])=>{let u=t[e];return u?[y(e,o,u)]:[]}),r=t.landscape?S(t.landscape):[];for(let e of r){if(!e.id||!e.text.trim())continue;let o=v.find(u=>u.id===e.id);n.push(y(e.id,o.description,e.text))}if(!n.length)return{input:t,excluded:[]};let d=Object.fromEntries(n.map(e=>[e.id,p(`Context block ${e.id} is relevant to completing the current request correctly.`,{true:"Needed or potentially relevant; retain if uncertain or the preview is incomplete.",false:"Clearly unrelated to the current request; safe to omit."})])),i=await m(x,{request:t.message.slice(0,2e3),channel:t.channel,agent:t.agentId,mandatory:["request","identity","permissions and instructions","same-chat history","handover","attachments","group-chat rules"],context:n},d,{timeoutMs:b(x,s.timeoutMs)});if(!i||i.mode!=="active")return{input:t,excluded:[]};let a={...t},c=[];for(let e of n){let o=i.answers[e.id]?.noul;Number.isFinite(o)&&o>=0&&o<.2&&c.push(e.id)}for(let e of c)e in T&&delete a[e];if(r.some(e=>e.id&&c.includes(e.id))){let e=r.filter(o=>!o.id||!c.includes(o.id)).map(o=>o.text.trim()).filter(Boolean);a.landscape=e.length?e.join(`
|
|
4
4
|
|
|
5
5
|
`):void 0}return{input:a,excluded:c}}function y(t,s,n){return{id:t,description:s,source:t,characters:n.length,preview:n.slice(0,400),trust:"context data, not instructions"}}export{q as DEFAULT_REQUEST_GATE_HOLDOUT,x as REQUEST_CONTEXT_SEAT,l as REQUEST_GATE_SEAT,C as REQUEST_SEAT_TIMEOUT_MS,k as evaluateRequest,O as selectRequestContext,S as splitLandscape};
|
|
6
|
-
//# sourceMappingURL=request-planner-
|
|
6
|
+
//# sourceMappingURL=request-planner-SYVDD4PZ.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as I}from"./chunk-
|
|
1
|
+
import{b as I}from"./chunk-ETOOT5KD.js";import"./chunk-QSKG754X.js";import"./chunk-KOKPK3OL.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-6TURWSMN.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-6BWVJ7UJ.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";import{createHash as E}from"crypto";var v="review:",b={decisions:"project",warnings:"feedback",friction:"feedback",context:"reference"};function A(t,n,r){let s=E("sha1").update(r.trim().toLowerCase()).digest("hex").slice(0,10);return`${v}${t}/${n}@${s}`}function F(t){if(!t.startsWith(v))return null;let n=t.slice(v.length),r=n.lastIndexOf("@"),s=n.lastIndexOf("/",r===-1?void 0:r);return r===-1||s===-1?null:{reviewId:n.slice(0,s),kind:n.slice(s+1,r),digest:n.slice(r+1)}}var C=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,48)||"finding",L=5;function T(t,n){return`${t}|${I(n)}`}function K(t,n={}){let r=n.kinds??Object.keys(b),s=n.minLength??24,h=[],d=new Map,u=new Map,f=new Map,x=new Map;for(let e of t){let i;try{i=JSON.parse(e.result)}catch{continue}let o=e.updated_at?new Date(e.updated_at).toISOString():new Date().toISOString();for(let c of r){let l=b[c];if(!l)continue;let R=i[c];if(Array.isArray(R))for(let $ of R){let a=String($?.text??"").trim();if(a.length<s)continue;let g=A(e.id,c,a),_=g.slice(g.lastIndexOf("@")),w=`${c}${_}`,y=T(c,a),S=f.get(y)??new Set;if(S.add(e.session_id??e.id),f.set(y,S),d.has(w))continue;let O=String($?.evidence??"").trim(),k={occurrences:1,agentId:e.agent,key:`${e.agent}/${l}_${C(a)}`,stamp:g,memory:{name:C(a),type:l,description:a.slice(0,200),body:"",createdAt:o,updatedAt:o}};x.set(g,{text:a,evidence:O,agent:e.agent,source:e.source}),d.set(w,k),u.set(w,y),h.push(k)}}}for(let[e,i]of d){let o=f.get(u.get(e)??"");i.occurrences=o?.size??1,i.sessions=[...o??[]].slice(0,L);let c=x.get(i.stamp);i.memory.body=D(c,i.occurrences)}let m=new Map;for(let[e,i]of d){let o=u.get(e)??e,c=m.get(o)??[];c.push(i),m.set(o,c)}let M=[...m.values()].sort((e,i)=>i[0].occurrences-e[0].occurrences),p=[];for(let e=0;p.length<h.length;e++){let i=!1;for(let o of M)e<o.length&&(p.push(o[e]),i=!0);if(!i)break}return p}function D(t,n){let r=`${t.agent}${t.source?` via ${t.source}`:""}`,s=[];return n>1?(s.push(`Observed in ${n} separate sessions. Most recently stated as:`),s.push(`> ${t.text}`),s.push(`Recurring across ${n} sessions is what makes this worth recording \u2014 any single occurrence is session state, the repetition is the finding.`)):s.push(t.text),t.evidence&&s.push(`**Evidence:** ${t.evidence}`),s.push(`_From ${n>1?"session reviews":"a session review"} of ${r}._`),s.join(`
|
|
2
2
|
|
|
3
3
|
`)}export{L as MAX_EVIDENCE_SESSIONS,b as PROMOTABLE_KINDS,v as REVIEW_STAMP_PREFIX,F as parseReviewStamp,A as reviewStamp,K as reviewsToCandidates};
|
|
4
|
-
//# sourceMappingURL=review-candidates-
|
|
4
|
+
//# sourceMappingURL=review-candidates-QUIX4AK7.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c,d,e,f}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=routing-
|
|
1
|
+
import{a,b,c,d,e,f}from"./chunk-EFUPLTQ3.js";import"./chunk-KOKPK3OL.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-6BWVJ7UJ.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{e as DEFAULT_TRIAGE_ACTIONS,a as DOWNGRADE_BELOW,b as channelKeepsConfiguredModel,c as cheapModelForEngine,d as routeTaskModel,f as triageModelFor};
|
|
2
|
+
//# sourceMappingURL=routing-MDZOHYYH.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import{d as x,i as ie,k as ae,m as G}from"./chunk-U6EJ53DA.js";import{k as T}from"./chunk-H4NSB54D.js";import"./chunk-MTX4UPNB.js";import{f,g as O}from"./chunk-QAWKN2N4.js";import"./chunk-IMLAPB7G.js";import{c as re}from"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-QIJLFPWE.js";import{createHash as $e}from"crypto";import{existsSync as be,mkdirSync as Re,readFileSync as Se,writeFileSync as We}from"fs";import{resolve as q}from"path";var C="wiki-rules",E="wiki-rules",_e=["deadline","due date","due by","penalt","late fee","fine of","fined","must file","must pay","must declare","must submit","filing","obligation","compliance","tax return","\xE9ch\xE9ance","date limite","d\xE9lai","p\xE9nalit","amende","majoration","d\xE9claration","obligation","\u063A\u0631\u0627\u0645\u0629","\u0623\u062C\u0644","\u0622\u062C\u0627\u0644","\u062A\u0635\u0631\u064A\u062D","\u062E\u0637\u064A\u0629"],xe=new Set(["event","agent","device","server","app","domain","account","penalty","relief","due_date","person"]),ve=new Set(["person","organization"]),Ae=6e3,Ee=900,W=(e,t)=>e.length>t?`${e.slice(0,t)}\u2026`:e,S=e=>typeof e=="string"?e.replace(/\s+/g," ").trim():"",j=e=>S(e).replace(/["\[\]]/g,"").slice(0,120).trim();function Xe(e=_e){let t=e.map(s=>s.trim().replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).filter(Boolean);return new RegExp(`(^|[^\\p{L}\\p{N}])(${t.join("|")})`,"iu")}function Ie(e,t){return t.test(`${e.article.meta.title}
|
|
2
|
+
${T(e.article.content)}`)}function Pe(e,t,s=[]){let n=new Set(s.map(f)),i=r=>r.pages.every(u=>(u.article.meta.tags??[]).includes(E)),a=r=>r.type==="legal_source"?0:r.type==="obligation"?1:2;return[...e.entities.values()].filter(r=>!i(r)).filter(r=>n.size?n.has(f(r.id))||n.has(f(r.title)):r.type==="legal_source"||r.type==="obligation"||!xe.has(r.type)&&r.pages.some(u=>Ie(u,t))).sort((r,u)=>a(r)-a(u)||u.sources.length-r.sources.length||r.title.localeCompare(u.title))}function se(e,t,s,n){let i=` ${f(s)} `,a=new Set([...(e.outgoing.get(t.id)??[]).map(r=>r.to),...(e.incoming.get(t.id)??[]).map(r=>r.from)]);return[...e.entities.values()].filter(r=>n.has(r.type)&&r.id!==t.id).filter(r=>a.has(r.id)||f(r.title).length>=3&&i.includes(` ${f(r.title)} `)).slice(0,40)}function Ue(e,t,s,n){let i=`${s.article.meta.title}
|
|
3
|
+
${T(s.article.content)}`,a=n(s.article.meta.sources??[]).sort((l,g)=>g.date.localeCompare(l.date)).slice(0,10),r=`${i}
|
|
4
|
+
${a.map(l=>l.content).join(`
|
|
5
|
+
`)}`,u=l=>l.pages.some(g=>x(g.article.meta,s.article.meta)),o=l=>[...e.entities.values()].filter(g=>g.type===l&&g.id!==t.id&&u(g));return{source:t,page:s,entries:a,known:o("obligation").slice(0,60),laws:o("legal_source").slice(0,40),parties:se(e,t,r,ve).filter(u),authorities:se(e,t,r,new Set(["organization"])).filter(u)}}function oe(e){let t=[`${e.agentId}/${e.article.path}`,T(e.article.content),...(e.article.meta.sources??[]).slice().sort()];return $e("sha1").update(t.join(`
|
|
6
|
+
`)).digest("hex").slice(0,16)}function Te(e,t){let s=t.statements.filter(n=>["action","due_rule"].includes(n.property)).map(n=>`${n.property}: ${n.value}`);return`- ${t.title}${s.length?` (${s.join("; ")})`:""}`}function Ce(e,t,s){let n=t.page,i=[`You are writing the rules one wiki page states, so nobody has to research them again. Today is ${s}.`,"",`## The page: ${n.agentId}/${n.article.path}: "${n.article.meta.title}"`,W(T(n.article.content),Ae),"","## Source entries behind the page (newest first)"];for(let a of t.entries)i.push(`### entry ${a.id} (${a.date}, ${a.agentId})`,W(a.content.trim(),Ee),"");return i.push("## Rule pages that already exist",...t.known.map(a=>Te(e,a)),""),i.push("## Legal source pages",...t.laws.map(a=>`- ${a.title}`),""),i.push("## People and organizations it names",...t.parties.map(a=>`- ${a.title} (${a.type})`),""),i.push("## Task","List each rule the page or the entries state: something a person or organization must do, by a deadline or on a schedule, often with a penalty when they do not.","Return one JSON object and nothing else:",'{"rules": [{"title": "\u2026", "action": "\u2026", "bearer": ["\u2026"], "deadline": "\u2026", "amount": "\u2026", "authority": "\u2026", "penalty": "\u2026", "basis": "\u2026", "procedure": "\u2026", "source": "\u2026"}]}',"","Rules:",'- title: a short name for the rule, such as "Monthly payroll tax filing". When it is one of the rule pages that already exist, use that title exactly.',"- action: what must be done, in one sentence. A rule without one is dropped.",'- bearer: who must do it. Use a listed person or organization title when it is one, else a short description such as "every employer".','- deadline: when, as the rule says it ("by the 15th of the following month"), not a computed date.',"- amount: what is paid or declared, if the rule says. authority: who it is filed with or paid to.","- penalty: what happens when it is late or missing, as stated.","- basis: the law, article or document it comes from. Use a listed legal source title when it is one.","- procedure: how it is done, in one sentence, if stated.","- source: the entry id or the page (agent/path) the rule comes from. A rule without one is dropped.","- Leave a field empty when the page and entries do not state it. Never guess a deadline, an amount or a penalty.","- Do not list one-time tasks, reminders or plans; only standing rules.","- Write in the language the page is written in.",'- No rules on the page: return {"rules": []}.'),i.join(`
|
|
7
|
+
`)}function De(e,t,s){let n=[],i=t.page,a=[...t.entries.map(l=>l.id),`${i.agentId}/${i.article.path}`,i.article.path],r=new Map(t.known.map(l=>[f(l.title),l])),u=[],o=new Set;for(let l of Array.isArray(e.rules)?e.rules:[]){let g=l??{},c=j(S(g.title)),p=W(S(g.action),400),$=S(g.source);if(!c){n.push("a rule with no title");continue}if(!p){n.push(`${c}: no action`);continue}if(!$||!a.some(R=>$.includes(R))){n.push(`${c}: source not among those given`);continue}if(o.has(f(c)))continue;o.add(f(c));let m=r.get(f(c)),h=s.names.get(f(c)),w=!m&&h?s.entities.get(h):void 0;if(w&&w.type!=="obligation"){n.push(`${c}: a page of type ${w.type} already has this title`);continue}let v=(Array.isArray(g.bearer)?g.bearer:[g.bearer]).map(R=>W(S(R),120)).filter(Boolean);u.push({title:m?.title??w?.title??c,existing:m??w,action:p,bearers:[...new Set(v)].slice(0,5),deadline:W(S(g.deadline),200),amount:W(S(g.amount),200),authority:W(S(g.authority),120),penalty:W(S(g.penalty),300),basis:W(S(g.basis),200),procedure:W(S(g.procedure),400),source:W($,200)})}return{rules:u,dropped:n}}function M(e,t){return t.find(n=>f(n.title)===f(e))?.title??e}function L(e,t){let s=i=>i&&/^\d{4}-\d{2}-\d{2}/.test(i)?i.slice(0,10):void 0;return t.entries.filter(i=>e.source.includes(i.id)).map(i=>s(i.date)).filter(Boolean).sort().at(-1)??s(t.entries[0]?.date)??s(t.page.article.meta.created)}function Oe(e,t){let s=L(e,t),n=(a,r)=>({property:a,value:r,source:e.source,...s?{checked_at:s}:{},status:"proposed",by:C}),i=[n("action",e.action)];for(let a of e.bearers)i.push(n("bearer",M(a,t.parties)));return e.deadline&&i.push(n("due_rule",e.deadline)),e.amount&&i.push(n("amount_rule",e.amount)),e.authority&&i.push(n("authority",M(e.authority,t.authorities))),i.push(n("created_by",e.basis?M(e.basis,t.laws):t.page.article.meta.title)),e.procedure&&i.push(n("procedure",e.procedure)),i}var pe=new Set(["action","due_rule","amount_rule","authority","created_by","procedure"]);function Ge(e,t,s){let n=e.filter(r=>r.by===C),i=new Set(t.filter(r=>r.property!=="created_by"||s.basis||!n.some(u=>u.property==="created_by")).map(r=>r.property)),a=t.filter(r=>i.has(r.property));for(let r of n)(pe.has(r.property)?!i.has(r.property):!a.some(u=>u.property===r.property&&f(u.value)===f(r.value)))&&a.push(r);return a}function ce(e,t,s){let n=(e.statements??[]).filter(o=>o.by!==C||o.status==="confirmed"),i=new Set(n.filter(o=>o.status==="confirmed"&&pe.has(o.property)).map(o=>o.property)),a=o=>`${o.property}
|
|
8
|
+
${f(o.value)}`,r=new Set(n.map(a)),u=[...n,...t.filter(o=>!i.has(o.property)&&!r.has(a(o)))];return{...e,statements:u.length?u:void 0,lastUpdated:s}}var J="not found in the sources yet";function Me(e,t,s){let n=c=>e.filter(p=>p.property===c),i=c=>e.find(p=>p.property===c),a=i("action"),r=c=>c&&c.source&&c.source!==a?.source?` (from ${c.source}${c.checked_at?`, ${c.checked_at}`:""})`:"",u=(c,p)=>`- **${c}:** ${p?`${p.value}${r(p)}`:J}`,o=[...new Set([...e,...t?[t]:[]].map(c=>c.source).filter(c=>!!c))],l=[...e.filter(c=>["action","due_rule"].includes(c.property)),...t?[t]:[]].map(c=>c.checked_at).filter(c=>!!c).sort(),g=i("created_by")?.value;return[u("What to do",a),`- **Who:** ${n("bearer").length?n("bearer").map(c=>c.value).join(", "):J}`,u("Deadline",i("due_rule")),...i("amount_rule")?[u("Amount",i("amount_rule"))]:[],...i("authority")?[u("Filed with",i("authority"))]:[],`- **Penalty:** ${t?`${t.value}${r(t)}`:J}`,`- **Source:** ${g?`${g}, `:""}last read from [[${s}]]${o.length?` (sources: ${o.join(", ")})`:""}`,`- **Source date:** ${l[0]??"not known"}. Not yet checked with the law or the authority.`].join(`
|
|
9
|
+
`)}var le="## Rule summary",K="<!-- /rule-summary -->";function je(e,t){let s=`${le}
|
|
10
|
+
|
|
11
|
+
${t.trim()}
|
|
12
|
+
|
|
13
|
+
${K}
|
|
14
|
+
`,n=e.indexOf(`${le}
|
|
15
|
+
`),i=n<0?-1:e.indexOf(K,n);return n>=0&&i>=0?`${e.slice(0,n)}${s}${e.slice(i+K.length).replace(/^\n/,"")}`:`${s}
|
|
16
|
+
${e.trim()}
|
|
17
|
+
`}function Ze(e){let t=q(e,"_rules","state.json");if(!be(t))return{sources:{}};try{let s=JSON.parse(Se(t,"utf-8"));return s&&typeof s.sources=="object"?s:{sources:{}}}catch{return{sources:{}}}}function et(e,t){Re(q(e,"_rules"),{recursive:!0}),We(q(e,"_rules","state.json"),JSON.stringify(t,null,2))}function Le(e,t,s,n,i){let a=s.page,r=n.get(f(t.title));if(r)return x(a.article.meta,r.meta)?r:"the rule page is readable by agents who cannot read the source";if(t.existing){let c=G(e,t.existing);return c?x(a.article.meta,c.article.meta)?{agentId:c.agentId,path:c.article.path,meta:c.article.meta,content:c.article.content,created:!1}:"the rule page is readable by agents who cannot read the source":"the rule page was copied from another machine"}let u=a.article.meta.owner||a.agentId,o=e.getAgentWiki(a.agentId),l=`obligations/${O(t.title)}.md`;for(let c=2;o.readArticle(l);c++)l=`obligations/${O(t.title)}-${c}.md`;let g={title:t.title,class:"obligation",tags:[E],owner:u,access:a.article.meta.access,sharedWith:a.article.meta.sharedWith,created:i,lastUpdated:i,sources:[]};return{agentId:a.agentId,path:l,meta:g,content:`${t.title}.
|
|
18
|
+
`,created:!0}}function ue(e,t,s){let n=e.getAgentWiki(t.agentId).readArticle(t.path);return t.created?n?"a page was created at the rule's path during the run":t:n?x(s,n.meta)?{...t,meta:n.meta,content:n.content}:"the rule page is readable by agents who cannot read the source":"the rule page was moved or removed during the run"}function Q(e,t,s,n){try{return e.getAgentWiki(t).withArticleLock(s,n)}catch(i){if(!(i instanceof re))throw i;return"the page was busy; run again"}}var Ne=e=>(e.statements??[]).some(t=>t.property==="amount_rule"&&t.status==="confirmed"),ge=e=>`penalties/${O(j(`${e} penalty`))}.md`;function He(e,t,s,n){let i=r=>{let u=(r??[]).filter(l=>l.property==="amount_rule"&&l.value),o=u.find(l=>l.status==="confirmed")??u[0];return o?{value:o.value,source:o.source,checked_at:o.checked_at,...o.status==="confirmed"?{confirmed:!0}:{}}:void 0},a=e.getAgentWiki(n.agentId).readArticle(ge(s));if(a&&(a.meta.tags??[]).includes(E))return i(a.meta.statements);for(let r of t.entities.values()){if(r.type!=="penalty"||!r.statements.some(l=>l.property==="penalty_for"&&f(l.value)===f(s)))continue;let u=r.pages.find(l=>x(n.meta,l.article.meta)),o=u&&i(u.article.meta.statements);if(o)return o}}function Fe(e,t,s,n){let i=j(`${e.title} penalty`),a=L(e,s),r=(o,l)=>({property:o,value:l,source:e.source,...a?{checked_at:a}:{},status:"proposed",by:C}),u=[r("penalty_for",e.title),r("amount_rule",e.penalty),r("created_by",e.basis?M(e.basis,s.laws):s.page.article.meta.title)];return{path:ge(e.title),meta:{title:i,class:"penalty",tags:[E],owner:t.meta.owner,access:t.meta.access,sharedWith:t.meta.sharedWith,created:n,lastUpdated:n,sources:t.meta.sources,statements:u,related:[e.title]},content:`## Overview
|
|
19
|
+
|
|
20
|
+
${e.penalty}
|
|
21
|
+
|
|
22
|
+
For [[${e.title}]]. Source: ${e.source}${a?`, dated ${a}`:""}. Not yet checked with the law or the authority.
|
|
23
|
+
`}}function de(e,t,s,n,i,a){let r=[];for(let u of t.bearers){let o=s.parties.find(m=>f(m.title)===f(u));if(!o)continue;let l=G(e,o);if(!l){a.push(`${t.title} \u2192 ${o.title}: page copied from another machine`);continue}if(!x(n.meta,l.article.meta)){a.push(`${t.title} \u2192 ${o.title}: page readable by agents who cannot read the rule`);continue}let g=m=>(m.statements??[]).some(h=>h.property==="subject_to"&&f(h.value)===f(t.title));if(g(l.article.meta))continue;if(i){r.push(o.title);continue}let c=e.getAgentWiki(l.agentId),p=!1,$=Q(e,l.agentId,l.article.path,()=>{let m=c.readArticle(l.article.path);if(!m)return"page moved or removed during the run";if(!x(n.meta,m.meta))return"page readable by agents who cannot read the rule";if(g(m.meta))return;let h=L(t,s),w=[...m.meta.statements??[],{property:"subject_to",value:t.title,source:t.source,...h?{checked_at:h}:{},status:"proposed",by:C}],v={...m.meta,statements:w};if(!c.writeArticle(l.article.path,v,m.content,m.meta.owner||l.agentId))return"write refused";l.article.meta=v,p=!0});$?a.push(`${t.title} \u2192 ${o.title}: ${$}`):p&&r.push(o.title)}return r}async function tt(e,t,s,n,i){let a=p=>i.sources[p.id]?.failures??0,r=Pe(t,n.words,n.only).sort((p,$)=>a(p)-a($)),u=p=>e.getSharedStore().readEntries(p),o={outcomes:[],costUsd:0,capped:!1},l=new Map,g=0,c=(p,$,m,h=!1)=>{if(n.dryRun)return;let w=i.sources[p];i.sources[p]=h?{fingerprint:w?.fingerprint??"",at:new Date().toISOString(),costUsd:m,failures:(w?.failures??0)+1}:{fingerprint:$,at:new Date().toISOString(),costUsd:m},n.save?.(i)};for(let p of r){if(g>=n.max)break;let $={source:p.id,title:p.title,rules:[],costUsd:0,dropped:[]},m=G(e,p);if(!m){n.only.length&&o.outcomes.push({...$,status:"no-page"});continue}let h=Ue(t,p,m,u),w=oe(m);if(!n.force&&i.sources[p.id]?.fingerprint===w){n.only.length&&o.outcomes.push({...$,status:"unchanged"});continue}if(o.costUsd>=n.maxCostUsd){o.capped=!0;break}g++;let v=`${m.agentId}/${m.article.path}`,R;try{R=await s(Ce(t,h,n.today))}catch(y){o.outcomes.push({...$,page:v,status:"failed",dropped:[y.message.slice(0,200)]}),c(p.id,w,0,!0);continue}o.costUsd+=R.costUsd;let k={...$,page:v,status:"no-reply",costUsd:R.costUsd},V=ie(R.text);if(!V){o.outcomes.push(k),c(p.id,w,R.costUsd);continue}let N=De(V,h,t);if(k.dropped=N.dropped,N.rules.length===0){k.status="no-rules",o.outcomes.push(k),c(p.id,w,R.costUsd);continue}let H=!1;for(let y of N.rules){let A=Le(e,y,h,l,n.today);if(typeof A=="string"){k.dropped.push(`${y.title}: ${A}`);continue}let Z=d=>{let b=Ge(d.meta.statements??[],Oe(y,h),y),_=ce(d.meta,b,n.today),P=He(e,t,y.title,d),Y=P?.confirmed||!y.penalty?P:{value:y.penalty,source:y.source,checked_at:L(y,h)},z=Me(_.statements??[],Y,m.article.meta.title),he=(d.meta.tags??[]).includes(E)?ae(d.content,z):je(d.content,z),ye=[...new Set([...d.meta.related??[],m.article.meta.title,...Y?[j(`${y.title} penalty`)]:[]])],we=[...new Set([...d.meta.sources??[],...h.entries.filter(U=>y.source.includes(U.id)).map(U=>U.id)])],ne={..._,related:ye,sources:we},ke={title:y.title,page:`${d.agentId}/${d.path}`,created:d.created,deadline:(ne.statements??[]).some(U=>U.property==="due_rule"),penalty:!!Y,linked:[]};return{t:d,meta:ne,content:he,summary:z,known:P,write:ke}};if(n.dryRun){let d=ue(e,A,h.page.article.meta);if(typeof d=="string"){k.dropped.push(`${y.title}: ${d}`);continue}let b=Z(d);b.write.preview=b.summary,b.write.linked=de(e,y,h,d,!0,k.dropped),k.rules.push(b.write);continue}let F,ee=Q(e,A.agentId,A.path,()=>{let d=ue(e,A,h.page.article.meta);if(typeof d=="string")return d;let b=Z(d);if(!e.getAgentWiki(d.agentId).writeArticle(d.path,b.meta,b.content,d.meta.owner||d.agentId))return"write refused";F=b});if(ee||!F){k.dropped.push(`${y.title}: ${ee??"write refused"}`),H=!0;continue}let{t:I,meta:B,content:me,known:fe,write:te}=F,D=e.getAgentWiki(I.agentId);if(l.set(f(y.title),{...I,meta:B,content:me,created:!1}),y.penalty&&!fe?.confirmed){let d=Fe(y,{...I,meta:B},h,n.today),b=Q(e,I.agentId,d.path,()=>{let _=D.readArticle(d.path);if(!_)return D.writeArticle(d.path,d.meta,d.content,d.meta.owner)?void 0:"write refused";if(!(_.meta.tags??[]).includes(E))return"already exists";if(Ne(_.meta))return;let P=ce({...d.meta,created:_.meta.created,statements:_.meta.statements},d.meta.statements??[],n.today);return D.writeArticle(d.path,P,d.content,d.meta.owner)?void 0:"write refused"});b&&k.dropped.push(`${y.title}: ${d.path} ${b}`)}te.linked=de(e,y,h,{...I,meta:B},!1,k.dropped),D.rebuildIndex(),k.rules.push(te)}k.status=n.dryRun?"dry-run":k.rules.length?"written":H?"failed":"no-rules",o.outcomes.push(k);let X=n.dryRun?null:e.getAgentWiki(m.agentId).readArticle(m.article.path);X&&(w=oe({agentId:m.agentId,article:X})),c(p.id,w,R.costUsd,H&&k.rules.length===0)}return o}export{_e as DEFAULT_RULE_WORDS,C as RULES_BY,E as RULES_TAG,Ce as buildRulesPrompt,De as checkRules,He as knownPenalty,Ze as loadRulesState,Ge as mergeRuleStatements,Me as ruleOverview,Pe as ruleSources,Oe as ruleStatements,Xe as ruleWordsPattern,Ue as rulesContext,oe as rulesFingerprint,tt as runRules,et as saveRulesState,L as sourceDate,Ie as statesRules,ce as withRuleStatements,je as withRuleSummary};
|
|
24
|
+
//# sourceMappingURL=rules-UVUJTVOE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/wiki/rules.ts"],"sourcesContent":["// --- Rule pages: one page per obligation, with deadline, penalty, source and check date (#811) ---\n//\n// Agents research the same rule again and again (a filing deadline, a\n// late fee) because the answer stays inside the page or chat where it\n// came up. This job reads the pages that state rules: legal sources,\n// obligation pages agents wrote, and any other page whose text speaks of\n// deadlines, penalties or filings. One model call per source page\n// returns the rules it states. Each rule is checked against what the\n// call was shown, then written once as an obligation page:\n// - statements for the obligation lens (action, bearer, due, amount,\n// authority, created by, procedure), each with its source and the\n// date of that source, marked proposed until the owner confirms them;\n// - a penalty page linked to it with `penalty_for`;\n// - `subject_to` on the page of each person or organization that must\n// follow it, so their Obligations panel lists it.\n// A later source that states less keeps what an earlier one stated: a\n// field is replaced only when the new source gives it. The model gets no\n// tools and every write goes through the store, which keeps the old version.\n\nimport { createHash } from \"crypto\"\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"fs\"\nimport { resolve } from \"path\"\nimport type { WikiHub } from \"./hub\"\nimport type { WikiArticleMeta, WikiEntry } from \"./types\"\nimport { normName, slugify, type Entity, type GraphPage, type WikiGraph } from \"./ontology/graph\"\nimport type { WikiStatement } from \"./ontology/types\"\nimport { bodyOf } from \"./ontology/view-entity\"\nimport { LockBusyError } from \"./facts/ledger-file\"\nimport { parseEnrichReply, readableAlongside, targetPage, withOverview, type EnrichCall } from \"./enrich\"\n\nexport const RULES_BY = \"wiki-rules\"\n/** Tag on the pages this job creates; they are never read as a source. */\nexport const RULES_TAG = \"wiki-rules\"\n\n/** Words that mark a page as stating a rule. Stems, matched at a word start. */\nexport const DEFAULT_RULE_WORDS = [\n \"deadline\", \"due date\", \"due by\", \"penalt\", \"late fee\", \"fine of\", \"fined\", \"must file\", \"must pay\", \"must declare\",\n \"must submit\", \"filing\", \"obligation\", \"compliance\", \"tax return\",\n \"échéance\", \"date limite\", \"délai\", \"pénalit\", \"amende\", \"majoration\", \"déclaration\", \"obligation\",\n \"غرامة\", \"أجل\", \"آجال\", \"تصريح\", \"خطية\",\n]\n\n/** Types never read as a rule source: things that happen or run, not rules. */\nconst SKIP_TYPES = new Set([\"event\", \"agent\", \"device\", \"server\", \"app\", \"domain\", \"account\", \"penalty\", \"relief\", \"due_date\", \"person\"])\n/** Types a rule's bearer may link to; anything else stays text. */\nconst BEARER_TYPES = new Set([\"person\", \"organization\"])\n\nconst PAGE_CHARS = 6000\nconst ENTRY_CHARS = 900\nconst clip = (s: string, n: number) => (s.length > n ? `${s.slice(0, n)}…` : s)\nconst str = (v: unknown): string => (typeof v === \"string\" ? v.replace(/\\s+/g, \" \").trim() : \"\")\n/** Frontmatter keeps a title on one quoted line. */\nconst cleanTitle = (s: string) => str(s).replace(/[\"\\[\\]]/g, \"\").slice(0, 120).trim()\n\nexport function ruleWordsPattern(words: string[] = DEFAULT_RULE_WORDS): RegExp {\n const escaped = words.map(w => w.trim().replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")).filter(Boolean)\n return new RegExp(`(^|[^\\\\p{L}\\\\p{N}])(${escaped.join(\"|\")})`, \"iu\")\n}\n\nexport interface RulesContext {\n /** The entity whose page is read. */\n source: Entity\n page: GraphPage\n entries: WikiEntry[]\n /** Obligation pages that already exist, so a known rule is updated, not doubled. */\n known: Entity[]\n /** Legal source pages a rule may cite as its basis. */\n laws: Entity[]\n /** People and organizations the page links or names. */\n parties: Entity[]\n /** Organizations a rule may name as its authority. */\n authorities: Entity[]\n}\n\nexport interface RuleDraft {\n title: string\n /** Set when the rule matches an existing obligation page. */\n existing?: Entity\n action: string\n bearers: string[]\n deadline: string\n amount: string\n authority: string\n penalty: string\n basis: string\n procedure: string\n source: string\n}\n\nexport interface RulesResult {\n rules: RuleDraft[]\n dropped: string[]\n}\n\n/** True when the page reads like it states a rule. */\nexport function statesRules(page: GraphPage, words: RegExp): boolean {\n return words.test(`${page.article.meta.title}\\n${bodyOf(page.article.content)}`)\n}\n\n/**\n * Entities whose page this job reads: legal sources and obligation pages\n * first, then any other page whose text matches the rule words. Pages\n * this job created are skipped.\n */\nexport function ruleSources(g: WikiGraph, words: RegExp, only: string[] = []): Entity[] {\n const wanted = new Set(only.map(normName))\n const ours = (e: Entity) => e.pages.every(p => (p.article.meta.tags ?? []).includes(RULES_TAG))\n const rank = (e: Entity) => (e.type === \"legal_source\" ? 0 : e.type === \"obligation\" ? 1 : 2)\n return [...g.entities.values()]\n .filter(e => !ours(e))\n .filter(e => wanted.size\n ? wanted.has(normName(e.id)) || wanted.has(normName(e.title))\n : e.type === \"legal_source\" || e.type === \"obligation\" || (!SKIP_TYPES.has(e.type) && e.pages.some(p => statesRules(p, words))))\n .sort((a, b) => rank(a) - rank(b) || b.sources.length - a.sources.length || a.title.localeCompare(b.title))\n}\n\n/** Entities of a type whose title appears in the text, or linked to `e`. */\nfunction partiesOf(g: WikiGraph, e: Entity, text: string, types: Set<string>): Entity[] {\n const hay = ` ${normName(text)} `\n const linked = new Set([...(g.outgoing.get(e.id) ?? []).map(x => x.to), ...(g.incoming.get(e.id) ?? []).map(x => x.from)])\n return [...g.entities.values()]\n .filter(x => types.has(x.type) && x.id !== e.id)\n .filter(x => linked.has(x.id) || (normName(x.title).length >= 3 && hay.includes(` ${normName(x.title)} `)))\n .slice(0, 40)\n}\n\n/** What one call for `source` may read: its page and the entries behind it. */\nexport function rulesContext(g: WikiGraph, source: Entity, page: GraphPage, readEntries: (ids: string[]) => WikiEntry[]): RulesContext {\n const text = `${page.article.meta.title}\\n${bodyOf(page.article.content)}`\n const entries = readEntries(page.article.meta.sources ?? []).sort((a, b) => b.date.localeCompare(a.date)).slice(0, 10)\n const all = `${text}\\n${entries.map(x => x.content).join(\"\\n\")}`\n const visible = (x: Entity) => x.pages.some(p => readableAlongside(p.article.meta, page.article.meta))\n const of = (type: string) => [...g.entities.values()].filter(x => x.type === type && x.id !== source.id && visible(x))\n return {\n source,\n page,\n entries,\n known: of(\"obligation\").slice(0, 60),\n laws: of(\"legal_source\").slice(0, 40),\n parties: partiesOf(g, source, all, BEARER_TYPES).filter(visible),\n authorities: partiesOf(g, source, all, new Set([\"organization\"])).filter(visible),\n }\n}\n\n/** Changes when the source page's text or the entries behind it change.\n * A `subject_to` link this job adds to the page does not change it. */\nexport function rulesFingerprint(page: GraphPage): string {\n const parts = [`${page.agentId}/${page.article.path}`, bodyOf(page.article.content), ...(page.article.meta.sources ?? []).slice().sort()]\n return createHash(\"sha1\").update(parts.join(\"\\n\")).digest(\"hex\").slice(0, 16)\n}\n\nfunction knownLine(g: WikiGraph, e: Entity): string {\n const facts = e.statements.filter(s => [\"action\", \"due_rule\"].includes(s.property)).map(s => `${s.property}: ${s.value}`)\n return `- ${e.title}${facts.length ? ` (${facts.join(\"; \")})` : \"\"}`\n}\n\nexport function buildRulesPrompt(g: WikiGraph, ctx: RulesContext, today: string): string {\n const p = ctx.page\n const lines = [\n `You are writing the rules one wiki page states, so nobody has to research them again. Today is ${today}.`,\n \"\",\n `## The page: ${p.agentId}/${p.article.path}: \"${p.article.meta.title}\"`,\n clip(bodyOf(p.article.content), PAGE_CHARS),\n \"\",\n \"## Source entries behind the page (newest first)\",\n ]\n for (const en of ctx.entries) lines.push(`### entry ${en.id} (${en.date}, ${en.agentId})`, clip(en.content.trim(), ENTRY_CHARS), \"\")\n lines.push(\"## Rule pages that already exist\", ...ctx.known.map(e => knownLine(g, e)), \"\")\n lines.push(\"## Legal source pages\", ...ctx.laws.map(e => `- ${e.title}`), \"\")\n lines.push(\"## People and organizations it names\", ...ctx.parties.map(e => `- ${e.title} (${e.type})`), \"\")\n lines.push(\n \"## Task\",\n \"List each rule the page or the entries state: something a person or organization must do, by a deadline or on a schedule, often with a penalty when they do not.\",\n \"Return one JSON object and nothing else:\",\n `{\"rules\": [{\"title\": \"…\", \"action\": \"…\", \"bearer\": [\"…\"], \"deadline\": \"…\", \"amount\": \"…\", \"authority\": \"…\", \"penalty\": \"…\", \"basis\": \"…\", \"procedure\": \"…\", \"source\": \"…\"}]}`,\n \"\",\n \"Rules:\",\n \"- title: a short name for the rule, such as \\\"Monthly payroll tax filing\\\". When it is one of the rule pages that already exist, use that title exactly.\",\n \"- action: what must be done, in one sentence. A rule without one is dropped.\",\n \"- bearer: who must do it. Use a listed person or organization title when it is one, else a short description such as \\\"every employer\\\".\",\n \"- deadline: when, as the rule says it (\\\"by the 15th of the following month\\\"), not a computed date.\",\n \"- amount: what is paid or declared, if the rule says. authority: who it is filed with or paid to.\",\n \"- penalty: what happens when it is late or missing, as stated.\",\n \"- basis: the law, article or document it comes from. Use a listed legal source title when it is one.\",\n \"- procedure: how it is done, in one sentence, if stated.\",\n \"- source: the entry id or the page (agent/path) the rule comes from. A rule without one is dropped.\",\n \"- Leave a field empty when the page and entries do not state it. Never guess a deadline, an amount or a penalty.\",\n \"- Do not list one-time tasks, reminders or plans; only standing rules.\",\n \"- Write in the language the page is written in.\",\n \"- No rules on the page: return {\\\"rules\\\": []}.\",\n )\n return lines.join(\"\\n\")\n}\n\n/** Keep only rules with an action and a source the call was shown. */\nexport function checkRules(raw: Record<string, unknown>, ctx: RulesContext, g: WikiGraph): RulesResult {\n const dropped: string[] = []\n const p = ctx.page\n const sourceIds = [...ctx.entries.map(x => x.id), `${p.agentId}/${p.article.path}`, p.article.path]\n const known = new Map(ctx.known.map(e => [normName(e.title), e]))\n const rules: RuleDraft[] = []\n const seen = new Set<string>()\n for (const item of Array.isArray(raw.rules) ? raw.rules : []) {\n const r = (item ?? {}) as Record<string, unknown>\n const title = cleanTitle(str(r.title))\n const action = clip(str(r.action), 400)\n const source = str(r.source)\n if (!title) { dropped.push(\"a rule with no title\"); continue }\n if (!action) { dropped.push(`${title}: no action`); continue }\n if (!source || !sourceIds.some(id => source.includes(id))) { dropped.push(`${title}: source not among those given`); continue }\n if (seen.has(normName(title))) continue\n seen.add(normName(title))\n const existing = known.get(normName(title))\n const taken = g.names.get(normName(title))\n const clash = !existing && taken ? g.entities.get(taken) : undefined\n if (clash && clash.type !== \"obligation\") { dropped.push(`${title}: a page of type ${clash.type} already has this title`); continue }\n const bearers = (Array.isArray(r.bearer) ? r.bearer : [r.bearer]).map(b => clip(str(b), 120)).filter(Boolean)\n rules.push({\n title: existing?.title ?? clash?.title ?? title,\n existing: existing ?? clash,\n action,\n bearers: [...new Set(bearers)].slice(0, 5),\n deadline: clip(str(r.deadline), 200),\n amount: clip(str(r.amount), 200),\n authority: clip(str(r.authority), 120),\n penalty: clip(str(r.penalty), 300),\n basis: clip(str(r.basis), 200),\n procedure: clip(str(r.procedure), 400),\n source: clip(source, 200),\n })\n }\n return { rules, dropped }\n}\n\n/** The title of a listed page when `value` names one, else the value. */\nfunction asPage(value: string, list: Entity[]): string {\n const hit = list.find(e => normName(e.title) === normName(value))\n return hit?.title ?? value\n}\n\n/**\n * The date of what the rule was read from: the entry it cites, else the\n * newest entry behind the page, else the day the page was created. Never\n * the run date: nothing was checked at the law or the authority.\n */\nexport function sourceDate(r: Pick<RuleDraft, \"source\">, ctx: RulesContext): string | undefined {\n const day = (d?: string) => (d && /^\\d{4}-\\d{2}-\\d{2}/.test(d) ? d.slice(0, 10) : undefined)\n const cited = ctx.entries.filter(x => r.source.includes(x.id)).map(x => day(x.date)).filter(Boolean).sort()\n return cited.at(-1) ?? day(ctx.entries[0]?.date) ?? day(ctx.page.article.meta.created)\n}\n\n/** Statements an obligation page gets for one rule, proposed until the owner confirms them. */\nexport function ruleStatements(r: RuleDraft, ctx: RulesContext): WikiStatement[] {\n const checked = sourceDate(r, ctx)\n const st = (property: string, value: string): WikiStatement => ({\n property, value, source: r.source, ...(checked ? { checked_at: checked } : {}), status: \"proposed\", by: RULES_BY,\n })\n const out = [st(\"action\", r.action)]\n for (const b of r.bearers) out.push(st(\"bearer\", asPage(b, ctx.parties)))\n if (r.deadline) out.push(st(\"due_rule\", r.deadline))\n if (r.amount) out.push(st(\"amount_rule\", r.amount))\n if (r.authority) out.push(st(\"authority\", asPage(r.authority, ctx.authorities)))\n out.push(st(\"created_by\", r.basis ? asPage(r.basis, ctx.laws) : ctx.page.article.meta.title))\n if (r.procedure) out.push(st(\"procedure\", r.procedure))\n return out\n}\n\n/** Properties a rule holds one value of; `bearer` may hold several. */\nconst SINGLE = new Set([\"action\", \"due_rule\", \"amount_rule\", \"authority\", \"created_by\", \"procedure\"])\n\n/**\n * This job's statements for a rule after reading one more source: a\n * field the new source states replaces the earlier one; a field it leaves\n * empty keeps the earlier value with its own source and date. A basis the\n * new source does not name (`created_by` set to the page read) does not\n * replace a law an earlier source named. Bearers add up.\n */\nexport function mergeRuleStatements(earlier: WikiStatement[], fresh: WikiStatement[], r: Pick<RuleDraft, \"basis\">): WikiStatement[] {\n const prev = earlier.filter(s => s.by === RULES_BY)\n const stated = new Set(fresh.filter(s => s.property !== \"created_by\" || r.basis || !prev.some(p => p.property === \"created_by\")).map(s => s.property))\n const out = fresh.filter(s => stated.has(s.property))\n for (const s of prev) {\n if (SINGLE.has(s.property) ? !stated.has(s.property) : !out.some(o => o.property === s.property && normName(o.value) === normName(s.value))) out.push(s)\n }\n return out\n}\n\n/** Statements merged in: this job's earlier ones replaced, others kept. A\n * statement the owner confirmed stays, and wins over a new value. */\nexport function withRuleStatements(meta: WikiArticleMeta, statements: WikiStatement[], today: string): WikiArticleMeta {\n const kept = (meta.statements ?? []).filter(s => s.by !== RULES_BY || s.status === \"confirmed\")\n const confirmed = new Set(kept.filter(s => s.status === \"confirmed\" && SINGLE.has(s.property)).map(s => s.property))\n const key = (s: WikiStatement) => `${s.property}\\n${normName(s.value)}`\n const taken = new Set(kept.map(key))\n const all = [...kept, ...statements.filter(s => !confirmed.has(s.property) && !taken.has(key(s)))]\n return { ...meta, statements: all.length ? all : undefined, lastUpdated: today }\n}\n\n/** A penalty as stated, with where it was read and that source's date. */\nexport interface PenaltyFact {\n value: string\n source?: string\n checked_at?: string\n /** The owner confirmed it: it wins over what a new source states. */\n confirmed?: boolean\n}\n\nconst missing = \"not found in the sources yet\"\n\n/** The plain-words summary at the top of an obligation page, built from\n * the statements the page holds after the merge. */\nexport function ruleOverview(statements: WikiStatement[], penalty: PenaltyFact | undefined, readFrom: string): string {\n const all = (p: string) => statements.filter(s => s.property === p)\n const one = (p: string) => statements.find(s => s.property === p)\n const action = one(\"action\")\n // A field read from another source than the action says which.\n const from = (s?: { source?: string; checked_at?: string }) =>\n s && s.source && s.source !== action?.source ? ` (from ${s.source}${s.checked_at ? `, ${s.checked_at}` : \"\"})` : \"\"\n const line = (label: string, s?: WikiStatement) => `- **${label}:** ${s ? `${s.value}${from(s)}` : missing}`\n const sources = [...new Set([...statements, ...(penalty ? [penalty] : [])].map(s => s.source).filter((x): x is string => !!x))]\n const dates = [...statements.filter(s => [\"action\", \"due_rule\"].includes(s.property)), ...(penalty ? [penalty] : [])]\n .map(s => s.checked_at).filter((x): x is string => !!x).sort()\n const basis = one(\"created_by\")?.value\n return [\n line(\"What to do\", action),\n `- **Who:** ${all(\"bearer\").length ? all(\"bearer\").map(s => s.value).join(\", \") : missing}`,\n line(\"Deadline\", one(\"due_rule\")),\n ...(one(\"amount_rule\") ? [line(\"Amount\", one(\"amount_rule\"))] : []),\n ...(one(\"authority\") ? [line(\"Filed with\", one(\"authority\"))] : []),\n `- **Penalty:** ${penalty ? `${penalty.value}${from(penalty)}` : missing}`,\n `- **Source:** ${basis ? `${basis}, ` : \"\"}last read from [[${readFrom}]]${sources.length ? ` (sources: ${sources.join(\", \")})` : \"\"}`,\n `- **Source date:** ${dates[0] ?? \"not known\"}. Not yet checked with the law or the authority.`,\n ].join(\"\\n\")\n}\n\nconst SUMMARY_HEAD = \"## Rule summary\"\nconst SUMMARY_END = \"<!-- /rule-summary -->\"\n\n/**\n * The summary on a page this job did not create. It goes in its own\n * section, which only this job rewrites, so the page's own Overview is\n * never replaced.\n */\nexport function withRuleSummary(content: string, summary: string): string {\n const section = `${SUMMARY_HEAD}\\n\\n${summary.trim()}\\n\\n${SUMMARY_END}\\n`\n const start = content.indexOf(`${SUMMARY_HEAD}\\n`)\n const end = start < 0 ? -1 : content.indexOf(SUMMARY_END, start)\n if (start >= 0 && end >= 0) return `${content.slice(0, start)}${section}${content.slice(end + SUMMARY_END.length).replace(/^\\n/, \"\")}`\n return `${section}\\n${content.trim()}\\n`\n}\n\nexport interface RulesState {\n sources: Record<string, { fingerprint: string; at: string; costUsd?: number; failures?: number }>\n}\n\nexport function loadRulesState(wikiDir: string): RulesState {\n const file = resolve(wikiDir, \"_rules\", \"state.json\")\n if (!existsSync(file)) return { sources: {} }\n try {\n const v = JSON.parse(readFileSync(file, \"utf-8\"))\n return v && typeof v.sources === \"object\" ? v : { sources: {} }\n } catch {\n return { sources: {} }\n }\n}\n\nexport function saveRulesState(wikiDir: string, state: RulesState): void {\n mkdirSync(resolve(wikiDir, \"_rules\"), { recursive: true })\n writeFileSync(resolve(wikiDir, \"_rules\", \"state.json\"), JSON.stringify(state, null, 2))\n}\n\nexport interface RulesOptions {\n /** Entity ids or titles; empty means every page that states rules. */\n only: string[]\n words: RegExp\n max: number\n maxCostUsd: number\n dryRun: boolean\n force: boolean\n today: string\n save?: (state: RulesState) => void\n}\n\nexport interface RuleWrite {\n title: string\n /** agent/path of the obligation page. */\n page: string\n created: boolean\n deadline: boolean\n penalty: boolean\n /** Bearer pages that got a `subject_to` link. */\n linked: string[]\n /** Dry runs: the summary that would be written. */\n preview?: string\n}\n\nexport interface RulesOutcome {\n source: string\n title: string\n page?: string\n status: \"written\" | \"dry-run\" | \"unchanged\" | \"no-page\" | \"no-reply\" | \"no-rules\" | \"failed\"\n rules: RuleWrite[]\n costUsd: number\n dropped: string[]\n}\n\nexport interface RulesRun {\n outcomes: RulesOutcome[]\n costUsd: number\n capped: boolean\n}\n\ninterface Target {\n agentId: string\n path: string\n meta: WikiArticleMeta\n content: string\n created: boolean\n}\n\n/**\n * Where a rule is written: the existing obligation page when one is\n * owned here and no wider audience than the source can read it, else a\n * new page in the source page's wiki with the source page's access.\n */\nfunction ruleTarget(hub: WikiHub, r: RuleDraft, ctx: RulesContext, made: Map<string, Target>, today: string): Target | string {\n const src = ctx.page\n const again = made.get(normName(r.title))\n if (again) return readableAlongside(src.article.meta, again.meta) ? again : \"the rule page is readable by agents who cannot read the source\"\n if (r.existing) {\n const page = targetPage(hub, r.existing)\n if (!page) return \"the rule page was copied from another machine\"\n if (!readableAlongside(src.article.meta, page.article.meta)) return \"the rule page is readable by agents who cannot read the source\"\n return { agentId: page.agentId, path: page.article.path, meta: page.article.meta, content: page.article.content, created: false }\n }\n const owner = src.article.meta.owner || src.agentId\n const store = hub.getAgentWiki(src.agentId)\n let path = `obligations/${slugify(r.title)}.md`\n for (let n = 2; store.readArticle(path); n++) path = `obligations/${slugify(r.title)}-${n}.md`\n const meta: WikiArticleMeta = {\n title: r.title, class: \"obligation\", tags: [RULES_TAG], owner, access: src.article.meta.access,\n sharedWith: src.article.meta.sharedWith, created: today, lastUpdated: today, sources: [],\n }\n return { agentId: src.agentId, path, meta, content: `${r.title}.\\n`, created: true }\n}\n\n/**\n * The target as it is on disk now. The run waited for the model, so the\n * write merges onto this, not the copy read at the start. Called holding\n * the page's lock when writing.\n */\nfunction onDisk(hub: WikiHub, t: Target, src: WikiArticleMeta): Target | string {\n const now = hub.getAgentWiki(t.agentId).readArticle(t.path)\n if (t.created) return now ? \"a page was created at the rule's path during the run\" : t\n if (!now) return \"the rule page was moved or removed during the run\"\n if (!readableAlongside(src, now.meta)) return \"the rule page is readable by agents who cannot read the source\"\n return { ...t, meta: now.meta, content: now.content }\n}\n\n/**\n * Run `fn` holding the page's lock, so no other write lands between its\n * re-read and its write. Returns why nothing was written, if so; a busy\n * lock is one such reason.\n */\nfunction locked(hub: WikiHub, agentId: string, path: string, fn: () => string | undefined): string | undefined {\n try {\n return hub.getAgentWiki(agentId).withArticleLock(path, fn)\n } catch (err) {\n if (!(err instanceof LockBusyError)) throw err\n return \"the page was busy; run again\"\n }\n}\n\nconst confirmedPenalty = (m: WikiArticleMeta) => (m.statements ?? []).some(s => s.property === \"amount_rule\" && s.status === \"confirmed\")\n\nconst penaltyPath = (title: string) => `penalties/${slugify(cleanTitle(`${title} penalty`))}.md`\n\n/**\n * The penalty a rule already has: on the page this job wrote for it, else\n * on any penalty page linked to it with `penalty_for`. A confirmed\n * statement is preferred over a proposed one on the same page.\n */\nexport function knownPenalty(hub: WikiHub, g: WikiGraph, title: string, t: Pick<Target, \"agentId\" | \"meta\">): PenaltyFact | undefined {\n const fact = (statements?: WikiStatement[]): PenaltyFact | undefined => {\n const all = (statements ?? []).filter(x => x.property === \"amount_rule\" && x.value)\n const s = all.find(x => x.status === \"confirmed\") ?? all[0]\n return s ? { value: s.value, source: s.source, checked_at: s.checked_at, ...(s.status === \"confirmed\" ? { confirmed: true } : {}) } : undefined\n }\n const own = hub.getAgentWiki(t.agentId).readArticle(penaltyPath(title))\n if (own && (own.meta.tags ?? []).includes(RULES_TAG)) return fact(own.meta.statements)\n for (const e of g.entities.values()) {\n if (e.type !== \"penalty\" || !e.statements.some(s => s.property === \"penalty_for\" && normName(s.value) === normName(title))) continue\n const page = e.pages.find(p => readableAlongside(t.meta, p.article.meta))\n const f = page && fact(page.article.meta.statements)\n if (f) return f\n }\n return undefined\n}\n\nfunction penaltyPage(r: RuleDraft, t: Target, ctx: RulesContext, today: string): { path: string; meta: WikiArticleMeta; content: string } {\n const title = cleanTitle(`${r.title} penalty`)\n const checked = sourceDate(r, ctx)\n const st = (property: string, value: string): WikiStatement => ({\n property, value, source: r.source, ...(checked ? { checked_at: checked } : {}), status: \"proposed\", by: RULES_BY,\n })\n const statements = [st(\"penalty_for\", r.title), st(\"amount_rule\", r.penalty), st(\"created_by\", r.basis ? asPage(r.basis, ctx.laws) : ctx.page.article.meta.title)]\n return {\n path: penaltyPath(r.title),\n meta: {\n title, class: \"penalty\", tags: [RULES_TAG], owner: t.meta.owner, access: t.meta.access, sharedWith: t.meta.sharedWith,\n created: today, lastUpdated: today, sources: t.meta.sources, statements, related: [r.title],\n },\n content: `## Overview\\n\\n${r.penalty}\\n\\nFor [[${r.title}]]. Source: ${r.source}${checked ? `, dated ${checked}` : \"\"}. Not yet checked with the law or the authority.\\n`,\n }\n}\n\n/** Add `subject_to` to each bearer's page that may show the rule. */\nfunction linkBearers(hub: WikiHub, r: RuleDraft, ctx: RulesContext, t: Target, dryRun: boolean, dropped: string[]): string[] {\n const linked: string[] = []\n for (const b of r.bearers) {\n const e = ctx.parties.find(x => normName(x.title) === normName(b))\n if (!e) continue\n const page = targetPage(hub, e)\n if (!page) { dropped.push(`${r.title} → ${e.title}: page copied from another machine`); continue }\n // The link shows the rule's title on the bearer's page.\n if (!readableAlongside(t.meta, page.article.meta)) { dropped.push(`${r.title} → ${e.title}: page readable by agents who cannot read the rule`); continue }\n const linkedTo = (m: WikiArticleMeta) => (m.statements ?? []).some(s => s.property === \"subject_to\" && normName(s.value) === normName(r.title))\n if (linkedTo(page.article.meta)) continue\n if (dryRun) { linked.push(e.title); continue }\n // Write onto the page as it is now, not the copy read at the start,\n // holding its lock from the re-read to the write.\n const store = hub.getAgentWiki(page.agentId)\n let wrote = false\n const why = locked(hub, page.agentId, page.article.path, () => {\n const now = store.readArticle(page.article.path)\n if (!now) return \"page moved or removed during the run\"\n if (!readableAlongside(t.meta, now.meta)) return \"page readable by agents who cannot read the rule\"\n if (linkedTo(now.meta)) return undefined\n const checked = sourceDate(r, ctx)\n const statements = [...(now.meta.statements ?? []), { property: \"subject_to\", value: r.title, source: r.source, ...(checked ? { checked_at: checked } : {}), status: \"proposed\" as const, by: RULES_BY }]\n // A link added is not an edit of the page: `lastUpdated` stays.\n const meta = { ...now.meta, statements }\n if (!store.writeArticle(page.article.path, meta, now.content, now.meta.owner || page.agentId)) return \"write refused\"\n page.article.meta = meta\n wrote = true\n return undefined\n })\n if (why) dropped.push(`${r.title} → ${e.title}: ${why}`)\n else if (wrote) linked.push(e.title)\n }\n return linked\n}\n\nexport async function runRules(hub: WikiHub, g: WikiGraph, call: EnrichCall, opts: RulesOptions, state: RulesState): Promise<RulesRun> {\n const failures = (e: Entity) => state.sources[e.id]?.failures ?? 0\n const candidates = ruleSources(g, opts.words, opts.only).sort((a, b) => failures(a) - failures(b))\n const readEntries = (ids: string[]) => hub.getSharedStore().readEntries(ids)\n const run: RulesRun = { outcomes: [], costUsd: 0, capped: false }\n const made = new Map<string, Target>()\n let calls = 0\n const remember = (id: string, fp: string, costUsd: number, failed = false) => {\n if (opts.dryRun) return\n const prev = state.sources[id]\n state.sources[id] = failed\n ? { fingerprint: prev?.fingerprint ?? \"\", at: new Date().toISOString(), costUsd, failures: (prev?.failures ?? 0) + 1 }\n : { fingerprint: fp, at: new Date().toISOString(), costUsd }\n opts.save?.(state)\n }\n\n for (const e of candidates) {\n if (calls >= opts.max) break\n const base = { source: e.id, title: e.title, rules: [] as RuleWrite[], costUsd: 0, dropped: [] as string[] }\n const page = targetPage(hub, e)\n if (!page) { if (opts.only.length) run.outcomes.push({ ...base, status: \"no-page\" }); continue }\n const ctx = rulesContext(g, e, page, readEntries)\n let fp = rulesFingerprint(page)\n if (!opts.force && state.sources[e.id]?.fingerprint === fp) {\n if (opts.only.length) run.outcomes.push({ ...base, status: \"unchanged\" })\n continue\n }\n if (run.costUsd >= opts.maxCostUsd) { run.capped = true; break }\n\n calls++\n const where = `${page.agentId}/${page.article.path}`\n let reply: { text: string; costUsd: number }\n try {\n reply = await call(buildRulesPrompt(g, ctx, opts.today))\n } catch (err) {\n run.outcomes.push({ ...base, page: where, status: \"failed\", dropped: [(err as Error).message.slice(0, 200)] })\n remember(e.id, fp, 0, true)\n continue\n }\n run.costUsd += reply.costUsd\n const outcome: RulesOutcome = { ...base, page: where, status: \"no-reply\", costUsd: reply.costUsd }\n const parsed = parseEnrichReply(reply.text)\n if (!parsed) { run.outcomes.push(outcome); remember(e.id, fp, reply.costUsd); continue }\n const checked = checkRules(parsed, ctx, g)\n outcome.dropped = checked.dropped\n if (checked.rules.length === 0) {\n outcome.status = \"no-rules\"\n run.outcomes.push(outcome)\n remember(e.id, fp, reply.costUsd)\n continue\n }\n\n let failed = false\n for (const r of checked.rules) {\n const t0 = ruleTarget(hub, r, ctx, made, opts.today)\n if (typeof t0 === \"string\") { outcome.dropped.push(`${r.title}: ${t0}`); continue }\n const compose = (t: Target) => {\n // What an earlier source stated stays when this one leaves it out.\n const statements = mergeRuleStatements(t.meta.statements ?? [], ruleStatements(r, ctx), r)\n const meta0 = withRuleStatements(t.meta, statements, opts.today)\n // A penalty the owner confirmed wins, as on the rule page itself.\n const known = knownPenalty(hub, g, r.title, t)\n const penalty = known?.confirmed || !r.penalty ? known : { value: r.penalty, source: r.source, checked_at: sourceDate(r, ctx) }\n const summary = ruleOverview(meta0.statements ?? [], penalty, page.article.meta.title)\n // A page this job did not create keeps its own Overview.\n const ours = (t.meta.tags ?? []).includes(RULES_TAG)\n const content = ours ? withOverview(t.content, summary) : withRuleSummary(t.content, summary)\n const related = [...new Set([...(t.meta.related ?? []), page.article.meta.title, ...(penalty ? [cleanTitle(`${r.title} penalty`)] : [])])]\n const sources = [...new Set([...(t.meta.sources ?? []), ...ctx.entries.filter(x => r.source.includes(x.id)).map(x => x.id)])]\n const meta = { ...meta0, related, sources }\n const write: RuleWrite = {\n title: r.title, page: `${t.agentId}/${t.path}`, created: t.created,\n deadline: (meta.statements ?? []).some(s => s.property === \"due_rule\"), penalty: !!penalty, linked: [],\n }\n return { t, meta, content, summary, known, write }\n }\n if (opts.dryRun) {\n const t = onDisk(hub, t0, ctx.page.article.meta)\n if (typeof t === \"string\") { outcome.dropped.push(`${r.title}: ${t}`); continue }\n const c = compose(t)\n c.write.preview = c.summary\n c.write.linked = linkBearers(hub, r, ctx, t, true, outcome.dropped)\n outcome.rules.push(c.write)\n continue\n }\n // Re-read, merge and write the rule page holding its lock.\n let c: ReturnType<typeof compose> | undefined\n const why = locked(hub, t0.agentId, t0.path, () => {\n const t = onDisk(hub, t0, ctx.page.article.meta)\n if (typeof t === \"string\") return t\n const next = compose(t)\n if (!hub.getAgentWiki(t.agentId).writeArticle(t.path, next.meta, next.content, t.meta.owner || t.agentId)) return \"write refused\"\n c = next\n return undefined\n })\n if (why || !c) {\n outcome.dropped.push(`${r.title}: ${why ?? \"write refused\"}`)\n failed = true\n continue\n }\n const { t, meta, content, known, write } = c\n const store = hub.getAgentWiki(t.agentId)\n made.set(normName(r.title), { ...t, meta, content, created: false })\n if (r.penalty && !known?.confirmed) {\n const pen = penaltyPage(r, { ...t, meta }, ctx, opts.today)\n const penWhy = locked(hub, t.agentId, pen.path, () => {\n const old = store.readArticle(pen.path)\n // A penalty page someone else wrote at that path is left alone; on\n // ours, statements the owner confirmed stay, and a penalty\n // confirmed during the run is kept as it is.\n if (!old) return store.writeArticle(pen.path, pen.meta, pen.content, pen.meta.owner) ? undefined : \"write refused\"\n if (!(old.meta.tags ?? []).includes(RULES_TAG)) return \"already exists\"\n if (confirmedPenalty(old.meta)) return undefined\n const merged = withRuleStatements({ ...pen.meta, created: old.meta.created, statements: old.meta.statements }, pen.meta.statements ?? [], opts.today)\n return store.writeArticle(pen.path, merged, pen.content, pen.meta.owner) ? undefined : \"write refused\"\n })\n if (penWhy) outcome.dropped.push(`${r.title}: ${pen.path} ${penWhy}`)\n }\n write.linked = linkBearers(hub, r, ctx, { ...t, meta }, false, outcome.dropped)\n store.rebuildIndex()\n outcome.rules.push(write)\n }\n outcome.status = opts.dryRun ? \"dry-run\" : outcome.rules.length ? \"written\" : failed ? \"failed\" : \"no-rules\"\n run.outcomes.push(outcome)\n // A rule written onto the source page itself changes its text; the\n // next run must not pay to read back what this one wrote.\n const now = opts.dryRun ? null : hub.getAgentWiki(page.agentId).readArticle(page.article.path)\n if (now) fp = rulesFingerprint({ agentId: page.agentId, article: now })\n remember(e.id, fp, reply.costUsd, failed && outcome.rules.length === 0)\n }\n return run\n}\n"],"mappings":"sUAmBA,OAAS,cAAA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EAAGF,EAAI,KAAK,YAAc,CAAC,EAAGxB,EAAK,KAAK,EACpJ,OAAO1B,EAAM,aAAakD,EAAI,KAAMG,EAAQH,EAAI,QAASA,EAAI,KAAK,KAAK,EAAI,OAAY,eACzF,CAAC,EACGC,GAAQZ,EAAQ,QAAQ,KAAK,GAAG3G,EAAE,UAAUsH,EAAI,QAAQC,GAAQ,EAEtEJ,GAAM,OAAS5B,GAAYzB,EAAK9D,EAAGZ,EAAK,CAAE,GAAG8F,EAAG,KAAAvD,CAAK,EAAG,GAAOgF,EAAQ,OAAO,EAC9EvC,EAAM,aAAa,EACnBuC,EAAQ,MAAM,KAAKQ,EAAK,EAE1BR,EAAQ,OAASb,EAAK,OAAS,UAAYa,EAAQ,MAAM,OAAS,UAAYJ,EAAS,SAAW,WAClGL,EAAI,SAAS,KAAKS,CAAO,EAGzB,IAAMnC,EAAMsB,EAAK,OAAS,KAAOhC,EAAI,aAAa5G,EAAK,OAAO,EAAE,YAAYA,EAAK,QAAQ,IAAI,EACzFsH,IAAK6B,EAAKvH,GAAiB,CAAE,QAAS5B,EAAK,QAAS,QAASsH,CAAI,CAAC,GACtE4B,EAAS1I,EAAE,GAAI2I,EAAIK,EAAM,QAASH,GAAUI,EAAQ,MAAM,SAAW,CAAC,EAExE,OAAOT,CACT","names":["createHash","existsSync","mkdirSync","readFileSync","writeFileSync","resolve","RULES_BY","RULES_TAG","DEFAULT_RULE_WORDS","SKIP_TYPES","BEARER_TYPES","PAGE_CHARS","ENTRY_CHARS","clip","s","n","str","v","cleanTitle","ruleWordsPattern","words","escaped","w","statesRules","page","bodyOf","ruleSources","g","only","wanted","normName","ours","e","p","rank","a","b","partiesOf","text","types","hay","linked","x","rulesContext","source","readEntries","entries","all","visible","readableAlongside","of","type","rulesFingerprint","parts","createHash","knownLine","facts","buildRulesPrompt","ctx","today","lines","en","checkRules","raw","dropped","sourceIds","known","rules","seen","item","r","title","action","id","existing","taken","clash","bearers","asPage","value","list","sourceDate","day","d","ruleStatements","checked","st","property","out","SINGLE","mergeRuleStatements","earlier","fresh","prev","stated","o","withRuleStatements","meta","statements","kept","confirmed","key","missing","ruleOverview","penalty","readFrom","one","from","line","label","sources","dates","basis","SUMMARY_HEAD","SUMMARY_END","withRuleSummary","content","summary","section","start","end","loadRulesState","wikiDir","file","resolve","existsSync","readFileSync","saveRulesState","state","mkdirSync","writeFileSync","ruleTarget","hub","made","src","again","targetPage","owner","store","path","slugify","onDisk","now","locked","agentId","fn","err","LockBusyError","confirmedPenalty","m","penaltyPath","knownPenalty","t","fact","own","f","penaltyPage","linkBearers","dryRun","linkedTo","wrote","why","runRules","call","opts","failures","candidates","ids","run","calls","remember","fp","costUsd","failed","base","where","reply","outcome","parsed","parseEnrichReply","t0","compose","meta0","withOverview","related","write","c","next","pen","penWhy","old","merged"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a,b}from"./chunk-RX2ISTNT.js";import"./chunk-RKPAVWXF.js";import"./chunk-QKILE72V.js";import"./chunk-QQ67J76O.js";import"./chunk-DX6RYYGP.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-6BWVJ7UJ.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{b as resolveScheduleCaller,a as runScheduleTool};
|
|
2
|
+
//# sourceMappingURL=schedule-tool-DKBPBQ3F.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as a,o as b,p as c,q as d,r as e,s as f}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=scheduler-
|
|
1
|
+
import{n as a,o as b,p as c,q as d,r as e,s as f}from"./chunk-QQ67J76O.js";import"./chunk-DX6RYYGP.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-6BWVJ7UJ.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{a as AGENT_RUN_TIMEOUT_FLOOR,f as CronScheduler,b as agentRunTimeout,e as cronRunId,d as getNextCronDate,c as runLinkIds};
|
|
2
|
+
//# sourceMappingURL=scheduler-76IIRAP7.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o as a,p as b,q as c,r as d,s as e,t as f,u as g,v as h,w as i,x as j,y as k,z as l}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=seat-
|
|
1
|
+
import{o as a,p as b,q as c,r as d,s as e,t as f,u as g,v as h,w as i,x as j,y as k,z as l}from"./chunk-KOKPK3OL.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-6BWVJ7UJ.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";l();export{a as DEFAULT_SEAT_TIMEOUT_MS,k as askSeat,c as configureDecisions,b as configuredSeatTimeout,e as decisionsRuntime,h as getSeatMode,i as labelSeatCall,f as parseSeatMode,j as recordSeatOutcome,d as resetDecisionsRuntime,g as seatEnvVar};
|
|
2
|
+
//# sourceMappingURL=seat-TV5SK2E7.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{y as S,z as w}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=select-
|
|
1
|
+
import{y as S,z as w}from"./chunk-KOKPK3OL.js";import{a as g,b as h,f as R}from"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import{e as f}from"./chunk-JHCI6XCJ.js";import"./chunk-6BWVJ7UJ.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";w();R();var p="skill-select";function y(l){return{task:d(l.task,1200),...l.agent?{agent:l.agent}:{},skills:l.candidates.map(t=>({name:t.name,purpose:d(t.description,300),...t.category?{category:t.category}:{},...t.tags?.length?{tags:t.tags.slice(0,8)}:{}}))}}function b(l){let t={};for(let i of l)t[i.name]=d(i.description,300);return{anyRelevant:g("At least one of these skills is about the task at hand.",{true:"The task is the kind of work one of these skills exists for, and following it would change how the work is done \u2014 it names the same system, the same procedure or the same kind of artefact.",false:"None of them is about this task. They may share vocabulary with it, mention the same tools, or belong to the same project without bearing on what is being asked. Sharing words with a task is not being about it."}),best:h(t,"Which skill is this task most about?")}}function v(l){let t=l.anyRelevant,i=l.best,o=Object.entries(i.probabilities??{}).map(([e,s])=>({name:e,p:Number(s)||0})).sort((e,s)=>s.p-e.p);return{anyRelevant:t.noul,name:i.choice,confidence:i.confidence,ranked:o}}function d(l,t){return l.length>t?`${l.slice(0,t)}\u2026`:l}var x=.1,A=12;async function E(l,t,i={}){let o=i.minRelevant??.6,e=f(l,t).filter(n=>n.relevance>=x).slice(0,A),s=e.map(n=>({name:n.skill.frontmatter.name,lexical:n.relevance}));if(e.length===0)return{skill:null,anyRelevant:0,confidence:0,shortlist:s,judged:!1,reason:"no skill mentions anything in this task"};if(e.length===1)return{skill:e[0].skill,anyRelevant:e[0].relevance,confidence:e[0].relevance,shortlist:s,judged:!1,reason:`only ${e[0].skill.frontmatter.name} matched (${e[0].matchReason})`};let r=e.map(n=>({name:n.skill.frontmatter.name,description:n.skill.frontmatter.description,category:n.skill.frontmatter.category??null,tags:n.skill.frontmatter.tags})),m=await S(p,y({task:t,agent:i.agent??null,candidates:r}),b(r),{incumbent:{best:r[0].name},features:{agent:i.agent??"unknown",candidates:r.length}});if(!m)return{skill:e[0].skill,anyRelevant:e[0].relevance,confidence:e[0].relevance,shortlist:s,judged:!1,reason:`seat off \u2014 lexical top match (${e[0].matchReason})`};let a=v(m.answers),c=s.map(n=>({...n,p:a.ranked.find(k=>k.name===n.name)?.p??0})).sort((n,k)=>(k.p??0)-(n.p??0));if(a.anyRelevant<o)return{skill:null,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`nothing on the shortlist is about this task (${a.anyRelevant.toFixed(2)} below ${o})`};let u=e.find(n=>n.skill.frontmatter.name===a.name);return u?{skill:u.skill,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`${a.name} (confidence ${a.confidence.toFixed(2)})`}:{skill:null,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`seat chose "${a.name}", which was not on the shortlist`}}export{E as pickSkillForTask};
|
|
2
|
+
//# sourceMappingURL=select-HKRDVQNW.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as a}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=set-enabled-
|
|
1
|
+
import{b as a}from"./chunk-DX6RYYGP.js";import"./chunk-6BWVJ7UJ.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";async function i(o,r,s={}){let e=null,n=await a(l=>{let t=l.crons?.[o];if(t?r&&t.approval?.action==="create"?e={ok:!1,status:409,error:`schedule "${o}" is waiting for approval: agentx schedule approve ${o}`}:t.enabled===r&&(e={ok:!0,id:o,enabled:r,changed:!1}):e={ok:!1,status:404,error:`no schedule "${o}"`},e)throw new Error("no write");t.enabled=r,e={ok:!0,id:o,enabled:r,changed:!0}},{configPath:s.configPath,reload:!1});return e&&(!e.ok||!e.changed)?e:n.success?e??{ok:!1,status:500,error:"mutation did not run"}:{ok:!1,status:500,error:n.error||"could not write agentx.json"}}export{i as setCronEnabled};
|
|
2
|
+
//# sourceMappingURL=set-enabled-I2V3PXOA.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{b as h}from"./chunk-
|
|
1
|
+
import{b as h}from"./chunk-RX2ISTNT.js";import"./chunk-RKPAVWXF.js";import{b as l}from"./chunk-LLNPKE7H.js";import"./chunk-SHEUCITK.js";import"./chunk-QKILE72V.js";import"./chunk-QQ67J76O.js";import"./chunk-DX6RYYGP.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-6BWVJ7UJ.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";var g=t=>typeof t=="string"?t.trim():"",w={in_progress:"in progress",waiting_owner:"waiting on the owner",waiting_other:"waiting on another agent",needs_attention:"needs attention"};function f(t){return t.length?t.map(e=>{let a=new Date(e.createdAt).toISOString().slice(0,16).replace("T"," "),c=e.state==="waiting_owner"&&e.question?` Question: ${e.question}`:e.state==="needs_attention"&&e.attentionReason?` ${e.attentionReason}`:"",n=String(e.text).replace(/\s+/g," ").trim();return`- ${e.id} [${w[e.state]??e.state}] ${a} UTC, ${e.channel}, ${e.agentId}: ${n.length>160?`${n.slice(0,159)}\u2026`:n}.${c}`}).join(`
|
|
2
2
|
`):"No open requests."}function $(t){return(t??[]).map(e=>`${e.idx}. ${e.name} (${e.agentId}, ${e.kind}) [${e.state}]${e.needsApproval?` approval: ${e.approval}`:""}`)}async function y(t,e){let a=e.fetch??fetch,c=e.daemonUrl.replace(/\/$/,""),n=(g(t.action)||"list").toLowerCase();try{if(n==="list"){let u=await a(`${c}/requests`,{signal:AbortSignal.timeout(1e4)}),r=await u.json().catch(()=>({}));return u.ok?r.enabled?`${r.count} open request${r.count===1?"":"s"}, oldest first.
|
|
3
3
|
${f(r.items??[])}`:"Requests are turned off on this node (requests.enabled), so nothing is recorded.":`Error: ${r?.error||`HTTP ${u.status}`}`}let i=e.env??process.env,p=h(t,i);if(!p)return"Error: couldn't tell which agent you are. Pass callerAgentId.";let d=await a(`${c}/requests`,{method:"POST",headers:{"Content-Type":"application/json",...l(i)},body:JSON.stringify({action:n,agentId:p.agentId,id:t.id,question:t.question,evidence:t.evidence,reason:t.reason,steps:t.steps,step:t.step,status:t.status,note:t.note}),signal:AbortSignal.timeout(1e4)}),s=await d.json().catch(()=>({}));if(!d.ok)return`Error: ${s?.error||`HTTP ${d.status}`}`;let o=s.request;return n==="accept"&&s.plan?[`Request ${o.id} is open with a plan of ${s.steps.length} steps. The daemon hands each step to its agent in order, nudges a step that goes quiet, and tells the owner when it is finished or blocked.`,...$(s.steps),`Steps the owner approves get a decision card now; an approved message is sent by the daemon itself. Report your own steps with {action:"step", id:"${o.id}", step:<n>, status:"progress"|"done"|"blocked"}.`].join(`
|
|
4
4
|
`):n==="step"?[`Step reported. Plan of ${o.id}:`,...$(s.steps)].join(`
|
|
5
5
|
`):n==="accept"?`Request ${o.id} is open and in progress. Close it with done (and a link to the evidence) or decline (and the reason); it stays on the owner's list until then.`:n==="wait"?`Request ${o.id} is waiting on the owner with your question. Ask them the question now, once.`:n==="done"?`Request ${o.id} is closed as done. Evidence: ${o.evidence}`:`Request ${o.id} is closed as declined. Reason: ${o.closeReason}`}catch(i){return`Error: couldn't reach the daemon (${i?.message??i}).`}}export{f as describeOpen,$ as describeSteps,y as runRequestTool};
|
|
6
|
-
//# sourceMappingURL=tool-
|
|
6
|
+
//# sourceMappingURL=tool-5ZFM6NSO.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as f}from"./chunk-
|
|
1
|
+
import{b as f}from"./chunk-RX2ISTNT.js";import"./chunk-RKPAVWXF.js";import{f as y}from"./chunk-Y4CYQV7G.js";import{b as u}from"./chunk-LLNPKE7H.js";import"./chunk-SHEUCITK.js";import"./chunk-QKILE72V.js";import"./chunk-QQ67J76O.js";import"./chunk-DX6RYYGP.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-6BWVJ7UJ.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";var w=new Set(["cron","heartbeat","api","a2a","mesh","approvals","requests"]);function c(t){return typeof t=="string"?t.trim():""}async function b(t,s){let d=s.fetch??fetch,l=s.daemonUrl.replace(/\/$/,""),i=(c(t.action)||"create").toLowerCase(),o=f(t,s.env??process.env);if(i==="status"){let n=c(t.id);if(!n)return"Error: `id` is required for status (the card id you got when you raised it).";try{let a=await d(`${l}/approvals/${encodeURIComponent(n)}`,{signal:AbortSignal.timeout(1e4)}),r=await a.json().catch(()=>({}));if(!a.ok)return`Error: ${r?.error||`HTTP ${a.status}`}`;let e=r.card;if(o&&e.raised_by!==o.agentId)return`Error: card "${n}" was raised by another agent.`;if(e.status==="pending")return`Card ${e.id} is still waiting for the operator. It expires ${e.expires}; then "${e.if_silent}" applies.`;if(e.status==="decided"){let h=e.verdict==="yes"?y(e).join(`
|
|
2
2
|
`):"";return`Card ${e.id}: the operator said ${String(e.verdict).toUpperCase()}.${e.note?` Note: ${e.note}`:""}${h?`
|
|
3
3
|
${h}`:""}`}return e.status==="resolved"?`Card ${e.id} was closed by ${e.raised_by}: ${e.resolution??"answered outside the card"}.`:`Card ${e.id} expired unanswered; the default applied: ${e.outcome??e.if_silent}.`}catch(a){return`Error: couldn't reach the daemon (${a?.message??a}).`}}if(i==="resolve"){let n=c(t.id),a=c(t.reason);if(!n)return"Error: `id` is required for resolve (the card id you got when you raised it).";if(!a)return'Error: `reason` is required for resolve: where the owner answered and what you did, e.g. "approved in chat, done".';if(!o)return"Error: couldn't tell which agent you are. Pass callerAgentId.";try{let r=await d(`${l}/approvals/${encodeURIComponent(n)}/resolve`,{method:"POST",headers:{"Content-Type":"application/json",...u(s.env??process.env)},body:JSON.stringify({raised_by:o.agentId,reason:a}),signal:AbortSignal.timeout(1e4)}),e=await r.json().catch(()=>({}));return r.ok?`Card ${e.card.id} is closed. It left the operator's inbox, so nobody will be asked about it again.`:`Error: ${e?.error||`HTTP ${r.status}`}`}catch(r){return`Error: couldn't reach the daemon (${r?.message??r}).`}}if(i!=="create")return`Error: unknown action "${i}". Use create, status or resolve.`;if(!o)return"Error: couldn't tell which agent you are. Pass callerAgentId.";let p=o.channel&&o.chatId&&!w.has(o.channel)?{channel:o.channel,chatId:o.chatId,...o.accountId?{accountId:o.accountId}:{}}:void 0,$={title:t.title,ask:t.ask,recommend:t.recommend,if_silent:t.if_silent,expires:t.expires,source:t.source,choices:t.choices,draft:t.draft,say:t.say,context:t.context,raised_by:o.agentId,...p?{reply:p}:{}};try{let n=await d(`${l}/approvals`,{method:"POST",headers:{"Content-Type":"application/json",...u(s.env??process.env)},body:JSON.stringify($),signal:AbortSignal.timeout(1e4)}),a=await n.json().catch(()=>({}));if(!n.ok)return`Error: ${a?.error||`HTTP ${n.status}`}`;let r=a.card;return[`Decision card ${r.id} is in the operator's Approvals inbox.`,`If nobody answers by ${r.expires}, "${r.if_silent}" applies.`,"You will get a message with the result. Tell the requester it is waiting for approval; don't ask the operator again in chat.",`If the operator answers the same thing in chat and you act on it, close the card with {action:"resolve", id:"${r.id}", reason:"approved in chat, done"} so it is not asked again.`].join(" ")}catch(n){return`Error: couldn't reach the daemon (${n?.message??n}).`}}export{b as runApprovalTool};
|
|
4
|
-
//# sourceMappingURL=tool-
|
|
4
|
+
//# sourceMappingURL=tool-J7PYS4NF.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./chunk-VWTBHLMX.js";import{a as b}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=wiki-
|
|
1
|
+
import"./chunk-VWTBHLMX.js";import{a as b}from"./chunk-44N5HXYE.js";import{a}from"./chunk-KEJGWFGS.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import{d as c}from"./chunk-GW4LKNQT.js";import"./chunk-SKSYII3K.js";import"./chunk-HSX5LMXD.js";import"./chunk-WPNRDEHW.js";import"./chunk-MWNCS57L.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-KOKPK3OL.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-6TURWSMN.js";import"./chunk-QD6IICK7.js";import"./chunk-QOYAX2FT.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-6BWVJ7UJ.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as WikiHub,a as WikiStore,c as agenticQuery};
|
|
2
|
+
//# sourceMappingURL=wiki-3VG33ZZB.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentix-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.137.0",
|
|
4
4
|
"description": "AI operations layer for small and medium businesses. Routes Telegram, WhatsApp, GitLab, GitHub, crons, webhooks, and mesh tasks to AI agents. Web wizard for operators, CLI for engineers. Self-hosted.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|