@wrongstack/cli 0.303.0 → 0.305.1

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.
Files changed (32) hide show
  1. package/dist/{acp-AQMGKW6O.js → acp-5ZLGFHWP.js} +4 -2
  2. package/dist/{auth-K7CYVVKH.js → auth-EPERLKYI.js} +3 -3
  3. package/dist/boot/system-prompt-builder.d.ts +24 -1
  4. package/dist/boot/tui-project-switch.d.ts +1 -1
  5. package/dist/boot/tui-runtime-state.d.ts +14 -0
  6. package/dist/{chunk-C5NXM2SI.js → chunk-2H47YMCV.js} +5 -1
  7. package/dist/{chunk-FJVCVZIV.js → chunk-5KFLLTSQ.js} +2 -2
  8. package/dist/{chunk-JW75HY4F.js → chunk-FKWHSFX4.js} +33 -4
  9. package/dist/{chunk-LUAFQIXT.js → chunk-RHLQT3EV.js} +11 -1
  10. package/dist/{cli-main-37XO26GK.js → cli-main-6YE423OH.js} +479 -326
  11. package/dist/diag-doctor-WTBHPOMB.js +329 -0
  12. package/dist/execute-deps.d.ts +16 -0
  13. package/dist/{execution-MVOH6PAQ.js → execution-QYFWDD3Y.js} +70 -35
  14. package/dist/fleet/host-context.d.ts +2 -0
  15. package/dist/fleet/host-session-writer.d.ts +33 -0
  16. package/dist/fleet/host.d.ts +10 -0
  17. package/dist/{hq-CD77GVSS.js → hq-5G6D5YIU.js} +2 -2
  18. package/dist/{hq-server-DME6EWIO.js → hq-server-IVZLVCFV.js} +2 -2
  19. package/dist/index.js +17 -60
  20. package/dist/{mailbox-serve-DBOOOOWZ.js → mailbox-serve-V3QIJBDH.js} +2 -2
  21. package/dist/{mcp-AX6ZAFJR.js → mcp-MSARYOPN.js} +4 -2
  22. package/dist/replay-XU6ZD7GM.js +34 -0
  23. package/dist/slash-commands/memory-triage.d.ts +4 -17
  24. package/dist/subcommands/handlers/daemon-inventory.d.ts +41 -0
  25. package/dist/{webui-server-E3OPEKU5.js → webui-server-FTG7JAZU.js} +5 -5
  26. package/dist/wiring/domain-glossary.d.ts +58 -0
  27. package/dist/wiring/domain-terms-mirror.d.ts +52 -0
  28. package/dist/wiring/pipeline.d.ts +2 -0
  29. package/dist/wiring/replay.d.ts +11 -1
  30. package/dist/wiring/sage.d.ts +4 -16
  31. package/package.json +24 -23
  32. package/dist/diag-doctor-ZF5BF2MK.js +0 -169
