agentix-cli 0.139.0 → 0.139.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-PRHZGF6J.js → agent-5CEDGNDW.js} +2 -2
- package/dist/{board-dashboard-GBEBQUFJ.js → board-dashboard-F5GP2X22.js} +2 -2
- package/dist/{builtin-YD7MC572.js → builtin-U5S2XCNJ.js} +2 -2
- package/dist/chunk-3W2BHUGM.js +11 -0
- package/dist/chunk-3W2BHUGM.js.map +1 -0
- package/dist/{chunk-KO6BU3B3.js → chunk-4LNJR5PC.js} +2 -2
- package/dist/{chunk-34XYHSL6.js → chunk-65LN6GQP.js} +230 -229
- package/dist/chunk-65LN6GQP.js.map +1 -0
- package/dist/chunk-6TTGRTDO.js +3 -0
- package/dist/chunk-6TTGRTDO.js.map +1 -0
- package/dist/{chunk-MUC7MMTT.js → chunk-BUKXFZEO.js} +2 -2
- package/dist/{chunk-2BEZU5OF.js → chunk-HWYU6XG2.js} +2 -2
- package/dist/chunk-HWYU6XG2.js.map +1 -0
- package/dist/{chunk-RIYQNADV.js → chunk-LGB6ILTW.js} +3 -3
- package/dist/{chunk-JBYLG3CQ.js → chunk-P4TSZDVO.js} +2 -2
- package/dist/{chunk-HF5EF335.js → chunk-VE3SSOQX.js} +4 -4
- package/dist/chunk-VE3SSOQX.js.map +1 -0
- package/dist/{chunk-XQVL2RYG.js → chunk-WTMZW5X7.js} +2 -2
- package/dist/{chunk-H4NSB54D.js → chunk-XVTD6I34.js} +2 -2
- package/dist/{chunk-U6EJ53DA.js → chunk-YWEGKAE2.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/{enrich-R2LIDLPZ.js → enrich-FPK3OW77.js} +2 -2
- package/dist/{event-levels-WOYYEWSZ.js → event-levels-NBOMTB23.js} +2 -2
- package/dist/{follow-up-tool-QRECR3AH.js → follow-up-tool-M2KCLRQQ.js} +2 -2
- package/dist/index.d.ts +14 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{program-7VHY5RVZ.js → program-SJT7PIFO.js} +6 -6
- package/dist/program-SJT7PIFO.js.map +1 -0
- package/dist/{registry-B276QJ75.js → registry-Q7VNRLZA.js} +2 -2
- package/dist/{rules-UVUJTVOE.js → rules-5ZZQZLQA.js} +2 -2
- package/dist/send-answer-ZG7UHCVS.js +2 -0
- package/dist/{tool-UPXUWIMM.js → tool-DFPOFXGA.js} +2 -2
- package/dist/{tool-5WCC7SKQ.js → tool-GJ75MWV5.js} +2 -2
- package/dist/wiki-enrich-JNQ2RPWU.js +2 -0
- package/dist/wiki-enrich-JNQ2RPWU.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-2BEZU5OF.js.map +0 -1
- package/dist/chunk-34XYHSL6.js.map +0 -1
- package/dist/chunk-HF5EF335.js.map +0 -1
- package/dist/chunk-Q4XP5TBI.js +0 -11
- package/dist/chunk-Q4XP5TBI.js.map +0 -1
- package/dist/program-7VHY5RVZ.js.map +0 -1
- package/dist/wiki-enrich-7SBCPK2E.js +0 -2
- /package/dist/{agent-PRHZGF6J.js.map → agent-5CEDGNDW.js.map} +0 -0
- /package/dist/{board-dashboard-GBEBQUFJ.js.map → board-dashboard-F5GP2X22.js.map} +0 -0
- /package/dist/{builtin-YD7MC572.js.map → builtin-U5S2XCNJ.js.map} +0 -0
- /package/dist/{chunk-KO6BU3B3.js.map → chunk-4LNJR5PC.js.map} +0 -0
- /package/dist/{chunk-MUC7MMTT.js.map → chunk-BUKXFZEO.js.map} +0 -0
- /package/dist/{chunk-RIYQNADV.js.map → chunk-LGB6ILTW.js.map} +0 -0
- /package/dist/{chunk-JBYLG3CQ.js.map → chunk-P4TSZDVO.js.map} +0 -0
- /package/dist/{chunk-XQVL2RYG.js.map → chunk-WTMZW5X7.js.map} +0 -0
- /package/dist/{chunk-H4NSB54D.js.map → chunk-XVTD6I34.js.map} +0 -0
- /package/dist/{chunk-U6EJ53DA.js.map → chunk-YWEGKAE2.js.map} +0 -0
- /package/dist/{enrich-R2LIDLPZ.js.map → enrich-FPK3OW77.js.map} +0 -0
- /package/dist/{event-levels-WOYYEWSZ.js.map → event-levels-NBOMTB23.js.map} +0 -0
- /package/dist/{follow-up-tool-QRECR3AH.js.map → follow-up-tool-M2KCLRQQ.js.map} +0 -0
- /package/dist/{registry-B276QJ75.js.map → registry-Q7VNRLZA.js.map} +0 -0
- /package/dist/{rules-UVUJTVOE.js.map → rules-5ZZQZLQA.js.map} +0 -0
- /package/dist/{wiki-enrich-7SBCPK2E.js.map → send-answer-ZG7UHCVS.js.map} +0 -0
- /package/dist/{tool-UPXUWIMM.js.map → tool-DFPOFXGA.js.map} +0 -0
- /package/dist/{tool-5WCC7SKQ.js.map → tool-GJ75MWV5.js.map} +0 -0
|
@@ -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-LGB6ILTW.js";import"./chunk-HWYU6XG2.js";import"./chunk-QSKG754X.js";import"./chunk-MEFPXHQJ.js";import"./chunk-SZDACK6O.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-JS2LEURJ.js";import"./chunk-NMYPZR4W.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-AXHP6TMT.js";import"./chunk-STIZFWDJ.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-HXLB2XCT.js";import"./chunk-SKSYII3K.js";import"./chunk-7KAQHNLT.js";import"./chunk-WPNRDEHW.js";import"./chunk-MWNCS57L.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-JJZVFDG6.js";import"./chunk-LMZCB7TT.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-MGM33GOW.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-Q7VNRLZA.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as x,i as ie,k as ae,m as G}from"./chunk-
|
|
1
|
+
import{d as x,i as ie,k as ae,m as G}from"./chunk-YWEGKAE2.js";import{k as T}from"./chunk-XVTD6I34.js";import{f,g as O}from"./chunk-QAWKN2N4.js";import"./chunk-MTX4UPNB.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
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
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
4
|
${a.map(l=>l.content).join(`
|
|
@@ -21,4 +21,4 @@ ${e.penalty}
|
|
|
21
21
|
|
|
22
22
|
For [[${e.title}]]. Source: ${e.source}${a?`, dated ${a}`:""}. Not yet checked with the law or the authority.
|
|
23
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-
|
|
24
|
+
//# sourceMappingURL=rules-5ZZQZLQA.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{b as h}from"./chunk-HGU5B7IY.js";import"./chunk-RKPAVWXF.js";import{b as l}from"./chunk-
|
|
1
|
+
import{b as h}from"./chunk-HGU5B7IY.js";import"./chunk-RKPAVWXF.js";import{b as l}from"./chunk-3W2BHUGM.js";import"./chunk-SHEUCITK.js";import"./chunk-ANDEMOYE.js";import"./chunk-JS2LEURJ.js";import"./chunk-NMYPZR4W.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-MGM33GOW.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-DFPOFXGA.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as f}from"./chunk-HGU5B7IY.js";import"./chunk-RKPAVWXF.js";import{f as y}from"./chunk-Y4CYQV7G.js";import{b as u}from"./chunk-
|
|
1
|
+
import{b as f}from"./chunk-HGU5B7IY.js";import"./chunk-RKPAVWXF.js";import{f as y}from"./chunk-Y4CYQV7G.js";import{b as u}from"./chunk-3W2BHUGM.js";import"./chunk-SHEUCITK.js";import"./chunk-ANDEMOYE.js";import"./chunk-JS2LEURJ.js";import"./chunk-NMYPZR4W.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-MGM33GOW.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-GJ75MWV5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentix-cli",
|
|
3
|
-
"version": "0.139.
|
|
3
|
+
"version": "0.139.2",
|
|
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": {
|