@t2000/engine 0.33.0 → 0.33.1
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 +7 -0
- 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
|
}
|
|
@@ -4052,6 +4056,9 @@ async function compactMessages(messages, opts = {}) {
|
|
|
4052
4056
|
);
|
|
4053
4057
|
}
|
|
4054
4058
|
if (estimateTokens(mutable) <= budget) return mutable;
|
|
4059
|
+
if (splitIdx <= 1) {
|
|
4060
|
+
return sanitizeMessages(mutable);
|
|
4061
|
+
}
|
|
4055
4062
|
const first = mutable[0];
|
|
4056
4063
|
const recentFromMutable = mutable.slice(splitIdx);
|
|
4057
4064
|
const oldSection = mutable.slice(1, splitIdx);
|