@wrongstack/cli 1.0.27 → 1.0.29

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 (46) hide show
  1. package/data/providers.json +22 -0
  2. package/dist/{acp-M4565YUW.js → acp-QWCBMQSO.js} +2 -2
  3. package/dist/{chunk-RGFWGUAB.js → chunk-4UWCMBPG.js} +159 -3
  4. package/dist/{chunk-ENRYW73H.js → chunk-6A7URMWN.js} +79 -8
  5. package/dist/{chunk-HDMFKTT3.js → chunk-7IQWQCBH.js} +5 -2
  6. package/dist/{chunk-5JYDKG5B.js → chunk-BZHT5GPF.js} +6 -1
  7. package/dist/{chunk-HFZH2XJN.js → chunk-IFQ6NQPL.js} +4 -4
  8. package/dist/{chunk-N57IU5FG.js → chunk-KT34LWIS.js} +10 -9
  9. package/dist/{chunk-UZ2TMHNH.js → chunk-UKP7H2U4.js} +10 -2
  10. package/dist/{chunk-EPR42SWM.js → chunk-WRYZLEXP.js} +20 -1
  11. package/dist/{cli-context-C7RBSWHF.js → cli-context-6RONY47P.js} +18 -18
  12. package/dist/{cli-main-TQTH73ZK.js → cli-main-YS3HIOSD.js} +827 -313
  13. package/dist/{execution-3STBD2U7.js → execution-JEYF2L7O.js} +32 -24
  14. package/dist/fleet/host-explore-companion.d.ts +1 -1
  15. package/dist/fleet/host-memory-companion.d.ts +43 -0
  16. package/dist/fleet/host-subagent-factory.d.ts +1 -1
  17. package/dist/fleet/host.d.ts +1 -0
  18. package/dist/fleet/memory-companion-evidence.d.ts +12 -0
  19. package/dist/fleet/memory-companion-policy.d.ts +9 -0
  20. package/dist/goal-commands.d.ts +10 -0
  21. package/dist/{hq-44F4OQH2.js → hq-BNK67HOE.js} +3 -3
  22. package/dist/hq-publisher.d.ts +4 -1
  23. package/dist/hq-server/sage-sync-send.d.ts +5 -0
  24. package/dist/hq-server/server-lifecycle.d.ts +1 -1
  25. package/dist/hq-server/snapshot.d.ts +1 -1
  26. package/dist/{hq-server-UIB24LU6.js → hq-server-PCQACV7Y.js} +2 -2
  27. package/dist/hq-ttl-N4DAIAVX.js +7 -0
  28. package/dist/index.js +3 -3
  29. package/dist/{mailbox-serve-GNGXEQ2R.js → mailbox-serve-FW3JCCPK.js} +2 -2
  30. package/dist/{per-subcommand-help-QDAQASPZ.js → per-subcommand-help-MWQWFIAV.js} +2 -2
  31. package/dist/sage-FFKUOCQL.js +475 -0
  32. package/dist/sage-connect.d.ts +62 -0
  33. package/dist/sage-hq-sync.d.ts +8 -0
  34. package/dist/sage-sync-ZMTHB477.js +69 -0
  35. package/dist/services/run-git.d.ts +3 -1
  36. package/dist/{sessions-config-XHLXJ5C3.js → sessions-config-JGIZRNT6.js} +15 -4
  37. package/dist/{short-circuit-flags-5TNTJPQR.js → short-circuit-flags-5N2LPK4R.js} +3 -3
  38. package/dist/subcommands/handlers/helpers.d.ts +1 -1
  39. package/dist/subcommands/handlers/sage-sync.d.ts +4 -0
  40. package/dist/subcommands/handlers/sage.d.ts +5 -0
  41. package/dist/{subcommands-BHQYLDSD.js → subcommands-WX4GDMWB.js} +2 -2
  42. package/dist/{typesafe-U7YB2RRV.js → typesafe-WA5O3KVS.js} +10 -2
  43. package/dist/{version-help-XJJQ7YSH.js → version-help-HN32QYQN.js} +2 -2
  44. package/dist/{webui-server-GCXIO3JY.js → webui-server-EXJWLB3X.js} +10 -8
  45. package/package.json +30 -29
  46. package/dist/hq-ttl-VJR65OBJ.js +0 -7
