@t2000/engine 0.7.6 → 0.7.7
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 +2 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +69 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -87,7 +87,7 @@ QueryEngine.submitMessage()
|
|
|
87
87
|
|
|
88
88
|
## Built-in Tools
|
|
89
89
|
|
|
90
|
-
### Read Tools (
|
|
90
|
+
### Read Tools (20 — parallel, auto-approved)
|
|
91
91
|
|
|
92
92
|
| Tool | Description |
|
|
93
93
|
|------|-------------|
|
|
@@ -96,6 +96,7 @@ QueryEngine.submitMessage()
|
|
|
96
96
|
| `health_check` | Health factor with risk assessment |
|
|
97
97
|
| `rates_info` | Current supply/borrow APYs |
|
|
98
98
|
| `transaction_history` | Recent transaction log |
|
|
99
|
+
| `allowance_status` | Agent budget allowance and permissions |
|
|
99
100
|
| `explain_tx` | Human-readable transaction explanation from digest |
|
|
100
101
|
| `web_search` | Web search via Brave Search API |
|
|
101
102
|
| `swap_quote` | Preview swap route, output amount, and price impact (no execution) |
|
package/dist/index.d.ts
CHANGED
|
@@ -850,6 +850,7 @@ declare const withdrawTool: Tool<{
|
|
|
850
850
|
declare const sendTransferTool: Tool<{
|
|
851
851
|
amount: number;
|
|
852
852
|
to: string;
|
|
853
|
+
memo?: string | undefined;
|
|
853
854
|
}, {
|
|
854
855
|
success: boolean;
|
|
855
856
|
tx: string;
|
|
@@ -859,6 +860,7 @@ declare const sendTransferTool: Tool<{
|
|
|
859
860
|
gasCost: number;
|
|
860
861
|
gasMethod: _t2000_sdk.GasMethod;
|
|
861
862
|
balance: _t2000_sdk.BalanceResponse;
|
|
863
|
+
memo: string | null;
|
|
862
864
|
}>;
|
|
863
865
|
|
|
864
866
|
declare const borrowTool: Tool<{
|
package/dist/index.js
CHANGED
|
@@ -1135,7 +1135,8 @@ var sendTransferTool = buildTool({
|
|
|
1135
1135
|
description: "Send USDC to another Sui address or contact name. Validates the address, checks balance, and executes the on-chain transfer. Returns tx hash, gas cost, and updated balance.",
|
|
1136
1136
|
inputSchema: z.object({
|
|
1137
1137
|
to: z.string().min(1),
|
|
1138
|
-
amount: z.number().positive()
|
|
1138
|
+
amount: z.number().positive(),
|
|
1139
|
+
memo: z.string().optional()
|
|
1139
1140
|
}),
|
|
1140
1141
|
jsonSchema: {
|
|
1141
1142
|
type: "object",
|
|
@@ -1147,6 +1148,10 @@ var sendTransferTool = buildTool({
|
|
|
1147
1148
|
amount: {
|
|
1148
1149
|
type: "number",
|
|
1149
1150
|
description: "Amount in USD to send"
|
|
1151
|
+
},
|
|
1152
|
+
memo: {
|
|
1153
|
+
type: "string",
|
|
1154
|
+
description: "Optional note attached to the transfer (shown in transaction receipt)"
|
|
1150
1155
|
}
|
|
1151
1156
|
},
|
|
1152
1157
|
required: ["to", "amount"]
|
|
@@ -1165,7 +1170,8 @@ var sendTransferTool = buildTool({
|
|
|
1165
1170
|
contactName: result.contactName,
|
|
1166
1171
|
gasCost: result.gasCost,
|
|
1167
1172
|
gasMethod: result.gasMethod,
|
|
1168
|
-
balance: result.balance
|
|
1173
|
+
balance: result.balance,
|
|
1174
|
+
memo: input.memo ?? null
|
|
1169
1175
|
},
|
|
1170
1176
|
displayText: `Sent $${result.amount.toFixed(2)} to ${result.contactName ?? result.to.slice(0, 10)}\u2026 (tx: ${result.tx.slice(0, 8)}\u2026)`
|
|
1171
1177
|
};
|
|
@@ -1295,7 +1301,15 @@ var payApiTool = buildTool({
|
|
|
1295
1301
|
|
|
1296
1302
|
Use mpp_services tool first to discover available services and get the correct endpoint URL, required body parameters, and pricing. Then call this tool with the full URL and JSON body.
|
|
1297
1303
|
|
|
1298
|
-
Always use POST. Construct the URL from the gateway base + service path. Pass parameters as a JSON string in body
|
|
1304
|
+
Always use POST. Construct the URL from the gateway base + service path. Pass parameters as a JSON string in body.
|
|
1305
|
+
|
|
1306
|
+
CRITICAL \u2014 non-retryable errors: If the result contains "doNotRetry": true or "paymentConfirmed": true, the user has ALREADY been charged. NEVER call pay_api again for the same request. Report the error to the user.
|
|
1307
|
+
|
|
1308
|
+
Lob (postcards/letters) \u2014 MULTI-STEP, NEVER skip:
|
|
1309
|
+
1. Generate design image FIRST via fal/fal-ai/flux/dev ($0.03). Show the image to the user as markdown .
|
|
1310
|
+
2. Ask the user to confirm before mailing ("Here's the design. Print and mail for $1.00?").
|
|
1311
|
+
3. ONLY after user confirms: call lob/v1/postcards with the image URL in the front HTML (<img src="URL" style="width:100%;height:100%;object-fit:cover"/>).
|
|
1312
|
+
Always use ISO-3166 country codes (GB not UK, US not USA). A return address ("from") is added automatically \u2014 do not include one.`,
|
|
1299
1313
|
inputSchema: z.object({
|
|
1300
1314
|
url: z.string().url(),
|
|
1301
1315
|
method: z.enum(["GET", "POST", "PUT", "DELETE"]).optional(),
|
|
@@ -1971,6 +1985,56 @@ Risks: ${riskFactors.join("; ")}`
|
|
|
1971
1985
|
};
|
|
1972
1986
|
}
|
|
1973
1987
|
});
|
|
1988
|
+
var allowanceStatusTool = buildTool({
|
|
1989
|
+
name: "allowance_status",
|
|
1990
|
+
description: "Check the agent spending allowance status: whether it is enabled, the daily USDC limit, amount spent today, remaining budget, which service categories are permitted, and when the budget resets. Use this when the user asks about their agent budget, spending limits, or autonomous transaction permissions.",
|
|
1991
|
+
inputSchema: z.object({}),
|
|
1992
|
+
jsonSchema: { type: "object", properties: {}, required: [] },
|
|
1993
|
+
isReadOnly: true,
|
|
1994
|
+
async call(_input, context) {
|
|
1995
|
+
if (!context.env?.ALLOWANCE_API_URL || !context.walletAddress) {
|
|
1996
|
+
return {
|
|
1997
|
+
data: {
|
|
1998
|
+
enabled: false,
|
|
1999
|
+
dailyLimit: 0,
|
|
2000
|
+
spent: 0,
|
|
2001
|
+
remaining: 0,
|
|
2002
|
+
permissions: [],
|
|
2003
|
+
resetsAt: null
|
|
2004
|
+
},
|
|
2005
|
+
displayText: "Agent allowance is not configured."
|
|
2006
|
+
};
|
|
2007
|
+
}
|
|
2008
|
+
const disabledResult = {
|
|
2009
|
+
data: {
|
|
2010
|
+
enabled: false,
|
|
2011
|
+
dailyLimit: 0,
|
|
2012
|
+
spent: 0,
|
|
2013
|
+
remaining: 0,
|
|
2014
|
+
permissions: [],
|
|
2015
|
+
resetsAt: null
|
|
2016
|
+
},
|
|
2017
|
+
displayText: "Unable to fetch allowance status."
|
|
2018
|
+
};
|
|
2019
|
+
let allowance;
|
|
2020
|
+
try {
|
|
2021
|
+
const url = `${context.env.ALLOWANCE_API_URL}/api/allowance/${context.walletAddress}`;
|
|
2022
|
+
const res = await fetch(url, {
|
|
2023
|
+
signal: context.signal,
|
|
2024
|
+
headers: context.env.AUDRIC_INTERNAL_KEY ? { "x-internal-key": context.env.AUDRIC_INTERNAL_KEY } : void 0
|
|
2025
|
+
});
|
|
2026
|
+
if (!res.ok) return disabledResult;
|
|
2027
|
+
allowance = await res.json();
|
|
2028
|
+
} catch {
|
|
2029
|
+
return disabledResult;
|
|
2030
|
+
}
|
|
2031
|
+
const statusText = allowance.enabled ? `Allowance active: $${allowance.spent.toFixed(2)} / $${allowance.dailyLimit.toFixed(2)} used today. ${allowance.permissions.length} service categories enabled.` : "Agent allowance is disabled.";
|
|
2032
|
+
return {
|
|
2033
|
+
data: allowance,
|
|
2034
|
+
displayText: statusText
|
|
2035
|
+
};
|
|
2036
|
+
}
|
|
2037
|
+
});
|
|
1974
2038
|
var LLAMA_API2 = "https://api.llama.fi";
|
|
1975
2039
|
var YIELDS_API2 = "https://yields.llama.fi";
|
|
1976
2040
|
var COINS_API = "https://coins.llama.fi";
|
|
@@ -2273,7 +2337,8 @@ var READ_TOOLS = [
|
|
|
2273
2337
|
defillamaPriceChangeTool,
|
|
2274
2338
|
defillamaChainTvlTool,
|
|
2275
2339
|
defillamaProtocolFeesTool,
|
|
2276
|
-
defillamaSuiProtocolsTool
|
|
2340
|
+
defillamaSuiProtocolsTool,
|
|
2341
|
+
allowanceStatusTool
|
|
2277
2342
|
];
|
|
2278
2343
|
var WRITE_TOOLS = [
|
|
2279
2344
|
saveDepositTool,
|