agentix-cli 0.213.3 → 0.215.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 (77) hide show
  1. package/dist/{agent-KUCECPSZ.js → agent-KOKQSRAH.js} +2 -2
  2. package/dist/{board-dashboard-RWX4F43G.js → board-dashboard-NVQUQSWI.js} +3 -3
  3. package/dist/{board-dashboard-RWX4F43G.js.map → board-dashboard-NVQUQSWI.js.map} +1 -1
  4. package/dist/chunk-4BYJN2A3.js +4 -0
  5. package/dist/chunk-4BYJN2A3.js.map +1 -0
  6. package/dist/{chunk-SPXXLPAS.js → chunk-4DCQIHWU.js} +2 -2
  7. package/dist/{chunk-SMZQLUJH.js → chunk-4ZD2C76P.js} +2 -2
  8. package/dist/{chunk-YR6GDF4W.js → chunk-7AFXLWWW.js} +87 -147
  9. package/dist/chunk-7AFXLWWW.js.map +1 -0
  10. package/dist/chunk-7YOLZGB5.js +2 -0
  11. package/dist/chunk-7YOLZGB5.js.map +1 -0
  12. package/dist/chunk-CSC45PA7.js +62 -0
  13. package/dist/chunk-CSC45PA7.js.map +1 -0
  14. package/dist/chunk-GGAEFVXL.js +42 -0
  15. package/dist/chunk-GGAEFVXL.js.map +1 -0
  16. package/dist/chunk-HVMUYEQP.js +4 -0
  17. package/dist/chunk-HVMUYEQP.js.map +1 -0
  18. package/dist/{chunk-SBFMNAJG.js → chunk-JLH73NRM.js} +88 -88
  19. package/dist/chunk-JLH73NRM.js.map +1 -0
  20. package/dist/{chunk-3GWIV2YO.js → chunk-OQNJIIR2.js} +2 -2
  21. package/dist/{chunk-3GWIV2YO.js.map → chunk-OQNJIIR2.js.map} +1 -1
  22. package/dist/{chunk-3327JD6L.js → chunk-Q7Y5VQGX.js} +2 -2
  23. package/dist/{chunk-UNVZUWOY.js → chunk-QMICGPM6.js} +3 -3
  24. package/dist/{chunk-UNVZUWOY.js.map → chunk-QMICGPM6.js.map} +1 -1
  25. package/dist/{chunk-D7B35QCZ.js → chunk-QOGZD6Z3.js} +323 -323
  26. package/dist/chunk-QOGZD6Z3.js.map +1 -0
  27. package/dist/chunk-Z5CMA4JN.js +6 -0
  28. package/dist/chunk-Z5CMA4JN.js.map +1 -0
  29. package/dist/cli.js +1 -1
  30. package/dist/decision-approvals-SWZ4RWFI.js +2 -0
  31. package/dist/{doctor-TK7LVXJ6.js → doctor-GP2KVKWE.js} +2 -2
  32. package/dist/hub-V2AGLA7T.js +2 -0
  33. package/dist/index.d.ts +93 -0
  34. package/dist/index.js +1 -1
  35. package/dist/index.js.map +1 -1
  36. package/dist/{program-GXEVAQRW.js → program-WSGVQTFM.js} +255 -255
  37. package/dist/program-WSGVQTFM.js.map +1 -0
  38. package/dist/{query-runs-AENEZOM6.js → query-runs-2F6KHFBZ.js} +2 -2
  39. package/dist/{registry-D727ZQUP.js → registry-KRU6AWVW.js} +2 -2
  40. package/dist/timers-LAT4ZVXJ.js +2 -0
  41. package/dist/{tool-2VRNH43W.js → tool-ZCSGJ2ZF.js} +9 -9
  42. package/dist/tool-ZCSGJ2ZF.js.map +1 -0
  43. package/dist/wiki-IDLRJ6WL.js +2 -0
  44. package/dist/wiki-enrich-XWLDJAZI.js +2 -0
  45. package/package.json +1 -1
  46. package/dist/chunk-AFRHKA7B.js +0 -2
  47. package/dist/chunk-AFRHKA7B.js.map +0 -1
  48. package/dist/chunk-D7B35QCZ.js.map +0 -1
  49. package/dist/chunk-FR4DTMCA.js +0 -42
  50. package/dist/chunk-FR4DTMCA.js.map +0 -1
  51. package/dist/chunk-HPRLRD4P.js +0 -6
  52. package/dist/chunk-HPRLRD4P.js.map +0 -1
  53. package/dist/chunk-LIY5CHUV.js +0 -4
  54. package/dist/chunk-LIY5CHUV.js.map +0 -1
  55. package/dist/chunk-RMXG5GNW.js +0 -4
  56. package/dist/chunk-RMXG5GNW.js.map +0 -1
  57. package/dist/chunk-SBFMNAJG.js.map +0 -1
  58. package/dist/chunk-YR6GDF4W.js.map +0 -1
  59. package/dist/decision-approvals-NJS2ARAF.js +0 -2
  60. package/dist/hub-PPQGFC35.js +0 -2
  61. package/dist/program-GXEVAQRW.js.map +0 -1
  62. package/dist/timers-KK7GF77Y.js +0 -2
  63. package/dist/tool-2VRNH43W.js.map +0 -1
  64. package/dist/wiki-FP4JMCYP.js +0 -2
  65. package/dist/wiki-enrich-3SPIVYSG.js +0 -2
  66. /package/dist/{agent-KUCECPSZ.js.map → agent-KOKQSRAH.js.map} +0 -0
  67. /package/dist/{chunk-SPXXLPAS.js.map → chunk-4DCQIHWU.js.map} +0 -0
  68. /package/dist/{chunk-SMZQLUJH.js.map → chunk-4ZD2C76P.js.map} +0 -0
  69. /package/dist/{chunk-3327JD6L.js.map → chunk-Q7Y5VQGX.js.map} +0 -0
  70. /package/dist/{decision-approvals-NJS2ARAF.js.map → decision-approvals-SWZ4RWFI.js.map} +0 -0
  71. /package/dist/{doctor-TK7LVXJ6.js.map → doctor-GP2KVKWE.js.map} +0 -0
  72. /package/dist/{hub-PPQGFC35.js.map → hub-V2AGLA7T.js.map} +0 -0
  73. /package/dist/{query-runs-AENEZOM6.js.map → query-runs-2F6KHFBZ.js.map} +0 -0
  74. /package/dist/{registry-D727ZQUP.js.map → registry-KRU6AWVW.js.map} +0 -0
  75. /package/dist/{timers-KK7GF77Y.js.map → timers-LAT4ZVXJ.js.map} +0 -0
  76. /package/dist/{wiki-FP4JMCYP.js.map → wiki-IDLRJ6WL.js.map} +0 -0
  77. /package/dist/{wiki-enrich-3SPIVYSG.js.map → wiki-enrich-XWLDJAZI.js.map} +0 -0
