agentix-cli 0.196.0 → 0.197.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 (198) hide show
  1. package/dist/{App-HBM52GXI.js → App-GF6MCNH6.js} +2 -2
  2. package/dist/{App-HBM52GXI.js.map → App-GF6MCNH6.js.map} +1 -1
  3. package/dist/ChatApp-FO2JNLWI.js +7 -0
  4. package/dist/{ChatApp-N4P7M2TD.js.map → ChatApp-FO2JNLWI.js.map} +1 -1
  5. package/dist/absorb-eval-7KMQJ5BR.js +2 -0
  6. package/dist/{adapter-X6T3YBUB.js → adapter-V7DQXCII.js} +2 -2
  7. package/dist/{adapter-X6T3YBUB.js.map → adapter-V7DQXCII.js.map} +1 -1
  8. package/dist/{agent-3B4RMEDI.js → agent-PJBGUZMR.js} +2 -2
  9. package/dist/{board-dashboard-Y2X7GNAS.js → board-dashboard-M3RVQM7K.js} +717 -380
  10. package/dist/board-dashboard-M3RVQM7K.js.map +1 -0
  11. package/dist/{chunk-YWAJNF2A.js → chunk-27ICCQVL.js} +54 -54
  12. package/dist/chunk-27ICCQVL.js.map +1 -0
  13. package/dist/{chunk-PMSL4A5Y.js → chunk-35GSB7SK.js} +3 -3
  14. package/dist/{chunk-XH36J3Z2.js → chunk-3K3IBV5K.js} +2 -2
  15. package/dist/{chunk-ZALVAXQ4.js → chunk-3LMBT5LK.js} +2 -2
  16. package/dist/{chunk-MB5CBY2C.js → chunk-424CABZF.js} +7 -7
  17. package/dist/chunk-424CABZF.js.map +1 -0
  18. package/dist/{chunk-F2FJXKDG.js → chunk-425HPUKF.js} +2 -2
  19. package/dist/{chunk-PX7PWXBI.js → chunk-4O6ZFYWT.js} +2 -2
  20. package/dist/chunk-7AB3QUGH.js +2 -0
  21. package/dist/{chunk-3FZ6WHKX.js.map → chunk-7AB3QUGH.js.map} +1 -1
  22. package/dist/chunk-7MW44Y5O.js +145 -0
  23. package/dist/chunk-7MW44Y5O.js.map +1 -0
  24. package/dist/chunk-B3JQ5J47.js +2 -0
  25. package/dist/chunk-B3JQ5J47.js.map +1 -0
  26. package/dist/chunk-BMNDAEF4.js +2 -0
  27. package/dist/chunk-BMNDAEF4.js.map +1 -0
  28. package/dist/{chunk-2GCPSAXQ.js → chunk-BN5JVELZ.js} +2 -2
  29. package/dist/{chunk-LQIF2OHS.js → chunk-BY5CN7C7.js} +2 -2
  30. package/dist/{chunk-HOZZUN47.js → chunk-DHD4KUTW.js} +2 -2
  31. package/dist/{chunk-KE6BF4ZJ.js → chunk-GMP2IB4E.js} +2 -2
  32. package/dist/{chunk-K2BEV3BD.js → chunk-HIHROVHC.js} +2 -2
  33. package/dist/{chunk-KXJRXRSD.js → chunk-HOL645BZ.js} +2 -2
  34. package/dist/{chunk-7L54Z4EH.js → chunk-HUOR3FGJ.js} +2 -2
  35. package/dist/chunk-I22ZKW7Q.js +4 -0
  36. package/dist/chunk-I22ZKW7Q.js.map +1 -0
  37. package/dist/chunk-IFUAP7UD.js +11 -0
  38. package/dist/chunk-IFUAP7UD.js.map +1 -0
  39. package/dist/{chunk-V7FZBETJ.js → chunk-IOCULCCJ.js} +2 -2
  40. package/dist/{chunk-NT3DGEBE.js → chunk-IQQ3I6R7.js} +312 -311
  41. package/dist/chunk-IQQ3I6R7.js.map +1 -0
  42. package/dist/{chunk-6V5JBHUN.js → chunk-J7PZJRYO.js} +2 -2
  43. package/dist/{chunk-F3CMNSON.js → chunk-K3623S4U.js} +2 -2
  44. package/dist/{chunk-2KYGPVTX.js → chunk-KB5JMDGS.js} +2 -2
  45. package/dist/{chunk-HNZEXUNM.js → chunk-OVB3LW6L.js} +2 -2
  46. package/dist/{chunk-6NQ7KYJH.js → chunk-OXTFAV2A.js} +2 -2
  47. package/dist/{chunk-VX4PSOKU.js → chunk-QABY3WEM.js} +2 -2
  48. package/dist/{chunk-M2E3CNFS.js → chunk-R3TH2OG7.js} +2 -2
  49. package/dist/chunk-RC3QYH2J.js +20 -0
  50. package/dist/chunk-RC3QYH2J.js.map +1 -0
  51. package/dist/{chunk-UOIWIVU3.js → chunk-RLI32DLG.js} +2 -2
  52. package/dist/{chunk-RW5FKJRE.js → chunk-SK7M6PS6.js} +2 -2
  53. package/dist/chunk-SNYAM7YB.js +116 -0
  54. package/dist/chunk-SNYAM7YB.js.map +1 -0
  55. package/dist/{chunk-BOCLWYWL.js → chunk-TBS7OVMI.js} +2 -2
  56. package/dist/{chunk-FO762MEC.js → chunk-TKXZHRV3.js} +2 -2
  57. package/dist/{chunk-PO2SORKY.js → chunk-WFPLZLCF.js} +2 -2
  58. package/dist/cli.js +1 -1
  59. package/dist/client-ZHE4B2DD.js +2 -0
  60. package/dist/config-THBWCNN7.js +2 -0
  61. package/dist/config-mutate-FBX6TFCY.js +2 -0
  62. package/dist/config-mutator-33RBNPV4.js +2 -0
  63. package/dist/{contributions-6VZ4OXJ5.js → contributions-2HR5ZGMK.js} +2 -2
  64. package/dist/{contributions-6VZ4OXJ5.js.map → contributions-2HR5ZGMK.js.map} +1 -1
  65. package/dist/doctor-VMWX6GKN.js +2 -0
  66. package/dist/{follow-up-tool-NVP56W7E.js → follow-up-tool-BCSCBKVL.js} +2 -2
  67. package/dist/{follow-up-tool-NVP56W7E.js.map → follow-up-tool-BCSCBKVL.js.map} +1 -1
  68. package/dist/hub-WPC6MTZY.js +2 -0
  69. package/dist/index.d.ts +131 -6
  70. package/dist/index.js +1 -1
  71. package/dist/index.js.map +1 -1
  72. package/dist/{note-tool-ANQWBBZE.js → note-tool-KVH3YBTX.js} +2 -2
  73. package/dist/ntfy-73UW6GHN.js +2 -0
  74. package/dist/{program-W7ZO7UDB.js → program-MOVUJBAA.js} +246 -246
  75. package/dist/program-MOVUJBAA.js.map +1 -0
  76. package/dist/promote-WWPXP5Z4.js +2 -0
  77. package/dist/push-E5YKRFAW.js +2 -0
  78. package/dist/push-bridge-RV3CBTYO.js +2 -0
  79. package/dist/query-F7HRTCWI.js +2 -0
  80. package/dist/{query-settings-C5UBKJMN.js → query-settings-Z32LXLJI.js} +2 -2
  81. package/dist/registry-D5HHCFCC.js +2 -0
  82. package/dist/request-planner-4FSNZJVQ.js +6 -0
  83. package/dist/{request-planner-G6IAUMSE.js.map → request-planner-4FSNZJVQ.js.map} +1 -1
  84. package/dist/review-candidates-U2DOD5Z3.js +4 -0
  85. package/dist/{review-candidates-ZL2SJXWC.js.map → review-candidates-U2DOD5Z3.js.map} +1 -1
  86. package/dist/routing-USMMBJYT.js +2 -0
  87. package/dist/schedule-tool-IRTB23XL.js +2 -0
  88. package/dist/scheduler-L4ERAOMG.js +2 -0
  89. package/dist/seat-3LW672DM.js +2 -0
  90. package/dist/select-MPMJSYKX.js +2 -0
  91. package/dist/{select-MU52ACKG.js.map → select-MPMJSYKX.js.map} +1 -1
  92. package/dist/self-HICJTWYO.js +2 -0
  93. package/dist/set-enabled-TQXG3MSQ.js +2 -0
  94. package/dist/{set-enabled-XRNSYEI3.js.map → set-enabled-TQXG3MSQ.js.map} +1 -1
  95. package/dist/{sprint-tool-E4MABD2N.js → sprint-tool-JQ5KCJDP.js} +2 -2
  96. package/dist/{sprint-tool-E4MABD2N.js.map → sprint-tool-JQ5KCJDP.js.map} +1 -1
  97. package/dist/{tool-ZYVT4VUU.js → tool-D4DHXF4Z.js} +2 -2
  98. package/dist/{tool-ZYVT4VUU.js.map → tool-D4DHXF4Z.js.map} +1 -1
  99. package/dist/tool-DHCKG3SK.js +10 -0
  100. package/dist/tool-DHCKG3SK.js.map +1 -0
  101. package/dist/{tool-V5Z4KWK7.js → tool-ZP3SZKYR.js} +2 -2
  102. package/dist/{tool-V5Z4KWK7.js.map → tool-ZP3SZKYR.js.map} +1 -1
  103. package/dist/wiki-CRH6XAXE.js +2 -0
  104. package/dist/wiki-enrich-YZEW6RZT.js +2 -0
  105. package/package.json +1 -1
  106. package/dist/ChatApp-N4P7M2TD.js +0 -7
  107. package/dist/absorb-eval-HRWWPKT3.js +0 -2
  108. package/dist/board-dashboard-Y2X7GNAS.js.map +0 -1
  109. package/dist/chunk-3FZ6WHKX.js +0 -2
  110. package/dist/chunk-5HLD66CW.js +0 -2
  111. package/dist/chunk-5HLD66CW.js.map +0 -1
  112. package/dist/chunk-AJ5HMDRW.js +0 -11
  113. package/dist/chunk-AJ5HMDRW.js.map +0 -1
  114. package/dist/chunk-IS2IWRP7.js +0 -4
  115. package/dist/chunk-IS2IWRP7.js.map +0 -1
  116. package/dist/chunk-MB5CBY2C.js.map +0 -1
  117. package/dist/chunk-MC3ZZA5G.js +0 -143
  118. package/dist/chunk-MC3ZZA5G.js.map +0 -1
  119. package/dist/chunk-NT3DGEBE.js.map +0 -1
  120. package/dist/chunk-P6WSD2UR.js +0 -116
  121. package/dist/chunk-P6WSD2UR.js.map +0 -1
  122. package/dist/chunk-UOYIC7XN.js +0 -3
  123. package/dist/chunk-UOYIC7XN.js.map +0 -1
  124. package/dist/chunk-YWAJNF2A.js.map +0 -1
  125. package/dist/client-YN3T56NM.js +0 -2
  126. package/dist/config-G7T3TMWE.js +0 -2
  127. package/dist/config-mutate-6CRKZQVQ.js +0 -2
  128. package/dist/config-mutator-7VS3J5BY.js +0 -2
  129. package/dist/doctor-GFZZTK7C.js +0 -2
  130. package/dist/hub-B434CABZ.js +0 -2
  131. package/dist/ntfy-Q4YHFKWW.js +0 -2
  132. package/dist/program-W7ZO7UDB.js.map +0 -1
  133. package/dist/promote-3P6PGJOW.js +0 -2
  134. package/dist/push-PRFZMCIK.js +0 -2
  135. package/dist/push-bridge-NR7SLHGX.js +0 -2
  136. package/dist/query-E4V7TS5S.js +0 -2
  137. package/dist/registry-IG324PR3.js +0 -2
  138. package/dist/request-planner-G6IAUMSE.js +0 -6
  139. package/dist/review-candidates-ZL2SJXWC.js +0 -4
  140. package/dist/routing-2IBIZYQU.js +0 -2
  141. package/dist/schedule-tool-QCTT2R3B.js +0 -2
  142. package/dist/scheduler-ZGB7IKZQ.js +0 -2
  143. package/dist/seat-CFY7LMPS.js +0 -2
  144. package/dist/select-MU52ACKG.js +0 -2
  145. package/dist/self-ELWZIMVY.js +0 -2
  146. package/dist/set-enabled-XRNSYEI3.js +0 -2
  147. package/dist/tool-W6M7GYRZ.js +0 -8
  148. package/dist/tool-W6M7GYRZ.js.map +0 -1
  149. package/dist/wiki-VP6XRWIS.js +0 -2
  150. package/dist/wiki-enrich-LUFXPUYY.js +0 -2
  151. /package/dist/{absorb-eval-HRWWPKT3.js.map → absorb-eval-7KMQJ5BR.js.map} +0 -0
  152. /package/dist/{agent-3B4RMEDI.js.map → agent-PJBGUZMR.js.map} +0 -0
  153. /package/dist/{chunk-PMSL4A5Y.js.map → chunk-35GSB7SK.js.map} +0 -0
  154. /package/dist/{chunk-XH36J3Z2.js.map → chunk-3K3IBV5K.js.map} +0 -0
  155. /package/dist/{chunk-ZALVAXQ4.js.map → chunk-3LMBT5LK.js.map} +0 -0
  156. /package/dist/{chunk-F2FJXKDG.js.map → chunk-425HPUKF.js.map} +0 -0
  157. /package/dist/{chunk-PX7PWXBI.js.map → chunk-4O6ZFYWT.js.map} +0 -0
  158. /package/dist/{chunk-2GCPSAXQ.js.map → chunk-BN5JVELZ.js.map} +0 -0
  159. /package/dist/{chunk-LQIF2OHS.js.map → chunk-BY5CN7C7.js.map} +0 -0
  160. /package/dist/{chunk-HOZZUN47.js.map → chunk-DHD4KUTW.js.map} +0 -0
  161. /package/dist/{chunk-KE6BF4ZJ.js.map → chunk-GMP2IB4E.js.map} +0 -0
  162. /package/dist/{chunk-K2BEV3BD.js.map → chunk-HIHROVHC.js.map} +0 -0
  163. /package/dist/{chunk-KXJRXRSD.js.map → chunk-HOL645BZ.js.map} +0 -0
  164. /package/dist/{chunk-7L54Z4EH.js.map → chunk-HUOR3FGJ.js.map} +0 -0
  165. /package/dist/{chunk-V7FZBETJ.js.map → chunk-IOCULCCJ.js.map} +0 -0
  166. /package/dist/{chunk-6V5JBHUN.js.map → chunk-J7PZJRYO.js.map} +0 -0
  167. /package/dist/{chunk-F3CMNSON.js.map → chunk-K3623S4U.js.map} +0 -0
  168. /package/dist/{chunk-2KYGPVTX.js.map → chunk-KB5JMDGS.js.map} +0 -0
  169. /package/dist/{chunk-HNZEXUNM.js.map → chunk-OVB3LW6L.js.map} +0 -0
  170. /package/dist/{chunk-6NQ7KYJH.js.map → chunk-OXTFAV2A.js.map} +0 -0
  171. /package/dist/{chunk-VX4PSOKU.js.map → chunk-QABY3WEM.js.map} +0 -0
  172. /package/dist/{chunk-M2E3CNFS.js.map → chunk-R3TH2OG7.js.map} +0 -0
  173. /package/dist/{chunk-UOIWIVU3.js.map → chunk-RLI32DLG.js.map} +0 -0
  174. /package/dist/{chunk-RW5FKJRE.js.map → chunk-SK7M6PS6.js.map} +0 -0
  175. /package/dist/{chunk-BOCLWYWL.js.map → chunk-TBS7OVMI.js.map} +0 -0
  176. /package/dist/{chunk-FO762MEC.js.map → chunk-TKXZHRV3.js.map} +0 -0
  177. /package/dist/{chunk-PO2SORKY.js.map → chunk-WFPLZLCF.js.map} +0 -0
  178. /package/dist/{client-YN3T56NM.js.map → client-ZHE4B2DD.js.map} +0 -0
  179. /package/dist/{config-G7T3TMWE.js.map → config-THBWCNN7.js.map} +0 -0
  180. /package/dist/{config-mutate-6CRKZQVQ.js.map → config-mutate-FBX6TFCY.js.map} +0 -0
  181. /package/dist/{config-mutator-7VS3J5BY.js.map → config-mutator-33RBNPV4.js.map} +0 -0
  182. /package/dist/{doctor-GFZZTK7C.js.map → doctor-VMWX6GKN.js.map} +0 -0
  183. /package/dist/{hub-B434CABZ.js.map → hub-WPC6MTZY.js.map} +0 -0
  184. /package/dist/{note-tool-ANQWBBZE.js.map → note-tool-KVH3YBTX.js.map} +0 -0
  185. /package/dist/{ntfy-Q4YHFKWW.js.map → ntfy-73UW6GHN.js.map} +0 -0
  186. /package/dist/{promote-3P6PGJOW.js.map → promote-WWPXP5Z4.js.map} +0 -0
  187. /package/dist/{push-PRFZMCIK.js.map → push-E5YKRFAW.js.map} +0 -0
  188. /package/dist/{push-bridge-NR7SLHGX.js.map → push-bridge-RV3CBTYO.js.map} +0 -0
  189. /package/dist/{query-E4V7TS5S.js.map → query-F7HRTCWI.js.map} +0 -0
  190. /package/dist/{query-settings-C5UBKJMN.js.map → query-settings-Z32LXLJI.js.map} +0 -0
  191. /package/dist/{registry-IG324PR3.js.map → registry-D5HHCFCC.js.map} +0 -0
  192. /package/dist/{routing-2IBIZYQU.js.map → routing-USMMBJYT.js.map} +0 -0
  193. /package/dist/{schedule-tool-QCTT2R3B.js.map → schedule-tool-IRTB23XL.js.map} +0 -0
  194. /package/dist/{scheduler-ZGB7IKZQ.js.map → scheduler-L4ERAOMG.js.map} +0 -0
  195. /package/dist/{seat-CFY7LMPS.js.map → seat-3LW672DM.js.map} +0 -0
  196. /package/dist/{self-ELWZIMVY.js.map → self-HICJTWYO.js.map} +0 -0
  197. /package/dist/{wiki-VP6XRWIS.js.map → wiki-CRH6XAXE.js.map} +0 -0
  198. /package/dist/{wiki-enrich-LUFXPUYY.js.map → wiki-enrich-YZEW6RZT.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/workflows/follow-up-tool.ts"],"sourcesContent":["import { resolveScheduleCaller } from \"@/crons/schedule-tool\"\nimport { callerHeaders } from \"@/calls/service\"\n\n// --- Agent-facing `agentx_workflow` tool (#788) ---\n//\n// A request with several steps is run as a workflow, not by hand:\n// match saved workflows that fit the request in front of you\n// start start one (workflowId), or build one from the owner's words\n// (title + steps) and run it; tags say what it concerns\n// status one run: the step it is on and what it waits on\n// list every follow-up still going, grouped by tag\n// done the step you own is finished (evidence)\n// blocked your step cannot go on without the owner (reason)\n// propose ask the owner to keep a workflow as a reusable template\n// plan write or change the plan of the run your task is wrapped in\n// step report a step of that plan (started, done, failed)\n// It talks to the daemon's /follow-up endpoints.\n\nexport interface WorkflowToolDeps {\n daemonUrl: string\n fetch?: typeof fetch\n env?: NodeJS.ProcessEnv\n}\n\nconst str = (v: unknown) => (typeof v === \"string\" ? v.trim() : \"\")\n\nfunction describe(run: any): string {\n const lines = [\n `Run ${run.runId} \"${run.title}\" [${run.status}] on step ${run.step}: waiting on ${run.waitingOn}.`,\n run.tags?.length ? `Tags: ${run.tags.join(\", \")}` : \"\",\n ...(run.steps ?? []).slice(-8).map((s: any) => `- ${String(s.at).slice(0, 16).replace(\"T\", \" \")} ${s.step} ${s.status}${s.note ? `: ${s.note}` : \"\"}`),\n ]\n return lines.filter(Boolean).join(\"\\n\")\n}\n\n/** Returns the text the agent sees. Every refusal is text, never a throw. */\nexport async function runWorkflowTool(args: Record<string, unknown>, deps: WorkflowToolDeps): Promise<string> {\n const doFetch = deps.fetch ?? fetch\n const base = deps.daemonUrl.replace(/\\/$/, \"\")\n const action = (str(args.action) || \"list\").toLowerCase()\n const env = deps.env ?? process.env\n const read = async (path: string) => {\n const res = await doFetch(`${base}${path}`, { signal: AbortSignal.timeout(10_000) })\n const data = await res.json().catch(() => ({})) as any\n return { ok: res.ok, status: res.status, data }\n }\n\n try {\n if (action === \"list\") {\n const r = await read(\"/follow-up\")\n if (!r.ok) return `Error: ${r.data?.error || `HTTP ${r.status}`}`\n const groups = r.data.groups ?? []\n if (!groups.length) return \"No follow-up workflows are running.\"\n return groups.map((g: any) => [`${g.tag}:`, ...g.rows.map((row: any) => `- ${row.runId} \"${row.title}\" on ${row.step}: waiting on ${row.waitingOn} (since ${String(row.since).slice(0, 16).replace(\"T\", \" \")} UTC)`)].join(\"\\n\")).join(\"\\n\")\n }\n if (action === \"match\") {\n const q = str(args.request) || str(args.title)\n if (!q) return \"Error: match needs `request`: the owner's request in their words.\"\n const caller = resolveScheduleCaller(args, env)\n const r = await read(`/follow-up/match?q=${encodeURIComponent(q)}${caller ? `&agentId=${encodeURIComponent(caller.agentId)}` : \"\"}`)\n if (!r.ok) return `Error: ${r.data?.error || `HTTP ${r.status}`}`\n const matches = r.data.matches ?? []\n if (!matches.length) return \"No saved workflow fits. If the request has several steps, build one: start with title and steps.\"\n return [\n \"Saved workflows, best fit first (confidence 0-1):\",\n ...matches.map((x: any) => `- ${x.workflowId} \"${x.title}\" (${x.confidence}${x.autoStart ? \", starts without asking\" : \"\"}): ${x.steps.map((s: any) => s.id).join(\" → \")}`),\n `Start one with {action:\"start\", workflowId:\"<id>\", title:\"…\", tags:[\"client:<name>\"]}. Run its steps through the workflow, not by hand.`,\n ].join(\"\\n\")\n }\n if (action === \"status\") {\n const runId = str(args.runId)\n if (!runId) return \"Error: status needs runId.\"\n const r = await read(`/follow-up/${encodeURIComponent(runId)}`)\n if (!r.ok) return `Error: ${r.data?.error || `HTTP ${r.status}`}`\n return describe(r.data.run)\n }\n\n const caller = resolveScheduleCaller(args, env)\n if (!caller) return \"Error: couldn't tell which agent you are. Pass callerAgentId.\"\n const res = await doFetch(`${base}/follow-up`, {\n method: \"POST\",\n // The headers name this run: the daemon refuses a write that does\n // not come from a running turn of the agent.\n headers: { \"Content-Type\": \"application/json\", ...callerHeaders(env) },\n body: JSON.stringify({\n action, agentId: caller.agentId,\n workflowId: args.workflowId, title: args.title, description: args.description, tags: args.tags, inputs: args.inputs,\n steps: args.steps, edges: args.edges, approval: args.approval, autoStart: args.autoStart, requestId: args.requestId,\n runId: args.runId, step: args.step, evidence: args.evidence, note: args.note, reason: args.reason, fromRun: args.fromRun, status: args.status,\n }),\n signal: AbortSignal.timeout(20_000),\n })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n if (action === \"start\") {\n const run = data.run\n return [\n `Started run ${run.runId} \"${run.title}\"${data.built ? \" (built from the steps you gave; propose it with fromRun to keep it)\" : \"\"}.`,\n data.awaitingApproval ? \"It waits for the owner's approval before the first step.\" : `It is on step ${run.step}: ${run.waitingOn}.`,\n \"AgentX follows it from here: it starts each step, reminds whoever is slow, and tells the owner when it ends. Do not run its steps by hand.\",\n ...(data.warning ? [`Note: ${data.warning}`] : []),\n ].join(\" \")\n }\n if (action === \"plan\") {\n return [\n `Plan recorded on run ${data.run?.runId ?? args.runId}:`,\n ...(data.plan ?? []).map((s: any) => `- ${s.id} ${s.title}`),\n `Report each step with {action:\"step\", runId, step:\"<id>\", status:\"started\"|\"done\"|\"failed\"}.`,\n ].join(\"\\n\")\n }\n if (action === \"step\") return `Step recorded. ${data.run ? describe(data.run) : \"\"}`.trim()\n if (action === \"done\") return `Step recorded as done. ${data.run ? describe(data.run) : \"\"}`.trim()\n if (action === \"blocked\") return \"The step is marked blocked and the owner is told. Nothing more happens on it until it is sorted.\"\n return `Saved ${data.workflowId} switched off, and asked the owner (card ${data.cardId}) whether to keep it as a reusable workflow.`\n } catch (e: any) {\n return `Error: couldn't reach the daemon (${e?.message ?? e}).`\n }\n}\n"],"mappings":"4bAwBA,IAAMA,EAAOC,GAAgB,OAAOA,GAAM,SAAWA,EAAE,KAAK,EAAI,GAEhE,SAASC,EAASC,EAAkB,CAMlC,MALc,CACZ,OAAOA,EAAI,UAAUA,EAAI,WAAWA,EAAI,mBAAmBA,EAAI,oBAAoBA,EAAI,aACvFA,EAAI,MAAM,OAAS,SAASA,EAAI,KAAK,KAAK,IAAI,IAAM,GACpD,IAAIA,EAAI,OAAS,CAAC,GAAG,MAAM,EAAE,EAAE,IAAK,GAAW,KAAK,OAAO,EAAE,EAAE,EAAE,MAAM,EAAG,EAAE,EAAE,QAAQ,IAAK,GAAG,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAO,KAAK,EAAE,OAAS,IAAI,CACvJ,EACa,OAAO,OAAO,EAAE,KAAK;AAAA,CAAI,CACxC,CAGA,eAAsBC,EAAgBC,EAA+BC,EAAyC,CAC5G,IAAMC,EAAUD,EAAK,OAAS,MACxBE,EAAOF,EAAK,UAAU,QAAQ,MAAO,EAAE,EACvCG,GAAUT,EAAIK,EAAK,MAAM,GAAK,QAAQ,YAAY,EAClDK,EAAMJ,EAAK,KAAO,QAAQ,IAC1BK,EAAO,MAAOC,GAAiB,CACnC,IAAMC,EAAM,MAAMN,EAAQ,GAAGC,IAAOI,IAAQ,CAAE,OAAQ,YA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yE,MAChIA,EAAK,iBAAmB,2DAA6D,iBAAiBX,EAAI,SAASA,EAAI,aACvH,6IACA,GAAIW,EAAK,QAAU,CAAC,SAASA,EAAK,SAAS,EAAI,CAAC,CAClD,EAAE,KAAK,GAAG,EAEZ,OAAIL,IAAW,OACN,CACL,wBAAwBK,EAAK,KAAK,OAAST,EAAK,SAChD,IAAIS,EAAK,MAAQ,CAAC,GAAG,IAAKU,GAAW,KAAKA,EAAE,MAAMA,EAAE,OAAO,EAC3D,8FACF,EAAE,KAAK;AAAA,CAAI,EAETf,IAAW,OAAe,kBAAkBK,EAAK,IAAMZ,EAASY,EAAK,GAAG,EAAI,KAAK,KAAK,EACtFL,IAAW,OAAe,0BAA0BK,EAAK,IAAMZ,EAASY,EAAK,GAAG,EAAI,KAAK,KAAK,EAC9FL,IAAW,UAAkB,mGAC1B,SAASK,EAAK,sDAAsDA,EAAK,oDAClF,OAASa,EAAP,CACA,MAAO,qCAAqCA,GAAG,SAAWA,KAC5D,CACF","names":["str","v","describe","run","runWorkflowTool","args","deps","doFetch","base","action","env","read","path","res","data","r","groups","g","row","q","caller","resolveScheduleCaller","matches","x","s","runId","callerHeaders","e"]}
