@wrongstack/core 0.31.1 → 0.32.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/index.d.ts CHANGED
@@ -44,7 +44,7 @@ export { D as DirectorStateCheckpoint, a as DirectorStateSnapshot, b as Director
44
44
  export { A as AutoApprovePermissionPolicy, D as DefaultPermissionPolicy, P as PermissionPolicyOptions } from './permission-policy-CtNscWOA.js';
45
45
  export { AutoCompactionMiddleware, AutonomousRunner, AutonomousRunnerOptions, AutonomyPromptContributorOptions, DefaultSkillLoader, DoneCheckResult, DoneConditionChecker, EternalAutonomyEngine, EternalAutonomyOptions, EternalEngineState, IntelligentCompactor, IntelligentCompactorOptions, ParallelEngineState, ParallelEternalEngine, ParallelEternalOptions, SelectiveCompactor, SelectiveCompactorOptions, SkillLoaderOptions, buildGoalPreamble, makeAutonomyPromptContributor } from './execution/index.js';
46
46
  export { DefaultProviderRunner } from './defaults/index.js';
47
- 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, n as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, s as Director, 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, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, S as SECURITY_SCANNER_AGENT, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, 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, af as rosterSummaryFromConfigs } from './null-fleet-bus-CAQDGsKc.js';
47
+ 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, n as CreateDelegateToolOptions, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, s as Director, 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, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, S as SECURITY_SCANNER_AGENT, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, 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, af as rosterSummaryFromConfigs } from './null-fleet-bus-DLsUjOyB.js';
48
48
  export { A as AgentBudgetTier, a as AgentCapability, b as AgentDefinition, 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, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from './multi-agent-coordinator-DOXSgtom.js';
49
49
  export { A as AgentFactory, a as AgentFactoryResult, b as AgentRunnerOptions, F as FleetBus, c as FleetEvent, d as FleetHandler, e as FleetUsage, f as FleetUsageAggregator, S as SubagentUsageSnapshot, m as makeAgentSubagentRunner } from './agent-subagent-runner-DpZTLdBe.js';
50
50
  export { DefaultModeStore, LLMSelector, LLMSelectorOptions, ModeLoaderOptions, loadProjectModes, loadUserModes } from './models/index.js';
package/dist/index.js CHANGED
@@ -14380,6 +14380,16 @@ function makeCollabDebugTool(director) {
14380
14380
  type: "number",
14381
14381
  minimum: 1,
14382
14382
  description: "Timeout in ms. Default: 600000 (10 minutes)."
14383
+ },
14384
+ maxTargetFiles: {
14385
+ type: "number",
14386
+ minimum: 1,
14387
+ description: "Maximum number of files to include in the snapshot. If not set, the limit is computed dynamically from contextWindow or falls back to the default (30)."
14388
+ },
14389
+ contextWindow: {
14390
+ type: "number",
14391
+ minimum: 1,
14392
+ description: "Context window size (tokens) of the model. When provided and maxTargetFiles is not set, the file limit is computed dynamically as floor((contextWindow * 0.4) / 2000)."
14383
14393
  }
14384
14394
  },
14385
14395
  required: ["targetPaths"]
@@ -14391,7 +14401,9 @@ function makeCollabDebugTool(director) {
14391
14401
  }
14392
14402
  const options = {
14393
14403
  targetPaths: i.targetPaths,
14394
- timeoutMs: i.timeoutMs
14404
+ timeoutMs: i.timeoutMs,
14405
+ maxTargetFiles: i.maxTargetFiles,
14406
+ contextWindow: i.contextWindow
14395
14407
  };
14396
14408
  try {
14397
14409
  const report = await director.spawnCollab(options);
@@ -14458,6 +14470,7 @@ function makeWorkCompleteTool(director) {
14458
14470
  }
14459
14471
  };
14460
14472
  }
14473
+ var DEFAULT_MAX_TARGET_FILES = 30;
14461
14474
  var CollabSession = class extends EventEmitter {
14462
14475
  sessionId;
14463
14476
  options;
@@ -14514,9 +14527,34 @@ var CollabSession = class extends EventEmitter {
14514
14527
  getSubagentIds() {
14515
14528
  return new Map(this.subagentIds);
14516
14529
  }
14530
+ /**
14531
+ * Returns the effective file limit for this session.
14532
+ * Priority: explicit `maxTargetFiles` > dynamic from `contextWindow` > `DEFAULT_MAX_TARGET_FILES`.
14533
+ */
14534
+ effectiveFileLimit() {
14535
+ if (this.options.maxTargetFiles !== void 0) {
14536
+ return this.options.maxTargetFiles;
14537
+ }
14538
+ if (this.options.contextWindow !== void 0) {
14539
+ return Math.max(5, Math.floor(this.options.contextWindow * 0.4 / 2e3));
14540
+ }
14541
+ return DEFAULT_MAX_TARGET_FILES;
14542
+ }
14517
14543
  async buildSnapshot() {
14518
14544
  if (this.snapshot.files.length > 0) return this.snapshot;
14519
- for (const filePath of (await Promise.all(this.options.targetPaths.map((p) => expandGlob(p)))).flat()) {
14545
+ const allFiles = [];
14546
+ for (const pattern of this.options.targetPaths) {
14547
+ const expanded = await expandGlob(pattern);
14548
+ allFiles.push(...expanded);
14549
+ }
14550
+ const limit = this.effectiveFileLimit();
14551
+ if (allFiles.length > limit) {
14552
+ const hint = this.options.contextWindow ? `contextWindow=${this.options.contextWindow} \u2192 calculated limit=${limit}` : `default limit=${DEFAULT_MAX_TARGET_FILES}`;
14553
+ throw new Error(
14554
+ `[collab_debug] Target has ${allFiles.length} files, which exceeds the limit (${hint}). Narrow the target or pass maxTargetFiles / contextWindow to override. For large codebases, run package-by-package or module-by-module sessions instead of targeting the entire repo.`
14555
+ );
14556
+ }
14557
+ for (const filePath of allFiles) {
14520
14558
  try {
14521
14559
  const content = await fsp3.readFile(filePath, "utf8");
14522
14560
  const ext = filePath.split(".").pop() ?? "";
@@ -15542,6 +15580,20 @@ var Director = class _Director {
15542
15580
  );
15543
15581
  this.coordinator.setSubagentBridge(result.subagentId, subagentBridge);
15544
15582
  this.subagentBridges.set(result.subagentId, subagentBridge);
15583
+ this.fleet.emit({
15584
+ subagentId: result.subagentId,
15585
+ ts: Date.now(),
15586
+ type: "subagent.spawned",
15587
+ payload: {
15588
+ subagentId: result.subagentId,
15589
+ taskId: "",
15590
+ // taskId will be set when assign() is called
15591
+ name: config.name,
15592
+ role: config.role,
15593
+ provider: config.provider,
15594
+ model: config.model
15595
+ }
15596
+ });
15545
15597
  if (!this.fleetManager) {
15546
15598
  this.manifestEntries.set(result.subagentId, {
15547
15599
  subagentId: result.subagentId,