agentix-cli 0.47.1 → 0.49.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 (178) hide show
  1. package/apps/mac-helper/Sources/AgentXHelper/Buffer.swift +65 -0
  2. package/apps/mac-helper/Sources/AgentXHelper/Notify.swift +26 -0
  3. package/apps/mac-helper/Sources/AgentXHelper/Ring.swift +58 -0
  4. package/apps/mac-helper/Sources/AgentXHelper/Screens.swift +7 -0
  5. package/apps/mac-helper/Sources/AgentXHelper/Vision.swift +13 -8
  6. package/apps/mac-helper/Sources/AgentXHelper/Watch.swift +87 -0
  7. package/apps/mac-helper/Sources/AgentXHelper/main.swift +72 -18
  8. package/apps/mac-voice/Sources/AgentXVoice/AgentClient.swift +17 -5
  9. package/apps/mac-voice/Sources/AgentXVoice/Config.swift +6 -1
  10. package/apps/mac-voice/Sources/AgentXVoice/main.swift +5 -2
  11. package/dist/{App-RZDJH6MK.js → App-KE4SURSS.js} +2 -2
  12. package/dist/{ChatApp-6TXOFUDH.js → ChatApp-NNHIKXO2.js} +2 -2
  13. package/dist/{agent-I6RXAEXG.js → agent-J7SLJYQ6.js} +2 -2
  14. package/dist/{board-dashboard-4LAQOB74.js → board-dashboard-LG3ECH7C.js} +494 -132
  15. package/dist/board-dashboard-LG3ECH7C.js.map +1 -0
  16. package/dist/chunk-3L2FKVR6.js +19 -0
  17. package/dist/chunk-3L2FKVR6.js.map +1 -0
  18. package/dist/{chunk-BZLHS3VF.js → chunk-4NBWF4TL.js} +2 -2
  19. package/dist/{schedule-tool-6SNLG2NA.js → chunk-4TITGMPX.js} +3 -3
  20. package/dist/{schedule-tool-6SNLG2NA.js.map → chunk-4TITGMPX.js.map} +1 -1
  21. package/dist/{chunk-NXJBAKBR.js → chunk-5ALS7SVV.js} +2 -2
  22. package/dist/chunk-5XQCGPQJ.js +2 -0
  23. package/dist/chunk-5XQCGPQJ.js.map +1 -0
  24. package/dist/chunk-7DXE264B.js +2 -0
  25. package/dist/chunk-7DXE264B.js.map +1 -0
  26. package/dist/{chunk-FRHSQVFN.js → chunk-AQASR6KR.js} +3 -3
  27. package/dist/chunk-AQASR6KR.js.map +1 -0
  28. package/dist/{chunk-LYOXXD4T.js → chunk-B5XHX44Y.js} +2 -2
  29. package/dist/{chunk-7CVJ4JOE.js → chunk-DLKRPK5M.js} +2 -2
  30. package/dist/chunk-DTJKN5VT.js +28 -0
  31. package/dist/chunk-DTJKN5VT.js.map +1 -0
  32. package/dist/chunk-DVNIFP7S.js +23 -0
  33. package/dist/chunk-DVNIFP7S.js.map +1 -0
  34. package/dist/chunk-FM2GGPSD.js +626 -0
  35. package/dist/chunk-FM2GGPSD.js.map +1 -0
  36. package/dist/chunk-FULEQYM6.js +13 -0
  37. package/dist/chunk-FULEQYM6.js.map +1 -0
  38. package/dist/{chunk-3RHPZXCR.js → chunk-GCHUE3TN.js} +2 -2
  39. package/dist/{chunk-YIXQDOPN.js → chunk-HGT4AKOH.js} +185 -179
  40. package/dist/chunk-HGT4AKOH.js.map +1 -0
  41. package/dist/{chunk-XMRI32CY.js → chunk-HVQJIROJ.js} +64 -74
  42. package/dist/chunk-HVQJIROJ.js.map +1 -0
  43. package/dist/{chunk-BJWK7FPT.js → chunk-IXUEJBHD.js} +2 -2
  44. package/dist/{chunk-KTM7HSEB.js → chunk-JVNFRS26.js} +2 -2
  45. package/dist/{chunk-V7FYSZSV.js → chunk-LQRBGQIR.js} +2 -2
  46. package/dist/chunk-LQRBGQIR.js.map +1 -0
  47. package/dist/{chunk-XMWOV2D5.js → chunk-MWUJOAAW.js} +2 -2
  48. package/dist/{chunk-DJQA2CWD.js → chunk-N6EWZGIX.js} +6 -6
  49. package/dist/{chunk-DJQA2CWD.js.map → chunk-N6EWZGIX.js.map} +1 -1
  50. package/dist/{chunk-J63MRNXF.js → chunk-NLZD2QKF.js} +2 -2
  51. package/dist/chunk-OHA3J5ZV.js +243 -0
  52. package/dist/chunk-OHA3J5ZV.js.map +1 -0
  53. package/dist/chunk-OTW5MPFT.js +7 -0
  54. package/dist/chunk-OTW5MPFT.js.map +1 -0
  55. package/dist/chunk-OUZ7YVQZ.js +5 -0
  56. package/dist/{chunk-BHPIAG3E.js.map → chunk-OUZ7YVQZ.js.map} +1 -1
  57. package/dist/chunk-P2ZYT5D6.js +15 -0
  58. package/dist/chunk-P2ZYT5D6.js.map +1 -0
  59. package/dist/{chunk-FNLGY4UV.js → chunk-PZCTCCC5.js} +2 -2
  60. package/dist/chunk-Q7C3X3R6.js +61 -0
  61. package/dist/chunk-Q7C3X3R6.js.map +1 -0
  62. package/dist/{chunk-MDTKQZC6.js → chunk-QDE75R4U.js} +2 -2
  63. package/dist/{chunk-VHTFHGVW.js → chunk-RKAJR37K.js} +51 -51
  64. package/dist/chunk-RKAJR37K.js.map +1 -0
  65. package/dist/chunk-RKPAVWXF.js +2 -0
  66. package/dist/chunk-RKPAVWXF.js.map +1 -0
  67. package/dist/{chunk-SFLF64Q3.js → chunk-Z3IP66SL.js} +2 -2
  68. package/dist/cli.js +1 -1
  69. package/dist/cli.js.map +1 -1
  70. package/dist/client-JZTH46N2.js +2 -0
  71. package/dist/{compaction-QXU3A4LQ.js → compaction-U5SAYTX6.js} +2 -2
  72. package/dist/config-R47ITLIY.js +2 -0
  73. package/dist/config-mutator-T6JGXJ26.js +2 -0
  74. package/dist/context-planner-FJMU5WAT.js +17 -0
  75. package/dist/context-planner-FJMU5WAT.js.map +1 -0
  76. package/dist/doctor-2DMGAWMW.js +2 -0
  77. package/dist/failure-candidates-ARRMFXRY.js +8 -0
  78. package/dist/failure-candidates-ARRMFXRY.js.map +1 -0
  79. package/dist/index.d.ts +272 -0
  80. package/dist/index.js +1 -1
  81. package/dist/index.js.map +1 -1
  82. package/dist/memory-extract-YZI2QZVR.js +2 -0
  83. package/dist/processes-XWRGOLMT.js +2 -0
  84. package/dist/program-3CDFUJVE.js +2 -0
  85. package/dist/promote-57YNOVXV.js +2 -0
  86. package/dist/proposals-TX2HBBYV.js +2 -0
  87. package/dist/query-ZT7WXY2F.js +2 -0
  88. package/dist/registry-722GXALE.js +2 -0
  89. package/dist/{request-planner-5354IOYM.js → request-planner-PEAYYXAP.js} +2 -2
  90. package/dist/{review-candidates-UTWMO7UO.js → review-candidates-W7NIHNAI.js} +2 -2
  91. package/dist/{routing-JGNWB6VJ.js → routing-7LCO7UJ7.js} +2 -2
  92. package/dist/schedule-tool-ZD3VBUBW.js +2 -0
  93. package/dist/scheduler-GC3FQKXY.js +2 -0
  94. package/dist/{seat-STLDEYSO.js → seat-HR6QMAR2.js} +2 -2
  95. package/dist/{select-VP66P6XB.js → select-4XYRIZ5L.js} +2 -2
  96. package/dist/{surface-usage-FM2ZHGYE.js → surface-usage-V2BX4SBD.js} +2 -2
  97. package/dist/tool-PAQ47HV2.js +2 -0
  98. package/dist/tool-PAQ47HV2.js.map +1 -0
  99. package/dist/wiki-EREMPSAE.js +2 -0
  100. package/dist/wiki-EREMPSAE.js.map +1 -0
  101. package/package.json +1 -1
  102. package/dist/board-dashboard-4LAQOB74.js.map +0 -1
  103. package/dist/chunk-7L6M3P2N.js +0 -13
  104. package/dist/chunk-7L6M3P2N.js.map +0 -1
  105. package/dist/chunk-ANLKBCYH.js +0 -15
  106. package/dist/chunk-ANLKBCYH.js.map +0 -1
  107. package/dist/chunk-BHPIAG3E.js +0 -5
  108. package/dist/chunk-CQR6C5FU.js +0 -23
  109. package/dist/chunk-CQR6C5FU.js.map +0 -1
  110. package/dist/chunk-FQBPSL36.js +0 -25
  111. package/dist/chunk-FQBPSL36.js.map +0 -1
  112. package/dist/chunk-FRHSQVFN.js.map +0 -1
  113. package/dist/chunk-FXGSSZAP.js +0 -9
  114. package/dist/chunk-FXGSSZAP.js.map +0 -1
  115. package/dist/chunk-OSSI6R4K.js +0 -2
  116. package/dist/chunk-OSSI6R4K.js.map +0 -1
  117. package/dist/chunk-QURVHYBP.js +0 -616
  118. package/dist/chunk-QURVHYBP.js.map +0 -1
  119. package/dist/chunk-V7FYSZSV.js.map +0 -1
  120. package/dist/chunk-VHTFHGVW.js.map +0 -1
  121. package/dist/chunk-VZDKE2EZ.js +0 -241
  122. package/dist/chunk-VZDKE2EZ.js.map +0 -1
  123. package/dist/chunk-W544ZCCO.js +0 -7
  124. package/dist/chunk-W544ZCCO.js.map +0 -1
  125. package/dist/chunk-WZGABQ72.js +0 -59
  126. package/dist/chunk-WZGABQ72.js.map +0 -1
  127. package/dist/chunk-XMRI32CY.js.map +0 -1
  128. package/dist/chunk-YIXQDOPN.js.map +0 -1
  129. package/dist/client-LAIP23IP.js +0 -2
  130. package/dist/config-OZ2OOKFA.js +0 -2
  131. package/dist/config-mutator-EUF7QQ4V.js +0 -2
  132. package/dist/context-planner-AQHJMVY2.js +0 -17
  133. package/dist/context-planner-AQHJMVY2.js.map +0 -1
  134. package/dist/doctor-PEE3F5TX.js +0 -2
  135. package/dist/memory-extract-3TO7UC5B.js +0 -2
  136. package/dist/processes-I3XAPHG7.js +0 -2
  137. package/dist/program-PMHQRD5E.js +0 -2
  138. package/dist/promote-RNSGW4AJ.js +0 -2
  139. package/dist/proposals-MWMEXRDW.js +0 -2
  140. package/dist/query-BOUVRUU4.js +0 -2
  141. package/dist/registry-GGU43EOI.js +0 -2
  142. package/dist/scheduler-N25EAWF6.js +0 -2
  143. package/dist/wiki-SKIIAVCU.js +0 -2
  144. /package/dist/{App-RZDJH6MK.js.map → App-KE4SURSS.js.map} +0 -0
  145. /package/dist/{ChatApp-6TXOFUDH.js.map → ChatApp-NNHIKXO2.js.map} +0 -0
  146. /package/dist/{agent-I6RXAEXG.js.map → agent-J7SLJYQ6.js.map} +0 -0
  147. /package/dist/{chunk-BZLHS3VF.js.map → chunk-4NBWF4TL.js.map} +0 -0
  148. /package/dist/{chunk-NXJBAKBR.js.map → chunk-5ALS7SVV.js.map} +0 -0
  149. /package/dist/{chunk-LYOXXD4T.js.map → chunk-B5XHX44Y.js.map} +0 -0
  150. /package/dist/{chunk-7CVJ4JOE.js.map → chunk-DLKRPK5M.js.map} +0 -0
  151. /package/dist/{chunk-3RHPZXCR.js.map → chunk-GCHUE3TN.js.map} +0 -0
  152. /package/dist/{chunk-BJWK7FPT.js.map → chunk-IXUEJBHD.js.map} +0 -0
  153. /package/dist/{chunk-KTM7HSEB.js.map → chunk-JVNFRS26.js.map} +0 -0
  154. /package/dist/{chunk-XMWOV2D5.js.map → chunk-MWUJOAAW.js.map} +0 -0
  155. /package/dist/{chunk-J63MRNXF.js.map → chunk-NLZD2QKF.js.map} +0 -0
  156. /package/dist/{chunk-FNLGY4UV.js.map → chunk-PZCTCCC5.js.map} +0 -0
  157. /package/dist/{chunk-MDTKQZC6.js.map → chunk-QDE75R4U.js.map} +0 -0
  158. /package/dist/{chunk-SFLF64Q3.js.map → chunk-Z3IP66SL.js.map} +0 -0
  159. /package/dist/{client-LAIP23IP.js.map → client-JZTH46N2.js.map} +0 -0
  160. /package/dist/{compaction-QXU3A4LQ.js.map → compaction-U5SAYTX6.js.map} +0 -0
  161. /package/dist/{config-OZ2OOKFA.js.map → config-R47ITLIY.js.map} +0 -0
  162. /package/dist/{config-mutator-EUF7QQ4V.js.map → config-mutator-T6JGXJ26.js.map} +0 -0
  163. /package/dist/{doctor-PEE3F5TX.js.map → doctor-2DMGAWMW.js.map} +0 -0
  164. /package/dist/{memory-extract-3TO7UC5B.js.map → memory-extract-YZI2QZVR.js.map} +0 -0
  165. /package/dist/{processes-I3XAPHG7.js.map → processes-XWRGOLMT.js.map} +0 -0
  166. /package/dist/{program-PMHQRD5E.js.map → program-3CDFUJVE.js.map} +0 -0
  167. /package/dist/{promote-RNSGW4AJ.js.map → promote-57YNOVXV.js.map} +0 -0
  168. /package/dist/{proposals-MWMEXRDW.js.map → proposals-TX2HBBYV.js.map} +0 -0
  169. /package/dist/{query-BOUVRUU4.js.map → query-ZT7WXY2F.js.map} +0 -0
  170. /package/dist/{registry-GGU43EOI.js.map → registry-722GXALE.js.map} +0 -0
  171. /package/dist/{request-planner-5354IOYM.js.map → request-planner-PEAYYXAP.js.map} +0 -0
  172. /package/dist/{review-candidates-UTWMO7UO.js.map → review-candidates-W7NIHNAI.js.map} +0 -0
  173. /package/dist/{routing-JGNWB6VJ.js.map → routing-7LCO7UJ7.js.map} +0 -0
  174. /package/dist/{scheduler-N25EAWF6.js.map → schedule-tool-ZD3VBUBW.js.map} +0 -0
  175. /package/dist/{seat-STLDEYSO.js.map → scheduler-GC3FQKXY.js.map} +0 -0
  176. /package/dist/{surface-usage-FM2ZHGYE.js.map → seat-HR6QMAR2.js.map} +0 -0
  177. /package/dist/{select-VP66P6XB.js.map → select-4XYRIZ5L.js.map} +0 -0
  178. /package/dist/{wiki-SKIIAVCU.js.map → surface-usage-V2BX4SBD.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/wiki/failure-candidates.ts"],"sourcesContent":["import { createHash } from \"crypto\"\nimport type Database from \"better-sqlite3\"\nimport { getTrace, listTraces, type TraceRecord, type TraceStepRecord } from \"@/storage/traces\"\nimport type { MemoryCandidate } from \"./promote\"\n\n// Failed traces → wiki promotion candidates.\n//\n// Every other learning pass reads successes: the procedure miner loads\n// `status: ok` traces, and promotion reads memories an agent chose to\n// write. A tool that keeps failing, or the same wrong turn taken in\n// session after session, never reaches either — nothing in a failed run\n// is written down as a memory, and the miner never looks at it.\n//\n// This groups failed and timed-out traces by a failure signature (agent\n// + tool + outcome + error class) and offers only the signatures that recur across\n// several sessions to `wiki promote`. They join the same pool as memories\n// and monitor findings, so the judge, the ledger and the proposal review\n// are shared rather than rebuilt. One failure is session state; the same\n// failure in five sessions is something the fleet should know.\n\nexport const FAILURE_STAMP_PREFIX = \"failure:\"\nexport const DEFAULT_MIN_SESSIONS = 3\n/** Example runs kept per signature; the counts carry the rest. */\nexport const MAX_FAILURE_EXAMPLES = 5\n\n/** Trace statuses that count as a failure. `cancelled` does not: an\n * operator or a daemon restart stopped the run, the agent did not fail. */\nconst FAILED_STATUSES = [\"error\", \"timeout\"]\n\n/** Chats a learning pass itself runs in. Learning from those would make\n * the system learn from itself (same rule as the procedure miner). */\nconst SELF_CHAT_PREFIXES = [\"memory-promote\", \"procedure-miner\"]\n\nexport interface FailedTrace {\n taskId: string\n agentId: string\n chatId: string | null\n /** The session the run belongs to — the provider session when one is\n * known, else the run itself. See sessionOf(). */\n sessionId: string\n status: string\n startedAt: number\n error: string | null\n messagePreview: string | null\n /** The failing tool — see failingTool(); null when the run failed\n * before or outside any tool. */\n tool: string | null\n}\n\nexport interface FailureCandidate extends MemoryCandidate {\n /** Distinct sessions that hit this signature. */\n occurrences: number\n /** Some of those sessions, newest first. */\n sessions: string[]\n /** Some of the failed runs (task ids), newest first. */\n tasks: string[]\n failure: { tool: string; errorClass: string; runs: number }\n}\n\n/**\n * Reduce an error message to its class: the words that stay the same\n * when the same thing breaks again. Ids, numbers, paths, URLs and quoted\n * values change every time and would split one failure into many.\n */\nexport function errorClass(status: string, error: string | null): string {\n const text = (error ?? \"\")\n .toLowerCase()\n .replace(/https?:\\/\\/\\S+/g, \"<url>\")\n .replace(/([\"'`]).*?\\1/g, \"<v>\")\n .replace(/(?:~|\\.{0,2})?\\/[\\w.@-]+(?:\\/[\\w.@-]+)*/g, \"<path>\")\n .replace(/\\b[0-9a-z]*\\d[0-9a-z]*\\b/g, \"<n>\")\n .replace(/[^a-z<>\\s]+/g, \" \")\n .replace(/\\s+/g, \" \")\n .trim()\n const words = text.split(\" \").filter(Boolean).slice(0, 8).join(\" \")\n return words || status\n}\n\n/** Agent + tool + outcome + error class. A timeout and an error in the\n * same tool are different failures with different fixes. */\nexport function failureSignature(t: Pick<FailedTrace, \"agentId\" | \"tool\" | \"status\" | \"error\">): string {\n return `${t.agentId}|${t.tool ?? \"no-tool\"}|${t.status}|${errorClass(t.status, t.error)}`\n}\n\nfunction digest(signature: string): string {\n return createHash(\"sha1\").update(signature).digest(\"hex\").slice(0, 10)\n}\n\n/**\n * The stamp changes only when recurrence doubles (2–3 → 4–7 → 8–15 …).\n * A lesson skipped or rejected at three sessions is offered again once\n * it has been seen in four, and next at eight; it is not re-offered every\n * night because one more session hit it.\n */\nexport function failureStamp(signature: string, sessions: number): string {\n return `${FAILURE_STAMP_PREFIX}${digest(signature)}@${Math.floor(Math.log2(Math.max(1, sessions)))}`\n}\n\n/**\n * Which session a run belongs to. The provider session is the honest\n * unit: two failures inside one continuing conversation are one session\n * going wrong, not two. A run that never got a session is its own. The\n * chat id is deliberately not used — a scheduled job reuses one chat id\n * forever, which would count a job failing every night as one session.\n */\nexport function sessionOf(t: Pick<TraceRecord, \"taskId\" | \"finalSessionId\" | \"resumeSessionId\">): string {\n return t.finalSessionId ?? t.resumeSessionId ?? t.taskId\n}\n\n/** Load failed and timed-out traces in the window, with their failing tool. */\nexport function loadFailedTraces(db: Database.Database, opts: { since?: number } = {}): FailedTrace[] {\n const traces = FAILED_STATUSES.flatMap((status) =>\n listTraces(db, { status, since: opts.since, limit: 1000 }))\n return traces\n .filter((t) => !SELF_CHAT_PREFIXES.some((p) => (t.chatId ?? \"\").startsWith(p)))\n .map((t) => {\n const { tool, error } = failingTool(getTrace(db, t.taskId)?.steps ?? [])\n return {\n taskId: t.taskId,\n agentId: t.agentId,\n chatId: t.chatId,\n sessionId: sessionOf(t),\n status: t.status,\n startedAt: t.startedAt,\n error: error ?? t.error,\n messagePreview: t.messagePreview,\n tool,\n }\n })\n}\n\n/**\n * The tool a run failed in, and that tool's error. The stream records a\n * call as a `tool_use` step (named, status in-flight) and its outcome as\n * a separate `tool_result` step that carries no tool name, so an errored\n * result is paired with the call before it. The last error wins; with no\n * errored call the run is attributed to the last tool it used, keeping\n * the run's own error.\n */\nexport function failingTool(\n steps: Array<Pick<TraceStepRecord, \"name\" | \"action\" | \"status\" | \"error\" | \"outputSummary\">>,\n): { tool: string | null; error: string | null } {\n let last: string | null = null\n let failing: { tool: string | null; error: string | null } | null = null\n for (const s of steps) {\n if (s.name === \"tool_use\" && s.action) {\n last = s.action\n if (s.status === \"error\") failing = { tool: s.action, error: s.error ?? s.outputSummary }\n } else if (s.name === \"tool_result\" && s.status === \"error\") {\n failing = { tool: s.action ?? last, error: s.error ?? s.outputSummary }\n }\n }\n return failing ?? { tool: last, error: null }\n}\n\n/** Group failures by signature; keep those seen in at least `minSessions`\n * distinct sessions (never fewer than 2 — one session is not a pattern).\n * Most recurrent first. */\nexport function failuresToCandidates(\n traces: FailedTrace[],\n opts: { minSessions?: number } = {},\n): FailureCandidate[] {\n const minSessions = Math.max(2, opts.minSessions ?? DEFAULT_MIN_SESSIONS)\n const groups = new Map<string, FailedTrace[]>()\n for (const t of traces) {\n const sig = failureSignature(t)\n groups.set(sig, [...(groups.get(sig) ?? []), t])\n }\n\n const out: FailureCandidate[] = []\n for (const [signature, list] of groups) {\n const sessions = [...new Set([...list].sort((a, b) => b.startedAt - a.startedAt).map((t) => t.sessionId))]\n if (sessions.length < minSessions) continue\n list.sort((a, b) => b.startedAt - a.startedAt)\n const latest = list[0]\n const tool = latest.tool ?? \"no tool\"\n const cls = errorClass(latest.status, latest.error)\n const name = `failure-${digest(signature)}`\n out.push({\n occurrences: sessions.length,\n sessions: sessions.slice(0, MAX_FAILURE_EXAMPLES),\n tasks: list.slice(0, MAX_FAILURE_EXAMPLES).map((t) => t.taskId),\n failure: { tool, errorClass: cls, runs: list.length },\n agentId: latest.agentId,\n key: `${latest.agentId}/feedback_${name}`,\n stamp: failureStamp(signature, sessions.length),\n memory: {\n name,\n type: \"feedback\",\n description: `${latest.agentId}: ${tool} keeps failing (${cls}) in ${sessions.length} sessions`.slice(0, 200),\n body: renderBody(latest.agentId, tool, cls, sessions.length, list),\n createdAt: new Date(list[list.length - 1].startedAt).toISOString(),\n updatedAt: new Date(latest.startedAt).toISOString(),\n },\n })\n }\n return out.sort((a, b) => b.occurrences - a.occurrences)\n}\n\nfunction renderBody(agent: string, tool: string, cls: string, sessions: number, list: FailedTrace[]): string {\n const examples = list.slice(0, MAX_FAILURE_EXAMPLES).map((t) => {\n const task = (t.messagePreview ?? \"\").replace(/\\s+/g, \" \").trim().slice(0, 120)\n const error = (t.error ?? t.status).replace(/\\s+/g, \" \").trim().slice(0, 160)\n return `- ${new Date(t.startedAt).toISOString().slice(0, 10)} \\`${t.taskId}\\` (${t.status})${task ? ` — task: ${task}` : \"\"}\\n error: ${error}`\n })\n return [\n `**${agent}** hit the same failure in ${sessions} separate sessions (${list.length} runs).`,\n `- Tool: \\`${tool}\\`\\n- Error class: \\`${cls}\\``,\n \"Recurrence across sessions is the finding: any one of these runs is session state. \" +\n \"Propose the fix that stops it recurring — what fails, the likely cause, and what to do instead \" +\n \"(a missing fact, a better approach, or a tool or configuration change to make) — \" +\n \"or skip it if the examples do not share a cause.\",\n `**Examples (newest first):**\\n${examples.join(\"\\n\")}`,\n ].join(\"\\n\\n\")\n}\n"],"mappings":"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","names":["createHash","FAILURE_STAMP_PREFIX","DEFAULT_MIN_SESSIONS","MAX_FAILURE_EXAMPLES","FAILED_STATUSES","SELF_CHAT_PREFIXES","errorClass","status","error","failureSignature","digest","signature","createHash","failureStamp","sessions","sessionOf","loadFailedTraces","db","opts","listTraces","t","p","tool","failingTool","getTrace","steps","last","failing","s","failuresToCandidates","traces","minSessions","groups","sig","out","list","a","b","latest","cls","name","renderBody","agent","examples","task"]}
