agentix-cli 0.120.0 → 0.121.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-XMSNIAU6.js → App-AMIGKAXO.js} +2 -2
- package/dist/{ChatApp-BFYTIQF3.js → ChatApp-WMI4HQSY.js} +2 -2
- package/dist/{agent-63RXZRL2.js → agent-TQQOAVMU.js} +2 -2
- package/dist/article-sync-TLZTHRZB.js +2 -0
- package/dist/article-sync-TLZTHRZB.js.map +1 -0
- package/dist/{board-dashboard-XQEZBQL5.js → board-dashboard-FNMZAP7A.js} +4 -4
- package/dist/{chunk-B6OXEIOF.js → chunk-25XR6QK2.js} +2 -2
- package/dist/{chunk-4PQREYBU.js → chunk-2IMK3NGJ.js} +2 -2
- package/dist/{chunk-247SOQLP.js → chunk-2NGXOYTS.js} +67 -67
- package/dist/chunk-2NGXOYTS.js.map +1 -0
- package/dist/{chunk-6PC4EZ4P.js → chunk-43CLFC4B.js} +2 -2
- package/dist/{chunk-NDPU6AX2.js → chunk-4GDLXWCH.js} +2 -2
- package/dist/{chunk-2G227TF3.js → chunk-6TUQHOO3.js} +2 -2
- package/dist/{chunk-RJBRYUKU.js → chunk-7KY7EEEI.js} +2 -2
- package/dist/{chunk-IOYRRGK7.js → chunk-BLEW5WQL.js} +2 -2
- package/dist/{chunk-S6NQB7VV.js → chunk-BWHHZJNJ.js} +3 -3
- package/dist/chunk-BWHHZJNJ.js.map +1 -0
- package/dist/{chunk-KQX3U3H2.js → chunk-CAS2IWSM.js} +2 -2
- package/dist/chunk-DJQMG6TH.js +4 -0
- package/dist/chunk-DJQMG6TH.js.map +1 -0
- package/dist/{chunk-U46G24CD.js → chunk-EI7D5V2L.js} +2 -2
- package/dist/{chunk-FTZCNID3.js → chunk-ELUEF4NC.js} +2 -2
- package/dist/{chunk-FSXWNVGL.js → chunk-H5Z42X7W.js} +2 -2
- package/dist/{chunk-PCOXSCYT.js → chunk-I4IDZSGF.js} +5 -5
- package/dist/{chunk-HK7TU5NX.js → chunk-IKBWV7YJ.js} +2 -2
- package/dist/{chunk-UAPWOE2W.js → chunk-MORRCYJE.js} +9 -9
- package/dist/chunk-MORRCYJE.js.map +1 -0
- package/dist/{chunk-IMLLHT7U.js → chunk-OPNZWQ6Y.js} +9 -9
- package/dist/{chunk-IMLLHT7U.js.map → chunk-OPNZWQ6Y.js.map} +1 -1
- package/dist/{chunk-NG677JHW.js → chunk-PAWCJIPZ.js} +2 -2
- package/dist/{chunk-AXFE34OV.js → chunk-RMA7KKR7.js} +2 -2
- package/dist/{chunk-6JJJ5MUU.js → chunk-Y4PR5LR3.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/{client-TSYZXEH7.js → client-ICDRAZBU.js} +2 -2
- package/dist/{config-QAE3LNFQ.js → config-K4UYPR7W.js} +2 -2
- package/dist/config-mutator-IGA6D4S5.js +2 -0
- package/dist/{doctor-PVLVKLRA.js → doctor-LRTOOCM6.js} +2 -2
- package/dist/index.d.ts +76 -2
- package/dist/index.js +1 -1
- package/dist/{program-E3NTPNCZ.js → program-OKPC77BN.js} +220 -220
- package/dist/program-OKPC77BN.js.map +1 -0
- package/dist/{promote-IRBBEXGG.js → promote-4LW53AMH.js} +2 -2
- package/dist/{query-R6YELRQN.js → query-4OPS5PET.js} +2 -2
- package/dist/{registry-HIZIFAVH.js → registry-YHSHGJ4K.js} +2 -2
- package/dist/{request-planner-CRG3OGGG.js → request-planner-GDXSBNN4.js} +2 -2
- package/dist/{review-candidates-6YIBOEEG.js → review-candidates-TUVDG2LR.js} +2 -2
- package/dist/{routing-G33LLOTF.js → routing-OKDZ4VYH.js} +2 -2
- package/dist/schedule-tool-MJLXMXN5.js +2 -0
- package/dist/scheduler-E5SASFAH.js +2 -0
- package/dist/{seat-IJN7NETF.js → seat-K6FNHYMY.js} +2 -2
- package/dist/{select-D7AZ2XZF.js → select-QMJXHNUP.js} +2 -2
- package/dist/{set-enabled-5YSDIQXU.js → set-enabled-I77LPL6Q.js} +2 -2
- package/dist/{tool-XADSW6NL.js → tool-BQUKONSF.js} +2 -2
- package/dist/{tool-GQIQWHWB.js → tool-QTGNWXUA.js} +2 -2
- package/dist/wiki-F6EZBBUH.js +2 -0
- package/package.json +1 -1
- package/dist/chunk-23SQSUBI.js +0 -3
- package/dist/chunk-23SQSUBI.js.map +0 -1
- package/dist/chunk-247SOQLP.js.map +0 -1
- package/dist/chunk-S6NQB7VV.js.map +0 -1
- package/dist/chunk-UAPWOE2W.js.map +0 -1
- package/dist/config-mutator-WRQ7MFQL.js +0 -2
- package/dist/program-E3NTPNCZ.js.map +0 -1
- package/dist/schedule-tool-IP7ZCQKI.js +0 -2
- package/dist/scheduler-QXLPYSNJ.js +0 -2
- package/dist/wiki-R4MNLBXE.js +0 -2
- /package/dist/{App-XMSNIAU6.js.map → App-AMIGKAXO.js.map} +0 -0
- /package/dist/{ChatApp-BFYTIQF3.js.map → ChatApp-WMI4HQSY.js.map} +0 -0
- /package/dist/{agent-63RXZRL2.js.map → agent-TQQOAVMU.js.map} +0 -0
- /package/dist/{board-dashboard-XQEZBQL5.js.map → board-dashboard-FNMZAP7A.js.map} +0 -0
- /package/dist/{chunk-B6OXEIOF.js.map → chunk-25XR6QK2.js.map} +0 -0
- /package/dist/{chunk-4PQREYBU.js.map → chunk-2IMK3NGJ.js.map} +0 -0
- /package/dist/{chunk-6PC4EZ4P.js.map → chunk-43CLFC4B.js.map} +0 -0
- /package/dist/{chunk-NDPU6AX2.js.map → chunk-4GDLXWCH.js.map} +0 -0
- /package/dist/{chunk-2G227TF3.js.map → chunk-6TUQHOO3.js.map} +0 -0
- /package/dist/{chunk-RJBRYUKU.js.map → chunk-7KY7EEEI.js.map} +0 -0
- /package/dist/{chunk-IOYRRGK7.js.map → chunk-BLEW5WQL.js.map} +0 -0
- /package/dist/{chunk-KQX3U3H2.js.map → chunk-CAS2IWSM.js.map} +0 -0
- /package/dist/{chunk-U46G24CD.js.map → chunk-EI7D5V2L.js.map} +0 -0
- /package/dist/{chunk-FTZCNID3.js.map → chunk-ELUEF4NC.js.map} +0 -0
- /package/dist/{chunk-FSXWNVGL.js.map → chunk-H5Z42X7W.js.map} +0 -0
- /package/dist/{chunk-PCOXSCYT.js.map → chunk-I4IDZSGF.js.map} +0 -0
- /package/dist/{chunk-HK7TU5NX.js.map → chunk-IKBWV7YJ.js.map} +0 -0
- /package/dist/{chunk-NG677JHW.js.map → chunk-PAWCJIPZ.js.map} +0 -0
- /package/dist/{chunk-AXFE34OV.js.map → chunk-RMA7KKR7.js.map} +0 -0
- /package/dist/{chunk-6JJJ5MUU.js.map → chunk-Y4PR5LR3.js.map} +0 -0
- /package/dist/{client-TSYZXEH7.js.map → client-ICDRAZBU.js.map} +0 -0
- /package/dist/{config-QAE3LNFQ.js.map → config-K4UYPR7W.js.map} +0 -0
- /package/dist/{config-mutator-WRQ7MFQL.js.map → config-mutator-IGA6D4S5.js.map} +0 -0
- /package/dist/{doctor-PVLVKLRA.js.map → doctor-LRTOOCM6.js.map} +0 -0
- /package/dist/{promote-IRBBEXGG.js.map → promote-4LW53AMH.js.map} +0 -0
- /package/dist/{query-R6YELRQN.js.map → query-4OPS5PET.js.map} +0 -0
- /package/dist/{registry-HIZIFAVH.js.map → registry-YHSHGJ4K.js.map} +0 -0
- /package/dist/{request-planner-CRG3OGGG.js.map → request-planner-GDXSBNN4.js.map} +0 -0
- /package/dist/{review-candidates-6YIBOEEG.js.map → review-candidates-TUVDG2LR.js.map} +0 -0
- /package/dist/{routing-G33LLOTF.js.map → routing-OKDZ4VYH.js.map} +0 -0
- /package/dist/{schedule-tool-IP7ZCQKI.js.map → schedule-tool-MJLXMXN5.js.map} +0 -0
- /package/dist/{scheduler-QXLPYSNJ.js.map → scheduler-E5SASFAH.js.map} +0 -0
- /package/dist/{seat-IJN7NETF.js.map → seat-K6FNHYMY.js.map} +0 -0
- /package/dist/{select-D7AZ2XZF.js.map → select-QMJXHNUP.js.map} +0 -0
- /package/dist/{set-enabled-5YSDIQXU.js.map → set-enabled-I77LPL6Q.js.map} +0 -0
- /package/dist/{tool-XADSW6NL.js.map → tool-BQUKONSF.js.map} +0 -0
- /package/dist/{tool-GQIQWHWB.js.map → tool-QTGNWXUA.js.map} +0 -0
- /package/dist/{wiki-R4MNLBXE.js.map → wiki-F6EZBBUH.js.map} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{a as D,b as _}from"./chunk-RKPAVWXF.js";import{a as R,b as q,c as O,d as B,f as k,g as v,h as E,i as w,j as y}from"./chunk-
|
|
1
|
+
import{a as D,b as _}from"./chunk-RKPAVWXF.js";import{a as R,b as q,c as O,d as B,f as k,g as v,h as E,i as w,j as y}from"./chunk-BLEW5WQL.js";import{a as T,b as C,c as I,d as x,e as P}from"./chunk-2IMK3NGJ.js";import{existsSync as X,readFileSync as F}from"fs";var J=new Set(["cron","heartbeat","api","a2a","mesh"]),M=160;function s(n){return typeof n=="string"&&n.trim()?n.trim():void 0}function S(n,e=M){let t=n.replace(/\s+/g," ").trim();return t.length>e?`${t.slice(0,e-1)}\u2026`:t}function V(n){let e=T(n);if(!X(e))throw new Error(`config not found at ${e}`);return JSON.parse(F(e,"utf-8"))}function W(n,e){return n?.agents?.[e]?.admin===!0}function Y(n,e,t){return W(n,t.agentId)||e?.createdBy===t.agentId}function Z(n,e){let t=e?.createdBy?`agent "${e.createdBy}"`:"the operator";return`Not allowed: "${n}" was created by ${t}. Agents manage only schedules they created (unless configured admin).`}function K(n,e){let t=s(n.notify);if(t!=="none"){if(t&&t!=="here"){let r=t.split(":");return r.length<2||!r[0]||!r[1]?"invalid":{channel:r[0],chatId:r.slice(1).join(":")}}if(e.channel&&e.chatId&&!J.has(e.channel))return{channel:e.channel,chatId:e.chatId,...e.accountId?{accountId:e.accountId}:{}}}}function Q(n,e,t){let r=e.timezone||"UTC",d=e.enabled&&!y(e)?w(E(e.schedule,r,t),r):"\u2014",h=e.approval?`pending ${e.approval.action} approval`:e.enabled?"active":"paused",f=[`- ${n} [${h}] ${e.schedule} \u2014 ${v(e.schedule)} (${r})`,` agent: ${e.agent}; created by: ${e.createdBy||"operator"}; next: ${d}`];return e.notify&&f.push(` notify: ${e.notify.channel} ${e.notify.chatId}${e.deliverResult===!1?" (failures only)":" (results and failures)"}`),e.command?f.push(` command: ${S(String(e.command))}`):e.prompt&&f.push(` prompt: ${S(String(e.prompt))}`),f.join(`
|
|
2
2
|
`)}async function b(n,e,t){let r=n?.notifications?.destination;if(!r?.channel||!r?.chatId)return"No operator notification destination is configured (notifications.destination); the operator must check `agentx schedule list`.";if(!e.notifyOperator)return"Operator notification is unavailable in this context.";try{return await e.notifyOperator({channel:r.channel,chatId:r.chatId,accountId:r.accountId},t),"The operator has been notified."}catch(d){return`Could not notify the operator (${d?.message??d}); the request is still recorded.`}}async function re(n,e,t={}){let r=(s(n.action)||"list").toLowerCase(),d=t.now?t.now():new Date,h;try{h=V(t.configPath)}catch(a){return`Error: ${a.message}`}let f=h.crons||{};if(r==="list"){let a=n.mine===!0,l=Object.entries(f).filter(([,i])=>!a||e&&i?.createdBy===e.agentId);return l.length?l.map(([i,p])=>Q(i,p,d)).join(`
|
|
3
3
|
`):a?"You have no schedules.":"No schedules."}if(!e?.agentId)return"Error: caller agent is unknown (AGENTX_AGENT_ID not set). Pass callerAgentId.";if(!h.agents?.[e.agentId])return`Error: caller "${e.agentId}" is not an agent on this node.`;let o=s(n.id),m=a=>C(a,{configPath:t.configPath,reload:t.reload});if(r==="create"){let a=s(n.when),l=s(n.prompt);if(!a||!l)return"Error: create needs `when` (plain English) and `prompt`.";let i=D(a);if(!i)return`Error: couldn't parse "${a}". ${q}.`;let p=s(n.agent)||e.agentId;if(!h.agents?.[p])return`Error: agent "${p}" not found on this node.`;let g=s(n.timezone)||R;if(!B(g))return`Error: unknown timezone "${g}".`;let u=o||_(i.matched,p);if(!O(u))return`Error: invalid id "${u}" (letters, digits, "-" and "_" only).`;if(f[u])return`Error: a schedule "${u}" already exists. Pick another \`id\`.`;let $=K(n,e);if($==="invalid")return'Error: `notify` must be "here", "none", or "channel:chatId".';let z={action:"create",requestedBy:e.agentId,requestedAt:d.toISOString()},L=k({parsed:i,agent:p,prompt:l,timezone:g,notify:$,enabled:!1,createdBy:e.agentId,approval:z}),A=await m(U=>I(U,`crons.${u}`,L));if(!A.success)return`Error: ${A.error}`;let N=w(E(i.cron,g,d),g),G=[`Schedule approval requested by ${e.agentId}`,`Create: ${u}`,`When: ${i.human} \u2014 cron \`${i.cron}\` (${g})`,`Next fire: ${N}`,`Agent: ${p}`,$?`Results and failures go to: ${$.channel} ${$.chatId}${$.channel==="voice"?" (as a push notification)":""}`:"Results go to: run log only (no chat)",`Prompt: ${S(l,400)}`,"",`Approve: agentx schedule approve ${u}`,`Reject: agentx schedule reject ${u}`].join(`
|
|
4
4
|
`),H=await b(h,t,G);return[`Requested schedule "${u}": ${i.human} (cron ${i.cron}, ${g}); next fire would be ${N}.`,"It is saved DISABLED and will not run until the operator approves it.",H].join(`
|
|
5
5
|
`)}if(!o)return`Error: ${r} needs \`id\`.`;let c=f[o];if(!c)return`Error: schedule "${o}" not found.`;if(!Y(h,c,e))return Z(o,c);if(r==="pause"||r==="resume"){let a=r==="resume";if(a&&y(c))return`"${o}" is still awaiting operator approval; it can't be resumed until approved.`;if(c.enabled===a)return`"${o}" is already ${a?"active":"paused"}.`;let l=await m(i=>I(i,`crons.${o}.enabled`,a));return l.success?`"${o}" ${a?"resumed":"paused"}.`:`Error: ${l.error}`}if(r==="delete"){if(y(c)&&c.approval.requestedBy===e.agentId){let u=await m($=>P($,`crons.${o}`));return u.success?`Withdrew the pending request "${o}".`:`Error: ${u.error}`}if(y(c))return`"${o}" is a creation request still awaiting approval; only its requester or the operator (\`agentx schedule reject ${o}\`) can drop it.`;if(c.approval?.action==="delete")return`Deletion of "${o}" is already awaiting approval.`;let a={action:"delete",requestedBy:e.agentId,requestedAt:d.toISOString()},l=await m(u=>{if(!x(u,`crons.${o}`))throw new Error(`schedule "${o}" not found`);I(u,`crons.${o}.approval`,a)});if(!l.success)return`Error: ${l.error}`;let i=c.timezone||"UTC",p=[`Schedule approval requested by ${e.agentId}`,`Delete: ${o}`,`When: ${v(c.schedule)} \u2014 cron \`${c.schedule}\` (${i})`,`Next fire: ${c.enabled?w(E(c.schedule,i,d),i):"\u2014 (paused)"}`,`Agent: ${c.agent}`,"",`Approve: agentx schedule approve ${o}`,`Reject: agentx schedule reject ${o}`].join(`
|
|
6
6
|
`),g=await b(h,t,p);return[`Deletion of "${o}" requested. It keeps its current state until the operator approves.`,g].join(`
|
|
7
7
|
`)}return`Error: unknown action "${r}". Use list, create, pause, resume or delete.`}function oe(n,e=process.env){let t=s(e.AGENTX_AGENT_ID)||s(n.callerAgentId);if(!t)return null;let r=!!(s(e.AGENTX_CHANNEL)&&s(e.AGENTX_CHAT_ID)),d=s(r?e.AGENTX_CHANNEL:n.channel),h=s(r?e.AGENTX_CHAT_ID:n.chatId),f=s(n.accountId);return{agentId:t,channel:d,chatId:h,...f?{accountId:f}:{}}}export{re as a,oe as b};
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
8
|
+
//# sourceMappingURL=chunk-PAWCJIPZ.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
|
${c}`,is_error:!0}:{tool_use_id:e.id,content:c||"(no output)"}}async editFile(e){let t=String(e.input.path||""),o=e.input.edits,n=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:n,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 re.readFile(n,"utf8"),c=[];for(let a of o)i.includes(a.old_text)?(i=i.replace(a.old_text,a.new_text),c.push(`Replaced: "${a.old_text.slice(0,40)}..."`)):c.push(`Not found: "${a.old_text.slice(0,40)}..."`);return this.options.dryRun||await re.writeFile(n,i,"utf8"),f.has("post:file-write")&&await f.execute("post:file-write",{event:"post:file-write",file:n,fileContent:i,cwd:this.cwd}),{tool_use_id:e.id,content:`Edited ${t}:
|
|
50
50
|
${c.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||""),n=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||""),n=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-YHSHGJ4K.js"),c=i();if(!c)return{tool_use_id:e.id,content:"Sub-agent spawning requires the daemon to be running.",is_error:!0};let p=await new s(c).spawn({targetAgentId:t,prompt:o,parentAgentId:"orchestrator",timeout:n*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,n=t;return o?.length&&(n+=`
|
|
54
54
|
Options: ${o.join(", ")}`),{tool_use_id:e.id,content:"Question sent to user.",followUp:n}}};async function Ae(r){let{provider:e,systemPrompt:t,messages:o,providerOptions:n,cwd:s,maxIterations:i=20,enabledTools:c,interactive:a=!0,overwrite:p=!1,dryRun:l=!1,onProgress:d,abortSignal:u}=r,m=u?{...n,abortSignal:u}:n;if(!e.generateRaw)return dt(r);let I=new se(s,{interactive:a,overwrite:p,dryRun:l,acmeContext:r.acmeContext,abortSignal:u}),D=be(c);if(r.acmeContext)for(let g of at)D.push({name:g.name,description:g.description,input_schema:g.input_schema});let E=new Set;if(r.mcpTools?.length)for(let g of r.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,A=0,O="",j,_=0;for(;_<i;){if(_++,u?.aborted)throw new Error("cancelled");d?.({type:"iteration_start",iteration:_}),b.step(_,`Agentic loop iteration (${D.length} tools available)`);let g,M=!!e.generateRawStream&&!!d;try{if(M){let T=null,U=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"?T=x.result:x.type==="error"&&(U=x.error);if(U&&!T)throw new Error(U);if(!T)throw new Error("generateRawStream returned no raw_result event");g=T,g._streamedText=v}else g=await e.generateRaw(C,t,D,m)}catch(T){if(T.message?.includes("not available"))return dt(r);throw T}G+=g.usage.input_tokens+g.usage.output_tokens,F+=g.usage.input_tokens,A+=g.usage.output_tokens;let P=g._streamedText;for(let T of g.content)T.type==="text"&&(O+=T.text,P===void 0&&d?.({type:"text_delta",text:T.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 T=g.content.filter(v=>v.type==="tool_use");if(T.length===0)break;C.push({role:"assistant",content:g.content});let U=[];for(let v of T){d?.({type:"tool_call",name:v.name,id:v.id,input:v.input}),b.step(_,`Tool call: ${v.name}`);let x;if(E.has(v.name)&&r.mcpDispatch){let h=await r.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),U.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:U}),j)break;continue}break}return d?.({type:"complete",iterations:_,totalTokens:G}),{files:B,content:O,followUp:j,tokensUsed:G,inputTokens:F||void 0,outputTokens:A||void 0,iterations:_}}async function dt(r){let{provider:e,systemPrompt:t,messages:o,providerOptions:n,maxIterations:s=5}=r,c=[{role:"system",content:t+`
|
|
@@ -123,4 +123,4 @@ ${r.projectInstructions}`),r.memoryContext&&o.push(r.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{qe as a,Vt as b,Yt as c,We as d,ze as e,Ve as f,Ye as g,Pe as h,ee as i,Re as j,le as k,te as l,Tt as m,oe as n,Mt as o,f as p,et as q,tt as r,Me as s,de as t,W as u,ne as v,it as w,Ee as x,$e as y,se as z,mt as A,Zn as B,er as C};
|
|
126
|
-
//# sourceMappingURL=chunk-
|
|
126
|
+
//# sourceMappingURL=chunk-RMA7KKR7.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as j,b as O,c as T,d as D,e as _,j as E}from"./chunk-
|
|
1
|
+
import{a as j,b as O,c as T,d as D,e as _,j as E}from"./chunk-ELUEF4NC.js";import{c as R}from"./chunk-56KNKUFF.js";import{y as W,z as I}from"./chunk-4GDLXWCH.js";import{b as v,c as C}from"./chunk-QOYAX2FT.js";import{readFileSync as Y,existsSync as B}from"fs";I();import{resolve as x}from"path";import{execSync as L}from"child_process";async function nt(n,a,o,t={}){let p=t.selectorModel??"haiku",g=t.synthModel??"sonnet",l=t.maxCandidates??3,r=t.maxHops??2,s=t.maxArticles??8,h=t.timeoutMs??6e4,u=t.log??console.error.bind(console,"[wiki-query]"),m=t.messagePath?.length?t.messagePath:void 0,w=t.graphWeight??$,i=x(a.baseDir,"_index.md");if(!B(i))return A("no-catalog",n,"No _index.md found \u2014 run `agentx wiki status` to rebuild.");let e=Y(i,"utf-8"),d=Date.now(),f=[],y="";try{let c=await G(n,a,o,l,m,w);c?(f=c,y=`[wiki-rerank seat] ${c.map(k=>k.title).join(" | ")}`):(y=await N(q(n,e,l,m),p,h),f=K(y))}catch(c){return u("selector failed:",c?.message),{...A("error",n,`Selector: ${c?.message||"unknown"}`),trace:{selectorMs:Date.now()-d,synthesisMs:0,selectorOutput:y}}}let S=Date.now()-d;if(f.length===0)return{...A("no-candidates",n,"Selector returned no candidates."),trace:{selectorMs:S,synthesisMs:0,selectorOutput:y}};let b=F(f,a,o,r,s);if(b.length===0)return{...A("no-candidates",n,"Candidates did not resolve to readable articles."),candidates:f,trace:{selectorMs:S,synthesisMs:0,selectorOutput:y}};let M=Date.now(),P="";try{P=await N(J(n,b),g,h*2)}catch(c){return u("synthesis failed:",c?.message),{...A("error",n,`Synthesis: ${c?.message||"unknown"}`),candidates:f,walked:b.map(k=>({title:k.meta.title,path:k.path,type:k.meta.type,hop:k.hop??0})),trace:{selectorMs:S,synthesisMs:Date.now()-M,selectorOutput:y}}}let Q=Date.now()-M;return{answer:P.trim(),citations:b.map(c=>({title:c.meta.title,path:c.path,type:c.meta.type})),candidates:f,walked:b.map(c=>({title:c.meta.title,path:c.path,type:c.meta.type,hop:c.hop??0})),status:"ok",trace:{selectorMs:S,synthesisMs:Q,selectorOutput:y}}}function A(n,a,o){return{answer:"",citations:[],candidates:[],walked:[],status:n,error:o}}function F(n,a,o,t,p){let g=new Map;for(let s of a.listArticles(o||""))g.set(s.meta.title.toLowerCase(),s.path);let l=new Map,r=[];for(let s of n)l.has(s.path)||r.push({path:s.path,hop:0});for(;r.length&&l.size<p;){let s=r.shift();if(l.has(s.path)||s.hop>t)continue;let h=o?a.readArticleAs(s.path,o):a.readArticle(s.path);if(h&&(l.set(s.path,{...h,hop:s.hop}),!(s.hop>=t)))for(let u of h.meta.related||[]){let m=g.get(u.toLowerCase());m&&!l.has(m)&&r.push({path:m,hop:s.hop+1})}}return Array.from(l.values())}async function G(n,a,o,t,p,g=$){try{let r=(a.rebuildIndex().articles??[]).filter(i=>i.path&&!i.path.includes("/_versions/"));if(r.length<2)return null;let h=H(n,r,p,g).slice(0,O).map(i=>({id:`k${i}`,title:r[i].title||r[i].path,tags:r[i].tags,excerpt:[r[i].type?`type: ${r[i].type}`:"",(r[i].related??[]).length?`related: ${(r[i].related??[]).join(", ")}`:"",(r[i].graphPath??[]).length?`graph: ${(r[i].graphPath??[]).join(" \u203A ")}`:""].filter(Boolean).join(" \xB7 ")})),u=await W(j,T({query:n,candidates:h,excerptChars:300}),D(h),{features:{agent:o??"unknown",stage:"catalog-selector"}});if(!u||u.mode!=="active")return null;let w=_(u.answers,h).ranked.slice(0,t).map(i=>r[Number(i.slice(1))]).filter(Boolean).map(i=>({title:i.title,path:i.path}));return w.length>0?w:null}catch{return null}}var $=.6;function H(n,a,o,t=$){let p=a.map(e=>[e.title,(e.tags??[]).join(" "),(e.related??[]).join(" ")].join(" ")),g=C(n,v(p)),l=g.reduce((e,d)=>Math.max(e,d.score),0),r=new Map(g.map(e=>[e.docIndex,l>0?e.score/l:0])),s=!!o?.length,h=e=>s&&e.graphPath?.length?E(o,e.graphPath):0,u=(e,d)=>d.score-e.score||e.i-d.i,m=a.map((e,d)=>({i:d,score:(r.get(d)??0)*(1+t*h(e))})).filter(e=>r.has(e.i)).sort(u),w=a.map((e,d)=>({i:d,score:h(e)})).filter(e=>!r.has(e.i)&&e.score>0).sort(u),i=[...m,...w].map(e=>e.i);for(let e=0;e<a.length;e++)i.includes(e)||i.push(e);return i}function q(n,a,o,t){let p=t?.length?`
|
|
2
2
|
## Intent
|
|
3
3
|
|
|
4
4
|
The request was classified under the intent-graph path "${t.join(" \u203A ")}". Prefer articles filed under the same branch when their titles are equally plausible.
|
|
@@ -46,4 +46,4 @@ ${o}
|
|
|
46
46
|
Answer the question in 2\u20136 sentences. Cite articles by their title in square brackets like [Article Title]. If the articles do not answer the question, say so plainly (do not invent). Prefer concrete facts over hedging.
|
|
47
47
|
|
|
48
48
|
Output ONLY the answer \u2014 no preamble, no "here is my answer:", no markdown fencing.`}function K(n){let a=n.match(/\[[\s\S]*?\]/);if(!a)return[];try{let o=JSON.parse(a[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 N(n,a,o){let{writeFileSync:t,mkdirSync:p,rmSync:g}=await import("fs"),{tmpdir:l}=await import("os"),r=x(l(),`agentx-wiki-query-${process.pid}`);p(r,{recursive:!0});let s=x(r,`prompt-${Date.now()}.txt`);t(s,n);try{let h=`cat '${s}' | claude -p - --output-format json --max-turns 1 --model ${a} --disallowedTools "Bash Read Write Edit Glob Grep Agent WebSearch WebFetch NotebookEdit"`,u=L(h,{env:R(),encoding:"utf-8",timeout:o,maxBuffer:4*1024*1024});try{let m=JSON.parse(u);return String(m.result||m.content||"")}catch{return u}}finally{try{g(s,{force:!0})}catch{}}}export{nt as a,$ as b,H as c};
|
|
49
|
-
//# sourceMappingURL=chunk-
|
|
49
|
+
//# sourceMappingURL=chunk-Y4PR5LR3.js.map
|
package/dist/cli.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{b as o}from"./chunk-JXF54PT7.js";import"./chunk-QIJLFPWE.js";var s=o(process.versions.node);s&&(console.error(s),process.exit(1));var{buildProgram:r}=await import("./program-
|
|
2
|
+
import{b as o}from"./chunk-JXF54PT7.js";import"./chunk-QIJLFPWE.js";var s=o(process.versions.node);s&&(console.error(s),process.exit(1));var{buildProgram:r}=await import("./program-OKPC77BN.js"),{installCliSignalExit:i}=await import("./signal-exit-WL7G3EEZ.js");i();var e=await r();process.argv.slice(2).length===0?e.outputHelp():e.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-EI7D5V2L.js";import"./chunk-OPNZWQ6Y.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.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-ICDRAZBU.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$ as c,Z as a,_ as b,aa as d,ba as e,ca as f,da as g,ea as h,fa as i,ga as j,ha as k,ia as l,ja as m,ka as n,ma as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=config-
|
|
1
|
+
import{$ as c,Z as a,_ as b,aa as d,ba as e,ca as f,da as g,ea as h,fa as i,ga as j,ha as k,ia as l,ja as m,ka as n,ma as o}from"./chunk-OPNZWQ6Y.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";o();export{a as INTEGRATION_KINDS,j as approvalsConfigSchema,d as callsSchema,c as cameraBotSchema,k as daemonConfigSchema,b as eventSubscriptionSchema,l as expandEnvVars,m as loadDaemonConfig,h as membersConfigSchema,g as peopleConfigSchema,f as personSchema,i as requestStatusConfigSchema,e as requestsConfigSchema,n as validateWorkspaces};
|
|
2
|
+
//# sourceMappingURL=config-K4UYPR7W.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a,b,c,d,e}from"./chunk-2IMK3NGJ.js";import"./chunk-OPNZWQ6Y.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.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-IGA6D4S5.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as a,c as b,d as c,e as d,f as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=doctor-
|
|
1
|
+
import{b as a,c as b,d as c,e as d,f as e}from"./chunk-43CLFC4B.js";import"./chunk-S2GAEH2F.js";import"./chunk-JXF54PT7.js";import"./chunk-OPNZWQ6Y.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{e as daemonVoiceCheck,b as doctor,a as runDoctorChecks,c as runNotificationChecks,d as runReminderChecks};
|
|
2
|
+
//# sourceMappingURL=doctor-LRTOOCM6.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -6935,6 +6935,38 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
6935
6935
|
* prompt on save; the CLAUDE.md block follows at the next daemon
|
|
6936
6936
|
* start or memory change. */
|
|
6937
6937
|
memoryIndexMaxChars: z.ZodDefault<z.ZodNumber>;
|
|
6938
|
+
/** Resume or start fresh (#621, step 3). Before a claude-code session
|
|
6939
|
+
* is resumed, compare what the coming turn costs when it replays the
|
|
6940
|
+
* transcript with what a fresh lean start costs, and start fresh when
|
|
6941
|
+
* that is cheaper by `margin`. Runs after the stale, tier-2 and
|
|
6942
|
+
* max-turns rules and can only rotate earlier than they would.
|
|
6943
|
+
* `shadow` only logs what it would do. Off by default. Applies on
|
|
6944
|
+
* save. See src/agents/resume-gate.ts. */
|
|
6945
|
+
resumeGate: z.ZodDefault<z.ZodObject<{
|
|
6946
|
+
mode: z.ZodDefault<z.ZodEnum<["off", "shadow", "active"]>>;
|
|
6947
|
+
/** Tokens a fresh lean session starts with (~27k measured in #615). */
|
|
6948
|
+
freshTokens: z.ZodDefault<z.ZodNumber>;
|
|
6949
|
+
/** How long the cached transcript is assumed to survive. Longer is the
|
|
6950
|
+
* safe side: it treats more sessions as warm, and keeps them. */
|
|
6951
|
+
cacheTtlMinutes: z.ZodDefault<z.ZodNumber>;
|
|
6952
|
+
/** Cache-write price as a multiple of the input price (2 for the
|
|
6953
|
+
* one-hour cache, 1.25 for the five-minute one). */
|
|
6954
|
+
cacheWriteFactor: z.ZodDefault<z.ZodNumber>;
|
|
6955
|
+
/** A fresh start must be at least this many times cheaper. */
|
|
6956
|
+
margin: z.ZodDefault<z.ZodNumber>;
|
|
6957
|
+
}, "strip", z.ZodTypeAny, {
|
|
6958
|
+
mode: "active" | "off" | "shadow";
|
|
6959
|
+
freshTokens: number;
|
|
6960
|
+
cacheTtlMinutes: number;
|
|
6961
|
+
cacheWriteFactor: number;
|
|
6962
|
+
margin: number;
|
|
6963
|
+
}, {
|
|
6964
|
+
mode?: "active" | "off" | "shadow" | undefined;
|
|
6965
|
+
freshTokens?: number | undefined;
|
|
6966
|
+
cacheTtlMinutes?: number | undefined;
|
|
6967
|
+
cacheWriteFactor?: number | undefined;
|
|
6968
|
+
margin?: number | undefined;
|
|
6969
|
+
}>>;
|
|
6938
6970
|
/** ObservationPack (#621). A large tool result stays in the context
|
|
6939
6971
|
* and is re-read on every later request. With this on, a Claude Code
|
|
6940
6972
|
* PostToolUse hook saves a text result over `limitBytes` to
|
|
@@ -7001,6 +7033,13 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
7001
7033
|
actions: string[];
|
|
7002
7034
|
};
|
|
7003
7035
|
memoryIndexMaxChars: number;
|
|
7036
|
+
resumeGate: {
|
|
7037
|
+
mode: "active" | "off" | "shadow";
|
|
7038
|
+
freshTokens: number;
|
|
7039
|
+
cacheTtlMinutes: number;
|
|
7040
|
+
cacheWriteFactor: number;
|
|
7041
|
+
margin: number;
|
|
7042
|
+
};
|
|
7004
7043
|
observationPack: {
|
|
7005
7044
|
enabled: boolean;
|
|
7006
7045
|
tools: string[];
|
|
@@ -7038,6 +7077,13 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
7038
7077
|
actions?: string[] | undefined;
|
|
7039
7078
|
} | undefined;
|
|
7040
7079
|
memoryIndexMaxChars?: number | undefined;
|
|
7080
|
+
resumeGate?: {
|
|
7081
|
+
mode?: "active" | "off" | "shadow" | undefined;
|
|
7082
|
+
freshTokens?: number | undefined;
|
|
7083
|
+
cacheTtlMinutes?: number | undefined;
|
|
7084
|
+
cacheWriteFactor?: number | undefined;
|
|
7085
|
+
margin?: number | undefined;
|
|
7086
|
+
} | undefined;
|
|
7041
7087
|
observationPack?: {
|
|
7042
7088
|
enabled?: boolean | undefined;
|
|
7043
7089
|
tools?: string[] | undefined;
|
|
@@ -7834,6 +7880,13 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
7834
7880
|
actions: string[];
|
|
7835
7881
|
};
|
|
7836
7882
|
memoryIndexMaxChars: number;
|
|
7883
|
+
resumeGate: {
|
|
7884
|
+
mode: "active" | "off" | "shadow";
|
|
7885
|
+
freshTokens: number;
|
|
7886
|
+
cacheTtlMinutes: number;
|
|
7887
|
+
cacheWriteFactor: number;
|
|
7888
|
+
margin: number;
|
|
7889
|
+
};
|
|
7837
7890
|
observationPack: {
|
|
7838
7891
|
enabled: boolean;
|
|
7839
7892
|
tools: string[];
|
|
@@ -8740,6 +8793,13 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
8740
8793
|
actions?: string[] | undefined;
|
|
8741
8794
|
} | undefined;
|
|
8742
8795
|
memoryIndexMaxChars?: number | undefined;
|
|
8796
|
+
resumeGate?: {
|
|
8797
|
+
mode?: "active" | "off" | "shadow" | undefined;
|
|
8798
|
+
freshTokens?: number | undefined;
|
|
8799
|
+
cacheTtlMinutes?: number | undefined;
|
|
8800
|
+
cacheWriteFactor?: number | undefined;
|
|
8801
|
+
margin?: number | undefined;
|
|
8802
|
+
} | undefined;
|
|
8743
8803
|
observationPack?: {
|
|
8744
8804
|
enabled?: boolean | undefined;
|
|
8745
8805
|
tools?: string[] | undefined;
|
|
@@ -9242,7 +9302,7 @@ interface AgentXEvents {
|
|
|
9242
9302
|
billedModel?: string;
|
|
9243
9303
|
at: string;
|
|
9244
9304
|
};
|
|
9245
|
-
/** Claude session rotation fired (stale / max-turns / tier-2). */
|
|
9305
|
+
/** Claude session rotation fired (stale / max-turns / tier-2 / continuity / cost). */
|
|
9246
9306
|
"session:rotated": {
|
|
9247
9307
|
/** Trace ULID of the in-flight task at rotation time, when known.
|
|
9248
9308
|
* When set, the rotation is recorded as a step on that trace. */
|
|
@@ -9250,7 +9310,7 @@ interface AgentXEvents {
|
|
|
9250
9310
|
agentId: string;
|
|
9251
9311
|
channel: string;
|
|
9252
9312
|
chatId: string;
|
|
9253
|
-
reason: "stale" | "max-turns" | "tier-2" | "continuity";
|
|
9313
|
+
reason: "stale" | "max-turns" | "tier-2" | "continuity" | "cost";
|
|
9254
9314
|
lastTurnInputTokens?: number;
|
|
9255
9315
|
at: string;
|
|
9256
9316
|
};
|
|
@@ -11239,10 +11299,24 @@ declare class WikiHub {
|
|
|
11239
11299
|
summary(): AgentWikiSummary[];
|
|
11240
11300
|
/** Split an agent's entries into cited by an article, read but not cited, and pending. */
|
|
11241
11301
|
private classifyEntries;
|
|
11302
|
+
/**
|
|
11303
|
+
* The peer an agent's articles were copied from by `wiki sync --articles`,
|
|
11304
|
+
* or null for an agent this node absorbs itself. A copied agent is
|
|
11305
|
+
* read-only here: absorb and patch leave it to its home node.
|
|
11306
|
+
*/
|
|
11307
|
+
syncedFrom(agentId: string): SyncedFrom | null;
|
|
11308
|
+
markSynced(agentId: string, from: SyncedFrom): void;
|
|
11242
11309
|
/** agents/<id>/_absorbed.json — shared by every mode, like the raw entries. */
|
|
11243
11310
|
private ledgerPath;
|
|
11244
11311
|
private readLedger;
|
|
11245
11312
|
}
|
|
11313
|
+
interface SyncedFrom {
|
|
11314
|
+
/** The peer's node id. */
|
|
11315
|
+
node: string;
|
|
11316
|
+
peerUrl: string;
|
|
11317
|
+
/** When the last copy finished. */
|
|
11318
|
+
at: string;
|
|
11319
|
+
}
|
|
11246
11320
|
interface AgentWikiSummary {
|
|
11247
11321
|
agentId: string;
|
|
11248
11322
|
totalEntries: number;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as St,b as kt,c as vt,d as xt,e as $t,f as Ct,g as Pt,h as bt,ja as Tt,ka as Mt}from"./chunk-
|
|
1
|
+
import{a as St,b as kt,c as vt,d as xt,e as $t,f as Ct,g as Pt,h as bt,ja as Tt,ka as Mt}from"./chunk-I4IDZSGF.js";import"./chunk-BWHHZJNJ.js";import"./chunk-GTJIKXDB.js";import"./chunk-CAS2IWSM.js";import"./chunk-S2GAEH2F.js";import"./chunk-BGG3ZSMW.js";import"./chunk-ZVP6GB4G.js";import"./chunk-XGOBZCYC.js";import"./chunk-WCXXXAHV.js";import"./chunk-LQE73AZR.js";import"./chunk-2D3RYIDU.js";import"./chunk-7ZABMMSW.js";import"./chunk-6FVFD5WU.js";import"./chunk-PPUN7YHA.js";import"./chunk-VZLIBDLH.js";import"./chunk-EKJG63EJ.js";import"./chunk-H5Z42X7W.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-EMGB23H5.js";import"./chunk-JWDJMFU6.js";import"./chunk-GRMCAO3Q.js";import"./chunk-KZKDVIOE.js";import{ca as yt,m as lt,n as ct,o as dt,p as mt,q as pt}from"./chunk-2NGXOYTS.js";import"./chunk-7KY7EEEI.js";import"./chunk-GLQLCBJS.js";import"./chunk-6W74CHNW.js";import{a as L}from"./chunk-UG2OF2EI.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-RMA7KKR7.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-Y4CYQV7G.js";import"./chunk-LLNPKE7H.js";import"./chunk-SHEUCITK.js";import"./chunk-BLEW5WQL.js";import"./chunk-GV7S5BAX.js";import"./chunk-SZDACK6O.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import{s as ut}from"./chunk-25XR6QK2.js";import"./chunk-2IMK3NGJ.js";import"./chunk-VWTBHLMX.js";import"./chunk-DJQMG6TH.js";import{a as ht}from"./chunk-IKBWV7YJ.js";import"./chunk-36AXN6ZB.js";import"./chunk-KA2UIZXG.js";import"./chunk-GQ76J72O.js";import"./chunk-ILEC3IAV.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-GSX4NK2N.js";import"./chunk-6TUQHOO3.js";import"./chunk-MYVHVJWZ.js";import"./chunk-AV7T3SYT.js";import"./chunk-Y5MFVVTM.js";import"./chunk-QD6IICK7.js";import"./chunk-CECHWYJ2.js";import"./chunk-Y4PR5LR3.js";import{f as gt,g as ft}from"./chunk-ELUEF4NC.js";import"./chunk-WPNRDEHW.js";import"./chunk-56KNKUFF.js";import{j as it,k as rt,l as at}from"./chunk-4GDLXWCH.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-QOYAX2FT.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-2PJKGZWP.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{ha as tt,ja as st,ka as ot,ma as nt}from"./chunk-OPNZWQ6Y.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.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).
|