1
+ {"version":3,"sources":["../src/workflows/follow-up-tool.ts"],"sourcesContent":["import { resolveScheduleCaller } from \"@/crons/schedule-tool\"\nimport { callerHeaders } from \"@/calls/service\"\n\n// --- Agent-facing `agentx_workflow` tool (#788) ---\n//\n// A request with several steps is run as a workflow, not by hand:\n// match saved workflows that fit the request in front of you\n// start start one (workflowId), or build one from the owner's words\n// (title + steps) and run it; tags say what it concerns\n// status one run: the step it is on and what it waits on\n// list every follow-up still going, grouped by tag\n// done the step you own is finished (evidence)\n// blocked your step cannot go on without the owner (reason)\n// propose ask the owner to keep a workflow as a reusable template\n// plan write or change the plan of the run your task is wrapped in\n// step report a step of that plan (started, done, failed)\n// It talks to the daemon's /follow-up endpoints.\n\nexport interface WorkflowToolDeps {\n daemonUrl: string\n fetch?: typeof fetch\n env?: NodeJS.ProcessEnv\n}\n\nconst str = (v: unknown) => (typeof v === \"string\" ? v.trim() : \"\")\n\nfunction describe(run: any): string {\n const lines = [\n `Run ${run.runId} \"${run.title}\" [${run.status}] on step ${run.step}: waiting on ${run.waitingOn}.`,\n run.tags?.length ? `Tags: ${run.tags.join(\", \")}` : \"\",\n ...(run.steps ?? []).slice(-8).map((s: any) => `- ${String(s.at).slice(0, 16).replace(\"T\", \" \")} ${s.step} ${s.status}${s.note ? `: ${s.note}` : \"\"}`),\n ]\n return lines.filter(Boolean).join(\"\\n\")\n}\n\n/** Returns the text the agent sees. Every refusal is text, never a throw. */\nexport async function runWorkflowTool(args: Record<string, unknown>, deps: WorkflowToolDeps): Promise<string> {\n const doFetch = deps.fetch ?? fetch\n const base = deps.daemonUrl.replace(/\\/$/, \"\")\n const action = (str(args.action) || \"list\").toLowerCase()\n const env = deps.env ?? process.env\n const read = async (path: string) => {\n const res = await doFetch(`${base}${path}`, { signal: AbortSignal.timeout(10_000) })\n const data = await res.json().catch(() => ({})) as any\n return { ok: res.ok, status: res.status, data }\n }\n\n try {\n if (action === \"list\") {\n const r = await read(\"/follow-up\")\n if (!r.ok) return `Error: ${r.data?.error || `HTTP ${r.status}`}`\n const groups = r.data.groups ?? []\n if (!groups.length) return \"No follow-up workflows are running.\"\n return groups.map((g: any) => [`${g.tag}:`, ...g.rows.map((row: any) => `- ${row.runId} \"${row.title}\" on ${row.step}: waiting on ${row.waitingOn} (since ${String(row.since).slice(0, 16).replace(\"T\", \" \")} UTC)`)].join(\"\\n\")).join(\"\\n\")\n }\n if (action === \"match\") {\n const q = str(args.request) || str(args.title)\n if (!q) return \"Error: match needs `request`: the owner's request in their words.\"\n const caller = resolveScheduleCaller(args, env)\n const r = await read(`/follow-up/match?q=${encodeURIComponent(q)}${caller ? `&agentId=${encodeURIComponent(caller.agentId)}` : \"\"}`)\n if (!r.ok) return `Error: ${r.data?.error || `HTTP ${r.status}`}`\n const matches = r.data.matches ?? []\n if (!matches.length) return \"No saved workflow fits. If the request has several steps, build one: start with title and steps.\"\n return [\n \"Saved workflows, best fit first (confidence 0-1):\",\n ...matches.map((x: any) => `- ${x.workflowId} \"${x.title}\" (${x.confidence}${x.autoStart ? \", starts without asking\" : \"\"}): ${x.steps.map((s: any) => s.id).join(\" → \")}`),\n `Start one with {action:\"start\", workflowId:\"<id>\", title:\"…\", tags:[\"client:<name>\"]}. Run its steps through the workflow, not by hand.`,\n ].join(\"\\n\")\n }\n if (action === \"status\") {\n const runId = str(args.runId)\n if (!runId) return \"Error: status needs runId.\"\n const r = await read(`/follow-up/${encodeURIComponent(runId)}`)\n if (!r.ok) return `Error: ${r.data?.error || `HTTP ${r.status}`}`\n return describe(r.data.run)\n }\n\n const caller = resolveScheduleCaller(args, env)\n if (!caller) return \"Error: couldn't tell which agent you are. Pass callerAgentId.\"\n const res = await doFetch(`${base}/follow-up`, {\n method: \"POST\",\n // The headers name this run: the daemon refuses a write that does\n // not come from a running turn of the agent.\n headers: { \"Content-Type\": \"application/json\", ...callerHeaders(env) },\n body: JSON.stringify({\n action, agentId: caller.agentId,\n workflowId: args.workflowId, title: args.title, description: args.description, tags: args.tags, inputs: args.inputs,\n steps: args.steps, edges: args.edges, approval: args.approval, autoStart: args.autoStart, requestId: args.requestId,\n runId: args.runId, step: args.step, evidence: args.evidence, note: args.note, reason: args.reason, fromRun: args.fromRun, status: args.status,\n }),\n signal: AbortSignal.timeout(20_000),\n })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n if (action === \"start\") {\n const run = data.run\n return [\n `Started run ${run.runId} \"${run.title}\"${data.built ? \" (built from the steps you gave; propose it with fromRun to keep it)\" : \"\"}.`,\n data.awaitingApproval ? \"It waits for the owner's approval before the first step.\" : `It is on step ${run.step}: ${run.waitingOn}.`,\n \"AgentX follows it from here: it starts each step, reminds whoever is slow, and tells the owner when it ends. Do not run its steps by hand.\",\n ...(data.warning ? [`Note: ${data.warning}`] : []),\n ].join(\" \")\n }\n if (action === \"plan\") {\n return [\n `Plan recorded on run ${data.run?.runId ?? args.runId}:`,\n ...(data.plan ?? []).map((s: any) => `- ${s.id} ${s.title}`),\n `Report each step with {action:\"step\", runId, step:\"<id>\", status:\"started\"|\"done\"|\"failed\"}.`,\n ].join(\"\\n\")\n }\n if (action === \"step\") return `Step recorded. ${data.run ? describe(data.run) : \"\"}`.trim()\n if (action === \"done\") return `Step recorded as done. ${data.run ? describe(data.run) : \"\"}`.trim()\n if (action === \"blocked\") return \"The step is marked blocked and the owner is told. Nothing more happens on it until it is sorted.\"\n return `Saved ${data.workflowId} switched off, and asked the owner (card ${data.cardId}) whether to keep it as a reusable workflow.`\n } catch (e: any) {\n return `Error: couldn't reach the daemon (${e?.message ?? e}).`\n }\n}\n"],"mappings":"wdAwBA,IAAMA,EAAOC,GAAgB,OAAOA,GAAM,SAAWA,EAAE,KAAK,EAAI,GAEhE,SAASC,EAASC,EAAkB,CAMlC,MALc,CACZ,OAAOA,EAAI,UAAUA,EAAI,WAAWA,EAAI,mBAAmBA,EAAI,oBAAoBA,EAAI,aACvFA,EAAI,MAAM,OAAS,SAASA,EAAI,KAAK,KAAK,IAAI,IAAM,GACpD,IAAIA,EAAI,OAAS,CAAC,GAAG,MAAM,EAAE,EAAE,IAAK,GAAW,KAAK,OAAO,EAAE,EAAE,EAAE,MAAM,EAAG,EAAE,EAAE,QAAQ,IAAK,GAAG,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAO,KAAK,EAAE,OAAS,IAAI,CACvJ,EACa,OAAO,OAAO,EAAE,KAAK;AAAA,CAAI,CACxC,CAGA,eAAsBC,EAAgBC,EAA+BC,EAAyC,CAC5G,IAAMC,EAAUD,EAAK,OAAS,MACxBE,EAAOF,EAAK,UAAU,QAAQ,MAAO,EAAE,EACvCG,GAAUT,EAAIK,EAAK,MAAM,GAAK,QAAQ,YAAY,EAClDK,EAAMJ,EAAK,KAAO,QAAQ,IAC1BK,EAAO,MAAO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EAAMW,EAAK,IACjB,MAAO,CACL,eAAeX,EAAI,UAAUA,EAAI,SAASW,EAAK,MAAQ,uEAAyE,MAChIA,EAAK,iBAAmB,2DAA6D,iBAAiBX,EAAI,SAASA,EAAI,aACvH,6IACA,GAAIW,EAAK,QAAU,CAAC,SAASA,EAAK,SAAS,EAAI,CAAC,CAClD,EAAE,KAAK,GAAG,EAEZ,OAAIL,IAAW,OACN,CACL,wBAAwBK,EAAK,KAAK,OAAST,EAAK,SAChD,IAAIS,EAAK,MAAQ,CAAC,GAAG,IAAKU,GAAW,KAAKA,EAAE,MAAMA,EAAE,OAAO,EAC3D,8FACF,EAAE,KAAK;AAAA,CAAI,EAETf,IAAW,OAAe,kBAAkBK,EAAK,IAAMZ,EAASY,EAAK,GAAG,EAAI,KAAK,KAAK,EACtFL,IAAW,OAAe,0BAA0BK,EAAK,IAAMZ,EAASY,EAAK,GAAG,EAAI,KAAK,KAAK,EAC9FL,IAAW,UAAkB,mGAC1B,SAASK,EAAK,sDAAsDA,EAAK,oDAClF,OAASa,EAAP,CACA,MAAO,qCAAqCA,GAAG,SAAWA,KAC5D,CACF","names":["str","v","describe","run","runWorkflowTool","args","deps","doFetch","base","action","env","read","path","res","data","r","groups","g","row","q","caller","resolveScheduleCaller","matches","x","s","runId","callerHeaders","e"]}
@@ -0,0 +1,2 @@
1
+ import{a}from"./chunk-SK7M6PS6.js";import"./chunk-3LMBT5LK.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-OXTFAV2A.js";import"./chunk-WPNRDEHW.js";import"./chunk-KB5JMDGS.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-AHWWJ7AF.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-SNYAM7YB.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-BMNDAEF4.js";import"./chunk-VQRY4IDI.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{a as WikiHub};
2
+ //# sourceMappingURL=hub-WPC6MTZY.js.map
package/dist/index.d.ts CHANGED
@@ -2248,6 +2248,11 @@ declare const cronJobSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<
2248
2248
  why: string;