package/dist/index.d.ts CHANGED
@@ -2894,6 +2894,10 @@ declare const daemonConfigSchema: z.ZodObject<{
2894
2894
  keywords?: string[] | undefined;
2895
2895
  node?: string | undefined;
2896
2896
  }>, "many">>;
2897
+ /** Extra GitLab usernames each agent answers to, as prefixes. With
2898
+ * ["team-"], an agent with no agentMappings row answers to @<id> and
2899
+ * @team-<id>. Default: only @<id>. */
2900
+ agentUsernamePrefixes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
2897
2901
  }, "strip", z.ZodTypeAny, {
2898
2902
  enabled: boolean;
2899
2903
  host: string;
@@ -2910,6 +2914,7 @@ declare const daemonConfigSchema: z.ZodObject<{
2910
2914
  token?: string | undefined;
2911
2915
  node?: string | undefined;
2912
2916
  }[];
2917
+ agentUsernamePrefixes: string[];
2913
2918
  token?: string | undefined;
2914
2919
  webhookSecret?: string | undefined;
2915
2920
  }, {
@@ -2930,6 +2935,7 @@ declare const daemonConfigSchema: z.ZodObject<{
2930
2935
  keywords?: string[] | undefined;
2931
2936
  node?: string | undefined;
2932
2937
  }[] | undefined;
2938
+ agentUsernamePrefixes?: string[] | undefined;
2933
2939
  }>>;
