tollkit-wallet 0.2.0 → 0.2.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.
package/README.md CHANGED
@@ -56,7 +56,11 @@ The agent has no tool for this.
56
56
  }
57
57
  ```
58
58
 
59
- Tools: `wallet_status`, `wallet_balances`, `swap_quote`, `swap`, `pay_fetch`, `seller_check`, `receipts`, `autopilot_propose`, `autopilot_rules`, `autopilot_cancel`, `paper_swap`, `paper_status`. There is no tool for changing limits, approvals or keys.
59
+ Tools: `wallet_status`, `wallet_balances`, `swap_quote`, `swap`, `pay_fetch`, `seller_check`, `receipts`, `market_prices`, `price_history`, `autopilot_propose`, `autopilot_rules`, `autopilot_cancel`, `paper_swap`, `paper_status`. There is no tool for changing limits, approvals or keys.
60
+
61
+ The easiest way: open the dashboard (`tollkit-wallet ui`), click **Connect your AI**, type your wallet password and click **Add** next to your app. It finds Claude desktop, Claude Code, Cursor, Codex and Gemini CLI on your computer and adds the wallet to their settings for you (keeping a backup of any file it changes); VS Code opens to confirm. Each app also has the steps to do it by hand.
62
+
63
+ The app needs to unlock the wallet on its own, so adding an app saves your password to `~/.tollkit-wallet/password`, readable only by your user account (or run `tollkit-wallet password-file` to do just that step). Anyone who can read that file and your wallet folder can spend within your limits, so keep both on this computer.
60
64
 
61
65
  ## Use with Coinbase AgentKit
62
66
 
@@ -69,7 +73,7 @@ const wallet = await TollkitWallet.open(process.env.TOLLKIT_WALLET_PASSWORD!);
69
73
  const agentkit = await AgentKit.from({ walletProvider, actionProviders: [tollkitWalletActionProvider(wallet)] });
70
74
  ```
71
75
 
72
- This adds `tollkit_swap`, `tollkit_swap_quote`, `tollkit_pay_fetch`, `tollkit_wallet_balances`, `tollkit_wallet_status`, `tollkit_seller_check` and `tollkit_receipts`. They use the Tollkit wallet's own keys and limits, whatever AgentKit wallet provider you use.
76
+ This adds the same 14 tools as the MCP server, with a `tollkit_` prefix (`tollkit_swap`, `tollkit_pay_fetch`, `tollkit_autopilot_propose`, …). They use the Tollkit wallet's own keys and limits, whatever AgentKit wallet provider you use.
73
77
 
74
78
  ## Use with ElizaOS
75
79
 
@@ -120,6 +124,14 @@ Or use the **Autopilot** tab in the dashboard (`tollkit-wallet ui`). Rule types:
120
124
  - The autopilot runs while the wallet runs: keep the dashboard open, or run `tollkit-wallet autopilot` on a computer or small server that stays on. Only one copy runs rules at a time.
121
125
  - Limit orders fill only at their price or better (within 1% for fees and spread). Stops always sell. When selling all of a chain's coin, a little is kept for network fees.
122
126
 
127
+ ### Chat with your AI on the Autopilot tab
128
+
129
+ If Claude Code is installed and signed in on this computer, the Autopilot tab is a chat. Say what you want in your own words ("protect my ETH if it drops hard", "buy SOL on dips, $20 at a time"); Claude checks your balances, live prices and recent price history, explains its thinking, and suggests rules as cards you turn on with one tap. It runs on your own Claude plan.
130
+
131
+ For these chats Claude Code runs with its own tools switched off and only the wallet's advisor tools available (`tollkit-wallet mcp --advisor`: balances, limits, receipts, prices, price history, your rules, and suggesting rules). It can't trade, pay, withdraw or change limits, and its suggestions always wait for you, even if you let other agents turn rules on.
132
+
133
+ **Check-ins:** pick every 1, 4, 12 or 24 hours and Claude reviews your rules against the market and what you've told it, then suggests changes (for example raising a stop-loss after a rise). A suggested change replaces the old rule only when you turn it on. If Telegram is set up, check-in suggestions also arrive there with Approve and Deny. Check-ins run while the dashboard is open.
134
+
123
135
  ## Paper trading
124
136
 
125
137
  Practise with pretend money at real live prices, fees included, under the same limits:
