@kaleidorg/mind 0.1.0 → 0.3.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 (182) hide show
  1. package/dist/capabilities.d.ts +38 -0
  2. package/dist/capabilities.d.ts.map +1 -0
  3. package/dist/capabilities.js +41 -0
  4. package/dist/capabilities.js.map +1 -0
  5. package/dist/context/budget.d.ts +29 -0
  6. package/dist/context/budget.d.ts.map +1 -0
  7. package/dist/context/budget.js +36 -0
  8. package/dist/context/budget.js.map +1 -0
  9. package/dist/context/builder.d.ts +39 -0
  10. package/dist/context/builder.d.ts.map +1 -0
  11. package/dist/context/builder.js +77 -0
  12. package/dist/context/builder.js.map +1 -0
  13. package/dist/engine.d.ts +9 -0
  14. package/dist/engine.d.ts.map +1 -1
  15. package/dist/engine.js +1 -0
  16. package/dist/engine.js.map +1 -1
  17. package/dist/fastpath/fastpath.d.ts +38 -0
  18. package/dist/fastpath/fastpath.d.ts.map +1 -0
  19. package/dist/fastpath/fastpath.js +52 -0
  20. package/dist/fastpath/fastpath.js.map +1 -0
  21. package/dist/funnel.d.ts +117 -0
  22. package/dist/funnel.d.ts.map +1 -0
  23. package/dist/funnel.js +195 -0
  24. package/dist/funnel.js.map +1 -0
  25. package/dist/index.d.ts +44 -0
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +36 -0
  28. package/dist/index.js.map +1 -1
  29. package/dist/kaleidoswap/contract.d.ts +72 -0
  30. package/dist/kaleidoswap/contract.d.ts.map +1 -0
  31. package/dist/kaleidoswap/contract.js +125 -0
  32. package/dist/kaleidoswap/contract.js.map +1 -0
  33. package/dist/knowledge/bitcoin-copilot.d.ts +11 -0
  34. package/dist/knowledge/bitcoin-copilot.d.ts.map +1 -0
  35. package/dist/knowledge/bitcoin-copilot.js +155 -0
  36. package/dist/knowledge/bitcoin-copilot.js.map +1 -0
  37. package/dist/knowledge/btc-map.d.ts +87 -0
  38. package/dist/knowledge/btc-map.d.ts.map +1 -0
  39. package/dist/knowledge/btc-map.js +365 -0
  40. package/dist/knowledge/btc-map.js.map +1 -0
  41. package/dist/knowledge/merchants.d.ts +24 -0
  42. package/dist/knowledge/merchants.d.ts.map +1 -0
  43. package/dist/knowledge/merchants.js +34 -0
  44. package/dist/knowledge/merchants.js.map +1 -0
  45. package/dist/knowledge/wallet.d.ts +34 -0
  46. package/dist/knowledge/wallet.d.ts.map +1 -0
  47. package/dist/knowledge/wallet.js +63 -0
  48. package/dist/knowledge/wallet.js.map +1 -0
  49. package/dist/lsps1/contract.d.ts +55 -0
  50. package/dist/lsps1/contract.d.ts.map +1 -0
  51. package/dist/lsps1/contract.js +91 -0
  52. package/dist/lsps1/contract.js.map +1 -0
  53. package/dist/memory/store.d.ts +40 -0
  54. package/dist/memory/store.d.ts.map +1 -0
  55. package/dist/memory/store.js +143 -0
  56. package/dist/memory/store.js.map +1 -0
  57. package/dist/memory/tool.d.ts +9 -0
  58. package/dist/memory/tool.d.ts.map +1 -0
  59. package/dist/memory/tool.js +70 -0
  60. package/dist/memory/tool.js.map +1 -0
  61. package/dist/memory/types.d.ts +68 -0
  62. package/dist/memory/types.d.ts.map +1 -0
  63. package/dist/memory/types.js +14 -0
  64. package/dist/memory/types.js.map +1 -0
  65. package/dist/rag/retriever.d.ts +30 -0
  66. package/dist/rag/retriever.d.ts.map +1 -0
  67. package/dist/rag/retriever.js +72 -0
  68. package/dist/rag/retriever.js.map +1 -0
  69. package/dist/rag/tool.d.ts +15 -0
  70. package/dist/rag/tool.d.ts.map +1 -0
  71. package/dist/rag/tool.js +42 -0
  72. package/dist/rag/tool.js.map +1 -0
  73. package/dist/rag/types.d.ts +44 -0
  74. package/dist/rag/types.d.ts.map +1 -0
  75. package/dist/rag/types.js +11 -0
  76. package/dist/rag/types.js.map +1 -0
  77. package/dist/rag/vector-store.d.ts +23 -0
  78. package/dist/rag/vector-store.d.ts.map +1 -0
  79. package/dist/rag/vector-store.js +72 -0
  80. package/dist/rag/vector-store.js.map +1 -0
  81. package/dist/recipe/asset-send.d.ts +15 -0
  82. package/dist/recipe/asset-send.d.ts.map +1 -0
  83. package/dist/recipe/asset-send.js +83 -0
  84. package/dist/recipe/asset-send.js.map +1 -0
  85. package/dist/recipe/kaleidoswap-atomic.d.ts +27 -0
  86. package/dist/recipe/kaleidoswap-atomic.d.ts.map +1 -0
  87. package/dist/recipe/kaleidoswap-atomic.js +111 -0
  88. package/dist/recipe/kaleidoswap-atomic.js.map +1 -0
  89. package/dist/recipe/payments.d.ts +15 -0
  90. package/dist/recipe/payments.d.ts.map +1 -0
  91. package/dist/recipe/payments.js +119 -0
  92. package/dist/recipe/payments.js.map +1 -0
  93. package/dist/recipe/receive.d.ts +14 -0
  94. package/dist/recipe/receive.d.ts.map +1 -0
  95. package/dist/recipe/receive.js +109 -0
  96. package/dist/recipe/receive.js.map +1 -0
  97. package/dist/recipe/runner.d.ts +42 -0
  98. package/dist/recipe/runner.d.ts.map +1 -0
  99. package/dist/recipe/runner.js +106 -0
  100. package/dist/recipe/runner.js.map +1 -0
  101. package/dist/recipe/swap.d.ts +16 -0
  102. package/dist/recipe/swap.d.ts.map +1 -0
  103. package/dist/recipe/swap.js +73 -0
  104. package/dist/recipe/swap.js.map +1 -0
  105. package/dist/recipe/types.d.ts +71 -0
  106. package/dist/recipe/types.d.ts.map +1 -0
  107. package/dist/recipe/types.js +13 -0
  108. package/dist/recipe/types.js.map +1 -0
  109. package/dist/skills/registry.d.ts.map +1 -1
  110. package/dist/skills/registry.js +20 -2
  111. package/dist/skills/registry.js.map +1 -1
  112. package/dist/tools/cli.d.ts +43 -0
  113. package/dist/tools/cli.d.ts.map +1 -0
  114. package/dist/tools/cli.js +61 -0
  115. package/dist/tools/cli.js.map +1 -0
  116. package/dist/tools/mcp.d.ts +3 -2
  117. package/dist/tools/mcp.d.ts.map +1 -1
  118. package/dist/tools/mcp.js +3 -2
  119. package/dist/tools/mcp.js.map +1 -1
  120. package/dist/wallet/confirm.d.ts +12 -0
  121. package/dist/wallet/confirm.d.ts.map +1 -0
  122. package/dist/wallet/confirm.js +67 -0
  123. package/dist/wallet/confirm.js.map +1 -0
  124. package/dist/wallet/contract.d.ts +57 -0
  125. package/dist/wallet/contract.d.ts.map +1 -0
  126. package/dist/wallet/contract.js +113 -0
  127. package/dist/wallet/contract.js.map +1 -0
  128. package/package.json +10 -5
  129. package/skills/README.md +6 -1
  130. package/skills/kaleido-lsps/SKILL.md +56 -0
  131. package/skills/kaleido-trading/SKILL.md +85 -18
  132. package/skills/merchant-finder/SKILL.md +87 -0
  133. package/skills/paid-data/SKILL.md +12 -0
  134. package/skills/wallet-assistant/SKILL.md +38 -0
  135. package/src/capabilities.ts +79 -0
  136. package/src/context/budget.ts +46 -0
  137. package/src/context/builder.ts +100 -0
  138. package/src/context/context.test.ts +87 -0
  139. package/src/engine.ts +6 -0
  140. package/src/fastpath/fastpath.test.ts +34 -0
  141. package/src/fastpath/fastpath.ts +70 -0
  142. package/src/funnel.test.ts +207 -0
  143. package/src/funnel.ts +285 -0
  144. package/src/index.ts +128 -0
  145. package/src/kaleidoswap/contract.test.ts +147 -0
  146. package/src/kaleidoswap/contract.ts +212 -0
  147. package/src/knowledge/bitcoin-copilot.ts +177 -0
  148. package/src/knowledge/btc-map.test.ts +188 -0
  149. package/src/knowledge/btc-map.ts +446 -0
  150. package/src/knowledge/knowledge.test.ts +63 -0
  151. package/src/knowledge/merchants.ts +49 -0
  152. package/src/knowledge/wallet.ts +84 -0
  153. package/src/lsps1/contract.test.ts +81 -0
  154. package/src/lsps1/contract.ts +132 -0
  155. package/src/memory/memory.test.ts +140 -0
  156. package/src/memory/store.ts +174 -0
  157. package/src/memory/tool.ts +76 -0
  158. package/src/memory/types.ts +76 -0
  159. package/src/rag/rag.test.ts +85 -0
  160. package/src/rag/retriever.ts +94 -0
  161. package/src/rag/tool.ts +55 -0
  162. package/src/rag/types.ts +49 -0
  163. package/src/rag/vector-store.ts +78 -0
  164. package/src/recipe/asset-send.ts +79 -0
  165. package/src/recipe/kaleidoswap-atomic.test.ts +138 -0
  166. package/src/recipe/kaleidoswap-atomic.ts +117 -0
  167. package/src/recipe/payments.ts +116 -0
  168. package/src/recipe/receive.ts +98 -0
  169. package/src/recipe/recipe.test.ts +193 -0
  170. package/src/recipe/runner.ts +134 -0
  171. package/src/recipe/swap.ts +74 -0
  172. package/src/recipe/types.ts +76 -0
  173. package/src/skills/registry.ts +21 -2
  174. package/src/skills/skills.test.ts +42 -0
  175. package/src/tools/cli.test.ts +53 -0
  176. package/src/tools/cli.ts +98 -0
  177. package/src/tools/mcp.ts +3 -2
  178. package/src/wallet/confirm.test.ts +57 -0
  179. package/src/wallet/confirm.ts +74 -0
  180. package/src/wallet/contract.test.ts +89 -0
  181. package/src/wallet/contract.ts +157 -0
  182. package/skills/kaleido-wallet/SKILL.md +0 -28
