@wrongstack/cli 1.0.28 → 1.0.32

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 (135) hide show
  1. package/data/providers.json +8 -177
  2. package/dist/{acp-M4565YUW.js → acp-EDGUWU7N.js} +4 -7
  3. package/dist/{audit-46YK5DSC.js → audit-KCBTHUQI.js} +1 -1
  4. package/dist/{auth-TE55JF4Z.js → auth-SUHKFFO4.js} +136 -59
  5. package/dist/auth-menu/github-copilot-oauth.d.ts +1 -35
  6. package/dist/auth-menu/index-input.d.ts +3 -0
  7. package/dist/auth-menu/panel-flow-bridge.d.ts +29 -0
  8. package/dist/auth-menu/panel-service.d.ts +3 -34
  9. package/dist/auth-menu/provider-auth-login.d.ts +1 -1
  10. package/dist/auto-discover-providers-QIL34K3U.js +7 -0
  11. package/dist/automation-MCDFCIMV.js +369 -0
  12. package/dist/{bench-GTLPM22B.js → bench-MMZHFHDL.js} +152 -43
  13. package/dist/boot/brain-decision-log.d.ts +1 -1
  14. package/dist/boot/system-prompt-builder.d.ts +1 -1
  15. package/dist/boot/system-prompt-menu.d.ts +11 -2
  16. package/dist/boot/tui-coordinator-setup.d.ts +2 -0
  17. package/dist/boot/tui-startup-output.d.ts +11 -0
  18. package/dist/{boot-auto-thin-6Q56FY3F.js → boot-auto-thin-K2DHHYIW.js} +3 -3
  19. package/dist/{chronicle-UTFETHP6.js → chronicle-PBJS7BN6.js} +5 -3
  20. package/dist/{chunk-EPR42SWM.js → chunk-2EZ2DHOW.js} +60 -7
  21. package/dist/{chunk-7IQWQCBH.js → chunk-3LEFXLAW.js} +39 -39
  22. package/dist/{chunk-WSTVGC2C.js → chunk-4BX2YDTQ.js} +13 -6
  23. package/dist/{chunk-SFBFYIOW.js → chunk-4MDRHMX4.js} +3 -2
  24. package/dist/{chunk-RGFWGUAB.js → chunk-4UWCMBPG.js} +159 -3
  25. package/dist/{chunk-RDGGWMTI.js → chunk-65VNCAF6.js} +2 -22
  26. package/dist/{chunk-WQZW3RDP.js → chunk-7BNBD4PE.js} +2 -2
  27. package/dist/chunk-CFHWIFXL.js +123 -0
  28. package/dist/{chunk-RZ4ZDRYA.js → chunk-DIOODAYM.js} +2 -2
  29. package/dist/{chunk-L2RVEQWO.js → chunk-HHRYIDOW.js} +2 -2
  30. package/dist/chunk-LIZXJHZQ.js +61 -0
  31. package/dist/{chunk-YHYINL47.js → chunk-LKFKO4JW.js} +2 -2
  32. package/dist/{chunk-Q4INH2DG.js → chunk-MPQCHBDJ.js} +2 -1
  33. package/dist/{chunk-2ERX3RPN.js → chunk-P3GRLV47.js} +30 -17
  34. package/dist/{chunk-ZMX5HRLI.js → chunk-P3Q3KMFH.js} +6 -4
  35. package/dist/{chunk-KOEO4CJG.js → chunk-PGNERAZL.js} +4 -4
  36. package/dist/{chunk-ENRYW73H.js → chunk-RQ4UBKYH.js} +81 -10
  37. package/dist/{chunk-X756ZS72.js → chunk-SUDNPYWD.js} +2 -2
  38. package/dist/{chunk-LDCGZJTC.js → chunk-TWSQTQKR.js} +12 -4
  39. package/dist/chunk-TXAFIERF.js +37 -0
  40. package/dist/{chunk-UZ2TMHNH.js → chunk-UKP7H2U4.js} +10 -2
  41. package/dist/{chunk-5JYDKG5B.js → chunk-WHEYHDIE.js} +7 -2
  42. package/dist/{chunk-LBPLTTZ6.js → chunk-WTJDSTYD.js} +4 -4
  43. package/dist/{chunk-L5TD7UIG.js → chunk-WXJH4F6K.js} +7 -7
  44. package/dist/{chunk-IS2PPBQV.js → chunk-X4LW5CZM.js} +8 -4
  45. package/dist/{chunk-BBHWW6LR.js → chunk-YL4KCHZG.js} +18 -6
  46. package/dist/{chunk-LUMETJFO.js → chunk-ZYACRPLN.js} +2 -2
  47. package/dist/{cli-context-O2SHBDFH.js → cli-context-ITHGP2CE.js} +91 -84
  48. package/dist/cli-context.d.ts +3 -1
  49. package/dist/cli-infrastructure.d.ts +33 -0
  50. package/dist/{cli-main-BKG4ZVLN.js → cli-main-TQGLKB6D.js} +3783 -2753
  51. package/dist/config-doctor.d.ts +1 -1
  52. package/dist/{config-transfer-RUWLDCNK.js → config-transfer-UE37X4B5.js} +2 -2
  53. package/dist/{execution-THXWTHYT.js → execution-C2IECWF7.js} +5271 -5118
  54. package/dist/execution-chimera-handlers.d.ts +6 -0
  55. package/dist/execution-session-callbacks.d.ts +36 -0
  56. package/dist/execution-webui.d.ts +3 -0
  57. package/dist/execution.d.ts +1 -1
  58. package/dist/fleet/host-acp-runner.d.ts +15 -0
  59. package/dist/fleet/host-budget.d.ts +13 -0
  60. package/dist/fleet/host-context.d.ts +5 -0
  61. package/dist/fleet/host-explore-companion.d.ts +7 -16
  62. package/dist/fleet/host.d.ts +2 -0
  63. package/dist/fleet/status-broadcast.d.ts +1 -1
  64. package/dist/{hq-44F4OQH2.js → hq-KBFDKTDD.js} +13 -7
  65. package/dist/hq-publisher.d.ts +4 -1
  66. package/dist/hq-server/sage-sync-send.d.ts +5 -0
  67. package/dist/hq-server/server-lifecycle.d.ts +1 -1
  68. package/dist/hq-server/snapshot.d.ts +1 -1
  69. package/dist/{hq-server-UIB24LU6.js → hq-server-AVNKZ2PV.js} +2 -2
  70. package/dist/{hq-service-BMMJAHRT.js → hq-service-FGB7BY2D.js} +3 -3
  71. package/dist/hq-ttl-N4DAIAVX.js +7 -0
  72. package/dist/index.js +126 -10
  73. package/dist/{mailbox-serve-GNGXEQ2R.js → mailbox-serve-S536N66F.js} +4 -3
  74. package/dist/{modeldiag-W7XAE625.js → modeldiag-PQILD7TN.js} +26 -8
  75. package/dist/{per-subcommand-help-QDAQASPZ.js → per-subcommand-help-VKPV3OEY.js} +2 -2
  76. package/dist/{plugin-usage-CIGOOTX3.js → plugin-usage-3TZGROK7.js} +3 -3
  77. package/dist/{plugins-HQTXUD6A.js → plugins-ITH4SLO6.js} +4 -4
  78. package/dist/pre-launch/project-check.d.ts +2 -8
  79. package/dist/pre-launch.d.ts +1 -1
  80. package/dist/{project-manifest-7NSFVBM3.js → project-manifest-FTFDCCTZ.js} +2 -2
  81. package/dist/{project-picker-SVBXMPKX.js → project-picker-NZYJKQQC.js} +3 -3
  82. package/dist/provider-cloud-config.d.ts +4 -0
  83. package/dist/provider-config-utils.d.ts +1 -1
  84. package/dist/{providers-models-5Z2PJTEW.js → providers-models-W57I3QOA.js} +3 -3
  85. package/dist/{remote-GB5VXCCT.js → remote-C74BCNND.js} +5 -5
  86. package/dist/{rewind-JA3ZLCNM.js → rewind-7AULJS7F.js} +7 -5
  87. package/dist/sage-FFKUOCQL.js +475 -0
  88. package/dist/sage-connect.d.ts +62 -0
  89. package/dist/sage-hq-sync.d.ts +8 -0
  90. package/dist/sage-sync-ZMTHB477.js +69 -0
  91. package/dist/sandbox-TYGD6FI2.js +131 -0
  92. package/dist/services/sdd/project-context.d.ts +1 -1
  93. package/dist/{sessions-config-XHLXJ5C3.js → sessions-config-VE26SB56.js} +19 -8
  94. package/dist/short-circuit-flags-6LB3EGF7.js +10 -0
  95. package/dist/slash-commands/openai-quota.d.ts +12 -6
  96. package/dist/slash-commands/sandbox.d.ts +5 -0
  97. package/dist/slash-commands/scout-stats.d.ts +46 -0
  98. package/dist/slash-commands/sdd-inspect-commands.d.ts +9 -0
  99. package/dist/slash-commands/sdd-session-commands.d.ts +19 -0
  100. package/dist/slash-commands/sdd.d.ts +1 -1
  101. package/dist/slash-commands/zai-plan.d.ts +26 -0
  102. package/dist/{standalone-auto-update-TOTRGCSA.js → standalone-auto-update-VQC4GYCM.js} +3 -3
  103. package/dist/{standalone-update-LZO3MNLH.js → standalone-update-HZHDZZOR.js} +2 -2
  104. package/dist/subcommands/handlers/automation-credentials.d.ts +8 -0
  105. package/dist/subcommands/handlers/automation.d.ts +3 -0
  106. package/dist/subcommands/handlers/bench-experiments.d.ts +5 -0
  107. package/dist/subcommands/handlers/helpers.d.ts +1 -1
  108. package/dist/subcommands/handlers/sage-sync.d.ts +4 -0
  109. package/dist/subcommands/handlers/sage.d.ts +5 -0
  110. package/dist/subcommands/handlers/sandbox.d.ts +5 -0
  111. package/dist/{subcommands-SRRB3RAS.js → subcommands-QO7VYTSS.js} +2 -2
  112. package/dist/{tools-skills-GH24UCBY.js → tools-skills-33AI6K6S.js} +2 -2
  113. package/dist/tui-provider-quota-menu.d.ts +5 -0
  114. package/dist/{typesafe-WA5O3KVS.js → typesafe-NHC322W5.js} +27 -8
  115. package/dist/{typesafe-topic-replay-ZILIU3WS.js → typesafe-topic-replay-DB2AYL7V.js} +2 -2
  116. package/dist/{typesafe-triage-replay-FGAW7QM7.js → typesafe-triage-replay-27NDAZ3V.js} +2 -2
  117. package/dist/{update-TDZX4IL2.js → update-J5WHAFPE.js} +3 -3
  118. package/dist/{update-check-J5ZVKS73.js → update-check-VLVT4IV2.js} +2 -2
  119. package/dist/{version-help-XJJQ7YSH.js → version-help-ATOKGMTK.js} +2 -2
  120. package/dist/webui-server/prefs-seeding.d.ts +1 -0
  121. package/dist/webui-server/route-contexts.d.ts +1 -0
  122. package/dist/{webui-server-GCXIO3JY.js → webui-server-GQOVLQS3.js} +79 -40
  123. package/dist/webui-session-retirement.d.ts +10 -0
  124. package/dist/wiring/command-host-state.d.ts +2 -0
  125. package/dist/wiring/director-announcement.d.ts +3 -1
  126. package/dist/wiring/session-establishment.d.ts +10 -8
  127. package/dist/wiring/session-runtime.d.ts +1 -1
  128. package/dist/wiring/session.d.ts +3 -0
  129. package/package.json +30 -29
  130. package/dist/auto-discover-providers-DXR25GTG.js +0 -7
  131. package/dist/chunk-3ZTLPNEQ.js +0 -58
  132. package/dist/chunk-D5GB5MHA.js +0 -87
  133. package/dist/chunk-SIGUWXAA.js +0 -43
  134. package/dist/hq-ttl-VJR65OBJ.js +0 -7
  135. package/dist/short-circuit-flags-BSIPTAPD.js +0 -10