@@ -11,3 +11,7 @@ Coin and chain logos in `src/coin-icons.ts` come from web3icons (`@web3icons/cor
11
11
  > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
12
 
13
13
  The coin and network names and logos are trademarks of their owners and are used only to identify the assets and networks the wallet supports.
14
+
15
+ ## Simple Icons
16
+
17
+ The Claude, Cursor, GitHub Copilot and Gemini logos in the dashboard's "Connect your AI" picker (`src/ai-icons.ts`) come from Simple Icons (https://simpleicons.org), whose data is released under CC0 1.0. The logos are trademarks of their owners and are shown only to say which apps work with the wallet.
package/dist/actions.d.ts CHANGED
@@ -80,11 +80,14 @@ export declare const ProposeArgs: z.ZodObject<{
80
80
  max_price: z.ZodOptional<z.ZodNumber>;
81
81
  group: z.ZodOptional<z.ZodString>;
82
82
  expires_at: z.ZodOptional<z.ZodString>;
83
+ reason: z.ZodOptional<z.ZodString>;
84
+ replaces: z.ZodOptional<z.ZodString>;
83
85
  }, "strip", z.ZodTypeAny, {
84
86
  chain: "base" | "ethereum" | "solana";
85
87
  kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca";
86
88
  token: string;
87
89
  every?: "hour" | "day" | "week" | undefined;
90
+ reason?: string | undefined;
88
91
  name?: string | undefined;
89
92
  sell_amount?: string | undefined;
90
93
  amount_usd?: number | undefined;
@@ -96,11 +99,13 @@ export declare const ProposeArgs: z.ZodObject<{
96
99
  max_price?: number | undefined;
97
100
  group?: string | undefined;
98
101
  expires_at?: string | undefined;
102
+ replaces?: string | undefined;
99
103
  }, {
100
104
  chain: "base" | "ethereum" | "solana";
101
105
  kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca";
102
106
  token: string;
103
107
  every?: "hour" | "day" | "week" | undefined;
108
+ reason?: string | undefined;
104
109
  name?: string | undefined;
105
110
  sell_amount?: string | undefined;
106
111
  amount_usd?: number | undefined;
@@ -112,6 +117,7 @@ export declare const ProposeArgs: z.ZodObject<{
112
117
  max_price?: number | undefined;
113
118
  group?: string | undefined;
114
119
  expires_at?: string | undefined;
120
+ replaces?: string | undefined;
115
121
  }>, "many">>;
116
122
  }, "strip", z.ZodTypeAny, {
117
123
  rules?: {
@@ -119,6 +125,7 @@ export declare const ProposeArgs: z.ZodObject<{
119
125
  kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca";
120
126
  token: string;
121
127
  every?: "hour" | "day" | "week" | undefined;
128
+ reason?: string | undefined;
122
129
  name?: string | undefined;
123
130
  sell_amount?: string | undefined;
124
131
  amount_usd?: number | undefined;
@@ -130,6 +137,7 @@ export declare const ProposeArgs: z.ZodObject<{
130
137
  max_price?: number | undefined;
131
138
  group?: string | undefined;
132
139
  expires_at?: string | undefined;
140
+ replaces?: string | undefined;
133
141
  }[] | undefined;
134
142
  text?: string | undefined;
135
143
  }, {
@@ -138,6 +146,7 @@ export declare const ProposeArgs: z.ZodObject<{
138
146
  kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca";
139
147
  token: string;
140
148
  every?: "hour" | "day" | "week" | undefined;
149
+ reason?: string | undefined;
141
150
  name?: string | undefined;
142
151
  sell_amount?: string | undefined;
143
152
  amount_usd?: number | undefined;
@@ -149,6 +158,7 @@ export declare const ProposeArgs: z.ZodObject<{
149
158
  max_price?: number | undefined;
150
159
  group?: string | undefined;
151
160
  expires_at?: string | undefined;
161
+ replaces?: string | undefined;
152
162
  }[] | undefined;
153
163
  text?: string | undefined;
154
164
  }>;
@@ -166,6 +176,58 @@ export declare const RuleIdArgs: z.ZodObject<{
166
176
  }, {
167
177
  id: string;
168
178
  }>;
179
+ export declare const HistoryArgs: z.ZodObject<{
180
+ token: z.ZodEnum<["ETH", "WETH", "SOL"]>;
181
+ interval: z.ZodOptional<z.ZodEnum<["15m", "1h", "6h", "1d"]>>;
182
+ points: z.ZodOptional<z.ZodNumber>;
183
+ }, "strip", z.ZodTypeAny, {
184
+ token: "ETH" | "WETH" | "SOL";
185
+ interval?: "15m" | "1h" | "6h" | "1d" | undefined;
186
+ points?: number | undefined;
187
+ }, {
188
+ token: "ETH" | "WETH" | "SOL";
189
+ interval?: "15m" | "1h" | "6h" | "1d" | undefined;
190
+ points?: number | undefined;
191
+ }>;
192
+ /** Coinbase Exchange public candles: [time, low, high, open, close, volume], newest first, at most 300, no key. */
193
+ export declare function priceHistory(a: z.infer<typeof HistoryArgs>, f?: typeof fetch): Promise<{
194
+ ok: boolean;
195
+ refused: {
196
+ code: string;
197
+ reason: string;
198
+ };
199
+ token?: undefined;
200
+ interval?: undefined;
201
+ source?: undefined;
202
+ from?: undefined;
203
+ to?: undefined;
204
+ open?: undefined;
205
+ last?: undefined;
206
+ change_pct?: undefined;
207
+ high?: undefined;
208
+ low?: undefined;
209
+ candles?: undefined;
210
+ } | {
211
+ ok: boolean;
212
+ token: "ETH" | "WETH" | "SOL";
213
+ interval: "15m" | "1h" | "6h" | "1d";
214
+ source: string;
215
+ from: string;
216
+ to: string;
217
+ open: number;
218
+ last: number;
219
+ change_pct: number;
220
+ high: number;
221
+ low: number;
222
+ candles: {
223
+ t: string;
224
+ open: number;
225
+ high: number;
226
+ low: number;
227
+ close: number;
228
+ }[];
229
+ refused?: undefined;
230
+ }>;
169
231
  export interface WalletAction<S extends z.ZodTypeAny = z.ZodTypeAny> {
170
232
  name: string;
171
233
  description: string;
@@ -242,6 +304,18 @@ export declare const ACTIONS: readonly [WalletAction<z.ZodObject<{}, "strip", z.
242
304
  }, {
243
305
  since?: string | undefined;
244
306
  limit?: number | undefined;
307
+ }>>, WalletAction<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>, WalletAction<z.ZodObject<{
308
+ token: z.ZodEnum<["ETH", "WETH", "SOL"]>;
309
+ interval: z.ZodOptional<z.ZodEnum<["15m", "1h", "6h", "1d"]>>;
310
+ points: z.ZodOptional<z.ZodNumber>;
311
+ }, "strip", z.ZodTypeAny, {
312
+ token: "ETH" | "WETH" | "SOL";
313
+ interval?: "15m" | "1h" | "6h" | "1d" | undefined;
314
+ points?: number | undefined;
315
+ }, {
316
+ token: "ETH" | "WETH" | "SOL";
317
+ interval?: "15m" | "1h" | "6h" | "1d" | undefined;
318
+ points?: number | undefined;
245
319
  }>>, WalletAction<z.ZodObject<{
246
320
  text: z.ZodOptional<z.ZodString>;
247
321
  rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -260,11 +334,14 @@ export declare const ACTIONS: readonly [WalletAction<z.ZodObject<{}, "strip", z.
260
334
  max_price: z.ZodOptional<z.ZodNumber>;
261
335
  group: z.ZodOptional<z.ZodString>;
262
336
  expires_at: z.ZodOptional<z.ZodString>;
337
+ reason: z.ZodOptional<z.ZodString>;
338
+ replaces: z.ZodOptional<z.ZodString>;
263
339
  }, "strip", z.ZodTypeAny, {
264
340
  chain: "base" | "ethereum" | "solana";
265
341
  kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca";
266
342
  token: string;
267
343
  every?: "hour" | "day" | "week" | undefined;
344
+ reason?: string | undefined;
268
345
  name?: string | undefined;
269
346
  sell_amount?: string | undefined;
270
347
  amount_usd?: number | undefined;
@@ -276,11 +353,13 @@ export declare const ACTIONS: readonly [WalletAction<z.ZodObject<{}, "strip", z.
276
353
  max_price?: number | undefined;
277
354
  group?: string | undefined;
278
355
  expires_at?: string | undefined;
356
+ replaces?: string | undefined;
279
357
  }, {
280
358
  chain: "base" | "ethereum" | "solana";
281
359
  kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca";
282
360
  token: string;
283
361
  every?: "hour" | "day" | "week" | undefined;
362
+ reason?: string | undefined;
284
363
  name?: string | undefined;
285
364
  sell_amount?: string | undefined;
286
365
  amount_usd?: number | undefined;
@@ -292,6 +371,7 @@ export declare const ACTIONS: readonly [WalletAction<z.ZodObject<{}, "strip", z.
292
371
  max_price?: number | undefined;
293
372
  group?: string | undefined;
294
373
  expires_at?: string | undefined;
374
+ replaces?: string | undefined;
295
375
  }>, "many">>;
296
376
  }, "strip", z.ZodTypeAny, {
297
377
  rules?: {
@@ -299,6 +379,7 @@ export declare const ACTIONS: readonly [WalletAction<z.ZodObject<{}, "strip", z.
299
379
  kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca";
300
380
  token: string;
301
381
  every?: "hour" | "day" | "week" | undefined;
382
+ reason?: string | undefined;
302
383
  name?: string | undefined;
303
384
  sell_amount?: string | undefined;
304
385
  amount_usd?: number | undefined;
@@ -310,6 +391,7 @@ export declare const ACTIONS: readonly [WalletAction<z.ZodObject<{}, "strip", z.
310
391
  max_price?: number | undefined;
311
392
  group?: string | undefined;
312
393
  expires_at?: string | undefined;
394
+ replaces?: string | undefined;
313
395
  }[] | undefined;
314
396
  text?: string | undefined;
315
397
  }, {
@@ -318,6 +400,7 @@ export declare const ACTIONS: readonly [WalletAction<z.ZodObject<{}, "strip", z.
318
400
  kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca";
319
401
  token: string;
320
402
  every?: "hour" | "day" | "week" | undefined;
403
+ reason?: string | undefined;
321
404
  name?: string | undefined;
322
405
  sell_amount?: string | undefined;
323
406
  amount_usd?: number | undefined;
@@ -329,6 +412,7 @@ export declare const ACTIONS: readonly [WalletAction<z.ZodObject<{}, "strip", z.
329
412
  max_price?: number | undefined;
330
413
  group?: string | undefined;
331
414
  expires_at?: string | undefined;
415
+ replaces?: string | undefined;
332
416
  }[] | undefined;
333
417
  text?: string | undefined;
334
418
  }>>, WalletAction<z.ZodObject<{
@@ -362,3 +446,98 @@ export declare const ACTIONS: readonly [WalletAction<z.ZodObject<{}, "strip", z.
362
446
  buy: string;
363
447
  slippage_bps?: number | undefined;
364
448
  }>>, WalletAction<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>];
449
+ export declare function proposeRules(w: TollkitWallet, a: z.infer<typeof ProposeArgs>, o?: {
450
+ neverAuto?: boolean;
451
+ }): Promise<{
452
+ ok: boolean;
453
+ refused: {
454
+ code: string;
455
+ reason: string;
456
+ };
457
+ unparsed: string[];
458
+ rules?: undefined;
459
+ note?: undefined;
460
+ } | {
461
+ ok: boolean;
462
+ refused: {
463
+ code: string;
464
+ reason: string;
465
+ };
466
+ rules: {
467
+ id: string;
468
+ status: import("./rules.js").RuleStatus;
469
+ description: string;
470
+ created_by: "owner" | "agent";
471
+ last_price: number | undefined;
472
+ fills: number;
473
+ last_fill: import("./rules.js").Fill | undefined;
474
+ error: string | undefined;
475
+ rule: {
476
+ state: undefined;
477
+ id: string;
478
+ status: import("./rules.js").RuleStatus;
479
+ created_by: "owner" | "agent";
480
+ created_at: string;
481
+ activated_at?: string;
482
+ chain: "base" | "ethereum" | "solana";
483
+ kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca";
484
+ token: string;
485
+ every?: "hour" | "day" | "week" | undefined;
486
+ reason?: string | undefined;
487
+ name?: string | undefined;
488
+ sell_amount?: string | undefined;
489
+ amount_usd?: number | undefined;
490
+ sell_percent?: number | undefined;
491
+ trigger_price?: number | undefined;
492
+ trail_pct?: number | undefined;
493
+ weekday?: number | undefined;
494
+ times?: number | undefined;
495
+ max_price?: number | undefined;
496
+ group?: string | undefined;
497
+ expires_at?: string | undefined;
498
+ replaces?: string | undefined;
499
+ };
500
+ }[];
501
+ unparsed: string[];
502
+ note?: undefined;
503
+ } | {
504
+ ok: boolean;
505
+ rules: {
506
+ id: string;
507
+ status: import("./rules.js").RuleStatus;
508
+ description: string;
509
+ created_by: "owner" | "agent";
510
+ last_price: number | undefined;
511
+ fills: number;
512
+ last_fill: import("./rules.js").Fill | undefined;
513
+ error: string | undefined;
514
+ rule: {
515
+ state: undefined;
516
+ id: string;
517
+ status: import("./rules.js").RuleStatus;
518
+ created_by: "owner" | "agent";
519
+ created_at: string;
520
+ activated_at?: string;
521
+ chain: "base" | "ethereum" | "solana";
522
+ kind: "limit_buy" | "limit_sell" | "stop_loss" | "take_profit" | "trailing_stop" | "dca";
523
+ token: string;
524
+ every?: "hour" | "day" | "week" | undefined;
525
+ reason?: string | undefined;
526
+ name?: string | undefined;
527
+ sell_amount?: string | undefined;
528
+ amount_usd?: number | undefined;
529
+ sell_percent?: number | undefined;
530
+ trigger_price?: number | undefined;
531
+ trail_pct?: number | undefined;
532
+ weekday?: number | undefined;
533
+ times?: number | undefined;
534
+ max_price?: number | undefined;
535
+ group?: string | undefined;
536
+ expires_at?: string | undefined;
537
+ replaces?: string | undefined;
538
+ };
539
+ }[];
540
+ unparsed: string[];
541
+ note: string;
542
+ refused?: undefined;
543
+ }>;
package/dist/actions.js CHANGED
@@ -36,6 +36,30 @@ export const ProposeArgs = z.object({
36
36
  });
37
37
  export const RulesListArgs = z.object({ status: z.enum(["proposed", "active", "paused", "done", "cancelled", "expired", "error"]).optional() });
38
38
  export const RuleIdArgs = z.object({ id: z.string().min(4).max(40) });
39
+ export const HistoryArgs = z.object({
40
+ token: z.enum(["ETH", "WETH", "SOL"]).describe("ETH (also WETH) or SOL; prices from Coinbase Exchange"),
41
+ interval: z.enum(["15m", "1h", "6h", "1d"]).optional().describe("Candle size (default 1h)"),
42
+ points: z.number().int().min(5).max(200).optional().describe("How many candles, newest last (default 48)"),
43
+ });
44
+ const GRAN = { "15m": 900, "1h": 3600, "6h": 21600, "1d": 86400 };
45
+ /** Coinbase Exchange public candles: [time, low, high, open, close, volume], newest first, at most 300, no key. */
46
+ export async function priceHistory(a, f = fetch) {
47
+ const product = a.token === "SOL" ? "SOL-USD" : "ETH-USD", interval = a.interval ?? "1h";
48
+ const r = await f(`https://api.exchange.coinbase.com/products/${product}/candles?granularity=${GRAN[interval]}`, { headers: { accept: "application/json" }, signal: AbortSignal.timeout(10_000) });
49
+ if (!r.ok)
50
+ return { ok: false, refused: { code: "unavailable", reason: `Price history isn't available right now (HTTP ${r.status}).` } };
51
+ const rows = (await r.json()).sort((x, y) => x[0] - y[0]).slice(-(a.points ?? 48));
52
+ if (!rows.length)
53
+ return { ok: false, refused: { code: "unavailable", reason: "No price history returned." } };
54
+ const closes = rows.map((x) => x[4]), first = rows[0][3], last = closes.at(-1);
55
+ return {
56
+ ok: true, token: a.token, interval, source: "Coinbase Exchange",
57
+ from: new Date(rows[0][0] * 1000).toISOString(), to: new Date(rows.at(-1)[0] * 1000).toISOString(),
58
+ open: first, last, change_pct: +(((last - first) / first) * 100).toFixed(2),
59
+ high: Math.max(...rows.map((x) => x[2])), low: Math.min(...rows.map((x) => x[1])),
60
+ candles: rows.map(([t, low, high, open, close]) => ({ t: new Date(t * 1000).toISOString(), open, high, low, close })),
61
+ };
62
+ }
39
63
  async function swapRequest(w, a) {
40
64
  const chain = a.chain;
41
65
  const [sell, buy] = await Promise.all([resolveToken(chain, a.sell), resolveToken(chain, a.buy)]);
@@ -85,8 +109,14 @@ export const ACTIONS = [
85
109
  def({ name: "receipts", spends: false, schema: ReceiptArgs,
86
110
  description: "Recent trades, payments and withdrawals with amounts, fees and transaction hashes.",
87
111
  run: async (w, a) => w.receipts(a.since).slice(-(a.limit ?? 50)) }),
112
+ def({ name: "market_prices", spends: false, schema: NoArgs,
113
+ description: "Live USD prices and 24-hour change for ETH, SOL and USDT (Coinbase Exchange; USDC is $1).",
114
+ run: async () => { const f = new PriceFeed(); await f.refresh(); return f.snapshot(); } }),
115
+ def({ name: "price_history", spends: false, schema: HistoryArgs,
116
+ description: "Recent price candles for ETH or SOL (open, high, low, close) with the period's change, high and low. Use it to judge trends and to set sensible trigger prices.",
117
+ run: async (_w, a) => priceHistory(a) }),
88
118
  def({ name: "autopilot_propose", spends: false, schema: ProposeArgs,
89
- description: "Set up autopilot rules: limit buy/sell, stop-loss, take-profit, trailing stop, recurring buy (DCA). Give plain English in `text` (e.g. \"buy $25 of SOL every Monday; sell half my ETH if it rises 10% and all if it falls 8%\") or exact `rules`. Unless the owner allows auto, rules wait for the owner to turn them on in the dashboard; fills follow the owner's limits.",
119
+ description: "Set up autopilot rules: limit buy/sell, stop-loss, take-profit, trailing stop, recurring buy (DCA). Give plain English in `text` (e.g. \"buy $25 of SOL every Monday; sell half my ETH if it rises 10% and all if it falls 8%\") or exact `rules`. Give each rule a short plain `reason`; to change an existing rule, propose its replacement with `replaces: <id>`. Unless the owner allows auto, rules wait for the owner to turn them on in the dashboard; fills follow the owner's limits.",
90
120
  run: async (w, a) => proposeRules(w, a) }),
91
121
  def({ name: "autopilot_rules", spends: false, schema: RulesListArgs,
92
122
  description: "The autopilot's rules with a plain description of each, status, last price seen, fills and any error.",
@@ -116,7 +146,7 @@ function showRule(r) {
116
146
  const last = r.state.fills.at(-1);
117
147
  return { id: r.id, status: r.status, description: describeRule(r), created_by: r.created_by, last_price: r.state.last_price, fills: r.state.fills.filter((f) => f.ok).length, last_fill: last, error: r.state.last_error, rule: { ...r, state: undefined } };
118
148
  }
119
- async function proposeRules(w, a) {
149
+ export async function proposeRules(w, a, o = {}) {
120
150
  let drafts = [...(a.rules ?? [])], unparsed = [];
121
151
  if (a.text) {
122
152
  const feed = new PriceFeed();
@@ -132,9 +162,15 @@ async function proposeRules(w, a) {
132
162
  if (why)
133
163
  return { ok: false, refused: { code: "bad_rule", reason: `${describeRule(d)}: ${why}` }, unparsed };
134
164
  }
135
- const store = w.rules(), auto = w.policy.agent_rules === "auto", made = [];
136
- for (const d of drafts)
137
- made.push(showRule(await store.add(d, "agent", auto)));
165
+ const store = w.rules(), auto = !o.neverAuto && w.policy.agent_rules === "auto", made = [];
166
+ for (const d of drafts) {
167
+ try {
168
+ made.push(showRule(await store.add(d, "agent", auto)));
169
+ }
170
+ catch (e) {
171
+ return { ok: false, refused: { code: "bad_rule", reason: `${describeRule(d)}: ${e.message}` }, rules: made, unparsed };
172
+ }
173
+ }
138
174
  return {
139
175
  ok: true, rules: made, unparsed,
140
176
  note: auto ? "These rules are on. The autopilot runs while the wallet's dashboard or `tollkit-wallet autopilot` is running." : "These rules are waiting for the owner to turn them on in the dashboard (Autopilot tab) or with `tollkit-wallet r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,IAAI,GAAG,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,MAAM,CAAC,WAAW,KAAK,MAAM,EAAE,IAAI,GAAG,EAAmC,CAAC;IAC5H,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;QAAC,IAAI,CAAC;YAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QAAC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC,KAAM,CAAW,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QAAC,CAAC;IAAC,CAAC;IAC5O,OAAO;QACL,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ;QAC/B,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,+GAA+G,CAAC,CAAC,CAAC,+HAA+H;KAC/P,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** App logos for the "Connect your AI" picker: Simple Icons (CC0), the same set tollkit.dev uses. Shown only to say "works with". */
2
+ export declare const AI_ICONS: Record<string, {
3
+ d: string;
4
+ rule?: string;
5
+ }>;
@@ -0,0 +1,3 @@
1
+ /** App logos for the "Connect your AI" picker: Simple Icons (CC0), the same set tollkit.dev uses. Shown only to say "works with". */
2
+ export const AI_ICONS = { "claude": { "d": "m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z" }, "cursor": { "d": "M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23" }, "copilot": { "d": "M23.922 16.997C23.061 18.492 18.063 22.02 12 22.02 5.937 22.02.939 18.492.078 16.997A.641.641 0 0 1 0 16.741v-2.869a.883.883 0 0 1 .053-.22c.372-.935 1.347-2.292 2.605-2.656.167-.429.414-1.055.644-1.517a10.098 10.098 0 0 1-.052-1.086c0-1.331.282-2.499 1.132-3.368.397-.406.89-.717 1.474-.952C7.255 2.937 9.248 1.98 11.978 1.98c2.731 0 4.767.957 6.166 2.093.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086.23.462.477 1.088.644 1.517 1.258.364 2.233 1.721 2.605 2.656a.841.841 0 0 1 .053.22v2.869a.641.641 0 0 1-.078.256Zm-11.75-5.992h-.344a4.359 4.359 0 0 1-.355.508c-.77.947-1.918 1.492-3.508 1.492-1.725 0-2.989-.359-3.782-1.259a2.137 2.137 0 0 1-.085-.104L4 11.746v6.585c1.435.779 4.514 2.179 8 2.179 3.486 0 6.565-1.4 8-2.179v-6.585l-.098-.104s-.033.045-.085.104c-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.545-3.508-1.492a4.359 4.359 0 0 1-.355-.508Zm2.328 3.25c.549 0 1 .451 1 1v2c0 .549-.451 1-1 1-.549 0-1-.451-1-1v-2c0-.549.451-1 1-1Zm-5 0c.549 0 1 .451 1 1v2c0 .549-.451 1-1 1-.549 0-1-.451-1-1v-2c0-.549.451-1 1-1Zm3.313-6.185c.136 1.057.403 1.913.878 2.497.442.544 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.15.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.319-.862-2.824-1.025-1.487-.161-2.192.138-2.533.529-.269.307-.437.808-.438 1.578v.021c0 .265.021.562.063.893Zm-1.626 0c.042-.331.063-.628.063-.894v-.02c-.001-.77-.169-1.271-.438-1.578-.341-.391-1.046-.69-2.533-.529-1.505.163-2.347.537-2.824 1.025-.462.472-.705 1.179-.705 2.319 0 1.211.175 1.926.558 2.361.365.414 1.084.751 2.657.751 1.21 0 1.902-.394 2.344-.938.475-.584.742-1.44.878-2.497Z" }, "gemini": { "d": "M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81" }, "terminal": { "rule": "evenodd", "d": "M3 4h18a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zM3 6v12h18V6zM5.3 8.7l1.4-1.4 4.7 4.7-4.7 4.7-1.4-1.4 3.3-3.3zM12 15h6v2h-6z" } };
3
+ //# sourceMappingURL=ai-icons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-icons.js","sourceRoot":"","sources":["../src/ai-icons.ts"],"names":[],"mappings":"AAAA,qIAAqI;AACrI,MAAM,CAAC,MAAM,QAAQ,GAAiD,EAAC,QAAQ,EAAC,EAAC,GAAG,EAAC,qxDAAqxD,EAAC,EAAC,QAAQ,EAAC,EAAC,GAAG,EAAC,0VAA0V,EAAC,EAAC,SAAS,EAAC,EAAC,GAAG,EAAC,4lDAA4lD,EAAC,EAAC,QAAQ,EAAC,EAAC,GAAG,EAAC,8RAA8R,EAAC,EAAC,UAAU,EAAC,EAAC,MAAM,EAAC,SAAS,EAAC,GAAG,EAAC,qJAAqJ,EAAC,EAAC,CAAC"}
package/dist/ai.d.ts ADDED
@@ -0,0 +1,77 @@
1
+ import type { TollkitWallet } from "./wallet.js";
2
+ export interface ChatMsg {
3
+ id: string;
4
+ role: "you" | "ai";
5
+ text: string;
6
+ ts: string;
7
+ rules?: string[];
8
+ checkin?: boolean;
9
+ error?: boolean;
10
+ quiet?: boolean;
11
+ }
12
+ export interface RunOpts {
13
+ sessionId?: string;
14
+ cwd: string;
15
+ mcpConfig: string;
16
+ system: string;
17
+ }
18
+ export type Runner = (prompt: string, o: RunOpts) => Promise<{
19
+ text: string;
20
+ sessionId?: string;
21
+ }>;
22
+ export declare const CHECKIN_HOURS: number[];
23
+ export declare const SYSTEM = "You are the AI inside the owner's Tollkit Wallet, on the Autopilot tab. The owner talks to you to set up and adjust autopilot rules for their own money.\n\nWhat you can do, through the tollkit-wallet tools:\n- read their balances, limits and recent trades (wallet_balances, wallet_status, receipts)\n- check prices and price history (market_prices, price_history; ETH and SOL)\n- see their rules (autopilot_rules) and suggest new ones (autopilot_propose)\nYou cannot trade, pay, withdraw or change limits, and you can't turn rules on. Every rule you suggest waits on a card under your message for the owner to tap \"Turn on\". Never say a rule is on or that you placed a trade.\n\nRule kinds: limit_buy, limit_sell, stop_loss, take_profit, trailing_stop, dca (recurring buy). Assets trade against USDC on Base or Solana (Ethereum only if the owner enabled it). Use exact `rules` in autopilot_propose, not text. Give every rule a one- or two-sentence plain `reason`. To change an existing rule, propose the new one with `replaces: <old rule id>`; turning it on cancels the old one. A take-profit and stop-loss for the same position should share a `group` so one cancels the other.\n\nBefore suggesting: check balances (don't plan to sell what they don't hold or spend more USDC than they have), keep each buy within their per-trade limit, and use recent prices to pick sensible triggers. If what they ask is unclear or risky (all-in, no stop), say so briefly and suggest a safer version; they decide.\n\nStyle: short, plain English, like a careful friend who knows markets. No hype, no emojis, no guarantees or predictions presented as fact. Quote real numbers from the tools. When you suggest rules, end with one line saying they're waiting below to turn on.";
24
+ /** Claude Code, headless, locked to the wallet's advisor tools. */
25
+ export declare function claudeRunner(exe: string, timeoutMs?: number): Runner;
26
+ export declare class AiAssistant {
27
+ private readonly w;
28
+ private readonly o;
29
+ private file;
30
+ busy: {
31
+ kind: "chat" | "checkin";
32
+ since: string;
33
+ } | null;
34
+ private approving;
35
+ constructor(w: TollkitWallet, o?: {
36
+ dir?: string;
37
+ runner?: Runner;
38
+ exe?: string | null;
39
+ now?: () => number;
40
+ fetch?: typeof fetch;
41
+ });
42
+ private now;
43
+ private exe;
44
+ private runner;
45
+ private load;
46
+ private save;
47
+ view(): {
48
+ provider: {
49
+ id: string;
50
+ name: string;
51
+ } | null;
52
+ ready: boolean;
53
+ busy: {
54
+ kind: "chat" | "checkin";
55
+ since: string;
56
+ } | null;
57
+ messages: ChatMsg[];
58
+ checkin: {
59
+ every_hours: number;
60
+ last: string | null;
61
+ next: string | null;
62
+ };
63
+ };
64
+ setCheckin(hours: number): void;
65
+ newChat(): void;
66
+ /** Why a message can't be sent right now, or null. */
67
+ precheck(text?: string): {
68
+ code: string;
69
+ message: string;
70
+ } | null;
71
+ /** Sends one message (or runs a check-in) and waits for the answer. */
72
+ send(text: string, kind?: "chat" | "checkin"): Promise<ChatMsg>;
73
+ /** Called by the dashboard's timer. Runs a check-in when one is due. */
74
+ tick(): Promise<void>;
75
+ /** Check-in suggestions on Telegram, if it's set up: Approve turns them on, Deny dismisses them. */
76
+ private askOnTelegram;
77
+ }