@t2000/engine 1.24.2 → 1.24.5
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 +8 -2
- package/dist/index.d.ts +15 -1
- package/dist/index.js +89 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @t2000/engine
|
|
2
2
|
|
|
3
|
-
Agent engine for conversational finance — implements **Audric Intelligence** (the moat behind the Audric consumer product). Five systems work together: Agent Harness (
|
|
3
|
+
Agent engine for conversational finance — implements **Audric Intelligence** (the moat behind the Audric consumer product). Five systems work together: Agent Harness (37 tools — 25 read, 12 write), Reasoning Engine (14 guards across 3 priority tiers + 6 YAML skill recipes), Silent Profile, Chain Memory, and AdviceLog. Every action it triggers waits on Audric Passport's tap-to-confirm.
|
|
4
4
|
|
|
5
5
|
QueryEngine orchestrates LLM conversations, financial tools, user confirmations, and MCP integrations into a single async-generator loop.
|
|
6
6
|
|
|
@@ -164,7 +164,13 @@ QueryEngine.submitMessage()
|
|
|
164
164
|
> equivalent on BlockVision). Net post-v1.4: 23 reads + 11 writes = 34 tools.
|
|
165
165
|
>
|
|
166
166
|
> **SPEC 10 SuiNS reverse-lookup (May 2026):** Added 1 read tool — `resolve_suins`.
|
|
167
|
-
> Net post-SPEC-10:
|
|
167
|
+
> Net post-SPEC-10: 24 reads + 11 writes = 35 tools.
|
|
168
|
+
>
|
|
169
|
+
> **S.119 NAVI rewards (May 2026):** Added 1 read tool — `pending_rewards` (preview claimable
|
|
170
|
+
> rewards without triggering a claim) — and 1 write tool — `harvest_rewards` (compound: claim
|
|
171
|
+
> NAVI rewards → swap each non-USDC reward to USDC → deposit merged USDC into NAVI savings,
|
|
172
|
+
> single PTB). Per-leg fees (10 bps Cetus overlay × N + 10 bps NAVI save fee) wired in S.120.
|
|
173
|
+
> Net post-S.119: **25 reads + 12 writes = 37 tools** (current).
|
|
168
174
|
|
|
169
175
|
## Recent Upgrades — Spec 1 (Correctness) + Spec 2 (Intelligence)
|
|
170
176
|
|
package/dist/index.d.ts
CHANGED
|
@@ -503,6 +503,7 @@ declare class SwapQuoteTracker {
|
|
|
503
503
|
amount: number;
|
|
504
504
|
}): boolean;
|
|
505
505
|
}
|
|
506
|
+
declare function extractTrustedAddressesFromResult(toolName: string, input: unknown, result: unknown, recentUserText: string, state: GuardRunnerState): void;
|
|
506
507
|
declare function guardArtifactPreview(result: unknown): GuardInjection | null;
|
|
507
508
|
declare function guardStaleData(toolFlags: ToolFlags): GuardInjection | null;
|
|
508
509
|
interface GuardRunnerState {
|
|
@@ -510,6 +511,19 @@ interface GuardRunnerState {
|
|
|
510
511
|
retryTracker: RetryTracker;
|
|
511
512
|
swapQuoteTracker: SwapQuoteTracker;
|
|
512
513
|
lastHealthFactor: number | null;
|
|
514
|
+
/**
|
|
515
|
+
* [S.121 Option C] Per-session set of normalized 0x addresses that
|
|
516
|
+
* identity-resolving read tools (`lookup_user`, `resolve_suins`)
|
|
517
|
+
* resolved from a user-typed identifier. Acts as the 4th trusted
|
|
518
|
+
* source for `guardAddressSource` so the LLM can pass the resolved
|
|
519
|
+
* 0x address to `send_transfer` without the guard demanding the user
|
|
520
|
+
* paste the raw address themselves.
|
|
521
|
+
*
|
|
522
|
+
* Persisted across turns within a session. Reset per-session by
|
|
523
|
+
* `createGuardRunnerState()`. Safety invariant: see
|
|
524
|
+
* `extractTrustedAddressesFromResult`.
|
|
525
|
+
*/
|
|
526
|
+
trustedAddresses: Set<string>;
|
|
513
527
|
}
|
|
514
528
|
declare function createGuardRunnerState(): GuardRunnerState;
|
|
515
529
|
declare function runGuards(tool: Tool, call: PendingToolCall, state: GuardRunnerState, config: GuardConfig, conversationContext: {
|
|
@@ -4289,4 +4303,4 @@ declare function getTelemetrySink(): TelemetrySink;
|
|
|
4289
4303
|
/** Restore the default noop sink. Used by test teardowns. */
|
|
4290
4304
|
declare function resetTelemetrySink(): void;
|
|
4291
4305
|
|
|
4292
|
-
export { type AddressPortfolio, AnthropicProvider, type AnthropicProviderConfig, type AudricHistoryRecord, type AudricPortfolioResult, type AwaitOrFetchOpts, type BalancePrices, type BalanceResult, BalanceTracker, type BuildToolOptions, type BundleCompositionInput, 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_LEASE_SEC, DEFAULT_PERMISSION_CONFIG, DEFAULT_POLL_BUDGET_MS, DEFAULT_POLL_INTERVAL_MS, DEFAULT_SYSTEM_PROMPT, DEFAULT_TOOL_TTL_MS, type DefiCacheEntry, type DefiCacheStore, type DefiProtocol, type DefiSummary, EFFORT_THINKING_BUDGET_CAPS, EarlyToolDispatcher, type EngineConfig, type EngineEvent, type EvalSummaryParseResult, type EvaluationItem, type EvaluationStatus, type FetchLock, type FormField, type FormFieldKind, type FormSchema, type GuardCheckResult, type GuardConfig, type GuardEvent, type GuardInjection, type GuardResult, type GuardRunnerState, type GuardTier, type GuardVerdict, type HarnessShape, type HealthFactorResult, InMemoryDefiCacheStore, InMemoryFetchLock, InMemoryNaviCacheStore, InMemoryWalletCacheStore, InvalidAddressError, type LLMProvider, MAX_BUNDLE_OPS, type McpCallResult, McpClientManager, McpResponseCache, type McpServerConfig, type McpServerConnection, type McpToolAdapterConfig, type McpToolDescriptor, MemorySessionStore, type Message, NAVI_ADDR_TTL_SEC, NAVI_MCP_CONFIG, NAVI_MCP_URL, NAVI_RATES_TTL_SEC, NAVI_SERVER_NAME, type NaviCacheEntry, type NaviCacheStore, type NaviRawCoin, type NaviRawHealthFactor, type NaviRawPool, type NaviRawPosition, type NaviRawPositionsResponse, type NaviRawProtocolStats, type NaviRawRewardsResponse, type NaviReadOptions, NaviTools, type NormalizedAddress, type OutputConfig, PERMISSION_PRESETS, type PendingAction, type PendingActionModifiableField, type PendingActionStep, type PendingInput, type PendingInputState, type PendingReward, type PendingToolCall, type PermissionLevel, type PermissionOperation, type PermissionResponse, type PermissionRule, type PortfolioCoin, type PositionEntry, type PreflightResult, type ProactiveMarker, type ProactiveType, type ProtocolStats, type ProviderEvent, QueryEngine, READ_TOOLS, REGENERATABLE_READ_TOOLS, type RatesResult, type Recipe, type RecipePrerequisite, RecipeRegistry, type RecipeStep, type RecipeStepOnError, type RegenerateFailure, type RegenerateResult, type RegenerateSuccess, type RegenerateTimelineEvent, RetryTracker, type SSEEvent, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, type SavingsResult, type ServerPositionData, type SessionData, type SessionStore, type StateType, type StopReason, type SuiCoinBalance, SuinsNotRegisteredError, SuinsRpcError, type SystemBlock, type SystemPrompt, TOOL_FLAGS, TOOL_MODIFIABLE_FIELDS, TOOL_TTL_MS, type TelemetrySink, type TelemetryTags, type ThinkingConfig, type ThinkingEffort, type TodoItem$1 as TodoItem, type Tool, type ToolChoice, type ToolContext, type ToolDefinition, type ToolFlags, type ToolJsonSchema, type ToolResult, TxMutex, type UpdateTodoInput, type TodoItem as UpdateTodoItem, type UserFinancialProfile, type UserPermissionConfig, VALID_PAIRS, WRITE_TOOLS, type WalletCacheEntry, type WalletCacheStore, type WalletCoin, _resetNaviCircuitBreaker, activitySummaryTool, adaptAllMcpTools, adaptAllServerTools, adaptMcpTool, addRecipientTool, applyToolFlags, awaitOrFetch, balanceCheckTool, borrowTool, budgetToolResult, buildCachedSystemPrompt, buildMcpTools, buildProactivenessInstructions, buildProfileContext, buildSelfEvaluationInstruction, buildStateContext, buildTool, bundleShortestTtl, checkValidPair, claimRewardsTool, clampThinkingForEffort, classifyEffort, clearPortfolioCache, clearPortfolioCacheFor, clearPriceMapCache, compactMessages, composeBundleFromToolResults, computeRegenerateFields, createGuardRunnerState, engineToSSE, estimateTokens, explainTxTool, extractAllProactiveMarkers, extractConversationText, extractMcpText, fetchAddressDefiPortfolio, fetchAddressPortfolio, fetchAudricHistory, fetchAudricPortfolio, fetchAvailableRewards, fetchBalance, fetchHealthFactor, fetchPositions, fetchProtocolStats, fetchRates, fetchSavings, fetchTokenPrices, fetchWalletCoins, findTool, getAudricApiBase, getDefaultTools, getDefiCacheStore, getFetchLock, getMcpManager, getModifiableFields, getNaviCacheStore, getTelemetrySink, getToolFlags, getWalletAddress, getWalletCacheStore, guardArtifactPreview, guardStaleData, harnessShapeForEffort, hasNaviMcp, healthCheckTool, isBundleableTool, loadRecipes, looksLikeSuiNs, microcompact, mppServicesTool, naviKey, normalizeAddressInput, parseEvalSummary, parseMcpJson, parseProactiveMarker, parseRecipe, parseSSE, payApiTool, portfolioAnalysisTool, protocolDeepDiveTool, ratesInfoTool, regenerateBundle, registerEngineTools, renderCanvasTool, repayDebtTool, requireAgent, resetDefiCacheStore, resetFetchLock, resetNaviCacheStore, resetTelemetrySink, resetWalletCacheStore, resolveAddressToSuinsViaRpc, resolvePermissionTier, resolveSuinsTool, resolveSuinsViaRpc, resolveUsdValue, runGuards, runTools, saveContactTool, saveDepositTool, savingsInfoTool, sendTransferTool, serializeSSE, setDefiCacheStore, setFetchLock, setNaviCacheStore, setTelemetrySink, setWalletCacheStore, spendingAnalyticsTool, stripProactiveMarkers, swapExecuteTool, swapQuoteTool, tokenPricesTool, toolNameToOperation, toolsToDefinitions, transactionHistoryTool, transformBalance, transformHealthFactor, transformPositions, transformRates, transformRewards, transformSavings, updateGuardStateAfterToolResult, updateTodoTool, validateHistory, voloStakeTool, voloStatsTool, voloUnstakeTool, webSearchTool, withdrawTool, yieldSummaryTool };
|
|
4306
|
+
export { type AddressPortfolio, AnthropicProvider, type AnthropicProviderConfig, type AudricHistoryRecord, type AudricPortfolioResult, type AwaitOrFetchOpts, type BalancePrices, type BalanceResult, BalanceTracker, type BuildToolOptions, type BundleCompositionInput, 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_LEASE_SEC, DEFAULT_PERMISSION_CONFIG, DEFAULT_POLL_BUDGET_MS, DEFAULT_POLL_INTERVAL_MS, DEFAULT_SYSTEM_PROMPT, DEFAULT_TOOL_TTL_MS, type DefiCacheEntry, type DefiCacheStore, type DefiProtocol, type DefiSummary, EFFORT_THINKING_BUDGET_CAPS, EarlyToolDispatcher, type EngineConfig, type EngineEvent, type EvalSummaryParseResult, type EvaluationItem, type EvaluationStatus, type FetchLock, type FormField, type FormFieldKind, type FormSchema, type GuardCheckResult, type GuardConfig, type GuardEvent, type GuardInjection, type GuardResult, type GuardRunnerState, type GuardTier, type GuardVerdict, type HarnessShape, type HealthFactorResult, InMemoryDefiCacheStore, InMemoryFetchLock, InMemoryNaviCacheStore, InMemoryWalletCacheStore, InvalidAddressError, type LLMProvider, MAX_BUNDLE_OPS, type McpCallResult, McpClientManager, McpResponseCache, type McpServerConfig, type McpServerConnection, type McpToolAdapterConfig, type McpToolDescriptor, MemorySessionStore, type Message, NAVI_ADDR_TTL_SEC, NAVI_MCP_CONFIG, NAVI_MCP_URL, NAVI_RATES_TTL_SEC, NAVI_SERVER_NAME, type NaviCacheEntry, type NaviCacheStore, type NaviRawCoin, type NaviRawHealthFactor, type NaviRawPool, type NaviRawPosition, type NaviRawPositionsResponse, type NaviRawProtocolStats, type NaviRawRewardsResponse, type NaviReadOptions, NaviTools, type NormalizedAddress, type OutputConfig, PERMISSION_PRESETS, type PendingAction, type PendingActionModifiableField, type PendingActionStep, type PendingInput, type PendingInputState, type PendingReward, type PendingToolCall, type PermissionLevel, type PermissionOperation, type PermissionResponse, type PermissionRule, type PortfolioCoin, type PositionEntry, type PreflightResult, type ProactiveMarker, type ProactiveType, type ProtocolStats, type ProviderEvent, QueryEngine, READ_TOOLS, REGENERATABLE_READ_TOOLS, type RatesResult, type Recipe, type RecipePrerequisite, RecipeRegistry, type RecipeStep, type RecipeStepOnError, type RegenerateFailure, type RegenerateResult, type RegenerateSuccess, type RegenerateTimelineEvent, RetryTracker, type SSEEvent, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, type SavingsResult, type ServerPositionData, type SessionData, type SessionStore, type StateType, type StopReason, type SuiCoinBalance, SuinsNotRegisteredError, SuinsRpcError, type SystemBlock, type SystemPrompt, TOOL_FLAGS, TOOL_MODIFIABLE_FIELDS, TOOL_TTL_MS, type TelemetrySink, type TelemetryTags, type ThinkingConfig, type ThinkingEffort, type TodoItem$1 as TodoItem, type Tool, type ToolChoice, type ToolContext, type ToolDefinition, type ToolFlags, type ToolJsonSchema, type ToolResult, TxMutex, type UpdateTodoInput, type TodoItem as UpdateTodoItem, type UserFinancialProfile, type UserPermissionConfig, VALID_PAIRS, WRITE_TOOLS, type WalletCacheEntry, type WalletCacheStore, type WalletCoin, _resetNaviCircuitBreaker, activitySummaryTool, adaptAllMcpTools, adaptAllServerTools, adaptMcpTool, addRecipientTool, applyToolFlags, awaitOrFetch, balanceCheckTool, borrowTool, budgetToolResult, buildCachedSystemPrompt, buildMcpTools, buildProactivenessInstructions, buildProfileContext, buildSelfEvaluationInstruction, buildStateContext, buildTool, bundleShortestTtl, checkValidPair, claimRewardsTool, clampThinkingForEffort, classifyEffort, clearPortfolioCache, clearPortfolioCacheFor, clearPriceMapCache, compactMessages, composeBundleFromToolResults, computeRegenerateFields, createGuardRunnerState, engineToSSE, estimateTokens, explainTxTool, extractAllProactiveMarkers, extractConversationText, extractMcpText, extractTrustedAddressesFromResult, fetchAddressDefiPortfolio, fetchAddressPortfolio, fetchAudricHistory, fetchAudricPortfolio, fetchAvailableRewards, fetchBalance, fetchHealthFactor, fetchPositions, fetchProtocolStats, fetchRates, fetchSavings, fetchTokenPrices, fetchWalletCoins, findTool, getAudricApiBase, getDefaultTools, getDefiCacheStore, getFetchLock, getMcpManager, getModifiableFields, getNaviCacheStore, getTelemetrySink, getToolFlags, getWalletAddress, getWalletCacheStore, guardArtifactPreview, guardStaleData, harnessShapeForEffort, hasNaviMcp, healthCheckTool, isBundleableTool, loadRecipes, looksLikeSuiNs, microcompact, mppServicesTool, naviKey, normalizeAddressInput, parseEvalSummary, parseMcpJson, parseProactiveMarker, parseRecipe, parseSSE, payApiTool, portfolioAnalysisTool, protocolDeepDiveTool, ratesInfoTool, regenerateBundle, registerEngineTools, renderCanvasTool, repayDebtTool, requireAgent, resetDefiCacheStore, resetFetchLock, resetNaviCacheStore, resetTelemetrySink, resetWalletCacheStore, resolveAddressToSuinsViaRpc, resolvePermissionTier, resolveSuinsTool, resolveSuinsViaRpc, resolveUsdValue, runGuards, runTools, saveContactTool, saveDepositTool, savingsInfoTool, sendTransferTool, serializeSSE, setDefiCacheStore, setFetchLock, setNaviCacheStore, setTelemetrySink, setWalletCacheStore, spendingAnalyticsTool, stripProactiveMarkers, swapExecuteTool, swapQuoteTool, tokenPricesTool, toolNameToOperation, toolsToDefinitions, transactionHistoryTool, transformBalance, transformHealthFactor, transformPositions, transformRates, transformRewards, transformSavings, updateGuardStateAfterToolResult, updateTodoTool, validateHistory, voloStakeTool, voloStatsTool, voloUnstakeTool, webSearchTool, withdrawTool, yieldSummaryTool };
|
package/dist/index.js
CHANGED
|
@@ -6227,7 +6227,7 @@ function guardSwapPreview(tool, call, swapQuoteTracker) {
|
|
|
6227
6227
|
message: `swap_execute requires a recent matching swap_quote so the user sees an accurate preview. Call swap_quote({ from: "${from}", to: "${to}", amount: ${amount} }) first, then re-issue swap_execute with the same params. swap_quote is read-only and returns the real on-chain output, route, and price impact \u2014 never estimate from memory.`
|
|
6228
6228
|
};
|
|
6229
6229
|
}
|
|
6230
|
-
function guardAddressSource(tool, call, userText, contacts, walletAddress) {
|
|
6230
|
+
function guardAddressSource(tool, call, userText, contacts, walletAddress, trustedAddresses) {
|
|
6231
6231
|
if (tool.name !== "send_transfer") {
|
|
6232
6232
|
return { verdict: "pass", gate: "address_source", tier: "safety" };
|
|
6233
6233
|
}
|
|
@@ -6251,13 +6251,75 @@ function guardAddressSource(tool, call, userText, contacts, walletAddress) {
|
|
|
6251
6251
|
if (userText.toLowerCase().includes(normalizedTo)) {
|
|
6252
6252
|
return { verdict: "pass", gate: "address_source", tier: "safety" };
|
|
6253
6253
|
}
|
|
6254
|
+
if (trustedAddresses.has(normalizedTo)) {
|
|
6255
|
+
return { verdict: "pass", gate: "address_source", tier: "safety" };
|
|
6256
|
+
}
|
|
6254
6257
|
return {
|
|
6255
6258
|
verdict: "block",
|
|
6256
6259
|
gate: "address_source",
|
|
6257
6260
|
tier: "safety",
|
|
6258
|
-
message: `Safety check failed: the recipient address "${rawTo}" was not provided by the user (no saved contact matches, address is not the user's own wallet,
|
|
6261
|
+
message: `Safety check failed: the recipient address "${rawTo}" was not provided by the user (no saved contact matches, address is not the user's own wallet, address does not appear verbatim in the user's recent messages, and no identity-resolving tool call this session linked it to a user-named handle). For safety, addresses must be supplied directly by the user \u2014 never reconstructed from memory or partial recall. Ask the user to paste the destination address again exactly, or call lookup_user / resolve_suins with the user-typed handle.`
|
|
6259
6262
|
};
|
|
6260
6263
|
}
|
|
6264
|
+
var IDENTITY_RESOLVING_TOOLS = /* @__PURE__ */ new Set([
|
|
6265
|
+
"lookup_user",
|
|
6266
|
+
"resolve_suins"
|
|
6267
|
+
]);
|
|
6268
|
+
function collectAddressesFromResult(value, out) {
|
|
6269
|
+
if (value === null || value === void 0) return;
|
|
6270
|
+
if (typeof value === "string") {
|
|
6271
|
+
if (SUI_ADDRESS_REGEX2.test(value)) {
|
|
6272
|
+
out.add(normalizeAddress(value));
|
|
6273
|
+
}
|
|
6274
|
+
return;
|
|
6275
|
+
}
|
|
6276
|
+
if (Array.isArray(value)) {
|
|
6277
|
+
for (const item of value) collectAddressesFromResult(item, out);
|
|
6278
|
+
return;
|
|
6279
|
+
}
|
|
6280
|
+
if (typeof value === "object") {
|
|
6281
|
+
for (const v of Object.values(value)) {
|
|
6282
|
+
collectAddressesFromResult(v, out);
|
|
6283
|
+
}
|
|
6284
|
+
}
|
|
6285
|
+
}
|
|
6286
|
+
function collectInputStringValues(value, out) {
|
|
6287
|
+
if (value === null || value === void 0) return;
|
|
6288
|
+
if (typeof value === "string") {
|
|
6289
|
+
const trimmed = value.trim();
|
|
6290
|
+
if (trimmed.length > 0) out.push(trimmed);
|
|
6291
|
+
return;
|
|
6292
|
+
}
|
|
6293
|
+
if (Array.isArray(value)) {
|
|
6294
|
+
for (const item of value) collectInputStringValues(item, out);
|
|
6295
|
+
return;
|
|
6296
|
+
}
|
|
6297
|
+
if (typeof value === "object") {
|
|
6298
|
+
for (const v of Object.values(value)) {
|
|
6299
|
+
collectInputStringValues(v, out);
|
|
6300
|
+
}
|
|
6301
|
+
}
|
|
6302
|
+
}
|
|
6303
|
+
function extractTrustedAddressesFromResult(toolName, input, result, recentUserText, state) {
|
|
6304
|
+
if (!IDENTITY_RESOLVING_TOOLS.has(toolName)) return;
|
|
6305
|
+
if (input === null || input === void 0) return;
|
|
6306
|
+
if (result === null || result === void 0) return;
|
|
6307
|
+
const inputStrings = [];
|
|
6308
|
+
collectInputStringValues(input, inputStrings);
|
|
6309
|
+
if (inputStrings.length === 0) return;
|
|
6310
|
+
const normalizedUserText = recentUserText.toLowerCase();
|
|
6311
|
+
const inputMatchesUser = inputStrings.some((s) => {
|
|
6312
|
+
const norm = s.toLowerCase();
|
|
6313
|
+
if (SUI_ADDRESS_REGEX2.test(s)) return false;
|
|
6314
|
+
return normalizedUserText.includes(norm);
|
|
6315
|
+
});
|
|
6316
|
+
if (!inputMatchesUser) return;
|
|
6317
|
+
const found = /* @__PURE__ */ new Set();
|
|
6318
|
+
collectAddressesFromResult(result, found);
|
|
6319
|
+
for (const addr of found) {
|
|
6320
|
+
state.trustedAddresses.add(addr);
|
|
6321
|
+
}
|
|
6322
|
+
}
|
|
6261
6323
|
var READ_TOOLS_WITH_ADDRESS_PARAM = /* @__PURE__ */ new Set([
|
|
6262
6324
|
"balance_check",
|
|
6263
6325
|
"portfolio_analysis",
|
|
@@ -6325,7 +6387,8 @@ function createGuardRunnerState() {
|
|
|
6325
6387
|
balanceTracker: new BalanceTracker(),
|
|
6326
6388
|
retryTracker: new RetryTracker(),
|
|
6327
6389
|
swapQuoteTracker: new SwapQuoteTracker(),
|
|
6328
|
-
lastHealthFactor: null
|
|
6390
|
+
lastHealthFactor: null,
|
|
6391
|
+
trustedAddresses: /* @__PURE__ */ new Set()
|
|
6329
6392
|
};
|
|
6330
6393
|
}
|
|
6331
6394
|
function runGuards(tool, call, state, config, conversationContext, onGuardFired, identity) {
|
|
@@ -6399,7 +6462,8 @@ function runGuards(tool, call, state, config, conversationContext, onGuardFired,
|
|
|
6399
6462
|
call,
|
|
6400
6463
|
conversationContext.recentUserText,
|
|
6401
6464
|
identity?.contacts ?? [],
|
|
6402
|
-
identity?.walletAddress
|
|
6465
|
+
identity?.walletAddress,
|
|
6466
|
+
state.trustedAddresses
|
|
6403
6467
|
)
|
|
6404
6468
|
);
|
|
6405
6469
|
}
|
|
@@ -8094,6 +8158,7 @@ ${recipeCtx}`;
|
|
|
8094
8158
|
if (signal.aborted) {
|
|
8095
8159
|
dispatcher.abort();
|
|
8096
8160
|
}
|
|
8161
|
+
const earlyConvCtx = extractConversationText(this.messages);
|
|
8097
8162
|
for await (const earlyEvent of dispatcher.collectResults()) {
|
|
8098
8163
|
if (earlyEvent.type === "tool_result") {
|
|
8099
8164
|
if (!earlyEvent.isError) {
|
|
@@ -8123,6 +8188,15 @@ ${recipeCtx}`;
|
|
|
8123
8188
|
earlyEvent.isError,
|
|
8124
8189
|
this.guardState
|
|
8125
8190
|
);
|
|
8191
|
+
if (!earlyEvent.isError) {
|
|
8192
|
+
extractTrustedAddressesFromResult(
|
|
8193
|
+
earlyEvent.toolName,
|
|
8194
|
+
earlyInput,
|
|
8195
|
+
earlyEvent.result,
|
|
8196
|
+
earlyConvCtx.recentUserText,
|
|
8197
|
+
this.guardState
|
|
8198
|
+
);
|
|
8199
|
+
}
|
|
8126
8200
|
let enrichedResult = earlyEvent.result;
|
|
8127
8201
|
if (this.guardConfig && !earlyEvent.isError && tool) {
|
|
8128
8202
|
const artifactInj = this.guardConfig.artifactPreview !== false ? guardArtifactPreview(earlyEvent.result) : null;
|
|
@@ -8330,6 +8404,7 @@ ${recipeCtx}`;
|
|
|
8330
8404
|
} else {
|
|
8331
8405
|
guardedApproved.push(...approved);
|
|
8332
8406
|
}
|
|
8407
|
+
const runConvCtx = extractConversationText(this.messages);
|
|
8333
8408
|
for await (const toolEvent of runTools(guardedApproved, this.tools, context, this.txMutex)) {
|
|
8334
8409
|
if (toolEvent.type === "tool_result" && !toolEvent.isError) {
|
|
8335
8410
|
const warning = flagSuspiciousResult(toolEvent.toolName, toolEvent.result);
|
|
@@ -8359,6 +8434,15 @@ ${recipeCtx}`;
|
|
|
8359
8434
|
toolEvent.isError,
|
|
8360
8435
|
this.guardState
|
|
8361
8436
|
);
|
|
8437
|
+
if (!toolEvent.isError) {
|
|
8438
|
+
extractTrustedAddressesFromResult(
|
|
8439
|
+
toolEvent.toolName,
|
|
8440
|
+
originalCall?.input ?? null,
|
|
8441
|
+
toolEvent.result,
|
|
8442
|
+
runConvCtx.recentUserText,
|
|
8443
|
+
this.guardState
|
|
8444
|
+
);
|
|
8445
|
+
}
|
|
8362
8446
|
let enrichedResult = toolEvent.result;
|
|
8363
8447
|
if (this.guardConfig && !toolEvent.isError && tool) {
|
|
8364
8448
|
const artifactInj = this.guardConfig.artifactPreview !== false ? guardArtifactPreview(toolEvent.result) : null;
|
|
@@ -10150,6 +10234,6 @@ function sanitizeAnthropicMessages(messages) {
|
|
|
10150
10234
|
return merged;
|
|
10151
10235
|
}
|
|
10152
10236
|
|
|
10153
|
-
export { AnthropicProvider, BalanceTracker, CANVAS_TEMPLATES, ContextBudget, CostTracker, DEFAULT_GUARD_CONFIG, DEFAULT_LEASE_SEC, DEFAULT_PERMISSION_CONFIG, DEFAULT_POLL_BUDGET_MS, DEFAULT_POLL_INTERVAL_MS, DEFAULT_SYSTEM_PROMPT, DEFAULT_TOOL_TTL_MS, EFFORT_THINKING_BUDGET_CAPS, EarlyToolDispatcher, InMemoryDefiCacheStore, InMemoryFetchLock, InMemoryNaviCacheStore, InMemoryWalletCacheStore, InvalidAddressError, MAX_BUNDLE_OPS, McpClientManager, McpResponseCache, MemorySessionStore, NAVI_ADDR_TTL_SEC, NAVI_MCP_CONFIG, NAVI_MCP_URL, NAVI_RATES_TTL_SEC, NAVI_SERVER_NAME, NaviTools, PERMISSION_PRESETS, QueryEngine, READ_TOOLS, REGENERATABLE_READ_TOOLS, RecipeRegistry, RetryTracker, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SuinsNotRegisteredError, SuinsRpcError, TOOL_FLAGS, TOOL_MODIFIABLE_FIELDS, TOOL_TTL_MS, TxMutex, VALID_PAIRS, WRITE_TOOLS, _resetNaviCircuitBreaker, activitySummaryTool, adaptAllMcpTools, adaptAllServerTools, adaptMcpTool, addRecipientTool, applyToolFlags, awaitOrFetch, balanceCheckTool, borrowTool, budgetToolResult, buildCachedSystemPrompt, buildMcpTools, buildProactivenessInstructions, buildProfileContext, buildSelfEvaluationInstruction, buildStateContext, buildTool, bundleShortestTtl, checkValidPair, claimRewardsTool, clampThinkingForEffort, classifyEffort, clearPortfolioCache, clearPortfolioCacheFor, clearPriceMapCache, compactMessages, composeBundleFromToolResults, computeRegenerateFields, createGuardRunnerState, engineToSSE, estimateTokens, explainTxTool, extractAllProactiveMarkers, extractConversationText, extractMcpText, fetchAddressDefiPortfolio, fetchAddressPortfolio, fetchAudricHistory, fetchAudricPortfolio, fetchAvailableRewards, fetchBalance, fetchHealthFactor, fetchPositions, fetchProtocolStats, fetchRates, fetchSavings, fetchTokenPrices, fetchWalletCoins, findTool, getAudricApiBase, getDefaultTools, getDefiCacheStore, getFetchLock, getMcpManager, getModifiableFields, getNaviCacheStore, getTelemetrySink, getToolFlags, getWalletAddress, getWalletCacheStore, guardArtifactPreview, guardStaleData, harnessShapeForEffort, hasNaviMcp, healthCheckTool, isBundleableTool, loadRecipes, looksLikeSuiNs, microcompact, mppServicesTool, naviKey, normalizeAddressInput, parseEvalSummary, parseMcpJson, parseProactiveMarker, parseRecipe, parseSSE, payApiTool, portfolioAnalysisTool, protocolDeepDiveTool, ratesInfoTool, regenerateBundle, registerEngineTools, renderCanvasTool, repayDebtTool, requireAgent, resetDefiCacheStore, resetFetchLock, resetNaviCacheStore, resetTelemetrySink, resetWalletCacheStore, resolveAddressToSuinsViaRpc, resolvePermissionTier, resolveSuinsTool, resolveSuinsViaRpc, resolveUsdValue, runGuards, runTools, saveContactTool, saveDepositTool, savingsInfoTool, sendTransferTool, serializeSSE, setDefiCacheStore, setFetchLock, setNaviCacheStore, setTelemetrySink, setWalletCacheStore, spendingAnalyticsTool, stripProactiveMarkers, swapExecuteTool, swapQuoteTool, tokenPricesTool, toolNameToOperation, toolsToDefinitions, transactionHistoryTool, transformBalance, transformHealthFactor, transformPositions, transformRates, transformRewards, transformSavings, updateGuardStateAfterToolResult, updateTodoTool, validateHistory, voloStakeTool, voloStatsTool, voloUnstakeTool, webSearchTool, withdrawTool, yieldSummaryTool };
|
|
10237
|
+
export { AnthropicProvider, BalanceTracker, CANVAS_TEMPLATES, ContextBudget, CostTracker, DEFAULT_GUARD_CONFIG, DEFAULT_LEASE_SEC, DEFAULT_PERMISSION_CONFIG, DEFAULT_POLL_BUDGET_MS, DEFAULT_POLL_INTERVAL_MS, DEFAULT_SYSTEM_PROMPT, DEFAULT_TOOL_TTL_MS, EFFORT_THINKING_BUDGET_CAPS, EarlyToolDispatcher, InMemoryDefiCacheStore, InMemoryFetchLock, InMemoryNaviCacheStore, InMemoryWalletCacheStore, InvalidAddressError, MAX_BUNDLE_OPS, McpClientManager, McpResponseCache, MemorySessionStore, NAVI_ADDR_TTL_SEC, NAVI_MCP_CONFIG, NAVI_MCP_URL, NAVI_RATES_TTL_SEC, NAVI_SERVER_NAME, NaviTools, PERMISSION_PRESETS, QueryEngine, READ_TOOLS, REGENERATABLE_READ_TOOLS, RecipeRegistry, RetryTracker, SUINS_NAME_REGEX, SUI_ADDRESS_REGEX, SUI_ADDRESS_STRICT_REGEX, SuinsNotRegisteredError, SuinsRpcError, TOOL_FLAGS, TOOL_MODIFIABLE_FIELDS, TOOL_TTL_MS, TxMutex, VALID_PAIRS, WRITE_TOOLS, _resetNaviCircuitBreaker, activitySummaryTool, adaptAllMcpTools, adaptAllServerTools, adaptMcpTool, addRecipientTool, applyToolFlags, awaitOrFetch, balanceCheckTool, borrowTool, budgetToolResult, buildCachedSystemPrompt, buildMcpTools, buildProactivenessInstructions, buildProfileContext, buildSelfEvaluationInstruction, buildStateContext, buildTool, bundleShortestTtl, checkValidPair, claimRewardsTool, clampThinkingForEffort, classifyEffort, clearPortfolioCache, clearPortfolioCacheFor, clearPriceMapCache, compactMessages, composeBundleFromToolResults, computeRegenerateFields, createGuardRunnerState, engineToSSE, estimateTokens, explainTxTool, extractAllProactiveMarkers, extractConversationText, extractMcpText, extractTrustedAddressesFromResult, fetchAddressDefiPortfolio, fetchAddressPortfolio, fetchAudricHistory, fetchAudricPortfolio, fetchAvailableRewards, fetchBalance, fetchHealthFactor, fetchPositions, fetchProtocolStats, fetchRates, fetchSavings, fetchTokenPrices, fetchWalletCoins, findTool, getAudricApiBase, getDefaultTools, getDefiCacheStore, getFetchLock, getMcpManager, getModifiableFields, getNaviCacheStore, getTelemetrySink, getToolFlags, getWalletAddress, getWalletCacheStore, guardArtifactPreview, guardStaleData, harnessShapeForEffort, hasNaviMcp, healthCheckTool, isBundleableTool, loadRecipes, looksLikeSuiNs, microcompact, mppServicesTool, naviKey, normalizeAddressInput, parseEvalSummary, parseMcpJson, parseProactiveMarker, parseRecipe, parseSSE, payApiTool, portfolioAnalysisTool, protocolDeepDiveTool, ratesInfoTool, regenerateBundle, registerEngineTools, renderCanvasTool, repayDebtTool, requireAgent, resetDefiCacheStore, resetFetchLock, resetNaviCacheStore, resetTelemetrySink, resetWalletCacheStore, resolveAddressToSuinsViaRpc, resolvePermissionTier, resolveSuinsTool, resolveSuinsViaRpc, resolveUsdValue, runGuards, runTools, saveContactTool, saveDepositTool, savingsInfoTool, sendTransferTool, serializeSSE, setDefiCacheStore, setFetchLock, setNaviCacheStore, setTelemetrySink, setWalletCacheStore, spendingAnalyticsTool, stripProactiveMarkers, swapExecuteTool, swapQuoteTool, tokenPricesTool, toolNameToOperation, toolsToDefinitions, transactionHistoryTool, transformBalance, transformHealthFactor, transformPositions, transformRates, transformRewards, transformSavings, updateGuardStateAfterToolResult, updateTodoTool, validateHistory, voloStakeTool, voloStatsTool, voloUnstakeTool, webSearchTool, withdrawTool, yieldSummaryTool };
|
|
10154
10238
|
//# sourceMappingURL=index.js.map
|
|
10155
10239
|
//# sourceMappingURL=index.js.map
|