@wrongstack/core 0.109.1 → 0.141.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-mOxbpFcg.d.ts → agent-bridge-r9y6gdn4.d.ts} +1 -1
- package/dist/{agent-subagent-runner-DukQLUcS.d.ts → agent-subagent-runner-1GeQE_L0.d.ts} +7 -8
- package/dist/{brain-Dfv4Y82E.d.ts → brain-Cp_3GIS2.d.ts} +14 -3
- package/dist/{compactor-DXLxLcmU.d.ts → compactor-BueGt7LG.d.ts} +9 -1
- package/dist/{config-BSU-6vah.d.ts → config-BaVThgnT.d.ts} +104 -3
- package/dist/{context-CNRYfhUv.d.ts → context-C7G_MtLV.d.ts} +38 -1
- package/dist/coordination/index.d.ts +12 -13
- package/dist/coordination/index.js +229 -17
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +26 -27
- package/dist/defaults/index.js +886 -721
- package/dist/defaults/index.js.map +1 -1
- package/dist/execution/index.d.ts +15 -16
- package/dist/execution/index.js +535 -322
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +6 -7
- package/dist/{goal-preamble-CI8lxeY1.d.ts → goal-preamble-iuIUTQwk.d.ts} +48 -18
- package/dist/{index-BWRN6wOb.d.ts → index-BZdezm3g.d.ts} +9 -10
- package/dist/{index-DIKEcfgC.d.ts → index-CPweVoFM.d.ts} +7 -6
- package/dist/index.d.ts +51 -52
- package/dist/index.js +752 -545
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +6 -7
- package/dist/infrastructure/index.js +64 -19
- package/dist/infrastructure/index.js.map +1 -1
- package/dist/kernel/index.d.ts +10 -11
- package/dist/kernel/index.js.map +1 -1
- package/dist/llm-selector-CP72f1lC.d.ts +58 -0
- package/dist/{mcp-servers-CXCsANdY.d.ts → mcp-servers-Bl5LTvQg.d.ts} +3 -3
- package/dist/{mode-ARA3HrkY.d.ts → mode-CZlO9iU1.d.ts} +1 -1
- package/dist/models/index.d.ts +157 -53
- package/dist/models/index.js +475 -20
- package/dist/models/index.js.map +1 -1
- package/dist/{models-registry-DU64QxQa.d.ts → models-registry-D90K9UnM.d.ts} +1 -1
- package/dist/{multi-agent-coordinator-51LvnXkD.d.ts → multi-agent-coordinator-QWEzJDlm.d.ts} +1 -1
- package/dist/{null-fleet-bus-D09hMzFQ.d.ts → null-fleet-bus-BUyfqh23.d.ts} +13 -10
- package/dist/observability/index.d.ts +2 -2
- package/dist/{parallel-eternal-engine-B2CbsKpc.d.ts → parallel-eternal-engine-Dj2SYzha.d.ts} +24 -11
- package/dist/{path-resolver-DDJiMAtX.d.ts → path-resolver-DRjQBkoO.d.ts} +3 -3
- package/dist/{permission-BDv7z0mk.d.ts → permission-B7nKnEvQ.d.ts} +1 -1
- package/dist/{permission-policy-dF74EpDp.d.ts → permission-policy-8-6zBmfA.d.ts} +2 -13
- package/dist/{pipeline-BqiA_UMr.d.ts → pipeline-BG7UgbDc.d.ts} +2 -2
- package/dist/{plan-templates-BdDxl9cI.d.ts → plan-templates-CkKNPU3I.d.ts} +6 -6
- package/dist/{provider-runner-BUunikwY.d.ts → provider-runner-BNpuIyOL.d.ts} +3 -3
- package/dist/{retry-policy-BcmuT_V0.d.ts → retry-policy-rutAfVeR.d.ts} +1 -1
- package/dist/sdd/index.d.ts +8 -9
- package/dist/sdd/index.js +208 -1
- package/dist/sdd/index.js.map +1 -1
- package/dist/{secret-vault-DrOhc2i5.d.ts → secret-vault-BTcC_T5v.d.ts} +3 -2
- package/dist/security/index.d.ts +5 -7
- package/dist/security/index.js +4 -35
- package/dist/security/index.js.map +1 -1
- package/dist/{selector-C7wcdqMA.d.ts → selector-4vDFZKt3.d.ts} +1 -1
- package/dist/{session-event-bridge-BpJ5trO9.d.ts → session-event-bridge-DWlvglC2.d.ts} +2 -2
- package/dist/{session-reader-DDz1Ek4V.d.ts → session-reader-BAtCxdaw.d.ts} +1 -1
- package/dist/storage/index.d.ts +14 -15
- package/dist/storage/index.js +140 -134
- package/dist/storage/index.js.map +1 -1
- package/dist/types/index.d.ts +19 -20
- package/dist/types/index.js +186 -102
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +38 -15
- package/dist/utils/index.js +62 -33
- package/dist/utils/index.js.map +1 -1
- package/dist/{wstack-paths-_lqjzErq.d.ts → wstack-paths-DD50Omgn.d.ts} +3 -0
- package/package.json +2 -2
- package/dist/models-registry-B6_KfS65.d.ts +0 -95
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BridgeTransport, a as BridgeMessage, A as AgentBridge, b as AgentBridgeConfig } from './agent-subagent-runner-
|
|
1
|
+
import { B as BridgeTransport, a as BridgeMessage, A as AgentBridge, b as AgentBridgeConfig } from './agent-subagent-runner-1GeQE_L0.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* In-memory pub/sub transport for agent-to-agent messaging.
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { c as ToolCallPipelinePayload, d as ToolWrapper, E as ExtensionRegistry, S as SystemPromptContributor, e as ToolRegistry, P as ProviderRegistry, A as AgentPipelines, f as ToolExecutorLike, g as AgentInit, h as AgentInput, R as RunResult } from './index-
|
|
2
|
-
import { C as Container, R as ReadonlyPipeline, a as Renderer } from './pipeline-
|
|
3
|
-
import { E as EventBus, c as EventName, L as Listener } from './brain-
|
|
4
|
-
import { R as RetryPolicy, E as ErrorHandler } from './retry-policy-
|
|
1
|
+
import { c as ToolCallPipelinePayload, d as ToolWrapper, E as ExtensionRegistry, S as SystemPromptContributor, e as ToolRegistry, P as ProviderRegistry, A as AgentPipelines, f as ToolExecutorLike, g as AgentInit, h as AgentInput, R as RunResult } from './index-CPweVoFM.js';
|
|
2
|
+
import { C as Container, R as ReadonlyPipeline, a as Renderer } from './pipeline-BG7UgbDc.js';
|
|
3
|
+
import { E as EventBus, c as EventName, L as Listener } from './brain-Cp_3GIS2.js';
|
|
4
|
+
import { R as RetryPolicy, E as ErrorHandler } from './retry-policy-rutAfVeR.js';
|
|
5
5
|
import { L as Logger } from './logger-B63L5bTg.js';
|
|
6
6
|
import { T as Tracer } from './observability-D-HZN_mF.js';
|
|
7
|
-
import { P as PermissionPolicy } from './permission-
|
|
8
|
-
import { U as Usage, C as Context, J as JSONSchema, R as Request, b as Response, g as ContentBlock, l as TextBlock, T as Tool, P as Provider, o as RunOptions } from './context-
|
|
9
|
-
import { H as HookEvent,
|
|
10
|
-
import { W as WireFamily } from './models-registry-B6_KfS65.js';
|
|
7
|
+
import { P as PermissionPolicy } from './permission-B7nKnEvQ.js';
|
|
8
|
+
import { U as Usage, C as Context, J as JSONSchema, R as Request, b as Response, g as ContentBlock, l as TextBlock, T as Tool, P as Provider, o as RunOptions } from './context-C7G_MtLV.js';
|
|
9
|
+
import { W as WireFamily, H as HookEvent, e as HookMatcher, I as InProcessHook, h as Config } from './config-BaVThgnT.js';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* Single fleet-wide event with subagent attribution. Whatever a child
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { U as Usage, C as Context, j as ToolProgressEvent, T as Tool } from './context-
|
|
1
|
+
import { U as Usage, C as Context, j as ToolProgressEvent, T as Tool } from './context-C7G_MtLV.js';
|
|
2
2
|
|
|
3
3
|
type MemoryScope = 'project-agents' | 'project-memory' | 'user-memory';
|
|
4
4
|
type MemoryType = 'fact' | 'decision' | 'convention' | 'preference' | 'reference' | 'anti_pattern';
|
|
@@ -168,6 +168,17 @@ interface EventMap {
|
|
|
168
168
|
id: string;
|
|
169
169
|
name: string;
|
|
170
170
|
};
|
|
171
|
+
/**
|
|
172
|
+
* Fired when a single SSE event handler throws mid-stream. Best-effort: the
|
|
173
|
+
* malformed event is skipped and the partial response built from earlier
|
|
174
|
+
* events is preserved, so the stream is not aborted. `eventType` is the SSE
|
|
175
|
+
* event's `type`; `msg` is the handler error message.
|
|
176
|
+
*/
|
|
177
|
+
'provider.stream_error': {
|
|
178
|
+
ctx: Context;
|
|
179
|
+
eventType: string;
|
|
180
|
+
msg: string;
|
|
181
|
+
};
|
|
171
182
|
/**
|
|
172
183
|
* Fired before each retry of a failed provider call. `attempt` is 1-based
|
|
173
184
|
* (the first retry is attempt 1, etc.). `description` is the human-readable
|
|
@@ -538,8 +549,8 @@ interface EventMap {
|
|
|
538
549
|
name: string | undefined;
|
|
539
550
|
message: string;
|
|
540
551
|
stack?: string | undefined;
|
|
541
|
-
};
|
|
542
|
-
};
|
|
552
|
+
} | undefined;
|
|
553
|
+
} | undefined;
|
|
543
554
|
};
|
|
544
555
|
/**
|
|
545
556
|
* Fired by the delegate tool when a subagent finishes. The agent's run
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Context } from './context-
|
|
1
|
+
import { C as Context } from './context-C7G_MtLV.js';
|
|
2
2
|
|
|
3
3
|
interface CompactRepairReport {
|
|
4
4
|
removedToolUses: string[];
|
|
@@ -31,6 +31,14 @@ interface CompactReport {
|
|
|
31
31
|
saved: number;
|
|
32
32
|
}[];
|
|
33
33
|
repaired?: CompactRepairReport | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* When a compactor collapses a range of ancient turns into a single digest,
|
|
36
|
+
* this carries the digest text so callers (e.g. the audit/session log) can
|
|
37
|
+
* record exactly what was collapsed. Lossless compactors preserve all
|
|
38
|
+
* textual content here; only raw tool I/O is dropped (it stays in the
|
|
39
|
+
* session log). Undefined when no range was collapsed this pass.
|
|
40
|
+
*/
|
|
41
|
+
collapsedDigest?: string | undefined;
|
|
34
42
|
}
|
|
35
43
|
interface Compactor {
|
|
36
44
|
compact(ctx: Context, opts?: {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { k as Capabilities, f as Permission } from './context-CNRYfhUv.js';
|
|
1
|
+
import { k as Capabilities, f as Permission } from './context-C7G_MtLV.js';
|
|
3
2
|
|
|
4
3
|
type ContextWindowModeId = 'balanced' | 'frugal' | 'deep' | 'archival';
|
|
5
4
|
type ContextWindowAggressiveOn = 'hard' | 'soft' | 'warn';
|
|
@@ -131,6 +130,100 @@ type HookEntry = {
|
|
|
131
130
|
timeoutMs?: number | undefined;
|
|
132
131
|
};
|
|
133
132
|
|
|
133
|
+
/**
|
|
134
|
+
* Mirror of the models.dev/api.json schema. Top-level is keyed by provider id.
|
|
135
|
+
* We keep `unknown` for fields we don't read so the cached payload stays faithful.
|
|
136
|
+
*/
|
|
137
|
+
interface ModelsDevModel {
|
|
138
|
+
id: string;
|
|
139
|
+
name: string;
|
|
140
|
+
family?: string | undefined;
|
|
141
|
+
attachment?: boolean | undefined;
|
|
142
|
+
reasoning?: boolean | undefined;
|
|
143
|
+
tool_call?: boolean | undefined;
|
|
144
|
+
temperature?: boolean | undefined;
|
|
145
|
+
knowledge?: string | undefined;
|
|
146
|
+
release_date?: string | undefined;
|
|
147
|
+
last_updated?: string | undefined;
|
|
148
|
+
open_weights?: boolean | undefined;
|
|
149
|
+
modalities?: {
|
|
150
|
+
input?: string[] | undefined;
|
|
151
|
+
output?: string[] | undefined;
|
|
152
|
+
};
|
|
153
|
+
cost?: {
|
|
154
|
+
input?: number | undefined;
|
|
155
|
+
output?: number | undefined;
|
|
156
|
+
cache_read?: number | undefined;
|
|
157
|
+
cache_write?: number | undefined;
|
|
158
|
+
[k: string]: number | undefined;
|
|
159
|
+
};
|
|
160
|
+
limit?: {
|
|
161
|
+
context?: number | undefined;
|
|
162
|
+
output?: number | undefined;
|
|
163
|
+
};
|
|
164
|
+
[k: string]: unknown;
|
|
165
|
+
}
|
|
166
|
+
interface ModelsDevProvider {
|
|
167
|
+
id: string;
|
|
168
|
+
name: string;
|
|
169
|
+
/** Env vars that hold the API key, in priority order. */
|
|
170
|
+
env?: string[] | undefined;
|
|
171
|
+
/** Identifies the wire format family (e.g. @ai-sdk/anthropic). */
|
|
172
|
+
npm?: string | undefined;
|
|
173
|
+
/** Default base URL when not provided by SDK defaults. */
|
|
174
|
+
api?: string | undefined;
|
|
175
|
+
/** Documentation URL. */
|
|
176
|
+
doc?: string | undefined;
|
|
177
|
+
models: Record<string, ModelsDevModel>;
|
|
178
|
+
}
|
|
179
|
+
type ModelsDevPayload = Record<string, ModelsDevProvider>;
|
|
180
|
+
/**
|
|
181
|
+
* Canonical wire-format families WrongStack knows how to speak natively.
|
|
182
|
+
* Used by the provider registry to pick a transport.
|
|
183
|
+
*/
|
|
184
|
+
type WireFamily = 'anthropic' | 'openai' | 'openai-compatible' | 'google' | 'unsupported';
|
|
185
|
+
interface ResolvedProvider {
|
|
186
|
+
id: string;
|
|
187
|
+
name: string;
|
|
188
|
+
family: WireFamily;
|
|
189
|
+
apiBase?: string | undefined;
|
|
190
|
+
envVars: string[];
|
|
191
|
+
doc?: string | undefined;
|
|
192
|
+
models: ModelsDevModel[];
|
|
193
|
+
npm?: string | undefined;
|
|
194
|
+
}
|
|
195
|
+
interface ResolvedModel {
|
|
196
|
+
providerId: string;
|
|
197
|
+
modelId: string;
|
|
198
|
+
capabilities: {
|
|
199
|
+
tools: boolean;
|
|
200
|
+
vision: boolean;
|
|
201
|
+
reasoning: boolean;
|
|
202
|
+
maxContext: number;
|
|
203
|
+
maxOutput?: number | undefined;
|
|
204
|
+
knowledge?: string | undefined;
|
|
205
|
+
};
|
|
206
|
+
cost?: ModelsDevModel['cost'] | undefined;
|
|
207
|
+
}
|
|
208
|
+
interface ModelsRegistry {
|
|
209
|
+
/** Load (from cache or network). Idempotent; second call returns cached value. */
|
|
210
|
+
load(opts?: {
|
|
211
|
+
force?: boolean | undefined;
|
|
212
|
+
}): Promise<ModelsDevPayload>;
|
|
213
|
+
/** Force-refresh from network and overwrite cache. */
|
|
214
|
+
refresh(): Promise<ModelsDevPayload>;
|
|
215
|
+
/** All providers, classified by wire family. */
|
|
216
|
+
listProviders(): Promise<ResolvedProvider[]>;
|
|
217
|
+
/** A single provider by id, or undefined. */
|
|
218
|
+
getProvider(id: string): Promise<ResolvedProvider | undefined>;
|
|
219
|
+
/** A model lookup with capabilities + cost. */
|
|
220
|
+
getModel(providerId: string, modelId: string): Promise<ResolvedModel | undefined>;
|
|
221
|
+
/** Suggest a default model for the given provider (latest by release_date). */
|
|
222
|
+
suggestModel(providerId: string): Promise<string | undefined>;
|
|
223
|
+
/** Cache freshness in seconds since last successful network fetch (Infinity if never). */
|
|
224
|
+
ageSeconds(): Promise<number>;
|
|
225
|
+
}
|
|
226
|
+
|
|
134
227
|
interface ContextConfig {
|
|
135
228
|
/** Context-window policy mode. Controls compaction thresholds and preservation depth. */
|
|
136
229
|
mode?: ContextWindowModeId | undefined;
|
|
@@ -433,6 +526,14 @@ interface Config {
|
|
|
433
526
|
autonomy?: AutonomyConfig | undefined;
|
|
434
527
|
/** Show rotating launch hints on startup. Default: true. Set to false to suppress. */
|
|
435
528
|
hints?: boolean | undefined;
|
|
529
|
+
/** Raw SSE stream debugging — hex-dump every byte received from providers to stderr. */
|
|
530
|
+
debugStream?: boolean | undefined;
|
|
531
|
+
/**
|
|
532
|
+
* Where settings are persisted. 'global' → ~/.wrongstack/config.json
|
|
533
|
+
* (default). 'project' → ~/.wrongstack/projects/<slug>/config.local.json.
|
|
534
|
+
* When 'project', provider/model/autonomy/ux settings are saved per-project.
|
|
535
|
+
*/
|
|
536
|
+
configScope?: 'global' | 'project' | undefined;
|
|
436
537
|
/** Automatic codebase symbol-index maintenance (session-start + live updates). */
|
|
437
538
|
indexing?: IndexingConfig | undefined;
|
|
438
539
|
/** Saved launch preferences — restored on next boot for one-line confirmation. */
|
|
@@ -503,4 +604,4 @@ interface ConfigStore {
|
|
|
503
604
|
watch(cb: (next: Readonly<Config>, prev: Readonly<Config>) => void): () => void;
|
|
504
605
|
}
|
|
505
606
|
|
|
506
|
-
export { type AutonomyConfig as A,
|
|
607
|
+
export { type AutonomyConfig as A, type SyncCategory as B, type ContextWindowAggressiveOn as C, DEFAULT_CONTEXT_WINDOW_MODE_ID as D, formatContextWindowModeList as E, type FeaturesConfig as F, getContextWindowMode as G, type HookEvent as H, type InProcessHook as I, isContextWindowModeId as J, listContextWindowModes as K, type LaunchConfig as L, type ModelsRegistry as M, resolveContextWindowPolicy as N, type ProviderConfig as P, type ResolvedProvider as R, type ShellHook as S, type ToolsConfig as T, type WireFamily as W, type ModelsDevPayload as a, type ResolvedModel as b, type MCPServerConfig as c, type ModelMatrixEntry as d, type HookMatcher as e, type HookEntry as f, type ContextWindowPolicy as g, type Config as h, type ConfigStore as i, type ConfigLoader as j, type SyncConfig as k, type HookInput as l, type HookOutcome as m, CONTEXT_WINDOW_MODES as n, type ContextConfig as o, type ContextWindowConfigLike as p, type ContextWindowMode as q, type ContextWindowModeId as r, type ContextWindowThresholds as s, type CustomModelDefinition as t, type IndexingConfig as u, type LogConfig as v, type ModelsDevProvider as w, type PluginConfig as x, type ProviderApiKey as y, type SessionLoggingConfig as z };
|
|
@@ -589,6 +589,36 @@ declare class ProviderError extends WrongStackError {
|
|
|
589
589
|
*/
|
|
590
590
|
describe(): string;
|
|
591
591
|
}
|
|
592
|
+
/**
|
|
593
|
+
* Thrown when the provider stream stops delivering data mid-response.
|
|
594
|
+
* This is distinct from a network error (TCP reset, DNS failure) — the
|
|
595
|
+
* connection is established and the response started, but chunks stopped
|
|
596
|
+
* arriving before the stream completed.
|
|
597
|
+
*
|
|
598
|
+
* Status 599 is used as a sentinel to distinguish stream hangs from
|
|
599
|
+
* regular HTTP errors while still flowing through ProviderError-based
|
|
600
|
+
* retry and fallback infrastructure.
|
|
601
|
+
*/
|
|
602
|
+
declare class StreamHangError extends ProviderError {
|
|
603
|
+
/** Name of the provider that hung, e.g. "zai", "anthropic". */
|
|
604
|
+
readonly hungProviderId: string;
|
|
605
|
+
/** Model that was being called when the hang occurred. */
|
|
606
|
+
readonly hungModel: string;
|
|
607
|
+
/** How long (ms) we waited for the next chunk before declaring a hang. */
|
|
608
|
+
readonly hangTimeoutMs: number;
|
|
609
|
+
/** How many bytes were received before the hang. */
|
|
610
|
+
readonly bytesReceived: number;
|
|
611
|
+
/** Elapsed time (ms) from the start of the stream until the hang. */
|
|
612
|
+
readonly elapsedMs: number;
|
|
613
|
+
constructor(opts: {
|
|
614
|
+
providerId: string;
|
|
615
|
+
model: string;
|
|
616
|
+
hangTimeoutMs: number;
|
|
617
|
+
bytesReceived: number;
|
|
618
|
+
elapsedMs: number;
|
|
619
|
+
cause?: unknown | undefined;
|
|
620
|
+
});
|
|
621
|
+
}
|
|
592
622
|
|
|
593
623
|
interface SessionMetadata {
|
|
594
624
|
id: string;
|
|
@@ -692,6 +722,13 @@ type SessionEvent = {
|
|
|
692
722
|
phase: string;
|
|
693
723
|
saved: number;
|
|
694
724
|
}>;
|
|
725
|
+
/**
|
|
726
|
+
* Lossless digest of the range collapsed during this compaction (text
|
|
727
|
+
* content preserved; raw tool I/O omitted). Captures *what* was collapsed
|
|
728
|
+
* for forensics. May be truncated for log size. Absent when nothing was
|
|
729
|
+
* collapsed (e.g. elision-only passes).
|
|
730
|
+
*/
|
|
731
|
+
digest?: string | undefined;
|
|
695
732
|
} | {
|
|
696
733
|
type: 'error';
|
|
697
734
|
ts: string;
|
|
@@ -1218,4 +1255,4 @@ declare class Context implements RunEnv {
|
|
|
1218
1255
|
usage(): Usage;
|
|
1219
1256
|
}
|
|
1220
1257
|
|
|
1221
|
-
export { type
|
|
1258
|
+
export { type ToolFinalEvent as $, AgentError as A, type MessageRole as B, Context as C, PluginError as D, ERROR_CODES as E, type FileSnapshot as F, type ProviderErrorBody as G, type ReadonlyConversationState as H, type ImageBlock as I, type JSONSchema as J, type RiskTier as K, type RunEnv as L, type Message as M, SessionError as N, type StateChange as O, type Provider as P, type StateChangeHandler as Q, type Request as R, type SessionEvent as S, type Tool as T, type Usage as U, type StopReason as V, type StreamEvent as W, StreamHangError as X, type ThinkingBlock as Y, type ToolCallContext as Z, ToolError as _, type SessionWriter as a, type ToolStreamEvent as a0, WrongStackError as a1, asBlocks as a2, asText as a3, extractRunEnv as a4, isAgentError as a5, isConfigError as a6, isFsError as a7, isImageBlock as a8, isPluginError as a9, isSessionError as aa, isTextBlock as ab, isThinkingBlock as ac, isToolError as ad, isToolResultBlock as ae, isToolUseBlock as af, isWrongStackError as ag, toWrongStackError as ah, wrapAsState as ai, type Response as b, type TokenCounter as c, type CacheStats as d, ProviderError as e, type Permission as f, type ContentBlock as g, type SessionMetadata as h, type SessionStore as i, type ToolProgressEvent as j, type Capabilities as k, type TextBlock as l, type ToolUseBlock as m, type ToolResultBlock as n, type RunOptions as o, type ResumedSession as p, type SessionData as q, type SessionSummary as r, type TodoItem as s, ConversationState as t, ConfigError as u, type ContextInit as v, type ErrorCode as w, type ErrorSeverity as x, type ErrorSubsystem as y, FsError as z };
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
export { b as BrainArbiter, B as BrainDecision, d as BrainDecisionOption, e as BrainDecisionQueue, a as BrainDecisionRequest, f as BrainDecisionSource, g as BrainFallback, h as BrainRisk, D as DefaultBrainArbiter, i as DefaultBrainArbiterOptions, H as HumanEscalatingBrainArbiter, O as ObservableBrainArbiter, j as formatHumanPrompt } from '../brain-
|
|
2
|
-
export { A as ACP_AGENTS, a as AGENTS_BY_PHASE, b as AGENT_CATALOG, c as ALL_AGENT_DEFINITIONS, d as ALL_FLEET_AGENTS, e as AUDIT_LOG_AGENT, f as AutoExtendCeiling, g as AutoExtendPolicy, B as BUG_HUNTER_AGENT, h as BugFinding, C as CollabBudgetConfig, i as CollabBudgetOverrides, j as CollabBudgetWarningPayload, k as CollabDebugReport, l as CollabSession, m as CollabSessionOptions, n as CreateDelegateToolOptions, o as CriticConcern, p as CriticEvaluation, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, s as Director, t as DirectorAlert, u as DirectorAlertLevel, v as DirectorCancelCollabPayload, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, E as FLEET_ROSTER_WITHACP, G as FleetCostCapError, H as FleetManager, I as FleetManagerOptions, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as ICoordinator, M as IFleetManager, N as LargeAnswerStore, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, P as RefactorPhase, Q as RefactorPlan, S as SECURITY_SCANNER_AGENT, T as SharedFileEntry, U as SharedFileSnapshot, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, a0 as makeAskResultTool, a1 as makeAskTool, a2 as makeAssignTool, a3 as makeAwaitTasksTool, a4 as makeCollabDebugTool, a5 as makeDirectorSessionFactory, a6 as makeFleetEmitTool, a7 as makeFleetHealthTool, a8 as makeFleetSessionTool, a9 as makeFleetStatusTool, aa as makeFleetUsageTool, ab as makeRollUpTool, ac as makeSpawnTool, ad as makeTerminateTool, ae as makeWorkCompleteTool, af as rosterSummaryFromConfigs } from '../null-fleet-bus-
|
|
3
|
-
import { A as AgentDefinition } from '../multi-agent-coordinator-
|
|
4
|
-
export { T as AGENT_TOOL_PRESETS, b as AgentBudgetTier, c as AgentCapability, d as AgentPhase, e as DEFAULT_DISPATCH_ROLE, a as DefaultMultiAgentCoordinator, f as DispatchCandidate, D as DispatchClassifier, g as DispatchMethod, h as DispatchOptions, i as DispatchResult, H as HEAVY_BUDGET, L as LIGHT_BUDGET, M as MEDIUM_BUDGET, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from '../multi-agent-coordinator-
|
|
5
|
-
export { h as AgentFactory, i as AgentFactoryResult, j as AgentRunnerOptions, k as BudgetExceededError, l as BudgetKind, m as BudgetLimits, n as BudgetNegotiationMode, o as BudgetThresholdDecision, p as BudgetThresholdHandler, q as BudgetThresholdSignal, r as BudgetUsage, F as FleetBus, s as FleetEvent, t as FleetHandler, u as FleetUsage, v as FleetUsageAggregator, w as SubagentBudget, x as SubagentUsageSnapshot, y as makeAgentSubagentRunner } from '../agent-subagent-runner-
|
|
6
|
-
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-
|
|
7
|
-
import '../context-
|
|
1
|
+
export { b as BrainArbiter, B as BrainDecision, d as BrainDecisionOption, e as BrainDecisionQueue, a as BrainDecisionRequest, f as BrainDecisionSource, g as BrainFallback, h as BrainRisk, D as DefaultBrainArbiter, i as DefaultBrainArbiterOptions, H as HumanEscalatingBrainArbiter, O as ObservableBrainArbiter, j as formatHumanPrompt } from '../brain-Cp_3GIS2.js';
|
|
2
|
+
export { A as ACP_AGENTS, a as AGENTS_BY_PHASE, b as AGENT_CATALOG, c as ALL_AGENT_DEFINITIONS, d as ALL_FLEET_AGENTS, e as AUDIT_LOG_AGENT, f as AutoExtendCeiling, g as AutoExtendPolicy, B as BUG_HUNTER_AGENT, h as BugFinding, C as CollabBudgetConfig, i as CollabBudgetOverrides, j as CollabBudgetWarningPayload, k as CollabDebugReport, l as CollabSession, m as CollabSessionOptions, n as CreateDelegateToolOptions, o as CriticConcern, p as CriticEvaluation, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, s as Director, t as DirectorAlert, u as DirectorAlertLevel, v as DirectorCancelCollabPayload, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, E as FLEET_ROSTER_WITHACP, G as FleetCostCapError, H as FleetManager, I as FleetManagerOptions, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as ICoordinator, M as IFleetManager, N as LargeAnswerStore, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, P as RefactorPhase, Q as RefactorPlan, S as SECURITY_SCANNER_AGENT, T as SharedFileEntry, U as SharedFileSnapshot, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, a0 as makeAskResultTool, a1 as makeAskTool, a2 as makeAssignTool, a3 as makeAwaitTasksTool, a4 as makeCollabDebugTool, a5 as makeDirectorSessionFactory, a6 as makeFleetEmitTool, a7 as makeFleetHealthTool, a8 as makeFleetSessionTool, a9 as makeFleetStatusTool, aa as makeFleetUsageTool, ab as makeRollUpTool, ac as makeSpawnTool, ad as makeTerminateTool, ae as makeWorkCompleteTool, af as rosterSummaryFromConfigs } from '../null-fleet-bus-BUyfqh23.js';
|
|
3
|
+
import { A as AgentDefinition } from '../multi-agent-coordinator-QWEzJDlm.js';
|
|
4
|
+
export { T as AGENT_TOOL_PRESETS, b as AgentBudgetTier, c as AgentCapability, d as AgentPhase, e as DEFAULT_DISPATCH_ROLE, a as DefaultMultiAgentCoordinator, f as DispatchCandidate, D as DispatchClassifier, g as DispatchMethod, h as DispatchOptions, i as DispatchResult, H as HEAVY_BUDGET, L as LIGHT_BUDGET, M as MEDIUM_BUDGET, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from '../multi-agent-coordinator-QWEzJDlm.js';
|
|
5
|
+
export { h as AgentFactory, i as AgentFactoryResult, j as AgentRunnerOptions, k as BudgetExceededError, l as BudgetKind, m as BudgetLimits, n as BudgetNegotiationMode, o as BudgetThresholdDecision, p as BudgetThresholdHandler, q as BudgetThresholdSignal, r as BudgetUsage, F as FleetBus, s as FleetEvent, t as FleetHandler, u as FleetUsage, v as FleetUsageAggregator, w as SubagentBudget, x as SubagentUsageSnapshot, y as makeAgentSubagentRunner } from '../agent-subagent-runner-1GeQE_L0.js';
|
|
6
|
+
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-r9y6gdn4.js';
|
|
7
|
+
import '../context-C7G_MtLV.js';
|
|
8
8
|
import 'node:events';
|
|
9
9
|
import '../director-state-BfeCUbmk.js';
|
|
10
|
-
import '../config-
|
|
11
|
-
import '../
|
|
12
|
-
import '../index-DIKEcfgC.js';
|
|
10
|
+
import '../config-BaVThgnT.js';
|
|
11
|
+
import '../index-CPweVoFM.js';
|
|
13
12
|
import '../logger-B63L5bTg.js';
|
|
14
|
-
import '../pipeline-
|
|
13
|
+
import '../pipeline-BG7UgbDc.js';
|
|
15
14
|
import '../observability-D-HZN_mF.js';
|
|
16
|
-
import '../permission-
|
|
17
|
-
import '../retry-policy-
|
|
15
|
+
import '../permission-B7nKnEvQ.js';
|
|
16
|
+
import '../retry-policy-rutAfVeR.js';
|
|
18
17
|
|
|
19
18
|
/** Phase 1 · Discovery — map the territory before any work begins. */
|
|
20
19
|
declare const DISCOVERY_AGENTS: AgentDefinition[];
|
|
@@ -123,6 +123,11 @@ var DefaultBrainArbiter = class {
|
|
|
123
123
|
options: request.options,
|
|
124
124
|
rationale: "Decision requires human authority or lacks a safe automatic option."
|
|
125
125
|
};
|
|
126
|
+
default:
|
|
127
|
+
return {
|
|
128
|
+
type: "deny",
|
|
129
|
+
reason: `Brain could not safely decide (unknown fallback: ${String(request.fallback)}): ${request.question}`
|
|
130
|
+
};
|
|
126
131
|
}
|
|
127
132
|
}
|
|
128
133
|
};
|
|
@@ -1758,6 +1763,53 @@ Working rules:
|
|
|
1758
1763
|
"flaws"
|
|
1759
1764
|
]
|
|
1760
1765
|
}
|
|
1766
|
+
},
|
|
1767
|
+
{
|
|
1768
|
+
config: {
|
|
1769
|
+
id: "refactor-planner",
|
|
1770
|
+
name: "Refactor Planner",
|
|
1771
|
+
role: "refactor-planner",
|
|
1772
|
+
tools: [...PLAN_TOOLS, "diff"],
|
|
1773
|
+
prompt: `You are the Refactor Planner agent. Your job is to analyze code
|
|
1774
|
+
structure and produce a concrete, phased refactoring plan with risk
|
|
1775
|
+
assessment, dependency ordering, and rollback strategy.
|
|
1776
|
+
|
|
1777
|
+
Scope:
|
|
1778
|
+
- Map module-level dependencies (import graph)
|
|
1779
|
+
- Identify coupling hotspots (high fan-in/out modules)
|
|
1780
|
+
- Assess refactoring risk by complexity and test coverage
|
|
1781
|
+
- Generate phased plans with checkpoint milestones
|
|
1782
|
+
- Produce diff-friendly task lists (one task = one concern)
|
|
1783
|
+
|
|
1784
|
+
Input format you accept:
|
|
1785
|
+
{ "task": "plan | assess | roadmap", "target": "src/core", "constraint": "no-breaking-changes | minimal-downtime | full-rewrite", "focus": "architecture | performance | maintainability" }
|
|
1786
|
+
|
|
1787
|
+
Output: Markdown refactor plan with phases (Low Risk / Medium Risk / High Risk),
|
|
1788
|
+
dependency graph, rollback strategy, and exit criteria.
|
|
1789
|
+
|
|
1790
|
+
Working rules:
|
|
1791
|
+
- Always include rollback strategy \u2014 every refactor can fail
|
|
1792
|
+
- Merge tasks that take <1h into a single phase
|
|
1793
|
+
- Respect team constraints (reviewer availability, parallelization)
|
|
1794
|
+
- Never plan without analyzing the actual code first`
|
|
1795
|
+
},
|
|
1796
|
+
budget: HEAVY_BUDGET,
|
|
1797
|
+
capability: {
|
|
1798
|
+
phase: "planning",
|
|
1799
|
+
summary: "Refactoring planner: analyzes code structure, maps dependencies, produces risk-scored phased plans with rollback strategy.",
|
|
1800
|
+
keywords: [
|
|
1801
|
+
"refactor",
|
|
1802
|
+
"refactoring",
|
|
1803
|
+
"restructure",
|
|
1804
|
+
"debt",
|
|
1805
|
+
"technical debt",
|
|
1806
|
+
"clean up",
|
|
1807
|
+
"modularize",
|
|
1808
|
+
"decouple",
|
|
1809
|
+
"dependency graph",
|
|
1810
|
+
"code structure"
|
|
1811
|
+
]
|
|
1812
|
+
}
|
|
1761
1813
|
}
|
|
1762
1814
|
];
|
|
1763
1815
|
|
|
@@ -2297,6 +2349,157 @@ Working rules:
|
|
|
2297
2349
|
"robustness"
|
|
2298
2350
|
]
|
|
2299
2351
|
}
|
|
2352
|
+
},
|
|
2353
|
+
{
|
|
2354
|
+
config: {
|
|
2355
|
+
id: "security-scanner",
|
|
2356
|
+
name: "Security Scanner",
|
|
2357
|
+
role: "security-scanner",
|
|
2358
|
+
tools: [...TOOLS.inspect],
|
|
2359
|
+
prompt: `You are the Security Scanner agent. Your job is to scan code,
|
|
2360
|
+
configs, and dependencies for security issues from hardcoded secrets to
|
|
2361
|
+
supply chain risks.
|
|
2362
|
+
|
|
2363
|
+
Scope:
|
|
2364
|
+
- Detect hardcoded secrets: API keys, tokens, passwords, private keys
|
|
2365
|
+
- Find injection vectors: eval, innerHTML, SQL concat, shell injection
|
|
2366
|
+
- Identify insecure patterns: weak crypto, hardcoded IVs, disabled TLS
|
|
2367
|
+
- Scan dependencies for known CVEs (via npm/pnpm audit)
|
|
2368
|
+
- Flag supply chain risks: postinstall hooks, unverified scripts
|
|
2369
|
+
|
|
2370
|
+
Input format you accept:
|
|
2371
|
+
{ "task": "scan | audit | secrets | dependencies", "paths": ["src", "config"], "depth": "quick | normal | deep" }
|
|
2372
|
+
|
|
2373
|
+
Output: Markdown security report with severity-ranked findings, injection
|
|
2374
|
+
vectors, dependency issues, and a remediation checklist.
|
|
2375
|
+
|
|
2376
|
+
Working rules:
|
|
2377
|
+
- Never scan node_modules \u2014 use npm audit instead
|
|
2378
|
+
- Always provide remediation steps, not just findings
|
|
2379
|
+
- Verify regex-based secrets before flagging (false positive risk)
|
|
2380
|
+
- When in doubt, flag as medium rather than ignoring potential issues`
|
|
2381
|
+
},
|
|
2382
|
+
budget: HEAVY_BUDGET,
|
|
2383
|
+
capability: {
|
|
2384
|
+
phase: "verify",
|
|
2385
|
+
summary: "Security scanner: detects hardcoded secrets, injection vectors, insecure patterns, and supply-chain risks with remediation.",
|
|
2386
|
+
keywords: [
|
|
2387
|
+
"security",
|
|
2388
|
+
"scan",
|
|
2389
|
+
"vulnerability",
|
|
2390
|
+
"secret",
|
|
2391
|
+
"api key",
|
|
2392
|
+
"hardcoded",
|
|
2393
|
+
"injection",
|
|
2394
|
+
"cve",
|
|
2395
|
+
"audit dependencies",
|
|
2396
|
+
"supply chain",
|
|
2397
|
+
"xss",
|
|
2398
|
+
"sqli",
|
|
2399
|
+
"shell injection",
|
|
2400
|
+
"sensitive data",
|
|
2401
|
+
"credential"
|
|
2402
|
+
]
|
|
2403
|
+
}
|
|
2404
|
+
},
|
|
2405
|
+
{
|
|
2406
|
+
config: {
|
|
2407
|
+
id: "bug-hunter",
|
|
2408
|
+
name: "Bug Hunter",
|
|
2409
|
+
role: "bug-hunter",
|
|
2410
|
+
tools: [...TOOLS.inspect],
|
|
2411
|
+
prompt: `You are the Bug Hunter agent. Your job is to systematically scan
|
|
2412
|
+
source code for bugs, anti-patterns, and code smells using pattern matching
|
|
2413
|
+
and heuristics. Output a prioritized hit list with file:line references.
|
|
2414
|
+
|
|
2415
|
+
Scope:
|
|
2416
|
+
- Detect common bug patterns (uncaught errors, resource leaks, race conditions)
|
|
2417
|
+
- Identify anti-patterns (callback hell, God objects, circular deps)
|
|
2418
|
+
- Find TypeScript-specific issues (unsafe any, missing null checks, branded types)
|
|
2419
|
+
- Flag security-sensitive constructs (eval, innerHTML, hardcoded secrets)
|
|
2420
|
+
- Rank findings: critical > high > medium > low
|
|
2421
|
+
|
|
2422
|
+
Input format you accept:
|
|
2423
|
+
{ "task": "scan | hunt | check", "paths": ["src/**/*.ts"], "focus": "bugs | patterns | security | all", "severityThreshold": "medium" }
|
|
2424
|
+
|
|
2425
|
+
Output: Markdown bug hunt report with critically/high/medium/low sections.
|
|
2426
|
+
Each entry: **[TYPE]** \`file:line\` \u2014 description + suggested fix
|
|
2427
|
+
|
|
2428
|
+
Working rules:
|
|
2429
|
+
- Never scan node_modules \u2014 it's noise
|
|
2430
|
+
- Always include file:line for every finding
|
|
2431
|
+
- If >30% of findings are false positives, note the confidence level
|
|
2432
|
+
- Ask director for clarification if paths are ambiguous`
|
|
2433
|
+
},
|
|
2434
|
+
budget: HEAVY_BUDGET,
|
|
2435
|
+
capability: {
|
|
2436
|
+
phase: "verify",
|
|
2437
|
+
summary: "Bug hunter: scans source code for bugs, anti-patterns, and code smells, producing a file:line-ranked hit list with fixes.",
|
|
2438
|
+
keywords: [
|
|
2439
|
+
"bug",
|
|
2440
|
+
"hunt",
|
|
2441
|
+
"scan",
|
|
2442
|
+
"code smell",
|
|
2443
|
+
"anti-pattern",
|
|
2444
|
+
"race condition",
|
|
2445
|
+
"memory leak",
|
|
2446
|
+
"null deref",
|
|
2447
|
+
"type safety",
|
|
2448
|
+
"unhandled error",
|
|
2449
|
+
"find bugs",
|
|
2450
|
+
"audit code",
|
|
2451
|
+
"code quality"
|
|
2452
|
+
]
|
|
2453
|
+
}
|
|
2454
|
+
},
|
|
2455
|
+
{
|
|
2456
|
+
config: {
|
|
2457
|
+
id: "audit-log",
|
|
2458
|
+
name: "Audit Log",
|
|
2459
|
+
role: "audit-log",
|
|
2460
|
+
tools: [...TOOLS.inspect],
|
|
2461
|
+
prompt: `You are the Audit Log agent. Your job is to analyze structured JSONL
|
|
2462
|
+
session logs and produce actionable markdown reports.
|
|
2463
|
+
|
|
2464
|
+
Scope:
|
|
2465
|
+
- Parse session logs (iteration counts, tool calls, errors, usage)
|
|
2466
|
+
- Detect repeated failure patterns across multiple runs
|
|
2467
|
+
- Identify tool usage anomalies (over-use, failures, unexpected chains)
|
|
2468
|
+
- Track token consumption trends
|
|
2469
|
+
- Generate structured audit reports with severity ratings
|
|
2470
|
+
|
|
2471
|
+
Input format you accept:
|
|
2472
|
+
{ "task": "analyze | report | trends", "sessionPath": "<path>", "focus": "errors | tools | usage | all" }
|
|
2473
|
+
|
|
2474
|
+
Output: Markdown audit report with Summary, Top Errors, Tool Usage table,
|
|
2475
|
+
Anomalies, and Cost Trend sections.
|
|
2476
|
+
|
|
2477
|
+
Working rules:
|
|
2478
|
+
- Never fabricate numbers \u2014 read the actual logs first
|
|
2479
|
+
- Always include file:line references for errors
|
|
2480
|
+
- If sessionPath is missing, ask the director to provide it
|
|
2481
|
+
- Report confidence level: high (>90% accuracy), medium, low`
|
|
2482
|
+
},
|
|
2483
|
+
budget: MEDIUM_BUDGET,
|
|
2484
|
+
capability: {
|
|
2485
|
+
phase: "verify",
|
|
2486
|
+
summary: "Audit log analyzer: parses session JSONL, detects failure patterns, tool anomalies, and cost trends with structured reports.",
|
|
2487
|
+
keywords: [
|
|
2488
|
+
"audit",
|
|
2489
|
+
"log",
|
|
2490
|
+
"logs",
|
|
2491
|
+
"session",
|
|
2492
|
+
"trace",
|
|
2493
|
+
"analyze logs",
|
|
2494
|
+
"error patterns",
|
|
2495
|
+
"cost analysis",
|
|
2496
|
+
"tool usage",
|
|
2497
|
+
"token usage",
|
|
2498
|
+
"post-mortem",
|
|
2499
|
+
"trend",
|
|
2500
|
+
"anomaly"
|
|
2501
|
+
]
|
|
2502
|
+
}
|
|
2300
2503
|
}
|
|
2301
2504
|
];
|
|
2302
2505
|
|
|
@@ -6280,7 +6483,10 @@ var Director = class _Director {
|
|
|
6280
6483
|
workCompleteFlag = false;
|
|
6281
6484
|
/** Pending /btw notes stashed by the leader agent (see setLeaderBtwNote). */
|
|
6282
6485
|
_leaderBtwNotes = [];
|
|
6283
|
-
/** Active collab sessions tracked by sessionId (see spawnCollab).
|
|
6486
|
+
/** Active collab sessions tracked by sessionId (see spawnCollab).
|
|
6487
|
+
* The tuple holds the session and its Director-registered listener unsubs.
|
|
6488
|
+
* Calling the unsubs on cancel/premature-cleanup prevents listener accumulation
|
|
6489
|
+
* on CollabSession (EventEmitter) across many spawnCollab() calls. */
|
|
6284
6490
|
_activeCollabSessions = /* @__PURE__ */ new Map();
|
|
6285
6491
|
/** Prevents large `ask_subagent` answers from bloating the leader's context window. */
|
|
6286
6492
|
largeAnswerStore;
|
|
@@ -6610,11 +6816,13 @@ var Director = class _Director {
|
|
|
6610
6816
|
* The CollabDebugReport will reflect 'cancelled' disposition when awaited.
|
|
6611
6817
|
*/
|
|
6612
6818
|
cancelCollabSession(sessionId, reason = "Director cancelled") {
|
|
6613
|
-
const
|
|
6614
|
-
if (!
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6819
|
+
const entry = this._activeCollabSessions.get(sessionId);
|
|
6820
|
+
if (!entry || entry.session.isCancelled()) return;
|
|
6821
|
+
for (const unsub of entry.unsubs) unsub();
|
|
6822
|
+
entry.session.cancel(reason);
|
|
6823
|
+
for (const [_role, subagentId] of entry.session.getSubagentIds()) {
|
|
6824
|
+
this.coordinator.stop(subagentId).catch((err) => {
|
|
6825
|
+
console.debug(`[director] stop subagent ${subagentId} failed (may have already completed): ${err}`);
|
|
6618
6826
|
});
|
|
6619
6827
|
}
|
|
6620
6828
|
}
|
|
@@ -7262,9 +7470,15 @@ var Director = class _Director {
|
|
|
7262
7470
|
return options.onBudgetWarning?.(alert) ?? "ignore";
|
|
7263
7471
|
}
|
|
7264
7472
|
});
|
|
7265
|
-
this._activeCollabSessions.
|
|
7266
|
-
|
|
7267
|
-
session.on("session.
|
|
7473
|
+
const doneHandler = () => this._activeCollabSessions.delete(session.sessionId);
|
|
7474
|
+
const errorHandler = () => this._activeCollabSessions.delete(session.sessionId);
|
|
7475
|
+
session.on("session.done", doneHandler);
|
|
7476
|
+
session.on("session.error", errorHandler);
|
|
7477
|
+
const unsubs = [
|
|
7478
|
+
() => session.off("session.done", doneHandler),
|
|
7479
|
+
() => session.off("session.error", errorHandler)
|
|
7480
|
+
];
|
|
7481
|
+
this._activeCollabSessions.set(session.sessionId, { session, unsubs });
|
|
7268
7482
|
return session.start();
|
|
7269
7483
|
}
|
|
7270
7484
|
/**
|
|
@@ -8010,8 +8224,7 @@ var DefaultSessionStore = class _DefaultSessionStore {
|
|
|
8010
8224
|
onClose: (s) => this.appendToIndex(s)
|
|
8011
8225
|
});
|
|
8012
8226
|
} catch (err) {
|
|
8013
|
-
await handle.close().catch(() => {
|
|
8014
|
-
});
|
|
8227
|
+
await handle.close().catch((e) => console.warn(`[session-store] handle.close() failed: ${e}`));
|
|
8015
8228
|
throw err;
|
|
8016
8229
|
}
|
|
8017
8230
|
}
|
|
@@ -8042,8 +8255,7 @@ var DefaultSessionStore = class _DefaultSessionStore {
|
|
|
8042
8255
|
);
|
|
8043
8256
|
return { writer, data };
|
|
8044
8257
|
} catch (err) {
|
|
8045
|
-
await handle.close().catch(() => {
|
|
8046
|
-
});
|
|
8258
|
+
await handle.close().catch((e) => console.warn(`[session-store] handle.close() failed: ${e}`));
|
|
8047
8259
|
throw err;
|
|
8048
8260
|
}
|
|
8049
8261
|
}
|
|
@@ -8232,15 +8444,15 @@ var DefaultSessionStore = class _DefaultSessionStore {
|
|
|
8232
8444
|
* sidecars, and the session directory (fleet.json, shared/, subagents/).
|
|
8233
8445
|
*/
|
|
8234
8446
|
async deleteSession(id) {
|
|
8235
|
-
await fsp6.unlink(this.sessionPath(id, ".jsonl")).catch(() =>
|
|
8236
|
-
await fsp6.unlink(this.sessionPath(id, ".summary.json")).catch(() =>
|
|
8447
|
+
await fsp6.unlink(this.sessionPath(id, ".jsonl")).catch((err) => console.warn(`[session-store] delete .jsonl failed: ${err}`));
|
|
8448
|
+
await fsp6.unlink(this.sessionPath(id, ".summary.json")).catch((err) => console.warn(`[session-store] delete .summary.json failed: ${err}`));
|
|
8237
8449
|
const shardDir = path4.dirname(path4.join(this.dir, id));
|
|
8238
8450
|
const base = path4.basename(id);
|
|
8239
8451
|
for (const ext of [".plan.json", ".todos.json"]) {
|
|
8240
|
-
await fsp6.unlink(path4.join(shardDir, `${base}${ext}`)).catch(() =>
|
|
8452
|
+
await fsp6.unlink(path4.join(shardDir, `${base}${ext}`)).catch((err) => console.warn(`[session-store] delete ${ext} failed: ${err}`));
|
|
8241
8453
|
}
|
|
8242
8454
|
const sessDir = path4.join(shardDir, base);
|
|
8243
|
-
await fsp6.rm(sessDir, { recursive: true, force: true }).catch(() =>
|
|
8455
|
+
await fsp6.rm(sessDir, { recursive: true, force: true }).catch((err) => console.warn(`[session-store] delete session dir failed: ${err}`));
|
|
8244
8456
|
await this.writeTombstone(id);
|
|
8245
8457
|
}
|
|
8246
8458
|
async delete(id) {
|