2934
2940
  github: z.ZodDefault<z.ZodObject<{
2935
2941
  enabled: z.ZodDefault<z.ZodBoolean>;
@@ -3225,6 +3231,7 @@ declare const daemonConfigSchema: z.ZodObject<{
3225
3231
  token?: string | undefined;
3226
3232
  node?: string | undefined;
3227
3233
  }[];
3234
+ agentUsernamePrefixes: string[];
3228
3235
  token?: string | undefined;
3229
3236
  webhookSecret?: string | undefined;
3230
3237
  };
@@ -3348,6 +3355,7 @@ declare const daemonConfigSchema: z.ZodObject<{
3348
3355
  keywords?: string[] | undefined;
3349
3356
  node?: string | undefined;
3350
3357
  }[] | undefined;
3358
+ agentUsernamePrefixes?: string[] | undefined;
3351
3359
  } | undefined;
3352
3360
  whatsapp?: {
3353
3361
  enabled?: boolean | undefined;
@@ -3828,6 +3836,86 @@ declare const daemonConfigSchema: z.ZodObject<{
3828
3836
  accountId?: string | undefined;
3829
3837
  } | undefined;
3830
3838
  }>>;
3839
+ approvals: z.ZodDefault<z.ZodObject<{
3840
+ /** A card without an `expires` gets this many days. */
3841
+ defaultExpiryDays: z.ZodDefault<z.ZodNumber>;
3842
+ /** No card waits longer than this, whatever the agent asked for. */
3843
+ maxExpiryDays: z.ZodDefault<z.ZodNumber>;
3844
+ /** How long "later" hides an item. */
3845
+ laterHours: z.ZodDefault<z.ZodNumber>;
3846
+ /** Tell the agent that raised a card when it is decided or expires. */
3847
+ notifyAgent: z.ZodDefault<z.ZodBoolean>;
3848
+ /** At most one message a day: how many are waiting, and the most urgent. */
3849
+ digest: z.ZodDefault<z.ZodObject<{
3850
+ enabled: z.ZodDefault<z.ZodBoolean>;
3851
+ /** Local time, 24-hour HH:MM. */
3852
+ time: z.ZodDefault<z.ZodString>;
3853
+ /** IANA timezone for `time`. Unset: this machine's. */
3854
+ timezone: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
3855
+ /** Where it goes. Unset: notifications.destination. */
3856
+ destination: z.ZodOptional<z.ZodObject<{
3857
+ channel: z.ZodString;
3858
+ chatId: z.ZodString;
3859
+ accountId: z.ZodOptional<z.ZodString>;
3860
+ }, "strip", z.ZodTypeAny, {
3861
+ channel: string;
3862
+ chatId: string;
3863
+ accountId?: string | undefined;
3864
+ }, {
3865
+ channel: string;
3866
+ chatId: string;
3867
+ accountId?: string | undefined;
3868
+ }>>;
3869
+ }, "strip", z.ZodTypeAny, {
3870
+ enabled: boolean;
3871
+ time: string;
3872
+ timezone?: string | undefined;
3873
+ destination?: {
3874
+ channel: string;
3875
+ chatId: string;
3876
+ accountId?: string | undefined;
3877
+ } | undefined;
3878
+ }, {
3879
+ enabled?: boolean | undefined;
3880
+ timezone?: string | undefined;
3881
+ time?: string | undefined;
3882
+ destination?: {
3883
+ channel: string;
3884
+ chatId: string;
3885
+ accountId?: string | undefined;
3886
+ } | undefined;
3887
+ }>>;
3888
+ }, "strip", z.ZodTypeAny, {
3889
+ defaultExpiryDays: number;
3890
+ maxExpiryDays: number;
3891
+ laterHours: number;
3892
+ notifyAgent: boolean;
3893
+ digest: {
3894
+ enabled: boolean;
3895
+ time: string;
3896
+ timezone?: string | undefined;
3897
+ destination?: {
3898
+ channel: string;
3899
+ chatId: string;
3900
+ accountId?: string | undefined;
3901
+ } | undefined;
3902
+ };
3903
+ }, {
3904
+ defaultExpiryDays?: number | undefined;
3905
+ maxExpiryDays?: number | undefined;
3906
+ laterHours?: number | undefined;
3907
+ notifyAgent?: boolean | undefined;
3908
+ digest?: {
3909
+ enabled?: boolean | undefined;
3910
+ timezone?: string | undefined;
3911
+ time?: string | undefined;
3912
+ destination?: {
3913
+ channel: string;
3914
+ chatId: string;
3915
+ accountId?: string | undefined;
3916
+ } | undefined;
3917
+ } | undefined;
3918
+ }>>;
3831
3919
  /** What happens to runs a restart cuts off (agents/resume). Chat messages
3832
3920
  * are resumed in their chat; scheduled jobs never are (the next run
3833
3921
  * covers them); everything else is reported unless its channel is in
@@ -3876,6 +3964,95 @@ declare const daemonConfigSchema: z.ZodObject<{
3876
3964
  windowMinutes?: number | undefined;
3877
3965
  } | undefined;
3878
3966
  }>>;
3967
+ screen: z.ZodDefault<z.ZodObject<{
3968
+ /** Pixel budget for a captured frame; larger captures are downscaled. */
3969
+ maxPixels: z.ZodDefault<z.ZodNumber>;
3970
+ /** Longest a capture waits for a change or for the screen to settle. */
3971
+ timeoutMs: z.ZodDefault<z.ZodNumber>;
3972
+ /** Time between samples while waiting. */
3973
+ intervalMs: z.ZodDefault<z.ZodNumber>;
3974
+ /** Mean difference (0–1) above which two samples count as different. */
3975
+ changeThreshold: z.ZodDefault<z.ZodNumber>;
3976
+ /** How long a region must stay unchanged to count as stable. */
3977
+ stableMs: z.ZodDefault<z.ZodNumber>;
3978
+ /** Named regions in screen points, e.g. { "chat": { x, y, width, height } }.
3979
+ * A name here overrides the built-in region of the same name. */
3980
+ regions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
3981
+ x: z.ZodNumber;
3982
+ y: z.ZodNumber;
3983
+ width: z.ZodNumber;
3984
+ height: z.ZodNumber;
3985
+ }, "strip", z.ZodTypeAny, {
3986
+ x: number;
3987
+ y: number;
3988
+ width: number;
3989
+ height: number;
3990
+ }, {
3991
+ x: number;
3992
+ y: number;
3993
+ width: number;
3994
+ height: number;
3995
+ }>>>;
3996
+ /** The last few seconds of a region, kept in memory by the daemon. Off
3997
+ * unless enabled; frames are written out only when asked for. */
3998
+ buffer: z.ZodDefault<z.ZodObject<{
3999
+ enabled: z.ZodDefault<z.ZodBoolean>;
4000
+ seconds: z.ZodDefault<z.ZodNumber>;
4001
+ fps: z.ZodDefault<z.ZodNumber>;
4002
+ region: z.ZodDefault<z.ZodString>;
4003
+ maxPixels: z.ZodDefault<z.ZodNumber>;
4004
+ }, "strip", z.ZodTypeAny, {
4005
+ enabled: boolean;
4006
+ maxPixels: number;
4007
+ seconds: number;
4008
+ fps: number;
4009
+ region: string;
4010
+ }, {
4011
+ enabled?: boolean | undefined;
4012
+ maxPixels?: number | undefined;
4013
+ seconds?: number | undefined;
4014
+ fps?: number | undefined;
4015
+ region?: string | undefined;
4016
+ }>>;
4017
+ }, "strip", z.ZodTypeAny, {
4018
+ timeoutMs: number;
4019
+ maxPixels: number;
4020
+ intervalMs: number;
4021
+ changeThreshold: number;
4022
+ stableMs: number;
4023
+ regions: Record<string, {
4024
+ x: number;
4025
+ y: number;
4026
+ width: number;
4027
+ height: number;
4028
+ }>;
4029
+ buffer: {
4030
+ enabled: boolean;
4031
+ maxPixels: number;
4032
+ seconds: number;
4033
+ fps: number;
4034
+ region: string;
4035
+ };
4036
+ }, {
4037
+ timeoutMs?: number | undefined;
4038
+ maxPixels?: number | undefined;
4039
+ intervalMs?: number | undefined;
4040
+ changeThreshold?: number | undefined;
4041
+ stableMs?: number | undefined;
4042
+ regions?: Record<string, {
4043
+ x: number;
4044
+ y: number;
4045
+ width: number;
4046
+ height: number;
4047
+ }> | undefined;
4048
+ buffer?: {
4049
+ enabled?: boolean | undefined;
4050
+ maxPixels?: number | undefined;
4051
+ seconds?: number | undefined;
4052
+ fps?: number | undefined;
4053
+ region?: string | undefined;
4054
+ } | undefined;
4055
+ }>>;
3879
4056
  mesh: z.ZodDefault<z.ZodObject<{
3880
4057
  enabled: z.ZodDefault<z.ZodBoolean>;
3881
4058
  peers: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -5417,6 +5594,26 @@ declare const daemonConfigSchema: z.ZodObject<{
5417
5594
  draftAgent?: string | undefined;
5418
5595
  reviewAgent?: string | undefined;
5419
5596
  };
5597
+ screen: {
5598
+ timeoutMs: number;
5599
+ maxPixels: number;
5600
+ intervalMs: number;
5601
+ changeThreshold: number;
5602
+ stableMs: number;
5603
+ regions: Record<string, {
5604
+ x: number;
5605
+ y: number;
5606
+ width: number;
5607
+ height: number;
5608
+ }>;
5609
+ buffer: {
5610
+ enabled: boolean;
5611
+ maxPixels: number;
5612
+ seconds: number;
5613
+ fps: number;
5614
+ region: string;
5615
+ };
5616
+ };
5420
5617
  providers: Record<string, {
5421
5618
  apiKey?: string | undefined;
5422
5619
  thinking?: boolean | undefined;
@@ -5440,6 +5637,7 @@ declare const daemonConfigSchema: z.ZodObject<{
5440
5637
  token?: string | undefined;
5441
5638
  node?: string | undefined;
5442
5639
  }[];
5640
+ agentUsernamePrefixes: string[];
5443
5641
  token?: string | undefined;
5444
5642
  webhookSecret?: string | undefined;
5445
5643
  };
@@ -5607,6 +5805,22 @@ declare const daemonConfigSchema: z.ZodObject<{
5607
5805
  accountId?: string | undefined;
5608
5806
  } | undefined;
5609
5807
  };
