@wrongstack/cli 1.0.17 → 1.0.24
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-INCNOH42.js → acp-AJWSKWE5.js} +18 -7
- package/dist/arg-parser.d.ts +1 -0
- package/dist/{auth-YXK3EDUL.js → auth-GRBZ7Y3D.js} +61 -15
- package/dist/auth-menu/direct.d.ts +1 -0
- package/dist/auth-menu/local.d.ts +2 -0
- package/dist/auth-menu/oauth-menu.d.ts +3 -1
- package/dist/auth-menu/panel-service.d.ts +20 -0
- package/dist/{bench-YBU6BVQP.js → bench-N5K7Z5O3.js} +2 -2
- package/dist/boot/config-backup-recovery.d.ts +2 -1
- package/dist/boot/dispatch-webui.d.ts +11 -0
- package/dist/boot/short-circuit-desktop.d.ts +1 -0
- package/dist/boot/tui-project-picker-callback.d.ts +1 -1
- package/dist/boot/tui-settings-adapter.d.ts +15 -2
- package/dist/{boot-auto-thin-MANHOYHE.js → boot-auto-thin-6Q56FY3F.js} +3 -2
- package/dist/{chunk-6WRKAACA.js → chunk-2BKFWIER.js} +4 -2
- package/dist/{chunk-JY52HWL6.js → chunk-2EBVTYJR.js} +2 -2
- package/dist/chunk-3OCUS3VN.js +46 -0
- package/dist/chunk-424ORSE7.js +56 -0
- package/dist/{chunk-KEPABQYT.js → chunk-5SEYGOCH.js} +8 -82
- package/dist/chunk-BBHWW6LR.js +549 -0
- package/dist/{chunk-CJTBLTS4.js → chunk-BLD5DSVA.js} +4 -3
- package/dist/{chunk-K5PAL6KR.js → chunk-DRM7PSW7.js} +75 -29
- package/dist/{chunk-XJ7K67PP.js → chunk-JF2MULWF.js} +17 -10
- package/dist/{chunk-SIS37L3W.js → chunk-L2RVEQWO.js} +211 -193
- package/dist/{chunk-RDHFXOJM.js → chunk-LFMVHT3R.js} +106 -57
- package/dist/chunk-LUMETJFO.js +171 -0
- package/dist/{chunk-C3Z4N6A6.js → chunk-MHEBWVXL.js} +6 -2
- package/dist/{chunk-VGER3HYZ.js → chunk-PGKJ2OQP.js} +5 -5
- package/dist/{chunk-672UXYL3.js → chunk-QBBF7GIK.js} +2 -2
- package/dist/{chunk-DE7BZDNK.js → chunk-QFPQXKCG.js} +11 -3
- package/dist/chunk-R4QGL6GB.js +10 -0
- package/dist/chunk-S4FFHDJG.js +93 -0
- package/dist/chunk-SFBFYIOW.js +271 -0
- package/dist/{chunk-JX6KL7OF.js → chunk-SKPDE62W.js} +4 -3
- package/dist/{chunk-RMQNCHGO.js → chunk-U46QR4WR.js} +5 -9
- package/dist/{chunk-B4JLSXZB.js → chunk-WSTVGC2C.js} +73 -45
- package/dist/chunk-YBUCXXYZ.js +36 -0
- package/dist/{chunk-2VMJ3E5Z.js → chunk-YTEOAWOJ.js} +6 -2
- package/dist/{chunk-GPPRNAKW.js → chunk-ZMX5HRLI.js} +2 -2
- package/dist/{chunk-YLQEGYV4.js → chunk-ZZRSG7VK.js} +14 -4
- package/dist/{cli-context-4PTWEK52.js → cli-context-34Q5IJRA.js} +121 -89
- package/dist/cli-entry-point.d.ts +2 -0
- package/dist/{cli-main-DQ2GBY7M.js → cli-main-AELJDBGU.js} +1471 -1293
- package/dist/config-doctor.d.ts +10 -2
- package/dist/{config-transfer-2YF3CRTN.js → config-transfer-RUWLDCNK.js} +34 -13
- package/dist/{diag-doctor-ANPRUYFM.js → diag-doctor-WIFJH3XH.js} +2 -2
- package/dist/execute-deps.d.ts +2 -1
- package/dist/{execution-A6WJLSOC.js → execution-PYC5FCS4.js} +303 -256
- package/dist/{hq-NU75W3SE.js → hq-JTUTFI4L.js} +274 -258
- package/dist/hq-command-controller.d.ts +1 -1
- package/dist/hq-server/project-root.d.ts +35 -1
- package/dist/{hq-server-M2JWVW4D.js → hq-server-PC7GZMPT.js} +2 -2
- package/dist/{hq-service-L5INQFM4.js → hq-service-NW56MUP2.js} +11 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -12
- package/dist/kanban-supervisor-67ECABTD.js +7 -0
- package/dist/live-settings-input.d.ts +7 -0
- package/dist/{mailbox-serve-3GFOK2I7.js → mailbox-serve-WDOCH6KR.js} +3 -3
- package/dist/{mcp-DC5WSBOO.js → mcp-LBS45HWZ.js} +4 -4
- package/dist/modeldiag-36OGAL5C.js +828 -0
- package/dist/{per-subcommand-help-DHTYU524.js → per-subcommand-help-XE77MTGJ.js} +3 -3
- package/dist/permission-prompt-mirror.d.ts +1 -1
- package/dist/permission-prompt.d.ts +2 -2
- package/dist/plugin-config.d.ts +12 -0
- package/dist/plugin-management-types.d.ts +31 -0
- package/dist/plugin-management.d.ts +2 -30
- package/dist/plugin-package-install.d.ts +3 -0
- package/dist/{plugin-usage-M6KET4OZ.js → plugin-usage-S5LVGMBW.js} +6 -5
- package/dist/{plugins-WJLW6ULV.js → plugins-RHBIVLI7.js} +4 -3
- package/dist/provider-config-utils.d.ts +1 -6
- package/dist/{providers-models-LFNZ5WI7.js → providers-models-2CFG46RD.js} +41 -31
- package/dist/release-asset-download.d.ts +3 -0
- package/dist/services/dispatch-classifier.d.ts +39 -5
- package/dist/{sessions-config-UL45XKX7.js → sessions-config-IQUH2GXT.js} +13 -5
- package/dist/settings-menu.d.ts +2 -0
- package/dist/short-circuit-flags-SDT53OML.js +10 -0
- package/dist/{simpleui-dist-CXSIDAXZ.js → simpleui-dist-7BQISSEP.js} +7 -3
- package/dist/skill-suggest-L2EVWB6R.js +290 -0
- package/dist/slash-commands/effort.d.ts +1 -1
- package/dist/slash-commands/fallback.d.ts +1 -1
- package/dist/slash-commands/gitid.d.ts +1 -1
- package/dist/slash-commands/jev.d.ts +4 -0
- package/dist/slash-commands/openai-quota.d.ts +15 -0
- package/dist/slash-commands/sdd-task-mutations.d.ts +4 -0
- package/dist/slash-commands/settings-keys.d.ts +2 -0
- package/dist/slash-commands/settings-reset.d.ts +6 -0
- package/dist/standalone-update-MW47J3AK.js +164 -0
- package/dist/standalone-update.d.ts +19 -0
- package/dist/subcommands/handlers/hq-alerts.d.ts +3 -0
- package/dist/subcommands/handlers/hq-audit.d.ts +46 -0
- package/dist/subcommands/handlers/hq-data-dir.d.ts +13 -0
- package/dist/subcommands/handlers/skill-suggest.d.ts +21 -0
- package/dist/subcommands/handlers/typesafe-brain-replay.d.ts +26 -0
- package/dist/subcommands/handlers/typesafe-judgment-check.d.ts +3 -0
- package/dist/subcommands/handlers/typesafe-topic-replay.d.ts +19 -0
- package/dist/subcommands/handlers/typesafe-triage-replay.d.ts +18 -0
- package/dist/subcommands/handlers/typesafe.d.ts +23 -0
- package/dist/{subcommands-ERDDIJ3L.js → subcommands-ZTSIN7LG.js} +2 -2
- package/dist/typesafe-HVEVPA6R.js +316 -0
- package/dist/typesafe-brain-replay-C5276FVR.js +222 -0
- package/dist/typesafe-judgment-check-GGYYV5UF.js +29 -0
- package/dist/typesafe-topic-replay-4W73BOLV.js +218 -0
- package/dist/typesafe-triage-replay-FGAW7QM7.js +215 -0
- package/dist/{update-5DPB4YD4.js → update-7XIOEXTD.js} +4 -3
- package/dist/{update-check-BS3DHTSI.js → update-check-2POMBHFB.js} +3 -2
- package/dist/update-check.d.ts +1 -1
- package/dist/version-help-WZ623NWM.js +10 -0
- package/dist/version.d.ts +3 -2
- package/dist/webui-client-observability.d.ts +7 -0
- package/dist/{webui-server-MRPGTTKL.js → webui-server-L2SICPTB.js} +158 -94
- package/dist/webui-server-options.d.ts +11 -0
- package/dist/webui-server.d.ts +15 -1
- package/dist/wiring/domain-glossary.d.ts +5 -4
- package/dist/wiring/plugins.d.ts +1 -1
- package/dist/wiring/provider-persisters.d.ts +24 -0
- package/dist/wiring/provider-runtime.d.ts +9 -1
- package/dist/wiring/runtime-dispatch-state.d.ts +3 -1
- package/package.json +28 -28
- package/dist/chunk-DR2OXU46.js +0 -174
- package/dist/chunk-JACOMTIH.js +0 -275
- package/dist/chunk-M4W3QLQW.js +0 -54
- package/dist/chunk-XJXDOF63.js +0 -28
- package/dist/modeldiag-CJSFHZ3J.js +0 -1356
- package/dist/short-circuit-flags-SJQBJ33I.js +0 -10
- package/dist/version-help-WXI42PZ3.js +0 -10
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CLI_VERSION
|
|
3
|
+
} from "./chunk-YBUCXXYZ.js";
|
|
1
4
|
|
|
2
5
|
// src/update-check.ts
|
|
3
6
|
import * as fs from "node:fs/promises";
|
|
@@ -5,7 +8,12 @@ import { createRequire } from "node:module";
|
|
|
5
8
|
import * as os from "node:os";
|
|
6
9
|
import * as path from "node:path";
|
|
7
10
|
import { FetchError } from "@wrongstack/core/types";
|
|
8
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
atomicWrite,
|
|
13
|
+
ensureDir,
|
|
14
|
+
isStandaloneBinary,
|
|
15
|
+
resolveWstackPaths
|
|
16
|
+
} from "@wrongstack/core/utils";
|
|
9
17
|
var defaultHomeDir = () => os.homedir();
|
|
10
18
|
function npmRegistryUrl(packageName) {
|
|
11
19
|
return `https://registry.npmjs.org/${encodeURIComponent(packageName)}/latest`;
|
|
@@ -16,6 +24,7 @@ function cachePath(homeFn = defaultHomeDir) {
|
|
|
16
24
|
}
|
|
17
25
|
var CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
18
26
|
function currentVersion() {
|
|
27
|
+
if (isStandaloneBinary()) return CLI_VERSION;
|
|
19
28
|
const req = createRequire(import.meta.url);
|
|
20
29
|
const candidates = ["../package.json", "../../package.json"];
|
|
21
30
|
for (const rel of candidates) {
|
|
@@ -118,7 +127,8 @@ async function checkForUpdate(signalOrOptions, legacyHomeFn) {
|
|
|
118
127
|
const options = signalOrOptions instanceof AbortSignal ? { signal: signalOrOptions, homeFn: legacyHomeFn } : signalOrOptions ?? { homeFn: legacyHomeFn };
|
|
119
128
|
const current = currentVersion();
|
|
120
129
|
const signal = options.signal;
|
|
121
|
-
const
|
|
130
|
+
const standalone = isStandaloneBinary();
|
|
131
|
+
const packageName = standalone ? "standalone-binary" : options.packageName ?? "wrongstack";
|
|
122
132
|
const aborted = () => signal?.aborted ?? false;
|
|
123
133
|
const hf = options.homeFn ?? defaultHomeDir;
|
|
124
134
|
if (aborted()) {
|
|
@@ -134,7 +144,7 @@ async function checkForUpdate(signalOrOptions, legacyHomeFn) {
|
|
|
134
144
|
};
|
|
135
145
|
}
|
|
136
146
|
try {
|
|
137
|
-
const latest = await fetchLatestFromNpm(packageName, 3e3, signal);
|
|
147
|
+
const latest = packageName === "standalone-binary" ? await (await import("./standalone-update-MW47J3AK.js")).fetchLatestStandaloneVersion(3e3, signal) : await fetchLatestFromNpm(packageName, 3e3, signal);
|
|
138
148
|
await writeCache({ timestamp: Date.now(), latestVersion: latest, packageName }, hf);
|
|
139
149
|
return {
|
|
140
150
|
current,
|
|
@@ -173,4 +183,4 @@ export {
|
|
|
173
183
|
checkForUpdate,
|
|
174
184
|
getUpdateNotification
|
|
175
185
|
};
|
|
176
|
-
//# sourceMappingURL=chunk-
|
|
186
|
+
//# sourceMappingURL=chunk-ZZRSG7VK.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
makePromptDelegate,
|
|
6
6
|
renderAgentsTemplate,
|
|
7
7
|
renderDiff
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-U46QR4WR.js";
|
|
9
9
|
import {
|
|
10
10
|
theme as theme2
|
|
11
11
|
} from "./chunk-QD544J2B.js";
|
|
@@ -16,20 +16,20 @@ import {
|
|
|
16
16
|
import {
|
|
17
17
|
parseWebuiSessionChildOptions,
|
|
18
18
|
writeWebuiSessionChildError
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-ZMX5HRLI.js";
|
|
20
20
|
import {
|
|
21
21
|
subcommands
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-424ORSE7.js";
|
|
23
23
|
import {
|
|
24
24
|
renderDeepHelp,
|
|
25
25
|
renderFocusedHelp
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-SKPDE62W.js";
|
|
27
27
|
import {
|
|
28
28
|
handleHelpVersionShortCircuit
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-PGKJ2OQP.js";
|
|
30
30
|
import {
|
|
31
31
|
DEFAULT_PORT
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-DRM7PSW7.js";
|
|
33
33
|
import "./chunk-HXJYHAR4.js";
|
|
34
34
|
import {
|
|
35
35
|
resolveHqPasswordInput
|
|
@@ -40,6 +40,9 @@ import {
|
|
|
40
40
|
import {
|
|
41
41
|
parseHqIpAllowlist
|
|
42
42
|
} from "./chunk-Q7E3BPDU.js";
|
|
43
|
+
import {
|
|
44
|
+
installProviderPersisters
|
|
45
|
+
} from "./chunk-3OCUS3VN.js";
|
|
43
46
|
import {
|
|
44
47
|
discoverAndMergeProviders
|
|
45
48
|
} from "./chunk-D5GB5MHA.js";
|
|
@@ -47,11 +50,8 @@ import {
|
|
|
47
50
|
applyNodeEnvDefault,
|
|
48
51
|
applySessionShellDefault,
|
|
49
52
|
runPreflight
|
|
50
|
-
} from "./chunk-
|
|
51
|
-
import "./chunk-
|
|
52
|
-
import {
|
|
53
|
-
CLI_VERSION
|
|
54
|
-
} from "./chunk-XJXDOF63.js";
|
|
53
|
+
} from "./chunk-QBBF7GIK.js";
|
|
54
|
+
import "./chunk-2BKFWIER.js";
|
|
55
55
|
import {
|
|
56
56
|
addFromCatalog,
|
|
57
57
|
boxBottom,
|
|
@@ -63,9 +63,8 @@ import {
|
|
|
63
63
|
runPicker,
|
|
64
64
|
saveToGlobalConfig,
|
|
65
65
|
theme
|
|
66
|
-
} from "./chunk-
|
|
67
|
-
import "./chunk-
|
|
68
|
-
import "./chunk-B4JLSXZB.js";
|
|
66
|
+
} from "./chunk-LFMVHT3R.js";
|
|
67
|
+
import "./chunk-YTEOAWOJ.js";
|
|
69
68
|
import {
|
|
70
69
|
isKeylessLocalProvider,
|
|
71
70
|
visibleModelIds
|
|
@@ -73,26 +72,26 @@ import {
|
|
|
73
72
|
import {
|
|
74
73
|
activeProfileConfigPath
|
|
75
74
|
} from "./chunk-YMXXOOFN.js";
|
|
75
|
+
import "./chunk-WSTVGC2C.js";
|
|
76
76
|
import {
|
|
77
77
|
parseArgs
|
|
78
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-MHEBWVXL.js";
|
|
79
79
|
import "./chunk-DAKVBMD4.js";
|
|
80
80
|
import {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
resolveActiveApiKey,
|
|
84
|
-
writeKeysBack
|
|
85
|
-
} from "./chunk-DR2OXU46.js";
|
|
81
|
+
resolveActiveApiKey
|
|
82
|
+
} from "./chunk-LUMETJFO.js";
|
|
86
83
|
import {
|
|
87
84
|
runUpdateCommand
|
|
88
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-QFPQXKCG.js";
|
|
89
86
|
import "./chunk-U3SS4NRH.js";
|
|
90
|
-
import "./chunk-
|
|
87
|
+
import "./chunk-ZZRSG7VK.js";
|
|
88
|
+
import {
|
|
89
|
+
CLI_VERSION
|
|
90
|
+
} from "./chunk-YBUCXXYZ.js";
|
|
91
91
|
|
|
92
92
|
// src/cli-context.ts
|
|
93
93
|
import { TOKENS as TOKENS3 } from "@wrongstack/core/kernel";
|
|
94
94
|
import { writeErr as writeErr2 } from "@wrongstack/core/utils";
|
|
95
|
-
import { setOAuthTokenPersister, setProviderModelPersister } from "@wrongstack/providers";
|
|
96
95
|
|
|
97
96
|
// src/boot/container-wiring.ts
|
|
98
97
|
import { DefaultPathResolver } from "@wrongstack/core/infrastructure";
|
|
@@ -102,10 +101,11 @@ import { createDefaultContainer } from "@wrongstack/runtime";
|
|
|
102
101
|
// src/cli-bundled-prompts.ts
|
|
103
102
|
import { createRequire } from "node:module";
|
|
104
103
|
import * as path from "node:path";
|
|
104
|
+
import { wrongstackPackageJsonPath } from "@wrongstack/core/utils";
|
|
105
105
|
function resolveBundledPromptsDir() {
|
|
106
106
|
try {
|
|
107
107
|
const req = createRequire(import.meta.url);
|
|
108
|
-
const corePkg =
|
|
108
|
+
const corePkg = wrongstackPackageJsonPath("@wrongstack/core", (id) => req.resolve(id));
|
|
109
109
|
return path.join(path.dirname(corePkg), "data", "prompts");
|
|
110
110
|
} catch {
|
|
111
111
|
return void 0;
|
|
@@ -115,10 +115,11 @@ function resolveBundledPromptsDir() {
|
|
|
115
115
|
// src/cli-bundled-skills.ts
|
|
116
116
|
import { createRequire as createRequire2 } from "node:module";
|
|
117
117
|
import * as path2 from "node:path";
|
|
118
|
+
import { wrongstackPackageJsonPath as wrongstackPackageJsonPath2 } from "@wrongstack/core/utils";
|
|
118
119
|
function resolveBundledSkillsDir() {
|
|
119
120
|
try {
|
|
120
121
|
const req = createRequire2(import.meta.url);
|
|
121
|
-
const corePkg =
|
|
122
|
+
const corePkg = wrongstackPackageJsonPath2("@wrongstack/core", (id) => req.resolve(id));
|
|
122
123
|
return path2.join(path2.dirname(corePkg), "skills");
|
|
123
124
|
} catch {
|
|
124
125
|
return void 0;
|
|
@@ -167,7 +168,7 @@ function makeMirroredPromptDelegate(deps) {
|
|
|
167
168
|
const typed = await deps.inner(tool, input, suggestedPattern, controller.signal);
|
|
168
169
|
if (remoteDecision !== void 0) return remoteDecision;
|
|
169
170
|
settled = true;
|
|
170
|
-
const decision = typed === "yes" || typed === "always" || typed === "deny" ? typed : "no";
|
|
171
|
+
const decision = typed === "yes" || typed === "always" || typed === "always-exact" || typed === "always-command" || typed === "always-tool" || typed === "deny" ? typed : "no";
|
|
171
172
|
finish(decision);
|
|
172
173
|
return decision;
|
|
173
174
|
} finally {
|
|
@@ -761,9 +762,40 @@ async function persistMenuChoice(globalConfigPath, choice) {
|
|
|
761
762
|
|
|
762
763
|
// src/boot/short-circuit-desktop.ts
|
|
763
764
|
import { spawn } from "node:child_process";
|
|
765
|
+
import { statSync } from "node:fs";
|
|
764
766
|
import { createRequire as createRequire3 } from "node:module";
|
|
767
|
+
import { homedir } from "node:os";
|
|
765
768
|
import * as path3 from "node:path";
|
|
766
769
|
import { color as color2 } from "@wrongstack/core/utils";
|
|
770
|
+
function desktopExecutableCandidates(platform, home, env) {
|
|
771
|
+
const join7 = platform === "win32" ? path3.win32.join : path3.posix.join;
|
|
772
|
+
const managed = join7(home, ".wrongstack", "desktop");
|
|
773
|
+
if (platform === "win32") {
|
|
774
|
+
const local = env["LOCALAPPDATA"] || join7(home, "AppData", "Local");
|
|
775
|
+
return [
|
|
776
|
+
join7(managed, "WrongStack.exe"),
|
|
777
|
+
join7(local, "Programs", "WrongStack", "WrongStack.exe")
|
|
778
|
+
];
|
|
779
|
+
}
|
|
780
|
+
if (platform === "darwin") {
|
|
781
|
+
return [
|
|
782
|
+
join7(managed, "WrongStack.app", "Contents", "MacOS", "WrongStack"),
|
|
783
|
+
join7(home, "Applications", "WrongStack.app", "Contents", "MacOS", "WrongStack"),
|
|
784
|
+
"/Applications/WrongStack.app/Contents/MacOS/WrongStack"
|
|
785
|
+
];
|
|
786
|
+
}
|
|
787
|
+
if (platform === "linux") {
|
|
788
|
+
return [join7(managed, "WrongStack.AppImage"), "/opt/WrongStack/wrongstack-desktop"];
|
|
789
|
+
}
|
|
790
|
+
return [];
|
|
791
|
+
}
|
|
792
|
+
function isFile(candidate) {
|
|
793
|
+
try {
|
|
794
|
+
return statSync(candidate).isFile();
|
|
795
|
+
} catch {
|
|
796
|
+
return false;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
767
799
|
function stripDesktopLauncherArgs(argv) {
|
|
768
800
|
const out = [];
|
|
769
801
|
for (let i = 0; i < argv.length; i++) {
|
|
@@ -784,35 +816,50 @@ async function handleDesktopShortCircuit(flags, argv) {
|
|
|
784
816
|
return launchDesktop(stripDesktopLauncherArgs(argv));
|
|
785
817
|
}
|
|
786
818
|
async function launchDesktop(args) {
|
|
787
|
-
const
|
|
788
|
-
|
|
789
|
-
try {
|
|
790
|
-
const desktopPkgPath = req.resolve("@wrongstack/desktop/package.json");
|
|
791
|
-
launcherPath = path3.join(path3.dirname(desktopPkgPath), "bin", "wrongstack-desktop.js");
|
|
792
|
-
} catch {
|
|
819
|
+
const override = process.env["WRONGSTACK_DESKTOP_EXECUTABLE"]?.trim();
|
|
820
|
+
if (override && (!path3.isAbsolute(override) || !isFile(override))) {
|
|
793
821
|
process.stderr.write(
|
|
794
|
-
|
|
795
|
-
color2.red("\u2717 WrongStack Desktop is not installed."),
|
|
796
|
-
"",
|
|
797
|
-
"Install the desktop package:",
|
|
798
|
-
" npm install -g @wrongstack/desktop",
|
|
799
|
-
"",
|
|
800
|
-
"The umbrella package also supports desktop when installed with optional dependencies:",
|
|
801
|
-
" npm install -g wrongstack",
|
|
802
|
-
""
|
|
803
|
-
].join("\n")
|
|
822
|
+
"WRONGSTACK_DESKTOP_EXECUTABLE must point to an existing absolute executable path.\n"
|
|
804
823
|
);
|
|
805
824
|
return 1;
|
|
806
825
|
}
|
|
826
|
+
const native = override || desktopExecutableCandidates(process.platform, homedir(), process.env).find(isFile);
|
|
827
|
+
let executable = native;
|
|
828
|
+
let launchArgs = args;
|
|
829
|
+
if (!executable)
|
|
830
|
+
try {
|
|
831
|
+
const req = createRequire3(import.meta.url);
|
|
832
|
+
const desktopPkgPath = req.resolve("@wrongstack/desktop/package.json");
|
|
833
|
+
launchArgs = [
|
|
834
|
+
path3.join(path3.dirname(desktopPkgPath), "bin", "wrongstack-desktop.js"),
|
|
835
|
+
...args
|
|
836
|
+
];
|
|
837
|
+
executable = selectDesktopLauncherExecutable(
|
|
838
|
+
process.execPath,
|
|
839
|
+
typeof globalThis.Bun !== "undefined",
|
|
840
|
+
process.env["NODE"]
|
|
841
|
+
);
|
|
842
|
+
} catch {
|
|
843
|
+
process.stderr.write(
|
|
844
|
+
[
|
|
845
|
+
color2.red("\u2717 WrongStack Desktop is not installed."),
|
|
846
|
+
"",
|
|
847
|
+
"Download WrongStack Desktop from GitHub Releases:",
|
|
848
|
+
" https://github.com/WrongStack/WrongStack/releases/latest",
|
|
849
|
+
"",
|
|
850
|
+
"For a portable or custom installation, set WRONGSTACK_DESKTOP_EXECUTABLE",
|
|
851
|
+
"to the absolute path of the Desktop executable (on macOS: WrongStack.app/Contents/MacOS/WrongStack).",
|
|
852
|
+
""
|
|
853
|
+
].join("\n")
|
|
854
|
+
);
|
|
855
|
+
return 1;
|
|
856
|
+
}
|
|
807
857
|
return await new Promise((resolve2) => {
|
|
808
|
-
const
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
process.env["NODE"]
|
|
812
|
-
);
|
|
813
|
-
const child = spawn(executable, [launcherPath, ...args], {
|
|
858
|
+
const env = { ...process.env };
|
|
859
|
+
if (native) delete env["ELECTRON_RUN_AS_NODE"];
|
|
860
|
+
const child = spawn(executable, launchArgs, {
|
|
814
861
|
stdio: "inherit",
|
|
815
|
-
env
|
|
862
|
+
env,
|
|
816
863
|
windowsHide: false
|
|
817
864
|
});
|
|
818
865
|
child.once("error", (err) => {
|
|
@@ -866,7 +913,7 @@ async function isPortInUse(host, port) {
|
|
|
866
913
|
}
|
|
867
914
|
async function handleHqShortCircuit(flags) {
|
|
868
915
|
if (flags["hq"] !== true) return null;
|
|
869
|
-
const { startHqServer } = await import("./hq-server-
|
|
916
|
+
const { startHqServer } = await import("./hq-server-PC7GZMPT.js");
|
|
870
917
|
const tunnelRequested = flags["tunnel"] === true;
|
|
871
918
|
const rawPublicUrl = typeof flags["hq-public-url"] === "string" ? flags["hq-public-url"] : process.env.WRONGSTACK_HQ_PUBLIC_URL;
|
|
872
919
|
let publicOrigin;
|
|
@@ -1113,14 +1160,14 @@ import { createRequire as createRequire4 } from "node:module";
|
|
|
1113
1160
|
import * as os from "node:os";
|
|
1114
1161
|
import * as path7 from "node:path";
|
|
1115
1162
|
import { fileURLToPath } from "node:url";
|
|
1116
|
-
import { toErrorMessage as toErrorMessage4 } from "@wrongstack/core/utils";
|
|
1163
|
+
import { moduleUrlFor, toErrorMessage as toErrorMessage4, wrongstackPackageJsonPath as wrongstackPackageJsonPath3 } from "@wrongstack/core/utils";
|
|
1117
1164
|
import { DefaultLogger } from "@wrongstack/core/infrastructure";
|
|
1118
1165
|
import { TOKENS as TOKENS2 } from "@wrongstack/core/kernel";
|
|
1119
1166
|
import { DefaultModelsRegistry } from "@wrongstack/core/models";
|
|
1120
1167
|
import { ToolRegistry } from "@wrongstack/core/registry";
|
|
1121
1168
|
import { normalizeTokenSavingTier } from "@wrongstack/core/types";
|
|
1122
|
-
import { isSetupProvider, SETUP_MODEL_ID, SETUP_PROVIDER_ID } from "@wrongstack/providers";
|
|
1123
1169
|
import { color as color10, isStdinTTY as isStdinTTY2, writeErr } from "@wrongstack/core/utils";
|
|
1170
|
+
import { isSetupProvider, SETUP_MODEL_ID, SETUP_PROVIDER_ID } from "@wrongstack/providers";
|
|
1124
1171
|
import { createDefaultContainer as createDefaultContainer2 } from "@wrongstack/runtime";
|
|
1125
1172
|
import { registerBuiltinToolTier } from "@wrongstack/tools/tool-tier";
|
|
1126
1173
|
|
|
@@ -1160,8 +1207,13 @@ function profileSnapshotTimestamp(fileName, fallback) {
|
|
|
1160
1207
|
Number(millisecond)
|
|
1161
1208
|
);
|
|
1162
1209
|
}
|
|
1163
|
-
async function findLatestProviderBackup(globalRoot) {
|
|
1210
|
+
async function findLatestProviderBackup(globalRoot, profileName = "default") {
|
|
1164
1211
|
const directory = path4.join(globalRoot, "config-history");
|
|
1212
|
+
const escapedProfile = profileName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1213
|
+
const filePattern = new RegExp(
|
|
1214
|
+
`^profiles-${escapedProfile}-config-\\d{4}-\\d{2}-\\d{2}T\\d{2}-\\d{2}-\\d{2}-\\d{3}\\.json$`,
|
|
1215
|
+
"i"
|
|
1216
|
+
);
|
|
1165
1217
|
const candidates = [];
|
|
1166
1218
|
let entries;
|
|
1167
1219
|
try {
|
|
@@ -1170,7 +1222,7 @@ async function findLatestProviderBackup(globalRoot) {
|
|
|
1170
1222
|
return void 0;
|
|
1171
1223
|
}
|
|
1172
1224
|
for (const entry of entries) {
|
|
1173
|
-
if (!entry.isFile() ||
|
|
1225
|
+
if (!entry.isFile() || !filePattern.test(entry.name)) {
|
|
1174
1226
|
continue;
|
|
1175
1227
|
}
|
|
1176
1228
|
const filePath = path4.join(directory, entry.name);
|
|
@@ -1204,14 +1256,15 @@ async function restoreDefaultProfileBackup(opts) {
|
|
|
1204
1256
|
}
|
|
1205
1257
|
async function maybeRestoreDefaultProfileFromBackup(opts) {
|
|
1206
1258
|
if (!await defaultProfileProvidersAreEmpty(opts.profilePath)) return false;
|
|
1207
|
-
const
|
|
1259
|
+
const profileName = opts.profileName ?? "default";
|
|
1260
|
+
const backup = await findLatestProviderBackup(opts.globalRoot, profileName);
|
|
1208
1261
|
if (!backup) return false;
|
|
1209
1262
|
const shownProviders = backup.providerIds.slice(0, 5).join(", ");
|
|
1210
1263
|
const remainder = backup.providerIds.length - 5;
|
|
1211
1264
|
const providerSummary = remainder > 0 ? `${shownProviders} +${remainder}` : shownProviders;
|
|
1212
1265
|
opts.renderer.write(
|
|
1213
1266
|
`
|
|
1214
|
-
${color4.amber("\u25CB")} ${color4.bold(
|
|
1267
|
+
${color4.amber("\u25CB")} ${color4.bold(profileName)} profile has no saved providers.
|
|
1215
1268
|
${color4.dim("Latest usable backup:")} ${color4.bold(backup.fileName)} ${color4.dim(`(${backup.providerIds.length} provider: ${providerSummary})`)}
|
|
1216
1269
|
`
|
|
1217
1270
|
);
|
|
@@ -2524,7 +2577,9 @@ function compactSingleLine(text) {
|
|
|
2524
2577
|
var GITHUB_PROVIDERS_OVERLAY_URL = "https://raw.githubusercontent.com/WrongStack/WrongStack/main/packages/cli/data/providers.json";
|
|
2525
2578
|
function resolveBundledOverlayFile() {
|
|
2526
2579
|
try {
|
|
2527
|
-
return fileURLToPath(
|
|
2580
|
+
return fileURLToPath(
|
|
2581
|
+
new URL("../data/providers.json", moduleUrlFor(import.meta.url, "@wrongstack/cli"))
|
|
2582
|
+
);
|
|
2528
2583
|
} catch {
|
|
2529
2584
|
return void 0;
|
|
2530
2585
|
}
|
|
@@ -2578,7 +2633,7 @@ async function autoSelectSavedProvider(config, modelsRegistry) {
|
|
|
2578
2633
|
function resolveBundledSkillsDir2() {
|
|
2579
2634
|
try {
|
|
2580
2635
|
const req = createRequire4(import.meta.url);
|
|
2581
|
-
const corePkg =
|
|
2636
|
+
const corePkg = wrongstackPackageJsonPath3("@wrongstack/core", (id) => req.resolve(id));
|
|
2582
2637
|
return path7.join(path7.dirname(corePkg), "skills");
|
|
2583
2638
|
} catch {
|
|
2584
2639
|
return void 0;
|
|
@@ -2587,7 +2642,7 @@ function resolveBundledSkillsDir2() {
|
|
|
2587
2642
|
function resolveBundledPromptsDir2() {
|
|
2588
2643
|
try {
|
|
2589
2644
|
const req = createRequire4(import.meta.url);
|
|
2590
|
-
const corePkg =
|
|
2645
|
+
const corePkg = wrongstackPackageJsonPath3("@wrongstack/core", (id) => req.resolve(id));
|
|
2591
2646
|
return path7.join(path7.dirname(corePkg), "data", "prompts");
|
|
2592
2647
|
} catch {
|
|
2593
2648
|
return void 0;
|
|
@@ -2625,13 +2680,15 @@ async function boot(argv) {
|
|
|
2625
2680
|
}
|
|
2626
2681
|
let { paths, config, vault } = bootResult;
|
|
2627
2682
|
let first = positional[0];
|
|
2628
|
-
const mayOfferConfigRecovery = isStdinTTY2() && (positional.length === 0 || first === "quick") &&
|
|
2683
|
+
const mayOfferConfigRecovery = isStdinTTY2() && (positional.length === 0 || first === "quick") && typeof flags["prompt"] !== "string" && !flags["webui"] && !flags["no-interactive"] && !flags["skip"];
|
|
2629
2684
|
const renderer = new TerminalRenderer();
|
|
2630
2685
|
const reader = new ReadlineInputReader({ historyFile: paths.wpaths.historyFile });
|
|
2631
2686
|
if (mayOfferConfigRecovery) {
|
|
2687
|
+
const recoveryProfile = config.activeProfile ?? "default";
|
|
2632
2688
|
const restored = await maybeRestoreDefaultProfileFromBackup({
|
|
2633
2689
|
globalRoot: paths.wpaths.globalRoot,
|
|
2634
|
-
profilePath: paths.wpaths.profileConfig(
|
|
2690
|
+
profilePath: paths.wpaths.profileConfig(recoveryProfile),
|
|
2691
|
+
profileName: recoveryProfile,
|
|
2635
2692
|
renderer,
|
|
2636
2693
|
reader
|
|
2637
2694
|
});
|
|
@@ -2693,6 +2750,7 @@ async function boot(argv) {
|
|
|
2693
2750
|
});
|
|
2694
2751
|
const subcommandHandler = first ? subcommands[first] : void 0;
|
|
2695
2752
|
if (first && subcommandHandler) {
|
|
2753
|
+
installProviderPersisters({ config, paths: wpaths, vault, logger });
|
|
2696
2754
|
if (flags["help"] === true || flags["h"] === true) {
|
|
2697
2755
|
const deepSub = positional[1];
|
|
2698
2756
|
if (deepSub && renderDeepHelp(`${first}:${deepSub}`, renderer)) {
|
|
@@ -3253,33 +3311,7 @@ async function initializeCli(argv) {
|
|
|
3253
3311
|
}
|
|
3254
3312
|
const { config, vault, wpaths, cwd, modelsRegistry, renderer, reader, logger } = ctx;
|
|
3255
3313
|
const { updateInfo: refreshedUpdateInfo } = await runPreflight(config, ctx.updateInfo);
|
|
3256
|
-
|
|
3257
|
-
setOAuthTokenPersister((providerId, creds) => {
|
|
3258
|
-
void mutateConfigProviders(profileConfigPath, vault, (all) => {
|
|
3259
|
-
const p = all[providerId];
|
|
3260
|
-
if (!p) return;
|
|
3261
|
-
const keys = normalizeKeys(p);
|
|
3262
|
-
const active = p.activeKey ? keys.find((k) => k.label === p.activeKey) : keys[0];
|
|
3263
|
-
if (!active) return;
|
|
3264
|
-
active.apiKey = creds.accessToken;
|
|
3265
|
-
active.refreshToken = creds.refreshToken;
|
|
3266
|
-
active.expiresAt = new Date(creds.expiresAt).toISOString();
|
|
3267
|
-
if (creds.accountId) active.accountId = creds.accountId;
|
|
3268
|
-
writeKeysBack(p, keys);
|
|
3269
|
-
}).catch(() => {
|
|
3270
|
-
});
|
|
3271
|
-
});
|
|
3272
|
-
setProviderModelPersister((providerId, models) => {
|
|
3273
|
-
if (models.length === 0) return;
|
|
3274
|
-
void mutateConfigProviders(profileConfigPath, vault, (all) => {
|
|
3275
|
-
const p = all[providerId];
|
|
3276
|
-
if (!p) return;
|
|
3277
|
-
const live = models.map((m) => m.id);
|
|
3278
|
-
if (p.models?.length === live.length && p.models.every((id, i) => id === live[i])) return;
|
|
3279
|
-
p.models = live;
|
|
3280
|
-
}).catch(() => {
|
|
3281
|
-
});
|
|
3282
|
-
});
|
|
3314
|
+
installProviderPersisters({ config, paths: wpaths, vault, logger });
|
|
3283
3315
|
const { events, container, approvalMirror } = wireContainer({
|
|
3284
3316
|
config,
|
|
3285
3317
|
wpaths,
|
|
@@ -3303,4 +3335,4 @@ async function initializeCli(argv) {
|
|
|
3303
3335
|
export {
|
|
3304
3336
|
initializeCli
|
|
3305
3337
|
};
|
|
3306
|
-
//# sourceMappingURL=cli-context-
|
|
3338
|
+
//# sourceMappingURL=cli-context-34Q5IJRA.js.map
|
|
@@ -45,6 +45,8 @@ interface ForcedExitDeps {
|
|
|
45
45
|
readonly exit?: ((code: number) => void) | undefined;
|
|
46
46
|
}
|
|
47
47
|
export declare function scheduleForcedExit(code: number, deps?: ForcedExitDeps): void;
|
|
48
|
+
/** Run the complete CLI process lifecycle for an already-confirmed entry point. */
|
|
49
|
+
export declare function runCliProcess(mainFn: (argv: string[]) => Promise<number>): void;
|
|
48
50
|
export declare function runAsMain(mainFn: (argv: string[]) => Promise<number>): void;
|
|
49
51
|
export {};
|
|
50
52
|
//# sourceMappingURL=cli-entry-point.d.ts.map
|