2249
2249
  metric: string;
2250
2250
  }>>;
2251
+ /** The goal record it serves (#1568), by id. Once the goal is done or
2252
+ * dropped the job stops running (its config is left as it is: the Wall
2253
+ * asks whether to turn it off), and each run's prompt starts with the
2254
+ * goal's current state instead of numbers written into the prompt. */
2255
+ goal: z.ZodOptional<z.ZodString>;
2251
2256
  schedule: z.ZodString;
2252
2257
  timezone: z.ZodDefault<z.ZodString>;
2253
2258
  agent: z.ZodString;
@@ -2366,6 +2371,7 @@ declare const cronJobSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<
2366
2371
  } | undefined;
2367
2372
  taskType?: string | undefined;
2368
2373
  createdBy?: string | undefined;
2374
+ goal?: string | undefined;
2369
2375
  approval?: {
2370
2376
  action: "delete" | "create";
2371
2377
  requestedBy: string;
@@ -2398,6 +2404,7 @@ declare const cronJobSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<
2398
2404
  } | undefined;
2399
2405
  taskType?: string | undefined;
2400
2406
  createdBy?: string | undefined;
2407
+ goal?: string | undefined;
2401
2408
  approval?: {
2402
2409
  action: "delete" | "create";
2403
2410
  requestedBy: string;
@@ -2432,6 +2439,7 @@ declare const cronJobSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<
2432
2439
  } | undefined;
