@kaleidorg/mind 0.5.1 → 0.6.1

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 (174) hide show
  1. package/dist/autonomy/index.d.ts +21 -0
  2. package/dist/autonomy/index.d.ts.map +1 -0
  3. package/dist/autonomy/index.js +16 -0
  4. package/dist/autonomy/index.js.map +1 -0
  5. package/dist/autonomy/prompt.d.ts +21 -0
  6. package/dist/autonomy/prompt.d.ts.map +1 -0
  7. package/dist/autonomy/prompt.js +37 -0
  8. package/dist/autonomy/prompt.js.map +1 -0
  9. package/dist/autonomy/risk.d.ts +53 -0
  10. package/dist/autonomy/risk.d.ts.map +1 -0
  11. package/dist/autonomy/risk.js +74 -0
  12. package/dist/autonomy/risk.js.map +1 -0
  13. package/dist/autonomy/run-state.d.ts +39 -0
  14. package/dist/autonomy/run-state.d.ts.map +1 -0
  15. package/dist/autonomy/run-state.js +118 -0
  16. package/dist/autonomy/run-state.js.map +1 -0
  17. package/dist/autonomy/scheduler.d.ts +18 -0
  18. package/dist/autonomy/scheduler.d.ts.map +1 -0
  19. package/dist/autonomy/scheduler.js +113 -0
  20. package/dist/autonomy/scheduler.js.map +1 -0
  21. package/dist/autonomy/task-store.d.ts +44 -0
  22. package/dist/autonomy/task-store.d.ts.map +1 -0
  23. package/dist/autonomy/task-store.js +139 -0
  24. package/dist/autonomy/task-store.js.map +1 -0
  25. package/dist/autonomy/types.d.ts +164 -0
  26. package/dist/autonomy/types.d.ts.map +1 -0
  27. package/dist/autonomy/types.js +20 -0
  28. package/dist/autonomy/types.js.map +1 -0
  29. package/dist/bitrefill/contract.d.ts +60 -0
  30. package/dist/bitrefill/contract.d.ts.map +1 -0
  31. package/dist/bitrefill/contract.js +119 -0
  32. package/dist/bitrefill/contract.js.map +1 -0
  33. package/dist/context/compress.d.ts +65 -0
  34. package/dist/context/compress.d.ts.map +1 -0
  35. package/dist/context/compress.js +181 -0
  36. package/dist/context/compress.js.map +1 -0
  37. package/dist/engine.d.ts +20 -0
  38. package/dist/engine.d.ts.map +1 -1
  39. package/dist/engine.js +23 -4
  40. package/dist/engine.js.map +1 -1
  41. package/dist/evidence.d.ts +62 -0
  42. package/dist/evidence.d.ts.map +1 -0
  43. package/dist/evidence.js +47 -0
  44. package/dist/evidence.js.map +1 -0
  45. package/dist/flashnet/contract.d.ts +56 -0
  46. package/dist/flashnet/contract.d.ts.map +1 -0
  47. package/dist/flashnet/contract.js +100 -0
  48. package/dist/flashnet/contract.js.map +1 -0
  49. package/dist/funnel.d.ts +11 -0
  50. package/dist/funnel.d.ts.map +1 -1
  51. package/dist/funnel.js +62 -7
  52. package/dist/funnel.js.map +1 -1
  53. package/dist/index.d.ts +12 -1
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +11 -0
  56. package/dist/index.js.map +1 -1
  57. package/dist/kaleidoswap/contract.js +1 -1
  58. package/dist/kaleidoswap/contract.js.map +1 -1
  59. package/dist/knowledge/bitcoin-copilot.d.ts.map +1 -1
  60. package/dist/knowledge/bitcoin-copilot.js +85 -2
  61. package/dist/knowledge/bitcoin-copilot.js.map +1 -1
  62. package/dist/providers/types.d.ts +17 -0
  63. package/dist/providers/types.d.ts.map +1 -1
  64. package/dist/qvac/index.d.ts +1 -1
  65. package/dist/qvac/index.d.ts.map +1 -1
  66. package/dist/qvac/index.js.map +1 -1
  67. package/dist/qvac/parse.d.ts +18 -0
  68. package/dist/qvac/parse.d.ts.map +1 -1
  69. package/dist/qvac/parse.js +1 -0
  70. package/dist/qvac/parse.js.map +1 -1
  71. package/dist/qvac/provider.d.ts +16 -0
  72. package/dist/qvac/provider.d.ts.map +1 -1
  73. package/dist/qvac/provider.js +40 -1
  74. package/dist/qvac/provider.js.map +1 -1
  75. package/dist/qvac/stream.d.ts +22 -0
  76. package/dist/qvac/stream.d.ts.map +1 -1
  77. package/dist/qvac/stream.js +33 -1
  78. package/dist/qvac/stream.js.map +1 -1
  79. package/dist/recipe/buy-asset-channel.d.ts +1 -1
  80. package/dist/recipe/buy-asset-channel.d.ts.map +1 -1
  81. package/dist/recipe/buy-asset-channel.js +4 -3
  82. package/dist/recipe/buy-asset-channel.js.map +1 -1
  83. package/dist/recipe/flashnet-swap.d.ts +35 -0
  84. package/dist/recipe/flashnet-swap.d.ts.map +1 -0
  85. package/dist/recipe/flashnet-swap.js +239 -0
  86. package/dist/recipe/flashnet-swap.js.map +1 -0
  87. package/dist/recipe/kaleidoswap-atomic.d.ts +1 -1
  88. package/dist/recipe/kaleidoswap-atomic.d.ts.map +1 -1
  89. package/dist/recipe/kaleidoswap-atomic.js +42 -20
  90. package/dist/recipe/kaleidoswap-atomic.js.map +1 -1
  91. package/dist/recipe/kaleidoswap-channel-order.d.ts.map +1 -1
  92. package/dist/recipe/kaleidoswap-channel-order.js +31 -10
  93. package/dist/recipe/kaleidoswap-channel-order.js.map +1 -1
  94. package/dist/recipe/kaleidoswap-price.d.ts.map +1 -1
  95. package/dist/recipe/kaleidoswap-price.js +7 -1
  96. package/dist/recipe/kaleidoswap-price.js.map +1 -1
  97. package/dist/recipe/runner.d.ts.map +1 -1
  98. package/dist/recipe/runner.js +43 -3
  99. package/dist/recipe/runner.js.map +1 -1
  100. package/dist/recipe/swap.d.ts.map +1 -1
  101. package/dist/recipe/swap.js +14 -1
  102. package/dist/recipe/swap.js.map +1 -1
  103. package/dist/tools/mcp.d.ts +19 -0
  104. package/dist/tools/mcp.d.ts.map +1 -1
  105. package/dist/tools/mcp.js +51 -9
  106. package/dist/tools/mcp.js.map +1 -1
  107. package/dist/wallet/confirm.d.ts.map +1 -1
  108. package/dist/wallet/confirm.js +1 -0
  109. package/dist/wallet/confirm.js.map +1 -1
  110. package/dist/wallet/contract.d.ts.map +1 -1
  111. package/dist/wallet/contract.js +20 -4
  112. package/dist/wallet/contract.js.map +1 -1
  113. package/package.json +5 -4
  114. package/skills/bitrefill/SKILL.md +152 -52
  115. package/skills/channel-manager/SKILL.md +59 -0
  116. package/skills/dca/SKILL.md +48 -0
  117. package/skills/flashnet-swaps/SKILL.md +158 -0
  118. package/skills/kaleido-lsps/SKILL.md +34 -17
  119. package/skills/kaleido-trading/SKILL.md +37 -13
  120. package/skills/liquidity-optimizer/SKILL.md +91 -0
  121. package/skills/merchant-finder/SKILL.md +2 -2
  122. package/skills/portfolio-manager/SKILL.md +67 -0
  123. package/skills/rgb-lightning-node/SKILL.md +38 -11
  124. package/skills/spark-wallet/SKILL.md +235 -0
  125. package/skills/wallet-assistant/SKILL.md +2 -2
  126. package/src/autonomy/autonomy.test.ts +348 -0
  127. package/src/autonomy/index.ts +50 -0
  128. package/src/autonomy/prompt.ts +48 -0
  129. package/src/autonomy/risk.ts +139 -0
  130. package/src/autonomy/run-state.ts +144 -0
  131. package/src/autonomy/scheduler.ts +120 -0
  132. package/src/autonomy/task-store.ts +167 -0
  133. package/src/autonomy/types.ts +186 -0
  134. package/src/bitrefill/contract.test.ts +89 -0
  135. package/src/bitrefill/contract.ts +190 -0
  136. package/src/context/compress.test.ts +120 -0
  137. package/src/context/compress.ts +230 -0
  138. package/src/engine.test.ts +34 -0
  139. package/src/engine.ts +35 -4
  140. package/src/evidence.test.ts +80 -0
  141. package/src/evidence.ts +114 -0
  142. package/src/flashnet/contract.test.ts +101 -0
  143. package/src/flashnet/contract.ts +164 -0
  144. package/src/funnel.mind.test.ts +390 -0
  145. package/src/funnel.ts +73 -8
  146. package/src/index.ts +92 -1
  147. package/src/kaleidoswap/contract.ts +1 -1
  148. package/src/knowledge/bitcoin-copilot.ts +96 -2
  149. package/src/providers/types.ts +18 -0
  150. package/src/qvac/index.ts +1 -0
  151. package/src/qvac/parse.ts +20 -0
  152. package/src/qvac/provider.test.ts +17 -0
  153. package/src/qvac/provider.ts +62 -2
  154. package/src/qvac/stream.test.ts +36 -0
  155. package/src/qvac/stream.ts +54 -1
  156. package/src/recipe/buy-asset-channel.test.ts +5 -0
  157. package/src/recipe/buy-asset-channel.ts +6 -3
  158. package/src/recipe/flashnet-swap.test.ts +114 -0
  159. package/src/recipe/flashnet-swap.ts +266 -0
  160. package/src/recipe/kaleidoswap-atomic.test.ts +24 -3
  161. package/src/recipe/kaleidoswap-atomic.ts +39 -20
  162. package/src/recipe/kaleidoswap-channel-order.test.ts +38 -0
  163. package/src/recipe/kaleidoswap-channel-order.ts +27 -9
  164. package/src/recipe/kaleidoswap-price.ts +7 -1
  165. package/src/recipe/recipe.test.ts +21 -0
  166. package/src/recipe/runner.ts +46 -3
  167. package/src/recipe/swap.ts +16 -1
  168. package/src/tools/mcp.live.test.ts +116 -0
  169. package/src/tools/mcp.parse.test.ts +37 -0
  170. package/src/tools/mcp.ts +55 -9
  171. package/src/wallet/confirm.test.ts +8 -0
  172. package/src/wallet/confirm.ts +1 -0
  173. package/src/wallet/contract.test.ts +10 -0
  174. package/src/wallet/contract.ts +26 -4