@@ -0,0 +1,6 @@
1
+ import type { ExecuteDeps } from './execute-deps.js';
2
+ export declare function installExecutionChimeraHandlers(deps: ExecuteDeps): {
3
+ chimeraWork: import("./chimera-work-registry.js").ChimeraWorkRegistry;
4
+ chimeraTeardowns: (() => void)[];
5
+ };
6
+ //# sourceMappingURL=execution-chimera-handlers.d.ts.map
@@ -0,0 +1,36 @@
1
+ import type { TuiRuntimeState } from './boot/tui-runtime-state.js';
2
+ import { type WorktreeRef } from './boot/worktree-sessions.js';
3
+ import type { ExecuteDeps } from './execute-deps.js';
4
+ export declare function createExecutionSessionCallbacks({ state, agent, session, worktreeSessions, }: {
5
+ state: TuiRuntimeState;
6
+ agent: ExecuteDeps['core']['agent'];
7
+ session: ExecuteDeps['session']['session'];
8
+ worktreeSessions: Map<string, WorktreeRef>;
9
+ }): {
10
+ listSessions: (limit?: number) => Promise<{
11
+ id: string;
12
+ title: string;
13
+ name: string | undefined;
14
+ lastUserMessage: string | undefined;
15
+ messageCount: number | undefined;
16
+ lastActivityAt: string | undefined;
17
+ startedAt: string;
18
+ endedAt: string | undefined;
19
+ tokenTotal: number;
20
+ iterationCount: number;
21
+ toolCallCount: number;
22
+ toolErrorCount: number;
23
+ outcome: "aborted" | "completed" | "error" | "timeout" | undefined;
24
+ forkedFrom: string | undefined;
25
+ worktree?: WorktreeRef;
26
+ isCurrent: boolean;
27
+ live?: {
28
+ pid: number;
29
+ clientType?: string | undefined;
30
+ } | undefined;
31
+ }[]>;
32
+ forkSession: (sessionId: string, checkpointPromptIndex: number) => Promise<{
33
+ id: string;
34
+ }>;
35
+ };
36
+ //# sourceMappingURL=execution-session-callbacks.d.ts.map
@@ -0,0 +1,3 @@
1
+ import type { ExecuteDeps } from './execute-deps.js';
2
+ export declare function runExecutionWebui(deps: ExecuteDeps): Promise<number>;
3
+ //# sourceMappingURL=execution-webui.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import type { ExecuteDeps } from './execute-deps.js';
2
- export type { LiveSettingsInput } from './live-settings-input.js';
3
2
  export { __resetReviewerRoundRobinCursor, applyChimeraReviewerReadOnlyPolicy, assignReviewerModels, assignReviewerModelsRoundRobin, CHIMERA_REVIEW_READ_ONLY_TOOLS, resolveReviewerFallbackModels, } from './chimera-reviewer-policy.js';
