@wrongstack/cli 1.0.19 → 1.0.26

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 (195) hide show
  1. package/data/providers.json +44 -0
  2. package/dist/{acp-INCNOH42.js → acp-LI665LO2.js} +18 -7
  3. package/dist/arg-parser.d.ts +1 -0
  4. package/dist/ascii-mode-SG4PRNLP.js +7 -0
  5. package/dist/{auth-YXK3EDUL.js → auth-TE55JF4Z.js} +68 -22
  6. package/dist/auth-menu/direct.d.ts +1 -0
  7. package/dist/auth-menu/local.d.ts +2 -0
  8. package/dist/auth-menu/oauth-menu.d.ts +3 -1
  9. package/dist/auth-menu/panel-service.d.ts +20 -0
  10. package/dist/{bench-YBU6BVQP.js → bench-GTLPM22B.js} +2 -2
  11. package/dist/boot/append-system-prompt.d.ts +10 -0
  12. package/dist/boot/ascii-mode.d.ts +12 -0
  13. package/dist/boot/config-backup-recovery.d.ts +2 -1
  14. package/dist/boot/container-wiring.d.ts +4 -2
  15. package/dist/boot/dispatch-singleshot.d.ts +4 -1
  16. package/dist/boot/dispatch-webui.d.ts +11 -0
  17. package/dist/boot/mcp-config-flag.d.ts +22 -0
  18. package/dist/boot/piped-stdin.d.ts +40 -0
  19. package/dist/boot/restricted-mode.d.ts +15 -0
  20. package/dist/boot/safe-mode.d.ts +30 -0
  21. package/dist/boot/short-circuit-desktop.d.ts +1 -0
  22. package/dist/boot/single-shot-budget.d.ts +30 -0
  23. package/dist/boot/stream-json.d.ts +36 -0
  24. package/dist/boot/structured-output.d.ts +16 -0
  25. package/dist/boot/system-prompt-builder.d.ts +2 -0
  26. package/dist/boot/tool-restriction-flags.d.ts +36 -0
  27. package/dist/boot/tui-project-picker-callback.d.ts +1 -1
  28. package/dist/boot/tui-settings-adapter.d.ts +15 -2
  29. package/dist/boot/worktree-sessions.d.ts +21 -0
  30. package/dist/{boot-auto-thin-MANHOYHE.js → boot-auto-thin-6Q56FY3F.js} +3 -2
  31. package/dist/boot-provider-selection.d.ts +67 -0
  32. package/dist/boot.d.ts +1 -38
  33. package/dist/{chunk-JY52HWL6.js → chunk-2EBVTYJR.js} +2 -2
  34. package/dist/{chunk-RDHFXOJM.js → chunk-2ERX3RPN.js} +112 -65
  35. package/dist/chunk-4TVYGG6G.js +62 -0
  36. package/dist/chunk-5JYDKG5B.js +154 -0
  37. package/dist/{chunk-KEPABQYT.js → chunk-5SEYGOCH.js} +8 -82
  38. package/dist/{chunk-3VXYY5JC.js → chunk-5UZBUV2H.js} +3 -19
  39. package/dist/chunk-BBHWW6LR.js +549 -0
  40. package/dist/chunk-BEHGRNOQ.js +58 -0
  41. package/dist/chunk-CZTXF6HY.js +140 -0
  42. package/dist/{chunk-JX6KL7OF.js → chunk-EPR42SWM.js} +39 -8
  43. package/dist/chunk-F5DCFAKI.js +36 -0
  44. package/dist/chunk-HLSHFXTO.js +97 -0
  45. package/dist/{chunk-CJTBLTS4.js → chunk-KJS5543T.js} +4 -3
  46. package/dist/{chunk-DE7BZDNK.js → chunk-KOEO4CJG.js} +27 -4
  47. package/dist/{chunk-SIS37L3W.js → chunk-L2RVEQWO.js} +211 -193
  48. package/dist/chunk-LBPLTTZ6.js +105 -0
  49. package/dist/chunk-LDCGZJTC.js +46 -0
  50. package/dist/chunk-LKPEBZBE.js +143 -0
  51. package/dist/chunk-LUMETJFO.js +171 -0
  52. package/dist/{chunk-KK2LB3ZS.js → chunk-OAVBM55Q.js} +9 -5
  53. package/dist/chunk-PZQBGUVZ.js +18 -0
  54. package/dist/{chunk-C3Z4N6A6.js → chunk-Q4INH2DG.js} +51 -3
  55. package/dist/chunk-R4QGL6GB.js +10 -0
  56. package/dist/{chunk-YLQEGYV4.js → chunk-RZ4ZDRYA.js} +14 -4
  57. package/dist/chunk-S4FFHDJG.js +93 -0
  58. package/dist/chunk-SFBFYIOW.js +271 -0
  59. package/dist/{chunk-RMQNCHGO.js → chunk-TI7KLHYX.js} +136 -11
  60. package/dist/{chunk-2ENZU66X.js → chunk-WQV2NP57.js} +5 -5
  61. package/dist/{chunk-B4JLSXZB.js → chunk-WSTVGC2C.js} +73 -45
  62. package/dist/chunk-X756ZS72.js +329 -0
  63. package/dist/{chunk-XJ7K67PP.js → chunk-YHYINL47.js} +63 -24
  64. package/dist/{chunk-2VMJ3E5Z.js → chunk-YTEOAWOJ.js} +6 -2
  65. package/dist/{chunk-GPPRNAKW.js → chunk-ZMX5HRLI.js} +2 -2
  66. package/dist/{cli-context-33F74CSZ.js → cli-context-UVGAN3NO.js} +496 -384
  67. package/dist/cli-entry-point.d.ts +2 -0
  68. package/dist/{cli-main-FNGMKPBA.js → cli-main-TN3KZ2P6.js} +3561 -2724
  69. package/dist/cli-update-notice.d.ts +2 -1
  70. package/dist/config-doctor.d.ts +10 -2
  71. package/dist/{config-transfer-2YF3CRTN.js → config-transfer-RUWLDCNK.js} +34 -13
  72. package/dist/{diag-doctor-ANPRUYFM.js → diag-doctor-BIZAFIAT.js} +2 -2
  73. package/dist/execute-deps.d.ts +2 -1
  74. package/dist/{execution-A6WJLSOC.js → execution-7QIP6GRY.js} +2384 -2055
  75. package/dist/fleet/host-types.d.ts +3 -1
  76. package/dist/goal-commands.d.ts +47 -0
  77. package/dist/goal-host.d.ts +1 -14
  78. package/dist/{hq-XQWQTRDA.js → hq-GLZ7QESM.js} +277 -261
  79. package/dist/hq-command-controller.d.ts +1 -1
  80. package/dist/{hq-server-IIBZQZU4.js → hq-server-YTKDVQPY.js} +2 -2
  81. package/dist/{hq-service-L5INQFM4.js → hq-service-BMMJAHRT.js} +11 -4
  82. package/dist/import-claude-code-32PCSIQI.js +236 -0
  83. package/dist/index.d.ts +1 -1
  84. package/dist/index.js +19 -10
  85. package/dist/kanban-supervisor-67ECABTD.js +7 -0
  86. package/dist/live-settings-input.d.ts +7 -0
  87. package/dist/{mailbox-serve-3GFOK2I7.js → mailbox-serve-NW5VZG7R.js} +3 -3
  88. package/dist/{mcp-DC5WSBOO.js → mcp-LBS45HWZ.js} +4 -4
  89. package/dist/modeldiag-36VODVIH.js +828 -0
  90. package/dist/{per-subcommand-help-DHTYU524.js → per-subcommand-help-QDAQASPZ.js} +3 -3
  91. package/dist/permission-prompt-mirror.d.ts +1 -1
  92. package/dist/permission-prompt.d.ts +16 -2
  93. package/dist/permission-rules-view.d.ts +18 -0
  94. package/dist/{permissions-CFDLXETM.js → permissions-PL27UHYD.js} +67 -45
  95. package/dist/plugin-config.d.ts +12 -0
  96. package/dist/plugin-management-types.d.ts +31 -0
  97. package/dist/plugin-management.d.ts +2 -30
  98. package/dist/plugin-package-install.d.ts +3 -0
  99. package/dist/{plugin-usage-M6KET4OZ.js → plugin-usage-CIGOOTX3.js} +6 -5
  100. package/dist/{plugins-WJLW6ULV.js → plugins-HQTXUD6A.js} +6 -3
  101. package/dist/preflight.d.ts +1 -1
  102. package/dist/{projects-LMNAGGEU.js → projects-T4CZCA25.js} +3 -6
  103. package/dist/provider-config-utils.d.ts +1 -6
  104. package/dist/provider-helpers.d.ts +7 -11
  105. package/dist/{providers-models-LFNZ5WI7.js → providers-models-5Z2PJTEW.js} +44 -34
  106. package/dist/release-asset-download.d.ts +13 -0
  107. package/dist/release-attestation.d.ts +28 -0
  108. package/dist/remote/remote-session.d.ts +64 -0
  109. package/dist/remote/remote-target.d.ts +69 -0
  110. package/dist/remote-O5WXHLWV.js +561 -0
  111. package/dist/{replay-Z3FTJEMM.js → replay-DEI566CW.js} +2 -2
  112. package/dist/services/commit-message.d.ts +2 -1
  113. package/dist/services/dispatch-classifier.d.ts +39 -5
  114. package/dist/session-move-P2EC2COA.js +44 -0
  115. package/dist/session-move.d.ts +20 -0
  116. package/dist/session-stats.d.ts +10 -0
  117. package/dist/{sessions-config-UL45XKX7.js → sessions-config-SXTTLNXA.js} +47 -9
  118. package/dist/settings-menu.d.ts +2 -0
  119. package/dist/short-circuit-flags-74Y5N6CF.js +10 -0
  120. package/dist/{simpleui-dist-CXSIDAXZ.js → simpleui-dist-7BQISSEP.js} +7 -3
  121. package/dist/skill-suggest-L2EVWB6R.js +290 -0
  122. package/dist/slash-commands/command-context.d.ts +15 -5
  123. package/dist/slash-commands/effort.d.ts +1 -1
  124. package/dist/slash-commands/fallback.d.ts +1 -1
  125. package/dist/slash-commands/gitid.d.ts +1 -1
  126. package/dist/slash-commands/goal-refiner.d.ts +4 -49
  127. package/dist/slash-commands/jev.d.ts +4 -0
  128. package/dist/slash-commands/mcp.d.ts +2 -1
  129. package/dist/slash-commands/openai-quota.d.ts +15 -0
  130. package/dist/slash-commands/permissions.d.ts +4 -0
  131. package/dist/slash-commands/sdd-task-mutations.d.ts +4 -0
  132. package/dist/slash-commands/settings-context-mutations.d.ts +5 -0
  133. package/dist/slash-commands/settings-keys.d.ts +2 -0
  134. package/dist/slash-commands/settings-limits-mutations.d.ts +12 -0
  135. package/dist/slash-commands/settings-reset.d.ts +6 -0
  136. package/dist/standalone-auto-update-TOTRGCSA.js +249 -0
  137. package/dist/standalone-auto-update.d.ts +65 -0
  138. package/dist/standalone-update-LZO3MNLH.js +24 -0
  139. package/dist/standalone-update.d.ts +55 -0
  140. package/dist/subcommands/handlers/hq-alerts.d.ts +3 -0
  141. package/dist/subcommands/handlers/hq-audit.d.ts +46 -0
  142. package/dist/subcommands/handlers/hq-data-dir.d.ts +13 -0
  143. package/dist/subcommands/handlers/import-claude-code.d.ts +42 -0
  144. package/dist/subcommands/handlers/permissions.d.ts +9 -3
  145. package/dist/subcommands/handlers/remote.d.ts +6 -0
  146. package/dist/subcommands/handlers/skill-suggest.d.ts +21 -0
  147. package/dist/subcommands/handlers/typesafe-brain-replay.d.ts +26 -0
  148. package/dist/subcommands/handlers/typesafe-judgment-check.d.ts +3 -0
  149. package/dist/subcommands/handlers/typesafe-topic-replay.d.ts +19 -0
  150. package/dist/subcommands/handlers/typesafe-triage-replay.d.ts +18 -0
  151. package/dist/subcommands/handlers/typesafe.d.ts +23 -0
  152. package/dist/subcommands/handlers/version-help.d.ts +5 -0
  153. package/dist/{subcommands-XSLXMIDP.js → subcommands-Q6ORSB2E.js} +2 -2
  154. package/dist/tui-resume-callback.d.ts +18 -0
  155. package/dist/typesafe-U7YB2RRV.js +316 -0
  156. package/dist/typesafe-brain-replay-C5276FVR.js +222 -0
  157. package/dist/typesafe-judgment-check-GGYYV5UF.js +29 -0
  158. package/dist/typesafe-topic-replay-ZILIU3WS.js +234 -0
  159. package/dist/typesafe-triage-replay-FGAW7QM7.js +215 -0
  160. package/dist/{update-5DPB4YD4.js → update-TDZX4IL2.js} +4 -3
  161. package/dist/{update-check-BS3DHTSI.js → update-check-J5ZVKS73.js} +3 -2
  162. package/dist/update-check.d.ts +1 -1
  163. package/dist/version-JB2UAV2A.js +11 -0
  164. package/dist/version-help-XJJQ7YSH.js +10 -0
  165. package/dist/version.d.ts +3 -2
  166. package/dist/webui-client-observability.d.ts +7 -0
  167. package/dist/webui-server/route-contexts.d.ts +1 -1
  168. package/dist/webui-server/session-start-payload.d.ts +5 -1
  169. package/dist/{webui-server-MRPGTTKL.js → webui-server-YTHLRFD2.js} +577 -370
  170. package/dist/webui-server-lifecycle.d.ts +57 -0
  171. package/dist/webui-server-options.d.ts +11 -0
  172. package/dist/webui-server.d.ts +1 -1
  173. package/dist/wiring/brain-and-orchestration.d.ts +3 -1
  174. package/dist/wiring/cli-prompt-and-tools-setup.d.ts +9 -0
  175. package/dist/wiring/cli-slash-commands-setup.d.ts +1 -0
  176. package/dist/wiring/domain-glossary.d.ts +5 -4
  177. package/dist/wiring/lifecycle-plugins.d.ts +4 -2
  178. package/dist/wiring/metrics.d.ts +9 -1
  179. package/dist/wiring/pipeline.d.ts +2 -7
  180. package/dist/wiring/plugins.d.ts +4 -1
  181. package/dist/wiring/provider-persisters.d.ts +24 -0
  182. package/dist/wiring/provider-runtime.d.ts +9 -1
  183. package/dist/wiring/provider-status.d.ts +1 -0
  184. package/dist/wiring/provider-utility-tools.d.ts +3 -1
  185. package/dist/wiring/runtime-dispatch-state.d.ts +3 -1
  186. package/package.json +28 -28
  187. package/dist/chunk-2CZEORLV.js +0 -54
  188. package/dist/chunk-672UXYL3.js +0 -65
  189. package/dist/chunk-6WRKAACA.js +0 -96
  190. package/dist/chunk-DR2OXU46.js +0 -174
  191. package/dist/chunk-JACOMTIH.js +0 -275
  192. package/dist/chunk-XJXDOF63.js +0 -28
  193. package/dist/modeldiag-CJSFHZ3J.js +0 -1356
  194. package/dist/short-circuit-flags-7GQIGMVD.js +0 -10
  195. package/dist/version-help-WXI42PZ3.js +0 -10
