@wrongstack/core 0.89.1 → 0.89.3
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-B8F2ORwg.d.ts → agent-bridge-DbVe1dHT.d.ts} +1 -1
- package/dist/{agent-subagent-runner-CQaLFNnA.d.ts → agent-subagent-runner-C6eqID1t.d.ts} +433 -433
- package/dist/{events-DzyLtja6.d.ts → brain-s9DyD_Vf.d.ts} +179 -92
- package/dist/{compactor-CJq7LQev.d.ts → compactor-DXLxLcmU.d.ts} +2 -2
- package/dist/{config-_DZ7dN-T.d.ts → config-84VaZpH6.d.ts} +45 -38
- package/dist/{context-ToHAp4-U.d.ts → context-CNRYfhUv.d.ts} +1 -1
- package/dist/coordination/index.d.ts +16 -17
- package/dist/coordination/index.js +25 -37
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +31 -33
- package/dist/defaults/index.js +476 -206
- package/dist/defaults/index.js.map +1 -1
- package/dist/{director-state-CgIc30qi.d.ts → director-state-BfeCUbmk.d.ts} +1 -1
- package/dist/execution/index.d.ts +18 -19
- package/dist/execution/index.js +23 -45
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +9 -10
- package/dist/extension/index.js +8 -6
- package/dist/extension/index.js.map +1 -1
- package/dist/{index-Ca_lOmKl.d.ts → index-CqrroYcU.d.ts} +13 -15
- package/dist/{index-Dx-CnrDN.d.ts → index-D3Nax3YU.d.ts} +9 -10
- package/dist/index.d.ts +184 -174
- package/dist/index.js +973 -349
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +9 -9
- package/dist/infrastructure/index.js +4 -2
- package/dist/infrastructure/index.js.map +1 -1
- package/dist/kernel/index.d.ts +14 -16
- package/dist/kernel/index.js.map +1 -1
- package/dist/{logger-B72yyPc6.d.ts → logger-B63L5bTg.d.ts} +1 -1
- package/dist/{logger-C_27pj9i.d.ts → logger-B9J5puGM.d.ts} +1 -1
- package/dist/{mcp-servers-Dck3T85_.d.ts → mcp-servers-D3E5ixAR.d.ts} +3 -3
- package/dist/{mode-CHo2XtHs.d.ts → mode-ARA3HrkY.d.ts} +1 -1
- package/dist/models/index.d.ts +5 -5
- package/dist/models/index.js +8 -6
- package/dist/models/index.js.map +1 -1
- package/dist/{models-registry-Be3osGt5.d.ts → models-registry-B6_KfS65.d.ts} +1 -1
- package/dist/{models-registry-Boz639EI.d.ts → models-registry-DU64QxQa.d.ts} +1 -1
- package/dist/{multi-agent-coordinator-Da9nd8Ic.d.ts → multi-agent-coordinator-DHNrjPaA.d.ts} +2 -2
- package/dist/{null-fleet-bus-CHJOXv3t.d.ts → null-fleet-bus-BzzciAc4.d.ts} +32 -31
- package/dist/observability/index.d.ts +3 -3
- package/dist/{observability-CoSNZdhX.d.ts → observability-D-HZN_mF.d.ts} +1 -1
- package/dist/{parallel-eternal-engine-DyMCj2Pw.d.ts → parallel-eternal-engine-CTpcrb9O.d.ts} +33 -33
- package/dist/{path-resolver-TjBlRKyH.d.ts → path-resolver-B7hgMAVe.d.ts} +3 -3
- package/dist/{permission-14CChMmO.d.ts → permission-BDv7z0mk.d.ts} +7 -2
- package/dist/{permission-policy-gW5htOo1.d.ts → permission-policy-dF74EpDp.d.ts} +2 -2
- package/dist/{system-prompt-C0rLCeyn.d.ts → pipeline-C1Ad9OjI.d.ts} +73 -73
- package/dist/{plan-templates-D9UhwoGh.d.ts → plan-templates-CNphsz0n.d.ts} +79 -11
- package/dist/{provider-runner-BEPWwkxH.d.ts → provider-runner-cqvlB_oS.d.ts} +5 -5
- package/dist/{retry-policy-DSu6O6rD.d.ts → retry-policy-BcmuT_V0.d.ts} +2 -2
- package/dist/sdd/index.d.ts +12 -33
- package/dist/sdd/index.js +21 -31
- package/dist/sdd/index.js.map +1 -1
- package/dist/{secret-scrubber-yGBFQYju.d.ts → secret-vault-DrOhc2i5.d.ts} +7 -7
- package/dist/security/index.d.ts +4 -5
- package/dist/security/index.js +4 -2
- package/dist/security/index.js.map +1 -1
- package/dist/{selector-11-fm95U.d.ts → selector-C7wcdqMA.d.ts} +1 -1
- package/dist/{session-event-bridge-D0u-x576.d.ts → session-event-bridge-IVzs2GpE.d.ts} +1 -1
- package/dist/{session-reader-BQU-toaN.d.ts → session-reader-DDz1Ek4V.d.ts} +2 -2
- package/dist/{skill-BJeF2DwY.d.ts → skill-BJxzIyyN.d.ts} +1 -1
- package/dist/skills/index.d.ts +1 -1
- package/dist/skills/index.js +3 -9
- package/dist/skills/index.js.map +1 -1
- package/dist/storage/index.d.ts +132 -12
- package/dist/storage/index.js +834 -159
- package/dist/storage/index.js.map +1 -1
- package/dist/{task-graph-CikNdRTG.d.ts → task-graph-DJBqO0EY.d.ts} +1 -1
- package/dist/types/index.d.ts +25 -27
- package/dist/types/index.js +19 -31
- package/dist/types/index.js.map +1 -1
- package/dist/utils/expect-defined.d.ts +7 -0
- package/dist/utils/expect-defined.js +11 -0
- package/dist/utils/expect-defined.js.map +1 -0
- package/dist/utils/index.d.ts +6 -20
- package/dist/utils/index.js +11 -41
- package/dist/utils/index.js.map +1 -1
- package/dist/{wstack-paths-BQMvEllz.d.ts → wstack-paths-_lqjzErq.d.ts} +1 -1
- package/package.json +5 -1
- package/dist/memory-CEXuo7sz.d.ts +0 -16
- package/dist/secret-scrubber-3MHDDAtm.d.ts +0 -6
|
@@ -105,4 +105,4 @@ declare class DirectorStateCheckpoint {
|
|
|
105
105
|
private persist;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
export {
|
|
108
|
+
export { type DirectorStateSnapshot as D, DirectorStateCheckpoint as a, type DirectorSubagentState as b, type DirectorTaskState as c, loadDirectorState as l };
|
|
@@ -1,24 +1,23 @@
|
|
|
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
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { M as MessageSelector } from '../selector-
|
|
5
|
-
import { E as EventBus } from '../
|
|
6
|
-
import {
|
|
7
|
-
import { a as SessionEventBridge } from '../session-event-bridge-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { R as RunResult, S as SystemPromptContributor } from '../index-
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import '../retry-policy-
|
|
14
|
-
import '../models-registry-
|
|
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-CTpcrb9O.js';
|
|
2
|
+
import { P as Provider, C as Context } from '../context-CNRYfhUv.js';
|
|
3
|
+
import { C as Compactor, a as CompactReport } from '../compactor-DXLxLcmU.js';
|
|
4
|
+
import { M as MessageSelector } from '../selector-C7wcdqMA.js';
|
|
5
|
+
import { E as EventBus } from '../brain-s9DyD_Vf.js';
|
|
6
|
+
import { d as MiddlewareHandler } from '../pipeline-C1Ad9OjI.js';
|
|
7
|
+
import { a as SessionEventBridge } from '../session-event-bridge-IVzs2GpE.js';
|
|
8
|
+
import { k as ContextWindowAggressiveOn, o as ContextWindowPolicy } from '../config-84VaZpH6.js';
|
|
9
|
+
import { g as Agent, O as DoneCondition } from '../agent-subagent-runner-C6eqID1t.js';
|
|
10
|
+
import { R as RunResult, S as SystemPromptContributor } from '../index-D3Nax3YU.js';
|
|
11
|
+
import { S as SkillLoader, b as SkillManifest, a as SkillEntry } from '../skill-BJxzIyyN.js';
|
|
12
|
+
import { W as WstackPaths } from '../wstack-paths-_lqjzErq.js';
|
|
13
|
+
import '../retry-policy-BcmuT_V0.js';
|
|
14
|
+
import '../models-registry-B6_KfS65.js';
|
|
15
15
|
import '../goal-store-DvWLNu52.js';
|
|
16
|
-
import '../multi-agent-coordinator-
|
|
16
|
+
import '../multi-agent-coordinator-DHNrjPaA.js';
|
|
17
17
|
import 'node:events';
|
|
18
|
-
import '../logger-
|
|
19
|
-
import '../observability-
|
|
20
|
-
import '../permission-
|
|
21
|
-
import '../secret-scrubber-3MHDDAtm.js';
|
|
18
|
+
import '../logger-B63L5bTg.js';
|
|
19
|
+
import '../observability-D-HZN_mF.js';
|
|
20
|
+
import '../permission-BDv7z0mk.js';
|
|
22
21
|
|
|
23
22
|
interface SkillLoaderOptions {
|
|
24
23
|
paths: WstackPaths;
|
package/dist/execution/index.js
CHANGED
|
@@ -6,13 +6,15 @@ import { randomUUID, createHash, randomBytes } from 'crypto';
|
|
|
6
6
|
import * as os from 'os';
|
|
7
7
|
import { EventEmitter } from 'events';
|
|
8
8
|
|
|
9
|
-
// src/utils/
|
|
10
|
-
function expectDefined(value) {
|
|
9
|
+
// src/utils/expect-defined.ts
|
|
10
|
+
function expectDefined(value, label) {
|
|
11
11
|
if (value === null || value === void 0) {
|
|
12
12
|
throw new Error("Expected value to be defined");
|
|
13
13
|
}
|
|
14
14
|
return value;
|
|
15
15
|
}
|
|
16
|
+
|
|
17
|
+
// src/utils/token-estimate.ts
|
|
16
18
|
var RoughTokenEstimate = (text, charsPerToken = 3.5) => Math.max(1, Math.ceil(text.length / charsPerToken));
|
|
17
19
|
var ESTIMATE_CACHE = /* @__PURE__ */ new Map();
|
|
18
20
|
var ESTIMATE_CACHE_MAX_SIZE = 1e4;
|
|
@@ -100,12 +102,6 @@ function estimateRequestTokensCalibrated(messages, systemPrompt, tools) {
|
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
// src/utils/message-invariants.ts
|
|
103
|
-
function expectDefined2(value) {
|
|
104
|
-
if (value === null || value === void 0) {
|
|
105
|
-
throw new Error("Expected value to be defined");
|
|
106
|
-
}
|
|
107
|
-
return value;
|
|
108
|
-
}
|
|
109
105
|
function repairToolUseAdjacency(messages) {
|
|
110
106
|
const removedToolUses = [];
|
|
111
107
|
const removedToolResults = [];
|
|
@@ -113,7 +109,7 @@ function repairToolUseAdjacency(messages) {
|
|
|
113
109
|
let changed = false;
|
|
114
110
|
const out = [];
|
|
115
111
|
for (let i = 0; i < messages.length; i++) {
|
|
116
|
-
const original =
|
|
112
|
+
const original = expectDefined(messages[i]);
|
|
117
113
|
let msg = original;
|
|
118
114
|
if (hasToolUse(msg)) {
|
|
119
115
|
const nextIds = toolResultIds(messages[i + 1]);
|
|
@@ -613,12 +609,6 @@ var IntelligentCompactor = class {
|
|
|
613
609
|
};
|
|
614
610
|
|
|
615
611
|
// src/models/llm-selector.ts
|
|
616
|
-
function expectDefined3(value) {
|
|
617
|
-
if (value === null || value === void 0) {
|
|
618
|
-
throw new Error("Expected value to be defined");
|
|
619
|
-
}
|
|
620
|
-
return value;
|
|
621
|
-
}
|
|
622
612
|
var DEFAULT_SYSTEM_PROMPT = `You are a context pruning assistant. Given a conversation history and a token budget, decide which message ranges are worth keeping verbatim and which should be collapsed into summaries.
|
|
623
613
|
|
|
624
614
|
Output a JSON object with this structure:
|
|
@@ -659,7 +649,7 @@ function formatMessages(messages, maxChars = 8e3) {
|
|
|
659
649
|
const lines = [];
|
|
660
650
|
let used = 0;
|
|
661
651
|
for (let i = 0; i < messages.length; i++) {
|
|
662
|
-
const m =
|
|
652
|
+
const m = expectDefined(messages[i]);
|
|
663
653
|
const role = m.role.padEnd(10, " ");
|
|
664
654
|
let text;
|
|
665
655
|
if (typeof m.content === "string") {
|
|
@@ -724,7 +714,7 @@ IMPORTANT: Total conversation (${totalTokens} tokens) exceeds budget (${effectiv
|
|
|
724
714
|
let tokenCount = 0;
|
|
725
715
|
let startIdx = 0;
|
|
726
716
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
727
|
-
const m =
|
|
717
|
+
const m = expectDefined(messages[i]);
|
|
728
718
|
const cost = typeof m.content === "string" ? Math.ceil(m.content.length / 4) : m.content.reduce(
|
|
729
719
|
(acc, b) => acc + (b.type === "text" ? Math.ceil(b.text.length / 4) : Math.ceil(JSON.stringify(b).length / 4)),
|
|
730
720
|
0
|
|
@@ -1457,12 +1447,6 @@ function createToolOutputSerializer(opts = {}) {
|
|
|
1457
1447
|
}
|
|
1458
1448
|
|
|
1459
1449
|
// src/execution/tool-executor.ts
|
|
1460
|
-
function expectDefined4(value) {
|
|
1461
|
-
if (value === null || value === void 0) {
|
|
1462
|
-
throw new Error("Expected value to be defined");
|
|
1463
|
-
}
|
|
1464
|
-
return value;
|
|
1465
|
-
}
|
|
1466
1450
|
var ToolExecutor = class {
|
|
1467
1451
|
constructor(registry, opts) {
|
|
1468
1452
|
this.registry = registry;
|
|
@@ -1869,7 +1853,7 @@ function hasMalformedArguments(input) {
|
|
|
1869
1853
|
function extractMalformedRaw(input) {
|
|
1870
1854
|
if (!hasMalformedArguments(input)) return void 0;
|
|
1871
1855
|
const obj = input;
|
|
1872
|
-
const value = obj[
|
|
1856
|
+
const value = obj[expectDefined(Object.keys(obj)[0])];
|
|
1873
1857
|
if (value === void 0 || value === null) return void 0;
|
|
1874
1858
|
if (typeof value === "string") return value;
|
|
1875
1859
|
try {
|
|
@@ -3123,15 +3107,7 @@ function makeAgentSubagentRunner(opts) {
|
|
|
3123
3107
|
let budgetError = null;
|
|
3124
3108
|
const onBudgetError = (err) => {
|
|
3125
3109
|
if (err instanceof BudgetThresholdSignal) {
|
|
3126
|
-
|
|
3127
|
-
if (decision === "stop") {
|
|
3128
|
-
budgetError = new BudgetExceededError(err.kind, err.limit, err.used);
|
|
3129
|
-
aborter.abort();
|
|
3130
|
-
}
|
|
3131
|
-
}).catch(() => {
|
|
3132
|
-
budgetError = new BudgetExceededError(err.kind, err.limit, err.used);
|
|
3133
|
-
aborter.abort();
|
|
3134
|
-
});
|
|
3110
|
+
budgetError = err;
|
|
3135
3111
|
return;
|
|
3136
3112
|
}
|
|
3137
3113
|
aborter.abort();
|
|
@@ -3239,15 +3215,23 @@ function makeAgentSubagentRunner(opts) {
|
|
|
3239
3215
|
}
|
|
3240
3216
|
if (budgetError) {
|
|
3241
3217
|
if ("decision" in budgetError) {
|
|
3242
|
-
|
|
3243
|
-
|
|
3218
|
+
try {
|
|
3219
|
+
const decision = await budgetError.decision;
|
|
3220
|
+
if (decision === "stop") {
|
|
3221
|
+
budgetError = new BudgetExceededError(
|
|
3222
|
+
budgetError.kind,
|
|
3223
|
+
budgetError.limit,
|
|
3224
|
+
budgetError.used
|
|
3225
|
+
);
|
|
3226
|
+
} else {
|
|
3227
|
+
budgetError = null;
|
|
3228
|
+
}
|
|
3229
|
+
} catch {
|
|
3244
3230
|
budgetError = new BudgetExceededError(
|
|
3245
3231
|
budgetError.kind,
|
|
3246
3232
|
budgetError.limit,
|
|
3247
3233
|
budgetError.used
|
|
3248
3234
|
);
|
|
3249
|
-
} else {
|
|
3250
|
-
budgetError = null;
|
|
3251
3235
|
}
|
|
3252
3236
|
}
|
|
3253
3237
|
if (budgetError) throw budgetError;
|
|
@@ -6557,12 +6541,6 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
6557
6541
|
};
|
|
6558
6542
|
|
|
6559
6543
|
// src/execution/parallel-eternal-engine.ts
|
|
6560
|
-
function expectDefined5(value) {
|
|
6561
|
-
if (value === null || value === void 0) {
|
|
6562
|
-
throw new Error("Expected value to be defined");
|
|
6563
|
-
}
|
|
6564
|
-
return value;
|
|
6565
|
-
}
|
|
6566
6544
|
var GOAL_COMPLETE_MARKER2 = /^\s*\[goal[_\s-]?complete\]\s*$/im;
|
|
6567
6545
|
var ParallelEternalEngine = class {
|
|
6568
6546
|
constructor(opts) {
|
|
@@ -6718,7 +6696,7 @@ var ParallelEternalEngine = class {
|
|
|
6718
6696
|
// Fan-out
|
|
6719
6697
|
// -------------------------------------------------------------------------
|
|
6720
6698
|
async fanOut(goal, tasks) {
|
|
6721
|
-
const coordinator =
|
|
6699
|
+
const coordinator = expectDefined(this.coordinator);
|
|
6722
6700
|
const slotCount = Math.min(this.slots, tasks.length);
|
|
6723
6701
|
const routes = this.dispatchEnabled ? await Promise.all(
|
|
6724
6702
|
tasks.slice(0, slotCount).map(
|
|
@@ -6750,7 +6728,7 @@ ${recentJournal}` : "No prior iterations.",
|
|
|
6750
6728
|
const routeInfo = [];
|
|
6751
6729
|
const spawnPromises = [];
|
|
6752
6730
|
for (let i = 0; i < slotCount; i++) {
|
|
6753
|
-
const task =
|
|
6731
|
+
const task = expectDefined(tasks[i]);
|
|
6754
6732
|
const route = routes[i] ?? null;
|
|
6755
6733
|
const subagentId = `parallel-${this.iterations}-${i}`;
|
|
6756
6734
|
const taskId = randomUUID();
|