package/dist/tools/mcp.js CHANGED
@@ -17,6 +17,51 @@
17
17
  * execute() are implemented. Used by the desktop sidecar (kaleido-mcp +
18
18
  * Bitrefill MCP) and verified against the remote Bitrefill MCP.
19
19
  */
20
+ import { isKaleidoswapSpendTool } from '../kaleidoswap/contract.js';
21
+ import { isLsps1SpendTool } from '../lsps1/contract.js';
22
+ import { isSpendTool } from '../wallet/contract.js';
23
+ function toolRequiresConfirmation(name, description) {
24
+ return (isSpendTool(name) ||
25
+ isKaleidoswapSpendTool(name) ||
26
+ isLsps1SpendTool(name) ||
27
+ /\bSPEND\b.*\bconfirm/i.test(description));
28
+ }
29
+ /**
30
+ * Normalize an MCP `callTool` result into a structured value.
31
+ *
32
+ * Two fixes vs. returning the raw text content:
33
+ * - `isError` (the MCP failure signal) becomes an `{ error }` object, so callers
34
+ * — the recipe runner's `toolFailure`, the agent — treat it as a FAILURE
35
+ * instead of a successful result. Without this the agent claimed a spend had
36
+ * succeeded when the wallet actually rejected it.
37
+ * - JSON text is PARSED, so recipes thread real fields (rfq_id, total_sat,
38
+ * order_id) and any failure fields (error/status) are visible. A raw string
39
+ * hid both — the quote's rfq_id never reached the create call, and the canned
40
+ * success summary fired regardless. Non-JSON text passes through unchanged;
41
+ * the engine re-stringifies objects when feeding the model.
42
+ *
43
+ * Exported for unit testing.
44
+ */
45
+ export function parseMcpResult(res) {
46
+ const r = res;
47
+ const text = Array.isArray(r?.content)
48
+ ? r.content
49
+ .filter((c) => c?.type === 'text')
50
+ .map((c) => c?.text ?? '')
51
+ .join('\n')
52
+ : '';
53
+ if (r?.isError)
54
+ return { error: text || 'The tool reported an error.' };
55
+ if (text) {
56
+ try {
57
+ return JSON.parse(text);
58
+ }
59
+ catch {
60
+ return text;
61
+ }
62
+ }
63
+ return Array.isArray(r?.content) ? r.content : res;
64
+ }
20
65
  export class McpToolSource {
21
66
  id;
22
67
  opts;
@@ -46,12 +91,15 @@ export class McpToolSource {
46
91
  await this.client.connect(transport);
47
92
  const listed = await this.client.listTools();
48
93
  const allow = this.opts.allow ? new Set(this.opts.allow) : null;
94
+ const denied = this.opts.denyPrefixes ?? [];
49
95
  this.tools = (listed.tools ?? [])
50
96
  .filter((t) => !allow || allow.has(t.name))
97
+ .filter((t) => !denied.some((prefix) => t.name.startsWith(prefix)))
51
98
  .map((t) => ({
52
99
  name: t.name,
53
100
  description: t.description ?? '',
54
101
  parameters: t.inputSchema ?? { type: 'object', properties: {} },
102
+ requiresConfirmation: toolRequiresConfirmation(t.name, t.description ?? ''),
55
103
  }));
56
104
  }
57
105
  listTools() {
@@ -64,15 +112,9 @@ export class McpToolSource {
64
112
  if (!this.client)
65
113
  throw new Error(`McpToolSource "${this.id}" not connected — call connect() first`);
66
114
  const res = await this.client.callTool({ name, arguments: args }, undefined, { timeout: this.opts.timeoutMs ?? 60_000 });
67
- // MCP returns content blocks; surface text content as the tool result.
68
- if (Array.isArray(res?.content)) {
69
- const text = res.content
70
- .filter((c) => c.type === 'text')
71
- .map((c) => c.text)
72
- .join('\n');
73
- return text || res.content;
74
- }
75
- return res;
115
+ // Parse JSON + surface isError so recipes/agent get structured results and
116
+ // real failures (not an opaque string that hid both). See parseMcpResult.
117
+ return parseMcpResult(res);
76
118
  }
77
119
  async close() {
78
120
  await this.client?.close?.();
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/tools/mcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAkBH,MAAM,OAAO,aAAa;IACf,EAAE,CAAS;IACH,IAAI,CAAuB;IACpC,MAAM,GAAe,IAAI,CAAC;IAC1B,KAAK,GAAc,EAAE,CAAC;IAE9B,YAAY,IAA0B;QACpC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QAClB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,+EAA+E;IAC/E,KAAK,CAAC,OAAO;QACX,6EAA6E;QAC7E,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,2CAA2C,CAAC,CAAC;QAC7E,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;QAE9B,IAAI,SAAc,CAAC;QACnB,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YACvB,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,MAAM,CAC3C,2CAA2C,CAC5C,CAAC;YACF,SAAS,GAAG,IAAI,oBAAoB,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;QAC/F,CAAC;aAAM,CAAC;YACN,MAAM,EAAE,6BAA6B,EAAE,GAAG,MAAM,MAAM,CACpD,oDAAoD,CACrD,CAAC;YACF,SAAS,GAAG,IAAI,6BAA6B,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;gBAC5D,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,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AAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,CAAC,EAAE,wCAAwC,CAAC,CAAC;QACrG,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CACpC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EACzB,SAAS,EACT,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,MAAM,EAAE,CAC3C,CAAC;QACF,2EAA2E;QAC3E,0EAA0E;QAC1E,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,CAAC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"confirm.d.ts","sourceRoot":"","sources":["../../src/wallet/confirm.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAyCH,+EAA+E;AAC/E,wBAAgB,eAAe,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAAG,MAAM,GAAG,IAAI,CA0BzG"}
1
+ {"version":3,"file":"confirm.d.ts","sourceRoot":"","sources":["../../src/wallet/confirm.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAyCH,+EAA+E;AAC/E,wBAAgB,eAAe,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAAG,MAAM,GAAG,IAAI,CA2BzG"}
@@ -56,6 +56,7 @@ export function confirmReadback(call) {
56
56
  case 'liquid_send':
57
57
  return ask(`Send ${asset(a.amount, a.asset)} to ${to()}${over(name, a)}`);
58
58
  case 'rln_pay_invoice':
59
+ case 'spark_pay_invoice':
59
60
  return ask(`Pay Lightning invoice ${shortRef(String(a.invoice ?? ''))}${over(name, a)}`);
60
61
  case 'execute_swap':
61
62
  return ask(`Swap ${fmtNum(Number(a.amount))} ${String(a.from_asset)} for ${String(a.to_asset)}`);
@@ -1 +1 @@
1
- {"version":3,"file":"confirm.js","sourceRoot":"","sources":["../../src/wallet/confirm.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,WAAW,GAA2B;IAC1C,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACjB,CAAC;AAEF,sFAAsF;AACtF,SAAS,MAAM,CAAC,CAAS;IACvB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;IAC1C,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IAClB,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,GAAI,CAAC,OAAO,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;IAC3D,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;AACpE,CAAC;AAED,qEAAqE;AACrE,SAAS,KAAK,CAAC,CAAS;IACtB,OAAO,sCAAsC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAA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AC3E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,EAAE,IAAI,GAAE,iBAAsB,GAAG,mBAAmB,CAkB1H"}
@@ -32,10 +32,26 @@ const asset = { type: 'string', description: "Asset ticker, e.g. 'USDT', 'XAUT',
32
32
  /** The full contract. Keep descriptions terse — small models read every word. */
33
33
  export const WALLET_TOOLS = [
34
34
  // ── Spark ──────────────────────────────────────────────────────────────
35
- t('spark', 'spark_get_balance', 'Get the Spark wallet BTC balance.'),
36
- t('spark', 'spark_get_address', 'Get a Spark deposit address to receive BTC.'),
37
- t('spark', 'spark_create_invoice', 'Create a Spark Lightning invoice to receive BTC.', { amount_sats: sats }),
38
- t('spark', 'spark_send', 'Send BTC from Spark to an address or invoice.', { amount_sats: sats, to: { type: 'string', description: 'Address or invoice' } }, ['amount_sats', 'to'], true),
35
+ t('spark', 'spark_get_balance', 'Get the Spark wallet balances — BTC sats AND every Spark-native token (e.g. USDB). Returns `{ total: <sats>, tokens: [{ address, balance, symbol?, decimals?, available_to_send? }], connected, layer, network }`. Use for ANY "balance / how much / what do I have on Spark" question — call it fresh every time, balances change. The `tokens` array surfaces ALL Spark-native tokens the wallet holds, so you do NOT need to call flashnet_get_balance separately for that (flashnet_get_balance is the AMM-client view of the same wallet and returns the same numbers). For RGB asset balances (USDT, XAUT) use the RLN tools — RGB assets are NOT on Spark.'),
36
+ // The user-facing "Spark address" an off-chain Spark identity (sparkrt1…/
37
+ // spark1…). For OFF-CHAIN peer transfers WITHIN Spark. NOT a Bitcoin
38
+ // on-chain address. Use spark_get_onchain_address for the on-chain deposit
39
+ // path; use spark_create_invoice for a Lightning invoice.
40
+ t('spark', 'spark_get_address', 'Get the user\'s Spark address (sparkrt1…/spark1…) — an OFF-CHAIN Spark identity for receiving Spark-to-Spark transfers. NOT a Bitcoin on-chain address (does not start with bc1/tb1/bcrt1) and NOT a Lightning invoice. For "an on-chain address to deposit BTC into Spark" use spark_get_onchain_address. For a Lightning invoice use spark_create_invoice.'),
41
+ // Real on-chain Bitcoin address used to deposit BTC FROM mainnet INTO the
42
+ // Spark wallet. The SDK calls this a "static deposit address" — bc1…/tb1…/
43
+ // bcrt1…. The opposite of spark_get_address.
44
+ t('spark', 'spark_get_onchain_address', 'Get a real Bitcoin ON-CHAIN address (bc1…/tb1…/bcrt1…) for depositing BTC from the Bitcoin L1 into the Spark wallet. Use ANY time the user asks for "an on-chain address", "deposit address", "Bitcoin address to fund Spark", "where do I send my on-chain BTC". This is NOT the Spark identity (spark_get_address) and NOT a Lightning invoice (spark_create_invoice).'),
45
+ t('spark', 'spark_create_invoice', 'Create a Spark Lightning invoice (BOLT11) to receive BTC over Lightning. Returns an invoice string the user can share. Use when the user asks for "an invoice", "a lightning invoice", "pay me", or names an amount they want received. NOT an address.', { amount_sats: sats }),
46
+ // Explicit Lightning-invoice payer. BOLT11 invoices encode the amount, so
47
+ // `amount_sats` is optional and only used for amount-less ("any-amount")
48
+ // invoices. Prefer this over `spark_send` when the destination is a BOLT11
49
+ // invoice — it removes ambiguity for small models and gives the cross-skill
50
+ // bitrefill flow a single, unambiguous target.
51
+ t('spark', 'spark_pay_invoice', 'Pay a Lightning (BOLT11) invoice from the Spark wallet. The invoice already encodes the amount; pass amount_sats ONLY for amount-less invoices. Use this for any BOLT11 destination (Bitrefill, contact, raw invoice).', { invoice: { type: 'string', description: 'BOLT11 Lightning invoice (lnbc…/lntb…/lnbcrt…).' }, amount_sats: { type: 'number', description: 'Required ONLY when the invoice has no amount; omit otherwise.' } }, ['invoice'],
52
+ /* spend */ true),
53
+ t('spark', 'spark_send', 'Send BTC from Spark to an on-chain address (bc1…/tb1…). For BOLT11 invoices, prefer spark_pay_invoice.', { amount_sats: sats, to: { type: 'string', description: 'On-chain Bitcoin address.' } }, ['amount_sats', 'to'],
54
+ /* spend */ true),
39
55
  // ── RLN / RGB ──────────────────────────────────────────────────────────
40
56
  t('rln', 'rln_get_balances', 'Get RLN node balances (BTC + RGB assets).'),
41
57
  t('rln', 'rln_get_node_info', 'Get RLN node status and sync state.'),
@@ -1 +1 @@
1
- {"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/wallet/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAc7D,SAAS,CAAC,CACR,KAAkB,EAClB,IAAY,EACZ,WAAmB,EACnB,aAAoB,EAAE,EACtB,WAAqB,EAAE,EACvB,KAAK,GAAG,KAAK;IAEb,OAAO;QACL,KAAK;QACL,IAAI;QACJ,WAAW;QACX,KAAK;QACL,oBAAoB,EAAE,KAAK;QAC3B,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE;KACrD,CAAC;AACJ,CAAC;AAED,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oBAAoB,EAAW,CAAC;AAC5E,MAAM,KAAK,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,0CAA0C,EAAW,CAAC;AAEnG,iFAAiF;AACjF,MAAM,CAAC,MAAM,YAAY,GAAoB;IAC3C,0EAA0E;IAC1E,CAAC,CAAC,OAAO,EAAE,mBAAmB,EAAE,mCAAmC,CAAC;IACpE,CAAC,CAAC,OAAO,EAAE,mBAAmB,EAAE,6CAA6C,CAAC;IAC9E,CAAC,CAAC,OAAO,EAAE,sBAAsB,EAAE,kDAAkD,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IAC7G,CAAC,CAAC,OAAO,EAAE,YAAY,EAAE,+CAA+C,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oBAAoB,EAAE,EA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AAU,eAAe,CAAC,QAAuC,EAAE,OAA0B,EAAE;IACnG,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,KAAK,GAAoB,EAAE,CAAC;IAClC,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,IAAI,IAAI,CAAC,YAAY;gBAAE,SAAS;YAChC,MAAM,IAAI,KAAK,CAAC,oCAAoC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC;QACnE,CAAC;QACD,KAAK,CAAC,IAAI,CAAC;YACT,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,WAAW,EAAE,GAAG,CAAC,WAAW;YAC5B,UAAU,EAAE,GAAG,CAAC,UAAU;YAC1B,oBAAoB,EAAE,GAAG,CAAC,oBAAoB;YAC9C,OAAO;SACR,CAAC,CAAC;IACL,CAAC;IACD,OAAO,IAAI,mBAAmB,CAAC,IAAI,CAAC,EAAE,IAAI,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC7D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaleidorg/mind",
3
- "version": "0.5.1",
3
+ "version": "0.6.1",
4
4
  "description": "Local-first reasoning + function-calling engine for KaleidoSwap. QVAC-powered.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -53,6 +53,7 @@
53
53
  "build": "tsc",
54
54
  "typecheck": "tsc --noEmit",
55
55
  "test": "vitest run",
56
+ "test:live": "vitest run mcp.live",
56
57
  "lint": "eslint src",
57
58
  "bundle-skills": "node scripts/bundle-skills.mjs"
58
59
  },
@@ -65,8 +66,8 @@
65
66
  }
66
67
  },
67
68
  "devDependencies": {
68
- "@qvac/sdk": "^0.13.1",
69
- "@types/node": "^20.0.0",
70
- "vitest": "^1.6.0"
69
+ "@qvac/sdk": "^0.13.5",
70
+ "@types/node": "^20.19.43",
71
+ "vitest": "^1.6.1"
71
72
  }
72
73
  }
@@ -1,10 +1,12 @@
1
1
  ---
2
2
  name: bitrefill
3
- description: "Buy or browse Bitrefill — 1,500+ gift cards, mobile top-ups, and eSIMs across 180+ countries, payable in crypto, Lightning, USDC via x402, or pre-funded account balance. Routes the host agent to its highest-fidelity channel (residential browser, MCP server, npm CLI, or REST API) based on detected runtime capabilities, with a dedicated OpenClaw integration guide for chat-channel scenarios. Triggers when the user mentions Bitrefill, gift cards, mobile top-up, eSIM data plan, refilling a phone, or asks to pay or check out with crypto, Lightning, USDC, or x402."
4
- compatibility: "Detects host capabilities at runtime. Paths require: browse — residential-IP browser; MCP — MCP-capable client + Bitrefill OAuth/API key; CLI — Node.js >=18 + shell + npm + @bitrefill/cli >=0.3.0 (headless login/verify via magic link); API — outbound HTTP + Bitrefill API key (Personal) or API ID/Secret (Business/Affiliate). OpenClaw host gets a dedicated guide."
3
+ description: "Buy or browse Bitrefill — 1,500+ gift cards, mobile top-ups, and eSIMs across 180+ countries, payable in crypto, Lightning, USDC via x402, or pre-funded account balance. Use these tools to actually transact: bitrefill_search bitrefill_get_product bitrefill_create_invoice (spend, confirmed) bitrefill_get_invoice/bitrefill_get_order for the redemption code."
4
+ tools: bitrefill_search, bitrefill_get_product, bitrefill_get_balance, bitrefill_create_invoice, bitrefill_get_invoice, bitrefill_get_order, spark_pay_invoice, spark_get_balance, rln_pay_invoice
5
+ triggers: bitrefill, gift card, gift cards, giftcard, voucher, vouchers, top-up, topup, top up, refill, esim, e-sim, mobile plan, mobile top-up, prepaid, amazon, steam, google play, app store, itunes, playstation, xbox, netflix, spotify, uber
6
+ compatibility: "Live REST adapter on the CLI/desktop when BITREFILL_API_KEY (Personal) or BITREFILL_API_ID + BITREFILL_API_SECRET (Business) are set. Without those env vars the tools aren't registered — tell the user and stop."
5
7
  metadata:
6
8
  author: bitrefill
7
- version: "2.1.5"
9
+ version: "3.0.0"
8
10
  homepage: "https://www.bitrefill.com"
9
11
  docs: "https://docs.bitrefill.com"
10
12
  repository: "https://github.com/bitrefill/cli"
@@ -12,55 +14,153 @@ metadata:
12
14
 
13
15
  # Bitrefill
14
16
 
15
- Bitrefill sells digital goods (gift cards, mobile top-ups, eSIMs) across 180+ countries and 1,500+ brands. Pay with crypto, Lightning, USDC via x402, or pre-funded account balance. Codes deliver instantly after payment confirms.
16
-
17
- This skill **routes by capability, not by use case**. Same intent ("buy a Steam card") plays out differently across hosts. Pick a path below based on what your runtime can do.
18
-
19
- ## Pick a path
20
-
21
- Walk these checks **in order**. First match wins.
22
-
23
- 1. **Inside OpenClaw?** Check for `~/.openclaw/openclaw.json`, `~/.openclaw/skills/`, or `openclaw` on PATH. If yes → read [host-openclaw.md](references/host-openclaw.md) first. **Default purchase path: guest CLI via `exec`** (no auth). Sign in for `balance`/cashback. OpenClaw also supports MCP, API, Browse, chat-channel scenarios (Telegram, cron, mobile camera).
24
-
25
- 2. **Browse-only intent (no purchase)?** If the user only wants to explore, compare prices, or learn how products work:
26
- - Have a residential-IP browser (ChatGPT Atlas, Cursor browser tool, Claude/Playwright Chrome extension, OpenClaw on user host)? → [browse.md](references/browse.md).
27
- - Datacenter egress only (ChatGPT web/Agent, Gemini consumer, Jules)? `www.bitrefill.com` returns **403 Cloudflare** to datacenter IPs. Use [mcp.md](references/mcp.md) `search-products` / `product-details` insteadthey return the same catalog without scraping.
28
-
29
- 3. **MCP supported?** Bitrefill ships a remote HTTP/SSE MCP at `https://api.bitrefill.com/mcp`. Works on Claude.ai (Pro+), Cowork, Claude Desktop, Claude Code, ChatGPT (Plus+), Atlas, Codex CLI, Gemini CLI, Cursor, OpenCode, OpenClaw. **Highest-fidelity purchase channel — typed tool calls, OAuth or API key, no shell needed.** → [mcp.md](references/mcp.md).
30
-
31
- 4. **Shell + `npm install` available?** CLI ≥ 0.3.0: **guest checkout first** (no auth — `buy-products --email` + crypto). Sign in for `balance`, cashback, order history. [cli.md](references/cli.md). Headless sign-in → [cli-headless-auth.md](references/cli-headless-auth.md).
32
-
33
- 5. **Outbound HTTP from agent loop?** Anywhere shell exists, plus Claude Code `WebFetch`. Last resort — verbose, no typed validation. → [api.md](references/api.md).
34
-
35
- 6. **None of the above** (e.g. Gemini consumer free tier): give the user a `bitrefill.com` link and stop.
36
-
37
- Don't know which host you're in? Read [capability-matrix.md](references/capability-matrix.md) per-client cheat sheet maps every leading agent product to its viable paths.
38
-
39
- ## Top spending safeguards (read full list before any purchase)
40
-
41
- This skill enables **real-money transactions**. Codes deliver instantly and digital goods are non-refundable per EU consumer rights.
42
-
43
- - **Confirm before buying.** Present product, denomination, price, payment method. Wait for explicit user approval. Autonomous purchasing only when user opts in for the current session.
44
- - **Treat codes as cash.** Never paste in group chats or public channels. Prefer in-memory storage over plain-text logs. Advise user to redeem ASAP.
45
- - **Use a dedicated, low-balance account.** Never give the agent access to high-balance accounts or crypto wallet seeds. This skill is **not a wallet**.
46
- - **Log every purchase.** `invoice_id`, product, amount, payment method.
47
-
48
- Full safeguards + per-host hardening (OpenClaw exec-approvals, Cursor auto-approve, Codex sandbox, Claude Code allowlist) → [safeguards.md](references/safeguards.md).
49
-
50
- ## References
51
-
52
- | File | Use when |
53
- |------|----------|
54
- | [browse.md](references/browse.md) | Agent has residential-IP browser; user wants to explore |
55
- | [mcp.md](references/mcp.md) | MCP-capable host; preferred purchase path |
56
- | [cli.md](references/cli.md) | Shell + npm; guest checkout or signed-in CLI ≥ 0.3.0 |
57
- | [cli-headless-auth.md](references/cli-headless-auth.md) | AgentMail or equivalent inbox + magic-link auth for headless agents |
58
- | [api.md](references/api.md) | HTTP-only runtime; Personal / Business / Affiliate REST tiers |
59
- | [host-openclaw.md](references/host-openclaw.md) | OpenClaw Gateway guest CLI via `exec` preferred |
60
- | [capability-matrix.md](references/capability-matrix.md) | Per-client viable paths cheat sheet |
61
- | [safeguards.md](references/safeguards.md) | Spending policy + per-host hardening |
62
- | [troubleshooting.md](references/troubleshooting.md) | Common errors across all paths |
17
+ Bitrefill sells digital goods (gift cards, mobile top-ups, eSIMs) across 180+
18
+ countries. Codes deliver instantly after the invoice settles.
19
+
20
+ This skill is **action-shaped**: when the host has the `bitrefill_*` tools
21
+ wired, you transact through them directly. Don't navigate browser / MCP / CLI
22
+ fallbacks unless the tools are absent.
23
+
24
+ ## Critical rules (read first)
25
+
26
+ 1. **Never invent product or package ids.** Every `product_id` and
27
+ `package_id` MUST come from a `bitrefill_search` + `bitrefill_get_product`
28
+ result in the current turn.
29
+ 2. **Confirm before spending.** `bitrefill_create_invoice` is the spendit
30
+ is automatically confirmation-gated by the host. Before calling it, show
31
+ the user product, denomination, total price, and payment method in plain
32
+ English, then call the tool. The host will fire one confirmation; on
33
+ approve, the invoice is created.
34
+ 3. **Codes are cash.** When you read `redemption_info.code` from
35
+ `bitrefill_get_order`, return it once, advise the user to store it
36
+ securely, and **never** repeat it in summaries or future turns.
37
+ 4. **No tools wired = no purchase.** If `bitrefill_search` isn't available
38
+ in this session (no API key configured), say so directly: *"Bitrefill
39
+ purchases need a `BITREFILL_API_KEY` env var. Set one and restart, or
40
+ browse <https://www.bitrefill.com> directly."* Don't fall back to
41
+ inventing products.
42
+
43
+ ## Happy-path playbook
44
+
45
+ For a typical buy ("a $25 Amazon US gift card with my balance"):
46
+
47
+ 1. **`bitrefill_search({ query, country? })`** find candidate products.
48
+ - "amazon" `{ query: "amazon", country: "US" }` if the user named a
49
+ country, else just `{ query: "amazon" }`.
50
+ - Returns a list of `{ id, name, country, category }` rows. Pick the one
51
+ that matches the user's intent. If multiple plausible matches, ask the
52
+ user once instead of guessing.
53
+
54
+ 2. **`bitrefill_get_product({ product_id })`** read the `packages` array
55
+ for the right denomination. Each package has `{ id, value, price,
56
+ currency }`. **The `package_id` is what you pass to create_invoice**, NOT
57
+ the bare `value`.
58
+
59
+ 3. **`bitrefill_get_balance()`** *(optional)* when the user said "with my
60
+ balance" or asked "can I afford it", verify the account has enough
61
+ before creating the invoice. Skip when paying with Lightning / on-chain.
62
+
63
+ 4. **`bitrefill_create_invoice({ products, payment_method, ... })`**
64
+ confirmation-gated spend. Choose `payment_method` per the user's request:
65
+ - `"balance"` + `auto_pay: true` — instant settlement from account
66
+ balance. **Default** when the user says "with my balance" or doesn't
67
+ specify and balance is sufficient.
68
+ - `"lightning"` — fastest crypto path. Response carries a BOLT11
69
+ invoice the user pays out-of-band (see step 5b — Spark, if connected,
70
+ pays it directly). **Requires `refund_address`** in case it expires.
71
+ - `"bitcoin"`, `"usdc_base"`, `"usdc_polygon"`, `"usdt_tron"`,
72
+ `"usdt_ethereum"` — same pattern, slower confirmation; also need
73
+ `refund_address`.
74
+
75
+ Line items: `products: [{ product_id, package_id, quantity }]`. Up to 20
76
+ per invoice.
77
+
78
+ 5. **Settlement.**
79
+
80
+ a. **`balance` + `auto_pay:true`** — the invoice is usually `complete`
81
+ on creation. Read its `order_id`(s) and skip to step 6.
82
+
83
+ b. **`lightning` with Spark connected** — the response includes a BOLT11
84
+ invoice (commonly under `payment.lightning_invoice`, surface whatever
85
+ field the host returns). Pay it with **`spark_pay_invoice({ invoice:
86
+ <bolt11> })`** — that's one extra confirmation gate, and Spark settles
87
+ it in seconds. (Same pattern if RLN is the user's Lightning layer:
88
+ use `rln_pay_invoice`.) Then `bitrefill_get_invoice` should already
89
+ report `paid` / `complete`.
90
+
91
+ c. **`lightning` or on-chain without an on-device wallet** — relay the
92
+ payment URI to the user and **poll** `bitrefill_get_invoice({
93
+ invoice_id })` until `status:"complete"`. Don't poll faster than
94
+ every ~5s; give up after a few minutes and hand the invoice id back
95
+ to the user to check later.
96
+
97
+ 6. **`bitrefill_get_order({ order_id })`** — read `redemption_info`:
98
+ - `.code` — the gift-card code or top-up PIN. The actual product.
99
+ - `.pin` — additional PIN for prepaid cards (often present alongside
100
+ the code).
101
+ - `.link` — brand redemption URL when applicable.
102
+ - `.instructions` — brand-specific redemption steps.
103
+
104
+ Present the code in the chat ONCE, then tell the user to store it and
105
+ redeem ASAP. Don't echo it in subsequent replies, summaries, or memory.
106
+
107
+ ## Choosing a payment method
108
+
109
+ | Method | Speed | Blast radius | Use when |
110
+ |---|---|---|---|
111
+ | `balance` + `auto_pay:true` | Instant | Capped at account balance | Default. User pre-funded the account; lowest risk. |
112
+ | `lightning` | Seconds | Whatever's in the user's LN wallet | User asks for "pay with Lightning" or wants no pre-funding. |
113
+ | `bitcoin` | 10–60 min | One on-chain UTXO | User asks for "pay on-chain" or invoice > Lightning capacity. |
114
+ | `usdc_base` (x402) | Seconds | Agent USDC wallet balance | Agent has an x402-capable USDC wallet. |
115
+ | Other on-chain (USDT/USDC variants) | Variable | One UTXO per network | User explicitly requested. |
116
+
117
+ Default to `balance` when available; ask the user before switching to a
118
+ crypto method.
119
+
120
+ ## Failure handling
121
+
122
+ Tool errors surface as thrown messages like `"bitrefill bitrefill_create_invoice failed: HTTP 401 ..."`. Relay them as plain English:
123
+
124
+ - **401 Unauthorized** — `BITREFILL_API_KEY` is unset or wrong. Tell the
125
+ user; don't retry.
126
+ - **400 / validation errors** — usually a bad `package_id` or
127
+ `payment_method`. Re-read the product's `packages` array and retry once,
128
+ then stop and ask.
129
+ - **402 Payment Required** (with `balance`) — account underfunded. Show
130
+ the deficit; suggest topping up or switching payment method.
131
+ - **Invoice `expired`** — re-create the invoice; an old quote isn't
132
+ reusable.
133
+
134
+ ## Reply style
135
+
136
+ - Show the candidate product list as a short bulleted list (≤5 rows).
137
+ - Before the spend, summarize in one line:
138
+ `Buying: 1× Amazon US $25 — total $25.00 USD, paying with balance. Confirm?`
139
+ - After settlement: one line on success, then the redemption details on a
140
+ separate line so the user can copy the code.
141
+ - After delivering the code, suggest redeeming ASAP and do NOT repeat the
142
+ code in later turns.
143
+
144
+ ## References (deep-dive, on demand)
145
+
146
+ The references below cover paths and host hardening — they're for hosts
147
+ that **don't** have the `bitrefill_*` tools wired (browser-only,
148
+ MCP-capable client, npm CLI, raw REST). When the tools above are
149
+ available, you don't need to read them.
150
+
151
+ | File | When |
152
+ |------|------|
153
+ | [api.md](references/api.md) | Mapping the contract tools back to raw REST endpoints. |
154
+ | [mcp.md](references/mcp.md) | Host has the Bitrefill remote MCP wired instead of the contract. |
155
+ | [cli.md](references/cli.md) | `@bitrefill/cli` npm path (auth-bound). |
156
+ | [cli-headless-auth.md](references/cli-headless-auth.md) | Magic-link auth via an agent inbox. |
157
+ | [browse.md](references/browse.md) | Browser-only hosts. |
158
+ | [host-openclaw.md](references/host-openclaw.md) | OpenClaw-specific path. |
159
+ | [capability-matrix.md](references/capability-matrix.md) | Per-client cheat sheet. |
160
+ | [safeguards.md](references/safeguards.md) | Spending policy + per-host hardening. |
161
+ | [troubleshooting.md](references/troubleshooting.md) | Common errors. |
63
162
 
64
163
  ## Source of truth
65
164
 
66
- Skill summarizes and routes. For exhaustive enums (countries, payment methods, full endpoint list), follow link-outs to <https://docs.bitrefill.com>.
165
+ Skill describes the contract + playbook. For exhaustive enums (countries,
166
+ payment methods, full endpoint list), see <https://docs.bitrefill.com>.
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: channel-manager
3
+ description: "Keep the Lightning node healthy: check node info, audit channels and liquidity, flush stuck RGB transfers, and (when allowed) buy inbound/asset channel capacity via the KaleidoSwap LSP. Triggers when the user asks about node health, channels, liquidity, or inbound capacity — and is the skill the scheduled 'heartbeat' loop runs."
4
+ tools: rln_get_node_info, rln_list_channels, rln_get_balances, rln_list_assets, rln_refresh_transfers, kaleidoswap_lsp_get_info, kaleidoswap_lsp_estimate_fees, kaleidoswap_lsp_create_order, rln_pay_invoice
5
+ triggers: node, channel, channels, liquidity, inbound, outbound, lsp, heartbeat, health, transfers, stuck
6
+ metadata:
7
+ author: kaleidoswap
8
+ version: "0.1.0"
9
+ ---
10
+
11
+ # Channel manager
12
+
13
+ Keep the RGB Lightning node healthy and liquid. Read state every run; only buy
14
+ capacity when the user allows it and it's actually needed.
15
+
16
+ ## Critical rules — these override everything else
17
+
18
+ - **Diagnose before acting.** `rln_get_node_info` + `rln_list_channels` +
19
+ `rln_get_balances` first. Report what you see; don't guess.
20
+ - **Respect `dry_run`.** When true, describe the action you *would* take (e.g.
21
+ "buy 1M sat inbound") but do NOT call `kaleidoswap_lsp_create_order` or
22
+ `rln_pay_invoice`.
23
+ - **Buying capacity is a spend** — it routes through the host's risk gate. Never
24
+ propose one that breaches the BTC reserve, and always show the LSP fee
25
+ (`kaleidoswap_lsp_estimate_fees`) before recommending it.
26
+
27
+ ## Health checks (run in order)
28
+
29
+ 1. **Node up?** `rln_get_node_info` — pubkey, block height, synced.
30
+ 2. **Channels.** `rln_list_channels` — count, capacity, outbound vs inbound. Flag
31
+ any channel whose outbound is below the configured floor.
32
+ 3. **Stuck transfers.** `rln_refresh_transfers` to flush pending RGB transfers;
33
+ report anything still pending afterward.
34
+ 4. **Liquidity verdict.** If usable inbound (or an asset's inbound) is below the
35
+ threshold in the task parameters, that's the trigger to consider buying.
36
+
37
+ ## Buying capacity (only when needed + allowed)
38
+
39
+ 1. `kaleidoswap_lsp_get_info` — confirm the LSP is reachable + its limits.
40
+ 2. `kaleidoswap_lsp_estimate_fees` — show the fee for the size you'd buy.
41
+ 3. `kaleidoswap_lsp_create_order` (spend-gated) — create the order; it returns an
42
+ invoice/onchain address. Pay via `rln_pay_invoice` only after approval.
43
+
44
+ ## Scheduled (background) runs
45
+
46
+ When run by the `heartbeat` loop, return STRICT JSON only:
47
+
48
+ ```
49
+ {"task":"heartbeat","timestamp":"<ISO8601>","action":"ok|flush|buy_capacity|alert","dry_run":<bool>,"reason":"<why>","details":{"channels":<n>,"outbound_sat":<n>,"inbound_sat":<n>,"pending_transfers":<n>}}
50
+ ```
51
+
52
+ Use `ok` when nothing needs doing, `alert` when a human should look.
53
+
54
+ ## Don'ts
55
+
56
+ - Don't buy capacity that isn't needed, or when within the liquidity threshold.
57
+ - Don't pay an LSP invoice when `dry_run` is true.
58
+ - Don't invent channel ids, balances, or fees — read them from tools.
59
+ - Don't breach the BTC reserve to open a channel.
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: dca
3
+ description: "Dollar-cost-average a fixed budget into a target asset on a schedule. Reads the live quote and (when allowed) buys a small fixed slice via an atomic swap, respecting per-run allocation and risk limits. Triggers when the user mentions DCA, recurring buys, or averaging in — and is the skill a user-created DCA loop runs."
4
+ tools: rln_get_balances, kaleidoswap_get_quote, kaleidoswap_atomic_init, kaleidoswap_atomic_execute, kaleidoswap_atomic_status, get_price
5
+ triggers: dca, dollar cost average, recurring buy, average in, accumulate, stack
6
+ metadata:
7
+ author: kaleidoswap
8
+ version: "0.1.0"
9
+ ---
10
+
11
+ # Dollar-cost averaging
12
+
13
+ Buy a fixed, small slice of a target asset each run. Boring on purpose: same
14
+ size, every interval, regardless of price.
15
+
16
+ ## Critical rules — these override everything else
17
+
18
+ - **Fixed slice only.** The per-run budget is the task's `allocation` — never
19
+ exceed it, never "catch up" by buying extra after a missed run.
20
+ - **Respect `dry_run`.** When true, quote and report what you *would* buy; do NOT
21
+ execute.
22
+ - **Respect risk + reserve.** A DCA buy is a spend; it passes through the host's
23
+ risk gate. Never breach the BTC reserve or the max single-spend limit.
24
+
25
+ ## Each run
26
+
27
+ 1. **Check funds.** `rln_get_balances` — is there enough BTC for one slice plus
28
+ the reserve? If not, return `action: "skip"` with the reason.
29
+ 2. **Quote.** `kaleidoswap_get_quote(BTC, <asset>, <slice>)`. Read the
30
+ `to_amount_display` / `fee_display` strings verbatim — no arithmetic.
31
+ 3. **Execute** (only when `dry_run` is false and within limits): the atomic swap
32
+ recipe drives `kaleidoswap_atomic_init` → `_execute`; then poll
33
+ `kaleidoswap_atomic_status`.
34
+
35
+ ## Scheduled (background) runs
36
+
37
+ Return STRICT JSON only:
38
+
39
+ ```
40
+ {"task":"<task id>","timestamp":"<ISO8601>","action":"buy|skip","dry_run":<bool>,"reason":"<why>","details":{"asset":"<asset>","slice":"<n>","received":"<display>","fee":"<display>"}}
41
+ ```
42
+
43
+ ## Don'ts
44
+
45
+ - Don't vary the slice size or try to time the market — that's not DCA.
46
+ - Don't buy when funds are below the reserve — `skip` instead.
47
+ - Don't execute when `dry_run` is true.
48
+ - Don't invent a quote — only the current `kaleidoswap_get_quote` result is real.