agentix-cli 0.226.0 → 0.226.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-PRA4ELTK.js → App-KOHZIHFD.js} +2 -2
- package/dist/{ChatApp-ZFYU5GL5.js → ChatApp-24AJYZEC.js} +2 -2
- package/dist/{absorb-eval-TRJJVOJZ.js → absorb-eval-VCDJPF6M.js} +2 -2
- package/dist/{adapter-R3ZRSWOT.js → adapter-JGB45SCW.js} +2 -2
- package/dist/{agent-HSCGRWXM.js → agent-6TUCPAEK.js} +2 -2
- package/dist/{board-dashboard-ZHF34H4B.js → board-dashboard-B3NC26BR.js} +4 -4
- package/dist/{chunk-W7XVPLDN.js → chunk-2TVJTWFC.js} +2 -2
- package/dist/{chunk-YEX3NOLR.js → chunk-2XQMUSGM.js} +2 -2
- package/dist/{chunk-L5LKL2N7.js → chunk-6ECXITK2.js} +2 -2
- package/dist/{chunk-MRSJOAWK.js → chunk-7GDFB4FS.js} +41 -40
- package/dist/{chunk-MRSJOAWK.js.map → chunk-7GDFB4FS.js.map} +1 -1
- package/dist/{chunk-2CFEXC67.js → chunk-7K7ZQU3C.js} +2 -2
- package/dist/{chunk-FWJHLDAX.js → chunk-A24QXLEG.js} +2 -2
- package/dist/{chunk-N4XPOJMC.js → chunk-BDHWTWD7.js} +2 -2
- package/dist/{chunk-YGGPPZTW.js → chunk-BTLADRMY.js} +2 -2
- package/dist/{chunk-KLWQ4KLG.js → chunk-CF2R6BOX.js} +2 -2
- package/dist/{chunk-LZBOQ3SA.js → chunk-D6LX27PO.js} +2 -2
- package/dist/{chunk-Y7ASJTMM.js → chunk-DG56PTYL.js} +2 -2
- package/dist/{chunk-YM5JAK3F.js → chunk-EYVPRIO3.js} +2 -2
- package/dist/{chunk-3QJZ5TXT.js → chunk-FGHJDZDB.js} +2 -2
- package/dist/{chunk-CUNUXJSF.js → chunk-FWNP27H4.js} +2 -2
- package/dist/chunk-FWNP27H4.js.map +1 -0
- package/dist/{chunk-YCXODM2J.js → chunk-GMAORBGM.js} +2 -2
- package/dist/{chunk-IKSCPOUA.js → chunk-HSBGTRKV.js} +260 -260
- package/dist/chunk-HSBGTRKV.js.map +1 -0
- package/dist/{chunk-DDYGJEH4.js → chunk-I32TCCAK.js} +2 -2
- package/dist/{chunk-BEH3UJGT.js → chunk-IXOJEEGR.js} +2 -2
- package/dist/{chunk-J3PUOD3I.js → chunk-LGYIHB73.js} +3 -3
- package/dist/{chunk-NCADCW3E.js → chunk-LTOSEP7C.js} +2 -2
- package/dist/{chunk-DQNMJXEM.js → chunk-M3K5B3WH.js} +2 -2
- package/dist/{chunk-PVNAUVBQ.js → chunk-MM7U4PWY.js} +2 -2
- package/dist/{chunk-3G3XXCHY.js → chunk-Q6TGKWZE.js} +2 -2
- package/dist/{chunk-TU6D4I4T.js → chunk-QU7ICYFR.js} +2 -2
- package/dist/{chunk-LMH4Z5QE.js → chunk-QZ24XACR.js} +2 -2
- package/dist/{chunk-ZN5SZLO4.js → chunk-SJXWBL72.js} +2 -2
- package/dist/{chunk-4GUFZT5S.js → chunk-TO7ZERY3.js} +103 -102
- package/dist/{chunk-4GUFZT5S.js.map → chunk-TO7ZERY3.js.map} +1 -1
- package/dist/{chunk-AU6ABL2P.js → chunk-UBONPGNT.js} +2 -2
- package/dist/{chunk-S656M5R5.js → chunk-VNXYQH45.js} +2 -2
- package/dist/{chunk-5DEGAL4M.js → chunk-XV3QPZWH.js} +2 -2
- package/dist/{chunk-FAZMGEPF.js → chunk-ZUZYJQJ4.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/{client-CUI3YEXS.js → client-D3HDGKKI.js} +2 -2
- package/dist/{config-WZ5O3SCZ.js → config-OBH67S4V.js} +2 -2
- package/dist/{config-mutate-BX4WUTRK.js → config-mutate-KSTFRHFL.js} +2 -2
- package/dist/{config-mutator-2SK2P355.js → config-mutator-XXZPHMS5.js} +2 -2
- package/dist/{contributions-AOVWT4GQ.js → contributions-ROZVACRZ.js} +2 -2
- package/dist/{doctor-KMKVMWIH.js → doctor-UCH5FAYV.js} +2 -2
- package/dist/{follow-up-tool-GOVILMAF.js → follow-up-tool-IPVPMERA.js} +2 -2
- package/dist/{hub-JLASJLAR.js → hub-UY6IPKJU.js} +2 -2
- package/dist/index.d.ts +8 -6
- package/dist/index.js +1 -1
- package/dist/{org-tool-TZOPMOVD.js → org-tool-YOLOEYRA.js} +2 -2
- package/dist/{program-ERNKLXGC.js → program-SUQ5ILYR.js} +24 -24
- package/dist/{promote-JL6T7KS7.js → promote-LKKZS7DD.js} +2 -2
- package/dist/{query-ZSGNVHAX.js → query-UGQY7TE7.js} +2 -2
- package/dist/{query-settings-PPJICZ26.js → query-settings-HS2YNSLM.js} +2 -2
- package/dist/{registry-EZBD7QJ3.js → registry-NTS5PNO4.js} +2 -2
- package/dist/{request-planner-HF7ZY7HX.js → request-planner-3MKTH2B6.js} +2 -2
- package/dist/{review-candidates-XCEOBHCM.js → review-candidates-ODCGXSYY.js} +2 -2
- package/dist/{routing-CVVEL76N.js → routing-K3O27TBW.js} +2 -2
- package/dist/{schedule-tool-UMSHKANT.js → schedule-tool-5ZIJOA7R.js} +2 -2
- package/dist/{scheduler-L6KEZI43.js → scheduler-Y2COW5JL.js} +2 -2
- package/dist/{seat-KEBD5OUK.js → seat-YMSIXFTN.js} +2 -2
- package/dist/{select-FSKHWU4T.js → select-F6DEPWZH.js} +2 -2
- package/dist/{set-enabled-N2EESOLU.js → set-enabled-UEYUQHF3.js} +2 -2
- package/dist/{sprint-tool-K4EDAGGZ.js → sprint-tool-WPVO3XBV.js} +2 -2
- package/dist/{tool-ISMGGPUZ.js → tool-7TXMGK5Q.js} +2 -2
- package/dist/{tool-MN65SRXS.js → tool-F5GN7WSE.js} +2 -2
- package/dist/{tool-V7ZNX6RY.js → tool-FZPOQXSQ.js} +2 -2
- package/dist/tool-HHMSHXUP.js +2 -0
- package/dist/{tool-HZRDVPDJ.js → tool-QVQZRRSO.js} +2 -2
- package/dist/{wiki-FVOQWOT5.js → wiki-ZI3GXGNW.js} +2 -2
- package/dist/wiki-enrich-JK46USSG.js +2 -0
- package/package.json +1 -1
- package/dist/chunk-CUNUXJSF.js.map +0 -1
- package/dist/chunk-IKSCPOUA.js.map +0 -1
- package/dist/tool-T6RJUVPW.js +0 -2
- package/dist/wiki-enrich-RKTYIZOM.js +0 -2
- /package/dist/{App-PRA4ELTK.js.map → App-KOHZIHFD.js.map} +0 -0
- /package/dist/{ChatApp-ZFYU5GL5.js.map → ChatApp-24AJYZEC.js.map} +0 -0
- /package/dist/{absorb-eval-TRJJVOJZ.js.map → absorb-eval-VCDJPF6M.js.map} +0 -0
- /package/dist/{adapter-R3ZRSWOT.js.map → adapter-JGB45SCW.js.map} +0 -0
- /package/dist/{agent-HSCGRWXM.js.map → agent-6TUCPAEK.js.map} +0 -0
- /package/dist/{board-dashboard-ZHF34H4B.js.map → board-dashboard-B3NC26BR.js.map} +0 -0
- /package/dist/{chunk-W7XVPLDN.js.map → chunk-2TVJTWFC.js.map} +0 -0
- /package/dist/{chunk-YEX3NOLR.js.map → chunk-2XQMUSGM.js.map} +0 -0
- /package/dist/{chunk-L5LKL2N7.js.map → chunk-6ECXITK2.js.map} +0 -0
- /package/dist/{chunk-2CFEXC67.js.map → chunk-7K7ZQU3C.js.map} +0 -0
- /package/dist/{chunk-FWJHLDAX.js.map → chunk-A24QXLEG.js.map} +0 -0
- /package/dist/{chunk-N4XPOJMC.js.map → chunk-BDHWTWD7.js.map} +0 -0
- /package/dist/{chunk-YGGPPZTW.js.map → chunk-BTLADRMY.js.map} +0 -0
- /package/dist/{chunk-KLWQ4KLG.js.map → chunk-CF2R6BOX.js.map} +0 -0
- /package/dist/{chunk-LZBOQ3SA.js.map → chunk-D6LX27PO.js.map} +0 -0
- /package/dist/{chunk-Y7ASJTMM.js.map → chunk-DG56PTYL.js.map} +0 -0
- /package/dist/{chunk-YM5JAK3F.js.map → chunk-EYVPRIO3.js.map} +0 -0
- /package/dist/{chunk-3QJZ5TXT.js.map → chunk-FGHJDZDB.js.map} +0 -0
- /package/dist/{chunk-YCXODM2J.js.map → chunk-GMAORBGM.js.map} +0 -0
- /package/dist/{chunk-DDYGJEH4.js.map → chunk-I32TCCAK.js.map} +0 -0
- /package/dist/{chunk-BEH3UJGT.js.map → chunk-IXOJEEGR.js.map} +0 -0
- /package/dist/{chunk-J3PUOD3I.js.map → chunk-LGYIHB73.js.map} +0 -0
- /package/dist/{chunk-NCADCW3E.js.map → chunk-LTOSEP7C.js.map} +0 -0
- /package/dist/{chunk-DQNMJXEM.js.map → chunk-M3K5B3WH.js.map} +0 -0
- /package/dist/{chunk-PVNAUVBQ.js.map → chunk-MM7U4PWY.js.map} +0 -0
- /package/dist/{chunk-3G3XXCHY.js.map → chunk-Q6TGKWZE.js.map} +0 -0
- /package/dist/{chunk-TU6D4I4T.js.map → chunk-QU7ICYFR.js.map} +0 -0
- /package/dist/{chunk-LMH4Z5QE.js.map → chunk-QZ24XACR.js.map} +0 -0
- /package/dist/{chunk-ZN5SZLO4.js.map → chunk-SJXWBL72.js.map} +0 -0
- /package/dist/{chunk-AU6ABL2P.js.map → chunk-UBONPGNT.js.map} +0 -0
- /package/dist/{chunk-S656M5R5.js.map → chunk-VNXYQH45.js.map} +0 -0
- /package/dist/{chunk-5DEGAL4M.js.map → chunk-XV3QPZWH.js.map} +0 -0
- /package/dist/{chunk-FAZMGEPF.js.map → chunk-ZUZYJQJ4.js.map} +0 -0
- /package/dist/{client-CUI3YEXS.js.map → client-D3HDGKKI.js.map} +0 -0
- /package/dist/{config-WZ5O3SCZ.js.map → config-OBH67S4V.js.map} +0 -0
- /package/dist/{config-mutate-BX4WUTRK.js.map → config-mutate-KSTFRHFL.js.map} +0 -0
- /package/dist/{config-mutator-2SK2P355.js.map → config-mutator-XXZPHMS5.js.map} +0 -0
- /package/dist/{contributions-AOVWT4GQ.js.map → contributions-ROZVACRZ.js.map} +0 -0
- /package/dist/{doctor-KMKVMWIH.js.map → doctor-UCH5FAYV.js.map} +0 -0
- /package/dist/{follow-up-tool-GOVILMAF.js.map → follow-up-tool-IPVPMERA.js.map} +0 -0
- /package/dist/{hub-JLASJLAR.js.map → hub-UY6IPKJU.js.map} +0 -0
- /package/dist/{org-tool-TZOPMOVD.js.map → org-tool-YOLOEYRA.js.map} +0 -0
- /package/dist/{program-ERNKLXGC.js.map → program-SUQ5ILYR.js.map} +0 -0
- /package/dist/{promote-JL6T7KS7.js.map → promote-LKKZS7DD.js.map} +0 -0
- /package/dist/{query-ZSGNVHAX.js.map → query-UGQY7TE7.js.map} +0 -0
- /package/dist/{query-settings-PPJICZ26.js.map → query-settings-HS2YNSLM.js.map} +0 -0
- /package/dist/{registry-EZBD7QJ3.js.map → registry-NTS5PNO4.js.map} +0 -0
- /package/dist/{request-planner-HF7ZY7HX.js.map → request-planner-3MKTH2B6.js.map} +0 -0
- /package/dist/{review-candidates-XCEOBHCM.js.map → review-candidates-ODCGXSYY.js.map} +0 -0
- /package/dist/{routing-CVVEL76N.js.map → routing-K3O27TBW.js.map} +0 -0
- /package/dist/{schedule-tool-UMSHKANT.js.map → schedule-tool-5ZIJOA7R.js.map} +0 -0
- /package/dist/{scheduler-L6KEZI43.js.map → scheduler-Y2COW5JL.js.map} +0 -0
- /package/dist/{seat-KEBD5OUK.js.map → seat-YMSIXFTN.js.map} +0 -0
- /package/dist/{select-FSKHWU4T.js.map → select-F6DEPWZH.js.map} +0 -0
- /package/dist/{set-enabled-N2EESOLU.js.map → set-enabled-UEYUQHF3.js.map} +0 -0
- /package/dist/{sprint-tool-K4EDAGGZ.js.map → sprint-tool-WPVO3XBV.js.map} +0 -0
- /package/dist/{tool-ISMGGPUZ.js.map → tool-7TXMGK5Q.js.map} +0 -0
- /package/dist/{tool-MN65SRXS.js.map → tool-F5GN7WSE.js.map} +0 -0
- /package/dist/{tool-V7ZNX6RY.js.map → tool-FZPOQXSQ.js.map} +0 -0
- /package/dist/{tool-T6RJUVPW.js.map → tool-HHMSHXUP.js.map} +0 -0
- /package/dist/{tool-HZRDVPDJ.js.map → tool-QVQZRRSO.js.map} +0 -0
- /package/dist/{wiki-FVOQWOT5.js.map → wiki-ZI3GXGNW.js.map} +0 -0
- /package/dist/{wiki-enrich-RKTYIZOM.js.map → wiki-enrich-JK46USSG.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as g}from"./chunk-
|
|
1
|
+
import{e as g}from"./chunk-LGYIHB73.js";async function $(e,i,r,n,o={}){let a=o.retrieve??g,c=o.perEntry??2,s=o.maxArticles??8,f=o.queryChars??1500,h=new Map;for(let t of e){let l=[];try{l=await a(t.content.slice(0,f),i,r,{pool:n,maxCandidates:c,maxHops:1,maxArticles:c*2,stage:"absorb-covering"})}catch{}for(let u of l){let p=h.get(u.path);p?(p.hop=Math.min(p.hop,u.hop),p.entries.includes(t.id)||p.entries.push(t.id)):h.set(u.path,{...u,entries:[t.id]})}}return[...h.values()].sort((t,l)=>t.hop-l.hop||l.entries.length-t.entries.length||t.path.localeCompare(l.path)).slice(0,s)}function x(e){if(e.length===0)return"";let i=e.map(r=>{let n=`### ${r.meta.title} \u2014 ${r.meta.type||"untyped"} (${r.path})`,o=`Found for entries: ${r.entries.join(", ")}${r.hop>0?" (linked from a match)":""}`,a=r.meta.related?.length?`Related: ${r.meta.related.join(", ")}`:"";return[n,o,a,"",r.content].filter(c=>c!=="").join(`
|
|
2
2
|
`)}).join(`
|
|
3
3
|
|
|
4
4
|
---
|
|
@@ -14,4 +14,4 @@ These ${e.length} articles were found by searching the wiki for each entry below
|
|
|
14
14
|
|
|
15
15
|
${i}
|
|
16
16
|
`}var d=/\bhttps?:\/\/[^\s<>"'`)\]]+/gi,y=/\[\[([^\]|]+)(?:\|[^\]]*)?\]\]/g,w=/(?<![\w-])(?=[0-9a-f]*[0-9])(?=[0-9a-f]*[a-f])[0-9a-f]{7,40}(?![\w-])/gi,k=/(?<![\w.,:/-])\d+(?:[.,:\-/]\d+)*(?![\w])/g,C=/^\s*\d+[.)]\s/gm;function A(e){let i=[...e.matchAll(d)].map(s=>s[0].replace(/[.,;:!?'"]+$/,"")),r=[...e.matchAll(y)].map(s=>s[1].trim()),n=e.replace(d," ").replace(y," ").replace(C," "),o=[...n.matchAll(w)].map(s=>s[0].toLowerCase()),c=[...n.replace(w," ").matchAll(k)].map(s=>v(s[0]));return{commits:m(o),urls:m(i),wikilinks:m(r),numbers:m(c)}}function R(e,i){let r=A(e),n=A(i),o=i.toLowerCase(),a=[];for(let t of r.commits)!o.includes(t)&&!n.commits.some(l=>l.startsWith(t)||t.startsWith(l))&&a.push(`commit ${t}`);let c=t=>t.toLowerCase().replace(/\/+$/,""),s=new Set(n.urls.map(c));for(let t of r.urls)s.has(c(t))||a.push(`link ${t}`);let f=new Set(n.wikilinks.map(t=>t.toLowerCase()));for(let t of r.wikilinks)f.has(t.toLowerCase())||a.push(`link [[${t}]]`);let h=new Set(n.numbers);for(let t of r.numbers)h.has(t)||a.push(`number ${t}`);return a}function v(e){return/^\d{1,3}(,\d{3})+$/.test(e)?e.replace(/,/g,""):e}function m(e){return[...new Set(e)]}function L(e,i){if(i.some(n=>n.path===e.path))return e.path;let r=b(e.title);return r?i.find(n=>b(n.title)===r)?.path??e.path:e.path}function b(e){return(e||"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}export{$ as a,x as b,A as c,R as d,L as e};
|
|
17
|
-
//# sourceMappingURL=chunk-
|
|
17
|
+
//# sourceMappingURL=chunk-I32TCCAK.js.map
|
|
@@ -48,7 +48,7 @@ The "modified" field is optional and can contain updated values to pass forward.
|
|
|
48
48
|
... (output truncated)`:i;return s.exitCode!==0?{tool_use_id:e.id,content:`Command exited with code ${s.exitCode}:
|
|
49
49
|
${l}`,is_error:!0}:{tool_use_id:e.id,content:l||"(no output)"}}async editFile(e){let t=String(e.input.path||""),o=e.input.edits,r=ge.resolve(this.cwd,t);if(!o||o.length===0)return{tool_use_id:e.id,content:"No edits provided.",is_error:!0};let s=await W.checkFileWrite(t);if(s==="deny")return{tool_use_id:e.id,content:`File write blocked by permissions: ${t}`,is_error:!0};if(s==="skip")return{tool_use_id:e.id,content:`File write skipped (plan mode): ${t}`};if(f.has("pre:file-write")){let a=await f.execute("pre:file-write",{event:"pre:file-write",file:r,cwd:this.cwd});if(a.blocked)return{tool_use_id:e.id,content:a.message||`File edit blocked by pre:file-write hook: ${t}`,is_error:!0}}let i=await ne.readFile(r,"utf8"),l=[];for(let a of o)i.includes(a.old_text)?(i=i.replace(a.old_text,a.new_text),l.push(`Replaced: "${a.old_text.slice(0,40)}..."`)):l.push(`Not found: "${a.old_text.slice(0,40)}..."`);return this.options.dryRun||await ne.writeFile(r,i,"utf8"),f.has("post:file-write")&&await f.execute("post:file-write",{event:"post:file-write",file:r,fileContent:i,cwd:this.cwd}),{tool_use_id:e.id,content:`Edited ${t}:
|
|
50
50
|
${l.join(`
|
|
51
|
-
`)}`}}async createFiles(e){let t=e.input,o=t.files||[];return{tool_use_id:e.id,content:t.summary||`Queued ${o.length} file(s) for creation.`,files:o}}async spawnAgent(e){let t=String(e.input.agent_id||""),o=String(e.input.prompt||""),r=Number(e.input.timeout_seconds)||300;if(!t||!o)return{tool_use_id:e.id,content:"agent_id and prompt are required.",is_error:!0};try{let{SubAgentManager:s}=await import("./subagent-XY5N7TUU.js"),{getGlobalRegistry:i}=await import("./registry-
|
|
51
|
+
`)}`}}async createFiles(e){let t=e.input,o=t.files||[];return{tool_use_id:e.id,content:t.summary||`Queued ${o.length} file(s) for creation.`,files:o}}async spawnAgent(e){let t=String(e.input.agent_id||""),o=String(e.input.prompt||""),r=Number(e.input.timeout_seconds)||300;if(!t||!o)return{tool_use_id:e.id,content:"agent_id and prompt are required.",is_error:!0};try{let{SubAgentManager:s}=await import("./subagent-XY5N7TUU.js"),{getGlobalRegistry:i}=await import("./registry-NTS5PNO4.js"),l=i();if(!l)return{tool_use_id:e.id,content:"Sub-agent spawning requires the daemon to be running.",is_error:!0};let p=await new s(l).spawn({targetAgentId:t,prompt:o,parentAgentId:"orchestrator",timeout:r*1e3});return p.success?{tool_use_id:e.id,content:`Sub-agent "${t}" completed (${Math.round(p.duration/1e3)}s):
|
|
52
52
|
|
|
53
53
|
${p.content}`}:{tool_use_id:e.id,content:`Sub-agent "${t}" failed: ${p.error}`,is_error:!0}}catch(s){return{tool_use_id:e.id,content:`Failed to spawn sub-agent: ${s.message}`,is_error:!0}}}async askUser(e){let t=String(e.input.question||""),o=e.input.options,r=t;return o?.length&&(r+=`
|
|
54
54
|
Options: ${o.join(", ")}`),{tool_use_id:e.id,content:"Question sent to user.",followUp:r}}};async function Oe(n){let{provider:e,systemPrompt:t,messages:o,providerOptions:r,cwd:s,maxIterations:i=20,enabledTools:l,interactive:a=!0,overwrite:p=!1,dryRun:c=!1,onProgress:d,abortSignal:u}=n,m=u?{...r,abortSignal:u}:r;if(!e.generateRaw)return mt(n);let I=new se(s,{interactive:a,overwrite:p,dryRun:c,acmeContext:n.acmeContext,abortSignal:u}),D=be(l);if(n.acmeContext)for(let g of ct)D.push({name:g.name,description:g.description,input_schema:g.input_schema});let E=new Set;if(n.mcpTools?.length)for(let g of n.mcpTools)D.push({name:g.name,description:g.description,input_schema:g.input_schema}),E.add(g.name);let C=o.filter(g=>g.role!=="system").map(g=>({role:g.role,content:g.content})),B=[],G=0,F=0,O=0,A="",j,_=0;for(;_<i;){if(_++,u?.aborted)throw new Error("cancelled");d?.({type:"iteration_start",iteration:_}),k.step(_,`Agentic loop iteration (${D.length} tools available)`);let g,M=!!e.generateRawStream&&!!d;try{if(M){let S=null,H=null,v="";for await(let x of e.generateRawStream(C,t,D,m))x.type==="text_delta"?(v+=x.text,d?.({type:"text_delta",text:x.text})):x.type==="thinking_delta"?d?.({type:"thinking_delta",text:x.text}):x.type==="raw_result"?S=x.result:x.type==="error"&&(H=x.error);if(H&&!S)throw new Error(H);if(!S)throw new Error("generateRawStream returned no raw_result event");g=S,g._streamedText=v}else g=await e.generateRaw(C,t,D,m)}catch(S){if(S.message?.includes("not available"))return mt(n);throw S}G+=g.usage.input_tokens+g.usage.output_tokens,F+=g.usage.input_tokens,O+=g.usage.output_tokens;let P=g._streamedText;for(let S of g.content)S.type==="text"&&(A+=S.text,P===void 0&&d?.({type:"text_delta",text:S.text}));if(P!==void 0&&delete g._streamedText,g.stop_reason==="end_turn"||g.stop_reason==="max_tokens")break;if(g.stop_reason==="tool_use"){let S=g.content.filter(v=>v.type==="tool_use");if(S.length===0)break;C.push({role:"assistant",content:g.content});let H=[];for(let v of S){d?.({type:"tool_call",name:v.name,id:v.id,input:v.input}),k.step(_,`Tool call: ${v.name}`);let x;if(E.has(v.name)&&n.mcpDispatch){let h=await n.mcpDispatch(v.name,v.input);x={tool_use_id:v.id,content:h.content,is_error:h.isError}}else x=await I.execute({name:v.name,id:v.id,input:v.input});d?.({type:"tool_result",name:v.name,id:v.id,content:x.content.slice(0,200),is_error:x.is_error}),x.files?.length&&(B.push(...x.files),d?.({type:"files_created",files:x.files})),x.followUp&&(j=x.followUp),H.push({type:"tool_result",tool_use_id:x.tool_use_id,content:x.content,is_error:x.is_error})}if(C.push({role:"user",content:H}),j)break;continue}break}return d?.({type:"complete",iterations:_,totalTokens:G}),{files:B,content:A,followUp:j,tokensUsed:G,inputTokens:F||void 0,outputTokens:O||void 0,iterations:_}}async function mt(n){let{provider:e,systemPrompt:t,messages:o,providerOptions:r,maxIterations:s=5}=n,l=[{role:"system",content:t+`
|
|
@@ -123,4 +123,4 @@ ${n.projectInstructions}`),n.memoryContext&&o.push(n.memoryContext),o.push(`# Ou
|
|
|
123
123
|
Generate output appropriate for: ${e}. Use the \`create_files\` tool to output all files.`),o.join(`
|
|
124
124
|
|
|
125
125
|
`)}export{We as a,Xt as b,Qt as c,Je as d,Ke as e,Xe as f,Qe as g,Pe as h,ee as i,Re as j,ce as k,te as l,Pt as m,oe as n,Et as o,f as p,ot as q,rt as r,Me as s,de as t,W as u,re as v,lt as w,Ee as x,$e as y,se as z,gt as A,tn as B,on as C};
|
|
126
|
-
//# sourceMappingURL=chunk-
|
|
126
|
+
//# sourceMappingURL=chunk-IXOJEEGR.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as _,b as F,c as K,d as z,e as J}from"./chunk-JTFCU5LH.js";import{a as H}from"./chunk-LUOW2YHY.js";import{a as j,b as I,c as Y,d as V,e as B,j as G}from"./chunk-
|
|
1
|
+
import{a as _,b as F,c as K,d as z,e as J}from"./chunk-JTFCU5LH.js";import{a as H}from"./chunk-LUOW2YHY.js";import{a as j,b as I,c as Y,d as V,e as B,j as G}from"./chunk-2XQMUSGM.js";import{b as E,c as L}from"./chunk-AHWWJ7AF.js";import{y as N,z as ot}from"./chunk-BTLADRMY.js";import{h as Q}from"./chunk-QUFIUXMQ.js";import{readFileSync as lt,existsSync as X}from"fs";ot();import{resolve as R}from"path";import{execSync as ct}from"child_process";var ht="haiku",dt="sonnet",pt=.8;function mt(e,r,o,t){if(t.size===0)return 0;let c=e.listArticles(r||"").map(l=>l.path).filter(l=>!l.includes("/_versions/"));return c.length===0&&(c=o.sharedPool.map(l=>l.path)),c.length===0?0:c.filter(l=>t.has(l)).length/c.length}async function _t(e,r,o,t={}){let c=t.selectorModel??ht,l=t.synthModel??dt,m=t.maxCandidates??3,g=t.maxHops??2,d=t.maxArticles??8,i=t.timeoutMs??6e4,s=t.log??console.error.bind(console,"[wiki-query]"),h=t.messagePath?.length?t.messagePath:void 0,n=t.graphWeight??W,a=R(r.baseDir,"_index.md"),p=tt(r,o,t.shared),b=t.method??"catalog";if(b!=="catalog"){let u=z(r,t.shared);if(b==="summaries"||mt(r,o,p,u)>=pt){let f=t.summaries??K,P=t.notes&&o&&t.notes.owner===o?F(t.notes):void 0,y=await J(e,P?gt(p,P):p,P?new Map([...u,...P.summaries]):u,{...f,navigatorModel:t.selectorModel??f.navigatorModel,answerModel:t.synthModel??f.answerModel},{call:t.call??H,fetch:t.fetch,timeoutMs:i,log:s}),$=y.picked.map(w=>({title:w.meta.title,path:w.path,type:_(w.path)?"note":w.meta.type,hop:w.hop}));return{answer:y.answer,citations:y.status==="ok"?$.map(({hop:w,...v})=>v):[],candidates:$.filter(w=>w.hop===0).map(({title:w,path:v})=>({title:w,path:v})),walked:$,status:y.status,method:"summaries",basis:y.basis,live:y.live,liveAsked:y.liveAsked,trace:y.trace,...y.error?{error:y.error}:{}}}}if(!X(a)&&p.sharedPool.length===0)return M("no-catalog",e,"No _index.md found \u2014 run `agentx wiki status` to rebuild.");let it=(X(a)?lt(a,"utf-8"):"")+yt(e,p.sharedPool,h,n),T=Date.now(),A=[],S="";try{let u=await nt(e,p.pool,o,m,h,n);u?(A=u,S=`[wiki-rerank seat] ${u.map(f=>f.title).join(" | ")}`):(S=await Z(wt(e,it,m,h),c,i),A=bt(S))}catch(u){return s("selector failed:",u?.message),{...M("error",e,`Selector: ${u?.message||"unknown"}`),trace:{selectorMs:Date.now()-T,synthesisMs:0,selectorOutput:S}}}let x=Date.now()-T;if(A.length===0)return{...M("no-candidates",e,"Selector returned no candidates."),trace:{selectorMs:x,synthesisMs:0,selectorOutput:S}};let C=rt(A,p,g,d);if(C.length===0)return{...M("no-candidates",e,"Candidates did not resolve to readable articles."),candidates:A,trace:{selectorMs:x,synthesisMs:0,selectorOutput:S}};let D=Date.now(),U="";try{U=await Z(kt(e,C),l,i*2)}catch(u){return s("synthesis failed:",u?.message),{...M("error",e,`Synthesis: ${u?.message||"unknown"}`),candidates:A,walked:C.map(f=>({title:f.meta.title,path:f.path,type:f.meta.type,hop:f.hop??0})),trace:{selectorMs:x,synthesisMs:Date.now()-D,selectorOutput:S}}}let st=Date.now()-D;return{answer:U.trim(),citations:C.map(u=>({title:u.meta.title,path:u.path,type:u.meta.type})),candidates:A,walked:C.map(u=>({title:u.meta.title,path:u.path,type:u.meta.type,hop:u.hop??0})),status:"ok",trace:{selectorMs:x,synthesisMs:st,selectorOutput:S}}}async function Rt(e,r,o,t={}){let c=t.maxCandidates??3,l=t.graphWeight??W,m=t.messagePath?.length?t.messagePath:void 0,g=t.pool??q(r);if(g.length===0||!e.trim())return[];let d=await nt(e,g,o,c,m,l,t.stage??"retrieve");if(!d){let i=new Set(L(e,E(g.map(at))).map(s=>s.docIndex));d=O(e,g,m,l).filter(s=>i.has(s)).slice(0,c).map(s=>({title:g[s].title,path:g[s].path}))}return d.length===0?[]:rt(d,tt(r,o),t.maxHops??1,t.maxArticles??6)}function q(e){try{return(e.rebuildIndex().articles??[]).filter(r=>r.path&&!r.path.includes("/_versions/"))}catch{return[]}}function M(e,r,o){return{answer:"",citations:[],candidates:[],walked:[],status:e,error:o}}function tt(e,r,o=[]){let t=new Map,c=[];for(let i of e.listArticles(r||""))t.set(i.meta.title.toLowerCase(),i.path),c.push({path:i.path,related:i.meta.related??[],lastUpdated:i.meta.lastUpdated??""});let l=[],m=new Map;for(let i of o)if(i.store.baseDir!==e.baseDir){m.set(i.id,i);for(let s of i.store.listArticles(r||"")){if(s.path.includes("/_versions/")||i.skip?.(s.path))continue;let h=`@${i.id}/${s.path}`;l.push(ut(s,h)),c.push({path:h,related:s.meta.related??[],lastUpdated:s.meta.lastUpdated??""});let n=s.meta.title.toLowerCase();t.has(n)||t.set(n,h)}}let g=new Map;if(m.size>0)for(let i of[...c].sort((s,h)=>h.lastUpdated.localeCompare(s.lastUpdated)))for(let s of i.related){let h=s.toLowerCase(),n=g.get(h)??[];n.includes(i.path)||n.push(i.path),g.set(h,n)}let d;return{backlinks:g,readable:new Set(c.map(i=>i.path)),get pool(){return d??=[...q(e),...l]},sharedPool:l,titleIndex:t,read(i){let s=i.match(/^@([^/]+)\/(.+)$/),h=s?m.get(s[1]):void 0;if(s&&!h)return null;let n=h?.store??e,a=s?s[2]:i,p=r?n.readArticleAs(a,r):n.readArticle(a);return p?{...p,path:i}:null},links(i){let s=(i.meta.related??[]).map(a=>t.get(a.toLowerCase())).filter(a=>!!a),h=[i.meta.title,...i.meta.aliases??[]].map(a=>a.toLowerCase()),n=[...new Set(h.flatMap(a=>g.get(a)??[]))].filter(a=>a!==i.path).slice(0,et);return[...new Set([...s,...n])].filter(a=>a!==i.path)}}}function gt(e,r){return{...e,pool:[...e.pool,...r.pool],readable:new Set([...e.readable,...r.pool.map(o=>o.path)]),read:o=>_(o)?r.read(o):e.read(o)}}function ut(e,r){return{path:r,title:e.meta.title,type:e.meta.type,related:e.meta.related,tags:e.meta.tags||[],owner:e.meta.owner,access:e.meta.access,sharedWith:e.meta.sharedWith,aliases:[e.meta.title.toLowerCase(),...(e.meta.aliases??[]).map(o=>o.toLowerCase())],backlinks:0,sources:e.meta.sources,lastUpdated:e.meta.lastUpdated,graphPath:e.meta.graphPath}}var ft=150;function yt(e,r,o,t){return r.length===0?"":`
|
|
2
2
|
|
|
3
3
|
## Shared wiki (other agents' articles)
|
|
4
4
|
|
|
@@ -51,5 +51,5 @@ ${o}
|
|
|
51
51
|
|
|
52
52
|
Answer the question in 2\u20136 sentences. Cite articles by their title in square brackets like [Article Title]. When two articles disagree, prefer the one updated more recently, and say which agent's page and date the answer comes from. If the articles do not answer the question, say so plainly (do not invent). Prefer concrete facts over hedging.
|
|
53
53
|
|
|
54
|
-
Output ONLY the answer \u2014 no preamble, no "here is my answer:", no markdown fencing.`}function bt(e){let r=e.match(/\[[\s\S]*?\]/);if(!r)return[];try{let o=JSON.parse(r[0]);return Array.isArray(o)?o.filter(t=>t&&typeof t.title=="string"&&typeof t.path=="string").map(t=>({title:t.title,path:t.path})):[]}catch{return[]}}async function Z(e,r,o){let{writeFileSync:t,mkdirSync:c,rmSync:l}=await import("fs"),{tmpdir:m}=await import("os"),g=R(m(),`agentx-wiki-query-${process.pid}`);c(g,{recursive:!0});let d=R(g,`prompt-${Date.now()}.txt`);t(d,e);try{let i=`cat '${d}' | claude -p - --output-format json --max-turns 1 --model ${r} --disallowedTools "Bash Read Write Edit Glob Grep Agent WebSearch WebFetch NotebookEdit"`,s=ct(i,{env:Q(),encoding:"utf-8",timeout:o,maxBuffer:4*1024*1024});try{let h=JSON.parse(s);return String(h.result||h.content||"")}catch{return s}}finally{try{l(d,{force:!0})}catch{}}}async function Ot(e){try{let{loadDaemonConfig:r}=await import("./config-
|
|
55
|
-
//# sourceMappingURL=chunk-
|
|
54
|
+
Output ONLY the answer \u2014 no preamble, no "here is my answer:", no markdown fencing.`}function bt(e){let r=e.match(/\[[\s\S]*?\]/);if(!r)return[];try{let o=JSON.parse(r[0]);return Array.isArray(o)?o.filter(t=>t&&typeof t.title=="string"&&typeof t.path=="string").map(t=>({title:t.title,path:t.path})):[]}catch{return[]}}async function Z(e,r,o){let{writeFileSync:t,mkdirSync:c,rmSync:l}=await import("fs"),{tmpdir:m}=await import("os"),g=R(m(),`agentx-wiki-query-${process.pid}`);c(g,{recursive:!0});let d=R(g,`prompt-${Date.now()}.txt`);t(d,e);try{let i=`cat '${d}' | claude -p - --output-format json --max-turns 1 --model ${r} --disallowedTools "Bash Read Write Edit Glob Grep Agent WebSearch WebFetch NotebookEdit"`,s=ct(i,{env:Q(),encoding:"utf-8",timeout:o,maxBuffer:4*1024*1024});try{let h=JSON.parse(s);return String(h.result||h.content||"")}catch{return s}}finally{try{l(d,{force:!0})}catch{}}}async function Ot(e){try{let{loadDaemonConfig:r}=await import("./config-OBH67S4V.js");return r(e).wiki.query.shared}catch{return!0}}export{ht as a,dt as b,pt as c,_t as d,Rt as e,q as f,ft as g,W as h,O as i,Ot as j};
|
|
55
|
+
//# sourceMappingURL=chunk-LGYIHB73.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{cb as p,hb as g}from"./chunk-
|
|
1
|
+
import{cb as p,hb as g}from"./chunk-FWNP27H4.js";import{q as d,r as N}from"./chunk-N47Y5ADQ.js";g();N();var m=["done","skipped"];function I(t,e=Date.now()){return t.state==="active"&&typeof t.waitUntil=="number"&&t.waitUntil>e?` waits until ${new Date(t.waitUntil).toISOString().slice(0,16).replace("T"," ")}Z`:""}var A=1e3;function h(t){t.exec(`
|
|
2
2
|
CREATE TABLE IF NOT EXISTS request_plans (
|
|
3
3
|
request_id TEXT PRIMARY KEY,
|
|
4
4
|
created_by TEXT NOT NULL,
|
|
@@ -59,4 +59,4 @@ import{cb as p,hb as g}from"./chunk-CUNUXJSF.js";import{q as d,r as N}from"./chu
|
|
|
59
59
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);this.db.transaction(()=>{i.run(e,a,l),n.forEach((s,u)=>{let E=u===0,T=E&&s.agentId===a&&s.kind!=="message";r.run(e,u+1,s.name,s.kind,s.agentId,s.doneWhen,E?"active":"pending",s.needsApproval?1:0,s.message??null,s.toChannel??null,s.toChat??null,s.toAccount??null,s.checkUrl??null,s.checkContains??null,s.stallMinutes??null,T?l:null,l,s.checkCount??null)}),this.event(e,null,"created",`${n.length} steps, written by ${a}`,l)})()}get(e){let a=this.db.prepare("SELECT * FROM request_plans WHERE request_id = ?").get(e);return a?o(a):null}steps(e){return this.db.prepare("SELECT * FROM request_plan_steps WHERE request_id = ? ORDER BY idx").all(e).map(c)}step(e,a){let n=this.db.prepare("SELECT * FROM request_plan_steps WHERE request_id = ? AND idx = ?").get(e,a);return n?c(n):null}listActive(){return this.db.prepare("SELECT * FROM request_plans WHERE state = 'active' ORDER BY created_at, rowid").all().map(o)}updateStep(e,a,n){let l=[],i=[];for(let[r,s]of Object.entries(n)){let u=R[r];!u||s===void 0||(l.push(`${u} = ?`),i.push(typeof s=="boolean"?s?1:0:s))}l.length&&this.db.prepare(`UPDATE request_plan_steps SET ${l.join(", ")} WHERE request_id = ? AND idx = ?`).run(...i,e,a)}finish(e,a,n){return this.db.prepare("UPDATE request_plans SET state = ?, finished_at = ? WHERE request_id = ? AND state = 'active'").run(a,n,e).changes>0}markNotified(e,a){this.db.prepare("UPDATE request_plans SET notified_at = ? WHERE request_id = ?").run(a,e)}awaitingSummary(){return this.db.prepare("SELECT * FROM request_plans WHERE state = 'done' AND notified_at IS NULL ORDER BY finished_at").all().map(o)}event(e,a,n,l,i){this.db.prepare("INSERT INTO request_plan_events (request_id, step, at, kind, detail) VALUES (?, ?, ?, ?, ?)").run(e,a,i,n,l.replace(/\s+/g," ").trim().slice(0,A))}continues(e,a){let n=this.db.prepare("SELECT turns, cost_usd, told_at FROM request_plan_continues WHERE goal_key = ? AND day = ?").get(e,a);return n?{turns:n.turns,costUsd:n.cost_usd,toldAt:n.told_at??null}:{turns:0,costUsd:0,toldAt:null}}addContinue(e,a,n){this.db.prepare(`INSERT INTO request_plan_continues (goal_key, day, turns, cost_usd, told_at) VALUES (?, ?, ?, ?, ?)
|
|
60
60
|
ON CONFLICT(goal_key, day) DO UPDATE SET turns = turns + excluded.turns, cost_usd = cost_usd + excluded.cost_usd,
|
|
61
61
|
told_at = COALESCE(excluded.told_at, told_at)`).run(e,a,n.turns??0,n.costUsd??0,n.toldAt??null)}events(e,a=200){return this.db.prepare("SELECT request_id, step, at, kind, detail FROM request_plan_events WHERE request_id = ? ORDER BY at DESC, rowid DESC LIMIT ?").all(e,a).reverse().map(n=>({requestId:n.request_id,step:n.step??null,at:n.at,kind:n.kind,detail:n.detail}))}stepEvents(e,a,n,l=200){return this.db.prepare("SELECT request_id, step, at, kind, detail FROM request_plan_events WHERE request_id = ? AND step = ? AND kind = ? ORDER BY at DESC, rowid DESC LIMIT ?").all(e,a,n,l).reverse().map(i=>({requestId:i.request_id,step:i.step??null,at:i.at,kind:i.kind,detail:i.detail}))}},q=p;export{m as a,I as b,b as c,_ as d,q as e};
|
|
62
|
-
//# sourceMappingURL=chunk-
|
|
62
|
+
//# sourceMappingURL=chunk-LTOSEP7C.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as xt}from"./chunk-GTJIKXDB.js";import{P as Wr,W as Xr,s as J}from"./chunk-
|
|
1
|
+
import{a as xt}from"./chunk-GTJIKXDB.js";import{P as Wr,W as Xr,s as J}from"./chunk-BDHWTWD7.js";import{f as Br,g as Hr,h as Vr,l as qr}from"./chunk-UBONPGNT.js";import{b as jr}from"./chunk-2VDO2HEK.js";import{t as Fr,u as Ur}from"./chunk-7K7ZQU3C.js";import{d as Pr,e as Mr}from"./chunk-AQASR6KR.js";import{h as he,j as Er,l as $r,m as Ar,n as _r}from"./chunk-RX5O5637.js";import{a as Rr,c as Tr,e as Ir,f as ht,h as Dr,j as Cr,k as Nr,l as bt,m as yt,n as wt}from"./chunk-5ELIX7BQ.js";import{c as Or,d as Lr}from"./chunk-LTOSEP7C.js";import{h as wr,i as xr,j as kr,l as vr,m as Sr}from"./chunk-QU7ICYFR.js";import{a as br,c as yr}from"./chunk-KP7KDLZ2.js";import{c as Le,d as fr,e as hr}from"./chunk-XVV7ZZ77.js";import{Ea as Oe,Fa as mr,Ga as W,Ha as fe,Ja as ft,b as pt,f as cr,s as gt,u as mt}from"./chunk-7GDFB4FS.js";import{a as Ce,b as me,e as dr}from"./chunk-7AB3QUGH.js";import{v as gr}from"./chunk-CF2R6BOX.js";import{a as ur,b as Ne,e as pr}from"./chunk-Q6TGKWZE.js";import{b as ne}from"./chunk-5ONH4ITT.js";import{a as lr,c as ut}from"./chunk-ILEC3IAV.js";import{a as er,j as sr,m as ir,o as ct,p as dt,s as ge,t as te,v as ar}from"./chunk-3323WFVK.js";import{a as tr,b as nr,d as rr,e as or}from"./chunk-4NZ4T3TQ.js";import{a as Zn}from"./chunk-7IW25T4K.js";import{a as Qn}from"./chunk-QUFIUXMQ.js";import{Dc as Yn,Fa as De,Ha as qn,I as ot,J as C,L as Te,M as $,N as pe,O as jn,R as Bn,S as st,Xa as Xn,b as In,c as Dn,d as Cn,e as Nn,eb as zn,f as On,fa as Ie,g as Ln,ga as Hn,gb as Kn,h as G,ha as Vn,hb as Xi,hc as lt,i as Pn,ia as Hi,j as Mn,k as Fn,l as rt,s as Un,sc as Gn,tc as Jn,w as ji,x as Wn,y as Bi}from"./chunk-FWNP27H4.js";import{a as it,h as Vi}from"./chunk-KEUW6YLL.js";import{j as at,r as qi}from"./chunk-N47Y5ADQ.js";import{existsSync as zi,readdirSync as Ki,readFileSync as Gi,statSync as Ji}from"fs";import{resolve as Yi}from"path";function zr(t,e,n=Date.now(),r=7){let o=r*864e5,s=new Map;for(let i of e){let a=s.get(i.workflowId);a?a.push(i):s.set(i.workflowId,[i])}return t.map(i=>{let a=s.get(i.id)??[],d=a.filter(m=>n-m.at<=o),l=a.filter(m=>n-m.at>o&&n-m.at<=o*2),c=d.filter(m=>m.status==="failed").length,p=a.filter(m=>m.status==="paused").length,u=a.length?Math.max(...a.map(m=>m.at)):null,g=a.length?l.length>0&&d.length===0?"dormant":d.length>0&&c*2>=d.length?"failing":d.length>0?"active":"quiet":"never";return{id:i.id,name:i.name||i.id,state:g,lastRunAt:u,recent:d.length,prior:l.length,failed:c,paused:p}}).sort((i,a)=>{let d={dormant:0,failing:1,active:2,quiet:3,never:4};return d[i.state]-d[a.state]||(a.lastRunAt??0)-(i.lastRunAt??0)})}var Pe=new Map;function rp(t,e=1e3){if(!zi(t))return[];let n=Ki(t).filter(s=>s.endsWith(".jsonl")).map(s=>{let i=Yi(t,s);return{path:i,mtime:Ji(i).mtimeMs}}).sort((s,i)=>i.mtime-s.mtime).slice(0,e),r=new Set(n.map(s=>s.path));for(let s of Pe.keys())r.has(s)||Pe.delete(s);let o=[];for(let{path:s,mtime:i}of n){let a=Pe.get(s);if(a&&a.mtime===i){a.summary&&o.push(a.summary);continue}let d=Qi(s,i);Pe.set(s,{mtime:i,summary:d}),d&&o.push(d)}return o}function Qi(t,e){try{let n=Gi(t,"utf-8").split(`
|
|
2
2
|
`).filter(Boolean);if(!n.length)return null;let r=JSON.parse(n[0]),o=r.run?.workflowId;if(!o)return null;let s=r.run?.status??"unknown";for(let i=n.length-1;i>=0;i--){let a=JSON.parse(n[i]),d=a.status??a.run?.status;if(d){s=d;break}}return{workflowId:o,status:s,at:e}}catch{return null}}var Kr=7,Zi={failStreak:3,disabledDays:30,missedFires:2,graceMs:15*6e4},T={routines:200,summary:160,filters:6,filterValue:60,text:120},ea=(t,e,n)=>{try{return gr(t,e,n)}catch{return null}},Gr=864e5;function ap(t){let e=t.now??Date.now(),n={...Zi,...t.thresholds},r=t.nextFire??ea,o=[];for(let a of t.crons){let d=t.cronRuns.get(a.id)??[],l=a.timezone||"UTC",c=d.map(g=>({at:Date.parse(g.startedAt),status:g.status})),p=d[0],u={id:`cron:${a.id}`,source:"cron",kind:"schedule",name:F(a.id,T.text),trigger:{schedule:F(a.schedule,T.text),timezone:l},agent:a.agent||null,enabled:a.enabled,state:a.enabled?"enabled":"disabled",nextRunAt:a.enabled?kt(a.nextRun)??kt(r(a.schedule,new Date(e),l)):null,lastRun:p?{at:p.startedAt,status:p.status,summary:ia(p.status==="success"?void 0:p.errorSummary,T.summary)}:null,lastSuccessAt:d.find(g=>g.status==="success")?.startedAt??null,consecutiveFailures:Jr(c),sampledRuns:d.length,flags:[],attention:null,recent:d.slice(0,Kr).map(g=>({at:g.startedAt,status:g.status}))};u.flags=Yr(u,c,a.schedule,l,null,e,n,r),o.push(Qr(u))}let s=new Map(zr(t.workflows.map(a=>({id:a.id,name:a.title})),t.workflowRuns,e).map(a=>[a.id,a])),i=new Map;for(let a of t.workflowRuns){let d=i.get(a.workflowId);d?d.push(a):i.set(a.workflowId,[a])}for(let a of t.workflows){let d=a.nodes.find(k=>k.type.startsWith("trigger."));if(!d||d.type!=="trigger.cron"&&d.type!=="trigger.hook")continue;let l=d.config??{},c=a.state||"active",p=c==="active",u=(i.get(a.id)??[]).slice().sort((k,S)=>S.at-k.at),g=u.map(k=>({at:k.at,status:ra(k.status)})),m=g[0],f=d.type==="trigger.cron",w=typeof l.spec=="string"?l.spec:"",x=typeof l.timezone=="string"?l.timezone:"UTC",b={id:`workflow:${a.id}`,source:"workflow",kind:f?"schedule":"event",name:F(a.title||a.id,T.text),trigger:f?{schedule:F(w,T.text),timezone:x}:{event:F(typeof l.event=="string"?l.event:"",T.text),filters:sa(l.filter,a)},agent:oa(a),enabled:p,state:c,nextRunAt:f&&p&&w?kt(r(w,new Date(e),x)):null,lastRun:m?{at:new Date(m.at).toISOString(),status:m.status}:null,lastSuccessAt:(()=>{let k=g.find(S=>S.status==="success");return k?new Date(k.at).toISOString():null})(),consecutiveFailures:Jr(g),sampledRuns:u.length,flags:[],attention:null,recent:g.slice(0,Kr).map(k=>({at:new Date(k.at).toISOString(),status:k.status}))},y=Date.parse(a.updated||a.created||"");b.flags=f?Yr(b,g,w,x,Number.isFinite(y)?y:null,e,n,r):ta(b,s.get(a.id)?.state==="dormant",Number.isFinite(y)?y:null,e,n),o.push(Qr(b))}return o.sort(na).slice(0,T.routines)}function Jr(t){let e=0;for(let n of t)if(!(n.status==="running"||n.status==="paused"||n.status==="unknown"))if(n.status==="failed"||n.status==="timeout")e++;else break;return e}function Yr(t,e,n,r,o,s,i,a){let d=[],l=e.length?e[0].at:null;if(!t.enabled){let u=eo(l,o,s,i);return u&&d.push(u),d}if(t.consecutiveFailures>=i.failStreak&&d.push({reason:"failing",detail:`${t.consecutiveFailures} failed attempts in a row`}),l===null)return d.push({reason:"never-ran",detail:"No persisted attempt"}),d;let c=new Date(l),p=null;for(let u=0;u<i.missedFires&&(p=a(n,c,r),!!p);u++)c=p;return p&&s>p.getTime()+i.graceMs&&d.push({reason:"overdue",detail:`No attempt since ${new Date(l).toISOString()}; ${i.missedFires} scheduled fires missed`}),d}function ta(t,e,n,r,o){let s=[],i=t.lastRun?Date.parse(t.lastRun.at):null;if(!t.enabled){let a=eo(i,n,r,o);return a&&s.push(a),s}return t.consecutiveFailures>=o.failStreak&&s.push({reason:"failing",detail:`${t.consecutiveFailures} failed runs in a row`}),i===null?s.push({reason:"never-ran",detail:"No run recorded for this trigger"}):e&&s.push({reason:"dormant",detail:"Fired in the prior week, silent in the last one"}),s}function eo(t,e,n,r){let o=Math.max(t??0,e??0);return o&&n-o<r.disabledDays*Gr?null:{reason:"disabled-long",detail:o?`Disabled; no activity for ${Math.floor((n-o)/Gr)} days`:"Disabled and never ran"}}function Qr(t){let e=new Set(t.flags.map(n=>n.reason));return t.attention=e.has("failing")?"critical":e.has("overdue")||e.has("dormant")||e.has("never-ran")?"warning":e.has("disabled-long")?"info":null,t}var Zr={critical:0,warning:1,info:2};function na(t,e){let n=t.attention?Zr[t.attention]:3,r=e.attention?Zr[e.attention]:3;return n-r||Number(e.enabled)-Number(t.enabled)||t.name.localeCompare(e.name)}function ra(t){switch(t){case"completed":case"ok":return"success";case"failed":return"failed";case"timeout":return"timeout";case"canceled":return"canceled";case"running":return"running";case"paused":return"paused";default:return"unknown"}}function oa(t){if(t.ownerAgent)return F(t.ownerAgent,T.text);let e=t.nodes.find(n=>n.type==="agent"&&typeof n.config?.agentId=="string"&&n.config.agentId);return e?F(String(e.config.agentId),T.text):null}function sa(t,e){let n=[],r=e?.project;if(r&&n.push(F(`project=${r}`,T.filterValue)),t&&typeof t=="object"&&!Array.isArray(t))for(let[o,s]of Object.entries(t)){let i=Array.isArray(s)?s.map(String):s==null?[]:[String(s)];i.length&&n.push(F(`${o}=${i.join(",")}`,T.filterValue))}return n.slice(0,T.filters)}function kt(t){if(!t)return null;let e=t instanceof Date?t:new Date(t);return Number.isFinite(e.getTime())?e.toISOString():null}function F(t,e){return t.length<=e?t:t.slice(0,e-3)+"..."}function ia(t,e){return t===void 0?void 0:F(t,e)}import{mkdirSync as aa,readFileSync as la,renameSync as ca,writeFileSync as da}from"fs";import{resolve as ua}from"path";function to(t){return ua(dt(t),"_state.json")}function N(t){try{let e=JSON.parse(la(to(t),"utf-8"));return{snoozed:e&&typeof e.snoozed=="object"&&e.snoozed?e.snoozed:{},...typeof e?.lastDigest=="string"?{lastDigest:e.lastDigest}:{},...e?.popped&&typeof e.popped=="object"?{popped:e.popped}:{},...typeof e?.passAt=="string"?{passAt:e.passAt}:{},...Array.isArray(e?.wanted)?{wanted:e.wanted.filter(n=>typeof n=="string")}:{}}}catch{return{snoozed:{}}}}function be(t,e){aa(dt(t),{recursive:!0});let n=to(t),r=`${n}.${process.pid}.tmp`;da(r,JSON.stringify(e,null,2)+`
|
|
3
3
|
`),ca(r,n)}function no(t,e,n,r=Date.now()){let o=N(t),s={};for(let[i,a]of Object.entries(o.snoozed))Date.parse(a)>r&&(s[i]=a);s[e]=n.toISOString(),be(t,{...o,snoozed:s})}function pp(t,e){be(t,{...N(t),lastDigest:e})}function vt(t,e,n,r=Date.now()){let o=N(t),s=new Set(n),i={};for(let[d,l]of Object.entries(o.popped??{}))s.has(d)&&(i[d]=l);i[e]=new Date(r).toISOString();let a=(o.wanted??[]).filter(d=>d!==e&&s.has(d));be(t,{...o,popped:i,wanted:a})}function ro(t,e){let n=N(t);be(t,{...n,wanted:[...(n.wanted??[]).filter(r=>r!==e),e]})}function gp(t,e=Date.now()){be(t,{...N(t),popped:{},passAt:new Date(e).toISOString()})}import{existsSync as pa,readFileSync as ga}from"fs";Yn();Vi();function oo(t){let e=ur(t),n={};if(pa(e))try{n=Gn(JSON.parse(ga(e,"utf-8")))}catch{n={}}let r=lt.safeParse(n?.requests);return r.success?r.data:lt.parse(void 0)}async function wp(t,e={}){let n=(t.channels??[]).filter(r=>!it.has(r.toLowerCase().split("@")[0]));return n.length?{success:!1,error:`unknown channel ${n.map(r=>`"${r}"`).join(", ")}: use ${[...it].join(", ")}`}:Ne(r=>{let o=r.requests??={};for(let s of["enabled","channels","from","staleAfterHours","retentionDays","settleHandedBack","homeCloses","releaseOnOwnerTurn"])t[s]!==void 0&&(o[s]=t[s]);if(t.plans){let s=o.plans??={};for(let i of["enabled","stallMinutes","maxNudges","approveKinds","disabledAgents","requireForWork","requireOverMinutes"])t.plans[i]!==void 0&&(s[i]=t.plans[i])}if(t.headlines?.enabled!==void 0&&((o.headlines??={}).enabled=t.headlines.enabled),t.catchPromises){let s=o.catchPromises??={};for(let i of["enabled","dailyCap"])t.catchPromises[i]!==void 0&&(s[i]=t.catchPromises[i])}if(t.autoResend){let s=o.autoResend??={};for(let i of["enabled","afterMinutes","holdMaxHours"])t.autoResend[i]!==void 0&&(s[i]=t.autoResend[i])}if(t.flow){let s=o.flow??={};for(let i of["timeZone","days"])t.flow[i]!==void 0&&(s[i]=t.flow[i])}if(t.checkers){let s=o.checkers??={};for(let i of["enabled","checkEveryMinutes"])t.checkers[i]!==void 0&&(s[i]=t.checkers[i])}},{configPath:e.configPath,reload:e.reload})}import{existsSync as V,readdirSync as Da,readFileSync as $t,statSync as Ca}from"fs";import{dirname as So,resolve as R}from"path";import{randomBytes as ao}from"crypto";import{existsSync as fa,mkdirSync as ha,readdirSync as ba,readFileSync as ya,renameSync as lo,unlinkSync as wa,writeFileSync as xa}from"fs";import{resolve as co}from"path";function so(t){return[...t.account?["--account",t.account]:[],...t.store?["--store",t.store]:[]]}var ma=t=>t.trim().split(`
|
|
4
4
|
`).pop()?.slice(0,300)||"no output";async function io(t,e,n,r=xt){let o=await r(t.bin,[...so(t),"send","text","--to",e,"--message",n,"--no-preview"],{timeoutMs:6e4});return o.code===0?{ok:!0}:{ok:!1,error:`wacli send failed: ${ma(o.stderr||o.stdout)}`}}async function vp(t,e,n,r,o=xt){return(await o(t.bin,[...so(t),"--read-only","media","download","--chat",e,"--id",n,"--output",r],{timeoutMs:12e4})).code===0}var ka=2e3,va=t=>io(t.wacli,t.to,t.text);function St(t){return co(t,".agentx","whatsapp-triage","drafts")}var Sa=t=>/^[a-z0-9-]{8,64}$/.test(t),Me=(t,e)=>co(St(t),`${e}.json`);function uo(t,e){ha(St(t),{recursive:!0});let n=Me(t,e.id),r=`${n}.${process.pid}.tmp`;xa(r,JSON.stringify(e,null,2)+`
|
|
@@ -960,4 +960,4 @@ Document the arguments, commands, or files the skill expects. Example:
|
|
|
960
960
|
claude-code ${Tn(t)} --arg value
|
|
961
961
|
\`\`\`
|
|
962
962
|
`}Yn();var Mi={maxPixels:12e5,timeoutMs:5e3,intervalMs:100,changeThreshold:.015,stableMs:400,regions:{},buffer:{enabled:!1,seconds:10,fps:2,region:"screen",maxPixels:3e5}};function Fi(t){return{...Mi,...t??{},regions:{...t?.regions??{}},buffer:{...Mi.buffer,...t?.buffer??{}}}}function Eb(t){try{return Fi(Jn(t).screen)}catch{return Fi(void 0)}}var ep=/^[a-z][\w-]*$/,Ui=["window","screen","menubar","notifications"];function Ae(t,e,n,r){let o=Number(t);if(t===""||t===null||!Number.isFinite(o)||!n(o))throw new Error(`${e} must be ${r}`);return o}var tt=(t,e)=>Ae(t,e,n=>Number.isInteger(n)&&n>0,"a whole number above 0");function Wi(t){let e=typeof t=="string"?t.split(",").map(Number):[t?.x,t?.y,t?.width,t?.height].map(Number);if(e.length!==4||!e.every(Number.isFinite)||e[2]<=0||e[3]<=0)throw new Error("a region is x,y,width,height in screen points, with width and height above 0");return{x:e[0],y:e[1],width:e[2],height:e[3]}}function $b(t,e){let n={...t??{}};if("maxPixels"in e&&(n.maxPixels=tt(e.maxPixels,"maxPixels")),"timeoutMs"in e&&(n.timeoutMs=tt(e.timeoutMs,"timeoutMs")),"intervalMs"in e&&(n.intervalMs=tt(e.intervalMs,"intervalMs")),"stableMs"in e&&(n.stableMs=Ae(e.stableMs,"stableMs",o=>Number.isInteger(o)&&o>=0,"a whole number, 0 or more")),"changeThreshold"in e&&(n.changeThreshold=Ae(e.changeThreshold,"changeThreshold",o=>o>=0&&o<=1,"between 0 and 1")),e.regions&&typeof e.regions=="object"){let o={...n.regions??{}};for(let[s,i]of Object.entries(e.regions)){if(!ep.test(s))throw new Error(`region name "${s}" must be lowercase letters, digits, - or _`);i===null?delete o[s]:o[s]=Wi(i)}n.regions=o}if(e.buffer&&typeof e.buffer=="object"){let o=e.buffer,s={...n.buffer??{}};"enabled"in o&&(s.enabled=!!o.enabled),"seconds"in o&&(s.seconds=Ae(o.seconds,"buffer.seconds",i=>i>0&&i<=120,"above 0 and at most 120")),"fps"in o&&(s.fps=Ae(o.fps,"buffer.fps",i=>i>0&&i<=10,"above 0 and at most 10")),"maxPixels"in o&&(s.maxPixels=tt(o.maxPixels,"buffer.maxPixels")),"region"in o&&(s.region=String(o.region).trim()),n.buffer=s}let r=n.buffer?.region;if(r!==void 0&&!Ui.includes(r)&&!n.regions?.[r])try{Wi(r)}catch{throw new Error(`buffer.region "${r}" is not a region \u2014 use ${[...Ui,...Object.keys(n.regions??{})].join(", ")}, or x,y,w,h`)}return n}export{zr as a,rp as b,en as c,$c as d,Ac as e,Om as f,Lm as g,Pm as h,Um as i,Wm as j,jm as k,vs as l,Ss as m,Bm as n,Vm as o,X as p,Es as q,T as r,ap as s,_s as t,Jm as u,Zm as v,Ts as w,ef as x,Is as y,tf as z,xe as A,Jc as B,nf as C,rf as D,Cs as E,vp as F,va as G,Rp as H,go as I,N as J,pp as K,gp as L,oo as M,wp as N,Y as O,ag as P,To as Q,Co as R,ed as S,sf as T,td as U,af as V,lf as W,nn as X,Os as Y,uf as Z,on as _,od as $,sd as aa,ff as ba,nl as ca,rl as da,dg as ea,ug as fa,dl as ga,fg as ha,Vs as ia,Xs as ja,kf as ka,ce as la,Af as ma,zs as na,Tf as oa,Df as pa,yg as qa,wg as ra,ys as sa,qt as ta,yc as ua,I as va,ii as wa,ch as xa,dh as ya,Yd as za,mh as Aa,pi as Ba,fh as Ca,hh as Da,vh as Ea,iu as Fa,lu as Ga,Sh as Ha,kg as Ia,vg as Ja,Sg as Ka,Eg as La,$g as Ma,Ag as Na,_g as Oa,Rg as Pa,Ig as Qa,Dg as Ra,Og as Sa,Lg as Ta,Pg as Ua,Ug as Va,Wg as Wa,jg as Xa,Bg as Ya,Hg as Za,Vg as _a,qg as $a,em as ab,Lt as bb,tm as cb,nm as db,ye as eb,we as fb,mu as gb,Ch as hb,Nh as ib,Oh as jb,Lh as kb,bn as lb,Ph as mb,Ft as nb,Ut as ob,ze as pb,Wl as qb,Bl as rb,am as sb,jt as tb,Bt as ub,Hl as vb,Vl as wb,rs as xb,as as yb,lm as zb,zl as Ab,cm as Bb,tc as Cb,oc as Db,Ht as Eb,ic as Fb,ls as Gb,z as Hb,Si as Ib,Ei as Jb,$i as Kb,wn as Lb,Bh as Mb,Su as Nb,_i as Ob,Ri as Pb,Zh as Qb,eb as Rb,Uu as Sb,tb as Tb,Ii as Ub,ps as Vb,ib as Wb,qu as Xb,lb as Yb,cb as Zb,Ke as _b,Em as $b,Qt as ac,Dm as bc,gb as cc,mb as dc,fb as ec,hb as fc,bb as gc,yb as hc,wb as ic,xb as jc,kb as kc,Mi as lc,Fi as mc,Eb as nc,Ui as oc,$b as pc};
|
|
963
|
-
//# sourceMappingURL=chunk-
|
|
963
|
+
//# sourceMappingURL=chunk-M3K5B3WH.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as l}from"./chunk-
|
|
1
|
+
import{a as l}from"./chunk-6ECXITK2.js";import{resolve as s}from"path";import{existsSync as h,readdirSync as p,mkdirSync as u,readFileSync as f,writeFileSync as m,renameSync as S}from"fs";var y=g=>{try{return p(g,{withFileTypes:!0}).filter(t=>t.isDirectory()).map(t=>t.name)}catch{return[]}},b=g=>{let t=s(g,"agents");return y(t).some(r=>y(s(t,r)).some(e=>h(s(t,r,e,"_index.md"))))};function w(g){for(let t of[g,s(g,".agentx/wiki")])if(b(t))return t;return null}var k=class{baseDir;agentsDir;mode;sharedStore;agentStores=new Map;log;constructor(t=s(process.cwd(),".agentx/wiki"),r=console.error.bind(console,"[wiki-hub]"),e="graph"){this.baseDir=t,this.agentsDir=s(t,"agents"),this.mode=e,this.log=r,u(this.agentsDir,{recursive:!0}),this.sharedStore=new l(t,r)}getMode(){return this.mode}getAgentWiki(t){let r=`${t}:${this.mode}`;if(this.agentStores.has(r))return this.agentStores.get(r);let e=s(this.agentsDir,t,this.mode),i=new l(e,this.log);return this.agentStores.set(r,i),i}getBaseDir(){return this.baseDir}getSharedStore(){return this.sharedStore}sharedScope(t){return[...this.listAgentDirs().filter(e=>e!==t).map(e=>({id:e,store:this.getAgentWiki(e)})),{id:"shared",store:this.sharedStore,skip:e=>e.startsWith("agents/")}]}listAgentDirs(){return h(this.agentsDir)?p(this.agentsDir).filter(t=>!t.startsWith("_")&&!t.startsWith(".")&&h(s(this.agentsDir,t,this.mode))).sort():[]}listAgents(t=this.sharedStore.listEntries()){let r=new Set;for(let e of t)r.add(e.agentId);if(h(this.agentsDir))for(let e of p(this.agentsDir))!e.startsWith("_")&&!e.startsWith(".")&&r.add(e);return[...r].sort()}getAgentEntries(t){return this.sharedStore.listEntries({agentId:t})}getUnabsorbedEntries(t){return this.classifyEntries(t).pending}markProcessed(t,r,e){let i=new Set(e),d=this.readLedger(t),c=new Date().toISOString();for(let n of r)d.entries[n]={at:c,cited:i.has(n)};let o=this.ledgerPath(t);u(s(o,".."),{recursive:!0});let a=`${o}.tmp`;m(a,`${JSON.stringify(d,null,2)}
|
|
2
2
|
`),S(a,o)}summary(){let t=this.sharedStore.listEntries(),r=new Map;for(let e of t){let i=r.get(e.agentId);i?i.push(e):r.set(e.agentId,[e])}return this.listAgents(t).map(e=>{let{all:i,cited:d,read:c,pending:o,articles:a}=this.classifyEntries(e,r.get(e)??[]);return{agentId:e,totalEntries:i.length,totalArticles:a.length,cited:d.length,readNotCited:c.length,unabsorbed:o.length,articles:a}})}classifyEntries(t,r=this.getAgentEntries(t)){let e=this.getAgentWiki(t).rebuildIndex().articles,i=new Set;for(let n of e)if(n.sources)for(let W of n.sources)i.add(W);let d=this.readLedger(t).entries,c=[],o=[],a=[];for(let n of r)i.has(n.id)?c.push(n):d[n.id]?o.push(n):a.push(n);return{all:r,cited:c,read:o,pending:a,articles:e}}syncedFrom(t){let r=s(this.agentsDir,t,"_synced.json");if(!h(r))return null;try{return JSON.parse(f(r,"utf-8"))}catch(e){return this.log(`synced marker ${r} is not valid JSON: ${e.message}`),{node:"unknown",peerUrl:"",at:""}}}markSynced(t,r){let e=s(this.agentsDir,t,"_synced.json");u(s(e,".."),{recursive:!0});let i=`${e}.tmp`;m(i,`${JSON.stringify(r,null,2)}
|
|
3
3
|
`),S(i,e)}ledgerPath(t){return s(this.agentsDir,t,"_absorbed.json")}readLedger(t){let r=this.ledgerPath(t);if(!h(r))return{entries:{}};try{return{entries:JSON.parse(f(r,"utf-8")).entries??{}}}catch(e){throw new Error(`absorb ledger ${r} is not valid JSON: ${e.message}`)}}};export{w as a,k as b};
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
4
|
+
//# sourceMappingURL=chunk-MM7U4PWY.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{Dc as S,rc as b,sc as k,vc as x}from"./chunk-
|
|
1
|
+
import{Dc as S,rc as b,sc as k,vc as x}from"./chunk-FWNP27H4.js";S();import{readFileSync as w,writeFileSync as v,existsSync as P}from"fs";import{resolve as d}from"path";function O(r){if(r)return d(r);let e=[d(process.cwd(),"agentx.json"),d(process.cwd(),".agentx/config.json")];for(let n of e)if(P(n))return n;return e[0]}function R(r){return JSON.parse(JSON.stringify(r))}async function C(r){try{let e=await fetch(`${r.replace(/\/$/,"")}/reload`,{method:"POST",signal:AbortSignal.timeout(3e3)});return e.ok?{ok:!0}:{ok:!1,reason:`HTTP ${e.status}`}}catch(e){return{ok:!1,reason:e?.cause?.code||e?.message||"unreachable"}}}async function N(r,e={}){let{validate:n=!0,dryRun:t=!1,reload:s=!0,configPath:l,daemonUrl:c}=e,o=O(l);if(!P(o))return{success:!1,path:o,error:`Config not found at ${o}. Run \`agentx init\` first.`};let g;try{g=w(o,"utf-8")}catch(a){return{success:!1,path:o,error:`Cannot read ${o}: ${a.message}`}}let p;try{p=JSON.parse(g)}catch(a){return{success:!1,path:o,error:`Invalid JSON in ${o}: ${a.message}`}}let i=R(p);try{await r(i)}catch(a){return{success:!1,path:o,error:`Mutator threw: ${a.message}`}}if(n){let a=k(i),u=b.safeParse(a);if(!u.success){let f=u.error.issues.map($=>` ${$.path.join(".")||"<root>"}: ${$.message}`).join(`
|
|
2
2
|
`);return{success:!1,path:o,error:`Validation failed:
|
|
3
3
|
${f}`,after:i}}let m=x(u.data);if(m.length)return{success:!1,path:o,error:`Validation failed:
|
|
4
4
|
${m.map(f=>` ${f}`).join(`
|
|
5
5
|
`)}`,after:i}}if(t)return{success:!0,path:o,after:i,dryRun:!0};try{v(o,JSON.stringify(i,null,2)+`
|
|
6
6
|
`)}catch(a){return{success:!1,path:o,error:`Write failed: ${a.message}`,after:i}}let h=!1,y;if(s){let a=c||M(i),u=await C(a);u.ok?h=!0:y=u.reason}return{success:!0,path:o,after:i,reloaded:h,reloadSkipped:y}}function M(r){let e=r?.node?.bind;if(!e)return"http://127.0.0.1:18800";let[n,t]=e.split(":");return`http://${n==="0.0.0.0"||n==="::"?"127.0.0.1":n}:${t}`}function A(r,e,n){let t=e.split("."),s=r;for(let l=0;l<t.length-1;l++){let c=t[l];(s[c]===void 0||s[c]===null)&&(s[c]={}),s=s[c]}s[t[t.length-1]]=n}function F(r,e){let n=e.split("."),t=r;for(let s of n){if(t==null)return;t=t[s]}return t}function U(r,e){let n=e.split("."),t=r;for(let s=0;s<n.length-1;s++){if(t==null)return;t=t[n[s]]}t!=null&&delete t[n[n.length-1]]}export{O as a,N as b,A as c,F as d,U as e};
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-Q6TGKWZE.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{v as p}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{v as p}from"./chunk-CF2R6BOX.js";import{b as i,c as u,d as l,e as c}from"./chunk-Q6TGKWZE.js";import d from"cronstrue";var f=Intl.DateTimeFormat().resolvedOptions().timeZone,g=600,E='Try: "every morning at 9", "weekdays at 6pm", "every 15 minutes", "every monday at 10am", "1st of every month at noon", "daily at 9:30am", "every hour"',m=/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;function x(e){return m.test(e)}function w(e){try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),!0}catch{return!1}}function S(e){return e?e.split(",").map(r=>r.trim().toLowerCase()).filter(r=>r==="log"||r==="notify"||r==="disable"):["log"]}function $(e){let r=[...e.onError??["log"]];e.notify&&!r.includes("notify")&&r.push("notify");let t={enabled:e.enabled??!0,schedule:e.parsed.cron,timezone:e.timezone||f,agent:e.agent,prompt:e.prompt,timeout:e.timeout??g,onError:r};return e.model&&(t.model=e.model),e.notify&&(t.notify=e.notify),e.notify&&e.deliverResult===!1&&(t.deliverResult=!1),e.report==="exceptions"&&(t.report="exceptions"),e.createdBy&&(t.createdBy=e.createdBy),e.approval&&(t.approval=e.approval),t}function P(e){return e.deliverResult===!1?"(failures only)":e.report==="exceptions"?"(exceptions and failures)":"(results and failures)"}function T(e){try{return d.toString(e,{use24HourTimeFormat:!1})}catch{return e}}function A(e,r,t=new Date){try{return p(e,t,r)}catch{return null}}function D(e,r){if(!e)return"unknown (no match within a year)";try{return`${new Intl.DateTimeFormat("en-GB",{timeZone:r,weekday:"short",day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)} (${r})`}catch{return e.toISOString()}}function y(e){return e?.approval?.action==="create"}async function R(e,r={}){let t="",o=await i(n=>{let a=l(n,`crons.${e}`);if(!a)throw new Error(`cron "${e}" not found`);let s=a.approval;if(!s)throw new Error(`cron "${e}" has no pending request`);s.action==="create"?(delete a.approval,a.enabled=!0,t=`${e} approved and enabled (requested by ${s.requestedBy})`):(c(n,`crons.${e}`),t=`${e} deletion approved; job removed (requested by ${s.requestedBy})`)},{configPath:r.configPath,reload:r.reload});return o.success?{success:!0,message:t,result:o}:{success:!1,message:o.error||"failed",result:o}}async function I(e,r={}){let t="",o=await i(n=>{let a=l(n,`crons.${e}`);if(!a)throw new Error(`cron "${e}" not found`);let s=a.approval;if(!s)throw new Error(`cron "${e}" has no pending request`);s.action==="create"?(c(n,`crons.${e}`),t=`${e} rejected; pending job removed`):(delete a.approval,t=`${e} deletion rejected; job kept`)},{configPath:r.configPath,reload:r.reload});return o.success?{success:!0,message:t,result:o}:{success:!1,message:o.error||"failed",result:o}}async function O(e,r,t={}){return i(o=>{let n=l(o,`crons.${e}`);if(!n)throw new Error(`cron "${e}" not found`);if(r&&y(n))throw new Error(`cron "${e}" is awaiting approval; run \`agentx schedule approve ${e}\``);u(o,`crons.${e}.enabled`,r)},{configPath:t.configPath,reload:t.reload})}export{f as a,E as b,x as c,w as d,S as e,$ as f,P as g,T as h,A as i,D as j,y as k,R as l,I as m,O as n};
|
|
2
|
+
//# sourceMappingURL=chunk-QU7ICYFR.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{y as l,z as T}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{y as l,z as T}from"./chunk-BTLADRMY.js";import{a,f as w}from"./chunk-72SZI2UW.js";T();w();var d="task-tier";function u(e){return{task:b(e.message,2e3),agent:e.agent,channel:e.channel??null,continuesExistingSession:e.isFollowUp??!1,...e.toolsAvailable?{toolsAvailable:e.toolsAvailable}:{}}}var c={needsFlagship:a("This task needs the strongest available model to be done correctly.",{true:"Doing it well takes real reasoning: writing or reviewing code, diagnosing a failure, planning work across several steps, weighing a judgement, handling money, touching production or anything irreversible, following a long or ambiguous instruction, or work where being subtly wrong would not be noticed. Anything where a weaker model would produce something that LOOKS right belongs here.",false:"It is mechanical and its result is obvious on sight: acknowledging or confirming a message, restating or formatting something already written, a greeting, a status echo, reading one file and reporting what it says, a lookup with one right answer, a scheduled heartbeat with nothing to decide."})};function g(e){return e.needsFlagship.noul}function b(e,n){return e.length>n?`${e.slice(0,n)}\u2026`:e}var h=.2;function p(e){return e==="voice"||e==="desktop"||e==="opencode"}var f=60*60*1e3;function M(e,n){if(e==="claude-code"){let t=n?.cheapModels?.[e]??n?.cheapModel;return t&&/^(claude-|haiku$|sonnet$|opus$)/.test(t)?t:void 0}if(e==="codex-cli"){let t=n?.cheapModels?.[e];return t&&/^(gpt-|o\d)/.test(t)?t:void 0}}async function v(e){let n=(s,r=null)=>({downgraded:!1,needsFlagship:r,reason:s});if(p(e.channel))return n(`${e.channel} requests retain the configured model`);if(!e.cheapModel)return n("no cheaper model configured");if(e.isFollowUp){let s=e.sessionIdleMs??0,r=e.cacheTtlMs??f;if(s<r)return n(`follow-up on a warm cache (idle ${Math.round(s/1e3)}s) \u2014 swapping would cost more than it saves`)}let t;try{t=await l(d,u(e),c,{incumbent:{needsFlagship:1},features:{agent:e.agent,channel:e.channel??"unknown"},timeoutMs:1500})}catch{return n("routing seat threw \u2014 keeping the flagship")}if(!t)return n("routing seat unavailable \u2014 keeping the flagship");let o=g(t.answers);if(t.mode!=="active")return n(`shadow \u2014 would ${o<(e.threshold??h)?"downgrade":"keep"} (${o.toFixed(2)})`,o);let i=e.threshold??h;return o>=i?n(`needs the flagship (${o.toFixed(2)})`,o):{model:e.cheapModel,downgraded:!0,needsFlagship:o,reason:`mechanical task (${o.toFixed(2)} below ${i}) \u2192 ${e.cheapModel}`}}var A=["labeled","unlabeled","closed"];function y(e){let n=r=>({downgraded:!1,needsFlagship:null,reason:r});if(p(e.channel))return n(`${e.channel} requests retain the configured model`);let t=e.eventActions??[];if(!t.length)return n("not started by a platform event");let o=e.triage?.actions??A,i=t.find(r=>!o.includes(r));if(i)return n(`"${i}" is not a triage action`);let s=M(e.tier,{cheapModels:e.triage?.models});if(!s)return n(`no triage model set for ${e.tier}`);if(e.isFollowUp){let r=e.sessionIdleMs??0,m=e.cacheTtlMs??f;if(r<m)return n(`follow-up on a warm cache (idle ${Math.round(r/1e3)}s) \u2014 keeping the session's model`)}return{model:s,downgraded:!0,needsFlagship:null,reason:`triage event (${t.join(", ")}) \u2192 ${s}`}}export{h as a,p as b,M as c,v as d,A as e,y as f};
|
|
2
|
+
//# sourceMappingURL=chunk-QZ24XACR.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Ze,b as k,c as D,d as ea,e as fe,f as he,g as H,h as be,i as L,j as N,n as aa,o as ta,p as ra,q as na}from"./chunk-EFGAPAYZ.js";import{e as Ve,i as Qe}from"./chunk-QAWKN2N4.js";import{b as me}from"./chunk-DODL5POT.js";import{$a as Xe,Aa as qe,Lb as Ge,Xa as Ke,Ya as Ye,Za as Je,c as Le,va as _}from"./chunk-
|
|
1
|
+
import{a as Ze,b as k,c as D,d as ea,e as fe,f as he,g as H,h as be,i as L,j as N,n as aa,o as ta,p as ra,q as na}from"./chunk-EFGAPAYZ.js";import{e as Ve,i as Qe}from"./chunk-QAWKN2N4.js";import{b as me}from"./chunk-DODL5POT.js";import{$a as Xe,Aa as qe,Lb as Ge,Xa as Ke,Ya as Ye,Za as Je,c as Le,va as _}from"./chunk-M3K5B3WH.js";import{a as V}from"./chunk-IMLAPB7G.js";import{b as Fe}from"./chunk-MRIVENBY.js";import{k as Be}from"./chunk-UBONPGNT.js";import{b as Q}from"./chunk-2VDO2HEK.js";import{c as Ne,e as We}from"./chunk-LQE73AZR.js";import{a as Z,b as Ue}from"./chunk-A24QXLEG.js";import{ia as G}from"./chunk-7GDFB4FS.js";import{b as ue}from"./chunk-7AB3QUGH.js";import{a as K,b as X}from"./chunk-Q6TGKWZE.js";import{s as ge,u as Oe}from"./chunk-3323WFVK.js";import{b as He}from"./chunk-MM7U4PWY.js";import{c as De,d as Me}from"./chunk-OWNQ2FD4.js";import{a as je}from"./chunk-ROLSSYXE.js";import{Dc as xe,J as le,M as F,Mb as Ee,S as Za,Tb as at,Va as ce,Wa as Pe,hb as et,oc as pe,sc as q,tc as Re}from"./chunk-FWNP27H4.js";import{existsSync as Y,readFileSync as xa,writeFileSync as ga,appendFileSync as lt,mkdirSync as ct}from"fs";import{dirname as pt,resolve as M}from"path";import{fileURLToPath as xt}from"url";import{hostname as gt}from"os";import{spawn as ut}from"child_process";var ve=`:root {
|
|
2
2
|
/* --- Brand (agentina) --------------------------------------------- */
|
|
3
3
|
--ax-blue: #2979FF;
|
|
4
4
|
--ax-blue-d: #1B5FD9;
|
|
@@ -2903,4 +2903,4 @@ tr:hover td { background: var(--bg-hover); }
|
|
|
2903
2903
|
${r}`).all(a,...t,...n).map(i=>({id:i.id,state:i.state,channel:i.channel,agentId:i.agent_id,text:i.text,createdAt:i.created_at})):[]}function Qo(e,a){return Ua(e,a,ce,"ORDER BY created_at")}function Zo(e,a,t=50){return Ua(e,a,[...ce,...Pe],"ORDER BY created_at DESC, rowid DESC LIMIT ?",Math.max(1,Math.min(t,500)))}at();var ze="member:",pr=90,xr="members",gr="tailscale-user-login",ur=400,mr=60*60*1e3;function fr(e){let a=e.scopes.find(t=>t.startsWith(ze));return a?a.slice(ze.length):null}function qa(e,a){if(!e)return null;let t=a.verify(e),r=t?fr(t):null;return t&&r?{rec:t,personId:r}:null}function ii(e,a){let t=e.people().find(s=>s.id===a);if(!t)return{ok:!1,error:`No person "${a}". Add them first: agentx people add ${a} --name "\u2026"`};let{token:r,record:n}=e.tokens.create({name:`${t.name} (machine not paired yet)`,scopes:[`${ze}${t.id}`],expiresInDays:pr}),{code:o,expiresAt:i}=e.codes.create({token:r,tokenId:n.id,name:t.id});return e.members.log({person:t.id,device:n.id,event:"invited"}),{ok:!0,code:o,expiresAt:i,tokenId:n.id,person:t}}var hr=Math.round(Ne/6e4);function br(e){return e==="client"?"Your project":"My work"}function si(e){let a=br(e.person.role),t=e.person.role==="client"?`I use AgentX to keep track of the work I do for you. It has a page for you, "${a}": what you asked us for, and where each request stands.`:`I use AgentX to give our AI agents their jobs. It has a page for you, "${a}": what you asked the agents for, and where each request stands.`;return[`Hi ${e.person.name},`,"",t,"","To open it:","1. Accept the Tailscale share I sent you. Tailscale is a small program that connects your computer to mine, privately.",`2. Open ${e.origin.replace(/\/+$/,"")}/member in Edge or Chrome, give your computer a name and type this code: ${We(e.code)}`,` The code works once, for ${hr} minutes. If it has stopped working, tell me and I will send you a new one.`,"","I then approve your machine, and the page opens by itself."].join(`
|
|
2904
2904
|
`)}var vr="The private network says someone else is connecting from this machine. Ask the person who invited you for a new code.",wr="Too many machines are waiting for the owner's answer. Try again later.",Fa="That code didn't work. Check it, or ask the person who invited you for a new one.",Ka=(e,a)=>{let t=e.headers[a];return(Array.isArray(t)?t[0]:t||"").trim()};function Ya(e){let a=e.socket?.remoteAddress||"";return a==="127.0.0.1"||a==="::1"||a==="::ffff:127.0.0.1"}function yr(e){if(!Ya(e))return null;let a=Ka(e,gr).toLowerCase();return a?a.slice(0,80):null}function kr(e){let a=e.socket?.remoteAddress||"unknown";if(!Ya(e))return a;let t=Ka(e,"x-forwarded-for").split(",").pop().trim();return/^[0-9a-fA-F:.]{2,45}$/.test(t)?t:a}function $r(e){return typeof e=="string"?e.replace(/[^\p{L}\p{N} ._'()-]/gu," ").replace(/\s+/g," ").trim().slice(0,60):""}function _r(e){return e.identities.map(Ee).filter(a=>!!a&&a.channel==="tailscale").map(a=>a.value)}async function di(e,a){let t=Date.now(),r=a.now??Date.now,n=a.log??(b=>console.log(b)),o=kr(e),i=a.limiter.retryAfter(o);if(i>0)return n(`[member] pair-code refused from ${o}: locked out for ${i}s more`),{status:429,body:{error:"too many attempts",retryAfter:i},retryAfter:i};let s=null,d="";try{let b=await Q(e,2048);s=b.code,d=$r(b.machine)}catch{}let l=a.codes.redeem(s),c=l?qa(l.token,a.tokens):null;if(await Cr(t,a.minMs??ur),!l||!c)return a.limiter.fail(o),n(`[member] pair-code failed from ${o}`),{status:401,body:{error:Fa}};a.limiter.succeed(o);let{rec:m,personId:g}=c,u=a.people().find(b=>b.id===g);if(!u)return a.tokens.revoke(m.id),a.members.log({person:g,device:m.id,event:"refused",address:o,detail:"person no longer listed"}),n(`[member] pair-code for ${g} refused from ${o}: person no longer listed`),{status:403,body:{error:Fa}};let x=yr(e),f=_r(u);if(f.length&&(!x||!f.includes(x)))return a.tokens.revoke(m.id),a.members.log({person:g,device:m.id,event:"refused",address:o,detail:`network login ${x??"missing"}; expected ${f.join(" or ")}`}),n(`[member] ${g}: pairing from ${o} refused: the network says "${x??"nobody"}", expected ${f.join(" or ")}`),{status:403,body:{error:vr}};let A=d||"Unnamed machine",y=u.name.slice(0,40),v=Oe(a.root,{title:`New machine for ${y}`,ask:`From ${o}, ${x?`network login ${x}`:"no network login reported"}. Machine name, as typed there: "${A}". Let it see their own work?`,recommend:`Yes if ${y} told you they just paired this machine. No if you did not expect it.`,if_silent:"discard",raised_by:xr},{now:r()});return v.ok?(a.members.add({tokenId:m.id,personId:g,name:A,state:"pending",cardId:v.card.id,address:o,...x?{network:x}:{},createdAt:new Date(r()).toISOString()}),a.members.log({person:g,device:m.id,event:"paired",address:o,detail:A}),n(`[member] ${g} paired "${A}" from ${o}; waiting for the owner (card ${v.card.id})`),{status:200,body:{person:g,name:A,state:"pending"},token:l.token}):(a.tokens.revoke(m.id),a.members.log({person:g,device:m.id,event:"refused",address:o,detail:v.error}),n(`[member] ${g}: pairing from ${o} refused: ${v.error}`),{status:503,body:{error:wr}})}var de="this machine is not paired",Sr="waiting for the owner to approve this machine";function Ja(e){return e?e.status==="decided"?e.verdict??null:e.status==="expired"?"no":null:null}function li(e,a){return a.state==="pending"&&a.cardId?Ja(ge(e,a.cardId)):null}function ci(e,a,t){let r=a.now??Date.now,n=a.log??(c=>console.log(c)),o=qa(e,a.tokens);if(!o)return{ok:!1,status:401,error:de};let{rec:i,personId:s}=o,d=a.members.byToken(i.id);if(!d||d.state==="removed"||d.personId!==s)return{ok:!1,status:401,error:de};if(a.people&&!a.people().some(c=>c.id===s))return Xa(a,i.id,"person no longer listed"),n(`[member] ${s}: "${d.name}" ended: person no longer listed`),{ok:!1,status:401,error:de};if(d.state==="pending"){let c=d.cardId?ge(a.root,d.cardId):null,m=Ja(c);if(m==="yes")d=a.members.update(i.id,{state:"active",approvedAt:new Date(r()).toISOString()})??d,a.members.log({person:s,device:i.id,event:"approved",detail:c?.decided_by}),n(`[member] ${s}: "${d.name}" approved`);else if(m==="no"){let g=c?.status==="expired"?"the owner did not answer in time":"the owner said no";return a.tokens.revoke(i.id),a.members.update(i.id,{state:"removed",removedAt:new Date(r()).toISOString(),removedReason:g}),a.members.log({person:s,device:i.id,event:"refused",detail:g}),n(`[member] ${s}: "${d.name}" refused: ${g}`),{ok:!1,status:401,error:de}}else return{ok:!1,status:403,error:Sr,waiting:!0}}let l=d.lastSeenAt?Date.parse(d.lastSeenAt):0;return t&&(r()-l>=mr||d.lastAddress!==t)&&(d=a.members.update(i.id,{lastSeenAt:new Date(r()).toISOString(),lastAddress:t})??d,a.members.log({person:s,device:i.id,event:"signed-in",address:t})),{ok:!0,device:d,personId:s,rec:i}}function Xa(e,a,t="removed by the owner"){let r=e.members.byToken(a);if(!r)return null;e.tokens.revoke(a);let n=e.members.update(a,{state:"removed",removedAt:new Date((e.now??Date.now)()).toISOString(),removedReason:t});return e.members.log({person:r.personId,device:a,event:"removed",detail:t}),n}function pi(e,a){return e.members.devices(a).filter(t=>t.state!=="removed").map(t=>Xa(e,t.tokenId,"person removed by the owner")).filter(t=>!!t)}async function Cr(e,a){let t=e+a-Date.now();t>0&&await new Promise(r=>setTimeout(r,t))}var Ga=["gitlab","github"];function Ar(e,a,t){let r=String(a||"").trim().toLowerCase();if(!Ga.includes(r))throw new Error(`Request status works on ${Ga.join(" and ")}, not on "${a}".`);e.requestStatus=e.requestStatus&&typeof e.requestStatus=="object"?e.requestStatus:{};let n=Array.isArray(e.requestStatus.channels)?e.requestStatus.channels.map(o=>String(o).toLowerCase()):[];return e.requestStatus.channels=t?[...new Set([...n,r])]:n.filter(o=>o!==r),`request status on ${r} is ${t?"on":"off"}`}function ui(e){return Array.isArray(e?.requestStatus?.channels)?e.requestStatus.channels.map(a=>String(a).toLowerCase()):[]}function mi(e){let{summary:a}=Z(t=>Ar(t,e?.channel,!!e?.enabled));return{summary:a}}var hi="https://myaccount.google.com/apppasswords";function bi(e){let a=e.split("@")[1]?.toLowerCase()??"";if(a==="gmail.com"||a==="googlemail.com")return{imapHost:"imap.gmail.com",imapPort:993,smtpHost:"smtp.gmail.com",smtpPort:465}}function vi(e){let a=e.user&&e.user!==e.address?{user:e.user}:{};return{agent:e.agent,address:e.address,imap:{host:e.imapHost,port:e.imapPort,secure:e.imapPort===993,...a,password:`\${${e.passwordEnv}}`},smtp:{host:e.smtpHost,port:e.smtpPort,secure:e.smtpPort===465},allowFrom:e.allowFrom,send:e.send}}function wi(e){return`EMAIL_${e.toUpperCase().replace(/[^A-Z0-9]/g,"_")}_PASSWORD`}function $i(e){return`${e.name} <${e.from}> via ${e.host}:${e.port}`}async function _i(e,a){return Be({host:e.host,port:e.port,secure:e.secure,user:e.user,password:e.password},{name:e.name,address:e.from},a,{"Auto-Submitted":"auto-generated"})}function Si(e,a){return{to:e,subject:`${a.name}: test mail`,text:[`This is a test mail from ${a.name}.`,"","If it reached you, AgentX can send mail through this sender.","You can ignore it."].join(`
|
|
2905
2905
|
`)}}function Ai(e){return new Set(Object.entries(e).filter(([,a])=>a?.wiki?.absorb?.enabled===!1).map(([a])=>a))}function Ti(e,a){return a.only?{agents:[a.only],skipped:[]}:{agents:e.filter(t=>!a.off.has(t)),skipped:e.filter(t=>a.off.has(t))}}function Ii(e,a){return`absorb is off for this agent (agents.${e}.wiki.absorb.enabled); skipped.${e===a?" It reads the wiki notes inbox, so the inbox was not read.":""} Use --agent ${e} to run it anyway.`}function zi(e,a){if(a){if(!e.wiki?.absorb)return;delete e.wiki.absorb.enabled,Object.keys(e.wiki.absorb).length===0&&delete e.wiki.absorb,Object.keys(e.wiki).length===0&&delete e.wiki;return}e.wiki??={},e.wiki.absorb??={},e.wiki.absorb.enabled=!1}var Tr="https://ntfy.sh";function Ei(e){return{enabled:!!e?.enabled,server:e?.server||Tr,topicSet:!!e?.topic,tokenSet:!!e?.token}}function Ri(e,a){let t={...e??{}};if("enabled"in a&&(t.enabled=!!a.enabled),"server"in a){let r=String(a.server).trim().replace(/\/+$/,"");if(!/^https?:\/\/\S+$/.test(r))throw new Error("ntfy server must be an http(s) URL");t.server=r}if("topic"in a){let r=String(a.topic).trim();if(!r)throw new Error("ntfy topic cannot be empty");t.topic=r}if("token"in a){let r=String(a.token??"").trim();r?t.token=r:delete t.token}if(t.enabled&&!t.topic)throw new Error("set a topic before enabling ntfy");return t}Za();function Va(e){return/^(agent|person):/.test(e)?F(e):`person:${e}`}function ji(e){let a=(e?.projects??[]).filter(t=>t?.id);return a.map(t=>({id:t.id,name:t.name?.trim()||t.id,client:Le(t.id,a),...t.pm?{pm:F(t.pm)}:{},...t.lead?{lead:Va(t.lead)}:{},team:[...new Set((t.team??[]).filter(Boolean).map(F))]})).sort((t,r)=>t.client.localeCompare(r.client)||t.name.localeCompare(r.name)||t.id.localeCompare(r.id))}function Hi(e,a,t){if(!t.lead&&!t.team?.length)return;let r=new Set(Object.keys(e.business?.orgChart||{})),n=new Set((e.people||[]).map(i=>String(i.id))),o={id:a,name:a,client:"",...t.lead?{lead:Va(t.lead)}:{},team:(t.team??[]).map(F)};return Ir([o],r,n)}function Ir(e,a,t){let r=n=>{let o=le(n);return o.kind==="agent"?a.has(o.id)?void 0:`"${o.id}", which is not an agent in business.orgChart`:t.has(o.id)?void 0:`"${o.id}", which is not a person in people`};for(let n of e){if(n.lead){if(le(n.lead).kind!=="person")return`Project ${n.name} is led by "${n.lead}"; a lead is a person (person:<id>), the PM is the agent`;let o=r(n.lead);if(o)return`Project ${n.name} is led by ${o}`}for(let o of n.team){let i=r(o);if(i)return`Project ${n.name} has ${i} in its team`}}}export{ve as a,da as b,ye as c,nt as d,ot as e,it as f,ua as g,mt as h,_n as i,Sn as j,Cn as k,ko as l,Co as m,Ba as n,Yo as o,Jo as p,Rn as q,On as r,It as s,Et as t,ke as u,Dn as v,Mn as w,Rt as x,Bn as y,Un as z,Fn as A,Vo as B,Qo as C,Zo as D,pr as E,xr as F,ii as G,hr as H,br as I,si as J,vr as K,wr as L,yr as M,kr as N,$r as O,_r as P,di as Q,Ja as R,li as S,ci as T,Xa as U,pi as V,Ga as W,Ar as X,ui as Y,mi as Z,hi as _,bi as $,vi as aa,wi as ba,$i as ca,_i as da,Si as ea,Ai as fa,Ti as ga,Ii as ha,zi as ia,Ei as ja,Ri as ka,Va as la,ji as ma,Hi as na,Ir as oa,Qt as pa,go as qa,vo as ra,wo as sa};
|
|
2906
|
-
//# sourceMappingURL=chunk-
|
|
2906
|
+
//# sourceMappingURL=chunk-SJXWBL72.js.map
|