@keeperhub/wallet 0.1.10 → 0.1.12
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 +16 -0
- package/bin/keeperhub-wallet-mcp.js +21 -0
- package/dist/cli.cjs +487 -159
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +501 -158
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +501 -171
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +78 -239
- package/dist/index.d.ts +78 -239
- package/dist/index.js +512 -167
- package/dist/index.js.map +1 -1
- package/dist/mcp-server.cjs +1206 -0
- package/dist/mcp-server.cjs.map +1 -0
- package/dist/mcp-server.d.cts +54 -0
- package/dist/mcp-server.d.ts +54 -0
- package/dist/mcp-server.js +1184 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/payment-signer-CyeRXcX2.d.cts +236 -0
- package/dist/payment-signer-CyeRXcX2.d.ts +236 -0
- package/package.json +57 -54
- package/skill/keeperhub-wallet.skill.md +8 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { H as HmacHeaders, S as SafetyConfig, a as HookDecision, W as WalletConfig } from './payment-signer-CyeRXcX2.cjs';
|
|
2
|
+
export { A as AskTierResponse, B as BalanceSnapshot, C as CheckBalanceOptions, b as ClientOptions, D as DEFAULT_SAFETY_CONFIG, F as FetchInit, K as KeeperHubClient, c as KeeperHubError, M as MppChallenge, P as PayRetryOptions, d as PaymentHint, e as PaymentSigner, f as WalletConfigMissingError, X as X402Challenge, g as checkBalance, h as createPaymentSigner, i as getSafetyConfigPath, l as loadSafetyConfig, p as parseMppChallenge, j as parseX402Challenge, k as paymentSigner, s as selectProtocol, v as validateAndMerge } from './payment-signer-CyeRXcX2.cjs';
|
|
1
3
|
import * as viem from 'viem';
|
|
2
|
-
import { PublicClient } from 'viem';
|
|
3
4
|
export { runCli } from './cli.cjs';
|
|
4
5
|
export { runHookCli } from './hook-entrypoint.cjs';
|
|
5
6
|
export { base } from 'viem/chains';
|
|
@@ -9,66 +10,24 @@ type AgentTarget = {
|
|
|
9
10
|
skillsDir: string;
|
|
10
11
|
settingsFile: string;
|
|
11
12
|
hookSupport: "claude-code" | "notice";
|
|
13
|
+
/**
|
|
14
|
+
* Path-segments under $HOME where the agent stores its MCP server registry.
|
|
15
|
+
* `undefined` for agents without a known MCP config location (cline today
|
|
16
|
+
* stores per-VS-Code-variant globalStorage state that is too fragile to
|
|
17
|
+
* auto-detect, so we ship "notice" instead).
|
|
18
|
+
*/
|
|
19
|
+
mcpConfigRel?: string[];
|
|
20
|
+
/**
|
|
21
|
+
* Which MCP config shape to write. `claude-code`, `cursor`, and `windsurf`
|
|
22
|
+
* all use the standard `{ mcpServers: { name: { command, args, env } } }`
|
|
23
|
+
* shape. `opencode` uses a divergent `{ mcp: { name: { type:"local",
|
|
24
|
+
* command:[...], enabled, environment } } }` shape. `notice` agents get
|
|
25
|
+
* a copy-paste hint instead of an auto-registered entry.
|
|
26
|
+
*/
|
|
27
|
+
mcpSupport: "claude-code" | "cursor" | "windsurf" | "opencode" | "notice";
|
|
12
28
|
};
|
|
13
29
|
declare function detectAgents(homeOverride?: string): AgentTarget[];
|
|
14
30
|
|
|
15
|
-
type WalletConfig = {
|
|
16
|
-
/** Turnkey sub-org ID returned by POST /api/agentic-wallet/provision */
|
|
17
|
-
subOrgId: string;
|
|
18
|
-
/** EVM-shared wallet address (same for Base chainId 8453 and Tempo chainId 4217) */
|
|
19
|
-
walletAddress: `0x${string}`;
|
|
20
|
-
/** 64-char lowercase hex HMAC secret, minted server-side at provision; never logged */
|
|
21
|
-
hmacSecret: string;
|
|
22
|
-
};
|
|
23
|
-
type HmacHeaders = {
|
|
24
|
-
"X-KH-Sub-Org": string;
|
|
25
|
-
"X-KH-Timestamp": string;
|
|
26
|
-
"X-KH-Signature": string;
|
|
27
|
-
};
|
|
28
|
-
type HookDecision = {
|
|
29
|
-
decision: "allow" | "deny" | "ask";
|
|
30
|
-
reason?: string;
|
|
31
|
-
};
|
|
32
|
-
declare class KeeperHubError extends Error {
|
|
33
|
-
readonly code: string;
|
|
34
|
-
constructor(code: string, message: string);
|
|
35
|
-
}
|
|
36
|
-
/** Protocol preference for a single pay() or fetch() call. "auto" preserves
|
|
37
|
-
* the x402-first default when both challenges are offered. */
|
|
38
|
-
type PaymentHint = "x402" | "mpp" | "auto";
|
|
39
|
-
declare class WalletConfigMissingError extends Error {
|
|
40
|
-
constructor();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
type BalanceSnapshot = {
|
|
44
|
-
base: {
|
|
45
|
-
chain: "base";
|
|
46
|
-
token: "USDC";
|
|
47
|
-
amount: string;
|
|
48
|
-
address: `0x${string}`;
|
|
49
|
-
};
|
|
50
|
-
tempo: {
|
|
51
|
-
chain: "tempo";
|
|
52
|
-
token: "USDC.e";
|
|
53
|
-
amount: string;
|
|
54
|
-
address: `0x${string}`;
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
type CheckBalanceOptions = {
|
|
58
|
-
/** Injectable viem client for Base (tests mock readContract). */
|
|
59
|
-
baseClient?: PublicClient;
|
|
60
|
-
/** Injectable viem client for Tempo (tests mock readContract). */
|
|
61
|
-
tempoClient?: PublicClient;
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Read the wallet's on-chain balance across Base + Tempo in parallel. Both
|
|
65
|
-
* legs must resolve; any single failure rejects the Promise.
|
|
66
|
-
*
|
|
67
|
-
* Amounts are formatted as decimal strings (6-decimal USDC precision) so the
|
|
68
|
-
* caller can render them without BigInt math.
|
|
69
|
-
*/
|
|
70
|
-
declare function checkBalance(wallet: WalletConfig, opts?: CheckBalanceOptions): Promise<BalanceSnapshot>;
|
|
71
|
-
|
|
72
31
|
declare const tempo: {
|
|
73
32
|
blockExplorers: {
|
|
74
33
|
readonly default: {
|
|
@@ -121,49 +80,6 @@ declare const BASE_USDC: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
|
121
80
|
/** Bridged USDC (USDC.e) on Tempo mainnet. NOT the same contract as BASE_USDC. */
|
|
122
81
|
declare const TEMPO_USDC_E: "0x20c000000000000000000000b9537d11c60e8b50";
|
|
123
82
|
|
|
124
|
-
type ClientOptions = {
|
|
125
|
-
/** Defaults to process.env.KEEPERHUB_API_URL ?? "https://app.keeperhub.com" */
|
|
126
|
-
baseUrl?: string;
|
|
127
|
-
/** Injected for tests; defaults to global fetch */
|
|
128
|
-
fetch?: typeof fetch;
|
|
129
|
-
};
|
|
130
|
-
/**
|
|
131
|
-
* 202 ask-tier envelope returned by /sign and /approval-request when the
|
|
132
|
-
* risk classifier routes a request to the ask queue. Callers poll
|
|
133
|
-
* `/api/agentic-wallet/approval-request/:id` until status !== "pending".
|
|
134
|
-
*/
|
|
135
|
-
type AskTierResponse = {
|
|
136
|
-
_status: 202;
|
|
137
|
-
approvalRequestId: string;
|
|
138
|
-
};
|
|
139
|
-
/**
|
|
140
|
-
* HMAC-signed HTTP client for the KeeperHub agentic-wallet API surface.
|
|
141
|
-
* Every request to /api/agentic-wallet/* (except /provision, which uses
|
|
142
|
-
* the session cookie) flows through this class.
|
|
143
|
-
*
|
|
144
|
-
* @security No logging of headers, body, or response bodies. Any stdout
|
|
145
|
-
* emitter (the global console object or util.inspect) added to this
|
|
146
|
-
* file is a T-34-08 violation (grep-enforced in CI).
|
|
147
|
-
*/
|
|
148
|
-
declare class KeeperHubClient {
|
|
149
|
-
private readonly baseUrl;
|
|
150
|
-
private readonly fetchImpl;
|
|
151
|
-
private readonly wallet;
|
|
152
|
-
constructor(wallet: WalletConfig, opts?: ClientOptions);
|
|
153
|
-
/**
|
|
154
|
-
* HMAC-signed POST/GET to any /api/agentic-wallet/* route except
|
|
155
|
-
* /provision. Path MUST start with a leading slash. Body is
|
|
156
|
-
* JSON.stringify'd (or the empty string for GET).
|
|
157
|
-
*
|
|
158
|
-
* Error mapping: non-2xx/non-202 surface as `KeeperHubError(code,
|
|
159
|
-
* message)` where `code` is the server-supplied field or the default
|
|
160
|
-
* taxonomy (`HMAC_INVALID`, `POLICY_BLOCKED`, `NOT_FOUND`,
|
|
161
|
-
* `TURNKEY_UPSTREAM`, `HTTP_<status>`). 202 ask-tier surfaces as an
|
|
162
|
-
* AskTierResponse envelope.
|
|
163
|
-
*/
|
|
164
|
-
request<T>(method: "GET" | "POST", path: string, body?: unknown): Promise<T | AskTierResponse>;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
83
|
type FundInstructions = {
|
|
168
84
|
/** Coinbase Onramp deeplink (legacy query-param form). */
|
|
169
85
|
coinbaseOnrampUrl: string;
|
|
@@ -205,28 +121,6 @@ declare function computeSignature(secret: string, method: string, path: string,
|
|
|
205
121
|
*/
|
|
206
122
|
declare function buildHmacHeaders(secret: string, method: string, path: string, subOrgId: string, body: string): HmacHeaders;
|
|
207
123
|
|
|
208
|
-
/**
|
|
209
|
-
* User-owned safety config at ~/.keeperhub/safety.json. File mode 0o644 so the
|
|
210
|
-
* user can freely edit thresholds and the allowlist; server-side Turnkey policy
|
|
211
|
-
* remains the authoritative hard cap (GUARD-06).
|
|
212
|
-
*/
|
|
213
|
-
type SafetyConfig = {
|
|
214
|
-
auto_approve_max_usd: number;
|
|
215
|
-
ask_threshold_usd: number;
|
|
216
|
-
block_threshold_usd: number;
|
|
217
|
-
allowlisted_contracts: string[];
|
|
218
|
-
};
|
|
219
|
-
/**
|
|
220
|
-
* Defaults per 34-CONTEXT lines 61-68. Thresholds bracket the Turnkey policy
|
|
221
|
-
* hard cap (100 USDC). Allowlisted contracts mirror the server Turnkey policy
|
|
222
|
-
* allowlist (lib/agentic-wallet/policy.ts FACILITATOR_ALLOWLIST) -- lowercased
|
|
223
|
-
* for case-insensitive match against tool_input.to / paymentChallenge.payTo.
|
|
224
|
-
*/
|
|
225
|
-
declare const DEFAULT_SAFETY_CONFIG: SafetyConfig;
|
|
226
|
-
declare function loadSafetyConfig(): Promise<SafetyConfig>;
|
|
227
|
-
declare function validateAndMerge(partial: Partial<SafetyConfig>): SafetyConfig;
|
|
228
|
-
declare function getSafetyConfigPath(): string;
|
|
229
|
-
|
|
230
124
|
type CreateHookOptions = {
|
|
231
125
|
/** Match against tool_name. Default: /keeperhub|wallet|sign/i */
|
|
232
126
|
toolNameMatcher?: (name: string) => boolean;
|
|
@@ -257,126 +151,31 @@ type CreateHookOptions = {
|
|
|
257
151
|
*/
|
|
258
152
|
declare function createPreToolUseHook(options?: CreateHookOptions): Promise<(input: unknown) => Promise<HookDecision>>;
|
|
259
153
|
|
|
260
|
-
type
|
|
261
|
-
|
|
154
|
+
type McpCommand = {
|
|
155
|
+
command: string;
|
|
156
|
+
args: string[];
|
|
157
|
+
/** Optional environment overrides. Currently unused but reserved for future flags. */
|
|
158
|
+
env?: Record<string, string>;
|
|
262
159
|
};
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
scheme: "exact";
|
|
269
|
-
network: string;
|
|
270
|
-
asset: string;
|
|
271
|
-
amount: string;
|
|
272
|
-
payTo: string;
|
|
273
|
-
maxTimeoutSeconds: number;
|
|
274
|
-
extra: Record<string, unknown>;
|
|
275
|
-
}>;
|
|
276
|
-
resource: {
|
|
277
|
-
url: string;
|
|
278
|
-
description: string;
|
|
279
|
-
mimeType: string;
|
|
280
|
-
};
|
|
281
|
-
};
|
|
282
|
-
declare function parseX402Challenge(response: Response): Promise<X402Challenge | null>;
|
|
283
|
-
|
|
284
|
-
type PaySignerOptions = {
|
|
285
|
-
/** Override wallet loader (primarily for tests). */
|
|
286
|
-
walletLoader?: () => Promise<WalletConfig>;
|
|
287
|
-
/** Override KeeperHubClient factory (tests inject a mocked fetch). */
|
|
288
|
-
clientFactory?: (wallet: WalletConfig) => KeeperHubClient;
|
|
289
|
-
/** Replayed fetch (tests intercept the retry). */
|
|
290
|
-
fetchImpl?: typeof fetch;
|
|
291
|
-
/** Approval polling override: interval + max attempts. */
|
|
292
|
-
approval?: {
|
|
293
|
-
intervalMs: number;
|
|
294
|
-
maxAttempts: number;
|
|
295
|
-
};
|
|
296
|
-
};
|
|
297
|
-
/**
|
|
298
|
-
* Retry options threaded through `pay()` and `fetch()` into the post-sign
|
|
299
|
-
* retry. Lets callers forward the original request body and headers so the
|
|
300
|
-
* paid workflow receives the same payload on the retry as on the 402 attempt
|
|
301
|
-
* -- otherwise a workflow whose input schema requires a body (e.g.
|
|
302
|
-
* `{address}` on `/api/mcp/workflows/<slug>/call`) rejects the retry with
|
|
303
|
-
* 400 "Invalid JSON body".
|
|
304
|
-
*/
|
|
305
|
-
type PayRetryOptions = {
|
|
306
|
-
/**
|
|
307
|
-
* Body to re-send on the retry. Must be a type that can be sent twice --
|
|
308
|
-
* string, ArrayBuffer, Uint8Array, FormData, URLSearchParams, or Blob.
|
|
309
|
-
* ReadableStream bodies are NOT supported because the first fetch() already
|
|
310
|
-
* consumed the stream; pass a string/Buffer instead.
|
|
311
|
-
*/
|
|
312
|
-
body?: RequestInit["body"];
|
|
313
|
-
/**
|
|
314
|
-
* Additional request headers to merge onto the retry (e.g. Content-Type).
|
|
315
|
-
* The payment auth header (PAYMENT-SIGNATURE or Authorization) is set by
|
|
316
|
-
* the signer and overrides any same-named header in this map.
|
|
317
|
-
*/
|
|
318
|
-
headers?: RequestInit["headers"];
|
|
319
|
-
/** HTTP method for the retry. Defaults to "POST". */
|
|
320
|
-
method?: string;
|
|
321
|
-
/**
|
|
322
|
-
* Per-call protocol preference. "x402" forces Base USDC; "mpp" forces Tempo
|
|
323
|
-
* USDC.e; "auto" (default, also the behaviour when omitted) uses x402 when
|
|
324
|
-
* offered, MPP otherwise. Throws KeeperHubError("X402_NOT_OFFERED") or
|
|
325
|
-
* KeeperHubError("MPP_NOT_OFFERED") when the requested protocol is absent
|
|
326
|
-
* from the challenge (KEEP-361).
|
|
327
|
-
*/
|
|
328
|
-
paymentHint?: PaymentHint;
|
|
329
|
-
};
|
|
330
|
-
/** RequestInit extended with paymentHint for per-call protocol selection. */
|
|
331
|
-
type FetchInit = RequestInit & {
|
|
332
|
-
paymentHint?: PaymentHint;
|
|
333
|
-
};
|
|
334
|
-
type PaymentSigner = {
|
|
335
|
-
/**
|
|
336
|
-
* Pays a 402 response and returns the post-payment retry Response.
|
|
337
|
-
* Non-402 responses are returned unchanged.
|
|
338
|
-
*
|
|
339
|
-
* Pass `options.body` (and usually `options.headers`) if the paid
|
|
340
|
-
* workflow's input schema requires a body -- `pay()` does not have access
|
|
341
|
-
* to the original request otherwise.
|
|
342
|
-
*
|
|
343
|
-
* For most agent code, prefer `signer.fetch(url, init)` which threads the
|
|
344
|
-
* body/headers automatically.
|
|
345
|
-
*/
|
|
346
|
-
pay: (response: Response, options?: PayRetryOptions) => Promise<Response>;
|
|
347
|
-
/**
|
|
348
|
-
* `fetch(url, init)` wrapper: does the initial fetch, and on 402 calls
|
|
349
|
-
* `pay()` with `init.body` + `init.headers` so the retry carries the
|
|
350
|
-
* original payload. Returns whatever the retry (or first response, if not
|
|
351
|
-
* 402) returns. No-op for non-402 responses.
|
|
352
|
-
*
|
|
353
|
-
* Pass `init.paymentHint` to force a specific payment protocol for this
|
|
354
|
-
* call. Omitting it is equivalent to `paymentHint: "auto"` (x402-first).
|
|
355
|
-
*/
|
|
356
|
-
fetch: (input: string | URL, init?: FetchInit) => Promise<Response>;
|
|
160
|
+
type RegisterMcpServerOptions = {
|
|
161
|
+
/** Override $HOME (tests). */
|
|
162
|
+
homeOverride?: string;
|
|
163
|
+
/** Override the launch command (tests, monorepo setups). */
|
|
164
|
+
command?: McpCommand;
|
|
357
165
|
};
|
|
358
|
-
/**
|
|
359
|
-
* Pure function that decides which payment protocol to use given challenge
|
|
360
|
-
* availability and caller's hint. Exported for unit testing.
|
|
361
|
-
*
|
|
362
|
-
* Returns "x402" or "mpp" to direct the caller to the appropriate path,
|
|
363
|
-
* or null when hint is "auto" and no challenge is present (pay() then
|
|
364
|
-
* returns the original 402 response unchanged). Throws KeeperHubError with
|
|
365
|
-
* a specific code when the requested protocol is unavailable (KEEP-361).
|
|
366
|
-
*/
|
|
367
|
-
declare function selectProtocol(x402: X402Challenge | null, mpp: MppChallenge | null, hint: PaymentHint | undefined): "x402" | "mpp" | null;
|
|
368
|
-
declare function createPaymentSigner(opts?: PaySignerOptions): PaymentSigner;
|
|
369
|
-
declare const paymentSigner: PaymentSigner;
|
|
370
166
|
|
|
371
167
|
/**
|
|
372
168
|
* Pick the hook command to write into settings.json.
|
|
373
169
|
*
|
|
374
|
-
* Returns the bare bin name if it resolves
|
|
375
|
-
* dev-time `npm link`), otherwise a
|
|
376
|
-
* pulls the installer's own version
|
|
377
|
-
*
|
|
378
|
-
*
|
|
379
|
-
*
|
|
170
|
+
* Returns the bare bin name if it resolves to a STABLE install on PATH
|
|
171
|
+
* (global install, brew, distro pkg, dev-time `npm link`), otherwise a
|
|
172
|
+
* version-pinned `npx` invocation that pulls the installer's own version
|
|
173
|
+
* of `@keeperhub/wallet` on demand. Implementation lives in
|
|
174
|
+
* runtime-detect.ts so the hook + MCP installers share a single decision.
|
|
175
|
+
*
|
|
176
|
+
* Override-able via the env var `KEEPERHUB_WALLET_HOOK_COMMAND` for test
|
|
177
|
+
* fixtures and unusual deployments (env input is trusted — it is written
|
|
178
|
+
* verbatim into settings.json and executed by the user's shell).
|
|
380
179
|
*/
|
|
381
180
|
declare function resolveHookCommand(): string;
|
|
382
181
|
type InstallResult = {
|
|
@@ -387,7 +186,13 @@ type InstallResult = {
|
|
|
387
186
|
}>;
|
|
388
187
|
hookRegistrations: Array<{
|
|
389
188
|
agent: string;
|
|
390
|
-
status: "registered" | "notice" | "skipped";
|
|
189
|
+
status: "registered" | "notice" | "skipped" | "failed";
|
|
190
|
+
message?: string;
|
|
191
|
+
}>;
|
|
192
|
+
mcpRegistrations: Array<{
|
|
193
|
+
agent: string;
|
|
194
|
+
status: "registered" | "notice" | "skipped" | "failed";
|
|
195
|
+
path?: string;
|
|
391
196
|
message?: string;
|
|
392
197
|
}>;
|
|
393
198
|
};
|
|
@@ -401,6 +206,12 @@ type InstallOptions = {
|
|
|
401
206
|
* Override for tests, monorepo setups, or unusual deployments.
|
|
402
207
|
*/
|
|
403
208
|
hookCommand?: string;
|
|
209
|
+
/**
|
|
210
|
+
* MCP command + args to register with each detected agent. Defaults to
|
|
211
|
+
* {@link resolveMcpCommand}. Tests pass an explicit value to pin
|
|
212
|
+
* assertions regardless of host PATH.
|
|
213
|
+
*/
|
|
214
|
+
mcpCommand?: RegisterMcpServerOptions["command"];
|
|
404
215
|
};
|
|
405
216
|
type RegisterClaudeCodeHookOptions = {
|
|
406
217
|
/**
|
|
@@ -411,10 +222,38 @@ type RegisterClaudeCodeHookOptions = {
|
|
|
411
222
|
hookCommand?: string;
|
|
412
223
|
};
|
|
413
224
|
declare function registerClaudeCodeHook(settingsPath: string, options?: RegisterClaudeCodeHookOptions): Promise<void>;
|
|
225
|
+
/**
|
|
226
|
+
* Install the keeperhub-wallet skill plus the PreToolUse safety hook plus
|
|
227
|
+
* the keeperhub-wallet MCP server into every detected agent.
|
|
228
|
+
*
|
|
229
|
+
* Per-agent flow:
|
|
230
|
+
* 1. Copy `keeperhub-wallet.skill.md` into the agent's `skills/` dir.
|
|
231
|
+
* 2. If the agent supports PreToolUse hooks (claude-code), register the
|
|
232
|
+
* safety hook in `settings.json`. Otherwise print a stderr notice.
|
|
233
|
+
* 3. If the agent supports MCP server registration (claude-code, cursor,
|
|
234
|
+
* windsurf, opencode), register the keeperhub-wallet MCP server in the
|
|
235
|
+
* agent's MCP config file (claude.json / mcp.json / opencode.json).
|
|
236
|
+
* Otherwise print a stderr notice.
|
|
237
|
+
*
|
|
238
|
+
* MCP idempotency is automatic: each agent's MCP config keys servers by name,
|
|
239
|
+
* so a re-run overwrites the existing `keeperhub-wallet` entry rather than
|
|
240
|
+
* appending a duplicate. All other keys are byte-preserved.
|
|
241
|
+
*/
|
|
414
242
|
declare function installSkill(options?: InstallOptions): Promise<InstallResult>;
|
|
415
243
|
|
|
416
244
|
declare function readWalletConfig(): Promise<WalletConfig>;
|
|
245
|
+
/**
|
|
246
|
+
* Atomic write: serialise to a sibling tmp file, fsync via the close, then
|
|
247
|
+
* rename(2) into place. Concurrent provisioning races (two MCP sessions
|
|
248
|
+
* spawning at once on a fresh install) collapse to last-rename-wins on the
|
|
249
|
+
* final path rather than torn-write-wins. Combined with the in-process
|
|
250
|
+
* promise cache in mcp-server.ts:ensureWallet this gates duplicate-mint
|
|
251
|
+
* within a single process AND keeps disk consistent across multiple.
|
|
252
|
+
*
|
|
253
|
+
* The tmp filename includes 16 bytes of randomness so two writers don't
|
|
254
|
+
* stomp each other's tmp files mid-write either.
|
|
255
|
+
*/
|
|
417
256
|
declare function writeWalletConfig(config: WalletConfig): Promise<void>;
|
|
418
257
|
declare function getWalletConfigPath(): string;
|
|
419
258
|
|
|
420
|
-
export { type AgentTarget,
|
|
259
|
+
export { type AgentTarget, BASE_USDC, type CreateHookOptions, type FundInstructions, HmacHeaders, HookDecision, type InstallOptions, type InstallResult, type RegisterClaudeCodeHookOptions, SafetyConfig, TEMPO_USDC_E, WalletConfig, buildHmacHeaders, computeSignature, createPreToolUseHook, detectAgents, fund, getWalletConfigPath, installSkill, readWalletConfig, registerClaudeCodeHook, resolveHookCommand, tempo, writeWalletConfig };
|