@wrongstack/core 0.68.0 → 0.77.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-D-j6OOBT.d.ts → agent-bridge-EWdqs8v6.d.ts} +1 -1
- package/dist/{agent-subagent-runner-DRZ9-NnR.d.ts → agent-subagent-runner-D8qW8OSC.d.ts} +13 -5
- package/dist/{config--86aHSln.d.ts → config-Dy0CK_o6.d.ts} +44 -1
- package/dist/coordination/index.d.ts +10 -10
- package/dist/coordination/index.js +74 -10
- package/dist/coordination/index.js.map +1 -1
- package/dist/defaults/index.d.ts +17 -17
- package/dist/defaults/index.js +160 -67
- package/dist/defaults/index.js.map +1 -1
- package/dist/{events-CIplI98R.d.ts → events-CYaoLN5_.d.ts} +45 -0
- package/dist/execution/index.d.ts +9 -9
- package/dist/execution/index.js +4 -4
- package/dist/execution/index.js.map +1 -1
- package/dist/extension/index.d.ts +5 -5
- package/dist/{index-b5uhfTSl.d.ts → index-DIxjTOga.d.ts} +6 -6
- package/dist/{index-DKUvyTvV.d.ts → index-Dsda0uCn.d.ts} +4 -4
- package/dist/index.d.ts +108 -33
- package/dist/index.js +388 -58
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +5 -5
- package/dist/infrastructure/index.js +16 -2
- package/dist/infrastructure/index.js.map +1 -1
- package/dist/kernel/index.d.ts +7 -7
- package/dist/kernel/index.js.map +1 -1
- package/dist/{logger-bOzkF5LL.d.ts → logger-BppKxDqZ.d.ts} +9 -0
- package/dist/{mcp-servers-DwoNBf6r.d.ts → mcp-servers-T0O6UN_w.d.ts} +1 -1
- package/dist/{mode-CV077NjV.d.ts → mode-BO4SEUIv.d.ts} +7 -0
- package/dist/models/index.d.ts +1 -1
- package/dist/models/index.js +18 -9
- package/dist/models/index.js.map +1 -1
- package/dist/{multi-agent-coordinator-CWnH-CiX.d.ts → multi-agent-coordinator-DpbG3wiy.d.ts} +1 -1
- package/dist/{null-fleet-bus-CuN0ObJr.d.ts → null-fleet-bus-u5ys3lW_.d.ts} +28 -9
- package/dist/observability/index.d.ts +1 -1
- package/dist/{parallel-eternal-engine-0UwotoSx.d.ts → parallel-eternal-engine-Dn0P8Pbj.d.ts} +3 -3
- package/dist/{path-resolver-DVkEcIw8.d.ts → path-resolver-B32v2JIq.d.ts} +1 -1
- package/dist/{permission-C1A5whY5.d.ts → permission-V5BLOrY6.d.ts} +0 -4
- package/dist/{permission-policy-B2dK-T5N.d.ts → permission-policy-CBVx-d-8.d.ts} +1 -5
- package/dist/{plan-templates-Bprrzhbu.d.ts → plan-templates-BcUwLlMQ.d.ts} +8 -3
- package/dist/{provider-runner-mXvXGSIw.d.ts → provider-runner-CSi_7l0h.d.ts} +1 -1
- package/dist/sdd/index.d.ts +6 -6
- package/dist/sdd/index.js +3 -3
- package/dist/sdd/index.js.map +1 -1
- package/dist/security/index.d.ts +2 -2
- package/dist/security/index.js +0 -8
- package/dist/security/index.js.map +1 -1
- package/dist/skills/index.js +1 -0
- package/dist/skills/index.js.map +1 -1
- package/dist/storage/index.d.ts +4 -4
- package/dist/storage/index.js +48 -8
- package/dist/storage/index.js.map +1 -1
- package/dist/{system-prompt-b61lOd49.d.ts → system-prompt-CA11g6Jo.d.ts} +1 -1
- package/dist/types/index.d.ts +14 -14
- package/dist/types/index.js +35 -12
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +14 -3
- package/dist/utils/index.js.map +1 -1
- package/dist/{wstack-paths-eMXnY1_X.d.ts → wstack-paths-D7evAFWM.d.ts} +8 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as BridgeTransport, B as BridgeMessage, a as AgentBridge, b as AgentBridgeConfig } from './agent-subagent-runner-
|
|
1
|
+
import { f as BridgeTransport, B as BridgeMessage, a as AgentBridge, b as AgentBridgeConfig } from './agent-subagent-runner-D8qW8OSC.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* In-memory pub/sub transport for agent-to-agent messaging.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { t as ToolRegistry, m as ProviderRegistry, f as AgentPipelines, q as ToolExecutorLike, E as ExtensionRegistry, d as AgentInit, e as AgentInput, R as RunResult, p as ToolCallPipelinePayload, u as ToolWrapper, S as SystemPromptContributor } from './index-
|
|
2
|
-
import { C as Container, e as Renderer, R as ReadonlyPipeline } from './system-prompt-
|
|
3
|
-
import { E as EventBus, k as EventName, L as Listener } from './events-
|
|
1
|
+
import { t as ToolRegistry, m as ProviderRegistry, f as AgentPipelines, q as ToolExecutorLike, E as ExtensionRegistry, d as AgentInit, e as AgentInput, R as RunResult, p as ToolCallPipelinePayload, u as ToolWrapper, S as SystemPromptContributor } from './index-Dsda0uCn.js';
|
|
2
|
+
import { C as Container, e as Renderer, R as ReadonlyPipeline } from './system-prompt-CA11g6Jo.js';
|
|
3
|
+
import { E as EventBus, k as EventName, L as Listener } from './events-CYaoLN5_.js';
|
|
4
4
|
import { a as RetryPolicy, E as ErrorHandler } from './retry-policy-CG3qvH_e.js';
|
|
5
5
|
import { a as Logger } from './logger-DDd5C--Z.js';
|
|
6
6
|
import { T as Tracer } from './observability-BhnVLBLS.js';
|
|
7
|
-
import { a as PermissionPolicy } from './permission-
|
|
7
|
+
import { a as PermissionPolicy } from './permission-V5BLOrY6.js';
|
|
8
8
|
import { d as Context, Q as Tool, u as RunOptions, J as JSONSchema, p as Request, q as Response, c as ContentBlock, T as TextBlock, m as Provider, $ as Usage } from './context-y87Jc5ei.js';
|
|
9
|
-
import { l as HookEvent, n as HookMatcher, I as InProcessHook, a as Config } from './config
|
|
9
|
+
import { l as HookEvent, n as HookMatcher, I as InProcessHook, a as Config } from './config-Dy0CK_o6.js';
|
|
10
10
|
import { W as WireFamily } from './models-registry-BcYJDKLm.js';
|
|
11
11
|
|
|
12
12
|
declare class Agent {
|
|
@@ -623,6 +623,14 @@ interface SubagentConfig {
|
|
|
623
623
|
* read tools, never write" or "respond in JSON only".
|
|
624
624
|
*/
|
|
625
625
|
systemPromptOverride?: string;
|
|
626
|
+
/**
|
|
627
|
+
* Domain-specific knowledge injected into the subagent's system prompt
|
|
628
|
+
* between the shared scratchpad and the override. Typically populated
|
|
629
|
+
* from SKILL.md body content matching the subagent's role (e.g. the
|
|
630
|
+
* bug-hunter skill body for a bug-hunter subagent). Keeps subagents
|
|
631
|
+
* informed of same domain patterns the host agent knows.
|
|
632
|
+
*/
|
|
633
|
+
skillContent?: string;
|
|
626
634
|
/**
|
|
627
635
|
* Routing for streaming output. `'director'` (default) forwards
|
|
628
636
|
* text/tool events to the parent's FleetBus so the director can read
|
|
@@ -279,6 +279,38 @@ interface AutonomyConfig {
|
|
|
279
279
|
/** ms to wait before auto-proceeding in 'auto' mode. Default: 45000. */
|
|
280
280
|
autoProceedDelayMs?: number;
|
|
281
281
|
}
|
|
282
|
+
/**
|
|
283
|
+
* Automatic codebase symbol-index maintenance. Keeps the `codebase-search`
|
|
284
|
+
* index (SQLite, `~/.wrongstack/projects/<hash>/codebase-index/index.db`) fresh
|
|
285
|
+
* without the user having to call `codebase-index` by hand.
|
|
286
|
+
*/
|
|
287
|
+
interface IndexingConfig {
|
|
288
|
+
/** Run a blocking incremental index at session start (with a visible summary). Default: true. */
|
|
289
|
+
onSessionStart: boolean;
|
|
290
|
+
/** Reindex files the agent writes/edits via tools, in the background. Default: true. */
|
|
291
|
+
onEdit: boolean;
|
|
292
|
+
/** Watch the project root for external editor changes and reindex them. Default: true. */
|
|
293
|
+
watchExternal: boolean;
|
|
294
|
+
/** Debounce window (ms) coalescing rapid edits to the same file. Default: 400. */
|
|
295
|
+
debounceMs: number;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Saved launch preferences — restored on next boot so the pre-launch prompt
|
|
299
|
+
* can offer a one-line "Continue with last settings? [Y/n]" instead of
|
|
300
|
+
* re-asking every question from scratch.
|
|
301
|
+
*/
|
|
302
|
+
interface LaunchConfig {
|
|
303
|
+
/** Interactive mode: 'tui' (Ink TUI) or 'repl' (readline REPL). */
|
|
304
|
+
mode?: 'tui' | 'repl';
|
|
305
|
+
/** Start with Director mode on (fleet manifest + multi-agent orchestration). */
|
|
306
|
+
director?: boolean;
|
|
307
|
+
/**
|
|
308
|
+
* Launch-time autonomy mode (binary choice from pre-launch prompt).
|
|
309
|
+
* 'off' = stops after each turn; 'auto' = self-driving.
|
|
310
|
+
* Distinct from `AutonomyConfig.defaultMode` which also supports 'suggest'.
|
|
311
|
+
*/
|
|
312
|
+
autonomy?: 'off' | 'auto';
|
|
313
|
+
}
|
|
282
314
|
/**
|
|
283
315
|
* Controls how much detail is persisted to the per-session JSONL log
|
|
284
316
|
* (`~/.wrongstack/projects/<hash>/sessions/<id>.jsonl`).
|
|
@@ -343,6 +375,13 @@ interface Config {
|
|
|
343
375
|
model: string;
|
|
344
376
|
apiKey?: string;
|
|
345
377
|
baseUrl?: string;
|
|
378
|
+
/**
|
|
379
|
+
* Maximum number of subagent tasks the fleet coordinator dispatches
|
|
380
|
+
* simultaneously. Extra tasks queue until a slot frees. Default: 4.
|
|
381
|
+
* Overridden by WRONGSTACK_MAX_CONCURRENT env var and --max-concurrent
|
|
382
|
+
* CLI flag. Change at runtime with /fleet concurrency <n>.
|
|
383
|
+
*/
|
|
384
|
+
maxConcurrent?: number;
|
|
346
385
|
providers?: Record<string, ProviderConfig>;
|
|
347
386
|
/**
|
|
348
387
|
* Top-level custom models (maps modelId → definition). Merged with
|
|
@@ -385,6 +424,10 @@ interface Config {
|
|
|
385
424
|
cwd?: string;
|
|
386
425
|
/** Autonomy mode configuration (auto-proceed delay, etc.). */
|
|
387
426
|
autonomy?: AutonomyConfig;
|
|
427
|
+
/** Automatic codebase symbol-index maintenance (session-start + live updates). */
|
|
428
|
+
indexing?: IndexingConfig;
|
|
429
|
+
/** Saved launch preferences — restored on next boot for one-line confirmation. */
|
|
430
|
+
launch?: LaunchConfig;
|
|
388
431
|
/**
|
|
389
432
|
* Session logging & audit configuration.
|
|
390
433
|
* Controls what gets written to the persistent JSONL transcript.
|
|
@@ -451,4 +494,4 @@ interface ConfigStore {
|
|
|
451
494
|
watch(cb: (next: Readonly<Config>, prev: Readonly<Config>) => void): () => void;
|
|
452
495
|
}
|
|
453
496
|
|
|
454
|
-
export { type AutonomyConfig as A, CONTEXT_WINDOW_MODES as C, DEFAULT_CONTEXT_WINDOW_MODE_ID as D, type FeaturesConfig as F, type HookEntry as H, type InProcessHook as I, type
|
|
497
|
+
export { type AutonomyConfig as A, listContextWindowModes as B, CONTEXT_WINDOW_MODES as C, DEFAULT_CONTEXT_WINDOW_MODE_ID as D, resolveContextWindowPolicy as E, type FeaturesConfig as F, type HookEntry as H, type InProcessHook as I, type LaunchConfig as L, type MCPServerConfig as M, type PluginConfig as P, type SessionLoggingConfig as S, type ToolsConfig as T, type Config as a, type ConfigLoader as b, type ConfigStore as c, type ContextConfig as d, type ContextWindowAggressiveOn as e, type ContextWindowConfigLike as f, type ContextWindowMode as g, type ContextWindowModeId as h, type ContextWindowPolicy as i, type ContextWindowThresholds as j, type CustomModelDefinition as k, type HookEvent as l, type HookInput as m, type HookMatcher as n, type HookOutcome as o, type IndexingConfig as p, type LogConfig as q, type ModelMatrixEntry as r, type ProviderApiKey as s, type ProviderConfig as t, type ShellHook as u, type SyncCategory as v, type SyncConfig as w, formatContextWindowModeList as x, getContextWindowMode as y, isContextWindowModeId as z };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export { B as BrainArbiter, a as BrainDecision, b as BrainDecisionOption, c as BrainDecisionQueue, d as BrainDecisionRequest, e as BrainDecisionSource, f as BrainFallback, g as BrainRisk, D as DefaultBrainArbiter, h as DefaultBrainArbiterOptions, H as HumanEscalatingBrainArbiter, O as ObservableBrainArbiter, l as formatHumanPrompt } from '../events-
|
|
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 { b as AgentDefinition } from '../multi-agent-coordinator-
|
|
4
|
-
export { T as AGENT_TOOL_PRESETS, A as AgentBudgetTier, a as AgentCapability, c as AgentPhase, D as DEFAULT_DISPATCH_ROLE, d as DefaultMultiAgentCoordinator, e as DispatchCandidate, f 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 { c as AgentFactory, d as AgentFactoryResult, e as AgentRunnerOptions, g as BudgetExceededError, h as BudgetKind, i as BudgetLimits, j as BudgetNegotiationMode, k as BudgetThresholdDecision, l as BudgetThresholdHandler, m as BudgetThresholdSignal, n as BudgetUsage, F as FleetBus, p as FleetEvent, q as FleetHandler, r as FleetUsage, s as FleetUsageAggregator, K as SubagentBudget, V as SubagentUsageSnapshot, _ as makeAgentSubagentRunner } from '../agent-subagent-runner-
|
|
6
|
-
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-
|
|
1
|
+
export { B as BrainArbiter, a as BrainDecision, b as BrainDecisionOption, c as BrainDecisionQueue, d as BrainDecisionRequest, e as BrainDecisionSource, f as BrainFallback, g as BrainRisk, D as DefaultBrainArbiter, h as DefaultBrainArbiterOptions, H as HumanEscalatingBrainArbiter, O as ObservableBrainArbiter, l as formatHumanPrompt } from '../events-CYaoLN5_.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-u5ys3lW_.js';
|
|
3
|
+
import { b as AgentDefinition } from '../multi-agent-coordinator-DpbG3wiy.js';
|
|
4
|
+
export { T as AGENT_TOOL_PRESETS, A as AgentBudgetTier, a as AgentCapability, c as AgentPhase, D as DEFAULT_DISPATCH_ROLE, d as DefaultMultiAgentCoordinator, e as DispatchCandidate, f 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-DpbG3wiy.js';
|
|
5
|
+
export { c as AgentFactory, d as AgentFactoryResult, e as AgentRunnerOptions, g as BudgetExceededError, h as BudgetKind, i as BudgetLimits, j as BudgetNegotiationMode, k as BudgetThresholdDecision, l as BudgetThresholdHandler, m as BudgetThresholdSignal, n as BudgetUsage, F as FleetBus, p as FleetEvent, q as FleetHandler, r as FleetUsage, s as FleetUsageAggregator, K as SubagentBudget, V as SubagentUsageSnapshot, _ as makeAgentSubagentRunner } from '../agent-subagent-runner-D8qW8OSC.js';
|
|
6
|
+
export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-EWdqs8v6.js';
|
|
7
7
|
import '../context-y87Jc5ei.js';
|
|
8
8
|
import 'node:events';
|
|
9
9
|
import '../director-state-BmYi3DGA.js';
|
|
10
|
-
import '../config
|
|
10
|
+
import '../config-Dy0CK_o6.js';
|
|
11
11
|
import '../models-registry-BcYJDKLm.js';
|
|
12
|
-
import '../index-
|
|
12
|
+
import '../index-Dsda0uCn.js';
|
|
13
13
|
import '../logger-DDd5C--Z.js';
|
|
14
|
-
import '../system-prompt-
|
|
14
|
+
import '../system-prompt-CA11g6Jo.js';
|
|
15
15
|
import '../observability-BhnVLBLS.js';
|
|
16
16
|
import '../secret-scrubber-3MHDDAtm.js';
|
|
17
|
-
import '../permission-
|
|
17
|
+
import '../permission-V5BLOrY6.js';
|
|
18
18
|
import '../retry-policy-CG3qvH_e.js';
|
|
19
19
|
|
|
20
20
|
/** Phase 1 · Discovery — map the territory before any work begins. */
|
|
@@ -538,7 +538,8 @@ function isGlob(p) {
|
|
|
538
538
|
return false;
|
|
539
539
|
}
|
|
540
540
|
function globToRegex(pat) {
|
|
541
|
-
let i = 0
|
|
541
|
+
let i = 0;
|
|
542
|
+
let re = "^";
|
|
542
543
|
while (i < pat.length) {
|
|
543
544
|
const c = pat[i];
|
|
544
545
|
if (c === "*") {
|
|
@@ -1263,6 +1264,10 @@ A scratchpad shared with the rest of the fleet is mounted at \`${parts.sharedScr
|
|
|
1263
1264
|
- Use stable filenames (one file per concern); overwrite instead of appending so the Director sees the latest state.`
|
|
1264
1265
|
);
|
|
1265
1266
|
}
|
|
1267
|
+
if (parts.skills && parts.skills.trim().length > 0) {
|
|
1268
|
+
sections.push(`Domain knowledge:
|
|
1269
|
+
${parts.skills.trim()}`);
|
|
1270
|
+
}
|
|
1266
1271
|
if (parts.override && parts.override.trim().length > 0) {
|
|
1267
1272
|
sections.push(parts.override.trim());
|
|
1268
1273
|
}
|
|
@@ -5308,7 +5313,7 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
5308
5313
|
}
|
|
5309
5314
|
async spawn(subagent) {
|
|
5310
5315
|
const id = subagent.id || randomUUID();
|
|
5311
|
-
|
|
5316
|
+
const cfg = this.withNickname(subagent, id);
|
|
5312
5317
|
if (this.subagents.has(id)) {
|
|
5313
5318
|
throw new Error(`Subagent id "${id}" already exists \u2014 refusing to overwrite`);
|
|
5314
5319
|
}
|
|
@@ -5323,12 +5328,12 @@ var DefaultMultiAgentCoordinator = class _DefaultMultiAgentCoordinator extends E
|
|
|
5323
5328
|
maxConcurrent: this.config.maxConcurrent ?? 16
|
|
5324
5329
|
};
|
|
5325
5330
|
this.subagents.set(id, {
|
|
5326
|
-
config: { ...
|
|
5331
|
+
config: { ...cfg, id },
|
|
5327
5332
|
context,
|
|
5328
5333
|
status: "idle",
|
|
5329
5334
|
abortController: new AbortController()
|
|
5330
5335
|
});
|
|
5331
|
-
this.emit("subagent.started", { subagent: { ...
|
|
5336
|
+
this.emit("subagent.started", { subagent: { ...cfg, id } });
|
|
5332
5337
|
this.fleetBus?.emit({
|
|
5333
5338
|
subagentId: id,
|
|
5334
5339
|
ts: Date.now(),
|
|
@@ -6976,6 +6981,7 @@ var Director = class _Director {
|
|
|
6976
6981
|
role: config.prompt,
|
|
6977
6982
|
task: taskBrief,
|
|
6978
6983
|
sharedScratchpad: this.sharedScratchpadPath ?? void 0,
|
|
6984
|
+
skills: config.skillContent,
|
|
6979
6985
|
override: config.systemPromptOverride
|
|
6980
6986
|
});
|
|
6981
6987
|
}
|
|
@@ -7125,6 +7131,7 @@ function createDelegateTool(opts) {
|
|
|
7125
7131
|
if (typeof i.task !== "string" || !i.task.trim()) {
|
|
7126
7132
|
return { ok: false, error: "`task` is required." };
|
|
7127
7133
|
}
|
|
7134
|
+
const target = i.role ?? i.name ?? "subagent";
|
|
7128
7135
|
try {
|
|
7129
7136
|
let director = await opts.host.ensureDirector();
|
|
7130
7137
|
if (!director) {
|
|
@@ -7185,6 +7192,7 @@ function createDelegateTool(opts) {
|
|
|
7185
7192
|
if (!cfg.timeoutMs) {
|
|
7186
7193
|
cfg.timeoutMs = Math.max(3e4, timeoutMs - SUBAGENT_TIMEOUT_BUFFER_MS);
|
|
7187
7194
|
}
|
|
7195
|
+
opts.events?.emit("delegate.started", { target, task: i.task });
|
|
7188
7196
|
const subagentId = await director.spawn(cfg);
|
|
7189
7197
|
const taskId = await director.assign({
|
|
7190
7198
|
id: `${randomUUID()}`,
|
|
@@ -7219,6 +7227,17 @@ function createDelegateTool(opts) {
|
|
|
7219
7227
|
});
|
|
7220
7228
|
if ("__timeout" in result) {
|
|
7221
7229
|
const partial2 = await readSubagentPartial(opts, subagentId);
|
|
7230
|
+
opts.events?.emit("delegate.completed", {
|
|
7231
|
+
target,
|
|
7232
|
+
task: i.task,
|
|
7233
|
+
ok: false,
|
|
7234
|
+
status: "host_timeout",
|
|
7235
|
+
summary: `[${target}] timed out \u2014 no result within ${Math.round(timeoutMs / 1e3)}s`,
|
|
7236
|
+
durationMs: timeoutMs,
|
|
7237
|
+
iterations: partial2?.events ?? 0,
|
|
7238
|
+
toolCalls: partial2?.toolUsesObserved ?? 0,
|
|
7239
|
+
subagentId
|
|
7240
|
+
});
|
|
7222
7241
|
return {
|
|
7223
7242
|
ok: false,
|
|
7224
7243
|
stopReason: "host_timeout",
|
|
@@ -7235,6 +7254,24 @@ function createDelegateTool(opts) {
|
|
|
7235
7254
|
const retryable = result.error?.retryable;
|
|
7236
7255
|
const backoffMs = result.error?.backoffMs;
|
|
7237
7256
|
const summary = buildDelegateSummary(i.role, result);
|
|
7257
|
+
let costUsd;
|
|
7258
|
+
try {
|
|
7259
|
+
costUsd = dir.snapshot().perSubagent[result.subagentId]?.cost;
|
|
7260
|
+
} catch {
|
|
7261
|
+
costUsd = void 0;
|
|
7262
|
+
}
|
|
7263
|
+
opts.events?.emit("delegate.completed", {
|
|
7264
|
+
target,
|
|
7265
|
+
task: i.task,
|
|
7266
|
+
ok: result.status === "success",
|
|
7267
|
+
status: result.status,
|
|
7268
|
+
summary,
|
|
7269
|
+
durationMs: result.durationMs,
|
|
7270
|
+
iterations: result.iterations,
|
|
7271
|
+
toolCalls: result.toolCalls,
|
|
7272
|
+
costUsd,
|
|
7273
|
+
subagentId: result.subagentId
|
|
7274
|
+
});
|
|
7238
7275
|
return {
|
|
7239
7276
|
ok: result.status === "success",
|
|
7240
7277
|
status: result.status,
|
|
@@ -7256,10 +7293,21 @@ function createDelegateTool(opts) {
|
|
|
7256
7293
|
summary
|
|
7257
7294
|
};
|
|
7258
7295
|
} catch (err) {
|
|
7296
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
7297
|
+
opts.events?.emit("delegate.completed", {
|
|
7298
|
+
target,
|
|
7299
|
+
task: i.task,
|
|
7300
|
+
ok: false,
|
|
7301
|
+
status: "error",
|
|
7302
|
+
summary: `[${target}] failed \u2014 ${message}`,
|
|
7303
|
+
durationMs: 0,
|
|
7304
|
+
iterations: 0,
|
|
7305
|
+
toolCalls: 0
|
|
7306
|
+
});
|
|
7259
7307
|
return {
|
|
7260
7308
|
ok: false,
|
|
7261
7309
|
stopReason: "error",
|
|
7262
|
-
error:
|
|
7310
|
+
error: message
|
|
7263
7311
|
};
|
|
7264
7312
|
}
|
|
7265
7313
|
}
|
|
@@ -7657,6 +7705,16 @@ function isEmptyMessage(msg) {
|
|
|
7657
7705
|
}
|
|
7658
7706
|
|
|
7659
7707
|
// src/storage/session-store.ts
|
|
7708
|
+
function sanitizeModel(model) {
|
|
7709
|
+
return model.replace(/[^a-zA-Z0-9_-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").slice(0, 40);
|
|
7710
|
+
}
|
|
7711
|
+
function generateSessionId(startedAt, model) {
|
|
7712
|
+
const date = startedAt.slice(0, 10);
|
|
7713
|
+
const time = startedAt.slice(11, 19).replace(/:/g, "-");
|
|
7714
|
+
const suffix = randomBytes(2).toString("hex");
|
|
7715
|
+
const modelPart = model ? `_${sanitizeModel(model)}` : "";
|
|
7716
|
+
return `${date}/${time}Z${modelPart}_${suffix}`;
|
|
7717
|
+
}
|
|
7660
7718
|
var DefaultSessionStore = class {
|
|
7661
7719
|
dir;
|
|
7662
7720
|
events;
|
|
@@ -7670,15 +7728,21 @@ var DefaultSessionStore = class {
|
|
|
7670
7728
|
sessionPath(id, ext) {
|
|
7671
7729
|
return path4.join(this.dir, `${id}${ext}`);
|
|
7672
7730
|
}
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
|
|
7731
|
+
/**
|
|
7732
|
+
* Ensure the directory implied by the session ID exists. When the ID
|
|
7733
|
+
* contains a date prefix like `2026-06-06/...`, this creates the date
|
|
7734
|
+
* subdirectory so sessions group naturally by day.
|
|
7735
|
+
*/
|
|
7736
|
+
async ensureShardDir(id) {
|
|
7737
|
+
const dirPath = path4.dirname(path4.join(this.dir, id));
|
|
7738
|
+
await ensureDir(dirPath);
|
|
7739
|
+
return dirPath;
|
|
7676
7740
|
}
|
|
7677
7741
|
async create(meta) {
|
|
7678
7742
|
const startedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7679
|
-
const id = meta.id
|
|
7743
|
+
const id = meta.id && meta.id.length > 0 ? meta.id : generateSessionId(startedAt, meta.model ?? meta.provider);
|
|
7680
7744
|
const shardDir = await this.ensureShardDir(id);
|
|
7681
|
-
const file = path4.join(shardDir, `${id}.jsonl`);
|
|
7745
|
+
const file = path4.join(shardDir, `${path4.basename(id)}.jsonl`);
|
|
7682
7746
|
let handle;
|
|
7683
7747
|
try {
|
|
7684
7748
|
handle = await fsp6.open(file, "a", 384);
|