@wrongstack/cli 0.308.6 → 0.309.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.
@@ -2203,7 +2203,15 @@ function applyChimeraReviewerReadOnlyPolicy(config) {
2203
2203
  // mutation tools/capabilities so Chimera reviewers cannot repair files.
2204
2204
  tools: [...CHIMERA_REVIEW_READ_ONLY_TOOLS],
2205
2205
  allowedCapabilities: ["fs.read"],
2206
- worktree: "off"
2206
+ worktree: "off",
2207
+ // Mandatory model-driven completion: a reviewer must never be killed by
2208
+ // the wall-clock watchdog. At its deadline (or when the leader's session
2209
+ // ends and `Director.requestFinish()` fires) it receives an in-band
2210
+ // `subagent.finish_requested` notification between tool batches and
2211
+ // finishes its report in its own turn within the granted grace window.
2212
+ // Only if that window also elapses does the terminal stop apply — the
2213
+ // reviewer's bounded maximum lifetime.
2214
+ gracefulFinish: true
2207
2215
  };
2208
2216
  }
2209
2217
 
@@ -2284,10 +2292,30 @@ async function finalizeExecutionCleanup(input) {
2284
2292
  sessionEndProducers.add(tracked);
2285
2293
  }
2286
2294
  });
2295
+ if (director) {
2296
+ try {
2297
+ director.requestFinish("leader session ended \u2014 finish your review now");
2298
+ } catch (finishErr) {
2299
+ console.warn(
2300
+ JSON.stringify({
2301
+ level: "warn",
2302
+ event: "shutdown.subagent_finish_notify_failed",
2303
+ message: finishErr instanceof Error ? finishErr.message : String(finishErr),
2304
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
2305
+ })
2306
+ );
2307
+ }
2308
+ }
2287
2309
  try {
2288
2310
  while (sessionEndProducers.size > 0) {
2289
2311
  await Promise.allSettled([...sessionEndProducers]);
2290
2312
  }
2313
+ if (director) {
2314
+ try {
2315
+ director.requestFinish("leader session ended \u2014 finish your review now");
2316
+ } catch {
2317
+ }
2318
+ }
2291
2319
  await chimeraWork?.drainAndClose();
2292
2320
  } catch (err) {
2293
2321
  console.warn(
@@ -2300,6 +2328,18 @@ async function finalizeExecutionCleanup(input) {
2300
2328
  );
2301
2329
  }
2302
2330
  if (director) {
2331
+ try {
2332
+ director.requestFinish("leader session ended \u2014 finish your review now");
2333
+ } catch (finishErr) {
2334
+ console.warn(
2335
+ JSON.stringify({
2336
+ level: "warn",
2337
+ event: "shutdown.subagent_finish_notify_failed",
2338
+ message: finishErr instanceof Error ? finishErr.message : String(finishErr),
2339
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
2340
+ })
2341
+ );
2342
+ }
2303
2343
  try {
2304
2344
  await director.terminateAll();
2305
2345
  } catch (termErr) {
@@ -3212,6 +3252,15 @@ function installChimeraCascadeHandler({
3212
3252
  // Cascade agents are ephemeral infrastructure: like reviewers,
3213
3253
  // they must not consume the leader's lifetime maxSpawns budget.
3214
3254
  spawnBudgetExempt: true,
3255
+ // Model-driven completion (see core coordination/subagent-finish.ts):
3256
+ // a rung crossing its wall-clock budget is notified in-band
3257
+ // between tool batches and finishes its own turn within the
3258
+ // grace window instead of being killed. Ladder-retry semantics
3259
+ // are intact: a rung that still exhausts the grace window lands
3260
+ // as a `timeout` task result, which advances the ladder, and
3261
+ // `buildRetryPreamble` below already warns the successor that
3262
+ // the tree may hold the dead rung's partial edits.
3263
+ gracefulFinish: true,
3215
3264
  // Rung 0 stays unpinned so the role model matrix still decides;
3216
3265
  // later rungs pin a model precisely because it just failed.
3217
3266
  ...attempt.tier === "inherit" ? {} : {
@@ -6045,4 +6094,4 @@ export {
6045
6094
  execute,
6046
6095
  resolveReviewerFallbackModels
6047
6096
  };
6048
- //# sourceMappingURL=execution-6HIKTAUB.js.map
6097
+ //# sourceMappingURL=execution-TYUXABWI.js.map
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Host wiring for the ExploreCompanion — the state-triggered background
3
+ * codebase explorer behind the leader agent.
4
+ *
5
+ * Mirrors `host-supervisor.ts`: a thin builder that wires the core
6
+ * `ExploreCompanion` observer (coordination/explore-companion.ts) to the
7
+ * director, the project mailbox, and the host session. Built in
8
+ * `buildDirector()`, stopped in `dispose()`.
9
+ *
10
+ * Resident model: one `explore-companion` subagent is spawned lazily on the
11
+ * FIRST probe (never eagerly — an idle session pays nothing) and holds a
12
+ * stable subagent id so subsequent probes reuse it. When the resident is
13
+ * gone (removed/reaped/never spawned), the next probe spawns a fresh one.
14
+ * Probes are `assignInternal`ed, never awaited — the leader is never
15
+ * blocked, and internal tasks stay out of the leader-visible task surface
16
+ * (same treatment as shadow passes).
17
+ *
18
+ * @module host-explore-companion
19
+ */
20
+ import { type Director, ExploreCompanion } from '@wrongstack/core/coordination';
21
+ import type { EventBus } from '@wrongstack/core/kernel';
22
+ import type { SubagentConfig } from '@wrongstack/core/types';
23
+ /** Config block for the explore-companion host wiring (FleetConfig.exploreCompanion). */
24
+ export interface HostExploreCompanionConfig {
25
+ /** Kill switch. Default true. */
26
+ enabled?: boolean | undefined;
27
+ /** Min gap between probes on the same subject (ms). Default 120_000. */
28
+ cooldownMs?: number | undefined;
29
+ /** Pending probe queue cap. Default 8. */
30
+ maxPending?: number | undefined;
31
+ /** Mailbox poll interval for explicit asks (ms). Default 5_000. */
32
+ pollIntervalMs?: number | undefined;
33
+ }
34
+ export interface HostExploreCompanionInput {
35
+ director: Director;
36
+ events: EventBus;
37
+ sessionId: string;
38
+ mailboxProjectDir: string;
39
+ roster: Record<string, SubagentConfig>;
40
+ config?: HostExploreCompanionConfig | undefined;
41
+ }
42
+ export declare function createHostExploreCompanion(input: HostExploreCompanionInput): ExploreCompanion | null;
43
+ //# sourceMappingURL=host-explore-companion.d.ts.map
@@ -53,6 +53,11 @@ export declare class MultiAgentHost {
53
53
  * buildDirector() (when a BrainArbiter is available), stopped in
54
54
  * dispose(). Also published to the supervisor registry for /supervisor. */
55
55
  private fleetSupervisor;
56
+ /** ExploreCompanion — state-triggered background codebase explorer behind
57
+ * the leader. Built in buildDirector() (unless disabled via
58
+ * fleet.exploreCompanion.enabled=false), stopped in dispose(). Probes are
59
+ * assigned to a lazily-spawned resident `explore-companion` subagent. */
60
+ private exploreCompanion;
56
61
  /** Built-ins plus lazily-resolved project-created roles. */
57
62
  private readonly roster;
58
63
  constructor(deps: MultiAgentDeps, opts?: MultiAgentHostOptions);
package/dist/index.js CHANGED
@@ -1860,15 +1860,15 @@ var loaders = {
1860
1860
  audit: async () => (await import("./audit-BBR22QH3.js")).auditCmd,
1861
1861
  tools: async () => (await import("./tools-skills-UNKLOB7M.js")).toolsCmd,
1862
1862
  skills: async () => (await import("./tools-skills-UNKLOB7M.js")).skillsCmd,
1863
- providers: async () => (await import("./providers-models-4FAKM2WO.js")).providersCmd,
1864
- models: async () => (await import("./providers-models-4FAKM2WO.js")).modelsCmd,
1863
+ providers: async () => (await import("./providers-models-D23WUD74.js")).providersCmd,
1864
+ models: async () => (await import("./providers-models-D23WUD74.js")).modelsCmd,
1865
1865
  mcp: async () => (await import("./mcp-CMLFHRG2.js")).mcpCmd,
1866
- plugin: async () => (await import("./plugin-usage-PTEETL3J.js")).pluginCmd,
1867
- plugins: async () => (await import("./plugin-usage-PTEETL3J.js")).pluginCmd,
1866
+ plugin: async () => (await import("./plugin-usage-26LIIW3P.js")).pluginCmd,
1867
+ plugins: async () => (await import("./plugin-usage-26LIIW3P.js")).pluginCmd,
1868
1868
  diag: async () => (await import("./diag-doctor-WTBHPOMB.js")).diagCmd,
1869
1869
  doctor: async () => (await import("./diag-doctor-WTBHPOMB.js")).doctorCmd,
1870
1870
  export: async () => (await import("./export-CCUXRJOU.js")).exportCmd,
1871
- usage: async () => (await import("./plugin-usage-PTEETL3J.js")).usageCmd,
1871
+ usage: async () => (await import("./plugin-usage-26LIIW3P.js")).usageCmd,
1872
1872
  version: async () => (await import("./version-help-TFD6VPF3.js")).versionCmd,
1873
1873
  help: async () => (await import("./version-help-TFD6VPF3.js")).helpCmd,
1874
1874
  projects: async () => (await import("./projects-XE76NFNZ.js")).projectsCmd,
@@ -4466,7 +4466,7 @@ async function initializeCli(argv) {
4466
4466
  async function main(argv) {
4467
4467
  const cliCtx = await initializeCli(argv);
4468
4468
  if (typeof cliCtx === "number") return cliCtx;
4469
- const { runInteractive } = await import("./cli-main-HCCYX3D5.js");
4469
+ const { runInteractive } = await import("./cli-main-RG2PTQ6S.js");
4470
4470
  return runInteractive(cliCtx);
4471
4471
  }
4472
4472
 
@@ -14,6 +14,15 @@ export declare const OFFICIAL_PLUGINS: readonly [{
14
14
  export interface PluginManagementDeps {
15
15
  config: Config;
16
16
  configPath: string;
17
+ /** Override `~/.wrongstack` for tests. Defaults to the real home dir. */
18
+ globalRoot?: string | undefined;
19
+ /** Injectable package-manager runner for tests. */
20
+ runPackageManager?: ((pm: string, args: readonly string[], cwd: string) => Promise<PackageManagerRunResult>) | undefined;
21
+ }
22
+ export interface PackageManagerRunResult {
23
+ code: number | null;
24
+ stdout: string;
25
+ stderr: string;
17
26
  }
18
27
  export interface PluginManagementResult {
19
28
  code: number;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runPluginManagementCommand
3
- } from "./chunk-RK7E3IXT.js";
3
+ } from "./chunk-H6C7SO5H.js";
4
4
  import {
5
5
  restoreFlags
6
6
  } from "./chunk-CSAPOCBP.js";
@@ -41,4 +41,4 @@ export {
41
41
  pluginCmd,
42
42
  usageCmd
43
43
  };
44
- //# sourceMappingURL=plugin-usage-PTEETL3J.js.map
44
+ //# sourceMappingURL=plugin-usage-26LIIW3P.js.map
@@ -7,8 +7,8 @@ import {
7
7
  pluginNameFromSpec,
8
8
  setupPlugins,
9
9
  warnIfDeprecatedPluginName
10
- } from "./chunk-KV6DNQT6.js";
11
- import "./chunk-RK7E3IXT.js";
10
+ } from "./chunk-BZJ4MP32.js";
11
+ import "./chunk-H6C7SO5H.js";
12
12
  import "./chunk-TYO2OVAD.js";
13
13
  import "./chunk-7OCVIDC7.js";
14
14
  export {
@@ -21,4 +21,4 @@ export {
21
21
  setupPlugins,
22
22
  warnIfDeprecatedPluginName
23
23
  };
24
- //# sourceMappingURL=plugins-XRGWC3NJ.js.map
24
+ //# sourceMappingURL=plugins-EEKHCMBE.js.map
@@ -496,7 +496,7 @@ async function modelsCaps(args, deps) {
496
496
  " disable: " + (rc.disableSupported ? "supported" : "unsupported") + "\n"
497
497
  );
498
498
  deps.renderer.write(
499
- " effort: " + (rc.effortSupported ? rc.effortLevels.join(", ") : "unsupported") + "\n"
499
+ " effort: " + (rc.effortSupported === void 0 ? "not enumerated (model reasons; any level forwarded)" : rc.effortSupported ? rc.effortLevels.join(", ") : "unsupported") + "\n"
500
500
  );
501
501
  deps.renderer.write(" preserve: " + rc.preserveThinking + "\n");
502
502
  } else if (caps.reasoning) {
@@ -661,4 +661,4 @@ export {
661
661
  modelsCmd,
662
662
  providersCmd
663
663
  };
664
- //# sourceMappingURL=providers-models-4FAKM2WO.js.map
664
+ //# sourceMappingURL=providers-models-D23WUD74.js.map
@@ -0,0 +1,33 @@
1
+ import { type ReasoningEffort, type SlashCommand } from '@wrongstack/core/types';
2
+ import type { SlashCommandContext } from './command-context.js';
3
+ import type { WstackPaths } from '@wrongstack/core/utils';
4
+ /**
5
+ * `/effort` — view or set the SESSION-WIDE reasoning effort applied to the
6
+ * active leader model. This is the quick, discoverable front-end for
7
+ * `Config.modelRuntime.reasoning.effort` — the same field `/settings
8
+ * reasoning-effort` writes and the WebUI "Reasoning effort" dropdown edits.
9
+ *
10
+ * Distinct from `/setmodel reasoning-effort <key>`, which pins effort onto a
11
+ * model-matrix entry (role/phase/*) for spawned subagents.
12
+ *
13
+ * Model-aware: when the active model's catalog entry advertises
14
+ * `effortLevels`, only those values are accepted and the view highlights the
15
+ * supported set. When capabilities are unknown, any canonical value is
16
+ * accepted (the runtime resolver drops unsupported values with a warning
17
+ * instead of erroring), and the view says so.
18
+ *
19
+ * Subcommands:
20
+ * (none) Show current effort, model-supported levels, and usage.
21
+ * <level> Set the session effort.
22
+ * clear Remove the setting (provider default applies).
23
+ * matrix Show per-key (role/phase/*) effort overrides, if any.
24
+ */
25
+ export declare function buildEffortCommand(opts: SlashCommandContext): SlashCommand;
26
+ /**
27
+ * Persist `Config.modelRuntime.reasoning.effort` to the active profile config.
28
+ * `undefined` removes the key entirely (JSON has no undefined). Uses the same
29
+ * read → decrypt → mutate → encrypt → atomicWrite cycle as `/setmodel` and
30
+ * `persistConfigSetting` so encrypted secrets round-trip byte-for-byte.
31
+ */
32
+ export declare function patchSessionEffort(effort: ReasoningEffort | undefined, paths: WstackPaths, activeProfile: string): Promise<void>;
33
+ //# sourceMappingURL=effort.d.ts.map
@@ -0,0 +1,58 @@
1
+ /**
2
+ * External (third-party) plugin loading for the CLI host.
3
+ *
4
+ * Three source kinds, in precedence order:
5
+ * 1. `config.plugins` entries with a bare/npm specifier — dynamically
6
+ * imported exactly as before (module resolution via the host).
7
+ * 2. `config.plugins` entries with an explicit `path` — resolved against
8
+ * the project root and imported via `file:` URL.
9
+ * 3. Directory discovery — `<globalRoot>/plugins/*` (user-global, active
10
+ * by default) and `<projectRoot>/.wrongstack/plugins/*` (project-local,
11
+ * INACTIVE by default: a cloned repo must not auto-execute plugin code
12
+ * the user never opted into).
13
+ *
14
+ * Every external plugin passes through, in order:
15
+ * - enablement resolution (same `resolvePluginEnablement` as built-ins),
16
+ * - deprecation + builtin-spec guards (passed in by the wiring so this
17
+ * module stays acyclic with wiring/plugins.ts),
18
+ * - a PRE-IMPORT TOFU trust gate keyed by the resolved entry file:
19
+ * the module is hashed before any of its code executes, first load
20
+ * pins the hash, a changed hash refuses the load until the user
21
+ * re-pins with `wstack plugin trust <name>`,
22
+ * - a shape check (default-exported object with name/apiVersion/setup),
23
+ * - a spoof guard (external plugins may not claim built-in names).
24
+ *
25
+ * First-party/built-in plugins never enter this module.
26
+ */
27
+ import type { Config, Logger, Plugin } from '@wrongstack/core/types';
28
+ /** Resolve a `file:` URL / absolute / relative path to an absolute fs path. */
29
+ export declare function normalizeConfigPath(raw: string, projectRoot: string): string;
30
+ /**
31
+ * Resolve a bare/npm specifier to its entry file WITHOUT importing it.
32
+ * Returns undefined when resolution is unavailable (bundled hosts, exotic
33
+ * specs) — callers then proceed without the pre-import trust gate.
34
+ */
35
+ export declare function resolveSpecifierEntry(spec: string): string | undefined;
36
+ export interface ExternalPluginHooks {
37
+ /** Normalize a config spec to its bare plugin name (null for paths/URLs). */
38
+ nameFromSpec(spec: string): string | null;
39
+ /** True when the spec refers to a built-in plugin (loaded elsewhere). */
40
+ isBuiltinSpec(spec: string): boolean;
41
+ /** Warn-once deprecation check; returns true when the spec is deprecated. */
42
+ warnIfDeprecated(name: string): boolean;
43
+ }
44
+ export interface LoadExternalPluginsContext {
45
+ config: Config;
46
+ log: Logger;
47
+ /** `~/.wrongstack` — anchors global discovery + the default trust store. */
48
+ globalRoot?: string | undefined;
49
+ projectRoot: string;
50
+ /** Plugin names claimed by built-ins — external plugins may not spoof them. */
51
+ reservedNames: ReadonlySet<string>;
52
+ /** Override for tests. Defaults to `~/.wrongstack/plugin-trust.json`. */
53
+ trustStorePath?: string | undefined;
54
+ /** Override for tests. Defaults to native dynamic import. */
55
+ importModule?: ((url: string) => Promise<unknown>) | undefined;
56
+ }
57
+ export declare function loadExternalPlugins(ctx: LoadExternalPluginsContext, hooks: ExternalPluginHooks): Promise<Plugin[]>;
58
+ //# sourceMappingURL=external-plugins.d.ts.map
@@ -103,6 +103,14 @@ export interface PluginsWiringDeps {
103
103
  projectDir?: string;
104
104
  /** Per-project goal.json path. Useful as a sibling anchor. */
105
105
  projectGoal?: string;
106
+ /**
107
+ * The actual code project root (the directory containing
108
+ * `<projectRoot>/.wrongstack/`). Anchors relative `path` entries in
109
+ * `config.plugins` and the project-local plugin discovery root.
110
+ * Optional — minimal hosts may omit it, in which case only
111
+ * config-specifier user plugins load.
112
+ */
113
+ projectRoot?: string;
106
114
  };
107
115
  }
108
116
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/cli",
3
- "version": "0.308.6",
3
+ "version": "0.309.0",
4
4
  "license": "MIT",
5
5
  "description": "WrongStack CLI — terminal AI coding agent with provider catalog from models.dev. Provides `wrongstack` and `wstack` binaries.",
6
6
  "keywords": [
@@ -42,32 +42,32 @@
42
42
  ],
43
43
  "dependencies": {
44
44
  "ws": "^8.21.3",
45
- "@wrongstack/bench": "0.308.6",
46
- "@wrongstack/acp": "0.308.6",
47
- "@wrongstack/core": "0.308.6",
48
- "@wrongstack/plug-lsp": "0.308.6",
49
- "@wrongstack/mcp": "0.308.6",
50
- "@wrongstack/kanban": "0.308.6",
51
- "@wrongstack/providers": "0.308.6",
52
- "@wrongstack/persistence": "0.308.6",
53
- "@wrongstack/sage": "0.308.6",
54
- "@wrongstack/plugins": "0.308.6",
55
- "@wrongstack/requirement-intake": "0.308.6",
56
- "@wrongstack/runtime": "0.308.6",
57
- "@wrongstack/techstack": "0.308.6",
58
- "@wrongstack/sdd": "0.308.6",
59
- "@wrongstack/simpleui": "0.308.6",
60
- "@wrongstack/telegram": "0.308.6",
61
- "@wrongstack/tui": "0.308.6",
62
- "@wrongstack/tools": "0.308.6",
63
- "@wrongstack/vector-memory": "0.308.6",
64
- "@wrongstack/security-scanner": "0.308.6",
65
- "@wrongstack/webui": "0.308.6",
66
- "@wrongstack/webui-hq": "0.308.6",
67
- "@wrongstack/webui-server": "0.308.6"
45
+ "@wrongstack/acp": "0.309.0",
46
+ "@wrongstack/core": "0.309.0",
47
+ "@wrongstack/kanban": "0.309.0",
48
+ "@wrongstack/bench": "0.309.0",
49
+ "@wrongstack/mcp": "0.309.0",
50
+ "@wrongstack/providers": "0.309.0",
51
+ "@wrongstack/requirement-intake": "0.309.0",
52
+ "@wrongstack/persistence": "0.309.0",
53
+ "@wrongstack/plug-lsp": "0.309.0",
54
+ "@wrongstack/sage": "0.309.0",
55
+ "@wrongstack/runtime": "0.309.0",
56
+ "@wrongstack/plugins": "0.309.0",
57
+ "@wrongstack/security-scanner": "0.309.0",
58
+ "@wrongstack/simpleui": "0.309.0",
59
+ "@wrongstack/sdd": "0.309.0",
60
+ "@wrongstack/telegram": "0.309.0",
61
+ "@wrongstack/techstack": "0.309.0",
62
+ "@wrongstack/tui": "0.309.0",
63
+ "@wrongstack/tools": "0.309.0",
64
+ "@wrongstack/vector-memory": "0.309.0",
65
+ "@wrongstack/webui": "0.309.0",
66
+ "@wrongstack/webui-hq": "0.309.0",
67
+ "@wrongstack/webui-server": "0.309.0"
68
68
  },
69
69
  "optionalDependencies": {
70
- "@wrongstack/desktop": "0.308.6"
70
+ "@wrongstack/desktop": "0.309.0"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@types/node": "^26.2.0",