2433
2440
  taskType?: string | undefined;
2434
2441
  createdBy?: string | undefined;
2442
+ goal?: string | undefined;
2435
2443
  approval?: {
2436
2444
  action: "delete" | "create";
2437
2445
  requestedBy: string;
@@ -2464,6 +2472,7 @@ declare const cronJobSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<
2464
2472
  } | undefined;
2465
2473
  taskType?: string | undefined;
2466
2474
  createdBy?: string | undefined;
2475
+ goal?: string | undefined;
2467
2476
  approval?: {
2468
2477
  action: "delete" | "create";
2469
2478
  requestedBy: string;
@@ -2498,6 +2507,7 @@ declare const cronJobSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<
2498
2507
  } | undefined;
2499
2508
  taskType?: string | undefined;
2500
2509
  createdBy?: string | undefined;
2510
+ goal?: string | undefined;
2501
2511
  approval?: {
2502
2512
  action: "delete" | "create";
2503
2513
  requestedBy: string;
@@ -2530,6 +2540,7 @@ declare const cronJobSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<
2530
2540
  } | undefined;
2531
2541
  taskType?: string | undefined;
2532
2542
  createdBy?: string | undefined;
2543
+ goal?: string | undefined;
2533
2544
  approval?: {
2534
2545
  action: "delete" | "create";
2535
2546
  requestedBy: string;
@@ -2564,6 +2575,7 @@ declare const cronJobSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<
2564
2575
  } | undefined;
