@wrongstack/core 0.8.2 → 0.8.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/dist/coordination/index.js +8 -1
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +2 -2
- package/dist/defaults/index.js +52 -26
- package/dist/defaults/index.js.map +1 -1
- package/dist/execution/index.d.ts +11 -5
- package/dist/execution/index.js +33 -8
- package/dist/execution/index.js.map +1 -1
- package/dist/index.d.ts +497 -5
- package/dist/index.js +1328 -89
- package/dist/index.js.map +1 -1
- package/dist/{plan-templates-BnlpEkX8.d.ts → plan-templates-D8zQgZzc.d.ts} +1 -1
- package/dist/sdd/index.d.ts +7 -7
- package/dist/sdd/index.js +10 -14
- package/dist/sdd/index.js.map +1 -1
- package/dist/security/index.js.map +1 -1
- package/dist/skills/index.js +7 -1
- package/dist/skills/index.js.map +1 -1
- package/dist/storage/index.d.ts +2 -2
- package/dist/storage/index.js +1 -3
- package/dist/storage/index.js.map +1 -1
- package/dist/types/index.js +22 -3
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +40 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/{wstack-paths-gCrJ631C.d.ts → wstack-paths-Bxik3CsK.d.ts} +2 -0
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ import { J as JournalEntry } from '../goal-store-C7jcumEh.js';
|
|
|
11
11
|
import { A as AgentFactory } from '../agent-subagent-runner-Cav3yEJM.js';
|
|
12
12
|
import { f as DispatchClassifier, d as DefaultMultiAgentCoordinator } from '../multi-agent-coordinator-IQKrMfXz.js';
|
|
13
13
|
import { a as SkillLoader, b as SkillManifest, S as SkillEntry } from '../skill-CxuWrsKK.js';
|
|
14
|
-
import { a as WstackPaths } from '../wstack-paths-
|
|
14
|
+
import { a as WstackPaths } from '../wstack-paths-Bxik3CsK.js';
|
|
15
15
|
import '../retry-policy-OwtKNxo8.js';
|
|
16
16
|
import '../models-registry-BcYJDKLm.js';
|
|
17
17
|
import '../logger-DDd5C--Z.js';
|
|
@@ -204,10 +204,16 @@ declare class AutoCompactionMiddleware {
|
|
|
204
204
|
private readonly failureMode;
|
|
205
205
|
private readonly policyProvider?;
|
|
206
206
|
/**
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
207
|
+
* Calibration factor applied to the estimator output. The estimator is now
|
|
208
|
+
* expected to already include messages + system prompt + tool definitions
|
|
209
|
+
* (see `estimateRequestTokens.total`), so no overhead boost is needed. Kept
|
|
210
|
+
* as a constant so a future calibration against real provider tokenization
|
|
211
|
+
* (BPE vs the chars/3.5 rough estimator) can dial this without touching the
|
|
212
|
+
* threshold-check math.
|
|
213
|
+
*
|
|
214
|
+
* Historical note: was 1.3 when the estimator only counted messages — that
|
|
215
|
+
* double-counted system+tools once the estimator was upgraded, firing
|
|
216
|
+
* compaction ~30% earlier than intended (e.g. real 56% load showed as 73%).
|
|
211
217
|
*/
|
|
212
218
|
private static readonly OVERHEAD_FACTOR;
|
|
213
219
|
/**
|
package/dist/execution/index.js
CHANGED
|
@@ -1019,12 +1019,18 @@ var AutoCompactionMiddleware = class _AutoCompactionMiddleware {
|
|
|
1019
1019
|
failureMode;
|
|
1020
1020
|
policyProvider;
|
|
1021
1021
|
/**
|
|
1022
|
-
*
|
|
1023
|
-
*
|
|
1024
|
-
*
|
|
1025
|
-
*
|
|
1022
|
+
* Calibration factor applied to the estimator output. The estimator is now
|
|
1023
|
+
* expected to already include messages + system prompt + tool definitions
|
|
1024
|
+
* (see `estimateRequestTokens.total`), so no overhead boost is needed. Kept
|
|
1025
|
+
* as a constant so a future calibration against real provider tokenization
|
|
1026
|
+
* (BPE vs the chars/3.5 rough estimator) can dial this without touching the
|
|
1027
|
+
* threshold-check math.
|
|
1028
|
+
*
|
|
1029
|
+
* Historical note: was 1.3 when the estimator only counted messages — that
|
|
1030
|
+
* double-counted system+tools once the estimator was upgraded, firing
|
|
1031
|
+
* compaction ~30% earlier than intended (e.g. real 56% load showed as 73%).
|
|
1026
1032
|
*/
|
|
1027
|
-
static OVERHEAD_FACTOR = 1
|
|
1033
|
+
static OVERHEAD_FACTOR = 1;
|
|
1028
1034
|
/**
|
|
1029
1035
|
* Once a compaction attempt reduces nothing (preserveK protects everything,
|
|
1030
1036
|
* no oversized tool_results remain to elide), retrying on every iteration
|
|
@@ -1234,7 +1240,7 @@ var ToolExecutor = class {
|
|
|
1234
1240
|
return { result, tool, durationMs: Date.now() - start };
|
|
1235
1241
|
}
|
|
1236
1242
|
if (hasMalformedArguments(use.input)) {
|
|
1237
|
-
const result = this.malformedInputResult(use);
|
|
1243
|
+
const result = this.malformedInputResult(use, extractMalformedRaw(use.input));
|
|
1238
1244
|
budget = this.decrementBudget(result, budget);
|
|
1239
1245
|
return { result, tool, durationMs: Date.now() - start };
|
|
1240
1246
|
}
|
|
@@ -1441,11 +1447,18 @@ var ToolExecutor = class {
|
|
|
1441
1447
|
is_error: true
|
|
1442
1448
|
};
|
|
1443
1449
|
}
|
|
1444
|
-
malformedInputResult(use) {
|
|
1450
|
+
malformedInputResult(use, raw) {
|
|
1451
|
+
let content = `Tool "${use.name}" received arguments that were not a valid JSON object, so they could not be parsed. Re-issue the call with the arguments encoded as a single well-formed JSON object matching the tool's input schema.`;
|
|
1452
|
+
if (raw) {
|
|
1453
|
+
const max = 800;
|
|
1454
|
+
const excerpt = raw.length > max ? `${raw.slice(0, max)}\u2026 (truncated, ${raw.length} chars total)` : raw;
|
|
1455
|
+
content += ` Common cause: a string field (e.g. code in old_string/new_string) contains literal newlines, quotes, or backslashes that must be JSON-escaped, or the payload was cut off mid-stream. The raw arguments received were:
|
|
1456
|
+
${excerpt}`;
|
|
1457
|
+
}
|
|
1445
1458
|
return {
|
|
1446
1459
|
type: "tool_result",
|
|
1447
1460
|
tool_use_id: use.id,
|
|
1448
|
-
content
|
|
1461
|
+
content,
|
|
1449
1462
|
is_error: true
|
|
1450
1463
|
};
|
|
1451
1464
|
}
|
|
@@ -1501,6 +1514,18 @@ function hasMalformedArguments(input) {
|
|
|
1501
1514
|
const keys = Object.keys(obj);
|
|
1502
1515
|
return keys.length === 1 && MALFORMED_ARG_MARKERS.includes(keys[0]);
|
|
1503
1516
|
}
|
|
1517
|
+
function extractMalformedRaw(input) {
|
|
1518
|
+
if (!hasMalformedArguments(input)) return void 0;
|
|
1519
|
+
const obj = input;
|
|
1520
|
+
const value = obj[Object.keys(obj)[0]];
|
|
1521
|
+
if (value === void 0 || value === null) return void 0;
|
|
1522
|
+
if (typeof value === "string") return value;
|
|
1523
|
+
try {
|
|
1524
|
+
return JSON.stringify(value);
|
|
1525
|
+
} catch {
|
|
1526
|
+
return String(value);
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1504
1529
|
|
|
1505
1530
|
// src/utils/regex-guard.ts
|
|
1506
1531
|
var MAX_PATTERN_LEN = 512;
|