@kaleidorg/mind 0.3.0 → 0.5.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.
- package/dist/funnel.d.ts +19 -0
- package/dist/funnel.d.ts.map +1 -1
- package/dist/funnel.js +48 -10
- package/dist/funnel.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/kaleidoswap/contract.d.ts +3 -3
- package/dist/kaleidoswap/contract.d.ts.map +1 -1
- package/dist/kaleidoswap/contract.js +16 -4
- package/dist/kaleidoswap/contract.js.map +1 -1
- package/dist/knowledge/bitcoin-copilot.d.ts.map +1 -1
- package/dist/knowledge/bitcoin-copilot.js +102 -0
- package/dist/knowledge/bitcoin-copilot.js.map +1 -1
- package/dist/knowledge/btc-map.d.ts +14 -17
- package/dist/knowledge/btc-map.d.ts.map +1 -1
- package/dist/knowledge/btc-map.js +66 -266
- package/dist/knowledge/btc-map.js.map +1 -1
- package/dist/lsps1/contract.d.ts.map +1 -1
- package/dist/lsps1/contract.js +28 -10
- package/dist/lsps1/contract.js.map +1 -1
- package/dist/qvac/assistant.d.ts +73 -0
- package/dist/qvac/assistant.d.ts.map +1 -0
- package/dist/qvac/assistant.js +97 -0
- package/dist/qvac/assistant.js.map +1 -0
- package/dist/qvac/config.d.ts +64 -0
- package/dist/qvac/config.d.ts.map +1 -0
- package/dist/qvac/config.js +71 -0
- package/dist/qvac/config.js.map +1 -0
- package/dist/qvac/delegate.d.ts +48 -0
- package/dist/qvac/delegate.d.ts.map +1 -0
- package/dist/qvac/delegate.js +51 -0
- package/dist/qvac/delegate.js.map +1 -0
- package/dist/qvac/index.d.ts +19 -0
- package/dist/qvac/index.d.ts.map +1 -0
- package/dist/qvac/index.js +19 -0
- package/dist/qvac/index.js.map +1 -0
- package/dist/qvac/parse.d.ts +44 -0
- package/dist/qvac/parse.d.ts.map +1 -0
- package/dist/qvac/parse.js +28 -0
- package/dist/qvac/parse.js.map +1 -0
- package/dist/qvac/provider.d.ts +49 -0
- package/dist/qvac/provider.d.ts.map +1 -0
- package/dist/qvac/provider.js +68 -0
- package/dist/qvac/provider.js.map +1 -0
- package/dist/qvac/stream.d.ts +37 -0
- package/dist/qvac/stream.d.ts.map +1 -0
- package/dist/qvac/stream.js +29 -0
- package/dist/qvac/stream.js.map +1 -0
- package/dist/qvac/text.d.ts +19 -0
- package/dist/qvac/text.d.ts.map +1 -0
- package/dist/qvac/text.js +56 -0
- package/dist/qvac/text.js.map +1 -0
- package/dist/qvac/voice.d.ts +69 -0
- package/dist/qvac/voice.d.ts.map +1 -0
- package/dist/qvac/voice.js +51 -0
- package/dist/qvac/voice.js.map +1 -0
- package/dist/recipe/buy-asset-channel.d.ts +26 -0
- package/dist/recipe/buy-asset-channel.d.ts.map +1 -0
- package/dist/recipe/buy-asset-channel.js +112 -0
- package/dist/recipe/buy-asset-channel.js.map +1 -0
- package/dist/recipe/kaleidoswap-atomic.d.ts +26 -18
- package/dist/recipe/kaleidoswap-atomic.d.ts.map +1 -1
- package/dist/recipe/kaleidoswap-atomic.js +101 -63
- package/dist/recipe/kaleidoswap-atomic.js.map +1 -1
- package/dist/recipe/kaleidoswap-channel-order.d.ts +35 -0
- package/dist/recipe/kaleidoswap-channel-order.d.ts.map +1 -0
- package/dist/recipe/kaleidoswap-channel-order.js +493 -0
- package/dist/recipe/kaleidoswap-channel-order.js.map +1 -0
- package/dist/recipe/kaleidoswap-price.d.ts +21 -0
- package/dist/recipe/kaleidoswap-price.d.ts.map +1 -0
- package/dist/recipe/kaleidoswap-price.js +57 -0
- package/dist/recipe/kaleidoswap-price.js.map +1 -0
- package/dist/recipe/runner.d.ts +7 -1
- package/dist/recipe/runner.d.ts.map +1 -1
- package/dist/recipe/runner.js +115 -29
- package/dist/recipe/runner.js.map +1 -1
- package/dist/recipe/swap.d.ts +26 -1
- package/dist/recipe/swap.d.ts.map +1 -1
- package/dist/recipe/swap.js +108 -13
- package/dist/recipe/swap.js.map +1 -1
- package/dist/recipe/types.d.ts +25 -1
- package/dist/recipe/types.d.ts.map +1 -1
- package/dist/skills/registry.d.ts +33 -1
- package/dist/skills/registry.d.ts.map +1 -1
- package/dist/skills/registry.js +45 -1
- package/dist/skills/registry.js.map +1 -1
- package/package.json +15 -1
- package/skills/README.md +3 -0
- package/skills/kaleido-lsps/SKILL.md +101 -43
- package/skills/kaleido-trading/SKILL.md +81 -31
- package/skills/merchant-finder/SKILL.md +96 -66
- package/skills/rgb-lightning-node/SKILL.md +108 -0
- package/skills/wallet-assistant/SKILL.md +32 -21
- package/src/funnel.ts +66 -11
- package/src/index.ts +14 -2
- package/src/kaleidoswap/contract.test.ts +7 -2
- package/src/kaleidoswap/contract.ts +27 -5
- package/src/knowledge/bitcoin-copilot.ts +111 -0
- package/src/knowledge/btc-map.test.ts +53 -96
- package/src/knowledge/btc-map.ts +72 -287
- package/src/lsps1/contract.ts +32 -14
- package/src/qvac/assistant.test.ts +132 -0
- package/src/qvac/assistant.ts +146 -0
- package/src/qvac/config.test.ts +44 -0
- package/src/qvac/config.ts +76 -0
- package/src/qvac/delegate.test.ts +68 -0
- package/src/qvac/delegate.ts +71 -0
- package/src/qvac/index.ts +72 -0
- package/src/qvac/parse.test.ts +52 -0
- package/src/qvac/parse.ts +57 -0
- package/src/qvac/provider.test.ts +107 -0
- package/src/qvac/provider.ts +124 -0
- package/src/qvac/stream.test.ts +79 -0
- package/src/qvac/stream.ts +56 -0
- package/src/qvac/text.test.ts +70 -0
- package/src/qvac/text.ts +60 -0
- package/src/qvac/voice.test.ts +151 -0
- package/src/qvac/voice.ts +122 -0
- package/src/recipe/buy-asset-channel.test.ts +148 -0
- package/src/recipe/buy-asset-channel.ts +118 -0
- package/src/recipe/kaleidoswap-atomic.test.ts +134 -61
- package/src/recipe/kaleidoswap-atomic.ts +112 -66
- package/src/recipe/kaleidoswap-channel-order.test.ts +333 -0
- package/src/recipe/kaleidoswap-channel-order.ts +548 -0
- package/src/recipe/kaleidoswap-price.ts +68 -0
- package/src/recipe/recipe.test.ts +61 -5
- package/src/recipe/runner.ts +128 -31
- package/src/recipe/swap.ts +109 -13
- package/src/recipe/types.ts +25 -1
- package/src/skills/registry.ts +52 -1
|
@@ -1,46 +1,77 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Built-in "
|
|
2
|
+
* Built-in "swap on KaleidoSwap" recipe — the real atomic-swap chain.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* user pays the maker's Lightning invoice, and the maker releases.
|
|
4
|
+
* A swap (especially the full maker + RLN atomic) is a 6-step, two-service flow
|
|
5
|
+
* no small model can plan reliably, so the recipe carries the plan. The model
|
|
6
|
+
* is used for natural-language understanding of the request (slot extraction).
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* "buy 1 usdt" (or "swap 10 usdt to btc")
|
|
9
|
+
* ↓ heuristic pre-filter (0 inf) decides to enter the reliable recipe branch
|
|
10
|
+
* ↓ 1 model inference (forced LLM slot extraction — the model parses intent)
|
|
11
|
+
* kaleidoswap_get_quote ← MAKER prices the swap (read-only)
|
|
12
|
+
* ↓ [ONE confirmation gate — shows the real quote numbers]
|
|
13
|
+
* kaleidoswap_atomic_init ← MAKER locks the swap → swapstring, payment_hash
|
|
14
|
+
* rln_get_node_info ← NODE read pubkey (= taker_pubkey)
|
|
15
|
+
* rln_whitelist_swap ← NODE accept the swapstring
|
|
16
|
+
* kaleidoswap_atomic_execute ← MAKER settle (final)
|
|
12
17
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* kaleidoswap_atomic_init 🔒 ← maker locks the swap, returns its invoice
|
|
19
|
-
* rln_pay_invoice 🔒 ← user pays the maker
|
|
20
|
-
* kaleidoswap_atomic_execute 🔒 ← (final) maker releases the asset
|
|
18
|
+
* `forceModelExtract` ensures the model is always consulted for slot parsing
|
|
19
|
+
* (1 inference) so natural language like "buy 1 usdt" is interpreted by the LLM.
|
|
20
|
+
* A safety fallback in the runner uses the deterministic extractor if the model
|
|
21
|
+
* returns incomplete slots. The execution sequence + single-confirm gate remain
|
|
22
|
+
* fully deterministic and reliable.
|
|
21
23
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
+
* Status is NOT polled here — settlement takes seconds-to-minutes and blocking
|
|
25
|
+
* the chat is bad UX. The recipe reports "submitted, settling"; the user (or a
|
|
26
|
+
* follow-up turn) calls `kaleidoswap_atomic_status` on demand.
|
|
27
|
+
*
|
|
28
|
+
* Confirmation: the single decision a user makes is "given this quote, proceed?"
|
|
29
|
+
* — so the recipe declares ONE `confirm(ctx)` summary, fired after the quote and
|
|
30
|
+
* before init. init/whitelist/execute then run as one approved unit. (The
|
|
31
|
+
* runner's recipe-level confirm path handles this; see recipe/runner.ts.)
|
|
24
32
|
*/
|
|
25
33
|
import { extractSwap } from './swap.js';
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
// Fire on swap intent — "swap/exchange/convert/trade", or "buy/sell/get" when a
|
|
35
|
+
// crypto asset is named (so "buy one usdt" routes here, but "buy a gift card"
|
|
36
|
+
// does not). PRICE / rate / "how much" questions are read-only and go to
|
|
37
|
+
// `kaleidoswapPriceRecipe` instead — keep them out of this match.
|
|
38
|
+
const ASSET = /\b(btc|bitcoin|sats?|usdt|tether|xaut|gold)\b/i;
|
|
39
|
+
const SWAP_INTENT = (t) => {
|
|
40
|
+
// Explanatory / educational questions → route to RAG-backed agentic answer,
|
|
41
|
+
// not the deterministic spend chain.
|
|
42
|
+
if (/\b(why|how|what|when|explain|tell\s+me|do\s+I\s+need|should\s+I|can\s+I)\b/i.test(t))
|
|
43
|
+
return false;
|
|
44
|
+
if (/\b(swap|exchange|convert|trade)\b/i.test(t))
|
|
45
|
+
return true;
|
|
46
|
+
if (/\b(buy|sell|get|purchase|acquire)\b/i.test(t) &&
|
|
47
|
+
ASSET.test(t) &&
|
|
48
|
+
// Exclude commerce / receive / LSPS1 channel-order phrasings that share
|
|
49
|
+
// the buy/get verb. "Buy a USDT channel" is a channel order, not a swap.
|
|
50
|
+
!/\b(gift\s?card|top-?up|esim|voucher|invoice|address|channel|inbound|liquidity|lsps?\b)\b/i.test(t))
|
|
51
|
+
return true;
|
|
52
|
+
return false;
|
|
53
|
+
};
|
|
30
54
|
export const kaleidoswapAtomicRecipe = {
|
|
31
55
|
name: 'kaleidoswap-atomic',
|
|
32
|
-
description: '
|
|
33
|
-
match: (t) =>
|
|
34
|
-
triggers: ['
|
|
56
|
+
description: 'Swap between BTC and an RGB asset on KaleidoSwap: quote, confirm once, then init (maker) → whitelist (node) → execute (maker).',
|
|
57
|
+
match: (t) => SWAP_INTENT(t),
|
|
58
|
+
triggers: ['swap', 'exchange', 'convert', 'trade', 'buy', 'sell'],
|
|
35
59
|
slots: [
|
|
36
60
|
{ name: 'from_asset', type: 'string', description: 'Asset to spend (BTC / USDT / XAUT)', required: true },
|
|
37
61
|
{ name: 'to_asset', type: 'string', description: 'Asset to receive (BTC / USDT / XAUT)', required: true },
|
|
38
|
-
{ name: 'amount', type: 'number', description: '
|
|
62
|
+
{ name: 'amount', type: 'number', description: 'The amount the user named' },
|
|
63
|
+
{ name: 'amount_side', type: 'string', description: "Which leg the amount is on: 'from' (sell/swap) or 'to' (buy)" },
|
|
39
64
|
],
|
|
65
|
+
// Keep the fast `extract` for the Funnel's cheap pre-filter (so "buy 1 usdt"
|
|
66
|
+
// reliably enters the recipe branch instead of falling to free agentic).
|
|
67
|
+
// `forceModelExtract` makes runRecipe ignore the deterministic result and
|
|
68
|
+
// always ask the model to produce the actual slots used for execution.
|
|
40
69
|
extract: extractSwap,
|
|
70
|
+
forceModelExtract: true,
|
|
41
71
|
confident: (s) => !!s.from_asset && !!s.to_asset && !!s.amount,
|
|
42
72
|
steps: [
|
|
43
|
-
// 1.
|
|
73
|
+
// 1. MAKER quotes the swap (read-only). Returns rfq_id + full asset specs
|
|
74
|
+
// (echoes the rgb: asset ids and maker-unit amounts) + *_display strings.
|
|
44
75
|
{
|
|
45
76
|
tool: 'kaleidoswap_get_quote',
|
|
46
77
|
as: 'quote',
|
|
@@ -48,64 +79,71 @@ export const kaleidoswapAtomicRecipe = {
|
|
|
48
79
|
from_asset: ctx.slots.from_asset,
|
|
49
80
|
to_asset: ctx.slots.to_asset,
|
|
50
81
|
amount: ctx.slots.amount,
|
|
82
|
+
// 'to' for buy ("buy 1 USDT" → amount is what you RECEIVE); default
|
|
83
|
+
// 'from' for sell/swap. The host puts the amount on the right leg.
|
|
84
|
+
amount_side: ctx.slots.amount_side ?? 'from',
|
|
51
85
|
}),
|
|
52
86
|
},
|
|
53
|
-
//
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
as: 'receive_rgb',
|
|
57
|
-
args: (ctx) => {
|
|
58
|
-
const q = ctx.results.quote;
|
|
59
|
-
return { asset: ctx.slots.to_asset, amount: q?.receive_amount };
|
|
60
|
-
},
|
|
61
|
-
skipIf: (ctx) => isBtc(ctx.slots.to_asset),
|
|
62
|
-
},
|
|
63
|
-
// 2b. User's node creates an LN receive invoice (when to_asset is BTC).
|
|
64
|
-
{
|
|
65
|
-
tool: 'rln_create_ln_invoice',
|
|
66
|
-
as: 'receive_ln',
|
|
67
|
-
args: (ctx) => {
|
|
68
|
-
const q = ctx.results.quote;
|
|
69
|
-
return { amount_sats: q?.receive_amount };
|
|
70
|
-
},
|
|
71
|
-
skipIf: (ctx) => !isBtc(ctx.slots.to_asset),
|
|
72
|
-
},
|
|
73
|
-
// 3. Maker locks the swap. Returns { atomic_id, maker_invoice }. Spend-gated.
|
|
87
|
+
// 2. MAKER locks the swap. SwapRequest is flat (asset ids + maker-unit
|
|
88
|
+
// amounts) — sourced straight from the quote result, no re-scaling.
|
|
89
|
+
// First spend step → the recipe-level confirm gate fires just before it.
|
|
74
90
|
{
|
|
75
91
|
tool: 'kaleidoswap_atomic_init',
|
|
76
|
-
as: '
|
|
92
|
+
as: 'init',
|
|
77
93
|
args: (ctx) => {
|
|
78
|
-
const rgb = ctx.results.receive_rgb;
|
|
79
|
-
const ln = ctx.results.receive_ln;
|
|
80
94
|
const q = ctx.results.quote;
|
|
81
95
|
return {
|
|
82
|
-
|
|
83
|
-
|
|
96
|
+
rfq_id: q?.rfq_id,
|
|
97
|
+
from_asset: q?.from_asset?.asset_id,
|
|
98
|
+
from_amount: q?.from_asset?.amount,
|
|
99
|
+
to_asset: q?.to_asset?.asset_id,
|
|
100
|
+
to_amount: q?.to_asset?.amount,
|
|
84
101
|
};
|
|
85
102
|
},
|
|
86
103
|
},
|
|
87
|
-
//
|
|
104
|
+
// 3. NODE: read our pubkey — the maker needs it as taker_pubkey for execute.
|
|
88
105
|
{
|
|
89
|
-
tool: '
|
|
90
|
-
as: '
|
|
106
|
+
tool: 'rln_get_node_info',
|
|
107
|
+
as: 'node',
|
|
108
|
+
args: () => ({}),
|
|
109
|
+
},
|
|
110
|
+
// 4. NODE: whitelist the maker's swapstring (accept the swap). Ungated —
|
|
111
|
+
// covered by the single confirm above.
|
|
112
|
+
{
|
|
113
|
+
tool: 'rln_whitelist_swap',
|
|
114
|
+
as: 'whitelist',
|
|
91
115
|
args: (ctx) => {
|
|
92
|
-
const
|
|
93
|
-
return {
|
|
116
|
+
const init = ctx.results.init;
|
|
117
|
+
return { swapstring: init?.swapstring };
|
|
94
118
|
},
|
|
95
119
|
},
|
|
96
120
|
],
|
|
97
|
-
// 5.
|
|
121
|
+
// 5. MAKER settles the swap. Needs swapstring + taker_pubkey + payment_hash.
|
|
98
122
|
final: {
|
|
99
123
|
tool: 'kaleidoswap_atomic_execute',
|
|
100
124
|
args: (ctx) => {
|
|
101
|
-
const
|
|
102
|
-
|
|
125
|
+
const init = ctx.results.init;
|
|
126
|
+
const node = ctx.results.node;
|
|
127
|
+
return {
|
|
128
|
+
swapstring: init?.swapstring,
|
|
129
|
+
taker_pubkey: node?.pubkey,
|
|
130
|
+
payment_hash: init?.payment_hash,
|
|
131
|
+
};
|
|
103
132
|
},
|
|
104
133
|
},
|
|
134
|
+
// ONE confirmation, fired after the quote / before init, with the real numbers.
|
|
135
|
+
confirm: (ctx) => {
|
|
136
|
+
const q = ctx.results.quote;
|
|
137
|
+
const from = q?.from_amount_display ?? `${ctx.slots.amount} ${ctx.slots.from_asset}`;
|
|
138
|
+
const to = q?.to_amount_display ?? String(ctx.slots.to_asset);
|
|
139
|
+
const fee = q?.fee_display ? ` · fee ${q.fee_display}` : '';
|
|
140
|
+
return `Swap ${from} → ${to}${fee} on KaleidoSwap. Proceed?`;
|
|
141
|
+
},
|
|
105
142
|
summary: (ctx) => {
|
|
106
143
|
const q = ctx.results.quote;
|
|
107
|
-
const
|
|
108
|
-
|
|
144
|
+
const from = q?.from_amount_display ?? `${ctx.slots.amount} ${ctx.slots.from_asset}`;
|
|
145
|
+
const to = q?.to_amount_display ?? String(ctx.slots.to_asset);
|
|
146
|
+
return `Swap submitted: ${from} → ${to}. Settling now — ask me to check the status.`;
|
|
109
147
|
},
|
|
110
148
|
};
|
|
111
149
|
//# sourceMappingURL=kaleidoswap-atomic.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kaleidoswap-atomic.js","sourceRoot":"","sources":["../../src/recipe/kaleidoswap-atomic.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"kaleidoswap-atomic.js","sourceRoot":"","sources":["../../src/recipe/kaleidoswap-atomic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,gFAAgF;AAChF,8EAA8E;AAC9E,yEAAyE;AACzE,kEAAkE;AAClE,MAAM,KAAK,GAAG,gDAAgD,CAAC;AAC/D,MAAM,WAAW,GAAG,CAAC,CAAS,EAAE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OAAO,CAAC,KAAgC,CAAC;QACvD,MAAM,IAAI,GAAG,CAAC,EAAE,mBAAmB,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;QACrF,MAAM,EAAE,GAAG,CAAC,EAAE,iBAAiB,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC9D,OAAO,mBAAmB,IAAI,MAAM,EAAE,8CAA8C,CAAC;IACvF,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in "buy inbound channel capacity from the LSP" recipe (LSPS1).
|
|
3
|
+
*
|
|
4
|
+
* "buy a 500k inbound channel"
|
|
5
|
+
* "I need 200000 sats of inbound liquidity"
|
|
6
|
+
* "open a channel from the LSP, 1M inbound for 30 days"
|
|
7
|
+
* ↓ heuristic pre-filter (0 inf) decides to enter the recipe branch
|
|
8
|
+
* ↓ 1 model inference (forced LLM slot extraction)
|
|
9
|
+
* lsp_get_info ← LSP options + assets (read-only)
|
|
10
|
+
* lsp_estimate_fees ← LSP fee preview (read-only)
|
|
11
|
+
* rln_get_node_info ← NODE client_pubkey (read-only)
|
|
12
|
+
* ↓ [ONE confirmation gate — shows estimated total fee + channel terms]
|
|
13
|
+
* lsp_create_order ← LSP creates the order → bolt11 invoice
|
|
14
|
+
* rln_pay_invoice ← NODE pays the LSP invoice → channel opens
|
|
15
|
+
*
|
|
16
|
+
* Mirrors the single-confirm pattern from kaleidoswapAtomicRecipe: the user
|
|
17
|
+
* decides ONCE on the fee, then create_order + pay_invoice run as one
|
|
18
|
+
* approved unit. The channel's actual opening is asynchronous — the recipe
|
|
19
|
+
* reports "order placed and paid, channel opening" and leaves polling to a
|
|
20
|
+
* follow-up turn (lsp_get_order) so the chat isn't blocked.
|
|
21
|
+
*
|
|
22
|
+
* forceModelExtract: a small model can't reliably regex out a fuzzy phrasing
|
|
23
|
+
* like "I want a channel from the LSP, 500k inbound for a month, no push" —
|
|
24
|
+
* so the recipe still owns the chain + the single confirm, but lets the LLM
|
|
25
|
+
* do the natural-language understanding for slot extraction.
|
|
26
|
+
*/
|
|
27
|
+
import type { Recipe } from './types.js';
|
|
28
|
+
/**
|
|
29
|
+
* Deterministic extractor — fast pre-filter for the Funnel to decide whether
|
|
30
|
+
* to enter the recipe branch. The model still runs (forceModelExtract) for
|
|
31
|
+
* the slots actually used in execution.
|
|
32
|
+
*/
|
|
33
|
+
export declare function extractChannelOrder(text: string): Record<string, unknown> | null;
|
|
34
|
+
export declare const kaleidoswapChannelOrderRecipe: Recipe;
|
|
35
|
+
//# sourceMappingURL=kaleidoswap-channel-order.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kaleidoswap-channel-order.d.ts","sourceRoot":"","sources":["../../src/recipe/kaleidoswap-channel-order.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,YAAY,CAAC;AAuCxD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAgKhF;AAwED,eAAO,MAAM,6BAA6B,EAAE,MAoP3C,CAAC"}
|