4
3
  export type { BrainData, BrainLogEntry, ExecuteDeps, McpPickerItem, PluginPickerItem, RestoredToolCall, ToolPickerItem, } from './execute-deps.js';
4
+ export type { LiveSettingsInput } from './live-settings-input.js';
5
5
  export declare function execute(deps: ExecuteDeps): Promise<number>;
6
6
  //# sourceMappingURL=execution.d.ts.map
@@ -0,0 +1,15 @@
1
+ import type { Config } from '@wrongstack/core/types';
2
+ import type { BuildAcpSubagentRunnerOptions } from './host-acp.js';
3
+ export interface HostAcpRunnerHost {
4
+ deps: import('./host-types.js').MultiAgentDeps;
5
+ getDirector: () => import('@wrongstack/core/coordination').Director | undefined;
6
+ ensureCoordinator: (_config: import('@wrongstack/core/types').Config) => Promise<void>;
7
+ getCoordinator: () => import('@wrongstack/core/coordination').DefaultMultiAgentCoordinator;
8
+ buildACPRunner: (subagentId: string) => Promise<import('@wrongstack/core/types').SubagentRunner>;
9
+ recordLearningRole: (subagentId: string, role: string, skills?: readonly string[]) => void;
10
+ directorRunnerSet: boolean;
11
+ sessionForSubagent: (subagentId: string) => string;
12
+ }
13
+ export declare function acpCommandOpts(this: HostAcpRunnerHost): BuildAcpSubagentRunnerOptions;
14
+ export declare function spawnACP(this: HostAcpRunnerHost, subagentId: string, task: string, config: Config): Promise<string>;
15
+ //# sourceMappingURL=host-acp-runner.d.ts.map
@@ -0,0 +1,13 @@
1
+ import { type FleetHostUsage } from './host-status.js';
2
+ export interface HostBudgetHost {
3
+ fleetManager: import('@wrongstack/core/coordination').FleetManager | undefined;
4
+ opts: import('./host-types.js').MultiAgentHostOptions;
5
+ director: import('@wrongstack/core/coordination').Director | undefined;
6
+ getCoordinator: () => import('@wrongstack/core/coordination').DefaultMultiAgentCoordinator;
7
+ getMaxConcurrent: () => number;
8
+ shadowManager: import('./host-shadow-manager.js').HostShadowManager;
9
+ }
10
+ export declare function budgetView(this: HostBudgetHost): import('./host-status.js').FleetBudgetView;
11
+ export declare function usage(this: HostBudgetHost): FleetHostUsage;
12
+ export declare function manifest(this: HostBudgetHost): Promise<string | null>;
13
+ //# sourceMappingURL=host-budget.d.ts.map
@@ -8,6 +8,11 @@ export interface SkillResolutionReport {
8
8
  dropped: Record<string, 'not-found' | 'missing-capability' | 'missing-tool' | 'budget' | 'empty'>;
9
9
  /** Skills kept under budget by shortening their bundled body. */
10
10
  trimmed: string[];
11
+ /**
12
+ * Skills this role cannot load whose project addendum was delivered on its
13
+ * own. Not counted as loaded: the method never reached the agent.
14
+ */
15
+ addendumOnly: string[];
11
16
  }
