@wrongstack/cli 0.9.7 → 0.9.19

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.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import * as path24 from 'path';
3
3
  import * as fsp3 from 'fs/promises';
4
- import { color, DefaultPathResolver, TOKENS, DefaultSystemPromptBuilder, makeAutonomyPromptContributor, ToolRegistry, createContextManagerTool, EventBus, SlashCommandRegistry, createDelegateTool, FLEET_ROSTER, createMcpControlTool, EternalAutonomyEngine, DefaultLogger, DefaultModelsRegistry, ProviderRegistry, InMemoryMetricsSink, wireMetricsToEvents, DefaultHealthRegistry, startMetricsServer, RecoveryLock, DefaultAttachmentStore, QueueStore, Context, loadTodosCheckpoint, attachTodosCheckpoint, loadDirectorState, loadPlan, createDefaultPipelines, AutoCompactionMiddleware, estimateRequestTokens, Agent, loadPlugins, FleetManager, makeDirectorSessionFactory, Director, AutoApprovePermissionPolicy, PhaseStore, AutoPhasePlanner, PhaseGraphBuilder, WorktreeManager, PhaseOrchestrator, makeLLMClassifier, resolveWstackPaths, DefaultSecretVault, migratePlaintextSecrets, DefaultConfigLoader, DefaultSessionReader, DefaultSessionRewinder, DefaultSessionStore, atomicWrite, DefaultPluginAPI, makeAgentSubagentRunner, NULL_FLEET_BUS, buildChildEnv, formatContextWindowModeList, repairToolUseAdjacency, getContextWindowMode, resolveContextWindowPolicy, AGENTS_BY_PHASE, dispatchAgent, formatTodosList, SpecStore, TaskGraphStore, analyzeCriticalPath, getTemplate, listTemplates, templateToMarkdown, SpecParser, renderSpecAnalysis, AISpecBuilder, DefaultTaskStore, TaskTracker, renderProgress, renderTaskGraph, loadGoal, goalFilePath, summarizeUsage, saveGoal, emptyGoal, buildGoalPreamble, formatGoal, pendingBtwCount, setBtwNote, decryptConfigSecrets, encryptConfigSecrets as encryptConfigSecrets$1, InputBuilder, FsError, ERROR_CODES, SpecVersioning, ParallelEternalEngine, allServers as allServers$1 } from '@wrongstack/core';
4
+ import { color, DefaultPathResolver, TOKENS, DefaultSystemPromptBuilder, makeAutonomyPromptContributor, ToolRegistry, createContextManagerTool, EventBus, SlashCommandRegistry, createDelegateTool, FLEET_ROSTER, createMcpControlTool, EternalAutonomyEngine, DefaultLogger, DefaultModelsRegistry, ProviderRegistry, InMemoryMetricsSink, wireMetricsToEvents, DefaultHealthRegistry, startMetricsServer, RecoveryLock, DefaultAttachmentStore, QueueStore, Context, loadTodosCheckpoint, attachTodosCheckpoint, loadDirectorState, loadPlan, createDefaultPipelines, AutoCompactionMiddleware, estimateRequestTokens, Agent, loadPlugins, FleetManager, makeDirectorSessionFactory, Director, makeFleetEmitTool, AutoApprovePermissionPolicy, PhaseStore, AutoPhasePlanner, PhaseGraphBuilder, WorktreeManager, PhaseOrchestrator, makeLLMClassifier, resolveWstackPaths, DefaultSecretVault, migratePlaintextSecrets, DefaultConfigLoader, DefaultSessionReader, DefaultSessionRewinder, DefaultSessionStore, atomicWrite, DefaultPluginAPI, makeAgentSubagentRunner, NULL_FLEET_BUS, buildChildEnv, formatContextWindowModeList, repairToolUseAdjacency, getContextWindowMode, resolveContextWindowPolicy, AGENTS_BY_PHASE, dispatchAgent, formatTodosList, SpecStore, TaskGraphStore, analyzeCriticalPath, getTemplate, listTemplates, templateToMarkdown, SpecParser, renderSpecAnalysis, AISpecBuilder, DefaultTaskStore, TaskTracker, renderProgress, renderTaskGraph, loadGoal, goalFilePath, summarizeUsage, saveGoal, emptyGoal, buildGoalPreamble, formatGoal, pendingBtwCount, setBtwNote, decryptConfigSecrets, encryptConfigSecrets as encryptConfigSecrets$1, InputBuilder, FsError, ERROR_CODES, SpecVersioning, ParallelEternalEngine, allServers as allServers$1 } from '@wrongstack/core';
5
5
  import { createRequire } from 'module';
6
6
  import * as os3 from 'os';
7
7
  import os3__default from 'os';
@@ -5753,7 +5753,11 @@ async function bootConfig(flags) {
5753
5753
  }
5754
5754
  }
5755
5755
  const configLoader = new DefaultConfigLoader({ paths: wpaths, vault });
