@wrongstack/core 0.51.3 → 0.63.4
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-CjbD-i7-.d.ts → agent-bridge-B5rxWrg3.d.ts} +1 -1
- package/dist/{agent-subagent-runner-DfvlBx5N.d.ts → agent-subagent-runner-Zc3f37Sg.d.ts} +3 -3
- package/dist/{compactor-D1RHFRmF.d.ts → compactor-0vjZ8KTk.d.ts} +1 -1
- package/dist/{config-ZRCf7sTu.d.ts → config-BdDuaZmB.d.ts} +143 -2
- package/dist/{context-7u93AcGD.d.ts → context-iFMEO2rN.d.ts} +9 -8
- package/dist/coordination/index.d.ts +12 -12
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +22 -22
- package/dist/defaults/index.js +285 -108
- package/dist/defaults/index.js.map +1 -1
- package/dist/{events-Bt44ikPN.d.ts → events-k8CHjcrN.d.ts} +20 -1
- package/dist/execution/index.d.ts +14 -14
- package/dist/execution/index.js +70 -10
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +7 -7
- package/dist/{goal-store-BeRsj7YX.d.ts → goal-store-iHltMi5n.d.ts} +1 -1
- package/dist/{index-mAWBdLyJ.d.ts → index-Bc6BiP5q.d.ts} +77 -6
- package/dist/{index-OzA1XjHL.d.ts → index-CWdW_CJt.d.ts} +10 -8
- package/dist/index.d.ts +58 -34
- package/dist/index.js +587 -100
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +6 -6
- package/dist/infrastructure/index.js +1 -1
- package/dist/infrastructure/index.js.map +1 -1
- package/dist/kernel/index.d.ts +9 -9
- package/dist/kernel/index.js +3 -1
- package/dist/kernel/index.js.map +1 -1
- package/dist/{mcp-servers-DONdo-XM.d.ts → mcp-servers-CwqQDMYy.d.ts} +3 -3
- package/dist/models/index.d.ts +3 -3
- package/dist/models/index.js +31 -16
- package/dist/models/index.js.map +1 -1
- package/dist/{models-registry-gwMAo6E3.d.ts → models-registry-Cuq1C8V9.d.ts} +7 -0
- package/dist/{multi-agent-Ba9Ni2hC.d.ts → multi-agent-SASYOrWA.d.ts} +2 -2
- package/dist/{multi-agent-coordinator-BuKq0q89.d.ts → multi-agent-coordinator-CNUJYq7U.d.ts} +2 -2
- package/dist/{null-fleet-bus-C0xd73YP.d.ts → null-fleet-bus-DRoJ0uOY.d.ts} +7 -7
- package/dist/observability/index.d.ts +2 -2
- package/dist/{path-resolver-nkmdiFgi.d.ts → path-resolver-C5sPVne8.d.ts} +2 -2
- package/dist/{permission-B6sldrSp.d.ts → permission-Ld-i5ugf.d.ts} +13 -1
- package/dist/{permission-policy-CtNscWOA.d.ts → permission-policy-CL-mPufp.d.ts} +14 -7
- package/dist/{plan-templates-BmDdJ7UL.d.ts → plan-templates-ThBHOjaM.d.ts} +4 -4
- package/dist/{provider-runner-BGro2qQB.d.ts → provider-runner-DJQa211J.d.ts} +3 -3
- package/dist/{retry-policy-KF18W4dg.d.ts → retry-policy-BfBScewS.d.ts} +1 -1
- package/dist/sdd/index.d.ts +9 -9
- package/dist/sdd/index.js +1 -1
- package/dist/sdd/index.js.map +1 -1
- package/dist/security/index.d.ts +3 -3
- package/dist/security/index.js +115 -13
- package/dist/security/index.js.map +1 -1
- package/dist/{selector-DmXxpFyM.d.ts → selector-DxhW7ML3.d.ts} +1 -1
- package/dist/{session-reader-bfgsy2a0.d.ts → session-reader-q2ThszgG.d.ts} +1 -1
- package/dist/storage/index.d.ts +6 -6
- package/dist/storage/index.js +57 -37
- package/dist/storage/index.js.map +1 -1
- package/dist/{system-prompt-CM6zOhd2.d.ts → system-prompt-7LHyBbIf.d.ts} +32 -2
- package/dist/{tool-executor-p4tP9tGF.d.ts → tool-executor-CIjpGaRA.d.ts} +5 -4
- package/dist/types/index.d.ts +15 -15
- package/dist/types/index.js +93 -22
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +14 -2
- package/dist/utils/index.js +18 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as Usage, d as Context, X as ToolProgressEvent, Q as Tool } from './context-
|
|
1
|
+
import { $ as Usage, d as Context, X as ToolProgressEvent, Q as Tool } from './context-iFMEO2rN.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Brain coordination primitives.
|
|
@@ -210,6 +210,25 @@ interface EventMap {
|
|
|
210
210
|
description: string;
|
|
211
211
|
retryable: boolean;
|
|
212
212
|
};
|
|
213
|
+
/**
|
|
214
|
+
* Fired by the fallback-model extension when the primary model is overloaded
|
|
215
|
+
* (after its own retries are exhausted) and the agent switches to the next
|
|
216
|
+
* model in the configured `fallbackModels` chain. `providerSwitched` is true
|
|
217
|
+
* when the fallback also changed the active provider (cross-provider). UIs
|
|
218
|
+
* render this as a notice: "⚠ opus overloaded — falling back to sonnet".
|
|
219
|
+
*/
|
|
220
|
+
'provider.fallback': {
|
|
221
|
+
from: {
|
|
222
|
+
providerId: string;
|
|
223
|
+
model: string;
|
|
224
|
+
};
|
|
225
|
+
to: {
|
|
226
|
+
providerId: string;
|
|
227
|
+
model: string;
|
|
228
|
+
};
|
|
229
|
+
status: number;
|
|
230
|
+
providerSwitched: boolean;
|
|
231
|
+
};
|
|
213
232
|
'tool.started': {
|
|
214
233
|
name: string;
|
|
215
234
|
id: string;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-
|
|
2
|
-
import { m as Provider, d as Context } from '../context-
|
|
3
|
-
import { a as Compactor, C as CompactReport } from '../compactor-
|
|
4
|
-
import { M as MessageSelector } from '../selector-
|
|
5
|
-
import { E as EventBus } from '../events-
|
|
6
|
-
import { b as MiddlewareHandler } from '../system-prompt-
|
|
7
|
-
import { a as SessionEventBridge, J as JournalEntry } from '../goal-store-
|
|
8
|
-
import { e as ContextWindowAggressiveOn, i as ContextWindowPolicy } from '../config-
|
|
9
|
-
import { c as Agent, R as RunResult,
|
|
10
|
-
import { D as DoneCondition } from '../multi-agent-
|
|
11
|
-
import { A as AgentFactory } from '../agent-subagent-runner-
|
|
12
|
-
import { f as DispatchClassifier, d as DefaultMultiAgentCoordinator } from '../multi-agent-coordinator-
|
|
1
|
+
export { C as CompactorOptions, a as DefaultErrorHandler, b as DefaultRetryPolicy, H as HybridCompactor, T as ToolExecutor } from '../tool-executor-CIjpGaRA.js';
|
|
2
|
+
import { m as Provider, d as Context } from '../context-iFMEO2rN.js';
|
|
3
|
+
import { a as Compactor, C as CompactReport } from '../compactor-0vjZ8KTk.js';
|
|
4
|
+
import { M as MessageSelector } from '../selector-DxhW7ML3.js';
|
|
5
|
+
import { E as EventBus } from '../events-k8CHjcrN.js';
|
|
6
|
+
import { b as MiddlewareHandler } from '../system-prompt-7LHyBbIf.js';
|
|
7
|
+
import { a as SessionEventBridge, J as JournalEntry } from '../goal-store-iHltMi5n.js';
|
|
8
|
+
import { e as ContextWindowAggressiveOn, i as ContextWindowPolicy } from '../config-BdDuaZmB.js';
|
|
9
|
+
import { c as Agent, R as RunResult, C as SystemPromptContributor } from '../index-Bc6BiP5q.js';
|
|
10
|
+
import { D as DoneCondition } from '../multi-agent-SASYOrWA.js';
|
|
11
|
+
import { A as AgentFactory } from '../agent-subagent-runner-Zc3f37Sg.js';
|
|
12
|
+
import { f as DispatchClassifier, d as DefaultMultiAgentCoordinator } from '../multi-agent-coordinator-CNUJYq7U.js';
|
|
13
13
|
import { a as SkillLoader, b as SkillManifest, S as SkillEntry } from '../skill-CxuWrsKK.js';
|
|
14
14
|
import { a as WstackPaths } from '../wstack-paths-eMXnY1_X.js';
|
|
15
|
-
import '../retry-policy-
|
|
15
|
+
import '../retry-policy-BfBScewS.js';
|
|
16
16
|
import '../models-registry-BcYJDKLm.js';
|
|
17
17
|
import '../logger-DDd5C--Z.js';
|
|
18
18
|
import '../observability-BhnVLBLS.js';
|
|
19
19
|
import '../secret-scrubber-3MHDDAtm.js';
|
|
20
|
-
import '../permission-
|
|
20
|
+
import '../permission-Ld-i5ugf.js';
|
|
21
21
|
import 'node:events';
|
|
22
22
|
|
|
23
23
|
interface SkillLoaderOptions {
|
package/dist/execution/index.js
CHANGED
|
@@ -1466,8 +1466,9 @@ var ToolExecutor = class {
|
|
|
1466
1466
|
*/
|
|
1467
1467
|
async executeBatch(toolUses, ctx, strategy) {
|
|
1468
1468
|
let budget = this.opts.perIterationOutputCapBytes ?? 1e5;
|
|
1469
|
-
const runOne = async (
|
|
1469
|
+
const runOne = async (use0) => {
|
|
1470
1470
|
const start = Date.now();
|
|
1471
|
+
let use = use0;
|
|
1471
1472
|
const tool = this.registry.get(use.name);
|
|
1472
1473
|
if (!tool) {
|
|
1473
1474
|
const result = this.unknownToolResult(use, () => this.registry.list().map((t) => t.name));
|
|
@@ -1500,10 +1501,36 @@ Please call the tool again with arguments that match its inputSchema. You can us
|
|
|
1500
1501
|
budget = this.decrementBudget(result, budget);
|
|
1501
1502
|
return { result, tool, durationMs: Date.now() - start };
|
|
1502
1503
|
}
|
|
1504
|
+
if (this.opts.hookRunner?.has("PreToolUse")) {
|
|
1505
|
+
const pre = await this.opts.hookRunner.preToolUse(tool.name, use.input, ctx);
|
|
1506
|
+
if (pre.block) {
|
|
1507
|
+
const result = this.blockedByHookResult(use, pre.reason);
|
|
1508
|
+
budget = this.decrementBudget(result, budget);
|
|
1509
|
+
return { result, tool, durationMs: Date.now() - start };
|
|
1510
|
+
}
|
|
1511
|
+
if (pre.input) {
|
|
1512
|
+
const reval = validateAgainstSchema(pre.input, tool.inputSchema);
|
|
1513
|
+
if (!reval.ok) {
|
|
1514
|
+
const errorDetails = reval.errors.map((e) => ` - ${e.path || "input"}: ${e.message}`).join("\n");
|
|
1515
|
+
const result = {
|
|
1516
|
+
type: "tool_result",
|
|
1517
|
+
tool_use_id: use.id,
|
|
1518
|
+
content: `A PreToolUse hook rewrote the arguments for "${tool.name}" into an invalid shape.
|
|
1519
|
+
|
|
1520
|
+
Validation errors:
|
|
1521
|
+
${errorDetails}`,
|
|
1522
|
+
is_error: true
|
|
1523
|
+
};
|
|
1524
|
+
budget = this.decrementBudget(result, budget);
|
|
1525
|
+
return { result, tool, durationMs: Date.now() - start };
|
|
1526
|
+
}
|
|
1527
|
+
use = { ...use, input: pre.input };
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1503
1530
|
const decision = await this.opts.permissionPolicy.evaluate(tool, use.input, ctx);
|
|
1504
1531
|
let effectivePermission = decision.permission;
|
|
1505
1532
|
const policy = this.opts.permissionPolicy;
|
|
1506
|
-
const yolo = policy.getYolo?.() === true || policy.getForceAllYolo?.() === true;
|
|
1533
|
+
const yolo = policy.getYolo?.() === true || policy.getYoloDestructive?.() === true || policy.getForceAllYolo?.() === true;
|
|
1507
1534
|
if (toolDangerousCaps.length > 0 && effectivePermission === "auto" && !yolo) {
|
|
1508
1535
|
effectivePermission = "confirm";
|
|
1509
1536
|
}
|
|
@@ -1546,7 +1573,20 @@ Please call the tool again with arguments that match its inputSchema. You can us
|
|
|
1546
1573
|
"tool.has_dangerous_capabilities": toolCapsForAudit.length > 0
|
|
1547
1574
|
});
|
|
1548
1575
|
try {
|
|
1549
|
-
|
|
1576
|
+
let result = await this.executeTool(tool, use, ctx, budget);
|
|
1577
|
+
if (this.opts.hookRunner?.has("PostToolUse")) {
|
|
1578
|
+
const post = await this.opts.hookRunner.postToolUse(
|
|
1579
|
+
tool.name,
|
|
1580
|
+
use.input,
|
|
1581
|
+
{ content: String(result.content), isError: !!result.is_error },
|
|
1582
|
+
ctx
|
|
1583
|
+
);
|
|
1584
|
+
if (post.additionalContext) {
|
|
1585
|
+
result = { ...result, content: `${result.content}
|
|
1586
|
+
|
|
1587
|
+
${post.additionalContext}` };
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1550
1590
|
budget = this.decrementBudget(result, budget);
|
|
1551
1591
|
span?.setAttribute("tool.is_error", !!result.is_error);
|
|
1552
1592
|
span?.setAttribute(
|
|
@@ -1735,6 +1775,14 @@ ${excerpt}`;
|
|
|
1735
1775
|
is_error: true
|
|
1736
1776
|
};
|
|
1737
1777
|
}
|
|
1778
|
+
blockedByHookResult(use, reason) {
|
|
1779
|
+
return {
|
|
1780
|
+
type: "tool_result",
|
|
1781
|
+
tool_use_id: use.id,
|
|
1782
|
+
content: `Tool "${use.name}" was blocked by a PreToolUse hook: ${reason ?? "no reason given"}`,
|
|
1783
|
+
is_error: true
|
|
1784
|
+
};
|
|
1785
|
+
}
|
|
1738
1786
|
decrementBudget(result, budget) {
|
|
1739
1787
|
const contentBytes = typeof result.content === "string" ? Buffer.byteLength(result.content, "utf8") : Buffer.byteLength(JSON.stringify(result.content), "utf8");
|
|
1740
1788
|
return Math.max(0, budget - contentBytes);
|
|
@@ -2544,7 +2592,8 @@ ${recentJournal}` : "No prior iterations.",
|
|
|
2544
2592
|
" \u2022 When this iteration's Task is finished (real artifact / passing",
|
|
2545
2593
|
" test / applied diff / clean output), emit `[done]` on its own line.",
|
|
2546
2594
|
" \u2022 Do not stop on the first obstacle \u2014 try at least 3 distinct",
|
|
2547
|
-
" approaches before giving up. YOLO is active
|
|
2595
|
+
" approaches before giving up. YOLO is active for normal project work;",
|
|
2596
|
+
" destructive-gated confirmations still belong to the permission flow.",
|
|
2548
2597
|
"",
|
|
2549
2598
|
"2. UPDATE TODO STATE (when Source is `todo`)",
|
|
2550
2599
|
" \u2022 Mark this todo `in_progress` via the todos tool before tool work.",
|
|
@@ -6634,7 +6683,8 @@ ${recentJournal}` : "No prior iterations.",
|
|
|
6634
6683
|
"\u2500\u2500 EXECUTION PROTOCOL \u2500\u2500",
|
|
6635
6684
|
"\u2022 Execute the assigned task end-to-end using multiple tool calls.",
|
|
6636
6685
|
"\u2022 Emit `[done]` on its own line when the task is complete.",
|
|
6637
|
-
"\u2022 Do not ask
|
|
6686
|
+
"\u2022 Do not ask before routine in-project tool use \u2014 YOLO is active for normal project work.",
|
|
6687
|
+
"\u2022 If a destructive-gated confirmation appears, wait for the permission flow.",
|
|
6638
6688
|
"\u2022 If the overall Mission is accomplished, emit `[GOAL_COMPLETE]` followed by a verification recipe.",
|
|
6639
6689
|
"\u2022 Keep output concise \u2014 summarize findings, do not transcribe files."
|
|
6640
6690
|
].join("\n");
|
|
@@ -6891,8 +6941,10 @@ ${journalTail.join("\n")}` : "Recent journal: (none \u2014 this is the first ite
|
|
|
6891
6941
|
" decide.",
|
|
6892
6942
|
"",
|
|
6893
6943
|
"### Operating principles",
|
|
6894
|
-
"- YOLO is active
|
|
6895
|
-
"
|
|
6944
|
+
"- YOLO is active for normal project work. Proceed with routine",
|
|
6945
|
+
" in-project tool use without pre-confirming; pick the best path and execute it.",
|
|
6946
|
+
" If the permission system raises a destructive-gated confirmation, wait",
|
|
6947
|
+
" for that flow instead of trying to bypass it.",
|
|
6896
6948
|
"- Use tools freely; multiple calls per turn are normal and expected.",
|
|
6897
6949
|
"- When working on a todo, mark it `in_progress` via the todos tool",
|
|
6898
6950
|
" before tool work and `completed` (or `cancelled` with a reason)",
|
|
@@ -7016,7 +7068,7 @@ var DefaultRetryPolicy = class {
|
|
|
7016
7068
|
};
|
|
7017
7069
|
|
|
7018
7070
|
// src/execution/error-handler.ts
|
|
7019
|
-
var CONTEXT_OVERFLOW_RE = /context|too long|tokens/i;
|
|
7071
|
+
var CONTEXT_OVERFLOW_RE = /context|too long|tokens|exceeds the context window|context window/i;
|
|
7020
7072
|
function buildRecoveryStrategies(opts) {
|
|
7021
7073
|
return [
|
|
7022
7074
|
{
|
|
@@ -7024,7 +7076,7 @@ function buildRecoveryStrategies(opts) {
|
|
|
7024
7076
|
compactor: opts?.compactor,
|
|
7025
7077
|
async attempt(err, ctx) {
|
|
7026
7078
|
if (!(err instanceof ProviderError)) return null;
|
|
7027
|
-
if (err.status !== 413 && !
|
|
7079
|
+
if (err.status !== 413 && !isContextOverflowError(err)) return null;
|
|
7028
7080
|
if (this.compactor) {
|
|
7029
7081
|
try {
|
|
7030
7082
|
const report = await this.compactor.compact(ctx, { aggressive: true });
|
|
@@ -7058,6 +7110,14 @@ function buildRecoveryStrategies(opts) {
|
|
|
7058
7110
|
];
|
|
7059
7111
|
}
|
|
7060
7112
|
var DEFAULT_RECOVERY_STRATEGIES = buildRecoveryStrategies();
|
|
7113
|
+
function isContextOverflowError(err) {
|
|
7114
|
+
return CONTEXT_OVERFLOW_RE.test([
|
|
7115
|
+
err.message,
|
|
7116
|
+
err.body?.message,
|
|
7117
|
+
err.body?.type,
|
|
7118
|
+
err.body?.raw
|
|
7119
|
+
].filter(Boolean).join("\n"));
|
|
7120
|
+
}
|
|
7061
7121
|
var DefaultErrorHandler = class {
|
|
7062
7122
|
strategies;
|
|
7063
7123
|
constructor(strategies = DEFAULT_RECOVERY_STRATEGIES) {
|
|
@@ -7074,7 +7134,7 @@ var DefaultErrorHandler = class {
|
|
|
7074
7134
|
if (err.status === 429) return { kind: "rate_limit", retryable: true };
|
|
7075
7135
|
if (err.status === 529) return { kind: "overloaded", retryable: true };
|
|
7076
7136
|
if (err.status >= 500) return { kind: "server", retryable: true };
|
|
7077
|
-
if (err.status === 413 ||
|
|
7137
|
+
if (err.status === 413 || isContextOverflowError(err)) {
|
|
7078
7138
|
return { kind: "context_overflow", retryable: false };
|
|
7079
7139
|
}
|
|
7080
7140
|
if (err.status >= 400) return { kind: "client", retryable: false };
|