@@ -1,10 +1,16 @@
1
1
  import type { SubcommandHandler } from '../contracts.js';
2
2
  /**
3
+ * `wstack permissions rules [--json]`
3
4
  * `wstack permissions explain <tool> --input '<json>' [--json]`
4
5
  *
5
- * Side-effect-free permission decision explainer. Evaluates the same
6
- * rules as `DefaultPermissionPolicy.evaluate()` without prompting the
7
- * user, writing to trust files, or mutating session state.
6
+ * Side-effect-free views of the permission policy. Both build the policy the
7
+ * agent itself runs under (`createProjectPermissionPolicy`: directory rules,
8
+ * trust file, YOLO and `autonomy.yoloConfirm` from the config) for a fresh
9
+ * session, without prompting the user, writing to trust files, or mutating
10
+ * session state. `rules` lists every rule in the order they are checked;
11
+ * `explain` traces one call and names the rule that decided it. Inside a
12
+ * session, `/permissions` shows the same with that session's YOLO, answers
13
+ * and session rules.
8
14
  */
9
15
  export declare const permissionsCmd: SubcommandHandler;
10
16
  //# sourceMappingURL=permissions.d.ts.map
@@ -0,0 +1,6 @@
1
+ import type { TerminalRenderer } from '../../renderer.js';
2
+ import type { SubcommandHandler } from '../contracts.js';
3
+ export declare function runRemoteCommand(args: string[], flags: Record<string, string | boolean>, renderer: Pick<TerminalRenderer, 'writeLine'>): Promise<number>;
4
+ /** Registry entry; `boot()` normally dispatches `remote` before loading any config. */
5
+ export declare const remoteCmd: SubcommandHandler;
6
+ //# sourceMappingURL=remote.d.ts.map
@@ -0,0 +1,21 @@
1
+ /**
2
+ * `wstack skill-suggest` — inspect and tune the TypeSafe skill suggester.
3
+ *
4
+ * The suggester runs inside a turn and its output is one line of system prompt,
5
+ * which makes it almost impossible to observe in place: you see the agent load
6
+ * a skill, not why. Two modes make it inspectable:
7
+ *
8
+ * wstack skill-suggest "<request>" one request, both passes, all numbers
9
+ * wstack skill-suggest --eval cases.jsonl labeled set, scored
10
+ * wstack skill-suggest --eval cases.jsonl --sweep …plus a threshold table
11
+ *
12
+ * Both work whether or not `skills.suggest.enabled` is on — previewing is how
13
+ * you decide whether to turn it on. Both need a TypeSafe API key, and both send
14
+ * request text to TypeSafe, so `--eval` prints what it is about to spend before
15
+ * it spends it.
16
+ */
17
+ import { type LabeledRequest, type ScoredCase } from '@wrongstack/core/skills';
18
+ import type { SubcommandHandler } from '../contracts.js';
19
+ export declare const skillSuggestCmd: SubcommandHandler;
20
+ export type { LabeledRequest, ScoredCase };
21
+ //# sourceMappingURL=skill-suggest.d.ts.map
@@ -0,0 +1,26 @@
1
+ /**
2
+ * `wstack typesafe replay-brain-ledger` — calibrate the Brain's System One
3
+ * tier on decisions this project already made.
4
+ *
5
+ * The Brain ledger records every decision (question, chosen option, which tier
6
+ * or council settled it) and, for interventions, whether the same signal fired
7
+ * again afterwards. It does not record the option list or the full context —
8
+ * but the BrainMonitor signals (file churn, tool-failure streak, stall, error
9
+ * storm) always ask the same steer/continue question with a context the
10
+ * question text already carries, so those requests can be rebuilt exactly.
11
+ *
12
+ * Each rebuilt request goes through `probeSystemOneBrain` (the tier's real
13
+ * questions, no thresholds), and the report compares Jev's pick with the
14
+ * recorded one: overall agreement, how much the current thresholds would
15
+ * settle and how often those settled picks agree, a threshold sweep, and how
16
+ * often Jev said `continue` on a steer the ledger shows was futile (the same
17
+ * signal re-fired).
18
+ *
19
+ * The recorded pick is a reference, not ground truth: most were made by the
20
+ * council or a policy, and the outcome record only exists for steers. The
21
+ * decision digest the live tier sees is omitted — rebuilding it from the
22
+ * ledger would leak later outcomes into earlier decisions.
23
+ */
24
+ import type { SubcommandDeps } from '../contracts.js';
25
+ export declare function replayBrainLedger(deps: SubcommandDeps, write: (line: string) => void): Promise<number>;
26
+ //# sourceMappingURL=typesafe-brain-replay.d.ts.map
@@ -0,0 +1,3 @@
1
+ import type { SubcommandDeps } from '../contracts.js';
2
+ export declare function checkJudgments(deps: SubcommandDeps, write: (line: string) => void): Promise<number>;
3
+ //# sourceMappingURL=typesafe-judgment-check.d.ts.map
@@ -0,0 +1,19 @@
1
+ /**
2
+ * `wstack typesafe replay-topic-shift` — calibrate the topic-shift front on
3
+ * this project's own sessions.
4
+ *
5
+ * Session journals record every user prompt (`user_input`) and every message
6
+ * appended to the conversation, so the history the advisor saw at each prompt
7
+ * can be rebuilt. Each prompt is replayed through the real `TopicShiftAdvisor`
8
+ * twice — once with only the TypeSafe judge, once with only the configured
9
+ * provider (the path it has always had, with its production request) — and only
10
+ * prompts that pass the advisor's own local gate are counted, because the
11
+ * rest never reach a classifier in production either.
12
+ *
13
+ * Reported: how often each classifier answers at all, what it answers, and
14
+ * how the two agree where Jev is decisive. `--json` includes the prompt and
15
+ * the previous user prompt for hand-labelling. Nothing is written.
16
+ */
17
+ import type { SubcommandDeps } from '../contracts.js';
18
+ export declare function replayTopicShift(deps: SubcommandDeps, write: (line: string) => void): Promise<number>;
19
+ //# sourceMappingURL=typesafe-topic-replay.d.ts.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * `wstack typesafe replay-memory-triage` — calibrate the triage front on this
3
+ * project's own memories.
4
+ *
5
+ * Opens the project's SAGE database READ-ONLY, runs the deterministic Phases
6
+ * 1–2 exactly as `/memory triage` does to find the gray zone, samples it, and
7
+ * asks both Jev (`probeMemoryValue`, raw distribution) and the configured LLM
8
+ * (the same prompt and parser `/memory triage` uses) for a 1–5 rating.
9
+ *
10
+ * The report compares them on the rating and — what actually matters — on the
11
+ * triage ACTION each rating would cause (keep / stale / propose archive),
12
+ * overall and for the subset the front would settle at each confidence
13
+ * threshold. The LLM is the reference, not ground truth; `--no-llm` skips it
14
+ * and reports Jev's distribution alone. Nothing is written anywhere.
15
+ */
16
+ import type { SubcommandDeps } from '../contracts.js';
17
+ export declare function replayMemoryTriage(deps: SubcommandDeps, write: (line: string) => void): Promise<number>;
18
+ //# sourceMappingURL=typesafe-triage-replay.d.ts.map
@@ -0,0 +1,23 @@
1
+ /**
2
+ * `wstack typesafe` — the account surface for the System One features.
3
+ *
4
+ * TypeSafe is not a provider and deliberately does not appear in `wstack auth`:
5
+ * it answers typed questions rather than generating text, so putting it in the
6
+ * provider list would leak `jev-latest` into the model picker, the subagent
7
+ * lanes and the fallback chain, where selecting it would simply break a turn.
8
+ * But "not a provider" is not "not an account" — it has a credential, a host
9
+ * and a bill, and until this command existed the only way to configure any of
10
+ * that was to hand-edit a config file. Nothing in any UI mentioned it.
11
+ *
12
+ * wstack typesafe what is configured (no network request)
13
+ * wstack typesafe login store a key (and pick a route)
14
+ * wstack typesafe test spend one cheap question proving it works
15
+ *
16
+ * `test` is the point of the whole command. Both consumers degrade silently by
17
+ * design, so a wrong or revoked key produces no error anywhere — it produces
18
+ * slightly worse routing and no skill suggestions, forever. This is the only
19
+ * place that asks the host directly and reports what it said.
20
+ */
21
+ import type { SubcommandHandler } from '../contracts.js';
22
+ export declare const typesafeCmd: SubcommandHandler;
23
+ //# sourceMappingURL=typesafe.d.ts.map
@@ -1,4 +1,9 @@
1
1
  import type { SubcommandHandler } from '../contracts.js';