12
17
  export declare function resolveHostSubagentSkillResolution(deps: MultiAgentDeps, roster: Record<string, SubagentConfig>, subCfg: SubagentConfig, availableToolNames?: readonly string[]): Promise<SkillResolutionReport>;
13
18
  /** Backwards-compatible wrapper for callers that only need the prompt text. */
@@ -11,8 +11,8 @@
11
11
  * FIRST probe (never eagerly — an idle session pays nothing) and holds a
12
12
  * stable subagent id so subsequent probes reuse it. When the resident is
13
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
14
+ * Probes are `assignInternal`ed off the leader's path; the observer waits
15
+ * for completion before dispatching another. Internal tasks stay out of the task surface
16
16
  * (same treatment as shadow passes). When the resident `submit_result`s,
17
17
  * this host posts a same-session `session.note` so the leader folds the
18
18
  * findings at its next iteration. Mailbox stays the durable cross-session
@@ -22,26 +22,17 @@
22
22
  */
23
23
  import { type Director, ExploreCompanion } from '@wrongstack/core/coordination';
24
24
  import type { EventBus } from '@wrongstack/core/kernel';
25
- import type { SubagentConfig } from '@wrongstack/core/types';
26
- /** Config block for the explore-companion host wiring (FleetConfig.exploreCompanion). */
27
- interface HostExploreCompanionConfig {
28
- /** Kill switch. Default true. */
29
- enabled?: boolean | undefined;
30
- /** Min gap between probes on the same subject (ms). Default 120_000. */
31
- cooldownMs?: number | undefined;
32
- /** Pending probe queue cap. Default 8. */
33
- maxPending?: number | undefined;
34
- /** Mailbox poll interval for explicit asks (ms). Default 5_000. */
35
- pollIntervalMs?: number | undefined;
36
- }
25
+ import type { FleetConfig, SubagentConfig } from '@wrongstack/core/types';
37
26
  interface HostExploreCompanionInput {
38
27
  director: Director;
39
28
  events: EventBus;
40
29
  sessionId: string;
41
30
  mailboxProjectDir: string;
42
31
  roster: Record<string, SubagentConfig>;
43
- config?: HostExploreCompanionConfig | undefined;
44
- subagentsAllowed?: (() => boolean) | undefined;
32
+ config?: FleetConfig['exploreCompanion'];
33
+ companionsAllowed?: (() => boolean) | undefined;
34
+ projectRoot?: string | undefined;
35
+ scrub?: ((text: string) => string) | undefined;
45
36
  }
