@wrongstack/cli 1.0.13 → 1.0.14

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.
@@ -22,7 +22,7 @@ async function handleHelpVersionShortCircuit(argv) {
22
22
  }
23
23
  if (earlyFlags["help"] === true) {
24
24
  if (positional.length > 0) {
25
- const { subcommandNames } = await import("./subcommands-EJI7DBQS.js");
25
+ const { subcommandNames } = await import("./subcommands-3ILCNR2T.js");
26
26
  if (subcommandNames.includes(positional[0])) {
27
27
  const first = positional[0];
28
28
  const deep = positional[1];
@@ -43,4 +43,4 @@ async function handleHelpVersionShortCircuit(argv) {
43
43
  export {
44
44
  handleHelpVersionShortCircuit
45
45
  };
46
- //# sourceMappingURL=chunk-TNZBQG45.js.map
46
+ //# sourceMappingURL=chunk-DUF5FEWD.js.map
@@ -231,7 +231,7 @@ function hqAuthRequired(mutableAuth, requireBrowserAuth) {
231
231
  return (requireBrowserAuth ?? mutableAuth.requireBrowserAuth) === true || mutableAuth.requireAuthFloor === true || mutableAuth.browserTokens.size > 0 || mutableAuth.passwordHash !== void 0;
232
232
  }
233
233
  function hqClientAuthRequired(mutableAuth) {
234
- return mutableAuth.requireAuthFloor === true || mutableAuth.clientTokens.size > 0;
234
+ return mutableAuth.clientTokens.size > 0 || hqAuthRequired(mutableAuth);
235
235
  }
236
236
  function extractBrowserToken(req, url) {
237
237
  const queryToken = url.searchParams.get("token");
@@ -4880,8 +4880,19 @@ async function startHqServerWithAuth(options, host, port, dataDir, firstRunAuth)
4880
4880
  bootstrapStore
4881
4881
  };
4882
4882
  const handleRequest = createHqRouter(routerDeps);
4883
+ const closeSocketsOfRemovedSessions = (before) => {
4884
+ for (const [browser, sessionId] of browserSocketSessions) {
4885
+ if (!before.has(sessionId) || sessions.has(sessionId)) continue;
4886
+ if (browser.readyState === WebSocket3.OPEN) {
4887
+ browser.close(1008, "Browser session revoked");
4888
+ }
4889
+ }
4890
+ };
4883
4891
  const httpServer = http.createServer((req, res) => {
4884
- void handleRequest(req, res);
4892
+ const sessionsBefore = sessions.size > 0 ? new Set(sessions.keys()) : void 0;
4893
+ void handleRequest(req, res).finally(() => {
4894
+ if (sessionsBefore !== void 0) closeSocketsOfRemovedSessions(sessionsBefore);
4895
+ });
4885
4896
  });
4886
4897
  const wss = new WebSocketServer({ noServer: true, maxPayload: 1 * 1024 * 1024 });
4887
4898
  const browserHeartbeatTimer = setInterval(() => {
@@ -5089,4 +5100,4 @@ export {
5089
5100
  startHqServer,
5090
5101
  HqInsecureExposureError2 as HqInsecureExposureError
5091
5102
  };
5092
- //# sourceMappingURL=chunk-YRC3I3LE.js.map
5103
+ //# sourceMappingURL=chunk-MZY6UDWC.js.map
@@ -31,7 +31,7 @@ var loaders = {
31
31
  quick: async () => (await import("./quick-CNB4Z3HS.js")).quickCmd,
32
32
  bench: async () => (await import("./bench-YBU6BVQP.js")).benchCmd,
33
33
  chronicle: async () => (await import("./chronicle-UTFETHP6.js")).chronicleCmd,
34
- hq: async () => (await import("./hq-NO2NWGU4.js")).hqCmd,
34
+ hq: async () => (await import("./hq-O5BOP6UY.js")).hqCmd,
35
35
  mailbox: async () => (await import("./mailbox-serve-X3CR6VFW.js")).mailboxServeCmd,
36
36
  permissions: async () => (await import("./permissions-CFDLXETM.js")).permissionsCmd,
37
37
  project: async () => (await import("./project-AOQI5XTK.js")).projectCmd,
@@ -51,4 +51,4 @@ export {
51
51
  subcommands,
52
52
  subcommandNames
53
53
  };
54
- //# sourceMappingURL=chunk-OJR7K3OI.js.map
54
+ //# sourceMappingURL=chunk-U3PDQOYU.js.map
@@ -19,17 +19,17 @@ import {
19
19
  } from "./chunk-GPPRNAKW.js";
20
20
  import {
21
21
  subcommands
22
- } from "./chunk-OJR7K3OI.js";
22
+ } from "./chunk-U3PDQOYU.js";
23
23
  import {
24
24
  renderDeepHelp,
25
25
  renderFocusedHelp
26
26
  } from "./chunk-JX6KL7OF.js";
27
27
  import {
28
28
  handleHelpVersionShortCircuit
29
- } from "./chunk-TNZBQG45.js";
29
+ } from "./chunk-DUF5FEWD.js";
30
30
  import {
31
31
  DEFAULT_PORT
32
- } from "./chunk-YRC3I3LE.js";
32
+ } from "./chunk-MZY6UDWC.js";
33
33
  import "./chunk-HXJYHAR4.js";
34
34
  import {
35
35
  resolveHqPasswordInput
@@ -866,7 +866,7 @@ async function isPortInUse(host, port) {
866
866
  }
867
867
  async function handleHqShortCircuit(flags) {
868
868
  if (flags["hq"] !== true) return null;
869
- const { startHqServer } = await import("./hq-server-KE5YDNGG.js");
869
+ const { startHqServer } = await import("./hq-server-YW4MJCKH.js");
870
870
  const tunnelRequested = flags["tunnel"] === true;
871
871
  const rawPublicUrl = typeof flags["hq-public-url"] === "string" ? flags["hq-public-url"] : process.env.WRONGSTACK_HQ_PUBLIC_URL;
872
872
  let publicOrigin;
@@ -3303,4 +3303,4 @@ async function initializeCli(argv) {
3303
3303
  export {
3304
3304
  initializeCli
3305
3305
  };
3306
- //# sourceMappingURL=cli-context-5IF7ZYEY.js.map
3306
+ //# sourceMappingURL=cli-context-6MTVFJPO.js.map
@@ -68,7 +68,7 @@ var hqCmd = async (args, deps) => {
68
68
  return 1;
69
69
  };
70
70
  async function startServer(deps) {
71
- const { startHqServer } = await import("./hq-server-KE5YDNGG.js");
71
+ const { startHqServer } = await import("./hq-server-YW4MJCKH.js");
72
72
  const dataDir = resolveDataDir(deps);
73
73
  const flags = deps.flags ?? {};
74
74
  const rawPublicUrl = typeof flags["hq-public-url"] === "string" ? flags["hq-public-url"] : process.env.WRONGSTACK_HQ_PUBLIC_URL;
@@ -538,6 +538,16 @@ async function tokenList(args, deps) {
538
538
  });
539
539
  const tokens = authFile[tokenField] ?? [];
540
540
  if (tokens.length === 0) {
541
+ const browserCredential = authFile.passwordHash !== void 0 || (authFile.browserTokens ?? []).length > 0;
542
+ if (scope === "client" && browserCredential) {
543
+ deps.renderer.write(
544
+ "No client tokens issued. HQ has a browser credential, so /ws/client REJECTS every publisher.\n"
545
+ );
546
+ deps.renderer.write(
547
+ "Run `wstack hq token create --client [label]` to let publishers connect.\n"
548
+ );
549
+ return 0;
550
+ }
541
551
  deps.renderer.write(
542
552
  `No ${scope} tokens issued. ${scope === "browser" ? "Browsers" : "Clients"} are in OPEN MODE.
543
553
  `
@@ -977,4 +987,4 @@ export {
977
987
  hqCmd,
978
988
  resolveAuditActor
979
989
  };
980
- //# sourceMappingURL=hq-NO2NWGU4.js.map
990
+ //# sourceMappingURL=hq-O5BOP6UY.js.map
@@ -91,6 +91,16 @@ export declare function hqAuthRequired(mutableAuth: HqRouterMutableAuth, require
91
91
  * which are a separate set from the browser tokens, but the same fail-closed
92
92
  * floor applies: an all-expired client-token file must not mean "no auth
93
93
  * configured, let anyone register as a session".
94
+ *
95
+ * WS-2026-09-15-01: this used to be `requireAuthFloor || clientTokens.size > 0`.
96
+ * The floor only latches in true open mode (no password, no browser token), so
97
+ * a password-protected HQ on a network bind whose client tokens had all expired
98
+ * or been revoked accepted a tokenless `/ws/client` — and `client.hello` then
99
+ * granted every capability the socket declared, `control.approve` included.
100
+ * OPEN MODE is "no credential of any kind" (SECURITY.md); once HQ holds ANY
101
+ * browser credential, the publisher channel must present a client token too.
102
+ * A loopback exemption is deliberately absent: `--tunnel` and reverse proxies
103
+ * deliver remote traffic from 127.0.0.1.
94
104
  */
95
105
  export declare function hqClientAuthRequired(mutableAuth: HqRouterMutableAuth): boolean;
96
106
  /**
@@ -10,7 +10,7 @@ import {
10
10
  readLocalSubagentTranscript,
11
11
  sanitizeApiError,
12
12
  startHqServer
13
- } from "./chunk-YRC3I3LE.js";
13
+ } from "./chunk-MZY6UDWC.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-KE5YDNGG.js.map
30
+ //# sourceMappingURL=hq-server-YW4MJCKH.js.map
package/dist/index.js CHANGED
@@ -16,11 +16,11 @@ async function main(argv) {
16
16
  applySessionShellDefault();
17
17
  const earlyFlags = parseArgs(argv).flags;
18
18
  if (earlyFlags["help"] === true || earlyFlags["version"] === true) {
19
- const { handleHelpVersionShortCircuit } = await import("./short-circuit-flags-72E77TJI.js");
19
+ const { handleHelpVersionShortCircuit } = await import("./short-circuit-flags-T6EFG3W6.js");
20
20
  const earlyExit = await handleHelpVersionShortCircuit(argv);
21
21
  if (earlyExit !== null) return earlyExit;
22
22
  }
23
- const { initializeCli } = await import("./cli-context-5IF7ZYEY.js");
23
+ const { initializeCli } = await import("./cli-context-6MTVFJPO.js");
24
24
  const cliCtx = await initializeCli(argv);
25
25
  if (typeof cliCtx === "number") return cliCtx;
26
26
  const { runInteractive } = await import("./cli-main-6JWASRH2.js");
@@ -31,7 +31,12 @@ async function main(argv) {
31
31
  import { resolve } from "node:path";
32
32
  import { pathToFileURL } from "node:url";
33
33
  import { scrubErrorText } from "@wrongstack/core/security";
34
- import { installCrashShield, runFatalSalvageSync, writeErr } from "@wrongstack/core/utils";
34
+ import {
35
+ hardenWin32ExecutableSearch,
36
+ installCrashShield,
37
+ runFatalSalvageSync,
38
+ writeErr
39
+ } from "@wrongstack/core/utils";
35
40
  var SQLITE_WARNING_RE = /sqlite is an experimental feature/i;
36
41
  function installSqliteWarningFilter() {
37
42
  const originalEmit = process.emitWarning.bind(process);
@@ -119,6 +124,7 @@ function runAsMain(mainFn) {
119
124
  if (!isMain) return;
120
125
  installBrokenPipeHandlers();
121
126
  installCrashShield();
127
+ hardenWin32ExecutableSearch();
122
128
  process.on("exit", () => {
123
129
  runFatalSalvageSync();
124
130
  });
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  handleHelpVersionShortCircuit
3
- } from "./chunk-TNZBQG45.js";
3
+ } from "./chunk-DUF5FEWD.js";
4
4
  import "./chunk-6WRKAACA.js";
5
5
  import "./chunk-XJXDOF63.js";
6
6
  import "./chunk-C3Z4N6A6.js";
7
7
  export {
8
8
  handleHelpVersionShortCircuit
9
9
  };
10
- //# sourceMappingURL=short-circuit-flags-72E77TJI.js.map
10
+ //# sourceMappingURL=short-circuit-flags-T6EFG3W6.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  subcommandNames,
3
3
  subcommands
4
- } from "./chunk-OJR7K3OI.js";
4
+ } from "./chunk-U3PDQOYU.js";
5
5
  export {
6
6
  subcommandNames,
7
7
  subcommands
8
8
  };
9
- //# sourceMappingURL=subcommands-EJI7DBQS.js.map
9
+ //# sourceMappingURL=subcommands-3ILCNR2T.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/cli",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
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": [
@@ -41,36 +41,36 @@
41
41
  "data"
42
42
  ],
43
43
  "dependencies": {
44
- "@wrongstack/acp": "1.0.13",
45
- "@wrongstack/bench": "1.0.13",
46
- "@wrongstack/core": "1.0.13",
47
- "@wrongstack/kanban": "1.0.13",
48
- "@wrongstack/mcp": "1.0.13",
49
- "@wrongstack/persistence": "1.0.13",
50
- "@wrongstack/plug-lsp": "1.0.13",
51
- "@wrongstack/plugins": "1.0.13",
52
- "@wrongstack/primitives": "1.0.13",
53
- "@wrongstack/providers": "1.0.13",
54
- "@wrongstack/requirement-intake": "1.0.13",
55
- "@wrongstack/runtime": "1.0.13",
56
- "@wrongstack/sage": "1.0.13",
57
- "@wrongstack/sdd": "1.0.13",
58
- "@wrongstack/security-scanner": "1.0.13",
59
- "@wrongstack/simpleui": "1.0.13",
60
- "@wrongstack/techstack": "1.0.13",
61
- "@wrongstack/telegram": "1.0.13",
62
- "@wrongstack/tools": "1.0.13",
63
- "@wrongstack/tui": "1.0.13",
64
- "@wrongstack/vector-memory": "1.0.13",
65
- "@wrongstack/webui": "1.0.13",
66
- "@wrongstack/webui-hq": "1.0.13",
67
- "@wrongstack/webui-protocol": "1.0.13",
68
- "@wrongstack/webui-server": "1.0.13",
69
- "@wrongstack/wrongtrace": "1.0.13",
44
+ "@wrongstack/acp": "1.0.14",
45
+ "@wrongstack/bench": "1.0.14",
46
+ "@wrongstack/core": "1.0.14",
47
+ "@wrongstack/kanban": "1.0.14",
48
+ "@wrongstack/mcp": "1.0.14",
49
+ "@wrongstack/persistence": "1.0.14",
50
+ "@wrongstack/plug-lsp": "1.0.14",
51
+ "@wrongstack/plugins": "1.0.14",
52
+ "@wrongstack/primitives": "1.0.14",
53
+ "@wrongstack/providers": "1.0.14",
54
+ "@wrongstack/requirement-intake": "1.0.14",
55
+ "@wrongstack/runtime": "1.0.14",
56
+ "@wrongstack/sage": "1.0.14",
57
+ "@wrongstack/sdd": "1.0.14",
58
+ "@wrongstack/security-scanner": "1.0.14",
59
+ "@wrongstack/simpleui": "1.0.14",
60
+ "@wrongstack/techstack": "1.0.14",
61
+ "@wrongstack/telegram": "1.0.14",
62
+ "@wrongstack/tools": "1.0.14",
63
+ "@wrongstack/tui": "1.0.14",
64
+ "@wrongstack/vector-memory": "1.0.14",
65
+ "@wrongstack/webui": "1.0.14",
66
+ "@wrongstack/webui-hq": "1.0.14",
67
+ "@wrongstack/webui-protocol": "1.0.14",
68
+ "@wrongstack/webui-server": "1.0.14",
69
+ "@wrongstack/wrongtrace": "1.0.14",
70
70
  "ws": "^8.21.3"
71
71
  },
72
72
  "optionalDependencies": {
73
- "@wrongstack/desktop": "1.0.13"
73
+ "@wrongstack/desktop": "1.0.14"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@types/node": "^26.5.1",