diff --git a/packages/amico-run/src/pasqal_verb.ts b/packages/amico-run/src/pasqal_verb.ts index 301f279df..183b82a3d 100644 --- a/packages/amico-run/src/pasqal_verb.ts +++ b/packages/amico-run/src/pasqal_verb.ts @@ -24,9 +24,9 @@ // token appears in the digest, the JSON output, or the launcher argv. import { spawn } from "node:child_process"; import { existsSync } from "node:fs"; -import { homedir } from "node:os"; import { dirname, join, resolve } from "node:path"; import { fileURLToPath } from "node:url"; +import { amicodeOpsDir } from "./session_retention.js"; import { pulseSha256, readDevicePathStatus, @@ -55,15 +55,6 @@ function flagValue(argv: string[], name: string): string | undefined { // ── connector + launcher resolution ─────────────────────────────────────────── -/** $AMICODE_OPS_DIR → ~/.amico/amicode — the SAME resolution the fork's - * amicodeOpsDir() and the extension use, so the packaged connector is found - * where it is staged. */ -function amicodeOpsDir(env: NodeJS.ProcessEnv): string { - const v = env.AMICODE_OPS_DIR; - if (v && v.trim() !== "") return v; - return join(homedir(), ".amico", "amicode"); -} - /** $AMICO_PASQAL_CONNECTOR overrides; default is the staged submit connector. */ function connectorScript(env: NodeJS.ProcessEnv): string { const v = env.AMICO_PASQAL_CONNECTOR; diff --git a/packages/amico-run/src/solver_mode.ts b/packages/amico-run/src/solver_mode.ts index 1c44eb8a9..60bb2a966 100644 --- a/packages/amico-run/src/solver_mode.ts +++ b/packages/amico-run/src/solver_mode.ts @@ -1,6 +1,6 @@ import { readFileSync } from "node:fs"; -import { homedir } from "node:os"; import { join } from "node:path"; +import { amicodeOpsDir } from "./session_retention.js"; // ============================================================================ // The selected solver, read from the extension's solver-mode.json contract. @@ -17,13 +17,8 @@ import { join } from "node:path"; export type SolverMode = "piccolo" | "hp"; -/** $AMICODE_OPS_DIR → ~/.amico/amicode — the SAME resolution the fork's - * amicodeOpsDir(), the extension, and pasqal_verb.ts use, so we read exactly - * the file the extension wrote. */ -function amicodeOpsDir(env: NodeJS.ProcessEnv): string { - const v = env.AMICODE_OPS_DIR; - return v && v.trim() !== "" ? v : join(homedir(), ".amico", "amicode"); -} +// amicodeOpsDir (session_retention.ts) is the amico-run resolution: $AMICODE_OPS_DIR +// → ~/.amico/amicode, so we read exactly the file the extension wrote. export function solverModeFile(env: NodeJS.ProcessEnv = process.env): string { return join(amicodeOpsDir(env), "solver-mode.json");