agentix-cli 0.218.0 → 0.220.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/README.md +87 -207
- package/dist/{App-2IEK5HWX.js → App-QRZJGHNK.js} +2 -2
- package/dist/{ChatApp-YHC7ASGR.js → ChatApp-DYC2WNAP.js} +2 -2
- package/dist/{absorb-eval-GJ47IOFG.js → absorb-eval-4FENRVXM.js} +2 -2
- package/dist/{adapter-WROHSAHE.js → adapter-5WMQSSQM.js} +2 -2
- package/dist/{agent-5MYO4YCO.js → agent-UDKXN4QV.js} +2 -2
- package/dist/{board-dashboard-3CSSUGNZ.js → board-dashboard-CZXKVKK7.js} +5 -5
- package/dist/{board-dashboard-3CSSUGNZ.js.map → board-dashboard-CZXKVKK7.js.map} +1 -1
- package/dist/{chunk-FSEJ2LX5.js → chunk-3XS7M5LM.js} +341 -339
- package/dist/chunk-3XS7M5LM.js.map +1 -0
- package/dist/{chunk-ZXABOPXF.js → chunk-4UJDRI7W.js} +2 -2
- package/dist/{chunk-QAMVAZ67.js → chunk-5BT4VPJC.js} +2 -2
- package/dist/chunk-5CUOKXOD.js +39 -0
- package/dist/chunk-5CUOKXOD.js.map +1 -0
- package/dist/{chunk-AKPLNPUY.js → chunk-5QXRGX2F.js} +2 -2
- package/dist/{chunk-X23I2U26.js → chunk-5RCWAXVK.js} +2 -2
- package/dist/{chunk-HCQX6LVZ.js → chunk-5XN2OMBS.js} +2 -2
- package/dist/{chunk-YG5GPPGI.js → chunk-6EJJKOMW.js} +3 -3
- package/dist/{chunk-IATCZJP7.js → chunk-ABMDDRZL.js} +2 -2
- package/dist/{chunk-D3HNIOZ7.js → chunk-AEFO6ES5.js} +2 -2
- package/dist/{chunk-EVFQINOQ.js → chunk-AZCGU5XU.js} +2 -2
- package/dist/{chunk-GMQLDXEM.js → chunk-CIW37UJT.js} +2 -2
- package/dist/{chunk-M75VNIVM.js → chunk-D5LIMOI6.js} +2 -2
- package/dist/{chunk-MSOAI54R.js → chunk-E3SA7KIZ.js} +2 -2
- package/dist/{chunk-WZIFXZZX.js → chunk-GO4J44UD.js} +2 -2
- package/dist/{chunk-CHCAPQ6E.js → chunk-JD5TCX4X.js} +2 -2
- package/dist/{chunk-2REJBHT5.js → chunk-JMRFYGET.js} +2 -2
- package/dist/{chunk-ETMUGFPI.js → chunk-M6TZ7IIJ.js} +2 -2
- package/dist/{chunk-NLMQ7ZAE.js → chunk-NCMPJPXG.js} +2 -2
- package/dist/{chunk-OQEP2Q32.js → chunk-NW7B53KD.js} +2 -2
- package/dist/{chunk-VFG7GZC6.js → chunk-PSUOF7O5.js} +2 -2
- package/dist/{chunk-FJJ5PVQK.js → chunk-RHNOMUYZ.js} +86 -86
- package/dist/chunk-RHNOMUYZ.js.map +1 -0
- package/dist/{chunk-B7WQT7GG.js → chunk-SQP6A5AG.js} +2 -2
- package/dist/{chunk-QEGBOPAP.js → chunk-TN3XNBQN.js} +2 -2
- package/dist/{chunk-GP56ZRAF.js → chunk-U476QMLK.js} +2 -2
- package/dist/{chunk-JE2EV6NS.js → chunk-VOVDWFFP.js} +31 -30
- package/dist/chunk-VOVDWFFP.js.map +1 -0
- package/dist/{chunk-B5JK4MQX.js → chunk-WQTPSXVB.js} +2 -2
- package/dist/{chunk-K5VZS747.js → chunk-XC3466Z4.js} +2 -2
- package/dist/{chunk-PJ2OFOAL.js → chunk-XPYZBWI7.js} +2 -2
- package/dist/{chunk-NJLWS44P.js → chunk-XV7IHWQE.js} +2 -2
- package/dist/{chunk-QW5WOBSU.js → chunk-Y6KR7NXL.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/{client-2TJ3TOCH.js → client-W7VFEYQ3.js} +2 -2
- package/dist/{config-JHSM6KFT.js → config-ZVRI3GFZ.js} +2 -2
- package/dist/{config-mutate-YERBKGAB.js → config-mutate-OM4MI56W.js} +2 -2
- package/dist/{config-mutator-WNNU4EDV.js → config-mutator-RK3UQORI.js} +2 -2
- package/dist/{contributions-HAWUHQWM.js → contributions-3WW5AJ5A.js} +2 -2
- package/dist/{doctor-GOMB6LDS.js → doctor-PLN3QJE4.js} +2 -2
- package/dist/{follow-up-tool-5YFJS2JZ.js → follow-up-tool-LS4OUMLZ.js} +2 -2
- package/dist/{hub-3M4HJMYR.js → hub-J43NXLW3.js} +2 -2
- package/dist/index.d.ts +131 -1
- package/dist/index.js +1 -1
- package/dist/{org-tool-JS4WKB35.js → org-tool-NVCSDX4I.js} +2 -2
- package/dist/{program-OFMRVB7N.js → program-BRFPOZLO.js} +26 -26
- package/dist/program-BRFPOZLO.js.map +1 -0
- package/dist/{promote-BME3QLM6.js → promote-AO6KC3SU.js} +2 -2
- package/dist/{query-BFZDI667.js → query-W6OYKQ2U.js} +2 -2
- package/dist/{query-settings-ICYJNA6H.js → query-settings-2D6NCHCV.js} +2 -2
- package/dist/{registry-NUO4JEA5.js → registry-3J5U67DS.js} +2 -2
- package/dist/{request-planner-CUAEVQKB.js → request-planner-SDO5MNFV.js} +2 -2
- package/dist/{review-candidates-PGF3IRZR.js → review-candidates-EAOLCDIK.js} +2 -2
- package/dist/{routing-CXGJMM55.js → routing-VDVZ4IYF.js} +2 -2
- package/dist/{schedule-tool-G3RBORJS.js → schedule-tool-65H6URQU.js} +2 -2
- package/dist/{scheduler-FKCNMUB7.js → scheduler-B52UIMKB.js} +2 -2
- package/dist/{seat-6TUUPDR6.js → seat-5DLUHBTK.js} +2 -2
- package/dist/{select-ARQMXFFV.js → select-Z3JDFC2C.js} +2 -2
- package/dist/{set-enabled-CYS6NYKQ.js → set-enabled-FMI2GXCF.js} +2 -2
- package/dist/{sprint-tool-5RNJZDQJ.js → sprint-tool-B2LNMNPB.js} +2 -2
- package/dist/tool-AR4BLSYC.js +2 -0
- package/dist/tool-EG6PL6NM.js +10 -0
- package/dist/tool-EG6PL6NM.js.map +1 -0
- package/dist/{tool-YQFTOJJL.js → tool-OVW6DDOO.js} +2 -2
- package/dist/{tool-KY7WN3HV.js → tool-RW32VEIV.js} +2 -2
- package/dist/{tool-CHHSFKU2.js → tool-YT3WBUHS.js} +2 -2
- package/dist/{wiki-RJKQ6ZLV.js → wiki-7PQ5YVA7.js} +2 -2
- package/dist/wiki-enrich-IQZ5Y7A5.js +2 -0
- package/package.json +2 -2
- package/dist/chunk-FJJ5PVQK.js.map +0 -1
- package/dist/chunk-FSEJ2LX5.js.map +0 -1
- package/dist/chunk-JE2EV6NS.js.map +0 -1
- package/dist/chunk-YB2QYUXG.js +0 -38
- package/dist/chunk-YB2QYUXG.js.map +0 -1
- package/dist/program-OFMRVB7N.js.map +0 -1
- package/dist/tool-243ZBIYG.js +0 -2
- package/dist/tool-JAVKPEKS.js +0 -10
- package/dist/tool-JAVKPEKS.js.map +0 -1
- package/dist/wiki-enrich-4ZKID3ZU.js +0 -2
- /package/dist/{App-2IEK5HWX.js.map → App-QRZJGHNK.js.map} +0 -0
- /package/dist/{ChatApp-YHC7ASGR.js.map → ChatApp-DYC2WNAP.js.map} +0 -0
- /package/dist/{absorb-eval-GJ47IOFG.js.map → absorb-eval-4FENRVXM.js.map} +0 -0
- /package/dist/{adapter-WROHSAHE.js.map → adapter-5WMQSSQM.js.map} +0 -0
- /package/dist/{agent-5MYO4YCO.js.map → agent-UDKXN4QV.js.map} +0 -0
- /package/dist/{chunk-ZXABOPXF.js.map → chunk-4UJDRI7W.js.map} +0 -0
- /package/dist/{chunk-QAMVAZ67.js.map → chunk-5BT4VPJC.js.map} +0 -0
- /package/dist/{chunk-AKPLNPUY.js.map → chunk-5QXRGX2F.js.map} +0 -0
- /package/dist/{chunk-X23I2U26.js.map → chunk-5RCWAXVK.js.map} +0 -0
- /package/dist/{chunk-HCQX6LVZ.js.map → chunk-5XN2OMBS.js.map} +0 -0
- /package/dist/{chunk-YG5GPPGI.js.map → chunk-6EJJKOMW.js.map} +0 -0
- /package/dist/{chunk-IATCZJP7.js.map → chunk-ABMDDRZL.js.map} +0 -0
- /package/dist/{chunk-D3HNIOZ7.js.map → chunk-AEFO6ES5.js.map} +0 -0
- /package/dist/{chunk-EVFQINOQ.js.map → chunk-AZCGU5XU.js.map} +0 -0
- /package/dist/{chunk-GMQLDXEM.js.map → chunk-CIW37UJT.js.map} +0 -0
- /package/dist/{chunk-M75VNIVM.js.map → chunk-D5LIMOI6.js.map} +0 -0
- /package/dist/{chunk-MSOAI54R.js.map → chunk-E3SA7KIZ.js.map} +0 -0
- /package/dist/{chunk-WZIFXZZX.js.map → chunk-GO4J44UD.js.map} +0 -0
- /package/dist/{chunk-CHCAPQ6E.js.map → chunk-JD5TCX4X.js.map} +0 -0
- /package/dist/{chunk-2REJBHT5.js.map → chunk-JMRFYGET.js.map} +0 -0
- /package/dist/{chunk-ETMUGFPI.js.map → chunk-M6TZ7IIJ.js.map} +0 -0
- /package/dist/{chunk-NLMQ7ZAE.js.map → chunk-NCMPJPXG.js.map} +0 -0
- /package/dist/{chunk-OQEP2Q32.js.map → chunk-NW7B53KD.js.map} +0 -0
- /package/dist/{chunk-VFG7GZC6.js.map → chunk-PSUOF7O5.js.map} +0 -0
- /package/dist/{chunk-B7WQT7GG.js.map → chunk-SQP6A5AG.js.map} +0 -0
- /package/dist/{chunk-QEGBOPAP.js.map → chunk-TN3XNBQN.js.map} +0 -0
- /package/dist/{chunk-GP56ZRAF.js.map → chunk-U476QMLK.js.map} +0 -0
- /package/dist/{chunk-B5JK4MQX.js.map → chunk-WQTPSXVB.js.map} +0 -0
- /package/dist/{chunk-K5VZS747.js.map → chunk-XC3466Z4.js.map} +0 -0
- /package/dist/{chunk-PJ2OFOAL.js.map → chunk-XPYZBWI7.js.map} +0 -0
- /package/dist/{chunk-NJLWS44P.js.map → chunk-XV7IHWQE.js.map} +0 -0
- /package/dist/{chunk-QW5WOBSU.js.map → chunk-Y6KR7NXL.js.map} +0 -0
- /package/dist/{client-2TJ3TOCH.js.map → client-W7VFEYQ3.js.map} +0 -0
- /package/dist/{config-JHSM6KFT.js.map → config-ZVRI3GFZ.js.map} +0 -0
- /package/dist/{config-mutate-YERBKGAB.js.map → config-mutate-OM4MI56W.js.map} +0 -0
- /package/dist/{config-mutator-WNNU4EDV.js.map → config-mutator-RK3UQORI.js.map} +0 -0
- /package/dist/{contributions-HAWUHQWM.js.map → contributions-3WW5AJ5A.js.map} +0 -0
- /package/dist/{doctor-GOMB6LDS.js.map → doctor-PLN3QJE4.js.map} +0 -0
- /package/dist/{follow-up-tool-5YFJS2JZ.js.map → follow-up-tool-LS4OUMLZ.js.map} +0 -0
- /package/dist/{hub-3M4HJMYR.js.map → hub-J43NXLW3.js.map} +0 -0
- /package/dist/{org-tool-JS4WKB35.js.map → org-tool-NVCSDX4I.js.map} +0 -0
- /package/dist/{promote-BME3QLM6.js.map → promote-AO6KC3SU.js.map} +0 -0
- /package/dist/{query-BFZDI667.js.map → query-W6OYKQ2U.js.map} +0 -0
- /package/dist/{query-settings-ICYJNA6H.js.map → query-settings-2D6NCHCV.js.map} +0 -0
- /package/dist/{registry-NUO4JEA5.js.map → registry-3J5U67DS.js.map} +0 -0
- /package/dist/{request-planner-CUAEVQKB.js.map → request-planner-SDO5MNFV.js.map} +0 -0
- /package/dist/{review-candidates-PGF3IRZR.js.map → review-candidates-EAOLCDIK.js.map} +0 -0
- /package/dist/{routing-CXGJMM55.js.map → routing-VDVZ4IYF.js.map} +0 -0
- /package/dist/{schedule-tool-G3RBORJS.js.map → schedule-tool-65H6URQU.js.map} +0 -0
- /package/dist/{scheduler-FKCNMUB7.js.map → scheduler-B52UIMKB.js.map} +0 -0
- /package/dist/{seat-6TUUPDR6.js.map → seat-5DLUHBTK.js.map} +0 -0
- /package/dist/{select-ARQMXFFV.js.map → select-Z3JDFC2C.js.map} +0 -0
- /package/dist/{set-enabled-CYS6NYKQ.js.map → set-enabled-FMI2GXCF.js.map} +0 -0
- /package/dist/{sprint-tool-5RNJZDQJ.js.map → sprint-tool-B2LNMNPB.js.map} +0 -0
- /package/dist/{tool-243ZBIYG.js.map → tool-AR4BLSYC.js.map} +0 -0
- /package/dist/{tool-YQFTOJJL.js.map → tool-OVW6DDOO.js.map} +0 -0
- /package/dist/{tool-KY7WN3HV.js.map → tool-RW32VEIV.js.map} +0 -0
- /package/dist/{tool-CHHSFKU2.js.map → tool-YT3WBUHS.js.map} +0 -0
- /package/dist/{wiki-RJKQ6ZLV.js.map → wiki-7PQ5YVA7.js.map} +0 -0
- /package/dist/{wiki-enrich-4ZKID3ZU.js.map → wiki-enrich-IQZ5Y7A5.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{d as h}from"./chunk-
|
|
1
|
+
import{d as h}from"./chunk-AZCGU5XU.js";var d=["main contact","primary contact","point of contact","billing contact","technical contact","decision maker"],f=/[\w.+-]+@[\w-]+(?:\.[\w-]+)+/g,w=/\b(role|title|position|job)\s*\**\s*[::]\s*\**\s*([^\n;|]+)/gi;function L(t,c,e=[]){let l=[c,...e].join(`
|
|
2
2
|
`),a=l.toLowerCase(),i=h(t,l);for(let s of p(t.match(f)??[]))a.includes(s.toLowerCase())||i.push(`email ${s}`);let m=t.toLowerCase();for(let s of d)m.includes(s)&&!a.includes(s)&&i.push(`marker "${s}"`);for(let s of t.matchAll(w)){let n=s[2].replace(/\*+/g,"").trim();n&&!a.includes(n.toLowerCase())&&i.push(`${s[1].toLowerCase()} "${n}"`)}return p(i)}function p(t){return[...new Set(t)]}var $=.9,g=/^\s*(?:wait\b|here(?:'s| is) the (?:updated|modified|patched|revised)|i (?:must|need to|will|should) (?:output|return|write)|(?:okay|ok|sure)[,.!]\s|let me\b|as requested\b)/im;function k(t,c){let e=[],l=t.split(`
|
|
3
3
|
`).filter(o=>o.trim()).length,a=c.split(`
|
|
4
4
|
`).filter(o=>o.trim()).length;l>=5&&a<Math.floor(l*$)&&e.push(`the article shrinks from ${l} to ${a} lines`);let i=c.match(g);i&&!t.match(g)&&e.push(`it contains the model's own commentary ("${i[0].trim().slice(0,40)}")`);let m=o=>{let r=new Map;for(let u of o.split(`
|
|
5
5
|
`))/^#{1,6} /.test(u)&&r.set(u.trim(),(r.get(u.trim())??0)+1);return r},s=m(t);for(let[o,r]of m(c))r>1&&r>(s.get(o)??0)&&e.push(`the heading "${o}" appears ${r} times`);let n=L(t,c);return n.length&&e.push(`it drops ${n.length} fact(s): ${n.slice(0,6).join(", ")}${n.length>6?", \u2026":""}`),e}export{L as a,k as b};
|
|
6
|
-
//# sourceMappingURL=chunk-
|
|
6
|
+
//# sourceMappingURL=chunk-WQTPSXVB.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{q as _,r as W}from"./chunk-2AXFYDWF.js";import{b as Y,c as I,d as O}from"./chunk-AQASR6KR.js";import{b as F}from"./chunk-MEFPXHQJ.js";import{a as E}from"./chunk-
|
|
1
|
+
import{q as _,r as W}from"./chunk-2AXFYDWF.js";import{b as Y,c as I,d as O}from"./chunk-AQASR6KR.js";import{b as F}from"./chunk-MEFPXHQJ.js";import{a as E}from"./chunk-ABMDDRZL.js";import{b as L}from"./chunk-KEXBEUSU.js";import{createHash as ee}from"crypto";import{existsSync as H,readdirSync as te,readFileSync as re,writeFileSync as ne}from"fs";import{resolve as P}from"path";function be(n,r,s,t,o,i,c="",p="",m=""){return Z(r,s,t,o,i,c,p,m)}function Z(n,r,s,t,o,i="",c="",p=""){let m=r?`
|
|
2
2
|
## Worldview
|
|
3
3
|
|
|
4
4
|
${r}
|
|
@@ -249,4 +249,4 @@ ${u}`}var x="memory-promoter",oe=["project","reference","feedback"],K="_memory-p
|
|
|
249
249
|
Re-emit the FULL corrected JSON object \u2014 same structure, fixed issues, valid JSON only.`:n,y=await t(`${a}/task`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:r.viaAgent,message:h,freshSession:s===null,context:{channel:"api",chatId:r.chatId??"memory-promote"}}),signal:i.signal});if(!y.ok){let f=await y.text().catch(()=>"");throw new Error(`agent /task ${y.status}: ${f.slice(0,500)}`)}let w=await y.json();if(w.error)throw new Error(`agent reported error: ${w.error}`);let b=String(w.content??"").trim();if(!b)throw new Error("agent returned empty content");return b}if(!r.model)throw new Error("callPromotionLlm: viaAgent or model is required");let p=process.env.ANTHROPIC_API_KEY;if(!p)throw new Error("ANTHROPIC_API_KEY not set; use --via <agentId> instead");let m=[{role:"user",content:n}];s&&(m.push({role:"assistant",content:"(previous attempt; will retry with corrections)"}),m.push({role:"user",content:`Your previous response failed validation: ${s}
|
|
250
250
|
Re-emit the FULL corrected JSON object.`}));let u=await t(me,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":p,"anthropic-version":ge},body:JSON.stringify({model:r.model,max_tokens:8e3,messages:m}),signal:i.signal});if(!u.ok){let a=await u.text().catch(()=>"");throw new Error(`anthropic API ${u.status}: ${a.slice(0,500)}`)}let d=await u.json(),e=(Array.isArray(d.content)?d.content:[]).filter(a=>a?.type==="text").map(a=>a.text).join(`
|
|
251
251
|
`).trim();if(!e)throw new Error("anthropic API returned no text content");return e}finally{clearTimeout(c)}}async function Se(n={}){let r=n.wikiDir??P(process.cwd(),".agentx","wiki"),s=n.memoryRoot??P(process.cwd(),".agentx"),t=n.log??(()=>{}),o=n.now??Date.now(),i={candidates:[],clusters:[],proposed:[],skipped:[],gaps:[],warnings:[],errors:[],dryRun:!n.commit},c=new E(r,(...l)=>t(l.map(String).join(" "))),p=c.rebuildIndex(),m=z(r),u=[...ce(s),...n.extraCandidates??[]];if(i.candidates=de(u,p,m,{types:n.types,sinceMs:n.sinceMs,agentFilter:n.agentFilter,now:o,max:n.max}),i.candidates.length===0)return t("no unpromoted memories in window"),i;if(i.clusters=le(i.candidates),i.dryRun)return i;let d=p.articles.map(l=>({title:l.title,path:l.path,type:l.type})),g=c.getWorldview()??"",e=n.budgetTokens??ue,a=i.clusters,h=D(x,a,d,g);for(;R(h)>e&&a.length>1;)a=a.slice(0,-1),h=D(x,a,d,g);if(R(h)>e)return i.errors.push(`judge prompt (~${R(h)} tokens) exceeds the ${e}-token budget even with one cluster`),i;a.length<i.clusters.length&&i.warnings.push(`token budget: judged ${a.length} of ${i.clusters.length} clusters; the rest wait for the next run`);let y=a.flatMap(l=>l.candidates),w=new Set(y.map(l=>l.stamp)),b=n.chatId??`memory-promote-${new Date(o).toISOString().slice(0,10)}`,f=B(await G(h,{...n,chatId:b}),w);if("error"in f&&(t(`parse failed (${f.error}) \u2014 retrying with feedback`),f=B(await G(h,{...n,chatId:b},f.error),w)),"error"in f)return i.errors.push(`LLM response unusable after retry: ${f.error}`),i;i.warnings.push(...f.warnings),i.gaps=f.gaps;let v=new Date(o).toISOString(),k=[],T=new Map(y.map(l=>[l.stamp,l]));for(let l of f.articles){let A=c.readArticle(l.path);if(A&&!c.canWrite(A.meta,x)){i.errors.push(`write denied for "${l.path}" (owned by ${A.meta.owner??"?"})`);continue}let M=fe(l.promotedFrom,T),S={id:Y(o,l.path),createdAt:v,status:"pending",article:l,evidence:M,...A?{replaces:{lastUpdated:A.meta.lastUpdated,contentHash:V(A.content)}}:{}};I(r,S),i.proposed.push({id:S.id,path:l.path,title:l.title,type:l.type,stamps:l.promotedFrom,agents:M.agents,occurrences:M.occurrences});for(let X of l.promotedFrom)k.push({stamp:X,decision:"proposed",article:l.path,proposal:S.id,at:v})}for(let l of f.skipped)k.push({stamp:l.stamp,decision:"skipped",reason:l.reason,at:v}),i.skipped.push(l);return k.length&&C(r,k),i}var ue=6e4;function R(n){return Math.ceil(n.length/4)}function V(n){return ee("sha256").update(n).digest("hex").slice(0,16)}var he=600;function ye(n){return n.startsWith("review:")?"review":n.startsWith(j)?"failure":"memory"}function fe(n,r){let s=[];for(let t of n){let o=r.get(t);o&&s.push({stamp:t,kind:ye(t),agentId:o.agentId,type:o.memory.type,name:o.memory.name,description:o.memory.description,...o.occurrences?{occurrences:o.occurrences}:{},...o.sessions?.length?{sessions:o.sessions}:{},...o.tasks?.length?{tasks:o.tasks}:{},...o.failure?{failure:o.failure}:{},...o.memory.author?{author:o.memory.author}:{},...o.memory.taskId?{taskId:o.memory.taskId}:{},updatedAt:o.memory.updatedAt,excerpt:o.memory.body.slice(0,he)})}return{agents:[...new Set(s.map(t=>t.agentId))].sort(),occurrences:Math.max(1,...s.map(t=>t.occurrences??1)),sources:s}}function Ee(n,r,s={}){let t=O(n,r);if(!t)return{ok:!1,error:`no proposal "${r}"`};if(t.status!=="pending")return{ok:!1,error:`proposal "${r}" is already ${t.status}`};let o=s.log??(()=>{}),i=new E(n,(...a)=>o(a.map(String).join(" "))),{article:c}=t,p=i.readArticle(c.path);if(!s.force){if(p&&!t.replaces)return{ok:!1,error:`"${c.path}" was created after this proposal; review it, then approve with --force`};if(p&&t.replaces&&V(p.content)!==t.replaces.contentHash)return{ok:!1,error:`"${c.path}" changed since this proposal; review it, then approve with --force`}}let m=s.now??Date.now(),u=new Date(m).toISOString().slice(0,10);if(!i.writeArticle(c.path,{title:c.title,type:L(c.type)?c.type:void 0,related:c.related,tags:c.tags,owner:x,access:"public",created:p?.meta.created??u,lastUpdated:u,sources:ae(p?.meta.sources,c.promotedFrom)},c.content,x))return{ok:!1,error:`write denied for "${c.path}" (owned by ${p?.meta.owner??"?"})`};let g=new Date(m).toISOString();C(n,c.promotedFrom.map(a=>({stamp:a,decision:"promoted",article:c.path,proposal:r,at:g}))),i.rebuildIndex();let e={...t,status:"approved",decidedBy:s.by??"operator",decidedAt:g};return I(n,e),{ok:!0,proposal:e}}function Oe(n,r,s={}){let t=O(n,r);if(!t)return{ok:!1,error:`no proposal "${r}"`};if(t.status!=="pending")return{ok:!1,error:`proposal "${r}" is already ${t.status}`};let o=new Date(s.now??Date.now()).toISOString();C(n,t.article.promotedFrom.map(c=>({stamp:c,decision:"rejected",article:t.article.path,proposal:r,reason:s.reason,at:o})));let i={...t,status:"rejected",decidedBy:s.by??"operator",decidedAt:o,...s.reason?{reason:s.reason}:{}};return I(n,i),{ok:!0,proposal:i}}export{be as a,x as b,oe as c,K as d,q as e,ie as f,$ as g,ae as h,ce as i,z as j,C as k,le as l,B as m,de as n,G as o,Se as p,R as q,ye as r,fe as s,Ee as t,Oe as u};
|
|
252
|
-
//# sourceMappingURL=chunk-
|
|
252
|
+
//# sourceMappingURL=chunk-XC3466Z4.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import t from"chalk";import{spawn as S}from"child_process";import{resolve as j}from"path";var E=l=>l||j(process.cwd(),".agentx/wiki");function N(l){return async d=>{let{claudeCliEnv:e}=await import("./workspace-env-UOK5MMKD.js"),h=["-p","-","--output-format","json","--max-turns","1","--model",l,"--tools","","--strict-mcp-config","--mcp-config",'{"mcpServers":{}}',"--settings",'{"disableAllHooks":true}',"--setting-sources","","--no-session-persistence"],y=await new Promise(($,a)=>{let s=S("claude",h,{env:e(),stdio:["pipe","pipe","pipe"]}),p="",g="",i=setTimeout(()=>s.kill("SIGTERM"),24e4);s.stdout.on("data",r=>{p+=r}),s.stderr.on("data",r=>{g+=r}),s.on("error",r=>{clearTimeout(i),a(r)}),s.on("close",r=>{clearTimeout(i),r===0?$(p):a(new Error(`claude exited ${r}: ${g.trim().slice(0,200)}`))}),s.stdin.end(d)}),c=JSON.parse(y);if(c.is_error)throw new Error(`model error: ${String(c.result).slice(0,200)}`);return{text:String(c.result??""),costUsd:Number(c.total_cost_usd)||0}}}function I(l){l.command("enrich [entities...]").description("write a full overview, sourced typed facts and linked history on entity pages (person, organization, project, place, assets)").option("--dir <path>","wiki directory (default .agentx/wiki)").option("--types <list>","comma-separated entity types","person,organization,project,place,device,server,app,domain,account").option("--max <n>","most entities per run","10").option("--max-cost <usd>","stop before the next call once the run spent this much","1").option("--model <m>","model","sonnet").option("--force","redo entities whose sources did not change").option("--dry-run","show what would be written, write nothing").option("--create <title>","first create a page for a thing other pages only name, then enrich it (needs --as and --owner)").option("--as <type>","type of the page --create makes, e.g. organization").option("--owner <agent>","agent whose wiki gets the page --create makes").option("--json","print the run as JSON").action(async(d,e)=>{let{WikiHub:h}=await import("./hub-
|
|
1
|
+
import t from"chalk";import{spawn as S}from"child_process";import{resolve as j}from"path";var E=l=>l||j(process.cwd(),".agentx/wiki");function N(l){return async d=>{let{claudeCliEnv:e}=await import("./workspace-env-UOK5MMKD.js"),h=["-p","-","--output-format","json","--max-turns","1","--model",l,"--tools","","--strict-mcp-config","--mcp-config",'{"mcpServers":{}}',"--settings",'{"disableAllHooks":true}',"--setting-sources","","--no-session-persistence"],y=await new Promise(($,a)=>{let s=S("claude",h,{env:e(),stdio:["pipe","pipe","pipe"]}),p="",g="",i=setTimeout(()=>s.kill("SIGTERM"),24e4);s.stdout.on("data",r=>{p+=r}),s.stderr.on("data",r=>{g+=r}),s.on("error",r=>{clearTimeout(i),a(r)}),s.on("close",r=>{clearTimeout(i),r===0?$(p):a(new Error(`claude exited ${r}: ${g.trim().slice(0,200)}`))}),s.stdin.end(d)}),c=JSON.parse(y);if(c.is_error)throw new Error(`model error: ${String(c.result).slice(0,200)}`);return{text:String(c.result??""),costUsd:Number(c.total_cost_usd)||0}}}function I(l){l.command("enrich [entities...]").description("write a full overview, sourced typed facts and linked history on entity pages (person, organization, project, place, assets)").option("--dir <path>","wiki directory (default .agentx/wiki)").option("--types <list>","comma-separated entity types","person,organization,project,place,device,server,app,domain,account").option("--max <n>","most entities per run","10").option("--max-cost <usd>","stop before the next call once the run spent this much","1").option("--model <m>","model","sonnet").option("--force","redo entities whose sources did not change").option("--dry-run","show what would be written, write nothing").option("--create <title>","first create a page for a thing other pages only name, then enrich it (needs --as and --owner)").option("--as <type>","type of the page --create makes, e.g. organization").option("--owner <agent>","agent whose wiki gets the page --create makes").option("--json","print the run as JSON").action(async(d,e)=>{let{WikiHub:h}=await import("./hub-J43NXLW3.js"),{GraphCache:y}=await import("./graph-ZVKV3JBD.js"),{loadOntology:c}=await import("./load-Q3HCFXDT.js"),{loadRoster:$}=await import("./roster-BZGKG2ZA.js"),{ENRICH_TYPES:a,loadEnrichState:s,runEnrich:p,saveEnrichState:g}=await import("./enrich-MZMIQ3SV.js"),i=E(e.dir),r=e.types.split(",").map(o=>o.trim()).filter(Boolean),b=r.filter(o=>!a.includes(o));if(b.length){console.error(t.red(` not an entity type this job handles: ${b.join(", ")} (use ${a.join(", ")})`)),process.exitCode=1;return}let x=Number(e.max);if(!Number.isInteger(x)||x<1){console.error(t.red(" --max must be a whole number of entities, 1 or more")),process.exitCode=1;return}let w=Number(e.maxCost);if(!Number.isFinite(w)||w<=0){console.error(t.red(" --max-cost must be a positive number of dollars")),process.exitCode=1;return}let m=new h(i,()=>{});if(e.create){let{createEntityPage:o}=await import("./enrich-MZMIQ3SV.js");if(!e.as||!a.includes(e.as)||!e.owner){console.error(t.red(` --create needs --as <${a.join("|")}> and --owner <agent>`)),process.exitCode=1;return}if(m.syncedFrom(e.owner)){console.error(t.red(` ${e.owner}'s pages are copied from another node; pick an agent that runs here`)),process.exitCode=1;return}if(e.dryRun)console.log(t.dim(` --dry-run: would create "${e.create}" (${e.as}) in ${e.owner}'s wiki`));else{let f=o(m,e.create,e.as,e.owner,new Date().toISOString().slice(0,10));console.log(f?t.green(` created ${e.owner}/${f}`):t.dim(` ${e.owner} already has a page titled "${e.create}"`))}d=[...d,e.create],r.includes(e.as)||r.push(e.as)}let{ontology:v}=c(i),k=new y().get(m,v,$(i,m.listAgents([]),v.agent_names)),C=s(i),u=await p(m,k,N(e.model),{types:r,only:d,max:x,maxCostUsd:w,dryRun:!!e.dryRun,force:!!e.force,today:new Date().toISOString().slice(0,10),save:o=>g(i,o)},C);if(e.json){console.log(JSON.stringify(u,null,2));return}for(let o of u.outcomes){let f=o.status==="written"?t.green("\u2713"):o.status==="dry-run"?t.cyan("~"):t.yellow("\xB7");console.log(` ${f} ${o.title} ${t.dim(`${o.status} \xB7 ${o.page??"no page"} \xB7 overview ${o.overview?"yes":"no"} \xB7 ${o.statements} facts \xB7 ${o.links} links \xB7 $${o.costUsd.toFixed(3)}`)}`);for(let n of o.facts??[])console.log(t.dim(` fact: ${n.property} \u2192 ${n.value}${n.role?` (${n.role})`:""} \xB7 source ${n.source}`));for(let n of o.dropped.slice(0,6))console.log(t.dim(` dropped: ${n}`));o.preview&&console.log(t.dim(o.preview.split(`
|
|
2
2
|
`).slice(0,12).map(n=>` | ${n}`).join(`
|
|
3
3
|
`)))}u.outcomes.length===0&&console.log(t.dim(" nothing to do: no entity of these types changed since the last run (--force redoes them)")),console.log(t.dim(` spent $${u.costUsd.toFixed(3)} of $${w}${u.capped?" \xB7 stopped at the cap":""}`))})}export{N as a,I as b};
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
4
|
+
//# sourceMappingURL=chunk-XPYZBWI7.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as w}from"./chunk-
|
|
1
|
+
import{c as w}from"./chunk-AZCGU5XU.js";function T(t){let r=1779033703^t.length;for(let s=0;s<t.length;s++)r=Math.imul(r^t.charCodeAt(s),3432918353),r=r<<13|r>>>19;let o=r>>>0;return()=>{o=o+1831565813>>>0;let s=o;return s=Math.imul(s^s>>>15,s|1),s^=s+Math.imul(s^s>>>7,s|61),((s^s>>>14)>>>0)/4294967296}}function _(t,r,o){let s=T(o),i=[...t].sort((e,u)=>e.path.localeCompare(u.path));for(let e=i.length-1;e>0;e--){let u=Math.floor(s()*(e+1));[i[e],i[u]]=[i[u],i[e]]}return i.slice(0,Math.max(0,r)).sort((e,u)=>e.path.localeCompare(u.path))}var R=new Set("about after again also because been before being between could does doing during each from have having here into just more most only other over same should some such than that their them then there these they this those through under until very were what when where which while will with would your yours user assistant agent message entry please thanks".split(" "));function k(t){let r=new Set;for(let o of t.toLowerCase().matchAll(/[\p{L}\p{N}][\p{L}\p{N}_-]{3,}/gu))R.has(o[0])||r.add(o[0]);return r}function E(t,r){let o=k(t);if(o.size===0)return 1;let s=k(r),i=0;for(let e of o)s.has(e)&&i++;return i/o.size}var W=.15;function $(t){let r=w(t);return{commits:r.commits,urls:r.urls,numbers:r.numbers}}function j(t,r,o){return t.includes(r)||o.some(s=>s.startsWith(r)||r.startsWith(s))}var y=t=>t.toLowerCase().replace(/\/+$/,"");function N(t,r,o){let s=t.sources.map(a=>r.get(a)).filter(a=>!!a),i=t.sources.filter(a=>!r.has(a)),e=s.filter(a=>k(a.content).size>=5&&E(a.content,t.content)<W).map(a=>a.id),u=[...s.map(a=>`${a.date??""}
|
|
2
2
|
${a.content}`),t.previous??""].join(`
|
|
3
3
|
`),l=u.toLowerCase(),d=$(u),p=new Set(d.urls.map(y)),g=new Set(d.numbers),n=$(t.content),c=[];for(let a of n.commits)j(l,a,d.commits)||c.push(`commit ${a}`);for(let a of n.urls)!p.has(y(a))&&!l.includes(y(a))&&c.push(`link ${a}`);for(let a of n.numbers)/^\d{1,2}$/.test(a)||!g.has(a)&&!l.includes(a)&&c.push(`number ${a}`);let h=[];for(let a of s){let m=$(a.content);if(m.commits.length===0&&m.urls.length===0)continue;let v=o(a.id),S=(v.length>0?v:[t.content]).join(`
|
|
4
4
|
`).toLowerCase(),x=$(S);for(let b of m.commits)j(S,b,x.commits)||h.push({entry:a.id,fact:`commit ${b}`});for(let b of m.urls)S.includes(y(b))||h.push({entry:a.id,fact:`link ${b}`})}return{path:t.path,title:t.title,type:t.type,sources:t.sources.length,missingSources:i,weakSources:e,ungrounded:c,lost:h}}function U(t,r){let o=r.toLowerCase(),s=w(r).commits,i=[];for(let e of t){let u=w(e.content),l=[...u.commits.filter(d=>!j(o,d,s)).map(d=>`commit ${d}`),...u.urls.filter(d=>!o.includes(y(d))).map(d=>`link ${d}`)];l.length>0&&i.push({entry:e.id,facts:l})}return i}var P=new Set("the and for with from into of on in at to by an a".split(" "));function L(t){return new Set((t||"").toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(r=>(r.length>1||/\d/.test(r))&&!P.has(r)&&!R.has(r)))}function M(t,r){if(t.size===0||r.size===0)return 0;let o=0;for(let s of t)r.has(s)&&o++;return o/(t.size+r.size-o)}function D(t,r,o={}){let s=o.titleMin??.75,i=o.sourcesMin??.5,e=t.map(l=>({...l,tt:L(l.title),ss:new Set(l.sources??[])})),u=[];for(let l=0;l<e.length;l++)for(let d=l+1;d<e.length;d++){let p=e[l],g=e[d];if(r&&!r.has(p.path)&&!r.has(g.path))continue;let n=(p.type??"")===(g.type??"")?M(p.tt,g.tt):0;if(n>=s){u.push({a:p.path,b:g.path,reason:"title",score:n});continue}if(p.ss.size>=2&&g.ss.size>=2){let c=M(p.ss,g.ss);c>=i&&u.push({a:p.path,b:g.path,reason:"sources",score:c})}}return u.sort((l,d)=>d.score-l.score||l.a.localeCompare(d.a))}var A=4e3;function J(t,r){let o=r.map(i=>{let e=i.content.length>A?`${i.content.slice(0,A)}
|
|
@@ -33,4 +33,4 @@ Reply with JSON only, no fencing:
|
|
|
33
33
|
{"claims": 0, "supported": 0, "unsupported": [], "contradicted": [], "off_subject": [], "missing": [], "verdict": "good"}`}function z(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let r=t,o=l=>Array.isArray(l)?l.map(d=>String(d)):[],s=l=>typeof l=="number"&&Number.isFinite(l)&&l>=0?Math.round(l):NaN,i=s(r.claims);if(Number.isNaN(i))return null;let e=Math.min(i,Number.isNaN(s(r.supported))?i-o(r.unsupported).length:s(r.supported)),u=r.verdict==="good"||r.verdict==="minor"||r.verdict==="major"?r.verdict:null;return u?{claims:i,supported:Math.max(0,e),unsupported:o(r.unsupported),contradicted:o(r.contradicted),offSubject:o(r.off_subject??r.offSubject),missing:o(r.missing),verdict:u}:null}function I(t,r,o,s=[],i=5,e){let u={};for(let n of t)u[n.type??"untyped"]=(u[n.type??"untyped"]??0)+1;let l=new Set,d=new Set;for(let n of t)for(let c of n.lost)l.add(c.entry),d.add(`${c.entry}|${c.fact}`);let p=new Set(r.flatMap(n=>[n.a,n.b]).filter(n=>t.some(c=>c.path===n))),g={sample:{articles:t.length,seed:o.seed,since:o.since,byType:u},citations:{withSources:t.filter(n=>n.sources>0).length,missingSources:t.reduce((n,c)=>n+c.missingSources.length,0),weakSources:t.reduce((n,c)=>n+c.weakSources.length,0),articlesWithWeak:t.filter(n=>n.weakSources.length>0).length},grounding:{articlesWithUngrounded:t.filter(n=>n.ungrounded.length>0).length,ungroundedFacts:t.reduce((n,c)=>n+c.ungrounded.length,0)},lost:{entriesWithLostFacts:l.size,lostFacts:d.size},duplicates:{pairs:r.length,articlesInPair:p.size},...e?{uncited:{entries:e.entries,withLostFacts:e.lost.length}}:{},examples:{ungrounded:t.filter(n=>n.ungrounded.length>0).slice(0,i).map(n=>({path:n.path,facts:n.ungrounded.slice(0,6)})),lost:t.flatMap(n=>n.lost.map(c=>({path:n.path,...c}))).slice(0,i),weak:t.filter(n=>n.weakSources.length>0).slice(0,i).map(n=>({path:n.path,entries:n.weakSources})),duplicates:r.slice(0,i),uncited:(e?.lost??[]).slice(0,i).map(n=>({entry:n.entry,facts:n.facts.slice(0,4)})),judged:s.filter(n=>n.verdict.verdict!=="good").slice(0,i).map(n=>({path:n.path,verdict:n.verdict.verdict,unsupported:n.verdict.unsupported.slice(0,4),contradicted:n.verdict.contradicted.slice(0,4),offSubject:n.verdict.offSubject,missing:n.verdict.missing.slice(0,4)}))}};if(s.length>0){let n=s.map(a=>a.verdict),c=n.reduce((a,m)=>a+m.claims,0),h=n.reduce((a,m)=>a+m.supported,0);g.judge={judged:n.length,claims:c,supported:h,supportRate:c>0?h/c:1,unsupported:n.reduce((a,m)=>a+m.unsupported.length,0),contradicted:n.reduce((a,m)=>a+m.contradicted.length,0),articlesWithWrongMerge:n.filter(a=>a.offSubject.length>0).length,missingFacts:n.reduce((a,m)=>a+m.missing.length,0),verdicts:{good:n.filter(a=>a.verdict==="good").length,minor:n.filter(a=>a.verdict==="minor").length,major:n.filter(a=>a.verdict==="major").length}}}return g}var f=(t,r)=>r>0?`${Math.round(t/r*100)}%`:"\u2013";function O(t){let r=t.sample.articles,o=["# Wiki absorb scorecard","",`Sample: ${r} articles (seed \`${t.sample.seed}\`${t.sample.since?`, changed since ${t.sample.since}`:""}). Types: ${Object.entries(t.sample.byType).map(([e,u])=>`${e} ${u}`).join(", ")||"\u2013"}.`,"","| Check | Result | Lower is better? |","|---|---|---|",`| Articles citing at least one entry | ${t.citations.withSources}/${r} (${f(t.citations.withSources,r)}) | no |`,`| Cited ids with no entry | ${t.citations.missingSources} | yes |`,`| Articles with a weak citation (entry shares <${Math.round(W*100)}% of its words) | ${t.citations.articlesWithWeak}/${r} (${f(t.citations.articlesWithWeak,r)}) | yes |`,`| Articles with an ungrounded commit, link or number | ${t.grounding.articlesWithUngrounded}/${r} (${f(t.grounding.articlesWithUngrounded,r)}) | yes |`,`| Ungrounded facts | ${t.grounding.ungroundedFacts} | yes |`,`| Commits or links lost from cited entries | ${t.lost.lostFacts} across ${t.lost.entriesWithLostFacts} entries | yes |`,`| Sampled articles in a likely duplicate pair | ${t.duplicates.articlesInPair}/${r} (${f(t.duplicates.articlesInPair,r)}) | yes |`];if(t.uncited&&o.push(`| Entries read in the window but cited by no article | ${t.uncited.entries} | \u2013 |`,`| \u2026of which carry a commit or link no article has | ${t.uncited.withLostFacts} | yes |`),t.judge){let e=t.judge;o.push(`| Judge: claims supported by the cited entries | ${e.supported}/${e.claims} (${f(e.supported,e.claims)}) | no |`,`| Judge: unsupported / contradicted claims | ${e.unsupported} / ${e.contradicted} | yes |`,`| Judge: articles with an off-subject source (wrong merge) | ${e.articlesWithWrongMerge}/${e.judged} (${f(e.articlesWithWrongMerge,e.judged)}) | yes |`,`| Judge: facts missing from the article | ${e.missingFacts} | yes |`,`| Judge verdicts good / minor / major | ${e.verdicts.good} / ${e.verdicts.minor} / ${e.verdicts.major} | \u2013 |`)}let s=t.examples,i=(e,u)=>{u.length!==0&&o.push("",`## ${e}`,"",...u)};return i("Examples: ungrounded facts",s.ungrounded.map(e=>`- \`${e.path}\`: ${e.facts.join("; ")}`)),i("Examples: lost facts",s.lost.map(e=>`- \`${e.path}\` \u2190 entry \`${e.entry}\`: ${e.fact}`)),i("Examples: weak citations",s.weak.map(e=>`- \`${e.path}\`: ${e.entries.map(u=>`\`${u}\``).join(", ")}`)),i("Examples: uncited entries with facts no article has",s.uncited.map(e=>`- \`${e.entry}\`: ${e.facts.join("; ")}`)),i("Examples: likely duplicates",s.duplicates.map(e=>`- \`${e.a}\` \u2194 \`${e.b}\` (${e.reason}, ${e.score.toFixed(2)})`)),i("Examples: judge findings",s.judged.map(e=>{let u=[e.unsupported.length?`unsupported: ${e.unsupported.join(" | ")}`:"",e.contradicted.length?`contradicted: ${e.contradicted.join(" | ")}`:"",e.offSubject.length?`off-subject: ${e.offSubject.join(", ")}`:"",e.missing.length?`missing: ${e.missing.join(" | ")}`:""].filter(Boolean);return`- \`${e.path}\` (${e.verdict}): ${u.join("; ")}`})),o.push("","## Method","","- The sample is drawn with a seeded shuffle from the articles changed in the window, so the same seed and window give the same articles.","- Ungrounded: a commit hash, link or number (three digits or more, or a date) in the article that no cited entry and no earlier version of the article contains.","- Lost: a commit hash or link in a cited entry that no article citing that entry contains.","- Uncited: entries the absorb ledger marks as read in the window that no article cites; those carrying a commit or link that no article on the node has are counted as lost, since absorb will not offer them again.","- Weak citation: a cited entry sharing fewer than 15% of its distinctive words with the article.","- Duplicate: two articles of the same type whose titles share at least 75% of their words, or which share at least half their sources.","- Judge (optional): one model call per article reads the article and its cited entries and lists unsupported, contradicted, off-subject and missing items."),o.join(`
|
|
34
34
|
`)+`
|
|
35
35
|
`}function V(t){if(!t||typeof t!="object")return{};let r=t,o=r.usage??{},s=i=>typeof i=="number"&&Number.isFinite(i)?i:void 0;return{costUsd:s(r.total_cost_usd)??s(r.cost_usd),apiMs:s(r.duration_api_ms),inputTokens:s(o.input_tokens),outputTokens:s(o.output_tokens),cacheReadTokens:s(o.cache_read_input_tokens),cacheWriteTokens:s(o.cache_creation_input_tokens)}}function C(t,r){return t.length===0?0:t[Math.min(t.length-1,Math.floor(r*t.length))]}function Y(t){let r=new Map,o=i=>{let e=i||"(none)",u=r.get(e);return u||r.set(e,u={calls:[],runs:[]}),u};for(let i of t)i.kind==="call"?o(i.label).calls.push(i):i.kind==="run"&&o(i.label).runs.push(i);let s=[];for(let[i,{calls:e,runs:u}]of r){if(e.length===0)continue;let l=e.map(n=>n.wallMs).sort((n,c)=>n-c),d;if(u.length>0)d=u.reduce((n,c)=>n+(Date.parse(c.endedAt)-Date.parse(c.startedAt)),0);else{let n=e.map(h=>Date.parse(h.at)-h.wallMs),c=e.map(h=>Date.parse(h.at));d=Math.max(...c)-Math.min(...n)}let p=e.reduce((n,c)=>n+c.entries,0),g=e.reduce((n,c)=>n+(c.costUsd??0),0);s.push({label:i,calls:e.length,failed:e.filter(n=>n.failed).length,entries:p,articles:e.reduce((n,c)=>n+c.articles,0),refused:e.reduce((n,c)=>n+c.refused,0),heldCited:e.reduce((n,c)=>n+(c.heldCited??0),0),wallMs:d,callMsP50:C(l,.5),callMsP95:C(l,.95),prepMs:e.reduce((n,c)=>n+(c.prepMs??0),0),costUsd:g,costPerEntry:p>0?g/p:0,entriesPerMinute:d>0?p/d*6e4:0,promptChars:e.reduce((n,c)=>n+c.promptChars,0)})}return s.sort((i,e)=>i.label.localeCompare(e.label))}export{T as a,_ as b,k as c,E as d,W as e,N as f,U as g,D as h,A as i,J as j,z as k,I as l,O as m,V as n,Y as o};
|
|
36
|
-
//# sourceMappingURL=chunk-
|
|
36
|
+
//# sourceMappingURL=chunk-XV7IHWQE.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as rt,b as ot,c as st,d as x,e as A,f as v}from"./chunk-72SZI2UW.js";import{a as ne,b as et}from"./chunk-FCPTN6NF.js";import{a as Te,b as ht}from"./chunk-MCI3DIWW.js";import{o as we,p as Ze}from"./chunk-DCIYOPJF.js";import{
|
|
1
|
+
import{a as rt,b as ot,c as st,d as x,e as A,f as v}from"./chunk-72SZI2UW.js";import{a as ne,b as et}from"./chunk-FCPTN6NF.js";import{a as Te,b as ht}from"./chunk-MCI3DIWW.js";import{o as we,p as Ze}from"./chunk-DCIYOPJF.js";import{Bc as tt,Cc as nt}from"./chunk-VOVDWFFP.js";import{a as it,b as at,c as ct,d as ut,e as lt,f as dt,g as pt,h as mt,i as bt,j as ft,k as gt,l as yt}from"./chunk-RGDKHYY2.js";import{a as E,b as We,c as he}from"./chunk-QIJLFPWE.js";function R(e,t){$.set(e,t),X.delete(e)}function D(e){let t=X.get(e);if(t)return t;let r=$.get(e);if(!r){let o=Ee();throw new Error(`unknown decision backend "${e}"`+(o.length>0?` \u2014 registered: ${o.join(", ")}`:" \u2014 none registered"))}let n=r();return X.set(e,n),n}function Ee(){return[...$.keys()].sort()}function wt(){$.clear(),X.clear()}var $,X,C=E(()=>{"use strict";$=new Map,X=new Map});import Tt from"better-sqlite3";import{createHash as Et}from"crypto";import{mkdirSync as kt}from"fs";import{dirname as St,resolve as xt}from"path";function Q(e){if(e.type==="noul"){let r=e.noul,n={yes:r,no:1-r},o=r>=.5?"yes":"no",s=Math.abs(r-.5)*2;return{predicted:o,confidence:s,probabilities:n,topLabel:o,topProb:Math.max(r,1-r),expectedScore:null,pMax:Math.max(r,1-r),negEntropy:s}}if(e.type==="choice")return{predicted:e.choice,confidence:e.confidence,probabilities:{...e.probabilities},topLabel:e.choice,topProb:e.probabilities[e.choice]??0,expectedScore:null,pMax:e.pMax,negEntropy:e.negEntropy};let t=String(Math.round(e.score));return{predicted:t,confidence:e.confidence,probabilities:{...e.probabilities},topLabel:t,topProb:e.probabilities[t]??0,expectedScore:e.score,pMax:e.pMax,negEntropy:e.negEntropy}}function At(e){if(typeof e!="string"||e.length===0)return{};try{let t=JSON.parse(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function Rt(e){e.exec("CREATE TABLE IF NOT EXISTS schema_version (v INTEGER PRIMARY KEY);");let t=e.prepare("SELECT MAX(v) AS v FROM schema_version").get().v??0;t<1&&vt(e),t<2&&Ot(e),t<3&&_t(e)}function _t(e){e.exec(`
|
|
2
2
|
ALTER TABLE decision_calls ADD COLUMN features_json TEXT;
|
|
3
3
|
INSERT INTO schema_version (v) VALUES (3);
|
|
4
4
|
`)}function Ot(e){e.exec(`
|
|
@@ -111,4 +111,4 @@ import{a as rt,b as ot,c as st,d as x,e as A,f as v}from"./chunk-72SZI2UW.js";im
|
|
|
111
111
|
`)}if(!m)throw new Error(`local decision backend could not get a valid answer after ${f+1} attempt(s): ${w}`);let M={},L=!1;for(let[k,q]of Object.entries(s.questions)){let S=_(q,m[k],{normalize:e.normalizeProbabilities??!0});M[k]=S.answer,S.repaired&&(L=!0)}return{model:a,answers:M,usage:h,meta:{backend:"local",structureMode:c,answerMode:"probabilities",repaired:L,retries:f,stateTruncated:l.truncated,latencyMs:Date.now()-i}}}finally{b()}}}}async function Jt(e,t,r,n,o){if(!e.generateRaw)throw new Error(`provider "${e.name}" has no generateRaw(); use structureMode "text"`);let s=[{role:"user",content:r},...n?[{role:"user",content:n}]:[]],i=await e.generateRaw(s,J,[{name:F,description:"Report a probability distribution for every question.",input_schema:se(t)}],{...o,toolChoice:{type:"tool",name:F}}),a=i.content.find(c=>c.type==="tool_use"&&c.name===F),u=a&&a.type==="tool_use"?a.input:null;return{answers:Be(u),usage:{inputTokens:i.usage.input_tokens,outputTokens:i.usage.output_tokens}}}async function Gt(e,t,r,n,o){let s=[r,ae(t)].join(`
|
|
112
112
|
`),i=[{role:"system",content:J},{role:"user",content:s},...n?[{role:"user",content:n}]:[]],a=await e.generate(i,o);return{answers:Be(Te(a.content??"")),usage:{inputTokens:0,outputTokens:a.tokensUsed??0}}}function Be(e){if(e&&typeof e=="object"&&!Array.isArray(e)){let t=e;if(t.answers&&typeof t.answers=="object")return t.answers}return e}function Yt(e,t){return e!=="auto"?e:t.generateRaw&&me[t.name]?.structuredOutput?"tool":"text"}function Kt(e,t){let r=new AbortController,n=setTimeout(()=>r.abort(new Error(`decision timed out after ${t}ms`)),t),o=()=>r.abort(e?.reason);return e&&(e.aborted?o():e.addEventListener("abort",o,{once:!0})),{signal:r.signal,dispose:()=>{clearTimeout(n),e?.removeEventListener("abort",o)}}}var Xt,$t,Vt,Fe,zt,be=E(()=>{"use strict";Ze();Ue();ht();j();Y();v();z();Xt="claude-code",$t="claude-haiku-4-5-20251001",Vt=24e3,Fe=2e3,zt=3e4});import{readFileSync as Ht}from"fs";import{homedir as Wt}from"os";import{join as Zt}from"path";function N(e={}){let t=(e.baseUrl??en).replace(/\/+$/,""),r=e.path??"/classifier",n=e.name??"simple-jev",o=e.maxStateChars??nn,s=e.maxChoiceOptions??rn,i={probabilitySource:e.probabilitySource??"logits",calibratedProbabilities:!1,maxChoiceOptions:s,maxStateChars:o,parallelQuestions:!0,images:!1};return{name:n,capabilities:i,async decide(a){A(a.questions),cn(a.questions,s);let u=Date.now(),c=a.model??e.model;if(!c)throw new Error("simple-jev backend needs a model id");let l=G(a.state,o),p=e.fetchImpl??fetch,{signal:g,dispose:d}=un(a.abortSignal,a.timeoutMs??e.timeoutMs??tn);try{let b={"Content-Type":"application/json"},h=an(e.apiKeyEnv,e.apiKeyFile);h&&(b.Authorization=`Bearer ${h}`);let T=await qe(p(`${t}${r}`,{method:"POST",headers:b,body:JSON.stringify({model:c,state:l.text,questions:sn(a.questions)}),signal:g}),g);if(!T.ok){let k=await T.text().catch(()=>"");throw new Error(`${n} ${T.status}: ${k.slice(0,300)}`)}let f=await qe(T.json(),g),m=P(a.questions).safeParse(f.answers);if(!m.success)throw new Error(`${n} returned a response that does not match the requested questions (contract drift, not a model slip \u2014 retrying will not help):
|
|
113
113
|
${U(m.error)}`);let w=m.data,M={},L=!1;for(let[k,q]of Object.entries(a.questions)){let S=_(q,w[k]);M[k]=S.answer,S.repaired&&(L=!0)}return{model:f.model??c,answers:M,usage:{inputTokens:f.usage?.input_tokens??0,outputTokens:f.usage?.output_tokens??0},meta:{backend:n,structureMode:i.probabilitySource==="native"?"native":"logprobs",answerMode:"probabilities",repaired:L,retries:0,stateTruncated:l.truncated,latencyMs:Date.now()-u}}}finally{d()}}}}function sn(e){let t={};for(let[r,n]of Object.entries(e))t[r]=n.instructions?n:{...n,instructions:on[n.type]};return t}function an(e,t){let r=e?process.env[e]:void 0;if(r)return r;if(!t)return;let n=t.startsWith("~/")?Zt(Wt(),t.slice(2)):t;if(!Z.has(n))try{let o=Ht(n,"utf-8").trim();Z.set(n,o.length>0?o:null)}catch{Z.set(n,null)}return Z.get(n)??void 0}function cn(e,t){for(let[r,n]of Object.entries(e))if(n.type==="choice"){let o=Object.keys(n.criteria).length;if(o>t)throw new Error(`question "${r}": accepts at most ${t} choice options, got ${o}`)}else if(n.type==="score"&&n.criteria.length>t)throw new Error(`question "${r}": accepts at most ${t} score levels, got ${n.criteria.length}`)}function qe(e,t){return t.aborted?Promise.reject(t.reason??new Error("aborted")):new Promise((r,n)=>{let o=()=>n(t.reason??new Error("aborted"));t.addEventListener("abort",o,{once:!0}),e.then(s=>{t.removeEventListener("abort",o),r(s)},s=>{t.removeEventListener("abort",o),n(s)})})}function un(e,t){let r=new AbortController,n=setTimeout(()=>r.abort(new Error(`decision timed out after ${t}ms`)),t),o=()=>r.abort(e?.reason);return e&&(e.aborted?o():e.addEventListener("abort",o,{once:!0})),{signal:r.signal,dispose:()=>{clearTimeout(n),e?.removeEventListener("abort",o)}}}var en,tn,nn,rn,on,Z,fe=E(()=>{"use strict";j();v();z();Y();en="http://127.0.0.1:8000/v1",tn=3e4,nn=6e3,rn=50;on={choice:"Which option best fits?",score:"Which level best fits?",noul:"Is this true of the state?"};Z=new Map});var Xe={};We(Xe,{DEFAULT_SEAT_TIMEOUT_MS:()=>Ve,DecisionStore:()=>I,MAX_CHOICE_OPTIONS:()=>MAX_CHOICE_OPTIONS,SYSTEM_PROMPT:()=>J,TOOL_NAME:()=>F,UNCERTAINTY_HIGH:()=>Ce,UNCERTAINTY_LOW:()=>De,_resetDecisionBackendsForTesting:()=>wt,agreement:()=>it,answerView:()=>Q,applyRecalibrator:()=>ue,applyTemperature:()=>mt,askSeat:()=>yn,band:()=>Ie,bootstrapInterval:()=>ft,brier:()=>lt,buildDesign:()=>ve,calibrationReport:()=>gt,choice:()=>ot,compareCalibrators:()=>It,confidenceFor:()=>re,configureDecisions:()=>pn,configuredSeatTimeout:()=>dn,coverageCurve:()=>pt,createLocalDecisionBackend:()=>W,createMockDecisionBackend:()=>H,createSimpleJevBackend:()=>N,decisionsRuntime:()=>bn,describeIssues:()=>U,ece:()=>ct,expectedScore:()=>Ae,finalizeAnswer:()=>_,fitLogistic:()=>Ne,fitRecalibrator:()=>B,fitTemperature:()=>bt,getDecisionBackend:()=>D,getSeatMode:()=>Je,labelSeatCall:()=>fn,labelsOf:()=>x,listDecisionBackends:()=>Ee,logLoss:()=>dt,logit:()=>le,mce:()=>ut,measureConsistency:()=>Ut,normalizeDistribution:()=>Se,normalizedNegEntropy:()=>oe,noul:()=>rt,pMax:()=>xe,parseSeatMode:()=>ge,rawAnswerSchema:()=>Re,rawAnswersSchema:()=>P,recordSeatOutcome:()=>gn,registerBuiltinDecisionBackends:()=>ln,registerDecisionBackend:()=>R,reliabilityBins:()=>at,renderQuestions:()=>_e,renderShapeInstructions:()=>ae,renderState:()=>G,renderUserPrompt:()=>ie,resetDecisionsRuntime:()=>mn,score:()=>st,seatEnvVar:()=>ze,sigmoid:()=>de,toolInputSchema:()=>se,validateQuestions:()=>A,withUid:()=>Qe});function ln(e={},t={},r={},n={}){R("mock",()=>H()),R("local",()=>W(e)),R("simple-jev",()=>N(t)),R("jev",()=>N({name:"jev",baseUrl:"https://openrouter.ai/api/alpha",path:"/decisions",model:"jev-latest",apiKeyEnv:"OPENROUTER_API_KEY",apiKeyFile:"~/.agentx/openrouter-key.txt",probabilitySource:"native",maxChoiceOptions:255,maxStateChars:9e4,...r})),R("typesafe",()=>N({name:"typesafe",baseUrl:"https://api.typesafe.ai/v1",path:"/systemone",model:"jev-latest",apiKeyEnv:"TYPESAFE_API_KEY",apiKeyFile:"~/.agentx/typesafe-key.txt",probabilitySource:"native",maxChoiceOptions:255,maxStateChars:9e4,...n}))}var $e=E(()=>{"use strict";ke();v();j();z();C();Y();V();yt();Me();je();Ge();pe();be();fe();C();pe();be();fe()});function dn(e){return Ke(),y.seats[e]?.timeoutMs}function pn(e){y={...ye,...y,...e},ee=!0}function mn(){y={...ye,seats:{}},ee=!1}function Ke(){if(!ee){ee=!0;try{let{loadDaemonConfig:e}=(nt(),he(tt)),t=e()?.decisions;if(!t?.enabled)return;let{registerBuiltinDecisionBackends:r}=($e(),he(Xe)),n=t.backends??{};r(n.local,n.simpleJev,n.jev,n.typesafe);let o=null;try{o=new I({path:t.dbPath})}catch{}y={enabled:!0,defaultBackend:t.defaultBackend,store:o,seats:Object.fromEntries(Object.entries(t.seats??{}).map(([s,i])=>[s,{...i,redactState:t.redactState,keepStateRows:t.keepStateRows}]))}}catch{}}}function bn(){return y}function ge(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return hn.includes(t)?t:null}function ze(e){return`AGENTX_DECISION_SEAT_${e.toUpperCase().replace(/[^A-Z0-9]+/g,"_")}`}function Je(e,t=process.env){Ke();let r=ge(t[ze(e)]);return r||(y.enabled?ge(y.seats[e]?.mode)??"off":"off")}function fn(e,t,r,n={}){if(!(!e||!y.store))try{y.store.label(e,t,r,n)}catch{}}function gn(e,t,r=!1){if(!(!e||!y.store))try{y.store.recordOutcome(e,t,r)}catch{}}async function yn(e,t,r,n={}){let o=Je(e);if(o==="off")return null;let s=y.seats[e]??{mode:o},i=n.backend??s.backend??y.defaultBackend,a=Date.now();try{let c=await D(i).decide({state:t,questions:r,model:n.model??s.model,abortSignal:n.signal,timeoutMs:n.timeoutMs??s.timeoutMs??(y.seats[e]?Ve:void 0)}),l=wn(e,o,t,r,c,n,s);return{answers:c.answers,callId:l,mode:o}}catch(u){return Tn(e,o,t,r,i,n,s,a,u),En(e,i,u),null}}function wn(e,t,r,n,o,s,i){if(!y.store)return null;try{return y.store.recordCall({seat:e,mode:t,backend:o.meta.backend,model:o.model,meta:o.meta,state:r,questions:n,answers:o.answers,usage:o.usage,incumbent:He(s.incumbent),links:s.links,features:s.features,keepState:!i.redactState})}catch{return null}}function Tn(e,t,r,n,o,s,i,a,u){if(y.store)try{y.store.recordCall({seat:e,mode:t,backend:o,model:s.model??i.model??"unknown",meta:{structureMode:"text",answerMode:"probabilities",retries:0,stateTruncated:!1,latencyMs:Date.now()-a},state:r,questions:n,answers:{},incumbent:He(s.incumbent),links:s.links,features:s.features,error:String(u?.message??u).slice(0,500),keepState:!i.redactState})}catch{}}function He(e){if(!e)return;let t={};for(let[r,n]of Object.entries(e))n!==void 0&&(t[r]={value:n});return t}function En(e,t,r){let n=Date.now();n-Ye<6e4||(Ye=n,console.warn(`[decisions] seat "${e}" on backend "${t}" failed: ${r?.message??r}`))}var Ve,ye,y,ee,hn,Ye,Ge=E(()=>{C();V();Ve=1e4;ye={enabled:!1,defaultBackend:"local",seats:{},store:null},y={...ye},ee=!1;hn=["off","shadow","active"];Ye=0});export{D as a,Ee as b,C as c,I as d,V as e,It as f,Me as g,Ut as h,je as i,me as j,Xn as k,Ue as l,ln as m,$e as n,Ve as o,dn as p,pn as q,mn as r,bn as s,ge as t,ze as u,Je as v,fn as w,gn as x,yn as y,Ge as z};
|
|
114
|
-
//# sourceMappingURL=chunk-
|
|
114
|
+
//# sourceMappingURL=chunk-Y6KR7NXL.js.map
|
package/dist/cli.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{b as o}from"./chunk-OSH2PEBH.js";import"./chunk-QIJLFPWE.js";var e=o(process.versions.node);e&&(console.error(e),process.exit(1));var{buildProgram:s}=await import("./program-
|
|
2
|
+
import{b as o}from"./chunk-OSH2PEBH.js";import"./chunk-QIJLFPWE.js";var e=o(process.versions.node);e&&(console.error(e),process.exit(1));var{buildProgram:s}=await import("./program-BRFPOZLO.js"),{installCliSignalExit:r}=await import("./signal-exit-C5EUGHKI.js"),{applyConnectAttemptTimeout:i,configPathFromArgv:a,readConnectAttemptTimeout:n}=await import("./net-family-X2P3OVDP.js");r();i(n(process.cwd(),a(process.argv.slice(2))));var t=await s();process.argv.slice(2).length===0?t.outputHelp():t.parse();
|
|
3
3
|
//# sourceMappingURL=cli.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=client-
|
|
1
|
+
import{a,b,c,d,e,f,g}from"./chunk-U476QMLK.js";import"./chunk-VOVDWFFP.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";export{b as fetchAgents,d as fetchCrons,c as fetchProcesses,e as killProcess,a as resolveConn,f as sendTask,g as streamTask};
|
|
2
|
+
//# sourceMappingURL=client-W7VFEYQ3.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$b as
|
|
2
|
-
//# sourceMappingURL=config-
|
|
1
|
+
import{$b as e,Ac as F,Cc as G,Xb as a,Yb as b,Zb as c,_b as d,ac as f,bc as g,cc as h,dc as i,ec as j,fc as k,gc as l,hc as m,ic as n,jc as o,kc as p,lc as q,mc as r,nc as s,oc as t,pc as u,qc as v,rc as w,sc as x,tc as y,uc as z,vc as A,wc as B,xc as C,yc as D,zc as E}from"./chunk-VOVDWFFP.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";G();export{a as INTEGRATION_KINDS,B as WIKI_CONTRIBUTE_JOB,C as WIKI_CONTRIBUTE_MERGE_JOB,E as WIKI_SUMMARIZE_JOB,s as approvalsConfigSchema,g as callsSchema,e as cameraBotSchema,z as crossFieldProblems,v as daemonConfigSchema,c as emailAccountSchema,b as eventSubscriptionSchema,w as expandEnvVars,r as improveConfigSchema,f as isCronExpression,y as literalSecretProblems,x as loadDaemonConfig,d as mailSenderSchema,o as membersConfigSchema,j as mergePolicyConfigSchema,t as numbersConfigSchema,n as peopleConfigSchema,m as personSchema,q as qualityReportConfigSchema,p as requestStatusConfigSchema,l as requestsConfigSchema,h as reviewGateConfigSchema,i as trackersConfigSchema,A as validateWorkspaces,u as wallConfigSchema,k as watchersConfigSchema,D as withContributionJobs,F as withSummariesJob};
|
|
2
|
+
//# sourceMappingURL=config-ZVRI3GFZ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=config-mutate-
|
|
1
|
+
import{a,b}from"./chunk-4UJDRI7W.js";import"./chunk-VOVDWFFP.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";export{a as mutateAgentxConfig,b as writeAgentxConfig};
|
|
2
|
+
//# sourceMappingURL=config-mutate-OM4MI56W.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c,d,e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=config-mutator-
|
|
1
|
+
import{a,b,c,d,e}from"./chunk-5BT4VPJC.js";import"./chunk-VOVDWFFP.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";export{b as applyConfigMutation,a as findConfigPath,d as getAtPath,c as setAtPath,e as unsetAtPath};
|
|
2
|
+
//# sourceMappingURL=config-mutator-RK3UQORI.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as ee}from"./chunk-
|
|
1
|
+
import{a as ee}from"./chunk-WQTPSXVB.js";import"./chunk-AZCGU5XU.js";import{f as Q,k as V}from"./chunk-IH65GDJR.js";import"./chunk-6EJJKOMW.js";import"./chunk-JTFCU5LH.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import{b as O}from"./chunk-5ONH4ITT.js";import"./chunk-JRAG37V5.js";import"./chunk-ILEC3IAV.js";import"./chunk-BERWTVG2.js";import"./chunk-A7JSRDJL.js";import"./chunk-5QXRGX2F.js";import"./chunk-WPNRDEHW.js";import"./chunk-OWNQ2FD4.js";import{b as N,c as H}from"./chunk-AHWWJ7AF.js";import{b as X}from"./chunk-KEXBEUSU.js";import"./chunk-Y6KR7NXL.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-QUFIUXMQ.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-VOVDWFFP.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";import{createHash as le}from"crypto";import{existsSync as z,mkdirSync as ne,readdirSync as re,readFileSync as ge,renameSync as se,writeFileSync as pe}from"fs";import{resolve as w}from"path";var _={maxPatches:30,maxCostUsd:.5,maxItems:60},he=12,fe=2e3,me=1500,M=8,U=300,be=12,B="## Checked facts";function S(n){return w(n,"_contributions")}function E(n,r){if(!z(n))return r;try{return JSON.parse(ge(n,"utf-8"))}catch(t){throw new Error(`${n} is not valid JSON: ${t.message}`)}}function L(n,r){ne(w(n,".."),{recursive:!0});let t=`${n}.${process.pid}.tmp`;pe(t,`${JSON.stringify(r,null,2)}
|
|
2
2
|
`),se(t,n)}function ie(n){return{agents:E(w(S(n),"state.json"),{agents:{}}).agents??{}}}function ye(n){let r=w(S(n),"pending");return z(r)?re(r).filter(t=>t.endsWith(".json")).sort().map(t=>E(w(r,t),null)).filter(t=>!!t):[]}function G(n){return w(S(n),"held.json")}function K(n,r={}){let t=E(G(n),[]);return r.all?t:t.filter(a=>a.status==="held")}function _e(n){let r=w(S(n),"reports");if(!z(r))return null;let t=re(r).filter(a=>a.endsWith(".json")).sort().pop();return t?E(w(r,t),null):null}function ke(n,r,t,a={}){let o=ie(r).agents[t],c=a.now??Date.now(),e=a.since??o?.lastRunAt??new Date(c-864e5).toISOString(),d=e.slice(0,10),u=new Set(o?.processed??[]),s=[];for(let g of n.getAgentEntries(t))g.date<d||u.has(g.id)||s.push({id:g.id,at:g.date,kind:"chat",title:[g.source,g.sourceContext].filter(Boolean).join(" \xB7 "),text:g.content});if(a.db){let g=Date.parse(e);for(let l of V(a.db,{agentId:t,since:Number.isFinite(g)?g:void 0,limit:500})){if(l.status==="in-flight"||u.has(l.taskId))continue;let k=(Q(a.db,l.taskId)?.steps??[]).filter(b=>b.name==="tool_use"||b.action).slice(0,be).map(b=>`- ${b.action??b.name}${b.inputSummary?` ${x(b.inputSummary,160)}`:""}${b.outputSummary?` \u2192 ${x(b.outputSummary,240)}`:""}${b.error?` \u2717 ${x(b.error,120)}`:""}`),y=[`Request: ${x(l.originalMessage??l.messagePreview??"",600)}`,k.length?`Tool calls:
|
|
3
3
|
${k.join(`
|
|
4
4
|
`)}`:"",l.finalResponse?`Reply: ${x(l.finalResponse,800)}`:""].filter(Boolean).join(`
|
|
@@ -54,4 +54,4 @@ _Sources: ${t.sources.join("; ")}._`,a);return n.writeArticle(r,{title:t.title,.
|
|
|
54
54
|
`).replace(/\n{3,}/g,`
|
|
55
55
|
|
|
56
56
|
`).trim(),superseded:d}}function Ce(n){let r=n.previous?` (previously: ${n.previous})`:"";return`- **${n.attribute}:** ${n.value} \u2014 ${n.source}; checked ${n.checkedAt.slice(0,10)} by ${n.by}${r}`}function Re(n){let r=n.match(/^- \*\*.+?:\*\* (.*?) — .*?; checked (\S+) by \S+(?: \(previously: (.*)\))?$/);return r?{value:r[1],checkedAt:r[2],...r[3]?{previous:r[3]}:{}}:void 0}function J(n,r){return`contribution:${n}@${r.slice(0,10)}`}var Te={person:"people",project:"projects",place:"places",concept:"concepts",event:"events",decision:"decisions",pattern:"patterns"};function de(n,r,t){let a=r.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,"").slice(0,60)||"page",o=t?Te[t]:"contributions",c=`${o}/${a}.md`;for(let e=2;n.readArticle(c);e++)c=`${o}/${a}-${e}.md`;return c}export{_ as DEFAULT_CONTRIBUTION_LIMITS,B as FACTS_HEADING,ue as applyFactLines,De as approveHeld,xe as buildContributionPrompt,S as contributionsDir,_e as latestReport,K as listHeld,ye as listPendingBatches,Be as mergeContributions,W as pageKey,Ae as parseContributionPatches,ke as pendingWork,Se as possibleDuplicate,Fe as rejectHeld,ce as replaceOnce,Me as runContribution};
|
|
57
|
-
//# sourceMappingURL=contributions-
|
|
57
|
+
//# sourceMappingURL=contributions-3WW5AJ5A.js.map
|
|
@@ -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}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=doctor-
|
|
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}from"./chunk-PSUOF7O5.js";import"./chunk-WMZ4TGMR.js";import"./chunk-2YDG5CSS.js";import"./chunk-5CUOKXOD.js";import"./chunk-IMLAPB7G.js";import"./chunk-QPABR72X.js";import"./chunk-KP7KDLZ2.js";import"./chunk-BXK5S2KK.js";import"./chunk-4NZ4T3TQ.js";import"./chunk-LY4G7PCW.js";import"./chunk-7IW25T4K.js";import"./chunk-Q3A5P373.js";import"./chunk-JLBRNYKY.js";import"./chunk-BYEL7KKR.js";import"./chunk-QUFIUXMQ.js";import"./chunk-OSH2PEBH.js";import"./chunk-7I7IEX4S.js";import"./chunk-VOVDWFFP.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";export{j as daemonVoiceCheck,b as doctor,i as mcpHeaderEnvChecks,g as meshPeerTokenChecks,h as meshTokenChecksFromConfig,a as runDoctorChecks,e as runMirrorChecks,d as runNativeChecks,c as runNotificationChecks,f as runReminderChecks};
|
|
2
|
+
//# sourceMappingURL=doctor-PLN3QJE4.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{d as h}from"./chunk-
|
|
1
|
+
import{d as h}from"./chunk-CIW37UJT.js";import{b as I}from"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-AEFO6ES5.js";import"./chunk-NW7B53KD.js";import"./chunk-5BT4VPJC.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-VOVDWFFP.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";var p=t=>typeof t=="string"?t.trim():"";function $(t){return[`Run ${t.runId} "${t.title}" [${t.status}] on step ${t.step}: waiting on ${t.waitingOn}.`,t.tags?.length?`Tags: ${t.tags.join(", ")}`:"",...(t.steps??[]).slice(-8).map(s=>`- ${String(s.at).slice(0,16).replace("T"," ")} ${s.step} ${s.status}${s.note?`: ${s.note}`:""}`)].filter(Boolean).join(`
|
|
2
2
|
`)}async function T(t,c){let s=c.fetch??fetch,m=c.daemonUrl.replace(/\/$/,""),r=(p(t.action)||"list").toLowerCase(),f=c.env??process.env,w=async i=>{let l=await s(`${m}${i}`,{signal:AbortSignal.timeout(1e4)}),n=await l.json().catch(()=>({}));return{ok:l.ok,status:l.status,data:n}};try{if(r==="list"){let e=await w("/follow-up");if(!e.ok)return`Error: ${e.data?.error||`HTTP ${e.status}`}`;let o=e.data.groups??[];return o.length?o.map(d=>[`${d.tag}:`,...d.rows.map(a=>`- ${a.runId} "${a.title}" on ${a.step}: waiting on ${a.waitingOn} (since ${String(a.since).slice(0,16).replace("T"," ")} UTC)`)].join(`
|
|
3
3
|
`)).join(`
|
|
4
4
|
`):"No follow-up workflows are running."}if(r==="match"){let e=p(t.request)||p(t.title);if(!e)return"Error: match needs `request`: the owner's request in their words.";let o=h(t,f),d=await w(`/follow-up/match?q=${encodeURIComponent(e)}${o?`&agentId=${encodeURIComponent(o.agentId)}`:""}`);if(!d.ok)return`Error: ${d.data?.error||`HTTP ${d.status}`}`;let a=d.data.matches??[];return a.length?["Saved workflows, best fit first (confidence 0-1):",...a.map(u=>`- ${u.workflowId} "${u.title}" (${u.confidence}${u.autoStart?", starts without asking":""}): ${u.steps.map(k=>k.id).join(" \u2192 ")}`),'Start one with {action:"start", workflowId:"<id>", title:"\u2026", tags:["client:<name>"]}. Run its steps through the workflow, not by hand.'].join(`
|
|
5
5
|
`):"No saved workflow fits. If the request has several steps, build one: start with title and steps."}if(r==="status"){let e=p(t.runId);if(!e)return"Error: status needs runId.";let o=await w(`/follow-up/${encodeURIComponent(e)}`);return o.ok?$(o.data.run):`Error: ${o.data?.error||`HTTP ${o.status}`}`}let i=h(t,f);if(!i)return"Error: couldn't tell which agent you are. Pass callerAgentId.";let l=await s(`${m}/follow-up`,{method:"POST",headers:{"Content-Type":"application/json",...I(f)},body:JSON.stringify({action:r,agentId:i.agentId,workflowId:t.workflowId,title:t.title,description:t.description,tags:t.tags,inputs:t.inputs,steps:t.steps,edges:t.edges,approval:t.approval,autoStart:t.autoStart,requestId:t.requestId,runId:t.runId,step:t.step,evidence:t.evidence,note:t.note,reason:t.reason,fromRun:t.fromRun,status:t.status}),signal:AbortSignal.timeout(2e4)}),n=await l.json().catch(()=>({}));if(!l.ok)return`Error: ${n?.error||`HTTP ${l.status}`}`;if(r==="start"){let e=n.run;return[`Started run ${e.runId} "${e.title}"${n.built?" (built from the steps you gave; propose it with fromRun to keep it)":""}.`,n.awaitingApproval?"It waits for the owner's approval before the first step.":`It is on step ${e.step}: ${e.waitingOn}.`,"AgentX follows it from here: it starts each step, reminds whoever is slow, and tells the owner when it ends. Do not run its steps by hand.",...n.warning?[`Note: ${n.warning}`]:[]].join(" ")}return r==="plan"?[`Plan recorded on run ${n.run?.runId??t.runId}:`,...(n.plan??[]).map(e=>`- ${e.id} ${e.title}`),'Report each step with {action:"step", runId, step:"<id>", status:"started"|"done"|"failed"}.'].join(`
|
|
6
6
|
`):r==="step"?`Step recorded. ${n.run?$(n.run):""}`.trim():r==="done"?`Step recorded as done. ${n.run?$(n.run):""}`.trim():r==="blocked"?"The step is marked blocked and the owner is told. Nothing more happens on it until it is sorted.":`Saved ${n.workflowId} switched off, and asked the owner (card ${n.cardId}) whether to keep it as a reusable workflow.`}catch(i){return`Error: couldn't reach the daemon (${i?.message??i}).`}}export{T as runWorkflowTool};
|
|
7
|
-
//# sourceMappingURL=follow-up-tool-
|
|
7
|
+
//# sourceMappingURL=follow-up-tool-LS4OUMLZ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=hub-
|
|
1
|
+
import{a,b}from"./chunk-JMRFYGET.js";import"./chunk-ABMDDRZL.js";import"./chunk-5QXRGX2F.js";import"./chunk-WPNRDEHW.js";import"./chunk-OWNQ2FD4.js";import"./chunk-AHWWJ7AF.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-Y6KR7NXL.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-VOVDWFFP.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as WikiHub,a as existingWikiDir};
|
|
2
|
+
//# sourceMappingURL=hub-J43NXLW3.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -7336,6 +7336,19 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
7336
7336
|
/** A run still waiting after this many minutes is refused in plain
|
|
7337
7337
|
* words; 0 = wait as long as it takes. */
|
|
7338
7338
|
maxWaitMinutes: z.ZodDefault<z.ZodNumber>;
|
|
7339
|
+
/** One written line, on the thread, to a person whose chat message has
|
|
7340
|
+
* waited afterSeconds in this queue; 0 = off. Only these channels.
|
|
7341
|
+
* The text has no numbers, host names or client detail. */
|
|
7342
|
+
waitNotice: z.ZodDefault<z.ZodObject<{
|
|
7343
|
+
afterSeconds: z.ZodDefault<z.ZodNumber>;
|
|
7344
|
+
channels: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
7345
|
+
}, "strip", z.ZodTypeAny, {
|
|
7346
|
+
channels: string[];
|
|
7347
|
+
afterSeconds: number;
|
|
7348
|
+
}, {
|
|
7349
|
+
channels?: string[] | undefined;
|
|
7350
|
+
afterSeconds?: number | undefined;
|
|
7351
|
+
}>>;
|
|
7339
7352
|
/** Seconds between resource re-reads while work waits. */
|
|
7340
7353
|
sampleSeconds: z.ZodDefault<z.ZodNumber>;
|
|
7341
7354
|
/** Named caps, e.g. { "browser": { "max": 1, "agents": ["web-tester"] } }. */
|
|
@@ -7417,6 +7430,10 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
7417
7430
|
intervalSeconds: number;
|
|
7418
7431
|
};
|
|
7419
7432
|
allowOneWhenIdle: boolean;
|
|
7433
|
+
waitNotice: {
|
|
7434
|
+
channels: string[];
|
|
7435
|
+
afterSeconds: number;
|
|
7436
|
+
};
|
|
7420
7437
|
sampleSeconds: number;
|
|
7421
7438
|
classes: Record<string, {
|
|
7422
7439
|
max: number;
|
|
@@ -7455,6 +7472,10 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
7455
7472
|
intervalSeconds?: number | undefined;
|
|
7456
7473
|
} | undefined;
|
|
7457
7474
|
allowOneWhenIdle?: boolean | undefined;
|
|
7475
|
+
waitNotice?: {
|
|
7476
|
+
channels?: string[] | undefined;
|
|
7477
|
+
afterSeconds?: number | undefined;
|
|
7478
|
+
} | undefined;
|
|
7458
7479
|
sampleSeconds?: number | undefined;
|
|
7459
7480
|
classes?: Record<string, {
|
|
7460
7481
|
max: number;
|
|
@@ -7669,6 +7690,28 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
7669
7690
|
perCheck?: number | undefined;
|
|
7670
7691
|
maxAgeHours?: number | undefined;
|
|
7671
7692
|
}>>;
|
|
7693
|
+
/** Proof per deliverable before a close by check (src/requests/close-proof.ts),
|
|
7694
|
+
* retro:01M70Z38BBZYRBBCZW2T1S3T3K. When the mode is not "off", the
|
|
7695
|
+
* words of open requests that can close on their own (a checker or an
|
|
7696
|
+
* issue home) go to the model of `ownerCheck` once, before any close,
|
|
7697
|
+
* to list what they ask for. A close by check then needs one proof
|
|
7698
|
+
* link per item: "warn" closes and records one signal, "block" keeps
|
|
7699
|
+
* it open and tells the agent once. Off by default. */
|
|
7700
|
+
closeProof: z.ZodDefault<z.ZodObject<{
|
|
7701
|
+
mode: z.ZodDefault<z.ZodEnum<["off", "warn", "block"]>>;
|
|
7702
|
+
/** Requests whose words are read per requests check (once a minute). */
|
|
7703
|
+
perCheck: z.ZodDefault<z.ZodNumber>;
|
|
7704
|
+
/** Agents told per requests check which items need a link. */
|
|
7705
|
+
askPerCheck: z.ZodDefault<z.ZodNumber>;
|
|
7706
|
+
}, "strip", z.ZodTypeAny, {
|
|
7707
|
+
mode: "warn" | "block" | "off";
|
|
7708
|
+
perCheck: number;
|
|
7709
|
+
askPerCheck: number;
|
|
7710
|
+
}, {
|
|
7711
|
+
mode?: "warn" | "block" | "off" | undefined;
|
|
7712
|
+
perCheck?: number | undefined;
|
|
7713
|
+
askPerCheck?: number | undefined;
|
|
7714
|
+
}>>;
|
|
7672
7715
|
/** Closed requests are deleted after this many days. Open ones never are. */
|
|
7673
7716
|
retentionDays: z.ZodDefault<z.ZodNumber>;
|
|
7674
7717
|
/** Resend once (src/requests/resend.ts, #1542): a request that needs
|
|
@@ -8076,6 +8119,11 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
8076
8119
|
days: number;
|
|
8077
8120
|
timeZone: string;
|
|
8078
8121
|
};
|
|
8122
|
+
closeProof: {
|
|
8123
|
+
mode: "warn" | "block" | "off";
|
|
8124
|
+
perCheck: number;
|
|
8125
|
+
askPerCheck: number;
|
|
8126
|
+
};
|
|
8079
8127
|
sprints: {
|
|
8080
8128
|
enabled: boolean;
|
|
8081
8129
|
idleMinutes: number;
|
|
@@ -8177,6 +8225,11 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
8177
8225
|
days?: number | undefined;
|
|
8178
8226
|
timeZone?: string | undefined;
|
|
8179
8227
|
} | undefined;
|
|
8228
|
+
closeProof?: {
|
|
8229
|
+
mode?: "warn" | "block" | "off" | undefined;
|
|
8230
|
+
perCheck?: number | undefined;
|
|
8231
|
+
askPerCheck?: number | undefined;
|
|
8232
|
+
} | undefined;
|
|
8180
8233
|
sprints?: {
|
|
8181
8234
|
enabled?: boolean | undefined;
|
|
8182
8235
|
idleMinutes?: number | undefined;
|
|
@@ -11795,6 +11848,11 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
11795
11848
|
days: number;
|
|
11796
11849
|
timeZone: string;
|
|
11797
11850
|
};
|
|
11851
|
+
closeProof: {
|
|
11852
|
+
mode: "warn" | "block" | "off";
|
|
11853
|
+
perCheck: number;
|
|
11854
|
+
askPerCheck: number;
|
|
11855
|
+
};
|
|
11798
11856
|
sprints: {
|
|
11799
11857
|
enabled: boolean;
|
|
11800
11858
|
idleMinutes: number;
|
|
@@ -12588,6 +12646,10 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
12588
12646
|
intervalSeconds: number;
|
|
12589
12647
|
};
|
|
12590
12648
|
allowOneWhenIdle: boolean;
|
|
12649
|
+
waitNotice: {
|
|
12650
|
+
channels: string[];
|
|
12651
|
+
afterSeconds: number;
|
|
12652
|
+
};
|
|
12591
12653
|
sampleSeconds: number;
|
|
12592
12654
|
classes: Record<string, {
|
|
12593
12655
|
max: number;
|
|
@@ -13234,6 +13296,11 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
13234
13296
|
days?: number | undefined;
|
|
13235
13297
|
timeZone?: string | undefined;
|
|
13236
13298
|
} | undefined;
|
|
13299
|
+
closeProof?: {
|
|
13300
|
+
mode?: "warn" | "block" | "off" | undefined;
|
|
13301
|
+
perCheck?: number | undefined;
|
|
13302
|
+
askPerCheck?: number | undefined;
|
|
13303
|
+
} | undefined;
|
|
13237
13304
|
sprints?: {
|
|
13238
13305
|
enabled?: boolean | undefined;
|
|
13239
13306
|
idleMinutes?: number | undefined;
|
|
@@ -14109,6 +14176,10 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
14109
14176
|
intervalSeconds?: number | undefined;
|
|
14110
14177
|
} | undefined;
|
|
14111
14178
|
allowOneWhenIdle?: boolean | undefined;
|
|
14179
|
+
waitNotice?: {
|
|
14180
|
+
channels?: string[] | undefined;
|
|
14181
|
+
afterSeconds?: number | undefined;
|
|
14182
|
+
} | undefined;
|
|
14112
14183
|
sampleSeconds?: number | undefined;
|
|
14113
14184
|
classes?: Record<string, {
|
|
14114
14185
|
max: number;
|
|
@@ -15429,6 +15500,12 @@ declare class AgentXDaemon {
|
|
|
15429
15500
|
private requestCheckContext;
|
|
15430
15501
|
private headlines?;
|
|
15431
15502
|
private ownerCheck?;
|
|
15503
|
+
private deliverables?;
|
|
15504
|
+
/** Proof per deliverable (src/requests/close-proof.ts, #692): a tracked
|
|
15505
|
+
* plan's steps are the list; otherwise one small call reads it from the
|
|
15506
|
+
* owner's words, through the provider and model of `ownerCheck`. */
|
|
15507
|
+
private closeProofDeps;
|
|
15508
|
+
private deliverablesReader;
|
|
15432
15509
|
/** Reads closes not made by the owner against the owner's words
|
|
15433
15510
|
* (src/requests/owner-check.ts): one small call each, through the
|
|
15434
15511
|
* provider the operator set up, settings read at each call. */
|
|
@@ -15961,7 +16038,10 @@ interface FriendlyError {
|
|
|
15961
16038
|
| "dispatch_hold"
|
|
15962
16039
|
/** Every slot of the agent stayed busy for the whole slot wait; the
|
|
15963
16040
|
* message did not run. An event wake retries it (#1596). */
|
|
15964
|
-
| "agent_busy"
|
|
16041
|
+
| "agent_busy"
|
|
16042
|
+
/** The node had no room to start the run for admission.maxWaitMinutes;
|
|
16043
|
+
* the run was refused and is not queued. */
|
|
16044
|
+
| "no_room" | "auth" | "permission" | "rate_limit" | "overloaded" | "context_too_large" | "invalid_request" | "upstream_api" | "timeout" | "cancelled" | "interrupted"
|
|
15965
16045
|
/** Ended by a stop signal; its resume plan is saved (#857). */
|
|
15966
16046
|
| "stopped" | "unknown";
|
|
15967
16047
|
/** Whether this error is transient — a retry has a reasonable chance of succeeding. */
|
|
@@ -16259,6 +16339,13 @@ interface AgentTask {
|
|
|
16259
16339
|
/** Called with `runningTaskId` as soon as the run starts. Never fires for
|
|
16260
16340
|
* a message that was queued or dropped instead of run. */
|
|
16261
16341
|
onStart?: (runningTaskId: string) => void;
|
|
16342
|
+
/** Called at most once when the run has waited in the admission queue
|
|
16343
|
+
* for admission.waitNotice.afterSeconds, with the queue's reasons.
|
|
16344
|
+
* Never awaited. Set by the router for chat messages. */
|
|
16345
|
+
onHeld?: (w: {
|
|
16346
|
+
waitedMs: number;
|
|
16347
|
+
blockedBy: string[];
|
|
16348
|
+
}) => void;
|
|
16262
16349
|
/** Aborted when the HTTP caller waiting on this run has gone (timeout,
|
|
16263
16350
|
* disconnect). A run still waiting for a busy agent's slot is then
|
|
16264
16351
|
* dropped instead of started: nobody is left to read its answer, and a
|
|
@@ -16409,6 +16496,8 @@ interface AgentResponse {
|
|
|
16409
16496
|
* full FriendlyError taxonomy is in error-map.ts; common ones to
|
|
16410
16497
|
* branch on: `out_of_credits`, `rate_limit`, `auth`, `timeout`. */
|
|
16411
16498
|
errorKind?: FriendlyError["kind"];
|
|
16499
|
+
/** dispatch_hold only: when a cold dispatch can go again (ms), when known. */
|
|
16500
|
+
retryAt?: number;
|
|
16412
16501
|
tokensUsed?: number;
|
|
16413
16502
|
duration?: number;
|
|
16414
16503
|
claudeSessionId?: string;
|
|
@@ -19767,6 +19856,14 @@ interface AdmissionSettings {
|
|
|
19767
19856
|
allowOneWhenIdle: boolean;
|
|
19768
19857
|
/** A run still waiting after this long is refused in plain words; 0 = never. */
|
|
19769
19858
|
maxWaitMinutes: number;
|
|
19859
|
+
/** One written line to the person whose chat message has waited this
|
|
19860
|
+
* long (admission/wait-notice.ts). afterSeconds 0 = off; only the
|
|
19861
|
+
* listed channels get it. Separate from any later "join the waiting
|
|
19862
|
+
* run" setting, so either can be off alone. */
|
|
19863
|
+
waitNotice?: {
|
|
19864
|
+
afterSeconds: number;
|
|
19865
|
+
channels: string[];
|
|
19866
|
+
};
|
|
19770
19867
|
/** Seconds between resource re-reads while work is waiting. */
|
|
19771
19868
|
sampleSeconds: number;
|
|
19772
19869
|
classes: Record<string, AdmissionClass>;
|
|
@@ -19817,6 +19914,17 @@ interface AdmissionRequest {
|
|
|
19817
19914
|
/** On close, leave this run unanswered (a chat message the router
|
|
19818
19915
|
* replays on boot) instead of answering "closed". */
|
|
19819
19916
|
keepOnClose?: boolean;
|
|
19917
|
+
/** Called once when the run has been held this long. Never awaited and
|
|
19918
|
+
* never retried: a slow or failing caller cannot hold up the queue.
|
|
19919
|
+
* No timer of its own: the re-check every sampleSeconds while work
|
|
19920
|
+
* waits is what sees the time pass. */
|
|
19921
|
+
longWait?: {
|
|
19922
|
+
afterMs: number;
|
|
19923
|
+
notify: (w: {
|
|
19924
|
+
waitedMs: number;
|
|
19925
|
+
blockedBy: string[];
|
|
19926
|
+
}) => void;
|
|
19927
|
+
};
|
|
19820
19928
|
signal?: AbortSignal;
|
|
19821
19929
|
}
|
|
19822
19930
|
interface AdmissionTicket {
|
|
@@ -19882,6 +19990,9 @@ declare class AdmissionQueue {
|
|
|
19882
19990
|
/** Starts every waiting run that may start now, in queue order. */
|
|
19883
19991
|
pump(): Promise<void>;
|
|
19884
19992
|
private pass;
|
|
19993
|
+
/** Tells the caller once that its run has waited long (longWait). The
|
|
19994
|
+
* mark is set before the call, so a throwing caller is not called again. */
|
|
19995
|
+
private noticeLongWait;
|
|
19885
19996
|
/** One round of closing idle sessions, when memory or swap holds a run. */
|
|
19886
19997
|
private closeIdleRound;
|
|
19887
19998
|
private admitEntry;
|
|
@@ -21960,6 +22071,14 @@ declare class MessageRouter {
|
|
|
21960
22071
|
private dedupSaveTimer?;
|
|
21961
22072
|
/** Crash-safe inflight log (see InflightLog class above). */
|
|
21962
22073
|
private inflight;
|
|
22074
|
+
/** Message id -> when its wait line went out (admission.waitNotice).
|
|
22075
|
+
* Filled from the inflight log on replay, so a restart does not post
|
|
22076
|
+
* a second line for the same message. Dropped when the run starts. */
|
|
22077
|
+
private waitNoticed;
|
|
22078
|
+
/** `channel:chatId` -> when the plan-limit line on that thread stops
|
|
22079
|
+
* counting (its retry time). Cleared by that time passing or by a run
|
|
22080
|
+
* on the thread answering. Memory only: a restart may post it again. */
|
|
22081
|
+
private planHoldNotified;
|
|
21963
22082
|
/** In-flight mesh forwards (this node is awaiting a peer's response).
|
|
21964
22083
|
* Counted so the daemon's shutdown drain can wait for these in addition
|
|
21965
22084
|
* to local agent tasks — otherwise a peer restart mid-forward kills the
|
|
@@ -22122,6 +22241,17 @@ declare class MessageRouter {
|
|
|
22122
22241
|
* fresh outage notifies again but a burst inside one outage does not.
|
|
22123
22242
|
*/
|
|
22124
22243
|
private meshFailureNotified;
|
|
22244
|
+
/** Channels whose chat messages get the wait line (admission.waitNotice). */
|
|
22245
|
+
private waitNoticeOn;
|
|
22246
|
+
/** Posts the one wait line for a message held in the node queue. Never
|
|
22247
|
+
* retried: a failed post is logged once and the run is untouched. On
|
|
22248
|
+
* GitLab the line is a top-level note (send ignores replyTo), visible
|
|
22249
|
+
* to everyone on the project, so its text has no numbers or names. */
|
|
22250
|
+
private postWaitNotice;
|
|
22251
|
+
/** True when the plan-limit line may be posted on this thread now, and
|
|
22252
|
+
* marks it. The mark lasts until the retry time it named (an hour when
|
|
22253
|
+
* unknown), or until a run on the thread answers. */
|
|
22254
|
+
private takePlanHoldMark;
|
|
22125
22255
|
/**
|
|
22126
22256
|
* A mesh-routed task failed. React ❌ (as the agent, where the channel
|
|
22127
22257
|
* supports identity) and — the FIRST time this thread fails — post one
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Oa as Tt,Pa as Mt,a as St,b as kt,c as vt,d as xt,e as $t,f as Ct,g as Pt,h as bt}from"./chunk-
|
|
1
|
+
import{Oa as Tt,Pa as Mt,a as St,b as kt,c as vt,d as xt,e as $t,f as Ct,g as Pt,h as bt}from"./chunk-3XS7M5LM.js";import"./chunk-E3SA7KIZ.js";import"./chunk-GTJIKXDB.js";import"./chunk-NCMPJPXG.js";import"./chunk-5CUOKXOD.js";import"./chunk-IMLAPB7G.js";import"./chunk-ZVP6GB4G.js";import"./chunk-SYIDD7CI.js";import"./chunk-PPUN7YHA.js";import"./chunk-VZLIBDLH.js";import"./chunk-EKJG63EJ.js";import"./chunk-GO4J44UD.js";import"./chunk-3Q6MRG3P.js";import"./chunk-2VDO2HEK.js";import"./chunk-JWDJMFU6.js";import"./chunk-2P5NP4H6.js";import"./chunk-B4KQC3DG.js";import"./chunk-LQE73AZR.js";import"./chunk-2D3RYIDU.js";import"./chunk-4UJDRI7W.js";import"./chunk-MRIVENBY.js";import"./chunk-A5GYG56I.js";import"./chunk-XC3466Z4.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-UKUH662W.js";import"./chunk-RX5O5637.js";import"./chunk-5ELIX7BQ.js";import"./chunk-X7UQY7CH.js";import"./chunk-D5LIMOI6.js";import"./chunk-SQP6A5AG.js";import"./chunk-QPABR72X.js";import"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import{Na as yt,r as lt,s as ct,t as dt,u as mt,v as pt}from"./chunk-RHNOMUYZ.js";import"./chunk-5RCWAXVK.js";import"./chunk-MEFPXHQJ.js";import"./chunk-7AB3QUGH.js";import{a as L}from"./chunk-BAXGL6TY.js";import{A as D,B as z,C as V,a as ye,b as we,c as Se,d as Ae,e as Ie,f as Oe,g as Ne,h as He,i as je,j as Ue,k as _e,l as I,m as q,n as Be,o as qe,p as Ye,q as O,r as ze,s as Ve,t as Xe,u as x,v as Y,w as Qe,x as Ze,y as et,z as wt}from"./chunk-M6TZ7IIJ.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-6TTGRTDO.js";import"./chunk-AEFO6ES5.js";import"./chunk-VE3SSOQX.js";import"./chunk-W4YR2RO2.js";import"./chunk-7YOLZGB5.js";import"./chunk-IH65GDJR.js";import{u as ut}from"./chunk-NW7B53KD.js";import"./chunk-5BT4VPJC.js";import"./chunk-3UOTLMXD.js";import"./chunk-XVV7ZZ77.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-KWWBDLE6.js";import"./chunk-HVMUYEQP.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-SZDACK6O.js";import"./chunk-VWTBHLMX.js";import"./chunk-6EJJKOMW.js";import"./chunk-JTFCU5LH.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-BE64IJWM.js";import"./chunk-5ONH4ITT.js";import"./chunk-JRAG37V5.js";import"./chunk-ILEC3IAV.js";import"./chunk-MYVHVJWZ.js";import"./chunk-XQH4LCZR.js";import"./chunk-BXK5S2KK.js";import"./chunk-4NZ4T3TQ.js";import"./chunk-LY4G7PCW.js";import"./chunk-DPG6VHPX.js";import"./chunk-BERWTVG2.js";import"./chunk-A7JSRDJL.js";import"./chunk-Z5CMA4JN.js";import"./chunk-JMRFYGET.js";import{a as ht}from"./chunk-ABMDDRZL.js";import{f as gt,g as ft}from"./chunk-5QXRGX2F.js";import"./chunk-WPNRDEHW.js";import"./chunk-OWNQ2FD4.js";import"./chunk-AHWWJ7AF.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-JD5TCX4X.js";import{j as it,k as rt,l as at}from"./chunk-Y6KR7NXL.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-7IW25T4K.js";import"./chunk-Q3A5P373.js";import"./chunk-JLBRNYKY.js";import"./chunk-BYEL7KKR.js";import"./chunk-QUFIUXMQ.js";import{a as ke,b as ve,c as xe,d as $e,e as Ce,f as Pe,g as be,h as Te,i as Me,j as Re,l as Ee,m as Ge,o as T,p as W}from"./chunk-DCIYOPJF.js";import{a as m,b as G}from"./chunk-7I7IEX4S.js";import{b as Fe,c as Le,d as A,e as De}from"./chunk-JHCI6XCJ.js";import{a as Ke,b as Je,e as We}from"./chunk-DSYKYZMT.js";import{Cc as nt,qc as tt,sc as st,vc as ot}from"./chunk-VOVDWFFP.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";W();G();import{execa as Rt}from"execa";import{existsSync as se,promises as X}from"fs";import S from"path";import ie from"node-fetch";async function Et(o,e){let t=o.split("/");if(t.length<2)throw new Error(`Invalid skill package ID: ${o}. Expected format: owner/repo`);let s=t[0],i=t[1],n=t[2];try{let a=n?`${s}/${i}/${n}`:`${s}/${i}`;await Rt("npx",["-y","skills","add",a],{cwd:e,stdio:"pipe"}),m.success(`Installed skill package: ${o}`);let r=S.resolve(e,".skills",`${s}_${i}`);if(se(r))return await ne(r,o);let d=S.resolve(e,".skills");return se(d)?await ne(d,o):[]}catch{return m.info(`Fetching skills directly from GitHub: ${s}/${i}`),await Gt(s,i,n,e)}}async function Gt(o,e,t,s){let i=[];try{let n=`https://api.github.com/repos/${o}/${e}/git/trees/main?recursive=1`,a=await ie(n);if(!a.ok)throw new Error(`GitHub API error: ${a.status}`);let d=(await a.json()).tree.filter(p=>p.type==="blob"&&p.path.endsWith("SKILL.md"));if(t){let p=d.find(f=>f.path.includes(`/${t}/`)||f.path===`${t}/SKILL.md`);if(p){let f=await oe(o,e,p.path,s);f&&i.push(f)}}else for(let p of d){let f=await oe(o,e,p.path,s);f&&i.push(f)}}catch(n){m.error(`Failed to fetch skills from GitHub: ${n.message}`)}return i}async function oe(o,e,t,s){try{let i=`https://raw.githubusercontent.com/${o}/${e}/main/${t}`,n=await ie(i);if(!n.ok)return null;let a=await n.text(),r=A(a);if(r){r.source="remote",r.packageId=`${o}/${e}`;let d=S.dirname(t),p=S.resolve(s,".skills",`${o}_${e}`,d);await X.mkdir(p,{recursive:!0}),await X.writeFile(S.resolve(p,"SKILL.md"),a),r.path=S.resolve(p,"SKILL.md")}return r}catch{return null}}async function ne(o,e){let t=[],{default:s}=await import("fast-glob"),i=await s.glob("**/SKILL.md",{cwd:o,deep:5});for(let n of i)try{let a=S.resolve(o,n),r=await X.readFile(a,"utf8"),d=A(r);d&&(d.source="remote",d.path=a,d.packageId=e,t.push(d))}catch{}return t}async function At(o,e,t,s,i){let n=["---",`name: ${o}`,`description: ${e}`];if(s?.length){n.push("tags:");for(let a of s)n.push(` - ${a}`)}if(i?.length){n.push("globs:");for(let a of i)n.push(` - ${a}`)}return n.push("---"),`${n.join(`
|
|
2
2
|
`)}
|
|
3
3
|
|
|
4
4
|
${t}`}async function It(o){let{loadLocalSkills:e}=await import("./loader-YFVSSYSL.js");return e(o)}async function Ot(o,e,t,s,i){let a=[{role:"system",content:`You are a skill author for the Agent Skills ecosystem (skills.sh).
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=org-tool-
|
|
1
|
+
import{d}from"./chunk-CIW37UJT.js";import{b as c}from"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-AEFO6ES5.js";import"./chunk-NW7B53KD.js";import"./chunk-5BT4VPJC.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-VOVDWFFP.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";var u=new Set(["cron","heartbeat","api","a2a","mesh","approvals","requests"]);function p(n){return typeof n=="string"?n.trim():""}async function y(n,o){let i=o.fetch??fetch,h=o.daemonUrl.replace(/\/$/,""),a=o.env??process.env,s=(p(n.action)||"show").toLowerCase();if(s==="show")try{let e=await i(`${h}/api/org`,{headers:c(a),signal:AbortSignal.timeout(1e4)}),r=await e.json().catch(()=>({}));return e.ok?String(r.text??""):`Error: ${r?.error||`HTTP ${e.status}`}`}catch(e){return`Error: couldn't reach the daemon (${e?.message??e}).`}if(s!=="propose")return`Error: unknown action "${s}". Use show or propose.`;let t=d(n,a);if(!t)return"Error: couldn't tell which agent you are. Pass callerAgentId.";let l=t.channel&&t.chatId&&!u.has(t.channel)?{channel:t.channel,chatId:t.chatId,...t.accountId?{accountId:t.accountId}:{}}:void 0;try{let e=await i(`${h}/api/org/proposals`,{method:"POST",headers:{"Content-Type":"application/json",...c(a)},body:JSON.stringify({changes:n.changes,newAgent:n.newAgent,why:n.why,raised_by:t.agentId,...l?{reply:l}:{}}),signal:AbortSignal.timeout(1e4)}),r=await e.json().catch(()=>({}));return e.ok?[`Card ${r.card.id} is in the owner's Approvals inbox: "${r.text}"`,"Nothing is changed yet. On the owner's yes the daemon applies it and you get a message with the result; do not edit the org chart yourself.","Tell the owner it is waiting for their yes."].join(" "):`Not proposed: ${r?.error||`HTTP ${e.status}`}`}catch(e){return`Error: couldn't reach the daemon (${e?.message??e}).`}}export{y as runOrgTool};
|
|
2
|
+
//# sourceMappingURL=org-tool-NVCSDX4I.js.map
|