@@ -0,0 +1,6 @@
1
+ import{appendFileSync as p,readFileSync as f,renameSync as b,statSync as S,writeFileSync as R}from"fs";var _="_query-runs.jsonl",Q=1e6;function y(r){return r==="error"||r==="no-catalog"}function h(r,s,n){p(r,`${JSON.stringify(s)}
2
+ `),S(r).size>n&&M(r,Math.floor(n/2))}function w(r,s,n=Q){try{h(r,s,n)}catch{}}function M(r,s){let n=f(r,"utf-8").split(`
3
+ `).filter(Boolean),u=[],a=0;for(let e=n.length-1;e>=0&&(a+=Buffer.byteLength(n[e])+1,!(a>s));e--)u.push(n[e]);let i=`${r}.${process.pid}.tmp`;R(i,u.reverse().map(e=>`${e}
4
+ `).join("")),b(i,r)}async function N(r,s,n,u){let a=Date.now(),i=(e,c)=>w(r,{at:new Date().toISOString(),agent:s,status:e,method:c,source:n,wallMs:Date.now()-a});try{let e=await u();return i(e.status,e.method),e}catch(e){throw i("error"),e}}function P(r,s){let n=r.split(`
5
+ `).filter(Boolean).flatMap(t=>{try{let o=JSON.parse(t);return o&&typeof o.status=="string"&&typeof o.at=="string"?[o]:[]}catch{return[]}}).filter(t=>!s||t.at>=s),u={},a={},i={},e={},c=(t,o,d)=>{let g=t[o]??={total:0,failed:0};g.total++,d&&g.failed++};for(let t of n){c(i,typeof t.agent=="string"?t.agent:"",y(t.status)),c(e,t.at.slice(0,10),y(t.status)),u[t.status]=(u[t.status]??0)+1;let o=t.source??"cli";a[o]=(a[o]??0)+1}let l=n.filter(t=>t.status!=="no-catalog").map(t=>Number(t.wallMs)||0).sort((t,o)=>t-o),m=t=>l.length?l[Math.min(l.length-1,Math.floor(t*l.length))]:0;return{total:n.length,failed:n.filter(t=>y(t.status)).length,byStatus:u,bySource:a,byAgent:i,byDay:e,wallMsP50:m(.5),wallMsP95:m(.95)}}export{_ as a,Q as b,y as c,h as d,w as e,N as f,P as g};
6
+ //# sourceMappingURL=chunk-Z5CMA4JN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/wiki/query-runs.ts"],"sourcesContent":["/**\n * `wiki query` outcomes, one line per query in `_query-runs.jsonl` (#603).\n *\n * A failed query used to print plain text and exit 0, so nothing counted\n * it. Each query now appends its status and timing here, and\n * `wiki query-runs` counts them. No question, answer or error text goes\n * in the file.\n */\nimport { appendFileSync, readFileSync, renameSync, statSync, writeFileSync } from \"fs\"\nimport type { AgenticQueryResult } from \"./query\"\n\nexport const QUERY_RUNS_FILE = \"_query-runs.jsonl\"\n\n/** Past this size the file is cut to its newest half, so it never grows without a limit. */\nexport const QUERY_RUNS_MAX_BYTES = 1_000_000\n\nexport type QueryStatus = AgenticQueryResult[\"status\"]\n\n/** Where the query came from: the `wiki query` command or the `agentx_wiki_query` tool. */\nexport type QuerySource = \"cli\" | \"tool\"\n\nexport interface QueryRunRecord {\n at: string\n agent: string\n status: QueryStatus\n method?: string\n /** Missing on lines written before the tool was counted; those came from the CLI. */\n source?: QuerySource\n wallMs: number\n}\n\n/** Statuses that mean the query could not run, not that the wiki had no answer. */\nexport function queryFailed(status: QueryStatus): boolean {\n return status === \"error\" || status === \"no-catalog\"\n}\n\n/** Append one JSON line; past `maxBytes` the file is cut to its newest half. Throws on a write error. */\nexport function appendCappedLine(file: string, record: unknown, maxBytes: number): void {\n appendFileSync(file, `${JSON.stringify(record)}\\n`)\n if (statSync(file).size > maxBytes) trimToNewest(file, Math.floor(maxBytes / 2))\n}\n\n/** Append one record. Never throws: logging must not fail a query. */\nexport function recordQueryRun(file: string, record: QueryRunRecord, maxBytes = QUERY_RUNS_MAX_BYTES): void {\n try {\n appendCappedLine(file, record, maxBytes)\n } catch {\n // best-effort\n }\n}\n\n/** Keep the newest whole lines that fit in `bytes`. Written to a temp file and renamed, so a reader never sees half a file. */\nfunction trimToNewest(file: string, bytes: number): void {\n const lines = readFileSync(file, \"utf-8\").split(\"\\n\").filter(Boolean)\n const kept: string[] = []\n let size = 0\n for (let i = lines.length - 1; i >= 0; i--) {\n size += Buffer.byteLength(lines[i]) + 1\n if (size > bytes) break\n kept.push(lines[i])\n }\n const tmp = `${file}.${process.pid}.tmp`\n writeFileSync(tmp, kept.reverse().map((l) => `${l}\\n`).join(\"\"))\n renameSync(tmp, file)\n}\n\n/**\n * Run one query and record how it ended. A query that throws is recorded\n * as `error` and the error is thrown on, so no query goes uncounted.\n */\nexport async function timedQuery<T extends { status: QueryStatus; method?: string }>(\n file: string,\n agent: string,\n source: QuerySource,\n run: () => Promise<T>,\n): Promise<T> {\n const start = Date.now()\n const record = (status: QueryStatus, method?: string) =>\n recordQueryRun(file, { at: new Date().toISOString(), agent, status, method, source, wallMs: Date.now() - start })\n try {\n const result = await run()\n record(result.status, result.method)\n return result\n } catch (e) {\n record(\"error\")\n throw e\n }\n}\n\nexport interface QueryRunSummary {\n total: number\n failed: number\n byStatus: Record<string, number>\n bySource: Record<string, number>\n /** Queries and failures per asking agent (\"\" when none was known). */\n byAgent: Record<string, { total: number; failed: number }>\n /** Queries and failures per UTC day (YYYY-MM-DD). */\n byDay: Record<string, { total: number; failed: number }>\n /** Over queries that ran: `no-catalog` lines are left out. */\n wallMsP50: number\n wallMsP95: number\n}\n\n/** Count queries by status, on or after `since` (an ISO date or time) when given. */\nexport function summariseQueryRuns(text: string, since?: string): QueryRunSummary {\n const records: QueryRunRecord[] = text.split(\"\\n\").filter(Boolean).flatMap((l) => {\n try {\n const r = JSON.parse(l)\n return r && typeof r.status === \"string\" && typeof r.at === \"string\" ? [r] : []\n } catch { return [] }\n }).filter((r) => !since || r.at >= since)\n const byStatus: Record<string, number> = {}\n const bySource: Record<string, number> = {}\n const byAgent: Record<string, { total: number; failed: number }> = {}\n const byDay: Record<string, { total: number; failed: number }> = {}\n const tally = (map: Record<string, { total: number; failed: number }>, key: string, failed: boolean) => {\n const row = (map[key] ??= { total: 0, failed: 0 })\n row.total++\n if (failed) row.failed++\n }\n for (const r of records) {\n tally(byAgent, typeof r.agent === \"string\" ? r.agent : \"\", queryFailed(r.status))\n tally(byDay, r.at.slice(0, 10), queryFailed(r.status))\n byStatus[r.status] = (byStatus[r.status] ?? 0) + 1\n const source = r.source ?? \"cli\"\n bySource[source] = (bySource[source] ?? 0) + 1\n }\n // A `no-catalog` line never ran a query (the tool writes it with wallMs 0), so it would only pull the times down.\n const ms = records.filter((r) => r.status !== \"no-catalog\").map((r) => Number(r.wallMs) || 0).sort((a, b) => a - b)\n const pick = (q: number) => (ms.length ? ms[Math.min(ms.length - 1, Math.floor(q * ms.length))] : 0)\n return {\n total: records.length,\n failed: records.filter((r) => queryFailed(r.status)).length,\n byStatus,\n bySource,\n byAgent,\n byDay,\n wallMsP50: pick(0.5),\n wallMsP95: pick(0.95),\n }\n}\n"],"mappings":"AAQA,OAAS,kBAAAA,EAAgB,gBAAAC,EAAc,cAAAC,EAAY,YAAAC,EAAU,iBAAAC,MAAqB,KAG3E,IAAMC,EAAkB,oBAGlBC,EAAuB,IAkB7B,SAASC,EAAYC,EAA8B,CACxD,OAAOA,IAAW,SAAWA,IAAW,YAC1C,CAGO,SAASC,EAAiBC,EAAcC,EAAiBC,EAAwB,CACtFZ,EAAeU,EAAM,GAAG,KAAK,UAAUC,CAAM;AAAA,CAAK,EAC9CR,EAASO,CAAI,EAAE,KAAOE,GAAUC,EAAaH,EAAM,KAAK,MAAME,EAAW,CAAC,CAAC,CACjF,CAGO,SAASE,EAAeJ,EAAcC,EAAwBC,EAAWN,EAA4B,CAC1G,GAAI,CACFG,EAAiBC,EAAMC,EAAQC,CAAQ,CACzC,MAAE,CAEF,CACF,CAGA,SAASC,EAAaH,EAAcK,EAAqB,CACvD,IAAMC,EAAQf,EAAaS,EAAM,OAAO,EAAE,MAAM;AAAA,CAAI,EAAE,OAAO,OAAO,EAC9DO,EAAiB,CAAC,EACpBC,EAAO,EACX,QAASC,EAAIH,EAAM,OAAS,EAAGG,GAAK,IAClCD,GAAQ,OAAO,WAAWF,EAAMG,CAAC,CAAC,EAAI,EAClC,EAAAD,EAAOH,IAF0BI,IAGrCF,EAAK,KAAKD,EAAMG,CAAC,CAAC,EAEpB,IAAMC,EAAM,GAAGV,KAAQ,QAAQ,UAC/BN,EAAcgB,EAAKH,EAAK,QAAQ,EAAE,IAAKI,GAAM,GAAGA;AAAA,CAAK,EAAE,KAAK,EAAE,CAAC,EAC/DnB,EAAWkB,EAAKV,CAAI,CACtB,CAMA,eAAsBY,EACpBZ,EACAa,EACAC,EACAC,EACY,CACZ,IAAMC,EAAQ,KAAK,IAAI,EACjBf,EAAS,CAACH,EAAqBmB,IACnCb,EAAeJ,EAAM,CAAE,GAAI,IAAI,KAAK,EAAE,YAAY,EAAG,MAAAa,EAAO,OAAAf,EAAQ,OAAAmB,EAAQ,OAAAH,EAAQ,OAAQ,KAAK,IAAI,EAAIE,CAAM,CAAC,EAClH,GAAI,CACF,IAAME,EAAS,MAAMH,EAAI,EACzB,OAAAd,EAAOiB,EAAO,OAAQA,EAAO,MAAM,EAC5BA,CACT,OAAS,EAAP,CACA,MAAAjB,EAAO,OAAO,EACR,CACR,CACF,CAiBO,SAASkB,EAAmBC,EAAcC,EAAiC,CAChF,IAAMC,EAA4BF,EAAK,MAAM;AAAA,CAAI,EAAE,OAAO,OAAO,EAAE,QAAST,GAAM,CAChF,GAAI,CACF,IAAMY,EAAI,KAAK,MAAMZ,CAAC,EACtB,OAAOY,GAAK,OAAOA,EAAE,QAAW,UAAY,OAAOA,EAAE,IAAO,SAAW,CAACA,CAAC,EAAI,CAAC,CAChF,MAAE,CAAQ,MAAO,CAAC,CAAE,CACtB,CAAC,EAAE,OAAQA,GAAM,CAACF,GAASE,EAAE,IAAMF,CAAK,EAClCG,EAAmC,CAAC,EACpCC,EAAmC,CAAC,EACpCC,EAA6D,CAAC,EAC9DC,EAA2D,CAAC,EAC5DC,EAAQ,CAACC,EAAwDC,EAAaC,IAAoB,CACtG,IAAMC,EAAOH,EAAIC,CAAG,IAAM,CAAE,MAAO,EAAG,OAAQ,CAAE,EAChDE,EAAI,QACAD,GAAQC,EAAI,QAClB,EACA,QAAWT,KAAKD,EAAS,CACvBM,EAAMF,EAAS,OAAOH,EAAE,OAAU,SAAWA,EAAE,MAAQ,GAAI1B,EAAY0B,EAAE,MAAM,CAAC,EAChFK,EAAMD,EAAOJ,EAAE,GAAG,MAAM,EAAG,EAAE,EAAG1B,EAAY0B,EAAE,MAAM,CAAC,EACrDC,EAASD,EAAE,MAAM,GAAKC,EAASD,EAAE,MAAM,GAAK,GAAK,EACjD,IAAMT,EAASS,EAAE,QAAU,MAC3BE,EAASX,CAAM,GAAKW,EAASX,CAAM,GAAK,GAAK,EAG/C,IAAMmB,EAAKX,EAAQ,OAAQC,GAAMA,EAAE,SAAW,YAAY,EAAE,IAAKA,GAAM,OAAOA,EAAE,MAAM,GAAK,CAAC,EAAE,KAAK,CAACW,EAAGC,IAAMD,EAAIC,CAAC,EAC5GC,EAAQC,GAAeJ,EAAG,OAASA,EAAG,KAAK,IAAIA,EAAG,OAAS,EAAG,KAAK,MAAMI,EAAIJ,EAAG,MAAM,CAAC,CAAC,EAAI,EAClG,MAAO,CACL,MAAOX,EAAQ,OACf,OAAQA,EAAQ,OAAQC,GAAM1B,EAAY0B,EAAE,MAAM,CAAC,EAAE,OACrD,SAAAC,EACA,SAAAC,EACA,QAAAC,EACA,MAAAC,EACA,UAAWS,EAAK,EAAG,EACnB,UAAWA,EAAK,GAAI,CACtB,CACF","names":["appendFileSync","readFileSync","renameSync","statSync","writeFileSync","QUERY_RUNS_FILE","QUERY_RUNS_MAX_BYTES","queryFailed","status","appendCappedLine","file","record","maxBytes","trimToNewest","recordQueryRun","bytes","lines","kept","size","i","tmp","l","timedQuery","agent","source","run","start","method","result","summariseQueryRuns","text","since","records","r","byStatus","bySource","byAgent","byDay","tally","map","key","failed","row","ms","a","b","pick","q"]}
package/dist/cli.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{b as o}from"./chunk-OSH2PEBH.js";import"./chunk-QIJLFPWE.js";var e=o(process.versions.node);e&&(console.error(e),process.exit(1));var{buildProgram:s}=await import("./program-GXEVAQRW.js"),{installCliSignalExit:r}=await import("./signal-exit-C5EUGHKI.js"),{applyConnectAttemptTimeout:i,configPathFromArgv:a,readConnectAttemptTimeout:n}=await import("./net-family-X2P3OVDP.js");r();i(n(process.cwd(),a(process.argv.slice(2))));var t=await s();process.argv.slice(2).length===0?t.outputHelp():t.parse();
2
+ import{b as o}from"./chunk-OSH2PEBH.js";import"./chunk-QIJLFPWE.js";var e=o(process.versions.node);e&&(console.error(e),process.exit(1));var{buildProgram:s}=await import("./program-WSGVQTFM.js"),{installCliSignalExit:r}=await import("./signal-exit-C5EUGHKI.js"),{applyConnectAttemptTimeout:i,configPathFromArgv:a,readConnectAttemptTimeout:n}=await import("./net-family-X2P3OVDP.js");r();i(n(process.cwd(),a(process.argv.slice(2))));var t=await s();process.argv.slice(2).length===0?t.outputHelp():t.parse();
3
3
  //# sourceMappingURL=cli.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b,c,d,e,f,g,h,i,j}from"./chunk-HVMUYEQP.js";import"./chunk-QIJLFPWE.js";export{h as approvalRefusal,a as approvalsFile,i as approveDecision,e as approvedDecisionsOnly,b as decisionHash,g as decisionPagesFor,d as decisionState,f as decisionsForBlock,c as readApprovals,j as revokeDecision};
