litmus-cli 1.4.98 → 1.5.0-beta.2
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/README.md +4 -2
- package/dist/commands/connect.d.ts +2 -0
- package/dist/commands/connect.d.ts.map +1 -1
- package/dist/commands/connect.js +1 -1
- package/dist/commands/connect.js.map +1 -1
- package/dist/index.js +10 -232
- package/dist/index.js.map +1 -1
- package/dist/lib/environment-checks.d.ts +1 -3
- package/dist/lib/environment-checks.d.ts.map +1 -1
- package/dist/lib/environment-checks.js +2 -16
- package/dist/lib/environment-checks.js.map +1 -1
- package/dist/lib/hook-logger.cjs +11 -0
- package/dist/lib/hosted-capture.d.ts +4 -2
- package/dist/lib/hosted-capture.d.ts.map +1 -1
- package/dist/lib/hosted-capture.js +63 -12
- package/dist/lib/hosted-capture.js.map +1 -1
- package/dist/lib/node-version.d.ts +8 -0
- package/dist/lib/node-version.d.ts.map +1 -0
- package/dist/lib/node-version.js +23 -0
- package/dist/lib/node-version.js.map +1 -0
- package/dist/lib/portal-launcher.d.ts.map +1 -1
- package/dist/lib/portal-launcher.js +6 -1
- package/dist/lib/portal-launcher.js.map +1 -1
- package/dist/program.d.ts +2 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +236 -0
- package/dist/program.js.map +1 -0
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,236 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import { runSubmit } from "./commands/submit.js";
|
|
11
|
-
import { runPause } from "./commands/pause.js";
|
|
12
|
-
import { runStatus } from "./commands/status.js";
|
|
13
|
-
import { runDoctor } from "./commands/doctor.js";
|
|
14
|
-
import { runSetupCheck } from "./commands/setup-check.js";
|
|
15
|
-
import { runEnv } from "./commands/env.js";
|
|
16
|
-
import { FatalError } from "./lib/errors.js";
|
|
17
|
-
import { CLI_VERSION } from "./lib/version.js";
|
|
18
|
-
import { checkNodeVersion } from "./lib/environment-checks.js";
|
|
19
|
-
import { MISSING_TOKEN_HELP, readTokenArgument } from "./lib/workspace-token.js";
|
|
20
|
-
/**
|
|
21
|
-
* The token for a command that takes one (ENG-3035): the argument, `-` for
|
|
22
|
-
* stdin, or LITMUS_ASSESSMENT_TOKEN. Exits with the help line when none is given.
|
|
23
|
-
*/
|
|
24
|
-
async function tokenOrExit(arg) {
|
|
25
|
-
const token = await readTokenArgument(arg);
|
|
26
|
-
if (!token) {
|
|
27
|
-
console.error(MISSING_TOKEN_HELP);
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
return token;
|
|
2
|
+
import { checkNodeVersion } from "./lib/node-version.js";
|
|
3
|
+
// Keep the runtime check ahead of Commander and every command import. Commander 15
|
|
4
|
+
// requires Node 22.12+, and this package promises Node 24+, so an older candidate
|
|
5
|
+
// gets an actionable message instead of an ESM loader failure.
|
|
6
|
+
const node = checkNodeVersion();
|
|
7
|
+
if (node.status === "fail") {
|
|
8
|
+
console.error(node.detail);
|
|
9
|
+
process.exitCode = 1;
|
|
31
10
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const check = checkNodeVersion();
|
|
35
|
-
if (check.status === "fail")
|
|
36
|
-
throw new Error(check.detail);
|
|
11
|
+
else {
|
|
12
|
+
await import("./program.js");
|
|
37
13
|
}
|
|
38
|
-
program
|
|
39
|
-
.name("litmus")
|
|
40
|
-
.description("Litmus engineering assessment CLI")
|
|
41
|
-
.version(CLI_VERSION);
|
|
42
|
-
program
|
|
43
|
-
.command("init [token]")
|
|
44
|
-
.description("Download and set up a Litmus assessment")
|
|
45
|
-
.action(async (token) => {
|
|
46
|
-
try {
|
|
47
|
-
requireSupportedNode();
|
|
48
|
-
await runInit(await tokenOrExit(token));
|
|
49
|
-
}
|
|
50
|
-
catch (err) {
|
|
51
|
-
if (err instanceof FatalError)
|
|
52
|
-
return;
|
|
53
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
54
|
-
process.exit(1);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
cursorSessionFlags(program.command("connect [token]"))
|
|
58
|
-
.description("Open your assessment workspace in your editor of choice (codespace)")
|
|
59
|
-
.option("--ide <editor>", "Where to open: vscode (native VS Code), cursor (native Cursor), browser, or ssh")
|
|
60
|
-
.option("--verbose", "Print what your editor wrote while opening, for support")
|
|
61
|
-
.option("--skills", "Import your AI skills (~/.claude/skills, ~/.agents/skills, ...) into the workspace without asking")
|
|
62
|
-
.option("--no-skills", "Don't offer to import your AI skills")
|
|
63
|
-
.action(async (token, opts) => {
|
|
64
|
-
try {
|
|
65
|
-
requireSupportedNode();
|
|
66
|
-
await runConnect(token, opts.ide, { verbose: opts.verbose, skills: opts.skills, cursorAgentWindow: opts.cursorAgentWindow, cursorSessionCleanup: opts.cursorSessionCleanup });
|
|
67
|
-
}
|
|
68
|
-
catch (err) {
|
|
69
|
-
if (err instanceof FatalError)
|
|
70
|
-
return;
|
|
71
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
72
|
-
process.exit(1);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
program
|
|
76
|
-
.command("ssh <alias>")
|
|
77
|
-
.description("Open a configured workspace SSH shell with automatic localhost forwarding")
|
|
78
|
-
.action(async (alias) => {
|
|
79
|
-
try {
|
|
80
|
-
await runSsh(alias);
|
|
81
|
-
}
|
|
82
|
-
catch (err) {
|
|
83
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
84
|
-
process.exitCode = 1;
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
program
|
|
88
|
-
.command("diagnose-connection [token]")
|
|
89
|
-
.description("Collect connection diagnostics without changing your editor or workspace")
|
|
90
|
-
.option("--ide <editor>", "Editor to inspect: cursor or vscode", "cursor")
|
|
91
|
-
.option("--log <file>", "Classify the last 64 KiB of a Remote-SSH log locally; raw contents are not uploaded")
|
|
92
|
-
.action(async (token, opts) => {
|
|
93
|
-
try {
|
|
94
|
-
await runDiagnoseConnection(await tokenOrExit(token), opts);
|
|
95
|
-
}
|
|
96
|
-
catch (err) {
|
|
97
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
98
|
-
process.exitCode = 1;
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
program
|
|
102
|
-
.command("forward [token] [ports...]")
|
|
103
|
-
.description("Automatically forward workspace apps to localhost; optionally choose ports (5173, or 5174:5173)")
|
|
104
|
-
.option("--verbose", "Print more detail, for support")
|
|
105
|
-
.action(async (token, ports, opts) => {
|
|
106
|
-
try {
|
|
107
|
-
await runForward(await tokenOrExit(token), ports, { verbose: opts.verbose });
|
|
108
|
-
}
|
|
109
|
-
catch (err) {
|
|
110
|
-
if (err instanceof FatalError)
|
|
111
|
-
return;
|
|
112
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
113
|
-
process.exit(1);
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
program
|
|
117
|
-
.command("push")
|
|
118
|
-
.description("Submit your VM workspace (codespace) for grading")
|
|
119
|
-
// OPTIONAL, unlike `init`/`connect` (ENG-2064). Inside the workspace the token
|
|
120
|
-
// comes from the environment the host injected at container start, so a candidate
|
|
121
|
-
// in their own terminal types `litmus push` and nothing else. On a laptop it is
|
|
122
|
-
// still required in practice: with no argument and no injected token the command
|
|
123
|
-
// says so and points at the assessment page.
|
|
124
|
-
.argument("[token]", "Assessment token — only needed outside the workspace (it is pre-set inside one)")
|
|
125
|
-
.option("-y, --yes", "Skip confirmation prompt")
|
|
126
|
-
.action(async (token, opts) => {
|
|
127
|
-
try {
|
|
128
|
-
await runPush(token, opts);
|
|
129
|
-
}
|
|
130
|
-
catch (err) {
|
|
131
|
-
if (err instanceof FatalError)
|
|
132
|
-
return;
|
|
133
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
134
|
-
process.exit(1);
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
program
|
|
138
|
-
.command("pause [token]")
|
|
139
|
-
.description("Pause your workspace (codespace) and come back later - your work is kept")
|
|
140
|
-
.action(async (token) => {
|
|
141
|
-
try {
|
|
142
|
-
await runPause(await tokenOrExit(token));
|
|
143
|
-
}
|
|
144
|
-
catch (err) {
|
|
145
|
-
if (err instanceof FatalError)
|
|
146
|
-
return;
|
|
147
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
148
|
-
process.exit(1);
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
program
|
|
152
|
-
.command("submit")
|
|
153
|
-
.description("Submit your assessment code (walkthrough recording happens in the browser)")
|
|
154
|
-
.option("-y, --yes", "Skip confirmation prompt")
|
|
155
|
-
.action(async (opts) => {
|
|
156
|
-
try {
|
|
157
|
-
await runSubmit(opts);
|
|
158
|
-
}
|
|
159
|
-
catch (err) {
|
|
160
|
-
if (err instanceof FatalError)
|
|
161
|
-
return;
|
|
162
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
163
|
-
process.exit(1);
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
program
|
|
167
|
-
.command("doctor")
|
|
168
|
-
.description("Check your assessment setup and repair activity tracking")
|
|
169
|
-
// Positional like `litmus init <token>`, but optional: with a healthy
|
|
170
|
-
// config the token comes from the settings file and nobody types it.
|
|
171
|
-
// Doctor only needs it to restore a missing/corrupted settings file, and
|
|
172
|
-
// prompts for it interactively when it does.
|
|
173
|
-
.argument("[token]", "Assessment token, only needed to restore a missing settings file (doctor asks for it otherwise)")
|
|
174
|
-
.option("--verbose", "Show diagnostic details for support")
|
|
175
|
-
.option("--backfill-prompts", "Recover missed AI prompts from the whole assessment window (recovery also runs automatically when doctor repairs broken tracking)")
|
|
176
|
-
.option("--since <timestamp>", "Only recover prompts after this time (ISO format, e.g. 2026-08-07T19:00:00Z)")
|
|
177
|
-
.option("--all-sessions", "Recover from every AI session on this machine (Claude, Gemini, Copilot, Cursor), not just this folder's")
|
|
178
|
-
.option("--no-backfill", "Skip automatic prompt recovery")
|
|
179
|
-
.option("--here", "Restore a missing settings file in this folder, without looking for your assessment folder below it")
|
|
180
|
-
.action(async (token, opts) => {
|
|
181
|
-
try {
|
|
182
|
-
await runDoctor({ ...opts, token });
|
|
183
|
-
}
|
|
184
|
-
catch (err) {
|
|
185
|
-
if (err instanceof FatalError)
|
|
186
|
-
return;
|
|
187
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
188
|
-
process.exit(1);
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
program
|
|
192
|
-
.command("setup-check")
|
|
193
|
-
.description("Check this machine can run the Litmus CLI, before you start an assessment")
|
|
194
|
-
.option("--verbose", "Show diagnostic details for support")
|
|
195
|
-
.action(async (opts) => {
|
|
196
|
-
try {
|
|
197
|
-
await runSetupCheck(opts);
|
|
198
|
-
}
|
|
199
|
-
catch (err) {
|
|
200
|
-
if (err instanceof FatalError)
|
|
201
|
-
return;
|
|
202
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
203
|
-
process.exit(1);
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
program
|
|
207
|
-
.command("status")
|
|
208
|
-
.description("Show assessment status and stats")
|
|
209
|
-
.action(async () => {
|
|
210
|
-
try {
|
|
211
|
-
await runStatus();
|
|
212
|
-
}
|
|
213
|
-
catch (err) {
|
|
214
|
-
if (err instanceof FatalError)
|
|
215
|
-
return;
|
|
216
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
217
|
-
process.exit(1);
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
program
|
|
221
|
-
.command("env")
|
|
222
|
-
.description("Set the assessment's environment variables in this shell: eval \"$(litmus env)\"")
|
|
223
|
-
.option("--powershell", "Print PowerShell assignments, for: litmus env --powershell | Invoke-Expression")
|
|
224
|
-
.action(async (opts) => {
|
|
225
|
-
try {
|
|
226
|
-
await runEnv(opts);
|
|
227
|
-
}
|
|
228
|
-
catch (err) {
|
|
229
|
-
if (err instanceof FatalError)
|
|
230
|
-
return;
|
|
231
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
232
|
-
process.exit(1);
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
program.parse();
|
|
236
14
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD,mFAAmF;AACnF,kFAAkF;AAClF,+DAA+D;AAC/D,MAAM,IAAI,GAAG,gBAAgB,EAAE,CAAA;AAC/B,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;IAC3B,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC1B,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;AACtB,CAAC;KAAM,CAAC;IACN,MAAM,MAAM,CAAC,cAAc,CAAC,CAAA;AAC9B,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { rmSync } from "fs";
|
|
2
|
+
export { NODE_MIN_VERSION, checkNodeVersion } from "./node-version.js";
|
|
2
3
|
/**
|
|
3
4
|
* Environment checks shared by `litmus setup-check` (pre-init, ENG-2300) and
|
|
4
5
|
* `litmus doctor` (post-init repair, ENG-1446).
|
|
@@ -37,12 +38,9 @@ export interface EnvironmentCheck {
|
|
|
37
38
|
/** Internals shown with --verbose. */
|
|
38
39
|
verbose?: string;
|
|
39
40
|
}
|
|
40
|
-
/** The `engines.node` floor in package.json; pinned to it by test. */
|
|
41
|
-
export declare const NODE_MIN_VERSION = "20.19.0";
|
|
42
41
|
export declare const REINSTALL_COMMAND = "npm install -g litmus-cli@latest";
|
|
43
42
|
/** Registry document for the `latest` dist-tag. */
|
|
44
43
|
export declare const NPM_LATEST_URL = "https://registry.npmjs.org/litmus-cli/latest";
|
|
45
|
-
export declare function checkNodeVersion(version?: string): EnvironmentCheck;
|
|
46
44
|
/**
|
|
47
45
|
* Numeric compare of dotted versions; prerelease suffixes are ignored, so
|
|
48
46
|
* `1.4.25-beta` compares as `1.4.25`. Returns <0 when a is behind b.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment-checks.d.ts","sourceRoot":"","sources":["../../src/lib/environment-checks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,MAAM,EAAiB,MAAM,IAAI,CAAA;AAOhF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,MAAM,MAAM,sBAAsB,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;AAE3D,MAAM,WAAW,gBAAgB;IAC/B,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,sBAAsB,CAAA;IAC9B,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAA;IACd,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,
|
|
1
|
+
{"version":3,"file":"environment-checks.d.ts","sourceRoot":"","sources":["../../src/lib/environment-checks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,MAAM,EAAiB,MAAM,IAAI,CAAA;AAOhF,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,MAAM,MAAM,sBAAsB,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;AAE3D,MAAM,WAAW,gBAAgB;IAC/B,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,sBAAsB,CAAA;IAC9B,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAA;IACd,sCA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O,CAAC,gBAAgB,CAAC,CAkEjC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EACX,IAAI,GAAE;IAAE,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,MAAM,CAAA;CAAO,GAC5G,OAAO,CAAC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,eAAe,GAAG,UAAU,CAAA;CAAE,CAAC,CA2CtG;AAID;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAA;CAC1C,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAS9B"}
|
|
@@ -4,8 +4,8 @@ import path from "path";
|
|
|
4
4
|
import { execSync } from "child_process";
|
|
5
5
|
import { CLI_VERSION } from "./version.js";
|
|
6
6
|
import { startTracker, trackerDiagnostics, waitForTrackerReady } from "./tracker.js";
|
|
7
|
-
|
|
8
|
-
export
|
|
7
|
+
import { checkNodeVersion } from "./node-version.js";
|
|
8
|
+
export { NODE_MIN_VERSION, checkNodeVersion } from "./node-version.js";
|
|
9
9
|
export const REINSTALL_COMMAND = "npm install -g litmus-cli@latest";
|
|
10
10
|
/** Registry document for the `latest` dist-tag. */
|
|
11
11
|
export const NPM_LATEST_URL = "https://registry.npmjs.org/litmus-cli/latest";
|
|
@@ -13,20 +13,6 @@ const REGISTRY_TIMEOUT_MS = 5000;
|
|
|
13
13
|
const SERVER_TIMEOUT_MS = 8000;
|
|
14
14
|
/** Above this the connection is reported as slow. Still `ok`: slowness is not a fix the candidate can apply. */
|
|
15
15
|
const SERVER_SLOW_MS = 3000;
|
|
16
|
-
// ── Node ─────────────────────────────────────────────────────────────
|
|
17
|
-
export function checkNodeVersion(version = process.version) {
|
|
18
|
-
if (!/^v?\d+(?:\.\d+){0,2}(?:[-+].*)?$/.test(version.trim())) {
|
|
19
|
-
return { name: "node", status: "warn", detail: `Node.js: version could not be read (${version})` };
|
|
20
|
-
}
|
|
21
|
-
if (compareVersions(version, NODE_MIN_VERSION) < 0) {
|
|
22
|
-
return {
|
|
23
|
-
name: "node",
|
|
24
|
-
status: "fail",
|
|
25
|
-
detail: `Node.js: ${version} is too old. Update to Node.js ${NODE_MIN_VERSION} or newer, then run "litmus setup-check" again.`,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
return { name: "node", status: "ok", detail: `Node.js: ${version}` };
|
|
29
|
-
}
|
|
30
16
|
// ── CLI version against npm ──────────────────────────────────────────
|
|
31
17
|
/**
|
|
32
18
|
* Numeric compare of dotted versions; prerelease suffixes are ignored, so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment-checks.js","sourceRoot":"","sources":["../../src/lib/environment-checks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,IAAI,CAAA;AAChF,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AA2CpF,sEAAsE;AACtE,MAAM,CAAC,MAAM,gBAAgB,GAAG,SAAS,CAAA;AAEzC,MAAM,CAAC,MAAM,iBAAiB,GAAG,kCAAkC,CAAA;AAEnE,mDAAmD;AACnD,MAAM,CAAC,MAAM,cAAc,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E;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAG1C;IACC,MAAM,OAAO,GAAuB,EAAE,CAAA;IACtC,MAAM,IAAI,GAAG,CAAC,CAAmB,EAAQ,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC,CAAA;IAC/E,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAA;IACxB,IAAI,CAAC,MAAM,eAAe,EAAE,CAAC,CAAA;IAC7B,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAA;IAChB,IAAI,CAAC,MAAM,oBAAoB,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;IAC3D,IAAI,CAAC,MAAM,gBAAgB,EAAE,CAAC,CAAA;IAC9B,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
package/dist/lib/hook-logger.cjs
CHANGED
|
@@ -2376,6 +2376,17 @@ const CODEX_CONTEXTUAL_PREFIXES = [
|
|
|
2376
2376
|
]
|
|
2377
2377
|
function isCodexContextualText(text) {
|
|
2378
2378
|
const trimmed = typeof text === "string" ? text.trimStart().toLowerCase() : ""
|
|
2379
|
+
// Desktop page visibility arrives as a standalone user-role notification.
|
|
2380
|
+
// Match only its metadata envelope: quoted examples and accompanying human
|
|
2381
|
+
// text must remain prompts, not disappear because they mention this tag.
|
|
2382
|
+
const page = /^<external_codex_apps_open_page>\s*([\s\S]*?)\s*<\/external_codex_apps_open_page>\s*$/.exec(trimmed)
|
|
2383
|
+
if (page) {
|
|
2384
|
+
try {
|
|
2385
|
+
const value = JSON.parse(page[1])
|
|
2386
|
+
if (value && Object.keys(value).length === 1 && Object.prototype.hasOwnProperty.call(value, "page_id")
|
|
2387
|
+
&& (value.page_id === null || typeof value.page_id === "string")) return true
|
|
2388
|
+
} catch { /* malformed or human-authored examples are preserved */ }
|
|
2389
|
+
}
|
|
2379
2390
|
return CODEX_CONTEXTUAL_PREFIXES.some(prefix => trimmed.startsWith(prefix.toLowerCase()))
|
|
2380
2391
|
}
|
|
2381
2392
|
// Python's ingest filter budgets JSON with ensure_ascii=True. Bound the same
|
|
@@ -2,6 +2,8 @@ import type { InitMetadata } from "./schemas.js";
|
|
|
2
2
|
export declare const HOSTED_CAPTURE_DISCLOSURE_VERSION = "hosted_local_v2";
|
|
3
3
|
export declare const HOSTED_CAPTURE_DISCLOSURE = "During this assessment, Litmus records prompts, responses, tool calls and their results from supported AI tools across this computer, including outside this workspace. The hiring company can review them alongside workspace activity. Capture ends with the coding session or pauses within ten seconds if offline. Browser AI and Copilot are not captured. Restart open AI tools to load capture hooks.";
|
|
4
4
|
export declare const HOSTED_CAPTURE_FILE: string;
|
|
5
|
+
/** Never infer session completion from an ordinary 404 or a network failure. */
|
|
6
|
+
export declare function isRemovedPreviewResponse(backendUrl: string, status: number, body: unknown): boolean;
|
|
5
7
|
export declare function atomicPrivateJson(file: string, value: unknown): void;
|
|
6
8
|
export declare function captureLease(backendUrl: string, token: string, accept?: boolean): Promise<{
|
|
7
9
|
active: boolean;
|
|
@@ -19,10 +21,10 @@ export declare function acquireCaptureSetupLock(lock: string, waitMs?: number):
|
|
|
19
21
|
/** Reconcile legacy hook registrations before opening a machine-wide window.
|
|
20
22
|
* No PID inference: a stopped watcher does not mean the assessment ended.
|
|
21
23
|
*/
|
|
22
|
-
export declare function reconcileLocalCaptureRegistrations(excluded: string[], localToken?: string): Promise<void>;
|
|
24
|
+
export declare function reconcileLocalCaptureRegistrations(excluded: string[], localToken?: string, forgetPreview?: boolean): Promise<void>;
|
|
23
25
|
/** Cancel only this newly prepared generation, never a reused/successor window.
|
|
24
26
|
* No session-over marker: the assessment is still valid and init can retry.
|
|
25
27
|
*/
|
|
26
28
|
export declare function rollbackPreparedCapture(projectDir: string, setupId: string): Promise<void>;
|
|
27
|
-
export declare function startHostedCapture(meta: InitMetadata, token: string, apiBase: string): Promise<(() => Promise<void>) | undefined>;
|
|
29
|
+
export declare function startHostedCapture(meta: InitMetadata, token: string, apiBase: string, forgetPreview?: boolean): Promise<(() => Promise<void>) | undefined>;
|
|
28
30
|
//# sourceMappingURL=hosted-capture.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-capture.d.ts","sourceRoot":"","sources":["../../src/lib/hosted-capture.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAMhD,eAAO,MAAM,iCAAiC,oBAAoB,CAAA;AAClE,eAAO,MAAM,yBAAyB,iZAAiZ,CAAA;AACvb,eAAO,MAAM,mBAAmB,QAA4D,CAAA;
|
|
1
|
+
{"version":3,"file":"hosted-capture.d.ts","sourceRoot":"","sources":["../../src/lib/hosted-capture.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAMhD,eAAO,MAAM,iCAAiC,oBAAoB,CAAA;AAClE,eAAO,MAAM,yBAAyB,iZAAiZ,CAAA;AACvb,eAAO,MAAM,mBAAmB,QAA4D,CAAA;AAM5F,gFAAgF;AAChF,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAOnG;AAUD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAKpE;AACD,wBAAsB,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,UAAQ,GAAG,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAC,CAAC,CAcjM;AACD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,IAAI,CA6B3D;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,SAAI,GAAG,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CA+BpG;AAED;;GAEG;AACH,wBAAsB,kCAAkC,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,aAAa,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAmDtI;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBhG;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,UAAQ,GAAG,OAAO,CAAC,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC,CAqF9J"}
|
|
@@ -11,12 +11,42 @@ import { linkSync, unlinkSync, realpathSync } from "fs";
|
|
|
11
11
|
import { startTracker, waitForTrackerReady, isTrackerHealthy } from "./tracker.js";
|
|
12
12
|
import { setupAiTracking } from "../commands/init.js";
|
|
13
13
|
import { releaseAiTrackingForAssessment, readRegistrySnapshot, pruneOrphanedCaptureRegistrations } from "./ai-tracking.js";
|
|
14
|
-
import { retireAiCaptureForEndedSession, sessionOverMarked } from "./session-over.js";
|
|
14
|
+
import { retireAiCaptureForEndedSession, sessionOverMarked, writeSessionOverMarker } from "./session-over.js";
|
|
15
15
|
import { findShadowConfigForDir } from "./shadow.js";
|
|
16
16
|
import { prepareHostedTranscripts } from "./hosted-transcripts.js";
|
|
17
17
|
export const HOSTED_CAPTURE_DISCLOSURE_VERSION = "hosted_local_v2";
|
|
18
18
|
export const HOSTED_CAPTURE_DISCLOSURE = "During this assessment, Litmus records prompts, responses, tool calls and their results from supported AI tools across this computer, including outside this workspace. The hiring company can review them alongside workspace activity. Capture ends with the coding session or pauses within ten seconds if offline. Browser AI and Copilot are not captured. Restart open AI tools to load capture hooks.";
|
|
19
19
|
export const HOSTED_CAPTURE_FILE = path.join(os.homedir(), ".litmus", "hosted-capture.json");
|
|
20
|
+
const PREVIEW_RECOVERY_HINT = "A previous preview capture service is unavailable. If that preview was removed, retry the same connect command with --forget-unavailable-preview. This stops its local capture only; it does not submit the previous assessment.";
|
|
21
|
+
class UnavailablePreviewCapture extends Error {
|
|
22
|
+
constructor() { super(PREVIEW_RECOVERY_HINT); }
|
|
23
|
+
}
|
|
24
|
+
/** Never infer session completion from an ordinary 404 or a network failure. */
|
|
25
|
+
export function isRemovedPreviewResponse(backendUrl, status, body) {
|
|
26
|
+
let url;
|
|
27
|
+
try {
|
|
28
|
+
url = new URL(backendUrl);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
if (url.protocol !== "https:" || url.port || url.username || url.password || url.pathname !== "/"
|
|
34
|
+
|| url.search || url.hash || !/^litmus-litmus-pr-\d+\.up\.railway\.app$/.test(url.hostname))
|
|
35
|
+
return false;
|
|
36
|
+
const value = body;
|
|
37
|
+
return status === 404 && value?.status === "error" && value.code === 404 && value.message === "Application not found";
|
|
38
|
+
}
|
|
39
|
+
function forgetUnavailablePreview(projectDir, token) {
|
|
40
|
+
// Explicit recovery is local abandonment, not evidence of server submission.
|
|
41
|
+
if (!writeSessionOverMarker(projectDir, token, "connect: user discarded unavailable preview capture")) {
|
|
42
|
+
throw new Error("Could not stop the previous preview capture. Contact support.");
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
writeFileSync(path.join(projectDir, ".litmus", "shutdown"), String(Date.now()));
|
|
46
|
+
}
|
|
47
|
+
catch { /* folder may be gone */ }
|
|
48
|
+
releaseAiTrackingForAssessment(projectDir);
|
|
49
|
+
}
|
|
20
50
|
export function atomicPrivateJson(file, value) {
|
|
21
51
|
mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 });
|
|
22
52
|
const temp = `${file}.${randomUUID()}.tmp`;
|
|
@@ -34,8 +64,11 @@ export async function captureLease(backendUrl, token, accept = false) {
|
|
|
34
64
|
...(accept ? { body: JSON.stringify({ disclosureVersion: HOSTED_CAPTURE_DISCLOSURE_VERSION }) } : {}),
|
|
35
65
|
signal: AbortSignal.timeout(4000),
|
|
36
66
|
});
|
|
37
|
-
if (!response.ok)
|
|
67
|
+
if (!response.ok) {
|
|
68
|
+
if (!accept && isRemovedPreviewResponse(backendUrl, response.status, await response.json().catch(() => null)))
|
|
69
|
+
throw new UnavailablePreviewCapture();
|
|
38
70
|
throw new Error(`Local capture authorization failed (${response.status})`);
|
|
71
|
+
}
|
|
39
72
|
const value = await response.json();
|
|
40
73
|
if (typeof value.active !== "boolean" || typeof value.leaseSeconds !== "number" || value.leaseSeconds < 0 || value.leaseSeconds > 10)
|
|
41
74
|
throw new Error("Invalid capture authorization");
|
|
@@ -144,7 +177,7 @@ export async function acquireCaptureSetupLock(lock, waitMs = 0) {
|
|
|
144
177
|
/** Reconcile legacy hook registrations before opening a machine-wide window.
|
|
145
178
|
* No PID inference: a stopped watcher does not mean the assessment ended.
|
|
146
179
|
*/
|
|
147
|
-
export async function reconcileLocalCaptureRegistrations(excluded, localToken) {
|
|
180
|
+
export async function reconcileLocalCaptureRegistrations(excluded, localToken, forgetPreview = false) {
|
|
148
181
|
const blocked = [];
|
|
149
182
|
let handoffError;
|
|
150
183
|
for (const dir of readRegistrySnapshot() ?? []) {
|
|
@@ -183,6 +216,12 @@ export async function reconcileLocalCaptureRegistrations(excluded, localToken) {
|
|
|
183
216
|
redirect: "error", signal: AbortSignal.timeout(4000),
|
|
184
217
|
});
|
|
185
218
|
const body = await response.json();
|
|
219
|
+
if (config.captureMode === "hosted-local" && isRemovedPreviewResponse(config.backendUrl, response.status, body)) {
|
|
220
|
+
if (!forgetPreview)
|
|
221
|
+
throw new UnavailablePreviewCapture();
|
|
222
|
+
forgetUnavailablePreview(dir, config.token);
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
186
225
|
const ended = (response.status === 403 && body.detail?.error === "Token expired")
|
|
187
226
|
|| (response.status === 404 && body.detail?.error === "Invalid token");
|
|
188
227
|
if (!ended) {
|
|
@@ -204,6 +243,8 @@ export async function reconcileLocalCaptureRegistrations(excluded, localToken) {
|
|
|
204
243
|
retireAiCaptureForEndedSession(dir, config.token);
|
|
205
244
|
}
|
|
206
245
|
catch (error) {
|
|
246
|
+
if (error instanceof UnavailablePreviewCapture)
|
|
247
|
+
throw error;
|
|
207
248
|
if (error instanceof ServerError)
|
|
208
249
|
handoffError ?? (handoffError = error);
|
|
209
250
|
blocked.push(dir);
|
|
@@ -250,7 +291,7 @@ export async function rollbackPreparedCapture(projectDir, setupId) {
|
|
|
250
291
|
await release();
|
|
251
292
|
}
|
|
252
293
|
}
|
|
253
|
-
export async function startHostedCapture(meta, token, apiBase) {
|
|
294
|
+
export async function startHostedCapture(meta, token, apiBase, forgetPreview = false) {
|
|
254
295
|
const key = createHash("sha256").update(token).digest("hex");
|
|
255
296
|
const projectDir = hostedCaptureProjectDir(token);
|
|
256
297
|
// One machine-wide window: never silently mix two candidates' conversations.
|
|
@@ -275,17 +316,27 @@ export async function startHostedCapture(meta, token, apiBase) {
|
|
|
275
316
|
}
|
|
276
317
|
if (prior.projectDir && prior.tokenKey !== key) {
|
|
277
318
|
const oldConfig = JSON.parse(readFileSync(path.join(prior.projectDir, ".litmus", "config.json"), "utf8"));
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
await
|
|
281
|
-
|
|
282
|
-
|
|
319
|
+
let oldLease;
|
|
320
|
+
try {
|
|
321
|
+
oldLease = await captureLease(oldConfig.backendUrl, oldConfig.token);
|
|
322
|
+
}
|
|
323
|
+
catch (error) {
|
|
324
|
+
if (!(error instanceof UnavailablePreviewCapture) || !forgetPreview || oldConfig.captureMode !== "hosted-local")
|
|
325
|
+
throw error;
|
|
326
|
+
forgetUnavailablePreview(prior.projectDir, oldConfig.token);
|
|
327
|
+
}
|
|
328
|
+
if (oldLease) {
|
|
329
|
+
if (oldLease.active) {
|
|
330
|
+
await finishPracticeCapture(oldConfig.backendUrl, oldConfig.token, token);
|
|
331
|
+
if ((await captureLease(oldConfig.backendUrl, oldConfig.token)).active)
|
|
332
|
+
throw new Error("Practice capture is still active. Retry the same command.");
|
|
333
|
+
}
|
|
334
|
+
// Confirmed server closure, not mere lease expiry, permits replacing a window.
|
|
335
|
+
retireAiCaptureForEndedSession(prior.projectDir, oldConfig.token);
|
|
283
336
|
}
|
|
284
|
-
// Confirmed server closure, not mere lease expiry, permits replacing a window.
|
|
285
|
-
retireAiCaptureForEndedSession(prior.projectDir, oldConfig.token);
|
|
286
337
|
rmSync(HOSTED_CAPTURE_FILE, { force: true });
|
|
287
338
|
}
|
|
288
|
-
await reconcileLocalCaptureRegistrations([projectDir, ...(prior.projectDir ? [prior.projectDir] : [])], token);
|
|
339
|
+
await reconcileLocalCaptureRegistrations([projectDir, ...(prior.projectDir ? [prior.projectDir] : [])], token, forgetPreview);
|
|
289
340
|
if (prior.projectDir === projectDir && isTrackerHealthy(projectDir)) {
|
|
290
341
|
// A later command has adopted this running window; an earlier failed
|
|
291
342
|
// preparation no longer owns its rollback.
|