@t2000/engine 0.33.0 → 0.33.2
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 +1 -1
- package/dist/index.js +14 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ declare function estimateTokens(messages: Message[]): number;
|
|
|
10
10
|
interface CompactOptions {
|
|
11
11
|
/** Max token budget for the conversation. Default 100_000. */
|
|
12
12
|
maxTokens?: number;
|
|
13
|
-
/** Number of recent messages to always keep uncompacted. Default
|
|
13
|
+
/** Number of recent messages to always keep uncompacted. Default 8. */
|
|
14
14
|
keepRecentCount?: number;
|
|
15
15
|
/** System prompt token estimate (subtracted from budget). Default 500. */
|
|
16
16
|
systemPromptTokens?: number;
|
package/dist/index.js
CHANGED
|
@@ -1265,6 +1265,10 @@ var sendTransferTool = buildTool({
|
|
|
1265
1265
|
if (input.to.startsWith("0x") && !/^0x[a-fA-F0-9]{64}$/.test(input.to)) {
|
|
1266
1266
|
return { valid: false, error: `Invalid Sui address format: "${input.to}". Must be 0x followed by 64 hex characters.` };
|
|
1267
1267
|
}
|
|
1268
|
+
const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
1269
|
+
if (input.to === ZERO_ADDRESS) {
|
|
1270
|
+
return { valid: false, error: "This is the zero address (burn address). Sending funds here will permanently destroy them. If you really intend to burn tokens, please confirm explicitly." };
|
|
1271
|
+
}
|
|
1268
1272
|
if (input.amount <= 0) {
|
|
1269
1273
|
return { valid: false, error: "Amount must be positive." };
|
|
1270
1274
|
}
|
|
@@ -3047,12 +3051,11 @@ var createScheduleTool = buildTool({
|
|
|
3047
3051
|
},
|
|
3048
3052
|
required: ["actionType", "amount", "schedule"]
|
|
3049
3053
|
},
|
|
3050
|
-
isReadOnly:
|
|
3051
|
-
permissionLevel: "confirm",
|
|
3054
|
+
isReadOnly: true,
|
|
3052
3055
|
async call(input, context) {
|
|
3053
3056
|
const { apiUrl, internalKey, address } = getApiConfig(context);
|
|
3054
3057
|
if (!apiUrl || !address) {
|
|
3055
|
-
return { data: null, displayText: "Scheduled actions are not available." };
|
|
3058
|
+
return { data: null, displayText: "Scheduled actions are not available \u2014 missing wallet or API configuration." };
|
|
3056
3059
|
}
|
|
3057
3060
|
let cronExpr;
|
|
3058
3061
|
try {
|
|
@@ -3148,8 +3151,7 @@ var cancelScheduleTool = buildTool({
|
|
|
3148
3151
|
},
|
|
3149
3152
|
required: ["scheduleId"]
|
|
3150
3153
|
},
|
|
3151
|
-
isReadOnly:
|
|
3152
|
-
permissionLevel: "confirm",
|
|
3154
|
+
isReadOnly: true,
|
|
3153
3155
|
async call(input, context) {
|
|
3154
3156
|
const { apiUrl, internalKey, address } = getApiConfig(context);
|
|
3155
3157
|
if (!apiUrl || !address) {
|
|
@@ -3501,7 +3503,9 @@ var READ_TOOLS = [
|
|
|
3501
3503
|
spendingAnalyticsTool,
|
|
3502
3504
|
yieldSummaryTool,
|
|
3503
3505
|
activitySummaryTool,
|
|
3504
|
-
listSchedulesTool
|
|
3506
|
+
listSchedulesTool,
|
|
3507
|
+
createScheduleTool,
|
|
3508
|
+
cancelScheduleTool
|
|
3505
3509
|
];
|
|
3506
3510
|
var WRITE_TOOLS = [
|
|
3507
3511
|
saveDepositTool,
|
|
@@ -3514,9 +3518,7 @@ var WRITE_TOOLS = [
|
|
|
3514
3518
|
swapExecuteTool,
|
|
3515
3519
|
voloStakeTool,
|
|
3516
3520
|
voloUnstakeTool,
|
|
3517
|
-
saveContactTool
|
|
3518
|
-
createScheduleTool,
|
|
3519
|
-
cancelScheduleTool
|
|
3521
|
+
saveContactTool
|
|
3520
3522
|
];
|
|
3521
3523
|
function getDefaultTools() {
|
|
3522
3524
|
return applyToolFlags([...READ_TOOLS, ...WRITE_TOOLS]);
|
|
@@ -4052,6 +4054,9 @@ async function compactMessages(messages, opts = {}) {
|
|
|
4052
4054
|
);
|
|
4053
4055
|
}
|
|
4054
4056
|
if (estimateTokens(mutable) <= budget) return mutable;
|
|
4057
|
+
if (splitIdx <= 1) {
|
|
4058
|
+
return sanitizeMessages(mutable);
|
|
4059
|
+
}
|
|
4055
4060
|
const first = mutable[0];
|
|
4056
4061
|
const recentFromMutable = mutable.slice(splitIdx);
|
|
4057
4062
|
const oldSection = mutable.slice(1, splitIdx);
|