@@ -0,0 +1,155 @@
1
+ /**
2
+ * Bitcoin-copilot knowledge pack — a curated, on-brand corpus to RAG over so an
3
+ * on-device assistant can answer Bitcoin / Lightning / RGB / KaleidoSwap
4
+ * questions privately. Ship it, ingest it with a Retriever, done.
5
+ *
6
+ * Concise + accurate. Extend or replace with your own docs (BOLT specs, RGB
7
+ * docs, app help, FAQs) — the format is just `RagDocument[]`.
8
+ */
9
+ export const BITCOIN_COPILOT_DOCS = [
10
+ {
11
+ id: 'inbound-liquidity',
12
+ text: 'To RECEIVE Lightning payments you need inbound liquidity — remote balance ' +
13
+ 'on a channel pointing at you. Brand-new wallets have none, so they can ' +
14
+ 'send but not receive. Get inbound liquidity by buying a channel from an ' +
15
+ 'LSP, or by receiving an on-chain deposit and swapping it into a channel.',
16
+ metadata: { topic: 'liquidity' },
17
+ },
18
+ {
19
+ id: 'outbound-liquidity',
20
+ text: 'Outbound liquidity is your local balance on a channel — what you can ' +
21
+ 'spend over Lightning. You get it by funding a channel yourself or being ' +
22
+ 'pushed funds. If you can receive but not send, you lack outbound liquidity.',
23
+ metadata: { topic: 'liquidity' },
24
+ },
25
+ {
26
+ id: 'channel-basics',
27
+ text: 'A Lightning channel is a 2-of-2 multisig funding output shared by two ' +
28
+ 'peers. It lets them send instant, low-fee payments off-chain by updating ' +
29
+ 'who owns how much, without touching the blockchain until the channel closes.',
30
+ metadata: { topic: 'lightning' },
31
+ },
32
+ {
33
+ id: 'onchain-vs-lightning',
34
+ text: 'On-chain Bitcoin transactions settle directly on the blockchain: final, ' +
35
+ 'but slower and with miner fees. Lightning payments are instant and cheap ' +
36
+ 'but require channels with liquidity. Use Lightning for spending, on-chain ' +
37
+ 'for settlement and for funding channels.',
38
+ metadata: { topic: 'lightning' },
39
+ },
40
+ {
41
+ id: 'open-channel',
42
+ text: 'Opening a channel funds a 2-of-2 output on-chain; it confirms in one or ' +
43
+ 'more blocks (or is usable immediately with 0-conf if the peer allows). ' +
44
+ 'The funder gets outbound liquidity. To get inbound, buy a channel from an ' +
45
+ 'LSP instead of opening your own.',
46
+ metadata: { topic: 'channels' },
47
+ },
48
+ {
49
+ id: 'lsp-lsps1',
50
+ text: 'An LSP (Lightning Service Provider) sells channels. With LSPS1 you place ' +
51
+ 'a channel order: choose capacity and how much inbound liquidity you want, ' +
52
+ 'pay the fee, and the LSP opens a channel to you — often 0-conf, so you can ' +
53
+ 'receive right away. KaleidoSwap acts as an LSP.',
54
+ metadata: { topic: 'channels' },
55
+ },
56
+ {
57
+ id: 'atomic-swap',
58
+ text: 'An atomic (HTLC) swap exchanges two assets so that either both legs ' +
59
+ 'happen or neither does — no counterparty can run off with your funds. ' +
60
+ 'KaleidoSwap uses a 5-step HTLC taker flow for trustless swaps.',
61
+ metadata: { topic: 'swaps' },
62
+ },
63
+ {
64
+ id: 'submarine-swap',
65
+ text: 'A submarine swap moves value between on-chain Bitcoin and Lightning ' +
66
+ 'atomically via an HTLC: send on-chain BTC and receive it on Lightning, or ' +
67
+ 'vice-versa, with no custodian. Useful to refill inbound/outbound liquidity.',
68
+ metadata: { topic: 'swaps' },
69
+ },
70
+ {
71
+ id: 'rgb-assets',
72
+ text: 'RGB is a protocol for issuing assets — like USDT and XAUT — on top of ' +
73
+ 'Bitcoin and Lightning. Validation is client-side, which keeps it private ' +
74
+ 'and scalable. On KaleidoSwap you can hold and swap RGB assets.',
75
+ metadata: { topic: 'rgb' },
76
+ },
77
+ {
78
+ id: 'colored-channels',
79
+ text: 'A colored channel is a Lightning channel that also carries an RGB asset ' +
80
+ 'balance, so you can send/receive USDT or XAUT over Lightning instantly. ' +
81
+ 'Buying an asset channel from the LSP gives you inbound capacity for that asset.',
82
+ metadata: { topic: 'rgb' },
83
+ },
84
+ {
85
+ id: 'rgb-invoice',
86
+ text: 'An RGB invoice requests a specific asset and amount and includes a ' +
87
+ 'blinded UTXO so the sender can transfer the asset privately. It differs ' +
88
+ 'from a plain Lightning (BOLT11) invoice, which is for BTC.',
89
+ metadata: { topic: 'rgb' },
90
+ },
91
+ {
92
+ id: 'rfq-quote',
93
+ text: 'Before a swap, KaleidoSwap gives a quote via RFQ (request for quote): the ' +
94
+ 'maker prices the pair (e.g. BTC/USDT) and returns the amount you will ' +
95
+ 'receive and the fees. Quotes expire — re-quote if you wait.',
96
+ metadata: { topic: 'trading' },
97
+ },
98
+ {
99
+ id: 'maker-taker',
100
+ text: 'KaleidoSwap is maker-based: a maker provides liquidity and prices, you ' +
101
+ 'are the taker who accepts a quote and executes the atomic swap. The maker ' +
102
+ 'also runs the LSP that sells channels.',
103
+ metadata: { topic: 'trading' },
104
+ },
105
+ {
106
+ id: 'mpp',
107
+ text: 'Multi-path payments (MPP) split one Lightning payment across several ' +
108
+ 'channels/routes so you can send more than any single channel allows. The ' +
109
+ 'parts recombine at the destination atomically.',
110
+ metadata: { topic: 'lightning' },
111
+ },
112
+ {
113
+ id: 'lightning-fees',
114
+ text: 'Lightning fees are tiny: a base fee plus a proportional fee per hop, paid ' +
115
+ 'to routing nodes. They are far smaller than on-chain miner fees, which is ' +
116
+ 'why Lightning suits everyday spending.',
117
+ metadata: { topic: 'fees' },
118
+ },
119
+ {
120
+ id: 'zero-conf',
121
+ text: '0-conf (zero-confirmation) means a channel is usable before its funding ' +
122
+ 'transaction is mined. It relies on trusting the channel partner not to ' +
123
+ 'double-spend; LSPs commonly offer it so you can receive instantly.',
124
+ metadata: { topic: 'channels' },
125
+ },
126
+ {
127
+ id: 'seed-backup',
128
+ text: 'Your seed phrase (12/24 words) controls your funds. Write it down offline ' +
129
+ 'and never share or photograph it. A KaleidoSwap node also needs channel ' +
130
+ 'state backups: losing them can mean losing funds in open channels.',
131
+ metadata: { topic: 'security' },
132
+ },
133
+ {
134
+ id: 'receiving',
135
+ text: 'To receive: share a Lightning invoice (BOLT11) or an on-chain address. ' +
136
+ 'For Lightning you need inbound liquidity first. For RGB assets, share an ' +
137
+ 'RGB invoice. On-chain always works but is slower.',
138
+ metadata: { topic: 'usage' },
139
+ },
140
+ {
141
+ id: 'sending',
142
+ text: 'To send: pay a Lightning invoice or a Lightning address for BTC, or use ' +
143
+ 'an on-chain address. You need outbound liquidity for Lightning. Always ' +
144
+ 'check the amount and destination before paying.',
145
+ metadata: { topic: 'usage' },
146
+ },
147
+ {
148
+ id: 'dca',
149
+ text: 'Dollar-cost averaging (DCA) buys a fixed amount on a schedule to smooth ' +
150
+ 'out price swings. KaleidoSwap can automate recurring swaps so you ' +
151
+ 'accumulate BTC or an asset over time without timing the market.',
152
+ metadata: { topic: 'trading' },
153
+ },
154
+ ];
155
+ //# sourceMappingURL=bitcoin-copilot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bitcoin-copilot.js","sourceRoot":"","sources":["../../src/knowledge/bitcoin-copilot.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,CAAC,MAAM,oBAAoB,GAAkB;IACjD;QACE,EAAE,EAAE,mBAAmB;QACvB,IAAI,EACF,4EAA4E;YAC5E,yEAAyE;YACzE,0EAA0E;YAC1E,0EAA0E;QAC5E,QAAQ,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE;KACjC;IACD;QACE,EAAE,EAAE,oBA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E,yEAAyE;YACzE,iDAAiD;QACnD,QAAQ,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;KAC7B;IACD;QACE,EAAE,EAAE,KAAK;QACT,IAAI,EACF,0EAA0E;YAC1E,oEAAoE;YACpE,iEAAiE;QACnE,QAAQ,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;KAC/B;CACF,CAAC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * BTC Map tool source — exposes `find_merchant_locations` and
3
+ * `get_merchant_info` so the agent can answer "where can I spend Bitcoin
4
+ * near me?" using the SAME tool names on every surface.
5
+ *
6
+ * - mobile → injects device GPS + a live BTC Map fetch
7
+ * - desktop → injects a live fetch (or a server-side cache)
8
+ * - eval / playground → no injection, falls back to the bundled offline list
9
+ *
10
+ * Pure data + orchestration — NO network in core. The host injects the
11
+ * `location` resolver and the `fetch` adapter; without them the source still
12
+ * runs against an offline `Merchant[]` so the skill is never dead on arrival.
13
+ *
14
+ * The result shape mirrors what rate's host returns today, so a mobile host
15
+ * can swap its bespoke merchant tools for this factory verbatim.
16
+ */
17
+ import type { ToolSource } from '../tools/source.js';
18
+ import type { Merchant } from './merchants.js';
19
+ /** A geographic point + optional human label. */
20
+ export interface LatLng {
21
+ lat: number;
22
+ lng: number;
23
+ /** Optional "Lugano, Switzerland" style label for messages. */
24
+ label?: string;
25
+ /** True when the location came from the device GPS, false for a default/fallback. */
26
+ precise?: boolean;
27
+ }
28
+ /**
29
+ * Host-injected location resolver. Core is platform-agnostic — RN has GPS,
30
+ * Node typically doesn't. When omitted, `find_merchant_locations` falls back
31
+ * to the offline merchant list.
32
+ */
33
+ export interface LocationProvider {
34
+ /** Resolve "near me" — the device location, or null if unavailable. */
35
+ getCurrent(): Promise<LatLng | null>;
36
+ /** Optional: geocode a free-text address ("Via Pessina 12, Lugano"). */
37
+ geocode?(address: string): Promise<LatLng | null>;
38
+ }
39
+ /** A merchant returned by a live BTC Map fetch. */
40
+ export interface BtcMapMerchant extends Merchant {
41
+ /** Distance from the search centre, metres. */
42
+ distance_m?: number;
43
+ /** Free-text contact extras the model can surface to the user. */
44
+ phone?: string;
45
+ website?: string;
46
+ opening_hours?: string;
47
+ }
48
+ /**
49
+ * Host-injected live-fetch adapter. Receives a normalized query and returns
50
+ * the matching merchants. The host is responsible for the HTTP call, caching,
51
+ * and any rate limits — core never reaches the network.
52
+ */
53
+ export type BtcMapFetch = (q: {
54
+ center: {
55
+ lat: number;
56
+ lng: number;
57
+ };
58
+ radiusMeters: number;
59
+ query?: string;
60
+ category?: string;
61
+ limit: number;
62
+ }) => Promise<BtcMapMerchant[]>;
63
+ export interface BtcMapToolOptions {
64
+ /** Resolve "near me" + geocode an address. RN hosts inject Expo Location. */
65
+ location?: LocationProvider;
66
+ /** Hit a live BTC Map (or your own cache). Host-injected — no network in core. */
67
+ fetch?: BtcMapFetch;
68
+ /** Offline list used when no location/fetch is available. Defaults to BTC_MAP_SAMPLE. */
69
+ offlineMerchants?: Merchant[];
70
+ /** Default for `limit` when the caller doesn't set one. Default 10. */
71
+ k?: number;
72
+ }
73
+ /** A tiny, hand-curated sample so the skill works offline out of the box. */
74
+ export declare const BTC_MAP_SAMPLE: Merchant[];
75
+ /**
76
+ * Build a ToolSource exposing `find_merchant_locations` + `get_merchant_info`.
77
+ *
78
+ * Resolution order for `find_merchant_locations`:
79
+ * 1. `near_address` provided → opts.location.geocode → opts.fetch (live)
80
+ * 2. opts.location.getCurrent → opts.fetch (live)
81
+ * 3. fall through to offline substring search over opts.offlineMerchants
82
+ *
83
+ * Any step that fails silently falls through to the next, so the skill is
84
+ * always answerable.
85
+ */
86
+ export declare function createBtcMapToolSource(opts?: BtcMapToolOptions): ToolSource;
87
+ //# sourceMappingURL=btc-map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"btc-map.d.ts","sourceRoot":"","sources":["../../src/knowledge/btc-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,UAAU,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ACzF,gBAAgB,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC9B,uEAAuE;IACvE,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ;AAED,6EAA6E;AAC7E,eAAO,MAAM,cAAc,EAAE,QAAQ,EA+GpC,CAAC;AA0EF;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,GAAE,iBAAsB,GAAG,UAAU,CAwK/E"}
@@ -0,0 +1,365 @@
1
+ /**
2
+ * BTC Map tool source — exposes `find_merchant_locations` and
3
+ * `get_merchant_info` so the agent can answer "where can I spend Bitcoin
4
+ * near me?" using the SAME tool names on every surface.
5
+ *
6
+ * - mobile → injects device GPS + a live BTC Map fetch
7
+ * - desktop → injects a live fetch (or a server-side cache)
8
+ * - eval / playground → no injection, falls back to the bundled offline list
9
+ *
10
+ * Pure data + orchestration — NO network in core. The host injects the
11
+ * `location` resolver and the `fetch` adapter; without them the source still
12
+ * runs against an offline `Merchant[]` so the skill is never dead on arrival.
13
+ *
14
+ * The result shape mirrors what rate's host returns today, so a mobile host
15
+ * can swap its bespoke merchant tools for this factory verbatim.
16
+ */
17
+ const FIND = 'find_merchant_locations';
18
+ const INFO = 'get_merchant_info';
19
+ /** A tiny, hand-curated sample so the skill works offline out of the box. */
20
+ export const BTC_MAP_SAMPLE = [
21
+ {
22
+ id: 'lugano-bitcoinpeople-cafe',
23
+ name: 'Bitcoin People Café',
24
+ category: 'cafe',
25
+ address: 'Via Pessina 12',
26
+ city: 'Lugano',
27
+ lat: 46.0037,
28
+ lng: 8.9511,
29
+ acceptedAssets: ['lightning', 'onchain'],
30
+ description: 'Specialty espresso bar; Plan ₿ Lugano partner.',
31
+ },
32
+ {
33
+ id: 'lugano-bistro-libertine',
34
+ name: 'Bistro Libertine',
35
+ category: 'restaurant',
36
+ address: 'Piazza della Riforma 3',
37
+ city: 'Lugano',
38
+ lat: 46.004,
39
+ lng: 8.952,
40
+ acceptedAssets: ['lightning', 'usdt', 'onchain'],
41
+ description: 'Italian-Swiss bistro, lunch + dinner. Accepts Tether on Liquid.',
42
+ },
43
+ {
44
+ id: 'lugano-bookshop-volta',
45
+ name: 'Libreria Volta',
46
+ category: 'shop',
47
+ address: 'Via Cattedrale 8',
48
+ city: 'Lugano',
49
+ lat: 46.0055,
50
+ lng: 8.9499,
51
+ acceptedAssets: ['lightning'],
52
+ description: 'Independent bookshop; Italian, English and German titles.',
53
+ },
54
+ {
55
+ id: 'lisbon-meson-andaluz',
56
+ name: 'Mesón Andaluz',
57
+ category: 'restaurant',
58
+ address: 'Rua das Flores 42',
59
+ city: 'Lisbon',
60
+ lat: 38.71,
61
+ lng: -9.143,
62
+ acceptedAssets: ['lightning', 'onchain'],
63
+ description: 'Andalusian tapas in Chiado. Bitcoin accepted since 2022.',
64
+ },
65
+ {
66
+ id: 'lisbon-surf-bitcoin',
67
+ name: 'Surf & Sats',
68
+ category: 'shop',
69
+ address: 'Av. da Liberdade 180',
70
+ city: 'Lisbon',
71
+ lat: 38.7211,
72
+ lng: -9.1466,
73
+ acceptedAssets: ['lightning'],
74
+ description: 'Surfboard rental and lessons in Costa da Caparica.',
75
+ },
76
+ {
77
+ id: 'sansalvador-elzonte-hope',
78
+ name: 'Hope House El Zonte',
79
+ category: 'cafe',
80
+ address: 'Calle Principal',
81
+ city: 'El Zonte',
82
+ lat: 13.492,
83
+ lng: -89.4395,
84
+ acceptedAssets: ['lightning', 'onchain'],
85
+ description: 'Bitcoin Beach hub. Coffee, community, and a Lightning ATM.',
86
+ },
87
+ {
88
+ id: 'sansalvador-elzonte-garten',
89
+ name: 'Garten Restaurante',
90
+ category: 'restaurant',
91
+ address: 'Bitcoin Beach',
92
+ city: 'El Zonte',
93
+ lat: 13.4925,
94
+ lng: -89.438,
95
+ acceptedAssets: ['lightning'],
96
+ description: 'Beachfront restaurant, full Bitcoin payments since 2021.',
97
+ },
98
+ {
99
+ id: 'nyc-pubkey',
100
+ name: 'PubKey',
101
+ category: 'bar',
102
+ address: '85 Washington Pl',
103
+ city: 'New York',
104
+ lat: 40.732,
105
+ lng: -73.999,
106
+ acceptedAssets: ['lightning', 'onchain'],
107
+ description: 'Bitcoin bar in Greenwich Village — meetups, Lightning tap.',
108
+ },
109
+ {
110
+ id: 'prague-paralelni-polis',
111
+ name: 'Paralelní Polis',
112
+ category: 'cafe',
113
+ address: 'Dělnická 43',
114
+ city: 'Prague',
115
+ lat: 50.105,
116
+ lng: 14.448,
117
+ acceptedAssets: ['lightning', 'onchain', 'monero'],
118
+ description: 'Crypto-only café and hackerspace — no fiat accepted, ever.',
119
+ },
120
+ {
121
+ id: 'amsterdam-bitcoin-embassy',
122
+ name: 'Bitcoin Embassy Amsterdam',
123
+ category: 'cafe',
124
+ address: 'Nieuwezijds Voorburgwal 162',
125
+ city: 'Amsterdam',
126
+ lat: 52.374,
127
+ lng: 4.893,
128
+ acceptedAssets: ['lightning', 'onchain'],
129
+ description: 'Co-working café and meetup hub, Lightning tap on draft beer.',
130
+ },
131
+ ];
132
+ /** Clamp a value to a numeric range, returning the default when input is bad. */
133
+ function clamp(n, lo, hi, dflt) {
134
+ const v = Number(n);
135
+ if (!Number.isFinite(v))
136
+ return dflt;
137
+ return Math.min(hi, Math.max(lo, v));
138
+ }
139
+ /** Substring scoring used by the offline fallback (matches the old behavior). */
140
+ function fuzzyScore(query, text) {
141
+ const q = query.toLowerCase();
142
+ const t = text.toLowerCase();
143
+ if (!q)
144
+ return 1;
145
+ if (t.includes(q))
146
+ return 1;
147
+ let hits = 0;
148
+ let qi = 0;
149
+ for (let i = 0; i < t.length && qi < q.length; i++) {
150
+ if (t[i] === q[qi]) {
151
+ hits++;
152
+ qi++;
153
+ }
154
+ }
155
+ return hits / q.length;
156
+ }
157
+ /** Map a Merchant → the response row the model sees (stable for rate parity). */
158
+ function row(m) {
159
+ return {
160
+ id: m.id,
161
+ name: m.name,
162
+ address: m.address,
163
+ category: m.category,
164
+ lat: m.lat,
165
+ lng: m.lng,
166
+ distance_m: m.distance_m,
167
+ phone: m.phone,
168
+ website: m.website,
169
+ opening_hours: m.opening_hours,
170
+ accepts_bitcoin: m.acceptedAssets?.includes('onchain') ?? true,
171
+ accepts_lightning: m.acceptedAssets?.includes('lightning') ?? true,
172
+ };
173
+ }
174
+ /** Offline search: substring + optional category over the bundled list. */
175
+ function searchOffline(merchants, query, category, limit) {
176
+ let filtered = merchants;
177
+ if (category) {
178
+ const c = category.toLowerCase().trim();
179
+ filtered = filtered.filter((m) => (m.category ?? '').toLowerCase() === c);
180
+ }
181
+ const q = (query ?? '').trim();
182
+ if (q.length >= 2) {
183
+ filtered = filtered
184
+ .map((m) => {
185
+ const hay = `${m.name ?? ''} ${m.description ?? ''} ${m.address ?? ''} ${m.city ?? ''}`;
186
+ const score = fuzzyScore(q, m.name ?? '') * 3 +
187
+ fuzzyScore(q, m.address ?? '') * 2 +
188
+ fuzzyScore(q, hay) * 1;
189
+ return { m, score };
190
+ })
191
+ .filter((x) => x.score > 0.3)
192
+ .sort((a, b) => b.score - a.score)
193
+ .map((x) => x.m);
194
+ }
195
+ return filtered.slice(0, limit);
196
+ }
197
+ /**
198
+ * Build a ToolSource exposing `find_merchant_locations` + `get_merchant_info`.
199
+ *
200
+ * Resolution order for `find_merchant_locations`:
201
+ * 1. `near_address` provided → opts.location.geocode → opts.fetch (live)
202
+ * 2. opts.location.getCurrent → opts.fetch (live)
203
+ * 3. fall through to offline substring search over opts.offlineMerchants
204
+ *
205
+ * Any step that fails silently falls through to the next, so the skill is
206
+ * always answerable.
207
+ */
208
+ export function createBtcMapToolSource(opts = {}) {
209
+ const offline = opts.offlineMerchants ?? BTC_MAP_SAMPLE;
210
+ const defaultLimit = opts.k ?? 10;
211
+ const find = {
212
+ name: FIND,
213
+ description: "Find Bitcoin-accepting merchants near the user using live BTC Map data " +
214
+ "and the device's real location when available. Use when the user wants " +
215
+ 'merchants, shops, restaurants, cafes, bars, ATMs, or places to spend ' +
216
+ 'Bitcoin nearby. Pass ONLY the fields the user actually named — do not ' +
217
+ 'invent constraints (e.g. omit `query` when they just say "near me").',
218
+ parameters: {
219
+ type: 'object',
220
+ properties: {
221
+ query: { type: 'string', description: 'Optional filter for merchant name or type, e.g. "coffee"' },
222
+ category: { type: 'string', description: 'restaurant | cafe | bar | shop | grocery | lodging | atm' },
223
+ near_address: { type: 'string', description: 'Address/city to search around instead of the current location' },
224
+ radius_km: { type: 'number', description: 'Search radius in km (0.25–50, default 5)' },
225
+ limit: { type: 'number', description: 'Max number of results (1–20, default 10)' },
226
+ },
227
+ },
228
+ };
229
+ const info = {
230
+ name: INFO,
231
+ description: 'Get detailed information about one specific merchant by id or name — ' +
232
+ 'full address, accepted assets, contact details. Use after ' +
233
+ 'find_merchant_locations when the user asks for more on a specific result.',
234
+ parameters: {
235
+ type: 'object',
236
+ properties: {
237
+ merchant_id: { type: 'string', description: 'Merchant id from find_merchant_locations (string or number)' },
238
+ merchant_name: { type: 'string', description: 'Merchant name (used when id is unknown)' },
239
+ },
240
+ },
241
+ };
242
+ async function tryLive(center, radiusMeters, query, category, limit) {
243
+ if (!opts.fetch)
244
+ return null;
245
+ try {
246
+ return await opts.fetch({
247
+ center: { lat: center.lat, lng: center.lng },
248
+ radiusMeters,
249
+ query,
250
+ category,
251
+ limit,
252
+ });
253
+ }
254
+ catch {
255
+ return null;
256
+ }
257
+ }
258
+ async function resolveCenter(near_address) {
259
+ if (!opts.location)
260
+ return null;
261
+ if (near_address && near_address.trim().length >= 2 && opts.location.geocode) {
262
+ try {
263
+ const pt = await opts.location.geocode(near_address);
264
+ if (pt)
265
+ return { ...pt, label: near_address, precise: false };
266
+ }
267
+ catch {
268
+ /* fall through */
269
+ }
270
+ }
271
+ try {
272
+ return await opts.location.getCurrent();
273
+ }
274
+ catch {
275
+ return null;
276
+ }
277
+ }
278
+ async function findLocations(args) {
279
+ const query = args.query ? String(args.query) : undefined;
280
+ const category = args.category ? String(args.category) : undefined;
281
+ const near_address = args.near_address ? String(args.near_address) : undefined;
282
+ const radius_km = clamp(args.radius_km, 0.25, 50, 5);
283
+ const limit = clamp(args.limit, 1, 20, defaultLimit);
284
+ const radiusMeters = radius_km * 1000;
285
+ // 1 + 2. Try the live path when we can.
286
+ const center = await resolveCenter(near_address);
287
+ if (center) {
288
+ const live = await tryLive(center, radiusMeters, query, category, limit);
289
+ if (live) {
290
+ const where = center.label || (center.precise ? 'your location' : 'the default location');
291
+ return {
292
+ success: true,
293
+ source: 'btcmap',
294
+ precise_location: !!center.precise,
295
+ center: { lat: center.lat, lng: center.lng },
296
+ merchants: live.map(row),
297
+ total_found: live.length,
298
+ message: live.length > 0
299
+ ? `Found ${live.length} Bitcoin merchant${live.length === 1 ? '' : 's'} near ${where}${query ? ` matching "${query}"` : ''}.`
300
+ : `No Bitcoin merchants found within ${radius_km} km of ${where}. Try widening the radius.`,
301
+ };
302
+ }
303
+ }
304
+ // 3. Offline fallback.
305
+ const found = searchOffline(offline, query, category, limit);
306
+ return {
307
+ success: true,
308
+ source: 'offline',
309
+ precise_location: false,
310
+ merchants: found.map(row),
311
+ total_found: found.length,
312
+ message: found.length > 0
313
+ ? `Showing ${found.length} merchant${found.length === 1 ? '' : 's'} from the offline list${query ? ` matching "${query}"` : ''}.`
314
+ : `No merchants in the offline list matched${query ? ` "${query}"` : ''}. The host hasn't injected a live BTC Map fetch.`,
315
+ };
316
+ }
317
+ async function getInfo(args) {
318
+ const idArg = args.merchant_id;
319
+ const nameArg = args.merchant_name ? String(args.merchant_name).trim() : '';
320
+ let m;
321
+ if (idArg !== undefined && idArg !== null && idArg !== '') {
322
+ const want = String(idArg);
323
+ m = offline.find((x) => String(x.id) === want);
324
+ }
325
+ if (!m && nameArg.length >= 2) {
326
+ const q = nameArg.toLowerCase();
327
+ m =
328
+ offline.find((x) => (x.name ?? '').toLowerCase() === q) ??
329
+ offline
330
+ .map((x) => ({ x, score: fuzzyScore(q, (x.name ?? '').toLowerCase()) }))
331
+ .filter((r) => r.score > 0.5)
332
+ .sort((a, b) => b.score - a.score)[0]?.x;
333
+ }
334
+ if (!m) {
335
+ const suggestions = nameArg
336
+ ? offline
337
+ .map((x) => ({ name: x.name ?? '', score: fuzzyScore(nameArg.toLowerCase(), (x.name ?? '').toLowerCase()) }))
338
+ .filter((r) => r.score > 0.3)
339
+ .sort((a, b) => b.score - a.score)
340
+ .slice(0, 3)
341
+ .map((r) => r.name)
342
+ : [];
343
+ return {
344
+ success: false,
345
+ error: `Could not find merchant${nameArg ? ` "${nameArg}"` : idArg !== undefined ? ` with id ${idArg}` : ''}.`,
346
+ suggestions: suggestions.length ? suggestions : undefined,
347
+ };
348
+ }
349
+ return { success: true, merchant: { ...row(m), city: m.city } };
350
+ }
351
+ async function execute(name, args) {
352
+ if (name === FIND)
353
+ return findLocations(args);
354
+ if (name === INFO)
355
+ return getInfo(args);
356
+ throw new Error(`btc-map: unknown tool "${name}"`);
357
+ }
358
+ return {
359
+ id: 'btc-map',
360
+ listTools: () => [find, info],
361
+ has: (name) => name === FIND || name === INFO,
362
+ execute,
363
+ };
364
+ }
365
+ //# sourceMappingURL=btc-map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"btc-map.js","sourceRoot":"","sources":["../../src/knowledge/btc-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,MAAM,IAAI,GAAG,yBAAyB,CAAC;AACvC,MAAM,IAAI,GAAG,mBAAmB,CAAC;AA0DjC,6EAA6E;AAC7E,MAAM,CAAC,MAAM,cAAc,GAAe;IACxC;QACE,EAAE,EAAE,2BAA2B;QAC/B,IAAI,EAAE,qBAAqB;QAC3B,QAAQ,EAAE,MAAM;QAChB,OAAO,EAAE,gBAAgB;QACzB,IAAI,EAAE,QAAQ;QACd,GAAG,EAAE,OAAO;QACZ,GAAG,EAAE,MAAM;QACX,cAAc,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC;QACxC,WAAW,EAAE,gDAAgD;KAC9D;IACD;QACE,EAAE,EAAE,yBAAyB;QAC7B,IAAI,EAAE,kBAAkB;QACxB,QAAQ,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Q,EAAE,EAAE,GAAG,GAAG,CAAC,CAAmB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;IACpF,CAAC;IAED,KAAK,UAAU,OAAO,CAAC,IAAY,EAAE,IAA6B;QAChE,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,GAAG,CAAC,CAAC;IACrD,CAAC;IAED,OAAO;QACL,EAAE,EAAE,SAAS;QACb,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC;QAC7B,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI;QAC7C,OAAO;KACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * BTC map discovery — turn a merchant directory (e.g. BTCMap / a local dataset)
3
+ * into `RagDocument[]` so the agent can answer "where can I spend Bitcoin for
4
+ * coffee near me?" with on-device semantic search over places.
5
+ *
6
+ * Pure transform over a generic Merchant shape. Coordinates are kept in
7
+ * metadata so the host can still pin results on a map after retrieval.
8
+ */
9
+ import type { RagDocument } from '../rag/types.js';
10
+ export interface Merchant {
11
+ id?: string;
12
+ name?: string;
13
+ category?: string;
14
+ address?: string;
15
+ city?: string;
16
+ lat?: number;
17
+ lng?: number;
18
+ /** e.g. ['onchain', 'lightning', 'rgb']. */
19
+ acceptedAssets?: string[];
20
+ description?: string;
21
+ }
22
+ /** One searchable doc per merchant; lat/lng preserved in metadata for mapping. */
23
+ export declare function merchantsToDocuments(merchants: Merchant[]): RagDocument[];
24
+ //# sourceMappingURL=merchants.d.ts.map