@t2000/engine 0.40.4 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +229 -34
- package/dist/index.js +346 -33
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -189,6 +189,19 @@ interface GuardEvent {
|
|
|
189
189
|
tier: GuardTier;
|
|
190
190
|
message?: string;
|
|
191
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* [v1.4 Item 4] Per-guard metric emitted via `EngineConfig.onGuardFired`.
|
|
194
|
+
* Hosts (e.g. audric `TurnMetricsCollector`) accumulate these for the
|
|
195
|
+
* `TurnMetrics.guardsFired` JSON column. Mirrors `GuardEvent` but with
|
|
196
|
+
* a coarser tri-state action (allow/warn/block) so the host doesn't
|
|
197
|
+
* need to know the engine's verdict vocabulary.
|
|
198
|
+
*/
|
|
199
|
+
interface GuardMetric {
|
|
200
|
+
name: string;
|
|
201
|
+
tier: GuardTier;
|
|
202
|
+
action: 'allow' | 'warn' | 'block';
|
|
203
|
+
injectionAdded: boolean;
|
|
204
|
+
}
|
|
192
205
|
interface GuardConfig {
|
|
193
206
|
balanceValidation?: boolean;
|
|
194
207
|
healthFactor?: {
|
|
@@ -236,7 +249,14 @@ declare function createGuardRunnerState(): GuardRunnerState;
|
|
|
236
249
|
declare function runGuards(tool: Tool, call: PendingToolCall, state: GuardRunnerState, config: GuardConfig, conversationContext: {
|
|
237
250
|
fullText: string;
|
|
238
251
|
lastAssistantText: string;
|
|
239
|
-
}
|
|
252
|
+
},
|
|
253
|
+
/**
|
|
254
|
+
* [v1.4 Item 4] Optional per-guard observation hook. Fired exactly
|
|
255
|
+
* once per non-`pass` guard verdict (i.e. for every event that ends
|
|
256
|
+
* up in `events`/`injections`/`block`). Errors thrown by the host
|
|
257
|
+
* are caught so a misbehaving collector can't break tool execution.
|
|
258
|
+
*/
|
|
259
|
+
onGuardFired?: (guard: GuardMetric) => void): GuardCheckResult;
|
|
240
260
|
declare function updateGuardStateAfterToolResult(toolName: string, tool: Tool | undefined, input: unknown, result: unknown, isError: boolean, state: GuardRunnerState): void;
|
|
241
261
|
declare function extractConversationText(messages: Array<{
|
|
242
262
|
role: string;
|
|
@@ -338,7 +358,16 @@ declare const PERMISSION_PRESETS: {
|
|
|
338
358
|
})[];
|
|
339
359
|
};
|
|
340
360
|
};
|
|
341
|
-
|
|
361
|
+
/**
|
|
362
|
+
* Resolve the permission tier for a given operation + USD value.
|
|
363
|
+
*
|
|
364
|
+
* [v1.4] When `sessionSpendUsd` is supplied and adding the incoming
|
|
365
|
+
* `amountUsd` would push cumulative session spend over
|
|
366
|
+
* `config.autonomousDailyLimit`, an otherwise-`auto` tier is downgraded to
|
|
367
|
+
* `confirm`. This is the runtime guard for the daily autonomous spend cap.
|
|
368
|
+
* Tiers above `auto` are returned unchanged.
|
|
369
|
+
*/
|
|
370
|
+
declare function resolvePermissionTier(operation: string, amountUsd: number, config: UserPermissionConfig, sessionSpendUsd?: number): 'auto' | 'confirm' | 'explicit';
|
|
342
371
|
declare function toolNameToOperation(toolName: string): PermissionOperation | undefined;
|
|
343
372
|
/**
|
|
344
373
|
* Resolve the USD value of a tool call from its inputs.
|
|
@@ -391,6 +420,28 @@ type EngineEvent = {
|
|
|
391
420
|
toolUseId: string;
|
|
392
421
|
result: unknown;
|
|
393
422
|
isError: boolean;
|
|
423
|
+
/**
|
|
424
|
+
* [v1.4 Item 4] True when the tool was executed by `EarlyToolDispatcher`
|
|
425
|
+
* (read tools dispatched concurrently before the LLM yields). Hosts
|
|
426
|
+
* record this in `TurnMetrics.toolsCalled[].wasEarlyDispatched`.
|
|
427
|
+
*/
|
|
428
|
+
wasEarlyDispatched?: boolean;
|
|
429
|
+
/**
|
|
430
|
+
* [v1.4 Item 4] True when this result was synthesized from a previous
|
|
431
|
+
* identical tool call by `microcompact` deduplication, instead of
|
|
432
|
+
* actually re-running the tool.
|
|
433
|
+
*/
|
|
434
|
+
resultDeduped?: boolean;
|
|
435
|
+
/**
|
|
436
|
+
* [v1.5] True when this result was produced by the engine's
|
|
437
|
+
* post-write refresh mechanism (see `EngineConfig.postWriteRefresh`).
|
|
438
|
+
* The engine auto-runs configured read tools immediately after a
|
|
439
|
+
* successful write so the LLM narrates from fresh on-chain state
|
|
440
|
+
* instead of inferring from a stale snapshot. Hosts should render
|
|
441
|
+
* these like any other tool result; the flag is for analytics and
|
|
442
|
+
* UI affordances (e.g. a subtle "auto-refreshed" badge).
|
|
443
|
+
*/
|
|
444
|
+
wasPostWriteRefresh?: boolean;
|
|
394
445
|
} | {
|
|
395
446
|
type: 'pending_action';
|
|
396
447
|
action: PendingAction;
|
|
@@ -413,8 +464,36 @@ type EngineEvent = {
|
|
|
413
464
|
data: unknown;
|
|
414
465
|
title: string;
|
|
415
466
|
toolUseId: string;
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* [v1.4 Item 4] Emitted exactly once per agent turn when context-window
|
|
470
|
+
* compaction fires. Hosts (e.g. audric `TurnMetricsCollector`) flip a
|
|
471
|
+
* boolean for the `TurnMetrics.compactionTriggered` column. Carries no
|
|
472
|
+
* payload — `compactMessages` stays a pure function.
|
|
473
|
+
*/
|
|
474
|
+
| {
|
|
475
|
+
type: 'compaction';
|
|
416
476
|
};
|
|
417
477
|
type StopReason = 'end_turn' | 'tool_use' | 'max_tokens' | 'max_turns' | 'error';
|
|
478
|
+
/**
|
|
479
|
+
* [v1.4 Item 6] Describes a single input field on a `PendingAction` that
|
|
480
|
+
* the host UI may let the user modify before approving. Carried on the
|
|
481
|
+
* `pending_action` event so clients can render editable controls without
|
|
482
|
+
* hard-coding per-tool field metadata. See
|
|
483
|
+
* `packages/engine/src/tools/tool-modifiable-fields.ts` for the registry.
|
|
484
|
+
*/
|
|
485
|
+
interface PendingActionModifiableField {
|
|
486
|
+
/** Input key on the `PendingAction.input` object (e.g. "amount", "to"). */
|
|
487
|
+
name: string;
|
|
488
|
+
/**
|
|
489
|
+
* UI hint for which control to render.
|
|
490
|
+
* - `amount` — numeric input; UI shows a "~Max" hint when balance is known.
|
|
491
|
+
* - `address` — Sui address input with paste/scan affordance.
|
|
492
|
+
*/
|
|
493
|
+
kind: 'amount' | 'address';
|
|
494
|
+
/** Optional asset symbol (e.g. "USDC", "SUI", "vSUI") for amount fields. */
|
|
495
|
+
asset?: string;
|
|
496
|
+
}
|
|
418
497
|
/**
|
|
419
498
|
* Serializable description of a write tool that needs user approval.
|
|
420
499
|
* Stored in the session so the client can act on it in a separate request.
|
|
@@ -438,6 +517,19 @@ interface PendingAction {
|
|
|
438
517
|
_hint?: string;
|
|
439
518
|
_warning?: string;
|
|
440
519
|
}>;
|
|
520
|
+
/**
|
|
521
|
+
* [v1.4 Item 6] Fields the host UI may let the user modify before
|
|
522
|
+
* approving. Sourced from `tool-modifiable-fields.ts`. Absent (or
|
|
523
|
+
* empty) means the action is approve-or-deny only.
|
|
524
|
+
*/
|
|
525
|
+
modifiableFields?: PendingActionModifiableField[];
|
|
526
|
+
/**
|
|
527
|
+
* [v1.4 Item 6] Monotonic turn index (assistant message count) at the
|
|
528
|
+
* point this pending action was emitted. Hosts use it to update the
|
|
529
|
+
* matching `TurnMetrics` row when the action resolves — see
|
|
530
|
+
* `apps/web/app/api/engine/resume/route.ts` `updateMany` clause.
|
|
531
|
+
*/
|
|
532
|
+
turnIndex: number;
|
|
441
533
|
}
|
|
442
534
|
/**
|
|
443
535
|
* Response from the client when resolving a pending action.
|
|
@@ -468,6 +560,13 @@ interface ToolContext {
|
|
|
468
560
|
priceCache?: Map<string, number>;
|
|
469
561
|
/** Per-user permission config for USD-threshold write tool gating (B.4). */
|
|
470
562
|
permissionConfig?: UserPermissionConfig;
|
|
563
|
+
/**
|
|
564
|
+
* [v1.4] Cumulative USD already auto-executed in the current session.
|
|
565
|
+
* Used by `resolvePermissionTier` to enforce `autonomousDailyLimit` —
|
|
566
|
+
* downgrades `auto` to `confirm` when adding the incoming tool's USD
|
|
567
|
+
* value would exceed the limit. Optional; omitted = unbounded.
|
|
568
|
+
*/
|
|
569
|
+
sessionSpendUsd?: number;
|
|
471
570
|
}
|
|
472
571
|
interface ServerPositionData {
|
|
473
572
|
savings: number;
|
|
@@ -587,6 +686,66 @@ interface EngineConfig {
|
|
|
587
686
|
priceCache?: Map<string, number>;
|
|
588
687
|
/** Per-user permission config for USD-threshold write tool gating (B.4). */
|
|
589
688
|
permissionConfig?: UserPermissionConfig;
|
|
689
|
+
/**
|
|
690
|
+
* [v1.4] Cumulative USD already auto-executed in the current session.
|
|
691
|
+
* Forwarded to `ToolContext` and consulted by `resolvePermissionTier` to
|
|
692
|
+
* enforce `autonomousDailyLimit`.
|
|
693
|
+
*/
|
|
694
|
+
sessionSpendUsd?: number;
|
|
695
|
+
/**
|
|
696
|
+
* [v1.4] Fired after a write tool successfully auto-executes (no
|
|
697
|
+
* confirmation required). Hosts use this to persist cumulative spend in
|
|
698
|
+
* Redis. Errors are caught — the tool result is never blocked by a failure
|
|
699
|
+
* here.
|
|
700
|
+
*/
|
|
701
|
+
onAutoExecuted?: (info: {
|
|
702
|
+
toolName: string;
|
|
703
|
+
usdValue: number;
|
|
704
|
+
}) => void | Promise<void>;
|
|
705
|
+
/**
|
|
706
|
+
* [v1.4 Item 4] Per-guard observation hook. Forwarded to `runGuards`
|
|
707
|
+
* and fired once per non-`pass` verdict so hosts can record guard
|
|
708
|
+
* behaviour in `TurnMetrics.guardsFired` without re-implementing the
|
|
709
|
+
* verdict→action mapping. Errors thrown by the host are caught.
|
|
710
|
+
*/
|
|
711
|
+
onGuardFired?: (guard: GuardMetric) => void;
|
|
712
|
+
/**
|
|
713
|
+
* [v1.5] Map of write tool name → list of read tool names whose state
|
|
714
|
+
* the write invalidates. After a successful write resumes via
|
|
715
|
+
* `resumeWithToolResult`, the engine auto-runs each configured read
|
|
716
|
+
* tool with empty input, pushes synthetic `tool_use` + `tool_result`
|
|
717
|
+
* messages into the conversation, and yields `tool_result` events
|
|
718
|
+
* with `wasPostWriteRefresh: true` BEFORE handing control back to the
|
|
719
|
+
* LLM for narration.
|
|
720
|
+
*
|
|
721
|
+
* Why: writes change on-chain state. Without a fresh read, the LLM
|
|
722
|
+
* narrates from the pre-write snapshot and frequently invents balance
|
|
723
|
+
* totals. Auto-injecting fresh reads makes the hallucination class
|
|
724
|
+
* physically impossible — the model has authoritative ground truth in
|
|
725
|
+
* its context before generating the post-write sentence.
|
|
726
|
+
*
|
|
727
|
+
* Constraints:
|
|
728
|
+
* - Refresh tools MUST be `isReadOnly` and `isConcurrencySafe`.
|
|
729
|
+
* - Refresh runs only when the write succeeded (executionResult is
|
|
730
|
+
* not `{ success: false }`); failed writes leave state unchanged
|
|
731
|
+
* and refreshing would be misleading.
|
|
732
|
+
* - Tools are invoked with empty input; refresh tools should accept
|
|
733
|
+
* an empty object schema (e.g. `balance_check`, `savings_info`).
|
|
734
|
+
* - Errors during refresh are non-fatal — a tool_result with
|
|
735
|
+
* `isError: true` is still pushed so the LLM knows refresh failed.
|
|
736
|
+
*
|
|
737
|
+
* Example:
|
|
738
|
+
* ```
|
|
739
|
+
* {
|
|
740
|
+
* save_deposit: ['balance_check', 'savings_info'],
|
|
741
|
+
* send_transfer: ['balance_check'],
|
|
742
|
+
* borrow: ['balance_check', 'savings_info', 'health_check'],
|
|
743
|
+
* }
|
|
744
|
+
* ```
|
|
745
|
+
*
|
|
746
|
+
* Omit (undefined / empty map) to disable post-write refresh entirely.
|
|
747
|
+
*/
|
|
748
|
+
postWriteRefresh?: Record<string, string[]>;
|
|
590
749
|
}
|
|
591
750
|
interface LLMProvider {
|
|
592
751
|
chat(params: ChatParams): AsyncGenerator<ProviderEvent>;
|
|
@@ -709,6 +868,10 @@ declare class QueryEngine {
|
|
|
709
868
|
private readonly contextSummarizer;
|
|
710
869
|
private readonly priceCache;
|
|
711
870
|
private readonly permissionConfig;
|
|
871
|
+
private readonly sessionSpendUsd;
|
|
872
|
+
private readonly onAutoExecuted;
|
|
873
|
+
private readonly onGuardFired;
|
|
874
|
+
private readonly postWriteRefresh;
|
|
712
875
|
private matchedRecipe;
|
|
713
876
|
private messages;
|
|
714
877
|
private abortController;
|
|
@@ -730,6 +893,16 @@ declare class QueryEngine {
|
|
|
730
893
|
* This is a separate HTTP request — no persistent connection from submitMessage.
|
|
731
894
|
*/
|
|
732
895
|
resumeWithToolResult(action: PendingAction, response: PermissionResponse): AsyncGenerator<EngineEvent>;
|
|
896
|
+
/**
|
|
897
|
+
* [v1.5] Auto-run configured read tools after a successful write,
|
|
898
|
+
* push their results into the conversation, and yield `tool_result`
|
|
899
|
+
* events so hosts/UI render them in the timeline. See
|
|
900
|
+
* `EngineConfig.postWriteRefresh`.
|
|
901
|
+
*
|
|
902
|
+
* Pure injection — no LLM call here. The next `agentLoop` turn sees
|
|
903
|
+
* the fresh tool results and narrates from them.
|
|
904
|
+
*/
|
|
905
|
+
private runPostWriteRefresh;
|
|
733
906
|
interrupt(): void;
|
|
734
907
|
getMessages(): readonly Message[];
|
|
735
908
|
getMatchedRecipe(): Recipe | null;
|
|
@@ -801,6 +974,9 @@ type SSEEvent = {
|
|
|
801
974
|
toolUseId: string;
|
|
802
975
|
result: unknown;
|
|
803
976
|
isError: boolean;
|
|
977
|
+
wasEarlyDispatched?: boolean;
|
|
978
|
+
resultDeduped?: boolean;
|
|
979
|
+
wasPostWriteRefresh?: boolean;
|
|
804
980
|
} | {
|
|
805
981
|
type: 'pending_action';
|
|
806
982
|
action: PendingAction;
|
|
@@ -983,15 +1159,32 @@ interface ConversationStateStore {
|
|
|
983
1159
|
}
|
|
984
1160
|
declare function buildStateContext(state: ConversationState): string;
|
|
985
1161
|
|
|
1162
|
+
/**
|
|
1163
|
+
* [v1.4 Item 4] Side-channel return from `microcompact` so callers can
|
|
1164
|
+
* count or surface dedup hits without re-walking the message ledger.
|
|
1165
|
+
* Backwards-compatible: `microcompact(messages)` still returns the
|
|
1166
|
+
* processed `Message[]` (now enriched), and the dedup set lives on the
|
|
1167
|
+
* returned array via a non-enumerable `dedupedToolUseIds` accessor that
|
|
1168
|
+
* the engine reads in its agent loop.
|
|
1169
|
+
*/
|
|
1170
|
+
interface MicrocompactResult extends Array<Message> {
|
|
1171
|
+
/**
|
|
1172
|
+
* Tool-use IDs whose prior results were replaced with a compact
|
|
1173
|
+
* back-reference during this pass. Empty when nothing matched.
|
|
1174
|
+
*/
|
|
1175
|
+
dedupedToolUseIds: Set<string>;
|
|
1176
|
+
}
|
|
986
1177
|
/**
|
|
987
1178
|
* Zero-cost deduplication pass: if the same tool was called with identical
|
|
988
1179
|
* inputs earlier in the conversation and the result hasn't changed, replace
|
|
989
1180
|
* the full prior result with a compact back-reference. Runs before any
|
|
990
1181
|
* LLM-based compaction and costs nothing.
|
|
991
1182
|
*
|
|
992
|
-
* Returns a new array — does not mutate the input.
|
|
1183
|
+
* Returns a new array — does not mutate the input. The returned array
|
|
1184
|
+
* carries a `dedupedToolUseIds` property listing every tool-use ID whose
|
|
1185
|
+
* tool_result block was replaced with a back-reference this pass.
|
|
993
1186
|
*/
|
|
994
|
-
declare function microcompact(messages: readonly Message[]):
|
|
1187
|
+
declare function microcompact(messages: readonly Message[]): MicrocompactResult;
|
|
995
1188
|
|
|
996
1189
|
/**
|
|
997
1190
|
* EarlyToolDispatcher — dispatches read-only tools mid-stream.
|
|
@@ -1421,13 +1614,10 @@ declare const healthCheckTool: Tool<{}, {
|
|
|
1421
1614
|
declare const ratesInfoTool: Tool<{}, _t2000_sdk.RatesResult>;
|
|
1422
1615
|
|
|
1423
1616
|
declare const transactionHistoryTool: Tool<{
|
|
1617
|
+
action?: "send" | "swap" | "lending" | "transaction" | undefined;
|
|
1424
1618
|
date?: string | undefined;
|
|
1425
1619
|
limit?: number | undefined;
|
|
1426
|
-
},
|
|
1427
|
-
transactions: _t2000_sdk.TransactionRecord[];
|
|
1428
|
-
count: number;
|
|
1429
|
-
date: string | null;
|
|
1430
|
-
}>;
|
|
1620
|
+
}, Record<string, unknown>>;
|
|
1431
1621
|
|
|
1432
1622
|
declare const saveDepositTool: Tool<{
|
|
1433
1623
|
amount: number;
|
|
@@ -1519,21 +1709,8 @@ declare const payApiTool: Tool<{
|
|
|
1519
1709
|
|
|
1520
1710
|
declare const mppServicesTool: Tool<{
|
|
1521
1711
|
query?: string | undefined;
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
id: string;
|
|
1525
|
-
name: string;
|
|
1526
|
-
description: string;
|
|
1527
|
-
categories: string[];
|
|
1528
|
-
endpoints: {
|
|
1529
|
-
url: string;
|
|
1530
|
-
method: string;
|
|
1531
|
-
description: string;
|
|
1532
|
-
price: string;
|
|
1533
|
-
}[];
|
|
1534
|
-
}[];
|
|
1535
|
-
total: number;
|
|
1536
|
-
}>;
|
|
1712
|
+
category?: string | undefined;
|
|
1713
|
+
}, Record<string, unknown>>;
|
|
1537
1714
|
|
|
1538
1715
|
declare const swapExecuteTool: Tool<{
|
|
1539
1716
|
amount: number;
|
|
@@ -1724,15 +1901,7 @@ declare const defillamaYieldPoolsTool: Tool<{
|
|
|
1724
1901
|
chain?: string | undefined;
|
|
1725
1902
|
project?: string | undefined;
|
|
1726
1903
|
minTvl?: number | undefined;
|
|
1727
|
-
},
|
|
1728
|
-
pool: string;
|
|
1729
|
-
protocol: string;
|
|
1730
|
-
chain: string;
|
|
1731
|
-
apy: number;
|
|
1732
|
-
apyBase: number | undefined;
|
|
1733
|
-
apyReward: number | undefined;
|
|
1734
|
-
tvl: number;
|
|
1735
|
-
}[]>;
|
|
1904
|
+
}, Record<string, unknown> | unknown[]>;
|
|
1736
1905
|
declare const defillamaProtocolInfoTool: Tool<{
|
|
1737
1906
|
name: string;
|
|
1738
1907
|
}, {
|
|
@@ -1791,6 +1960,32 @@ declare const READ_TOOLS: Tool[];
|
|
|
1791
1960
|
declare const WRITE_TOOLS: Tool[];
|
|
1792
1961
|
declare function getDefaultTools(): Tool[];
|
|
1793
1962
|
|
|
1963
|
+
/**
|
|
1964
|
+
* tool-modifiable-fields.ts — Audric Harness Correctness Spec v1.4 / Item 6
|
|
1965
|
+
*
|
|
1966
|
+
* Per-tool registry of input fields the host UI may let the user modify
|
|
1967
|
+
* before approving a `PendingAction`. The engine consults this registry
|
|
1968
|
+
* when emitting a `pending_action` event so the client can render an
|
|
1969
|
+
* editable control without hard-coding tool names in the UI layer.
|
|
1970
|
+
*
|
|
1971
|
+
* The plan reserves modification for amount-bearing write tools where the
|
|
1972
|
+
* user might want to lower the amount before confirming (e.g. "save $50"
|
|
1973
|
+
* → user edits to $30 → engine resumes with the modified input). Tools
|
|
1974
|
+
* absent from this registry have no modifiable fields and the UI renders
|
|
1975
|
+
* a static "approve / deny" pair.
|
|
1976
|
+
*/
|
|
1977
|
+
|
|
1978
|
+
/**
|
|
1979
|
+
* Tool name → ordered list of modifiable input fields. Order matters for
|
|
1980
|
+
* UI rendering — the first entry typically becomes the prominent control.
|
|
1981
|
+
*/
|
|
1982
|
+
declare const TOOL_MODIFIABLE_FIELDS: Record<string, PendingActionModifiableField[]>;
|
|
1983
|
+
/**
|
|
1984
|
+
* Returns the modifiable fields for a tool name, or `undefined` if the tool
|
|
1985
|
+
* has no modifiable inputs. Used by the engine when emitting `pending_action`.
|
|
1986
|
+
*/
|
|
1987
|
+
declare function getModifiableFields(toolName: string): PendingActionModifiableField[] | undefined;
|
|
1988
|
+
|
|
1794
1989
|
declare function requireAgent(context: ToolContext): T2000;
|
|
1795
1990
|
/**
|
|
1796
1991
|
* Check if context has an MCP manager with a connected NAVI server
|
|
@@ -1834,4 +2029,4 @@ declare function clearPriceCache(): void;
|
|
|
1834
2029
|
|
|
1835
2030
|
declare const DEFAULT_SYSTEM_PROMPT = "You are Audric \u2014 a financial agent on Sui. Audric is exactly five products: Audric Passport (the trust layer \u2014 Google sign-in, non-custodial wallet, tap-to-confirm consent, sponsored gas \u2014 wraps every other product), Audric Intelligence (you \u2014 the 5-system brain: Agent Harness with 40 tools, Reasoning Engine with 9 guards and 7 skill recipes, Silent Profile, Chain Memory, AdviceLog), Audric Finance (manage money on Sui \u2014 Save via NAVI lending at 3-8% APY USDC, Credit via NAVI borrowing with health factor, Swap via Cetus aggregator across 20+ DEXs at 0.1% fee, Charts for yield/health/portfolio viz), Audric Pay (move money \u2014 send USDC, receive via payment links / invoices / QR; free, global, instant on Sui), and Audric Store (creator marketplace, ships Phase 5 \u2014 say \"coming soon\" if asked). Save, swap, borrow, repay, withdraw, charts \u2192 Audric Finance. Send, receive, payment-link, invoice, QR \u2192 Audric Pay. Your silent context (profile, memory, chain facts, advice log) shapes your replies but never surfaces as a notification \u2014 you act only when the user asks, and every write waits on their tap-to-confirm via Passport. You can also call 41 paid APIs (music, image, research, translation, weather, fulfilment) via MPP micropayments using the pay_api tool \u2014 this is an internal capability, not a promoted product, so only mention it when the user asks for something that needs it.\n\n## Response rules\n- 1-2 sentences max. No bullet lists unless asked. No preambles.\n- Never say \"Would you like me to...\", \"Sure!\", \"Great question!\", \"Absolutely!\" \u2014 just do it or say you can't.\n- Lead with the result. After tool calls, state the outcome with real numbers. Done.\n- Present amounts as $1,234.56 and rates as X.XX% APY.\n- Show top 3 results unless asked for more. Summarize totals in one line.\n\n## Execution rule\nOnly offer to execute actions you have tools for. If you retrieved a quote, data, or information but have no tool to act on it, give the user the result and tell them where to execute manually \u2014 in one sentence. Never say \"Would you like me to proceed?\" unless you have a tool that can actually proceed.\n\n## Before acting\n- ALWAYS call a read tool first before any write tool \u2014 balance_check before save/send/borrow, savings_info before withdraw.\n- Show real numbers from tools \u2014 never fabricate rates, amounts, or balances.\n- When user says \"all\" or an imprecise amount, call the read tool first to get the exact number.\n\n## Tool usage\n- Use tools proactively \u2014 don't refuse requests you can handle.\n- For real-world questions (weather, search, news, prices), use pay_api. Tell the user the cost first.\n- For broad market data (yields across protocols, token prices, TVL, protocol comparisons), use defillama_* tools.\n- To discover Sui protocols, use defillama_sui_protocols first, then defillama_protocol_info with the slug.\n- Run multiple read-only tools in parallel when you need several data points.\n- If a tool errors, say what went wrong and what to try instead. One sentence.\n\n## Savings = USDC only (critical)\n- save_deposit accepts ONLY USDC. No other token can be deposited into savings.\n- When asked \"how much can I save?\", report only the user's USDC wallet balance (saveableUsdc field from balance_check). Other tokens like GOLD, SUI, USDT are NOT saveable and NOT savings positions \u2014 they are just wallet holdings.\n- NEVER say a non-USDC token is \"in savings\" or \"earning APY in savings\" unless it appears in the savings_info positions list. Wallet holdings \u2260 savings.\n- If user wants to save non-USDC tokens, tell them to swap to USDC first. Do NOT auto-chain swap + deposit.\n\n## Multi-step flows\n- \"How much X for Y?\": swap_quote first, then swap_execute if user confirms.\n- \"Swap then save\": swap_execute \u2192 balance_check \u2192 save_deposit. Confirm each step.\n- \"Buy $X of token\": defillama_token_prices \u2192 calculate amount \u2192 swap_execute.\n- \"Best yield on SUI\": compare rates_info (NAVI lending) + defillama_yield_pools (broader) + volo_stats.\n- withdraw supports legacy positions: USDC, USDe, USDsui, SUI. Pass asset param to withdraw a specific token.\n- \"Deposit SUI to earn yield\": volo_stake for SUI liquid staking. save_deposit is USDC only.\n- \"What protocols are on Sui?\": defillama_sui_protocols \u2192 defillama_protocol_info for details.\n\n## Safety\n- Never encourage risky financial behavior.\n- Warn when health factor < 1.5.\n- All amounts in USDC unless stated otherwise.";
|
|
1836
2031
|
|
|
1837
|
-
export { AnthropicProvider, type AnthropicProviderConfig, type BalancePrices, type BalanceResult, BalanceTracker, type BuildToolOptions, CANVAS_TEMPLATES, type CanvasTemplate, type ChatParams, type CompactOptions, type ContentBlock, ContextBudget, type ContextBudgetConfig, type ConversationState, type ConversationStateStore, type CostSnapshot, CostTracker, type CostTrackerConfig, DEFAULT_GUARD_CONFIG, DEFAULT_PERMISSION_CONFIG, DEFAULT_SYSTEM_PROMPT, EarlyToolDispatcher, type EngineConfig, type EngineEvent, type GuardCheckResult, type GuardConfig, type GuardEvent, type GuardInjection, type GuardResult, type GuardRunnerState, type GuardTier, type GuardVerdict, type HealthFactorResult, type LLMProvider, type McpCallResult, McpClientManager, McpResponseCache, type McpServerConfig, type McpServerConnection, type McpToolAdapterConfig, type McpToolDescriptor, MemorySessionStore, type Message, NAVI_MCP_CONFIG, NAVI_MCP_URL, NAVI_SERVER_NAME, type NaviRawCoin, type NaviRawHealthFactor, type NaviRawPool, type NaviRawPosition, type NaviRawPositionsResponse, type NaviRawProtocolStats, type NaviRawRewardsResponse, type NaviReadOptions, NaviTools, type OutputConfig, PERMISSION_PRESETS, type PendingAction, type PendingReward, type PendingToolCall, type PermissionLevel, type PermissionOperation, type PermissionResponse, type PermissionRule, type PositionEntry, type PreflightResult, type ProtocolStats, type ProviderEvent, QueryEngine, READ_TOOLS, type RatesResult, type Recipe, type RecipePrerequisite, RecipeRegistry, type RecipeStep, type RecipeStepOnError, RetryTracker, type SSEEvent, type SavingsResult, type ServerPositionData, type SessionData, type SessionStore, type StateType, type StopReason, type SuiCoinBalance, type SystemBlock, type SystemPrompt, TOOL_FLAGS, type ThinkingConfig, type ThinkingEffort, type Tool, type ToolChoice, type ToolContext, type ToolDefinition, type ToolFlags, type ToolJsonSchema, type ToolResult, TxMutex, type UserFinancialProfile, type UserPermissionConfig, WRITE_TOOLS, type WalletCoin, activitySummaryTool, adaptAllMcpTools, adaptAllServerTools, adaptMcpTool, applyToolFlags, balanceCheckTool, borrowTool, budgetToolResult, buildCachedSystemPrompt, buildMcpTools, buildProactivenessInstructions, buildProfileContext, buildSelfEvaluationInstruction, buildStateContext, buildTool, claimRewardsTool, classifyEffort, clearPriceCache, compactMessages, createGuardRunnerState, defillamaChainTvlTool, defillamaPriceChangeTool, defillamaProtocolFeesTool, defillamaProtocolInfoTool, defillamaSuiProtocolsTool, defillamaTokenPricesTool, defillamaYieldPoolsTool, engineToSSE, estimateTokens, explainTxTool, extractConversationText, extractMcpText, fetchAvailableRewards, fetchBalance, fetchHealthFactor, fetchPositions, fetchProtocolStats, fetchRates, fetchSavings, fetchTokenPrices, fetchWalletCoins, findTool, getDefaultTools, getMcpManager, getToolFlags, getWalletAddress, guardArtifactPreview, guardStaleData, hasNaviMcp, healthCheckTool, loadRecipes, microcompact, mppServicesTool, parseMcpJson, parseRecipe, parseSSE, payApiTool, portfolioAnalysisTool, protocolDeepDiveTool, ratesInfoTool, registerEngineTools, renderCanvasTool, repayDebtTool, requireAgent, resolvePermissionTier, resolveUsdValue, runGuards, runTools, saveContactTool, saveDepositTool, savingsInfoTool, sendTransferTool, serializeSSE, spendingAnalyticsTool, swapExecuteTool, swapQuoteTool, toolNameToOperation, toolsToDefinitions, transactionHistoryTool, transformBalance, transformHealthFactor, transformPositions, transformRates, transformRewards, transformSavings, updateGuardStateAfterToolResult, validateHistory, voloStakeTool, voloStatsTool, voloUnstakeTool, webSearchTool, withdrawTool, yieldSummaryTool };
|
|
2032
|
+
export { AnthropicProvider, type AnthropicProviderConfig, type BalancePrices, type BalanceResult, BalanceTracker, type BuildToolOptions, CANVAS_TEMPLATES, type CanvasTemplate, type ChatParams, type CompactOptions, type ContentBlock, ContextBudget, type ContextBudgetConfig, type ConversationState, type ConversationStateStore, type CostSnapshot, CostTracker, type CostTrackerConfig, DEFAULT_GUARD_CONFIG, DEFAULT_PERMISSION_CONFIG, DEFAULT_SYSTEM_PROMPT, EarlyToolDispatcher, type EngineConfig, type EngineEvent, type GuardCheckResult, type GuardConfig, type GuardEvent, type GuardInjection, type GuardResult, type GuardRunnerState, type GuardTier, type GuardVerdict, type HealthFactorResult, type LLMProvider, type McpCallResult, McpClientManager, McpResponseCache, type McpServerConfig, type McpServerConnection, type McpToolAdapterConfig, type McpToolDescriptor, MemorySessionStore, type Message, NAVI_MCP_CONFIG, NAVI_MCP_URL, NAVI_SERVER_NAME, type NaviRawCoin, type NaviRawHealthFactor, type NaviRawPool, type NaviRawPosition, type NaviRawPositionsResponse, type NaviRawProtocolStats, type NaviRawRewardsResponse, type NaviReadOptions, NaviTools, type OutputConfig, PERMISSION_PRESETS, type PendingAction, type PendingActionModifiableField, type PendingReward, type PendingToolCall, type PermissionLevel, type PermissionOperation, type PermissionResponse, type PermissionRule, type PositionEntry, type PreflightResult, type ProtocolStats, type ProviderEvent, QueryEngine, READ_TOOLS, type RatesResult, type Recipe, type RecipePrerequisite, RecipeRegistry, type RecipeStep, type RecipeStepOnError, RetryTracker, type SSEEvent, type SavingsResult, type ServerPositionData, type SessionData, type SessionStore, type StateType, type StopReason, type SuiCoinBalance, type SystemBlock, type SystemPrompt, TOOL_FLAGS, TOOL_MODIFIABLE_FIELDS, type ThinkingConfig, type ThinkingEffort, type Tool, type ToolChoice, type ToolContext, type ToolDefinition, type ToolFlags, type ToolJsonSchema, type ToolResult, TxMutex, type UserFinancialProfile, type UserPermissionConfig, WRITE_TOOLS, type WalletCoin, activitySummaryTool, adaptAllMcpTools, adaptAllServerTools, adaptMcpTool, applyToolFlags, balanceCheckTool, borrowTool, budgetToolResult, buildCachedSystemPrompt, buildMcpTools, buildProactivenessInstructions, buildProfileContext, buildSelfEvaluationInstruction, buildStateContext, buildTool, claimRewardsTool, classifyEffort, clearPriceCache, compactMessages, createGuardRunnerState, defillamaChainTvlTool, defillamaPriceChangeTool, defillamaProtocolFeesTool, defillamaProtocolInfoTool, defillamaSuiProtocolsTool, defillamaTokenPricesTool, defillamaYieldPoolsTool, engineToSSE, estimateTokens, explainTxTool, extractConversationText, extractMcpText, fetchAvailableRewards, fetchBalance, fetchHealthFactor, fetchPositions, fetchProtocolStats, fetchRates, fetchSavings, fetchTokenPrices, fetchWalletCoins, findTool, getDefaultTools, getMcpManager, getModifiableFields, getToolFlags, getWalletAddress, guardArtifactPreview, guardStaleData, hasNaviMcp, healthCheckTool, loadRecipes, microcompact, mppServicesTool, parseMcpJson, parseRecipe, parseSSE, payApiTool, portfolioAnalysisTool, protocolDeepDiveTool, ratesInfoTool, registerEngineTools, renderCanvasTool, repayDebtTool, requireAgent, resolvePermissionTier, resolveUsdValue, runGuards, runTools, saveContactTool, saveDepositTool, savingsInfoTool, sendTransferTool, serializeSSE, spendingAnalyticsTool, swapExecuteTool, swapQuoteTool, toolNameToOperation, toolsToDefinitions, transactionHistoryTool, transformBalance, transformHealthFactor, transformPositions, transformRates, transformRewards, transformSavings, updateGuardStateAfterToolResult, validateHistory, voloStakeTool, voloStatsTool, voloUnstakeTool, webSearchTool, withdrawTool, yieldSummaryTool };
|