2
2
  export declare const versionCmd: SubcommandHandler;
3
+ /**
4
+ * Global help. Every row here must name something the CLI actually reads —
5
+ * `wstack <command> --help` carries the per-command detail, so this page
6
+ * groups by what the user is trying to do rather than listing everything.
7
+ */
3
8
  export declare const helpCmd: SubcommandHandler;
4
9
  //# sourceMappingURL=version-help.d.ts.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  subcommandNames,
3
3
  subcommands
4
- } from "./chunk-2CZEORLV.js";
4
+ } from "./chunk-BEHGRNOQ.js";
5
5
  export {
6
6
  subcommandNames,
7
7
  subcommands
8
8
  };
9
- //# sourceMappingURL=subcommands-XSLXMIDP.js.map
9
+ //# sourceMappingURL=subcommands-Q6ORSB2E.js.map
@@ -0,0 +1,18 @@
1
+ import type { SessionLoadProgress } from '@wrongstack/core/types';
2
+ export declare function createTuiResumeCallback({ state, agent, tokenCounter, switchProviderAndModel, events, }: {
3
+ state: import('./boot/tui-runtime-state.js').TuiRuntimeState;
4
+ agent: import('@wrongstack/core/agent').Agent;
5
+ tokenCounter: import('@wrongstack/core/types').TokenCounter;
6
+ switchProviderAndModel: (providerId: string, modelId: string) => string | Promise<string | null> | null;
7
+ events: import('@wrongstack/core/kernel').EventBus;
8
+ }): (sessionId: string, onLoadProgress?: (progress: SessionLoadProgress) => void, onStage?: (stage: string) => void) => Promise<{
9
+ entries: unknown[];
10
+ nextId: number;
11
+ sessionId: string;
12
+ attached: boolean;
13
+ warnings: string[];
14
+ contextSnapshot?: import("@wrongstack/core/types").ContextSnapshot | undefined;
15
+ lastAssistantText?: string | undefined;
16
+ nextSteps: string[];
17
+ }>;
18
+ //# sourceMappingURL=tui-resume-callback.d.ts.map
@@ -0,0 +1,316 @@
1
+ import {
2
+ maskedKey,
3
+ mutateConfigProviders
4
+ } from "./chunk-LUMETJFO.js";
5
+ import {
6
+ activeProfileConfigPath
7
+ } from "./chunk-YMXXOOFN.js";
8
+
9
+ // src/subcommands/handlers/typesafe.ts
10
+ import { execFile } from "node:child_process";
11
+ import { readFile } from "node:fs/promises";
12
+ import * as path from "node:path";
13
+ import {
14
+ BUILT_IN_ROUTES,
15
+ BUILT_IN_SEMANTIC_LINT_RULES,
16
+ estimateTypeSafeCostUsd,
17
+ findSemanticLintCandidates,
18
+ isTypeSafeJudgmentEnabled,
19
+ isTypeSafeRoute,
20
+ judgeSemanticLintCandidates,
21
+ parseSemanticLintRules,
22
+ resolveTypeSafeAccount,
23
+ resolveTypeSafeJudge,
24
+ resolveTypeSafeRoute,
25
+ TYPESAFE_JUDGMENT_FEATURES,
26
+ TYPESAFE_ROUTES
27
+ } from "@wrongstack/core/typesafe";
28
+ import { buildChildEnv, color } from "@wrongstack/core/utils";
29
+ var USAGE = [
30
+ "Usage:",
31
+ " wstack typesafe [status] show account and feature configuration",
32
+ " wstack typesafe login [--route <id>] store an API key in the active profile",
33
+ " [--endpoint <url>] [--model <id>] configure a proxy or pin a model",
34
+ " wstack typesafe test send one question and report the answer",
35
+ " wstack typesafe lint-conventions judge convention-rule hits in the diff",
36
+ " [--staged | --base <ref>] [--threshold <0..1>] [--json]",
37
+ " rules: built-in + .wrongstack/semantic-lint.json; exit 1 on findings",
38
+ " wstack typesafe check-judgments run every judgment on known cases (live)",
39
+ " wstack typesafe replay-brain-ledger compare Jev with past Brain decisions",
40
+ " [--ledger <path>] [--limit <per kind>] [--kind <signal>] [--json]",
41
+ " wstack typesafe replay-topic-shift compare Jev with the provider on past session prompts",
42
+ " [--sessions <dir>] [--limit <n>] [--max-context <n>] [--no-llm] [--json]",
43
+ " wstack typesafe replay-memory-triage compare Jev with the LLM on SAGE gray-zone memories",
44
+ " [--limit <n>] [--provider <id>] [--model <id>] [--llm-max-tokens <n>]",
45
+ " [--no-llm] [--json]",
46
+ "",
47
+ `Routes: ${BUILT_IN_ROUTES.map((r) => `${r} (${TYPESAFE_ROUTES[r].env})`).join(", ")}, custom (typesafe.endpoint)`,
48
+ "",
49
+ "TypeSafe is not a chat provider and is not listed by `wstack auth`."
50
+ ].join("\n");
51
+ var typesafeCmd = async (args, deps) => {
52
+ const write = (line) => deps.renderer.write(`${line}
53
+ `);
54
+ const flags = deps.flags ?? {};
55
+ if (flags["help"] === true || flags["h"] === true) {
56
+ write(USAGE);
57
+ return 0;
58
+ }
59
+ const sub = (args[0] ?? "status").toLowerCase();
60
+ switch (sub) {
61
+ case "status":
62
+ return showStatus(deps, write);
63
+ case "login":
64
+ return await login(deps, write);
65
+ case "test":
66
+ return await test(deps, write);
67
+ case "lint-conventions":
68
+ return await lintConventions(deps, write);
69
+ case "replay-topic-shift":
70
+ return await (await import("./typesafe-topic-replay-ZILIU3WS.js")).replayTopicShift(deps, write);
71
+ case "replay-memory-triage":
72
+ return await (await import("./typesafe-triage-replay-FGAW7QM7.js")).replayMemoryTriage(deps, write);
73
+ case "replay-brain-ledger":
74
+ return await (await import("./typesafe-brain-replay-C5276FVR.js")).replayBrainLedger(deps, write);
75
+ case "check-judgments":
76
+ return await (await import("./typesafe-judgment-check-GGYYV5UF.js")).checkJudgments(deps, write);
77
+ default:
78
+ write(`Unknown subcommand: ${sub}
79
+ `);
80
+ write(USAGE);
81
+ return 1;
82
+ }
83
+ };
84
+ function requestedFeatures(deps) {
85
+ const requested = [];
86
+ if (deps.config.skills?.suggest?.enabled === true) requested.push("skills.suggest");
87
+ if (deps.config.fleet?.dispatch?.typesafeClassifier === true) {
88
+ requested.push("fleet.dispatch.typesafeClassifier");
89
+ }
90
+ return requested;
91
+ }
92
+ function showStatus(deps, write) {
93
+ const account = resolveTypeSafeAccount({ config: deps.config });
94
+ const route = resolveTypeSafeRoute(deps.config, process.env);
95
+ const features = requestedFeatures(deps);
96
+ write(color.bold("TypeSafe account"));
97
+ write(` route ${route}${route === "custom" ? color.dim(" (from typesafe.endpoint)") : ""}`);
98
+ if (account.status === "ready") {
99
+ write(` endpoint ${account.endpoint}`);
100
+ write(` model ${account.model}`);
101
+ write(
102
+ ` key ${account.keySource === "config" ? `${maskedKey(deps.config.typesafe?.apiKey ?? "")} ${color.dim("(typesafe.apiKey)")}` : color.dim(`from $${account.keyEnv}`)}`
103
+ );
104
+ write(" connection not tested \u2014 run `wstack typesafe test` to verify");
105
+ } else {
106
+ write(` key ${color.dim("\u2014")}`);
107
+ write(` ${color.amber("!")} ${account.reason}`);
108
+ }
109
+ write("");
110
+ write(
111
+ color.bold("Judgments") + color.dim(" (on with an account; typesafe.judgments.<id>: false turns one off)")
112
+ );
113
+ for (const feature of TYPESAFE_JUDGMENT_FEATURES) {
114
+ const on = isTypeSafeJudgmentEnabled(deps.config, feature);
115
+ write(
116
+ ` ${!on ? color.dim("off") : account.status === "ready" ? color.green("on ") : color.dim("idle")} ${feature}`
117
+ );
118
+ }
119
+ write("");
120
+ write(color.bold("Features"));
121
+ if (features.length === 0) {
122
+ write(` ${color.dim("none enabled")} \u2014 see docs/skills-suggestion.md`);
123
+ } else {
124
+ for (const feature of features) {
125
+ write(
126
+ account.status === "ready" ? ` ${color.green("on")} ${feature}` : ` ${color.amber("on, but not running")} ${feature}`
127
+ );
128
+ }
129
+ }
130
+ if (account.status !== "ready" && features.length > 0) {
131
+ write("");
132
+ write(` ${color.amber("Run `wstack typesafe login` \u2014 these switches do nothing today.")}`);
133
+ return 1;
134
+ }
135
+ return 0;
136
+ }
137
+ async function login(deps, write) {
138
+ const flags = deps.flags ?? {};
139
+ for (const name of ["route", "endpoint", "model", "key"]) {
140
+ if (flags[name] !== void 0 && (typeof flags[name] !== "string" || !String(flags[name]).trim())) {
141
+ write(`--${name} requires a value.`);
142
+ return 1;
143
+ }
144
+ }
145
+ const requested = flags["route"];
146
+ let route;
147
+ if (typeof requested === "string") {
148
+ if (!isTypeSafeRoute(requested)) {
149
+ write(`Unknown route: ${requested}`);
150
+ write(USAGE);
151
+ return 1;
152
+ }
153
+ route = requested;
154
+ }
155
+ const endpoint = typeof flags["endpoint"] === "string" ? flags["endpoint"].trim() : void 0;
156
+ const model = typeof flags["model"] === "string" ? flags["model"].trim() : void 0;
157
+ if (endpoint && !route) route = "custom";
158
+ const update = (existing) => {
159
+ const next = { ...existing };
160
+ if (route && route !== resolveTypeSafeRoute({ typesafe: existing }, {})) {
161
+ delete next.endpoint;
162
+ delete next.model;
163
+ }
164
+ if (route) next.route = route;
165
+ if (endpoint) next.endpoint = endpoint;
166
+ if (model) next.model = model;
167
+ return next;
168
+ };
169
+ const settings = update(deps.config.typesafe ?? {});
170
+ const preview = resolveTypeSafeAccount({ config: { typesafe: settings }, env: {} });
171
+ if (preview.status === "unusable") {
172
+ write(`${preview.reason}. For a custom route, pass --endpoint <url>.`);
173
+ return 1;
174
+ }
175
+ const effectiveRoute = resolveTypeSafeRoute({ typesafe: settings }, {});
176
+ const label = effectiveRoute !== "custom" ? TYPESAFE_ROUTES[effectiveRoute].label : "TypeSafe (custom)";
177
+ const fromFlag = typeof flags["key"] === "string" ? flags["key"].trim() : "";
178
+ const key = fromFlag || await deps.reader.readSecret(` ${color.amber("?")} ${label} API key: `);
179
+ if (!key.trim()) {
180
+ write("No key entered; nothing written.");
181
+ return 1;
182
+ }
183
+ const configPath = activeProfileConfigPath(deps.paths, deps.config);
184
+ await mutateConfigProviders(configPath, deps.vault, (_providers, config) => {
185
+ const existing = typeof config["typesafe"] === "object" && config["typesafe"] !== null ? config["typesafe"] : {};
186
+ config["typesafe"] = { ...update(existing), apiKey: key.trim() };
187
+ });
188
+ write(`${color.green("\u2713")} Key stored in ${configPath}`);
189
+ if (route) write(` route set to ${route}`);
190
+ write(` Verify it with ${color.bold("wstack typesafe test")}.`);
191
+ return 0;
192
+ }
193
+ async function test(deps, write) {
194
+ const account = resolveTypeSafeAccount({ config: deps.config, restGate: null });
195
+ if (account.status !== "ready") {
196
+ write(`${color.red("\u2717")} ${account.reason}`);
197
+ write(" Run `wstack typesafe login`.");
198
+ return 1;
199
+ }
200
+ write(`Asking ${account.endpoint} (${account.model})\u2026`);
201
+ const started = Date.now();
202
+ try {
203
+ const result = await account.client.systemOne({
204
+ state: { text: "The service returned this request successfully." },
205
+ questions: {
206
+ reachable: {
207
+ type: "noul",
208
+ instructions: "Is the text in the state written in English?"
209
+ }
210
+ }
211
+ });
212
+ const answer = result.answers["reachable"];
213
+ const elapsed = Date.now() - started;
214
+ if (answer?.type !== "noul") {
215
+ write(`${color.red("\u2717")} Reached the host but the answer was missing or malformed.`);
216
+ return 1;
217
+ }
218
+ write(`${color.green("\u2713")} ${account.route} route works \u2014 answered in ${elapsed}ms`);
219
+ write(` model reported ${result.model ?? color.dim("(none in response)")}`);
220
+ write(
221
+ ` cost ${result.usage.inputTokens} input tokens ` + color.dim(`(~$${estimateTypeSafeCostUsd(result.usage.inputTokens).toFixed(6)})`)
222
+ );
223
+ if (result.model && deps.config.typesafe?.model && result.model !== deps.config.typesafe.model) {
224
+ write(
225
+ color.dim(` note: asked for ${deps.config.typesafe.model}, answered by ${result.model}`)
226
+ );
227
+ }
228
+ return 0;
229
+ } catch (err) {
230
+ const status = err.status;
231
+ write(`${color.red("\u2717")} ${err instanceof Error ? err.message : String(err)}`);
232
+ if (status === 401 || status === 403) {
233
+ write(" The host rejected the key. Re-run `wstack typesafe login`.");
234
+ } else if (status === 429 || status === 529) {
235
+ write(" Rate limited or overloaded \u2014 the key is probably fine; try again shortly.");
236
+ } else if (status === 422) {
237
+ write(" The host rejected the request shape, not the key. This is a bug; please report it.");
238
+ }
239
+ return 1;
240
+ }
241
+ }
242
+ function runGit(cwd, args) {
243
+ return new Promise((resolve, reject) => {
244
+ execFile(
245
+ "git",
246
+ args,
247
+ {
248
+ cwd,
249
+ env: buildChildEnv(),
250
+ encoding: "utf8",
251
+ timeout: 3e4,
252
+ windowsHide: true,
253
+ maxBuffer: 32 * 1024 * 1024
254
+ },
255
+ (err, stdout) => err ? reject(err) : resolve(stdout)
256
+ );
257
+ });
258
+ }
259
+ async function lintConventions(deps, write) {
260
+ const flags = deps.flags ?? {};
261
+ const judge = resolveTypeSafeJudge({ config: deps.config, feature: "semanticLint" });
262
+ if (!judge) {
263
+ const account = resolveTypeSafeAccount({ config: deps.config });
264
+ write(
265
+ `${color.red("\u2717")} ${account.status === "ready" ? "typesafe.judgments.semanticLint is false." : `${account.reason}. Run \`wstack typesafe login\`.`}`
266
+ );
267
+ return 2;
268
+ }
269
+ const rules = [...BUILT_IN_SEMANTIC_LINT_RULES];
270
+ const rulesPath = path.join(deps.projectRoot, ".wrongstack", "semantic-lint.json");
271
+ try {
272
+ const parsed = parseSemanticLintRules(JSON.parse(await readFile(rulesPath, "utf8")));
273
+ for (const error of parsed.errors) write(color.amber(`! ${rulesPath}: ${error}`));
274
+ rules.push(...parsed.rules);
275
+ } catch (err) {
276
+ if (err.code !== "ENOENT") {
277
+ write(color.amber(`! ${rulesPath}: ${err instanceof Error ? err.message : String(err)}`));
278
+ }
279
+ }
280
+ const base = typeof flags["base"] === "string" ? flags["base"] : void 0;
281
+ const diffArgs = ["diff", "--no-color", "--no-ext-diff", "-U24"];
282
+ if (flags["staged"] === true) diffArgs.push("--cached");
283
+ else if (base) diffArgs.push(`${base}...HEAD`);
284
+ let diff;
285
+ try {
286
+ diff = await runGit(deps.projectRoot, diffArgs);
287
+ } catch (err) {
288
+ write(`${color.red("\u2717")} git diff failed: ${err instanceof Error ? err.message : String(err)}`);
289
+ return 2;
290
+ }
291
+ const candidates = findSemanticLintCandidates(diff, rules);
292
+ const thresholdFlag = Number(flags["threshold"]);
293
+ const threshold = Number.isFinite(thresholdFlag) && thresholdFlag > 0 && thresholdFlag <= 1 ? thresholdFlag : 0.7;
294
+ const result = candidates.length === 0 ? { findings: [], cleared: 0, unjudged: 0 } : await judgeSemanticLintCandidates(judge, rules, candidates, { threshold });
295
+ if (flags["json"] === true) {
296
+ write(JSON.stringify({ candidates: candidates.length, ...result }, null, 2));
297
+ } else {
298
+ for (const f of result.findings) {
299
+ write(
300
+ `${color.amber(`${f.file}:${f.line}`)} ${color.bold(f.ruleId)} ` + color.dim(`p=${f.probability.toFixed(2)}`)
301
+ );
302
+ write(` ${f.text.slice(0, 160)}`);
303
+ }
304
+ write(
305
+ color.dim(
306
+ `${candidates.length} candidate(s) across ${rules.length} rule(s): ${result.findings.length} finding(s), ${result.cleared} cleared` + (result.unjudged ? `, ${result.unjudged} not judged (host unavailable)` : "")
307
+ )
308
+ );
309
+ }
310
+ if (result.findings.length > 0) return 1;
311
+ return result.unjudged > 0 ? 2 : 0;
312
+ }
313
+ export {
314
+ typesafeCmd
315
+ };
316
+ //# sourceMappingURL=typesafe-U7YB2RRV.js.map