@t2000/engine 1.7.0 → 1.9.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 +311 -1
- package/dist/index.js +543 -115
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -94,6 +94,19 @@ interface RecipeStep {
|
|
|
94
94
|
on_error?: RecipeStepOnError;
|
|
95
95
|
input_template?: Record<string, string>;
|
|
96
96
|
cost_per_unit?: string;
|
|
97
|
+
/**
|
|
98
|
+
* [SPEC 7 P2.5 Layer 4] When true, this step is part of a multi-write
|
|
99
|
+
* Payment Stream bundle group. Steps with `bundle: true` MUST resolve
|
|
100
|
+
* to confirm-tier write tools that carry `bundleable: true` in
|
|
101
|
+
* `TOOL_FLAGS` (validated at recipe load time). The loader fails fast
|
|
102
|
+
* on auto-tier writes / read-only tools / non-bundleable confirm tools
|
|
103
|
+
* (`pay_api`, `save_contact`) inside a `bundle: true` group.
|
|
104
|
+
*
|
|
105
|
+
* The engine emits parallel `tool_use` blocks for `bundle: true`
|
|
106
|
+
* steps in the same turn; the permission gate (Layer 2) collapses
|
|
107
|
+
* them into a single bundled `pending_action`.
|
|
108
|
+
*/
|
|
109
|
+
bundle?: boolean;
|
|
97
110
|
}
|
|
98
111
|
interface Recipe {
|
|
99
112
|
name: string;
|
|
@@ -889,6 +902,27 @@ interface PendingActionModifiableField {
|
|
|
889
902
|
/** Optional asset symbol (e.g. "USDC", "SUI", "vSUI") for amount fields. */
|
|
890
903
|
asset?: string;
|
|
891
904
|
}
|
|
905
|
+
/**
|
|
906
|
+
* [SPEC 7 v0.4 Layer 2] One step inside a multi-write Payment Stream
|
|
907
|
+
* `PendingAction`. Single-write actions never carry `steps[]`; the
|
|
908
|
+
* legacy `toolName`/`toolUseId`/`input`/`attemptId` fields cover them.
|
|
909
|
+
*/
|
|
910
|
+
interface PendingActionStep {
|
|
911
|
+
toolName: string;
|
|
912
|
+
toolUseId: string;
|
|
913
|
+
/**
|
|
914
|
+
* Per-step UUID v4 stamped at emit time. Hosts write one
|
|
915
|
+
* `TurnMetrics` row per step keyed on this id; the resume route's
|
|
916
|
+
* `updateMany({ where: { attemptId } })` extends trivially to the
|
|
917
|
+
* per-step shape (loop `stepResults`, update each row).
|
|
918
|
+
*/
|
|
919
|
+
attemptId: string;
|
|
920
|
+
input: unknown;
|
|
921
|
+
/** Per-step user-facing summary (rendered in the PermissionCard). */
|
|
922
|
+
description: string;
|
|
923
|
+
/** Optional modifiable fields for THIS step (rare in v1; sourced from `tool-modifiable-fields.ts`). */
|
|
924
|
+
modifiableFields?: PendingActionModifiableField[];
|
|
925
|
+
}
|
|
892
926
|
/**
|
|
893
927
|
* Serializable description of a write tool that needs user approval.
|
|
894
928
|
* Stored in the session so the client can act on it in a separate request.
|
|
@@ -935,17 +969,88 @@ interface PendingAction {
|
|
|
935
969
|
* matching the pair, which is exactly the false-resolution bug Item 3
|
|
936
970
|
* exists to kill. Also survives session persistence so the resume call
|
|
937
971
|
* can read it back from the rehydrated `PendingAction`.
|
|
972
|
+
*
|
|
973
|
+
* **Bundles:** when `steps !== undefined` (multi-write Payment Stream),
|
|
974
|
+
* the top-level `attemptId` mirrors `steps[0].attemptId` per SPEC 7
|
|
975
|
+
* § Layer 2 line 463 ("`steps[0]` mirrors the top-level
|
|
976
|
+
* toolName/toolUseId/input/attemptId for hosts that haven't been
|
|
977
|
+
* updated"). Pre-bundle hosts that key TurnMetrics rows on top-level
|
|
978
|
+
* `attemptId` collide cleanly with the bundle-aware host's step-0 row.
|
|
979
|
+
* Bundle-aware hosts iterate `steps[]` and write N TurnMetrics rows
|
|
980
|
+
* (one per step `attemptId`); the resume route's
|
|
981
|
+
* `updateMany({ where: { attemptId } })` keys still work because the
|
|
982
|
+
* route loops `stepResults` and updates each per-step row.
|
|
938
983
|
*/
|
|
939
984
|
attemptId: string;
|
|
985
|
+
/**
|
|
986
|
+
* [SPEC 7 v0.4 Layer 2] When set, this `pending_action` represents a
|
|
987
|
+
* multi-write Payment Stream. Single-step bundles are NOT created — the
|
|
988
|
+
* engine emits the legacy single-write shape when N=1. Hosts that haven't
|
|
989
|
+
* been updated read `toolName`/`toolUseId`/`input` (which mirror
|
|
990
|
+
* `steps[0]`); newer hosts iterate `steps`.
|
|
991
|
+
*
|
|
992
|
+
* Bundleable tools (v1): `save_deposit`, `withdraw`, `borrow`,
|
|
993
|
+
* `repay_debt`, `send_transfer`, `swap_execute`, `claim_rewards`,
|
|
994
|
+
* `volo_stake`, `volo_unstake`. Non-bundleable: `pay_api`
|
|
995
|
+
* (HTTPS coupling), `save_contact` (Postgres only).
|
|
996
|
+
*/
|
|
997
|
+
steps?: PendingActionStep[];
|
|
998
|
+
/**
|
|
999
|
+
* [SPEC 7 v0.3 Quote-Refresh] Milliseconds since the upstream read tools
|
|
1000
|
+
* that fed this bundle's composition completed. Engine stamps at emit
|
|
1001
|
+
* time using `Date.now() - min(tool_result.timestamp)` across the listed
|
|
1002
|
+
* `regenerateInput.toolUseIds`. Host renders as a "QUOTE Ns OLD" badge in
|
|
1003
|
+
* the PermissionCard header. Only set on bundled `pending_action`s.
|
|
1004
|
+
*/
|
|
1005
|
+
quoteAge?: number;
|
|
1006
|
+
/**
|
|
1007
|
+
* [SPEC 7 v0.3 Quote-Refresh] True when the bundle was composed from
|
|
1008
|
+
* re-runnable read tools (`swap_quote`, `rates_info`, `balance_check`,
|
|
1009
|
+
* `portfolio_analysis`). False when amounts came from user-provided
|
|
1010
|
+
* inputs that don't depend on upstream quotes. Single-write
|
|
1011
|
+
* `pending_action`s set this to `false` (regenerate is N≥2 only).
|
|
1012
|
+
*/
|
|
1013
|
+
canRegenerate?: boolean;
|
|
1014
|
+
/**
|
|
1015
|
+
* [SPEC 7 v0.3 Quote-Refresh] Engine-internal payload listing which
|
|
1016
|
+
* upstream read `tool_use` ids to re-fire when the user taps REGENERATE.
|
|
1017
|
+
* Host echoes this back via `POST /api/engine/regenerate`; engine re-runs
|
|
1018
|
+
* each tool with the same input (no LLM call), rebuilds the bundle, and
|
|
1019
|
+
* emits a fresh `pending_action` with new per-step `attemptId`s.
|
|
1020
|
+
*/
|
|
1021
|
+
regenerateInput?: {
|
|
1022
|
+
toolUseIds: string[];
|
|
1023
|
+
};
|
|
940
1024
|
}
|
|
941
1025
|
/**
|
|
942
1026
|
* Response from the client when resolving a pending action.
|
|
943
1027
|
* - `approved: false` → tool is declined, LLM is told "user declined"
|
|
944
1028
|
* - `approved: true` with `executionResult` → engine uses the client-provided result
|
|
1029
|
+
* (single-write path)
|
|
1030
|
+
* - `approved: true` with `stepResults` → engine pushes one `tool_result`
|
|
1031
|
+
* block per step into the conversation (bundle path)
|
|
945
1032
|
*/
|
|
946
1033
|
interface PermissionResponse {
|
|
947
1034
|
approved: boolean;
|
|
1035
|
+
/** Single-write (legacy) execution result. Ignored when `stepResults` is set. */
|
|
948
1036
|
executionResult?: unknown;
|
|
1037
|
+
/**
|
|
1038
|
+
* [SPEC 7 v0.4 Layer 2] Per-step results for a bundle resume. One entry
|
|
1039
|
+
* per step in the original `PendingAction.steps`, in the same order.
|
|
1040
|
+
* Each carries the step's `toolUseId` + `attemptId` so the host's resume
|
|
1041
|
+
* route can update the matching `TurnMetrics` row.
|
|
1042
|
+
*
|
|
1043
|
+
* **Atomic semantics:** PTB execution is atomic at the Sui layer. If the
|
|
1044
|
+
* host detects a bundle-level failure, it should populate every entry
|
|
1045
|
+
* with `isError: true` carrying the same error message (so the LLM
|
|
1046
|
+
* narrates the failure once, not N times).
|
|
1047
|
+
*/
|
|
1048
|
+
stepResults?: Array<{
|
|
1049
|
+
toolUseId: string;
|
|
1050
|
+
attemptId: string;
|
|
1051
|
+
result: unknown;
|
|
1052
|
+
isError: boolean;
|
|
1053
|
+
}>;
|
|
949
1054
|
}
|
|
950
1055
|
type PermissionLevel = 'auto' | 'confirm' | 'explicit';
|
|
951
1056
|
interface ToolResult<T = unknown> {
|
|
@@ -1046,6 +1151,24 @@ interface ToolFlags {
|
|
|
1046
1151
|
producesArtifact?: boolean;
|
|
1047
1152
|
costAware?: boolean;
|
|
1048
1153
|
maxRetries?: number;
|
|
1154
|
+
/**
|
|
1155
|
+
* [SPEC 7 v0.4 Layer 2] Opt-in: this write tool can participate in a
|
|
1156
|
+
* multi-write Payment Stream. When the LLM emits ≥2 `tool_use` blocks
|
|
1157
|
+
* in a single assistant turn AND every block resolves to a `confirm`-tier
|
|
1158
|
+
* write tool with `bundleable: true`, the engine collapses them into one
|
|
1159
|
+
* `pending_action` with `steps[]` instead of yielding N times. Default
|
|
1160
|
+
* `false` — silently opt-out. v1 set: `save_deposit`, `withdraw`,
|
|
1161
|
+
* `borrow`, `repay_debt`, `send_transfer`, `swap_execute`,
|
|
1162
|
+
* `claim_rewards`, `volo_stake`, `volo_unstake`.
|
|
1163
|
+
*
|
|
1164
|
+
* **Permanently non-bundleable:**
|
|
1165
|
+
* - `pay_api` — recipient/amount/currency aren't known at LLM intent
|
|
1166
|
+
* time (gateway 402 challenge resolves them at route time, after a
|
|
1167
|
+
* network round-trip the engine has no knowledge of). PTB cannot be
|
|
1168
|
+
* composed at compose time.
|
|
1169
|
+
* - `save_contact` — Postgres-only, no on-chain effect.
|
|
1170
|
+
*/
|
|
1171
|
+
bundleable?: boolean;
|
|
1049
1172
|
}
|
|
1050
1173
|
type PreflightResult = {
|
|
1051
1174
|
valid: true;
|
|
@@ -1412,6 +1535,14 @@ declare class QueryEngine {
|
|
|
1412
1535
|
private runPostWriteRefresh;
|
|
1413
1536
|
interrupt(): void;
|
|
1414
1537
|
getMessages(): readonly Message[];
|
|
1538
|
+
/**
|
|
1539
|
+
* [SPEC 7 P2.4b] Read-only access to the engine's tool registry.
|
|
1540
|
+
* Exposed so out-of-band utilities like `regenerateBundle` can call
|
|
1541
|
+
* `composeBundleFromToolResults({ tools: engine.getTools(), ... })`
|
|
1542
|
+
* without forcing the host to hand-thread the tool array. Mirrors
|
|
1543
|
+
* `getMessages()` access pattern.
|
|
1544
|
+
*/
|
|
1545
|
+
getTools(): readonly Tool[];
|
|
1415
1546
|
getMatchedRecipe(): Recipe | null;
|
|
1416
1547
|
getContextBudget(): ContextBudget;
|
|
1417
1548
|
reset(): void;
|
|
@@ -1466,6 +1597,168 @@ declare class QueryEngine {
|
|
|
1466
1597
|
*/
|
|
1467
1598
|
declare function validateHistory(messages: Message[]): Message[];
|
|
1468
1599
|
|
|
1600
|
+
/**
|
|
1601
|
+
* SPEC 7 v0.3 Quote-Refresh ReviewCard — per-tool result freshness budgets.
|
|
1602
|
+
*
|
|
1603
|
+
* When a Payment Stream `pending_action` is composed at T=0 from upstream
|
|
1604
|
+
* read results, the user may take 30–60s to read + tap APPROVE. By that
|
|
1605
|
+
* time some upstream results have drifted (Cetus quotes refresh in
|
|
1606
|
+
* ~30s; NAVI APYs change slower). The host renders a "QUOTE Ns OLD"
|
|
1607
|
+
* badge and pulses the REGENERATE button when `quoteAge >
|
|
1608
|
+
* bundleShortestTtl(...)` so the user is nudged toward a fresh
|
|
1609
|
+
* composition. The TTL is a UX hint — it does NOT gate correctness.
|
|
1610
|
+
* The actual safety net is Sui's on-chain dry-run + `minOut` reverts.
|
|
1611
|
+
*
|
|
1612
|
+
* **Why per-tool, not per-bundle.** A bundle that depends on `swap_quote`
|
|
1613
|
+
* (30s drift) AND `rates_info` (90s drift) inherits the SHORTEST member
|
|
1614
|
+
* TTL — that's the freshness ceiling we can promise. Mixing in a
|
|
1615
|
+
* stable-floor read like `balance_check` (120s) doesn't loosen the
|
|
1616
|
+
* ceiling; the user still cares about the 30s quote going stale.
|
|
1617
|
+
*
|
|
1618
|
+
* **Where this lives.** Engine emits `quoteAge` + `regenerateInput` on
|
|
1619
|
+
* the bundled `pending_action`; the host imports `bundleShortestTtl` to
|
|
1620
|
+
* decide when the regenerate button auto-pulses. Adding a new
|
|
1621
|
+
* re-runnable read tool: append it to `TOOL_TTL_MS` here AND ensure the
|
|
1622
|
+
* bundle composer's contributing-reads detector picks it up.
|
|
1623
|
+
*/
|
|
1624
|
+
declare const TOOL_TTL_MS: Record<string, number>;
|
|
1625
|
+
/** Default TTL for read tools not in `TOOL_TTL_MS` (60s — conservative). */
|
|
1626
|
+
declare const DEFAULT_TOOL_TTL_MS = 60000;
|
|
1627
|
+
/**
|
|
1628
|
+
* Resolve the shortest TTL among a set of tool_use_ids. Hosts call this
|
|
1629
|
+
* to decide when the regenerate button should auto-pulse.
|
|
1630
|
+
*
|
|
1631
|
+
* @param toolUseIds — the set of upstream read `tool_use` ids that fed
|
|
1632
|
+
* the bundle composition (what the engine stamps into
|
|
1633
|
+
* `PendingAction.regenerateInput.toolUseIds`).
|
|
1634
|
+
* @param toolNamesById — `tool_use_id` → `toolName` map, built by the
|
|
1635
|
+
* host from the same turn's tool_use blocks.
|
|
1636
|
+
* @returns The smallest TTL in milliseconds. Empty input returns
|
|
1637
|
+
* `DEFAULT_TOOL_TTL_MS`.
|
|
1638
|
+
*/
|
|
1639
|
+
declare function bundleShortestTtl(toolUseIds: string[], toolNamesById: Record<string, string>): number;
|
|
1640
|
+
/** The set of read tools whose results re-fire on REGENERATE. */
|
|
1641
|
+
declare const REGENERATABLE_READ_TOOLS: ReadonlySet<string>;
|
|
1642
|
+
|
|
1643
|
+
/**
|
|
1644
|
+
* SPEC 7 v0.3 Quote-Refresh ReviewCard — engine-side bundle regeneration.
|
|
1645
|
+
*
|
|
1646
|
+
* When a user takes 30–60s to read a multi-step Payment Stream
|
|
1647
|
+
* `pending_action`, the upstream read results that fed bundle composition
|
|
1648
|
+
* (Cetus quotes, NAVI APYs, wallet balances) drift. Today the user has to
|
|
1649
|
+
* either approve with stale data (Sui dry-run is the safety gate, but the
|
|
1650
|
+
* UX is "did this just lie to me?") or cancel and re-prompt the LLM
|
|
1651
|
+
* (loses the narrative thread). The Quote-Refresh ReviewCard adds a
|
|
1652
|
+
* third option: an explicit REGENERATE button that re-fires the
|
|
1653
|
+
* upstream reads (no LLM call), rebuilds the bundle in place, and
|
|
1654
|
+
* yields a fresh `pending_action` with new per-step `attemptId`s.
|
|
1655
|
+
*
|
|
1656
|
+
* **What this function does NOT do.**
|
|
1657
|
+
* - Run the LLM. Regenerate is "re-evaluate the same intent against
|
|
1658
|
+
* fresh state" — the writes' tool names + inputs stay identical;
|
|
1659
|
+
* only the upstream read TIMESTAMPS change (and any downstream
|
|
1660
|
+
* derivations the host made off them).
|
|
1661
|
+
* - Run the bundle on-chain. The host still presents the new
|
|
1662
|
+
* PermissionCard for confirmation; user can approve, regenerate
|
|
1663
|
+
* again, or deny.
|
|
1664
|
+
* - Mutate `TurnMetrics` rows. The host route owns analytics — see
|
|
1665
|
+
* `audric/apps/web/app/api/engine/regenerate/route.ts`.
|
|
1666
|
+
*
|
|
1667
|
+
* **Spec 1 / Spec 2 invariants preserved.**
|
|
1668
|
+
* - Each regeneration produces its own per-step `attemptId` (UUID v4),
|
|
1669
|
+
* so the host can write a fresh `TurnMetrics` row keyed on it.
|
|
1670
|
+
* - The original `pending_action`'s `attemptId` stays valid for the
|
|
1671
|
+
* host's `pendingActionOutcome = 'regenerated'` update — no
|
|
1672
|
+
* accidental over-write of the original row.
|
|
1673
|
+
*
|
|
1674
|
+
* **Why synchronous (no SSE).** The chat stream that originally
|
|
1675
|
+
* yielded the bundled `pending_action` has already closed by the time
|
|
1676
|
+
* the user taps Regenerate (`useEngine.ts` flips `isStreaming: false`
|
|
1677
|
+
* on `pending_action`). Reopening a stream for a sub-second round-trip
|
|
1678
|
+
* would be heavier than the host needs. Instead, the host endpoint
|
|
1679
|
+
* calls this function synchronously and returns
|
|
1680
|
+
* `{ success, newPendingAction, timelineEvents[] }` in the response
|
|
1681
|
+
* body — host renders `timelineEvents[]` as a "↻ Regenerated · Ns"
|
|
1682
|
+
* group above the new card.
|
|
1683
|
+
*/
|
|
1684
|
+
|
|
1685
|
+
/**
|
|
1686
|
+
* One event in the `timelineEvents[]` array returned to the host.
|
|
1687
|
+
* Mirrors the engine's normal SSE event shapes for `tool_start` and
|
|
1688
|
+
* `tool_result` so the host can push them onto its timeline as if they
|
|
1689
|
+
* had streamed live.
|
|
1690
|
+
*/
|
|
1691
|
+
type RegenerateTimelineEvent = {
|
|
1692
|
+
type: 'tool_start';
|
|
1693
|
+
toolName: string;
|
|
1694
|
+
toolUseId: string;
|
|
1695
|
+
input: unknown;
|
|
1696
|
+
} | {
|
|
1697
|
+
type: 'tool_result';
|
|
1698
|
+
toolName: string;
|
|
1699
|
+
toolUseId: string;
|
|
1700
|
+
result: unknown;
|
|
1701
|
+
isError: boolean;
|
|
1702
|
+
durationMs: number;
|
|
1703
|
+
};
|
|
1704
|
+
interface RegenerateSuccess {
|
|
1705
|
+
success: true;
|
|
1706
|
+
/**
|
|
1707
|
+
* Fresh `pending_action` with new per-step `attemptId`s. The host
|
|
1708
|
+
* swaps this in for the original `PermissionCard` payload; the
|
|
1709
|
+
* existing PermissionCard renderer requires no changes — it sees a
|
|
1710
|
+
* fresh action with a fresh `quoteAge` of ~0ms.
|
|
1711
|
+
*/
|
|
1712
|
+
newPendingAction: PendingAction;
|
|
1713
|
+
/**
|
|
1714
|
+
* Re-fired upstream read events the host renders as a
|
|
1715
|
+
* "↻ Regenerated · Ns" group above the new card. Order: every
|
|
1716
|
+
* `tool_start` for one read is paired with its `tool_result`; reads
|
|
1717
|
+
* are processed serially (so durations sum cleanly for the group
|
|
1718
|
+
* label).
|
|
1719
|
+
*/
|
|
1720
|
+
timelineEvents: RegenerateTimelineEvent[];
|
|
1721
|
+
}
|
|
1722
|
+
interface RegenerateFailure {
|
|
1723
|
+
success: false;
|
|
1724
|
+
reason: 'pending_action_not_found' | 'cannot_regenerate' | 'engine_error';
|
|
1725
|
+
message: string;
|
|
1726
|
+
}
|
|
1727
|
+
type RegenerateResult = RegenerateSuccess | RegenerateFailure;
|
|
1728
|
+
/**
|
|
1729
|
+
* Re-fire the upstream reads that fed a bundled pending_action and
|
|
1730
|
+
* compose a fresh bundle. The engine MUST be created with the same
|
|
1731
|
+
* tool registry + ToolContext as the chat turn that produced the
|
|
1732
|
+
* original action. The host typically reaches this by calling
|
|
1733
|
+
* `createEngine({ address, session })` on the same session that
|
|
1734
|
+
* persisted the pending_action.
|
|
1735
|
+
*
|
|
1736
|
+
* **Side effect.** On success, this mutates the engine's message
|
|
1737
|
+
* history by appending one synthetic assistant message (carrying the
|
|
1738
|
+
* regenerated `tool_use` blocks) and one user message (carrying the
|
|
1739
|
+
* fresh `tool_result` blocks). This is so the LLM sees the fresh
|
|
1740
|
+
* data when the user approves the new bundle and the engine resumes.
|
|
1741
|
+
* The host should persist `engine.getMessages()` back to its session
|
|
1742
|
+
* store after a successful regenerate.
|
|
1743
|
+
*
|
|
1744
|
+
* **Failure modes.**
|
|
1745
|
+
* - `pending_action_not_found` — the action isn't a bundle (no
|
|
1746
|
+
* `steps`, or fewer than 2 steps). Single-write actions can't be
|
|
1747
|
+
* regenerated by design.
|
|
1748
|
+
* - `cannot_regenerate` — the action's `canRegenerate` flag is
|
|
1749
|
+
* false, OR no contributing read tool_use_ids could be located in
|
|
1750
|
+
* session history.
|
|
1751
|
+
* - `engine_error` — a tool re-execution threw, OR bundle
|
|
1752
|
+
* composition rejected (defensive — should not happen if the
|
|
1753
|
+
* original bundle was valid).
|
|
1754
|
+
*
|
|
1755
|
+
* Errors in tool re-execution short-circuit the whole regenerate
|
|
1756
|
+
* (bundle composition would inherit a broken read result). The host
|
|
1757
|
+
* surfaces this as a toast: "Could not regenerate. The original card
|
|
1758
|
+
* is still valid."
|
|
1759
|
+
*/
|
|
1760
|
+
declare function regenerateBundle(engine: QueryEngine, action: PendingAction): Promise<RegenerateResult>;
|
|
1761
|
+
|
|
1469
1762
|
interface BuildToolOptions<TInput, TOutput> {
|
|
1470
1763
|
name: string;
|
|
1471
1764
|
description: string;
|
|
@@ -1614,6 +1907,11 @@ declare class MemorySessionStore implements SessionStore {
|
|
|
1614
1907
|
* producesArtifact — returns images, documents, generated content
|
|
1615
1908
|
* costAware — has a monetary cost the user should know about
|
|
1616
1909
|
* maxRetries — max calls with same input (default: unlimited for reads, 1 for writes)
|
|
1910
|
+
* bundleable — [SPEC 7 Layer 2] can participate in a multi-write Payment Stream
|
|
1911
|
+
* PTB. Set on every confirm-tier write whose on-chain effect is
|
|
1912
|
+
* fully expressible at compose time. Excluded: `pay_api` (recipient/
|
|
1913
|
+
* amount/currency unknown until gateway 402 challenge resolves at
|
|
1914
|
+
* route time) and `save_contact` (Postgres-only, no on-chain effect).
|
|
1617
1915
|
*/
|
|
1618
1916
|
declare const TOOL_FLAGS: Record<string, ToolFlags>;
|
|
1619
1917
|
/**
|
|
@@ -1625,6 +1923,18 @@ declare function applyToolFlags<T extends Tool>(tools: T[]): T[];
|
|
|
1625
1923
|
* Get flags for a tool by name. Returns empty flags if not registered.
|
|
1626
1924
|
*/
|
|
1627
1925
|
declare function getToolFlags(name: string): ToolFlags;
|
|
1926
|
+
/**
|
|
1927
|
+
* [SPEC 7 P2.5 Layer 4] True if this tool is in the v1 bundleable set.
|
|
1928
|
+
*
|
|
1929
|
+
* Used by the recipe loader's `bundle: true` validation — recipes that
|
|
1930
|
+
* declare `bundle: true` on a step MUST point to a tool that returns
|
|
1931
|
+
* `true` here. The set is the 9 confirm-tier write tools whose on-chain
|
|
1932
|
+
* effect is fully expressible at compose time:
|
|
1933
|
+
*
|
|
1934
|
+
* save_deposit, withdraw, borrow, repay_debt, send_transfer,
|
|
1935
|
+
* swap_execute, claim_rewards, volo_stake, volo_unstake.
|
|
1936
|
+
*/
|
|
1937
|
+
declare function isBundleableTool(name: string): boolean;
|
|
1628
1938
|
|
|
1629
1939
|
/**
|
|
1630
1940
|
* Routes each turn to the appropriate thinking effort level based on
|
|
@@ -3338,4 +3648,4 @@ declare function getTelemetrySink(): TelemetrySink;
|
|
|
3338
3648
|
/** Restore the default noop sink. Used by test teardowns. */
|
|
3339
3649
|
declare function resetTelemetrySink(): void;
|
|
3340
3650
|
|
|
3341
|
-
export { type AddressPortfolio, AnthropicProvider, type AnthropicProviderConfig, type AudricHistoryRecord, type AudricPortfolioResult, type AwaitOrFetchOpts, 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_LEASE_SEC, DEFAULT_PERMISSION_CONFIG, DEFAULT_POLL_BUDGET_MS, DEFAULT_POLL_INTERVAL_MS, DEFAULT_SYSTEM_PROMPT, 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 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, 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 PendingReward, type PendingToolCall, type PermissionLevel, type PermissionOperation, type PermissionResponse, type PermissionRule, type PortfolioCoin, 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, 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, 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, WRITE_TOOLS, type WalletCacheEntry, type WalletCacheStore, type WalletCoin, _resetNaviCircuitBreaker, activitySummaryTool, adaptAllMcpTools, adaptAllServerTools, adaptMcpTool, applyToolFlags, awaitOrFetch, balanceCheckTool, borrowTool, budgetToolResult, buildCachedSystemPrompt, buildMcpTools, buildProactivenessInstructions, buildProfileContext, buildSelfEvaluationInstruction, buildStateContext, buildTool, claimRewardsTool, clampThinkingForEffort, classifyEffort, clearPortfolioCache, clearPortfolioCacheFor, clearPriceMapCache, compactMessages, createGuardRunnerState, engineToSSE, estimateTokens, explainTxTool, 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, loadRecipes, looksLikeSuiNs, microcompact, mppServicesTool, naviKey, normalizeAddressInput, parseEvalSummary, parseMcpJson, parseRecipe, parseSSE, payApiTool, portfolioAnalysisTool, protocolDeepDiveTool, ratesInfoTool, 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, swapExecuteTool, swapQuoteTool, tokenPricesTool, toolNameToOperation, toolsToDefinitions, transactionHistoryTool, transformBalance, transformHealthFactor, transformPositions, transformRates, transformRewards, transformSavings, updateGuardStateAfterToolResult, updateTodoTool, validateHistory, voloStakeTool, voloStatsTool, voloUnstakeTool, webSearchTool, withdrawTool, yieldSummaryTool };
|
|
3651
|
+
export { type AddressPortfolio, AnthropicProvider, type AnthropicProviderConfig, type AudricHistoryRecord, type AudricPortfolioResult, type AwaitOrFetchOpts, 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_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 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, 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 PendingReward, type PendingToolCall, type PermissionLevel, type PermissionOperation, type PermissionResponse, type PermissionRule, type PortfolioCoin, type PositionEntry, type PreflightResult, 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, WRITE_TOOLS, type WalletCacheEntry, type WalletCacheStore, type WalletCoin, _resetNaviCircuitBreaker, activitySummaryTool, adaptAllMcpTools, adaptAllServerTools, adaptMcpTool, applyToolFlags, awaitOrFetch, balanceCheckTool, borrowTool, budgetToolResult, buildCachedSystemPrompt, buildMcpTools, buildProactivenessInstructions, buildProfileContext, buildSelfEvaluationInstruction, buildStateContext, buildTool, bundleShortestTtl, claimRewardsTool, clampThinkingForEffort, classifyEffort, clearPortfolioCache, clearPortfolioCacheFor, clearPriceMapCache, compactMessages, createGuardRunnerState, engineToSSE, estimateTokens, explainTxTool, 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, 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, swapExecuteTool, swapQuoteTool, tokenPricesTool, toolNameToOperation, toolsToDefinitions, transactionHistoryTool, transformBalance, transformHealthFactor, transformPositions, transformRates, transformRewards, transformSavings, updateGuardStateAfterToolResult, updateTodoTool, validateHistory, voloStakeTool, voloStatsTool, voloUnstakeTool, webSearchTool, withdrawTool, yieldSummaryTool };
|