5808
+ approvals: {
5809
+ defaultExpiryDays: number;
5810
+ maxExpiryDays: number;
5811
+ laterHours: number;
5812
+ notifyAgent: boolean;
5813
+ digest: {
5814
+ enabled: boolean;
5815
+ time: string;
5816
+ timezone?: string | undefined;
5817
+ destination?: {
5818
+ channel: string;
5819
+ chatId: string;
5820
+ accountId?: string | undefined;
5821
+ } | undefined;
5822
+ };
5823
+ };
5610
5824
  meshVoices: Record<string, {
5611
5825
  system?: string | Record<string, string> | undefined;
5612
5826
  provider?: "system" | "elevenlabs" | undefined;
@@ -5977,6 +6191,26 @@ declare const daemonConfigSchema: z.ZodObject<{
5977
6191
  bm25?: number | undefined;
5978
6192
  } | undefined;
5979
6193
  } | undefined;
6194
+ screen?: {
6195
+ timeoutMs?: number | undefined;
6196
+ maxPixels?: number | undefined;
6197
+ intervalMs?: number | undefined;
6198
+ changeThreshold?: number | undefined;
6199
+ stableMs?: number | undefined;
6200
+ regions?: Record<string, {
6201
+ x: number;
6202
+ y: number;
6203
+ width: number;
6204
+ height: number;
6205
+ }> | undefined;
6206
+ buffer?: {
6207
+ enabled?: boolean | undefined;
6208
+ maxPixels?: number | undefined;
6209
+ seconds?: number | undefined;
6210
+ fps?: number | undefined;
6211
+ region?: string | undefined;
6212
+ } | undefined;
6213
+ } | undefined;
5980
6214
  providers?: Record<string, {
5981
6215
  apiKey?: string | undefined;
5982
6216
  thinking?: boolean | undefined;
@@ -6002,6 +6236,7 @@ declare const daemonConfigSchema: z.ZodObject<{
6002
6236
  keywords?: string[] | undefined;
6003
6237
  node?: string | undefined;
6004
6238
  }[] | undefined;
6239
+ agentUsernamePrefixes?: string[] | undefined;
6005
6240
  } | undefined;