5756
- const config = await configLoader.load({ cliFlags: flagsToConfigPatch(flags) });
5756
+ let config = await configLoader.load({ cliFlags: flagsToConfigPatch(flags) });
5757
+ const syncConfig = await configLoader.loadSyncConfig();
5758
+ if (syncConfig) {
5759
+ config = Object.freeze({ ...config, sync: syncConfig });
5760
+ }
5757
5761
  return {
5758
5762
  paths: { cwd, projectRoot, userHome, wpaths, pathResolver },
5759
5763
  config,
@@ -5906,7 +5910,7 @@ var ReadlineInputReader = class {
5906
5910
  * user gets visual confirmation that bytes are arriving (especially on
5907
5911
  * paste, which previously felt like nothing happened). Pasted chunks
5908
5912
  * are echoed as a run of bullets, Backspace/DEL erases one bullet, and
5909
- * Ctrl+U / Ctrl+W are honored. Non-TTY input is read normally — there's
5913
+ * Ctrl+U / Ctrl+T are honored. Non-TTY input is read normally — there's
5910
5914
  * nothing to hide when piped, and echoing bullets to a file is noise.
5911
5915
  *
5912
5916
  * Returns the raw entered string (no trim — caller decides).
@@ -10526,6 +10530,11 @@ var MultiAgentHost = class {
10526
10530
  /** Own FleetManager — created in buildDirector(), used for pending task
10527
10531
  * tracking so status() can show descriptions without host-side state. */
10528
10532
  fleetManager;
10533
+ /** Own FleetEmitTool — created in buildDirector() so subagents in director
10534
+ * mode can publish structured events (bug.found, refactor.plan,
10535
+ * critic.evaluation) onto the fleet bus without needing the tool registered
10536
+ * in the host's ToolRegistry. */
10537
+ fleetEmitTool;
10529
10538
  /** Lazily built alongside the director — produces per-subagent JSONL
10530
10539
  * writers under `<sessionsRoot>/<runId>/`. Null without sessionsRoot. */
10531
10540
  sessionFactory;
@@ -10642,9 +10651,18 @@ var MultiAgentHost = class {
10642
10651
  });
10643
10652
  }
10644
10653
  );
10654
+ this.fleetEmitTool = makeFleetEmitTool(this.director);
10645
10655
  const runner = await this.buildSubagentRunner(config);
10646
10656
  this.getCoordinator().setRunner(runner);
10647
10657
  }
10658
+ /**
10659
+ * Returns the FleetEmitTool for director-mode subagents, if the director
10660
+ * has been built. Used by makeSubagentFactory to inject the tool into
10661
+ * the filtered tool registry so collab session agents can emit fleet events.
10662
+ */
10663
+ getFleetEmitTool() {
10664
+ return this.fleetEmitTool;
10665
+ }
10648
10666
  /**
10649
10667
  * Build a per-role subagent factory: given a SubagentConfig, construct a
10650
10668
  * fresh, isolated Agent with the role's filtered tools and (when the config
@@ -10689,6 +10707,15 @@ var MultiAgentHost = class {
10689
10707
  append: (ev) => parentSession.append({ ...ev })
10690
10708
  };
10691
10709
  }
10710
+ const tools = subCfg.tools ? [...subCfg.tools] : void 0;
10711
+ let injectedFleetEmit;
10712
+ if (tools?.includes("fleet_emit")) {
10713
+ const fleetTool = this.fleetEmitTool;
10714
+ if (fleetTool) {
10715
+ tools.splice(tools.indexOf("fleet_emit"), 1);
10716
+ injectedFleetEmit = fleetTool;
10717
+ }
10718
+ }
10692
10719
  const ctx = new Context({
10693
10720
  systemPrompt: baseSystem,
10694
10721
  provider,
@@ -10698,9 +10725,11 @@ var MultiAgentHost = class {
10698
10725
  cwd: subCwd,
10699
10726
  projectRoot: this.deps.projectRoot,
10700
10727
  model: subCfg.model ?? config.model,
10701
- tools: this.filterTools(subCfg.tools)
10728
+ tools: this.filterTools(tools)
10702
10729
  });
10703
- const toolExecutor = new ToolExecutor(this.subagentToolRegistry(subCfg.tools), {
10730
+ const baseRegistry = this.subagentToolRegistry(tools);
10731
+ if (injectedFleetEmit) baseRegistry.register(injectedFleetEmit);
10732
+ const toolExecutor = new ToolExecutor(baseRegistry, {
10704
10733
  permissionPolicy: new AutoApprovePermissionPolicy(),
10705
10734
  secretScrubber: this.deps.secretScrubber,
10706
10735
  renderer: this.deps.renderer,
@@ -10712,7 +10741,7 @@ var MultiAgentHost = class {
10712
10741
  });
10713
10742
  const agent = new Agent({
10714
10743
  container: this.deps.container,
10715
- tools: this.subagentToolRegistry(subCfg.tools),
10744
+ tools: baseRegistry,
10716
10745
  providers: this.deps.providerRegistry,
10717
10746
  events,
10718
10747
  pipelines: createDefaultPipelines(),