46
37
  export declare function createHostExploreCompanion(input: HostExploreCompanionInput): ExploreCompanion | null;
47
38
  export {};
@@ -160,5 +160,7 @@ export declare class MultiAgentHost {
160
160
  */
161
161
  releaseSession(sessionId: string): void;
162
162
  dispose(): Promise<void>;
163
+ private hostAcpRunnerHost;
164
+ private hostBudgetHost;
163
165
  }
164
166
  //# sourceMappingURL=host.d.ts.map
@@ -22,7 +22,7 @@
22
22
  *
23
23
  * @module fleet/status-broadcast
24
24
  */
25
- import type { Mailbox } from '@wrongstack/core/coordination';
25
+ import { type Mailbox } from '@wrongstack/core/coordination';
26
26
  import type { EventBus } from '@wrongstack/core/kernel';
27
27
  import type { FleetConfig } from '@wrongstack/core/types';
28
28
  interface FleetStatusBroadcasterOptions {
@@ -1,3 +1,6 @@
1
+ import {
2
+ parseTokenTtlValue
3
+ } from "./chunk-UKP7H2U4.js";
1
4
  import {
2
5
  resolveHqPasswordInput
3
6
  } from "./chunk-AUQDGU5D.js";
@@ -8,9 +11,6 @@ import {
8
11
  import {
9
12
  parseHqIpAllowlist
10
13
  } from "./chunk-Q7E3BPDU.js";
11
- import {
12
- parseTokenTtlValue
13
- } from "./chunk-UZ2TMHNH.js";
14
14
 
15
15
  // src/subcommands/handlers/hq.ts
16
16
  import {
@@ -316,7 +316,7 @@ var hqCmd = async (args, deps) => {
316
316
  return hqAlertsCmd(args.slice(1), deps);
317
317
  }
318
318
  if (sub === "service") {
319
- const { hqServiceCmd } = await import("./hq-service-BMMJAHRT.js");
319
+ const { hqServiceCmd } = await import("./hq-service-FGB7BY2D.js");
320
320
  return hqServiceCmd(args.slice(1), deps);
321
321
  }
322
322
  if (sub === "help" || sub === "--help") {
@@ -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-AVNKZ2PV.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;
@@ -344,7 +344,13 @@ async function startServer(deps) {
344
344
  }
345
345
  }
346
346
  const host = typeof flags["host"] === "string" ? flags["host"] : publicOrigin !== void 0 ? "127.0.0.1" : HQ_CLI_DEFAULT_HOST;
347
- const port = typeof flags["port"] === "string" ? Number.parseInt(flags["port"], 10) : 3499;
347
+ const rawPort = typeof flags["port"] === "string" ? flags["port"].trim() : void 0;
348
+ const port = rawPort === void 0 ? 3499 : /^\d+$/.test(rawPort) ? Number(rawPort) : Number.NaN;
349
+ if (!Number.isInteger(port) || port < 0 || port > 65535) {
350
+ deps.renderer.writeError(`Invalid --port value: ${String(flags["port"])}
351
+ `);
352
+ return 1;
353
+ }
348
354
  if (publicOrigin !== void 0 && !isLoopbackHost(host)) {
349
355
  deps.renderer.writeError(
350
356
  "Persistent public HQ requires a loopback bind. Remove --host or use --host 127.0.0.1.\n"
@@ -1004,4 +1010,4 @@ export {
1004
1010
  hqCmd,
1005
1011
  resolveAuditActor
1006
1012
  };
1007
- //# sourceMappingURL=hq-44F4OQH2.js.map
1013
+ //# sourceMappingURL=hq-KBFDKTDD.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-RQ4UBKYH.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-AVNKZ2PV.js.map
@@ -4,9 +4,9 @@ import {
4
4
  import {
5
5
  detectUpdatePackageManager,
6
6
  detectUpdatePackageName
7
- } from "./chunk-KOEO4CJG.js";
7
+ } from "./chunk-PGNERAZL.js";
8
8
  import "./chunk-U3SS4NRH.js";
9
- import "./chunk-RZ4ZDRYA.js";
9
+ import "./chunk-DIOODAYM.js";
10
10
  import "./chunk-F5DCFAKI.js";
11
11
 
12
12
  // src/hq-service.ts
@@ -511,4 +511,4 @@ export {
511
511
  hqServiceCmd,
512
512
  renderHqServiceAssets
513
513
  };
514
- //# sourceMappingURL=hq-service-BMMJAHRT.js.map
514
+ //# sourceMappingURL=hq-service-FGB7BY2D.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
@@ -2,13 +2,114 @@
2
2
  import {
3
3
  applyNodeEnvDefault,
4
4
  applySessionShellDefault
5
- } from "./chunk-LBPLTTZ6.js";
5
+ } from "./chunk-WTJDSTYD.js";
6
+ import {
7
+ parseArgs
8
+ } from "./chunk-MPQCHBDJ.js";
6
9
  import {
7
10
  CLI_VERSION
8
11
  } from "./chunk-F5DCFAKI.js";
9
- import {
10
- parseArgs
11
- } from "./chunk-Q4INH2DG.js";
12
+
13
+ // src/boot/tui-startup-output.ts
14
+ import { format, stripVTControlCharacters } from "node:util";
15
+ var LEVELS = ["log", "info", "debug", "warn"];
16
+ function shouldCaptureTuiStartup(flags, positional, interactive = process.stdin.isTTY === true && process.stdout.isTTY === true) {
17
+ return interactive && !flags["no-tui"] && !flags["webui"] && !flags["simpleui"] && !flags["hq"] && !flags["desktop"] && !flags["remote"] && !flags["no-interactive"] && typeof flags["prompt"] !== "string" && (positional.length === 0 || positional[0] === "quick" || positional[0] === "resume" && positional.length === 2);
18
+ }
19
+ function startTuiStartupOutput(enabled) {
20
+ const originals = Object.fromEntries(LEVELS.map((level) => [level, console[level]]));
21
+ const originalWrite = process.stderr.write;
22
+ const originalWarning = process.emitWarning;
23
+ const wrappers = {};
24
+ const buffered = [];
25
+ let logger;
26
+ let quiet = false;
27
+ let stopped = !enabled;
28
+ const remember = (output) => {
29
+ if (quiet) {
30
+ if (output.kind === "console") {
31
+ const text = format(...output.args);
32
+ const structuredLevel = recordLevel(text);
33
+ const level = structuredLevel === "warn" || structuredLevel === "info" || structuredLevel === "debug" || structuredLevel === "trace" ? structuredLevel : output.level === "log" ? "info" : output.level;
34
+ logger?.[level](text, { event: "tui.startup.console" });
35
+ } else if (output.kind === "warning") {
36
+ const warning = output.args[0];
37
+ logger?.warn(warning instanceof Error ? warning.message : String(warning), {
38
+ event: "tui.startup.warning"
39
+ });
40
+ }
41
+ return;
42
+ }
43
+ buffered.push(output);
44
+ if (buffered.length > 200) buffered.shift();
45
+ };
46
+ const recordLevel = (text) => {
47
+ try {
48
+ const record = JSON.parse(text);
49
+ if (record && typeof record === "object" && "level" in record && typeof record.level === "string")
50
+ return record.level;
51
+ } catch {
52
+ }
53
+ return void 0;
54
+ };
55
+ for (const level of LEVELS) {
56
+ wrappers[level] = (...args) => {
57
+ if (stopped || recordLevel(format(...args)) === "error") {
58
+ originals[level](...args);
59
+ } else {
60
+ remember({ kind: "console", level, args });
61
+ }
62
+ };
63
+ if (enabled) console[level] = wrappers[level];
64
+ }
65
+ const write = function(...args) {
66
+ const text = typeof args[0] === "string" ? args[0] : Buffer.from(args[0]).toString();
67
+ const plain = stripVTControlCharacters(text).trim();
68
+ const lines = plain.split(/\r?\n/);
69
+ const diagnostic = lines.every((line) => {
70
+ const level = recordLevel(line);
71
+ return level !== void 0 && ["warn", "info", "debug", "trace"].includes(level) || /^\d{2}:\d{2}:\d{2}\s+(WARN|INFO|DEBUG|TRACE)\s/.test(line);
72
+ });
73
+ if (stopped || !diagnostic) return originalWrite.apply(this, args);
74
+ remember({ kind: "stderr", text });
75
+ const callback = typeof args[1] === "function" ? args[1] : args[2];
76
+ if (typeof callback === "function") callback();
77
+ return true;
78
+ };
79
+ const emitWarning = ((...args) => {
80
+ if (stopped) originalWarning.apply(process, args);
81
+ else remember({ kind: "warning", args });
82
+ });
83
+ if (enabled) {
84
+ process.stderr.write = write;
85
+ process.emitWarning = emitWarning;
86
+ }
87
+ return {
88
+ acceptTui(fileLogger) {
89
+ if (stopped) return;
90
+ quiet = true;
91
+ logger = fileLogger;
92
+ for (const output of buffered.splice(0)) remember(output);
93
+ },
94
+ stop(replay = !quiet) {
95
+ if (stopped) return;
96
+ stopped = true;
97
+ for (const level of LEVELS) {
98
+ if (console[level] === wrappers[level]) console[level] = originals[level];
99
+ }
100
+ if (process.stderr.write === write) process.stderr.write = originalWrite;
101
+ if (process.emitWarning === emitWarning) process.emitWarning = originalWarning;
102
+ if (replay) {
103
+ for (const output of buffered) {
104
+ if (output.kind === "console") originals[output.level](...output.args);
105
+ else if (output.kind === "stderr") originalWrite.call(process.stderr, output.text);
106
+ else originalWarning.apply(process, output.args);
107
+ }
108
+ }
109
+ buffered.length = 0;
110
+ }
111
+ };
112
+ }
12
113
 
13
114
  // src/cli-entry-main.ts
14
115
  async function main(argv) {
@@ -20,15 +121,30 @@ async function main(argv) {
20
121
  applyAsciiMode(earlyFlags);
21
122
  }
22
123
  if (earlyFlags["help"] === true || earlyFlags["version"] === true) {
23
- const { handleHelpVersionShortCircuit } = await import("./short-circuit-flags-BSIPTAPD.js");
124
+ const { handleHelpVersionShortCircuit } = await import("./short-circuit-flags-6LB3EGF7.js");
24
125
  const earlyExit = await handleHelpVersionShortCircuit(argv);
25
126
  if (earlyExit !== null) return earlyExit;
26
127
  }
27
- const { initializeCli } = await import("./cli-context-O2SHBDFH.js");
28
- const cliCtx = await initializeCli(argv);
29
- if (typeof cliCtx === "number") return cliCtx;
30
- const { runInteractive } = await import("./cli-main-BKG4ZVLN.js");
31
- return runInteractive(cliCtx);
128
+ const parsed = parseArgs(argv);
129
+ const startupOutput = startTuiStartupOutput(
130
+ shouldCaptureTuiStartup(parsed.flags, parsed.positional)
131
+ );
132
+ try {
133
+ const { initializeCli } = await import("./cli-context-ITHGP2CE.js");
134
+ const cliCtx = await initializeCli(argv, {
135
+ onNonTuiLaunch: () => startupOutput.stop()
136
+ });
137
+ if (typeof cliCtx === "number") return cliCtx;
138
+ if (cliCtx.flags["tui"] === true && cliCtx.flags["no-tui"] !== true) {
139
+ startupOutput.acceptTui(cliCtx.logger);
140
+ } else {
141
+ startupOutput.stop();
142
+ }
143
+ const { runInteractive } = await import("./cli-main-TQGLKB6D.js");
144
+ return await runInteractive(cliCtx);
145
+ } finally {
146
+ startupOutput.stop();
147
+ }
32
148
  }
33
149
 
34
150
  // src/cli-entry-point.ts
@@ -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
@@ -38,7 +38,8 @@ var mailboxServeCmd = async (args, deps) => {
38
38
  async function startServer(deps) {
39
39
  const flags = deps.flags ?? {};
40
40
  const host = typeof flags["host"] === "string" ? flags["host"] : DEFAULT_HOST;
41
- const portRaw = typeof flags["port"] === "string" ? Number.parseInt(flags["port"], 10) : DEFAULT_PORT;
41
+ const rawPort = typeof flags["port"] === "string" ? flags["port"].trim() : void 0;
42
+ const portRaw = rawPort === void 0 ? DEFAULT_PORT : /^\d+$/.test(rawPort) ? Number(rawPort) : Number.NaN;
42
43
  const strictPort = flags["strict-port"] === true;
43
44
  if (!Number.isInteger(portRaw) || portRaw < 0 || portRaw > 65535) {
44
45
  deps.renderer.writeError(`Invalid --port: ${String(flags["port"])}
@@ -361,4 +362,4 @@ function printHelp(deps) {
361
362
  export {
362
363
  mailboxServeCmd
363
364
  };
364
- //# sourceMappingURL=mailbox-serve-GNGXEQ2R.js.map
365
+ //# sourceMappingURL=mailbox-serve-S536N66F.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  applyProviderOAuthRefresh
3
- } from "./chunk-LDCGZJTC.js";
3
+ } from "./chunk-TWSQTQKR.js";
4
4
  import {
5
5
  discoverAndMergeProviders
6
- } from "./chunk-D5GB5MHA.js";
6
+ } from "./chunk-CFHWIFXL.js";
7
7
  import {
8
8
  checkMark,
9
9
  costLabel,
@@ -17,16 +17,16 @@ import {
17
17
  runModeldiagEval,
18
18
  scoreBar,
19
19
  speedLabel
20
- } from "./chunk-BBHWW6LR.js";
21
- import {
22
- resolveRawProviderConnection
23
- } from "./chunk-SDJCLEK6.js";
20
+ } from "./chunk-YL4KCHZG.js";
24
21
  import {
25
22
  mutateConfigProviders
26
- } from "./chunk-LUMETJFO.js";
23
+ } from "./chunk-ZYACRPLN.js";
27
24
  import {
28
25
  activeProfileConfigPath
29
26
  } from "./chunk-YMXXOOFN.js";
27
+ import {
28
+ resolveRawProviderConnection
29
+ } from "./chunk-SDJCLEK6.js";
30
30
 
31
31
  // src/subcommands/handlers/modeldiag.ts
32
32
  import * as fs from "node:fs/promises";
@@ -620,6 +620,24 @@ function checkHasKey(pid, config) {
620
620
  }
621
621
  var modeldiagCmd = async (args, deps) => {
622
622
  const sub = args[0]?.toLowerCase() || "full";
623
+ if (sub === "preflight") {
624
+ const { inspectProviderPreflight } = await import("@wrongstack/providers");
625
+ const requested = args[1];
626
+ const entries = Object.entries(deps.config.providers ?? {}).filter(
627
+ ([id]) => !requested || id === requested
628
+ );
629
+ const results = entries.map(([id, config2]) => inspectProviderPreflight(id, config2));
630
+ deps.renderer.write(
631
+ `${JSON.stringify({ checks: results, scope: "configuration presence only; no authenticated model calls" }, null, 2)}
632
+ `
633
+ );
634
+ if (requested && entries.length === 0) {
635
+ deps.renderer.write(`Provider profile not configured: ${requested}
636
+ `);
637
+ return 1;
638
+ }
639
+ return results.some((result) => result.requiresConfiguration) ? 1 : 0;
640
+ }
623
641
  const cacheResult = await readProviders(deps.paths.modelsCache);
624
642
  if (!cacheResult.ok) {
625
643
  deps.renderer.write(`${cacheResult.message}
@@ -825,4 +843,4 @@ var modeldiagCmd = async (args, deps) => {
825
843
  export {
826
844
  modeldiagCmd
827
845
  };
828
- //# sourceMappingURL=modeldiag-W7XAE625.js.map
846
+ //# sourceMappingURL=modeldiag-PQILD7TN.js.map
@@ -7,7 +7,7 @@ import {
7
7
  renderFocusedHelpToString,
8
8
  renderGenericHelp,
9
9
  subcommandsWithFocusedHelp
10
- } from "./chunk-EPR42SWM.js";
10
+ } from "./chunk-2EZ2DHOW.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-VKPV3OEY.js.map
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  runPluginManagementCommand
3
- } from "./chunk-L2RVEQWO.js";
3
+ } from "./chunk-HHRYIDOW.js";
4
4
  import {
5
5
  activeProfileConfigPath
6
6
  } from "./chunk-YMXXOOFN.js";
7
+ import "./chunk-4BX2YDTQ.js";
7
8
  import {
8
9
  restoreFlags
9
10
  } from "./chunk-CSAPOCBP.js";
10
- import "./chunk-WSTVGC2C.js";
11
11
 
12
12
  // src/subcommands/handlers/plugin-usage.ts
13
13
  var pluginCmd = async (args, deps) => {
@@ -41,4 +41,4 @@ export {
41
41
  pluginCmd,
42
42
  usageCmd
43
43
  };
44
- //# sourceMappingURL=plugin-usage-CIGOOTX3.js.map
44
+ //# sourceMappingURL=plugin-usage-3TZGROK7.js.map
@@ -7,10 +7,10 @@ import {
7
7
  pluginNameFromSpec,
8
8
  setupPlugins,
9
9
  warnIfDeprecatedPluginName
10
- } from "./chunk-YHYINL47.js";
10
+ } from "./chunk-LKFKO4JW.js";
11
11
  import "./chunk-EWKESL4L.js";
12
- import "./chunk-L2RVEQWO.js";
13
- import "./chunk-WSTVGC2C.js";
12
+ import "./chunk-HHRYIDOW.js";
13
+ import "./chunk-4BX2YDTQ.js";
14
14
  export {
15
15
  BUILTIN_PLUGIN_FACTORIES,
16
16
  BUILTIN_PLUGIN_NAME_HINTS,
@@ -21,4 +21,4 @@ export {
21
21
  setupPlugins,
22
22
  warnIfDeprecatedPluginName
23
23
  };
24
- //# sourceMappingURL=plugins-HQTXUD6A.js.map
24
+ //# sourceMappingURL=plugins-ITH4SLO6.js.map
@@ -1,13 +1,7 @@
1
+ import { detectProjectKind, isOutsideProject, type ProjectKind } from '@wrongstack/core/utils';
1
2
  import type { ReadlineInputReader } from '../input-reader.js';
2
3
  import type { TerminalRenderer } from '../renderer.js';
3
- export type ProjectKind =
4
- /** `.wrongstack/AGENTS.md` exists — fully set up. */
5
- 'initialized'
6
- /** Has a recognizable manifest (package.json, pyproject.toml, etc.) but no AGENTS.md yet. */
7
- | 'project'
8
- /** No manifest, no AGENTS.md — probably an empty/scratch directory. */
9
- | 'empty';
10
- export declare function detectProjectKind(projectRoot: string): Promise<ProjectKind>;
4
+ export { detectProjectKind, isOutsideProject, type ProjectKind };
11
5
  /**
12
6
  * Print a one-line project status banner and, when relevant, prompt the
13
7
  * user about scaffolding `AGENTS.md` or continuing in a directory that
@@ -1,4 +1,4 @@
1
1
  export { type FirstRunDeps, type FirstRunOutcome, hasAnyCredential, runFirstRunSetup, } from './pre-launch/first-run.js';
2
2
  export { LaunchAbortedError, type LaunchModeChoices, persistLaunchChoices, runLaunchPrompts, } from './pre-launch/launch-prompts.js';
3
- export { detectProjectKind, type ProjectKind, runProjectCheck, } from './pre-launch/project-check.js';
3
+ export { detectProjectKind, isOutsideProject, type ProjectKind, runProjectCheck, } from './pre-launch/project-check.js';
4
4
  //# sourceMappingURL=pre-launch.d.ts.map
@@ -5,7 +5,7 @@ import {
5
5
  loadManifest,
6
6
  saveManifest,
7
7
  touchProjectInManifest
8
- } from "./chunk-IS2PPBQV.js";
8
+ } from "./chunk-X4LW5CZM.js";
9
9
  export {
10
10
  ensureProjectDataDir,
11
11
  findProject,
@@ -14,4 +14,4 @@ export {
14
14
  saveManifest,
15
15
  touchProjectInManifest
16
16
  };
17
- //# sourceMappingURL=project-manifest-7NSFVBM3.js.map
17
+ //# sourceMappingURL=project-manifest-FTFDCCTZ.js.map