@owney/sdk 0.7.25-beta.7 → 0.7.25-beta.9

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/index.d.cts CHANGED
@@ -70,148 +70,6 @@ type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
70
70
  type OwneySupportedChains = (typeof SUPPORTED_CHAINS)[number];
71
71
  type OwneySupportedTokens = (typeof SUPPORTED_TOKENS)[number];
72
72
 
73
- type AgentId = "zyfai" | "yieldseeker";
74
- type Asset = string;
75
- type AgentSupportedAsset = {
76
- readonly symbol: string;
77
- readonly minDepositAmount: string;
78
- };
79
- type AgentSupportedAssets = {
80
- readonly chainId: number;
81
- readonly chain?: string;
82
- readonly assets: readonly AgentSupportedAsset[];
83
- };
84
- type AvailableAgent = {
85
- id: AgentId;
86
- isEnabled: boolean;
87
- supportedChainIds: readonly number[];
88
- supportedAssets: readonly AgentSupportedAssets[];
89
- };
90
- type AvailableAgentsOptions = {
91
- chainId?: number;
92
- asset?: Asset;
93
- /** Disabled agents are omitted by default because they cannot accept funds. */
94
- includeDisabled?: boolean;
95
- };
96
- /**
97
- * A lookback window for any "last N days" read — the APY series, the daily
98
- * earnings series. Named for the window itself, so nothing borrows the APY's
99
- * name to ask for something else.
100
- */
101
- type LookbackDays = "7D" | "14D" | "30D";
102
- /** Kept so existing callers keep compiling. Prefer `LookbackDays`. */
103
- type DailyApyDays = LookbackDays;
104
- type HistoryFilters = {
105
- fromDate?: string;
106
- toDate?: string;
107
- /** Max entries returned per call. Defaults to 10. */
108
- limit?: number;
109
- /** Opaque cursor returned by a previous getHistory call. */
110
- cursor?: string;
111
- /**
112
- * Optional asset symbol (e.g. "USDC", "WETH") to scope the history to a
113
- * single asset. Without it the page blends every asset on the chain, so a
114
- * consumer showing one asset at a time has to filter client-side — and a
115
- * page whose entries all belong to the *other* asset then renders empty
116
- * even though matching entries exist further back. Agents whose backends
117
- * cannot filter by asset ignore this and return the whole chain's history.
118
- */
119
- tokenSymbol?: string;
120
- };
121
- type HistoryOptions = {
122
- agentId?: AgentId;
123
- filters?: HistoryFilters;
124
- };
125
- type WithdrawOptions = {
126
- asset: Asset;
127
- amount?: string;
128
- agentId?: AgentId;
129
- };
130
- type AccountApyOptions = {
131
- agentId?: AgentId;
132
- days: LookbackDays;
133
- /**
134
- * Optional asset symbol (e.g. "USDC", "WETH") to scope the daily APY series
135
- * to a specific asset on the active chain. Without it the series blends every
136
- * position on the chain, so two assets sharing a chain (USDC and WETH on
137
- * Base/Arbitrum) would render one merged line. Agents whose backends do not
138
- * expose per-asset positions ignore this. (ROUT-186)
139
- */
140
- tokenSymbol?: string;
141
- };
142
- /**
143
- * Options for the daily earnings series. Same shape as `AccountApyOptions` and
144
- * deliberately its own type: the two reads answer different questions and are
145
- * free to diverge.
146
- */
147
- type DailyEarningsOptions = {
148
- agentId?: AgentId;
149
- days: LookbackDays;
150
- /**
151
- * Optional asset symbol (e.g. "USDC", "WETH") scoping the series to one
152
- * asset on the active chain.
153
- */
154
- tokenSymbol?: string;
155
- };
156
- type AllocationApyOptions = {
157
- agentId?: AgentId;
158
- };
159
- type AgentsApyOptions = {
160
- agentId?: AgentId;
161
- days: DailyApyDays;
162
- /**
163
- * Optional asset symbol (e.g. "USDC", "WETH") to scope the APY to a
164
- * specific asset+chain. Ignored by agents whose backends do not yet
165
- * support per-asset APY.
166
- */
167
- tokenSymbol?: string;
168
- /**
169
- * Optional chain id for per-asset APY lookups. Typically paired with
170
- * `tokenSymbol`.
171
- */
172
- chainId?: number;
173
- };
174
- type DepositOptions = {
175
- amount: string;
176
- asset: Asset;
177
- depositCallback?: DepositCallback;
178
- agentId?: AgentId;
179
- onApproved?: () => void;
180
- };
181
-
182
- /**
183
- * One protocol's pool selection on one chain. `pools` holds Zyfai pool NAMES
184
- * verbatim — matched case-sensitively by customizeBatch, and an unrecognised
185
- * name makes Zyfai's rebalance engine skip the whole protocol, so these strings
186
- * must not be normalised anywhere.
187
- *
188
- * An empty array means "no usable pools on this chain".
189
- */
190
- type OrgPoolSelection = {
191
- protocolId: string;
192
- chainId: number;
193
- pools: string[];
194
- };
195
- /**
196
- * The partner's protocol/pool policy (ROUT-224). Sparse — only protocols they
197
- * narrowed appear. Optional so an older routing API, which does not return the
198
- * field, still parses; undefined and null both mean "change nothing".
199
- */
200
- type OrgPoolPolicy = {
201
- autoApproveProtocols: boolean;
202
- autoApprovePools: boolean;
203
- selections: OrgPoolSelection[];
204
- };
205
- /**
206
- * The organization's agent execution policy, or null when the partner has never
207
- * configured one — in which case the agents leave the user's profile alone.
208
- */
209
- type OrgAgentConfig = {
210
- splittingMode: "none" | "automatic" | "force";
211
- minSplits: number | null;
212
- poolPolicy?: OrgPoolPolicy | null;
213
- };
214
-
215
73
  interface OwneyDepositResult {
216
74
  txHash: string;
217
75
  smartWallet: string;
@@ -248,8 +106,10 @@ interface OwneyPosition {
248
106
  pool?: string;
249
107
  asset: string;
250
108
  amount: string;
251
- /** Smallest-unit amount when the provider exposes it alongside `amount`. */
109
+ /** Provider-native raw quantity; may represent vault shares, not the underlying asset. */
252
110
  amountRaw?: string;
111
+ /** Withdrawable underlying asset amount in that asset's smallest units. */
112
+ withdrawableAmountRaw?: string;
253
113
  apy?: number;
254
114
  tvl?: number;
255
115
  /** Pool liquidity. Prepared slot — Zyfai will add this to its portfolio
@@ -482,6 +342,150 @@ interface AccountDailyEarnings {
482
342
  assets: AssetDailyEarnings[];
483
343
  }
484
344
 
345
+ type AgentId = "zyfai" | "yieldseeker";
346
+ type Asset = string;
347
+ type AgentSupportedAsset = {
348
+ readonly symbol: string;
349
+ readonly minDepositAmount: string;
350
+ };
351
+ type AgentSupportedAssets = {
352
+ readonly chainId: number;
353
+ readonly chain?: string;
354
+ readonly assets: readonly AgentSupportedAsset[];
355
+ };
356
+ type AvailableAgent = {
357
+ id: AgentId;
358
+ isEnabled: boolean;
359
+ supportedChainIds: readonly number[];
360
+ supportedAssets: readonly AgentSupportedAssets[];
361
+ };
362
+ type AvailableAgentsOptions = {
363
+ chainId?: number;
364
+ asset?: Asset;
365
+ /** Disabled agents are omitted by default because they cannot accept funds. */
366
+ includeDisabled?: boolean;
367
+ };
368
+ /**
369
+ * A lookback window for any "last N days" read — the APY series, the daily
370
+ * earnings series. Named for the window itself, so nothing borrows the APY's
371
+ * name to ask for something else.
372
+ */
373
+ type LookbackDays = "7D" | "14D" | "30D";
374
+ /** Kept so existing callers keep compiling. Prefer `LookbackDays`. */
375
+ type DailyApyDays = LookbackDays;
376
+ type HistoryFilters = {
377
+ fromDate?: string;
378
+ toDate?: string;
379
+ /** Max entries returned per call. Defaults to 10. */
380
+ limit?: number;
381
+ /** Opaque cursor returned by a previous getHistory call. */
382
+ cursor?: string;
383
+ /**
384
+ * Optional asset symbol (e.g. "USDC", "WETH") to scope the history to a
385
+ * single asset. Without it the page blends every asset on the chain, so a
386
+ * consumer showing one asset at a time has to filter client-side — and a
387
+ * page whose entries all belong to the *other* asset then renders empty
388
+ * even though matching entries exist further back. Agents whose backends
389
+ * cannot filter by asset ignore this and return the whole chain's history.
390
+ */
391
+ tokenSymbol?: string;
392
+ };
393
+ type HistoryOptions = {
394
+ agentId?: AgentId;
395
+ filters?: HistoryFilters;
396
+ };
397
+ type WithdrawOptions = {
398
+ asset: Asset;
399
+ amount?: string;
400
+ agentId?: AgentId;
401
+ /** Called after each agent returns; callback failures never change a financial result. */
402
+ onAgentResult?: (agentId: AgentId, result: AgentWithdrawResult) => void;
403
+ };
404
+ type AccountApyOptions = {
405
+ agentId?: AgentId;
406
+ days: LookbackDays;
407
+ /**
408
+ * Optional asset symbol (e.g. "USDC", "WETH") to scope the daily APY series
409
+ * to a specific asset on the active chain. Without it the series blends every
410
+ * position on the chain, so two assets sharing a chain (USDC and WETH on
411
+ * Base/Arbitrum) would render one merged line. Agents whose backends do not
412
+ * expose per-asset positions ignore this. (ROUT-186)
413
+ */
414
+ tokenSymbol?: string;
415
+ };
416
+ /**
417
+ * Options for the daily earnings series. Same shape as `AccountApyOptions` and
418
+ * deliberately its own type: the two reads answer different questions and are
419
+ * free to diverge.
420
+ */
421
+ type DailyEarningsOptions = {
422
+ agentId?: AgentId;
423
+ days: LookbackDays;
424
+ /**
425
+ * Optional asset symbol (e.g. "USDC", "WETH") scoping the series to one
426
+ * asset on the active chain.
427
+ */
428
+ tokenSymbol?: string;
429
+ };
430
+ type AllocationApyOptions = {
431
+ agentId?: AgentId;
432
+ };
433
+ type AgentsApyOptions = {
434
+ agentId?: AgentId;
435
+ days: DailyApyDays;
436
+ /**
437
+ * Optional asset symbol (e.g. "USDC", "WETH") to scope the APY to a
438
+ * specific asset+chain. Ignored by agents whose backends do not yet
439
+ * support per-asset APY.
440
+ */
441
+ tokenSymbol?: string;
442
+ /**
443
+ * Optional chain id for per-asset APY lookups. Typically paired with
444
+ * `tokenSymbol`.
445
+ */
446
+ chainId?: number;
447
+ };
448
+ type DepositOptions = {
449
+ amount: string;
450
+ asset: Asset;
451
+ depositCallback?: DepositCallback;
452
+ agentId?: AgentId;
453
+ onApproved?: () => void;
454
+ };
455
+
456
+ /**
457
+ * One protocol's pool selection on one chain. `pools` holds Zyfai pool NAMES
458
+ * verbatim — matched case-sensitively by customizeBatch, and an unrecognised
459
+ * name makes Zyfai's rebalance engine skip the whole protocol, so these strings
460
+ * must not be normalised anywhere.
461
+ *
462
+ * An empty array means "no usable pools on this chain".
463
+ */
464
+ type OrgPoolSelection = {
465
+ protocolId: string;
466
+ chainId: number;
467
+ pools: string[];
468
+ };
469
+ /**
470
+ * The partner's protocol/pool policy (ROUT-224). Sparse — only protocols they
471
+ * narrowed appear. Optional so an older routing API, which does not return the
472
+ * field, still parses; undefined and null both mean "change nothing".
473
+ */
474
+ type OrgPoolPolicy = {
475
+ autoApproveProtocols: boolean;
476
+ autoApprovePools: boolean;
477
+ selections: OrgPoolSelection[];
478
+ };
479
+ /**
480
+ * The organization's agent execution policy, or null when the partner has never
481
+ * configured one — in which case the agents leave the user's profile alone.
482
+ */
483
+ type OrgAgentConfig = {
484
+ splittingMode: "none" | "automatic" | "force";
485
+ minSplits: number | null;
486
+ poolPolicy?: OrgPoolPolicy | null;
487
+ };
488
+
485
489
  type DepositCallback = (smartWalletAddress: string, chainId: number, amount: string) => Promise<`0x${string}`> | `0x${string}`;
486
490
  interface IAgent {
487
491
  readonly id: string;
@@ -910,6 +914,13 @@ declare class YieldseekerAgent implements IAgent {
910
914
  private readonly readCache;
911
915
  private readonly pendingReads;
912
916
  private readGeneration;
917
+ private readonly portfolioVersions;
918
+ private readonly snapshotFailures;
919
+ private readonly standardReadFailures;
920
+ private readonly reconcileUntil;
921
+ private readonly activityRefreshUntil;
922
+ private readonly snapshotMovements;
923
+ private readonly movementEpochs;
913
924
  private readonly yieldOptions;
914
925
  private readonly pendingYieldOptions;
915
926
  constructor(owneyApiKey: string, options?: YieldseekerAgentOptions);
@@ -927,6 +938,7 @@ declare class YieldseekerAgent implements IAgent {
927
938
  private loadYieldOptions;
928
939
  private userKey;
929
940
  private contextKey;
941
+ private assertSession;
930
942
  private cachedRead;
931
943
  private agentListKey;
932
944
  private listAgents;
@@ -937,6 +949,12 @@ declare class YieldseekerAgent implements IAgent {
937
949
  private findAgent;
938
950
  private resolveAgent;
939
951
  private loadPortfolio;
952
+ private portfolioVersion;
953
+ private portfolioCacheMs;
954
+ private snapshotMovement;
955
+ private advancePortfolioVersion;
956
+ private requestPortfolioSnapshot;
957
+ private portfolioSnapshot;
940
958
  private loadPortfolioContext;
941
959
  private deployAgent;
942
960
  private refreshSnapshotAfterMovement;
package/dist/index.d.ts CHANGED
@@ -70,148 +70,6 @@ type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
70
70
  type OwneySupportedChains = (typeof SUPPORTED_CHAINS)[number];
71
71
  type OwneySupportedTokens = (typeof SUPPORTED_TOKENS)[number];
72
72
 
73
- type AgentId = "zyfai" | "yieldseeker";
74
- type Asset = string;
75
- type AgentSupportedAsset = {
76
- readonly symbol: string;
77
- readonly minDepositAmount: string;
78
- };
79
- type AgentSupportedAssets = {
80
- readonly chainId: number;
81
- readonly chain?: string;
82
- readonly assets: readonly AgentSupportedAsset[];
83
- };
84
- type AvailableAgent = {
85
- id: AgentId;
86
- isEnabled: boolean;
87
- supportedChainIds: readonly number[];
88
- supportedAssets: readonly AgentSupportedAssets[];
89
- };
90
- type AvailableAgentsOptions = {
91
- chainId?: number;
92
- asset?: Asset;
93
- /** Disabled agents are omitted by default because they cannot accept funds. */
94
- includeDisabled?: boolean;
95
- };
96
- /**
97
- * A lookback window for any "last N days" read — the APY series, the daily
98
- * earnings series. Named for the window itself, so nothing borrows the APY's
99
- * name to ask for something else.
100
- */
101
- type LookbackDays = "7D" | "14D" | "30D";
102
- /** Kept so existing callers keep compiling. Prefer `LookbackDays`. */
103
- type DailyApyDays = LookbackDays;
104
- type HistoryFilters = {
105
- fromDate?: string;
106
- toDate?: string;
107
- /** Max entries returned per call. Defaults to 10. */
108
- limit?: number;
109
- /** Opaque cursor returned by a previous getHistory call. */
110
- cursor?: string;
111
- /**
112
- * Optional asset symbol (e.g. "USDC", "WETH") to scope the history to a
113
- * single asset. Without it the page blends every asset on the chain, so a
114
- * consumer showing one asset at a time has to filter client-side — and a
115
- * page whose entries all belong to the *other* asset then renders empty
116
- * even though matching entries exist further back. Agents whose backends
117
- * cannot filter by asset ignore this and return the whole chain's history.
118
- */
119
- tokenSymbol?: string;
120
- };
121
- type HistoryOptions = {
122
- agentId?: AgentId;
123
- filters?: HistoryFilters;
124
- };
125
- type WithdrawOptions = {
126
- asset: Asset;
127
- amount?: string;
128
- agentId?: AgentId;
129
- };
130
- type AccountApyOptions = {
131
- agentId?: AgentId;
132
- days: LookbackDays;
133
- /**
134
- * Optional asset symbol (e.g. "USDC", "WETH") to scope the daily APY series
135
- * to a specific asset on the active chain. Without it the series blends every
136
- * position on the chain, so two assets sharing a chain (USDC and WETH on
137
- * Base/Arbitrum) would render one merged line. Agents whose backends do not
138
- * expose per-asset positions ignore this. (ROUT-186)
139
- */
140
- tokenSymbol?: string;
141
- };
142
- /**
143
- * Options for the daily earnings series. Same shape as `AccountApyOptions` and
144
- * deliberately its own type: the two reads answer different questions and are
145
- * free to diverge.
146
- */
147
- type DailyEarningsOptions = {
148
- agentId?: AgentId;
149
- days: LookbackDays;
150
- /**
151
- * Optional asset symbol (e.g. "USDC", "WETH") scoping the series to one
152
- * asset on the active chain.
153
- */
154
- tokenSymbol?: string;
155
- };
156
- type AllocationApyOptions = {
157
- agentId?: AgentId;
158
- };
159
- type AgentsApyOptions = {
160
- agentId?: AgentId;
161
- days: DailyApyDays;
162
- /**
163
- * Optional asset symbol (e.g. "USDC", "WETH") to scope the APY to a
164
- * specific asset+chain. Ignored by agents whose backends do not yet
165
- * support per-asset APY.
166
- */
167
- tokenSymbol?: string;
168
- /**
169
- * Optional chain id for per-asset APY lookups. Typically paired with
170
- * `tokenSymbol`.
171
- */
172
- chainId?: number;
173
- };
174
- type DepositOptions = {
175
- amount: string;
176
- asset: Asset;
177
- depositCallback?: DepositCallback;
178
- agentId?: AgentId;
179
- onApproved?: () => void;
180
- };
181
-
182
- /**
183
- * One protocol's pool selection on one chain. `pools` holds Zyfai pool NAMES
184
- * verbatim — matched case-sensitively by customizeBatch, and an unrecognised
185
- * name makes Zyfai's rebalance engine skip the whole protocol, so these strings
186
- * must not be normalised anywhere.
187
- *
188
- * An empty array means "no usable pools on this chain".
189
- */
190
- type OrgPoolSelection = {
191
- protocolId: string;
192
- chainId: number;
193
- pools: string[];
194
- };
195
- /**
196
- * The partner's protocol/pool policy (ROUT-224). Sparse — only protocols they
197
- * narrowed appear. Optional so an older routing API, which does not return the
198
- * field, still parses; undefined and null both mean "change nothing".
199
- */
200
- type OrgPoolPolicy = {
201
- autoApproveProtocols: boolean;
202
- autoApprovePools: boolean;
203
- selections: OrgPoolSelection[];
204
- };
205
- /**
206
- * The organization's agent execution policy, or null when the partner has never
207
- * configured one — in which case the agents leave the user's profile alone.
208
- */
209
- type OrgAgentConfig = {
210
- splittingMode: "none" | "automatic" | "force";
211
- minSplits: number | null;
212
- poolPolicy?: OrgPoolPolicy | null;
213
- };
214
-
215
73
  interface OwneyDepositResult {
216
74
  txHash: string;
217
75
  smartWallet: string;
@@ -248,8 +106,10 @@ interface OwneyPosition {
248
106
  pool?: string;
249
107
  asset: string;
250
108
  amount: string;
251
- /** Smallest-unit amount when the provider exposes it alongside `amount`. */
109
+ /** Provider-native raw quantity; may represent vault shares, not the underlying asset. */
252
110
  amountRaw?: string;
111
+ /** Withdrawable underlying asset amount in that asset's smallest units. */
112
+ withdrawableAmountRaw?: string;
253
113
  apy?: number;
254
114
  tvl?: number;
255
115
  /** Pool liquidity. Prepared slot — Zyfai will add this to its portfolio
@@ -482,6 +342,150 @@ interface AccountDailyEarnings {
482
342
  assets: AssetDailyEarnings[];
483
343
  }
484
344
 
345
+ type AgentId = "zyfai" | "yieldseeker";
346
+ type Asset = string;
347
+ type AgentSupportedAsset = {
348
+ readonly symbol: string;
349
+ readonly minDepositAmount: string;
350
+ };
351
+ type AgentSupportedAssets = {
352
+ readonly chainId: number;
353
+ readonly chain?: string;
354
+ readonly assets: readonly AgentSupportedAsset[];
355
+ };
356
+ type AvailableAgent = {
357
+ id: AgentId;
358
+ isEnabled: boolean;
359
+ supportedChainIds: readonly number[];
360
+ supportedAssets: readonly AgentSupportedAssets[];
361
+ };
362
+ type AvailableAgentsOptions = {
363
+ chainId?: number;
364
+ asset?: Asset;
365
+ /** Disabled agents are omitted by default because they cannot accept funds. */
366
+ includeDisabled?: boolean;
367
+ };
368
+ /**
369
+ * A lookback window for any "last N days" read — the APY series, the daily
370
+ * earnings series. Named for the window itself, so nothing borrows the APY's
371
+ * name to ask for something else.
372
+ */
373
+ type LookbackDays = "7D" | "14D" | "30D";
374
+ /** Kept so existing callers keep compiling. Prefer `LookbackDays`. */
375
+ type DailyApyDays = LookbackDays;
376
+ type HistoryFilters = {
377
+ fromDate?: string;
378
+ toDate?: string;
379
+ /** Max entries returned per call. Defaults to 10. */
380
+ limit?: number;
381
+ /** Opaque cursor returned by a previous getHistory call. */
382
+ cursor?: string;
383
+ /**
384
+ * Optional asset symbol (e.g. "USDC", "WETH") to scope the history to a
385
+ * single asset. Without it the page blends every asset on the chain, so a
386
+ * consumer showing one asset at a time has to filter client-side — and a
387
+ * page whose entries all belong to the *other* asset then renders empty
388
+ * even though matching entries exist further back. Agents whose backends
389
+ * cannot filter by asset ignore this and return the whole chain's history.
390
+ */
391
+ tokenSymbol?: string;
392
+ };
393
+ type HistoryOptions = {
394
+ agentId?: AgentId;
395
+ filters?: HistoryFilters;
396
+ };
397
+ type WithdrawOptions = {
398
+ asset: Asset;
399
+ amount?: string;
400
+ agentId?: AgentId;
401
+ /** Called after each agent returns; callback failures never change a financial result. */
402
+ onAgentResult?: (agentId: AgentId, result: AgentWithdrawResult) => void;
403
+ };
404
+ type AccountApyOptions = {
405
+ agentId?: AgentId;
406
+ days: LookbackDays;
407
+ /**
408
+ * Optional asset symbol (e.g. "USDC", "WETH") to scope the daily APY series
409
+ * to a specific asset on the active chain. Without it the series blends every
410
+ * position on the chain, so two assets sharing a chain (USDC and WETH on
411
+ * Base/Arbitrum) would render one merged line. Agents whose backends do not
412
+ * expose per-asset positions ignore this. (ROUT-186)
413
+ */
414
+ tokenSymbol?: string;
415
+ };
416
+ /**
417
+ * Options for the daily earnings series. Same shape as `AccountApyOptions` and
418
+ * deliberately its own type: the two reads answer different questions and are
419
+ * free to diverge.
420
+ */
421
+ type DailyEarningsOptions = {
422
+ agentId?: AgentId;
423
+ days: LookbackDays;
424
+ /**
425
+ * Optional asset symbol (e.g. "USDC", "WETH") scoping the series to one
426
+ * asset on the active chain.
427
+ */
428
+ tokenSymbol?: string;
429
+ };
430
+ type AllocationApyOptions = {
431
+ agentId?: AgentId;
432
+ };
433
+ type AgentsApyOptions = {
434
+ agentId?: AgentId;
435
+ days: DailyApyDays;
436
+ /**
437
+ * Optional asset symbol (e.g. "USDC", "WETH") to scope the APY to a
438
+ * specific asset+chain. Ignored by agents whose backends do not yet
439
+ * support per-asset APY.
440
+ */
441
+ tokenSymbol?: string;
442
+ /**
443
+ * Optional chain id for per-asset APY lookups. Typically paired with
444
+ * `tokenSymbol`.
445
+ */
446
+ chainId?: number;
447
+ };
448
+ type DepositOptions = {
449
+ amount: string;
450
+ asset: Asset;
451
+ depositCallback?: DepositCallback;
452
+ agentId?: AgentId;
453
+ onApproved?: () => void;
454
+ };
455
+
456
+ /**
457
+ * One protocol's pool selection on one chain. `pools` holds Zyfai pool NAMES
458
+ * verbatim — matched case-sensitively by customizeBatch, and an unrecognised
459
+ * name makes Zyfai's rebalance engine skip the whole protocol, so these strings
460
+ * must not be normalised anywhere.
461
+ *
462
+ * An empty array means "no usable pools on this chain".
463
+ */
464
+ type OrgPoolSelection = {
465
+ protocolId: string;
466
+ chainId: number;
467
+ pools: string[];
468
+ };
469
+ /**
470
+ * The partner's protocol/pool policy (ROUT-224). Sparse — only protocols they
471
+ * narrowed appear. Optional so an older routing API, which does not return the
472
+ * field, still parses; undefined and null both mean "change nothing".
473
+ */
474
+ type OrgPoolPolicy = {
475
+ autoApproveProtocols: boolean;
476
+ autoApprovePools: boolean;
477
+ selections: OrgPoolSelection[];
478
+ };
479
+ /**
480
+ * The organization's agent execution policy, or null when the partner has never
481
+ * configured one — in which case the agents leave the user's profile alone.
482
+ */
483
+ type OrgAgentConfig = {
484
+ splittingMode: "none" | "automatic" | "force";
485
+ minSplits: number | null;
486
+ poolPolicy?: OrgPoolPolicy | null;
487
+ };
488
+
485
489
  type DepositCallback = (smartWalletAddress: string, chainId: number, amount: string) => Promise<`0x${string}`> | `0x${string}`;
486
490
  interface IAgent {
487
491
  readonly id: string;
@@ -910,6 +914,13 @@ declare class YieldseekerAgent implements IAgent {
910
914
  private readonly readCache;
911
915
  private readonly pendingReads;
912
916
  private readGeneration;
917
+ private readonly portfolioVersions;
918
+ private readonly snapshotFailures;
919
+ private readonly standardReadFailures;
920
+ private readonly reconcileUntil;
921
+ private readonly activityRefreshUntil;
922
+ private readonly snapshotMovements;
923
+ private readonly movementEpochs;
913
924
  private readonly yieldOptions;
914
925
  private readonly pendingYieldOptions;
915
926
  constructor(owneyApiKey: string, options?: YieldseekerAgentOptions);
@@ -927,6 +938,7 @@ declare class YieldseekerAgent implements IAgent {
927
938
  private loadYieldOptions;
928
939
  private userKey;
929
940
  private contextKey;
941
+ private assertSession;
930
942
  private cachedRead;
931
943
  private agentListKey;
932
944
  private listAgents;
@@ -937,6 +949,12 @@ declare class YieldseekerAgent implements IAgent {
937
949
  private findAgent;
938
950
  private resolveAgent;
939
951
  private loadPortfolio;
952
+ private portfolioVersion;
953
+ private portfolioCacheMs;
954
+ private snapshotMovement;
955
+ private advancePortfolioVersion;
956
+ private requestPortfolioSnapshot;
957
+ private portfolioSnapshot;
940
958
  private loadPortfolioContext;
941
959
  private deployAgent;
942
960
  private refreshSnapshotAfterMovement;