@@ -6,11 +6,25 @@ import {
6
6
  runGit,
7
7
  setAutoSuggestions,
8
8
  setSuggestions
9
- } from "./chunk-HDMFKTT3.js";
9
+ } from "./chunk-7IQWQCBH.js";
10
10
  import {
11
11
  deriveFsAccessPair,
12
12
  persistConfigSetting
13
13
  } from "./chunk-SFBFYIOW.js";
14
+ import "./chunk-WHOIR577.js";
15
+ import {
16
+ advanceToNextTask,
17
+ autoDetectTaskCompletion,
18
+ getActiveSDDContext,
19
+ getActiveSDDPhase,
20
+ getCurrentExecutingContext,
21
+ getTaskListText,
22
+ getTaskProgress,
23
+ renderTaskListWithProgress,
24
+ trySaveImplementationPlan,
25
+ trySaveSpecFromAIOutput,
26
+ trySaveTasksFromAIOutput
27
+ } from "./chunk-JHUJUIOH.js";
14
28
  import {
15
29
  checkStructuredAnswer,
16
30
  parseOutputFormat,
@@ -22,35 +36,21 @@ import {
22
36
  import {
23
37
  theme
24
38
  } from "./chunk-QD544J2B.js";
39
+ import {
40
+ fmtTok
41
+ } from "./chunk-EWKESL4L.js";
25
42
  import {
26
43
  WEBUI_SESSION_CHILD_CAPABILITIES,
27
44
  writeWebuiSessionChildError,
28
45
  writeWebuiSessionChildReady
29
46
  } from "./chunk-ZMX5HRLI.js";
30
- import {
31
- fmtTok
32
- } from "./chunk-EWKESL4L.js";
33
- import "./chunk-WHOIR577.js";
34
- import {
35
- advanceToNextTask,
36
- autoDetectTaskCompletion,
37
- getActiveSDDContext,
38
- getActiveSDDPhase,
39
- getCurrentExecutingContext,
40
- getTaskListText,
41
- getTaskProgress,
42
- renderTaskListWithProgress,
43
- trySaveImplementationPlan,
44
- trySaveSpecFromAIOutput,
45
- trySaveTasksFromAIOutput
46
- } from "./chunk-JHUJUIOH.js";
47
47
  import {
48
48
  terminalLink,
49
49
  terminalText
50
50
  } from "./chunk-HXJYHAR4.js";
51
51
  import {
52
52
  startCliHqConnection
53
- } from "./chunk-RGFWGUAB.js";
53
+ } from "./chunk-4UWCMBPG.js";
54
54
  import {
55
55
  CLI_VERSION
56
56
  } from "./chunk-F5DCFAKI.js";
@@ -84,9 +84,12 @@ import { color, writeOut } from "@wrongstack/core/utils";
84
84
  import { ERROR_CODES } from "@wrongstack/core/types";
85
85
  var CONTEXT_OVERFLOW_RE = /context window|exceeds the context|too many tokens|context.*tokens/i;
86
86
  function contextOverflowHint(err) {
87
+ if (!err || typeof err !== "object") return null;
87
88
  const structured = err.code === ERROR_CODES.PROVIDER_CONTEXT_OVERFLOW || err.code === ERROR_CODES.AGENT_CONTEXT_OVERFLOW;
88
- const textual = CONTEXT_OVERFLOW_RE.test(`${err.message}
89
- ${err.describe()}`);
89
+ const desc = typeof err.describe === "function" ? err.describe() : "";
90
+ const message = typeof err.message === "string" ? err.message : "";
91
+ const textual = CONTEXT_OVERFLOW_RE.test(`${message}
92
+ ${desc}`);
90
93
  if (!structured && !textual) return null;
91
94
  return [
92
95
  "Provider rejected the request as over its effective context window.",
@@ -354,7 +357,7 @@ async function runWebUIDispatch(ctx) {
354
357
  const isSimpleUi = !isSessionChild && flags["simpleui"] === true;
355
358
  agent.disableInteractiveConfirmation();
356
359
  renderer.setSilent(true);
357
- const { runWebUI } = await import("./webui-server-GCXIO3JY.js");
360
+ const { runWebUI } = await import("./webui-server-EXJWLB3X.js");
358
361
  const flagValue = (names) => {
359
362
  for (const name of names) {
360
363
  if (!Object.hasOwn(flags, name)) continue;
@@ -3284,7 +3287,12 @@ async function resumeSession(ctx, sessionId) {
3284
3287
  agent.ctx.session = resumed.writer;
3285
3288
  try {
3286
3289
  agent.ctx.state.replaceMessages(resumed.data.messages);
3287
- restoreSessionSubagentPolicy(agent.ctx, resumed.data.events, resumed.data.subagentsAllowed);
3290
+ restoreSessionSubagentPolicy(
3291
+ agent.ctx,
3292
+ resumed.data.events,
3293
+ resumed.data.subagentsAllowed,
3294
+ resumed.data.subagentCompanionsAllowed
3295
+ );
3288
3296
  restoreSessionSubagentModelPlan(agent.ctx, resumed.data.events);
3289
3297
  restoreSessionPermissionOverrides2(agent.ctx.meta, resumed.data);
3290
3298
  restoreRequiredSkillsFromEvents2(agent.ctx, resumed.data.events);
@@ -7342,4 +7350,4 @@ export {
7342
7350
  execute,
7343
7351
  resolveReviewerFallbackModels
7344
7352
  };
7345
- //# sourceMappingURL=execution-3STBD2U7.js.map
7353
+ //# sourceMappingURL=execution-JEYF2L7O.js.map
@@ -41,7 +41,7 @@ interface HostExploreCompanionInput {
41
41
  mailboxProjectDir: string;
42
42
  roster: Record<string, SubagentConfig>;
43
43
  config?: HostExploreCompanionConfig | undefined;
44
- subagentsAllowed?: (() => boolean) | undefined;
44
+ companionsAllowed?: (() => boolean) | undefined;
45
45
  }
46
46
  export declare function createHostExploreCompanion(input: HostExploreCompanionInput): ExploreCompanion | null;
47
47
  export {};
@@ -0,0 +1,43 @@
1
+ import type { Director } from '@wrongstack/core/coordination';
2
+ import type { EventBus } from '@wrongstack/core/kernel';
3
+ import type { SubagentConfig } from '@wrongstack/core/types';
4
+ import { type SageSurface } from '@wrongstack/sage';
5
+ import { snapshotMemoryEvidence } from './memory-companion-evidence.js';
6
+ interface Input {
7
+ director: Director;
8
+ events: EventBus;
9
+ projectRoot: string;
10
+ roster: Record<string, SubagentConfig>;
11
+ memory: () => SageSurface | undefined;
12
+ enabled: (sessionId: string) => boolean;
13
+ scrub: (text: string) => string;
14
+ note: (sessionId: string, subject: string, body: string) => void;
15
+ /** Test seams; production uses bounded file snapshots and a 75-second watchdog. */
16
+ snapshot?: typeof snapshotMemoryEvidence;
17
+ timeoutMs?: number;
18
+ ioTimeoutMs?: number;
19
+ }
20
+ /** One bounded worker at a time; one lazily spawned resident per live conversation. */
21
+ export declare class HostMemoryCompanion {
22
+ private readonly input;
23
+ private sessions;
24
+ private pending;
25
+ private cooldown;
26
+ private draining;
27
+ private stopped;
28
+ private active;
29
+ private readonly off;
30
+ constructor(input: Input);
31
+ ensure(sessionId: string): void;
32
+ release(sessionId: string): void;
33
+ stop(): void;
34
+ private allowed;
35
+ private enqueue;
36
+ private drain;
37
+ private review;
38
+ private send;
39
+ private withinIoBudget;
40
+ private spawnBounded;
41
+ }
42
+ export {};
43
+ //# sourceMappingURL=host-memory-companion.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { type AgentFactory, type DirectorSessionFactory } from '@wrongstack/core/coordination';
2
- import type { ToolRegistry } from '@wrongstack/core/registry';
2
+ import { ToolRegistry } from '@wrongstack/core/registry';
3
3
  import type { Config, SubagentConfig, Tool } from '@wrongstack/core/types';
4
4
  import type { MultiAgentDeps, MultiAgentHostOptions } from './host-types.js';
5
5
  interface HostSubagentFactoryContext {
@@ -60,6 +60,7 @@ export declare class MultiAgentHost {
60
60
  * fleet.exploreCompanion.enabled=false. Probes are assigned to a
61
61
  * lazily-spawned resident `explore-companion` subagent per session. */
62
62
  private exploreCompanions;
63
+ private memoryCompanion;
63
64
  /** `agent.run.started` subscription that opens a companion for a new tab. */
64
65
  private exploreCompanionOff;
65
66
  /** Built-ins plus lazily-resolved project-created roles. */
@@ -0,0 +1,12 @@
1
+ import type { MemoryEvidenceSnapshot } from '@wrongstack/sage';
2
+ export { type MemoryEvidenceSnapshot, snapshotMemoryEvidence } from '@wrongstack/sage';
3
+ export interface MemoryCompanionVerdict {
4
+ verdict: 'supported' | 'outdated' | 'contradicted' | 'unverifiable' | 'irrelevant';
5
+ summary: string;
6
+ evidence: Array<{
7
+ path: string;
8
+ quote: string;
9
+ }>;
10
+ }
11
+ export declare function parseMemoryCompanionVerdict(raw: string, snapshot: MemoryEvidenceSnapshot): MemoryCompanionVerdict | undefined;
12
+ //# sourceMappingURL=memory-companion-evidence.d.ts.map
@@ -0,0 +1,9 @@
1
+ import type { SubagentConfig, Tool } from '@wrongstack/core/types';
2
+ export declare const MEMORY_COMPANION_READ_TOOLS: string[];
3
+ /** This predicate only narrows privileges; copying the prefix cannot grant any. */
4
+ export declare function isMemoryCompanion(config: SubagentConfig): boolean;
5
+ /** Reapply the host's read-only boundary AFTER project role/model overrides. */
6
+ export declare function constrainMemoryCompanion(config: SubagentConfig): SubagentConfig;
7
+ /** Do not auto-add session_note: all conclusions must pass the host's evidence gate. */
8
+ export declare function memoryCompanionTools(available: readonly Tool[]): Tool[];
9
+ //# sourceMappingURL=memory-companion-policy.d.ts.map
@@ -8,6 +8,16 @@ export declare function pathExists(p: string): Promise<boolean>;
8
8
  * test run); gitText keeps the head (its commands are tiny).
9
9
  */
10
10
  export declare const MAX_CMD_OUTPUT = 200000;
11
+ /**
12
+ * The last `cap` characters of a stream, trimmed WHILE it grows (at 2x the
13
+ * cap, so amortized linear). Collecting every chunk and slicing once at the
14
+ * end held the whole transcript: +146 MB retained for 150 MB of output.
15
+ */
16
+ export declare function createTailBuffer(cap: number): {
17
+ push(chunk: string): void;
18
+ value(): string;
19
+ retained(): number;
20
+ };
11
21
  /** Run a git command, returning trimmed stdout (empty string on failure). */
12
22
  export declare function gitText(args: string[], cwd: string): Promise<{
13
23
  code: number;
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-Q7E3BPDU.js";
11
11
  import {
12
12
  parseTokenTtlValue
13
- } from "./chunk-UZ2TMHNH.js";
13
+ } from "./chunk-UKP7H2U4.js";
14
14
 
15
15
  // src/subcommands/handlers/hq.ts
16
16
  import {
@@ -329,7 +329,7 @@ var hqCmd = async (args, deps) => {
329
329
  return 1;
330
330
  };
331
331
  async function startServer(deps) {
332
- const { startHqServer } = await import("./hq-server-UIB24LU6.js");
332
+ const { startHqServer } = await import("./hq-server-PCQACV7Y.js");
333
333
  const dataDir = resolveDataDir(deps);
334
334
  const flags = deps.flags ?? {};
335
335
  const rawPublicUrl = typeof flags["hq-public-url"] === "string" ? flags["hq-public-url"] : process.env.WRONGSTACK_HQ_PUBLIC_URL;
@@ -1004,4 +1004,4 @@ export {
1004
1004
  hqCmd,
1005
1005
  resolveAuditActor
1006
1006
  };
1007
- //# sourceMappingURL=hq-44F4OQH2.js.map
1007
+ //# sourceMappingURL=hq-BNK67HOE.js.map
@@ -1,6 +1,8 @@
1
1
  import type { CreateHqPublisherOptions, HqPublisher } from '@wrongstack/core/hq';
2
+ import type { Config } from '@wrongstack/core/types';
2
3
  import { type KanbanHqSyncStats } from './kanban-hq-sync.js';
3
- type CliHqPublisherOptions = Omit<CreateHqPublisherOptions, 'socketFactory'> & {
4
+ type CliHqPublisherOptions = Omit<CreateHqPublisherOptions, 'socketFactory' | 'appConfig'> & {
5
+ appConfig?: Pick<Config, 'hq' | 'Sage'> | undefined;
4
6
  socketFactory?: CreateHqPublisherOptions['socketFactory'];
5
7
  };
6
8
  export interface CliHqConnection {
@@ -29,6 +31,7 @@ interface CliHqConnectionOptions extends CliHqPublisherOptions {
29
31
  * two writers applying the same remote snapshots to the same board files.
30
32
  */
31
33
  ownKanbanSync?: boolean | undefined;
34
+ ownSageSync?: boolean | undefined;
32
35
  }
33
36
  export declare function createCliHqPublisher(options: CliHqPublisherOptions): HqPublisher | undefined;
34
37
  export declare function startCliHqConnection(options: CliHqConnectionOptions): CliHqConnection;
@@ -0,0 +1,5 @@
1
+ import { type HqSageSnapshotPayload } from '@wrongstack/core/hq';
2
+ import type { WebSocket } from 'ws';
3
+ /** Pace the initial corpus by socket flushes, keeping large projects below the queue cap. */
4
+ export declare function sendSageSnapshot(ws: WebSocket, snapshot: HqSageSnapshotPayload): Promise<boolean>;
5
+ //# sourceMappingURL=sage-sync-send.d.ts.map
@@ -4,8 +4,8 @@
4
4
  * @module hq-server/server-lifecycle
5
5
  */
6
6
  import type { Server as HttpServer } from 'node:http';
7
- import type { WebSocket, WebSocketServer } from 'ws';
8
7
  import type { HqPersistence } from '@wrongstack/core/hq';
8
+ import type { WebSocket, WebSocketServer } from 'ws';
9
9
  import type { LoginAttemptStore } from './login-attempt-store.js';
10
10
  import type { MailboxGatewayManager } from './mailbox-gateway-manager.js';
11
11
  interface HqServerShutdownParams {
@@ -24,7 +24,7 @@ export declare const HQ_BROWSER_MAX_BUFFERED_BYTES: number;
24
24
  * always-loaded graph, and a static import would drag that whole package into
25
25
  * boot, which the CLI keeps behind a lazy import on purpose.
26
26
  */
27
- export declare function sendGuarded(ws: WebSocket, data: string): boolean;
27
+ export declare function sendGuarded(ws: WebSocket, data: string, callback?: (error?: Error) => void): boolean;
28
28
  /**
29
29
  * How long a session/fleet snapshot may go unrefreshed before it is treated
30
30
  * as gone.
@@ -10,7 +10,7 @@ import {
10
10
  readLocalSubagentTranscript,
11
11
  sanitizeApiError,
12
12
  startHqServer
13
- } from "./chunk-ENRYW73H.js";
13
+ } from "./chunk-6A7URMWN.js";
14
14
  import "./chunk-HXJYHAR4.js";
15
15
  import "./chunk-5EA6OTLJ.js";
16
16
  import "./chunk-Q7E3BPDU.js";
@@ -27,4 +27,4 @@ export {
27
27
  sanitizeApiError,
28
28
  startHqServer
29
29
  };
30
- //# sourceMappingURL=hq-server-UIB24LU6.js.map
30
+ //# sourceMappingURL=hq-server-PCQACV7Y.js.map
@@ -0,0 +1,7 @@
1
+ import {
2
+ parseTokenTtlValue
3
+ } from "./chunk-UKP7H2U4.js";
4
+ export {
5
+ parseTokenTtlValue
6
+ };
7
+ //# sourceMappingURL=hq-ttl-N4DAIAVX.js.map
package/dist/index.js CHANGED
@@ -20,14 +20,14 @@ async function main(argv) {
20
20
  applyAsciiMode(earlyFlags);
21
21
  }
22
22
  if (earlyFlags["help"] === true || earlyFlags["version"] === true) {
23
- const { handleHelpVersionShortCircuit } = await import("./short-circuit-flags-5TNTJPQR.js");
23
+ const { handleHelpVersionShortCircuit } = await import("./short-circuit-flags-5N2LPK4R.js");
24
24
  const earlyExit = await handleHelpVersionShortCircuit(argv);
25
25
  if (earlyExit !== null) return earlyExit;
26
26
  }
27
- const { initializeCli } = await import("./cli-context-C7RBSWHF.js");
27
+ const { initializeCli } = await import("./cli-context-6RONY47P.js");
28
28
  const cliCtx = await initializeCli(argv);
29
29
  if (typeof cliCtx === "number") return cliCtx;
30
- const { runInteractive } = await import("./cli-main-TQTH73ZK.js");
30
+ const { runInteractive } = await import("./cli-main-YS3HIOSD.js");
31
31
  return runInteractive(cliCtx);
32
32
  }
33
33
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  startCliHqConnection
3
- } from "./chunk-RGFWGUAB.js";
3
+ } from "./chunk-4UWCMBPG.js";
4
4
  import "./chunk-F5DCFAKI.js";
5
5
 
6
6
  // src/subcommands/handlers/mailbox-serve.ts
@@ -361,4 +361,4 @@ function printHelp(deps) {
361
361
  export {
362
362
  mailboxServeCmd
363
363
  };
364
- //# sourceMappingURL=mailbox-serve-GNGXEQ2R.js.map
364
+ //# sourceMappingURL=mailbox-serve-FW3JCCPK.js.map
@@ -7,7 +7,7 @@ import {
7
7
  renderFocusedHelpToString,
8
8
  renderGenericHelp,
9
9
  subcommandsWithFocusedHelp
10
- } from "./chunk-EPR42SWM.js";
10
+ } from "./chunk-WRYZLEXP.js";
11
11
  import "./chunk-YTEOAWOJ.js";
12
12
  export {
13
13
  deepSubcommandsWithFocusedHelp,
@@ -19,4 +19,4 @@ export {
19
19
  renderGenericHelp,
20
20
  subcommandsWithFocusedHelp
21
21
  };
22
- //# sourceMappingURL=per-subcommand-help-QDAQASPZ.js.map
22
+ //# sourceMappingURL=per-subcommand-help-MWQWFIAV.js.map