@wrongstack/core 0.9.19 → 0.10.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/README.md +37 -33
- package/dist/{agent-bridge-DMVOX0cF.d.ts → agent-bridge-DBBGP5O4.d.ts} +1 -1
- package/dist/{agent-subagent-runner-C4qt9e5Y.d.ts → agent-subagent-runner-KwufTWwn.d.ts} +3 -4
- package/dist/compactor-D1RHFRmF.d.ts +41 -0
- package/dist/{config-CWva0qoL.d.ts → config-CJXBka2r.d.ts} +38 -2
- package/dist/{context-BRNbHmRM.d.ts → context-7u93AcGD.d.ts} +140 -0
- package/dist/coordination/index.d.ts +13 -13
- package/dist/coordination/index.js +786 -200
- package/dist/coordination/index.js.map +1 -1
- package/dist/{default-config-Uzla85H-.d.ts → default-config-DEXI4jsl.d.ts} +10 -1
- package/dist/defaults/index.d.ts +24 -24
- package/dist/defaults/index.js +1612 -528
- package/dist/defaults/index.js.map +1 -1
- package/dist/{events-CiG9qUM_.d.ts → events-Bw1K5E6K.d.ts} +49 -1
- package/dist/execution/index.d.ts +46 -32
- package/dist/execution/index.js +663 -169
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +6 -6
- package/dist/extension/index.js.map +1 -1
- package/dist/goal-store-BeRsj7YX.d.ts +188 -0
- package/dist/{index-p95HQ22A.d.ts → index-DIt5TIaF.d.ts} +8 -8
- package/dist/{index-aizK8olO.d.ts → index-DgQWnZxP.d.ts} +11 -8
- package/dist/index.d.ts +338 -41
- package/dist/index.js +2747 -787
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +6 -6
- package/dist/infrastructure/index.js +36 -0
- package/dist/infrastructure/index.js.map +1 -1
- package/dist/kernel/index.d.ts +9 -9
- package/dist/kernel/index.js +57 -8
- package/dist/kernel/index.js.map +1 -1
- package/dist/{mcp-servers-BkVEqkRe.d.ts → mcp-servers-BgINZzuo.d.ts} +25 -3
- package/dist/models/index.d.ts +3 -3
- package/dist/models/index.js +164 -11
- package/dist/models/index.js.map +1 -1
- package/dist/models-registry-gwMAo6E3.d.ts +86 -0
- package/dist/{multi-agent-3ZnTB1aT.d.ts → multi-agent-C1O8EFzb.d.ts} +77 -24
- package/dist/{multi-agent-coordinator-bRaI_aD1.d.ts → multi-agent-coordinator-DoVSBFNx.d.ts} +20 -2
- package/dist/{null-fleet-bus-DKM3Iy9d.d.ts → null-fleet-bus-T-s3JaOt.d.ts} +413 -110
- package/dist/observability/index.d.ts +2 -2
- package/dist/{path-resolver-TcJfc29Y.d.ts → path-resolver-BfyK-I7w.d.ts} +2 -2
- package/dist/{permission-bPuzAy4x.d.ts → permission-B6sldrSp.d.ts} +1 -1
- package/dist/{permission-policy-BUQSutpl.d.ts → permission-policy-CtNscWOA.d.ts} +10 -9
- package/dist/{plan-templates-fkQTyz3U.d.ts → plan-templates-BWs6Je7j.d.ts} +8 -8
- package/dist/{provider-runner-BEpikbbN.d.ts → provider-runner-BmPe2RuU.d.ts} +3 -3
- package/dist/{retry-policy-BYkq0ugs.d.ts → retry-policy-KF18W4dg.d.ts} +1 -1
- package/dist/sdd/index.d.ts +9 -10
- package/dist/sdd/index.js +350 -122
- package/dist/sdd/index.js.map +1 -1
- package/dist/security/index.d.ts +65 -4
- package/dist/security/index.js +67 -19
- package/dist/security/index.js.map +1 -1
- package/dist/{selector-pox8abg0.d.ts → selector-DmXxpFyM.d.ts} +1 -1
- package/dist/{session-reader-CSWcb5Ga.d.ts → session-reader-CCSBfQmd.d.ts} +2 -2
- package/dist/skills/index.d.ts +1 -1
- package/dist/skills/index.js +1 -1
- package/dist/skills/index.js.map +1 -1
- package/dist/storage/index.d.ts +392 -8
- package/dist/storage/index.js +796 -40
- package/dist/storage/index.js.map +1 -1
- package/dist/{system-prompt-Bs-Wliab.d.ts → system-prompt-CM6zOhd2.d.ts} +19 -1
- package/dist/{tool-executor-Boo3dekH.d.ts → tool-executor-D7RxLtg4.d.ts} +9 -4
- package/dist/types/index.d.ts +16 -16
- package/dist/types/index.js +404 -14
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +40 -8
- package/dist/utils/index.js +127 -57
- package/dist/utils/index.js.map +1 -1
- package/dist/{wstack-paths-BCgmTNlG.d.ts → wstack-paths-eMXnY1_X.d.ts} +8 -0
- package/package.json +1 -1
- package/dist/compactor-DVTKL7XD.d.ts +0 -23
- package/dist/goal-store-C7jcumEh.d.ts +0 -96
- package/dist/models-registry-OG_30xqZ.d.ts +0 -46
|
@@ -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-7u93AcGD.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* EventBus — observe-only typed event bus.
|
|
@@ -160,6 +160,20 @@ interface EventMap {
|
|
|
160
160
|
* for tools without a meaningful line count. */
|
|
161
161
|
outputLines?: number;
|
|
162
162
|
};
|
|
163
|
+
/**
|
|
164
|
+
* Fired on every `iteration.completed`. UIs subscribe to render a live
|
|
165
|
+
* context-window fill bar per agent (e.g. "67% ████████░░"). The
|
|
166
|
+
* `load` fraction matches the threshold levels: 0–0.6 green, 0.6–0.75
|
|
167
|
+
* yellow, 0.75+ red.
|
|
168
|
+
*/
|
|
169
|
+
'ctx.pct': {
|
|
170
|
+
/** Fraction of maxContext currently in use (0–1+. Can exceed 1 when over budget). */
|
|
171
|
+
load: number;
|
|
172
|
+
/** Estimated total tokens (system + tools + messages). */
|
|
173
|
+
tokens: number;
|
|
174
|
+
/** Provider's max context window. */
|
|
175
|
+
maxContext: number;
|
|
176
|
+
};
|
|
163
177
|
'token.threshold': {
|
|
164
178
|
used: number;
|
|
165
179
|
limit: number;
|
|
@@ -365,6 +379,18 @@ interface EventMap {
|
|
|
365
379
|
summary: string;
|
|
366
380
|
ok: boolean;
|
|
367
381
|
};
|
|
382
|
+
/**
|
|
383
|
+
* Fired by MultiAgentHost when a subagent's context window load changes.
|
|
384
|
+
* The leader agent's ctx.pct is emitted directly on the host EventBus;
|
|
385
|
+
* subagent ctx.pct events are forwarded here with subagentId attribution.
|
|
386
|
+
* TUI uses this to render live context fill bars per agent.
|
|
387
|
+
*/
|
|
388
|
+
'subagent.ctx_pct': {
|
|
389
|
+
subagentId: string;
|
|
390
|
+
load: number;
|
|
391
|
+
tokens: number;
|
|
392
|
+
maxContext: number;
|
|
393
|
+
};
|
|
368
394
|
'mcp.server.connected': {
|
|
369
395
|
name: string;
|
|
370
396
|
toolCount: number;
|
|
@@ -387,6 +413,21 @@ interface EventMap {
|
|
|
387
413
|
ts: string;
|
|
388
414
|
fileCount: number;
|
|
389
415
|
};
|
|
416
|
+
/**
|
|
417
|
+
* Fired by SessionWriter.writeInFlightMarker() — the agent loop has
|
|
418
|
+
* started a long-running operation. Pairs with `in_flight.ended`
|
|
419
|
+
* on clean shutdown. A marker with no end indicates a crash.
|
|
420
|
+
* (Idea #1 from IDEAS.md — Stateful Session Recovery.)
|
|
421
|
+
*/
|
|
422
|
+
'in_flight.started': {
|
|
423
|
+
context: string;
|
|
424
|
+
ts: string;
|
|
425
|
+
};
|
|
426
|
+
/** Fired by SessionWriter.clearInFlightMarker() — operation completed cleanly. */
|
|
427
|
+
'in_flight.ended': {
|
|
428
|
+
reason: 'clean' | 'aborted' | 'recovered';
|
|
429
|
+
ts: string;
|
|
430
|
+
};
|
|
390
431
|
/**
|
|
391
432
|
* Fired after a session rewind completes: files are reverted and the session
|
|
392
433
|
* history is truncated. The TUI listens to this to update its checkpoint
|
|
@@ -571,6 +612,13 @@ declare class ScopedEventBus extends EventBus {
|
|
|
571
612
|
* Uses EventBus's public API directly to avoid triggering our own `on()`
|
|
572
613
|
* override (which would consume a key slot for the wrapper, then orphan
|
|
573
614
|
* our registration entry under a different key).
|
|
615
|
+
*
|
|
616
|
+
* When the wrapper fires, it cleans up BOTH the underlying EventBus
|
|
617
|
+
* listener AND the tracking entry — so `scopedListenerCount` returns to
|
|
618
|
+
* its pre-`once()` value without requiring the caller to invoke the
|
|
619
|
+
* returned unsubscribe. The returned `unsub` is still safe to call
|
|
620
|
+
* after auto-removal (its delete is a no-op and its off() finds
|
|
621
|
+
* nothing to remove).
|
|
574
622
|
*/
|
|
575
623
|
once<E extends EventName>(event: E, fn: Listener<E>): () => void;
|
|
576
624
|
/**
|
|
@@ -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 {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
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-D7RxLtg4.js';
|
|
2
|
+
import { m as Provider, d as Context } from '../context-7u93AcGD.js';
|
|
3
|
+
import { a as Compactor, C as CompactReport } from '../compactor-D1RHFRmF.js';
|
|
4
|
+
import { M as MessageSelector } from '../selector-DmXxpFyM.js';
|
|
5
|
+
import { E as EventBus } from '../events-Bw1K5E6K.js';
|
|
6
|
+
import { b as MiddlewareHandler } from '../system-prompt-CM6zOhd2.js';
|
|
7
|
+
import { a as SessionEventBridge, J as JournalEntry } from '../goal-store-BeRsj7YX.js';
|
|
8
|
+
import { e as ContextWindowAggressiveOn, i as ContextWindowPolicy } from '../config-CJXBka2r.js';
|
|
9
|
+
import { c as Agent, R as RunResult, w as SystemPromptContributor } from '../index-DgQWnZxP.js';
|
|
10
|
+
import { D as DoneCondition } from '../multi-agent-C1O8EFzb.js';
|
|
11
|
+
import { A as AgentFactory } from '../agent-subagent-runner-KwufTWwn.js';
|
|
12
|
+
import { f as DispatchClassifier, d as DefaultMultiAgentCoordinator } from '../multi-agent-coordinator-DoVSBFNx.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-
|
|
15
|
-
import '../retry-policy-
|
|
14
|
+
import { a as WstackPaths } from '../wstack-paths-eMXnY1_X.js';
|
|
15
|
+
import '../retry-policy-KF18W4dg.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-B6sldrSp.js';
|
|
21
21
|
import 'node:events';
|
|
22
22
|
|
|
23
23
|
interface SkillLoaderOptions {
|
|
@@ -92,6 +92,11 @@ declare class IntelligentCompactor implements Compactor {
|
|
|
92
92
|
compact(ctx: Context, opts?: {
|
|
93
93
|
aggressive?: boolean;
|
|
94
94
|
}): Promise<CompactReport>;
|
|
95
|
+
/**
|
|
96
|
+
* Estimate the full API request token count: messages + systemPrompt + toolDefs.
|
|
97
|
+
* This is the accurate figure for context-window pressure monitoring.
|
|
98
|
+
*/
|
|
99
|
+
private estimateFullRequest;
|
|
95
100
|
private summarizeAncientTurns;
|
|
96
101
|
private findSafeBoundary;
|
|
97
102
|
private findExchangeStart;
|
|
@@ -154,6 +159,11 @@ declare class SelectiveCompactor implements Compactor {
|
|
|
154
159
|
compact(ctx: Context, opts?: {
|
|
155
160
|
aggressive?: boolean;
|
|
156
161
|
}): Promise<CompactReport>;
|
|
162
|
+
/**
|
|
163
|
+
* Estimate the full API request token count: messages + systemPrompt + toolDefs.
|
|
164
|
+
* This is the accurate figure for context-window pressure monitoring.
|
|
165
|
+
*/
|
|
166
|
+
private estimateFullRequest;
|
|
157
167
|
private repairProtocolAdjacency;
|
|
158
168
|
/**
|
|
159
169
|
* Run the LLM selector to decide what to keep vs collapse.
|
|
@@ -185,16 +195,23 @@ interface AutoCompactionOptions {
|
|
|
185
195
|
events?: EventBus;
|
|
186
196
|
failureMode?: CompactionFailureMode;
|
|
187
197
|
policyProvider?: (ctx: Context) => Pick<ContextWindowPolicy, 'thresholds' | 'aggressiveOn'> | null | undefined;
|
|
198
|
+
/** Optional bridge for writing compaction events into the persistent session log. */
|
|
199
|
+
sessionBridge?: SessionEventBridge;
|
|
188
200
|
}
|
|
189
201
|
/**
|
|
190
202
|
* Pipeline middleware that monitors context token load and automatically
|
|
191
203
|
* triggers compaction when the warn/soft/hard thresholds are crossed.
|
|
192
204
|
* Runs before the next agent iteration.
|
|
205
|
+
*
|
|
206
|
+
* Uses `estimateRequestTokens` for accurate full-request token counting:
|
|
207
|
+
* messages + systemPrompt + toolDefs. This replaces the previous pattern
|
|
208
|
+
* of applying an OVERHEAD_FACTOR to a messages-only estimate.
|
|
193
209
|
*/
|
|
194
210
|
declare class AutoCompactionMiddleware {
|
|
195
211
|
readonly name = "AutoCompaction";
|
|
196
212
|
private readonly compactor;
|
|
197
|
-
|
|
213
|
+
/** Deprecated. Kept for backward compat with tests that pass simpleEstimator. */
|
|
214
|
+
private readonly _estimator?;
|
|
198
215
|
private readonly warnThreshold;
|
|
199
216
|
private readonly softThreshold;
|
|
200
217
|
private readonly hardThreshold;
|
|
@@ -204,19 +221,7 @@ declare class AutoCompactionMiddleware {
|
|
|
204
221
|
private readonly events?;
|
|
205
222
|
private readonly failureMode;
|
|
206
223
|
private readonly policyProvider?;
|
|
207
|
-
|
|
208
|
-
* Calibration factor applied to the estimator output. The estimator is now
|
|
209
|
-
* expected to already include messages + system prompt + tool definitions
|
|
210
|
-
* (see `estimateRequestTokens.total`), so no overhead boost is needed. Kept
|
|
211
|
-
* as a constant so a future calibration against real provider tokenization
|
|
212
|
-
* (BPE vs the chars/3.5 rough estimator) can dial this without touching the
|
|
213
|
-
* threshold-check math.
|
|
214
|
-
*
|
|
215
|
-
* Historical note: was 1.3 when the estimator only counted messages — that
|
|
216
|
-
* double-counted system+tools once the estimator was upgraded, firing
|
|
217
|
-
* compaction ~30% earlier than intended (e.g. real 56% load showed as 73%).
|
|
218
|
-
*/
|
|
219
|
-
private static readonly OVERHEAD_FACTOR;
|
|
224
|
+
private readonly sessionBridge?;
|
|
220
225
|
/**
|
|
221
226
|
* Once a compaction attempt reduces nothing (preserveK protects everything,
|
|
222
227
|
* no oversized tool_results remain to elide), retrying on every iteration
|
|
@@ -229,8 +234,11 @@ declare class AutoCompactionMiddleware {
|
|
|
229
234
|
private lastNoopAttempt;
|
|
230
235
|
/**
|
|
231
236
|
* @param compactor Compactor to use for compaction.
|
|
232
|
-
* @param maxContext
|
|
233
|
-
* @param
|
|
237
|
+
* @param maxContext Provider's max context window in tokens.
|
|
238
|
+
* @param _estimator Deprecated parameter kept for backward compatibility.
|
|
239
|
+
* The middleware now uses `estimateRequestTokens` internally
|
|
240
|
+
* for accurate full-request token counting (messages +
|
|
241
|
+
* systemPrompt + toolDefs).
|
|
234
242
|
* @param thresholds Threshold fractions (0-1) of maxContext.
|
|
235
243
|
* @param opts Optional behavior. By default, failures at the
|
|
236
244
|
* hard threshold throw AGENT_CONTEXT_OVERFLOW so
|
|
@@ -238,7 +246,7 @@ declare class AutoCompactionMiddleware {
|
|
|
238
246
|
* provider context overflow. Warn/soft failures
|
|
239
247
|
* still emit compaction.failed and continue.
|
|
240
248
|
*/
|
|
241
|
-
constructor(compactor: Compactor, maxContext: number,
|
|
249
|
+
constructor(compactor: Compactor, maxContext: number, _estimator: (ctx: Context) => number, thresholds: {
|
|
242
250
|
warn: number;
|
|
243
251
|
soft: number;
|
|
244
252
|
hard: number;
|
|
@@ -563,6 +571,12 @@ interface ParallelEternalOptions {
|
|
|
563
571
|
agent: Agent;
|
|
564
572
|
/** Project root (used for goal.json path). */
|
|
565
573
|
projectRoot: string;
|
|
574
|
+
/**
|
|
575
|
+
* Override the resolved goal.json path. Defaults to
|
|
576
|
+
* `goalFilePath(projectRoot)` (a hashed location under the home dir).
|
|
577
|
+
* Primarily for tests that want an isolated goal file under a temp dir.
|
|
578
|
+
*/
|
|
579
|
+
goalPath?: string;
|
|
566
580
|
/**
|
|
567
581
|
* Number of parallel subagent slots per tick.
|
|
568
582
|
* Default: 4. Range 1–16; values >8 are for high-throughput machines.
|