litmus-cli 1.5.0-beta.4 → 1.5.0-beta.6
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 -0
- package/dist/commands/connect.d.ts.map +1 -1
- package/dist/commands/connect.js +201 -48
- package/dist/commands/connect.js.map +1 -1
- package/dist/commands/doctor.d.ts +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +8 -2
- package/dist/commands/doctor.js.map +1 -1
- package/dist/cursor-session/extension.cjs +12 -3
- package/dist/cursor-session/package.json +2 -2
- package/dist/cursor-session/session.cjs +19 -6
- package/dist/lib/api.d.ts.map +1 -1
- package/dist/lib/api.js +7 -2
- package/dist/lib/api.js.map +1 -1
- package/dist/lib/capture-startup-diagnostics.d.ts +15 -0
- package/dist/lib/capture-startup-diagnostics.d.ts.map +1 -0
- package/dist/lib/capture-startup-diagnostics.js +134 -0
- package/dist/lib/capture-startup-diagnostics.js.map +1 -0
- package/dist/lib/capture-storage-error.d.ts +10 -0
- package/dist/lib/capture-storage-error.d.ts.map +1 -0
- package/dist/lib/capture-storage-error.js +18 -0
- package/dist/lib/capture-storage-error.js.map +1 -0
- package/dist/lib/cursor-session.js +2 -2
- package/dist/lib/editor-foreground.d.ts +9 -1
- package/dist/lib/editor-foreground.d.ts.map +1 -1
- package/dist/lib/editor-foreground.js +15 -0
- package/dist/lib/editor-foreground.js.map +1 -1
- package/dist/lib/errors.d.ts +2 -0
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/errors.js +7 -0
- package/dist/lib/errors.js.map +1 -1
- package/dist/lib/hosted-capture.d.ts.map +1 -1
- package/dist/lib/hosted-capture.js +47 -10
- package/dist/lib/hosted-capture.js.map +1 -1
- package/dist/lib/hosted-watcher.js +9 -1
- package/dist/lib/hosted-watcher.js.map +1 -1
- package/dist/lib/installed-tools.d.ts +3 -0
- package/dist/lib/installed-tools.d.ts.map +1 -1
- package/dist/lib/installed-tools.js +31 -18
- package/dist/lib/installed-tools.js.map +1 -1
- package/dist/lib/launcher-cleanup-journal.d.ts +44 -0
- package/dist/lib/launcher-cleanup-journal.d.ts.map +1 -0
- package/dist/lib/launcher-cleanup-journal.js +196 -0
- package/dist/lib/launcher-cleanup-journal.js.map +1 -0
- package/dist/lib/launcher-inventory-cache.d.ts +44 -0
- package/dist/lib/launcher-inventory-cache.d.ts.map +1 -0
- package/dist/lib/launcher-inventory-cache.js +126 -0
- package/dist/lib/launcher-inventory-cache.js.map +1 -0
- package/dist/lib/launcher-preparation-cache.d.ts +46 -0
- package/dist/lib/launcher-preparation-cache.d.ts.map +1 -0
- package/dist/lib/launcher-preparation-cache.js +131 -0
- package/dist/lib/launcher-preparation-cache.js.map +1 -0
- package/dist/lib/portal-launcher-background.d.ts +2 -0
- package/dist/lib/portal-launcher-background.d.ts.map +1 -1
- package/dist/lib/portal-launcher-background.js.map +1 -1
- package/dist/lib/portal-launcher.d.ts +42 -5
- package/dist/lib/portal-launcher.d.ts.map +1 -1
- package/dist/lib/portal-launcher.js +339 -86
- package/dist/lib/portal-launcher.js.map +1 -1
- package/dist/lib/prepared-editor.d.ts.map +1 -1
- package/dist/lib/prepared-editor.js +20 -5
- package/dist/lib/prepared-editor.js.map +1 -1
- package/dist/lib/session-over.d.ts +2 -0
- package/dist/lib/session-over.d.ts.map +1 -1
- package/dist/lib/session-over.js +71 -12
- package/dist/lib/session-over.js.map +1 -1
- package/dist/lib/ssh-config-file.d.ts +13 -2
- package/dist/lib/ssh-config-file.d.ts.map +1 -1
- package/dist/lib/ssh-config-file.js +32 -27
- package/dist/lib/ssh-config-file.js.map +1 -1
- package/dist/lib/tool-installation-watcher.d.ts +20 -0
- package/dist/lib/tool-installation-watcher.d.ts.map +1 -0
- package/dist/lib/tool-installation-watcher.js +112 -0
- package/dist/lib/tool-installation-watcher.js.map +1 -0
- package/dist/lib/tracker.d.ts.map +1 -1
- package/dist/lib/tracker.js +25 -2
- package/dist/lib/tracker.js.map +1 -1
- package/dist/lib/watcher.js +5 -0
- package/dist/lib/watcher.js.map +1 -1
- package/dist/program.js +11 -3
- package/dist/program.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -393,3 +393,7 @@ conversations alone do not trigger one. Hosted capture-risk episodes stay
|
|
|
393
393
|
diagnostic and produce no candidate setup warning. Notification guidance is no longer
|
|
394
394
|
written into the assessment folder. Existing CLI-owned notices are cleaned up;
|
|
395
395
|
candidate-edited files are preserved.
|
|
396
|
+
|
|
397
|
+
### Capture startup diagnostics
|
|
398
|
+
|
|
399
|
+
Failed local capture setup and `litmus doctor` report fixed diagnostic fields: storage errno/operation and home-versus-assessment location; the latest watcher startup timestamp, exit code/signal, allowlisted error classifications; and recorded session-retirement reason/time when available. Watcher error classifications come from that child’s structured failure receipt; shared stderr logs are not used to infer its cause. Raw stderr, local paths, token hashes and prompt/code contents are not included in these new summaries. Unavailable or legacy evidence remains explicitly unknown. Retirement markers remain terminal; these diagnostics never clear them or restart capture. A startup receipt or diagnostic upload does not prove successful capture.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../src/commands/connect.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,KAAK,gBAAgB,EAAE,MAAM,sCAAsC,CAAA;AAOrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../src/commands/connect.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,KAAK,gBAAgB,EAAE,MAAM,sCAAsC,CAAA;AAOrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAwBhE,OAAO,EAA4C,KAAK,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAE9G,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAOL,KAAK,aAAa,EAClB,KAAK,WAAW,E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C5E,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,yGAAyG;IACzG,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;;;OAIG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAC5F;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,iBAAiB,CAAA;CAC3B;AAiBD,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0DxH;AAgxBD,oFAAoF;AACpF,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,IAAI,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAqK5H"}
|
package/dist/commands/connect.js
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
import { configureClaudeDesktopConnection, removeClaudeDesktopConnection } from "../lib/ai-tracking.js";
|
|
2
2
|
import { waitForWorkspace } from "../lib/workspace-start-wait.js";
|
|
3
3
|
import { startBackgroundLauncher } from "../lib/portal-launcher-background.js";
|
|
4
|
-
import { desktopRuntimeReady } from "../lib/desktop-readiness.js";
|
|
5
|
-
import { startPortalPreparation, runPortalLauncher, openDesktop, openTerminal, openNativeEditor } from "../lib/portal-launcher.js";
|
|
4
|
+
import { desktopAppProbeCommand, desktopRuntimeReady } from "../lib/desktop-readiness.js";
|
|
5
|
+
import { startPortalPreparation, runPortalLauncher, reportLauncherTiming, openDesktop, openTerminal, openNativeEditor, desktopLaunchOutcome, removeTerminalLauncher } from "../lib/portal-launcher.js";
|
|
6
6
|
import { startHostedCapture } from "../lib/hosted-capture.js";
|
|
7
7
|
import { installSshForwardHook } from "../lib/install-ssh-forward-hook.js";
|
|
8
8
|
import { runSsh } from "./ssh.js";
|
|
9
9
|
import { cursorSessionOptions, prepareCursorSession } from "../lib/cursor-session.js";
|
|
10
10
|
import { ConnectionAttempt } from "../lib/connection-attempt.js";
|
|
11
|
-
import { editorAppBundle, waitForEditorDispatch } from "../lib/editor-foreground.js";
|
|
11
|
+
import { editorAppBundle, reselectEditorWindow, waitForEditorDispatch } from "../lib/editor-foreground.js";
|
|
12
12
|
import { createPreparedEditorLauncher, parseWorkspaceGeneration } from "../lib/prepared-editor.js";
|
|
13
13
|
import { createPreparedDesktopReadiness } from "../lib/prepared-desktop.js";
|
|
14
14
|
import { findInstalledExecutable } from "../lib/installed-tools.js";
|
|
15
|
+
import { clearLauncherInventoryCache, loadLauncherInventoryCache, saveLauncherInventoryCache } from "../lib/launcher-inventory-cache.js";
|
|
16
|
+
import { clearLauncherPreparationCache, hasLauncherPreparationCache, saveLauncherPreparationCache } from "../lib/launcher-preparation-cache.js";
|
|
17
|
+
import { attemptIndependentCleanup, queueLauncherCleanup, reconcileLauncherCleanup } from "../lib/launcher-cleanup-journal.js";
|
|
15
18
|
import { prepareVscodeServer } from "../lib/vscode-server-preparation.js";
|
|
16
19
|
import { closedState } from "../lib/session-state.js";
|
|
17
|
-
import { updateSshConfig,
|
|
20
|
+
import { updateSshConfig, createSshConfigCleanupPlan, executeSshConfigCleanupPlan } from "../lib/ssh-config-file.js";
|
|
18
21
|
import os from "os";
|
|
19
22
|
import path from "path";
|
|
20
23
|
import readline from "readline";
|
|
21
24
|
import { closeSync, constants, existsSync, mkdirSync, openSync, readFileSync, realpathSync } from "fs";
|
|
22
|
-
import { randomBytes } from "crypto";
|
|
25
|
+
import { createHash, randomBytes } from "crypto";
|
|
23
26
|
import { execFileSync, spawn, spawnSync } from "child_process";
|
|
24
27
|
import chalk from "chalk";
|
|
25
28
|
import ora from "ora";
|
|
@@ -887,6 +890,10 @@ export function launchEditor(ed, command, alias, logPath, foreground = false) {
|
|
|
887
890
|
const dispatched = bundle ? waitForEditorDispatch(child, () => {
|
|
888
891
|
try {
|
|
889
892
|
execFileSync("/usr/bin/open", ["-a", bundle], { timeout: 3000, stdio: "ignore" });
|
|
893
|
+
// App activation is not window selection: macOS can raise a stale window
|
|
894
|
+
// from a previous assessment. Re-issue the exact alias/folder request only
|
|
895
|
+
// after activation so the current assessment window ends in front.
|
|
896
|
+
reselectEditorWindow(spec.command, spec.args, spec.shell);
|
|
890
897
|
}
|
|
891
898
|
catch {
|
|
892
899
|
// Activation is best effort; a successful editor open remains usable.
|
|
@@ -1360,6 +1367,7 @@ export function browserFallback(hasUrl, ideWasChosen) {
|
|
|
1360
1367
|
return ideWasChosen ? "unavailable" : "vscode";
|
|
1361
1368
|
}
|
|
1362
1369
|
export async function runConnect(tokenArg, ideOpt, opts = {}) {
|
|
1370
|
+
const connectStartedAt = Date.now();
|
|
1363
1371
|
// A workspace cannot configure the candidate's local editor. Return before
|
|
1364
1372
|
// reading a token or creating an attempt, whose first checkpoint reports health.
|
|
1365
1373
|
if (isWorkspaceInstall(import.meta.url)) {
|
|
@@ -1376,6 +1384,13 @@ export async function runConnect(tokenArg, ideOpt, opts = {}) {
|
|
|
1376
1384
|
// is lost when a later step fails. The workspace lines follow it, so the candidate's
|
|
1377
1385
|
// last read is where they are and what the session ending looks like.
|
|
1378
1386
|
setErrorContext({ token, apiBase: resolveApiBase(process.env.LITMUS_API_URL) });
|
|
1387
|
+
// A previous worker may have stopped after the server committed submission but
|
|
1388
|
+
// before it removed this assessment's local connection. Reconcile before init,
|
|
1389
|
+
// which can legitimately refuse an already-submitted token.
|
|
1390
|
+
try {
|
|
1391
|
+
await reconcileLauncherCleanup(token, launcherCleanupHandlers(token));
|
|
1392
|
+
}
|
|
1393
|
+
catch { /* Never block a new connection on cleanup. */ }
|
|
1379
1394
|
const attempt = new ConnectionAttempt();
|
|
1380
1395
|
const skillImport = { report: null, footer: [], sshAlias: null, publishedPorts: [], tunnelSession: null };
|
|
1381
1396
|
// Register before entering the flow: a fast fatal report can settle before the
|
|
@@ -1383,7 +1398,7 @@ export async function runConnect(tokenArg, ideOpt, opts = {}) {
|
|
|
1383
1398
|
let releaseExitHold;
|
|
1384
1399
|
holdExitFor(new Promise((resolve) => { releaseExitHold = resolve; }));
|
|
1385
1400
|
try {
|
|
1386
|
-
await connectFlow(token, ideOpt, opts, skillImport, attempt);
|
|
1401
|
+
await connectFlow(token, ideOpt, opts, skillImport, attempt, connectStartedAt);
|
|
1387
1402
|
}
|
|
1388
1403
|
catch (error) {
|
|
1389
1404
|
await skillImport.rollbackCapture?.();
|
|
@@ -1430,7 +1445,7 @@ export async function runConnect(tokenArg, ideOpt, opts = {}) {
|
|
|
1430
1445
|
else
|
|
1431
1446
|
await runSsh(skillImport.sshAlias);
|
|
1432
1447
|
}
|
|
1433
|
-
async function connectFlow(token, ideOpt, opts, skillImport, attempt) {
|
|
1448
|
+
async function connectFlow(token, ideOpt, opts, skillImport, attempt, connectStartedAt) {
|
|
1434
1449
|
const verbose = Boolean(opts.verbose);
|
|
1435
1450
|
const apiBase = resolveApiBase(process.env.LITMUS_API_URL);
|
|
1436
1451
|
setErrorContext({ token, apiBase });
|
|
@@ -1747,7 +1762,7 @@ async function connectFlow(token, ideOpt, opts, skillImport, attempt) {
|
|
|
1747
1762
|
return;
|
|
1748
1763
|
attempt.finish("ssh_ready");
|
|
1749
1764
|
skillImport.launcher = async () => {
|
|
1750
|
-
const ready = await startBackgroundLauncher({ backendUrl, token, alias, pageUrl, browserAvailable: Boolean(conn.browser_ide_url), assessmentName: meta.assessmentName });
|
|
1765
|
+
const ready = await startBackgroundLauncher({ backendUrl, token, alias, pageUrl, browserAvailable: Boolean(conn.browser_ide_url), assessmentName: meta.assessmentName, connectStartedAt });
|
|
1751
1766
|
if (ready) {
|
|
1752
1767
|
ora().succeed("Workspace ready · Laptop connected");
|
|
1753
1768
|
console.log("\nLaunch your tools from the assessment page.");
|
|
@@ -2005,22 +2020,27 @@ async function connectFlow(token, ideOpt, opts, skillImport, attempt) {
|
|
|
2005
2020
|
const resend = { done: false };
|
|
2006
2021
|
const launchPlan = editorLaunchPlan(editor, alias);
|
|
2007
2022
|
const launches = resendableLaunch((logPath) => launchEditor(editor, resolved.command, alias, logPath, launcherBetaEnabled));
|
|
2008
|
-
// Local UI extension: it survives a remote-host disconnect
|
|
2009
|
-
//
|
|
2010
|
-
|
|
2011
|
-
|
|
2023
|
+
// Local UI extension: it survives a remote-host disconnect and is registered
|
|
2024
|
+
// against this exact authority + workspace. Cursor also uses it for Agents
|
|
2025
|
+
// handoff; VS Code receives it only when launcher teardown is requested.
|
|
2026
|
+
if (editor.ide === "cursor" || opts.cursorSessionCleanup === true) {
|
|
2027
|
+
const sessionOptions = editor.ide === "cursor"
|
|
2028
|
+
? cursorSessionOptions(opts)
|
|
2029
|
+
: { handoff: false, cleanup: opts.cursorSessionCleanup === true };
|
|
2012
2030
|
const enabled = sessionOptions.handoff || sessionOptions.cleanup;
|
|
2013
2031
|
if (enabled)
|
|
2014
|
-
info(
|
|
2032
|
+
info(`Setting up the Litmus ${editor.label} companion for this workspace.`);
|
|
2015
2033
|
try {
|
|
2016
2034
|
const ready = await prepareCursorSession(resolved.command, alias, backendUrl, token, sessionOptions);
|
|
2017
2035
|
if (enabled)
|
|
2018
2036
|
skillImport.footer.push(ready
|
|
2019
|
-
?
|
|
2020
|
-
|
|
2037
|
+
? sessionOptions.cleanup
|
|
2038
|
+
? `${editor.label} companion enabled. When the assessment ends, it disconnects only this clean assessment workspace and removes its Open Recent entry. Saved chats are not deleted.`
|
|
2039
|
+
: `${editor.label} companion enabled for workspace handoff.`
|
|
2040
|
+
: `${editor.label} companion unavailable. Continue in the IDE; close this assessment window manually when it ends.`);
|
|
2021
2041
|
}
|
|
2022
2042
|
catch {
|
|
2023
|
-
skillImport.footer.push(
|
|
2043
|
+
skillImport.footer.push(`${editor.label} companion setup failed. Your normal IDE connection is unaffected; automatic window cleanup may be unavailable.`);
|
|
2024
2044
|
}
|
|
2025
2045
|
}
|
|
2026
2046
|
const outcome = await attemptEditorLaunch(editor, {
|
|
@@ -2148,60 +2168,186 @@ async function connectFlow(token, ideOpt, opts, skillImport, attempt) {
|
|
|
2148
2168
|
// which also carries why we do not simply close the window.
|
|
2149
2169
|
skillImport.footer.push(...editorEndingForewarning());
|
|
2150
2170
|
}
|
|
2171
|
+
function launcherCleanupHandlers(token, report = (outcome, entry) => {
|
|
2172
|
+
const stage = outcome === "queued" ? "cleanup_queued" : outcome === "retry" ? "cleanup_retry" :
|
|
2173
|
+
outcome === "abandoned" ? "cleanup_abandoned" : "cleanup_complete";
|
|
2174
|
+
reportLauncherTiming(entry.backendOrigin, token, stage, 0, { outcome: outcome === "abandoned" ? "failed" : "ok" });
|
|
2175
|
+
}) {
|
|
2176
|
+
return {
|
|
2177
|
+
cleanup: async (entry) => {
|
|
2178
|
+
const context = { backendUrl: entry.backendOrigin, token, alias: entry.alias };
|
|
2179
|
+
clearLauncherInventoryCache(context);
|
|
2180
|
+
clearLauncherPreparationCache(context);
|
|
2181
|
+
await attemptIndependentCleanup([
|
|
2182
|
+
() => removeClaudeDesktopConnection(entry.alias, entry.assessmentName),
|
|
2183
|
+
() => removeTerminalLauncher(entry.alias),
|
|
2184
|
+
...(entry.ssh ? [() => executeSshConfigCleanupPlan(path.join(os.homedir(), ".ssh", "config"), entry.ssh)] : []),
|
|
2185
|
+
]);
|
|
2186
|
+
},
|
|
2187
|
+
report,
|
|
2188
|
+
};
|
|
2189
|
+
}
|
|
2151
2190
|
/** Used only by the detached launcher after the interactive setup has completed. */
|
|
2152
2191
|
export function runPreparedPortalLauncher(context, onReady, signal) {
|
|
2153
2192
|
const checkedDesktopApps = new Set();
|
|
2154
2193
|
const attemptedVscode = new Set();
|
|
2194
|
+
const seenPreparation = new Set();
|
|
2155
2195
|
const native = createPreparedEditorLauncher(context.alias);
|
|
2156
2196
|
const desktopReadiness = createPreparedDesktopReadiness(context.alias);
|
|
2157
|
-
const
|
|
2197
|
+
const sshConfig = path.join(os.homedir(), ".ssh", "config");
|
|
2198
|
+
const cleanupSsh = createSshConfigCleanupPlan(sshConfig, context.alias);
|
|
2199
|
+
let cleanupQueued = false;
|
|
2200
|
+
const cachedInventory = loadLauncherInventoryCache(context);
|
|
2201
|
+
const timing = (stage, elapsedMs, extra) => reportLauncherTiming(context.backendUrl, context.token, stage, elapsedMs, extra);
|
|
2202
|
+
const cleanupHandlers = launcherCleanupHandlers(context.token);
|
|
2158
2203
|
return runPortalLauncher({
|
|
2159
|
-
...context, onReady, signal,
|
|
2160
|
-
|
|
2204
|
+
...context, onReady, signal, cachedInventory: cachedInventory ?? undefined,
|
|
2205
|
+
onInventoryCacheRejected: () => {
|
|
2206
|
+
clearLauncherInventoryCache(context);
|
|
2207
|
+
clearLauncherPreparationCache(context);
|
|
2208
|
+
},
|
|
2209
|
+
onInventoryRevalidated: (tools, generationValue) => {
|
|
2210
|
+
const generation = parseWorkspaceGeneration(generationValue);
|
|
2211
|
+
if (generation)
|
|
2212
|
+
saveLauncherInventoryCache(context, generation, tools);
|
|
2213
|
+
},
|
|
2214
|
+
onRegistered: async (generationValue) => {
|
|
2161
2215
|
try {
|
|
2162
|
-
|
|
2216
|
+
await queueLauncherCleanup(context, generationValue, cleanupSsh, cleanupHandlers);
|
|
2217
|
+
cleanupQueued = Boolean(parseWorkspaceGeneration(generationValue));
|
|
2163
2218
|
}
|
|
2164
|
-
catch { /*
|
|
2165
|
-
|
|
2166
|
-
|
|
2219
|
+
catch { /* Cleanup durability must never prevent the launcher from becoming ready. */ }
|
|
2220
|
+
},
|
|
2221
|
+
reportTiming: timing,
|
|
2222
|
+
onSubmitted: async () => {
|
|
2223
|
+
const outcome = cleanupQueued
|
|
2224
|
+
? await reconcileLauncherCleanup(context.token, cleanupHandlers, undefined, true)
|
|
2225
|
+
: "none";
|
|
2226
|
+
// Old launcher backends do not return a generation. Preserve their prior,
|
|
2227
|
+
// exact-region cleanup behavior without putting an unfenced job on disk.
|
|
2228
|
+
if (outcome === "none") {
|
|
2229
|
+
await cleanupHandlers.cleanup({
|
|
2230
|
+
schema: 1, savedAt: Date.now(), backendOrigin: new URL(context.backendUrl).origin,
|
|
2231
|
+
alias: context.alias, assessmentName: context.assessmentName ?? "Assessment",
|
|
2232
|
+
generation: { epoch: 0, container_id: "legacy" }, ssh: cleanupSsh, attempts: 0, nextAttemptAt: 0,
|
|
2233
|
+
});
|
|
2234
|
+
cleanupHandlers.report?.("complete", {
|
|
2235
|
+
schema: 1, savedAt: Date.now(), backendOrigin: new URL(context.backendUrl).origin,
|
|
2236
|
+
alias: context.alias, assessmentName: context.assessmentName ?? "Assessment",
|
|
2237
|
+
generation: { epoch: 0, container_id: "legacy" }, ssh: cleanupSsh, attempts: 0, nextAttemptAt: 0,
|
|
2238
|
+
});
|
|
2167
2239
|
}
|
|
2168
|
-
catch { /* Preserve config if busy or externally edited. */ }
|
|
2169
2240
|
},
|
|
2170
2241
|
openUrl: url => url === context.pageUrl ? Promise.resolve(true) : openBrowser(url),
|
|
2171
|
-
prepareTools: async (installed, signal) => Promise.all(installed.map(async (app) => {
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2242
|
+
prepareTools: async (installed, signal, onPrepared, generationValue) => Promise.all(installed.map(async (app) => {
|
|
2243
|
+
const started = performance.now();
|
|
2244
|
+
const key = `${app.tool}:${app.command}`;
|
|
2245
|
+
const generation = parseWorkspaceGeneration(generationValue);
|
|
2246
|
+
let preparationInput = null;
|
|
2247
|
+
if (generation && !app.unavailable && app.tool === "vscode") {
|
|
2176
2248
|
const resolved = resolveEditorCommand(NATIVE_EDITORS.vscode);
|
|
2177
2249
|
const commit = resolved?.version.commit;
|
|
2178
2250
|
if (resolved && commit && identifyEditorCli(NATIVE_EDITORS.vscode, resolved.command).kind === "match") {
|
|
2179
|
-
|
|
2251
|
+
preparationInput = {
|
|
2252
|
+
generation, tool: app.tool, command: app.command,
|
|
2253
|
+
preparationFingerprint: createHash("sha256").update(`vscode-server:${commit}`).digest("hex"),
|
|
2254
|
+
};
|
|
2180
2255
|
}
|
|
2181
|
-
return app;
|
|
2182
2256
|
}
|
|
2183
|
-
if (app.unavailable
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2257
|
+
else if (generation && !app.unavailable && (app.tool === "codex" || app.tool === "claude")) {
|
|
2258
|
+
preparationInput = {
|
|
2259
|
+
generation, tool: app.tool, command: app.command,
|
|
2260
|
+
preparationFingerprint: createHash("sha256").update(desktopAppProbeCommand(app.tool)).digest("hex"),
|
|
2261
|
+
};
|
|
2262
|
+
}
|
|
2263
|
+
const cacheHit = preparationInput ? hasLauncherPreparationCache(context, preparationInput) : false;
|
|
2264
|
+
if (preparationInput)
|
|
2265
|
+
timing(cacheHit ? "tool_preparation_cache_hit" : "tool_preparation_cache_miss", performance.now() - started, { tool: app.tool });
|
|
2266
|
+
const temperature = cacheHit || seenPreparation.has(key) ? "warm" : "cold";
|
|
2267
|
+
timing("tool_preparation_started", 0, { tool: app.tool, temperature });
|
|
2268
|
+
let outcome = "ok";
|
|
2269
|
+
let prepared = app;
|
|
2270
|
+
let threw = false;
|
|
2271
|
+
try {
|
|
2272
|
+
if (cacheHit) {
|
|
2273
|
+
if (app.tool === "claude") {
|
|
2274
|
+
try {
|
|
2275
|
+
configureClaudeDesktopConnection(context.alias, context.assessmentName ?? "Assessment");
|
|
2276
|
+
}
|
|
2277
|
+
catch {
|
|
2278
|
+
outcome = "failed";
|
|
2279
|
+
prepared = { ...app, unavailable: "desktop_setup_failed" };
|
|
2280
|
+
return prepared;
|
|
2281
|
+
}
|
|
2192
2282
|
}
|
|
2193
|
-
|
|
2194
|
-
|
|
2283
|
+
return prepared;
|
|
2284
|
+
}
|
|
2285
|
+
if (app.tool === "vscode" && !app.unavailable) {
|
|
2286
|
+
if (attemptedVscode.has(app.command))
|
|
2287
|
+
return prepared;
|
|
2288
|
+
const resolved = resolveEditorCommand(NATIVE_EDITORS.vscode);
|
|
2289
|
+
const commit = resolved?.version.commit;
|
|
2290
|
+
if (resolved && commit && identifyEditorCli(NATIVE_EDITORS.vscode, resolved.command).kind === "match") {
|
|
2291
|
+
const ready = await prepareVscodeServer(context.alias, commit, signal);
|
|
2292
|
+
if (!ready) {
|
|
2293
|
+
outcome = "failed";
|
|
2294
|
+
return prepared;
|
|
2295
|
+
}
|
|
2296
|
+
attemptedVscode.add(app.command);
|
|
2195
2297
|
}
|
|
2298
|
+
return prepared;
|
|
2196
2299
|
}
|
|
2197
|
-
|
|
2198
|
-
|
|
2300
|
+
if (app.unavailable) {
|
|
2301
|
+
outcome = "failed";
|
|
2302
|
+
return prepared;
|
|
2303
|
+
}
|
|
2304
|
+
if (app.tool !== "codex" && app.tool !== "claude")
|
|
2305
|
+
return prepared;
|
|
2306
|
+
if (checkedDesktopApps.has(key))
|
|
2307
|
+
return prepared;
|
|
2308
|
+
if (await desktopRuntimeReady(context.alias, app.tool, signal)) {
|
|
2309
|
+
if (app.tool === "claude") {
|
|
2310
|
+
try {
|
|
2311
|
+
configureClaudeDesktopConnection(context.alias, context.assessmentName ?? "Assessment");
|
|
2312
|
+
}
|
|
2313
|
+
catch {
|
|
2314
|
+
outcome = "failed";
|
|
2315
|
+
prepared = { ...app, unavailable: "desktop_setup_failed" };
|
|
2316
|
+
return prepared;
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
checkedDesktopApps.add(key);
|
|
2320
|
+
return prepared;
|
|
2321
|
+
}
|
|
2322
|
+
outcome = "failed";
|
|
2323
|
+
prepared = { ...app, unavailable: "workspace_not_ready" };
|
|
2324
|
+
return prepared;
|
|
2325
|
+
}
|
|
2326
|
+
catch (error) {
|
|
2327
|
+
outcome = "failed";
|
|
2328
|
+
threw = true;
|
|
2329
|
+
throw error;
|
|
2330
|
+
}
|
|
2331
|
+
finally {
|
|
2332
|
+
seenPreparation.add(key);
|
|
2333
|
+
if (!threw && !cacheHit && outcome === "ok" && !prepared.unavailable && preparationInput)
|
|
2334
|
+
saveLauncherPreparationCache(context, preparationInput);
|
|
2335
|
+
timing("tool_preparation_complete", performance.now() - started, { tool: app.tool, temperature, outcome });
|
|
2336
|
+
if (!threw)
|
|
2337
|
+
await onPrepared(prepared);
|
|
2199
2338
|
}
|
|
2200
|
-
return { ...app, unavailable: "workspace_not_ready" };
|
|
2201
2339
|
})),
|
|
2202
2340
|
launch: async (tool, installed, signal, launchContext) => {
|
|
2203
2341
|
if (tool === "vscode" || tool === "cursor") {
|
|
2204
|
-
|
|
2342
|
+
const started = performance.now();
|
|
2343
|
+
let verified = false;
|
|
2344
|
+
let readinessPath;
|
|
2345
|
+
const result = await native.launch(tool, launchContext?.generation, remember => openNativeEditor(tool, context.token, signal, undefined, value => { verified = true; readinessPath ?? (readinessPath = "poll"); remember(value); }, launchContext?.generation, launchContext?.remoteReady, () => { verified = true; readinessPath = "event"; }), signal);
|
|
2346
|
+
if (result === "failed")
|
|
2347
|
+
clearLauncherPreparationCache(context);
|
|
2348
|
+
if (verified)
|
|
2349
|
+
timing("remote_ready", performance.now() - started, { tool, requestId: launchContext?.requestId, outcome: "ok", readinessPath });
|
|
2350
|
+
return result;
|
|
2205
2351
|
}
|
|
2206
2352
|
if (tool === "browser") {
|
|
2207
2353
|
const current = await getConnection(context.backendUrl, context.token);
|
|
@@ -2209,13 +2355,16 @@ export function runPreparedPortalLauncher(context, onReady, signal) {
|
|
|
2209
2355
|
}
|
|
2210
2356
|
if (tool === "codex" || tool === "claude") {
|
|
2211
2357
|
const app = installed.find(i => i.tool === tool);
|
|
2212
|
-
if (!app || app.unavailable || !await desktopReadiness.check(tool, app.command, launchContext?.generation, signal))
|
|
2358
|
+
if (!app || app.unavailable || !await desktopReadiness.check(tool, app.command, launchContext?.generation, signal)) {
|
|
2359
|
+
clearLauncherPreparationCache(context);
|
|
2213
2360
|
return "failed";
|
|
2361
|
+
}
|
|
2214
2362
|
if (tool === "claude") {
|
|
2215
2363
|
try {
|
|
2216
2364
|
configureClaudeDesktopConnection(context.alias, context.assessmentName ?? "Assessment");
|
|
2217
2365
|
}
|
|
2218
2366
|
catch {
|
|
2367
|
+
clearLauncherPreparationCache(context);
|
|
2219
2368
|
return "failed";
|
|
2220
2369
|
}
|
|
2221
2370
|
}
|
|
@@ -2224,7 +2373,11 @@ export function runPreparedPortalLauncher(context, onReady, signal) {
|
|
|
2224
2373
|
const opened = await openDesktop(app, context.alias, signal);
|
|
2225
2374
|
if (!opened)
|
|
2226
2375
|
desktopReadiness.invalidate();
|
|
2227
|
-
|
|
2376
|
+
// Claude's deep link carries the exact current alias and assessment
|
|
2377
|
+
// folder, but an accepted OS handoff cannot prove that Claude selected
|
|
2378
|
+
// it. Keep the portal at an explicit confirmation state until the
|
|
2379
|
+
// generation-fenced native hook observes activity in this workspace.
|
|
2380
|
+
return desktopLaunchOutcome(tool, opened);
|
|
2228
2381
|
}
|
|
2229
2382
|
const terminal = installed.find(i => i.tool === "ssh");
|
|
2230
2383
|
return terminal && await openTerminal(context.alias, terminal.command, launchContext?.requestId) ? "dispatched" : "failed";
|