agentix-cli 0.37.0 → 0.40.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 (95) hide show
  1. package/apps/mac-helper/Sources/AgentXHelper/AXTree.swift +29 -11
  2. package/apps/mac-helper/Sources/AgentXHelper/Pointer.swift +7 -4
  3. package/apps/mac-helper/Sources/AgentXHelper/Presence.swift +7 -3
  4. package/apps/mac-helper/Sources/AgentXHelper/Typer.swift +2 -1
  5. package/apps/mac-helper/Sources/AgentXHelper/Vision.swift +53 -4
  6. package/apps/mac-helper/Sources/AgentXHelper/main.swift +4 -2
  7. package/apps/mac-voice/Sources/AgentXVoice/AgentClient.swift +6 -0
  8. package/apps/mac-voice/Sources/AgentXVoice/Panel.swift +8 -0
  9. package/apps/mac-voice/Sources/AgentXVoice/Speech.swift +82 -4
  10. package/apps/mac-voice/Sources/AgentXVoice/SpeechEnd.swift +71 -0
  11. package/apps/mac-voice/Sources/AgentXVoice/main.swift +28 -0
  12. package/dist/{App-TW5N7JY2.js → App-HSRGG5VA.js} +2 -2
  13. package/dist/{ChatApp-MRGX7JBT.js → ChatApp-4FOU6Q3S.js} +2 -2
  14. package/dist/{agent-FQHWBQP2.js → agent-54NUP2Z3.js} +2 -2
  15. package/dist/{board-dashboard-2YEYVCUS.js → board-dashboard-R7FWWFFK.js} +4 -4
  16. package/dist/{chunk-3SKFX6G3.js → chunk-B32HVIDN.js} +2 -2
  17. package/dist/{chunk-ADRAW342.js → chunk-B5HKRYCU.js} +2 -2
  18. package/dist/{chunk-N6APC3DF.js → chunk-DIKZWTL5.js} +5 -5
  19. package/dist/{chunk-AKIYB3IJ.js → chunk-FAJEBVZE.js} +2 -2
  20. package/dist/{chunk-SR6TVIIS.js → chunk-H4MIYENA.js} +2 -2
  21. package/dist/chunk-IAG6FI3Q.js +13 -0
  22. package/dist/chunk-IAG6FI3Q.js.map +1 -0
  23. package/dist/{chunk-4ZGX4L6Q.js → chunk-L2RUE6T4.js} +260 -174
  24. package/dist/chunk-L2RUE6T4.js.map +1 -0
  25. package/dist/{chunk-RRLIZLBH.js → chunk-NZ6AQIKJ.js} +2 -2
  26. package/dist/{chunk-IEE475O2.js → chunk-P7LNYB53.js} +2 -2
  27. package/dist/{chunk-UORMWVLP.js → chunk-R3VXG2Q5.js} +133 -133
  28. package/dist/chunk-R3VXG2Q5.js.map +1 -0
  29. package/dist/{chunk-MC6I6ZLY.js → chunk-RCVGIKC2.js} +2 -2
  30. package/dist/{chunk-GL7VC26K.js → chunk-REPZID5M.js} +2 -2
  31. package/dist/{chunk-EJWIRM52.js → chunk-RQKUQOFC.js} +2 -2
  32. package/dist/{chunk-FHF4RA4Q.js → chunk-SJPLXXCI.js} +2 -2
  33. package/dist/{chunk-HEV3AVFJ.js → chunk-WBGROLOX.js} +2 -2
  34. package/dist/{chunk-JLEADOCC.js → chunk-X763UOES.js} +2 -2
  35. package/dist/cli.js +1 -1
  36. package/dist/client-6BGTH2TT.js +2 -0
  37. package/dist/config-SRTXHGSK.js +2 -0
  38. package/dist/config-mutator-KJ5GEMVV.js +2 -0
  39. package/dist/doctor-J4FLV45L.js +2 -0
  40. package/dist/index.d.ts +32 -32
  41. package/dist/index.js +1 -1
  42. package/dist/program-E6AXVO5W.js +2 -0
  43. package/dist/query-ZSUBNWOL.js +2 -0
  44. package/dist/{registry-TDYF7HGH.js → registry-OMUDCBKM.js} +2 -2
  45. package/dist/{request-planner-DF74JHQB.js → request-planner-326NOKPZ.js} +2 -2
  46. package/dist/{review-candidates-SEAGMKI6.js → review-candidates-LEOPEOEG.js} +2 -2
  47. package/dist/{routing-JKWL3L3Q.js → routing-AWIRBYGU.js} +2 -2
  48. package/dist/scheduler-PGGYW5AB.js +2 -0
  49. package/dist/{seat-C6TOB63Q.js → seat-XB4EGUKJ.js} +2 -2
  50. package/dist/{select-YB5KF27O.js → select-L4VIYSFJ.js} +2 -2
  51. package/dist/wiki-GBC6I7ZX.js +2 -0
  52. package/package.json +1 -1
  53. package/dist/chunk-4ZGX4L6Q.js.map +0 -1
  54. package/dist/chunk-UORMWVLP.js.map +0 -1
  55. package/dist/chunk-WFKS4O34.js +0 -13
  56. package/dist/chunk-WFKS4O34.js.map +0 -1
  57. package/dist/client-4KD2UA75.js +0 -2
  58. package/dist/config-WN3R3BPU.js +0 -2
  59. package/dist/config-mutator-2FIUL4DA.js +0 -2
  60. package/dist/doctor-BNO46EOR.js +0 -2
  61. package/dist/program-Z6EK44PV.js +0 -2
  62. package/dist/query-TKUDIOBZ.js +0 -2
  63. package/dist/scheduler-7CYBDKQ7.js +0 -2
  64. package/dist/wiki-7FCINSKJ.js +0 -2
  65. /package/dist/{App-TW5N7JY2.js.map → App-HSRGG5VA.js.map} +0 -0
  66. /package/dist/{ChatApp-MRGX7JBT.js.map → ChatApp-4FOU6Q3S.js.map} +0 -0
  67. /package/dist/{agent-FQHWBQP2.js.map → agent-54NUP2Z3.js.map} +0 -0
  68. /package/dist/{board-dashboard-2YEYVCUS.js.map → board-dashboard-R7FWWFFK.js.map} +0 -0
  69. /package/dist/{chunk-3SKFX6G3.js.map → chunk-B32HVIDN.js.map} +0 -0
  70. /package/dist/{chunk-ADRAW342.js.map → chunk-B5HKRYCU.js.map} +0 -0
  71. /package/dist/{chunk-N6APC3DF.js.map → chunk-DIKZWTL5.js.map} +0 -0
  72. /package/dist/{chunk-AKIYB3IJ.js.map → chunk-FAJEBVZE.js.map} +0 -0
  73. /package/dist/{chunk-SR6TVIIS.js.map → chunk-H4MIYENA.js.map} +0 -0
  74. /package/dist/{chunk-RRLIZLBH.js.map → chunk-NZ6AQIKJ.js.map} +0 -0
  75. /package/dist/{chunk-IEE475O2.js.map → chunk-P7LNYB53.js.map} +0 -0
  76. /package/dist/{chunk-MC6I6ZLY.js.map → chunk-RCVGIKC2.js.map} +0 -0
  77. /package/dist/{chunk-GL7VC26K.js.map → chunk-REPZID5M.js.map} +0 -0
  78. /package/dist/{chunk-EJWIRM52.js.map → chunk-RQKUQOFC.js.map} +0 -0
  79. /package/dist/{chunk-FHF4RA4Q.js.map → chunk-SJPLXXCI.js.map} +0 -0
  80. /package/dist/{chunk-HEV3AVFJ.js.map → chunk-WBGROLOX.js.map} +0 -0
  81. /package/dist/{chunk-JLEADOCC.js.map → chunk-X763UOES.js.map} +0 -0
  82. /package/dist/{client-4KD2UA75.js.map → client-6BGTH2TT.js.map} +0 -0
  83. /package/dist/{config-WN3R3BPU.js.map → config-SRTXHGSK.js.map} +0 -0
  84. /package/dist/{config-mutator-2FIUL4DA.js.map → config-mutator-KJ5GEMVV.js.map} +0 -0
  85. /package/dist/{doctor-BNO46EOR.js.map → doctor-J4FLV45L.js.map} +0 -0
  86. /package/dist/{program-Z6EK44PV.js.map → program-E6AXVO5W.js.map} +0 -0
  87. /package/dist/{query-TKUDIOBZ.js.map → query-ZSUBNWOL.js.map} +0 -0
  88. /package/dist/{registry-TDYF7HGH.js.map → registry-OMUDCBKM.js.map} +0 -0
  89. /package/dist/{request-planner-DF74JHQB.js.map → request-planner-326NOKPZ.js.map} +0 -0
  90. /package/dist/{review-candidates-SEAGMKI6.js.map → review-candidates-LEOPEOEG.js.map} +0 -0
  91. /package/dist/{routing-JKWL3L3Q.js.map → routing-AWIRBYGU.js.map} +0 -0
  92. /package/dist/{scheduler-7CYBDKQ7.js.map → scheduler-PGGYW5AB.js.map} +0 -0
  93. /package/dist/{seat-C6TOB63Q.js.map → seat-XB4EGUKJ.js.map} +0 -0
  94. /package/dist/{select-YB5KF27O.js.map → select-L4VIYSFJ.js.map} +0 -0
  95. /package/dist/{wiki-7FCINSKJ.js.map → wiki-GBC6I7ZX.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import{a as T,b as P,c as _,d as G}from"./chunk-PNWNVOEZ.js";import{b as ee}from"./chunk-64P4QHSZ.js";import{a as te,b as se,c as re,d as ie,e as ne}from"./chunk-AJ5RMU7X.js";import{v as Z,w as he}from"./chunk-SR6TVIIS.js";import{a as Q,b as pe}from"./chunk-AJONZWLT.js";import{c as M,d as L}from"./chunk-QOYAX2FT.js";import{o as X,p as de}from"./chunk-LCIREYTD.js";var A={version:2,levels:[{id:"category",description:"Top-level kind of work. Closed set \u2014 pick the closest fit.",axes:[{name:"kind",type:"enum",values:["code","ops","support","admin","knowledge","social","system"],description:"Which category this work belongs in."}]},{id:"verb",description:"Specific intent \u2014 verb-level only, NOT client/project-bound.",axes:[{name:"name",type:"free",description:"Lower-kebab dot-namespaced verb. Examples: review.merge-request, fix.bug, investigate.error, deploy.staging, deploy.production, rollback.release, spec.feature, triage.issue, document.feature, chat.greeting, chat.support-request, schedule.add, config.change, ingest.contact, transcribe.audio, brief.daily, summarize.thread, plan.work."}]}],leafInput:{name:"input",type:"enum",values:["telegram","whatsapp","slack","discord","gitlab-mr","gitlab-issue","github-issue","github-pr","cron","webhook","mesh","http"],description:"Where the message entered the system."},leafOutput:{name:"output",type:"free",description:"One short sentence describing what the agent is expected to produce. Generic \u2014 refers to the verb's outcome, not the specific client/project (those are on the event metadata already)."}},F=[{category:"code",verb:"review.merge-request",description:"Review a GitLab MR or GitHub PR"},{category:"code",verb:"review.code-change",description:"General code review (snippet, diff)"},{category:"code",verb:"fix.bug",description:"Fix a reported bug"},{category:"code",verb:"implement.feature",description:"Build a new feature"},{category:"code",verb:"investigate.error",description:"Investigate a failing test, exception, pipeline"},{category:"code",verb:"refactor.code",description:"Restructure existing code without behaviour change"},{category:"code",verb:"spec.feature",description:"Write or update a feature spec / RFC"},{category:"code",verb:"triage.issue",description:"Classify, label, or assign an issue"},{category:"code",verb:"answer.code-question",description:"Answer a code-related question"},{category:"ops",verb:"deploy.staging",description:"Deploy to a staging/preview environment"},{category:"ops",verb:"deploy.production",description:"Deploy to production"},{category:"ops",verb:"rollback.release",description:"Roll back a release"},{category:"ops",verb:"investigate.incident",description:"Investigate a production incident"},{category:"ops",verb:"monitor.system",description:"Check system status / metrics"},{category:"ops",verb:"rotate.credential",description:"Rotate a token, key, certificate"},{category:"ops",verb:"audit.security",description:"Review for security issues"},{category:"support",verb:"chat.greeting",description:"A casual hello, no actionable request"},{category:"support",verb:"chat.support-request",description:"End-user / customer asking for help"},{category:"support",verb:"chat.casual",description:"Informal back-and-forth chat"},{category:"support",verb:"answer.question",description:"Answer an open-ended question"},{category:"support",verb:"route.request",description:"Forward a request to the right agent"},{category:"admin",verb:"config.change",description:"Change agentx.json / environment / config"},{category:"admin",verb:"schedule.add",description:"Add a new cron / scheduled task"},{category:"admin",verb:"schedule.remove",description:"Remove or disable a schedule"},{category:"admin",verb:"token.create",description:"Mint a scoped API token"},{category:"admin",verb:"agent.add",description:"Configure a new agent"},{category:"admin",verb:"channel.add",description:"Wire up a new channel"},{category:"knowledge",verb:"document.feature",description:"Write or update documentation"},{category:"knowledge",verb:"summarize.thread",description:"Summarize a long conversation/thread"},{category:"knowledge",verb:"research.topic",description:"Investigate / gather info on a topic"},{category:"knowledge",verb:"wiki.absorb",description:"Roll raw entries into typed wiki articles"},{category:"social",verb:"brief.daily",description:"Compose a daily brief / digest"},{category:"social",verb:"draft.post",description:"Draft a marketing post / announcement"},{category:"social",verb:"report.weekly",description:"Compose a weekly status report"},{category:"system",verb:"classify.intent",description:"Internal: graph-classifier sub-call"}];import{readFileSync as D,writeFileSync as J,appendFileSync as ge,existsSync as I,mkdirSync as U,renameSync as ue}from"fs";import{resolve as R,dirname as ae}from"path";import{createHash as fe}from"crypto";var H=class{baseDir;log;constructor(e={}){this.baseDir=e.baseDir??R(process.cwd(),".agentx/graph"),this.log=e.log??console.error.bind(console,"[graph]"),U(this.baseDir,{recursive:!0})}schemaPath(){return R(this.baseDir,"schema.json")}nodesPath(){return R(this.baseDir,"nodes.json")}indexPath(){return R(this.baseDir,"index.json")}classificationsPath(){return R(this.baseDir,"classifications.jsonl")}loadSchema(){let e=this.schemaPath();if(!I(e))return this.saveSchema(A),this.log("seeded starter schema at",e),A;let t=D(e,"utf-8"),s=T.safeParse(JSON.parse(t));if(!s.success)throw new Error(`Invalid ${e}: ${s.error.issues.map(r=>r.message).join("; ")}`);if((s.data.version??1)<(A.version??2)){let r=e.replace(/\.json$/,`.v${s.data.version??1}.bak.json`);try{J(r,t),this.log(`migrated graph schema v${s.data.version??1} -> v${A.version}; old saved at ${r}`)}catch(n){this.log(`could not back up old schema: ${n?.message??n}`)}this.saveSchema(A);let o=this.nodesPath();if(I(o)){let n=o.replace(/\.json$/,".v1.bak.json");try{J(n,D(o,"utf-8")),this.log(`archived v1 nodes.json -> ${n}`)}catch(i){this.log(`could not back up old nodes: ${i?.message??i}`)}try{let i=oe();this.saveNodes(i)}catch(i){this.log(`could not seed v2 nodes: ${i?.message??i}`)}}return A}return s.data}saveSchema(e){let t=T.safeParse(e);if(!t.success)throw new Error(`Refusing to save invalid schema: ${t.error.issues.map(s=>s.message).join("; ")}`);B(this.schemaPath(),t.data)}loadNodes(){let e=this.nodesPath();if(!I(e)){let r=oe();return this.saveNodes(r),r}let t=D(e,"utf-8"),s=_.safeParse(JSON.parse(t));if(!s.success)throw new Error(`Invalid ${e}: ${s.error.issues.map(r=>r.message).join("; ")}`);return s.data}saveNodes(e){let t=_.safeParse(e);if(!t.success)throw new Error(`Refusing to save invalid nodes file: ${t.error.issues.map(s=>s.message).join("; ")}`);B(this.nodesPath(),t.data)}validateNode(e,t,s){let r=t.levels.find(i=>i.id===e.level);if(!r)throw new Error(`Unknown level: "${e.level}"`);let o=r.axes.filter(i=>!i.optional).filter(i=>!(i.name in e.axes));if(o.length)throw new Error(`Node ${e.id} (${e.level}) missing required axes: ${o.map(i=>i.name).join(", ")}`);for(let i of r.axes){let a=e.axes[i.name];if(a!=null){if(i.type==="enum"&&i.values&&!i.values.includes(a))throw new Error(`Node ${e.id}: axis ${i.name}="${a}" not in enum ${JSON.stringify(i.values)}`);if(i.type==="ref"){if(!s.some(c=>c.id===a))throw new Error(`Node ${e.id}: axis ${i.name}="${a}" refers to unknown node`);if(i.refLevel){let c=s.find(l=>l.id===a);if(c.level!==i.refLevel)throw new Error(`Node ${e.id}: axis ${i.name} expected level "${i.refLevel}" but got "${c.level}"`)}}}}let n=t.levels.findIndex(i=>i.id===e.level);if(n===0){if(e.parentId!==null)throw new Error(`Root-level node ${e.id} must have parentId: null`)}else{if(!e.parentId)throw new Error(`Non-root node ${e.id} must have a parentId`);let i=s.find(c=>c.id===e.parentId);if(!i)throw new Error(`Node ${e.id}: parent "${e.parentId}" not found`);let a=t.levels.findIndex(c=>c.id===i.level);if(a<0||a>=n)throw new Error(`Node ${e.id} at level "${e.level}" has parent at level "${i.level}" \u2014 parent must be at a higher level`)}}commitNodesAlongPath(e,t,s,r){let o=[],n=[],i=new Date().toISOString();for(let a=0;a<e.length;a++){let c=e[a],l=this.loadNodes().nodes;if(l.find(m=>m.id===c)){n.push(c);continue}let p=0;for(let m=a-1;m>=0;m--){let w=e[m],N=l.find(k=>k.id===w)||o.find(k=>k.id===w);if(N){p=s.levels.findIndex(k=>k.id===N.level)+1;break}}let g=t[c]??{},d=null;for(let m=p;m<s.levels.length;m++){let w=s.levels[m];if(w.axes.filter(k=>!k.optional).filter(k=>!(k.name in g)).length===0){d=w.id,p=m+1;break}}if(!d&&p<s.levels.length&&(d=s.levels[p].id,p++),!d)throw new Error(`Can't place node ${c} \u2014 no schema level left (cursor=${p}, levels=${s.levels.length})`);let h=null,f=s.levels.findIndex(m=>m.id===d);for(let m=a-1;m>=0;m--){let w=e[m],N=l.find(C=>C.id===w)||o.find(C=>C.id===w);if(!N)continue;let k=s.levels.findIndex(C=>C.id===N.level);if(k>=0&&k<f){h=w;break}}let u={id:c,level:d,parentId:h,axes:g,createdAt:i,createdBy:r};this.addNode(u),o.push(u)}return{added:o,skipped:n}}addNode(e){let t=this.loadSchema(),s=this.loadNodes();if(s.nodes.some(r=>r.id===e.id))throw new Error(`Node id already exists: ${e.id}`);return this.validateNode(e,t,[...s.nodes,e]),s.nodes.push(e),this.saveNodes(s),e}appendClassification(e){let t=P.safeParse(e);if(!t.success){let o=t.error.issues.map(n=>`${n.path.join(".")}: ${n.message}`).join(" \xB7 ");return this.log(`skipped invalid classification \u2014 ${o} \xB7`,`path=${JSON.stringify(e.path)}`,`axes-keys=${JSON.stringify(Object.keys(e.proposedAxes||{}))}`),!1}let s=JSON.stringify(t.data)+`
1
+ import{a as T,b as P,c as _,d as G}from"./chunk-PNWNVOEZ.js";import{b as ee}from"./chunk-64P4QHSZ.js";import{a as te,b as se,c as re,d as ie,e as ne}from"./chunk-AJ5RMU7X.js";import{v as Z,w as he}from"./chunk-H4MIYENA.js";import{a as Q,b as pe}from"./chunk-AJONZWLT.js";import{c as M,d as L}from"./chunk-QOYAX2FT.js";import{o as X,p as de}from"./chunk-LCIREYTD.js";var A={version:2,levels:[{id:"category",description:"Top-level kind of work. Closed set \u2014 pick the closest fit.",axes:[{name:"kind",type:"enum",values:["code","ops","support","admin","knowledge","social","system"],description:"Which category this work belongs in."}]},{id:"verb",description:"Specific intent \u2014 verb-level only, NOT client/project-bound.",axes:[{name:"name",type:"free",description:"Lower-kebab dot-namespaced verb. Examples: review.merge-request, fix.bug, investigate.error, deploy.staging, deploy.production, rollback.release, spec.feature, triage.issue, document.feature, chat.greeting, chat.support-request, schedule.add, config.change, ingest.contact, transcribe.audio, brief.daily, summarize.thread, plan.work."}]}],leafInput:{name:"input",type:"enum",values:["telegram","whatsapp","slack","discord","gitlab-mr","gitlab-issue","github-issue","github-pr","cron","webhook","mesh","http"],description:"Where the message entered the system."},leafOutput:{name:"output",type:"free",description:"One short sentence describing what the agent is expected to produce. Generic \u2014 refers to the verb's outcome, not the specific client/project (those are on the event metadata already)."}},F=[{category:"code",verb:"review.merge-request",description:"Review a GitLab MR or GitHub PR"},{category:"code",verb:"review.code-change",description:"General code review (snippet, diff)"},{category:"code",verb:"fix.bug",description:"Fix a reported bug"},{category:"code",verb:"implement.feature",description:"Build a new feature"},{category:"code",verb:"investigate.error",description:"Investigate a failing test, exception, pipeline"},{category:"code",verb:"refactor.code",description:"Restructure existing code without behaviour change"},{category:"code",verb:"spec.feature",description:"Write or update a feature spec / RFC"},{category:"code",verb:"triage.issue",description:"Classify, label, or assign an issue"},{category:"code",verb:"answer.code-question",description:"Answer a code-related question"},{category:"ops",verb:"deploy.staging",description:"Deploy to a staging/preview environment"},{category:"ops",verb:"deploy.production",description:"Deploy to production"},{category:"ops",verb:"rollback.release",description:"Roll back a release"},{category:"ops",verb:"investigate.incident",description:"Investigate a production incident"},{category:"ops",verb:"monitor.system",description:"Check system status / metrics"},{category:"ops",verb:"rotate.credential",description:"Rotate a token, key, certificate"},{category:"ops",verb:"audit.security",description:"Review for security issues"},{category:"support",verb:"chat.greeting",description:"A casual hello, no actionable request"},{category:"support",verb:"chat.support-request",description:"End-user / customer asking for help"},{category:"support",verb:"chat.casual",description:"Informal back-and-forth chat"},{category:"support",verb:"answer.question",description:"Answer an open-ended question"},{category:"support",verb:"route.request",description:"Forward a request to the right agent"},{category:"admin",verb:"config.change",description:"Change agentx.json / environment / config"},{category:"admin",verb:"schedule.add",description:"Add a new cron / scheduled task"},{category:"admin",verb:"schedule.remove",description:"Remove or disable a schedule"},{category:"admin",verb:"token.create",description:"Mint a scoped API token"},{category:"admin",verb:"agent.add",description:"Configure a new agent"},{category:"admin",verb:"channel.add",description:"Wire up a new channel"},{category:"knowledge",verb:"document.feature",description:"Write or update documentation"},{category:"knowledge",verb:"summarize.thread",description:"Summarize a long conversation/thread"},{category:"knowledge",verb:"research.topic",description:"Investigate / gather info on a topic"},{category:"knowledge",verb:"wiki.absorb",description:"Roll raw entries into typed wiki articles"},{category:"social",verb:"brief.daily",description:"Compose a daily brief / digest"},{category:"social",verb:"draft.post",description:"Draft a marketing post / announcement"},{category:"social",verb:"report.weekly",description:"Compose a weekly status report"},{category:"system",verb:"classify.intent",description:"Internal: graph-classifier sub-call"}];import{readFileSync as D,writeFileSync as J,appendFileSync as ge,existsSync as I,mkdirSync as U,renameSync as ue}from"fs";import{resolve as R,dirname as ae}from"path";import{createHash as fe}from"crypto";var H=class{baseDir;log;constructor(e={}){this.baseDir=e.baseDir??R(process.cwd(),".agentx/graph"),this.log=e.log??console.error.bind(console,"[graph]"),U(this.baseDir,{recursive:!0})}schemaPath(){return R(this.baseDir,"schema.json")}nodesPath(){return R(this.baseDir,"nodes.json")}indexPath(){return R(this.baseDir,"index.json")}classificationsPath(){return R(this.baseDir,"classifications.jsonl")}loadSchema(){let e=this.schemaPath();if(!I(e))return this.saveSchema(A),this.log("seeded starter schema at",e),A;let t=D(e,"utf-8"),s=T.safeParse(JSON.parse(t));if(!s.success)throw new Error(`Invalid ${e}: ${s.error.issues.map(r=>r.message).join("; ")}`);if((s.data.version??1)<(A.version??2)){let r=e.replace(/\.json$/,`.v${s.data.version??1}.bak.json`);try{J(r,t),this.log(`migrated graph schema v${s.data.version??1} -> v${A.version}; old saved at ${r}`)}catch(n){this.log(`could not back up old schema: ${n?.message??n}`)}this.saveSchema(A);let o=this.nodesPath();if(I(o)){let n=o.replace(/\.json$/,".v1.bak.json");try{J(n,D(o,"utf-8")),this.log(`archived v1 nodes.json -> ${n}`)}catch(i){this.log(`could not back up old nodes: ${i?.message??i}`)}try{let i=oe();this.saveNodes(i)}catch(i){this.log(`could not seed v2 nodes: ${i?.message??i}`)}}return A}return s.data}saveSchema(e){let t=T.safeParse(e);if(!t.success)throw new Error(`Refusing to save invalid schema: ${t.error.issues.map(s=>s.message).join("; ")}`);B(this.schemaPath(),t.data)}loadNodes(){let e=this.nodesPath();if(!I(e)){let r=oe();return this.saveNodes(r),r}let t=D(e,"utf-8"),s=_.safeParse(JSON.parse(t));if(!s.success)throw new Error(`Invalid ${e}: ${s.error.issues.map(r=>r.message).join("; ")}`);return s.data}saveNodes(e){let t=_.safeParse(e);if(!t.success)throw new Error(`Refusing to save invalid nodes file: ${t.error.issues.map(s=>s.message).join("; ")}`);B(this.nodesPath(),t.data)}validateNode(e,t,s){let r=t.levels.find(i=>i.id===e.level);if(!r)throw new Error(`Unknown level: "${e.level}"`);let o=r.axes.filter(i=>!i.optional).filter(i=>!(i.name in e.axes));if(o.length)throw new Error(`Node ${e.id} (${e.level}) missing required axes: ${o.map(i=>i.name).join(", ")}`);for(let i of r.axes){let a=e.axes[i.name];if(a!=null){if(i.type==="enum"&&i.values&&!i.values.includes(a))throw new Error(`Node ${e.id}: axis ${i.name}="${a}" not in enum ${JSON.stringify(i.values)}`);if(i.type==="ref"){if(!s.some(c=>c.id===a))throw new Error(`Node ${e.id}: axis ${i.name}="${a}" refers to unknown node`);if(i.refLevel){let c=s.find(l=>l.id===a);if(c.level!==i.refLevel)throw new Error(`Node ${e.id}: axis ${i.name} expected level "${i.refLevel}" but got "${c.level}"`)}}}}let n=t.levels.findIndex(i=>i.id===e.level);if(n===0){if(e.parentId!==null)throw new Error(`Root-level node ${e.id} must have parentId: null`)}else{if(!e.parentId)throw new Error(`Non-root node ${e.id} must have a parentId`);let i=s.find(c=>c.id===e.parentId);if(!i)throw new Error(`Node ${e.id}: parent "${e.parentId}" not found`);let a=t.levels.findIndex(c=>c.id===i.level);if(a<0||a>=n)throw new Error(`Node ${e.id} at level "${e.level}" has parent at level "${i.level}" \u2014 parent must be at a higher level`)}}commitNodesAlongPath(e,t,s,r){let o=[],n=[],i=new Date().toISOString();for(let a=0;a<e.length;a++){let c=e[a],l=this.loadNodes().nodes;if(l.find(m=>m.id===c)){n.push(c);continue}let p=0;for(let m=a-1;m>=0;m--){let w=e[m],N=l.find(k=>k.id===w)||o.find(k=>k.id===w);if(N){p=s.levels.findIndex(k=>k.id===N.level)+1;break}}let g=t[c]??{},d=null;for(let m=p;m<s.levels.length;m++){let w=s.levels[m];if(w.axes.filter(k=>!k.optional).filter(k=>!(k.name in g)).length===0){d=w.id,p=m+1;break}}if(!d&&p<s.levels.length&&(d=s.levels[p].id,p++),!d)throw new Error(`Can't place node ${c} \u2014 no schema level left (cursor=${p}, levels=${s.levels.length})`);let h=null,f=s.levels.findIndex(m=>m.id===d);for(let m=a-1;m>=0;m--){let w=e[m],N=l.find(C=>C.id===w)||o.find(C=>C.id===w);if(!N)continue;let k=s.levels.findIndex(C=>C.id===N.level);if(k>=0&&k<f){h=w;break}}let u={id:c,level:d,parentId:h,axes:g,createdAt:i,createdBy:r};this.addNode(u),o.push(u)}return{added:o,skipped:n}}addNode(e){let t=this.loadSchema(),s=this.loadNodes();if(s.nodes.some(r=>r.id===e.id))throw new Error(`Node id already exists: ${e.id}`);return this.validateNode(e,t,[...s.nodes,e]),s.nodes.push(e),this.saveNodes(s),e}appendClassification(e){let t=P.safeParse(e);if(!t.success){let o=t.error.issues.map(n=>`${n.path.join(".")}: ${n.message}`).join(" \xB7 ");return this.log(`skipped invalid classification \u2014 ${o} \xB7`,`path=${JSON.stringify(e.path)}`,`axes-keys=${JSON.stringify(Object.keys(e.proposedAxes||{}))}`),!1}let s=JSON.stringify(t.data)+`
2
2
  `,r=this.classificationsPath();return I(r)||U(ae(r),{recursive:!0}),ge(r,s),!0}listPendingClassifications(e=200){return this.listByStatus("pending",e)}listAllClassifications(){return this.readAllCollapsed()}listByStatus(e,t=200){return this.readAllCollapsed().filter(r=>r.status===e).slice(0,t)}readAllCollapsed(){let e=this.classificationsPath();if(!I(e))return[];let s=D(e,"utf-8").split(`
3
3
  `).filter(Boolean),r=new Map;for(let o of s)try{let n=P.safeParse(JSON.parse(o));if(!n.success)continue;r.set(n.data.msgHash,n.data)}catch{}return Array.from(r.values()).sort((o,n)=>o.ts<n.ts?1:-1)}updateClassificationStatus(e,t){let r=this.readAllCollapsed().find(n=>n.msgHash===e);if(!r)return null;let o={...r,status:t.status,ts:new Date().toISOString()};if(t.reviewer||t.reviewReason){let n=` \xB7 ${t.reviewer?`reviewer=${t.reviewer}`:""}${t.reviewReason?` \xB7 ${t.reviewReason}`:""}`;o.preview=((r.preview||"")+n).slice(0,500)}return this.appendClassification(o),o}readRecentClassifications(e=50){let t=this.classificationsPath();if(!I(t))return[];let r=D(t,"utf-8").split(`
4
4
  `).filter(Boolean),o=[];for(let n=r.length-1;n>=0&&o.length<e;n--)try{let i=P.safeParse(JSON.parse(r[n]));i.success&&o.push(i.data)}catch{}return o}fingerprint(e){let s=[e.text.toLowerCase().replace(/\s+/g," ").trim(),e.channel??"",e.sender??""].join("");return fe("sha256").update(s).digest("hex").slice(0,32)}loadIndex(){let e=this.indexPath();if(!I(e))return{version:1,entries:{}};let t=D(e,"utf-8"),s=G.safeParse(JSON.parse(t));if(!s.success)throw new Error(`Invalid ${e}: ${s.error.issues.map(r=>r.message).join("; ")}`);return s.data}saveIndex(e){let t=G.safeParse(e);if(!t.success)throw new Error(`Refusing to save invalid index: ${t.error.issues.map(s=>s.message).join("; ")}`);B(this.indexPath(),t.data)}getFingerprint(e){return this.loadIndex().entries[e]}setFingerprint(e,t){let s=this.loadIndex();s.entries[e]={...t,fingerprint:e,updatedAt:new Date().toISOString()},this.saveIndex(s)}updateNodeAxes(e,t){let s=this.loadSchema(),r=this.loadNodes(),o=r.nodes.find(i=>i.id===e);if(!o)throw new Error(`Node not found: ${e}`);let n={...o,axes:t};return this.validateNode(n,s,r.nodes.map(i=>i.id===e?n:i)),r.nodes=r.nodes.map(i=>i.id===e?n:i),this.saveNodes(r),n}deleteNode(e){let t=this.loadNodes(),s=t.nodes.find(o=>o.parentId===e);if(s)throw new Error(`Cannot delete "${e}" \u2014 child node "${s.id}" still points to it`);let r=t.nodes.find(o=>Object.values(o.axes).some(n=>n===e));if(r)throw new Error(`Cannot delete "${e}" \u2014 node "${r.id}" references it via an axis`);t.nodes=t.nodes.filter(o=>o.id!==e),this.saveNodes(t)}approveClassification(e){if(this.getFingerprint(e.msgHash))return;let t=this.loadSchema(),s=new Set(this.loadNodes().nodes.map(r=>r.id));for(let r=0;r<e.path.length;r++){let o=e.path[r];if(s.has(o))continue;let n=t.levels[r]?.id;if(!n)break;let i=e.proposedAxes?.[o]??{},a=r===0?null:e.path[r-1];this.addNode({id:o,level:n,parentId:a,axes:i,createdAt:new Date().toISOString(),createdBy:e.agentId}),s.add(o)}this.setFingerprint(e.msgHash,{path:e.path,leaf:e.leaf}),this.appendClassification({...e,status:"approved",ts:new Date().toISOString()})}rejectClassification(e){this.appendClassification({...e,status:"rejected",ts:new Date().toISOString()})}};function B(b,e){U(ae(b),{recursive:!0});let t=`${b}.tmp-${process.pid}`;J(t,JSON.stringify(e,null,2)),ue(t,b)}function oe(){let b=new Date().toISOString(),e=[],t=new Set;for(let s of F)t.has(s.category)||(e.push({id:s.category,level:"category",parentId:null,axes:{kind:s.category},createdAt:b,createdBy:"starter"}),t.add(s.category));for(let s of F)e.push({id:s.verb,level:"verb",parentId:s.category,axes:{name:s.verb,...s.description?{description:s.description}:{}},createdAt:b,createdBy:"starter"});return{version:1,nodes:e}}pe();de();import{createHash as me}from"crypto";var q=class{store;daemonUrl;token;draftAgent;autoApprove;autoApproveStructure;classifierModel;classifierProviderName;providerInstance;log;constructor(e){this.store=e.store,this.daemonUrl=e.daemonUrl.replace(/\/+$/,""),this.token=e.token,this.draftAgent=e.draftAgent,this.autoApprove=e.autoApproveConfidence??1,this.autoApproveStructure=e.autoApproveStructure??"extend-leaves",this.classifierModel=e.classifierModel??"claude-haiku-4-5-20251001",this.classifierProviderName=e.classifierProvider??"claude-code",this.log=e.log??console.error.bind(console,"[classifier]")}getProvider(){return this.providerInstance||(this.providerInstance=X(this.classifierProviderName)),this.providerInstance}async classify(e){let t=this.store.fingerprint({text:e.text,channel:e.channel,sender:e.sender}),s=this.store.getFingerprint(t);if(s)return this.store.appendClassification({ts:new Date().toISOString(),msgHash:t,agentId:e.agentId,channel:e.channel,sender:e.sender,path:s.path,proposedAxes:{},leaf:s.leaf,source:"cache",status:"approved",preview:e.text.slice(0,200)}),{path:s.path,pathId:z(s.path),pathLabel:K(s.path,this.store.loadNodes().nodes),axes:{},leaf:s.leaf,source:"cache",status:"approved"};let r=this.store.loadSchema(),o=this.store.loadNodes().nodes,n=await this.proposePath(e,r,o).catch(u=>(this.log("LLM proposal failed:",u?.message||u),null));if(!n)return null;let{path:i,proposedAxes:a,confidence:c,leaf:l}=n;if(i.length===0)return null;let v={ts:new Date().toISOString(),msgHash:t,agentId:e.agentId,channel:e.channel,sender:e.sender,path:i,proposedAxes:a,leaf:l,source:"llm",status:"pending",confidence:c,preview:e.text.slice(0,200)},p=new Set(o.map(u=>u.id)),g=i.map((u,m)=>p.has(u)?-1:m).filter(u=>u>=0),d=!1;if(this.autoApproveStructure==="any")d=!0;else if(this.autoApproveStructure==="extend-leaves"){let u=g.length===0,m=g.length===1&&g[0]===i.length-1;d=u||m}let h=c!==void 0&&c>=this.autoApprove,f="pending";if(d||h)try{this.commitNewNodes(i,a,r,o,e.sender),this.store.setFingerprint(t,{path:i,leaf:l}),f="approved"}catch(u){this.log("auto-approve failed \u2014 staying pending \xB7",`path=${JSON.stringify(i)}`,`reason=${(u?.message||u).toString().slice(0,200)}`)}return v.status=f,this.store.appendClassification(v),{path:i,pathId:z(i),pathLabel:K(i,this.store.loadNodes().nodes),axes:a,leaf:l,source:"llm",status:f,confidence:c}}async proposePath(e,t,s){let r=s.map(d=>({id:d.id,level:d.level,parentId:d.parentId,axes:d.axes})),o=["You are the intent classifier for AgentX. You answer ONE question:",'"what kind of work does this message describe?" \u2014 verb-level only.',"","IMPORTANT \u2014 what NOT to encode in the path:","- Client / company / project / team names. Those are already on the event"," metadata (project, channel, agentId). Embedding them in the path causes"," duplicate nodes (one per client) for the same verb.","- The specific subject (issue number, file name, person name). Same reason.","- The agent's name or role. Pick the verb the *requester* intended.","","SCHEMA (fixed levels \u2014 pick one node per level):","```json",JSON.stringify(t,null,2),"```","","EXISTING NODES (prefer reusing these; only invent a new node when no","existing one fits):","```json",JSON.stringify(r,null,2),"```","","MESSAGE:","```",e.text.slice(0,2e3),"```",`channel: ${e.channel??"?"}`,`sender: ${e.sender??"?"}`,"","TASK:","1. Classify into 'category' (closed enum): code, ops, support, admin,"," knowledge, social, system. Pick the closest fit.","2. Pick or propose a 'verb' node. Verb ids are dot-namespaced lower-kebab,",' e.g. "review.merge-request", "deploy.staging", "investigate.error",',' "chat.greeting", "fix.bug". Reuse an existing verb when the message is'," the same kind of work as something already classified, even when the"," client / project / subject differs.","","Examples (right vs wrong):",'- "Please review MR #957 on globex/system" \u2192 ["code", "review.merge-request"]',' NOT ["business", "acme", "globex-v2", "review-mr-957-system"]','- "Deploy initech-v2 to staging please" \u2192 ["ops", "deploy.staging"]',' NOT ["business", "acme", "initech-v2", "deploy-initech-v2-to-staging"]','- "Hello Atlas" \u2192 ["support", "chat.greeting"]',"","NODE ID RULES (strict \u2014 invalid ids get dropped):","- lowercase-kebab + dots only: [a-z0-9][a-z0-9._-]*","- no spaces, no uppercase, no Arabic/other non-Latin",'- verb ids should use a "category.specific" or "verb.modifier" shape',"","Return ONE JSON object on one line, no prose, no fences:",' { "path": string[], "proposedAxes": { [nodeId]: { [axisName]: string } }, "leaf": { "input"?: string, "output"?: string }, "confidence": number }',"confidence in [0,1]. Prefer low confidence over guessing."].join(`
@@ -106,4 +106,4 @@ We use GitLab for version control.
106
106
  There are ${t.length} unprocessed entries. Read each, understand what it means, and create or update wiki articles.
107
107
 
108
108
  ${s}`}walkDir(e,t){if(x(e))for(let s of O(e)){let r=be(e,s);ye(r).isDirectory()?this.walkDir(r,t):t(r)}}};import{resolve as Y}from"path";import{existsSync as ke,readdirSync as Se,mkdirSync as xe}from"fs";var le=class{baseDir;agentsDir;mode;sharedStore;agentStores=new Map;log;constructor(e=Y(process.cwd(),".agentx/wiki"),t=console.error.bind(console,"[wiki-hub]"),s="graph"){this.baseDir=e,this.agentsDir=Y(e,"agents"),this.mode=s,this.log=t,xe(this.agentsDir,{recursive:!0}),this.sharedStore=new E(e,t)}getMode(){return this.mode}getAgentWiki(e){let t=`${e}:${this.mode}`;if(this.agentStores.has(t))return this.agentStores.get(t);let s=Y(this.agentsDir,e,this.mode),r=new E(s,this.log);return this.agentStores.set(t,r),r}getSharedStore(){return this.sharedStore}listAgents(){let e=new Set,t=this.sharedStore.listEntries();for(let s of t)e.add(s.agentId);if(ke(this.agentsDir))for(let s of Se(this.agentsDir))!s.startsWith("_")&&!s.startsWith(".")&&e.add(s);return[...e].sort()}getAgentEntries(e){return this.sharedStore.listEntries({agentId:e})}getUnabsorbedEntries(e){let t=this.getAgentWiki(e),s=this.getAgentEntries(e),r=new Set,o=t.rebuildIndex();for(let n of o.articles)if(n.sources)for(let i of n.sources)r.add(i);return s.filter(n=>!r.has(n.id))}summary(){return this.listAgents().map(t=>{let s=this.getAgentEntries(t),o=this.getAgentWiki(t).rebuildIndex(),n=this.getUnabsorbedEntries(t);return{agentId:t,totalEntries:s.length,totalArticles:o.articles.length,unabsorbed:n.length,articles:o.articles}})}};export{A as a,H as b,q as c,K as d,E as e,le as f};
109
- //# sourceMappingURL=chunk-MC6I6ZLY.js.map
109
+ //# sourceMappingURL=chunk-RCVGIKC2.js.map
@@ -1,4 +1,4 @@
1
- import{b as Y,c as X,d as G,e as D,f as I,g as M,h as W}from"./chunk-7CVJ4JOE.js";import{f as K}from"./chunk-MC6I6ZLY.js";import{g as B,j as q}from"./chunk-WFKS4O34.js";import{existsSync as _,readFileSync as re,writeFileSync as se,appendFileSync as be,mkdirSync as ye}from"fs";import{dirname as ke,resolve as R}from"path";import{fileURLToPath as we}from"url";import{hostname as $e}from"os";import{spawn as Ae}from"child_process";q();import{existsSync as Q,readFileSync as V,writeFileSync as F,copyFileSync as he}from"fs";import{resolve as Z}from"path";function ee(e,t={}){let a=t.configPath||Z(process.cwd(),"agentx.json");if(!Q(a))throw new Error(`agentx.json not found at ${a}`);let r=JSON.parse(V(a,"utf-8")),n=e(r),s=typeof n=="string"?{summary:n}:n,c=JSON.stringify(r,null,2)+`
1
+ import{b as Y,c as X,d as G,e as D,f as I,g as M,h as W}from"./chunk-7CVJ4JOE.js";import{f as K}from"./chunk-RCVGIKC2.js";import{g as B,j as q}from"./chunk-IAG6FI3Q.js";import{existsSync as _,readFileSync as re,writeFileSync as se,appendFileSync as be,mkdirSync as ye}from"fs";import{dirname as ke,resolve as R}from"path";import{fileURLToPath as we}from"url";import{hostname as $e}from"os";import{spawn as Ae}from"child_process";q();import{existsSync as Q,readFileSync as V,writeFileSync as F,copyFileSync as he}from"fs";import{resolve as Z}from"path";function ee(e,t={}){let a=t.configPath||Z(process.cwd(),"agentx.json");if(!Q(a))throw new Error(`agentx.json not found at ${a}`);let r=JSON.parse(V(a,"utf-8")),n=e(r),s=typeof n=="string"?{summary:n}:n,c=JSON.stringify(r,null,2)+`
2
2
  `,p=a+".tmp";F(p,c,"utf-8");try{JSON.parse(V(p,"utf-8"))}catch(d){throw new Error(`config did not round-trip cleanly: ${d.message}`)}let i;return t.skipBackup||(i=`${a}.bak.${Date.now()}`,he(a,i)),F(a,c,"utf-8"),t.skipReload||fe().catch(()=>{}),{summary:s.summary,payload:s.payload,backupPath:i}}function te(e,t={}){let a=t.configPath||Z(process.cwd(),"agentx.json");if(Q(a)&&!t.overwrite)throw new Error(`agentx.json already exists at ${a}. Pass overwrite=true to replace it.`);return F(a,JSON.stringify(e,null,2)+`
3
3
  `,"utf-8"),{file:a}}async function fe(){try{let t=B().dashboard.daemonUrl?.replace(/\/+$/,"")||"http://127.0.0.1:18800";await fetch(`${t}/reload`,{method:"POST"}).catch(()=>null)}catch{}}function ae(e,t){let a=e.configExists?e.agentCount===0?"Add your first agent":"Add another agent":"Set up your team",r=`<header class="ax-topbar">
4
4
  <div class="ax-topbar__left">
@@ -737,4 +737,4 @@ tr:hover td { background: var(--bg-hover); }
737
737
  <div class="meta-line">${U((d.meta.tags||[]).slice(0,6),t)}</div>
738
738
  <h3><a href="${p}/article/${encodeURIComponent(d.path)}">${o(d.meta.title)}</a></h3>
739
739
  </div>`;return $(`${t} \xB7 ${a}`,C(n),i)}function P(e,t,a){let r=e.rebuildIndex(),n=L(r.articles.map(c=>({title:c.title,path:c.path,tags:c.tags}))),s='<div class="nav-section">';s+=`<div class="nav-section-title">${o(t)}</div>`,s+=`<a class="nav-item${a?"":" active"}" href="/">Home</a>`,s+='<a class="nav-item" href="/lint">Health check</a>',s+="</div>";for(let[c,p]of n){s+='<div class="nav-section">',s+=`<div class="nav-section-title">${J(c)}</div>`;for(let i of p){let d=i.path===a;s+=`<a class="nav-item${d?" active":""}" href="/article/${encodeURIComponent(i.path)}">${o(i.title)}</a>`}s+="</div>"}return s}function Ge(e){let{wikiDir:t,agentFilter:a,peerUrls:r=[],mode:n="graph",pathPrefix:s=""}=e,c=s.replace(/\/+$/,""),p=new K(t,void 0,n),i=r.length>0?new H(r):null;return async(d,g)=>{let x=new URL(d.url||"/","http://localhost"),l=decodeURIComponent(x.pathname),h=c&&l.startsWith(c)?l.slice(c.length)||"/":l,f=null,z=200;try{if(h.startsWith("/remote/")&&i){let y=h.slice(8).split("/article/");if(y.length===2){let[b,v]=y,m=b.indexOf("/"),k=decodeURIComponent(b.slice(0,m)),u=b.slice(m+1),w=await i.getRemoteArticle(k,u,v);if(w){let E=await i.getRemoteAgents(),N=[...p.summary(),...E.map(S=>({...S,agentId:`${S.agentId} @${S.nodeId}`}))],A=`<div class="breadcrumb"><a href="/">Hub</a> / <span class="tag">remote</span> ${o(u)} @ ${o(k)}</div>`;A+=`<h1>${o(w.meta.title)}</h1>`,A+='<dl class="meta">',A+=`<dt>Tags</dt><dd>${(w.meta.tags||[]).map(S=>`<span class="tag">${S}</span>`).join(" ")}</dd>`,A+=`<dt>Owner</dt><dd>${o(w.meta.owner)}</dd>`,A+=`<dt>Source</dt><dd><span class="tag">remote</span> ${o(k)}</dd>`,A+=`<dt>Updated</dt><dd>${w.meta.lastUpdated}</dd>`,A+="</dl>";let T=new Map;A+=O(w.content,T),f=$(w.meta.title,C(N),A)}}}if(!f&&a){let y=p.getAgentWiki(a);if(h==="/"||h===""){let b=y.rebuildIndex(),v=p.getAgentEntries(a),m=`<h1>${o(a)}</h1>`;if(m+='<div class="stats">',m+=`<div class="stat-card"><div class="number">${b.articles.length}</div><div class="label">Articles</div></div>`,m+=`<div class="stat-card"><div class="number">${v.length}</div><div class="label">Entries</div></div>`,m+="</div>",b.articles.length>0){m+="<h2>Articles</h2><table><tr><th>Title</th><th>Type</th><th>Updated</th></tr>";for(let k of b.articles)m+=`<tr><td><a href="/article/${encodeURIComponent(k.path)}">${o(k.title)}</a></td><td><span class="tag">${(k.tags||[]).slice(0,3).join(", ")}</span></td><td>${k.lastUpdated||""}</td></tr>`;m+="</table>"}f=$(a,P(y,a),m)}else if(h.startsWith("/article/")){let b=h.slice(9),v=y.readArticle(b);if(v){let m=y.rebuildIndex(),k=new Map;for(let w of m.articles)k.set(w.title,w.path);let u=`<h1>${o(v.meta.title)}</h1>`;u+='<dl class="meta">',u+=`<dt>Tags</dt><dd>${(v.meta.tags||[]).map(w=>`<span class="tag">${w}</span>`).join(" ")}</dd>`,u+=`<dt>Updated</dt><dd>${v.meta.lastUpdated}</dd>`,v.meta.sources?.length&&(u+=`<dt>Sources</dt><dd>${v.meta.sources.length} entries</dd>`),u+="</dl>",u+=O(v.content,k),f=$(v.meta.title,P(y,a,b),u)}}else if(h==="/lint"){let b=y.lint(),v="<h1>Health Check</h1>";if(b.length===0)v+='<p style="color:green;">No issues.</p>';else{v+="<table><tr><th>Type</th><th>Article</th><th>Issue</th></tr>";for(let m of b)v+=`<tr><td><span class="tag">${m.type}</span></td><td>${o(m.article)}</td><td>${o(m.message)}</td></tr>`;v+="</table>"}f=$("Health Check",P(y,a),v)}else if(h==="/search"){let b=x.searchParams.get("q")||"",v=await y.findRelevantReranked(b,void 0,20),m=`<h1>Search: "${o(b)}"</h1>`;for(let k of v)m+=`<div class="entry-card"><h3><a href="/article/${encodeURIComponent(k.path)}">${o(k.meta.title)}</a></h3><p>${o(k.content.slice(0,200))}...</p></div>`;v.length===0&&(m+="<p>No results.</p>"),f=$(`Search: ${b}`,P(y,a),m)}else if(h.startsWith("/tag/")){let b=decodeURIComponent(h.slice(5)),v=y.findByTags([b],void 0,100),m=`<h1>Tag: <a class="tag" href="#">${o(b)}</a></h1>`;m+=`<p>${v.length} article${v.length===1?"":"s"} tagged <code>${o(b)}</code></p>`;for(let k of v)m+=`<div class="entry-card"><h3><a href="/article/${encodeURIComponent(k.path)}">${o(k.meta.title)}</a></h3><div class="meta-line">${U((k.meta.tags||[]).slice(0,6))}</div></div>`;v.length===0&&(m+="<p>No articles with this tag.</p>"),f=$(`Tag: ${b}`,P(y,a),m)}}else{let y=i?await i.getRemoteAgents():[],b=p.summary(),v=new Map(b.map(u=>[u.agentId,u])),m=[],k=new Set;for(let u of b){let w=y.find(E=>E.agentId===u.agentId);w&&w.totalArticles>u.totalArticles?m.push({...w,totalEntries:Math.max(u.totalEntries,w.totalEntries),unabsorbed:Math.max(u.unabsorbed,w.unabsorbed)}):m.push(u),k.add(u.agentId)}for(let u of y)k.has(u.agentId)||(m.push(u),k.add(u.agentId));if(h==="/"||h==="")f=je(p,m,y);else if(h==="/entries")f=qe(p,m);else if(h==="/search")f=Ke(p,x.searchParams.get("q")||"",m);else if(h.startsWith("/tag/"))f=Ye(p,decodeURIComponent(h.slice(5)),m);else if(h.match(/^\/agent\/[^/]+\/tag\/.+/)){let u=h.match(/^\/agent\/([^/]+)\/tag\/(.+)$/);f=Xe(p,decodeURIComponent(u[1]),decodeURIComponent(u[2]),m)}else if(h.startsWith("/agent/")){let u=h.slice(7),w=u.indexOf("/article/");if(w===-1)f=Le(p,u,m);else{let E=u.slice(0,w),N=u.slice(w+9);if(f=Je(p,E,N,m),!f&&i){let A=y.find(T=>T.agentId===E);if(A){let T=await i.getRemoteArticle(A.peerUrl,E,N);if(T){let S=`<div class="breadcrumb"><a href="/">Hub</a> / <span class="tag">remote @ ${o(A.nodeId)}</span> / ${o(E)}</div>`;S+=`<h1>${o(T.meta.title)}</h1>`,S+='<dl class="meta">',S+=`<dt>Tags</dt><dd>${(T.meta.tags||[]).map(ue=>`<span class="tag">${ue}</span>`).join(" ")}</dd>`,S+=`<dt>Source</dt><dd><span class="tag">remote</span> ${o(A.nodeId)}</dd>`,S+=`<dt>Updated</dt><dd>${T.meta.lastUpdated}</dd>`,S+="</dl>",S+=O(T.content,new Map),f=$(T.meta.title,C(m),S)}}}}}}if(!f){z=404;let y=a?P(p.getAgentWiki(a),a):C(p.summary());f=$("Not Found",y,"<h1>Page not found</h1>")}}catch(y){z=500,f=$("Error","",`<h1>Error</h1><pre>${o(y.message)}</pre>`)}g.writeHead(z,{"Content-Type":"text/html; charset=utf-8"}),g.end(c?Ve(f,c):f)}}function Ve(e,t){e=e.replace(/(\s(?:href|action)=")\/(?!\/)/g,`$1${t}/`),e=e.replace(new RegExp(`(${t})${t}/`,"g"),`${t}/`);let a=`<a href="/admin" style="position:fixed;top:10px;right:14px;z-index:9999;padding:5px 11px;background:rgba(0,0,0,0.55);color:#fff;font:12px/1.2 'IBM Plex Sans',system-ui,sans-serif;text-decoration:none;border-radius:6px;border:1px solid rgba(255,255,255,0.18);backdrop-filter:blur(6px)">\u2190 Dashboard</a>`;return e=e.replace(/<body([^>]*)>/,`<body$1>${a}`),e}function Ct(e,t=4200,a,r=[],n="graph"){let s=Ge({wikiDir:e,agentFilter:a,peerUrls:r,mode:n});He((p,i)=>{s(p,i)}).listen(t)}export{ee as a,ie as b,gt as c,mt as d,ut as e,pe as f,bt as g,yt as h,Ge as i,Ct as j};
740
- //# sourceMappingURL=chunk-GL7VC26K.js.map
740
+ //# sourceMappingURL=chunk-REPZID5M.js.map
@@ -1,4 +1,4 @@
1
- import{a as R,b as j,c as O,d as W,e as D}from"./chunk-AJ5RMU7X.js";import{b as C}from"./chunk-2GIDVZ4H.js";import{v,w as Q}from"./chunk-SR6TVIIS.js";import{b as $,c as M}from"./chunk-QOYAX2FT.js";import{readFileSync as T,existsSync as _}from"fs";Q();import{resolve as b}from"path";import{execSync as Y}from"child_process";async function V(n,i,s,e={}){let d=e.selectorModel??"haiku",a=e.synthModel??"sonnet",c=e.maxCandidates??3,l=e.maxHops??2,r=e.maxArticles??8,p=e.timeoutMs??6e4,u=e.log??console.error.bind(console,"[wiki-query]"),h=b(i.baseDir,"_index.md");if(!_(h))return w("no-catalog",n,"No _index.md found \u2014 run `agentx wiki status` to rebuild.");let k=T(h,"utf-8"),t=Date.now(),g=[],m="";try{let o=await B(n,i,s,c);o?(g=o,m=`[wiki-rerank seat] ${o.map(y=>y.title).join(" | ")}`):(m=await N(I(n,k,c),d,p),g=F(m))}catch(o){return u("selector failed:",o?.message),{...w("error",n,`Selector: ${o?.message||"unknown"}`),trace:{selectorMs:Date.now()-t,synthesisMs:0,selectorOutput:m}}}let A=Date.now()-t;if(g.length===0)return{...w("no-candidates",n,"Selector returned no candidates."),trace:{selectorMs:A,synthesisMs:0,selectorOutput:m}};let f=E(g,i,s,l,r);if(f.length===0)return{...w("no-candidates",n,"Candidates did not resolve to readable articles."),candidates:g,trace:{selectorMs:A,synthesisMs:0,selectorOutput:m}};let S=Date.now(),x="";try{x=await N(L(n,f),a,p*2)}catch(o){return u("synthesis failed:",o?.message),{...w("error",n,`Synthesis: ${o?.message||"unknown"}`),candidates:g,walked:f.map(y=>({title:y.meta.title,path:y.path,type:y.meta.type,hop:y.hop??0})),trace:{selectorMs:A,synthesisMs:Date.now()-S,selectorOutput:m}}}let P=Date.now()-S;return{answer:x.trim(),citations:f.map(o=>({title:o.meta.title,path:o.path,type:o.meta.type})),candidates:g,walked:f.map(o=>({title:o.meta.title,path:o.path,type:o.meta.type,hop:o.hop??0})),status:"ok",trace:{selectorMs:A,synthesisMs:P,selectorOutput:m}}}function w(n,i,s){return{answer:"",citations:[],candidates:[],walked:[],status:n,error:s}}function E(n,i,s,e,d){let a=new Map;for(let r of i.listArticles(s||""))a.set(r.meta.title.toLowerCase(),r.path);let c=new Map,l=[];for(let r of n)c.has(r.path)||l.push({path:r.path,hop:0});for(;l.length&&c.size<d;){let r=l.shift();if(c.has(r.path)||r.hop>e)continue;let p=s?i.readArticleAs(r.path,s):i.readArticle(r.path);if(p&&(c.set(r.path,{...p,hop:r.hop}),!(r.hop>=e)))for(let u of p.meta.related||[]){let h=a.get(u.toLowerCase());h&&!c.has(h)&&l.push({path:h,hop:r.hop+1})}}return Array.from(c.values())}async function B(n,i,s,e){try{let a=(i.rebuildIndex().articles??[]).filter(t=>t.path&&!t.path.includes("/_versions/"));if(a.length<2)return null;let c=a.map(t=>[t.title,(t.tags??[]).join(" "),(t.related??[]).join(" ")].join(" ")),l=M(n,$(c)).map(t=>t.docIndex);for(let t=0;t<a.length;t++)l.includes(t)||l.push(t);let p=l.slice(0,j).map(t=>({id:`k${t}`,title:a[t].title||a[t].path,tags:a[t].tags,excerpt:[a[t].type?`type: ${a[t].type}`:"",(a[t].related??[]).length?`related: ${(a[t].related??[]).join(", ")}`:""].filter(Boolean).join(" \xB7 ")})),u=await v(R,O({query:n,candidates:p,excerptChars:300}),W(p),{features:{agent:s??"unknown",stage:"catalog-selector"}});if(!u||u.mode!=="active")return null;let k=D(u.answers,p).ranked.slice(0,e).map(t=>a[Number(t.slice(1))]).filter(Boolean).map(t=>({title:t.title,path:t.path}));return k.length>0?k:null}catch{return null}}function I(n,i,s){return`You are picking candidate articles from a wiki catalog to answer a question. You do NOT answer the question. You pick which articles the answer is likely to come from.
1
+ import{a as R,b as j,c as O,d as W,e as D}from"./chunk-AJ5RMU7X.js";import{b as C}from"./chunk-2GIDVZ4H.js";import{v,w as Q}from"./chunk-H4MIYENA.js";import{b as $,c as M}from"./chunk-QOYAX2FT.js";import{readFileSync as T,existsSync as _}from"fs";Q();import{resolve as b}from"path";import{execSync as Y}from"child_process";async function V(n,i,s,e={}){let d=e.selectorModel??"haiku",a=e.synthModel??"sonnet",c=e.maxCandidates??3,l=e.maxHops??2,r=e.maxArticles??8,p=e.timeoutMs??6e4,u=e.log??console.error.bind(console,"[wiki-query]"),h=b(i.baseDir,"_index.md");if(!_(h))return w("no-catalog",n,"No _index.md found \u2014 run `agentx wiki status` to rebuild.");let k=T(h,"utf-8"),t=Date.now(),g=[],m="";try{let o=await B(n,i,s,c);o?(g=o,m=`[wiki-rerank seat] ${o.map(y=>y.title).join(" | ")}`):(m=await N(I(n,k,c),d,p),g=F(m))}catch(o){return u("selector failed:",o?.message),{...w("error",n,`Selector: ${o?.message||"unknown"}`),trace:{selectorMs:Date.now()-t,synthesisMs:0,selectorOutput:m}}}let A=Date.now()-t;if(g.length===0)return{...w("no-candidates",n,"Selector returned no candidates."),trace:{selectorMs:A,synthesisMs:0,selectorOutput:m}};let f=E(g,i,s,l,r);if(f.length===0)return{...w("no-candidates",n,"Candidates did not resolve to readable articles."),candidates:g,trace:{selectorMs:A,synthesisMs:0,selectorOutput:m}};let S=Date.now(),x="";try{x=await N(L(n,f),a,p*2)}catch(o){return u("synthesis failed:",o?.message),{...w("error",n,`Synthesis: ${o?.message||"unknown"}`),candidates:g,walked:f.map(y=>({title:y.meta.title,path:y.path,type:y.meta.type,hop:y.hop??0})),trace:{selectorMs:A,synthesisMs:Date.now()-S,selectorOutput:m}}}let P=Date.now()-S;return{answer:x.trim(),citations:f.map(o=>({title:o.meta.title,path:o.path,type:o.meta.type})),candidates:g,walked:f.map(o=>({title:o.meta.title,path:o.path,type:o.meta.type,hop:o.hop??0})),status:"ok",trace:{selectorMs:A,synthesisMs:P,selectorOutput:m}}}function w(n,i,s){return{answer:"",citations:[],candidates:[],walked:[],status:n,error:s}}function E(n,i,s,e,d){let a=new Map;for(let r of i.listArticles(s||""))a.set(r.meta.title.toLowerCase(),r.path);let c=new Map,l=[];for(let r of n)c.has(r.path)||l.push({path:r.path,hop:0});for(;l.length&&c.size<d;){let r=l.shift();if(c.has(r.path)||r.hop>e)continue;let p=s?i.readArticleAs(r.path,s):i.readArticle(r.path);if(p&&(c.set(r.path,{...p,hop:r.hop}),!(r.hop>=e)))for(let u of p.meta.related||[]){let h=a.get(u.toLowerCase());h&&!c.has(h)&&l.push({path:h,hop:r.hop+1})}}return Array.from(c.values())}async function B(n,i,s,e){try{let a=(i.rebuildIndex().articles??[]).filter(t=>t.path&&!t.path.includes("/_versions/"));if(a.length<2)return null;let c=a.map(t=>[t.title,(t.tags??[]).join(" "),(t.related??[]).join(" ")].join(" ")),l=M(n,$(c)).map(t=>t.docIndex);for(let t=0;t<a.length;t++)l.includes(t)||l.push(t);let p=l.slice(0,j).map(t=>({id:`k${t}`,title:a[t].title||a[t].path,tags:a[t].tags,excerpt:[a[t].type?`type: ${a[t].type}`:"",(a[t].related??[]).length?`related: ${(a[t].related??[]).join(", ")}`:""].filter(Boolean).join(" \xB7 ")})),u=await v(R,O({query:n,candidates:p,excerptChars:300}),W(p),{features:{agent:s??"unknown",stage:"catalog-selector"}});if(!u||u.mode!=="active")return null;let k=D(u.answers,p).ranked.slice(0,e).map(t=>a[Number(t.slice(1))]).filter(Boolean).map(t=>({title:t.title,path:t.path}));return k.length>0?k:null}catch{return null}}function I(n,i,s){return`You are picking candidate articles from a wiki catalog to answer a question. You do NOT answer the question. You pick which articles the answer is likely to come from.
2
2
 
3
3
  ## Question
4
4
 
@@ -42,4 +42,4 @@ ${s}
42
42
  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.
43
43
 
44
44
  Output ONLY the answer \u2014 no preamble, no "here is my answer:", no markdown fencing.`}function F(n){let i=n.match(/\[[\s\S]*?\]/);if(!i)return[];try{let s=JSON.parse(i[0]);return Array.isArray(s)?s.filter(e=>e&&typeof e.title=="string"&&typeof e.path=="string").map(e=>({title:e.title,path:e.path})):[]}catch{return[]}}async function N(n,i,s){let{writeFileSync:e,mkdirSync:d,rmSync:a}=await import("fs"),{tmpdir:c}=await import("os"),l=b(c(),`agentx-wiki-query-${process.pid}`);d(l,{recursive:!0});let r=b(l,`prompt-${Date.now()}.txt`);e(r,n);try{let p=`cat '${r}' | claude -p - --output-format json --max-turns 1 --model ${i} --disallowedTools "Bash Read Write Edit Glob Grep Agent WebSearch WebFetch NotebookEdit"`,u=Y(p,{env:C({...process.env}),encoding:"utf-8",timeout:s,maxBuffer:4*1024*1024});try{let h=JSON.parse(u);return String(h.result||h.content||"")}catch{return u}}finally{try{a(r,{force:!0})}catch{}}}export{V as a};
45
- //# sourceMappingURL=chunk-EJWIRM52.js.map
45
+ //# sourceMappingURL=chunk-RQKUQOFC.js.map
@@ -1,5 +1,5 @@
1
- import{g as m,j as b}from"./chunk-WFKS4O34.js";b();function w(t){let e=typeof t.node=="string"?t.node:"",n=typeof t.token=="string"?t.token:"";if(!e||!n)try{let o=m(t.config);e||(e=o.dashboard?.daemonUrl||""),n||(n=o.dashboard?.token||"")}catch{}return e||(e="http://localhost:18800"),{baseUrl:e.replace(/\/+$/,""),token:n}}async function d(t,e,n){let o={Accept:"application/json"};t.token&&(o.Authorization=`Bearer ${t.token}`);let r=await fetch(`${t.baseUrl}${e}`,{headers:o,signal:n});if(!r.ok)throw new Error(`GET ${e} \u2192 HTTP ${r.status}`);return await r.json()}function R(t,e){return d(t,"/agents",e)}async function S(t,e){return(await d(t,"/api/processes",e)).processes??[]}function P(t,e){return d(t,"/crons",e)}async function h(t,e,n,o){let r={Accept:"application/json","Content-Type":"application/json"};t.token&&(r.Authorization=`Bearer ${t.token}`);let s=await fetch(`${t.baseUrl}${e}`,{method:"POST",headers:r,body:JSON.stringify(n),signal:o}),a=await s.text(),i;try{i=a?JSON.parse(a):{}}catch{i={raw:a}}if(!s.ok)throw new Error(i?.error||`POST ${e} \u2192 HTTP ${s.status}`);return i}function A(t,e,n="tui"){return h(t,"/api/processes/kill",{...e,reason:n})}function C(t,e,n,o){return h(t,"/task",{agent:e,message:n,context:o??{channel:"tui",chatId:"tui:operator"}})}async function $(t,e,n,o={}){let r={Accept:"text/event-stream","Content-Type":"application/json"};t.token&&(r.Authorization=`Bearer ${t.token}`);let s=await fetch(`${t.baseUrl}/task`,{method:"POST",headers:r,body:JSON.stringify({agent:e,message:n,stream:!0,context:{channel:o.channel??"chat-cli",chatId:o.chatId??"chat-cli:operator"}}),signal:o.signal});if(!s.ok||!s.body){let g=await s.text().catch(()=>"");throw new Error(`POST /task (stream) \u2192 HTTP ${s.status}${g?`: ${g.slice(0,200)}`:""}`)}let a=s.body.getReader(),i=new TextDecoder,u={content:""},c="";try{for(;;){let{done:g,value:p}=await a.read();if(g)break;c+=i.decode(p,{stream:!0});let l;for(;(l=c.indexOf(`
1
+ import{g as m,j as b}from"./chunk-IAG6FI3Q.js";b();function w(t){let e=typeof t.node=="string"?t.node:"",n=typeof t.token=="string"?t.token:"";if(!e||!n)try{let o=m(t.config);e||(e=o.dashboard?.daemonUrl||""),n||(n=o.dashboard?.token||"")}catch{}return e||(e="http://localhost:18800"),{baseUrl:e.replace(/\/+$/,""),token:n}}async function d(t,e,n){let o={Accept:"application/json"};t.token&&(o.Authorization=`Bearer ${t.token}`);let r=await fetch(`${t.baseUrl}${e}`,{headers:o,signal:n});if(!r.ok)throw new Error(`GET ${e} \u2192 HTTP ${r.status}`);return await r.json()}function R(t,e){return d(t,"/agents",e)}async function S(t,e){return(await d(t,"/api/processes",e)).processes??[]}function P(t,e){return d(t,"/crons",e)}async function h(t,e,n,o){let r={Accept:"application/json","Content-Type":"application/json"};t.token&&(r.Authorization=`Bearer ${t.token}`);let s=await fetch(`${t.baseUrl}${e}`,{method:"POST",headers:r,body:JSON.stringify(n),signal:o}),a=await s.text(),i;try{i=a?JSON.parse(a):{}}catch{i={raw:a}}if(!s.ok)throw new Error(i?.error||`POST ${e} \u2192 HTTP ${s.status}`);return i}function A(t,e,n="tui"){return h(t,"/api/processes/kill",{...e,reason:n})}function C(t,e,n,o){return h(t,"/task",{agent:e,message:n,context:o??{channel:"tui",chatId:"tui:operator"}})}async function $(t,e,n,o={}){let r={Accept:"text/event-stream","Content-Type":"application/json"};t.token&&(r.Authorization=`Bearer ${t.token}`);let s=await fetch(`${t.baseUrl}/task`,{method:"POST",headers:r,body:JSON.stringify({agent:e,message:n,stream:!0,context:{channel:o.channel??"chat-cli",chatId:o.chatId??"chat-cli:operator"}}),signal:o.signal});if(!s.ok||!s.body){let g=await s.text().catch(()=>"");throw new Error(`POST /task (stream) \u2192 HTTP ${s.status}${g?`: ${g.slice(0,200)}`:""}`)}let a=s.body.getReader(),i=new TextDecoder,u={content:""},c="";try{for(;;){let{done:g,value:p}=await a.read();if(g)break;c+=i.decode(p,{stream:!0});let l;for(;(l=c.indexOf(`
2
2
 
3
3
  `))>=0;){let k=c.slice(0,l);c=c.slice(l+2);let f=x(k);f&&T(f,o,u)}}}finally{try{a.releaseLock()}catch{}}return u}function T(t,e,n){let{event:o,data:r}=t;switch(o){case"text":r?.text&&(n.content+=r.text,e.onText?.(r.text));break;case"thinking":r?.text&&e.onThinking?.(r.text);break;case"tool":e.onTool?.(r);break;case"done":typeof r?.content=="string"&&(n.content=r.content),n.usage=r?.usage,n.duration=r?.duration;break;case"error":n.error=r?.error,n.errorKind=r?.errorKind;break}}function x(t){let e="message",n="";for(let r of t.split(`
4
4
  `))r.startsWith("event: ")?e=r.slice(7).trim():r.startsWith("data: ")&&(n=r.slice(6));if(!n)return null;let o;try{o=JSON.parse(n)}catch{o=n}return{event:e,data:o}}export{w as a,R as b,S as c,P as d,A as e,C as f,$ as g};
5
- //# sourceMappingURL=chunk-FHF4RA4Q.js.map
5
+ //# sourceMappingURL=chunk-SJPLXXCI.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-2SJHSSJS.js"),{getGlobalRegistry:i}=await import("./registry-TDYF7HGH.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-2SJHSSJS.js"),{getGlobalRegistry:i}=await import("./registry-OMUDCBKM.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-HEV3AVFJ.js.map
126
+ //# sourceMappingURL=chunk-WBGROLOX.js.map
@@ -1,2 +1,2 @@
1
- import{v as l,w}from"./chunk-SR6TVIIS.js";import{a as i,f as p}from"./chunk-F4HZTZHW.js";w();p();var d="task-tier";function u(e){return{task:f(e.message,2e3),agent:e.agent,channel:e.channel??null,continuesExistingSession:e.isFollowUp??!1,...e.toolsAvailable?{toolsAvailable:e.toolsAvailable}:{}}}var c={needsFlagship:i("This task needs the strongest available model to be done correctly.",{true:"Doing it well takes real reasoning: writing or reviewing code, diagnosing a failure, planning work across several steps, weighing a judgement, handling money, touching production or anything irreversible, following a long or ambiguous instruction, or work where being subtly wrong would not be noticed. Anything where a weaker model would produce something that LOOKS right belongs here.",false:"It is mechanical and its result is obvious on sight: acknowledging or confirming a message, restating or formatting something already written, a greeting, a status echo, reading one file and reporting what it says, a lookup with one right answer, a scheduled heartbeat with nothing to decide."})};function g(e){return e.needsFlagship.noul}function f(e,n){return e.length>n?`${e.slice(0,n)}\u2026`:e}var h=.2,m=60*60*1e3;function F(e,n){if(e==="claude-code"){let t=n?.cheapModels?.[e]??n?.cheapModel;return t&&/^(claude-|haiku$|sonnet$|opus$)/.test(t)?t:void 0}if(e==="codex-cli"){let t=n?.cheapModels?.[e];return t&&/^(gpt-|o\d)/.test(t)?t:void 0}}async function M(e){let n=(o,r=null)=>({downgraded:!1,needsFlagship:r,reason:o});if(e.channel==="voice"||e.channel==="desktop"||e.channel==="opencode")return n(`${e.channel} requests retain the configured model`);if(!e.cheapModel)return n("no cheaper model configured");if(e.isFollowUp){let o=e.sessionIdleMs??0,r=e.cacheTtlMs??m;if(o<r)return n(`follow-up on a warm cache (idle ${Math.round(o/1e3)}s) \u2014 swapping would cost more than it saves`)}let t;try{t=await l(d,u(e),c,{incumbent:{needsFlagship:1},features:{agent:e.agent,channel:e.channel??"unknown"}})}catch{return n("routing seat threw \u2014 keeping the flagship")}if(!t)return n("routing seat unavailable \u2014 keeping the flagship");let s=g(t.answers);if(t.mode!=="active")return n(`shadow \u2014 would ${s<(e.threshold??h)?"downgrade":"keep"} (${s.toFixed(2)})`,s);let a=e.threshold??h;return s>=a?n(`needs the flagship (${s.toFixed(2)})`,s):{model:e.cheapModel,downgraded:!0,needsFlagship:s,reason:`mechanical task (${s.toFixed(2)} below ${a}) \u2192 ${e.cheapModel}`}}export{F as a,M as b};
2
- //# sourceMappingURL=chunk-JLEADOCC.js.map
1
+ import{v as l,w}from"./chunk-H4MIYENA.js";import{a as i,f as p}from"./chunk-F4HZTZHW.js";w();p();var d="task-tier";function u(e){return{task:f(e.message,2e3),agent:e.agent,channel:e.channel??null,continuesExistingSession:e.isFollowUp??!1,...e.toolsAvailable?{toolsAvailable:e.toolsAvailable}:{}}}var c={needsFlagship:i("This task needs the strongest available model to be done correctly.",{true:"Doing it well takes real reasoning: writing or reviewing code, diagnosing a failure, planning work across several steps, weighing a judgement, handling money, touching production or anything irreversible, following a long or ambiguous instruction, or work where being subtly wrong would not be noticed. Anything where a weaker model would produce something that LOOKS right belongs here.",false:"It is mechanical and its result is obvious on sight: acknowledging or confirming a message, restating or formatting something already written, a greeting, a status echo, reading one file and reporting what it says, a lookup with one right answer, a scheduled heartbeat with nothing to decide."})};function g(e){return e.needsFlagship.noul}function f(e,n){return e.length>n?`${e.slice(0,n)}\u2026`:e}var h=.2,m=60*60*1e3;function F(e,n){if(e==="claude-code"){let t=n?.cheapModels?.[e]??n?.cheapModel;return t&&/^(claude-|haiku$|sonnet$|opus$)/.test(t)?t:void 0}if(e==="codex-cli"){let t=n?.cheapModels?.[e];return t&&/^(gpt-|o\d)/.test(t)?t:void 0}}async function M(e){let n=(o,r=null)=>({downgraded:!1,needsFlagship:r,reason:o});if(e.channel==="voice"||e.channel==="desktop"||e.channel==="opencode")return n(`${e.channel} requests retain the configured model`);if(!e.cheapModel)return n("no cheaper model configured");if(e.isFollowUp){let o=e.sessionIdleMs??0,r=e.cacheTtlMs??m;if(o<r)return n(`follow-up on a warm cache (idle ${Math.round(o/1e3)}s) \u2014 swapping would cost more than it saves`)}let t;try{t=await l(d,u(e),c,{incumbent:{needsFlagship:1},features:{agent:e.agent,channel:e.channel??"unknown"}})}catch{return n("routing seat threw \u2014 keeping the flagship")}if(!t)return n("routing seat unavailable \u2014 keeping the flagship");let s=g(t.answers);if(t.mode!=="active")return n(`shadow \u2014 would ${s<(e.threshold??h)?"downgrade":"keep"} (${s.toFixed(2)})`,s);let a=e.threshold??h;return s>=a?n(`needs the flagship (${s.toFixed(2)})`,s):{model:e.cheapModel,downgraded:!0,needsFlagship:s,reason:`mechanical task (${s.toFixed(2)} below ${a}) \u2192 ${e.cheapModel}`}}export{F as a,M as b};
2
+ //# sourceMappingURL=chunk-X763UOES.js.map
package/dist/cli.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{a as s}from"./chunk-UORMWVLP.js";import"./chunk-FHF4RA4Q.js";import"./chunk-ADRAW342.js";import"./chunk-GL7VC26K.js";import"./chunk-2TJ5L7CB.js";import"./chunk-7CVJ4JOE.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-SZDACK6O.js";import"./chunk-4ZGX4L6Q.js";import"./chunk-F6CNF7V3.js";import"./chunk-AKIYB3IJ.js";import"./chunk-V7FYSZSV.js";import"./chunk-ZVP6GB4G.js";import"./chunk-N6APC3DF.js";import"./chunk-IEE475O2.js";import"./chunk-VMDA2SX2.js";import"./chunk-QLTM3F7M.js";import"./chunk-RRLIZLBH.js";import"./chunk-HEV3AVFJ.js";import"./chunk-SFQUP3BP.js";import"./chunk-3SCPRYJB.js";import"./chunk-WPMX3VGI.js";import"./chunk-K33GIBSE.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-3SKFX6G3.js";import"./chunk-JLEADOCC.js";import"./chunk-DWADWDMU.js";import"./chunk-77OV7346.js";import"./chunk-VWTBHLMX.js";import"./chunk-MC6I6ZLY.js";import"./chunk-PNWNVOEZ.js";import"./chunk-64P4QHSZ.js";import"./chunk-EJWIRM52.js";import"./chunk-AJ5RMU7X.js";import"./chunk-2GIDVZ4H.js";import"./chunk-SR6TVIIS.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-AJONZWLT.js";import"./chunk-F4HZTZHW.js";import"./chunk-QOYAX2FT.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-VDMYBPYB.js";import"./chunk-DSYKYZMT.js";import"./chunk-WFKS4O34.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));async function o(){let r=await s();if(process.argv.slice(2).length===0){r.outputHelp();return}r.parse()}o();
2
+ import{a as s}from"./chunk-R3VXG2Q5.js";import"./chunk-SJPLXXCI.js";import"./chunk-B5HKRYCU.js";import"./chunk-REPZID5M.js";import"./chunk-2TJ5L7CB.js";import"./chunk-7CVJ4JOE.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-SZDACK6O.js";import"./chunk-L2RUE6T4.js";import"./chunk-F6CNF7V3.js";import"./chunk-FAJEBVZE.js";import"./chunk-V7FYSZSV.js";import"./chunk-ZVP6GB4G.js";import"./chunk-DIKZWTL5.js";import"./chunk-P7LNYB53.js";import"./chunk-VMDA2SX2.js";import"./chunk-QLTM3F7M.js";import"./chunk-NZ6AQIKJ.js";import"./chunk-WBGROLOX.js";import"./chunk-SFQUP3BP.js";import"./chunk-3SCPRYJB.js";import"./chunk-WPMX3VGI.js";import"./chunk-K33GIBSE.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-B32HVIDN.js";import"./chunk-X763UOES.js";import"./chunk-DWADWDMU.js";import"./chunk-77OV7346.js";import"./chunk-VWTBHLMX.js";import"./chunk-RCVGIKC2.js";import"./chunk-PNWNVOEZ.js";import"./chunk-64P4QHSZ.js";import"./chunk-RQKUQOFC.js";import"./chunk-AJ5RMU7X.js";import"./chunk-2GIDVZ4H.js";import"./chunk-H4MIYENA.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-AJONZWLT.js";import"./chunk-F4HZTZHW.js";import"./chunk-QOYAX2FT.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-VDMYBPYB.js";import"./chunk-DSYKYZMT.js";import"./chunk-IAG6FI3Q.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));async function o(){let r=await s();if(process.argv.slice(2).length===0){r.outputHelp();return}r.parse()}o();
3
3
  //# sourceMappingURL=cli.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b,c,d,e,f,g}from"./chunk-SJPLXXCI.js";import"./chunk-IAG6FI3Q.js";import"./chunk-FIOB3MEX.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-6BGTH2TT.js.map
@@ -0,0 +1,2 @@
1
+ import{d as a,e as b,f as c,g as d,h as e,j as f}from"./chunk-IAG6FI3Q.js";import"./chunk-FIOB3MEX.js";f();export{a as INTEGRATION_KINDS,b as daemonConfigSchema,c as expandEnvVars,d as loadDaemonConfig,e as validateWorkspaces};
2
+ //# sourceMappingURL=config-SRTXHGSK.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b,c,d}from"./chunk-B32HVIDN.js";import"./chunk-IAG6FI3Q.js";import"./chunk-FIOB3MEX.js";export{a as applyConfigMutation,c as getAtPath,b as setAtPath,d as unsetAtPath};
2
+ //# sourceMappingURL=config-mutator-KJ5GEMVV.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b}from"./chunk-B5HKRYCU.js";import"./chunk-IAG6FI3Q.js";import"./chunk-FIOB3MEX.js";export{b as doctor,a as runDoctorChecks};
2
+ //# sourceMappingURL=doctor-J4FLV45L.js.map
package/dist/index.d.ts CHANGED
@@ -1713,9 +1713,9 @@ declare const agentConfigSchema: z.ZodObject<{
1713
1713
  voice: z.ZodOptional<z.ZodObject<{
1714
1714
  /** Overrides the global voice.provider for this agent. */
1715
1715
  provider: z.ZodOptional<z.ZodEnum<["system", "elevenlabs"]>>;
1716
- /** A macOS voice: a name ("Daniel", "Ava (Premium)") or identifier.
1717
- * Unset: one is assigned, different from every other agent's. */
1718
- system: z.ZodOptional<z.ZodString>;
1716
+ /** See systemVoiceSchema. Unset: one is assigned, of the agent's
1717
+ * gender when set, different from every other agent's. */
1718
+ system: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
1719
1719
  elevenlabsVoiceId: z.ZodOptional<z.ZodString>;
1720
1720
  gender: z.ZodOptional<z.ZodEnum<["female", "male", "neutral"]>>;
1721
1721
  /** A few words on manner, e.g. "warm, upbeat, a little playful". */
@@ -1726,7 +1726,7 @@ declare const agentConfigSchema: z.ZodObject<{
1726
1726
  * works: "on" for everything but cron, "all" to include cron. */
1727
1727
  narrate: z.ZodOptional<z.ZodEnum<["off", "on", "all"]>>;
1728
1728
  }, "strip", z.ZodTypeAny, {
1729
- system?: string | undefined;
1729
+ system?: string | Record<string, string> | undefined;
1730
1730
  provider?: "system" | "elevenlabs" | undefined;
1731
1731
  style?: string | undefined;
1732
1732
  elevenlabsVoiceId?: string | undefined;
@@ -1734,7 +1734,7 @@ declare const agentConfigSchema: z.ZodObject<{
1734
1734
  intro?: string | undefined;
1735
1735
  narrate?: "all" | "on" | "off" | undefined;
1736
1736
  }, {
1737
- system?: string | undefined;
1737
+ system?: string | Record<string, string> | undefined;
1738
1738
  provider?: "system" | "elevenlabs" | undefined;
1739
1739
  style?: string | undefined;
1740
1740
  elevenlabsVoiceId?: string | undefined;
@@ -1822,7 +1822,7 @@ declare const agentConfigSchema: z.ZodObject<{
1822
1822
  contextStrategy?: "layered" | "planner" | undefined;
1823
1823
  gitlabAutoReply?: boolean | undefined;
1824
1824
  voice?: {
1825
- system?: string | undefined;
1825
+ system?: string | Record<string, string> | undefined;
1826
1826
  provider?: "system" | "elevenlabs" | undefined;
1827
1827
  style?: string | undefined;
1828
1828
  elevenlabsVoiceId?: string | undefined;
@@ -1892,7 +1892,7 @@ declare const agentConfigSchema: z.ZodObject<{
1892
1892
  metadata?: Record<string, string | number | boolean> | undefined;
1893
1893
  }[] | undefined;
1894
1894
  voice?: {
1895
- system?: string | undefined;
1895
+ system?: string | Record<string, string> | undefined;
1896
1896
  provider?: "system" | "elevenlabs" | undefined;
1897
1897
  style?: string | undefined;
1898
1898
  elevenlabsVoiceId?: string | undefined;
@@ -2310,9 +2310,9 @@ declare const daemonConfigSchema: z.ZodObject<{
2310
2310
  voice: z.ZodOptional<z.ZodObject<{
2311
2311
  /** Overrides the global voice.provider for this agent. */
2312
2312
  provider: z.ZodOptional<z.ZodEnum<["system", "elevenlabs"]>>;
2313
- /** A macOS voice: a name ("Daniel", "Ava (Premium)") or identifier.
2314
- * Unset: one is assigned, different from every other agent's. */
2315
- system: z.ZodOptional<z.ZodString>;
2313
+ /** See systemVoiceSchema. Unset: one is assigned, of the agent's
2314
+ * gender when set, different from every other agent's. */
2315
+ system: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
2316
2316
  elevenlabsVoiceId: z.ZodOptional<z.ZodString>;
2317
2317
  gender: z.ZodOptional<z.ZodEnum<["female", "male", "neutral"]>>;
2318
2318
  /** A few words on manner, e.g. "warm, upbeat, a little playful". */
@@ -2323,7 +2323,7 @@ declare const daemonConfigSchema: z.ZodObject<{
2323
2323
  * works: "on" for everything but cron, "all" to include cron. */
2324
2324
  narrate: z.ZodOptional<z.ZodEnum<["off", "on", "all"]>>;
2325
2325
  }, "strip", z.ZodTypeAny, {
2326
- system?: string | undefined;
2326
+ system?: string | Record<string, string> | undefined;
2327
2327
  provider?: "system" | "elevenlabs" | undefined;
2328
2328
  style?: string | undefined;
2329
2329
  elevenlabsVoiceId?: string | undefined;
@@ -2331,7 +2331,7 @@ declare const daemonConfigSchema: z.ZodObject<{
2331
2331
  intro?: string | undefined;
2332
2332
  narrate?: "all" | "on" | "off" | undefined;
2333
2333
  }, {
2334
- system?: string | undefined;
2334
+ system?: string | Record<string, string> | undefined;
2335
2335
  provider?: "system" | "elevenlabs" | undefined;
2336
2336
  style?: string | undefined;
2337
2337
  elevenlabsVoiceId?: string | undefined;
@@ -2419,7 +2419,7 @@ declare const daemonConfigSchema: z.ZodObject<{
2419
2419
  contextStrategy?: "layered" | "planner" | undefined;
2420
2420
  gitlabAutoReply?: boolean | undefined;
2421
2421
  voice?: {
2422
- system?: string | undefined;
2422
+ system?: string | Record<string, string> | undefined;
2423
2423
  provider?: "system" | "elevenlabs" | undefined;
2424
2424
  style?: string | undefined;
2425
2425
  elevenlabsVoiceId?: string | undefined;
@@ -2489,7 +2489,7 @@ declare const daemonConfigSchema: z.ZodObject<{
2489
2489
  metadata?: Record<string, string | number | boolean> | undefined;
2490
2490
  }[] | undefined;
2491
2491
  voice?: {
2492
- system?: string | undefined;
2492
+ system?: string | Record<string, string> | undefined;
2493
2493
  provider?: "system" | "elevenlabs" | undefined;
2494
2494
  style?: string | undefined;
2495
2495
  elevenlabsVoiceId?: string | undefined;
@@ -3638,9 +3638,9 @@ declare const daemonConfigSchema: z.ZodObject<{
3638
3638
  meshVoices: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
3639
3639
  /** Overrides the global voice.provider for this agent. */
3640
3640
  provider: z.ZodOptional<z.ZodEnum<["system", "elevenlabs"]>>;
3641
- /** A macOS voice: a name ("Daniel", "Ava (Premium)") or identifier.
3642
- * Unset: one is assigned, different from every other agent's. */
3643
- system: z.ZodOptional<z.ZodString>;
3641
+ /** See systemVoiceSchema. Unset: one is assigned, of the agent's
3642
+ * gender when set, different from every other agent's. */
3643
+ system: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
3644
3644
  elevenlabsVoiceId: z.ZodOptional<z.ZodString>;
3645
3645
  gender: z.ZodOptional<z.ZodEnum<["female", "male", "neutral"]>>;
3646
3646
  /** A few words on manner, e.g. "warm, upbeat, a little playful". */
@@ -3654,7 +3654,7 @@ declare const daemonConfigSchema: z.ZodObject<{
3654
3654
  /** What to call the agent aloud, e.g. "Atlas" for "Main Agent". */
3655
3655
  name: z.ZodOptional<z.ZodString>;
3656
3656
  }, "strip", z.ZodTypeAny, {
3657
- system?: string | undefined;
3657
+ system?: string | Record<string, string> | undefined;
3658
3658
  provider?: "system" | "elevenlabs" | undefined;
3659
3659
  name?: string | undefined;
3660
3660
  style?: string | undefined;
@@ -3663,7 +3663,7 @@ declare const daemonConfigSchema: z.ZodObject<{
3663
3663
  intro?: string | undefined;
3664
3664
  narrate?: "all" | "on" | "off" | undefined;
3665
3665
  }, {
3666
- system?: string | undefined;
3666
+ system?: string | Record<string, string> | undefined;
3667
3667
  provider?: "system" | "elevenlabs" | undefined;
3668
3668
  name?: string | undefined;
3669
3669
  style?: string | undefined;
@@ -3680,18 +3680,18 @@ declare const daemonConfigSchema: z.ZodObject<{
3680
3680
  /** When ElevenLabs cannot speak (no key, an error): the system voice,
3681
3681
  * or silence. */
3682
3682
  fallback: z.ZodDefault<z.ZodEnum<["system", "none"]>>;
3683
- /** The system voice for agents without one of their own. Unset: each
3684
- * agent gets its own. */
3685
- system: z.ZodOptional<z.ZodString>;
3683
+ /** The system voice for agents without one of their own (see
3684
+ * systemVoiceSchema). Unset: each agent gets its own. */
3685
+ system: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
3686
3686
  /** Language for assigned system voices, e.g. "en", "fr-FR". */
3687
3687
  locale: z.ZodDefault<z.ZodString>;
3688
3688
  }, "strip", z.ZodTypeAny, {
3689
3689
  provider: "system" | "elevenlabs";
3690
3690
  fallback: "system" | "none";
3691
3691
  locale: string;
3692
- system?: string | undefined;
3692
+ system?: string | Record<string, string> | undefined;
3693
3693
  }, {
3694
- system?: string | undefined;
3694
+ system?: string | Record<string, string> | undefined;
3695
3695
  provider?: "system" | "elevenlabs" | undefined;
3696
3696
  fallback?: "system" | "none" | undefined;
3697
3697
  locale?: string | undefined;
@@ -4170,7 +4170,7 @@ declare const daemonConfigSchema: z.ZodObject<{
4170
4170
  port: z.ZodDefault<z.ZodNumber>;
4171
4171
  bind: z.ZodDefault<z.ZodString>;
4172
4172
  token: z.ZodOptional<z.ZodString>;
4173
- daemonUrl: z.ZodDefault<z.ZodString>;
4173
+ daemonUrl: z.ZodDefault<z.ZodString>; /** Overrides the global voice.provider for this agent. */
4174
4174
  daemons: z.ZodDefault<z.ZodArray<z.ZodObject<{
4175
4175
  name: z.ZodString;
4176
4176
  url: z.ZodString;
@@ -4189,7 +4189,7 @@ declare const daemonConfigSchema: z.ZodObject<{
4189
4189
  token?: string | undefined;
4190
4190
  dashboardUrl?: string | undefined;
4191
4191
  dashboardToken?: string | undefined;
4192
- }>, "many">>; /** The one-line self-introduction used on first contact. */
4192
+ }>, "many">>;
4193
4193
  draftAgent: z.ZodOptional<z.ZodString>;
4194
4194
  }, "strip", z.ZodTypeAny, {
4195
4195
  enabled: boolean;
@@ -5022,7 +5022,7 @@ declare const daemonConfigSchema: z.ZodObject<{
5022
5022
  contextStrategy?: "layered" | "planner" | undefined;
5023
5023
  gitlabAutoReply?: boolean | undefined;
5024
5024
  voice?: {
5025
- system?: string | undefined;
5025
+ system?: string | Record<string, string> | undefined;
5026
5026
  provider?: "system" | "elevenlabs" | undefined;
5027
5027
  style?: string | undefined;
5028
5028
  elevenlabsVoiceId?: string | undefined;
@@ -5059,7 +5059,7 @@ declare const daemonConfigSchema: z.ZodObject<{
5059
5059
  provider: "system" | "elevenlabs";
5060
5060
  fallback: "system" | "none";
5061
5061
  locale: string;
5062
- system?: string | undefined;
5062
+ system?: string | Record<string, string> | undefined;
5063
5063
  };
5064
5064
  node: {
5065
5065
  id: string;
@@ -5256,7 +5256,7 @@ declare const daemonConfigSchema: z.ZodObject<{
5256
5256
  } | undefined;
5257
5257
  };
5258
5258
  meshVoices: Record<string, {
5259
- system?: string | undefined;
5259
+ system?: string | Record<string, string> | undefined;
5260
5260
  provider?: "system" | "elevenlabs" | undefined;
5261
5261
  name?: string | undefined;
5262
5262
  style?: string | undefined;
@@ -5560,7 +5560,7 @@ declare const daemonConfigSchema: z.ZodObject<{
5560
5560
  metadata?: Record<string, string | number | boolean> | undefined;
5561
5561
  }[] | undefined;
5562
5562
  voice?: {
5563
- system?: string | undefined;
5563
+ system?: string | Record<string, string> | undefined;
5564
5564
  provider?: "system" | "elevenlabs" | undefined;
5565
5565
  style?: string | undefined;
5566
5566
  elevenlabsVoiceId?: string | undefined;
@@ -5594,7 +5594,7 @@ declare const daemonConfigSchema: z.ZodObject<{
5594
5594
  } | undefined;
5595
5595
  } | undefined;
5596
5596
  voice?: {
5597
- system?: string | undefined;
5597
+ system?: string | Record<string, string> | undefined;
5598
5598
  provider?: "system" | "elevenlabs" | undefined;
5599
5599
  fallback?: "system" | "none" | undefined;
5600
5600
  locale?: string | undefined;
@@ -5788,7 +5788,7 @@ declare const daemonConfigSchema: z.ZodObject<{
5788
5788
  } | undefined;
5789
5789
  } | undefined;
5790
5790
  meshVoices?: Record<string, {
5791
- system?: string | undefined;
5791
+ system?: string | Record<string, string> | undefined;
5792
5792
  provider?: "system" | "elevenlabs" | undefined;
5793
5793
  name?: string | undefined;
5794
5794
  style?: string | undefined;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{a as L}from"./chunk-W5C2GDNC.js";import{a as St,b as kt,c as vt,d as xt,e as $t,ea as bt,f as Ct,fa as Tt,g as Pt,ga as Mt}from"./chunk-4ZGX4L6Q.js";import"./chunk-F6CNF7V3.js";import"./chunk-AKIYB3IJ.js";import"./chunk-V7FYSZSV.js";import"./chunk-ZVP6GB4G.js";import{J as yt,h as lt,i as ct,j as dt,k as mt,l as pt}from"./chunk-N6APC3DF.js";import"./chunk-IEE475O2.js";import"./chunk-VMDA2SX2.js";import"./chunk-QLTM3F7M.js";import{h as ut}from"./chunk-RRLIZLBH.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-HEV3AVFJ.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-3SCPRYJB.js";import"./chunk-WPMX3VGI.js";import"./chunk-K33GIBSE.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-3SKFX6G3.js";import"./chunk-JLEADOCC.js";import"./chunk-DWADWDMU.js";import"./chunk-77OV7346.js";import"./chunk-VWTBHLMX.js";import{a as gt,b as ft,e as ht}from"./chunk-MC6I6ZLY.js";import"./chunk-PNWNVOEZ.js";import"./chunk-64P4QHSZ.js";import"./chunk-EJWIRM52.js";import"./chunk-AJ5RMU7X.js";import"./chunk-2GIDVZ4H.js";import{j as it,k as rt,l as at}from"./chunk-SR6TVIIS.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-AJONZWLT.js";import"./chunk-F4HZTZHW.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-LCIREYTD.js";import{a as m,b as G}from"./chunk-L2WSPY6S.js";import{a as Fe,b as Le,c as A,d as De}from"./chunk-VDMYBPYB.js";import{a as Ke,b as Je,e as We}from"./chunk-DSYKYZMT.js";import{e as tt,g as st,h as ot,j as nt}from"./chunk-WFKS4O34.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.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-W5C2GDNC.js";import{a as St,b as kt,c as vt,d as xt,e as $t,f as Ct,g as Pt,ga as bt,ha as Tt,ia as Mt}from"./chunk-L2RUE6T4.js";import"./chunk-F6CNF7V3.js";import"./chunk-FAJEBVZE.js";import"./chunk-V7FYSZSV.js";import"./chunk-ZVP6GB4G.js";import{J as yt,h as lt,i as ct,j as dt,k as mt,l as pt}from"./chunk-DIKZWTL5.js";import"./chunk-P7LNYB53.js";import"./chunk-VMDA2SX2.js";import"./chunk-QLTM3F7M.js";import{h as ut}from"./chunk-NZ6AQIKJ.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-WBGROLOX.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-3SCPRYJB.js";import"./chunk-WPMX3VGI.js";import"./chunk-K33GIBSE.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-B32HVIDN.js";import"./chunk-X763UOES.js";import"./chunk-DWADWDMU.js";import"./chunk-77OV7346.js";import"./chunk-VWTBHLMX.js";import{a as gt,b as ft,e as ht}from"./chunk-RCVGIKC2.js";import"./chunk-PNWNVOEZ.js";import"./chunk-64P4QHSZ.js";import"./chunk-RQKUQOFC.js";import"./chunk-AJ5RMU7X.js";import"./chunk-2GIDVZ4H.js";import{j as it,k as rt,l as at}from"./chunk-H4MIYENA.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-AJONZWLT.js";import"./chunk-F4HZTZHW.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-LCIREYTD.js";import{a as m,b as G}from"./chunk-L2WSPY6S.js";import{a as Fe,b as Le,c as A,d as De}from"./chunk-VDMYBPYB.js";import{a as Ke,b as Je,e as We}from"./chunk-DSYKYZMT.js";import{e as tt,g as st,h as ot,j as nt}from"./chunk-IAG6FI3Q.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.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-BOKE5M5S.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).
@@ -0,0 +1,2 @@
1
+ import{a}from"./chunk-R3VXG2Q5.js";import"./chunk-SJPLXXCI.js";import"./chunk-B5HKRYCU.js";import"./chunk-REPZID5M.js";import"./chunk-2TJ5L7CB.js";import"./chunk-7CVJ4JOE.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-SZDACK6O.js";import"./chunk-L2RUE6T4.js";import"./chunk-F6CNF7V3.js";import"./chunk-FAJEBVZE.js";import"./chunk-V7FYSZSV.js";import"./chunk-ZVP6GB4G.js";import"./chunk-DIKZWTL5.js";import"./chunk-P7LNYB53.js";import"./chunk-VMDA2SX2.js";import"./chunk-QLTM3F7M.js";import"./chunk-NZ6AQIKJ.js";import"./chunk-WBGROLOX.js";import"./chunk-SFQUP3BP.js";import"./chunk-3SCPRYJB.js";import"./chunk-WPMX3VGI.js";import"./chunk-K33GIBSE.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-B32HVIDN.js";import"./chunk-X763UOES.js";import"./chunk-DWADWDMU.js";import"./chunk-77OV7346.js";import"./chunk-VWTBHLMX.js";import"./chunk-RCVGIKC2.js";import"./chunk-PNWNVOEZ.js";import"./chunk-64P4QHSZ.js";import"./chunk-RQKUQOFC.js";import"./chunk-AJ5RMU7X.js";import"./chunk-2GIDVZ4H.js";import"./chunk-H4MIYENA.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-AJONZWLT.js";import"./chunk-F4HZTZHW.js";import"./chunk-QOYAX2FT.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-VDMYBPYB.js";import"./chunk-DSYKYZMT.js";import"./chunk-IAG6FI3Q.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";export{a as buildProgram};
2
+ //# sourceMappingURL=program-E6AXVO5W.js.map
@@ -0,0 +1,2 @@
1
+ import{a}from"./chunk-RQKUQOFC.js";import"./chunk-AJ5RMU7X.js";import"./chunk-2GIDVZ4H.js";import"./chunk-H4MIYENA.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-AJONZWLT.js";import"./chunk-F4HZTZHW.js";import"./chunk-QOYAX2FT.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-IAG6FI3Q.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";export{a as agenticQuery};
2
+ //# sourceMappingURL=query-ZSUBNWOL.js.map
@@ -1,2 +1,2 @@
1
- import{A as a,B as b,C as c,D as d,E as e,F as f,G as g,H as h,I as i,J as j}from"./chunk-N6APC3DF.js";import"./chunk-IEE475O2.js";import"./chunk-VMDA2SX2.js";import"./chunk-QLTM3F7M.js";import"./chunk-RRLIZLBH.js";import"./chunk-WPMX3VGI.js";import"./chunk-K33GIBSE.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-3SKFX6G3.js";import"./chunk-JLEADOCC.js";import"./chunk-DWADWDMU.js";import"./chunk-77OV7346.js";import"./chunk-VWTBHLMX.js";import"./chunk-MC6I6ZLY.js";import"./chunk-PNWNVOEZ.js";import"./chunk-64P4QHSZ.js";import"./chunk-EJWIRM52.js";import"./chunk-AJ5RMU7X.js";import"./chunk-2GIDVZ4H.js";import"./chunk-SR6TVIIS.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-AJONZWLT.js";import"./chunk-F4HZTZHW.js";import"./chunk-QOYAX2FT.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-DSYKYZMT.js";import"./chunk-WFKS4O34.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";export{j as AgentRegistry,e as TRACE_STEP_SUMMARY_BYTES,c as buildEntryMeta,d as buildWikiContext,f as clipForTrace,i as emitTraceStepsFromStreamEvent,h as firstMissingRequiredTool,b as getGlobalRegistry,a as setGlobalRegistry,g as tallyToolUses};
2
- //# sourceMappingURL=registry-TDYF7HGH.js.map
1
+ import{A as a,B as b,C as c,D as d,E as e,F as f,G as g,H as h,I as i,J as j}from"./chunk-DIKZWTL5.js";import"./chunk-P7LNYB53.js";import"./chunk-VMDA2SX2.js";import"./chunk-QLTM3F7M.js";import"./chunk-NZ6AQIKJ.js";import"./chunk-WPMX3VGI.js";import"./chunk-K33GIBSE.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-B32HVIDN.js";import"./chunk-X763UOES.js";import"./chunk-DWADWDMU.js";import"./chunk-77OV7346.js";import"./chunk-VWTBHLMX.js";import"./chunk-RCVGIKC2.js";import"./chunk-PNWNVOEZ.js";import"./chunk-64P4QHSZ.js";import"./chunk-RQKUQOFC.js";import"./chunk-AJ5RMU7X.js";import"./chunk-2GIDVZ4H.js";import"./chunk-H4MIYENA.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-AJONZWLT.js";import"./chunk-F4HZTZHW.js";import"./chunk-QOYAX2FT.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-DSYKYZMT.js";import"./chunk-IAG6FI3Q.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";export{j as AgentRegistry,e as TRACE_STEP_SUMMARY_BYTES,c as buildEntryMeta,d as buildWikiContext,f as clipForTrace,i as emitTraceStepsFromStreamEvent,h as firstMissingRequiredTool,b as getGlobalRegistry,a as setGlobalRegistry,g as tallyToolUses};
2
+ //# sourceMappingURL=registry-OMUDCBKM.js.map
@@ -1,2 +1,2 @@
1
- import{q as m,t as p,v as d,w as x}from"./chunk-SR6TVIIS.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-AJONZWLT.js";import{a as u,f}from"./chunk-F4HZTZHW.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-WFKS4O34.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";x();f();var l="request-gate",h="request-context",g=.1;async function q(t,o,c,r=Math.random){let s=p(l)==="active";if(s){let i=m().seats[l]?.holdout??g;if(r()<i)return{active:!0,preprocess:!1,arm:"holdout"}}let a=s?"treatment":void 0,e=await d(l,{request:t.slice(0,2e3),agent:o,channel:c,operations:["select optional context","evaluate model routing where permitted"],constraints:["Keep the original request and mandatory instructions","Desktop model cannot be downgraded"]},{preprocess:u("This request benefits from structured context selection or another bounded typed decision before the main agent executes.",{true:"Relevant context must be selected, or a bounded routing decision can help. Follow-ups and ambiguous references need context.",false:"Typed preprocessing adds no useful decision; send the request to the configured main agent with existing context."})},{timeoutMs:3e3});if(!e||e.mode!=="active")return{active:!1,preprocess:!1,arm:a};let n=e.answers.preprocess?.noul;return{active:!0,preprocess:Number.isFinite(n)&&n>=.5,arm:a}}var v={landscape:"Agent directory and mesh overview",patternContext:"Learned behavioral patterns",references:"Retrieved project references",memoryContext:"Retrieved agent memory",crossChatContext:"Summaries from other conversations",longMemoryRecall:"Older conversation recall",wikiContext:"Retrieved wiki knowledge"};async function b(t){let o=Object.entries(v).flatMap(([e,n])=>{let i=t[e];return i?[{id:e,description:n,source:e,characters:i.length,preview:i.slice(0,400),trust:"context data, not instructions"}]:[]});if(!o.length)return{input:t,excluded:[]};let c=Object.fromEntries(o.map(e=>[e.id,u(`Context block ${e.id} is relevant to completing the current request correctly.`,{true:"Needed or potentially relevant; retain if uncertain or the preview is incomplete.",false:"Clearly unrelated to the current request; safe to omit."})])),r=await d(h,{request:t.message.slice(0,2e3),channel:t.channel,agent:t.agentId,mandatory:["request","identity","permissions and instructions","same-chat history","handover","attachments"],context:o},c,{timeoutMs:3e3});if(!r||r.mode!=="active")return{input:t,excluded:[]};let s={...t},a=[];for(let e of o){let n=r.answers[e.id]?.noul;Number.isFinite(n)&&n>=0&&n<.2&&(delete s[e.id],a.push(e.id))}return{input:s,excluded:a}}export{g as DEFAULT_REQUEST_GATE_HOLDOUT,h as REQUEST_CONTEXT_SEAT,l as REQUEST_GATE_SEAT,q as evaluateRequest,b as selectRequestContext};
2
- //# sourceMappingURL=request-planner-DF74JHQB.js.map
1
+ import{q as m,t as p,v as d,w as x}from"./chunk-H4MIYENA.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-AJONZWLT.js";import{a as u,f}from"./chunk-F4HZTZHW.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-IAG6FI3Q.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";x();f();var l="request-gate",h="request-context",g=.1;async function q(t,o,c,r=Math.random){let s=p(l)==="active";if(s){let i=m().seats[l]?.holdout??g;if(r()<i)return{active:!0,preprocess:!1,arm:"holdout"}}let a=s?"treatment":void 0,e=await d(l,{request:t.slice(0,2e3),agent:o,channel:c,operations:["select optional context","evaluate model routing where permitted"],constraints:["Keep the original request and mandatory instructions","Desktop model cannot be downgraded"]},{preprocess:u("This request benefits from structured context selection or another bounded typed decision before the main agent executes.",{true:"Relevant context must be selected, or a bounded routing decision can help. Follow-ups and ambiguous references need context.",false:"Typed preprocessing adds no useful decision; send the request to the configured main agent with existing context."})},{timeoutMs:3e3});if(!e||e.mode!=="active")return{active:!1,preprocess:!1,arm:a};let n=e.answers.preprocess?.noul;return{active:!0,preprocess:Number.isFinite(n)&&n>=.5,arm:a}}var v={landscape:"Agent directory and mesh overview",patternContext:"Learned behavioral patterns",references:"Retrieved project references",memoryContext:"Retrieved agent memory",crossChatContext:"Summaries from other conversations",longMemoryRecall:"Older conversation recall",wikiContext:"Retrieved wiki knowledge"};async function b(t){let o=Object.entries(v).flatMap(([e,n])=>{let i=t[e];return i?[{id:e,description:n,source:e,characters:i.length,preview:i.slice(0,400),trust:"context data, not instructions"}]:[]});if(!o.length)return{input:t,excluded:[]};let c=Object.fromEntries(o.map(e=>[e.id,u(`Context block ${e.id} is relevant to completing the current request correctly.`,{true:"Needed or potentially relevant; retain if uncertain or the preview is incomplete.",false:"Clearly unrelated to the current request; safe to omit."})])),r=await d(h,{request:t.message.slice(0,2e3),channel:t.channel,agent:t.agentId,mandatory:["request","identity","permissions and instructions","same-chat history","handover","attachments"],context:o},c,{timeoutMs:3e3});if(!r||r.mode!=="active")return{input:t,excluded:[]};let s={...t},a=[];for(let e of o){let n=r.answers[e.id]?.noul;Number.isFinite(n)&&n>=0&&n<.2&&(delete s[e.id],a.push(e.id))}return{input:s,excluded:a}}export{g as DEFAULT_REQUEST_GATE_HOLDOUT,h as REQUEST_CONTEXT_SEAT,l as REQUEST_GATE_SEAT,q as evaluateRequest,b as selectRequestContext};
2
+ //# sourceMappingURL=request-planner-326NOKPZ.js.map
@@ -1,4 +1,4 @@
1
- import{b}from"./chunk-AKIYB3IJ.js";import"./chunk-VMDA2SX2.js";import"./chunk-2GIDVZ4H.js";import"./chunk-SR6TVIIS.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-AJONZWLT.js";import"./chunk-F4HZTZHW.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-WFKS4O34.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";import{createHash as A}from"crypto";var v="review:",I={decisions:"project",warnings:"feedback",friction:"feedback",context:"reference"};function E(t,n,r){let s=A("sha1").update(r.trim().toLowerCase()).digest("hex").slice(0,10);return`${v}${t}/${n}@${s}`}function F(t){if(!t.startsWith(v))return null;let n=t.slice(v.length),r=n.lastIndexOf("@"),s=n.lastIndexOf("/",r===-1?void 0:r);return r===-1||s===-1?null:{reviewId:n.slice(0,s),kind:n.slice(s+1,r),digest:n.slice(r+1)}}var C=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,48)||"finding";function L(t,n){return`${t}|${b(n)}`}function K(t,n={}){let r=n.kinds??Object.keys(I),s=n.minLength??24,h=[],d=new Map,u=new Map,f=new Map,x=new Map;for(let e of t){let i;try{i=JSON.parse(e.result)}catch{continue}let o=e.updated_at?new Date(e.updated_at).toISOString():new Date().toISOString();for(let c of r){let l=I[c];if(!l)continue;let R=i[c];if(Array.isArray(R))for(let $ of R){let a=String($?.text??"").trim();if(a.length<s)continue;let g=E(e.id,c,a),O=g.slice(g.lastIndexOf("@")),w=`${c}${O}`,y=L(c,a),k=f.get(y)??new Set;if(k.add(e.session_id??e.id),f.set(y,k),d.has(w))continue;let _=String($?.evidence??"").trim(),S={occurrences:1,agentId:e.agent,key:`${e.agent}/${l}_${C(a)}`,stamp:g,memory:{name:C(a),type:l,description:a.slice(0,200),body:"",createdAt:o,updatedAt:o}};x.set(g,{text:a,evidence:_,agent:e.agent,source:e.source}),d.set(w,S),u.set(w,y),h.push(S)}}}for(let[e,i]of d){i.occurrences=f.get(u.get(e)??"")?.size??1;let o=x.get(i.stamp);i.memory.body=T(o,i.occurrences)}let m=new Map;for(let[e,i]of d){let o=u.get(e)??e,c=m.get(o)??[];c.push(i),m.set(o,c)}let M=[...m.values()].sort((e,i)=>i[0].occurrences-e[0].occurrences),p=[];for(let e=0;p.length<h.length;e++){let i=!1;for(let o of M)e<o.length&&(p.push(o[e]),i=!0);if(!i)break}return p}function T(t,n){let r=`${t.agent}${t.source?` via ${t.source}`:""}`,s=[];return n>1?(s.push(`Observed in ${n} separate sessions. Most recently stated as:`),s.push(`> ${t.text}`),s.push(`Recurring across ${n} sessions is what makes this worth recording \u2014 any single occurrence is session state, the repetition is the finding.`)):s.push(t.text),t.evidence&&s.push(`**Evidence:** ${t.evidence}`),s.push(`_From ${n>1?"session reviews":"a session review"} of ${r}._`),s.join(`
1
+ import{b}from"./chunk-FAJEBVZE.js";import"./chunk-VMDA2SX2.js";import"./chunk-2GIDVZ4H.js";import"./chunk-H4MIYENA.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-AJONZWLT.js";import"./chunk-F4HZTZHW.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-IAG6FI3Q.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";import{createHash as A}from"crypto";var v="review:",I={decisions:"project",warnings:"feedback",friction:"feedback",context:"reference"};function E(t,n,r){let s=A("sha1").update(r.trim().toLowerCase()).digest("hex").slice(0,10);return`${v}${t}/${n}@${s}`}function F(t){if(!t.startsWith(v))return null;let n=t.slice(v.length),r=n.lastIndexOf("@"),s=n.lastIndexOf("/",r===-1?void 0:r);return r===-1||s===-1?null:{reviewId:n.slice(0,s),kind:n.slice(s+1,r),digest:n.slice(r+1)}}var C=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,48)||"finding";function L(t,n){return`${t}|${b(n)}`}function K(t,n={}){let r=n.kinds??Object.keys(I),s=n.minLength??24,h=[],d=new Map,u=new Map,f=new Map,x=new Map;for(let e of t){let i;try{i=JSON.parse(e.result)}catch{continue}let o=e.updated_at?new Date(e.updated_at).toISOString():new Date().toISOString();for(let c of r){let l=I[c];if(!l)continue;let R=i[c];if(Array.isArray(R))for(let $ of R){let a=String($?.text??"").trim();if(a.length<s)continue;let g=E(e.id,c,a),O=g.slice(g.lastIndexOf("@")),w=`${c}${O}`,y=L(c,a),k=f.get(y)??new Set;if(k.add(e.session_id??e.id),f.set(y,k),d.has(w))continue;let _=String($?.evidence??"").trim(),S={occurrences:1,agentId:e.agent,key:`${e.agent}/${l}_${C(a)}`,stamp:g,memory:{name:C(a),type:l,description:a.slice(0,200),body:"",createdAt:o,updatedAt:o}};x.set(g,{text:a,evidence:_,agent:e.agent,source:e.source}),d.set(w,S),u.set(w,y),h.push(S)}}}for(let[e,i]of d){i.occurrences=f.get(u.get(e)??"")?.size??1;let o=x.get(i.stamp);i.memory.body=T(o,i.occurrences)}let m=new Map;for(let[e,i]of d){let o=u.get(e)??e,c=m.get(o)??[];c.push(i),m.set(o,c)}let M=[...m.values()].sort((e,i)=>i[0].occurrences-e[0].occurrences),p=[];for(let e=0;p.length<h.length;e++){let i=!1;for(let o of M)e<o.length&&(p.push(o[e]),i=!0);if(!i)break}return p}function T(t,n){let r=`${t.agent}${t.source?` via ${t.source}`:""}`,s=[];return n>1?(s.push(`Observed in ${n} separate sessions. Most recently stated as:`),s.push(`> ${t.text}`),s.push(`Recurring across ${n} sessions is what makes this worth recording \u2014 any single occurrence is session state, the repetition is the finding.`)):s.push(t.text),t.evidence&&s.push(`**Evidence:** ${t.evidence}`),s.push(`_From ${n>1?"session reviews":"a session review"} of ${r}._`),s.join(`
2
2
 
3
3
  `)}export{I as PROMOTABLE_KINDS,v as REVIEW_STAMP_PREFIX,F as parseReviewStamp,E as reviewStamp,K as reviewsToCandidates};
4
- //# sourceMappingURL=review-candidates-SEAGMKI6.js.map
4
+ //# sourceMappingURL=review-candidates-LEOPEOEG.js.map
@@ -1,2 +1,2 @@
1
- import{a,b}from"./chunk-JLEADOCC.js";import"./chunk-SR6TVIIS.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-AJONZWLT.js";import"./chunk-F4HZTZHW.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-WFKS4O34.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";export{a as cheapModelForEngine,b as routeTaskModel};
2
- //# sourceMappingURL=routing-JKWL3L3Q.js.map
1
+ import{a,b}from"./chunk-X763UOES.js";import"./chunk-H4MIYENA.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-AJONZWLT.js";import"./chunk-F4HZTZHW.js";import"./chunk-LCIREYTD.js";import"./chunk-L2WSPY6S.js";import"./chunk-IAG6FI3Q.js";import"./chunk-BH3GTCZ6.js";import"./chunk-FIOB3MEX.js";export{a as cheapModelForEngine,b as routeTaskModel};
2
+ //# sourceMappingURL=routing-AWIRBYGU.js.map
@@ -0,0 +1,2 @@
1
+ import{g as a,h as b}from"./chunk-NZ6AQIKJ.js";import"./chunk-B32HVIDN.js";import"./chunk-ZTEU5JVQ.js";import"./chunk-L2WSPY6S.js";import"./chunk-IAG6FI3Q.js";import"./chunk-FIOB3MEX.js";export{b as CronScheduler,a as getNextCronDate};
2
+ //# sourceMappingURL=scheduler-PGGYW5AB.js.map