@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
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
activeProfileConfigPath
|
|
3
3
|
} from "./chunk-YMXXOOFN.js";
|
|
4
|
+
import {
|
|
5
|
+
restoreFlags
|
|
6
|
+
} from "./chunk-CSAPOCBP.js";
|
|
4
7
|
import {
|
|
5
8
|
backupCurrent,
|
|
6
9
|
getHistoryEntry,
|
|
@@ -8,11 +11,9 @@ import {
|
|
|
8
11
|
restoreFromHistory,
|
|
9
12
|
restoreLast
|
|
10
13
|
} from "./chunk-WSTVGC2C.js";
|
|
11
|
-
import {
|
|
12
|
-
restoreFlags
|
|
13
|
-
} from "./chunk-CSAPOCBP.js";
|
|
14
14
|
|
|
15
15
|
// src/subcommands/handlers/sessions-config.ts
|
|
16
|
+
import * as path2 from "node:path";
|
|
16
17
|
import { color as color2, expectDefined } from "@wrongstack/core/utils";
|
|
17
18
|
|
|
18
19
|
// src/subcommands/handlers/helpers.ts
|
|
@@ -32,6 +33,40 @@ function redactKeys(obj) {
|
|
|
32
33
|
import * as fsp from "node:fs/promises";
|
|
33
34
|
import * as path from "node:path";
|
|
34
35
|
import { color } from "@wrongstack/core/utils";
|
|
36
|
+
var STORE_SIDECAR_JSONL_NAMES = /* @__PURE__ */ new Set(["_index.jsonl", "_mailbox.jsonl"]);
|
|
37
|
+
var SESSION_SIDECAR_JSONL_SUFFIXES = [".replay.jsonl", ".audit.jsonl", ".annotations.jsonl"];
|
|
38
|
+
function isSubagentTranscriptFile(name) {
|
|
39
|
+
const lower = name.toLowerCase();
|
|
40
|
+
if (!lower.endsWith(".jsonl")) return false;
|
|
41
|
+
if (STORE_SIDECAR_JSONL_NAMES.has(lower)) return false;
|
|
42
|
+
return !SESSION_SIDECAR_JSONL_SUFFIXES.some((suffix) => lower.endsWith(suffix));
|
|
43
|
+
}
|
|
44
|
+
async function collectSubagentTranscripts(subagentsDir) {
|
|
45
|
+
let entries;
|
|
46
|
+
try {
|
|
47
|
+
entries = await fsp.readdir(subagentsDir, { withFileTypes: true });
|
|
48
|
+
} catch {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
const out = [];
|
|
52
|
+
for (const entry of entries) {
|
|
53
|
+
if (entry.isFile()) {
|
|
54
|
+
if (isSubagentTranscriptFile(entry.name)) out.push(entry.name);
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (!entry.isDirectory() || entry.name === "transcripts" || entry.name === "shared") continue;
|
|
58
|
+
let nested;
|
|
59
|
+
try {
|
|
60
|
+
nested = await fsp.readdir(path.join(subagentsDir, entry.name));
|
|
61
|
+
} catch {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
for (const name of nested) {
|
|
65
|
+
if (isSubagentTranscriptFile(name)) out.push(`${entry.name}/${name}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return out;
|
|
69
|
+
}
|
|
35
70
|
var sessionsFleetCmd = async (args, deps) => {
|
|
36
71
|
const runId = args.find((a) => !a.startsWith("-"));
|
|
37
72
|
if (runId) {
|
|
@@ -39,10 +74,46 @@ var sessionsFleetCmd = async (args, deps) => {
|
|
|
39
74
|
}
|
|
40
75
|
return listFleetRuns(deps);
|
|
41
76
|
};
|
|
77
|
+
async function hasFleetRunArtifacts(dir) {
|
|
78
|
+
const markers = await Promise.all(
|
|
79
|
+
["fleet.json", "checkpoint.json", "subagents"].map(
|
|
80
|
+
(name) => fsp.access(path.join(dir, name)).then(
|
|
81
|
+
() => true,
|
|
82
|
+
() => false
|
|
83
|
+
)
|
|
84
|
+
)
|
|
85
|
+
);
|
|
86
|
+
return markers.some((found) => found);
|
|
87
|
+
}
|
|
88
|
+
async function discoverFleetRunIds(projectSessions) {
|
|
89
|
+
const entries = await fsp.readdir(projectSessions, { withFileTypes: true });
|
|
90
|
+
const ids = [];
|
|
91
|
+
for (const entry of entries) {
|
|
92
|
+
if (!entry.isDirectory()) continue;
|
|
93
|
+
const dir = path.join(projectSessions, entry.name);
|
|
94
|
+
if (await hasFleetRunArtifacts(dir)) {
|
|
95
|
+
ids.push(entry.name);
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
let children;
|
|
99
|
+
try {
|
|
100
|
+
children = await fsp.readdir(dir, { withFileTypes: true });
|
|
101
|
+
} catch {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
for (const child of children) {
|
|
105
|
+
if (!child.isDirectory()) continue;
|
|
106
|
+
if (await hasFleetRunArtifacts(path.join(dir, child.name))) {
|
|
107
|
+
ids.push(`${entry.name}/${child.name}`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return ids;
|
|
112
|
+
}
|
|
42
113
|
async function listFleetRuns(deps) {
|
|
43
114
|
let entries = [];
|
|
44
115
|
try {
|
|
45
|
-
entries = await
|
|
116
|
+
entries = await discoverFleetRunIds(deps.paths.projectSessions);
|
|
46
117
|
} catch {
|
|
47
118
|
deps.renderer.writeError(`Cannot read projectSessions: ${deps.paths.projectSessions}
|
|
48
119
|
`);
|
|
@@ -68,8 +139,8 @@ async function listFleetRuns(deps) {
|
|
|
68
139
|
() => true,
|
|
69
140
|
() => false
|
|
70
141
|
),
|
|
71
|
-
|
|
72
|
-
(files) => files.
|
|
142
|
+
collectSubagentTranscripts(path.join(runDir, "subagents")).then(
|
|
143
|
+
(files) => files.length,
|
|
73
144
|
() => 0
|
|
74
145
|
)
|
|
75
146
|
]);
|
|
@@ -188,8 +259,7 @@ Fleet Run: ${runId}
|
|
|
188
259
|
const subagentsDir = path.join(runDir, "subagents");
|
|
189
260
|
let subagentFiles = [];
|
|
190
261
|
try {
|
|
191
|
-
subagentFiles = await
|
|
192
|
-
subagentFiles = subagentFiles.filter((f) => f.endsWith(".jsonl"));
|
|
262
|
+
subagentFiles = await collectSubagentTranscripts(subagentsDir);
|
|
193
263
|
} catch {
|
|
194
264
|
}
|
|
195
265
|
if (subagentFiles.length > 0) {
|
|
@@ -296,6 +366,35 @@ var sessionsCmd = async (args, deps) => {
|
|
|
296
366
|
} catch (err) {
|
|
297
367
|
deps.renderer.writeError(
|
|
298
368
|
`Fork failed: ${err instanceof Error ? err.message : String(err)}
|
|
369
|
+
`
|
|
370
|
+
);
|
|
371
|
+
return 1;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
if (sub === "move") {
|
|
375
|
+
const moveArgs = args.slice(1);
|
|
376
|
+
const sessionId = moveArgs[0] && !moveArgs[0].startsWith("-") ? moveArgs[0] : void 0;
|
|
377
|
+
const targetPath = extractArg(moveArgs, "--to");
|
|
378
|
+
if (!sessionId || !targetPath) {
|
|
379
|
+
deps.renderer.writeError(
|
|
380
|
+
"Usage: wstack sessions move <id> --to <project or worktree path>\n"
|
|
381
|
+
);
|
|
382
|
+
return 1;
|
|
383
|
+
}
|
|
384
|
+
try {
|
|
385
|
+
const { moveSessionTo, describeSessionMove } = await import("./session-move-P2EC2COA.js");
|
|
386
|
+
const result = await moveSessionTo({
|
|
387
|
+
store: deps.sessionStore,
|
|
388
|
+
sessionId,
|
|
389
|
+
targetPath: path2.resolve(deps.cwd, targetPath),
|
|
390
|
+
globalRoot: deps.paths.globalRoot
|
|
391
|
+
});
|
|
392
|
+
deps.renderer.write(`${describeSessionMove(result)}
|
|
393
|
+
`);
|
|
394
|
+
return 0;
|
|
395
|
+
} catch (err) {
|
|
396
|
+
deps.renderer.writeError(
|
|
397
|
+
`Move failed: ${err instanceof Error ? err.message : String(err)}
|
|
299
398
|
`
|
|
300
399
|
);
|
|
301
400
|
return 1;
|
|
@@ -308,7 +407,7 @@ var sessionsCmd = async (args, deps) => {
|
|
|
308
407
|
}
|
|
309
408
|
for (const s of list)
|
|
310
409
|
deps.renderer.write(
|
|
311
|
-
` ${s.id} ${color2.dim(s.startedAt)} ${color2.dim(`${s.tokenTotal} tok`)} ${s.title}
|
|
410
|
+
` ${s.id} ${color2.dim(s.startedAt)} ${color2.dim(`${s.tokenTotal} tok`)} ${s.name ? `${color2.cyan(s.name)} ${color2.dim(s.title)}` : s.title}
|
|
312
411
|
`
|
|
313
412
|
);
|
|
314
413
|
return 0;
|
|
@@ -426,4 +525,4 @@ export {
|
|
|
426
525
|
configCmd,
|
|
427
526
|
sessionsCmd
|
|
428
527
|
};
|
|
429
|
-
//# sourceMappingURL=sessions-config-
|
|
528
|
+
//# sourceMappingURL=sessions-config-XHLXJ5C3.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
handleHelpVersionShortCircuit
|
|
3
|
+
} from "./chunk-HFZH2XJN.js";
|
|
4
|
+
import "./chunk-5JYDKG5B.js";
|
|
5
|
+
import "./chunk-F5DCFAKI.js";
|
|
6
|
+
import "./chunk-Q4INH2DG.js";
|
|
7
|
+
export {
|
|
8
|
+
handleHelpVersionShortCircuit
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=short-circuit-flags-5TNTJPQR.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Context } from '@wrongstack/core/agent';
|
|
2
2
|
import type { EventBus } from '@wrongstack/core/kernel';
|
|
3
3
|
import type { SlashCommandRegistry, ToolRegistry } from '@wrongstack/core/registry';
|
|
4
|
-
import type { CompactReport, HealthRegistry, MemoryPort, MetricsRuntimeStatus, MetricsSink, ModeStore, Renderer, SessionStore, SkillLoader, TokenCounter } from '@wrongstack/core/types';
|
|
4
|
+
import type { CompactOptions, CompactReport, HealthRegistry, MemoryPort, MetricsRuntimeStatus, MetricsSink, ModeStore, PermissionPolicy, Renderer, SessionStore, SkillLoader, TokenCounter } from '@wrongstack/core/types';
|
|
5
5
|
import type { WstackPaths } from '@wrongstack/core/utils';
|
|
6
6
|
import type { SummarizerPort } from '@wrongstack/tools';
|
|
7
7
|
import type { VectorMemoryStore } from '@wrongstack/vector-memory';
|
|
@@ -9,6 +9,12 @@ import type { VectorMemoryStore } from '@wrongstack/vector-memory';
|
|
|
9
9
|
export interface SlashCommandContext {
|
|
10
10
|
registry: SlashCommandRegistry;
|
|
11
11
|
toolRegistry: ToolRegistry;
|
|
12
|
+
/**
|
|
13
|
+
* The agent's permission policy: `/permissions rules|explain` read it, and
|
|
14
|
+
* it reads each session's `/permissions allow|deny` rules from that
|
|
15
|
+
* session's context.
|
|
16
|
+
*/
|
|
17
|
+
permissionPolicy?: PermissionPolicy | undefined;
|
|
12
18
|
/** Run one tool through the active ToolExecutor and its permission policy. */
|
|
13
19
|
executeTool?: ((name: string, input: Record<string, unknown>, ctx: Context) => Promise<{
|
|
14
20
|
detail: string;
|
|
@@ -19,9 +25,7 @@ export interface SlashCommandContext {
|
|
|
19
25
|
/** Explicit legacy SDD session codec for compatibility tests/old hosts. */
|
|
20
26
|
sddSessionTransport?: 'kanban' | 'legacy-file' | undefined;
|
|
21
27
|
compactor?: {
|
|
22
|
-
compact(ctx: Context, opts?:
|
|
23
|
-
aggressive?: boolean | undefined;
|
|
24
|
-
}): Promise<CompactReport>;
|
|
28
|
+
compact(ctx: Context, opts?: CompactOptions): Promise<CompactReport>;
|
|
25
29
|
};
|
|
26
30
|
sessionStore?: SessionStore | undefined;
|
|
27
31
|
skillLoader?: SkillLoader | undefined;
|
|
@@ -536,7 +540,13 @@ export interface SlashCommandContext {
|
|
|
536
540
|
* Resume a persisted PhaseGraph. The host creates a new orchestrator for
|
|
537
541
|
* the loaded graph and starts executing pending tasks.
|
|
538
542
|
*/
|
|
539
|
-
onGoalResumeFromGraph?: ((graph: import('@wrongstack/core/goal').PhaseGraph) => Promise<
|
|
543
|
+
onGoalResumeFromGraph?: ((graph: import('@wrongstack/core/goal').PhaseGraph) => Promise<{
|
|
544
|
+
ok: true;
|
|
545
|
+
graph: import('@wrongstack/core/goal').PhaseGraph;
|
|
546
|
+
} | {
|
|
547
|
+
ok: false;
|
|
548
|
+
error: string;
|
|
549
|
+
}>) | undefined;
|
|
540
550
|
/** Live, read-only view of the running Goal (null when idle). */
|
|
541
551
|
getGoalRunner?: () => {
|
|
542
552
|
graph: import('@wrongstack/core/goal').PhaseGraph;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import type { OneShotOrchestrator } from '@wrongstack/core/execution';
|
|
2
|
-
import
|
|
2
|
+
import { type RefinedMission } from '@wrongstack/core/goal';
|
|
3
|
+
import type { Provider } from '@wrongstack/core/types';
|
|
4
|
+
export { refineGoalHeuristic, resolveRefinerTarget } from '@wrongstack/core/goal';
|
|
3
5
|
/**
|
|
4
6
|
* Result of refining a user's raw goal into a clear, actionable mission.
|
|
5
7
|
*/
|
|
6
|
-
|
|
7
|
-
/** Unambiguous, detailed goal statement. */
|
|
8
|
-
refinedGoal: string;
|
|
9
|
-
/** Concrete, verifiable deliverables (one per entry). */
|
|
10
|
-
deliverables: string[];
|
|
11
|
-
}
|
|
8
|
+
type RefinedGoal = RefinedMission;
|
|
12
9
|
/**
|
|
13
10
|
* Options for goal refinement with fallback tiers.
|
|
14
11
|
*/
|
|
@@ -31,42 +28,6 @@ interface GoalRefinerOptions {
|
|
|
31
28
|
*/
|
|
32
29
|
oneShotOrchestrator?: OneShotOrchestrator | undefined;
|
|
33
30
|
}
|
|
34
|
-
/**
|
|
35
|
-
* Resolved refiner target after validating against available providers,
|
|
36
|
-
* favorite models, and the currently active session model.
|
|
37
|
-
* Both `provider` and `model` are defined when a viable dedicated refiner
|
|
38
|
-
* is found; otherwise the caller should use the primary session defaults.
|
|
39
|
-
*/
|
|
40
|
-
interface ResolvedRefinerTarget {
|
|
41
|
-
/** Resolved provider instance, ready for `provider.complete()`. */
|
|
42
|
-
provider: Provider;
|
|
43
|
-
/** Resolved model id on that provider. */
|
|
44
|
-
model: string;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Validate and resolve a dedicated refiner provider+model from the user
|
|
48
|
-
* config. Returns undefined when:
|
|
49
|
-
* - refinerFallbackProfile resolves to a valid profile entry (tried first)
|
|
50
|
-
* - Neither refinerProvider nor refinerModel is configured
|
|
51
|
-
* - The configured provider is unavailable (createProvider returns
|
|
52
|
-
* undefined, meaning the provider doesn't exist or has no credentials)
|
|
53
|
-
* - The configured model is not a favorite model AND is not the
|
|
54
|
-
* currently active session model
|
|
55
|
-
*
|
|
56
|
-
* Precedence (first wins):
|
|
57
|
-
* 1. refinerFallbackProfile → first valid entry from the named profile chain
|
|
58
|
-
* 2. refinerProvider + refinerModel (both set)
|
|
59
|
-
* 3. refinerModel on the active session provider
|
|
60
|
-
*
|
|
61
|
-
* When only `refinerModel` is set (no provider), the model is used on
|
|
62
|
-
* the active session provider — validated against the same constraints.
|
|
63
|
-
*
|
|
64
|
-
* @param cfg — live Config from configStore
|
|
65
|
-
* @param createProvider— factory: providerId → Provider | undefined
|
|
66
|
-
* @param activeProviderId — the session's active provider id (config.provider)
|
|
67
|
-
* @param activeModel — the session's active model (config.model)
|
|
68
|
-
*/
|
|
69
|
-
export declare function resolveRefinerTarget(cfg: Config, createProvider: ((providerId: string) => Provider | undefined) | undefined, activeProviderId: string, activeModel: string): ResolvedRefinerTarget | undefined;
|
|
70
31
|
/**
|
|
71
32
|
* Refine a raw goal using the best available model/provider, with a
|
|
72
33
|
* four-tier fallback chain:
|
|
@@ -85,10 +46,4 @@ export declare function refineGoalWithFallback(rawGoal: string, opts: GoalRefine
|
|
|
85
46
|
* or the call fails.
|
|
86
47
|
*/
|
|
87
48
|
export declare function refineGoal(rawGoal: string, provider: Provider, model: string, oneShotOrchestrator?: OneShotOrchestrator | undefined): Promise<RefinedGoal | null>;
|
|
88
|
-
/**
|
|
89
|
-
* Heuristic-only refinement — used when no LLM is available.
|
|
90
|
-
* Produces a basic structure from the raw goal.
|
|
91
|
-
*/
|
|
92
|
-
export declare function refineGoalHeuristic(rawGoal: string): RefinedGoal;
|
|
93
|
-
export {};
|
|
94
49
|
//# sourceMappingURL=goal-refiner.d.ts.map
|
|
@@ -18,7 +18,8 @@ export { parseMcpArgs, runMcpManagementCommand } from '../services/mcp-managemen
|
|
|
18
18
|
* /mcp prompts <name> — discover cached/live prompts
|
|
19
19
|
* /mcp read <name> <uri> — explicitly insert a selected resource
|
|
20
20
|
* /mcp get <name> <prompt> [key=value...] — explicitly insert a selected prompt
|
|
21
|
-
* /mcp auth
|
|
21
|
+
* /mcp auth login <name> [--client-id <id>] [--port <n>] [scopes...] — one-step OAuth
|
|
22
|
+
* /mcp auth start <name> --redirect-uri <url> [--client-id <id>] [scopes...] — manual OAuth
|
|
22
23
|
* /mcp auth complete <name> <callback-url> — finish OAuth from a callback URL
|
|
23
24
|
* /mcp auth status <name> — show non-secret authorization state
|
|
24
25
|
* /mcp auth logout <name> — remove stored OAuth credentials
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { persistConfigSetting } from '../settings-menu.js';
|
|
2
|
+
export declare function executeContextSettings(sub: string, rest: string[], persistDeps: Parameters<typeof persistConfigSetting>[0]): Promise<{
|
|
3
|
+
message: string;
|
|
4
|
+
} | undefined>;
|
|
5
|
+
//# sourceMappingURL=settings-context-mutations.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type LimitsConfig } from '@wrongstack/core/types';
|
|
2
|
+
import { persistConfigSetting } from '../settings-menu.js';
|
|
3
|
+
/** Render `/settings limits` — every limit, whether the user set it, and its range. */
|
|
4
|
+
export declare function renderLimitsView(limits: LimitsConfig | undefined): string;
|
|
5
|
+
/**
|
|
6
|
+
* `/settings limits [<name> <n|off>]`. Limits are user config only (denied to
|
|
7
|
+
* in-project config), so writes always go to the active profile.
|
|
8
|
+
*/
|
|
9
|
+
export declare function executeLimitsSettings(sub: string, rest: string[], persistDeps: Parameters<typeof persistConfigSetting>[0], current: LimitsConfig | undefined): Promise<{
|
|
10
|
+
message: string;
|
|
11
|
+
} | undefined>;
|
|
12
|
+
//# sourceMappingURL=settings-limits-mutations.d.ts.map
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
import type { InputReader, SlashCommand } from '@wrongstack/core/types';
|
|
1
|
+
import type { InputReader, SlashCommand, ThemePresetId } from '@wrongstack/core/types';
|
|
2
2
|
import type { SlashCommandContext } from './command-context.js';
|
|
3
|
+
interface ThemeOption {
|
|
4
|
+
id: ThemePresetId;
|
|
5
|
+
name: string;
|
|
6
|
+
desc: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The CLI's picker rows, exported for the TUI↔CLI agreement test
|
|
10
|
+
* (`packages/cli/tests/theme-metadata-agreement.test.ts`). The TUI derives its
|
|
11
|
+
* own rows from the same `THEME_PRESET_META` record, so this export is the
|
|
12
|
+
* second side of that comparison — it must stay in step with `THEME_OPTIONS`
|
|
13
|
+
* above.
|
|
14
|
+
*/
|
|
15
|
+
export declare const cliThemePickerOptions: readonly ThemeOption[];
|
|
3
16
|
/**
|
|
4
17
|
* Windowed slice of the theme list for the raw-terminal picker — mirrors the
|
|
5
18
|
* math in the TUI's `useWindowedPicker` (same centering + marker rules) so
|
|
@@ -35,4 +48,5 @@ export declare function truncateDesc(desc: string, columns: number, active: bool
|
|
|
35
48
|
export declare function buildThemeCommand(opts: SlashCommandContext & {
|
|
36
49
|
inputReader?: InputReader | undefined;
|
|
37
50
|
}): SlashCommand;
|
|
51
|
+
export {};
|
|
38
52
|
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MAX_BINARY_BYTES,
|
|
3
|
+
downloadReleaseAssetToFile,
|
|
4
|
+
findStandaloneRelease,
|
|
5
|
+
installExecutableFrom,
|
|
6
|
+
verifyStandaloneDigest
|
|
7
|
+
} from "./chunk-X756ZS72.js";
|
|
8
|
+
import {
|
|
9
|
+
isNewer
|
|
10
|
+
} from "./chunk-RZ4ZDRYA.js";
|
|
11
|
+
import {
|
|
12
|
+
CLI_VERSION,
|
|
13
|
+
STANDALONE_TARGET
|
|
14
|
+
} from "./chunk-F5DCFAKI.js";
|
|
15
|
+
|
|
16
|
+
// src/standalone-auto-update.ts
|
|
17
|
+
import { randomBytes } from "node:crypto";
|
|
18
|
+
import * as fs from "node:fs";
|
|
19
|
+
import * as path from "node:path";
|
|
20
|
+
import { isStandaloneBinary, wstackGlobalRoot } from "@wrongstack/core/utils";
|
|
21
|
+
var PENDING_FILE = "pending.json";
|
|
22
|
+
var APPLIED_FILE = "last-applied.json";
|
|
23
|
+
var LOCK_FILE = "update.lock";
|
|
24
|
+
var LOCK_STALE_MS = 45 * 6e4;
|
|
25
|
+
var DOWNLOAD_TIMEOUT_MS = 30 * 6e4;
|
|
26
|
+
function updatesDir(root = wstackGlobalRoot()) {
|
|
27
|
+
return path.join(root, "updates");
|
|
28
|
+
}
|
|
29
|
+
function autoUpdateEnabled(config, env = process.env) {
|
|
30
|
+
const off = env["WRONGSTACK_NO_AUTO_UPDATE"];
|
|
31
|
+
if (off !== void 0 && off !== "" && off !== "0") return false;
|
|
32
|
+
return config?.update?.autoDownload !== false;
|
|
33
|
+
}
|
|
34
|
+
function readPendingUpdate(dir = updatesDir()) {
|
|
35
|
+
let raw;
|
|
36
|
+
try {
|
|
37
|
+
raw = JSON.parse(fs.readFileSync(path.join(dir, PENDING_FILE), "utf8"));
|
|
38
|
+
} catch {
|
|
39
|
+
return void 0;
|
|
40
|
+
}
|
|
41
|
+
const p = raw;
|
|
42
|
+
if (!p || typeof p.version !== "string" || typeof p.file !== "string" || typeof p.sha256 !== "string" || !/^[0-9a-f]{64}$/.test(p.sha256) || typeof p.target !== "string" || typeof p.executable !== "string" || // Only ever install from the staging directory itself.
|
|
43
|
+
path.dirname(path.resolve(p.file)) !== path.resolve(dir) || !fs.existsSync(p.file)) {
|
|
44
|
+
return void 0;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
version: p.version,
|
|
48
|
+
file: p.file,
|
|
49
|
+
sha256: p.sha256,
|
|
50
|
+
target: p.target,
|
|
51
|
+
executable: p.executable,
|
|
52
|
+
stagedAt: typeof p.stagedAt === "string" ? p.stagedAt : ""
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function discardPending(dir, pending) {
|
|
56
|
+
fs.rmSync(path.join(dir, PENDING_FILE), { force: true });
|
|
57
|
+
if (pending) fs.rmSync(pending.file, { force: true });
|
|
58
|
+
}
|
|
59
|
+
function writeJsonAtomic(file, value) {
|
|
60
|
+
const tmp = `${file}.${randomBytes(6).toString("hex")}.tmp`;
|
|
61
|
+
fs.writeFileSync(tmp, `${JSON.stringify(value, null, 2)}
|
|
62
|
+
`, { mode: 384, flag: "wx" });
|
|
63
|
+
fs.renameSync(tmp, file);
|
|
64
|
+
}
|
|
65
|
+
function pidAlive(pid) {
|
|
66
|
+
try {
|
|
67
|
+
process.kill(pid, 0);
|
|
68
|
+
return true;
|
|
69
|
+
} catch (err) {
|
|
70
|
+
return err.code === "EPERM";
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function acquireLock(dir) {
|
|
74
|
+
const lock = path.join(dir, LOCK_FILE);
|
|
75
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
76
|
+
try {
|
|
77
|
+
fs.writeFileSync(lock, JSON.stringify({ pid: process.pid, at: Date.now() }), { flag: "wx" });
|
|
78
|
+
return () => fs.rmSync(lock, { force: true });
|
|
79
|
+
} catch (err) {
|
|
80
|
+
if (err.code !== "EEXIST") throw err;
|
|
81
|
+
let owner = {};
|
|
82
|
+
try {
|
|
83
|
+
owner = JSON.parse(fs.readFileSync(lock, "utf8"));
|
|
84
|
+
} catch {
|
|
85
|
+
}
|
|
86
|
+
const fresh = typeof owner.pid === "number" && pidAlive(owner.pid) && typeof owner.at === "number" && Date.now() - owner.at < LOCK_STALE_MS;
|
|
87
|
+
if (fresh) return void 0;
|
|
88
|
+
fs.rmSync(lock, { force: true });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return void 0;
|
|
92
|
+
}
|
|
93
|
+
function applyPending(install, platform) {
|
|
94
|
+
const { dir, current, executable } = install;
|
|
95
|
+
const pending = readPendingUpdate(dir);
|
|
96
|
+
if (!pending) return void 0;
|
|
97
|
+
if (!isNewer(pending.version, current)) {
|
|
98
|
+
discardPending(dir, pending);
|
|
99
|
+
return void 0;
|
|
100
|
+
}
|
|
101
|
+
if (pending.executable !== executable) return void 0;
|
|
102
|
+
const release = acquireLock(dir);
|
|
103
|
+
if (!release) return void 0;
|
|
104
|
+
try {
|
|
105
|
+
try {
|
|
106
|
+
installExecutableFrom(executable, pending.file, pending.sha256, platform);
|
|
107
|
+
} catch (err) {
|
|
108
|
+
if (/does not match its digest/.test(String(err))) discardPending(dir, pending);
|
|
109
|
+
throw err;
|
|
110
|
+
}
|
|
111
|
+
discardPending(dir, pending);
|
|
112
|
+
writeJsonAtomic(path.join(dir, APPLIED_FILE), {
|
|
113
|
+
from: current,
|
|
114
|
+
to: pending.version,
|
|
115
|
+
at: (/* @__PURE__ */ new Date()).toISOString()
|
|
116
|
+
});
|
|
117
|
+
return pending.version;
|
|
118
|
+
} finally {
|
|
119
|
+
release();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function takeAppliedUpdate(dir = updatesDir()) {
|
|
123
|
+
const file = path.join(dir, APPLIED_FILE);
|
|
124
|
+
try {
|
|
125
|
+
const raw = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
126
|
+
fs.rmSync(file, { force: true });
|
|
127
|
+
if (typeof raw.from === "string" && typeof raw.to === "string") {
|
|
128
|
+
return { from: raw.from, to: raw.to };
|
|
129
|
+
}
|
|
130
|
+
} catch {
|
|
131
|
+
}
|
|
132
|
+
return void 0;
|
|
133
|
+
}
|
|
134
|
+
async function stageLatest(install, signal) {
|
|
135
|
+
const { dir } = install;
|
|
136
|
+
const release = await findStandaloneRelease(install.target, signal);
|
|
137
|
+
if (!isNewer(release.version, install.current)) return void 0;
|
|
138
|
+
const already = readPendingUpdate(dir);
|
|
139
|
+
if (already?.version === release.version && already.target === install.target && already.executable === install.executable) {
|
|
140
|
+
return already;
|
|
141
|
+
}
|
|
142
|
+
fs.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
143
|
+
const unlock = acquireLock(dir);
|
|
144
|
+
if (!unlock) return void 0;
|
|
145
|
+
const partial = path.join(dir, `.partial-${randomBytes(9).toString("hex")}`);
|
|
146
|
+
try {
|
|
147
|
+
const sha256 = await downloadReleaseAssetToFile(release.asset.browser_download_url, partial, {
|
|
148
|
+
timeoutMs: DOWNLOAD_TIMEOUT_MS,
|
|
149
|
+
maxBytes: MAX_BINARY_BYTES,
|
|
150
|
+
signal
|
|
151
|
+
});
|
|
152
|
+
await verifyStandaloneDigest(release, sha256, signal);
|
|
153
|
+
const file = path.join(dir, `${release.version}-${release.assetName}`);
|
|
154
|
+
fs.rmSync(file, { force: true });
|
|
155
|
+
fs.renameSync(partial, file);
|
|
156
|
+
const pending = {
|
|
157
|
+
version: release.version,
|
|
158
|
+
file,
|
|
159
|
+
sha256,
|
|
160
|
+
target: install.target,
|
|
161
|
+
executable: install.executable,
|
|
162
|
+
stagedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
163
|
+
};
|
|
164
|
+
writeJsonAtomic(path.join(dir, PENDING_FILE), pending);
|
|
165
|
+
for (const name of fs.readdirSync(dir)) {
|
|
166
|
+
const keep = [PENDING_FILE, APPLIED_FILE, LOCK_FILE, path.basename(file)];
|
|
167
|
+
if (!keep.includes(name)) fs.rmSync(path.join(dir, name), { force: true, recursive: true });
|
|
168
|
+
}
|
|
169
|
+
return pending;
|
|
170
|
+
} finally {
|
|
171
|
+
fs.rmSync(partial, { force: true });
|
|
172
|
+
unlock();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function standaloneUpdater(install) {
|
|
176
|
+
const bound = { ...install, dir: install.dir ?? updatesDir() };
|
|
177
|
+
const pending = () => {
|
|
178
|
+
const found = readPendingUpdate(bound.dir);
|
|
179
|
+
return found?.executable === bound.executable ? found : void 0;
|
|
180
|
+
};
|
|
181
|
+
return {
|
|
182
|
+
pending,
|
|
183
|
+
stage: (signal) => stageLatest(bound, signal),
|
|
184
|
+
apply: (platform) => applyPending(bound, platform),
|
|
185
|
+
clear: () => {
|
|
186
|
+
const found = pending();
|
|
187
|
+
if (found) discardPending(bound.dir, found);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function startStandaloneAutoUpdate(options) {
|
|
192
|
+
if (!isStandaloneBinary() || !STANDALONE_TARGET) return void 0;
|
|
193
|
+
if (!autoUpdateEnabled(options.getConfig())) return void 0;
|
|
194
|
+
let updater;
|
|
195
|
+
try {
|
|
196
|
+
updater = standaloneUpdater({
|
|
197
|
+
executable: fs.realpathSync(process.execPath),
|
|
198
|
+
target: STANDALONE_TARGET,
|
|
199
|
+
current: CLI_VERSION
|
|
200
|
+
});
|
|
201
|
+
} catch {
|
|
202
|
+
return void 0;
|
|
203
|
+
}
|
|
204
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
205
|
+
let ready;
|
|
206
|
+
const markReady = (version) => {
|
|
207
|
+
ready = version;
|
|
208
|
+
for (const listener of listeners) listener(version);
|
|
209
|
+
};
|
|
210
|
+
process.once("exit", () => {
|
|
211
|
+
if (!autoUpdateEnabled(options.getConfig())) return;
|
|
212
|
+
try {
|
|
213
|
+
updater.apply();
|
|
214
|
+
} catch {
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
const found = updater.pending();
|
|
218
|
+
const pending = found && isNewer(found.version, CLI_VERSION) ? found : void 0;
|
|
219
|
+
const latest = options.updateInfo?.outdated ? options.updateInfo.latest : void 0;
|
|
220
|
+
const controller = new AbortController();
|
|
221
|
+
if (pending && (latest === void 0 || !isNewer(latest, pending.version))) {
|
|
222
|
+
ready = pending.version;
|
|
223
|
+
} else if (latest !== void 0) {
|
|
224
|
+
void updater.stage(controller.signal).then((staged) => {
|
|
225
|
+
if (staged) markReady(staged.version);
|
|
226
|
+
}).catch((err) => {
|
|
227
|
+
if (controller.signal.aborted) return;
|
|
228
|
+
options.onError?.(err instanceof Error ? err.message : String(err));
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
return {
|
|
232
|
+
subscribe(listener) {
|
|
233
|
+
listeners.add(listener);
|
|
234
|
+
if (ready) listener(ready);
|
|
235
|
+
return () => listeners.delete(listener);
|
|
236
|
+
},
|
|
237
|
+
dispose() {
|
|
238
|
+
controller.abort();
|
|
239
|
+
listeners.clear();
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
export {
|
|
244
|
+
autoUpdateEnabled,
|
|
245
|
+
standaloneUpdater,
|
|
246
|
+
startStandaloneAutoUpdate,
|
|
247
|
+
takeAppliedUpdate
|
|
248
|
+
};
|
|
249
|
+
//# sourceMappingURL=standalone-auto-update-TOTRGCSA.js.map
|