2565
2576
  taskType?: string | undefined;
2566
2577
  createdBy?: string | undefined;
2578
+ goal?: string | undefined;
2567
2579
  approval?: {
2568
2580
  action: "delete" | "create";
2569
2581
  requestedBy: string;
@@ -2596,6 +2608,7 @@ declare const cronJobSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<
2596
2608
  } | undefined;
2597
2609
  taskType?: string | undefined;
2598
2610
  createdBy?: string | undefined;
2611
+ goal?: string | undefined;
2599
2612
  approval?: {
2600
2613
  action: "delete" | "create";
2601
2614
  requestedBy: string;
@@ -5220,6 +5233,11 @@ declare const daemonConfigSchema: z.ZodObject<{
5220
5233
  why: string;
5221
5234
  metric: string;
5222
5235
  }>>;
5236
+ /** The goal record it serves (#1568), by id. Once the goal is done or
5237
+ * dropped the job stops running (its config is left as it is: the Wall
5238
+ * asks whether to turn it off), and each run's prompt starts with the
5239
+ * goal's current state instead of numbers written into the prompt. */
5240
+ goal: z.ZodOptional<z.ZodString>;
5223
5241
  schedule: z.ZodString;
5224
5242
  timezone: z.ZodDefault<z.ZodString>;
5225
5243
  agent: z.ZodString;
@@ -5338,6 +5356,7 @@ declare const daemonConfigSchema: z.ZodObject<{
5338
5356
  } | undefined;
5339
5357
  taskType?: string | undefined;
5340
5358
  createdBy?: string | undefined;
5359
+ goal?: string | undefined;
5341
5360
  approval?: {
5342
5361
  action: "delete" | "create";
5343
5362
  requestedBy: string;
@@ -5370,6 +5389,7 @@ declare const daemonConfigSchema: z.ZodObject<{
5370
5389
  } | undefined;
5371
5390
  taskType?: string | undefined;
5372
5391
  createdBy?: string | undefined;
5392
+ goal?: string | undefined;
5373
5393
  approval?: {
5374
5394
  action: "delete" | "create";
5375
5395
  requestedBy: string;
@@ -5404,6 +5424,7 @@ declare const daemonConfigSchema: z.ZodObject<{
5404
5424
  } | undefined;
5405
5425
  taskType?: string | undefined;
5406
5426
  createdBy?: string | undefined;
5427
+ goal?: string | undefined;
5407
5428
  approval?: {
5408
5429
  action: "delete" | "create";
5409
5430
  requestedBy: string;
@@ -5436,6 +5457,7 @@ declare const daemonConfigSchema: z.ZodObject<{
5436
5457
  } | undefined;
5437
5458
  taskType?: string | undefined;
5438
5459
  createdBy?: string | undefined;
5460
+ goal?: string | undefined;
5439
5461
  approval?: {
5440
5462
  action: "delete" | "create";
5441
5463
  requestedBy: string;
@@ -5470,6 +5492,7 @@ declare const daemonConfigSchema: z.ZodObject<{
5470
5492
  } | undefined;
5471
5493
  taskType?: string | undefined;
5472
5494
  createdBy?: string | undefined;
5495
+ goal?: string | undefined;
5473
5496
  approval?: {
5474
5497
  action: "delete" | "create";
5475
5498
  requestedBy: string;
@@ -5502,6 +5525,7 @@ declare const daemonConfigSchema: z.ZodObject<{
5502
5525
  } | undefined;
5503
5526
  taskType?: string | undefined;
5504
5527
  createdBy?: string | undefined;
5528
+ goal?: string | undefined;
5505
5529
  approval?: {
5506
5530
  action: "delete" | "create";
5507
5531
  requestedBy: string;
@@ -5536,6 +5560,7 @@ declare const daemonConfigSchema: z.ZodObject<{
5536
5560
  } | undefined;
5537
5561
  taskType?: string | undefined;
5538
5562
  createdBy?: string | undefined;
5563
+ goal?: string | undefined;
5539
5564
  approval?: {
5540
5565
  action: "delete" | "create";
5541
5566
  requestedBy: string;
@@ -5568,6 +5593,7 @@ declare const daemonConfigSchema: z.ZodObject<{
5568
5593
  } | undefined;
5569
5594
  taskType?: string | undefined;
5570
5595
  createdBy?: string | undefined;
5596
+ goal?: string | undefined;
5571
5597
  approval?: {
5572
5598
  action: "delete" | "create";
5573
5599
  requestedBy: string;
@@ -5757,6 +5783,11 @@ declare const daemonConfigSchema: z.ZodObject<{
5757
5783
  * Unset: `push` (the phone app) when channels.push is enabled, else
5758
5784
  * `ntfy`, so upgrading never points notify at a channel that is off. */
5759
5785
  channel: z.ZodOptional<z.ZodString>;
5786
+ /** The address the phone opens the Hub at, such as
5787
+ * https://my-mac.example.ts.net (#1652). A tap on an ntfy push opens
5788
+ * its own link, else its request on the Hub, else the Hub. Unset: a
5789
+ * push without a link of its own opens nothing. */
5790
+ publicUrl: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
5760
5791
  /** Notify on these events */
5761
5792
  on: z.ZodDefault<z.ZodObject<{
5762
5793
  taskComplete: z.ZodDefault<z.ZodBoolean>;
@@ -5905,6 +5936,7 @@ declare const daemonConfigSchema: z.ZodObject<{
5905
5936
  chatId: string;
5906
5937
  accountId?: string | undefined;
5907
5938
  } | undefined;
5939
+ publicUrl?: string | undefined;
5908
5940
  }, {
5909
5941
  local?: {
5910
5942
  sound?: boolean | undefined;
@@ -5926,6 +5958,7 @@ declare const daemonConfigSchema: z.ZodObject<{
5926
5958
  chatId: string;
5927
5959
  accountId?: string | undefined;
5928
5960
  } | undefined;
5961
+ publicUrl?: string | undefined;
5929
5962
  told?: {
5930
5963
  enabled?: boolean | undefined;
5931
5964
  channels?: string[] | undefined;
@@ -5982,6 +6015,24 @@ declare const daemonConfigSchema: z.ZodObject<{
5982
6015
  retryMinutes?: number | undefined;
5983
6016
  maxWaitMinutes?: number | undefined;
5984
6017
  }>>;
6018
+ /** Ringing the phone (#1605). A voice call also goes to the phone as a
6019
+ * call push (ntfy at priority 5 when urgent, else 4, tagged as a call;
6020
+ * Web Push that stays on screen), and the phone app answers it. */
6021
+ phone: z.ZodDefault<z.ZodObject<{
6022
+ /** "always": the phone rings with the widget, and the first to answer
6023
+ * takes the call. "away": only when AgentX Voice is not running. */
6024
+ ring: z.ZodDefault<z.ZodEnum<["always", "away"]>>;
6025
+ /** The address the phone opens the app at, such as
6026
+ * https://my-mac.example.ts.net (what `agentx app pair` showed). ntfy
6027
+ * needs it so a tap opens the call; Web Push does not. */
6028
+ appUrl: z.ZodOptional<z.ZodString>;
6029
+ }, "strip", z.ZodTypeAny, {
6030
+ ring: "always" | "away";
6031
+ appUrl?: string | undefined;
6032
+ }, {
6033
+ ring?: "always" | "away" | undefined;
6034
+ appUrl?: string | undefined;
6035
+ }>>;
5985
6036
  }, "strip", z.ZodTypeAny, {
5986
6037
  summary: boolean;
5987
6038
  allow: string[];
@@ -5995,6 +6046,10 @@ declare const daemonConfigSchema: z.ZodObject<{
5995
6046
  maxCallMinutes: number;
5996
6047
  ringSeconds: number;
5997
6048
  ringSound: string;
6049
+ phone: {
6050
+ ring: "always" | "away";
6051
+ appUrl?: string | undefined;
6052
+ };
5998
6053
  }, {
5999
6054
  summary?: boolean | undefined;
6000
6055
  allow?: string[] | undefined;
@@ -6008,6 +6063,10 @@ declare const daemonConfigSchema: z.ZodObject<{
6008
6063
  maxCallMinutes?: number | undefined;
6009
6064
  ringSeconds?: number | undefined;
6010
6065
  ringSound?: string | undefined;
6066
+ phone?: {
6067
+ ring?: "always" | "away" | undefined;
6068
+ appUrl?: string | undefined;
6069
+ } | undefined;
6011
6070
  }>>;
6012
6071
  /** Watched WhatsApp chats triaged by an agent (src/whatsapp-triage). */
6013
6072
  whatsappTriage: z.ZodDefault<z.ZodObject<{
@@ -8914,6 +8973,9 @@ declare const daemonConfigSchema: z.ZodObject<{
8914
8973
  path?: string | undefined;
8915
8974
  }>, z.ZodObject<{
8916
8975
  type: z.ZodLiteral<"gitlab">;
8976
+ /** A list of agentx MCP tool names (session.lean.agentxTools). An unknown
8977
+ * name is an error, not ignored: a misspelt `agentx_channel_reply` would
8978
+ * otherwise leave a lean GitHub session with no way to reply. */
8917
8979
  projects: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
8918
8980
  }, "strip", z.ZodTypeAny, {
8919
8981
  type: "gitlab";
@@ -9442,8 +9504,8 @@ declare const daemonConfigSchema: z.ZodObject<{
9442
9504
  accent: z.ZodOptional<z.ZodString>;
9443
9505
  }, "strip", z.ZodTypeAny, {
9444
9506
  id: string;
9445
- kind: "label" | "open-backlog" | "scoped-label" | "closed";
9446
9507
  title: string;
9508
+ kind: "label" | "open-backlog" | "scoped-label" | "closed";
9447
9509
  scopedPrefix: string;
9448
9510
  mapsToLabel?: string | undefined;
9449
9511
  scopedLabel?: string | undefined;
@@ -9492,8 +9554,8 @@ declare const daemonConfigSchema: z.ZodObject<{
9492
9554
  }[];
9493
9555
  columns: {
9494
9556
  id: string;
9495
- kind: "label" | "open-backlog" | "scoped-label" | "closed";
9496
9557
  title: string;
9558
+ kind: "label" | "open-backlog" | "scoped-label" | "closed";
9497
9559
  scopedPrefix: string;
9498
9560
  mapsToLabel?: string | undefined;
9499
9561
  scopedLabel?: string | undefined;
@@ -9550,7 +9612,7 @@ declare const daemonConfigSchema: z.ZodObject<{
9550
9612
  daemons: z.ZodDefault<z.ZodArray<z.ZodObject<{
9551
9613
  name: z.ZodString;
9552
9614
  url: z.ZodString;
9553
- dashboardUrl: z.ZodOptional<z.ZodString>; /** Service identifier — open string, well-known values in INTEGRATION_KINDS. */
9615
+ dashboardUrl: z.ZodOptional<z.ZodString>;
9554
9616
  token: z.ZodOptional<z.ZodString>;
9555
9617
  dashboardToken: z.ZodOptional<z.ZodString>;
9556
9618
  }, "strip", z.ZodTypeAny, {
@@ -9612,7 +9674,8 @@ declare const daemonConfigSchema: z.ZodObject<{
9612
9674
  threshold?: number | undefined;
9613
9675
  }, {
9614
9676
  threshold?: number | undefined;
9615
- }>>;
9677
+ }>>; /** See systemVoiceSchema. Unset: one is assigned, of the agent's
9678
+ * gender when set, different from every other agent's. */
9616
9679
  }, "strip", z.ZodTypeAny, {
9617
9680
  projects: {
9618
9681
  agents: string[];
@@ -11569,6 +11632,7 @@ declare const daemonConfigSchema: z.ZodObject<{
11569
11632
  } | undefined;
11570
11633
  taskType?: string | undefined;
11571
11634
  createdBy?: string | undefined;
11635
+ goal?: string | undefined;
11572
11636
  approval?: {
11573
11637
  action: "delete" | "create";
11574
11638
  requestedBy: string;
@@ -11742,6 +11806,7 @@ declare const daemonConfigSchema: z.ZodObject<{
11742
11806
  chatId: string;
11743
11807
  accountId?: string | undefined;
11744
11808
  } | undefined;
11809
+ publicUrl?: string | undefined;
11745
11810
  };
11746
11811
  calls: {
11747
11812
  summary: boolean;
@@ -11756,6 +11821,10 @@ declare const daemonConfigSchema: z.ZodObject<{
11756
11821
  maxCallMinutes: number;
11757
11822
  ringSeconds: number;
11758
11823
  ringSound: string;
11824
+ phone: {
11825
+ ring: "always" | "away";
11826
+ appUrl?: string | undefined;
11827
+ };
11759
11828
  };
11760
11829
  whatsappTriage: {
11761
11830
  enabled: boolean;
@@ -11933,8 +12002,8 @@ declare const daemonConfigSchema: z.ZodObject<{
11933
12002
  }[];
11934
12003
  columns: {
11935
12004
  id: string;
11936
- kind: "label" | "open-backlog" | "scoped-label" | "closed";
11937
12005
  title: string;
12006
+ kind: "label" | "open-backlog" | "scoped-label" | "closed";
11938
12007
  scopedPrefix: string;
11939
12008
  mapsToLabel?: string | undefined;
11940
12009
  scopedLabel?: string | undefined;
@@ -12995,6 +13064,7 @@ declare const daemonConfigSchema: z.ZodObject<{
12995
13064
  } | undefined;
12996
13065
  taskType?: string | undefined;
12997
13066
  createdBy?: string | undefined;
13067
+ goal?: string | undefined;
12998
13068
  approval?: {
12999
13069
  action: "delete" | "create";
13000
13070
  requestedBy: string;
@@ -13153,6 +13223,7 @@ declare const daemonConfigSchema: z.ZodObject<{
13153
13223
  chatId: string;
13154
13224
  accountId?: string | undefined;
13155
13225
  } | undefined;
13226
+ publicUrl?: string | undefined;
13156
13227
  told?: {
13157
13228
  enabled?: boolean | undefined;
13158
13229
  channels?: string[] | undefined;
@@ -13183,6 +13254,10 @@ declare const daemonConfigSchema: z.ZodObject<{
13183
13254
  maxCallMinutes?: number | undefined;
13184
13255
  ringSeconds?: number | undefined;
13185
13256
  ringSound?: string | undefined;
13257
+ phone?: {
13258
+ ring?: "always" | "away" | undefined;
13259
+ appUrl?: string | undefined;
13260
+ } | undefined;
13186
13261
  } | undefined;
13187
13262
  whatsappTriage?: {
13188
13263
  enabled?: boolean | undefined;
@@ -14556,6 +14631,9 @@ declare class AgentXDaemon {
14556
14631
  * the requests check, at its own pace, since each check reads the
14557
14632
  * forges. Reports drift to the owner; writes a label only in write mode. */
14558
14633
  private statusDriftTick;
14634
+ /** Goals with a check close by themselves when it is met (#1568), at
14635
+ * the loop checkers' pace. */
14636
+ private checkGoalRecords;
14559
14637
  /** What the loop checkers read (#1039): the forges through the
14560
14638
  * configured connectors, the local clones under requests.checkers.repos,
14561
14639
  * and this node's own record of inbound turns. Built per check, so a
@@ -15047,7 +15125,10 @@ interface FriendlyError {
15047
15125
  | "agent_held"
15048
15126
  /** A cold dispatch held by the plan window, overage gate or local
15049
15127
  * dispatch cap; it goes through once the window frees up (#1284). */
15050
- | "dispatch_hold" | "auth" | "permission" | "rate_limit" | "overloaded" | "context_too_large" | "invalid_request" | "upstream_api" | "timeout" | "cancelled" | "interrupted"
15128
+ | "dispatch_hold"
15129
+ /** Every slot of the agent stayed busy for the whole slot wait; the
15130
+ * message did not run. An event wake retries it (#1596). */
15131
+ | "agent_busy" | "auth" | "permission" | "rate_limit" | "overloaded" | "context_too_large" | "invalid_request" | "upstream_api" | "timeout" | "cancelled" | "interrupted"
15051
15132
  /** Ended by a stop signal; its resume plan is saved (#857). */
15052
15133
  | "stopped" | "unknown";
15053
15134
  /** Whether this error is transient — a retry has a reasonable chance of succeeding. */
@@ -15188,6 +15269,23 @@ interface OutgoingMessage {
15188
15269
  from?: string;
15189
15270
  passed?: boolean;
15190
15271
  };
15272
+ /** Where a tap on a phone notification opens when the message has no
15273
+ * link of its own (#1652): a path on this node, such as a request on
15274
+ * the Hub. A channel that can open links makes it absolute with
15275
+ * `notifications.publicUrl`. */
15276
+ open?: string;
15277
+ /** A voice call on the phone (#1605). "ringing": ntfy sends it as a
15278
+ * call (priority 5 when urgent, else 4, a phone tag, a tap that opens
15279
+ * `url`); Web Push keeps it on screen until tapped. "missed": the same
15280
+ * notification on the phone is replaced where the channel can. */
15281
+ ring?: CallRing;
15282
+ }
15283
+ interface CallRing {
15284
+ callId: string;
15285
+ state: "ringing" | "missed";
15286
+ urgent: boolean;
15287
+ /** Absolute link that opens the call in the phone app, for ntfy. */
15288
+ url?: string;
15191
15289
  }
15192
15290
  interface ChannelAdapter {
15193
15291
  readonly name: string;
@@ -21504,6 +21602,15 @@ interface CronJobState {
21504
21602
  onError: Array<"log" | "notify" | "disable">;
21505
21603
  /** Why it runs and the number that proves it (#1183). */
21506
21604
  value?: CronValue;
21605
+ /** The goal it serves (#1568): once that goal is done or dropped, the
21606
+ * job stops running, and each run gets the goal's current state. */
21607
+ goal?: string;
21608
+ /** Set when a run was skipped because its goal is closed: the Wall
21609
+ * shows "goal done, disable?". */
21610
+ goalClosed?: {
21611
+ state: string;
21612
+ at: Date;
21613
+ };
21507
21614
  /** Send each successful run's answer to the job's `notify` target.
21508
21615
  * True whenever the job has `notify`, unless `deliverResult: false`. */
21509
21616
  deliverResult?: boolean;
@@ -21561,6 +21668,15 @@ interface CronRunResult {
21561
21668
  unsourced?: number;
21562
21669
  }
21563
21670
 
21671
+ interface CronGoalView {
21672
+ /** active, done or dropped. */
21673
+ state: string;
21674
+ /** The goal's state in a few lines, for the prompt. */
21675
+ brief: string;
21676
+ }
21677
+ /** Reads a goal by id; null when this node has no record of it. */
21678
+ type CronGoalSource = (goalId: string) => CronGoalView | null;
21679
+
21564
21680
  type FireNowResult = {
21565
21681
  ok: true;
21566
21682
  runId: string;
@@ -21587,6 +21703,7 @@ declare class CronScheduler {
21587
21703
  private notifyCallback?;
21588
21704
  private deliverCallback?;
21589
21705
  private wikiNotes?;
21706
+ private goalSource?;
21590
21707
  private log;
21591
21708
  constructor(config: DaemonConfig, registry: AgentRegistry, hooks?: HookRegistry, log?: (...args: unknown[]) => void);
21592
21709
  /** Whether a job with this id exists. */
@@ -21606,6 +21723,12 @@ declare class CronScheduler {
21606
21723
  * Called when onError is "notify" or after multiple consecutive failures.
21607
21724
  */
21608
21725
  setNotifyCallback(cb: CronNotifyCallback): void;
21726
+ /** Where `crons.<id>.goal` is read (#1568): the goal records. */
21727
+ setGoalSource(source: CronGoalSource): void;
21728
+ /** The job's goal before a run: skip it when the goal is closed, else
21729
+ * the goal's state for the prompt. A skip is kept on the job, so the
21730
+ * Wall can ask whether to turn it off. */
21731
+ private goalGate;
21609
21732
  /**
21610
21733
  * Set the callback that sends a successful run's answer to the job's
21611
21734
  * `notify` target. Not called for jobs with `deliverResult: false`.
@@ -21632,6 +21755,8 @@ declare class CronScheduler {
21632
21755
  private armTimer;
21633
21756
  private scheduleNext;
21634
21757
  private scheduleRetry;
21758
+ /** The ledger row for a run skipped because its goal is closed (#1568). */
21759
+ private recordGoalHalt;
21635
21760
  /**
21636
21761
  * Phase 1 commit 6.d — record one cron-fire decision in the ledger
21637
21762
  * when the source is enabled. Wrapped in try/catch so a ledger
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{Ma as Tt,Na 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-NT3DGEBE.js";import"./chunk-YWAJNF2A.js";import"./chunk-GTJIKXDB.js";import"./chunk-XH36J3Z2.js";import"./chunk-ZVP6GB4G.js";import"./chunk-M2E3CNFS.js";import"./chunk-IMLAPB7G.js";import"./chunk-VZLIBDLH.js";import"./chunk-EKJG63EJ.js";import"./chunk-LQIF2OHS.js";import"./chunk-6V5JBHUN.js";import"./chunk-2VDO2HEK.js";import"./chunk-5HLD66CW.js";import"./chunk-IS2IWRP7.js";import"./chunk-LQE73AZR.js";import"./chunk-2D3RYIDU.js";import"./chunk-MRIVENBY.js";import"./chunk-BIYEGA7Q.js";import"./chunk-XPZSEDE3.js";import"./chunk-PPUN7YHA.js";import"./chunk-A5GYG56I.js";import"./chunk-FO762MEC.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-UKUH662W.js";import"./chunk-JWDJMFU6.js";import"./chunk-6TTGRTDO.js";import"./chunk-MNG2AMKZ.js";import"./chunk-RX5O5637.js";import"./chunk-5ELIX7BQ.js";import"./chunk-X7UQY7CH.js";import"./chunk-UOYIC7XN.js";import"./chunk-QPABR72X.js";import"./chunk-HOZZUN47.js";import"./chunk-AJ5HMDRW.js";import"./chunk-KP7KDLZ2.js";import"./chunk-XVV7ZZ77.js";import{Ca as yt,m as lt,n as ct,o as dt,p as mt,q as pt}from"./chunk-MB5CBY2C.js";import"./chunk-PO2SORKY.js";import"./chunk-MEFPXHQJ.js";import"./chunk-3FZ6WHKX.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-UOIWIVU3.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-GV7S5BAX.js";import"./chunk-SZDACK6O.js";import"./chunk-VE3SSOQX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-VJVXEVZ7.js";import{t as ut}from"./chunk-MC3ZZA5G.js";import"./chunk-KXJRXRSD.js";import"./chunk-3UOTLMXD.js";import"./chunk-VWTBHLMX.js";import"./chunk-BE64IJWM.js";import"./chunk-5ONH4ITT.js";import"./chunk-JRAG37V5.js";import"./chunk-ILEC3IAV.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-GSX4NK2N.js";import"./chunk-HPRLRD4P.js";import"./chunk-RW5FKJRE.js";import{a as ht}from"./chunk-ZALVAXQ4.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-PMSL4A5Y.js";import"./chunk-JTFCU5LH.js";import{f as gt,g as ft}from"./chunk-6NQ7KYJH.js";import"./chunk-WPNRDEHW.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-HNZEXUNM.js";import{j as it,k as rt,l as at}from"./chunk-2KYGPVTX.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-MYVHVJWZ.js";import"./chunk-QUFIUXMQ.js";import"./chunk-AV7T3SYT.js";import"./chunk-2HBEZV7L.js";import"./chunk-A7JSRDJL.js";import"./chunk-BERWTVG2.js";import"./chunk-AHWWJ7AF.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{Bb as ot,Ib as nt,xb as tt,zb as st}from"./chunk-P6WSD2UR.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.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{Ma as Tt,Na 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-IQQ3I6R7.js";import"./chunk-27ICCQVL.js";import"./chunk-GTJIKXDB.js";import"./chunk-3K3IBV5K.js";import"./chunk-ZVP6GB4G.js";import"./chunk-R3TH2OG7.js";import"./chunk-IMLAPB7G.js";import"./chunk-VZLIBDLH.js";import"./chunk-EKJG63EJ.js";import"./chunk-BY5CN7C7.js";import"./chunk-J7PZJRYO.js";import"./chunk-2VDO2HEK.js";import"./chunk-B3JQ5J47.js";import"./chunk-I22ZKW7Q.js";import"./chunk-LQE73AZR.js";import"./chunk-2D3RYIDU.js";import"./chunk-MRIVENBY.js";import"./chunk-BIYEGA7Q.js";import"./chunk-XPZSEDE3.js";import"./chunk-PPUN7YHA.js";import"./chunk-A5GYG56I.js";import"./chunk-TKXZHRV3.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-UKUH662W.js";import"./chunk-JWDJMFU6.js";import"./chunk-6TTGRTDO.js";import"./chunk-MNG2AMKZ.js";import"./chunk-RX5O5637.js";import"./chunk-5ELIX7BQ.js";import"./chunk-X7UQY7CH.js";import"./chunk-RC3QYH2J.js";import"./chunk-QPABR72X.js";import"./chunk-DHD4KUTW.js";import"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-XVV7ZZ77.js";import{Ca as yt,m as lt,n as ct,o as dt,p as mt,q as pt}from"./chunk-424CABZF.js";import"./chunk-WFPLZLCF.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-RLI32DLG.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-GV7S5BAX.js";import"./chunk-SZDACK6O.js";import"./chunk-VE3SSOQX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-VJVXEVZ7.js";import{t as ut}from"./chunk-7MW44Y5O.js";import"./chunk-HOL645BZ.js";import"./chunk-3UOTLMXD.js";import"./chunk-VWTBHLMX.js";import"./chunk-BE64IJWM.js";import"./chunk-5ONH4ITT.js";import"./chunk-JRAG37V5.js";import"./chunk-ILEC3IAV.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-GSX4NK2N.js";import"./chunk-HPRLRD4P.js";import"./chunk-SK7M6PS6.js";import{a as ht}from"./chunk-3LMBT5LK.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-35GSB7SK.js";import"./chunk-JTFCU5LH.js";import{f as gt,g as ft}from"./chunk-OXTFAV2A.js";import"./chunk-WPNRDEHW.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-OVB3LW6L.js";import{j as it,k as rt,l as at}from"./chunk-KB5JMDGS.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-MYVHVJWZ.js";import"./chunk-QUFIUXMQ.js";import"./chunk-AV7T3SYT.js";import"./chunk-2HBEZV7L.js";import"./chunk-A7JSRDJL.js";import"./chunk-BERWTVG2.js";import"./chunk-AHWWJ7AF.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{Bb as tt,Db as st,Fb as ot,Mb as nt}from"./chunk-SNYAM7YB.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-BMNDAEF4.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).