@wrongstack/core 0.268.0 → 0.269.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/{agent-bridge-UhojbpWx.d.ts → agent-bridge-PcHQl_UQ.d.ts} +1 -1
- package/dist/{agent-subagent-runner-Bvtf1o9K.d.ts → agent-subagent-runner-SHJW7t8q.d.ts} +8 -8
- package/dist/{brain-69wzMKp1.d.ts → brain-BYcK__Ym.d.ts} +1 -1
- package/dist/{compactor-CBQAJoDc.d.ts → compactor-C2RKEBtC.d.ts} +1 -1
- package/dist/{config-VKfOZ-6X.d.ts → config-C_ae2k86.d.ts} +11 -2
- package/dist/{context-C0U8B9NF.d.ts → context-Dp87Bcaq.d.ts} +24 -1
- package/dist/coordination/index.d.ts +22 -16
- package/dist/coordination/index.js +233 -86
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +25 -25
- package/dist/defaults/index.js +272 -69
- package/dist/defaults/index.js.map +1 -1
- package/dist/execution/index.d.ts +15 -15
- package/dist/execution/index.js +116 -19
- package/dist/execution/index.js.map +1 -1
- package/dist/execution/prompt-enhancer.d.ts +1 -1
- package/dist/extension/index.d.ts +6 -6
- package/dist/{global-mailbox-KByEFFBa.d.ts → global-mailbox-Bvrz1P3f.d.ts} +2 -1
- package/dist/{goal-preamble-CrYjmdw4.d.ts → goal-preamble-CA_4yiGQ.d.ts} +9 -9
- package/dist/{goal-store-Y_zdLZ3q.d.ts → goal-store-DhuJoUNG.d.ts} +1 -1
- package/dist/hq/index.d.ts +15 -6
- package/dist/hq/index.js +55 -8
- package/dist/hq/index.js.map +1 -1
- package/dist/{index-CtQnmkaS.d.ts → index-CZQ6Pwbs.d.ts} +8 -8
- package/dist/{index-gCv830d7.d.ts → index-W4VJCzHa.d.ts} +5 -5
- package/dist/{index-BfaS-f_m.d.ts → index-whDfTANu.d.ts} +2 -2
- package/dist/index.d.ts +41 -41
- package/dist/index.js +531 -167
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +6 -6
- package/dist/infrastructure/index.js +3 -3
- package/dist/infrastructure/index.js.map +1 -1
- package/dist/kernel/index.d.ts +9 -9
- package/dist/{mcp-servers-HT3Fi7Bl.d.ts → mcp-servers-DJdZiRcv.d.ts} +3 -3
- package/dist/models/index.d.ts +5 -5
- package/dist/models/index.js +1 -1
- package/dist/models/index.js.map +1 -1
- package/dist/{models-registry-Bvcl3Vaa.d.ts → models-registry-C3a-2-Yd.d.ts} +1 -1
- package/dist/{multi-agent-coordinator-BACjsmkC.d.ts → multi-agent-coordinator-CJSpTe5O.d.ts} +1 -1
- package/dist/{null-fleet-bus-DA7fvhUg.d.ts → null-fleet-bus-QVshIsDx.d.ts} +6 -6
- package/dist/observability/index.d.ts +2 -2
- package/dist/{parallel-eternal-engine-Ci71gYu_.d.ts → parallel-eternal-engine-D9y5Pkcc.d.ts} +9 -9
- package/dist/{path-resolver-O1IJnmKE.d.ts → path-resolver-CnQ8SIfh.d.ts} +3 -3
- package/dist/{permission-Bd-57Lbl.d.ts → permission-CvYQNUqZ.d.ts} +1 -1
- package/dist/{permission-policy-uNXC6Kge.d.ts → permission-policy-D5Ss8j4B.d.ts} +2 -2
- package/dist/{pipeline-BDNvENyV.d.ts → pipeline-l_zzFRh3.d.ts} +2 -2
- package/dist/{plan-templates-EMsalEtN.d.ts → plan-templates-NtPgyeJA.d.ts} +6 -5
- package/dist/{provider-model-resolve-CEb9x886.d.ts → provider-model-resolve-d5poT5y0.d.ts} +3 -3
- package/dist/{provider-runner-DWJbpo70.d.ts → provider-runner-gkctlQV_.d.ts} +3 -3
- package/dist/{retry-policy-C3s_lvdK.d.ts → retry-policy-CtFhfwa8.d.ts} +1 -1
- package/dist/sdd/index.d.ts +8 -8
- package/dist/sdd/index.js +1 -1
- package/dist/sdd/index.js.map +1 -1
- package/dist/{secret-vault-Cgduf5xL.d.ts → secret-vault-BLsVmTIK.d.ts} +1 -1
- package/dist/security/index.d.ts +5 -5
- package/dist/security/index.js.map +1 -1
- package/dist/{selector-47LBnBVk.d.ts → selector-CXl2_y9W.d.ts} +1 -1
- package/dist/{session-event-bridge-Cw7oqmW2.d.ts → session-event-bridge-Ccud20CC.d.ts} +1 -1
- package/dist/{session-reader-DD4v2Obw.d.ts → session-reader-ZeXQmsmE.d.ts} +1 -1
- package/dist/skills/index.js.map +1 -1
- package/dist/storage/index.d.ts +13 -11
- package/dist/storage/index.js +210 -64
- package/dist/storage/index.js.map +1 -1
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/types/index.d.ts +21 -21
- package/dist/types/index.js +110 -19
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +58 -24
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/chimera/SKILL.md +1 -1
- package/skills/typescript-strict/SKILL.md +3 -3
- package/skills/typescript-strict/SKILL.save.md +1 -1
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, E as EternalAutonomyEngine, c as EternalAutonomyOptions, d as EternalEngineState, H as HybridCompactor, I as IterationStage, P as ParallelEngineState, e as ParallelEternalEngine, f as ParallelEternalOptions, g as ParallelIterationStage, T as ToolExecutor } from '../parallel-eternal-engine-
|
|
2
|
-
export { A as AutoCompactionMiddleware, a as AutonomousRunner, b as AutonomousRunnerOptions, c as AutonomyPromptContributorOptions, C as CompactorStrategy, l as ContextWindowBudgetSnapshot, D as DefaultSkillLoader, d as DoneCheckResult, e as DoneConditionChecker, I as IntelligentCompactor, f as IntelligentCompactorOptions, S as SelectiveCompactor, g as SelectiveCompactorOptions, h as SkillLoaderOptions, i as StrategyCompactorOptions, j as buildGoalPreamble, k as createStrategyCompactor, m as makeAutonomyPromptContributor } from '../goal-preamble-
|
|
3
|
-
import { P as Provider, l as ReasoningConfig, R as Request } from '../context-
|
|
4
|
-
import { e as BrainDecision, h as BrainDecisionRequest, B as BrainArbiter } from '../brain-
|
|
5
|
-
import {
|
|
6
|
-
import '../retry-policy-
|
|
7
|
-
import '../compactor-
|
|
8
|
-
import '../index-
|
|
1
|
+
export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, E as EternalAutonomyEngine, c as EternalAutonomyOptions, d as EternalEngineState, H as HybridCompactor, I as IterationStage, P as ParallelEngineState, e as ParallelEternalEngine, f as ParallelEternalOptions, g as ParallelIterationStage, T as ToolExecutor } from '../parallel-eternal-engine-D9y5Pkcc.js';
|
|
2
|
+
export { A as AutoCompactionMiddleware, a as AutonomousRunner, b as AutonomousRunnerOptions, c as AutonomyPromptContributorOptions, C as CompactorStrategy, l as ContextWindowBudgetSnapshot, D as DefaultSkillLoader, d as DoneCheckResult, e as DoneConditionChecker, I as IntelligentCompactor, f as IntelligentCompactorOptions, S as SelectiveCompactor, g as SelectiveCompactorOptions, h as SkillLoaderOptions, i as StrategyCompactorOptions, j as buildGoalPreamble, k as createStrategyCompactor, m as makeAutonomyPromptContributor } from '../goal-preamble-CA_4yiGQ.js';
|
|
3
|
+
import { P as Provider, l as ReasoningConfig, R as Request } from '../context-Dp87Bcaq.js';
|
|
4
|
+
import { e as BrainDecision, h as BrainDecisionRequest, B as BrainArbiter } from '../brain-BYcK__Ym.js';
|
|
5
|
+
import { G as ModelRuntimeConfig } from '../config-C_ae2k86.js';
|
|
6
|
+
import '../retry-policy-CtFhfwa8.js';
|
|
7
|
+
import '../compactor-C2RKEBtC.js';
|
|
8
|
+
import '../index-W4VJCzHa.js';
|
|
9
9
|
import '../logger-B63L5bTg.js';
|
|
10
|
-
import '../pipeline-
|
|
10
|
+
import '../pipeline-l_zzFRh3.js';
|
|
11
11
|
import '../mailbox-types-Ct2hJq0P.js';
|
|
12
12
|
import '../observability-D-HZN_mF.js';
|
|
13
|
-
import '../permission-
|
|
14
|
-
import '../agent-subagent-runner-
|
|
15
|
-
import '../goal-store-
|
|
16
|
-
import '../multi-agent-coordinator-
|
|
13
|
+
import '../permission-CvYQNUqZ.js';
|
|
14
|
+
import '../agent-subagent-runner-SHJW7t8q.js';
|
|
15
|
+
import '../goal-store-DhuJoUNG.js';
|
|
16
|
+
import '../multi-agent-coordinator-CJSpTe5O.js';
|
|
17
17
|
import 'node:events';
|
|
18
18
|
import '../skill-DGIXCtdv.js';
|
|
19
19
|
import '../wstack-paths-hOpNLmvf.js';
|
|
20
|
-
import '../selector-
|
|
21
|
-
import '../session-event-bridge-
|
|
20
|
+
import '../selector-CXl2_y9W.js';
|
|
21
|
+
import '../session-event-bridge-Ccud20CC.js';
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* AutonomyBrain — a self-driving decision layer for autonomous workflows.
|
package/dist/execution/index.js
CHANGED
|
@@ -89,8 +89,19 @@ function calState(key) {
|
|
|
89
89
|
return state;
|
|
90
90
|
}
|
|
91
91
|
var MIN_SAMPLES_FOR_CALIBRATION = 3;
|
|
92
|
+
var MODEL_FAMILY_RATIO = {
|
|
93
|
+
// Anthropic: ~3.8-4.0 chars/token depending on model
|
|
94
|
+
claude: 3.8,
|
|
95
|
+
// OpenAI: ~4.0 chars/token
|
|
96
|
+
"gpt-4": 4,
|
|
97
|
+
"gpt-3.5": 4,
|
|
98
|
+
// Google: ~3.5 chars/token
|
|
99
|
+
gemini: 3.5,
|
|
100
|
+
// DeepSeek: ~3.5 chars/token
|
|
101
|
+
deepseek: 3.5
|
|
102
|
+
};
|
|
92
103
|
var ESTIMATE_CACHE = /* @__PURE__ */ new Map();
|
|
93
|
-
var ESTIMATE_CACHE_MAX_SIZE =
|
|
104
|
+
var ESTIMATE_CACHE_MAX_SIZE = 5e4;
|
|
94
105
|
function getCachedEstimate(key, compute) {
|
|
95
106
|
const existing = ESTIMATE_CACHE.get(key);
|
|
96
107
|
if (existing !== void 0) return existing;
|
|
@@ -218,8 +229,24 @@ function estimateRequestTokensCalibrated(messages, systemPrompt, tools, calibrat
|
|
|
218
229
|
total: Math.round(result.total * safeRatio)
|
|
219
230
|
};
|
|
220
231
|
}
|
|
232
|
+
const fallbackRatio = getModelFamilyRatio(calibrationKey);
|
|
233
|
+
if (fallbackRatio !== null) {
|
|
234
|
+
return {
|
|
235
|
+
messages: Math.round(result.messages * fallbackRatio),
|
|
236
|
+
systemPrompt: Math.round(result.systemPrompt * fallbackRatio),
|
|
237
|
+
tools: Math.round(result.tools * fallbackRatio),
|
|
238
|
+
total: Math.round(result.total * fallbackRatio)
|
|
239
|
+
};
|
|
240
|
+
}
|
|
221
241
|
return result;
|
|
222
242
|
}
|
|
243
|
+
function getModelFamilyRatio(calibrationKey) {
|
|
244
|
+
const lower = calibrationKey.toLowerCase();
|
|
245
|
+
for (const [family, ratio] of Object.entries(MODEL_FAMILY_RATIO)) {
|
|
246
|
+
if (lower.includes(family)) return ratio / 3.5;
|
|
247
|
+
}
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
223
250
|
|
|
224
251
|
// src/utils/expect-defined.ts
|
|
225
252
|
function expectDefined(value, label) {
|
|
@@ -293,7 +320,7 @@ function hasToolResult(msg) {
|
|
|
293
320
|
}
|
|
294
321
|
function toolUseIds(msg) {
|
|
295
322
|
const ids = /* @__PURE__ */ new Set();
|
|
296
|
-
if (
|
|
323
|
+
if (msg?.role !== "assistant") return ids;
|
|
297
324
|
for (const block of contentBlocks(msg)) {
|
|
298
325
|
if (block.type === "tool_use") ids.add(block.id);
|
|
299
326
|
}
|
|
@@ -301,7 +328,7 @@ function toolUseIds(msg) {
|
|
|
301
328
|
}
|
|
302
329
|
function toolResultIds(msg) {
|
|
303
330
|
const ids = /* @__PURE__ */ new Set();
|
|
304
|
-
if (
|
|
331
|
+
if (msg?.role !== "user") return ids;
|
|
305
332
|
for (const block of contentBlocks(msg)) {
|
|
306
333
|
if (block.type === "tool_result") ids.add(block.tool_use_id);
|
|
307
334
|
}
|
|
@@ -1809,6 +1836,7 @@ var GREP_MATCHES_PER_FILE = 3;
|
|
|
1809
1836
|
var DIFF_INLINE_LINE_LIMIT = 260;
|
|
1810
1837
|
var DIFF_HUNK_LIMIT = 8;
|
|
1811
1838
|
var DIFF_HUNK_CONTEXT = 14;
|
|
1839
|
+
var GREP_LINE_RE = /^(.+?):(\d+):(.*)$/;
|
|
1812
1840
|
function createToolOutputSerializer(opts = {}) {
|
|
1813
1841
|
const capBytes = opts.perIterationOutputCapBytes ?? 1e5;
|
|
1814
1842
|
function serialize(value, context = {}) {
|
|
@@ -2194,7 +2222,7 @@ ${renderStringList(passthrough, "", 50)}`);
|
|
|
2194
2222
|
return sections.join("\n");
|
|
2195
2223
|
}
|
|
2196
2224
|
function parseGrepContentLine(line) {
|
|
2197
|
-
const match =
|
|
2225
|
+
const match = GREP_LINE_RE.exec(line);
|
|
2198
2226
|
if (!match?.[1] || !match[2]) return void 0;
|
|
2199
2227
|
return { file: match[1], line: match[2], text: match[3] ?? "" };
|
|
2200
2228
|
}
|
|
@@ -2212,22 +2240,20 @@ function compactDiff(diff) {
|
|
|
2212
2240
|
const hunks = lines.filter((line) => line.startsWith("@@")).length;
|
|
2213
2241
|
const added = lines.filter((line) => line.startsWith("+") && !line.startsWith("+++")).length;
|
|
2214
2242
|
const removed = lines.filter((line) => line.startsWith("-") && !line.startsWith("---")).length;
|
|
2215
|
-
const
|
|
2243
|
+
const intervals = [];
|
|
2216
2244
|
let hunkCount = 0;
|
|
2217
2245
|
for (let i = 0; i < lines.length; i++) {
|
|
2218
2246
|
const line = lines[i] ?? "";
|
|
2219
2247
|
if (line.startsWith("diff --git") || line.startsWith("--- ") || line.startsWith("+++ ")) {
|
|
2220
|
-
|
|
2248
|
+
intervals.push([i, i]);
|
|
2221
2249
|
continue;
|
|
2222
2250
|
}
|
|
2223
2251
|
if (!line.startsWith("@@")) continue;
|
|
2224
2252
|
if (hunkCount >= DIFF_HUNK_LIMIT) continue;
|
|
2225
2253
|
hunkCount++;
|
|
2226
|
-
|
|
2227
|
-
selected.add(j);
|
|
2228
|
-
}
|
|
2254
|
+
intervals.push([i, Math.min(lines.length - 1, i + DIFF_HUNK_CONTEXT)]);
|
|
2229
2255
|
}
|
|
2230
|
-
if (
|
|
2256
|
+
if (intervals.length === 0) {
|
|
2231
2257
|
return joinSections([
|
|
2232
2258
|
renderHeader("diff_summary", {
|
|
2233
2259
|
files: fileCount,
|
|
@@ -2240,17 +2266,29 @@ function compactDiff(diff) {
|
|
|
2240
2266
|
`[serializer omitted ${Math.max(0, lines.length - DIFF_INLINE_LINE_LIMIT)} diff line(s)]`
|
|
2241
2267
|
]);
|
|
2242
2268
|
}
|
|
2269
|
+
const merged = [intervals[0]];
|
|
2270
|
+
for (let i = 1; i < intervals.length; i++) {
|
|
2271
|
+
const last = merged[merged.length - 1];
|
|
2272
|
+
const current = intervals[i];
|
|
2273
|
+
if (current[0] <= last[1] + 1) {
|
|
2274
|
+
last[1] = Math.max(last[1], current[1]);
|
|
2275
|
+
} else {
|
|
2276
|
+
merged.push(current);
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2243
2279
|
const excerpt = [];
|
|
2244
|
-
let
|
|
2245
|
-
for (const
|
|
2246
|
-
if (
|
|
2247
|
-
const omitted =
|
|
2280
|
+
let prevLine = -1;
|
|
2281
|
+
for (const [start, end] of merged) {
|
|
2282
|
+
if (start > prevLine + 1) {
|
|
2283
|
+
const omitted = prevLine === -1 ? start : start - prevLine - 1;
|
|
2248
2284
|
excerpt.push(`[serializer omitted ${omitted} diff line(s)]`);
|
|
2249
2285
|
}
|
|
2250
|
-
|
|
2251
|
-
|
|
2286
|
+
for (let j = start; j <= end; j++) {
|
|
2287
|
+
excerpt.push(lines[j] ?? "");
|
|
2288
|
+
}
|
|
2289
|
+
prevLine = end;
|
|
2252
2290
|
}
|
|
2253
|
-
const trailing = lines.length -
|
|
2291
|
+
const trailing = lines.length - prevLine - 1;
|
|
2254
2292
|
if (trailing > 0) excerpt.push(`[serializer omitted ${trailing} trailing diff line(s)]`);
|
|
2255
2293
|
return joinSections([
|
|
2256
2294
|
renderHeader("diff_summary", {
|
|
@@ -3075,6 +3113,7 @@ ${post.additionalContext}`;
|
|
|
3075
3113
|
} catch (err) {
|
|
3076
3114
|
const msg = toErrorMessage(err);
|
|
3077
3115
|
const scrubbed = this.opts.secretScrubber.scrub(msg);
|
|
3116
|
+
const { category, retryable, detail } = classifyToolError(err);
|
|
3078
3117
|
this.opts.renderer?.writeToolResult(tool.name, scrubbed, true);
|
|
3079
3118
|
const result = {
|
|
3080
3119
|
type: "tool_result",
|
|
@@ -3085,6 +3124,9 @@ ${post.additionalContext}`;
|
|
|
3085
3124
|
budget = this.budgetForString(result.content, budget);
|
|
3086
3125
|
if (err instanceof Error) span?.recordError(err);
|
|
3087
3126
|
span?.setAttribute("tool.is_error", true);
|
|
3127
|
+
span?.setAttribute("tool.error_category", category);
|
|
3128
|
+
span?.setAttribute("tool.error_retryable", retryable);
|
|
3129
|
+
if (detail) span?.setAttribute("tool.error_detail", detail);
|
|
3088
3130
|
return { result, tool, durationMs: Date.now() - start };
|
|
3089
3131
|
} finally {
|
|
3090
3132
|
span?.end();
|
|
@@ -3096,6 +3138,9 @@ ${post.additionalContext}`;
|
|
|
3096
3138
|
} catch (err) {
|
|
3097
3139
|
const msg = toErrorMessage(err);
|
|
3098
3140
|
const scrubbed = this.opts.secretScrubber.scrub(msg);
|
|
3141
|
+
const { category, retryable, detail } = classifyToolError(err);
|
|
3142
|
+
const tool = this.registry.get(use.name);
|
|
3143
|
+
this.opts.renderer?.writeToolResult(tool?.name ?? use.name, scrubbed, true);
|
|
3099
3144
|
const result = {
|
|
3100
3145
|
type: "tool_result",
|
|
3101
3146
|
tool_use_id: use.id,
|
|
@@ -3103,7 +3148,7 @@ ${post.additionalContext}`;
|
|
|
3103
3148
|
is_error: true
|
|
3104
3149
|
};
|
|
3105
3150
|
budget = this.budgetForString(result.content, budget);
|
|
3106
|
-
return { result, tool
|
|
3151
|
+
return { result, tool, durationMs: 0 };
|
|
3107
3152
|
}
|
|
3108
3153
|
};
|
|
3109
3154
|
if (strategy === "sequential") {
|
|
@@ -3335,6 +3380,58 @@ function extractMalformedRaw(input) {
|
|
|
3335
3380
|
}
|
|
3336
3381
|
}
|
|
3337
3382
|
var TOOL_OUTPUT_ARTIFACT_THRESHOLD_BYTES = 64 * 1024;
|
|
3383
|
+
function classifyToolError(err) {
|
|
3384
|
+
if (err instanceof Error && err.name === "AbortError") {
|
|
3385
|
+
return { category: "fatal" /* FATAL */, retryable: false, detail: "aborted" };
|
|
3386
|
+
}
|
|
3387
|
+
if (err instanceof Error && "code" in err) {
|
|
3388
|
+
const code = err.code;
|
|
3389
|
+
switch (code) {
|
|
3390
|
+
case "ETIMEDOUT":
|
|
3391
|
+
case "ECONNRESET":
|
|
3392
|
+
case "ECONNREFUSED":
|
|
3393
|
+
case "ENETUNREACH":
|
|
3394
|
+
case "EHOSTUNREACH":
|
|
3395
|
+
return { category: "transient" /* TRANSIENT */, retryable: true, detail: code };
|
|
3396
|
+
case "ENOENT":
|
|
3397
|
+
case "ENOTDIR":
|
|
3398
|
+
return { category: "not_found" /* NOT_FOUND */, retryable: false, detail: code };
|
|
3399
|
+
case "EACCES":
|
|
3400
|
+
case "EPERM":
|
|
3401
|
+
return { category: "permission" /* PERMISSION */, retryable: false, detail: code };
|
|
3402
|
+
case "EBUSY":
|
|
3403
|
+
case "EMFILE":
|
|
3404
|
+
case "ENFILE":
|
|
3405
|
+
return { category: "transient" /* TRANSIENT */, retryable: true, detail: code };
|
|
3406
|
+
}
|
|
3407
|
+
}
|
|
3408
|
+
if (err instanceof Error && "response" in err) {
|
|
3409
|
+
const response = err.response;
|
|
3410
|
+
const status = response?.status;
|
|
3411
|
+
if (status !== void 0) {
|
|
3412
|
+
if (status === 429 || status === 503 || status === 502 || status === 504) {
|
|
3413
|
+
return { category: "transient" /* TRANSIENT */, retryable: true, detail: `HTTP ${status}` };
|
|
3414
|
+
}
|
|
3415
|
+
if (status === 404 || status === 410) {
|
|
3416
|
+
return { category: "not_found" /* NOT_FOUND */, retryable: false, detail: `HTTP ${status}` };
|
|
3417
|
+
}
|
|
3418
|
+
if (status === 401 || status === 403) {
|
|
3419
|
+
return { category: "permission" /* PERMISSION */, retryable: false, detail: `HTTP ${status}` };
|
|
3420
|
+
}
|
|
3421
|
+
if (status === 400) {
|
|
3422
|
+
return { category: "validation" /* VALIDATION */, retryable: false, detail: `HTTP ${status}` };
|
|
3423
|
+
}
|
|
3424
|
+
}
|
|
3425
|
+
}
|
|
3426
|
+
if (err instanceof Error && err.message.includes("validation")) {
|
|
3427
|
+
return { category: "validation" /* VALIDATION */, retryable: false, detail: "validation" };
|
|
3428
|
+
}
|
|
3429
|
+
return {
|
|
3430
|
+
category: "fatal" /* FATAL */,
|
|
3431
|
+
retryable: false,
|
|
3432
|
+
detail: err instanceof Error ? err.message.slice(0, 100) : String(err).slice(0, 100)
|
|
3433
|
+
};
|
|
3434
|
+
}
|
|
3338
3435
|
async function maybePersistLargeToolOutput(toolName, content, budget) {
|
|
3339
3436
|
const bytes = Buffer.byteLength(content, "utf8");
|
|
3340
3437
|
if (bytes <= Math.min(TOOL_OUTPUT_ARTIFACT_THRESHOLD_BYTES, Math.max(0, budget))) {
|
|
@@ -4844,7 +4941,7 @@ var SubagentBudget = class _SubagentBudget {
|
|
|
4844
4941
|
*/
|
|
4845
4942
|
_busRequestDecision(entry) {
|
|
4846
4943
|
const bus = this._events;
|
|
4847
|
-
if (!bus
|
|
4944
|
+
if (!bus?.hasListenerFor("budget.threshold_reached")) {
|
|
4848
4945
|
return Promise.resolve("stop");
|
|
4849
4946
|
}
|
|
4850
4947
|
return new Promise((resolve3) => {
|