@wrongstack/cli 1.0.24 → 1.0.27
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/data/providers.json +44 -0
- package/dist/{acp-AJWSKWE5.js → acp-M4565YUW.js} +33 -20
- package/dist/ascii-mode-SG4PRNLP.js +7 -0
- package/dist/{auth-GRBZ7Y3D.js → auth-TE55JF4Z.js} +14 -14
- package/dist/{bench-N5K7Z5O3.js → bench-GTLPM22B.js} +2 -2
- package/dist/boot/append-system-prompt.d.ts +10 -0
- package/dist/boot/ascii-mode.d.ts +12 -0
- package/dist/boot/container-wiring.d.ts +4 -2
- package/dist/boot/dispatch-singleshot.d.ts +12 -1
- package/dist/boot/dispatch-webui.d.ts +2 -0
- package/dist/boot/goal-tui-default.d.ts +10 -0
- package/dist/boot/mcp-config-flag.d.ts +22 -0
- package/dist/boot/piped-stdin.d.ts +40 -0
- package/dist/boot/restricted-mode.d.ts +15 -0
- package/dist/boot/safe-mode.d.ts +30 -0
- package/dist/boot/single-shot-budget.d.ts +30 -0
- package/dist/boot/stream-json.d.ts +36 -0
- package/dist/boot/structured-output.d.ts +16 -0
- package/dist/boot/system-prompt-builder.d.ts +2 -0
- package/dist/boot/tool-restriction-flags.d.ts +36 -0
- package/dist/boot/worktree-sessions.d.ts +21 -0
- package/dist/boot-provider-selection.d.ts +67 -0
- package/dist/boot.d.ts +1 -38
- package/dist/{chunk-LFMVHT3R.js → chunk-2ERX3RPN.js} +11 -13
- package/dist/chunk-4TVYGG6G.js +62 -0
- package/dist/chunk-5JYDKG5B.js +154 -0
- package/dist/{chunk-3VXYY5JC.js → chunk-5UZBUV2H.js} +3 -19
- package/dist/chunk-CZTXF6HY.js +140 -0
- package/dist/{chunk-DRM7PSW7.js → chunk-ENRYW73H.js} +527 -381
- package/dist/{chunk-SKPDE62W.js → chunk-EPR42SWM.js} +36 -6
- package/dist/{chunk-YBUCXXYZ.js → chunk-F5DCFAKI.js} +1 -1
- package/dist/chunk-HDMFKTT3.js +157 -0
- package/dist/{chunk-PGKJ2OQP.js → chunk-HFZH2XJN.js} +5 -5
- package/dist/chunk-HLSHFXTO.js +97 -0
- package/dist/{chunk-QFPQXKCG.js → chunk-KOEO4CJG.js} +21 -6
- package/dist/chunk-LBPLTTZ6.js +105 -0
- package/dist/{chunk-3OCUS3VN.js → chunk-LDCGZJTC.js} +4 -4
- package/dist/chunk-LKPEBZBE.js +143 -0
- package/dist/chunk-N57IU5FG.js +58 -0
- package/dist/{chunk-2EBVTYJR.js → chunk-NRXWOMK7.js} +17 -3
- package/dist/chunk-PZQBGUVZ.js +18 -0
- package/dist/{chunk-MHEBWVXL.js → chunk-Q4INH2DG.js} +46 -2
- package/dist/{chunk-5SEYGOCH.js → chunk-RDGGWMTI.js} +2 -2
- package/dist/{chunk-BLD5DSVA.js → chunk-RGFWGUAB.js} +27 -15
- package/dist/{chunk-ZZRSG7VK.js → chunk-RZ4ZDRYA.js} +3 -3
- package/dist/{chunk-S4FFHDJG.js → chunk-SDJCLEK6.js} +6 -2
- package/dist/{chunk-U46QR4WR.js → chunk-TI7KLHYX.js} +132 -3
- package/dist/chunk-X756ZS72.js +329 -0
- package/dist/{chunk-JF2MULWF.js → chunk-YHYINL47.js} +47 -15
- package/dist/{cli-context-34Q5IJRA.js → cli-context-C7RBSWHF.js} +434 -327
- package/dist/{cli-main-AELJDBGU.js → cli-main-TQTH73ZK.js} +2948 -2315
- package/dist/cli-update-notice.d.ts +2 -1
- package/dist/config-doctor.d.ts +1 -1
- package/dist/{diag-doctor-WIFJH3XH.js → diag-doctor-BIZAFIAT.js} +2 -2
- package/dist/{execution-PYC5FCS4.js → execution-3STBD2U7.js} +2167 -1831
- package/dist/execution-chimera-review.d.ts +18 -1
- package/dist/fleet/host-types.d.ts +3 -1
- package/dist/goal-commands.d.ts +47 -0
- package/dist/goal-host.d.ts +1 -14
- package/dist/{hq-JTUTFI4L.js → hq-44F4OQH2.js} +9 -8
- package/dist/hq-fleet-control.d.ts +36 -0
- package/dist/hq-live-status.d.ts +22 -0
- package/dist/hq-publisher.d.ts +18 -0
- package/dist/hq-server/routes/command-handlers.d.ts +12 -1
- package/dist/hq-server/routes/data-handlers.d.ts +1 -1
- package/dist/hq-server/socket-credentials.d.ts +63 -0
- package/dist/hq-server/upgrade-handler.d.ts +2 -0
- package/dist/hq-server/ws.d.ts +24 -0
- package/dist/{hq-server-PC7GZMPT.js → hq-server-UIB24LU6.js} +2 -2
- package/dist/{hq-service-NW56MUP2.js → hq-service-BMMJAHRT.js} +4 -4
- package/dist/import-claude-code-AYG24RG2.js +268 -0
- package/dist/index.js +12 -8
- package/dist/live-settings-input.d.ts +1 -0
- package/dist/{mailbox-serve-WDOCH6KR.js → mailbox-serve-GNGXEQ2R.js} +3 -3
- package/dist/{modeldiag-36OGAL5C.js → modeldiag-W7XAE625.js} +9 -9
- package/dist/{per-subcommand-help-XE77MTGJ.js → per-subcommand-help-QDAQASPZ.js} +2 -2
- package/dist/permission-prompt.d.ts +14 -0
- package/dist/permission-rules-view.d.ts +18 -0
- package/dist/{permissions-CFDLXETM.js → permissions-PL27UHYD.js} +67 -45
- package/dist/{plugin-usage-S5LVGMBW.js → plugin-usage-CIGOOTX3.js} +2 -2
- package/dist/{plugins-RHBIVLI7.js → plugins-HQTXUD6A.js} +4 -2
- package/dist/preflight.d.ts +1 -1
- package/dist/{projects-LMNAGGEU.js → projects-T4CZCA25.js} +3 -6
- package/dist/provider-helpers.d.ts +7 -11
- package/dist/{providers-models-2CFG46RD.js → providers-models-5Z2PJTEW.js} +5 -5
- package/dist/release-asset-download.d.ts +10 -0
- package/dist/release-attestation.d.ts +28 -0
- package/dist/remote/remote-session.d.ts +64 -0
- package/dist/remote/remote-target.d.ts +69 -0
- package/dist/remote-GB5VXCCT.js +576 -0
- package/dist/{replay-Z3FTJEMM.js → replay-DEI566CW.js} +2 -2
- package/dist/services/commit-message.d.ts +2 -1
- package/dist/session-move-P2EC2COA.js +44 -0
- package/dist/session-move.d.ts +20 -0
- package/dist/session-stats.d.ts +10 -0
- package/dist/{sessions-config-IQUH2GXT.js → sessions-config-XHLXJ5C3.js} +109 -10
- package/dist/short-circuit-flags-5TNTJPQR.js +10 -0
- package/dist/slash-commands/command-context.d.ts +15 -5
- package/dist/slash-commands/goal-refiner.d.ts +4 -49
- package/dist/slash-commands/mcp.d.ts +2 -1
- package/dist/slash-commands/permissions.d.ts +4 -0
- package/dist/slash-commands/settings-context-mutations.d.ts +5 -0
- package/dist/slash-commands/settings-limits-mutations.d.ts +12 -0
- package/dist/slash-commands/theme.d.ts +15 -1
- package/dist/standalone-auto-update-TOTRGCSA.js +249 -0
- package/dist/standalone-auto-update.d.ts +65 -0
- package/dist/standalone-update-LZO3MNLH.js +24 -0
- package/dist/standalone-update.d.ts +37 -1
- package/dist/subcommands/handlers/import-claude-code.d.ts +52 -0
- package/dist/subcommands/handlers/permissions.d.ts +9 -3
- package/dist/subcommands/handlers/remote.d.ts +6 -0
- package/dist/subcommands/handlers/sessions-fleet.d.ts +0 -12
- package/dist/subcommands/handlers/version-help.d.ts +5 -0
- package/dist/{subcommands-ZTSIN7LG.js → subcommands-BHQYLDSD.js} +2 -2
- package/dist/tui-resume-callback.d.ts +18 -0
- package/dist/{typesafe-HVEVPA6R.js → typesafe-U7YB2RRV.js} +5 -5
- package/dist/{typesafe-topic-replay-4W73BOLV.js → typesafe-topic-replay-ZILIU3WS.js} +18 -2
- package/dist/{update-7XIOEXTD.js → update-TDZX4IL2.js} +4 -4
- package/dist/{update-check-2POMBHFB.js → update-check-J5ZVKS73.js} +3 -3
- package/dist/version-JB2UAV2A.js +11 -0
- package/dist/version-help-XJJQ7YSH.js +10 -0
- package/dist/webui-server/route-contexts.d.ts +1 -1
- package/dist/webui-server/session-start-payload.d.ts +5 -1
- package/dist/{webui-server-L2SICPTB.js → webui-server-GCXIO3JY.js} +515 -365
- package/dist/webui-server-lifecycle.d.ts +57 -0
- package/dist/webui-server-options.d.ts +10 -0
- package/dist/webui-server.d.ts +0 -14
- package/dist/wiring/brain-and-orchestration.d.ts +3 -1
- package/dist/wiring/cli-prompt-and-tools-setup.d.ts +9 -0
- package/dist/wiring/cli-slash-commands-setup.d.ts +1 -0
- package/dist/wiring/command-host-state.d.ts +2 -0
- package/dist/wiring/hq-telemetry.d.ts +12 -0
- package/dist/wiring/lifecycle-plugins.d.ts +4 -2
- package/dist/wiring/metrics.d.ts +9 -1
- package/dist/wiring/pipeline.d.ts +2 -7
- package/dist/wiring/plugins.d.ts +3 -0
- package/dist/wiring/provider-status.d.ts +1 -0
- package/dist/wiring/provider-utility-tools.d.ts +3 -1
- package/package.json +29 -28
- package/dist/chunk-2BKFWIER.js +0 -98
- package/dist/chunk-424ORSE7.js +0 -56
- package/dist/chunk-OWNC7LMD.js +0 -78
- package/dist/chunk-QBBF7GIK.js +0 -65
- package/dist/short-circuit-flags-SDT53OML.js +0 -10
- package/dist/standalone-update-MW47J3AK.js +0 -164
- package/dist/version-help-WZ623NWM.js +0 -10
|
@@ -817,7 +817,7 @@ var helpTable = {
|
|
|
817
817
|
name: "sessions",
|
|
818
818
|
title: "wstack sessions \u2014 list and resume recent sessions",
|
|
819
819
|
description: "List recent sessions, show one session in detail, resume a session, or inspect a session's audit log. The audit log is stored as JSONL next to each session's recording.",
|
|
820
|
-
usage: "wstack sessions [list|show|resume|fork|doctor|config|fleet] [...]",
|
|
820
|
+
usage: "wstack sessions [list|show|resume|fork|move|doctor|config|fleet] [...]",
|
|
821
821
|
subcommands: [
|
|
822
822
|
{ name: "list", description: "List the most recent sessions." },
|
|
823
823
|
{
|
|
@@ -830,6 +830,10 @@ var helpTable = {
|
|
|
830
830
|
name: "fork [<id>] [--to N]",
|
|
831
831
|
description: "Create an isolated child journal at a persisted boundary."
|
|
832
832
|
},
|
|
833
|
+
{
|
|
834
|
+
name: "move <id> --to <path>",
|
|
835
|
+
description: "Move a closed session to another git worktree of this repository, or to another project (its journal moves to that project)."
|
|
836
|
+
},
|
|
833
837
|
{ name: "config", description: "Show or edit session-specific config." },
|
|
834
838
|
{ name: "fleet", description: "List the active fleet of sessions." }
|
|
835
839
|
],
|
|
@@ -959,6 +963,13 @@ var helpTable = {
|
|
|
959
963
|
usage: "wstack update [--check-only] [--pm <manager>] [--allow-scripts (alias: --lifecycle-scripts)]",
|
|
960
964
|
seeAlso: "wstack version (read-only version info)"
|
|
961
965
|
},
|
|
966
|
+
remote: {
|
|
967
|
+
name: "remote",
|
|
968
|
+
title: "wstack remote \u2014 run WrongStack on another machine over SSH",
|
|
969
|
+
description: "Runs WrongStack on the remote machine, in the given project directory, and opens its WebUI here through an SSH tunnel; the agent, its tools and its daemons run remotely. The system ssh is used, so ~/.ssh/config, your agent and known_hosts apply. The matching build is uploaded once per version to ~/.wrongstack/remote and checked by SHA-256. A dropped connection is reopened; the remote host keeps running meanwhile. Nothing from your local configuration is copied: set up a provider in the remote WebUI the first time.",
|
|
970
|
+
usage: "wstack remote <user@host:/path | ssh://user@host:port/path> [--port <n>] [--open] [--keep] [--ssh-config <file>] [--remote-binary <file>]",
|
|
971
|
+
seeAlso: "wstack --remote <target> (same command)"
|
|
972
|
+
},
|
|
962
973
|
// -- ACP (Agent Client Protocol) --------------------------------------
|
|
963
974
|
acp: {
|
|
964
975
|
name: "acp",
|
|
@@ -1080,13 +1091,17 @@ var helpTable = {
|
|
|
1080
1091
|
// -- Permissions ────────────────────────────────────────────────────
|
|
1081
1092
|
permissions: {
|
|
1082
1093
|
name: "permissions",
|
|
1083
|
-
title: "wstack permissions \u2014 explain
|
|
1084
|
-
description: "Side-effect-free permission
|
|
1085
|
-
usage: "wstack permissions explain <tool> [--input '<json>'] [--json]",
|
|
1094
|
+
title: "wstack permissions \u2014 list and explain the permission rules",
|
|
1095
|
+
description: "Side-effect-free views of the permission policy the agent runs under: every rule in the order it is checked, and how one tool call is decided, without prompting, modifying trust files, or mutating state. Inside a session, /permissions also sets allow/deny rules for that session only.",
|
|
1096
|
+
usage: "wstack permissions [rules|explain <tool> [--input '<json>']] [--json]",
|
|
1086
1097
|
subcommands: [
|
|
1098
|
+
{
|
|
1099
|
+
name: "rules",
|
|
1100
|
+
description: "List every permission rule, in the order they are checked (first match decides)."
|
|
1101
|
+
},
|
|
1087
1102
|
{
|
|
1088
1103
|
name: "explain <tool>",
|
|
1089
|
-
description: "Explain how the permission policy
|
|
1104
|
+
description: "Explain how the permission policy decides a tool call, and name the rule."
|
|
1090
1105
|
}
|
|
1091
1106
|
],
|
|
1092
1107
|
seeAlso: "wstack tools (list available tools)"
|
|
@@ -1112,6 +1127,21 @@ var helpTable = {
|
|
|
1112
1127
|
subcommands: [{ name: "status", description: "Show daemon and attachment-broker health." }],
|
|
1113
1128
|
seeAlso: "wstack doctor (broader environment diagnostics)"
|
|
1114
1129
|
},
|
|
1130
|
+
"import-claude-code": {
|
|
1131
|
+
name: "import-claude-code",
|
|
1132
|
+
title: "wstack import-claude-code \u2014 bring a Claude Code setup across",
|
|
1133
|
+
description: "Import MCP servers from ~/.claude.json (user + this project) and the repository's .mcp.json into the active profile. Previews by default. Repository servers arrive disabled unless --enable-project-servers. Skills are read in place; hooks, permission rules and CLAUDE.md are reported with next steps, not translated.",
|
|
1134
|
+
usage: "wstack import-claude-code [--apply] [--overwrite] [--enable-project-servers]",
|
|
1135
|
+
subcommands: [
|
|
1136
|
+
{ name: "--apply", description: "Write the plan (default: preview only)." },
|
|
1137
|
+
{ name: "--overwrite", description: "Replace servers that already exist by name." },
|
|
1138
|
+
{
|
|
1139
|
+
name: "--enable-project-servers",
|
|
1140
|
+
description: "Enable the repository's .mcp.json servers on import."
|
|
1141
|
+
}
|
|
1142
|
+
],
|
|
1143
|
+
seeAlso: "wstack mcp list; --mcp-config (one-off servers without importing)"
|
|
1144
|
+
},
|
|
1115
1145
|
// -- Chronicle ──────────────────────────────────────────────────────
|
|
1116
1146
|
chronicle: {
|
|
1117
1147
|
name: "chronicle",
|
|
@@ -1213,4 +1243,4 @@ export {
|
|
|
1213
1243
|
subcommandsWithFocusedHelp,
|
|
1214
1244
|
renderGenericHelp
|
|
1215
1245
|
};
|
|
1216
|
-
//# sourceMappingURL=chunk-
|
|
1246
|
+
//# sourceMappingURL=chunk-EPR42SWM.js.map
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
|
|
2
|
+
// src/boot/execution-mode.ts
|
|
3
|
+
function resolveExecutionMode(positional, flags) {
|
|
4
|
+
const prompt = typeof flags["prompt"] === "string" ? flags["prompt"] : "";
|
|
5
|
+
if (positional.length > 0 || prompt.length > 0) return "single-shot";
|
|
6
|
+
if (flags.tui && flags["no-tui"] !== true && !flags.webui && !flags["webui-session-child"])
|
|
7
|
+
return "tui";
|
|
8
|
+
if (flags.webui || flags["webui-session-child"]) return "webui";
|
|
9
|
+
return "repl";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// src/hq-fleet-control.ts
|
|
13
|
+
import {
|
|
14
|
+
areSubagentsAllowedForSession,
|
|
15
|
+
FLEET_ROSTER
|
|
16
|
+
} from "@wrongstack/core/coordination";
|
|
17
|
+
import { AgentError } from "@wrongstack/core/types";
|
|
18
|
+
async function killHqSessionFleet(director, sessionId, scope) {
|
|
19
|
+
if (!director) return 0;
|
|
20
|
+
const owned = sessionId ? director.subagentIdsForSession(sessionId) : [];
|
|
21
|
+
if (owned.length > 0 && sessionId) {
|
|
22
|
+
await director.terminateSession(sessionId);
|
|
23
|
+
return owned.length;
|
|
24
|
+
}
|
|
25
|
+
if (scope.multiConversation) return 0;
|
|
26
|
+
let killed = 0;
|
|
27
|
+
for (const subagent of director.status().subagents) {
|
|
28
|
+
if (subagent.status === "running" || subagent.status === "idle") {
|
|
29
|
+
try {
|
|
30
|
+
await director.remove(subagent.id);
|
|
31
|
+
killed++;
|
|
32
|
+
} catch {
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return killed;
|
|
37
|
+
}
|
|
38
|
+
async function terminateHqAgent(director, subagentId) {
|
|
39
|
+
if (!director) return false;
|
|
40
|
+
try {
|
|
41
|
+
await director.terminate(subagentId);
|
|
42
|
+
return true;
|
|
43
|
+
} catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function spawnHqAgent(director, sessionId, role, task, maxIterations) {
|
|
48
|
+
if (!director) {
|
|
49
|
+
throw new AgentError({
|
|
50
|
+
message: "Director is not available.",
|
|
51
|
+
code: "AGENT_RUN_FAILED",
|
|
52
|
+
context: { phase: "hq-spawn", role }
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (!areSubagentsAllowedForSession(sessionId)) {
|
|
56
|
+
throw new Error("Subagents are disabled for this session.");
|
|
57
|
+
}
|
|
58
|
+
const base = FLEET_ROSTER[role] ?? {
|
|
59
|
+
id: `manual-${Date.now()}`,
|
|
60
|
+
name: role,
|
|
61
|
+
maxIterations: maxIterations ?? 0,
|
|
62
|
+
maxToolCalls: 200
|
|
63
|
+
};
|
|
64
|
+
const overrides = maxIterations !== void 0 ? { maxIterations } : {};
|
|
65
|
+
const config = task !== void 0 ? { ...base, ...overrides, task } : { ...base, ...overrides };
|
|
66
|
+
return director.spawn({ ...config, originSessionId: sessionId });
|
|
67
|
+
}
|
|
68
|
+
function createHqFleetControl(getDirector, defaultSessionId, scope) {
|
|
69
|
+
return {
|
|
70
|
+
killFleet: (sessionId) => killHqSessionFleet(getDirector(), sessionId ?? defaultSessionId(), scope),
|
|
71
|
+
terminateAgent: (subagentId) => terminateHqAgent(getDirector(), subagentId),
|
|
72
|
+
spawnAgent: (role, task, maxIterations, sessionId) => spawnHqAgent(getDirector(), sessionId ?? defaultSessionId(), role, task, maxIterations)
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// src/services/suggestion-store.ts
|
|
77
|
+
var sharedSuggestions = [];
|
|
78
|
+
var sharedAutoSuggestions = [];
|
|
79
|
+
function setSuggestions(suggestions) {
|
|
80
|
+
sharedSuggestions = suggestions;
|
|
81
|
+
}
|
|
82
|
+
function setAutoSuggestions(suggestions) {
|
|
83
|
+
sharedAutoSuggestions = suggestions;
|
|
84
|
+
}
|
|
85
|
+
function getSuggestions() {
|
|
86
|
+
return sharedSuggestions;
|
|
87
|
+
}
|
|
88
|
+
function removeSuggestions(indices) {
|
|
89
|
+
if (indices.length === 0) return;
|
|
90
|
+
const set = new Set(indices);
|
|
91
|
+
sharedSuggestions = sharedSuggestions.filter((_, i) => !set.has(i));
|
|
92
|
+
sharedAutoSuggestions = [];
|
|
93
|
+
}
|
|
94
|
+
function clearSuggestions() {
|
|
95
|
+
sharedSuggestions = [];
|
|
96
|
+
sharedAutoSuggestions = [];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// src/tui-thinking-word.ts
|
|
100
|
+
var DEFAULT_TUI_THINKING_WORD = "thinking";
|
|
101
|
+
var MAX_TUI_THINKING_WORD_LENGTH = 16;
|
|
102
|
+
function normalizeTuiThinkingWord(value) {
|
|
103
|
+
if (typeof value !== "string") return DEFAULT_TUI_THINKING_WORD;
|
|
104
|
+
const word = value.trim();
|
|
105
|
+
if (word.length === 0 || word.length > MAX_TUI_THINKING_WORD_LENGTH) {
|
|
106
|
+
return DEFAULT_TUI_THINKING_WORD;
|
|
107
|
+
}
|
|
108
|
+
if (!/^[\p{L}\p{N}_-]+$/u.test(word)) return DEFAULT_TUI_THINKING_WORD;
|
|
109
|
+
return word;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// src/services/run-git.ts
|
|
113
|
+
import { spawn } from "node:child_process";
|
|
114
|
+
import { toErrorMessage } from "@wrongstack/core/utils";
|
|
115
|
+
async function runGit(args, cwd) {
|
|
116
|
+
try {
|
|
117
|
+
return await new Promise((resolve, reject) => {
|
|
118
|
+
const child = spawn("git", args, {
|
|
119
|
+
cwd,
|
|
120
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
121
|
+
signal: AbortSignal.timeout(3e4),
|
|
122
|
+
windowsHide: true
|
|
123
|
+
});
|
|
124
|
+
let stdout = "";
|
|
125
|
+
let stderr = "";
|
|
126
|
+
child.stdout?.on("data", (d) => {
|
|
127
|
+
stdout += d;
|
|
128
|
+
});
|
|
129
|
+
child.stderr?.on("data", (d) => {
|
|
130
|
+
stderr += d;
|
|
131
|
+
});
|
|
132
|
+
child.on("error", (err) => {
|
|
133
|
+
reject(new Error(`Failed to run git: ${err.message}`));
|
|
134
|
+
});
|
|
135
|
+
child.on("close", (code) => resolve({ stdout, stderr, code: code ?? 1 }));
|
|
136
|
+
});
|
|
137
|
+
} catch (err) {
|
|
138
|
+
throw new Error(toErrorMessage(err));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export {
|
|
143
|
+
resolveExecutionMode,
|
|
144
|
+
setSuggestions,
|
|
145
|
+
setAutoSuggestions,
|
|
146
|
+
getSuggestions,
|
|
147
|
+
removeSuggestions,
|
|
148
|
+
clearSuggestions,
|
|
149
|
+
killHqSessionFleet,
|
|
150
|
+
terminateHqAgent,
|
|
151
|
+
spawnHqAgent,
|
|
152
|
+
createHqFleetControl,
|
|
153
|
+
MAX_TUI_THINKING_WORD_LENGTH,
|
|
154
|
+
normalizeTuiThinkingWord,
|
|
155
|
+
runGit
|
|
156
|
+
};
|
|
157
|
+
//# sourceMappingURL=chunk-HDMFKTT3.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
helpCmd,
|
|
3
3
|
versionCmd
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-5JYDKG5B.js";
|
|
5
5
|
import {
|
|
6
6
|
parseArgs
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-Q4INH2DG.js";
|
|
8
8
|
|
|
9
9
|
// src/boot/short-circuit-flags.ts
|
|
10
10
|
async function handleHelpVersionShortCircuit(argv) {
|
|
@@ -22,11 +22,11 @@ async function handleHelpVersionShortCircuit(argv) {
|
|
|
22
22
|
}
|
|
23
23
|
if (earlyFlags["help"] === true) {
|
|
24
24
|
if (positional.length > 0) {
|
|
25
|
-
const { subcommandNames } = await import("./subcommands-
|
|
25
|
+
const { subcommandNames } = await import("./subcommands-BHQYLDSD.js");
|
|
26
26
|
if (subcommandNames.includes(positional[0])) {
|
|
27
27
|
const first = positional[0];
|
|
28
28
|
const deep = positional[1];
|
|
29
|
-
const { renderDeepHelp, renderFocusedHelp } = await import("./per-subcommand-help-
|
|
29
|
+
const { renderDeepHelp, renderFocusedHelp } = await import("./per-subcommand-help-QDAQASPZ.js");
|
|
30
30
|
if (deep && renderDeepHelp(`${first}:${deep}`, stubRenderer)) {
|
|
31
31
|
return 0;
|
|
32
32
|
}
|
|
@@ -43,4 +43,4 @@ async function handleHelpVersionShortCircuit(argv) {
|
|
|
43
43
|
export {
|
|
44
44
|
handleHelpVersionShortCircuit
|
|
45
45
|
};
|
|
46
|
-
//# sourceMappingURL=chunk-
|
|
46
|
+
//# sourceMappingURL=chunk-HFZH2XJN.js.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
|
|
2
|
+
// src/boot/mcp-config-flag.ts
|
|
3
|
+
import * as fs from "node:fs/promises";
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
function isRecord(value) {
|
|
6
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7
|
+
}
|
|
8
|
+
function stringRecord(value, where) {
|
|
9
|
+
if (value === void 0) return void 0;
|
|
10
|
+
if (!isRecord(value) || Object.values(value).some((v) => typeof v !== "string")) {
|
|
11
|
+
throw new Error(`${where} must be an object of strings`);
|
|
12
|
+
}
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
function normalizeMcpServerEntry(name, raw) {
|
|
16
|
+
if (!isRecord(raw)) throw new Error(`server "${name}" must be an object`);
|
|
17
|
+
const where = `server "${name}"`;
|
|
18
|
+
const { type, transport: rawTransport, ...rest } = raw;
|
|
19
|
+
let transport;
|
|
20
|
+
if (rawTransport !== void 0) {
|
|
21
|
+
if (rawTransport !== "stdio" && rawTransport !== "sse" && rawTransport !== "streamable-http") {
|
|
22
|
+
throw new Error(`${where}: unknown transport "${String(rawTransport)}"`);
|
|
23
|
+
}
|
|
24
|
+
transport = rawTransport;
|
|
25
|
+
} else if (type !== void 0) {
|
|
26
|
+
if (type === "http") transport = "streamable-http";
|
|
27
|
+
else if (type === "sse" || type === "stdio") transport = type;
|
|
28
|
+
else throw new Error(`${where}: unknown type "${String(type)}"`);
|
|
29
|
+
} else if (typeof rest["command"] === "string") {
|
|
30
|
+
transport = "stdio";
|
|
31
|
+
}
|
|
32
|
+
if (transport === "stdio" && typeof rest["command"] !== "string") {
|
|
33
|
+
throw new Error(`${where}: stdio needs a "command"`);
|
|
34
|
+
}
|
|
35
|
+
if ((transport === "sse" || transport === "streamable-http") && typeof rest["url"] !== "string") {
|
|
36
|
+
throw new Error(`${where}: ${transport} needs a "url"`);
|
|
37
|
+
}
|
|
38
|
+
if (rest["args"] !== void 0 && !Array.isArray(rest["args"])) {
|
|
39
|
+
throw new Error(`${where}: "args" must be an array`);
|
|
40
|
+
}
|
|
41
|
+
const env = stringRecord(rest["env"], `${where} "env"`);
|
|
42
|
+
const headers = stringRecord(rest["headers"], `${where} "headers"`);
|
|
43
|
+
return {
|
|
44
|
+
...rest,
|
|
45
|
+
...transport ? { transport } : {},
|
|
46
|
+
...env ? { env } : {},
|
|
47
|
+
...headers ? { headers } : {}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function parseLaunchMcpServers(text, source) {
|
|
51
|
+
let doc;
|
|
52
|
+
try {
|
|
53
|
+
doc = JSON.parse(text);
|
|
54
|
+
} catch (err) {
|
|
55
|
+
throw new Error(`--mcp-config: ${source} is not valid JSON (${err.message})`);
|
|
56
|
+
}
|
|
57
|
+
if (!isRecord(doc)) throw new Error(`--mcp-config: ${source} must be a JSON object`);
|
|
58
|
+
const servers = isRecord(doc["mcpServers"]) ? doc["mcpServers"] : doc;
|
|
59
|
+
const out = {};
|
|
60
|
+
for (const [name, raw] of Object.entries(servers)) {
|
|
61
|
+
try {
|
|
62
|
+
out[name] = { ...normalizeMcpServerEntry(name, raw), enabled: true };
|
|
63
|
+
} catch (err) {
|
|
64
|
+
throw new Error(`--mcp-config: ${source}: ${err.message}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
async function resolveLaunchMcpServers(flags, cwd) {
|
|
70
|
+
const value = flags["mcp-config"];
|
|
71
|
+
if (value === void 0) return void 0;
|
|
72
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
73
|
+
throw new Error("--mcp-config needs a JSON file path or an inline JSON object");
|
|
74
|
+
}
|
|
75
|
+
const trimmed = value.trim();
|
|
76
|
+
if (trimmed.startsWith("{")) return parseLaunchMcpServers(trimmed, "inline JSON");
|
|
77
|
+
const file = path.resolve(cwd, trimmed);
|
|
78
|
+
let text;
|
|
79
|
+
try {
|
|
80
|
+
text = await fs.readFile(file, "utf8");
|
|
81
|
+
} catch (err) {
|
|
82
|
+
const reason = err.code ?? String(err);
|
|
83
|
+
throw new Error(`--mcp-config: cannot read ${file} (${reason})`);
|
|
84
|
+
}
|
|
85
|
+
return parseLaunchMcpServers(text, file);
|
|
86
|
+
}
|
|
87
|
+
function effectiveMcpServers(configured, launch, strict) {
|
|
88
|
+
return { ...strict ? {} : configured ?? {}, ...launch ?? {} };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export {
|
|
92
|
+
normalizeMcpServerEntry,
|
|
93
|
+
parseLaunchMcpServers,
|
|
94
|
+
resolveLaunchMcpServers,
|
|
95
|
+
effectiveMcpServers
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=chunk-HLSHFXTO.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-U3SS4NRH.js";
|
|
4
4
|
import {
|
|
5
5
|
checkForUpdate
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RZ4ZDRYA.js";
|
|
7
7
|
|
|
8
8
|
// src/subcommands/handlers/update.ts
|
|
9
9
|
import { spawn } from "node:child_process";
|
|
@@ -21,6 +21,8 @@ async function runUpdateCommand(args, deps) {
|
|
|
21
21
|
(flag) => ![
|
|
22
22
|
"check-only",
|
|
23
23
|
"c",
|
|
24
|
+
// `-c` after the top-level parser's expansion; see mergeUpdateArgs.
|
|
25
|
+
"continue",
|
|
24
26
|
"pm",
|
|
25
27
|
"package-manager",
|
|
26
28
|
"allow-scripts",
|
|
@@ -77,11 +79,24 @@ async function runUpdateCommand(args, deps) {
|
|
|
77
79
|
return 0;
|
|
78
80
|
}
|
|
79
81
|
if (isStandaloneBinary()) {
|
|
80
|
-
const { updateStandaloneBinary } = await
|
|
81
|
-
|
|
82
|
+
const [{ updateStandaloneBinary }, { standaloneUpdater }, { STANDALONE_TARGET }] = await Promise.all([
|
|
83
|
+
import("./standalone-update-LZO3MNLH.js"),
|
|
84
|
+
import("./standalone-auto-update-TOTRGCSA.js"),
|
|
85
|
+
import("./version-JB2UAV2A.js")
|
|
86
|
+
]);
|
|
87
|
+
const updater = standaloneUpdater({
|
|
88
|
+
executable: realpathSync(process.execPath),
|
|
89
|
+
target: STANDALONE_TARGET ?? "",
|
|
90
|
+
current: info.current
|
|
91
|
+
});
|
|
92
|
+
const code = await updateStandaloneBinary({
|
|
82
93
|
current: info.current,
|
|
83
|
-
renderer: deps.renderer
|
|
94
|
+
renderer: deps.renderer,
|
|
95
|
+
// A build the background updater already downloaded and verified.
|
|
96
|
+
staged: updater.pending()
|
|
84
97
|
});
|
|
98
|
+
if (code === 0) updater.clear();
|
|
99
|
+
return code;
|
|
85
100
|
}
|
|
86
101
|
const packageManager = parsed.packageManager ?? detectUpdatePackageManager();
|
|
87
102
|
let updateCommand;
|
|
@@ -184,7 +199,7 @@ function mergeUpdateArgs(args, flags) {
|
|
|
184
199
|
if (flags[name] === true || flags[name] === "true") merged.push(`--${alias}`);
|
|
185
200
|
};
|
|
186
201
|
addBoolean("check-only");
|
|
187
|
-
if (flags["c"] === true || flags["c"] === "true") merged.push("-c");
|
|
202
|
+
if (flags["continue"] === true || flags["c"] === true || flags["c"] === "true") merged.push("-c");
|
|
188
203
|
addBoolean("allow-scripts");
|
|
189
204
|
addBoolean("lifecycle-scripts");
|
|
190
205
|
for (const pm of ["npm", "pnpm", "yarn", "bun"]) addBoolean(pm);
|
|
@@ -391,4 +406,4 @@ export {
|
|
|
391
406
|
detectUpdatePackageManager,
|
|
392
407
|
detectUpdatePackageName
|
|
393
408
|
};
|
|
394
|
-
//# sourceMappingURL=chunk-
|
|
409
|
+
//# sourceMappingURL=chunk-KOEO4CJG.js.map
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
|
|
2
|
+
// src/preflight.ts
|
|
3
|
+
import { ensureSessionShell } from "@wrongstack/tools/session-shell";
|
|
4
|
+
|
|
5
|
+
// src/cli-update-notice.ts
|
|
6
|
+
import { realpathSync } from "node:fs";
|
|
7
|
+
import { isStandaloneBinary, writeErr } from "@wrongstack/core/utils";
|
|
8
|
+
var NOTICE_FMT = `
|
|
9
|
+
\x1B[33m\u2191 Update available: v%s \u2192 v%s\x1B[0m Run \`wrongstack update\` to upgrade.
|
|
10
|
+
|
|
11
|
+
`;
|
|
12
|
+
var READY_FMT = `
|
|
13
|
+
\x1B[33m\u2191 v%s is downloaded\x1B[0m It replaces this executable when this session exits.
|
|
14
|
+
|
|
15
|
+
`;
|
|
16
|
+
var READY_MANUAL_FMT = `
|
|
17
|
+
\x1B[33m\u2191 v%s is downloaded\x1B[0m Run \`wrongstack update\` to install it.
|
|
18
|
+
|
|
19
|
+
`;
|
|
20
|
+
var APPLIED_FMT = `
|
|
21
|
+
\x1B[32m\u2713 Updated wrongstack v%s \u2192 v%s\x1B[0m
|
|
22
|
+
|
|
23
|
+
`;
|
|
24
|
+
async function printStandaloneUpdateNotice(info, config) {
|
|
25
|
+
const [{ autoUpdateEnabled, standaloneUpdater, takeAppliedUpdate }, { isNewer }, version] = await Promise.all([
|
|
26
|
+
import("./standalone-auto-update-TOTRGCSA.js"),
|
|
27
|
+
import("./update-check-J5ZVKS73.js"),
|
|
28
|
+
import("./version-JB2UAV2A.js")
|
|
29
|
+
]);
|
|
30
|
+
const applied = takeAppliedUpdate();
|
|
31
|
+
if (applied) writeErr(APPLIED_FMT.replace("%s", applied.from).replace("%s", applied.to));
|
|
32
|
+
const pending = standaloneUpdater({
|
|
33
|
+
executable: realpathSync(process.execPath),
|
|
34
|
+
target: version.STANDALONE_TARGET ?? "",
|
|
35
|
+
current: version.CLI_VERSION
|
|
36
|
+
}).pending();
|
|
37
|
+
if (pending && info && isNewer(pending.version, info.current) && pending.version === info.latest) {
|
|
38
|
+
const fmt = autoUpdateEnabled(config) ? READY_FMT : READY_MANUAL_FMT;
|
|
39
|
+
writeErr(fmt.replace("%s", pending.version));
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
async function printUpdateNotice(initialUpdateInfo, config) {
|
|
45
|
+
let info = initialUpdateInfo;
|
|
46
|
+
if (!info?.outdated) {
|
|
47
|
+
const ac = new AbortController();
|
|
48
|
+
const timer = setTimeout(() => ac.abort(), 2e3);
|
|
49
|
+
try {
|
|
50
|
+
const { checkForUpdate } = await import("./update-check-J5ZVKS73.js");
|
|
51
|
+
info = await checkForUpdate(ac.signal);
|
|
52
|
+
} catch {
|
|
53
|
+
} finally {
|
|
54
|
+
clearTimeout(timer);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
let reported = false;
|
|
58
|
+
if (isStandaloneBinary()) {
|
|
59
|
+
try {
|
|
60
|
+
reported = await printStandaloneUpdateNotice(info, config);
|
|
61
|
+
} catch {
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (info?.outdated && !reported) {
|
|
65
|
+
writeErr(NOTICE_FMT.replace("%s", info.current).replace("%s", info.latest));
|
|
66
|
+
}
|
|
67
|
+
return info;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// src/preflight.ts
|
|
71
|
+
function applyNodeEnvDefault() {
|
|
72
|
+
if (process.env["NODE_ENV"] === void 0) {
|
|
73
|
+
process.env["NODE_ENV"] = "production";
|
|
74
|
+
process.env["WRONGSTACK_NODE_ENV_DEFAULTED"] = "1";
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function applySessionShellDefault() {
|
|
78
|
+
ensureSessionShell();
|
|
79
|
+
}
|
|
80
|
+
async function applyPrintUpdateNotice(initialUpdateInfo, config) {
|
|
81
|
+
return await printUpdateNotice(initialUpdateInfo, config);
|
|
82
|
+
}
|
|
83
|
+
async function applyDebugStreamSeed(config) {
|
|
84
|
+
const { setDebugStreamEnabled } = await import("@wrongstack/providers");
|
|
85
|
+
if (config.debugStream) {
|
|
86
|
+
setDebugStreamEnabled(true);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async function runPreflight(config, initialUpdateInfo) {
|
|
90
|
+
applyNodeEnvDefault();
|
|
91
|
+
applySessionShellDefault();
|
|
92
|
+
const updateInfo = await applyPrintUpdateNotice(initialUpdateInfo, config);
|
|
93
|
+
await applyDebugStreamSeed(config);
|
|
94
|
+
return {
|
|
95
|
+
updateInfo,
|
|
96
|
+
debugStreamEnabled: Boolean(config.debugStream)
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export {
|
|
101
|
+
applyNodeEnvDefault,
|
|
102
|
+
applySessionShellDefault,
|
|
103
|
+
runPreflight
|
|
104
|
+
};
|
|
105
|
+
//# sourceMappingURL=chunk-LBPLTTZ6.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
activeProfileConfigPath
|
|
3
|
-
} from "./chunk-YMXXOOFN.js";
|
|
4
1
|
import {
|
|
5
2
|
mutateConfigProviders
|
|
6
3
|
} from "./chunk-LUMETJFO.js";
|
|
4
|
+
import {
|
|
5
|
+
activeProfileConfigPath
|
|
6
|
+
} from "./chunk-YMXXOOFN.js";
|
|
7
7
|
|
|
8
8
|
// src/wiring/provider-persisters.ts
|
|
9
9
|
import {
|
|
@@ -43,4 +43,4 @@ export {
|
|
|
43
43
|
installProviderPersisters,
|
|
44
44
|
applyProviderOAuthRefresh2 as applyProviderOAuthRefresh
|
|
45
45
|
};
|
|
46
|
-
//# sourceMappingURL=chunk-
|
|
46
|
+
//# sourceMappingURL=chunk-LDCGZJTC.js.map
|