6006
6241
  whatsapp?: {
6007
6242
  enabled?: boolean | undefined;
@@ -6167,6 +6402,22 @@ declare const daemonConfigSchema: z.ZodObject<{
6167
6402
  accountId?: string | undefined;
6168
6403
  } | undefined;
6169
6404
  } | undefined;
6405
+ approvals?: {
6406
+ defaultExpiryDays?: number | undefined;
6407
+ maxExpiryDays?: number | undefined;
6408
+ laterHours?: number | undefined;
6409
+ notifyAgent?: boolean | undefined;
6410
+ digest?: {
6411
+ enabled?: boolean | undefined;
6412
+ timezone?: string | undefined;
6413
+ time?: string | undefined;
6414
+ destination?: {
6415
+ channel: string;
6416
+ chatId: string;
6417
+ accountId?: string | undefined;
6418
+ } | undefined;
6419
+ } | undefined;
6420
+ } | undefined;
6170
6421
  meshVoices?: Record<string, {
6171
6422
  system?: string | Record<string, string> | undefined;
6172
6423
  provider?: "system" | "elevenlabs" | undefined;
@@ -6753,6 +7004,7 @@ declare class AgentXDaemon {
6753
7004
  private voiceIntros;
6754
7005
  /** Talk mode and task narration: see src/daemon/voice-talk-api.ts. */
6755
7006
  private voiceTalk;
7007
+ private screenBuffer?;
6756
7008
  /** Voice for agents on mesh peers: see src/daemon/voice-mesh-proxy.ts. */
6757
7009
  private voiceMesh;
6758
7010
  /** Persistent-claude process registry. Null when no agent has
@@ -6772,6 +7024,17 @@ declare class AgentXDaemon {
6772
7024
  constructor(configPath?: string);
6773
7025
  start(): Promise<void>;
6774
7026
  stop(): Promise<void>;
7027
+ /** In-flight work the drain waits for: local agent tasks + mesh forwards. */
7028
+ private inflightCounts;
7029
+ /** Set by start(): the same graceful path a SIGTERM takes. */
7030
+ private requestShutdown?;
7031
+ /** Exit code stop() ends with; a self-restart may need a non-zero one. */
7032
+ private exitCode;
7033
+ private selfRestartInfo?;
7034
+ /** "Restart when idle" (dashboard button / POST /daemon/restart). */
7035
+ private idleRestart;
7036
+ /** What runs this daemon, detected once (it can't change while it runs). */
7037
+ private restartService;
6775
7038
  private midnightTimer?;
6776
7039
  /** Set on the first stop signal: new work is refused while tasks drain. */
6777
7040
  private shuttingDown;
@@ -6802,6 +7065,11 @@ declare class AgentXDaemon {
6802
7065
  restartRequired: string[];
6803
7066
  error?: string;
6804
7067
  }>;
7068
+ private approvalsTimer?;
7069
+ private approvalsSweeping;
7070
+ /** Every minute: expire decision cards, tell agents their results, and
7071
+ * send the day's digest when due (src/approvals/sweep.ts). */
7072
+ private startApprovalsSweep;
6805
7073
  private scheduleMidnightHook;
6806
7074
  private runDailyCostReport;
6807
7075
  private startChannels;
@@ -7591,6 +7859,10 @@ declare class MemoryStore {
7591
7859
  getAll(agentId: string): MemoryFact[];
7592
7860
  findRelevant(message: string, agentId: string, limit?: number): MemoryFact[];
7593
7861
  buildContext(memories: MemoryFact[]): string;
7862
+ /** The facts buildContext actually renders — the rest fall past its
7863
+ * character budget. Trace capture records these ids, not the candidates. */
7864
+ contextFacts(memories: MemoryFact[]): MemoryFact[];
7865
+ private contextLines;
7594
7866
  /**
7595
7867
  * Record that memories were accessed (for spaced repetition tracking).
7596
7868
  */
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{a as L}from"./chunk-W5C2GDNC.js";import{Y as bt,Z as Tt,_ as Mt,a as St,b as kt,c as vt,d as xt,e as $t,f as Ct,g as Pt}from"./chunk-YIXQDOPN.js";import"./chunk-FQBPSL36.js";import"./chunk-FNLGY4UV.js";import"./chunk-V7FYSZSV.js";import"./chunk-ZVP6GB4G.js";import"./chunk-7L6M3P2N.js";import"./chunk-VZDKE2EZ.js";import"./chunk-3SCPRYJB.js";import"./chunk-FRHSQVFN.js";import"./chunk-L53FTKEP.js";import{O as yt,l as lt,m as ct,n as dt,o as mt,p as pt}from"./chunk-XMRI32CY.js";import"./chunk-FXGSSZAP.js";import"./chunk-DJQA2CWD.js";import"./chunk-WZGABQ72.js";import"./chunk-DP7RTNDM.js";import{A as D,B as z,C as V,a as ye,b as we,c as Se,d as Ae,e as Ie,f as Oe,g as Ne,h as He,i as je,j as Ue,k as _e,l as I,m as q,n as Be,o as qe,p as Ye,q as O,r as ze,s as Ve,t as Xe,u as x,v as Y,w as Qe,x as Ze,y as et,z as wt}from"./chunk-XMWOV2D5.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import{m as ut}from"./chunk-LYOXXD4T.js";import"./chunk-WPMX3VGI.js";import"./chunk-K33GIBSE.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-J63MRNXF.js";import"./chunk-NXJBAKBR.js";import"./chunk-DWADWDMU.js";import"./chunk-CQR6C5FU.js";import"./chunk-VWTBHLMX.js";import"./chunk-BJWK7FPT.js";import{a as gt,b as ft,e as ht}from"./chunk-KTM7HSEB.js";import"./chunk-PNWNVOEZ.js";import"./chunk-64P4QHSZ.js";import"./chunk-MDTKQZC6.js";import"./chunk-AJ5RMU7X.js";import"./chunk-2GIDVZ4H.js";import{j as it,k as rt,l as at}from"./chunk-BZLHS3VF.js";import"./chunk-F4HZTZHW.js";import"./chunk-AJONZWLT.js";import"./chunk-ZTEU5JVQ.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{j as tt,l as st,m as ot,o as nt}from"./chunk-ANLKBCYH.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,ia as bt,ja as Tt,ka as Mt}from"./chunk-HGT4AKOH.js";import"./chunk-DTJKN5VT.js";import"./chunk-PZCTCCC5.js";import"./chunk-LQRBGQIR.js";import"./chunk-ZVP6GB4G.js";import"./chunk-FULEQYM6.js";import"./chunk-OHA3J5ZV.js";import"./chunk-3SCPRYJB.js";import"./chunk-AQASR6KR.js";import"./chunk-L53FTKEP.js";import{N as yt,l as lt,m as ct,n as dt,o as mt,p as pt}from"./chunk-HVQJIROJ.js";import"./chunk-3L2FKVR6.js";import"./chunk-N6EWZGIX.js";import"./chunk-Q7C3X3R6.js";import"./chunk-DP7RTNDM.js";import{A as D,B as z,C as V,a as ye,b as we,c as Se,d as Ae,e as Ie,f as Oe,g as Ne,h as He,i as je,j as Ue,k as _e,l as I,m as q,n as Be,o as qe,p as Ye,q as O,r as ze,s as Ve,t as Xe,u as x,v as Y,w as Qe,x as Ze,y as et,z as wt}from"./chunk-MWUJOAAW.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-5XQCGPQJ.js";import{m as ut}from"./chunk-B5XHX44Y.js";import"./chunk-WPMX3VGI.js";import"./chunk-K33GIBSE.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-NLZD2QKF.js";import"./chunk-5ALS7SVV.js";import"./chunk-DWADWDMU.js";import"./chunk-DVNIFP7S.js";import"./chunk-7DXE264B.js";import"./chunk-VWTBHLMX.js";import"./chunk-IXUEJBHD.js";import{a as gt,b as ft,e as ht}from"./chunk-JVNFRS26.js";import"./chunk-PNWNVOEZ.js";import"./chunk-64P4QHSZ.js";import"./chunk-QDE75R4U.js";import"./chunk-AJ5RMU7X.js";import"./chunk-2GIDVZ4H.js";import{j as it,k as rt,l as at}from"./chunk-4NBWF4TL.js";import"./chunk-F4HZTZHW.js";import"./chunk-AJONZWLT.js";import"./chunk-ZTEU5JVQ.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{k as tt,m as st,n as ot,p as nt}from"./chunk-P2ZYT5D6.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).