@wrongstack/cli 0.309.0 → 0.310.0
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.
- package/dist/{acp-5ZLGFHWP.js → acp-EA57GUFB.js} +6 -4
- package/dist/acp-server-agent.d.ts +1 -1
- package/dist/{audit-BBR22QH3.js → audit-ZPCLCC3C.js} +1 -1
- package/dist/{auth-WOKC2RVG.js → auth-VQMSZGKE.js} +4 -4
- package/dist/auth-menu/loopback-server.d.ts +0 -12
- package/dist/{bench-XNDUJOSZ.js → bench-XYG56AMO.js} +1 -1
- package/dist/boot/tui-session-stub-enrich.d.ts +20 -0
- package/dist/{chronicle-63MFCZN6.js → chronicle-6EPPMUC5.js} +1 -1
- package/dist/{chunk-53STH6CX.js → chunk-63GFD62R.js} +3 -2
- package/dist/{chunk-SZ42FYPT.js → chunk-BXFYBQKR.js} +4 -6
- package/dist/{chunk-JQURRYU4.js → chunk-CHZZEEIP.js} +2 -2
- package/dist/{chunk-CB35UVXO.js → chunk-KQNYSZG2.js} +34 -9
- package/dist/{chunk-XSG33WHN.js → chunk-QAC263FZ.js} +4 -2
- package/dist/{chunk-SSSJQVUY.js → chunk-QYIIOMLE.js} +15 -2
- package/dist/{chunk-7JOMY3HO.js → chunk-USYOJIV2.js} +3 -3
- package/dist/{chunk-DOJLAULS.js → chunk-WOTGMHAH.js} +36 -26
- package/dist/{chunk-T6YAVFXA.js → chunk-X3N5TS2S.js} +2 -1
- package/dist/{cli-main-RG2PTQ6S.js → cli-main-RFEZAJ4U.js} +3190 -2839
- package/dist/{diag-doctor-WTBHPOMB.js → diag-doctor-HJKFUY6B.js} +1 -1
- package/dist/diff-renderer.d.ts +17 -0
- package/dist/{execution-TYUXABWI.js → execution-WA2UCXNM.js} +180 -61
- package/dist/{export-CCUXRJOU.js → export-ROG3DKTZ.js} +1 -1
- package/dist/{hq-PA6RH2UW.js → hq-AG4VW4XO.js} +18 -10
- package/dist/hq-server/handle-types.d.ts +32 -0
- package/dist/hq-server/login-attempt-store.d.ts +5 -0
- package/dist/{hq-server-PBRU275L.js → hq-server-GZGM4BHA.js} +2 -2
- package/dist/hq-server.d.ts +2 -20
- package/dist/index.js +105 -76
- package/dist/{init-E2NDDOHI.js → init-4JQSG66Q.js} +1 -1
- package/dist/{mailbox-serve-V3QIJBDH.js → mailbox-serve-5S3PHG5D.js} +1 -1
- package/dist/{mcp-CMLFHRG2.js → mcp-RRPKNRSN.js} +3 -1
- package/dist/mcp-serve.d.ts +1 -1
- package/dist/{modeldiag-ICMPHT5L.js → modeldiag-H6DKWJ2N.js} +6 -12
- package/dist/{plugin-usage-26LIIW3P.js → plugin-usage-GCTYOZPH.js} +1 -1
- package/dist/{projects-XE76NFNZ.js → projects-5J727S4L.js} +1 -1
- package/dist/provider-config-utils.d.ts +1 -2
- package/dist/{providers-models-D23WUD74.js → providers-models-663NDPRQ.js} +2 -2
- package/dist/{quick-VIO2BEHS.js → quick-XLYLZX4B.js} +1 -1
- package/dist/{replay-WBRMEWQ5.js → replay-RZXZKP2U.js} +1 -1
- package/dist/{rewind-7RE6ONIC.js → rewind-2FFNOOKS.js} +1 -1
- package/dist/{sessions-config-YX2ZPAFM.js → sessions-config-7Q7QJBKJ.js} +1 -1
- package/dist/slash-commands/dev.d.ts +50 -0
- package/dist/subcommands/handlers/acp.d.ts +1 -1
- package/dist/subcommands/handlers/audit.d.ts +1 -1
- package/dist/subcommands/handlers/auth.d.ts +1 -1
- package/dist/subcommands/handlers/bench.d.ts +1 -1
- package/dist/subcommands/handlers/chronicle.d.ts +1 -1
- package/dist/subcommands/handlers/config-history.d.ts +1 -1
- package/dist/subcommands/handlers/diag-doctor.d.ts +1 -1
- package/dist/subcommands/handlers/export.d.ts +1 -1
- package/dist/subcommands/handlers/hq.d.ts +1 -1
- package/dist/subcommands/handlers/init.d.ts +1 -1
- package/dist/subcommands/handlers/mailbox-serve.d.ts +1 -1
- package/dist/subcommands/handlers/mcp.d.ts +1 -1
- package/dist/subcommands/handlers/modeldiag-bench.d.ts +1 -1
- package/dist/subcommands/handlers/modeldiag-eval.d.ts +1 -1
- package/dist/subcommands/handlers/modeldiag-test.d.ts +1 -1
- package/dist/subcommands/handlers/modeldiag.d.ts +1 -1
- package/dist/subcommands/handlers/plugin-usage.d.ts +1 -1
- package/dist/subcommands/handlers/projects.d.ts +1 -1
- package/dist/subcommands/handlers/providers-models.d.ts +1 -1
- package/dist/subcommands/handlers/quick.d.ts +1 -1
- package/dist/subcommands/handlers/replay.d.ts +1 -1
- package/dist/subcommands/handlers/rewind.d.ts +1 -1
- package/dist/subcommands/handlers/sessions-config.d.ts +1 -1
- package/dist/subcommands/handlers/sessions-fleet.d.ts +1 -1
- package/dist/subcommands/handlers/tools-skills.d.ts +1 -1
- package/dist/subcommands/handlers/update.d.ts +1 -1
- package/dist/subcommands/handlers/version-help.d.ts +1 -1
- package/dist/subcommands/index.d.ts +2 -3
- package/dist/{tools-skills-UNKLOB7M.js → tools-skills-Q4P27URS.js} +1 -1
- package/dist/{update-VZSOZGYC.js → update-RATFF63M.js} +2 -2
- package/dist/{version-help-TFD6VPF3.js → version-help-WMPSEL4U.js} +2 -2
- package/dist/{webui-server-JXJ4CGIX.js → webui-server-3DU6BVTB.js} +7 -10
- package/dist/wiring/cli-execute-builder.d.ts +110 -85
- package/dist/wiring/cli-slash-commands-setup.d.ts +102 -72
- package/dist/wiring/director-announcement.d.ts +31 -0
- package/dist/wiring/session-establishment.d.ts +45 -0
- package/dist/wiring/session-registry.d.ts +1 -1
- package/dist/wiring/session-runtime.d.ts +64 -0
- package/dist/wiring/teardown-registrar.d.ts +41 -0
- package/dist/wiring/vector-memory-setup.d.ts +30 -0
- package/package.json +27 -25
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
loadCachedAcpRegistry,
|
|
4
4
|
refreshAcpRegistry,
|
|
5
5
|
setupProvider
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-CHZZEEIP.js";
|
|
7
|
+
import "./chunk-QYIIOMLE.js";
|
|
8
|
+
import "./chunk-BXFYBQKR.js";
|
|
9
9
|
import "./chunk-7OCVIDC7.js";
|
|
10
10
|
|
|
11
11
|
// src/subcommands/handlers/acp.ts
|
|
@@ -33,6 +33,7 @@ import { WebSocketServer } from "ws";
|
|
|
33
33
|
// src/acp-server-agent.ts
|
|
34
34
|
import { Agent, Context, createDefaultPipelines } from "@wrongstack/core/agent";
|
|
35
35
|
import { ToolExecutor } from "@wrongstack/core/execution";
|
|
36
|
+
import { wireKanbanPorts } from "@wrongstack/runtime";
|
|
36
37
|
import { DefaultLogger, DefaultTokenCounter } from "@wrongstack/core/infrastructure";
|
|
37
38
|
import { EventBus, TOKENS } from "@wrongstack/core/kernel";
|
|
38
39
|
import { ToolRegistry } from "@wrongstack/core/registry";
|
|
@@ -227,6 +228,7 @@ function buildAcpServerAgentFactory(deps, options = {}) {
|
|
|
227
228
|
await container.resolve(TOKENS.MemoryStore).initialize();
|
|
228
229
|
const { provider, providerRegistry } = await bootProvider();
|
|
229
230
|
const events = new EventBus();
|
|
231
|
+
wireKanbanPorts();
|
|
230
232
|
const source = deps.toolRegistry ?? new ToolRegistry();
|
|
231
233
|
const tools = source.clone();
|
|
232
234
|
if (api) {
|
|
@@ -911,4 +913,4 @@ ${renderAcpBenchText(result)}
|
|
|
911
913
|
export {
|
|
912
914
|
acpCmd
|
|
913
915
|
};
|
|
914
|
-
//# sourceMappingURL=acp-
|
|
916
|
+
//# sourceMappingURL=acp-EA57GUFB.js.map
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import type { RunTurnApi } from '@wrongstack/acp/agent';
|
|
17
17
|
import { Agent } from '@wrongstack/core/agent';
|
|
18
18
|
import { type Logger, type PermissionDecision, type PermissionPolicy, type Tool } from '@wrongstack/core/types';
|
|
19
|
-
import type { SubcommandDeps } from './subcommands/
|
|
19
|
+
import type { SubcommandDeps } from './subcommands/contracts.js';
|
|
20
20
|
/**
|
|
21
21
|
* Error thrown when the server cannot start because no model provider is
|
|
22
22
|
* configured. The CLI handler catches this and prints a actionable message
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
runOAuthLoginKind,
|
|
14
14
|
runOAuthLoginMenu,
|
|
15
15
|
validateFamily
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-USYOJIV2.js";
|
|
17
17
|
import {
|
|
18
18
|
restoreFlags
|
|
19
19
|
} from "./chunk-CSAPOCBP.js";
|
|
@@ -29,7 +29,7 @@ import "./chunk-VUVOMXWP.js";
|
|
|
29
29
|
import {
|
|
30
30
|
activeProfileConfigPath
|
|
31
31
|
} from "./chunk-YMXXOOFN.js";
|
|
32
|
-
import "./chunk-
|
|
32
|
+
import "./chunk-QYIIOMLE.js";
|
|
33
33
|
import {
|
|
34
34
|
loadConfigProviders,
|
|
35
35
|
maskedKey,
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
normalizeKeys,
|
|
38
38
|
nowIso,
|
|
39
39
|
writeKeysBack
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-BXFYBQKR.js";
|
|
41
41
|
import "./chunk-7OCVIDC7.js";
|
|
42
42
|
|
|
43
43
|
// src/subcommands/handlers/auth.ts
|
|
@@ -596,4 +596,4 @@ async function runAuthRemove(deps, providerId) {
|
|
|
596
596
|
export {
|
|
597
597
|
authCmd
|
|
598
598
|
};
|
|
599
|
-
//# sourceMappingURL=auth-
|
|
599
|
+
//# sourceMappingURL=auth-VQMSZGKE.js.map
|
|
@@ -31,18 +31,6 @@ export interface LoopbackCallback {
|
|
|
31
31
|
/** The OAuth state parameter from the callback (validated against expected). */
|
|
32
32
|
state: string;
|
|
33
33
|
}
|
|
34
|
-
/**
|
|
35
|
-
* Open a URL in the user's default browser. Best-effort — never throws.
|
|
36
|
-
*
|
|
37
|
-
* - Windows: `cmd /c start "" <url>`
|
|
38
|
-
* - macOS: `open <url>`
|
|
39
|
-
* - Linux: `xdg-open <url>`
|
|
40
|
-
*
|
|
41
|
-
* Not `detached`: the CLI flows wait on the loopback callback in the
|
|
42
|
-
* foreground, so the opener is a short-lived handoff. (The WebUI server's
|
|
43
|
-
* `openBrowser` is deliberately different — it detaches and registers the pid
|
|
44
|
-
* as protected because it launches a browser the session must outlive.)
|
|
45
|
-
*/
|
|
46
34
|
export declare function openBrowser(url: string): void;
|
|
47
35
|
/**
|
|
48
36
|
* Start a loopback HTTP server for the OAuth authorization-code callback.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SessionSummary } from '@wrongstack/core/types';
|
|
2
|
+
/** Resolve `<sessionsDir>/<id>.jsonl`, rejecting ids that escape the store
|
|
3
|
+
* directory (path traversal via crafted shard-relative session ids). Returns
|
|
4
|
+
* undefined instead of throwing so callers treat it as "not enrichable". */
|
|
5
|
+
export declare function containedJsonlPath(sessionsDir: string, id: string): string | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* Build the /resume picker list from an over-fetched store pool.
|
|
8
|
+
*
|
|
9
|
+
* Enrichment can *raise* a stub's lastActivityAt to its real kill time, so
|
|
10
|
+
* ordering must happen after enrichment — otherwise stale-ordered stubs crowd
|
|
11
|
+
* richer sessions out of the top-N window. Fetch a pool ~3x the requested
|
|
12
|
+
* limit, enrich, re-sort most-recent-first (store COALESCE order), slice.
|
|
13
|
+
*/
|
|
14
|
+
export declare function selectPickerSessions(storeList: (limit: number) => Promise<SessionSummary[]>, sessionsDir: string, limit: number): Promise<SessionSummary[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Return picker-ready copies of `summaries`, with stub entries enriched from
|
|
17
|
+
* their JSONL transcripts. Non-stub entries pass through untouched.
|
|
18
|
+
*/
|
|
19
|
+
export declare function enrichStubSummaries(summaries: SessionSummary[], sessionsDir: string): Promise<SessionSummary[]>;
|
|
20
|
+
//# sourceMappingURL=tui-session-stub-enrich.d.ts.map
|
|
@@ -348,7 +348,8 @@ function environmentValue(env, key) {
|
|
|
348
348
|
}
|
|
349
349
|
function isPathInsideWin32(candidate, parent) {
|
|
350
350
|
const normalizedCandidate = path.win32.resolve(candidate).toLowerCase();
|
|
351
|
-
const
|
|
351
|
+
const normalizedParent = path.win32.resolve(parent).toLowerCase();
|
|
352
|
+
const relative = path.win32.relative(normalizedParent, normalizedCandidate);
|
|
352
353
|
return relative === "" || !relative.startsWith("..\\") && relative !== ".." && !path.win32.isAbsolute(relative);
|
|
353
354
|
}
|
|
354
355
|
function otherManagerCommands(selected, packageName, version, opts = { allowScripts: false }) {
|
|
@@ -382,4 +383,4 @@ export {
|
|
|
382
383
|
detectUpdatePackageManager,
|
|
383
384
|
detectUpdatePackageName
|
|
384
385
|
};
|
|
385
|
-
//# sourceMappingURL=chunk-
|
|
386
|
+
//# sourceMappingURL=chunk-63GFD62R.js.map
|
|
@@ -5,6 +5,7 @@ import { expectDefined } from "@wrongstack/core/utils";
|
|
|
5
5
|
import * as fs from "node:fs/promises";
|
|
6
6
|
import { decryptConfigSecrets, encryptConfigSecrets } from "@wrongstack/core/security";
|
|
7
7
|
import { atomicWrite, color } from "@wrongstack/core/utils";
|
|
8
|
+
import { nowIso } from "@wrongstack/primitives";
|
|
8
9
|
function normalizeKeys(cfg) {
|
|
9
10
|
if (Array.isArray(cfg.apiKeys) && cfg.apiKeys.length > 0) {
|
|
10
11
|
return cfg.apiKeys.map((k) => ({ ...k }));
|
|
@@ -77,9 +78,6 @@ function maskedKey(key) {
|
|
|
77
78
|
const tail = key.slice(-4);
|
|
78
79
|
return `${color.dim(head + "\u2026")}${tail}`;
|
|
79
80
|
}
|
|
80
|
-
function nowIso() {
|
|
81
|
-
return (/* @__PURE__ */ new Date()).toISOString();
|
|
82
|
-
}
|
|
83
81
|
async function loadConfigProviders(configPath, vault, opts) {
|
|
84
82
|
const warn = opts?.warn;
|
|
85
83
|
const targetPath = opts?.profileConfigPath ?? configPath;
|
|
@@ -151,8 +149,8 @@ export {
|
|
|
151
149
|
resolveActiveApiKey,
|
|
152
150
|
activeLabel,
|
|
153
151
|
maskedKey,
|
|
154
|
-
nowIso,
|
|
155
152
|
loadConfigProviders,
|
|
156
|
-
mutateConfigProviders
|
|
153
|
+
mutateConfigProviders,
|
|
154
|
+
nowIso
|
|
157
155
|
};
|
|
158
|
-
//# sourceMappingURL=chunk-
|
|
156
|
+
//# sourceMappingURL=chunk-BXFYBQKR.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
fallbackCodexProviderModels,
|
|
3
3
|
filterCurrentCodexModelIds,
|
|
4
4
|
isCodexCatalogModel
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-QYIIOMLE.js";
|
|
6
6
|
|
|
7
7
|
// src/acp-registry-cache.ts
|
|
8
8
|
import * as fs from "node:fs/promises";
|
|
@@ -214,4 +214,4 @@ export {
|
|
|
214
214
|
setupProvider,
|
|
215
215
|
createGracefulShutdown
|
|
216
216
|
};
|
|
217
|
-
//# sourceMappingURL=chunk-
|
|
217
|
+
//# sourceMappingURL=chunk-CHZZEEIP.js.map
|
|
@@ -11,9 +11,7 @@ import { randomUUID as randomUUID6 } from "node:crypto";
|
|
|
11
11
|
import * as fs5 from "node:fs/promises";
|
|
12
12
|
import * as http from "node:http";
|
|
13
13
|
import * as path7 from "node:path";
|
|
14
|
-
import {
|
|
15
|
-
getSharedProjectMailbox
|
|
16
|
-
} from "@wrongstack/core/coordination";
|
|
14
|
+
import { getSharedProjectMailbox } from "@wrongstack/core/coordination";
|
|
17
15
|
import {
|
|
18
16
|
assessHqExposure as assessHqExposure2,
|
|
19
17
|
createHqPersistence,
|
|
@@ -330,6 +328,7 @@ function projectAuthFile(mutableAuth, next) {
|
|
|
330
328
|
mutableAuth.totpSecret = next.totpSecret;
|
|
331
329
|
mutableAuth.totpPendingSecret = next.totpPendingSecret;
|
|
332
330
|
mutableAuth.totpRecoveryCodes = next.totpRecoveryCodes;
|
|
331
|
+
mutableAuth.totpLastUsedCounter = next.totpLastUsedCounter;
|
|
333
332
|
mutableAuth.alertRules = next.alertRules;
|
|
334
333
|
}
|
|
335
334
|
function createHqAuthState(authFile, dataDir, opts = {}) {
|
|
@@ -425,19 +424,31 @@ var LoginAttemptStore = class _LoginAttemptStore {
|
|
|
425
424
|
/**
|
|
426
425
|
* Load persisted state from disk and prune stale entries.
|
|
427
426
|
* Safe to call once at startup; subsequent calls reload from disk.
|
|
427
|
+
*
|
|
428
|
+
* SEC-001: legacy `cred:` entries (per-password hashes persisted by the
|
|
429
|
+
* pre-fix version) are skipped here, not just on write — re-seeding them
|
|
430
|
+
* would keep the hashes in memory and on disk. When any are found, a
|
|
431
|
+
* debounced rewrite scrubs them from the file.
|
|
428
432
|
*/
|
|
429
433
|
async load() {
|
|
434
|
+
let legacyCredEntries = 0;
|
|
430
435
|
try {
|
|
431
436
|
const raw = await fs.readFile(this.filePath, "utf8");
|
|
432
437
|
const parsed = JSON.parse(raw);
|
|
433
438
|
const cutoff = Date.now() - this.retentionMs;
|
|
434
439
|
for (const [key, entry] of Object.entries(parsed)) {
|
|
440
|
+
if (key.startsWith("cred:")) {
|
|
441
|
+
legacyCredEntries++;
|
|
442
|
+
continue;
|
|
443
|
+
}
|
|
435
444
|
if (entry && typeof entry.lastAttempt === "number" && entry.lastAttempt > cutoff) {
|
|
436
445
|
this.store.set(key, entry);
|
|
437
446
|
}
|
|
438
447
|
}
|
|
439
448
|
} catch {
|
|
449
|
+
return;
|
|
440
450
|
}
|
|
451
|
+
if (legacyCredEntries > 0) this.scheduleWrite();
|
|
441
452
|
}
|
|
442
453
|
get(key) {
|
|
443
454
|
return this.store.get(key);
|
|
@@ -559,7 +570,9 @@ var LoginAttemptStore = class _LoginAttemptStore {
|
|
|
559
570
|
const obj = {};
|
|
560
571
|
for (const [key, entry] of this.store) {
|
|
561
572
|
if (entry.lastAttempt > cutoff) {
|
|
562
|
-
|
|
573
|
+
if (!key.startsWith("cred:")) {
|
|
574
|
+
obj[key] = entry;
|
|
575
|
+
}
|
|
563
576
|
} else {
|
|
564
577
|
this.store.delete(key);
|
|
565
578
|
}
|
|
@@ -1329,6 +1342,14 @@ async function handleApiLoginVerify(req, res, _url, mutableAuth, sessions, login
|
|
|
1329
1342
|
return;
|
|
1330
1343
|
}
|
|
1331
1344
|
mutableAuth.totpLastUsedCounter = matchedCounter;
|
|
1345
|
+
try {
|
|
1346
|
+
const next = await mutateHqAuthFile2(dataDir, (current) => ({
|
|
1347
|
+
...current,
|
|
1348
|
+
totpLastUsedCounter: matchedCounter
|
|
1349
|
+
}));
|
|
1350
|
+
applyAuthFile(next);
|
|
1351
|
+
} catch {
|
|
1352
|
+
}
|
|
1332
1353
|
loginAttempts.clearOnSuccess(clientIp);
|
|
1333
1354
|
sessions.delete(sessionId);
|
|
1334
1355
|
const fullSessionId = randomUUID2();
|
|
@@ -2820,7 +2841,7 @@ async function handleApiAgentMessages(req, res, match, agentMessages) {
|
|
|
2820
2841
|
async function handleApiSystemUpdate(res) {
|
|
2821
2842
|
const [{ checkForUpdate }, { detectUpdatePackageName }] = await Promise.all([
|
|
2822
2843
|
import("./update-check-WARHSVZA.js"),
|
|
2823
|
-
import("./update-
|
|
2844
|
+
import("./update-RATFF63M.js")
|
|
2824
2845
|
]);
|
|
2825
2846
|
const packageName = detectUpdatePackageName();
|
|
2826
2847
|
const info = await checkForUpdate({ packageName });
|
|
@@ -3512,7 +3533,6 @@ function createHqServerShutdown(params) {
|
|
|
3512
3533
|
clearInterval(params.browserHeartbeatTimer);
|
|
3513
3534
|
clearInterval(params.timeseriesFlushTimer);
|
|
3514
3535
|
clearInterval(params.sessionCleanupTimer);
|
|
3515
|
-
void params.loginAttempts.flush();
|
|
3516
3536
|
params.stopAlertEngine();
|
|
3517
3537
|
params.authWatcher.close();
|
|
3518
3538
|
params.snapshotBroadcaster.close();
|
|
@@ -3535,6 +3555,11 @@ function createHqServerShutdown(params) {
|
|
|
3535
3555
|
params.mailboxManager.mailboxGatewayLastUsed.clear();
|
|
3536
3556
|
void Promise.all([
|
|
3537
3557
|
...mailboxCloses,
|
|
3558
|
+
// Chimera/race: flush the login-attempt store INSIDE the awaited
|
|
3559
|
+
// shutdown set — the old fire-and-forget `void flush()` let close()
|
|
3560
|
+
// resolve before the debounced write landed, so persistence tests
|
|
3561
|
+
// had to sleep past it (and restarts could miss lockout state).
|
|
3562
|
+
params.loginAttempts.flush(),
|
|
3538
3563
|
params.persistence.eventLog.drain(),
|
|
3539
3564
|
params.persistence.snapshotStore.drain(),
|
|
3540
3565
|
params.persistence.timeseries.drain(),
|
|
@@ -4457,6 +4482,8 @@ async function startHqServerWithAuth(options, host, port, dataDir, firstRunAuth)
|
|
|
4457
4482
|
onApplied: (live) => reassessExposureFloor(live)
|
|
4458
4483
|
});
|
|
4459
4484
|
const { mutableAuth } = authState;
|
|
4485
|
+
const loginAttempts = new LoginAttemptStore(dataDir);
|
|
4486
|
+
await loginAttempts.load();
|
|
4460
4487
|
if (!mutableAuth.cookieSecret && mutableAuth.browserTokens.size > 0) {
|
|
4461
4488
|
const secret = mintHqCookieSecret2();
|
|
4462
4489
|
const next = await mutateHqAuthFile3(dataDir, (current) => ({
|
|
@@ -4505,8 +4532,6 @@ async function startHqServerWithAuth(options, host, port, dataDir, firstRunAuth)
|
|
|
4505
4532
|
mutableAuth,
|
|
4506
4533
|
sessions
|
|
4507
4534
|
});
|
|
4508
|
-
const loginAttempts = new LoginAttemptStore(dataDir);
|
|
4509
|
-
void loginAttempts.load();
|
|
4510
4535
|
const HQ_SESSION_MAX_AGE_MS2 = 7 * 24 * 60 * 60 * 1e3;
|
|
4511
4536
|
const HQ_SESSION_IDLE_TIMEOUT_MS2 = 30 * 6e4;
|
|
4512
4537
|
const SESSION_CLEANUP_INTERVAL_MS = 6e4;
|
|
@@ -4891,4 +4916,4 @@ export {
|
|
|
4891
4916
|
startHqServer,
|
|
4892
4917
|
HqInsecureExposureError2 as HqInsecureExposureError
|
|
4893
4918
|
};
|
|
4894
|
-
//# sourceMappingURL=chunk-
|
|
4919
|
+
//# sourceMappingURL=chunk-KQNYSZG2.js.map
|
|
@@ -7,8 +7,10 @@ import {
|
|
|
7
7
|
import * as os from "node:os";
|
|
8
8
|
import { color } from "@wrongstack/core/utils";
|
|
9
9
|
var versionCmd = async (_args, deps) => {
|
|
10
|
+
const bunVersion = globalThis.Bun?.version;
|
|
11
|
+
const runtime = bunVersion ? `bun v${bunVersion}` : `node ${process.version}`;
|
|
10
12
|
deps.renderer.write(
|
|
11
|
-
`WrongStack ${CLI_VERSION} (apiVersion ${API_VERSION},
|
|
13
|
+
`WrongStack ${CLI_VERSION} (apiVersion ${API_VERSION}, ${runtime}, ${os.platform()})
|
|
12
14
|
`
|
|
13
15
|
);
|
|
14
16
|
return 0;
|
|
@@ -92,4 +94,4 @@ export {
|
|
|
92
94
|
versionCmd,
|
|
93
95
|
helpCmd
|
|
94
96
|
};
|
|
95
|
-
//# sourceMappingURL=chunk-
|
|
97
|
+
//# sourceMappingURL=chunk-QAC263FZ.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
normalizeKeys,
|
|
4
4
|
nowIso,
|
|
5
5
|
writeKeysBack
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-BXFYBQKR.js";
|
|
7
7
|
|
|
8
8
|
// src/auth-menu/openai-codex-oauth.ts
|
|
9
9
|
import { color } from "@wrongstack/core/utils";
|
|
@@ -32,7 +32,20 @@ import {
|
|
|
32
32
|
startLoopbackServer as startSharedLoopbackServer
|
|
33
33
|
} from "@wrongstack/providers/oauth";
|
|
34
34
|
import { callbackHtml } from "@wrongstack/providers/oauth";
|
|
35
|
+
var URL_METACHAR_REGEX = /[&|;<>(){}^"'`%\n\r\0]/;
|
|
36
|
+
function isSafeBrowserUrl(url) {
|
|
37
|
+
if (URL_METACHAR_REGEX.test(url)) return false;
|
|
38
|
+
try {
|
|
39
|
+
const parsed = new URL(url);
|
|
40
|
+
return parsed.protocol === "http:" || parsed.protocol === "https:";
|
|
41
|
+
} catch {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
35
45
|
function openBrowser(url) {
|
|
46
|
+
if (!isSafeBrowserUrl(url)) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
36
49
|
try {
|
|
37
50
|
const platform = process.platform;
|
|
38
51
|
const { command, args } = platform === "win32" ? { command: "cmd", args: ["/c", "start", "", url] } : platform === "darwin" ? { command: "open", args: [url] } : { command: "xdg-open", args: [url] };
|
|
@@ -246,4 +259,4 @@ export {
|
|
|
246
259
|
filterCurrentCodexModelIds,
|
|
247
260
|
isCodexCatalogModel
|
|
248
261
|
};
|
|
249
|
-
//# sourceMappingURL=chunk-
|
|
262
|
+
//# sourceMappingURL=chunk-QYIIOMLE.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
openBrowser,
|
|
7
7
|
runCodexOAuthLogin,
|
|
8
8
|
startLoopbackServer
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-QYIIOMLE.js";
|
|
10
10
|
import {
|
|
11
11
|
activeLabel,
|
|
12
12
|
loadConfigProviders,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
normalizeKeys,
|
|
16
16
|
nowIso,
|
|
17
17
|
writeKeysBack
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-BXFYBQKR.js";
|
|
19
19
|
|
|
20
20
|
// src/auth-menu/local.ts
|
|
21
21
|
import { DefaultSecretScrubber as DefaultSecretScrubber2 } from "@wrongstack/core/security";
|
|
@@ -1374,4 +1374,4 @@ export {
|
|
|
1374
1374
|
addCustomProvider,
|
|
1375
1375
|
addKeyForProvider
|
|
1376
1376
|
};
|
|
1377
|
-
//# sourceMappingURL=chunk-
|
|
1377
|
+
//# sourceMappingURL=chunk-USYOJIV2.js.map
|
|
@@ -4,20 +4,27 @@ import {
|
|
|
4
4
|
|
|
5
5
|
// src/permission-prompt.ts
|
|
6
6
|
import { alwaysAllowUnavailableReason } from "@wrongstack/core/security";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
color as color2,
|
|
9
|
+
sanitizeTerminalPreview,
|
|
10
|
+
sanitizeTerminalText as sanitizeTerminalText2,
|
|
11
|
+
truncate,
|
|
12
|
+
unifiedDiff,
|
|
13
|
+
writeOut
|
|
14
|
+
} from "@wrongstack/core/utils";
|
|
8
15
|
|
|
9
16
|
// src/diff-renderer.ts
|
|
10
|
-
import { color } from "@wrongstack/core/utils";
|
|
17
|
+
import { color, sanitizeTerminalText } from "@wrongstack/core/utils";
|
|
18
|
+
function diffLineStyle(line) {
|
|
19
|
+
if (line.startsWith("+++") || line.startsWith("---")) return color.bold(line);
|
|
20
|
+
if (line.startsWith("@@")) return color.cyan(line);
|
|
21
|
+
if (line.startsWith("+")) return color.green(line);
|
|
22
|
+
if (line.startsWith("-")) return color.red(line);
|
|
23
|
+
return color.dim(line);
|
|
24
|
+
}
|
|
11
25
|
function renderDiff(diff) {
|
|
12
26
|
if (!diff) return "";
|
|
13
|
-
|
|
14
|
-
return lines.map((line) => {
|
|
15
|
-
if (line.startsWith("+++") || line.startsWith("---")) return color.bold(line);
|
|
16
|
-
if (line.startsWith("@@")) return color.cyan(line);
|
|
17
|
-
if (line.startsWith("+")) return color.green(line);
|
|
18
|
-
if (line.startsWith("-")) return color.red(line);
|
|
19
|
-
return color.dim(line);
|
|
20
|
-
}).join("\n");
|
|
27
|
+
return sanitizeTerminalText(diff).split("\n").map(diffLineStyle).join("\n");
|
|
21
28
|
}
|
|
22
29
|
|
|
23
30
|
// src/permission-prompt.ts
|
|
@@ -46,7 +53,7 @@ ${theme.warn("\u26A0 APPROVAL REQUIRED")} ${theme.primary("\u2502")} ${theme.bol
|
|
|
46
53
|
...noAlwaysReason ? [] : [{ key: "a", label: "always", value: "always" }],
|
|
47
54
|
{ key: "d", label: "deny", value: "deny" }
|
|
48
55
|
];
|
|
49
|
-
const alwaysHint = noAlwaysReason ? "" : ` ${theme.bold("[a]")}lways allow (${suggestedPattern})`;
|
|
56
|
+
const alwaysHint = noAlwaysReason ? "" : ` ${theme.bold("[a]")}lways allow (${sanitizeTerminalText2(suggestedPattern)})`;
|
|
50
57
|
const answer = await reader.readKey(
|
|
51
58
|
`${theme.bold("[y]")}es ${theme.bold("[n]")}o${alwaysHint} ${theme.bold("[d]")}eny: `,
|
|
52
59
|
options
|
|
@@ -64,17 +71,22 @@ function makeConfirmAwaiter(reader) {
|
|
|
64
71
|
function stringifyInput(input) {
|
|
65
72
|
if (!input || typeof input !== "object") return "";
|
|
66
73
|
const obj = input;
|
|
67
|
-
return Object.entries(obj).filter(([k]) => k !== "content" && k !== "new_string").map(([k, v]) => `${k}: ${truncate(JSON.stringify(v), 80)}`).join(" ");
|
|
74
|
+
return Object.entries(obj).filter(([k]) => k !== "content" && k !== "new_string").map(([k, v]) => `${k}: ${truncate(sanitizeTerminalText2(JSON.stringify(v)), 80)}`).join(" ");
|
|
68
75
|
}
|
|
69
76
|
var PREVIEW_MAX_LINES = 40;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
)
|
|
77
|
+
var PREVIEW_MAX_CHARS = 8e3;
|
|
78
|
+
function clipPreview(body, decorate = (l) => l) {
|
|
79
|
+
const safe = sanitizeTerminalText2(body);
|
|
80
|
+
const { text, truncated } = sanitizeTerminalPreview(body, {
|
|
81
|
+
maxLines: PREVIEW_MAX_LINES,
|
|
82
|
+
maxChars: PREVIEW_MAX_CHARS
|
|
83
|
+
});
|
|
84
|
+
const rendered = text.split("\n").map(decorate).join("\n");
|
|
85
|
+
if (!truncated) return rendered;
|
|
86
|
+
const hiddenLines = safe.split("\n").length - text.split("\n").length;
|
|
87
|
+
const detail = hiddenLines > 0 ? `${hiddenLines} more line${hiddenLines === 1 ? "" : "s"} not shown` : `${safe.length - text.length} more characters not shown`;
|
|
88
|
+
return `${rendered}
|
|
89
|
+
${color2.dim(`\u2026 ${detail} \u2014 review the file before approving`)}`;
|
|
78
90
|
}
|
|
79
91
|
function renderPayloadPreview(input) {
|
|
80
92
|
if (!input || typeof input !== "object") return "";
|
|
@@ -87,17 +99,15 @@ function renderPayloadPreview(input) {
|
|
|
87
99
|
toFile: "after",
|
|
88
100
|
context: 2
|
|
89
101
|
});
|
|
90
|
-
return diff2 ? clipPreview(
|
|
102
|
+
return diff2 ? clipPreview(diff2, diffLineStyle) : color2.dim("(replacement is identical)");
|
|
91
103
|
}
|
|
92
104
|
const content = obj["content"];
|
|
93
105
|
if (typeof content === "string") {
|
|
94
106
|
if (content === "") return color2.dim("(writes an empty file)");
|
|
95
|
-
return clipPreview(
|
|
96
|
-
content.split("\n").map((line) => color2.dim("\u2502 ") + line).join("\n")
|
|
97
|
-
);
|
|
107
|
+
return clipPreview(content, (line) => color2.dim("\u2502 ") + line);
|
|
98
108
|
}
|
|
99
109
|
const diff = obj["diff"];
|
|
100
|
-
return typeof diff === "string" && diff ? clipPreview(
|
|
110
|
+
return typeof diff === "string" && diff ? clipPreview(diff, diffLineStyle) : "";
|
|
101
111
|
}
|
|
102
112
|
|
|
103
113
|
// src/boot/simpleui-full-auto.ts
|
|
@@ -473,4 +483,4 @@ export {
|
|
|
473
483
|
detectProjectFacts,
|
|
474
484
|
renderAgentsTemplate
|
|
475
485
|
};
|
|
476
|
-
//# sourceMappingURL=chunk-
|
|
486
|
+
//# sourceMappingURL=chunk-WOTGMHAH.js.map
|
|
@@ -246,6 +246,7 @@ async function persistTelegramConfig(deps, mutator) {
|
|
|
246
246
|
decrypted.extensions = extensions;
|
|
247
247
|
const encrypted = encryptConfigSecrets(decrypted, deps.vault);
|
|
248
248
|
await atomicWrite(targetPath, JSON.stringify(encrypted, null, 2), { mode: 384 });
|
|
249
|
+
await deps.vault.flushHardening?.();
|
|
249
250
|
deps.configStore.update({
|
|
250
251
|
extensions
|
|
251
252
|
});
|
|
@@ -345,4 +346,4 @@ export {
|
|
|
345
346
|
normalizeTuiThinkingWord,
|
|
346
347
|
runGit
|
|
347
348
|
};
|
|
348
|
-
//# sourceMappingURL=chunk-
|
|
349
|
+
//# sourceMappingURL=chunk-X3N5TS2S.js.map
|