@vapi-network/core 0.5.0 → 0.8.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/README.md +406 -5
- package/dist/account-add.d.ts +101 -0
- package/dist/account-add.d.ts.map +1 -0
- package/dist/account-movement-lock.d.ts +10 -0
- package/dist/account-movement-lock.d.ts.map +1 -0
- package/dist/agent-link.d.ts +16 -1
- package/dist/agent-link.d.ts.map +1 -1
- package/dist/agent-link.js +131 -54
- package/dist/agent-link.js.map +3 -3
- package/dist/agent-profile.d.ts +47 -6
- package/dist/agent-profile.d.ts.map +1 -1
- package/dist/agent-run.d.ts +12 -0
- package/dist/agent-run.d.ts.map +1 -0
- package/dist/allocation.d.ts +64 -0
- package/dist/allocation.d.ts.map +1 -0
- package/dist/api-key.js +4 -2
- package/dist/api-key.js.map +1 -1
- package/dist/atomic-file.d.ts +23 -0
- package/dist/atomic-file.d.ts.map +1 -0
- package/dist/audit.d.ts +4 -1
- package/dist/audit.d.ts.map +1 -1
- package/dist/backup.d.ts +307 -0
- package/dist/backup.d.ts.map +1 -0
- package/dist/backup.js +49938 -0
- package/dist/backup.js.map +6 -0
- package/dist/call-contracts-wire.d.ts +12 -12
- package/dist/ceiling.d.ts +98 -0
- package/dist/ceiling.d.ts.map +1 -0
- package/dist/cloud-backup.d.ts +123 -0
- package/dist/cloud-backup.d.ts.map +1 -0
- package/dist/cloud-backup.js +50827 -0
- package/dist/cloud-backup.js.map +6 -0
- package/dist/config.d.ts +5 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/device.d.ts +15 -0
- package/dist/device.d.ts.map +1 -0
- package/dist/distribute.d.ts +68 -0
- package/dist/distribute.d.ts.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10131 -1228
- package/dist/index.js.map +3 -3
- package/dist/keystore.d.ts +24 -1
- package/dist/keystore.d.ts.map +1 -1
- package/dist/marketplace-contracts.d.ts +14 -14
- package/dist/member-bundle.d.ts +110 -0
- package/dist/member-bundle.d.ts.map +1 -0
- package/dist/movement-open.d.ts +10 -0
- package/dist/movement-open.d.ts.map +1 -0
- package/dist/movement.d.ts +172 -0
- package/dist/movement.d.ts.map +1 -0
- package/dist/networks.d.ts +1 -0
- package/dist/networks.d.ts.map +1 -1
- package/dist/receipts.d.ts +33 -0
- package/dist/receipts.d.ts.map +1 -1
- package/dist/router-client.d.ts +9 -1
- package/dist/router-client.d.ts.map +1 -1
- package/dist/router-client.js +36500 -16308
- package/dist/router-client.js.map +3 -3
- package/dist/run-budget.d.ts +17 -0
- package/dist/run-budget.d.ts.map +1 -0
- package/dist/secret-store.d.ts +23 -5
- package/dist/secret-store.d.ts.map +1 -1
- package/dist/secrets.d.ts +2 -0
- package/dist/secrets.d.ts.map +1 -1
- package/dist/secrets.js +1439 -56
- package/dist/secrets.js.map +3 -3
- package/dist/siblings.d.ts +41 -0
- package/dist/siblings.d.ts.map +1 -0
- package/dist/spend-policy.d.ts +12 -0
- package/dist/spend-policy.d.ts.map +1 -1
- package/dist/status.d.ts +73 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/support-report.d.ts +1 -1
- package/dist/swarm-capital.d.ts +147 -0
- package/dist/swarm-capital.d.ts.map +1 -0
- package/dist/swarm.d.ts +224 -0
- package/dist/swarm.d.ts.map +1 -0
- package/dist/transfer-journal.d.ts +11 -0
- package/dist/transfer-journal.d.ts.map +1 -0
- package/dist/transfer.d.ts +65 -0
- package/dist/transfer.d.ts.map +1 -0
- package/dist/vault-key.d.ts +41 -0
- package/dist/vault-key.d.ts.map +1 -0
- package/dist/vault-migrate.d.ts +29 -0
- package/dist/vault-migrate.d.ts.map +1 -0
- package/dist/vault.d.ts +104 -0
- package/dist/vault.d.ts.map +1 -0
- package/dist/wallet-store.d.ts +135 -39
- package/dist/wallet-store.d.ts.map +1 -1
- package/dist/x402-pay.d.ts +12 -0
- package/dist/x402-pay.d.ts.map +1 -1
- package/dist/x402.d.ts +3 -0
- package/dist/x402.d.ts.map +1 -1
- package/package.json +9 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { SecretStore } from "./secret-store.js";
|
|
2
|
+
import type { WalletName, WalletStore } from "./wallet-store.js";
|
|
3
|
+
export type SiblingStatus = "active" | "revoked";
|
|
4
|
+
export type Sibling = {
|
|
5
|
+
name: string;
|
|
6
|
+
address: `0x${string}`;
|
|
7
|
+
device: string | null;
|
|
8
|
+
status: SiblingStatus;
|
|
9
|
+
allowance: {
|
|
10
|
+
routerPerDayUsd: number | null;
|
|
11
|
+
perCallUsd: number | null;
|
|
12
|
+
perDayUsd: number | null;
|
|
13
|
+
};
|
|
14
|
+
self: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type SiblingsResult = {
|
|
17
|
+
owner: `0x${string}` | null;
|
|
18
|
+
siblings: Sibling[];
|
|
19
|
+
source: {
|
|
20
|
+
account: WalletName;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export type SiblingsErrorCode = "not_linked" | "unsupported" | "invalid_response" | "http";
|
|
24
|
+
export declare class SiblingsError extends Error {
|
|
25
|
+
readonly code: SiblingsErrorCode;
|
|
26
|
+
readonly status?: number | undefined;
|
|
27
|
+
constructor(code: SiblingsErrorCode, message: string, status?: number | undefined);
|
|
28
|
+
}
|
|
29
|
+
export declare const SIBLINGS_UNSUPPORTED_MESSAGE = "This vAPI server does not list siblings yet.";
|
|
30
|
+
export declare const SIBLINGS_DEFAULT_TIMEOUT_MS = 10000;
|
|
31
|
+
export declare function fetchSiblings(args: {
|
|
32
|
+
apiBase: string;
|
|
33
|
+
account: WalletName;
|
|
34
|
+
secrets: SecretStore;
|
|
35
|
+
wallets: WalletStore;
|
|
36
|
+
fetchImpl?: typeof fetch;
|
|
37
|
+
now?: () => number;
|
|
38
|
+
signal?: AbortSignal;
|
|
39
|
+
timeoutMs?: number;
|
|
40
|
+
}): Promise<SiblingsResult>;
|
|
41
|
+
//# sourceMappingURL=siblings.d.ts.map
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wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,UAAU,CAAC;IACpB,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE,WAAW,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,cAAc,CAAC,CA0D1B"}
|
package/dist/spend-policy.d.ts
CHANGED
|
@@ -26,6 +26,18 @@ export declare function reserveSpend(amountAtomic: bigint, caps: SpendCaps, opti
|
|
|
26
26
|
ledgerPath?: string;
|
|
27
27
|
now?: Date;
|
|
28
28
|
wallet?: WalletName;
|
|
29
|
+
reservationId?: string;
|
|
30
|
+
}): Promise<SpendLedger>;
|
|
31
|
+
/**
|
|
32
|
+
* Releases a reservation made earlier on the same UTC day. A reservation from
|
|
33
|
+
* a prior day has already rolled out of the active ledger and is left alone.
|
|
34
|
+
*/
|
|
35
|
+
export declare function releaseSpend(amountAtomic: bigint, options: {
|
|
36
|
+
reservedOn: string;
|
|
37
|
+
ledgerPath?: string;
|
|
38
|
+
now?: Date;
|
|
39
|
+
wallet?: WalletName;
|
|
40
|
+
reservationId?: string;
|
|
29
41
|
}): Promise<SpendLedger>;
|
|
30
42
|
export {};
|
|
31
43
|
//# sourceMappingURL=spend-policy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spend-policy.d.ts","sourceRoot":"","sources":["../src/spend-policy.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAoC,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAyC,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE1F,QAAA,MAAM,YAAY;;;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wBAAsB,YAAY,CAChC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE;IACP,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GACA,OAAO,CAAC,WAAW,CAAC,CAgDtB"}
|
package/dist/status.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { AgentRouterUsage } from "./router-client.js";
|
|
2
|
+
import { type MovementSummary } from "./movement.js";
|
|
3
|
+
import type { SecretStore } from "./secret-store.js";
|
|
4
|
+
import type { WalletName } from "./wallet-name.js";
|
|
5
|
+
import { type WalletStore } from "./wallet-store.js";
|
|
6
|
+
export type AccountLinkStatus = "active" | "paused" | "revoked" | "not_linked" | "unknown";
|
|
7
|
+
export type StatusAccount = {
|
|
8
|
+
name: string;
|
|
9
|
+
default: boolean;
|
|
10
|
+
address: string;
|
|
11
|
+
usdc?: string;
|
|
12
|
+
routerTodayUsd?: string;
|
|
13
|
+
routerAllowanceUsd?: string;
|
|
14
|
+
caps: {
|
|
15
|
+
perCallUsd: string;
|
|
16
|
+
perDayUsd: string;
|
|
17
|
+
ceilingUsd: string;
|
|
18
|
+
ceilingFloorUsd?: string;
|
|
19
|
+
};
|
|
20
|
+
link: AccountLinkStatus;
|
|
21
|
+
};
|
|
22
|
+
export type StatusReport = {
|
|
23
|
+
version: string;
|
|
24
|
+
home: string;
|
|
25
|
+
registry: string;
|
|
26
|
+
owner?: {
|
|
27
|
+
address: string;
|
|
28
|
+
linked: boolean;
|
|
29
|
+
console: string;
|
|
30
|
+
};
|
|
31
|
+
vault: {
|
|
32
|
+
exists: boolean;
|
|
33
|
+
unlocked: boolean;
|
|
34
|
+
store: string;
|
|
35
|
+
protected: boolean;
|
|
36
|
+
};
|
|
37
|
+
accounts: StatusAccount[];
|
|
38
|
+
unfinishedMovements: MovementSummary[];
|
|
39
|
+
cloudBackup?: {
|
|
40
|
+
enabled: boolean;
|
|
41
|
+
lastUploadAt?: string;
|
|
42
|
+
};
|
|
43
|
+
next: string[];
|
|
44
|
+
};
|
|
45
|
+
export type StatusDeps = {
|
|
46
|
+
version: string;
|
|
47
|
+
home: string;
|
|
48
|
+
registry: string;
|
|
49
|
+
wallets: WalletStore;
|
|
50
|
+
secrets: SecretStore;
|
|
51
|
+
env?: NodeJS.ProcessEnv;
|
|
52
|
+
chain: {
|
|
53
|
+
usdcBalance: (address: string, signal?: AbortSignal) => Promise<bigint>;
|
|
54
|
+
};
|
|
55
|
+
agents: {
|
|
56
|
+
routerUsage: (account: WalletName, signal?: AbortSignal) => Promise<AgentRouterUsage>;
|
|
57
|
+
linkStatus: (account: WalletName, signal?: AbortSignal) => Promise<Exclude<AccountLinkStatus, "not_linked">>;
|
|
58
|
+
};
|
|
59
|
+
cloudBackup?: (signal?: AbortSignal) => Promise<{
|
|
60
|
+
enabled: boolean;
|
|
61
|
+
lastUploadAt?: string;
|
|
62
|
+
}>;
|
|
63
|
+
now: () => Date;
|
|
64
|
+
timeoutMs?: number;
|
|
65
|
+
timers?: {
|
|
66
|
+
setTimeout: typeof setTimeout;
|
|
67
|
+
clearTimeout: typeof clearTimeout;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export declare const STATUS_TIMEOUT_MS = 2000;
|
|
71
|
+
export declare function buildStatus(deps: StatusDeps): Promise<StatusReport>;
|
|
72
|
+
export declare function formatUsdAmount(value: bigint | number): string;
|
|
73
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAA2B,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,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,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAI9D"}
|
package/dist/support-report.d.ts
CHANGED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type CeilingSweepResult } from "./ceiling.js";
|
|
3
|
+
import { type VapiConfig } from "./config.js";
|
|
4
|
+
import { type MovementDependencies } from "./movement.js";
|
|
5
|
+
import { type RunBudget } from "./run-budget.js";
|
|
6
|
+
import { type SwarmBalanceReader } from "./swarm.js";
|
|
7
|
+
import { type TransferNetwork } from "./transfer.js";
|
|
8
|
+
import { type WalletName } from "./wallet-name.js";
|
|
9
|
+
export type SwarmCapitalDeps = MovementDependencies & {
|
|
10
|
+
balanceReader?: SwarmBalanceReader;
|
|
11
|
+
config?: VapiConfig;
|
|
12
|
+
reconcileCeilingSweep?: (account: WalletName) => Promise<CeilingSweepResult>;
|
|
13
|
+
};
|
|
14
|
+
export type SwarmLegResult = {
|
|
15
|
+
from: string;
|
|
16
|
+
to: string;
|
|
17
|
+
amountUsd: string;
|
|
18
|
+
purpose: "send" | "sweep";
|
|
19
|
+
status: "planned" | "sent" | "failed" | "unknown" | "cancelled";
|
|
20
|
+
txHash?: string;
|
|
21
|
+
reason?: string;
|
|
22
|
+
};
|
|
23
|
+
export type SwarmMovementResult = {
|
|
24
|
+
movementId: string;
|
|
25
|
+
reason: string;
|
|
26
|
+
resumed: boolean;
|
|
27
|
+
legs: SwarmLegResult[];
|
|
28
|
+
complete: boolean;
|
|
29
|
+
};
|
|
30
|
+
type SwarmSkippedMember = {
|
|
31
|
+
account: string;
|
|
32
|
+
reason: string;
|
|
33
|
+
};
|
|
34
|
+
type SwarmBlockedLeg = {
|
|
35
|
+
to: string;
|
|
36
|
+
amountUsd: string;
|
|
37
|
+
reason: string;
|
|
38
|
+
};
|
|
39
|
+
declare const delegationRecordSchema: z.ZodObject<{
|
|
40
|
+
v: z.ZodLiteral<1>;
|
|
41
|
+
movementId: z.ZodString;
|
|
42
|
+
requestId: z.ZodString;
|
|
43
|
+
swarm: z.ZodString;
|
|
44
|
+
member: z.ZodString;
|
|
45
|
+
budgetUsd: z.ZodString;
|
|
46
|
+
childRunId: z.ZodString;
|
|
47
|
+
startedAt: z.ZodISODateTime;
|
|
48
|
+
result: z.ZodOptional<z.ZodObject<{
|
|
49
|
+
runId: z.ZodNullable<z.ZodString>;
|
|
50
|
+
answer: z.ZodNullable<z.ZodString>;
|
|
51
|
+
stoppedBecause: z.ZodNullable<z.ZodObject<{
|
|
52
|
+
reason: z.ZodString;
|
|
53
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
54
|
+
}, z.core.$strict>>;
|
|
55
|
+
spentUsd: z.ZodNumber;
|
|
56
|
+
budgetUsd: z.ZodNumber;
|
|
57
|
+
}, z.core.$strict>>;
|
|
58
|
+
}, z.core.$strict>;
|
|
59
|
+
export type DelegationRecord = z.infer<typeof delegationRecordSchema>;
|
|
60
|
+
export type SwarmFundResult = {
|
|
61
|
+
status: "sent" | "incomplete" | "waiting_for_owner" | "resumed";
|
|
62
|
+
treasury: {
|
|
63
|
+
account: string;
|
|
64
|
+
address: string;
|
|
65
|
+
};
|
|
66
|
+
network: TransferNetwork;
|
|
67
|
+
amountUsd: string;
|
|
68
|
+
fund?: SwarmMovementResult;
|
|
69
|
+
policy?: SwarmMovementResult | SwarmRebalanceResult;
|
|
70
|
+
blocked: SwarmBlockedLeg[];
|
|
71
|
+
skipped: SwarmSkippedMember[];
|
|
72
|
+
message: string;
|
|
73
|
+
};
|
|
74
|
+
export type SwarmFundOptions = {
|
|
75
|
+
name: string;
|
|
76
|
+
amountUsd: string | number;
|
|
77
|
+
from: string;
|
|
78
|
+
setup: true;
|
|
79
|
+
} | {
|
|
80
|
+
name: string;
|
|
81
|
+
amountUsd: string | number;
|
|
82
|
+
from?: string;
|
|
83
|
+
setup?: undefined;
|
|
84
|
+
};
|
|
85
|
+
export type SwarmRebalanceResult = {
|
|
86
|
+
status: "sent" | "incomplete" | "balanced" | "resumed";
|
|
87
|
+
movement?: SwarmMovementResult;
|
|
88
|
+
blocked: SwarmBlockedLeg[];
|
|
89
|
+
skipped: SwarmSkippedMember[];
|
|
90
|
+
message: string;
|
|
91
|
+
};
|
|
92
|
+
export type SwarmLeaveResult = {
|
|
93
|
+
status: "left" | "kept" | "resumed";
|
|
94
|
+
member: string;
|
|
95
|
+
movement?: SwarmMovementResult;
|
|
96
|
+
message: string;
|
|
97
|
+
};
|
|
98
|
+
export type SwarmDissolveResult = {
|
|
99
|
+
status: "dissolved" | "incomplete" | "resumed";
|
|
100
|
+
movements: SwarmMovementResult[];
|
|
101
|
+
message: string;
|
|
102
|
+
};
|
|
103
|
+
export type AllocateFromTreasuryOptions = {
|
|
104
|
+
name: string;
|
|
105
|
+
member: string;
|
|
106
|
+
amountUsd: string | number;
|
|
107
|
+
reason: "allocate" | "delegate";
|
|
108
|
+
requestId?: string;
|
|
109
|
+
draw?: RunBudget;
|
|
110
|
+
};
|
|
111
|
+
export type AllocateFromTreasuryResult = {
|
|
112
|
+
status: "sent" | "incomplete" | "blocked" | "resumed";
|
|
113
|
+
movementId: string | null;
|
|
114
|
+
requestedUsd: string;
|
|
115
|
+
sentUsd: string;
|
|
116
|
+
unknownUsd: string;
|
|
117
|
+
blocked: Array<{
|
|
118
|
+
to: string;
|
|
119
|
+
amountUsd: string;
|
|
120
|
+
reason: string;
|
|
121
|
+
}>;
|
|
122
|
+
movement?: SwarmMovementResult;
|
|
123
|
+
message: string;
|
|
124
|
+
};
|
|
125
|
+
export declare function treasuryRequestMovementId(swarm: string, requestId: string): string;
|
|
126
|
+
/**
|
|
127
|
+
* Moves treasury capital for one intent. Reusing a requestId returns a finished result or resumes
|
|
128
|
+
* its unfinished movement; changing its member, amount, or reason is a request conflict. Different
|
|
129
|
+
* requestIds are distinct intents, bounded only by the run draw and treasury caps.
|
|
130
|
+
*/
|
|
131
|
+
export declare function allocateFromTreasury(opts: AllocateFromTreasuryOptions, deps: SwarmCapitalDeps): Promise<AllocateFromTreasuryResult>;
|
|
132
|
+
export declare function fundSwarm(opts: SwarmFundOptions, deps: SwarmCapitalDeps): Promise<SwarmFundResult>;
|
|
133
|
+
export declare function rebalanceSwarm(opts: {
|
|
134
|
+
name: string;
|
|
135
|
+
targetsUsd?: Record<string, string | number>;
|
|
136
|
+
}, deps: SwarmCapitalDeps): Promise<SwarmRebalanceResult>;
|
|
137
|
+
export declare function leaveSwarm(opts: {
|
|
138
|
+
name: string;
|
|
139
|
+
member: string;
|
|
140
|
+
}, deps: SwarmCapitalDeps): Promise<SwarmLeaveResult>;
|
|
141
|
+
export declare function dissolveSwarm(opts: {
|
|
142
|
+
name: string;
|
|
143
|
+
}, deps: SwarmCapitalDeps): Promise<SwarmDissolveResult>;
|
|
144
|
+
export declare function readDelegationRecord(home: string, movementId: string): Promise<DelegationRecord | undefined>;
|
|
145
|
+
export declare function writeDelegationRecord(home: string, record: DelegationRecord): Promise<void>;
|
|
146
|
+
export {};
|
|
147
|
+
//# sourceMappingURL=swarm-capital.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swarm-capital.d.ts","sourceRoot":"","sources":["../src/swarm-capital.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,OAAO,EAAqB,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAA2C,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAQL,KAAK,oBAAoB,EAG1B,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjE,OAAO,EAQL,KAAK,kBAAkB,EAGxB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAIrE,MAAM,MAAM,gBAAgB,GAAG,oBAAo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CAAC,CAAA;CAAE,EACpE,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,oBAAoB,CAAC,CAG/B;AAgHD,wBAAsB,UAAU,CAC9B,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EACtC,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,gBAAgB,CAAC,CAG3B;AA0FD,wBAAsB,aAAa,CACjC,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EACtB,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,mBAAmB,CAAC,CAG9B;AA8GD,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAkBvC;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAOjG"}
|
package/dist/swarm.d.ts
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type AccountLinkOutcome, type StartAccountLinkArgs } from "./account-add.js";
|
|
3
|
+
import { type AgentGrant } from "./agent-profile.js";
|
|
4
|
+
import { type VapiConfig } from "./config.js";
|
|
5
|
+
import { type MovementSummary } from "./movement.js";
|
|
6
|
+
import type { SecretStore } from "./secret-store.js";
|
|
7
|
+
import type { TransferNetwork } from "./transfer.js";
|
|
8
|
+
import { type WalletName } from "./wallet-name.js";
|
|
9
|
+
import type { WalletStore } from "./wallet-store.js";
|
|
10
|
+
import { type CanonicalX402UsdcNetwork } from "./x402-networks.js";
|
|
11
|
+
export declare const SWARM_NAME_PATTERN: RegExp;
|
|
12
|
+
export declare const SWARM_ROLE_PATTERN: RegExp;
|
|
13
|
+
export declare const DEFAULT_SWARM_MODEL = "venice/claude-sonnet-5";
|
|
14
|
+
export type SwarmStrategy = "targets" | "even" | "weights";
|
|
15
|
+
export declare const SWARM_TREASURY_CAPS: {
|
|
16
|
+
readonly perCallAtomic: "5000000";
|
|
17
|
+
readonly perDayAtomic: "20000000";
|
|
18
|
+
};
|
|
19
|
+
export declare const swarmFileSchema: z.ZodObject<{
|
|
20
|
+
v: z.ZodLiteral<1>;
|
|
21
|
+
name: z.ZodString;
|
|
22
|
+
device: z.ZodString;
|
|
23
|
+
network: z.ZodEnum<{
|
|
24
|
+
"eip155:8453": "eip155:8453";
|
|
25
|
+
"eip155:5042": "eip155:5042";
|
|
26
|
+
}>;
|
|
27
|
+
createdAt: z.ZodISODateTime;
|
|
28
|
+
treasury: z.ZodObject<{
|
|
29
|
+
account: z.ZodString;
|
|
30
|
+
address: z.ZodOptional<z.ZodString>;
|
|
31
|
+
steps: z.ZodObject<{
|
|
32
|
+
creating: z.ZodDefault<z.ZodBoolean>;
|
|
33
|
+
created: z.ZodBoolean;
|
|
34
|
+
capped: z.ZodBoolean;
|
|
35
|
+
linked: z.ZodBoolean;
|
|
36
|
+
}, z.core.$strict>;
|
|
37
|
+
}, z.core.$strict>;
|
|
38
|
+
members: z.ZodArray<z.ZodObject<{
|
|
39
|
+
account: z.ZodString;
|
|
40
|
+
address: z.ZodOptional<z.ZodString>;
|
|
41
|
+
role: z.ZodString;
|
|
42
|
+
weight: z.ZodNumber;
|
|
43
|
+
targetAtomic: z.ZodString;
|
|
44
|
+
ceilingAtomic: z.ZodNullable<z.ZodString>;
|
|
45
|
+
steps: z.ZodObject<{
|
|
46
|
+
profiled: z.ZodBoolean;
|
|
47
|
+
creating: z.ZodDefault<z.ZodBoolean>;
|
|
48
|
+
created: z.ZodBoolean;
|
|
49
|
+
capped: z.ZodBoolean;
|
|
50
|
+
linked: z.ZodBoolean;
|
|
51
|
+
}, z.core.$strict>;
|
|
52
|
+
}, z.core.$strict>>;
|
|
53
|
+
setupFunding: z.ZodOptional<z.ZodObject<{
|
|
54
|
+
amountUsd: z.ZodString;
|
|
55
|
+
from: z.ZodString;
|
|
56
|
+
movementId: z.ZodOptional<z.ZodString>;
|
|
57
|
+
status: z.ZodEnum<{
|
|
58
|
+
sent: "sent";
|
|
59
|
+
planned: "planned";
|
|
60
|
+
incomplete: "incomplete";
|
|
61
|
+
}>;
|
|
62
|
+
policy: z.ZodOptional<z.ZodObject<{
|
|
63
|
+
strategy: z.ZodEnum<{
|
|
64
|
+
even: "even";
|
|
65
|
+
weights: "weights";
|
|
66
|
+
targets: "targets";
|
|
67
|
+
}>;
|
|
68
|
+
movementId: z.ZodOptional<z.ZodString>;
|
|
69
|
+
status: z.ZodEnum<{
|
|
70
|
+
sent: "sent";
|
|
71
|
+
planned: "planned";
|
|
72
|
+
incomplete: "incomplete";
|
|
73
|
+
}>;
|
|
74
|
+
blocked: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
75
|
+
to: z.ZodString;
|
|
76
|
+
amountUsd: z.ZodString;
|
|
77
|
+
reason: z.ZodString;
|
|
78
|
+
}, z.core.$strict>>>;
|
|
79
|
+
}, z.core.$strict>>;
|
|
80
|
+
}, z.core.$strict>>;
|
|
81
|
+
policy: z.ZodObject<{
|
|
82
|
+
strategy: z.ZodEnum<{
|
|
83
|
+
even: "even";
|
|
84
|
+
weights: "weights";
|
|
85
|
+
targets: "targets";
|
|
86
|
+
}>;
|
|
87
|
+
treasuryCaps: z.ZodObject<{
|
|
88
|
+
perCallAtomic: z.ZodString;
|
|
89
|
+
perDayAtomic: z.ZodString;
|
|
90
|
+
}, z.core.$strict>;
|
|
91
|
+
}, z.core.$strict>;
|
|
92
|
+
}, z.core.$strict>;
|
|
93
|
+
export type SwarmFile = z.infer<typeof swarmFileSchema>;
|
|
94
|
+
export type SwarmMember = SwarmFile["members"][number];
|
|
95
|
+
export type SwarmErrorCode = "invalid_swarm" | "swarm_not_found" | "swarm_exists_different_shape" | "account_in_other_swarm" | "account_name_taken" | "name_too_long" | "treasury_refused" | "member_not_found" | "member_not_linked" | "draw_exceeded" | "request_conflict" | "movement_unfinished" | "ceiling_sweep_pending" | "account_address_mismatch" | "swarm_locked";
|
|
96
|
+
export declare class SwarmError extends Error {
|
|
97
|
+
readonly code: SwarmErrorCode;
|
|
98
|
+
constructor(code: SwarmErrorCode, message: string);
|
|
99
|
+
}
|
|
100
|
+
export declare function swarmsDirectory(home: string): string;
|
|
101
|
+
export declare function swarmFilePath(home: string, name: string): string;
|
|
102
|
+
export declare function readSwarm(home: string, name: string): Promise<SwarmFile>;
|
|
103
|
+
export declare function listSwarms(home: string): Promise<SwarmFile[]>;
|
|
104
|
+
export declare function writeSwarm(home: string, value: SwarmFile): Promise<void>;
|
|
105
|
+
export declare function deleteSwarmFile(home: string, name: string): Promise<void>;
|
|
106
|
+
export declare function withSwarmLock<T>(home: string, name: string, fn: () => Promise<T>): Promise<T>;
|
|
107
|
+
export declare function swarmAccountNames(swarm: SwarmFile): WalletName[];
|
|
108
|
+
export declare function swarmTreasuryName(name: string): WalletName;
|
|
109
|
+
export declare function swarmMemberName(name: string, role: string, n: number): WalletName;
|
|
110
|
+
export declare function roleDefaults(role: string): {
|
|
111
|
+
weight: number;
|
|
112
|
+
targetAtomic: string;
|
|
113
|
+
ceilingAtomic: string;
|
|
114
|
+
};
|
|
115
|
+
export declare function roleGrants(role: string): AgentGrant[];
|
|
116
|
+
export declare function swarmParentResolver(home: string): (account: WalletName) => Promise<{
|
|
117
|
+
account: WalletName;
|
|
118
|
+
address: `0x${string}`;
|
|
119
|
+
} | undefined>;
|
|
120
|
+
type LinkOptions = Pick<StartAccountLinkArgs, "fetchImpl" | "startDeviceLink" | "pollDeviceLink" | "saveAgentLink" | "sleep" | "signal" | "configPath" | "env" | "hostname" | "awaitApproval">;
|
|
121
|
+
export type SetupSwarmOptions = LinkOptions & {
|
|
122
|
+
home?: string;
|
|
123
|
+
store: WalletStore;
|
|
124
|
+
secrets: SecretStore;
|
|
125
|
+
apiBase: string;
|
|
126
|
+
name: string;
|
|
127
|
+
agents?: number;
|
|
128
|
+
roles?: string[];
|
|
129
|
+
strategy?: SwarmStrategy;
|
|
130
|
+
targetsUsd?: Record<string, string | number>;
|
|
131
|
+
weights?: Record<string, number>;
|
|
132
|
+
ceilingsUsd?: Record<string, string | number | null>;
|
|
133
|
+
caps?: {
|
|
134
|
+
perCallUsd: string | number;
|
|
135
|
+
perDayUsd: string | number;
|
|
136
|
+
};
|
|
137
|
+
treasuryCaps?: {
|
|
138
|
+
perCallUsd: string | number;
|
|
139
|
+
perDayUsd: string | number;
|
|
140
|
+
};
|
|
141
|
+
network?: TransferNetwork;
|
|
142
|
+
model?: string;
|
|
143
|
+
surface: "cli" | "mcp";
|
|
144
|
+
now?: () => Date;
|
|
145
|
+
};
|
|
146
|
+
export type AddSwarmMemberOptions = Omit<SetupSwarmOptions, "agents" | "roles" | "strategy" | "treasuryCaps" | "network"> & {
|
|
147
|
+
role: string;
|
|
148
|
+
targetUsd?: string | number;
|
|
149
|
+
weight?: number;
|
|
150
|
+
ceilingUsd?: string | number | null;
|
|
151
|
+
};
|
|
152
|
+
export type SwarmNextStep = {
|
|
153
|
+
kind: "link";
|
|
154
|
+
account: string;
|
|
155
|
+
userCode: string;
|
|
156
|
+
verificationUri: string;
|
|
157
|
+
verificationUriComplete: string;
|
|
158
|
+
expiresInSeconds: number;
|
|
159
|
+
} | {
|
|
160
|
+
kind: "caps";
|
|
161
|
+
account: string;
|
|
162
|
+
command: string;
|
|
163
|
+
};
|
|
164
|
+
export type SwarmMemberSetupStatus = {
|
|
165
|
+
account: string;
|
|
166
|
+
address: string;
|
|
167
|
+
role: string;
|
|
168
|
+
created: boolean;
|
|
169
|
+
capped: boolean;
|
|
170
|
+
profiled: boolean;
|
|
171
|
+
linked: boolean;
|
|
172
|
+
};
|
|
173
|
+
export type SwarmSetupResult = {
|
|
174
|
+
swarm: SwarmFile;
|
|
175
|
+
members: SwarmMemberSetupStatus[];
|
|
176
|
+
next: SwarmNextStep[];
|
|
177
|
+
completions: Map<string, Promise<AccountLinkOutcome>>;
|
|
178
|
+
};
|
|
179
|
+
export declare function setupSwarm(opts: SetupSwarmOptions): Promise<SwarmSetupResult>;
|
|
180
|
+
export declare function addSwarmMember(opts: AddSwarmMemberOptions): Promise<SwarmSetupResult>;
|
|
181
|
+
export type SwarmBalanceReader = (input: {
|
|
182
|
+
account: WalletName;
|
|
183
|
+
address: string;
|
|
184
|
+
network: CanonicalX402UsdcNetwork;
|
|
185
|
+
}) => Promise<bigint>;
|
|
186
|
+
export type SwarmStatusOptions = {
|
|
187
|
+
home?: string;
|
|
188
|
+
store: WalletStore;
|
|
189
|
+
name: string;
|
|
190
|
+
balanceReader?: SwarmBalanceReader;
|
|
191
|
+
config?: VapiConfig;
|
|
192
|
+
fetchImpl?: typeof fetch;
|
|
193
|
+
};
|
|
194
|
+
export type SwarmStatusResult = {
|
|
195
|
+
swarm: string;
|
|
196
|
+
network: TransferNetwork;
|
|
197
|
+
strategy: SwarmStrategy;
|
|
198
|
+
treasury: {
|
|
199
|
+
account: string;
|
|
200
|
+
address: string;
|
|
201
|
+
linked: boolean;
|
|
202
|
+
balanceAtomic: string;
|
|
203
|
+
balanceUsd: string;
|
|
204
|
+
};
|
|
205
|
+
members: Array<{
|
|
206
|
+
account: string;
|
|
207
|
+
address: string;
|
|
208
|
+
role: string;
|
|
209
|
+
weight: number;
|
|
210
|
+
targetUsd: string;
|
|
211
|
+
ceilingUsd: string | null;
|
|
212
|
+
linked: boolean;
|
|
213
|
+
profile: boolean;
|
|
214
|
+
balanceAtomic: string;
|
|
215
|
+
balanceUsd: string;
|
|
216
|
+
allocatedInUsd: string;
|
|
217
|
+
sweptOutUsd: string;
|
|
218
|
+
netUsd: string;
|
|
219
|
+
}>;
|
|
220
|
+
openMovements: MovementSummary[];
|
|
221
|
+
};
|
|
222
|
+
export declare function swarmStatus(opts: SwarmStatusOptions): Promise<SwarmStatusResult>;
|
|
223
|
+
export {};
|
|
224
|
+
//# sourceMappingURL=swarm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|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B,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,MAAM,EAAE,OAAO,CAAC;QAChB,OAAO,EAAE,OAAO,CAAC;QACjB,aAAa,EAAE,MAAM,CAAC;QACtB,UAAU,EAAE,MAAM,CAAC;QACnB,cAAc,EAAE,MAAM,CAAC;QACvB,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;IACH,aAAa,EAAE,eAAe,EAAE,CAAC;CAClC,CAAC;AACF,wBAAsB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAqGtF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Receipt } from "./receipts.js";
|
|
2
|
+
import type { WalletName } from "./wallet-name.js";
|
|
3
|
+
export type TransferJournal = {
|
|
4
|
+
signed: boolean;
|
|
5
|
+
latest?: Receipt;
|
|
6
|
+
request?: Receipt;
|
|
7
|
+
validBefore?: string;
|
|
8
|
+
reservedOn?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function readTransferJournal(home: string, from: WalletName, nonce: string): Promise<TransferJournal>;
|
|
11
|
+
//# sourceMappingURL=transfer-journal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transfer-journal.d.ts","sourceRoot":"","sources":["../src/transfer-journal.ts"],"names":[],"mappings":"AAGA,OAAO,EAA+B,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,eAAe,CAAC,CAsC1B"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { SecretStore } from "./secret-store.js";
|
|
2
|
+
import { type WalletName, type WalletStore } from "./wallet-store.js";
|
|
3
|
+
import { type X402TypedData } from "./x402.js";
|
|
4
|
+
import { ARC_MAINNET_CAIP2, BASE_MAINNET_CAIP2 } from "./x402-networks.js";
|
|
5
|
+
export type TransferPurpose = "send" | "sweep";
|
|
6
|
+
export type TransferNetwork = typeof BASE_MAINNET_CAIP2 | typeof ARC_MAINNET_CAIP2;
|
|
7
|
+
export type TransferSigner = {
|
|
8
|
+
address: `0x${string}`;
|
|
9
|
+
signTypedData: (typedData: X402TypedData) => Promise<`0x${string}`>;
|
|
10
|
+
};
|
|
11
|
+
export type TransferArgs = {
|
|
12
|
+
store: WalletStore;
|
|
13
|
+
secrets: SecretStore;
|
|
14
|
+
apiBase: string;
|
|
15
|
+
from: WalletName;
|
|
16
|
+
to: string;
|
|
17
|
+
amountUsd: string | number;
|
|
18
|
+
network?: "base" | "arc" | TransferNetwork;
|
|
19
|
+
purpose?: TransferPurpose;
|
|
20
|
+
sweepParent?: `0x${string}`;
|
|
21
|
+
expectedFromAddress?: string;
|
|
22
|
+
expectedToAddress?: string;
|
|
23
|
+
unlock?: (account: WalletName) => Promise<TransferSigner>;
|
|
24
|
+
resume?: `0x${string}`;
|
|
25
|
+
fetchImpl?: typeof fetch;
|
|
26
|
+
now?: () => number;
|
|
27
|
+
nonce?: `0x${string}`;
|
|
28
|
+
timeoutMs?: number;
|
|
29
|
+
/** Cancels discovery/signing/relay work owned by a bounded best-effort caller. */
|
|
30
|
+
signal?: AbortSignal;
|
|
31
|
+
ledgerPath?: string;
|
|
32
|
+
home?: string;
|
|
33
|
+
};
|
|
34
|
+
export type TransferResult = {
|
|
35
|
+
status: "sent" | "unknown";
|
|
36
|
+
from: WalletName;
|
|
37
|
+
to: `0x${string}`;
|
|
38
|
+
toName: string;
|
|
39
|
+
toKind: "owner" | "account";
|
|
40
|
+
amountUsd: string;
|
|
41
|
+
amountAtomic: string;
|
|
42
|
+
network: TransferNetwork;
|
|
43
|
+
txHash: `0x${string}` | null;
|
|
44
|
+
nonce: `0x${string}`;
|
|
45
|
+
replayed: boolean;
|
|
46
|
+
};
|
|
47
|
+
export type TransferErrorCode = "invalid_amount" | "invalid_network" | "not_linked" | "unsupported" | "recipient_not_allowed" | "ambiguous_recipient" | "sweep_not_owner" | "per_call_cap_exceeded" | "per_day_cap_exceeded" | "payer_mismatch" | "payee_not_allowed" | "authorization_invalid" | "relay_limit" | "relay_failed" | "temporarily_unavailable" | "network_error" | "resume_not_found" | "resume_mismatch" | "signer_mismatch" | "account_address_mismatch" | "signing_failed";
|
|
48
|
+
export declare class TransferError extends Error {
|
|
49
|
+
readonly code: TransferErrorCode;
|
|
50
|
+
readonly moneyMoved: false;
|
|
51
|
+
readonly reservationReleased: boolean;
|
|
52
|
+
readonly resetsAt?: string;
|
|
53
|
+
readonly addresses?: string[];
|
|
54
|
+
constructor(code: TransferErrorCode, message: string, options?: {
|
|
55
|
+
reservationReleased?: boolean;
|
|
56
|
+
resetsAt?: string;
|
|
57
|
+
addresses?: string[];
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
export declare function parseTransferAmount(value: string | number): {
|
|
61
|
+
amountUsd: string;
|
|
62
|
+
amountAtomic: bigint;
|
|
63
|
+
};
|
|
64
|
+
export declare function transferBetweenAccounts(args: TransferArgs): Promise<TransferResult>;
|
|
65
|
+
//# sourceMappingURL=transfer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../src/transfer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