2
+ //# sourceMappingURL=decision-approvals-SWZ4RWFI.js.map
@@ -1,2 +1,2 @@
1
- import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j}from"./chunk-SMZQLUJH.js";import"./chunk-WMZ4TGMR.js";import"./chunk-2YDG5CSS.js";import"./chunk-3GWIV2YO.js";import"./chunk-IMLAPB7G.js";import"./chunk-QPABR72X.js";import"./chunk-KP7KDLZ2.js";import"./chunk-OQQTV3OF.js";import"./chunk-4NZ4T3TQ.js";import"./chunk-LY4G7PCW.js";import"./chunk-7IW25T4K.js";import"./chunk-Q3A5P373.js";import"./chunk-JLBRNYKY.js";import"./chunk-BYEL7KKR.js";import"./chunk-QUFIUXMQ.js";import"./chunk-OSH2PEBH.js";import"./chunk-7I7IEX4S.js";import"./chunk-KAM4ZWRE.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-YSCT6DPR.js";import"./chunk-VQRY4IDI.js";import"./chunk-QIJLFPWE.js";export{j as daemonVoiceCheck,b as doctor,i as mcpHeaderEnvChecks,g as meshPeerTokenChecks,h as meshTokenChecksFromConfig,a as runDoctorChecks,e as runMirrorChecks,d as runNativeChecks,c as runNotificationChecks,f as runReminderChecks};
2
- //# sourceMappingURL=doctor-TK7LVXJ6.js.map
1
+ import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j}from"./chunk-4ZD2C76P.js";import"./chunk-WMZ4TGMR.js";import"./chunk-2YDG5CSS.js";import"./chunk-OQNJIIR2.js";import"./chunk-IMLAPB7G.js";import"./chunk-QPABR72X.js";import"./chunk-KP7KDLZ2.js";import"./chunk-OQQTV3OF.js";import"./chunk-4NZ4T3TQ.js";import"./chunk-LY4G7PCW.js";import"./chunk-7IW25T4K.js";import"./chunk-Q3A5P373.js";import"./chunk-JLBRNYKY.js";import"./chunk-BYEL7KKR.js";import"./chunk-QUFIUXMQ.js";import"./chunk-OSH2PEBH.js";import"./chunk-7I7IEX4S.js";import"./chunk-KAM4ZWRE.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-YSCT6DPR.js";import"./chunk-VQRY4IDI.js";import"./chunk-QIJLFPWE.js";export{j as daemonVoiceCheck,b as doctor,i as mcpHeaderEnvChecks,g as meshPeerTokenChecks,h as meshTokenChecksFromConfig,a as runDoctorChecks,e as runMirrorChecks,d as runNativeChecks,c as runNotificationChecks,f as runReminderChecks};
2
+ //# sourceMappingURL=doctor-GP2KVKWE.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b}from"./chunk-4BYJN2A3.js";import"./chunk-ZRBTLW2B.js";import"./chunk-Z7632XS3.js";import"./chunk-WPNRDEHW.js";import"./chunk-OWNQ2FD4.js";import"./chunk-AHWWJ7AF.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-MIUITI47.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-KAM4ZWRE.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-YSCT6DPR.js";import"./chunk-VQRY4IDI.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as WikiHub,a as existingWikiDir};
2
+ //# sourceMappingURL=hub-V2AGLA7T.js.map
package/dist/index.d.ts CHANGED
@@ -1207,6 +1207,13 @@ declare class HookRegistry {
1207
1207
  * Priority follows the same rule as register(): lower runs first.
1208
1208
  */
1209
1209
  registerHandler(event: HookEvent, name: string, handler: HookHandler, priority?: number): void;
1210
+ /**
1211
+ * Remove the hooks loaded from disk and keep the in-process handlers.
1212
+ * The config reload uses this before loading the disk hooks again: the
1213
+ * workflow engine registers its handlers once, at start, so clearing them
1214
+ * would stop every workflow trigger until the next restart.
1215
+ */
1216
+ clearLoaded(): void;
1210
1217
  /**
1211
1218
  * Check if any hooks are registered for an event.
1212
1219
  */
@@ -15561,6 +15568,11 @@ declare class AgentXDaemon {
15561
15568
  private workspaceFor;
15562
15569
  /** Agent-memory HTTP surface — see memory-api.ts. */
15563
15570
  private handleMemoryApi;
15571
+ /** A note or label change seen by this node's GitLab channel: wake the
15572
+ * timer waits that watch it here, and tell every healthy peer, since the
15573
+ * run may live on another node. A peer applies it locally and never
15574
+ * passes it on. */
15575
+ private wakeWorkflows;
15564
15576
  private handleWorkflowEvent;
15565
15577
  /** POSTs to the mesh peer hosting the phone app: /channel/send for
15566
15578
  * PushRelayAdapter, /push/app for phones paired here (#711). */
@@ -18273,14 +18285,43 @@ declare const pausedAtSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
18273
18285
  nodeId: z.ZodString;
18274
18286
  /** ISO-8601 instant when the timer should fire. */
18275
18287
  fireAt: z.ZodString;
18288
+ /** The node's `wake` config, rendered at this pause (src/workflows/wake.ts). */
18289
+ wake: z.ZodOptional<z.ZodObject<{
18290
+ on: z.ZodArray<z.ZodEnum<["note", "label"]>, "many">;
18291
+ refs: z.ZodArray<z.ZodString, "many">;
18292
+ minGapSec: z.ZodNumber;
18293
+ selfLabels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
18294
+ }, "strip", z.ZodTypeAny, {
18295
+ on: ("label" | "note")[];
18296
+ refs: string[];
18297
+ minGapSec: number;
18298
+ selfLabels?: string[] | undefined;
18299
+ }, {
18300
+ on: ("label" | "note")[];
18301
+ refs: string[];
18302
+ minGapSec: number;
18303
+ selfLabels?: string[] | undefined;
18304
+ }>>;
18276
18305
  }, "strip", z.ZodTypeAny, {
18277
18306
  kind: "timerWait";
18278
18307
  nodeId: string;
18279
18308
  fireAt: string;
18309
+ wake?: {
18310
+ on: ("label" | "note")[];
18311
+ refs: string[];
18312
+ minGapSec: number;
18313
+ selfLabels?: string[] | undefined;
18314
+ } | undefined;
18280
18315
  }, {
18281
18316
  kind: "timerWait";
18282
18317
  nodeId: string;
18283
18318
  fireAt: string;
18319
+ wake?: {
18320
+ on: ("label" | "note")[];
18321
+ refs: string[];
18322
+ minGapSec: number;
18323
+ selfLabels?: string[] | undefined;
18324
+ } | undefined;
18284
18325
  }>, z.ZodObject<{
18285
18326
  kind: z.ZodLiteral<"ownerDecision">;
18286
18327
  nodeId: z.ZodString;
@@ -18553,6 +18594,8 @@ declare const runMetaSchema: z.ZodObject<{
18553
18594
  /** The run this one continues (#870): a wrapped task that was stopped,
18554
18595
  * then resumed, gets a new run that names the one the stop closed. */
18555
18596
  continues: z.ZodOptional<z.ZodString>;
18597
+ /** When a work-item event last moved this run's timer to now. */
18598
+ lastWakeAt: z.ZodOptional<z.ZodString>;
18556
18599
  }, "strip", z.ZodTypeAny, {
18557
18600
  followUp: boolean;
18558
18601
  tags: string[];
@@ -18591,6 +18634,7 @@ declare const runMetaSchema: z.ZodObject<{
18591
18634
  agentId: string;
18592
18635
  taskId?: string | undefined;
18593
18636
  } | undefined;
18637
+ lastWakeAt?: string | undefined;
18594
18638
  }, {
18595
18639
  followUp?: boolean | undefined;
18596
18640
  tags?: string[] | undefined;
@@ -18629,6 +18673,7 @@ declare const runMetaSchema: z.ZodObject<{
18629
18673
  agentId: string;
18630
18674
  taskId?: string | undefined;
18631
18675
  } | undefined;
18676
+ lastWakeAt?: string | undefined;
18632
18677
  }>;
18633
18678
  type RunMeta = z.infer<typeof runMetaSchema>;
18634
18679
  declare const workflowRunSchema: z.ZodObject<{
@@ -18693,14 +18738,43 @@ declare const workflowRunSchema: z.ZodObject<{
18693
18738
  nodeId: z.ZodString;
18694
18739
  /** ISO-8601 instant when the timer should fire. */
18695
18740
  fireAt: z.ZodString;
18741
+ /** The node's `wake` config, rendered at this pause (src/workflows/wake.ts). */
18742
+ wake: z.ZodOptional<z.ZodObject<{
18743
+ on: z.ZodArray<z.ZodEnum<["note", "label"]>, "many">;
18744
+ refs: z.ZodArray<z.ZodString, "many">;
18745
+ minGapSec: z.ZodNumber;
18746
+ selfLabels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
18747
+ }, "strip", z.ZodTypeAny, {
18748
+ on: ("label" | "note")[];
18749
+ refs: string[];
18750
+ minGapSec: number;
18751
+ selfLabels?: string[] | undefined;
18752
+ }, {
18753
+ on: ("label" | "note")[];
18754
+ refs: string[];
18755
+ minGapSec: number;
18756
+ selfLabels?: string[] | undefined;
18757
+ }>>;
18696
18758
  }, "strip", z.ZodTypeAny, {
18697
18759
  kind: "timerWait";
18698
18760
  nodeId: string;
18699
18761
  fireAt: string;
18762
+ wake?: {
18763
+ on: ("label" | "note")[];
18764
+ refs: string[];
18765
+ minGapSec: number;
18766
+ selfLabels?: string[] | undefined;
18767
+ } | undefined;
18700
18768
  }, {
18701
18769
  kind: "timerWait";
18702
18770
  nodeId: string;
18703
18771
  fireAt: string;
18772
+ wake?: {
18773
+ on: ("label" | "note")[];
18774
+ refs: string[];
18775
+ minGapSec: number;
18776
+ selfLabels?: string[] | undefined;
18777
+ } | undefined;
18704
18778
  }>, z.ZodObject<{
18705
18779
  kind: z.ZodLiteral<"ownerDecision">;
18706
18780
  nodeId: z.ZodString;
@@ -19049,6 +19123,8 @@ declare const workflowRunSchema: z.ZodObject<{
19049
19123
  /** The run this one continues (#870): a wrapped task that was stopped,
19050
19124
  * then resumed, gets a new run that names the one the stop closed. */
19051
19125
  continues: z.ZodOptional<z.ZodString>;
19126
+ /** When a work-item event last moved this run's timer to now. */
19127
+ lastWakeAt: z.ZodOptional<z.ZodString>;
19052
19128
  }, "strip", z.ZodTypeAny, {
19053
19129
  followUp: boolean;
19054
19130
  tags: string[];
@@ -19087,6 +19163,7 @@ declare const workflowRunSchema: z.ZodObject<{
19087
19163
  agentId: string;
19088
19164
  taskId?: string | undefined;
19089
19165
  } | undefined;
19166
+ lastWakeAt?: string | undefined;
19090
19167
  }, {
19091
19168
  followUp?: boolean | undefined;
19092
19169
  tags?: string[] | undefined;
@@ -19125,6 +19202,7 @@ declare const workflowRunSchema: z.ZodObject<{
19125
19202
  agentId: string;
19126
19203
  taskId?: string | undefined;
19127
19204
  } | undefined;
19205
+ lastWakeAt?: string | undefined;
19128
19206
  }>>;
19129
19207
  createdAt: z.ZodString;
19130
19208
  updatedAt: z.ZodString;
@@ -19196,6 +19274,7 @@ declare const workflowRunSchema: z.ZodObject<{
19196
19274
  agentId: string;
19197
19275
  taskId?: string | undefined;
19198
19276
  } | undefined;
19277
+ lastWakeAt?: string | undefined;
19199
19278
  } | undefined;
19200
19279
  pausedAt?: {
19201
19280
  kind: "checkpoint";
@@ -19217,6 +19296,12 @@ declare const workflowRunSchema: z.ZodObject<{
19217
19296
  kind: "timerWait";
19218
19297
  nodeId: string;
19219
19298
  fireAt: string;
19299
+ wake?: {
19300
+ on: ("label" | "note")[];
19301
+ refs: string[];
19302
+ minGapSec: number;
19303
+ selfLabels?: string[] | undefined;
19304
+ } | undefined;
19220
19305
  } | {
19221
19306
  kind: "ownerDecision";
19222
19307
  cardId: string;
@@ -19321,6 +19406,7 @@ declare const workflowRunSchema: z.ZodObject<{
19321
19406
  agentId: string;
19322
19407
  taskId?: string | undefined;
19323
19408
  } | undefined;
19409
+ lastWakeAt?: string | undefined;
19324
19410
  } | undefined;
19325
19411
  pausedAt?: {
19326
19412
  kind: "checkpoint";
@@ -19342,6 +19428,12 @@ declare const workflowRunSchema: z.ZodObject<{
19342
19428
  kind: "timerWait";
19343
19429
  nodeId: string;
19344
19430
  fireAt: string;
19431
+ wake?: {
19432
+ on: ("label" | "note")[];
19433
+ refs: string[];
19434
+ minGapSec: number;
19435
+ selfLabels?: string[] | undefined;
19436
+ } | undefined;
19345
19437
  } | {
19346
19438
  kind: "ownerDecision";
19347
19439
  cardId: string;
@@ -19465,6 +19557,7 @@ declare class RunStore {
19465
19557
  patch(runId: string, patch: {
19466
19558
  meta?: Partial<RunMeta>;
19467
19559
  pending?: string[];
19560
+ pausedAt?: PausedAt;
19468
19561
  }): WorkflowRun | null;
19469
19562
  /** Remove a run and its entity index entry, as if it never ran (#858: a
19470
19563
  * plain question exempted from workflows.required). */
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{Oa as Tt,Pa as Mt,a as St,b as kt,c as vt,d as xt,e as $t,f as Ct,g as Pt,h as bt}from"./chunk-D7B35QCZ.js";import"./chunk-YR6GDF4W.js";import"./chunk-GTJIKXDB.js";import"./chunk-B7HDWFKR.js";import"./chunk-3GWIV2YO.js";import"./chunk-IMLAPB7G.js";import"./chunk-ZVP6GB4G.js";import"./chunk-PPUN7YHA.js";import"./chunk-VZLIBDLH.js";import"./chunk-EKJG63EJ.js";import"./chunk-PSYHAO57.js";import"./chunk-3Q6MRG3P.js";import"./chunk-2VDO2HEK.js";import"./chunk-2P5NP4H6.js";import"./chunk-B4KQC3DG.js";import"./chunk-LQE73AZR.js";import"./chunk-2D3RYIDU.js";import"./chunk-ACPGDZOV.js";import"./chunk-MRIVENBY.js";import"./chunk-6UTOBSEA.js";import"./chunk-A5GYG56I.js";import"./chunk-JEBU5JUM.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-UKUH662W.js";import"./chunk-JWDJMFU6.js";import"./chunk-RX5O5637.js";import"./chunk-5ELIX7BQ.js";import"./chunk-X7UQY7CH.js";import"./chunk-35UGFFHA.js";import"./chunk-QPABR72X.js";import"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import{Ka as yt,r as lt,s as ct,t as dt,u as mt,v as pt}from"./chunk-SBFMNAJG.js";import"./chunk-FR4DTMCA.js";import"./chunk-MEFPXHQJ.js";import"./chunk-7AB3QUGH.js";import{a as L}from"./chunk-BAXGL6TY.js";import{A as D,B as z,C as V,a as ye,b as we,c as Se,d as Ae,e as Ie,f as Oe,g as Ne,h as He,i as je,j as Ue,k as _e,l as I,m as q,n as Be,o as qe,p as Ye,q as O,r as ze,s as Ve,t as Xe,u as x,v as Y,w as Qe,x as Ze,y as et,z as wt}from"./chunk-UNVZUWOY.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-6TTGRTDO.js";import"./chunk-H4DWZIU7.js";import"./chunk-VE3SSOQX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-IH65GDJR.js";import{u as ut}from"./chunk-CAH6TNC6.js";import"./chunk-N476XZD3.js";import"./chunk-3UOTLMXD.js";import"./chunk-XVV7ZZ77.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-KWWBDLE6.js";import"./chunk-LIY5CHUV.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-SZDACK6O.js";import"./chunk-VWTBHLMX.js";import"./chunk-XHON5WB5.js";import"./chunk-JTFCU5LH.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-BE64IJWM.js";import"./chunk-5ONH4ITT.js";import"./chunk-JRAG37V5.js";import"./chunk-ILEC3IAV.js";import"./chunk-MYVHVJWZ.js";import"./chunk-M4H2RYP4.js";import"./chunk-OQQTV3OF.js";import"./chunk-4NZ4T3TQ.js";import"./chunk-LY4G7PCW.js";import"./chunk-DPG6VHPX.js";import"./chunk-BERWTVG2.js";import"./chunk-A7JSRDJL.js";import"./chunk-HPRLRD4P.js";import"./chunk-RMXG5GNW.js";import{a as ht}from"./chunk-ZRBTLW2B.js";import{f as gt,g as ft}from"./chunk-Z7632XS3.js";import"./chunk-WPNRDEHW.js";import"./chunk-OWNQ2FD4.js";import"./chunk-AHWWJ7AF.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-JKMFKNGS.js";import{j as it,k as rt,l as at}from"./chunk-MIUITI47.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-7IW25T4K.js";import"./chunk-Q3A5P373.js";import"./chunk-JLBRNYKY.js";import"./chunk-BYEL7KKR.js";import"./chunk-QUFIUXMQ.js";import{a as ke,b as ve,c as xe,d as $e,e as Ce,f as Pe,g as be,h as Te,i as Me,j as Re,l as Ee,m as Ge,o as T,p as W}from"./chunk-DCIYOPJF.js";import{a as m,b as G}from"./chunk-7I7IEX4S.js";import{b as Fe,c as Le,d as A,e as De}from"./chunk-JHCI6XCJ.js";import{a as Ke,b as Je,e as We}from"./chunk-DSYKYZMT.js";import{Rb as tt,Tb as st,Wb as ot,bc as nt}from"./chunk-KAM4ZWRE.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-YSCT6DPR.js";import"./chunk-VQRY4IDI.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";W();G();import{execa as Rt}from"execa";import{existsSync as se,promises as X}from"fs";import S from"path";import ie from"node-fetch";async function Et(o,e){let t=o.split("/");if(t.length<2)throw new Error(`Invalid skill package ID: ${o}. Expected format: owner/repo`);let s=t[0],i=t[1],n=t[2];try{let a=n?`${s}/${i}/${n}`:`${s}/${i}`;await Rt("npx",["-y","skills","add",a],{cwd:e,stdio:"pipe"}),m.success(`Installed skill package: ${o}`);let r=S.resolve(e,".skills",`${s}_${i}`);if(se(r))return await ne(r,o);let d=S.resolve(e,".skills");return se(d)?await ne(d,o):[]}catch{return m.info(`Fetching skills directly from GitHub: ${s}/${i}`),await Gt(s,i,n,e)}}async function Gt(o,e,t,s){let i=[];try{let n=`https://api.github.com/repos/${o}/${e}/git/trees/main?recursive=1`,a=await ie(n);if(!a.ok)throw new Error(`GitHub API error: ${a.status}`);let d=(await a.json()).tree.filter(p=>p.type==="blob"&&p.path.endsWith("SKILL.md"));if(t){let p=d.find(f=>f.path.includes(`/${t}/`)||f.path===`${t}/SKILL.md`);if(p){let f=await oe(o,e,p.path,s);f&&i.push(f)}}else for(let p of d){let f=await oe(o,e,p.path,s);f&&i.push(f)}}catch(n){m.error(`Failed to fetch skills from GitHub: ${n.message}`)}return i}async function oe(o,e,t,s){try{let i=`https://raw.githubusercontent.com/${o}/${e}/main/${t}`,n=await ie(i);if(!n.ok)return null;let a=await n.text(),r=A(a);if(r){r.source="remote",r.packageId=`${o}/${e}`;let d=S.dirname(t),p=S.resolve(s,".skills",`${o}_${e}`,d);await X.mkdir(p,{recursive:!0}),await X.writeFile(S.resolve(p,"SKILL.md"),a),r.path=S.resolve(p,"SKILL.md")}return r}catch{return null}}async function ne(o,e){let t=[],{default:s}=await import("fast-glob"),i=await s.glob("**/SKILL.md",{cwd:o,deep:5});for(let n of i)try{let a=S.resolve(o,n),r=await X.readFile(a,"utf8"),d=A(r);d&&(d.source="remote",d.path=a,d.packageId=e,t.push(d))}catch{}return t}async function At(o,e,t,s,i){let n=["---",`name: ${o}`,`description: ${e}`];if(s?.length){n.push("tags:");for(let a of s)n.push(` - ${a}`)}if(i?.length){n.push("globs:");for(let a of i)n.push(` - ${a}`)}return n.push("---"),`${n.join(`
1
+ import{Oa as Tt,Pa as Mt,a as St,b as kt,c as vt,d as xt,e as $t,f as Ct,g as Pt,h as bt}from"./chunk-QOGZD6Z3.js";import"./chunk-7AFXLWWW.js";import"./chunk-GTJIKXDB.js";import"./chunk-B7HDWFKR.js";import"./chunk-OQNJIIR2.js";import"./chunk-IMLAPB7G.js";import"./chunk-ZVP6GB4G.js";import"./chunk-PPUN7YHA.js";import"./chunk-VZLIBDLH.js";import"./chunk-EKJG63EJ.js";import"./chunk-PSYHAO57.js";import"./chunk-3Q6MRG3P.js";import"./chunk-2VDO2HEK.js";import"./chunk-2P5NP4H6.js";import"./chunk-B4KQC3DG.js";import"./chunk-LQE73AZR.js";import"./chunk-2D3RYIDU.js";import"./chunk-ACPGDZOV.js";import"./chunk-MRIVENBY.js";import"./chunk-6UTOBSEA.js";import"./chunk-A5GYG56I.js";import"./chunk-JEBU5JUM.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-UKUH662W.js";import"./chunk-JWDJMFU6.js";import"./chunk-RX5O5637.js";import"./chunk-5ELIX7BQ.js";import"./chunk-X7UQY7CH.js";import"./chunk-35UGFFHA.js";import"./chunk-CSC45PA7.js";import"./chunk-QPABR72X.js";import"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import{Ka as yt,r as lt,s as ct,t as dt,u as mt,v as pt}from"./chunk-JLH73NRM.js";import"./chunk-GGAEFVXL.js";import"./chunk-MEFPXHQJ.js";import"./chunk-7AB3QUGH.js";import{a as L}from"./chunk-BAXGL6TY.js";import{A as D,B as z,C as V,a as ye,b as we,c as Se,d as Ae,e as Ie,f as Oe,g as Ne,h as He,i as je,j as Ue,k as _e,l as I,m as q,n as Be,o as qe,p as Ye,q as O,r as ze,s as Ve,t as Xe,u as x,v as Y,w as Qe,x as Ze,y as et,z as wt}from"./chunk-QMICGPM6.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-6TTGRTDO.js";import"./chunk-H4DWZIU7.js";import"./chunk-VE3SSOQX.js";import"./chunk-W4YR2RO2.js";import"./chunk-7YOLZGB5.js";import"./chunk-IH65GDJR.js";import{u as ut}from"./chunk-CAH6TNC6.js";import"./chunk-N476XZD3.js";import"./chunk-3UOTLMXD.js";import"./chunk-XVV7ZZ77.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-KWWBDLE6.js";import"./chunk-HVMUYEQP.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-SZDACK6O.js";import"./chunk-VWTBHLMX.js";import"./chunk-XHON5WB5.js";import"./chunk-JTFCU5LH.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-BE64IJWM.js";import"./chunk-5ONH4ITT.js";import"./chunk-JRAG37V5.js";import"./chunk-ILEC3IAV.js";import"./chunk-MYVHVJWZ.js";import"./chunk-M4H2RYP4.js";import"./chunk-OQQTV3OF.js";import"./chunk-4NZ4T3TQ.js";import"./chunk-LY4G7PCW.js";import"./chunk-DPG6VHPX.js";import"./chunk-BERWTVG2.js";import"./chunk-A7JSRDJL.js";import"./chunk-Z5CMA4JN.js";import"./chunk-4BYJN2A3.js";import{a as ht}from"./chunk-ZRBTLW2B.js";import{f as gt,g as ft}from"./chunk-Z7632XS3.js";import"./chunk-WPNRDEHW.js";import"./chunk-OWNQ2FD4.js";import"./chunk-AHWWJ7AF.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-JKMFKNGS.js";import{j as it,k as rt,l as at}from"./chunk-MIUITI47.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-7IW25T4K.js";import"./chunk-Q3A5P373.js";import"./chunk-JLBRNYKY.js";import"./chunk-BYEL7KKR.js";import"./chunk-QUFIUXMQ.js";import{a as ke,b as ve,c as xe,d as $e,e as Ce,f as Pe,g as be,h as Te,i as Me,j as Re,l as Ee,m as Ge,o as T,p as W}from"./chunk-DCIYOPJF.js";import{a as m,b as G}from"./chunk-7I7IEX4S.js";import{b as Fe,c as Le,d as A,e as De}from"./chunk-JHCI6XCJ.js";import{a as Ke,b as Je,e as We}from"./chunk-DSYKYZMT.js";import{Rb as tt,Tb as st,Wb as ot,bc as nt}from"./chunk-KAM4ZWRE.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-YSCT6DPR.js";import"./chunk-VQRY4IDI.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";W();G();import{execa as Rt}from"execa";import{existsSync as se,promises as X}from"fs";import S from"path";import ie from"node-fetch";async function Et(o,e){let t=o.split("/");if(t.length<2)throw new Error(`Invalid skill package ID: ${o}. Expected format: owner/repo`);let s=t[0],i=t[1],n=t[2];try{let a=n?`${s}/${i}/${n}`:`${s}/${i}`;await Rt("npx",["-y","skills","add",a],{cwd:e,stdio:"pipe"}),m.success(`Installed skill package: ${o}`);let r=S.resolve(e,".skills",`${s}_${i}`);if(se(r))return await ne(r,o);let d=S.resolve(e,".skills");return se(d)?await ne(d,o):[]}catch{return m.info(`Fetching skills directly from GitHub: ${s}/${i}`),await Gt(s,i,n,e)}}async function Gt(o,e,t,s){let i=[];try{let n=`https://api.github.com/repos/${o}/${e}/git/trees/main?recursive=1`,a=await ie(n);if(!a.ok)throw new Error(`GitHub API error: ${a.status}`);let d=(await a.json()).tree.filter(p=>p.type==="blob"&&p.path.endsWith("SKILL.md"));if(t){let p=d.find(f=>f.path.includes(`/${t}/`)||f.path===`${t}/SKILL.md`);if(p){let f=await oe(o,e,p.path,s);f&&i.push(f)}}else for(let p of d){let f=await oe(o,e,p.path,s);f&&i.push(f)}}catch(n){m.error(`Failed to fetch skills from GitHub: ${n.message}`)}return i}async function oe(o,e,t,s){try{let i=`https://raw.githubusercontent.com/${o}/${e}/main/${t}`,n=await ie(i);if(!n.ok)return null;let a=await n.text(),r=A(a);if(r){r.source="remote",r.packageId=`${o}/${e}`;let d=S.dirname(t),p=S.resolve(s,".skills",`${o}_${e}`,d);await X.mkdir(p,{recursive:!0}),await X.writeFile(S.resolve(p,"SKILL.md"),a),r.path=S.resolve(p,"SKILL.md")}return r}catch{return null}}async function ne(o,e){let t=[],{default:s}=await import("fast-glob"),i=await s.glob("**/SKILL.md",{cwd:o,deep:5});for(let n of i)try{let a=S.resolve(o,n),r=await X.readFile(a,"utf8"),d=A(r);d&&(d.source="remote",d.path=a,d.packageId=e,t.push(d))}catch{}return t}async function At(o,e,t,s,i){let n=["---",`name: ${o}`,`description: ${e}`];if(s?.length){n.push("tags:");for(let a of s)n.push(` - ${a}`)}if(i?.length){n.push("globs:");for(let a of i)n.push(` - ${a}`)}return n.push("---"),`${n.join(`
2
2
  `)}
3
3
 
4
4
  ${t}`}async function It(o){let{loadLocalSkills:e}=await import("./loader-YFVSSYSL.js");return e(o)}async function Ot(o,e,t,s,i){let a=[{role:"system",content:`You are a skill author for the Agent Skills ecosystem (skills.sh).