package/dist/index.js CHANGED
@@ -1,8 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- parseWebuiSessionChildOptions,
4
- writeWebuiSessionChildError
5
- } from "./chunk-3JPTNADJ.js";
6
2
  import {
7
3
  applySimpleUiFullAutoProfile,
8
4
  detectProjectFacts,
@@ -17,11 +13,15 @@ import {
17
13
  import {
18
14
  patchConfig
19
15
  } from "./chunk-TYO2OVAD.js";
16
+ import {
17
+ parseWebuiSessionChildOptions,
18
+ writeWebuiSessionChildError
19
+ } from "./chunk-3JPTNADJ.js";
20
20
  import {
21
21
  parseArgs,
22
22
  runPicker,
23
23
  saveToGlobalConfig
24
- } from "./chunk-C5NXM2SI.js";
24
+ } from "./chunk-2H47YMCV.js";
25
25
  import {
26
26
  isKeylessLocalProvider,
27
27
  visibleModelIds
@@ -43,7 +43,7 @@ import "./chunk-U3SS4NRH.js";
43
43
  import "./chunk-NUIHRGPY.js";
44
44
  import {
45
45
  DEFAULT_PORT
46
- } from "./chunk-LUAFQIXT.js";
46
+ } from "./chunk-RHLQT3EV.js";
47
47
  import "./chunk-KE7E7DPX.js";
48
48
  import "./chunk-Q5GTM25S.js";
49
49
  import {
@@ -59,7 +59,7 @@ import {
59
59
  import "./chunk-7OCVIDC7.js";
60
60
 
61
61
  // src/cli-context.ts
62
- import { TOKENS as TOKENS4 } from "@wrongstack/core/kernel";
62
+ import { TOKENS as TOKENS3 } from "@wrongstack/core/kernel";
63
63
  import { writeErr as writeErr3 } from "@wrongstack/core/utils";
64
64
  import { setOAuthTokenPersister } from "@wrongstack/providers";
65
65
 
@@ -761,7 +761,7 @@ async function isPortInUse(host, port) {
761
761
  }
762
762
  async function handleHqShortCircuit(flags) {
763
763
  if (flags["hq"] !== true) return null;
764
- const { startHqServer } = await import("./hq-server-DME6EWIO.js");
764
+ const { startHqServer } = await import("./hq-server-IVZLVCFV.js");
765
765
  const tunnelRequested = flags["tunnel"] === true;
766
766
  const host = typeof flags["host"] === "string" ? flags["host"] : tunnelRequested ? "127.0.0.1" : HQ_CLI_DEFAULT_HOST2;
767
767
  if (tunnelRequested && !isLoopbackHost(host)) {
@@ -2306,9 +2306,9 @@ function compactSingleLine(text) {
2306
2306
 
2307
2307
  // src/subcommands/index.ts
2308
2308
  var loaders = {
2309
- acp: async () => (await import("./acp-AQMGKW6O.js")).acpCmd,
2309
+ acp: async () => (await import("./acp-5ZLGFHWP.js")).acpCmd,
2310
2310
  init: async () => (await import("./init-E2NDDOHI.js")).initCmd,
2311
- auth: async () => (await import("./auth-K7CYVVKH.js")).authCmd,
2311
+ auth: async () => (await import("./auth-EPERLKYI.js")).authCmd,
2312
2312
  update: async () => (await import("./update-VZSOZGYC.js")).updateCmd,
2313
2313
  sessions: async () => (await import("./sessions-config-YX2ZPAFM.js")).sessionsCmd,
2314
2314
  config: async () => (await import("./sessions-config-YX2ZPAFM.js")).configCmd,
@@ -2319,11 +2319,11 @@ var loaders = {
2319
2319
  skills: async () => (await import("./tools-skills-UNKLOB7M.js")).skillsCmd,
2320
2320
  providers: async () => (await import("./providers-models-VV74TRQ2.js")).providersCmd,
2321
2321
  models: async () => (await import("./providers-models-VV74TRQ2.js")).modelsCmd,
2322
- mcp: async () => (await import("./mcp-AX6ZAFJR.js")).mcpCmd,
2322
+ mcp: async () => (await import("./mcp-MSARYOPN.js")).mcpCmd,
2323
2323
  plugin: async () => (await import("./plugin-usage-PTEETL3J.js")).pluginCmd,
2324
2324
  plugins: async () => (await import("./plugin-usage-PTEETL3J.js")).pluginCmd,
2325
- diag: async () => (await import("./diag-doctor-ZF5BF2MK.js")).diagCmd,
2326
- doctor: async () => (await import("./diag-doctor-ZF5BF2MK.js")).doctorCmd,
2325
+ diag: async () => (await import("./diag-doctor-WTBHPOMB.js")).diagCmd,
2326
+ doctor: async () => (await import("./diag-doctor-WTBHPOMB.js")).doctorCmd,
2327
2327
  export: async () => (await import("./export-CCUXRJOU.js")).exportCmd,
2328
2328
  usage: async () => (await import("./plugin-usage-PTEETL3J.js")).usageCmd,
2329
2329
  version: async () => (await import("./version-help-ASKQYXDJ.js")).versionCmd,
@@ -2333,8 +2333,8 @@ var loaders = {
2333
2333
  quick: async () => (await import("./quick-VIO2BEHS.js")).quickCmd,
2334
2334
  bench: async () => (await import("./bench-XNDUJOSZ.js")).benchCmd,
2335
2335
  chronicle: async () => (await import("./chronicle-63MFCZN6.js")).chronicleCmd,
2336
- hq: async () => (await import("./hq-CD77GVSS.js")).hqCmd,
2337
- mailbox: async () => (await import("./mailbox-serve-DBOOOOWZ.js")).mailboxServeCmd,
2336
+ hq: async () => (await import("./hq-5G6D5YIU.js")).hqCmd,
2337
+ mailbox: async () => (await import("./mailbox-serve-V3QIJBDH.js")).mailboxServeCmd,
2338
2338
  permissions: async () => (await import("./permissions-2PWBL4YU.js")).permissionsCmd,
2339
2339
  project: async () => (await import("./project-BLQ3ALVL.js")).projectCmd,
2340
2340
  governance: async () => (await import("./governance-V2Z42RBE.js")).governanceCmd
@@ -2916,35 +2916,6 @@ async function runPreflight(config, initialUpdateInfo) {
2916
2916
  };
2917
2917
  }
2918
2918
 
2919
- // src/wiring/replay.ts
2920
- import { runProviderWithRetry } from "@wrongstack/core/agent";
2921
- import { TOKENS as TOKENS3 } from "@wrongstack/core/kernel";
2922
- import { ReplayProviderRunner } from "@wrongstack/core/replay";
2923
- import { ReplayLogStore } from "@wrongstack/core/storage";
2924
- function bindReplayToContainer(opts) {
2925
- const { container, wpaths, sessionId, mode, logger } = opts;
2926
- if (!opts.container.has(TOKENS3.ProviderRunner)) {
2927
- container.bind(
2928
- TOKENS3.ProviderRunner,
2929
- () => ({
2930
- run: (o) => runProviderWithRetry(o)
2931
- })
2932
- );
2933
- }
2934
- const inner = container.resolve(TOKENS3.ProviderRunner);
2935
- const log = new ReplayLogStore({ dir: wpaths.projectSessions });
2936
- const wrapped = new ReplayProviderRunner(inner, {
2937
- log,
2938
- sessionId,
2939
- mode,
2940
- logger: logger ? {
2941
- debug: (m) => logger.debug?.(m),
2942
- warn: (m) => logger.warn?.(m)
2943
- } : void 0
2944
- });
2945
- container.bind(TOKENS3.ProviderRunner, () => wrapped);
2946
- }
2947
-
2948
2919
  // src/cli-context.ts
2949
2920
  async function initializeCli(argv) {
2950
2921
  applyNodeEnvDefault();
@@ -3103,21 +3074,7 @@ async function initializeCli(argv) {
3103
3074
  renderer,
3104
3075
  modelsRegistry
3105
3076
  });
3106
- const replayFlag = ctx.flags["replay"];
3107
- const recordFlag = ctx.flags["record"];
3108
- if (typeof replayFlag === "string" || recordFlag === true) {
3109
- const sessionId = typeof replayFlag === "string" ? replayFlag : `record-${Date.now()}`;
3110
- const mode = recordFlag === true ? "record" : "replay";
3111
- bindReplayToContainer({
3112
- container,
3113
- wpaths,
3114
- sessionId,
3115
- mode,
3116
- logger
3117
- });
3118
- logger.info(`replay: ProviderRunner bound in '${mode}' mode for session ${sessionId}`);
3119
- }
3120
- const configStore = container.resolve(TOKENS4.ConfigStore);
3077
+ const configStore = container.resolve(TOKENS3.ConfigStore);
3121
3078
  return {
3122
3079
  ...ctx,
3123
3080
  updateInfo: refreshedUpdateInfo,
@@ -3132,7 +3089,7 @@ async function initializeCli(argv) {
3132
3089
  async function main(argv) {
3133
3090
  const cliCtx = await initializeCli(argv);
3134
3091
  if (typeof cliCtx === "number") return cliCtx;
3135
- const { runInteractive } = await import("./cli-main-37XO26GK.js");
3092
+ const { runInteractive } = await import("./cli-main-6YE423OH.js");
3136
3093
  return runInteractive(cliCtx);
3137
3094
  }
3138
3095
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  startCliHqConnection
3
- } from "./chunk-JW75HY4F.js";
3
+ } from "./chunk-FKWHSFX4.js";
4
4
  import "./chunk-7OCVIDC7.js";
5
5
 
6
6
  // src/subcommands/handlers/mailbox-serve.ts
@@ -341,4 +341,4 @@ function printHelp(deps) {
341
341
  export {
342
342
  mailboxServeCmd
343
343
  };
344
- //# sourceMappingURL=mailbox-serve-DBOOOOWZ.js.map
344
+ //# sourceMappingURL=mailbox-serve-V3QIJBDH.js.map
@@ -221,7 +221,9 @@ async function serveMcpStdio(deps) {
221
221
  secretScrubber: new DefaultSecretScrubber(),
222
222
  maxToolTimeoutMs: deps.config.tools?.maxToolTimeoutMs ?? 3e5,
223
223
  perIterationOutputCapBytes: 1e6,
224
- requireKanbanGovernance: true
224
+ // Kanban tracks work; it does not gate it. Off unless the operator opts in.
225
+ // See wiring/pipeline.ts for why all four hosts must agree.
226
+ requireKanbanGovernance: deps.config.tools?.kanbanGovernance ?? false
225
227
  });
226
228
  const allowed = await selectExposedTools(registry, ctx, permissionPolicy, whitelist);
227
229
  const allowedNames = new Set(allowed.map((t) => t.name));
@@ -415,4 +417,4 @@ function isRecord(value) {
415
417
  export {
416
418
  mcpCmd
417
419
  };
418
- //# sourceMappingURL=mcp-AX6ZAFJR.js.map
420
+ //# sourceMappingURL=mcp-MSARYOPN.js.map
@@ -0,0 +1,34 @@
1
+ import "./chunk-7OCVIDC7.js";
2
+
3
+ // src/wiring/replay.ts
4
+ import { runProviderWithRetry } from "@wrongstack/core/agent";
5
+ import { TOKENS } from "@wrongstack/core/kernel";
6
+ import { ReplayProviderRunner } from "@wrongstack/core/replay";
7
+ import { ReplayLogStore } from "@wrongstack/core/storage";
8
+ function bindReplayToContainer(opts) {
9
+ const { container, wpaths, sessionId, mode, logger } = opts;
10
+ if (!opts.container.has(TOKENS.ProviderRunner)) {
11
+ container.bind(
12
+ TOKENS.ProviderRunner,
13
+ () => ({
14
+ run: (o) => runProviderWithRetry(o)
15
+ })
16
+ );
17
+ }
18
+ const inner = container.resolve(TOKENS.ProviderRunner);
19
+ const log = new ReplayLogStore({ dir: wpaths.projectSessions });
20
+ const wrapped = new ReplayProviderRunner(inner, {
21
+ log,
22
+ sessionId,
23
+ mode,
24
+ logger: logger ? {
25
+ debug: (m) => logger.debug?.(m),
26
+ warn: (m) => logger.warn?.(m)
27
+ } : void 0
28
+ });
29
+ container.bind(TOKENS.ProviderRunner, () => wrapped);
30
+ }
31
+ export {
32
+ bindReplayToContainer
33
+ };
34
+ //# sourceMappingURL=replay-XU6ZD7GM.js.map
@@ -19,29 +19,16 @@
19
19
  * `/memory compact`. Falls back to a no-op LLM if the provider is absent
20
20
  * (Phase 3 and 4 will degrade to skip-only; report is still useful).
21
21
  */
22
- import type { CreateCandidateInput, SageSurface } from '@wrongstack/sage';
22
+ import type { SageSurface } from '@wrongstack/sage';
23
23
  import { type TriageReport } from '@wrongstack/sage';
24
24
  import type { SlashCommandContext } from './command-context.js';
25
25
  export declare function runTriageCommand(opts: SlashCommandContext, args: string[]): Promise<{
26
26
  message: string;
27
27
  }>;
28
- export interface ProposalFileResult {
29
- filed: number;
30
- failed: number;
31
- total: number;
32
- failures: Array<{
33
- memoryId: string;
34
- error: string;
35
- }>;
36
- /** All inputs that were submitted to Sage.createCandidate, for test verification. */
37
- inputs: CreateCandidateInput[];
38
- }
28
+ export type { ProposalFileResult } from '@wrongstack/sage';
39
29
  /**
40
30
  * File triage proposals as MemoryCandidates via the Sage surface.
41
- *
42
- * Exported for unit testing — the round-trip path through
43
- * Sage.createCandidate is the key contract: every proposal must
44
- * surface in `/memory candidates` for human review.
31
+ * Implementation lives in `@wrongstack/sage` (shared with daily dry-run).
45
32
  */
46
- export declare function fileProposals(Sage: SageSurface, proposals: TriageReport['dispatch']['proposals']): Promise<ProposalFileResult>;
33
+ export declare function fileProposals(Sage: SageSurface, proposals: TriageReport['dispatch']['proposals']): Promise<import('@wrongstack/sage').ProposalFileResult>;
47
34
  //# sourceMappingURL=memory-triage.d.ts.map
@@ -0,0 +1,41 @@
1
+ export type DaemonStatus =
2
+ /** Answering on its endpoint. */
3
+ 'live'
4
+ /**
5
+ * The endpoint exists on disk but nothing answers on it. This is the wedge:
6
+ * clients get ECONNREFUSED and conclude "spawn one", the replacement gets
7
+ * EADDRINUSE from the leftover file. Self-healing daemons reclaim it on
8
+ * their next start; seeing this means one has not been started since.
9
+ */
10
+ | 'stale'
11
+ /** No endpoint and no daemon. The normal state before first use. */
12
+ | 'stopped';
13
+ export interface DaemonReport {
14
+ readonly name: string;
15
+ readonly endpoint: string;
16
+ readonly status: DaemonStatus;
17
+ /** Owning process id, when a metadata file was readable. */
18
+ readonly pid?: number;
19
+ }
20
+ export interface DaemonInventoryOptions {
21
+ readonly projectRoot: string;
22
+ /**
23
+ * The project's slot under the global root — `~/.wrongstack/projects/<hash>`,
24
+ * NOT the in-repo `.wrongstack/`. Most daemons key their endpoint and
25
+ * metadata off this; kanban is the exception and uses the repo directory.
26
+ */
27
+ readonly projectDir: string;
28
+ }
29
+ /** Probe every project daemon concurrently. Never spawns one. */
30
+ export declare function collectDaemonReports(options: DaemonInventoryOptions): Promise<readonly DaemonReport[]>;
31
+ /**
32
+ * Delete stale endpoints so the next client spawn can bind.
33
+ *
34
+ * Only ever removes an endpoint that a fresh probe just reported as stale —
35
+ * unlinking a live daemon's socket would sever every connected client and
36
+ * elect a second writer over the same database. Restarting is therefore not
37
+ * an operation this offers: daemons are spawned on demand, so clearing the
38
+ * wedge is the whole job, and the next command that needs one starts it.
39
+ */
40
+ export declare function clearStaleDaemonEndpoints(options: DaemonInventoryOptions): Promise<readonly string[]>;
41
+ //# sourceMappingURL=daemon-inventory.d.ts.map
@@ -1,12 +1,12 @@
1
- import {
2
- createKanbanRunMirror
3
- } from "./chunk-VCYZ3WZV.js";
4
1
  import {
5
2
  createHqCommandDispatcher
6
3
  } from "./chunk-7YLN7YUA.js";
4
+ import {
5
+ createKanbanRunMirror
6
+ } from "./chunk-VCYZ3WZV.js";
7
7
  import {
8
8
  startCliHqConnection
9
- } from "./chunk-JW75HY4F.js";
9
+ } from "./chunk-FKWHSFX4.js";
10
10
  import {
11
11
  WEBUI_SESSION_CHILD_CAPABILITIES
12
12
  } from "./chunk-3JPTNADJ.js";
@@ -1591,4 +1591,4 @@ async function runWebUI(opts) {
1591
1591
  export {
1592
1592
  runWebUI
1593
1593
  };
1594
- //# sourceMappingURL=webui-server-E3OPEKU5.js.map
1594
+ //# sourceMappingURL=webui-server-FTG7JAZU.js.map
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Narrow adapter that bridges the resolved SAGE `MemoryPort` to the
3
+ * `DomainGlossary` shape the prompt builder consumes.
4
+ *
5
+ * Background
6
+ * ----------
7
+ * The agent system prompt wants a compact `[Project Jargon Dictionary]`
8
+ * block listing only the project's `domain-term`-tagged memories. The
9
+ * block must come from SAGE so the same single-owner-of-SQLite invariant
10
+ * holds (per `packages/sage/docs/direct-icp-usage.md`). But the prompt
11
+ * builder runs **before** any per-turn SAGE middleware has filtered the
12
+ * corpus — so we can't simply hand it the legacy `MemoryStore` and ask
13
+ * it to call `list()`. That would scan every memory on every prompt
14
+ * build, which is exactly what the glossary block was supposed to
15
+ * avoid.
16
+ *
17
+ * Instead, we ask SAGE for only the `domain-term`-tagged subset using
18
+ * the typed `SageServiceLike.searchSage({ query: 'domain-term', limit })`
19
+ * op (which performs the tag/keyword filter at the SQL layer), then map
20
+ * the resulting `Sage[]` into the canonical `MemoryEntry` shape that
21
+ * `renderDomainGlossary` in `packages/core/src/core/system-prompt-glossary.ts`
22
+ * is typed against.
23
+ *
24
+ * Architectural rule
25
+ * ------------------
26
+ * This module imports from `@wrongstack/sage` directly — **never** from
27
+ * `@wrongstack/sage-mcp`. The CLI is an in-process consumer; the MCP
28
+ * surface is reserved for out-of-process clients (Claude Desktop, other
29
+ * agent runtimes).
30
+ */
31
+ import type { MemoryEntry, MemoryPort } from '@wrongstack/core/types';
32
+ /**
33
+ * Narrow `MemoryEntry`-shaped list provider for the `[Project Jargon Dictionary]`
34
+ * block. Returns only `domain-term`-tagged SAGE memories, mapped to the
35
+ * canonical `MemoryEntry` shape `renderDomainGlossary` is typed against.
36
+ *
37
+ * Robustness contract:
38
+ * - If the port is the legacy `LegacyMemoryPortAdapter` (no SAGE
39
+ * capability), the helper returns an empty glossary rather than
40
+ * throwing — the prompt must still assemble.
41
+ * - If `searchSage` rejects, the wrapper returns an empty glossary
42
+ * for this prompt build; SAGE itself remains the source of truth and
43
+ * the next prompt retry can succeed.
44
+ */
45
+ export interface DomainGlossaryListProvider {
46
+ list(scope: 'project-memory', limit?: number): Promise<ReadonlyArray<MemoryEntry>>;
47
+ }
48
+ /**
49
+ * Build a `DomainGlossaryListProvider` over a SAGE-aware `MemoryPort`.
50
+ *
51
+ * The mapping is honest: every `MemoryEntry` field that core will read
52
+ * (`text`, `tags`, `confidence`, `ts`, `priority`) is populated from the
53
+ * corresponding `Sage` field. `text` is preserved verbatim because
54
+ * `SageDomainTermExtractor` writes the canonical `"Term — Definition"`
55
+ * format that `parseTermEntry` in core splits back apart.
56
+ */
57
+ export declare function createDomainGlossaryAdapter(memoryStore: MemoryPort): DomainGlossaryListProvider;
58
+ //# sourceMappingURL=domain-glossary.d.ts.map
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Refresh the `.wrongstack/domain-terms.md` mirror file from the
3
+ * resolved SAGE `MemoryPort` at CLI boot.
4
+ *
5
+ * Background
6
+ * ----------
7
+ * The Project Jargon Dictionary feature splits ownership between two
8
+ * storage backends (per `packages/sage/docs/direct-icp-usage.md`):
9
+ * - SAGE's SQLite store is the authoritative source of truth.
10
+ * - `.wrongstack/domain-terms.md` is a *derived* view of the same
11
+ * data, kept on disk so humans (and ProjectRoot sandboxes) can
12
+ * read the glossary without going through the IPC client.
13
+ *
14
+ * `SageDomainTermExtractor.writeDomainTermsFile` already knows how to
15
+ * regenerate the file from the canonical SAGE state. What it lacks
16
+ * is a runtime host caller — the helper exists only in tests. This
17
+ * module closes that gap for the CLI host.
18
+ *
19
+ * Behaviour
20
+ * ---------
21
+ * - **Fire and forget at boot.** The mirror is a derived artefact;
22
+ * a failure to refresh at startup must not abort the CLI. The
23
+ * helper logs via `writeErr` and returns `null` on failure.
24
+ * - **Idempotent.** Calling this on every boot is safe: the file is
25
+ * regenerated atomically by `writeDomainTermsFile`, and the content
26
+ * is fully derived from SAGE state.
27
+ * - **Honest about scope.** Only the CLI host invokes this. TUI and
28
+ * WebUI hosts share the same SAGE port and read the same file; the
29
+ * CLI boot path is the canonical place to refresh the mirror.
30
+ */
31
+ import type { MemoryPort } from '@wrongstack/core/types';
32
+ export interface RefreshDomainTermsMirrorOptions {
33
+ /** Absolute project root whose `.wrongstack/domain-terms.md` should be refreshed. */
34
+ projectRoot: string;
35
+ /**
36
+ * Resolved SAGE `MemoryPort`. The extractor reads the `domain-term`
37
+ * tagged subset from this port.
38
+ */
39
+ memoryStore: MemoryPort;
40
+ }
41
+ /**
42
+ * Regenerate the mirror file from the current SAGE state.
43
+ *
44
+ * Returns the absolute path of the written file, or `null` when the
45
+ * refresh failed (the CLI logs the underlying reason to stderr and
46
+ * continues — the SAGE corpus remains authoritative).
47
+ *
48
+ * Never throws — callers are guaranteed to receive a `string | null`
49
+ * outcome.
50
+ */
51
+ export declare function refreshDomainTermsMirror(options: RefreshDomainTermsMirrorOptions): Promise<string | null>;
52
+ //# sourceMappingURL=domain-terms-mirror.d.ts.map
@@ -79,6 +79,8 @@ export declare function createAgent(params: {
79
79
  maxToolTimeoutMs?: number | undefined;
80
80
  defaultExecutionStrategy: 'parallel' | 'sequential' | 'smart';
81
81
  perIterationOutputCapBytes: number;
82
+ /** Opt-in Kanban governance gate; see ToolsConfig.kanbanGovernance. */
83
+ kanbanGovernance?: boolean | undefined;
82
84
  loopDetection?: import('@wrongstack/core/types').LoopDetectionConfig | undefined;
83
85
  };
84
86
  };
@@ -23,11 +23,21 @@ import type { WstackPaths } from '@wrongstack/core/utils';
23
23
  * The log lives next to the session JSONL via
24
24
  * `sessionScopedPath(projectSessions, sessionId, '.replay.jsonl')`,
25
25
  * colocated with annotations and audit sidecars.
26
+ *
27
+ * Call this AFTER the session exists. `TOKENS.ProviderRunner` is resolved per
28
+ * request inside the agent loop, not at agent construction, so the binding only
29
+ * has to be in place before the first `run()` — which is what lets `--record`
30
+ * name the real session instead of inventing one.
26
31
  */
27
32
  export interface BindReplayOptions {
28
33
  container: Container;
29
34
  wpaths: WstackPaths;
30
- sessionId: string;
35
+ /**
36
+ * Explicit id for `--replay <id>`, or a resolver for `--record` so the log
37
+ * lands beside the live session's transcript instead of under a synthetic
38
+ * name. See {@link ReplayProviderRunnerOptions.sessionId}.
39
+ */
40
+ sessionId: string | (() => string);
31
41
  mode: ReplayMode;
32
42
  logger?: Logger | undefined;
33
43
  }
@@ -1,19 +1,7 @@
1
- import type { AgentPipelines } from '@wrongstack/core/agent';
2
- import type { EventBus } from '@wrongstack/core/kernel';
3
- import type { Config, Logger, MemoryPort } from '@wrongstack/core/types';
4
- export interface SageWiringDeps {
5
- config: Config;
6
- pipelines: AgentPipelines;
7
- memoryStore: MemoryPort | undefined;
8
- logger: Logger;
9
- events: EventBus;
10
- getSessionId?: (() => string | undefined) | undefined;
11
- }
12
1
  /**
13
- * Test-only: reset the auto-hygiene throttle so the next teardown always
14
- * runs hygiene. Used by the regression test to verify the throttle skips
15
- * on the second call within the interval.
2
+ * CLI host adapter for shared SAGE wiring.
3
+ *
4
+ * Implementation lives in `@wrongstack/sage` so CLI and WebUI cannot drift.
16
5
  */
17
- export declare function _resetAutoHygieneThrottleForTesting(): void;
18
- export declare function setupSage(deps: SageWiringDeps): () => Promise<void>;
6
+ export { AUTO_HYGIENE_INTERVAL_MS, _resetAutoHygieneThrottleForTesting, sageHygieneOptionsFromConfig, setupSage, type SageHostWiringDeps as SageWiringDeps, } from '@wrongstack/sage';
19
7
  //# sourceMappingURL=sage.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/cli",
3
- "version": "0.303.0",
3
+ "version": "0.305.1",
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,30 +42,31 @@
42
42
  ],
43
43
  "dependencies": {
44
44
  "ws": "^8.21.1",
45
- "@wrongstack/acp": "0.303.0",
46
- "@wrongstack/bench": "0.303.0",
47
- "@wrongstack/core": "0.303.0",
48
- "@wrongstack/plug-lsp": "0.303.0",
49
- "@wrongstack/runtime": "0.303.0",
50
- "@wrongstack/security-scanner": "0.303.0",
51
- "@wrongstack/mcp": "0.303.0",
52
- "@wrongstack/plugins": "0.303.0",
53
- "@wrongstack/providers": "0.303.0",
54
- "@wrongstack/sdd": "0.303.0",
55
- "@wrongstack/kanban": "0.303.0",
56
- "@wrongstack/requirement-intake": "0.303.0",
57
- "@wrongstack/sage": "0.303.0",
58
- "@wrongstack/simpleui": "0.303.0",
59
- "@wrongstack/tui": "0.303.0",
60
- "@wrongstack/tools": "0.303.0",
61
- "@wrongstack/webui-hq": "0.303.0",
62
- "@wrongstack/techstack": "0.303.0",
63
- "@wrongstack/telegram": "0.303.0",
64
- "@wrongstack/webui": "0.303.0",
65
- "@wrongstack/webui-server": "0.303.0"
45
+ "@wrongstack/core": "0.305.1",
46
+ "@wrongstack/mcp": "0.305.1",
47
+ "@wrongstack/acp": "0.305.1",
48
+ "@wrongstack/bench": "0.305.1",
49
+ "@wrongstack/persistence": "0.305.1",
50
+ "@wrongstack/kanban": "0.305.1",
51
+ "@wrongstack/plugins": "0.305.1",
52
+ "@wrongstack/providers": "0.305.1",
53
+ "@wrongstack/plug-lsp": "0.305.1",
54
+ "@wrongstack/sage": "0.305.1",
55
+ "@wrongstack/runtime": "0.305.1",
56
+ "@wrongstack/requirement-intake": "0.305.1",
57
+ "@wrongstack/simpleui": "0.305.1",
58
+ "@wrongstack/sdd": "0.305.1",
59
+ "@wrongstack/security-scanner": "0.305.1",
60
+ "@wrongstack/telegram": "0.305.1",
61
+ "@wrongstack/techstack": "0.305.1",
62
+ "@wrongstack/tools": "0.305.1",
63
+ "@wrongstack/tui": "0.305.1",
64
+ "@wrongstack/webui-hq": "0.305.1",
65
+ "@wrongstack/webui": "0.305.1",
66
+ "@wrongstack/webui-server": "0.305.1"
66
67
  },
67
68
  "optionalDependencies": {
68
- "@wrongstack/desktop": "0.303.0"
69
+ "@wrongstack/desktop": "0.305.1"
69
70
  },
70
71
  "devDependencies": {
71
72
  "@types/node": "^26.1.2",