agentix-cli 0.71.0 → 0.72.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.
Files changed (115) hide show
  1. package/dist/{App-PRD5JNO4.js → App-244WEQJR.js} +2 -2
  2. package/dist/{ChatApp-BKS6OJ3L.js → ChatApp-SFP6SHUU.js} +2 -2
  3. package/dist/{agent-QF2JQ72Z.js → agent-PMNBXRFW.js} +2 -2
  4. package/dist/{board-dashboard-AROMOAKS.js → board-dashboard-J34PSEJS.js} +491 -217
  5. package/dist/board-dashboard-J34PSEJS.js.map +1 -0
  6. package/dist/{chunk-MT3BD6WG.js → chunk-335JCO5R.js} +165 -162
  7. package/dist/chunk-335JCO5R.js.map +1 -0
  8. package/dist/{chunk-WLX4766Y.js → chunk-55N4VTWX.js} +2 -2
  9. package/dist/{chunk-SELIVR6U.js → chunk-576L7ZFD.js} +2 -2
  10. package/dist/{chunk-BO4WLXXC.js → chunk-7XR5LGLD.js} +2 -2
  11. package/dist/{chunk-5Y7QRFSL.js → chunk-DMWFRKWR.js} +2 -2
  12. package/dist/{chunk-SFWA67GQ.js → chunk-FMUOVVXX.js} +2 -2
  13. package/dist/chunk-FWQVXZ5T.js +154 -0
  14. package/dist/chunk-FWQVXZ5T.js.map +1 -0
  15. package/dist/{chunk-D233M73Q.js → chunk-J6RZOP7Z.js} +2 -2
  16. package/dist/{chunk-XJQNIFZ4.js → chunk-MESWF2ZM.js} +2 -2
  17. package/dist/chunk-MYVHVJWZ.js +2 -0
  18. package/dist/chunk-MYVHVJWZ.js.map +1 -0
  19. package/dist/{chunk-OTMDMGHE.js → chunk-OSHG52OO.js} +65 -65
  20. package/dist/chunk-OSHG52OO.js.map +1 -0
  21. package/dist/{chunk-3C2SQDIH.js → chunk-OWRPCMGW.js} +199 -184
  22. package/dist/chunk-OWRPCMGW.js.map +1 -0
  23. package/dist/{chunk-6LTD7XL5.js → chunk-PBRI3MTE.js} +2 -2
  24. package/dist/{chunk-IK2XG65P.js → chunk-PC5LKW3L.js} +2 -2
  25. package/dist/{chunk-EMRQ6W5J.js → chunk-PHSYP22H.js} +2 -2
  26. package/dist/{chunk-4XBYHKYG.js → chunk-PY54XYAG.js} +2 -2
  27. package/dist/{chunk-RCKICCTT.js → chunk-QKV7FN67.js} +2 -2
  28. package/dist/{chunk-AHOGFVHA.js → chunk-RAYOK4GI.js} +8 -8
  29. package/dist/chunk-RAYOK4GI.js.map +1 -0
  30. package/dist/{chunk-AAA6NGY5.js → chunk-TT4T6CB3.js} +2 -2
  31. package/dist/{chunk-K6CHA6JJ.js → chunk-UFPWMNUW.js} +2 -2
  32. package/dist/{chunk-JBVABB26.js → chunk-VWMO4C72.js} +2 -2
  33. package/dist/{chunk-DJMUP6TK.js → chunk-YVLFX35J.js} +2 -2
  34. package/dist/{chunk-HXW4NAWF.js → chunk-Z5TXWHDN.js} +2 -2
  35. package/dist/cli.js +1 -1
  36. package/dist/cli.js.map +1 -1
  37. package/dist/client-L4JAPXTE.js +2 -0
  38. package/dist/{config-UY5K6SCL.js → config-X7BHZ75G.js} +2 -2
  39. package/dist/config-mutator-R2KBGTZJ.js +2 -0
  40. package/dist/doctor-5VFQVAVC.js +2 -0
  41. package/dist/index.d.ts +96 -11
  42. package/dist/index.js +1 -1
  43. package/dist/index.js.map +1 -1
  44. package/dist/opencode-launch-ECMEY2QZ.js +2 -0
  45. package/dist/opencode-launch-ECMEY2QZ.js.map +1 -0
  46. package/dist/opencode-process-ENS4MXHM.js +2 -0
  47. package/dist/program-6C3G65YA.js +2 -0
  48. package/dist/{promote-YLKNYYIU.js → promote-36XF4LH7.js} +2 -2
  49. package/dist/{query-CVRXEG43.js → query-YFZ6GWHU.js} +2 -2
  50. package/dist/registry-WJSGG62F.js +2 -0
  51. package/dist/{request-planner-76NCBYBW.js → request-planner-OXRWVBXI.js} +2 -2
  52. package/dist/{review-candidates-ZUXMX6BJ.js → review-candidates-5XZWP2BN.js} +2 -2
  53. package/dist/{routing-EIGWDKH7.js → routing-XEPCPLVM.js} +2 -2
  54. package/dist/schedule-tool-WQCO2YUG.js +2 -0
  55. package/dist/scheduler-4NQ62XDK.js +2 -0
  56. package/dist/{seat-QOY6FA4N.js → seat-FGFHW363.js} +2 -2
  57. package/dist/{select-JHKHO5BO.js → select-N6CIZF2S.js} +2 -2
  58. package/dist/{set-enabled-DVJIUOKX.js → set-enabled-L7Z6H7EG.js} +2 -2
  59. package/dist/{tool-WKSLNQ6H.js → tool-OSH6GHIF.js} +2 -2
  60. package/dist/wiki-E46QDRS7.js +2 -0
  61. package/dist/wiki-E46QDRS7.js.map +1 -0
  62. package/package.json +1 -1
  63. package/dist/board-dashboard-AROMOAKS.js.map +0 -1
  64. package/dist/chunk-3C2SQDIH.js.map +0 -1
  65. package/dist/chunk-AHOGFVHA.js.map +0 -1
  66. package/dist/chunk-JU67IZLC.js +0 -131
  67. package/dist/chunk-JU67IZLC.js.map +0 -1
  68. package/dist/chunk-MT3BD6WG.js.map +0 -1
  69. package/dist/chunk-OTMDMGHE.js.map +0 -1
  70. package/dist/client-UPBQVXYM.js +0 -2
  71. package/dist/config-mutator-7KOSRAQF.js +0 -2
  72. package/dist/doctor-GFPSIJGB.js +0 -2
  73. package/dist/program-XMGZOYX3.js +0 -2
  74. package/dist/registry-HZL363TA.js +0 -2
  75. package/dist/schedule-tool-PSZMP7C4.js +0 -2
  76. package/dist/scheduler-S24PXNB6.js +0 -2
  77. package/dist/wiki-PTXUMSIR.js +0 -2
  78. /package/dist/{App-PRD5JNO4.js.map → App-244WEQJR.js.map} +0 -0
  79. /package/dist/{ChatApp-BKS6OJ3L.js.map → ChatApp-SFP6SHUU.js.map} +0 -0
  80. /package/dist/{agent-QF2JQ72Z.js.map → agent-PMNBXRFW.js.map} +0 -0
  81. /package/dist/{chunk-WLX4766Y.js.map → chunk-55N4VTWX.js.map} +0 -0
  82. /package/dist/{chunk-SELIVR6U.js.map → chunk-576L7ZFD.js.map} +0 -0
  83. /package/dist/{chunk-BO4WLXXC.js.map → chunk-7XR5LGLD.js.map} +0 -0
  84. /package/dist/{chunk-5Y7QRFSL.js.map → chunk-DMWFRKWR.js.map} +0 -0
  85. /package/dist/{chunk-SFWA67GQ.js.map → chunk-FMUOVVXX.js.map} +0 -0
  86. /package/dist/{chunk-D233M73Q.js.map → chunk-J6RZOP7Z.js.map} +0 -0
  87. /package/dist/{chunk-XJQNIFZ4.js.map → chunk-MESWF2ZM.js.map} +0 -0
  88. /package/dist/{chunk-6LTD7XL5.js.map → chunk-PBRI3MTE.js.map} +0 -0
  89. /package/dist/{chunk-IK2XG65P.js.map → chunk-PC5LKW3L.js.map} +0 -0
  90. /package/dist/{chunk-EMRQ6W5J.js.map → chunk-PHSYP22H.js.map} +0 -0
  91. /package/dist/{chunk-4XBYHKYG.js.map → chunk-PY54XYAG.js.map} +0 -0
  92. /package/dist/{chunk-RCKICCTT.js.map → chunk-QKV7FN67.js.map} +0 -0
  93. /package/dist/{chunk-AAA6NGY5.js.map → chunk-TT4T6CB3.js.map} +0 -0
  94. /package/dist/{chunk-K6CHA6JJ.js.map → chunk-UFPWMNUW.js.map} +0 -0
  95. /package/dist/{chunk-JBVABB26.js.map → chunk-VWMO4C72.js.map} +0 -0
  96. /package/dist/{chunk-DJMUP6TK.js.map → chunk-YVLFX35J.js.map} +0 -0
  97. /package/dist/{chunk-HXW4NAWF.js.map → chunk-Z5TXWHDN.js.map} +0 -0
  98. /package/dist/{client-UPBQVXYM.js.map → client-L4JAPXTE.js.map} +0 -0
  99. /package/dist/{config-UY5K6SCL.js.map → config-X7BHZ75G.js.map} +0 -0
  100. /package/dist/{config-mutator-7KOSRAQF.js.map → config-mutator-R2KBGTZJ.js.map} +0 -0
  101. /package/dist/{doctor-GFPSIJGB.js.map → doctor-5VFQVAVC.js.map} +0 -0
  102. /package/dist/{program-XMGZOYX3.js.map → opencode-process-ENS4MXHM.js.map} +0 -0
  103. /package/dist/{promote-YLKNYYIU.js.map → program-6C3G65YA.js.map} +0 -0
  104. /package/dist/{query-CVRXEG43.js.map → promote-36XF4LH7.js.map} +0 -0
  105. /package/dist/{registry-HZL363TA.js.map → query-YFZ6GWHU.js.map} +0 -0
  106. /package/dist/{routing-EIGWDKH7.js.map → registry-WJSGG62F.js.map} +0 -0
  107. /package/dist/{request-planner-76NCBYBW.js.map → request-planner-OXRWVBXI.js.map} +0 -0
  108. /package/dist/{review-candidates-ZUXMX6BJ.js.map → review-candidates-5XZWP2BN.js.map} +0 -0
  109. /package/dist/{schedule-tool-PSZMP7C4.js.map → routing-XEPCPLVM.js.map} +0 -0
  110. /package/dist/{scheduler-S24PXNB6.js.map → schedule-tool-WQCO2YUG.js.map} +0 -0
  111. /package/dist/{seat-QOY6FA4N.js.map → scheduler-4NQ62XDK.js.map} +0 -0
  112. /package/dist/{wiki-PTXUMSIR.js.map → seat-FGFHW363.js.map} +0 -0
  113. /package/dist/{select-JHKHO5BO.js.map → select-N6CIZF2S.js.map} +0 -0
  114. /package/dist/{set-enabled-DVJIUOKX.js.map → set-enabled-L7Z6H7EG.js.map} +0 -0
  115. /package/dist/{tool-WKSLNQ6H.js.map → tool-OSH6GHIF.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import{a as Te,b as ft}from"./chunk-FX3D7YON.js";import{a as et,b as tt,c as nt,d as S,e as A,f as N}from"./chunk-72SZI2UW.js";import{a as ne,b as He}from"./chunk-FCPTN6NF.js";import{o as we,p as Ke}from"./chunk-5MUJZODV.js";import{A as Ze,z as We}from"./chunk-AHOGFVHA.js";import{a as rt,b as ot,c as st,d as it,e as at,f as ct,g as ut,h as lt,i as dt,j as pt,k as mt,l as bt}from"./chunk-RGDKHYY2.js";import{a as E,b as Ye,c as he}from"./chunk-QIJLFPWE.js";function R(e,t){$.set(e,t),X.delete(e)}function D(e){let t=X.get(e);if(t)return t;let r=$.get(e);if(!r){let o=Ee();throw new Error(`unknown decision backend "${e}"`+(o.length>0?` \u2014 registered: ${o.join(", ")}`:" \u2014 none registered"))}let n=r();return X.set(e,n),n}function Ee(){return[...$.keys()].sort()}function gt(){$.clear(),X.clear()}var $,X,C=E(()=>{"use strict";$=new Map,X=new Map});import yt from"better-sqlite3";import{createHash as ht}from"crypto";import{mkdirSync as wt}from"fs";import{dirname as Tt,resolve as Et}from"path";function Q(e){if(e.type==="noul"){let r=e.noul,n={yes:r,no:1-r},o=r>=.5?"yes":"no",s=Math.abs(r-.5)*2;return{predicted:o,confidence:s,probabilities:n,topLabel:o,topProb:Math.max(r,1-r),expectedScore:null,pMax:Math.max(r,1-r),negEntropy:s}}if(e.type==="choice")return{predicted:e.choice,confidence:e.confidence,probabilities:{...e.probabilities},topLabel:e.choice,topProb:e.probabilities[e.choice]??0,expectedScore:null,pMax:e.pMax,negEntropy:e.negEntropy};let t=String(Math.round(e.score));return{predicted:t,confidence:e.confidence,probabilities:{...e.probabilities},topLabel:t,topProb:e.probabilities[t]??0,expectedScore:e.score,pMax:e.pMax,negEntropy:e.negEntropy}}function kt(e){if(typeof e!="string"||e.length===0)return{};try{let t=JSON.parse(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function xt(e){e.exec("CREATE TABLE IF NOT EXISTS schema_version (v INTEGER PRIMARY KEY);");let t=e.prepare("SELECT MAX(v) AS v FROM schema_version").get().v??0;t<1&&Rt(e),t<2&&At(e),t<3&&St(e)}function St(e){e.exec(`
1
+ import{a as Te,b as ft}from"./chunk-FX3D7YON.js";import{a as et,b as tt,c as nt,d as S,e as A,f as N}from"./chunk-72SZI2UW.js";import{a as ne,b as He}from"./chunk-FCPTN6NF.js";import{o as we,p as Ke}from"./chunk-5MUJZODV.js";import{A as Ze,z as We}from"./chunk-RAYOK4GI.js";import{a as rt,b as ot,c as st,d as it,e as at,f as ct,g as ut,h as lt,i as dt,j as pt,k as mt,l as bt}from"./chunk-RGDKHYY2.js";import{a as E,b as Ye,c as he}from"./chunk-QIJLFPWE.js";function R(e,t){$.set(e,t),X.delete(e)}function D(e){let t=X.get(e);if(t)return t;let r=$.get(e);if(!r){let o=Ee();throw new Error(`unknown decision backend "${e}"`+(o.length>0?` \u2014 registered: ${o.join(", ")}`:" \u2014 none registered"))}let n=r();return X.set(e,n),n}function Ee(){return[...$.keys()].sort()}function gt(){$.clear(),X.clear()}var $,X,C=E(()=>{"use strict";$=new Map,X=new Map});import yt from"better-sqlite3";import{createHash as ht}from"crypto";import{mkdirSync as wt}from"fs";import{dirname as Tt,resolve as Et}from"path";function Q(e){if(e.type==="noul"){let r=e.noul,n={yes:r,no:1-r},o=r>=.5?"yes":"no",s=Math.abs(r-.5)*2;return{predicted:o,confidence:s,probabilities:n,topLabel:o,topProb:Math.max(r,1-r),expectedScore:null,pMax:Math.max(r,1-r),negEntropy:s}}if(e.type==="choice")return{predicted:e.choice,confidence:e.confidence,probabilities:{...e.probabilities},topLabel:e.choice,topProb:e.probabilities[e.choice]??0,expectedScore:null,pMax:e.pMax,negEntropy:e.negEntropy};let t=String(Math.round(e.score));return{predicted:t,confidence:e.confidence,probabilities:{...e.probabilities},topLabel:t,topProb:e.probabilities[t]??0,expectedScore:e.score,pMax:e.pMax,negEntropy:e.negEntropy}}function kt(e){if(typeof e!="string"||e.length===0)return{};try{let t=JSON.parse(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function xt(e){e.exec("CREATE TABLE IF NOT EXISTS schema_version (v INTEGER PRIMARY KEY);");let t=e.prepare("SELECT MAX(v) AS v FROM schema_version").get().v??0;t<1&&Rt(e),t<2&&At(e),t<3&&St(e)}function St(e){e.exec(`
2
2
  ALTER TABLE decision_calls ADD COLUMN features_json TEXT;
3
3
  INSERT INTO schema_version (v) VALUES (3);
4
4
  `)}function At(e){e.exec(`
@@ -111,4 +111,4 @@ import{a as Te,b as ft}from"./chunk-FX3D7YON.js";import{a as et,b as tt,c as nt,
111
111
  `)}if(!m)throw new Error(`local decision backend could not get a valid answer after ${f+1} attempt(s): ${h}`);let M={},L=!1;for(let[k,q]of Object.entries(s.questions)){let x=_(q,m[k],{normalize:e.normalizeProbabilities??!0});M[k]=x.answer,x.repaired&&(L=!0)}return{model:a,answers:M,usage:g,meta:{backend:"local",structureMode:c,answerMode:"probabilities",repaired:L,retries:f,stateTruncated:l.truncated,latencyMs:Date.now()-i}}}finally{b()}}}}async function $t(e,t,r,n,o){if(!e.generateRaw)throw new Error(`provider "${e.name}" has no generateRaw(); use structureMode "text"`);let s=[{role:"user",content:r},...n?[{role:"user",content:n}]:[]],i=await e.generateRaw(s,J,[{name:B,description:"Report a probability distribution for every question.",input_schema:se(t)}],{...o,toolChoice:{type:"tool",name:B}}),a=i.content.find(c=>c.type==="tool_use"&&c.name===B),u=a&&a.type==="tool_use"?a.input:null;return{answers:Pe(u),usage:{inputTokens:i.usage.input_tokens,outputTokens:i.usage.output_tokens}}}async function Vt(e,t,r,n,o){let s=[r,ae(t)].join(`
112
112
  `),i=[{role:"system",content:J},{role:"user",content:s},...n?[{role:"user",content:n}]:[]],a=await e.generate(i,o);return{answers:Pe(Te(a.content??"")),usage:{inputTokens:0,outputTokens:a.tokensUsed??0}}}function Pe(e){if(e&&typeof e=="object"&&!Array.isArray(e)){let t=e;if(t.answers&&typeof t.answers=="object")return t.answers}return e}function zt(e,t){return e!=="auto"?e:t.generateRaw&&me[t.name]?.structuredOutput?"tool":"text"}function Jt(e,t){let r=new AbortController,n=setTimeout(()=>r.abort(new Error(`decision timed out after ${t}ms`)),t),o=()=>r.abort(e?.reason);return e&&(e.aborted?o():e.addEventListener("abort",o,{once:!0})),{signal:r.signal,dispose:()=>{clearTimeout(n),e?.removeEventListener("abort",o)}}}var Bt,Pt,qt,Be,Xt,be=E(()=>{"use strict";Ke();Ue();ft();j();Y();N();z();Bt="claude-code",Pt="claude-haiku-4-5-20251001",qt=24e3,Be=2e3,Xt=3e4});import{readFileSync as Gt}from"fs";import{homedir as Yt}from"os";import{join as Kt}from"path";function v(e={}){let t=(e.baseUrl??Ht).replace(/\/+$/,""),r=e.path??"/classifier",n=e.name??"simple-jev",o=e.maxStateChars??Zt,s=e.maxChoiceOptions??en,i={probabilitySource:e.probabilitySource??"logits",calibratedProbabilities:!1,maxChoiceOptions:s,maxStateChars:o,parallelQuestions:!0,images:!1};return{name:n,capabilities:i,async decide(a){A(a.questions),on(a.questions,s);let u=Date.now(),c=a.model??e.model;if(!c)throw new Error("simple-jev backend needs a model id");let l=G(a.state,o),p=e.fetchImpl??fetch,{signal:y,dispose:d}=sn(a.abortSignal,a.timeoutMs??e.timeoutMs??Wt);try{let b={"Content-Type":"application/json"},g=rn(e.apiKeyEnv,e.apiKeyFile);g&&(b.Authorization=`Bearer ${g}`);let w=await p(`${t}${r}`,{method:"POST",headers:b,body:JSON.stringify({model:c,state:l.text,questions:nn(a.questions)}),signal:y});if(!w.ok){let k=await w.text().catch(()=>"");throw new Error(`${n} ${w.status}: ${k.slice(0,300)}`)}let f=await w.json(),m=F(a.questions).safeParse(f.answers);if(!m.success)throw new Error(`${n} returned a response that does not match the requested questions (contract drift, not a model slip \u2014 retrying will not help):
113
113
  ${U(m.error)}`);let h=m.data,M={},L=!1;for(let[k,q]of Object.entries(a.questions)){let x=_(q,h[k]);M[k]=x.answer,x.repaired&&(L=!0)}return{model:f.model??c,answers:M,usage:{inputTokens:f.usage?.input_tokens??0,outputTokens:f.usage?.output_tokens??0},meta:{backend:n,structureMode:i.probabilitySource==="native"?"native":"logprobs",answerMode:"probabilities",repaired:L,retries:0,stateTruncated:l.truncated,latencyMs:Date.now()-u}}}finally{d()}}}}function nn(e){let t={};for(let[r,n]of Object.entries(e))t[r]=n.instructions?n:{...n,instructions:tn[n.type]};return t}function rn(e,t){let r=e?process.env[e]:void 0;if(r)return r;if(!t)return;let n=t.startsWith("~/")?Kt(Yt(),t.slice(2)):t;if(!Z.has(n))try{let o=Gt(n,"utf-8").trim();Z.set(n,o.length>0?o:null)}catch{Z.set(n,null)}return Z.get(n)??void 0}function on(e,t){for(let[r,n]of Object.entries(e))if(n.type==="choice"){let o=Object.keys(n.criteria).length;if(o>t)throw new Error(`question "${r}": accepts at most ${t} choice options, got ${o}`)}else if(n.type==="score"&&n.criteria.length>t)throw new Error(`question "${r}": accepts at most ${t} score levels, got ${n.criteria.length}`)}function sn(e,t){let r=new AbortController,n=setTimeout(()=>r.abort(new Error(`decision timed out after ${t}ms`)),t),o=()=>r.abort(e?.reason);return e&&(e.aborted?o():e.addEventListener("abort",o,{once:!0})),{signal:r.signal,dispose:()=>{clearTimeout(n),e?.removeEventListener("abort",o)}}}var Ht,Wt,Zt,en,tn,Z,fe=E(()=>{"use strict";j();N();z();Y();Ht="http://127.0.0.1:8000/v1",Wt=3e4,Zt=6e3,en=50;tn={choice:"Which option best fits?",score:"Which level best fits?",noul:"Is this true of the state?"};Z=new Map});var qe={};Ye(qe,{DecisionStore:()=>I,MAX_CHOICE_OPTIONS:()=>MAX_CHOICE_OPTIONS,SYSTEM_PROMPT:()=>J,TOOL_NAME:()=>B,UNCERTAINTY_HIGH:()=>Ce,UNCERTAINTY_LOW:()=>De,_resetDecisionBackendsForTesting:()=>gt,agreement:()=>rt,answerView:()=>Q,applyRecalibrator:()=>ue,applyTemperature:()=>lt,askSeat:()=>pn,band:()=>Ie,bootstrapInterval:()=>pt,brier:()=>at,buildDesign:()=>Ne,calibrationReport:()=>mt,choice:()=>tt,compareCalibrators:()=>Lt,confidenceFor:()=>re,configureDecisions:()=>cn,coverageCurve:()=>ut,createLocalDecisionBackend:()=>W,createMockDecisionBackend:()=>H,createSimpleJevBackend:()=>v,decisionsRuntime:()=>ln,describeIssues:()=>U,ece:()=>st,expectedScore:()=>Ae,finalizeAnswer:()=>_,fitLogistic:()=>ve,fitRecalibrator:()=>P,fitTemperature:()=>dt,getDecisionBackend:()=>D,getSeatMode:()=>Ve,labelsOf:()=>S,listDecisionBackends:()=>Ee,logLoss:()=>ct,logit:()=>le,mce:()=>it,measureConsistency:()=>Qt,normalizeDistribution:()=>xe,normalizedNegEntropy:()=>oe,noul:()=>et,pMax:()=>Se,parseSeatMode:()=>ge,rawAnswerSchema:()=>Re,rawAnswersSchema:()=>F,recordSeatOutcome:()=>dn,registerBuiltinDecisionBackends:()=>an,registerDecisionBackend:()=>R,reliabilityBins:()=>ot,renderQuestions:()=>_e,renderShapeInstructions:()=>ae,renderState:()=>G,renderUserPrompt:()=>ie,resetDecisionsRuntime:()=>un,score:()=>nt,seatEnvVar:()=>$e,sigmoid:()=>de,toolInputSchema:()=>se,validateQuestions:()=>A,withUid:()=>Qe});function an(e={},t={},r={},n={}){R("mock",()=>H()),R("local",()=>W(e)),R("simple-jev",()=>v(t)),R("jev",()=>v({name:"jev",baseUrl:"https://openrouter.ai/api/alpha",path:"/decisions",model:"jev-latest",apiKeyEnv:"OPENROUTER_API_KEY",apiKeyFile:"~/.agentx/openrouter-key.txt",probabilitySource:"native",maxChoiceOptions:255,maxStateChars:9e4,...r})),R("typesafe",()=>v({name:"typesafe",baseUrl:"https://api.typesafe.ai/v1",path:"/systemone",model:"jev-latest",apiKeyEnv:"TYPESAFE_API_KEY",apiKeyFile:"~/.agentx/typesafe-key.txt",probabilitySource:"native",maxChoiceOptions:255,maxStateChars:9e4,...n}))}var Xe=E(()=>{"use strict";ke();N();j();z();C();Y();V();bt();Me();je();ze();pe();be();fe();C();pe();be();fe()});function cn(e){T={...ye,...T,...e},ee=!0}function un(){T={...ye,seats:{}},ee=!1}function mn(){if(!ee){ee=!0;try{let{loadDaemonConfig:e}=(Ze(),he(We)),t=e()?.decisions;if(!t?.enabled)return;let{registerBuiltinDecisionBackends:r}=(Xe(),he(qe)),n=t.backends??{};r(n.local,n.simpleJev,n.jev,n.typesafe);let o=null;try{o=new I({path:t.dbPath})}catch{}T={enabled:!0,defaultBackend:t.defaultBackend,store:o,seats:Object.fromEntries(Object.entries(t.seats??{}).map(([s,i])=>[s,{...i,redactState:t.redactState,keepStateRows:t.keepStateRows}]))}}catch{}}}function ln(){return T}function ge(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return bn.includes(t)?t:null}function $e(e){return`AGENTX_DECISION_SEAT_${e.toUpperCase().replace(/[^A-Z0-9]+/g,"_")}`}function Ve(e,t=process.env){mn();let r=ge(t[$e(e)]);return r||(T.enabled?ge(T.seats[e]?.mode)??"off":"off")}function dn(e,t,r=!1){if(!(!e||!T.store))try{T.store.recordOutcome(e,t,r)}catch{}}async function pn(e,t,r,n={}){let o=Ve(e);if(o==="off")return null;let s=T.seats[e]??{mode:o},i=n.backend??s.backend??T.defaultBackend,a=Date.now();try{let c=await D(i).decide({state:t,questions:r,model:n.model??s.model,abortSignal:n.signal,timeoutMs:n.timeoutMs??s.timeoutMs}),l=fn(e,o,t,r,c,n,s);return{answers:c.answers,callId:l,mode:o}}catch(u){return gn(e,o,t,r,i,n,s,a,u),yn(e,i,u),null}}function fn(e,t,r,n,o,s,i){if(!T.store)return null;try{return T.store.recordCall({seat:e,mode:t,backend:o.meta.backend,model:o.model,meta:o.meta,state:r,questions:n,answers:o.answers,usage:o.usage,incumbent:Ge(s.incumbent),links:s.links,features:s.features,keepState:!i.redactState})}catch{return null}}function gn(e,t,r,n,o,s,i,a,u){if(T.store)try{T.store.recordCall({seat:e,mode:t,backend:o,model:s.model??i.model??"unknown",meta:{structureMode:"text",answerMode:"probabilities",retries:0,stateTruncated:!1,latencyMs:Date.now()-a},state:r,questions:n,answers:{},incumbent:Ge(s.incumbent),links:s.links,features:s.features,error:String(u?.message??u).slice(0,500),keepState:!i.redactState})}catch{}}function Ge(e){if(!e)return;let t={};for(let[r,n]of Object.entries(e))n!==void 0&&(t[r]={value:n});return t}function yn(e,t,r){let n=Date.now();n-Je<6e4||(Je=n,console.warn(`[decisions] seat "${e}" on backend "${t}" failed: ${r?.message??r}`))}var ye,T,ee,bn,Je,ze=E(()=>{C();V();ye={enabled:!1,defaultBackend:"local",seats:{},store:null},T={...ye},ee=!1;bn=["off","shadow","active"];Je=0});export{D as a,Ee as b,C as c,I as d,V as e,Lt as f,Me as g,Qt as h,je as i,me as j,Un as k,Ue as l,an as m,Xe as n,cn as o,un as p,ln as q,ge as r,$e as s,Ve as t,dn as u,pn as v,ze as w};
114
- //# sourceMappingURL=chunk-DJMUP6TK.js.map
114
+ //# sourceMappingURL=chunk-YVLFX35J.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-HZL363TA.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):
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-WJSGG62F.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-HXW4NAWF.js.map
126
+ //# sourceMappingURL=chunk-Z5TXWHDN.js.map
package/dist/cli.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{a as n}from"./chunk-MT3BD6WG.js";import"./chunk-BO4WLXXC.js";import"./chunk-IK2XG65P.js";import"./chunk-D233M73Q.js";import"./chunk-Z3IP66SL.js";import"./chunk-C4CDVE2E.js";import"./chunk-RKPAVWXF.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-SZDACK6O.js";import"./chunk-3C2SQDIH.js";import"./chunk-JU67IZLC.js";import"./chunk-BYJ3A55Y.js";import"./chunk-NMFXY3QU.js";import"./chunk-4XBYHKYG.js";import"./chunk-LQRBGQIR.js";import"./chunk-ZVP6GB4G.js";import"./chunk-JBVABB26.js";import"./chunk-2D3RYIDU.js";import"./chunk-EKJG63EJ.js";import"./chunk-OTMDMGHE.js";import"./chunk-6LTD7XL5.js";import"./chunk-N6EWZGIX.js";import"./chunk-WP6KLXTP.js";import"./chunk-DP7RTNDM.js";import"./chunk-HXW4NAWF.js";import"./chunk-SFQUP3BP.js";import"./chunk-SELIVR6U.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-5Y7QRFSL.js";import"./chunk-WLX4766Y.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-K6CHA6JJ.js";import"./chunk-DWADWDMU.js";import"./chunk-23A5K5UW.js";import"./chunk-QD6IICK7.js";import"./chunk-VWTBHLMX.js";import"./chunk-RCKICCTT.js";import"./chunk-EMRQ6W5J.js";import"./chunk-CECHWYJ2.js";import"./chunk-XJQNIFZ4.js";import"./chunk-AAA6NGY5.js";import"./chunk-WPNRDEHW.js";import"./chunk-2GIDVZ4H.js";import"./chunk-DJMUP6TK.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-QOYAX2FT.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-JHCI6XCJ.js";import"./chunk-DSYKYZMT.js";import"./chunk-AHOGFVHA.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";var r=["SIGINT","SIGTERM"];function o(t=process){for(let i of r)t.on(i,()=>{t.listenerCount(i)<=1&&t.exit(0)})}o();async function s(){let t=await n();if(process.argv.slice(2).length===0){t.outputHelp();return}t.parse()}s();
2
+ import{a as n}from"./chunk-335JCO5R.js";import"./chunk-7XR5LGLD.js";import"./chunk-PC5LKW3L.js";import"./chunk-J6RZOP7Z.js";import"./chunk-Z3IP66SL.js";import"./chunk-C4CDVE2E.js";import"./chunk-RKPAVWXF.js";import"./chunk-SZDACK6O.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-OWRPCMGW.js";import"./chunk-FWQVXZ5T.js";import"./chunk-PY54XYAG.js";import"./chunk-BYJ3A55Y.js";import"./chunk-NMFXY3QU.js";import"./chunk-LQRBGQIR.js";import"./chunk-ZVP6GB4G.js";import"./chunk-VWMO4C72.js";import"./chunk-AQASR6KR.js";import"./chunk-2D3RYIDU.js";import"./chunk-EKJG63EJ.js";import"./chunk-OSHG52OO.js";import"./chunk-PBRI3MTE.js";import"./chunk-WP6KLXTP.js";import"./chunk-N6EWZGIX.js";import"./chunk-DP7RTNDM.js";import"./chunk-Z5TXWHDN.js";import"./chunk-SFQUP3BP.js";import"./chunk-576L7ZFD.js";import"./chunk-2AXFYDWF.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-DMWFRKWR.js";import"./chunk-55N4VTWX.js";import"./chunk-VWTBHLMX.js";import"./chunk-QKV7FN67.js";import"./chunk-PHSYP22H.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-UFPWMNUW.js";import"./chunk-MYVHVJWZ.js";import"./chunk-DWADWDMU.js";import"./chunk-23A5K5UW.js";import"./chunk-QD6IICK7.js";import"./chunk-CECHWYJ2.js";import"./chunk-MESWF2ZM.js";import"./chunk-TT4T6CB3.js";import"./chunk-WPNRDEHW.js";import"./chunk-2GIDVZ4H.js";import"./chunk-YVLFX35J.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-QOYAX2FT.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-JHCI6XCJ.js";import"./chunk-DSYKYZMT.js";import"./chunk-RAYOK4GI.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";var r=["SIGINT","SIGTERM"];function o(t=process){for(let i of r)t.on(i,()=>{t.listenerCount(i)<=1&&t.exit(0)})}o();async function s(){let t=await n();if(process.argv.slice(2).length===0){t.outputHelp();return}t.parse()}s();
3
3
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/signal-exit.ts","../src/cli.ts"],"sourcesContent":["// --- Ctrl-C / SIGTERM for CLI commands ---\n//\n// Short commands should exit at once when stopped. Long-running ones (the\n// daemon above all) install their own handler to finish in-flight work first.\n// The CLI's quick exit used to be registered unconditionally, before the\n// daemon's, and Node runs listeners in registration order — so every stop\n// exited the process before the daemon's drain began and killed in-flight\n// agent tasks mid-turn (#103). Now the quick exit only fires when nobody\n// else handles the signal.\n\ntype SignalTarget = Pick<NodeJS.Process, \"on\" | \"listenerCount\" | \"exit\">\n\nexport const CLI_EXIT_SIGNALS = [\"SIGINT\", \"SIGTERM\"] as const\n\nexport function installCliSignalExit(proc: SignalTarget = process): void {\n for (const sig of CLI_EXIT_SIGNALS) {\n proc.on(sig, () => {\n // This listener is always one of them; anything more means a command\n // is handling the stop itself.\n if (proc.listenerCount(sig) <= 1) proc.exit(0)\n })\n }\n}\n","#!/usr/bin/env node\nimport { buildProgram } from \"@/program\"\nimport { installCliSignalExit } from \"@/utils/signal-exit\"\n\ninstallCliSignalExit()\n\nasync function main() {\n const program = await buildProgram()\n\n const args = process.argv.slice(2)\n if (args.length === 0) {\n program.outputHelp()\n return\n }\n\n program.parse()\n}\n\nmain()\n"],"mappings":";wyDAYO,IAAMA,EAAmB,CAAC,SAAU,SAAS,EAE7C,SAASC,EAAqBC,EAAqB,QAAe,CACvE,QAAWC,KAAOH,EAChBE,EAAK,GAAGC,EAAK,IAAM,CAGbD,EAAK,cAAcC,CAAG,GAAK,GAAGD,EAAK,KAAK,CAAC,CAC/C,CAAC,CAEL,CClBAE,EAAqB,EAErB,eAAeC,GAAO,CACpB,IAAMC,EAAU,MAAMC,EAAa,EAGnC,GADa,QAAQ,KAAK,MAAM,CAAC,EACxB,SAAW,EAAG,CACrBD,EAAQ,WAAW,EACnB,OAGFA,EAAQ,MAAM,CAChB,CAEAD,EAAK","names":["CLI_EXIT_SIGNALS","installCliSignalExit","proc","sig","installCliSignalExit","main","program","buildProgram"]}
1
+ {"version":3,"sources":["../src/utils/signal-exit.ts","../src/cli.ts"],"sourcesContent":["// --- Ctrl-C / SIGTERM for CLI commands ---\n//\n// Short commands should exit at once when stopped. Long-running ones (the\n// daemon above all) install their own handler to finish in-flight work first.\n// The CLI's quick exit used to be registered unconditionally, before the\n// daemon's, and Node runs listeners in registration order — so every stop\n// exited the process before the daemon's drain began and killed in-flight\n// agent tasks mid-turn (#103). Now the quick exit only fires when nobody\n// else handles the signal.\n\ntype SignalTarget = Pick<NodeJS.Process, \"on\" | \"listenerCount\" | \"exit\">\n\nexport const CLI_EXIT_SIGNALS = [\"SIGINT\", \"SIGTERM\"] as const\n\nexport function installCliSignalExit(proc: SignalTarget = process): void {\n for (const sig of CLI_EXIT_SIGNALS) {\n proc.on(sig, () => {\n // This listener is always one of them; anything more means a command\n // is handling the stop itself.\n if (proc.listenerCount(sig) <= 1) proc.exit(0)\n })\n }\n}\n","#!/usr/bin/env node\nimport { buildProgram } from \"@/program\"\nimport { installCliSignalExit } from \"@/utils/signal-exit\"\n\ninstallCliSignalExit()\n\nasync function main() {\n const program = await buildProgram()\n\n const args = process.argv.slice(2)\n if (args.length === 0) {\n program.outputHelp()\n return\n }\n\n program.parse()\n}\n\nmain()\n"],"mappings":";o0DAYO,IAAMA,EAAmB,CAAC,SAAU,SAAS,EAE7C,SAASC,EAAqBC,EAAqB,QAAe,CACvE,QAAWC,KAAOH,EAChBE,EAAK,GAAGC,EAAK,IAAM,CAGbD,EAAK,cAAcC,CAAG,GAAK,GAAGD,EAAK,KAAK,CAAC,CAC/C,CAAC,CAEL,CClBAE,EAAqB,EAErB,eAAeC,GAAO,CACpB,IAAMC,EAAU,MAAMC,EAAa,EAGnC,GADa,QAAQ,KAAK,MAAM,CAAC,EACxB,SAAW,EAAG,CACrBD,EAAQ,WAAW,EACnB,OAGFA,EAAQ,MAAM,CAChB,CAEAD,EAAK","names":["CLI_EXIT_SIGNALS","installCliSignalExit","proc","sig","installCliSignalExit","main","program","buildProgram"]}
@@ -0,0 +1,2 @@
1
+ import{a,b,c,d,e,f,g}from"./chunk-7XR5LGLD.js";import"./chunk-RAYOK4GI.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-L4JAPXTE.js.map
@@ -1,2 +1,2 @@
1
- import{A as i,r as a,s as b,t as c,u as d,v as e,w as f,x as g,y as h}from"./chunk-AHOGFVHA.js";import"./chunk-QIJLFPWE.js";i();export{a as INTEGRATION_KINDS,d as approvalsConfigSchema,c as callsSchema,e as daemonConfigSchema,b as eventSubscriptionSchema,f as expandEnvVars,g as loadDaemonConfig,h as validateWorkspaces};
2
- //# sourceMappingURL=config-UY5K6SCL.js.map
1
+ import{A as i,r as a,s as b,t as c,u as d,v as e,w as f,x as g,y as h}from"./chunk-RAYOK4GI.js";import"./chunk-QIJLFPWE.js";i();export{a as INTEGRATION_KINDS,d as approvalsConfigSchema,c as callsSchema,e as daemonConfigSchema,b as eventSubscriptionSchema,f as expandEnvVars,g as loadDaemonConfig,h as validateWorkspaces};
2
+ //# sourceMappingURL=config-X7BHZ75G.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b,c,d,e}from"./chunk-55N4VTWX.js";import"./chunk-RAYOK4GI.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-R2KBGTZJ.js.map
@@ -0,0 +1,2 @@
1
+ import{b as a,c as b,d as c,e as d,f as e}from"./chunk-PC5LKW3L.js";import"./chunk-BYJ3A55Y.js";import"./chunk-RAYOK4GI.js";import"./chunk-QIJLFPWE.js";export{e as daemonVoiceCheck,b as doctor,a as runDoctorChecks,c as runNotificationChecks,d as runReminderChecks};
2
+ //# sourceMappingURL=doctor-5VFQVAVC.js.map
package/dist/index.d.ts CHANGED
@@ -1767,6 +1767,10 @@ declare const agentConfigSchema: z.ZodObject<{
1767
1767
  /** See systemVoiceSchema. Unset: one is assigned, of the agent's
1768
1768
  * gender when set, different from every other agent's. */
1769
1769
  system: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
1770
+ /** Voices to try, in order, when `system` names one that is not
1771
+ * installed (e.g. ["Ava (Premium)", "Allison"]). Unset, or none
1772
+ * installed: the best installed voice of its language and gender. */
1773
+ fallbacks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1770
1774
  elevenlabsVoiceId: z.ZodOptional<z.ZodString>;
1771
1775
  gender: z.ZodOptional<z.ZodEnum<["female", "male", "neutral"]>>;
1772
1776
  /** A few words on manner, e.g. "warm, upbeat, a little playful". */
@@ -1790,6 +1794,7 @@ declare const agentConfigSchema: z.ZodObject<{
1790
1794
  provider?: "system" | "elevenlabs" | undefined;
1791
1795
  style?: string | undefined;
1792
1796
  priority?: "high" | "normal" | "low" | undefined;
1797
+ fallbacks?: string[] | undefined;
1793
1798
  elevenlabsVoiceId?: string | undefined;
1794
1799
  gender?: "neutral" | "female" | "male" | undefined;
1795
1800
  intro?: string | undefined;
@@ -1801,6 +1806,7 @@ declare const agentConfigSchema: z.ZodObject<{
1801
1806
  provider?: "system" | "elevenlabs" | undefined;
1802
1807
  style?: string | undefined;
1803
1808
  priority?: "high" | "normal" | "low" | undefined;
1809
+ fallbacks?: string[] | undefined;
1804
1810
  elevenlabsVoiceId?: string | undefined;
1805
1811
  gender?: "neutral" | "female" | "male" | undefined;
1806
1812
  intro?: string | undefined;
@@ -1908,6 +1914,7 @@ declare const agentConfigSchema: z.ZodObject<{
1908
1914
  provider?: "system" | "elevenlabs" | undefined;
1909
1915
  style?: string | undefined;
1910
1916
  priority?: "high" | "normal" | "low" | undefined;
1917
+ fallbacks?: string[] | undefined;
1911
1918
  elevenlabsVoiceId?: string | undefined;
1912
1919
  gender?: "neutral" | "female" | "male" | undefined;
1913
1920
  intro?: string | undefined;
@@ -1993,6 +2000,7 @@ declare const agentConfigSchema: z.ZodObject<{
1993
2000
  provider?: "system" | "elevenlabs" | undefined;
1994
2001
  style?: string | undefined;
1995
2002
  priority?: "high" | "normal" | "low" | undefined;
2003
+ fallbacks?: string[] | undefined;
1996
2004
  elevenlabsVoiceId?: string | undefined;
1997
2005
  gender?: "neutral" | "female" | "male" | undefined;
1998
2006
  intro?: string | undefined;
@@ -2568,6 +2576,10 @@ declare const daemonConfigSchema: z.ZodObject<{
2568
2576
  /** See systemVoiceSchema. Unset: one is assigned, of the agent's
2569
2577
  * gender when set, different from every other agent's. */
2570
2578
  system: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
2579
+ /** Voices to try, in order, when `system` names one that is not
2580
+ * installed (e.g. ["Ava (Premium)", "Allison"]). Unset, or none
2581
+ * installed: the best installed voice of its language and gender. */
2582
+ fallbacks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2571
2583
  elevenlabsVoiceId: z.ZodOptional<z.ZodString>;
2572
2584
  gender: z.ZodOptional<z.ZodEnum<["female", "male", "neutral"]>>;
2573
2585
  /** A few words on manner, e.g. "warm, upbeat, a little playful". */
@@ -2591,6 +2603,7 @@ declare const daemonConfigSchema: z.ZodObject<{
2591
2603
  provider?: "system" | "elevenlabs" | undefined;
2592
2604
  style?: string | undefined;
2593
2605
  priority?: "high" | "normal" | "low" | undefined;
2606
+ fallbacks?: string[] | undefined;
2594
2607
  elevenlabsVoiceId?: string | undefined;
2595
2608
  gender?: "neutral" | "female" | "male" | undefined;
2596
2609
  intro?: string | undefined;
@@ -2602,6 +2615,7 @@ declare const daemonConfigSchema: z.ZodObject<{
2602
2615
  provider?: "system" | "elevenlabs" | undefined;
2603
2616
  style?: string | undefined;
2604
2617
  priority?: "high" | "normal" | "low" | undefined;
2618
+ fallbacks?: string[] | undefined;
2605
2619
  elevenlabsVoiceId?: string | undefined;
2606
2620
  gender?: "neutral" | "female" | "male" | undefined;
2607
2621
  intro?: string | undefined;
@@ -2709,6 +2723,7 @@ declare const daemonConfigSchema: z.ZodObject<{
2709
2723
  provider?: "system" | "elevenlabs" | undefined;
2710
2724
  style?: string | undefined;
2711
2725
  priority?: "high" | "normal" | "low" | undefined;
2726
+ fallbacks?: string[] | undefined;
2712
2727
  elevenlabsVoiceId?: string | undefined;
2713
2728
  gender?: "neutral" | "female" | "male" | undefined;
2714
2729
  intro?: string | undefined;
@@ -2794,6 +2809,7 @@ declare const daemonConfigSchema: z.ZodObject<{
2794
2809
  provider?: "system" | "elevenlabs" | undefined;
2795
2810
  style?: string | undefined;
2796
2811
  priority?: "high" | "normal" | "low" | undefined;
2812
+ fallbacks?: string[] | undefined;
2797
2813
  elevenlabsVoiceId?: string | undefined;
2798
2814
  gender?: "neutral" | "female" | "male" | undefined;
2799
2815
  intro?: string | undefined;
@@ -3377,6 +3393,25 @@ declare const daemonConfigSchema: z.ZodObject<{
3377
3393
  } | undefined;
3378
3394
  maxCallMinutes?: number | undefined;
3379
3395
  }>>;
3396
+ /** The phone app's Share camera (#325). The phone asks for this size and
3397
+ * rate; the browser picks the nearest the camera supports. The share
3398
+ * stops by itself after maxSeconds. */
3399
+ camera: z.ZodDefault<z.ZodObject<{
3400
+ width: z.ZodDefault<z.ZodNumber>;
3401
+ height: z.ZodDefault<z.ZodNumber>;
3402
+ frameRate: z.ZodDefault<z.ZodNumber>;
3403
+ maxSeconds: z.ZodDefault<z.ZodNumber>;
3404
+ }, "strip", z.ZodTypeAny, {
3405
+ width: number;
3406
+ height: number;
3407
+ frameRate: number;
3408
+ maxSeconds: number;
3409
+ }, {
3410
+ width?: number | undefined;
3411
+ height?: number | undefined;
3412
+ frameRate?: number | undefined;
3413
+ maxSeconds?: number | undefined;
3414
+ }>>;
3380
3415
  }, "strip", z.ZodTypeAny, {
3381
3416
  enabled: boolean;
3382
3417
  stunServers: string[];
@@ -3405,6 +3440,12 @@ declare const daemonConfigSchema: z.ZodObject<{
3405
3440
  accountId?: string | undefined;
3406
3441
  } | undefined;
3407
3442
  };
3443
+ camera: {
3444
+ width: number;
3445
+ height: number;
3446
+ frameRate: number;
3447
+ maxSeconds: number;
3448
+ };
3408
3449
  callUrlBase?: string | undefined;
3409
3450
  }, {
3410
3451
  enabled?: boolean | undefined;
@@ -3435,6 +3476,12 @@ declare const daemonConfigSchema: z.ZodObject<{
3435
3476
  } | undefined;
3436
3477
  maxCallMinutes?: number | undefined;
3437
3478
  } | undefined;
3479
+ camera?: {
3480
+ width?: number | undefined;
3481
+ height?: number | undefined;
3482
+ frameRate?: number | undefined;
3483
+ maxSeconds?: number | undefined;
3484
+ } | undefined;
3438
3485
  }>>;
3439
3486
  }, "strip", z.ZodTypeAny, {
3440
3487
  push: {
@@ -3565,6 +3612,12 @@ declare const daemonConfigSchema: z.ZodObject<{
3565
3612
  accountId?: string | undefined;
3566
3613
  } | undefined;
3567
3614
  };
3615
+ camera: {
3616
+ width: number;
3617
+ height: number;
3618
+ frameRate: number;
3619
+ maxSeconds: number;
3620
+ };
3568
3621
  callUrlBase?: string | undefined;
3569
3622
  };
3570
3623
  }, {
@@ -3697,6 +3750,12 @@ declare const daemonConfigSchema: z.ZodObject<{
3697
3750
  } | undefined;
3698
3751
  maxCallMinutes?: number | undefined;
3699
3752
  } | undefined;
3753
+ camera?: {
3754
+ width?: number | undefined;
3755
+ height?: number | undefined;
3756
+ frameRate?: number | undefined;
3757
+ maxSeconds?: number | undefined;
3758
+ } | undefined;
3700
3759
  } | undefined;
3701
3760
  }>>;
3702
3761
  crons: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodEffects<z.ZodObject<{
@@ -4318,15 +4377,15 @@ declare const daemonConfigSchema: z.ZodObject<{
4318
4377
  width: z.ZodNumber;
4319
4378
  height: z.ZodNumber;
4320
4379
  }, "strip", z.ZodTypeAny, {
4321
- x: number;
4322
- y: number;
4323
4380
  width: number;
4324
4381
  height: number;
4325
- }, {
4326
4382
  x: number;
4327
4383
  y: number;
4384
+ }, {
4328
4385
  width: number;
4329
4386
  height: number;
4387
+ x: number;
4388
+ y: number;
4330
4389
  }>>>;
4331
4390
  /** The last few seconds of a region, kept in memory by the daemon. Off
4332
4391
  * unless enabled; frames are written out only when asked for. */
@@ -4356,10 +4415,10 @@ declare const daemonConfigSchema: z.ZodObject<{
4356
4415
  changeThreshold: number;
4357
4416
  stableMs: number;
4358
4417
  regions: Record<string, {
4359
- x: number;
4360
- y: number;
4361
4418
  width: number;
4362
4419
  height: number;
4420
+ x: number;
4421
+ y: number;
4363
4422
  }>;
4364
4423
  buffer: {
4365
4424
  enabled: boolean;
@@ -4375,10 +4434,10 @@ declare const daemonConfigSchema: z.ZodObject<{
4375
4434
  changeThreshold?: number | undefined;
4376
4435
  stableMs?: number | undefined;
4377
4436
  regions?: Record<string, {
4378
- x: number;
4379
- y: number;
4380
4437
  width: number;
4381
4438
  height: number;
4439
+ x: number;
4440
+ y: number;
4382
4441
  }> | undefined;
4383
4442
  buffer?: {
4384
4443
  enabled?: boolean | undefined;
@@ -4518,6 +4577,10 @@ declare const daemonConfigSchema: z.ZodObject<{
4518
4577
  /** See systemVoiceSchema. Unset: one is assigned, of the agent's
4519
4578
  * gender when set, different from every other agent's. */
4520
4579
  system: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
4580
+ /** Voices to try, in order, when `system` names one that is not
4581
+ * installed (e.g. ["Ava (Premium)", "Allison"]). Unset, or none
4582
+ * installed: the best installed voice of its language and gender. */
4583
+ fallbacks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
4521
4584
  elevenlabsVoiceId: z.ZodOptional<z.ZodString>;
4522
4585
  gender: z.ZodOptional<z.ZodEnum<["female", "male", "neutral"]>>;
4523
4586
  /** A few words on manner, e.g. "warm, upbeat, a little playful". */
@@ -4544,6 +4607,7 @@ declare const daemonConfigSchema: z.ZodObject<{
4544
4607
  provider?: "system" | "elevenlabs" | undefined;
4545
4608
  name?: string | undefined;
4546
4609
  style?: string | undefined;
4610
+ fallbacks?: string[] | undefined;
4547
4611
  elevenlabsVoiceId?: string | undefined;
4548
4612
  gender?: "neutral" | "female" | "male" | undefined;
4549
4613
  intro?: string | undefined;
@@ -4553,6 +4617,7 @@ declare const daemonConfigSchema: z.ZodObject<{
4553
4617
  provider?: "system" | "elevenlabs" | undefined;
4554
4618
  name?: string | undefined;
4555
4619
  style?: string | undefined;
4620
+ fallbacks?: string[] | undefined;
4556
4621
  elevenlabsVoiceId?: string | undefined;
4557
4622
  gender?: "neutral" | "female" | "male" | undefined;
4558
4623
  intro?: string | undefined;
@@ -6004,6 +6069,7 @@ declare const daemonConfigSchema: z.ZodObject<{
6004
6069
  provider?: "system" | "elevenlabs" | undefined;
6005
6070
  style?: string | undefined;
6006
6071
  priority?: "high" | "normal" | "low" | undefined;
6072
+ fallbacks?: string[] | undefined;
6007
6073
  elevenlabsVoiceId?: string | undefined;
6008
6074
  gender?: "neutral" | "female" | "male" | undefined;
6009
6075
  intro?: string | undefined;
@@ -6102,10 +6168,10 @@ declare const daemonConfigSchema: z.ZodObject<{
6102
6168
  changeThreshold: number;
6103
6169
  stableMs: number;
6104
6170
  regions: Record<string, {
6105
- x: number;
6106
- y: number;
6107
6171
  width: number;
6108
6172
  height: number;
6173
+ x: number;
6174
+ y: number;
6109
6175
  }>;
6110
6176
  buffer: {
6111
6177
  enabled: boolean;
@@ -6250,6 +6316,12 @@ declare const daemonConfigSchema: z.ZodObject<{
6250
6316
  accountId?: string | undefined;
6251
6317
  } | undefined;
6252
6318
  };
6319
+ camera: {
6320
+ width: number;
6321
+ height: number;
6322
+ frameRate: number;
6323
+ maxSeconds: number;
6324
+ };
6253
6325
  callUrlBase?: string | undefined;
6254
6326
  };
6255
6327
  };
@@ -6358,6 +6430,7 @@ declare const daemonConfigSchema: z.ZodObject<{
6358
6430
  provider?: "system" | "elevenlabs" | undefined;
6359
6431
  name?: string | undefined;
6360
6432
  style?: string | undefined;
6433
+ fallbacks?: string[] | undefined;
6361
6434
  elevenlabsVoiceId?: string | undefined;
6362
6435
  gender?: "neutral" | "female" | "male" | undefined;
6363
6436
  intro?: string | undefined;
@@ -6676,6 +6749,7 @@ declare const daemonConfigSchema: z.ZodObject<{
6676
6749
  provider?: "system" | "elevenlabs" | undefined;
6677
6750
  style?: string | undefined;
6678
6751
  priority?: "high" | "normal" | "low" | undefined;
6752
+ fallbacks?: string[] | undefined;
6679
6753
  elevenlabsVoiceId?: string | undefined;
6680
6754
  gender?: "neutral" | "female" | "male" | undefined;
6681
6755
  intro?: string | undefined;
@@ -6768,10 +6842,10 @@ declare const daemonConfigSchema: z.ZodObject<{
6768
6842
  changeThreshold?: number | undefined;
6769
6843
  stableMs?: number | undefined;
6770
6844
  regions?: Record<string, {
6771
- x: number;
6772
- y: number;
6773
6845
  width: number;
6774
6846
  height: number;
6847
+ x: number;
6848
+ y: number;
6775
6849
  }> | undefined;
6776
6850
  buffer?: {
6777
6851
  enabled?: boolean | undefined;
@@ -6917,6 +6991,12 @@ declare const daemonConfigSchema: z.ZodObject<{
6917
6991
  } | undefined;
6918
6992
  maxCallMinutes?: number | undefined;
6919
6993
  } | undefined;
6994
+ camera?: {
6995
+ width?: number | undefined;
6996
+ height?: number | undefined;
6997
+ frameRate?: number | undefined;
6998
+ maxSeconds?: number | undefined;
6999
+ } | undefined;
6920
7000
  } | undefined;
6921
7001
  } | undefined;
6922
7002
  crons?: Record<string, {
@@ -7024,6 +7104,7 @@ declare const daemonConfigSchema: z.ZodObject<{
7024
7104
  provider?: "system" | "elevenlabs" | undefined;
7025
7105
  name?: string | undefined;
7026
7106
  style?: string | undefined;
7107
+ fallbacks?: string[] | undefined;
7027
7108
  elevenlabsVoiceId?: string | undefined;
7028
7109
  gender?: "neutral" | "female" | "male" | undefined;
7029
7110
  intro?: string | undefined;
@@ -7881,6 +7962,7 @@ declare class AgentXDaemon {
7881
7962
  private screenBuffer?;
7882
7963
  /** Voice for agents on mesh peers: see src/daemon/voice-mesh-proxy.ts. */
7883
7964
  private voiceMesh;
7965
+ private voiceHealth?;
7884
7966
  /** Persistent-claude process registry. Null when no agent has
7885
7967
  * persistentProcess: true (legacy spawn-per-task path). */
7886
7968
  private sessionMonitor?;
@@ -7900,6 +7982,9 @@ declare class AgentXDaemon {
7900
7982
  constructor(configPath?: string);
7901
7983
  start(): Promise<void>;
7902
7984
  stop(): Promise<void>;
7985
+ /** Deliver a notice to the owner through the channel router: the
7986
+ * address it was given, else notifications.channel (push or ntfy). */
7987
+ private ownerSender;
7903
7988
  /** In-flight work the drain waits for: local agent tasks + mesh forwards. */
7904
7989
  private inflightCounts;
7905
7990
  /** Set by start(): the same graceful path a SIGTERM takes. */
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{a as L}from"./chunk-C245D4BZ.js";import{d as St,e as kt,ea as Tt,f as vt,fa as Mt,g as xt,h as $t,i as Ct,j as Pt,k as bt}from"./chunk-3C2SQDIH.js";import"./chunk-JU67IZLC.js";import"./chunk-BYJ3A55Y.js";import"./chunk-NMFXY3QU.js";import"./chunk-4XBYHKYG.js";import"./chunk-LQRBGQIR.js";import"./chunk-ZVP6GB4G.js";import"./chunk-JBVABB26.js";import"./chunk-2D3RYIDU.js";import"./chunk-EKJG63EJ.js";import{S as yt,l as lt,m as ct,n as dt,o as mt,p as pt}from"./chunk-OTMDMGHE.js";import"./chunk-6LTD7XL5.js";import"./chunk-N6EWZGIX.js";import"./chunk-WP6KLXTP.js";import"./chunk-DP7RTNDM.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-HXW4NAWF.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-SELIVR6U.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import{s as ut}from"./chunk-5Y7QRFSL.js";import"./chunk-WLX4766Y.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-K6CHA6JJ.js";import"./chunk-DWADWDMU.js";import"./chunk-23A5K5UW.js";import"./chunk-QD6IICK7.js";import"./chunk-VWTBHLMX.js";import"./chunk-RCKICCTT.js";import{a as ht}from"./chunk-EMRQ6W5J.js";import"./chunk-CECHWYJ2.js";import"./chunk-XJQNIFZ4.js";import{f as gt,g as ft}from"./chunk-AAA6NGY5.js";import"./chunk-WPNRDEHW.js";import"./chunk-2GIDVZ4H.js";import{j as it,k as rt,l as at}from"./chunk-DJMUP6TK.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.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-5MUJZODV.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{A as nt,v as tt,x as st,y as ot}from"./chunk-AHOGFVHA.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(`
1
+ import{a as L}from"./chunk-C245D4BZ.js";import{d as St,e as kt,ea as Tt,f as vt,fa as Mt,g as xt,h as $t,i as Ct,j as Pt,k as bt}from"./chunk-OWRPCMGW.js";import"./chunk-FWQVXZ5T.js";import"./chunk-PY54XYAG.js";import"./chunk-BYJ3A55Y.js";import"./chunk-NMFXY3QU.js";import"./chunk-LQRBGQIR.js";import"./chunk-ZVP6GB4G.js";import"./chunk-VWMO4C72.js";import"./chunk-AQASR6KR.js";import"./chunk-2D3RYIDU.js";import"./chunk-EKJG63EJ.js";import{R as yt,k as lt,l as ct,m as dt,n as mt,o as pt}from"./chunk-OSHG52OO.js";import"./chunk-PBRI3MTE.js";import"./chunk-WP6KLXTP.js";import"./chunk-N6EWZGIX.js";import"./chunk-DP7RTNDM.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-Z5TXWHDN.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-576L7ZFD.js";import"./chunk-2AXFYDWF.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import{s as ut}from"./chunk-DMWFRKWR.js";import"./chunk-55N4VTWX.js";import"./chunk-VWTBHLMX.js";import"./chunk-QKV7FN67.js";import{a as ht}from"./chunk-PHSYP22H.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-UFPWMNUW.js";import"./chunk-MYVHVJWZ.js";import"./chunk-DWADWDMU.js";import"./chunk-23A5K5UW.js";import"./chunk-QD6IICK7.js";import"./chunk-CECHWYJ2.js";import"./chunk-MESWF2ZM.js";import{f as gt,g as ft}from"./chunk-TT4T6CB3.js";import"./chunk-WPNRDEHW.js";import"./chunk-2GIDVZ4H.js";import{j as it,k as rt,l as at}from"./chunk-YVLFX35J.js";import"./chunk-FX3D7YON.js";import"./chunk-72SZI2UW.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-5MUJZODV.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{A as nt,v as tt,x as st,y as ot}from"./chunk-RAYOK4GI.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).