@super-one/cli 0.57.2-alpha → 0.57.3-alpha

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.
Files changed (3) hide show
  1. package/MANIFEST.json +2 -2
  2. package/lib/cli.mjs +591 -598
  3. package/package.json +1 -1
package/lib/cli.mjs CHANGED
@@ -2990,7 +2990,7 @@ If the tool returns an error containing "user_locked", the user has manually nam
2990
2990
  },
2991
2991
  {
2992
2992
  "name": "browser_act",
2993
- "description": "Submit 1\u201320 page actions as one call: click, hover, type, press, scroll, drag, select, upload. Prefer a CSS selector from snapshot/query; click/hover also accept text or x/y. engine=auto|cdp|synthetic (default auto). description is shown to the user instead of raw selectors. Do not use this to navigate (browser_tabs), wait (browser_wait_for), or run JS (browser_evaluate). Fail-fast: stops at the first error.",
2993
+ "description": "Submit 1\u201320 page actions as one call: click, hover, type, press, scroll, drag, select, upload. Prefer a CSS selector from snapshot/query; click/hover also accept text or x/y. engine=auto|cdp|synthetic (default auto). description is shown to the user instead of raw selectors. Set recording=true to save a short video containing only this action transaction. Optional expect keeps the recording open until an explicit page condition is met. Do not use this to navigate (browser_tabs), wait (browser_wait_for), or run JS (browser_evaluate). Fail-fast: stops at the first error.",
2994
2994
  "inputSchema": {
2995
2995
  "type": "object",
2996
2996
  "properties": {
@@ -3008,7 +3008,19 @@ If the tool returns an error containing "user_locked", the user has manually nam
3008
3008
  "required": ["type"],
3009
3009
  "additionalProperties": true
3010
3010
  }
3011
- }
3011
+ },
3012
+ "recording": { "type": "boolean", "description": "Save a video of only this action transaction. Default false." },
3013
+ "expect": {
3014
+ "type": "object",
3015
+ "properties": {
3016
+ "selector": { "type": "string" },
3017
+ "selectorGone": { "type": "string" },
3018
+ "text": { "type": "string" },
3019
+ "urlIncludes": { "type": "string" }
3020
+ },
3021
+ "additionalProperties": false
3022
+ },
3023
+ "timeoutMs": { "type": "integer", "minimum": 100, "maximum": 6e4 }
3012
3024
  },
3013
3025
  "required": ["actions"],
3014
3026
  "additionalProperties": false
@@ -3277,7 +3289,7 @@ If the tool returns an error containing "user_locked", the user has manually nam
3277
3289
  },
3278
3290
  {
3279
3291
  "name": "computer_act",
3280
- "description": "Submit 1\u201320 related UI actions as a checked transaction against a stateId. Delivery policy (pick explicitly when possible): (1) Prefer delivery=semantic whenever actions use @eN refs and the action is press/setText/click(ref)/typeText(ref) \u2014 pure AX, most reliable for labeled controls. (2) Use delivery=app-directed (runtime default if omitted) for coordinate click/type/scroll/drag/keypress or when no usable AX ref exists \u2014 posts CGEvent to the target app PID in the background without stealing frontmost. (3) Use delivery=physical only when app-directed fails and global HID is required (requires frontmost; disruptive). Actions: click, typeText, keypress, scroll(dx,dy[,x,y|ref]), drag(path\u22652 points), moveMouse, press/setText (AX). scroll: positive dy scrolls content down; aim with x,y (capture space) or ref center; else window/outline center. drag: path is capture-space points; virtual cursor animates along the path. Returns outcome worked|didnt|unknown based on re-observation (not API success codes): worked when AX readback, expect, typed text, or a meaningful successor outline diff confirms effect; unknown only when applied but unprovable; didnt on hard failure or failed expect. When the successor has pixels, successorImage.path contains the fresh screenshot. Stale stateId (UI changed since snapshot) is rejected before side effects. delivery=semantic never silently upgrades to app-directed/physical input.",
3292
+ "description": "Submit 1\u201320 related UI actions as a checked transaction against a stateId. Delivery policy (pick explicitly when possible): (1) Prefer delivery=semantic whenever actions use @eN refs and the action is press/setText/click(ref)/typeText(ref) \u2014 pure AX, most reliable for labeled controls. (2) Use delivery=app-directed (runtime default if omitted) for coordinate click/type/scroll/drag/keypress or when no usable AX ref exists \u2014 posts CGEvent to the target app PID in the background without stealing frontmost. (3) Use delivery=physical only when app-directed fails and global HID is required (requires frontmost; disruptive). Actions: click, typeText, keypress, scroll(dx,dy[,x,y|ref]), drag(path\u22652 points), moveMouse, press/setText (AX). scroll: positive dy scrolls content down; aim with x,y (capture space) or ref center; else window/outline center. drag: path is capture-space points; virtual cursor animates along the path. Returns outcome worked|didnt|unknown based on re-observation (not API success codes): worked when AX readback, expect, typed text, or a meaningful successor outline diff confirms effect; unknown only when applied but unprovable; didnt on hard failure or failed expect. When the successor has pixels, successorImage.path contains the fresh screenshot. Set recording=true to save a short video containing only this action transaction. Stale stateId (UI changed since snapshot) is rejected before side effects. delivery=semantic never silently upgrades to app-directed/physical input.",
3281
3293
  "inputSchema": {
3282
3294
  "type": "object",
3283
3295
  "properties": {
@@ -3396,6 +3408,16 @@ If the tool returns an error containing "user_locked", the user has manually nam
3396
3408
  ],
3397
3409
  "additionalProperties": false
3398
3410
  },
3411
+ "recording": {
3412
+ "description": "Save a video of only this action transaction. Default false.",
3413
+ "type": "boolean"
3414
+ },
3415
+ "timeoutMs": {
3416
+ "description": "Maximum wait for expect before the action is judged. Default 5000.",
3417
+ "type": "integer",
3418
+ "minimum": 100,
3419
+ "maximum": 6e4
3420
+ },
3399
3421
  "delivery": {
3400
3422
  "description": "Prefer semantic when actions target @eN refs (press/setText/click/typeText). Omit or app-directed = background postToPid (default). physical = global HID + frontmost only as last resort.",
3401
3423
  "type": "string",
@@ -3800,7 +3822,7 @@ If the tool returns an error containing "user_locked", the user has manually nam
3800
3822
  },
3801
3823
  {
3802
3824
  "name": "device_act",
3803
- "description": "Run 1-10 touch actions against a snapshot, then re-observe to judge if they worked. Actions: tap, doubleTap, longPress, swipe(direction|toX/toY), pinch(scale), press(ref), type, key, rotate, keyboard. Prefer press for a ref-backed control; it goes through accessibility, immune to animation, rotation and scale (not on a source=ocr snapshot \u2014 tap there). Aim touch actions at refs too; raw x/y is a last resort. The whole batch, stale stateId included, is validated up front. rotate ends the snapshot it is in: put it last, then re-snapshot \u2014 a later ref or coordinate is refused. Returns worked|didnt|unknown; unknown means input landed but nothing visibly changed. Pass expect to define success.",
3825
+ "description": "Run 1-10 touch actions against a snapshot, then re-observe to judge if they worked. Actions: tap, doubleTap, longPress, swipe(direction|toX/toY), pinch(scale), press(ref), type, key, rotate, keyboard. Prefer refs; press uses accessibility and is resilient to animation (use tap for source=ocr). Raw x/y is a last resort. The batch and stale stateId are validated before side effects. rotate must be last; re-snapshot afterwards. Set recording=true to save a short video containing only this action transaction. Returns worked|didnt|unknown. Pass expect to define and wait for success.",
3804
3826
  "inputSchema": {
3805
3827
  "type": "object",
3806
3828
  "properties": {
@@ -3808,7 +3830,9 @@ If the tool returns an error containing "user_locked", the user has manually nam
3808
3830
  "device": deviceTargetProperty,
3809
3831
  "stateId": { "type": "string" },
3810
3832
  "actions": { "minItems": 1, "maxItems": 10, "type": "array", "items": deviceActionSchema },
3811
- "expect": { "description": "Postcondition checked after the actions run.", ...deviceConditionSchema }
3833
+ "expect": { "description": "Postcondition checked after the actions run.", ...deviceConditionSchema },
3834
+ "timeoutMs": { "description": "Maximum wait for expect before the action is judged. Default 5000.", "type": "integer", "minimum": 100, "maximum": 6e4 },
3835
+ "recording": { "description": "Save a video of only this action transaction. Default false.", "type": "boolean" }
3812
3836
  },
3813
3837
  "required": ["description", "stateId", "actions"],
3814
3838
  "additionalProperties": false
@@ -4548,9 +4572,9 @@ var require_node_gyp_build = __commonJS({
4548
4572
  var debug = getFirst(path.join(dir, "build/Debug"), matchBuild);
4549
4573
  if (debug) return debug;
4550
4574
  }
4551
- var prebuild = resolve14(dir);
4575
+ var prebuild = resolve15(dir);
4552
4576
  if (prebuild) return prebuild;
4553
- var nearby = resolve14(path.dirname(process.execPath));
4577
+ var nearby = resolve15(path.dirname(process.execPath));
4554
4578
  if (nearby) return nearby;
4555
4579
  var target = [
4556
4580
  "platform=" + platform2,
@@ -4566,7 +4590,7 @@ var require_node_gyp_build = __commonJS({
4566
4590
  // eslint-disable-line
4567
4591
  ].filter(Boolean).join(" ");
4568
4592
  throw new Error("No native build was found for " + target + "\n loaded from: " + dir + "\n");
4569
- function resolve14(dir2) {
4593
+ function resolve15(dir2) {
4570
4594
  var tuples = readdirSync12(path.join(dir2, "prebuilds")).map(parseTuple);
4571
4595
  var tuple2 = tuples.filter(matchTuple(platform2, arch2)).sort(compareTuples)[0];
4572
4596
  if (!tuple2) return;
@@ -18701,139 +18725,16 @@ var init_hooks_config = __esm({
18701
18725
  }
18702
18726
  });
18703
18727
 
18704
- // ../../packages/runtime/src/fs/additional-dirs-config.ts
18705
- import { existsSync as existsSync14, mkdirSync as mkdirSync11, readFileSync as readFileSync12, writeFileSync as writeFileSync9 } from "node:fs";
18728
+ // ../../packages/runtime/src/fs/agents-discover.ts
18729
+ import { existsSync as existsSync14, readdirSync as readdirSync5, readFileSync as readFileSync12 } from "node:fs";
18730
+ import { join as join15 } from "node:path";
18706
18731
  import { homedir as osHomedir7 } from "node:os";
18707
- import { dirname as dirname12, join as join15 } from "node:path";
18708
18732
  function homeOf7(opts) {
18709
18733
  return opts?.homeDir ?? osHomedir7();
18710
18734
  }
18711
- function codexHomeOf3(opts) {
18712
- if (opts?.codexHome) return opts.codexHome;
18713
- return process.env.CODEX_HOME?.trim() || join15(homeOf7(opts), ".codex");
18714
- }
18715
- function readJson3(filePath) {
18716
- if (!existsSync14(filePath)) return null;
18717
- try {
18718
- return JSON.parse(readFileSync12(filePath, "utf8"));
18719
- } catch {
18720
- return null;
18721
- }
18722
- }
18723
- function readToml(filePath) {
18724
- if (!existsSync14(filePath)) return null;
18725
- try {
18726
- return parse(readFileSync12(filePath, "utf8"));
18727
- } catch {
18728
- return null;
18729
- }
18730
- }
18731
- function cleanDirs(value) {
18732
- if (!Array.isArray(value)) return [];
18733
- return Array.from(new Set(value.filter((dir) => typeof dir === "string" && dir.trim().length > 0)));
18734
- }
18735
- function claudeDirs(data) {
18736
- if (!data) return [];
18737
- const permissions = data.permissions;
18738
- const nested = permissions && typeof permissions === "object" && !Array.isArray(permissions) ? permissions.additionalDirectories : void 0;
18739
- return Array.from(/* @__PURE__ */ new Set([
18740
- ...cleanDirs(data.additionalDirectories),
18741
- ...cleanDirs(nested)
18742
- ]));
18743
- }
18744
- function codexDirs(data) {
18745
- if (!data) return [];
18746
- const workspaceWrite = data.sandbox_workspace_write;
18747
- if (!workspaceWrite || typeof workspaceWrite !== "object" || Array.isArray(workspaceWrite)) return [];
18748
- return cleanDirs(workspaceWrite.writable_roots);
18749
- }
18750
- function readScopedAdditionalDirs(provider, cwd, opts) {
18751
- if (provider === "codex") {
18752
- return {
18753
- user: codexDirs(readToml(join15(codexHomeOf3(opts), "config.toml"))),
18754
- projectShared: [],
18755
- projectLocal: codexDirs(readToml(join15(cwd, ".codex", "config.toml")))
18756
- };
18757
- }
18758
- return {
18759
- user: claudeDirs(readJson3(join15(homeOf7(opts), ".claude", "settings.json"))),
18760
- projectShared: claudeDirs(readJson3(join15(cwd, ".claude", "settings.json"))),
18761
- projectLocal: claudeDirs(readJson3(join15(cwd, ".claude", "settings.local.json")))
18762
- };
18763
- }
18764
- function addProjectAdditionalDir(provider, cwd, dir, opts) {
18765
- if (provider === "codex") {
18766
- const filePath2 = join15(cwd, ".codex", "config.toml");
18767
- const data2 = readToml(filePath2) ?? {};
18768
- const current2 = data2.sandbox_workspace_write;
18769
- const workspaceWrite = current2 && typeof current2 === "object" && !Array.isArray(current2) ? current2 : {};
18770
- const existing2 = cleanDirs(workspaceWrite.writable_roots);
18771
- if (existing2.includes(dir)) return;
18772
- workspaceWrite.writable_roots = [...existing2, dir];
18773
- data2.sandbox_workspace_write = workspaceWrite;
18774
- mkdirSync11(dirname12(filePath2), { recursive: true });
18775
- writeFileSync9(filePath2, stringify(data2), "utf8");
18776
- return;
18777
- }
18778
- const filePath = join15(cwd, ".claude", "settings.local.json");
18779
- const data = readJson3(filePath) ?? {};
18780
- const current = data.permissions;
18781
- const permissions = current && typeof current === "object" && !Array.isArray(current) ? current : {};
18782
- const existing = cleanDirs(permissions.additionalDirectories);
18783
- if (existing.includes(dir)) return;
18784
- permissions.additionalDirectories = [...existing, dir];
18785
- data.permissions = permissions;
18786
- mkdirSync11(dirname12(filePath), { recursive: true });
18787
- writeFileSync9(filePath, `${JSON.stringify(data, null, 2)}
18788
- `, "utf8");
18789
- }
18790
- function removeProjectAdditionalDir(provider, cwd, dir) {
18791
- if (provider === "codex") {
18792
- const filePath2 = join15(cwd, ".codex", "config.toml");
18793
- const data2 = readToml(filePath2);
18794
- if (!data2) return;
18795
- const current2 = data2.sandbox_workspace_write;
18796
- if (!current2 || typeof current2 !== "object" || Array.isArray(current2)) return;
18797
- const workspaceWrite = current2;
18798
- const existing2 = cleanDirs(workspaceWrite.writable_roots);
18799
- const filtered2 = existing2.filter((root) => root !== dir);
18800
- if (filtered2.length === existing2.length) return;
18801
- if (filtered2.length > 0) workspaceWrite.writable_roots = filtered2;
18802
- else delete workspaceWrite.writable_roots;
18803
- if (Object.keys(workspaceWrite).length === 0) delete data2.sandbox_workspace_write;
18804
- writeFileSync9(filePath2, stringify(data2), "utf8");
18805
- return;
18806
- }
18807
- const filePath = join15(cwd, ".claude", "settings.local.json");
18808
- const data = readJson3(filePath);
18809
- if (!data) return;
18810
- const current = data.permissions;
18811
- if (!current || typeof current !== "object" || Array.isArray(current)) return;
18812
- const permissions = current;
18813
- const existing = cleanDirs(permissions.additionalDirectories);
18814
- const filtered = existing.filter((root) => root !== dir);
18815
- if (filtered.length === existing.length) return;
18816
- permissions.additionalDirectories = filtered;
18817
- writeFileSync9(filePath, `${JSON.stringify(data, null, 2)}
18818
- `, "utf8");
18819
- }
18820
- var init_additional_dirs_config = __esm({
18821
- "../../packages/runtime/src/fs/additional-dirs-config.ts"() {
18822
- "use strict";
18823
- init_dist();
18824
- }
18825
- });
18826
-
18827
- // ../../packages/runtime/src/fs/agents-discover.ts
18828
- import { existsSync as existsSync15, readdirSync as readdirSync5, readFileSync as readFileSync13 } from "node:fs";
18829
- import { join as join16 } from "node:path";
18830
- import { homedir as osHomedir8 } from "node:os";
18831
- function homeOf8(opts) {
18832
- return opts?.homeDir ?? osHomedir8();
18833
- }
18834
18735
  function safeRead(path) {
18835
18736
  try {
18836
- return readFileSync13(path, "utf-8");
18737
+ return readFileSync12(path, "utf-8");
18837
18738
  } catch {
18838
18739
  return "";
18839
18740
  }
@@ -18880,10 +18781,10 @@ function parseFrontmatter(content) {
18880
18781
  return result;
18881
18782
  }
18882
18783
  function readPlugins(opts) {
18883
- const pluginsFile = join16(homeOf8(opts), ".claude", "plugins", "installed_plugins.json");
18884
- if (!existsSync15(pluginsFile)) return {};
18784
+ const pluginsFile = join15(homeOf7(opts), ".claude", "plugins", "installed_plugins.json");
18785
+ if (!existsSync14(pluginsFile)) return {};
18885
18786
  try {
18886
- const data = JSON.parse(readFileSync13(pluginsFile, "utf-8"));
18787
+ const data = JSON.parse(readFileSync12(pluginsFile, "utf-8"));
18887
18788
  return data.plugins ?? {};
18888
18789
  } catch {
18889
18790
  return {};
@@ -18904,12 +18805,12 @@ function forEachPluginScope(filter, callback, opts) {
18904
18805
  }
18905
18806
  }
18906
18807
  function scanAgentDir(dir, source, namePrefix = "") {
18907
- if (!existsSync15(dir)) return [];
18808
+ if (!existsSync14(dir)) return [];
18908
18809
  const agents = [];
18909
18810
  for (const entry of readdirSync5(dir, { withFileTypes: true })) {
18910
18811
  if (!entry.isFile() || !entry.name.endsWith(".md")) continue;
18911
18812
  const name = namePrefix + entry.name.replace(/\.md$/, "");
18912
- const content = safeRead(join16(dir, entry.name));
18813
+ const content = safeRead(join15(dir, entry.name));
18913
18814
  const fm = parseFrontmatter(content);
18914
18815
  agents.push({
18915
18816
  name,
@@ -18922,23 +18823,23 @@ function scanAgentDir(dir, source, namePrefix = "") {
18922
18823
  }
18923
18824
  function discoverUserAgents(opts) {
18924
18825
  const agents = [
18925
- ...scanAgentDir(join16(homeOf8(opts), ".claude", "agents"), "user")
18826
+ ...scanAgentDir(join15(homeOf7(opts), ".claude", "agents"), "user")
18926
18827
  ];
18927
18828
  forEachPluginScope(
18928
18829
  isUserScoped,
18929
18830
  (installPath, pluginName) => {
18930
- agents.push(...scanAgentDir(join16(installPath, "agents"), "plugin", `${pluginName}:`));
18831
+ agents.push(...scanAgentDir(join15(installPath, "agents"), "plugin", `${pluginName}:`));
18931
18832
  },
18932
18833
  opts
18933
18834
  );
18934
18835
  return agents;
18935
18836
  }
18936
18837
  function discoverProjectAgents(cwd, opts) {
18937
- const agents = [...scanAgentDir(join16(cwd, ".claude", "agents"), "project")];
18838
+ const agents = [...scanAgentDir(join15(cwd, ".claude", "agents"), "project")];
18938
18839
  forEachPluginScope(
18939
18840
  (e) => isProjectScoped(e, cwd),
18940
18841
  (installPath, pluginName) => {
18941
- agents.push(...scanAgentDir(join16(installPath, "agents"), "plugin", `${pluginName}:`));
18842
+ agents.push(...scanAgentDir(join15(installPath, "agents"), "plugin", `${pluginName}:`));
18942
18843
  },
18943
18844
  opts
18944
18845
  );
@@ -18961,10 +18862,10 @@ function discoverAllAgents(cwd, opts) {
18961
18862
  }
18962
18863
  function readAgentFile(cwd, name, opts) {
18963
18864
  const baseName = name.includes(":") ? name.split(":").pop() : name;
18964
- const projectPath = join16(cwd, ".claude", "agents", `${baseName}.md`);
18965
- if (existsSync15(projectPath)) return safeRead(projectPath) || null;
18966
- const userPath = join16(homeOf8(opts), ".claude", "agents", `${baseName}.md`);
18967
- if (existsSync15(userPath)) return safeRead(userPath) || null;
18865
+ const projectPath = join15(cwd, ".claude", "agents", `${baseName}.md`);
18866
+ if (existsSync14(projectPath)) return safeRead(projectPath) || null;
18867
+ const userPath = join15(homeOf7(opts), ".claude", "agents", `${baseName}.md`);
18868
+ if (existsSync14(userPath)) return safeRead(userPath) || null;
18968
18869
  const plugins = readPlugins(opts);
18969
18870
  for (const [pluginKey, entries] of Object.entries(plugins)) {
18970
18871
  const pluginName = pluginKey.split("@")[0] ?? pluginKey;
@@ -18972,8 +18873,8 @@ function readAgentFile(cwd, name, opts) {
18972
18873
  if (!entry.installPath) continue;
18973
18874
  const prefix = `${pluginName}:`;
18974
18875
  const agentBaseName = name.startsWith(prefix) ? name.slice(prefix.length) : baseName;
18975
- const pluginAgentPath = join16(entry.installPath, "agents", `${agentBaseName}.md`);
18976
- if (existsSync15(pluginAgentPath)) return safeRead(pluginAgentPath) || null;
18876
+ const pluginAgentPath = join15(entry.installPath, "agents", `${agentBaseName}.md`);
18877
+ if (existsSync14(pluginAgentPath)) return safeRead(pluginAgentPath) || null;
18977
18878
  }
18978
18879
  }
18979
18880
  return null;
@@ -18998,7 +18899,6 @@ var init_fs = __esm({
18998
18899
  init_fuzzy();
18999
18900
  init_plugins_manage();
19000
18901
  init_hooks_config();
19001
- init_additional_dirs_config();
19002
18902
  init_agents_discover();
19003
18903
  }
19004
18904
  });
@@ -20010,12 +19910,12 @@ var init_agent_event_mapper = __esm({
20010
19910
  // ../../packages/codex/src/app-server-client.ts
20011
19911
  import { spawn } from "node:child_process";
20012
19912
  import { createInterface } from "node:readline";
20013
- import { existsSync as existsSync16 } from "node:fs";
19913
+ import { existsSync as existsSync15 } from "node:fs";
20014
19914
  async function openCodexAppServer(opts) {
20015
19915
  if (opts.signal?.aborted) {
20016
19916
  throw new Error("Codex app-server launch interrupted");
20017
19917
  }
20018
- if (!opts.binaryPath || !existsSync16(opts.binaryPath)) {
19918
+ if (!opts.binaryPath || !existsSync15(opts.binaryPath)) {
20019
19919
  throw new Error(`Codex binary not found: ${opts.binaryPath || "(empty)"}`);
20020
19920
  }
20021
19921
  const spawnFn = opts.spawnFn ?? defaultSpawn;
@@ -20079,21 +19979,21 @@ async function openCodexAppServer(opts) {
20079
19979
  const terminateChild = async () => {
20080
19980
  if (processExited) return;
20081
19981
  const killTimeoutMs = opts.killTimeoutMs ?? 2e3;
20082
- await new Promise((resolve14) => {
19982
+ await new Promise((resolve15) => {
20083
19983
  if (processExited) {
20084
- resolve14();
19984
+ resolve15();
20085
19985
  return;
20086
19986
  }
20087
19987
  const onExit = () => {
20088
19988
  clearTimeout(t);
20089
- resolve14();
19989
+ resolve15();
20090
19990
  };
20091
19991
  child.once("exit", onExit);
20092
19992
  try {
20093
19993
  child.kill("SIGTERM");
20094
19994
  } catch {
20095
19995
  child.removeListener("exit", onExit);
20096
- resolve14();
19996
+ resolve15();
20097
19997
  return;
20098
19998
  }
20099
19999
  const t = setTimeout(() => {
@@ -20105,7 +20005,7 @@ async function openCodexAppServer(opts) {
20105
20005
  }
20106
20006
  setTimeout(() => {
20107
20007
  child.removeListener("exit", onExit);
20108
- resolve14();
20008
+ resolve15();
20109
20009
  }, 500);
20110
20010
  }, killTimeoutMs);
20111
20011
  });
@@ -20185,7 +20085,7 @@ async function openCodexAppServer(opts) {
20185
20085
  failAll(safePublicError("Codex app-server read failed", readLoopError));
20186
20086
  }
20187
20087
  })();
20188
- const request = (method, params, timeoutMs = DEFAULT_REQUEST_TIMEOUT_MS) => new Promise((resolve14, reject) => {
20088
+ const request = (method, params, timeoutMs = DEFAULT_REQUEST_TIMEOUT_MS) => new Promise((resolve15, reject) => {
20189
20089
  if (closed) {
20190
20090
  reject(new Error("Codex app-server connection closed"));
20191
20091
  return;
@@ -20203,7 +20103,7 @@ async function openCodexAppServer(opts) {
20203
20103
  pending.delete(id);
20204
20104
  reject(new Error(`Codex app-server ${method} timed out after ${timeoutMs}ms`));
20205
20105
  }, timeoutMs);
20206
- pending.set(id, { resolve: resolve14, reject, timer });
20106
+ pending.set(id, { resolve: resolve15, reject, timer });
20207
20107
  try {
20208
20108
  writeLine({ jsonrpc: "2.0", id, method, params: params ?? {} });
20209
20109
  } catch (err) {
@@ -20215,9 +20115,9 @@ async function openCodexAppServer(opts) {
20215
20115
  const notify = async (method, params) => {
20216
20116
  writeLine({ jsonrpc: "2.0", method, params: params ?? {} });
20217
20117
  };
20218
- const nextNotification = (timeoutMs = 3e4) => new Promise((resolve14, reject) => {
20118
+ const nextNotification = (timeoutMs = 3e4) => new Promise((resolve15, reject) => {
20219
20119
  if (notificationQueue.length) {
20220
- resolve14(notificationQueue.shift());
20120
+ resolve15(notificationQueue.shift());
20221
20121
  return;
20222
20122
  }
20223
20123
  if (readLoopError) {
@@ -20225,16 +20125,16 @@ async function openCodexAppServer(opts) {
20225
20125
  return;
20226
20126
  }
20227
20127
  if (closed) {
20228
- resolve14(null);
20128
+ resolve15(null);
20229
20129
  return;
20230
20130
  }
20231
20131
  const timer = setTimeout(() => {
20232
20132
  const idx = notificationWaiters.findIndex((w2) => w2.timer === timer);
20233
20133
  if (idx >= 0) notificationWaiters.splice(idx, 1);
20234
20134
  if (readLoopError) reject(readLoopError);
20235
- else resolve14(null);
20135
+ else resolve15(null);
20236
20136
  }, timeoutMs);
20237
- notificationWaiters.push({ resolve: resolve14, reject, timer });
20137
+ notificationWaiters.push({ resolve: resolve15, reject, timer });
20238
20138
  });
20239
20139
  child.stdin.on("error", (err) => {
20240
20140
  const publicErr = safePublicError("Codex app-server stdin error", err);
@@ -22071,7 +21971,7 @@ var init_agent_event_mapper2 = __esm({
22071
21971
 
22072
21972
  // ../../packages/claude/src/resolve-sdk-binary.ts
22073
21973
  import { createRequire } from "node:module";
22074
- import { existsSync as existsSync17 } from "node:fs";
21974
+ import { existsSync as existsSync16 } from "node:fs";
22075
21975
  function resolveSdkClaudeBinary() {
22076
21976
  if (cached !== void 0) return cached;
22077
21977
  try {
@@ -22086,7 +21986,7 @@ function resolveSdkClaudeBinary() {
22086
21986
  let p2 = req.resolve(c);
22087
21987
  if (p2.includes("/app.asar/")) p2 = p2.replace("/app.asar/", "/app.asar.unpacked/");
22088
21988
  if (p2.includes("\\app.asar\\")) p2 = p2.replace("\\app.asar\\", "\\app.asar.unpacked\\");
22089
- if (existsSync17(p2)) {
21989
+ if (existsSync16(p2)) {
22090
21990
  cached = p2;
22091
21991
  return p2;
22092
21992
  }
@@ -22299,8 +22199,8 @@ var init_message_bridge = __esm({
22299
22199
  if (this.closed) {
22300
22200
  return Promise.resolve({ value: void 0, done: true });
22301
22201
  }
22302
- return new Promise((resolve14) => {
22303
- this.waiter = { resolve: resolve14 };
22202
+ return new Promise((resolve15) => {
22203
+ this.waiter = { resolve: resolve15 };
22304
22204
  });
22305
22205
  }
22306
22206
  };
@@ -22310,7 +22210,7 @@ var init_message_bridge = __esm({
22310
22210
  });
22311
22211
 
22312
22212
  // ../../packages/claude/src/claude-live-session.ts
22313
- import { existsSync as existsSync18 } from "node:fs";
22213
+ import { existsSync as existsSync17 } from "node:fs";
22314
22214
  import { randomUUID as randomUUID2 } from "node:crypto";
22315
22215
  import { query as sdkQuery2 } from "@anthropic-ai/claude-agent-sdk";
22316
22216
  function buildLiveOptions(opts, onPermission, onQuestion, onPlan, signal, timing, turn) {
@@ -22370,7 +22270,7 @@ function buildLiveOptions(opts, onPermission, onQuestion, onPlan, signal, timing
22370
22270
  if (decision === "allow") return { behavior: "allow" };
22371
22271
  return { behavior: "deny", message: "Permission denied by SuperOne node" };
22372
22272
  };
22373
- const binaryPath = (opts.binaryPath && existsSync18(opts.binaryPath) ? opts.binaryPath : null) ?? resolveSdkClaudeBinary() ?? void 0;
22273
+ const binaryPath = (opts.binaryPath && existsSync17(opts.binaryPath) ? opts.binaryPath : null) ?? resolveSdkClaudeBinary() ?? void 0;
22374
22274
  const effort = opts.effort === "low" || opts.effort === "medium" || opts.effort === "high" || opts.effort === "xhigh" || opts.effort === "max" ? opts.effort : void 0;
22375
22275
  const env = opts.env ? { ...process.env, ...opts.env } : void 0;
22376
22276
  const sandbox = opts.sandboxMode === "on" || opts.sandboxMode === "auto" ? {
@@ -22487,8 +22387,8 @@ var init_claude_live_session = __esm({
22487
22387
  planHandler;
22488
22388
  timing = { pausedMs: 0 };
22489
22389
  static open(opts) {
22490
- const binary = (opts.binaryPath && existsSync18(opts.binaryPath) ? opts.binaryPath : null) ?? resolveSdkClaudeBinary();
22491
- if (opts.binaryPath && !existsSync18(opts.binaryPath)) {
22390
+ const binary = (opts.binaryPath && existsSync17(opts.binaryPath) ? opts.binaryPath : null) ?? resolveSdkClaudeBinary();
22391
+ if (opts.binaryPath && !existsSync17(opts.binaryPath)) {
22492
22392
  throw new Error(`Claude binary not found: ${opts.binaryPath}`);
22493
22393
  }
22494
22394
  if (!binary && !opts.queryFn) {
@@ -22518,7 +22418,7 @@ var init_claude_live_session = __esm({
22518
22418
  const sessionId = this.sdkSessionId || "";
22519
22419
  const priorityNext = input.priorityNext !== false && this.active != null;
22520
22420
  const msg = toUserMessage(input.content, sessionId, priorityNext);
22521
- return new Promise((resolve14, reject) => {
22421
+ return new Promise((resolve15, reject) => {
22522
22422
  if (input.signal?.aborted) {
22523
22423
  reject(new Error("Claude turn interrupted"));
22524
22424
  return;
@@ -22539,10 +22439,10 @@ var init_claude_live_session = __esm({
22539
22439
  };
22540
22440
  input.signal?.addEventListener("abort", onAbort, { once: true });
22541
22441
  if (this.active) {
22542
- this.pending.push({ tag, msg, input, resolve: resolve14, reject });
22442
+ this.pending.push({ tag, msg, input, resolve: resolve15, reject });
22543
22443
  return;
22544
22444
  }
22545
- this.startTurn({ tag, msg, input, resolve: resolve14, reject });
22445
+ this.startTurn({ tag, msg, input, resolve: resolve15, reject });
22546
22446
  });
22547
22447
  }
22548
22448
  async dispose() {
@@ -22742,12 +22642,12 @@ async function fetchClaudeModels(opts) {
22742
22642
  }
22743
22643
  }
22744
22644
  function withTimeout(promise2, ms) {
22745
- return new Promise((resolve14, reject) => {
22645
+ return new Promise((resolve15, reject) => {
22746
22646
  const timer = setTimeout(() => reject(new Error(`claude model probe timed out after ${ms}ms`)), ms);
22747
22647
  promise2.then(
22748
22648
  (v2) => {
22749
22649
  clearTimeout(timer);
22750
- resolve14(v2);
22650
+ resolve15(v2);
22751
22651
  },
22752
22652
  (e) => {
22753
22653
  clearTimeout(timer);
@@ -22768,16 +22668,16 @@ var init_fetch_models = __esm({
22768
22668
  });
22769
22669
 
22770
22670
  // ../../packages/claude/src/fork-session.ts
22771
- import { existsSync as existsSync19, mkdirSync as mkdirSync12, readdirSync as readdirSync6, realpathSync as realpathSync2, renameSync } from "node:fs";
22671
+ import { existsSync as existsSync18, mkdirSync as mkdirSync11, readdirSync as readdirSync6, realpathSync as realpathSync2, renameSync } from "node:fs";
22772
22672
  import { homedir as homedir3 } from "node:os";
22773
- import { join as join17 } from "node:path";
22673
+ import { join as join16 } from "node:path";
22774
22674
  import { forkSession as defaultSdkForkSession } from "@anthropic-ai/claude-agent-sdk";
22775
22675
  function claudeProjectSlug(p2) {
22776
22676
  return p2.replace(/[^a-zA-Z0-9]/g, "-");
22777
22677
  }
22778
22678
  function claudeProjectsDir(configDir) {
22779
- const root = configDir || process.env.CLAUDE_CONFIG_DIR || join17(homedir3(), ".claude");
22780
- return join17(root, "projects");
22679
+ const root = configDir || process.env.CLAUDE_CONFIG_DIR || join16(homedir3(), ".claude");
22680
+ return join16(root, "projects");
22781
22681
  }
22782
22682
  async function forkClaudeTranscript(input) {
22783
22683
  const providerSessionId = input.providerSessionId?.trim();
@@ -22797,13 +22697,13 @@ async function forkClaudeTranscript(input) {
22797
22697
  throw new Error("Claude forkSession did not return a session id");
22798
22698
  }
22799
22699
  const projectsDir = input.projectsDir ?? claudeProjectsDir();
22800
- if (!existsSync19(projectsDir)) {
22700
+ if (!existsSync18(projectsDir)) {
22801
22701
  throw new Error(`Claude projects dir not found: ${projectsDir}`);
22802
22702
  }
22803
22703
  let forkedFile = null;
22804
22704
  for (const dir of readdirSync6(projectsDir)) {
22805
- const candidate = join17(projectsDir, dir, `${newSdkId}.jsonl`);
22806
- if (existsSync19(candidate)) {
22705
+ const candidate = join16(projectsDir, dir, `${newSdkId}.jsonl`);
22706
+ if (existsSync18(candidate)) {
22807
22707
  forkedFile = candidate;
22808
22708
  break;
22809
22709
  }
@@ -22811,9 +22711,9 @@ async function forkClaudeTranscript(input) {
22811
22711
  if (!forkedFile) {
22812
22712
  throw new Error(`forked transcript ${newSdkId}.jsonl not found under ${projectsDir}`);
22813
22713
  }
22814
- const destDir = join17(projectsDir, claudeProjectSlug(realpathSync2(targetCwd)));
22815
- mkdirSync12(destDir, { recursive: true });
22816
- const dest = join17(destDir, `${newSdkId}.jsonl`);
22714
+ const destDir = join16(projectsDir, claudeProjectSlug(realpathSync2(targetCwd)));
22715
+ mkdirSync11(destDir, { recursive: true });
22716
+ const dest = join16(destDir, `${newSdkId}.jsonl`);
22817
22717
  if (dest !== forkedFile) {
22818
22718
  renameSync(forkedFile, dest);
22819
22719
  }
@@ -25681,7 +25581,7 @@ var init_session_runtime = __esm({
25681
25581
  eventType: SESSION_DURABLE_EVENT.hostActionRequested,
25682
25582
  payload: { actionId: row.actionId }
25683
25583
  });
25684
- return new Promise((resolve14) => {
25584
+ return new Promise((resolve15) => {
25685
25585
  const remaining = Math.max(0, row.deadline - Date.now());
25686
25586
  const timer = setTimeout(() => {
25687
25587
  this.cancelHostActionInternal(row.actionId, "deadline_exceeded");
@@ -25708,7 +25608,7 @@ var init_session_runtime = __esm({
25708
25608
  clearTimeout(timer);
25709
25609
  for (const c of abortCleanups) c();
25710
25610
  this.hostActionWaiters.delete(row.actionId);
25711
- resolve14(result);
25611
+ resolve15(result);
25712
25612
  },
25713
25613
  timer
25714
25614
  });
@@ -25749,14 +25649,14 @@ var init_session_runtime = __esm({
25749
25649
  cursor: existing.length ? existing[existing.length - 1].sequence : this.hostActions.headSequence()
25750
25650
  };
25751
25651
  }
25752
- await new Promise((resolve14) => {
25652
+ await new Promise((resolve15) => {
25753
25653
  let settled = false;
25754
25654
  const done = () => {
25755
25655
  if (settled) return;
25756
25656
  settled = true;
25757
25657
  this.hostActionPollWaiters.delete(done);
25758
25658
  clearTimeout(timer);
25759
- resolve14();
25659
+ resolve15();
25760
25660
  };
25761
25661
  const timer = setTimeout(done, waitMs);
25762
25662
  this.hostActionPollWaiters.add(done);
@@ -26006,7 +25906,7 @@ var init_session_runtime = __esm({
26006
25906
  profiles: input.profiles
26007
25907
  }
26008
25908
  };
26009
- return new Promise((resolve14) => {
25909
+ return new Promise((resolve15) => {
26010
25910
  let settled = false;
26011
25911
  session.pendingInteraction = interaction;
26012
25912
  session.updatedAt = Date.now();
@@ -26040,14 +25940,14 @@ var init_session_runtime = __esm({
26040
25940
  action: result.action
26041
25941
  }
26042
25942
  });
26043
- resolve14({ action: result.action, content: result.content });
25943
+ resolve15({ action: result.action, content: result.content });
26044
25944
  } else {
26045
25945
  this.events.appendSession({
26046
25946
  sessionId: session.sessionId,
26047
25947
  eventType: result.reason === "timeout" ? SESSION_DURABLE_EVENT.permissionTimeout : SESSION_DURABLE_EVENT.permissionAborted,
26048
25948
  payload: { interactionId: interaction.interactionId, decision: "deny" }
26049
25949
  });
26050
- resolve14({ action: "cancel" });
25950
+ resolve15({ action: "cancel" });
26051
25951
  }
26052
25952
  };
26053
25953
  const timer = setTimeout(() => {
@@ -26120,7 +26020,7 @@ var init_session_runtime = __esm({
26120
26020
  if (session.pendingInteraction) {
26121
26021
  this.rejectPendingPermission(session, "aborted");
26122
26022
  }
26123
- return new Promise((resolve14) => {
26023
+ return new Promise((resolve15) => {
26124
26024
  let settled = false;
26125
26025
  session.pendingInteraction = interaction;
26126
26026
  session.updatedAt = Date.now();
@@ -26166,7 +26066,7 @@ var init_session_runtime = __esm({
26166
26066
  payload: { interactionId: interaction.interactionId, decision: "deny" }
26167
26067
  });
26168
26068
  }
26169
- resolve14(result.decision);
26069
+ resolve15(result.decision);
26170
26070
  };
26171
26071
  const timer = setTimeout(() => {
26172
26072
  settle({ decision: "deny", reason: "timeout" });
@@ -26223,7 +26123,7 @@ var init_session_runtime = __esm({
26223
26123
  this.rejectPendingPermission(session, "aborted");
26224
26124
  }
26225
26125
  const pending = { ...interaction, kind: "question" };
26226
- return new Promise((resolve14) => {
26126
+ return new Promise((resolve15) => {
26227
26127
  let settled = false;
26228
26128
  session.pendingInteraction = pending;
26229
26129
  session.updatedAt = Date.now();
@@ -26266,7 +26166,7 @@ var init_session_runtime = __esm({
26266
26166
  payload: { interactionId: pending.interactionId }
26267
26167
  });
26268
26168
  }
26269
- resolve14(result.answers);
26169
+ resolve15(result.answers);
26270
26170
  };
26271
26171
  const timer = setTimeout(() => {
26272
26172
  settle({ answers: {}, reason: "timeout" });
@@ -26294,7 +26194,7 @@ var init_session_runtime = __esm({
26294
26194
  this.rejectPendingPermission(session, "aborted");
26295
26195
  }
26296
26196
  const pending = { ...interaction, kind: "plan" };
26297
- return new Promise((resolve14) => {
26197
+ return new Promise((resolve15) => {
26298
26198
  let settled = false;
26299
26199
  session.pendingInteraction = pending;
26300
26200
  session.updatedAt = Date.now();
@@ -26341,7 +26241,7 @@ var init_session_runtime = __esm({
26341
26241
  payload: { interactionId: pending.interactionId, decision: "reject" }
26342
26242
  });
26343
26243
  }
26344
- resolve14({ decision: result.decision, options: result.options });
26244
+ resolve15({ decision: result.decision, options: result.options });
26345
26245
  };
26346
26246
  const timer = setTimeout(() => {
26347
26247
  settle({ decision: "reject", reason: "timeout" });
@@ -26427,7 +26327,7 @@ var init_session_runtime = __esm({
26427
26327
  Promise.allSettled(batch).then(() => {
26428
26328
  settled = true;
26429
26329
  }),
26430
- new Promise((resolve14) => setTimeout(resolve14, remaining))
26330
+ new Promise((resolve15) => setTimeout(resolve15, remaining))
26431
26331
  ]);
26432
26332
  if (!settled && Date.now() >= deadline) break;
26433
26333
  }
@@ -26932,9 +26832,9 @@ var init_session_provider_store = __esm({
26932
26832
  });
26933
26833
 
26934
26834
  // ../../packages/runtime/src/session/harness-resources.ts
26935
- import { existsSync as existsSync20, readdirSync as readdirSync7, readFileSync as readFileSync14 } from "node:fs";
26936
- import { join as join18 } from "node:path";
26937
- import { homedir as osHomedir9 } from "node:os";
26835
+ import { existsSync as existsSync19, readdirSync as readdirSync7, readFileSync as readFileSync13 } from "node:fs";
26836
+ import { join as join17 } from "node:path";
26837
+ import { homedir as osHomedir8 } from "node:os";
26938
26838
  function emptyClaude() {
26939
26839
  return {
26940
26840
  models: [],
@@ -26957,15 +26857,15 @@ function emptyAcp() {
26957
26857
  }
26958
26858
  function safeRead2(path) {
26959
26859
  try {
26960
- return readFileSync14(path, "utf-8");
26860
+ return readFileSync13(path, "utf-8");
26961
26861
  } catch {
26962
26862
  return "";
26963
26863
  }
26964
26864
  }
26965
26865
  function discoverCodexUserPrompts(opts) {
26966
- const home = opts?.homeDir ?? osHomedir9();
26967
- const dir = join18(home, ".codex", "prompts");
26968
- if (!existsSync20(dir)) return [];
26866
+ const home = opts?.homeDir ?? osHomedir8();
26867
+ const dir = join17(home, ".codex", "prompts");
26868
+ if (!existsSync19(dir)) return [];
26969
26869
  let ents;
26970
26870
  try {
26971
26871
  ents = readdirSync7(dir, { withFileTypes: true });
@@ -26976,7 +26876,7 @@ function discoverCodexUserPrompts(opts) {
26976
26876
  for (const ent of ents) {
26977
26877
  if (!ent.isFile() || !ent.name.endsWith(".md")) continue;
26978
26878
  const name = ent.name.replace(/\.md$/, "");
26979
- const content = safeRead2(join18(dir, ent.name));
26879
+ const content = safeRead2(join17(dir, ent.name));
26980
26880
  const fm = parseSimpleFrontmatter(content);
26981
26881
  out.push({
26982
26882
  name,
@@ -30913,7 +30813,7 @@ function requireInboundAuth(req, res) {
30913
30813
  return false;
30914
30814
  }
30915
30815
  function readBody(req) {
30916
- return new Promise((resolve14, reject) => {
30816
+ return new Promise((resolve15, reject) => {
30917
30817
  const chunks = [];
30918
30818
  let total = 0;
30919
30819
  req.on("data", (chunk) => {
@@ -30925,7 +30825,7 @@ function readBody(req) {
30925
30825
  }
30926
30826
  chunks.push(chunk);
30927
30827
  });
30928
- req.on("end", () => resolve14(Buffer.concat(chunks)));
30828
+ req.on("end", () => resolve15(Buffer.concat(chunks)));
30929
30829
  req.on("error", reject);
30930
30830
  });
30931
30831
  }
@@ -30955,7 +30855,7 @@ async function writeWebResponse(res, web) {
30955
30855
  if (done) break;
30956
30856
  if (value) {
30957
30857
  if (!res.write(Buffer.from(value))) {
30958
- await new Promise((resolve14) => res.once("drain", resolve14));
30858
+ await new Promise((resolve15) => res.once("drain", resolve15));
30959
30859
  }
30960
30860
  }
30961
30861
  }
@@ -31033,15 +30933,15 @@ async function startLlmProxyServer(upstream, port) {
31033
30933
  }
31034
30934
  }
31035
30935
  });
31036
- await new Promise((resolve14, reject) => {
30936
+ await new Promise((resolve15, reject) => {
31037
30937
  server.once("error", reject);
31038
- server.listen(port, "127.0.0.1", () => resolve14());
30938
+ server.listen(port, "127.0.0.1", () => resolve15());
31039
30939
  });
31040
30940
  return {
31041
30941
  port,
31042
30942
  url: `http://127.0.0.1:${port}`,
31043
- close: () => new Promise((resolve14, reject) => {
31044
- server.close((err) => err ? reject(err) : resolve14());
30943
+ close: () => new Promise((resolve15, reject) => {
30944
+ server.close((err) => err ? reject(err) : resolve15());
31045
30945
  })
31046
30946
  };
31047
30947
  }
@@ -31063,7 +30963,7 @@ function upstreamKey(u) {
31063
30963
  return createHash3("sha256").update(JSON.stringify(u)).digest("hex").slice(0, 16);
31064
30964
  }
31065
30965
  async function getFreePort() {
31066
- return new Promise((resolve14, reject) => {
30966
+ return new Promise((resolve15, reject) => {
31067
30967
  const server = net.createServer();
31068
30968
  server.unref();
31069
30969
  server.on("error", reject);
@@ -31071,7 +30971,7 @@ async function getFreePort() {
31071
30971
  const addr = server.address();
31072
30972
  if (typeof addr === "object" && addr) {
31073
30973
  const { port } = addr;
31074
- server.close(() => resolve14(port));
30974
+ server.close(() => resolve15(port));
31075
30975
  } else {
31076
30976
  server.close(() => reject(new Error("no address")));
31077
30977
  }
@@ -31344,14 +31244,14 @@ var init_resolve_service = __esm({
31344
31244
  });
31345
31245
 
31346
31246
  // ../../packages/shared/src/attachment-store.ts
31347
- import { mkdirSync as mkdirSync13, writeFileSync as writeFileSync10 } from "node:fs";
31247
+ import { mkdirSync as mkdirSync12, writeFileSync as writeFileSync9 } from "node:fs";
31348
31248
  import { tmpdir } from "node:os";
31349
- import { join as join19 } from "node:path";
31249
+ import { join as join18 } from "node:path";
31350
31250
  import { randomUUID as randomUUID7 } from "node:crypto";
31351
31251
  function resolveAttachmentsDir() {
31352
31252
  const override = process.env.SUPERONE_ATTACHMENTS_DIR?.trim();
31353
31253
  if (override) return override;
31354
- return join19(tmpdir(), SUPERONE_ATTACHMENTS_DIR_NAME);
31254
+ return join18(tmpdir(), SUPERONE_ATTACHMENTS_DIR_NAME);
31355
31255
  }
31356
31256
  function extForAttachmentMime(mimeType) {
31357
31257
  const m2 = mimeType.toLowerCase();
@@ -31386,10 +31286,10 @@ function persistAttachment(base643, mimeType, opts) {
31386
31286
  if (!buf) return null;
31387
31287
  try {
31388
31288
  const dir = resolveAttachmentsDir();
31389
- mkdirSync13(dir, { recursive: true });
31289
+ mkdirSync12(dir, { recursive: true });
31390
31290
  const fileName = `${randomUUID7()}-${safeFileBase(opts?.name, mimeType)}`;
31391
- const filePath = join19(dir, fileName);
31392
- writeFileSync10(filePath, buf);
31291
+ const filePath = join18(dir, fileName);
31292
+ writeFileSync9(filePath, buf);
31393
31293
  return filePath;
31394
31294
  } catch {
31395
31295
  return null;
@@ -31471,11 +31371,11 @@ var init_turn_attachments = __esm({
31471
31371
  });
31472
31372
 
31473
31373
  // src/session/claude-turn-runner.ts
31474
- import { existsSync as existsSync21 } from "node:fs";
31374
+ import { existsSync as existsSync20 } from "node:fs";
31475
31375
  function resolveClaudeBinaryPath(opts) {
31476
- if (opts.binaryPath && existsSync21(opts.binaryPath)) return opts.binaryPath;
31376
+ if (opts.binaryPath && existsSync20(opts.binaryPath)) return opts.binaryPath;
31477
31377
  const status = opts.harnesses?.get("claude");
31478
- if (status?.enabled && (status.state === "ready" || status.state === "needs_auth") && status.command && existsSync21(status.command)) {
31378
+ if (status?.enabled && (status.state === "ready" || status.state === "needs_auth") && status.command && existsSync20(status.command)) {
31479
31379
  return status.command;
31480
31380
  }
31481
31381
  if (!opts.skipSdkBinary) {
@@ -31483,7 +31383,7 @@ function resolveClaudeBinaryPath(opts) {
31483
31383
  if (sdk) return sdk;
31484
31384
  }
31485
31385
  const fromEnv = process.env.SUPERONE_CLAUDE_BINARY?.trim();
31486
- if (fromEnv && existsSync21(fromEnv)) return fromEnv;
31386
+ if (fromEnv && existsSync20(fromEnv)) return fromEnv;
31487
31387
  return null;
31488
31388
  }
31489
31389
  function isClaudeRuntimeRunnable() {
@@ -31529,6 +31429,7 @@ function createNodeClaudeTurnRunner(opts) {
31529
31429
  await entry.hostActionDispose?.().catch(() => void 0);
31530
31430
  };
31531
31431
  const mcpDiskKeyOf = (diskNames) => [...diskNames].sort().join("\0");
31432
+ const additionalDirsKeyOf = (dirs) => [...new Set(dirs ?? [])].sort().join("\0");
31532
31433
  const runner = async (input) => {
31533
31434
  const harnessId = input.session.harnessId || "claude";
31534
31435
  if (harnessId !== "claude") {
@@ -31582,8 +31483,9 @@ function createNodeClaudeTurnRunner(opts) {
31582
31483
  homeDir: opts.homeDir
31583
31484
  });
31584
31485
  const nextMcpDiskKey = mcpDiskKeyOf(mergedProbe.diskNames);
31486
+ const nextAdditionalDirsKey = additionalDirsKeyOf(input.additionalDirectories?.filter(Boolean));
31585
31487
  let entry = lives.get(sessionKey);
31586
- if (entry && (entry.cwd !== cwd || entry.mcpDiskKey !== nextMcpDiskKey)) {
31488
+ if (entry && (entry.cwd !== cwd || entry.mcpDiskKey !== nextMcpDiskKey || entry.additionalDirsKey !== nextAdditionalDirsKey)) {
31587
31489
  await entry.live.dispose().catch(() => void 0);
31588
31490
  await entry.hostActionDispose?.().catch(() => void 0);
31589
31491
  lives.delete(sessionKey);
@@ -31624,6 +31526,7 @@ function createNodeClaudeTurnRunner(opts) {
31624
31526
  hostActionDispose: hostActionMcp ? () => hostActionMcp.dispose() : null,
31625
31527
  cwd,
31626
31528
  mcpDiskKey: mcpDiskKeyOf(merged.diskNames),
31529
+ additionalDirsKey: additionalDirsKeyOf(input.additionalDirectories?.filter(Boolean)),
31627
31530
  busyCount: 0,
31628
31531
  lastActivityAt: Date.now()
31629
31532
  };
@@ -48969,11 +48872,11 @@ var init_jsonrpc = __esm({
48969
48872
  const id = this.nextRequestId++;
48970
48873
  let cancel = () => {
48971
48874
  };
48972
- const response = new Promise((resolve14, reject) => {
48875
+ const response = new Promise((resolve15, reject) => {
48973
48876
  const pendingResponse = {
48974
48877
  resolve: (value) => {
48975
48878
  try {
48976
- resolve14(mapResponse ? mapResponse(value) : value);
48879
+ resolve15(mapResponse ? mapResponse(value) : value);
48977
48880
  } catch (error51) {
48978
48881
  reject(error51);
48979
48882
  }
@@ -49030,8 +48933,8 @@ var init_jsonrpc = __esm({
49030
48933
  this.stream = stream;
49031
48934
  this.staticHandlers = handlers;
49032
48935
  this.allowBatches = options?.allowBatches ?? true;
49033
- this.closedPromise = new Promise((resolve14) => {
49034
- this.abortController.signal.addEventListener("abort", () => resolve14());
48936
+ this.closedPromise = new Promise((resolve15) => {
48937
+ this.abortController.signal.addEventListener("abort", () => resolve15());
49035
48938
  });
49036
48939
  void this.receive();
49037
48940
  }
@@ -50035,8 +49938,8 @@ var init_acp = __esm({
50035
49938
  if (this.failed) {
50036
49939
  return Promise.reject(this.failure);
50037
49940
  }
50038
- return new Promise((resolve14, reject) => {
50039
- this.waiters.push({ resolve: resolve14, reject });
49941
+ return new Promise((resolve15, reject) => {
49942
+ this.waiters.push({ resolve: resolve15, reject });
50040
49943
  });
50041
49944
  }
50042
49945
  };
@@ -51678,6 +51581,30 @@ var init_session_archive_result_shape = __esm({
51678
51581
  }
51679
51582
  });
51680
51583
 
51584
+ // ../../packages/shared/src/computer-use-result-shape.ts
51585
+ function isComputerUseToolName(toolName) {
51586
+ if (!toolName) return false;
51587
+ return /(?:^|__)computer_(?:snapshot|observe|query|act|apps|zoom|wait_for)$/.test(toolName);
51588
+ }
51589
+ function isComputerUseRoot(value) {
51590
+ if (typeof value !== "object" || value === null) return false;
51591
+ const root = value;
51592
+ return typeof root.app === "string" && typeof root.bundleId === "string";
51593
+ }
51594
+ function looksLikeComputerUseResult(obj) {
51595
+ const stateId = typeof obj.stateId === "string" ? obj.stateId : obj.successorStateId;
51596
+ if (typeof stateId !== "string") return false;
51597
+ return typeof obj.outline === "string" || typeof obj.subtree === "string" || typeof obj.element === "string" || Array.isArray(obj.matches) || isComputerUseRoot(obj.root) || isComputerUseRoot(obj.successorRoot);
51598
+ }
51599
+ function looksLikeComputerUseOutline(summary) {
51600
+ return /outline\[\d+\]\{ref,depth/.test(summary);
51601
+ }
51602
+ var init_computer_use_result_shape = __esm({
51603
+ "../../packages/shared/src/computer-use-result-shape.ts"() {
51604
+ "use strict";
51605
+ }
51606
+ });
51607
+
51681
51608
  // ../../packages/acp/src/tool-result-map.ts
51682
51609
  function formatAcpRawOutput(raw) {
51683
51610
  return formatAgentToolOutput(raw);
@@ -51781,11 +51708,13 @@ function shouldKeepFullToolResult(summary, toolName) {
51781
51708
  if (isCollabToolName(toolName)) return true;
51782
51709
  if (isSessionArchiveToolName(toolName)) return true;
51783
51710
  if (looksLikeSessionArchiveToon(summary)) return true;
51711
+ if (isComputerUseToolName(toolName)) return true;
51712
+ if (looksLikeComputerUseOutline(summary)) return true;
51784
51713
  const trimmed = summary.trim();
51785
51714
  if (!trimmed.startsWith("{")) return false;
51786
51715
  try {
51787
51716
  const obj = JSON.parse(trimmed);
51788
- return typeof obj.widget_code === "string" && obj.widget_code.length > 0 || looksLikeCollabResult(obj) || looksLikeSessionArchiveJson(obj);
51717
+ return typeof obj.widget_code === "string" && obj.widget_code.length > 0 || looksLikeCollabResult(obj) || looksLikeSessionArchiveJson(obj) || looksLikeComputerUseResult(obj);
51789
51718
  } catch {
51790
51719
  return false;
51791
51720
  }
@@ -51798,6 +51727,7 @@ var init_tool_result_map = __esm({
51798
51727
  "use strict";
51799
51728
  init_capability_prompt_tags();
51800
51729
  init_session_archive_result_shape();
51730
+ init_computer_use_result_shape();
51801
51731
  init_tool_ui();
51802
51732
  init_tool_normalization();
51803
51733
  }
@@ -51838,7 +51768,7 @@ var init_acp_goal = __esm({
51838
51768
 
51839
51769
  // ../../packages/acp/src/xai-state.ts
51840
51770
  import { homedir as homedir4 } from "node:os";
51841
- import { join as join20 } from "node:path";
51771
+ import { join as join19 } from "node:path";
51842
51772
  function skipEventSeqDedup(kind) {
51843
51773
  return kind === "workflow_updated" || !!kind && SUBAGENT_LIFECYCLE.has(kind);
51844
51774
  }
@@ -51874,7 +51804,7 @@ function resetTurnTokens(state) {
51874
51804
  }
51875
51805
  function resolveGrokChildChatHistoryPath(cwd, childSessionId) {
51876
51806
  if (!cwd || !childSessionId) return void 0;
51877
- return join20(homedir4(), ".grok", "sessions", encodeURIComponent(cwd), childSessionId, "chat_history.jsonl");
51807
+ return join19(homedir4(), ".grok", "sessions", encodeURIComponent(cwd), childSessionId, "chat_history.jsonl");
51878
51808
  }
51879
51809
  function noteSubagentOutputFile(state, subagentId, childSessionId) {
51880
51810
  const existing = state.subagentOutputById.get(subagentId);
@@ -53542,7 +53472,7 @@ async function stopProcess(child, closed) {
53542
53472
  signalProcess(child, "SIGTERM");
53543
53473
  const stopped = await Promise.race([
53544
53474
  closed.then(() => true),
53545
- new Promise((resolve14) => setTimeout(() => resolve14(false), KILL_ESCALATE_MS))
53475
+ new Promise((resolve15) => setTimeout(() => resolve15(false), KILL_ESCALATE_MS))
53546
53476
  ]);
53547
53477
  if (stopped) return;
53548
53478
  signalProcess(child, "SIGKILL");
@@ -53574,9 +53504,9 @@ function spawnAcpProcess(launch2) {
53574
53504
  const output = Writable.toWeb(stdin);
53575
53505
  const input = Readable.toWeb(stdout);
53576
53506
  const stream = ndJsonStream2(output, input);
53577
- const closed = new Promise((resolve14) => {
53507
+ const closed = new Promise((resolve15) => {
53578
53508
  child.once("exit", (code, signal) => {
53579
- resolve14({ code, signal, stderr: stderrChunks.join("") });
53509
+ resolve15({ code, signal, stderr: stderrChunks.join("") });
53580
53510
  });
53581
53511
  });
53582
53512
  let killPromise = null;
@@ -53759,7 +53689,7 @@ var init_run_turn = __esm({
53759
53689
  });
53760
53690
 
53761
53691
  // ../../packages/acp/src/simulated-runner.ts
53762
- import { existsSync as existsSync22 } from "node:fs";
53692
+ import { existsSync as existsSync21 } from "node:fs";
53763
53693
  function createSimulatedAcpTurnRunner(opts) {
53764
53694
  return createSimulatedTurnRunner({
53765
53695
  delayMs: opts?.delayMs ?? 15,
@@ -53773,7 +53703,7 @@ function resolveLaunch(opts) {
53773
53703
  const fromEnv = process.env.SUPERONE_ACP_BINARY?.trim() || process.env.SUPERONE_ACP_COMMAND?.trim() || opts.binaryPath?.trim();
53774
53704
  if (!fromEnv) return null;
53775
53705
  if (fromEnv.includes("/") || fromEnv.includes("\\")) {
53776
- if (!existsSync22(fromEnv)) return null;
53706
+ if (!existsSync21(fromEnv)) return null;
53777
53707
  }
53778
53708
  return {
53779
53709
  command: fromEnv,
@@ -53837,7 +53767,7 @@ var init_serverSentEvents_gen = __esm({
53837
53767
  "../../node_modules/@opencode-ai/sdk/dist/v2/gen/core/serverSentEvents.gen.js"() {
53838
53768
  createSseClient = ({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url: url2, ...options }) => {
53839
53769
  let lastEventId;
53840
- const sleep = sseSleepFn ?? ((ms) => new Promise((resolve14) => setTimeout(resolve14, ms)));
53770
+ const sleep = sseSleepFn ?? ((ms) => new Promise((resolve15) => setTimeout(resolve15, ms)));
53841
53771
  const createStream = async function* () {
53842
53772
  let retryDelay = sseDefaultRetryDelay ?? 3e3;
53843
53773
  let attempt = 0;
@@ -59415,12 +59345,12 @@ var require_isexe = __commonJS({
59415
59345
  if (typeof Promise !== "function") {
59416
59346
  throw new TypeError("callback not provided");
59417
59347
  }
59418
- return new Promise(function(resolve14, reject) {
59348
+ return new Promise(function(resolve15, reject) {
59419
59349
  isexe(path, options || {}, function(er, is) {
59420
59350
  if (er) {
59421
59351
  reject(er);
59422
59352
  } else {
59423
- resolve14(is);
59353
+ resolve15(is);
59424
59354
  }
59425
59355
  });
59426
59356
  });
@@ -59486,27 +59416,27 @@ var require_which = __commonJS({
59486
59416
  opt = {};
59487
59417
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
59488
59418
  const found = [];
59489
- const step = (i) => new Promise((resolve14, reject) => {
59419
+ const step = (i) => new Promise((resolve15, reject) => {
59490
59420
  if (i === pathEnv.length)
59491
- return opt.all && found.length ? resolve14(found) : reject(getNotFoundError(cmd));
59421
+ return opt.all && found.length ? resolve15(found) : reject(getNotFoundError(cmd));
59492
59422
  const ppRaw = pathEnv[i];
59493
59423
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
59494
59424
  const pCmd = path.join(pathPart, cmd);
59495
59425
  const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
59496
- resolve14(subStep(p2, i, 0));
59426
+ resolve15(subStep(p2, i, 0));
59497
59427
  });
59498
- const subStep = (p2, i, ii) => new Promise((resolve14, reject) => {
59428
+ const subStep = (p2, i, ii) => new Promise((resolve15, reject) => {
59499
59429
  if (ii === pathExt.length)
59500
- return resolve14(step(i + 1));
59430
+ return resolve15(step(i + 1));
59501
59431
  const ext = pathExt[ii];
59502
59432
  isexe(p2 + ext, { pathExt: pathExtExe }, (er, is) => {
59503
59433
  if (!er && is) {
59504
59434
  if (opt.all)
59505
59435
  found.push(p2 + ext);
59506
59436
  else
59507
- return resolve14(p2 + ext);
59437
+ return resolve15(p2 + ext);
59508
59438
  }
59509
- return resolve14(subStep(p2, i, ii + 1));
59439
+ return resolve15(subStep(p2, i, ii + 1));
59510
59440
  });
59511
59441
  });
59512
59442
  return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
@@ -60215,24 +60145,24 @@ var init_parse4 = __esm({
60215
60145
 
60216
60146
  // ../../packages/opencode/src/server.ts
60217
60147
  import { spawn as spawn3 } from "node:child_process";
60218
- import { existsSync as existsSync23 } from "node:fs";
60148
+ import { existsSync as existsSync22 } from "node:fs";
60219
60149
  import { homedir as homedir5 } from "node:os";
60220
- import { delimiter, join as join21 } from "node:path";
60150
+ import { delimiter, join as join20 } from "node:path";
60221
60151
  function appendOutput(current, chunk) {
60222
60152
  const next = current + chunk.toString();
60223
60153
  return next.length <= maxServerOutput ? next : next.slice(-maxServerOutput);
60224
60154
  }
60225
60155
  function defaultOpenCodeBinaryPath() {
60226
60156
  const filename = process.platform === "win32" ? "opencode.exe" : "opencode";
60227
- const installed = join21(homedir5(), ".opencode", "bin", filename);
60228
- return existsSync23(installed) ? installed : filename;
60157
+ const installed = join20(homedir5(), ".opencode", "bin", filename);
60158
+ return existsSync22(installed) ? installed : filename;
60229
60159
  }
60230
60160
  function openCodePath(pathEnv) {
60231
60161
  const home = homedir5();
60232
60162
  const paths = [
60233
- join21(home, ".opencode", "bin"),
60234
- join21(home, ".local", "bin"),
60235
- join21(home, ".bun", "bin"),
60163
+ join20(home, ".opencode", "bin"),
60164
+ join20(home, ".local", "bin"),
60165
+ join20(home, ".bun", "bin"),
60236
60166
  "/opt/homebrew/bin",
60237
60167
  "/usr/local/bin",
60238
60168
  ...(pathEnv ?? "").split(delimiter)
@@ -60257,7 +60187,7 @@ async function stopChild(child, exited) {
60257
60187
  signalChild(child, "SIGTERM");
60258
60188
  const stopped = await Promise.race([
60259
60189
  exited.then(() => true),
60260
- new Promise((resolve14) => setTimeout(() => resolve14(false), 1500))
60190
+ new Promise((resolve15) => setTimeout(() => resolve15(false), 1500))
60261
60191
  ]);
60262
60192
  if (stopped) return;
60263
60193
  signalChild(child, "SIGKILL");
@@ -60265,7 +60195,7 @@ async function stopChild(child, exited) {
60265
60195
  }
60266
60196
  async function waitForServer(child, exited, timeoutMs, signal) {
60267
60197
  let output = "";
60268
- return new Promise((resolve14, reject) => {
60198
+ return new Promise((resolve15, reject) => {
60269
60199
  let settled = false;
60270
60200
  const finish = (error51, url2) => {
60271
60201
  if (settled) return;
@@ -60275,7 +60205,7 @@ async function waitForServer(child, exited, timeoutMs, signal) {
60275
60205
  child.stderr.off("data", onData);
60276
60206
  signal?.removeEventListener("abort", onAbort);
60277
60207
  if (error51) reject(error51);
60278
- else resolve14(url2);
60208
+ else resolve15(url2);
60279
60209
  };
60280
60210
  const onData = (chunk) => {
60281
60211
  output = appendOutput(output, chunk);
@@ -60311,12 +60241,12 @@ async function startOpenCodeServer(opts) {
60311
60241
  env: buildOpenCodeServeEnv(opts.env),
60312
60242
  stdio: "pipe"
60313
60243
  });
60314
- const exited = new Promise((resolve14) => {
60244
+ const exited = new Promise((resolve15) => {
60315
60245
  let settled = false;
60316
60246
  const finish = (code, signal) => {
60317
60247
  if (settled) return;
60318
60248
  settled = true;
60319
- resolve14({ code, signal });
60249
+ resolve15({ code, signal });
60320
60250
  };
60321
60251
  child.once("exit", finish);
60322
60252
  child.once("close", finish);
@@ -60341,7 +60271,7 @@ function isOpenCodeBinaryRunnable(binaryPath) {
60341
60271
  const fromEnv = process.env.SUPERONE_OPENCODE_BINARY?.trim();
60342
60272
  const candidate = binaryPath?.trim() || fromEnv;
60343
60273
  if (!candidate) return false;
60344
- return existsSync23(candidate);
60274
+ return existsSync22(candidate);
60345
60275
  }
60346
60276
  var OPENCODE_SERVE_ARGS, maxServerOutput;
60347
60277
  var init_server3 = __esm({
@@ -60692,9 +60622,9 @@ var init_cursor_sdk_available = __esm({
60692
60622
  });
60693
60623
 
60694
60624
  // ../../packages/cursor/src/cursor-platform-binaries.ts
60695
- import { existsSync as existsSync24, statSync as statSync5 } from "node:fs";
60625
+ import { existsSync as existsSync23, statSync as statSync5 } from "node:fs";
60696
60626
  import { createRequire as createRequire3 } from "node:module";
60697
- import { dirname as dirname13, join as join22 } from "node:path";
60627
+ import { dirname as dirname12, join as join21 } from "node:path";
60698
60628
  function cursorPlatformPackageName(platform2 = process.platform, arch2 = process.arch) {
60699
60629
  return `@cursor/sdk-${platform2}-${arch2}`;
60700
60630
  }
@@ -60723,7 +60653,7 @@ function resolveCursorPlatformRoot() {
60723
60653
  const req = cursorSdkRequire();
60724
60654
  try {
60725
60655
  const pkgJson = toUnpackedAsarPath(req.resolve(`${name}/package.json`));
60726
- return existsSync24(pkgJson) ? dirname13(pkgJson) : null;
60656
+ return existsSync23(pkgJson) ? dirname12(pkgJson) : null;
60727
60657
  } catch {
60728
60658
  return null;
60729
60659
  }
@@ -60734,20 +60664,20 @@ function platformBinName(base) {
60734
60664
  function resolveCursorSandboxBinary() {
60735
60665
  const root = resolveCursorPlatformRoot();
60736
60666
  if (!root) return null;
60737
- const bin = join22(root, "bin", platformBinName("cursorsandbox"));
60667
+ const bin = join21(root, "bin", platformBinName("cursorsandbox"));
60738
60668
  return isExecutableFile(bin) ? bin : null;
60739
60669
  }
60740
60670
  function resolveCursorRipgrepBinary() {
60741
60671
  const root = resolveCursorPlatformRoot();
60742
60672
  if (!root) return null;
60743
- const bin = join22(root, "bin", platformBinName("rg"));
60673
+ const bin = join21(root, "bin", platformBinName("rg"));
60744
60674
  return isExecutableFile(bin) ? bin : null;
60745
60675
  }
60746
60676
  function resolveCursorTreeSitterVendorDir() {
60747
60677
  const root = resolveCursorPlatformRoot();
60748
60678
  if (!root) return null;
60749
- const vendor = join22(root, "vendor");
60750
- return existsSync24(join22(vendor, "tree-sitter", "index.js")) ? vendor : null;
60679
+ const vendor = join21(root, "vendor");
60680
+ return existsSync23(join21(vendor, "tree-sitter", "index.js")) ? vendor : null;
60751
60681
  }
60752
60682
  function sandboxExecAvailable() {
60753
60683
  try {
@@ -60789,7 +60719,7 @@ function beginPlatformLookup() {
60789
60719
  if (lookupDepth === 0) {
60790
60720
  savedArgv1 = process.argv[1];
60791
60721
  const root = resolveCursorPlatformRoot();
60792
- if (root) process.argv[1] = join22(root, "package.json");
60722
+ if (root) process.argv[1] = join21(root, "package.json");
60793
60723
  primeHelperEnv();
60794
60724
  }
60795
60725
  lookupDepth += 1;
@@ -61436,9 +61366,9 @@ var init_cursor_event_map = __esm({
61436
61366
 
61437
61367
  // ../../packages/cursor/src/cursor-store.ts
61438
61368
  import Database2 from "better-sqlite3";
61439
- import { mkdirSync as mkdirSync14 } from "node:fs";
61369
+ import { mkdirSync as mkdirSync13 } from "node:fs";
61440
61370
  import { createHash as createHash4 } from "node:crypto";
61441
- import { join as join23 } from "node:path";
61371
+ import { join as join22 } from "node:path";
61442
61372
  function workspaceHash(workspaceRef) {
61443
61373
  return createHash4("md5").update(workspaceRef).digest("hex");
61444
61374
  }
@@ -61481,7 +61411,7 @@ var init_cursor_store = __esm({
61481
61411
  runEvents;
61482
61412
  db;
61483
61413
  constructor(dbPath) {
61484
- mkdirSync14(join23(dbPath, ".."), { recursive: true });
61414
+ mkdirSync13(join22(dbPath, ".."), { recursive: true });
61485
61415
  this.db = new Database2(dbPath);
61486
61416
  this.db.pragma("journal_mode = WAL");
61487
61417
  this.migrate();
@@ -61491,9 +61421,9 @@ var init_cursor_store = __esm({
61491
61421
  this.runEvents = this.createRunEvents();
61492
61422
  }
61493
61423
  static openForWorkspace(userDataRoot, workspaceRef) {
61494
- const dir = join23(userDataRoot, "cursor-sdk", workspaceHash(workspaceRef));
61495
- mkdirSync14(dir, { recursive: true });
61496
- return new _BetterSqliteLocalAgentStore(join23(dir, "agent-store.db"));
61424
+ const dir = join22(userDataRoot, "cursor-sdk", workspaceHash(workspaceRef));
61425
+ mkdirSync13(dir, { recursive: true });
61426
+ return new _BetterSqliteLocalAgentStore(join22(dir, "agent-store.db"));
61497
61427
  }
61498
61428
  dispose() {
61499
61429
  this.db.close();
@@ -62016,8 +61946,8 @@ function isCursorRetryableNetworkError(error51) {
62016
61946
  return Boolean(error51.isRetryable);
62017
61947
  }
62018
61948
  function defaultSleep(ms) {
62019
- return new Promise((resolve14) => {
62020
- setTimeout(resolve14, ms);
61949
+ return new Promise((resolve15) => {
61950
+ setTimeout(resolve15, ms);
62021
61951
  });
62022
61952
  }
62023
61953
  async function withCursorNetworkRetries(fn, opts) {
@@ -62933,7 +62863,7 @@ var init_codex_live_turn = __esm({
62933
62863
  });
62934
62864
 
62935
62865
  // src/session/codex-turn-runner.ts
62936
- import { existsSync as existsSync25 } from "node:fs";
62866
+ import { existsSync as existsSync24 } from "node:fs";
62937
62867
  function mapCodexReasoningEffort(effort) {
62938
62868
  if (!effort) return void 0;
62939
62869
  const e = effort.trim().toLowerCase();
@@ -62943,18 +62873,18 @@ function mapCodexReasoningEffort(effort) {
62943
62873
  return void 0;
62944
62874
  }
62945
62875
  function resolveCodexBinaryPath(opts) {
62946
- if (opts.binaryPath && existsSync25(opts.binaryPath)) return opts.binaryPath;
62876
+ if (opts.binaryPath && existsSync24(opts.binaryPath)) return opts.binaryPath;
62947
62877
  const fromEnv = process.env.SUPERONE_CODEX_BINARY?.trim();
62948
- if (fromEnv && existsSync25(fromEnv)) return fromEnv;
62878
+ if (fromEnv && existsSync24(fromEnv)) return fromEnv;
62949
62879
  const status = opts.harnesses?.get("codex");
62950
- if (status?.enabled && (status.state === "ready" || status.state === "needs_auth") && status.command && existsSync25(status.command)) {
62880
+ if (status?.enabled && (status.state === "ready" || status.state === "needs_auth") && status.command && existsSync24(status.command)) {
62951
62881
  return status.command;
62952
62882
  }
62953
62883
  return null;
62954
62884
  }
62955
62885
  function isCodexBinaryOverrideRunnable() {
62956
62886
  const fromEnv = process.env.SUPERONE_CODEX_BINARY?.trim();
62957
- return Boolean(fromEnv && existsSync25(fromEnv));
62887
+ return Boolean(fromEnv && existsSync24(fromEnv));
62958
62888
  }
62959
62889
  function providerEnvKeyOf(env) {
62960
62890
  return [
@@ -66687,7 +66617,7 @@ var require_compile = __commonJS({
66687
66617
  const schOrFunc = root.refs[ref];
66688
66618
  if (schOrFunc)
66689
66619
  return schOrFunc;
66690
- let _sch = resolve14.call(this, root, ref);
66620
+ let _sch = resolve15.call(this, root, ref);
66691
66621
  if (_sch === void 0) {
66692
66622
  const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref];
66693
66623
  const { schemaId } = this.opts;
@@ -66714,7 +66644,7 @@ var require_compile = __commonJS({
66714
66644
  function sameSchemaEnv(s1, s2) {
66715
66645
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
66716
66646
  }
66717
- function resolve14(root, ref) {
66647
+ function resolve15(root, ref) {
66718
66648
  let sch;
66719
66649
  while (typeof (sch = this.refs[ref]) == "string")
66720
66650
  ref = sch;
@@ -67345,7 +67275,7 @@ var require_fast_uri = __commonJS({
67345
67275
  }
67346
67276
  return uri;
67347
67277
  }
67348
- function resolve14(baseURI, relativeURI, options) {
67278
+ function resolve15(baseURI, relativeURI, options) {
67349
67279
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
67350
67280
  const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
67351
67281
  const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
@@ -67629,7 +67559,7 @@ var require_fast_uri = __commonJS({
67629
67559
  var fastUri = {
67630
67560
  SCHEMES,
67631
67561
  normalize: normalize2,
67632
- resolve: resolve14,
67562
+ resolve: resolve15,
67633
67563
  resolveComponent,
67634
67564
  equal,
67635
67565
  serialize,
@@ -70620,7 +70550,7 @@ var require_dist2 = __commonJS({
70620
70550
 
70621
70551
  // src/cli.ts
70622
70552
  import { homedir as homedir10 } from "node:os";
70623
- import { resolve as resolve13 } from "node:path";
70553
+ import { resolve as resolve14 } from "node:path";
70624
70554
 
70625
70555
  // src/config.ts
70626
70556
  import { homedir } from "node:os";
@@ -70661,8 +70591,8 @@ import { fileURLToPath } from "node:url";
70661
70591
  function resolveCliReleaseVersion() {
70662
70592
  const fromEnv = process.env.SUPERONE_CLI_VERSION?.trim();
70663
70593
  if (fromEnv) return fromEnv;
70664
- if ("0.57.2-alpha".trim()) {
70665
- return "0.57.2-alpha".trim();
70594
+ if ("0.57.3-alpha".trim()) {
70595
+ return "0.57.3-alpha".trim();
70666
70596
  }
70667
70597
  const fromDist = readDistManifestVersion();
70668
70598
  if (fromDist) return fromDist;
@@ -71531,9 +71461,9 @@ async function startNodeServer(opts) {
71531
71461
  }
71532
71462
  });
71533
71463
  });
71534
- await new Promise((resolve14, reject) => {
71464
+ await new Promise((resolve15, reject) => {
71535
71465
  httpServer.once("error", reject);
71536
- httpServer.listen(opts.bindPort, opts.bindHost, () => resolve14());
71466
+ httpServer.listen(opts.bindPort, opts.bindHost, () => resolve15());
71537
71467
  });
71538
71468
  const address = httpServer.address();
71539
71469
  const port = typeof address === "object" && address ? address.port : opts.bindPort;
@@ -71546,9 +71476,9 @@ async function startNodeServer(opts) {
71546
71476
  async close() {
71547
71477
  for (const ws of activeSockets.keys()) ws.close();
71548
71478
  activeSockets.clear();
71549
- await new Promise((resolve14) => wss.close(() => resolve14()));
71550
- await new Promise((resolve14, reject) => {
71551
- httpServer.close((err) => err ? reject(err) : resolve14());
71479
+ await new Promise((resolve15) => wss.close(() => resolve15()));
71480
+ await new Promise((resolve15, reject) => {
71481
+ httpServer.close((err) => err ? reject(err) : resolve15());
71552
71482
  });
71553
71483
  }
71554
71484
  };
@@ -71658,7 +71588,7 @@ async function handleHttp(req, res, opts) {
71658
71588
  }
71659
71589
 
71660
71590
  // src/runtime.ts
71661
- import { existsSync as existsSync42, readFileSync as readFileSync21, writeFileSync as writeFileSync19 } from "node:fs";
71591
+ import { existsSync as existsSync41, readFileSync as readFileSync20, writeFileSync as writeFileSync18 } from "node:fs";
71662
71592
 
71663
71593
  // ../../packages/runtime/src/db/database.ts
71664
71594
  import Database from "better-sqlite3";
@@ -71761,7 +71691,8 @@ CREATE TABLE IF NOT EXISTS projects (
71761
71691
  name TEXT NOT NULL,
71762
71692
  repo_identity TEXT,
71763
71693
  opened_at INTEGER,
71764
- last_active_at INTEGER
71694
+ last_active_at INTEGER,
71695
+ extra_dirs_json TEXT NOT NULL DEFAULT '[]'
71765
71696
  );
71766
71697
 
71767
71698
  CREATE TABLE IF NOT EXISTS sessions (
@@ -71954,6 +71885,7 @@ function openNodeDatabase(dbPath) {
71954
71885
  ensureCollaborationTables(db);
71955
71886
  ensureAutomationsSupport(db);
71956
71887
  ensureSessionTagsColumn(db);
71888
+ ensureProjectExtraDirsColumn(db);
71957
71889
  ensureSessionProvidersSupport(db);
71958
71890
  const row = db.prepare("SELECT value FROM meta WHERE key = ?").get("schema_generation");
71959
71891
  if (!row) {
@@ -71984,6 +71916,12 @@ function ensureSessionUiColumns(db) {
71984
71916
  db.exec(`ALTER TABLE sessions ADD COLUMN is_user_renamed INTEGER NOT NULL DEFAULT 0`);
71985
71917
  }
71986
71918
  }
71919
+ function ensureProjectExtraDirsColumn(db) {
71920
+ const cols = db.prepare(`PRAGMA table_info(projects)`).all();
71921
+ if (!cols.some((c) => c.name === "extra_dirs_json")) {
71922
+ db.exec(`ALTER TABLE projects ADD COLUMN extra_dirs_json TEXT NOT NULL DEFAULT '[]'`);
71923
+ }
71924
+ }
71987
71925
  function ensureHarnessInstallationsTable(db) {
71988
71926
  db.exec(`
71989
71927
  CREATE TABLE IF NOT EXISTS harness_installations (
@@ -72689,7 +72627,7 @@ async function cloneRepository(input) {
72689
72627
  }
72690
72628
 
72691
72629
  // src/rpc/handlers.ts
72692
- import { existsSync as existsSync26, mkdirSync as mkdirSync15, readdirSync as readdirSync8, statSync as statSync6 } from "node:fs";
72630
+ import { existsSync as existsSync25, mkdirSync as mkdirSync14, readdirSync as readdirSync8, statSync as statSync6 } from "node:fs";
72693
72631
  import { join as pathJoin, resolve as pathResolve } from "node:path";
72694
72632
  import { arch, cpus, freemem, homedir as homedir6, hostname as hostname4, platform, totalmem, uptime } from "node:os";
72695
72633
 
@@ -72896,57 +72834,6 @@ function handleMcpList(payload, ctx) {
72896
72834
  return mapThrown(err);
72897
72835
  }
72898
72836
  }
72899
- function handleAdditionalDirsList(payload, ctx) {
72900
- const denied = requireScopes(ctx.client, OPERATION_SCOPES.readWorkspace);
72901
- if (denied) return denied;
72902
- const p2 = asRecord13(payload);
72903
- try {
72904
- const projectId = String(p2.projectId ?? "");
72905
- const cwd = projectRoot(ctx.projects, projectId);
72906
- const provider = parseProviderStrict(p2.provider);
72907
- if (!provider) return { error: { code: "invalid_argument", message: "provider must be claude or codex" } };
72908
- ctx.projects.touch(projectId);
72909
- return { result: readScopedAdditionalDirs(provider, cwd, manageOpts(ctx)) };
72910
- } catch (err) {
72911
- return mapThrown(err);
72912
- }
72913
- }
72914
- function handleAdditionalDirsAdd(payload, ctx) {
72915
- const denied = requireScopes(ctx.client, OPERATION_SCOPES.writeWorkspace);
72916
- if (denied) return denied;
72917
- const p2 = asRecord13(payload);
72918
- try {
72919
- const projectId = String(p2.projectId ?? "");
72920
- const cwd = projectRoot(ctx.projects, projectId);
72921
- const provider = parseProviderStrict(p2.provider);
72922
- if (!provider) return { error: { code: "invalid_argument", message: "provider must be claude or codex" } };
72923
- const dir = typeof p2.dir === "string" ? p2.dir.trim() : "";
72924
- if (!dir) return { error: { code: "invalid_argument", message: "dir is required" } };
72925
- addProjectAdditionalDir(provider, cwd, dir, manageOpts(ctx));
72926
- ctx.projects.touch(projectId);
72927
- return { result: { ok: true } };
72928
- } catch (err) {
72929
- return mapThrown(err);
72930
- }
72931
- }
72932
- function handleAdditionalDirsRemove(payload, ctx) {
72933
- const denied = requireScopes(ctx.client, OPERATION_SCOPES.writeWorkspace);
72934
- if (denied) return denied;
72935
- const p2 = asRecord13(payload);
72936
- try {
72937
- const projectId = String(p2.projectId ?? "");
72938
- const cwd = projectRoot(ctx.projects, projectId);
72939
- const provider = parseProviderStrict(p2.provider);
72940
- if (!provider) return { error: { code: "invalid_argument", message: "provider must be claude or codex" } };
72941
- const dir = typeof p2.dir === "string" ? p2.dir.trim() : "";
72942
- if (!dir) return { error: { code: "invalid_argument", message: "dir is required" } };
72943
- removeProjectAdditionalDir(provider, cwd, dir);
72944
- ctx.projects.touch(projectId);
72945
- return { result: { ok: true } };
72946
- } catch (err) {
72947
- return mapThrown(err);
72948
- }
72949
- }
72950
72837
  function parseMcpWriteConfig(raw) {
72951
72838
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
72952
72839
  return {
@@ -73558,12 +73445,6 @@ function dispatchResourceRpc(method, payload, ctx) {
73558
73445
  return handleMcpToggle(payload, ctx);
73559
73446
  case "mcp.delete":
73560
73447
  return handleMcpDelete(payload, ctx);
73561
- case "additionalDirs.list":
73562
- return handleAdditionalDirsList(payload, ctx);
73563
- case "additionalDirs.add":
73564
- return handleAdditionalDirsAdd(payload, ctx);
73565
- case "additionalDirs.remove":
73566
- return handleAdditionalDirsRemove(payload, ctx);
73567
73448
  case "plugins.list":
73568
73449
  return handlePluginsList(payload, ctx);
73569
73450
  case "plugins.get":
@@ -74741,12 +74622,14 @@ function clearWatchBuffersForClient(clientSessionId) {
74741
74622
  watchBuffers.delete(watchId);
74742
74623
  }
74743
74624
  }
74625
+ var MAX_TURN_ADDITIONAL_DIRS = 64;
74744
74626
  var MUTATING_METHODS = /* @__PURE__ */ new Set([
74745
74627
  "terminal.create",
74746
74628
  "terminal.write",
74747
74629
  "terminal.resize",
74748
74630
  "terminal.kill",
74749
74631
  "project.open",
74632
+ "project.update",
74750
74633
  "project.remove",
74751
74634
  "workspace.writeFile",
74752
74635
  "workspace.rename",
@@ -74941,6 +74824,8 @@ async function dispatchRpcInner(method, payload, ctx) {
74941
74824
  return handleProjectGet(payload, ctx);
74942
74825
  case "project.open":
74943
74826
  return handleProjectOpen(payload, ctx);
74827
+ case "project.update":
74828
+ return handleProjectUpdate(payload, ctx);
74944
74829
  case "project.remove":
74945
74830
  return handleProjectRemove(payload, ctx);
74946
74831
  case "fs.listDir":
@@ -75625,14 +75510,42 @@ function handleProjectOpen(payload, ctx) {
75625
75510
  }
75626
75511
  const name = typeof p2.name === "string" ? p2.name : void 0;
75627
75512
  try {
75628
- if (p2.createIfMissing === true && !existsSync26(path)) {
75629
- mkdirSync15(path, { recursive: true });
75513
+ if (p2.createIfMissing === true && !existsSync25(path)) {
75514
+ mkdirSync14(path, { recursive: true });
75630
75515
  }
75631
75516
  return { result: ctx.projects.open(path, name) };
75632
75517
  } catch (err) {
75633
75518
  return mapThrown7(err);
75634
75519
  }
75635
75520
  }
75521
+ function handleProjectUpdate(payload, ctx) {
75522
+ const denied = requireScopes7(ctx.client, OPERATION_SCOPES.manageProject);
75523
+ if (denied) return denied;
75524
+ const p2 = asRecord19(payload);
75525
+ const projectId = typeof p2.projectId === "string" && p2.projectId ? p2.projectId : void 0;
75526
+ const pathRaw = typeof p2.path === "string" && p2.path ? expandHostPath(p2.path) : void 0;
75527
+ if (!projectId && !pathRaw) {
75528
+ return { error: { code: "invalid_argument", message: "projectId or path is required" } };
75529
+ }
75530
+ const name = typeof p2.name === "string" ? p2.name : void 0;
75531
+ const hostDirs = (raw) => Array.isArray(raw) ? raw.filter((d) => typeof d === "string" && d.trim().length > 0).map((d) => expandHostPath(d.trim())) : void 0;
75532
+ try {
75533
+ const updated = ctx.projects.update({
75534
+ projectId,
75535
+ path: pathRaw,
75536
+ name,
75537
+ extraDirs: hostDirs(p2.extraDirs),
75538
+ addExtraDirs: hostDirs(p2.addExtraDirs),
75539
+ removeExtraDirs: hostDirs(p2.removeExtraDirs)
75540
+ });
75541
+ if (!updated) {
75542
+ return { error: { code: "not_found", message: "project not found" } };
75543
+ }
75544
+ return { result: updated };
75545
+ } catch (err) {
75546
+ return mapThrown7(err);
75547
+ }
75548
+ }
75636
75549
  function handleProjectRemove(payload, ctx) {
75637
75550
  const denied = requireScopes7(ctx.client, OPERATION_SCOPES.manageProject);
75638
75551
  if (denied) return denied;
@@ -75662,7 +75575,7 @@ function handleFsListDir(payload, ctx) {
75662
75575
  }
75663
75576
  try {
75664
75577
  const resolved = expandHostPath(raw);
75665
- if (!existsSync26(resolved)) {
75578
+ if (!existsSync25(resolved)) {
75666
75579
  return { error: { code: "not_found", message: "path not found" } };
75667
75580
  }
75668
75581
  if (!statSync6(resolved).isDirectory()) {
@@ -76608,7 +76521,7 @@ async function handleSessionSend(payload, ctx) {
76608
76521
  const permissionModeFromClient = typeof options.permissionMode === "string" && options.permissionMode.trim() ? options.permissionMode.trim() : typeof p2.permissionMode === "string" && p2.permissionMode.trim() ? p2.permissionMode.trim() : null;
76609
76522
  const sandboxModeFromClient = typeof options.sandboxMode === "string" && options.sandboxMode.trim() ? options.sandboxMode.trim() : typeof p2.sandboxMode === "string" && p2.sandboxMode.trim() ? p2.sandboxMode.trim() : null;
76610
76523
  const rawAdditionalDirs = Array.isArray(options.additionalDirectories) ? options.additionalDirectories : Array.isArray(p2.additionalDirectories) ? p2.additionalDirectories : [];
76611
- const additionalDirectories = rawAdditionalDirs.filter((d) => typeof d === "string" && d.trim().length > 0).map((d) => d.trim()).slice(0, 32);
76524
+ const clientAdditionalDirectories = rawAdditionalDirs.filter((d) => typeof d === "string" && d.trim().length > 0).map((d) => d.trim());
76612
76525
  const rawEnabledSkills = Array.isArray(options.enabledSkills) ? options.enabledSkills : Array.isArray(p2.enabledSkills) ? p2.enabledSkills : [];
76613
76526
  const enabledSkills = rawEnabledSkills.filter((s2) => typeof s2 === "string" && s2.trim().length > 0).map((s2) => s2.trim()).slice(0, 200);
76614
76527
  const rawDisabledSkills = Array.isArray(options.disabledSkills) ? options.disabledSkills : Array.isArray(p2.disabledSkills) ? p2.disabledSkills : null;
@@ -76633,6 +76546,10 @@ async function handleSessionSend(payload, ctx) {
76633
76546
  const reviewTarget = options.reviewTarget !== void 0 ? options.reviewTarget : p2.reviewTarget !== void 0 ? p2.reviewTarget : void 0;
76634
76547
  const existing = ctx.sessions.get(String(p2.sessionId ?? ""));
76635
76548
  const harnessId = existing?.harnessId || "claude";
76549
+ const projectExtraDirs = existing ? ctx.projects.get(existing.projectId)?.extraDirs ?? [] : [];
76550
+ const additionalDirectories = [
76551
+ .../* @__PURE__ */ new Set([...projectExtraDirs, ...clientAdditionalDirectories])
76552
+ ].slice(0, MAX_TURN_ADDITIONAL_DIRS);
76636
76553
  const agentDefaults = resolveAgentTurnDefaults(
76637
76554
  loadNodeAgentSettings(ctx.settingsConfigPath),
76638
76555
  harnessId
@@ -77243,11 +77160,11 @@ function parseState(raw) {
77243
77160
 
77244
77161
  // ../../packages/runtime/src/harness/home-path.ts
77245
77162
  import { homedir as homedir7 } from "node:os";
77246
- import { join as join24 } from "node:path";
77163
+ import { join as join23 } from "node:path";
77247
77164
  var HARNESS_HOME_DIRNAME = "harness";
77248
77165
  var SUPERONE_DIRNAME = ".superone";
77249
77166
  function defaultHarnessHomeRoot(userHome = homedir7()) {
77250
- return join24(userHome, SUPERONE_DIRNAME, HARNESS_HOME_DIRNAME);
77167
+ return join23(userHome, SUPERONE_DIRNAME, HARNESS_HOME_DIRNAME);
77251
77168
  }
77252
77169
  function resolveHarnessHomeRoot(opts = {}) {
77253
77170
  const explicit = opts.override?.trim();
@@ -77261,16 +77178,16 @@ function resolveHarnessHomeRoot(opts = {}) {
77261
77178
 
77262
77179
  // ../../packages/runtime/src/harness/managed-layout.ts
77263
77180
  import {
77264
- existsSync as existsSync27,
77265
- mkdirSync as mkdirSync16,
77181
+ existsSync as existsSync26,
77182
+ mkdirSync as mkdirSync15,
77266
77183
  readdirSync as readdirSync9,
77267
- readFileSync as readFileSync15,
77184
+ readFileSync as readFileSync14,
77268
77185
  renameSync as renameSync2,
77269
77186
  rmSync as rmSync2,
77270
77187
  statSync as statSync7,
77271
- writeFileSync as writeFileSync11
77188
+ writeFileSync as writeFileSync10
77272
77189
  } from "node:fs";
77273
- import { join as join25 } from "node:path";
77190
+ import { join as join24 } from "node:path";
77274
77191
  import { randomBytes as randomBytes3 } from "node:crypto";
77275
77192
  var MANAGED_VERSIONS_DIRNAME = "versions";
77276
77193
  var MANAGED_CURRENT_BASENAME = "current";
@@ -77287,19 +77204,19 @@ function sanitizeRuntimeVersionForPath(runtimeVersion) {
77287
77204
  return v2;
77288
77205
  }
77289
77206
  function managedVersionsDir(prefix) {
77290
- return join25(prefix, MANAGED_VERSIONS_DIRNAME);
77207
+ return join24(prefix, MANAGED_VERSIONS_DIRNAME);
77291
77208
  }
77292
77209
  function managedVersionDir(prefix, runtimeVersion) {
77293
- return join25(managedVersionsDir(prefix), sanitizeRuntimeVersionForPath(runtimeVersion));
77210
+ return join24(managedVersionsDir(prefix), sanitizeRuntimeVersionForPath(runtimeVersion));
77294
77211
  }
77295
77212
  function managedCurrentPath(prefix) {
77296
- return join25(prefix, MANAGED_CURRENT_BASENAME);
77213
+ return join24(prefix, MANAGED_CURRENT_BASENAME);
77297
77214
  }
77298
77215
  function readCurrentPointer(prefix) {
77299
77216
  const path = managedCurrentPath(prefix);
77300
- if (!existsSync27(path)) return null;
77217
+ if (!existsSync26(path)) return null;
77301
77218
  try {
77302
- const raw = JSON.parse(readFileSync15(path, "utf8"));
77219
+ const raw = JSON.parse(readFileSync14(path, "utf8"));
77303
77220
  if (typeof raw.runtimeVersion !== "string" || !raw.runtimeVersion.trim()) return null;
77304
77221
  return {
77305
77222
  runtimeVersion: raw.runtimeVersion.trim(),
@@ -77312,7 +77229,7 @@ function readCurrentPointer(prefix) {
77312
77229
  }
77313
77230
  function writeCurrentPointer(prefix, runtimeVersion, extras) {
77314
77231
  const ver = sanitizeRuntimeVersionForPath(runtimeVersion);
77315
- mkdirSync16(prefix, { recursive: true });
77232
+ mkdirSync15(prefix, { recursive: true });
77316
77233
  const path = managedCurrentPath(prefix);
77317
77234
  const body = JSON.stringify(
77318
77235
  {
@@ -77323,19 +77240,19 @@ function writeCurrentPointer(prefix, runtimeVersion, extras) {
77323
77240
  null,
77324
77241
  2
77325
77242
  );
77326
- const tmp = join25(
77243
+ const tmp = join24(
77327
77244
  prefix,
77328
77245
  `.${MANAGED_CURRENT_BASENAME}.${process.pid}.${randomBytes3(6).toString("hex")}.tmp`
77329
77246
  );
77330
- writeFileSync11(tmp, body);
77247
+ writeFileSync10(tmp, body);
77331
77248
  try {
77332
77249
  renameSync2(tmp, path);
77333
77250
  } catch {
77334
77251
  try {
77335
- if (existsSync27(path)) rmSync2(path, { force: true });
77252
+ if (existsSync26(path)) rmSync2(path, { force: true });
77336
77253
  renameSync2(tmp, path);
77337
77254
  } catch {
77338
- writeFileSync11(path, body);
77255
+ writeFileSync10(path, body);
77339
77256
  try {
77340
77257
  rmSync2(tmp, { force: true });
77341
77258
  } catch {
@@ -77344,26 +77261,26 @@ function writeCurrentPointer(prefix, runtimeVersion, extras) {
77344
77261
  }
77345
77262
  }
77346
77263
  function resolveActiveInstallRoot(prefix) {
77347
- if (!prefix || !existsSync27(prefix)) return null;
77264
+ if (!prefix || !existsSync26(prefix)) return null;
77348
77265
  const pointer = readCurrentPointer(prefix);
77349
77266
  if (pointer) {
77350
- if (pointer.installRoot && existsSync27(pointer.installRoot) && statSync7(pointer.installRoot).isDirectory()) {
77267
+ if (pointer.installRoot && existsSync26(pointer.installRoot) && statSync7(pointer.installRoot).isDirectory()) {
77351
77268
  return pointer.installRoot;
77352
77269
  }
77353
77270
  const dir = managedVersionDir(prefix, pointer.runtimeVersion);
77354
- if (existsSync27(dir) && statSync7(dir).isDirectory()) return dir;
77271
+ if (existsSync26(dir) && statSync7(dir).isDirectory()) return dir;
77355
77272
  }
77356
77273
  const versionsRoot = managedVersionsDir(prefix);
77357
- if (existsSync27(versionsRoot)) {
77274
+ if (existsSync26(versionsRoot)) {
77358
77275
  try {
77359
77276
  const kids = readdirSync9(versionsRoot).filter((n) => {
77360
77277
  try {
77361
- return statSync7(join25(versionsRoot, n)).isDirectory();
77278
+ return statSync7(join24(versionsRoot, n)).isDirectory();
77362
77279
  } catch {
77363
77280
  return false;
77364
77281
  }
77365
77282
  });
77366
- if (kids.length === 1) return join25(versionsRoot, kids[0]);
77283
+ if (kids.length === 1) return join24(versionsRoot, kids[0]);
77367
77284
  } catch {
77368
77285
  }
77369
77286
  }
@@ -77371,7 +77288,7 @@ function resolveActiveInstallRoot(prefix) {
77371
77288
  }
77372
77289
  function pruneManagedVersions(prefix, keep, maxKeep = MANAGED_VERSION_KEEP) {
77373
77290
  const versionsRoot = managedVersionsDir(prefix);
77374
- if (!existsSync27(versionsRoot)) return;
77291
+ if (!existsSync26(versionsRoot)) return;
77375
77292
  const keepSet = new Set(
77376
77293
  keep.filter(Boolean).map((v2) => {
77377
77294
  try {
@@ -77385,7 +77302,7 @@ function pruneManagedVersions(prefix, keep, maxKeep = MANAGED_VERSION_KEEP) {
77385
77302
  try {
77386
77303
  entries = readdirSync9(versionsRoot).map((name) => {
77387
77304
  try {
77388
- const st = statSync7(join25(versionsRoot, name));
77305
+ const st = statSync7(join24(versionsRoot, name));
77389
77306
  if (!st.isDirectory()) return null;
77390
77307
  return { name, mtime: st.mtimeMs };
77391
77308
  } catch {
@@ -77404,7 +77321,7 @@ function pruneManagedVersions(prefix, keep, maxKeep = MANAGED_VERSION_KEEP) {
77404
77321
  }
77405
77322
  for (const e of entries) {
77406
77323
  if (retain.has(e.name)) continue;
77407
- const dir = join25(versionsRoot, e.name);
77324
+ const dir = join24(versionsRoot, e.name);
77408
77325
  try {
77409
77326
  rmSync2(dir, { recursive: true, force: true });
77410
77327
  } catch {
@@ -77416,17 +77333,17 @@ function pruneManagedVersions(prefix, keep, maxKeep = MANAGED_VERSION_KEEP) {
77416
77333
  import {
77417
77334
  copyFileSync,
77418
77335
  createReadStream,
77419
- existsSync as existsSync28,
77420
- mkdirSync as mkdirSync17,
77336
+ existsSync as existsSync27,
77337
+ mkdirSync as mkdirSync16,
77421
77338
  mkdtempSync,
77422
- readFileSync as readFileSync16,
77339
+ readFileSync as readFileSync15,
77423
77340
  renameSync as renameSync3,
77424
77341
  rmSync as rmSync3,
77425
77342
  statSync as statSync8,
77426
- writeFileSync as writeFileSync12
77343
+ writeFileSync as writeFileSync11
77427
77344
  } from "node:fs";
77428
77345
  import { createHash as createHash5, randomBytes as randomBytes4 } from "node:crypto";
77429
- import { dirname as dirname14, join as join26, relative, resolve as resolve6, sep as sep3 } from "node:path";
77346
+ import { dirname as dirname13, join as join25, relative, resolve as resolve6, sep as sep3 } from "node:path";
77430
77347
  import { arch as osArch, platform as osPlatform } from "node:os";
77431
77348
  var releaseVersionProvider = null;
77432
77349
  function setHarnessReleaseVersionProvider(fn) {
@@ -77570,14 +77487,14 @@ function parseManagedHarnessPin(id, raw) {
77570
77487
  function loadHarnessReleaseManifest(nodeHome) {
77571
77488
  const fromEnv = process.env.SUPERONE_HARNESS_MANIFEST;
77572
77489
  if (fromEnv) {
77573
- if (!existsSync28(fromEnv)) {
77490
+ if (!existsSync27(fromEnv)) {
77574
77491
  throw new Error(`SUPERONE_HARNESS_MANIFEST not found: ${fromEnv}`);
77575
77492
  }
77576
- return parseHarnessReleaseManifest(JSON.parse(readFileSync16(fromEnv, "utf8")));
77493
+ return parseHarnessReleaseManifest(JSON.parse(readFileSync15(fromEnv, "utf8")));
77577
77494
  }
77578
- const local = join26(nodeHome, "release-manifest.json");
77579
- if (existsSync28(local)) {
77580
- return parseHarnessReleaseManifest(JSON.parse(readFileSync16(local, "utf8")));
77495
+ const local = join25(nodeHome, "release-manifest.json");
77496
+ if (existsSync27(local)) {
77497
+ return parseHarnessReleaseManifest(JSON.parse(readFileSync15(local, "utf8")));
77581
77498
  }
77582
77499
  return null;
77583
77500
  }
@@ -77645,7 +77562,7 @@ async function installManagedArtifactFromFile(opts) {
77645
77562
  throw new Error(`release manifest does not pin managed harness ${opts.harnessId}`);
77646
77563
  }
77647
77564
  const art = selectArtifactPin(pin);
77648
- if (!existsSync28(opts.artifactPath)) {
77565
+ if (!existsSync27(opts.artifactPath)) {
77649
77566
  throw new Error(`artifact not found: ${opts.artifactPath}`);
77650
77567
  }
77651
77568
  if (!statSync8(opts.artifactPath).isFile()) {
@@ -77663,8 +77580,8 @@ async function installManagedArtifactFromFile(opts) {
77663
77580
  opts.harnessId,
77664
77581
  pin.artifactVersion
77665
77582
  );
77666
- const finalFile = join26(destDir, MANAGED_PAYLOAD_BASENAME);
77667
- const metaPath = join26(destDir, MANAGED_META_BASENAME);
77583
+ const finalFile = join25(destDir, MANAGED_PAYLOAD_BASENAME);
77584
+ const metaPath = join25(destDir, MANAGED_META_BASENAME);
77668
77585
  assertStrictChild(finalFile, destDir, "payload path");
77669
77586
  assertStrictChild(metaPath, destDir, "meta path");
77670
77587
  const metaBody = JSON.stringify(
@@ -77683,8 +77600,8 @@ async function installManagedArtifactFromFile(opts) {
77683
77600
  2
77684
77601
  );
77685
77602
  let reusedExisting = false;
77686
- if (existsSync28(destDir)) {
77687
- const payloadOk = existsSync28(finalFile) && statSync8(finalFile).isFile() && await sha256File(finalFile) === art.digestSha256;
77603
+ if (existsSync27(destDir)) {
77604
+ const payloadOk = existsSync27(finalFile) && statSync8(finalFile).isFile() && await sha256File(finalFile) === art.digestSha256;
77688
77605
  if (payloadOk) {
77689
77606
  reusedExisting = true;
77690
77607
  } else if (mode === "repair") {
@@ -77703,26 +77620,26 @@ async function installManagedArtifactFromFile(opts) {
77703
77620
  );
77704
77621
  }
77705
77622
  } else {
77706
- const harnessRoot2 = dirname14(destDir);
77707
- mkdirSync17(harnessRoot2, { recursive: true });
77623
+ const harnessRoot2 = dirname13(destDir);
77624
+ mkdirSync16(harnessRoot2, { recursive: true });
77708
77625
  assertPathInside(destDir, harnessRoot2, "version dir");
77709
77626
  const stagingDir = mkdtempSync(
77710
- join26(harnessRoot2, `.staging-${opts.harnessId}-${randomBytes4(8).toString("hex")}-`)
77627
+ join25(harnessRoot2, `.staging-${opts.harnessId}-${randomBytes4(8).toString("hex")}-`)
77711
77628
  );
77712
77629
  assertPathInside(stagingDir, harnessRoot2, "staging dir");
77713
- const stagingFile = join26(stagingDir, MANAGED_PAYLOAD_BASENAME);
77714
- const stagingMeta = join26(stagingDir, MANAGED_META_BASENAME);
77630
+ const stagingFile = join25(stagingDir, MANAGED_PAYLOAD_BASENAME);
77631
+ const stagingMeta = join25(stagingDir, MANAGED_META_BASENAME);
77715
77632
  try {
77716
77633
  copyFileSync(opts.artifactPath, stagingFile);
77717
77634
  const stagedDigest = await sha256File(stagingFile);
77718
77635
  if (stagedDigest !== art.digestSha256) {
77719
77636
  throw new Error(`staged artifact digest mismatch for ${opts.harnessId}`);
77720
77637
  }
77721
- writeFileSync12(stagingMeta, metaBody, "utf8");
77638
+ writeFileSync11(stagingMeta, metaBody, "utf8");
77722
77639
  renameSync3(stagingDir, destDir);
77723
77640
  } catch (err) {
77724
77641
  rmSync3(stagingDir, { recursive: true, force: true });
77725
- if (existsSync28(destDir) && existsSync28(finalFile)) {
77642
+ if (existsSync27(destDir) && existsSync27(finalFile)) {
77726
77643
  const existingDigest = await sha256File(finalFile);
77727
77644
  if (existingDigest === art.digestSha256) {
77728
77645
  reusedExisting = true;
@@ -77747,22 +77664,22 @@ async function installManagedArtifactFromFile(opts) {
77747
77664
  if (finalDigest !== art.digestSha256) {
77748
77665
  throw new Error(`final payload digest mismatch for ${opts.harnessId}`);
77749
77666
  }
77750
- const harnessRoot = join26(
77667
+ const harnessRoot = join25(
77751
77668
  releasesRoot(opts.nodeHome),
77752
77669
  opts.manifest.cliVersion,
77753
77670
  "harnesses",
77754
77671
  opts.harnessId
77755
77672
  );
77756
77673
  assertPathInside(harnessRoot, releasesRoot(opts.nodeHome), "harness root");
77757
- mkdirSync17(harnessRoot, { recursive: true });
77758
- const currentPath = join26(harnessRoot, MANAGED_CURRENT_BASENAME2);
77759
- const currentTmp = join26(
77674
+ mkdirSync16(harnessRoot, { recursive: true });
77675
+ const currentPath = join25(harnessRoot, MANAGED_CURRENT_BASENAME2);
77676
+ const currentTmp = join25(
77760
77677
  harnessRoot,
77761
77678
  `.${MANAGED_CURRENT_BASENAME2}.${process.pid}.${randomBytes4(6).toString("hex")}.tmp`
77762
77679
  );
77763
77680
  assertStrictChild(currentTmp, harnessRoot, "current pointer temp");
77764
77681
  try {
77765
- writeFileSync12(
77682
+ writeFileSync11(
77766
77683
  currentTmp,
77767
77684
  JSON.stringify(
77768
77685
  {
@@ -77793,10 +77710,10 @@ async function installManagedArtifactFromFile(opts) {
77793
77710
  };
77794
77711
  }
77795
77712
  async function replacePayloadAtomically(opts) {
77796
- mkdirSync17(opts.destDir, { recursive: true });
77713
+ mkdirSync16(opts.destDir, { recursive: true });
77797
77714
  const nonce = randomBytes4(8).toString("hex");
77798
- const payloadTmp = join26(opts.destDir, `.${MANAGED_PAYLOAD_BASENAME}.${nonce}.tmp`);
77799
- const metaTmp = join26(opts.destDir, `.${MANAGED_META_BASENAME}.${nonce}.tmp`);
77715
+ const payloadTmp = join25(opts.destDir, `.${MANAGED_PAYLOAD_BASENAME}.${nonce}.tmp`);
77716
+ const metaTmp = join25(opts.destDir, `.${MANAGED_META_BASENAME}.${nonce}.tmp`);
77800
77717
  assertStrictChild(payloadTmp, opts.destDir, "payload temp");
77801
77718
  assertStrictChild(metaTmp, opts.destDir, "meta temp");
77802
77719
  try {
@@ -77805,7 +77722,7 @@ async function replacePayloadAtomically(opts) {
77805
77722
  if (d !== opts.expectedDigest) {
77806
77723
  throw new Error(`repair staged digest mismatch: expected ${opts.expectedDigest}, got ${d}`);
77807
77724
  }
77808
- writeFileSync12(metaTmp, opts.metaBody, "utf8");
77725
+ writeFileSync11(metaTmp, opts.metaBody, "utf8");
77809
77726
  renameSync3(payloadTmp, opts.finalFile);
77810
77727
  renameSync3(metaTmp, opts.metaPath);
77811
77728
  } catch (err) {
@@ -77830,9 +77747,9 @@ function requiredRuntimeVersion(harnessId, manifest) {
77830
77747
  }
77831
77748
 
77832
77749
  // ../../packages/runtime/src/harness/managed-official.ts
77833
- import { existsSync as existsSync29, mkdirSync as mkdirSync18, readFileSync as readFileSync17, readdirSync as readdirSync10, statSync as statSync9, writeFileSync as writeFileSync13 } from "node:fs";
77750
+ import { existsSync as existsSync28, mkdirSync as mkdirSync17, readFileSync as readFileSync16, readdirSync as readdirSync10, statSync as statSync9, writeFileSync as writeFileSync12 } from "node:fs";
77834
77751
  import { arch as osArch2, platform as osPlatform2 } from "node:os";
77835
- import { join as join27, resolve as resolve7 } from "node:path";
77752
+ import { join as join26, resolve as resolve7 } from "node:path";
77836
77753
  var OFFICIAL_CLAUDE_SDK_VERSION = "0.3.238";
77837
77754
  var OFFICIAL_CODEX_NPM_VERSION = "0.149.0";
77838
77755
  var OFFICIAL_CODEX_PACKAGE = "@openai/codex";
@@ -77876,7 +77793,7 @@ function claudePlatformPackageName() {
77876
77793
  }
77877
77794
  function isMuslLinux() {
77878
77795
  try {
77879
- if (existsSync29("/etc/alpine-release")) return true;
77796
+ if (existsSync28("/etc/alpine-release")) return true;
77880
77797
  const lib = readdirSync10("/lib").some((n) => n.startsWith("ld-musl"));
77881
77798
  if (lib) return true;
77882
77799
  } catch {
@@ -77884,44 +77801,44 @@ function isMuslLinux() {
77884
77801
  return false;
77885
77802
  }
77886
77803
  function resolveOfficialInstallBinaryInRoot(harnessId, installRoot) {
77887
- if (!installRoot || !existsSync29(installRoot)) return null;
77804
+ if (!installRoot || !existsSync28(installRoot)) return null;
77888
77805
  if (harnessId === "codex") {
77889
77806
  const triple = codexTargetTriple();
77890
77807
  const nativeName = process.platform === "win32" ? "codex.exe" : "codex";
77891
77808
  const candidates = [
77892
- join27(installRoot, "bin", "codex"),
77893
- join27(installRoot, "bin", "codex.cmd"),
77894
- join27(installRoot, "lib", "node_modules", "@openai", "codex", "bin", "codex.js"),
77895
- join27(installRoot, "node_modules", "@openai", "codex", "bin", "codex.js"),
77809
+ join26(installRoot, "bin", "codex"),
77810
+ join26(installRoot, "bin", "codex.cmd"),
77811
+ join26(installRoot, "lib", "node_modules", "@openai", "codex", "bin", "codex.js"),
77812
+ join26(installRoot, "node_modules", "@openai", "codex", "bin", "codex.js"),
77896
77813
  ...triple ? [
77897
- join27(installRoot, "lib", "node_modules", "@openai", "codex", "vendor", triple, "bin", nativeName),
77898
- join27(installRoot, "node_modules", "@openai", "codex", "vendor", triple, "bin", nativeName)
77814
+ join26(installRoot, "lib", "node_modules", "@openai", "codex", "vendor", triple, "bin", nativeName),
77815
+ join26(installRoot, "node_modules", "@openai", "codex", "vendor", triple, "bin", nativeName)
77899
77816
  ] : []
77900
77817
  ];
77901
77818
  for (const c of candidates) {
77902
- if (existsSync29(c) && (c.endsWith(".js") || isExecutableFile2(c))) return c;
77819
+ if (existsSync28(c) && (c.endsWith(".js") || isExecutableFile2(c))) return c;
77903
77820
  }
77904
77821
  return null;
77905
77822
  }
77906
- const nm = join27(installRoot, "lib", "node_modules");
77907
- const scoped = join27(nm, "@anthropic-ai");
77823
+ const nm = join26(installRoot, "lib", "node_modules");
77824
+ const scoped = join26(nm, "@anthropic-ai");
77908
77825
  try {
77909
- if (existsSync29(scoped)) {
77826
+ if (existsSync28(scoped)) {
77910
77827
  const names = readdirSync10(scoped).filter((n) => n.startsWith("claude-agent-sdk-"));
77911
77828
  for (const n of names) {
77912
77829
  const ext = process.platform === "win32" ? ".exe" : "";
77913
- const bin = join27(scoped, n, `claude${ext}`);
77914
- if (existsSync29(bin)) return bin;
77830
+ const bin = join26(scoped, n, `claude${ext}`);
77831
+ if (existsSync28(bin)) return bin;
77915
77832
  }
77916
77833
  }
77917
77834
  } catch {
77918
77835
  }
77919
- const direct = join27(
77836
+ const direct = join26(
77920
77837
  nm,
77921
77838
  ...claudePlatformPackageName().split("/"),
77922
77839
  process.platform === "win32" ? "claude.exe" : "claude"
77923
77840
  );
77924
- if (existsSync29(direct)) return direct;
77841
+ if (existsSync28(direct)) return direct;
77925
77842
  return null;
77926
77843
  }
77927
77844
  function isExecutableFile2(path) {
@@ -77936,7 +77853,7 @@ function isExecutableFile2(path) {
77936
77853
  }
77937
77854
 
77938
77855
  // ../../packages/runtime/src/harness/tarball-fetch.ts
77939
- import { existsSync as existsSync30, rmSync as rmSync4 } from "node:fs";
77856
+ import { existsSync as existsSync29, rmSync as rmSync4 } from "node:fs";
77940
77857
  var NPM_REGISTRY = "https://registry.npmjs.org";
77941
77858
  function assertSha256(actualHex, expectedHex) {
77942
77859
  if (actualHex !== expectedHex.toLowerCase()) {
@@ -77954,7 +77871,7 @@ function assertSha512Integrity(actualBase64, integrity) {
77954
77871
  }
77955
77872
  function discardPartial(destPath) {
77956
77873
  try {
77957
- if (existsSync30(destPath)) rmSync4(destPath, { force: true });
77874
+ if (existsSync29(destPath)) rmSync4(destPath, { force: true });
77958
77875
  } catch {
77959
77876
  }
77960
77877
  }
@@ -78035,13 +77952,13 @@ import {
78035
77952
  appendFileSync,
78036
77953
  createReadStream as createReadStream2,
78037
77954
  createWriteStream,
78038
- existsSync as existsSync31,
78039
- mkdirSync as mkdirSync19,
77955
+ existsSync as existsSync30,
77956
+ mkdirSync as mkdirSync18,
78040
77957
  rmSync as rmSync5,
78041
77958
  statSync as statSync10,
78042
- writeFileSync as writeFileSync14
77959
+ writeFileSync as writeFileSync13
78043
77960
  } from "node:fs";
78044
- import { dirname as dirname15 } from "node:path";
77961
+ import { dirname as dirname14 } from "node:path";
78045
77962
  import { pipeline } from "node:stream/promises";
78046
77963
  import { Readable as Readable2, Transform } from "node:stream";
78047
77964
  var HARNESS_PROGRESS_THROTTLE_MS = 200;
@@ -78072,7 +77989,7 @@ async function seedHashesFromFile(path) {
78072
77989
  const sha512 = createHash6("sha512");
78073
77990
  const size = statSync10(path).size;
78074
77991
  if (size === 0) return { sha256, sha512, size };
78075
- await new Promise((resolve14, reject) => {
77992
+ await new Promise((resolve15, reject) => {
78076
77993
  const stream = createReadStream2(path);
78077
77994
  stream.on("data", (chunk) => {
78078
77995
  const buf = typeof chunk === "string" ? Buffer.from(chunk) : chunk;
@@ -78080,7 +77997,7 @@ async function seedHashesFromFile(path) {
78080
77997
  sha512.update(buf);
78081
77998
  });
78082
77999
  stream.on("error", reject);
78083
- stream.on("end", () => resolve14());
78000
+ stream.on("end", () => resolve15());
78084
78001
  });
78085
78002
  return { sha256, sha512, size };
78086
78003
  }
@@ -78102,7 +78019,7 @@ async function streamResponseToFile(res, destPath, onProgress, opts = {}) {
78102
78019
  const keepPartial = opts.keepPartialOnError !== false;
78103
78020
  const contentLen = Number(res.headers.get("content-length") ?? 0);
78104
78021
  const total = opts.totalBytes && opts.totalBytes > 0 ? opts.totalBytes : append ? resumeFrom + contentLen : contentLen;
78105
- mkdirSync19(dirname15(destPath), { recursive: true });
78022
+ mkdirSync18(dirname14(destPath), { recursive: true });
78106
78023
  const emit = createThrottledProgress(onProgress, opts.progressThrottleMs);
78107
78024
  let sha256;
78108
78025
  let sha512;
@@ -78128,7 +78045,7 @@ async function streamResponseToFile(res, destPath, onProgress, opts = {}) {
78128
78045
  if (append) {
78129
78046
  appendFileSync(destPath, buf);
78130
78047
  } else {
78131
- writeFileSync14(destPath, buf);
78048
+ writeFileSync13(destPath, buf);
78132
78049
  }
78133
78050
  sha256.update(buf);
78134
78051
  sha512.update(buf);
@@ -78160,7 +78077,7 @@ async function streamResponseToFile(res, destPath, onProgress, opts = {}) {
78160
78077
  } catch (err) {
78161
78078
  if (!keepPartial) {
78162
78079
  try {
78163
- if (existsSync31(destPath)) rmSync5(destPath, { force: true });
78080
+ if (existsSync30(destPath)) rmSync5(destPath, { force: true });
78164
78081
  } catch {
78165
78082
  }
78166
78083
  }
@@ -78177,8 +78094,8 @@ var destPathLocks = /* @__PURE__ */ new Map();
78177
78094
  async function withDestPathLock(destPath, fn) {
78178
78095
  const prev = destPathLocks.get(destPath) ?? Promise.resolve();
78179
78096
  let release;
78180
- const gate = new Promise((resolve14) => {
78181
- release = resolve14;
78097
+ const gate = new Promise((resolve15) => {
78098
+ release = resolve15;
78182
78099
  });
78183
78100
  const held = prev.then(() => gate);
78184
78101
  destPathLocks.set(
@@ -78204,14 +78121,14 @@ async function downloadResumableToFile(httpFetch, url2, destPath, onProgress, lo
78204
78121
  );
78205
78122
  }
78206
78123
  async function downloadResumableToFileUnlocked(httpFetch, url2, destPath, onProgress, log2) {
78207
- mkdirSync19(dirname15(destPath), { recursive: true });
78208
- let existing = existsSync31(destPath) ? statSync10(destPath).size : 0;
78124
+ mkdirSync18(dirname14(destPath), { recursive: true });
78125
+ let existing = existsSync30(destPath) ? statSync10(destPath).size : 0;
78209
78126
  if (existing > 0 && existing < 64) {
78210
78127
  rmSync5(destPath, { force: true });
78211
78128
  existing = 0;
78212
78129
  }
78213
78130
  const tryOnce = async (from) => {
78214
- const diskNow = existsSync31(destPath) ? statSync10(destPath).size : 0;
78131
+ const diskNow = existsSync30(destPath) ? statSync10(destPath).size : 0;
78215
78132
  const start = from > 0 ? diskNow : 0;
78216
78133
  if (from > 0 && diskNow !== from) {
78217
78134
  log2?.warn?.(
@@ -78293,17 +78210,17 @@ function createResumableDownloadToFile(httpFetch, log2) {
78293
78210
 
78294
78211
  // ../../packages/runtime/src/harness/managed-tarball-installer.ts
78295
78212
  import {
78296
- existsSync as existsSync32,
78297
- mkdirSync as mkdirSync20,
78213
+ existsSync as existsSync31,
78214
+ mkdirSync as mkdirSync19,
78298
78215
  mkdtempSync as mkdtempSync2,
78299
- readFileSync as readFileSync18,
78216
+ readFileSync as readFileSync17,
78300
78217
  renameSync as renameSync4,
78301
78218
  rmSync as rmSync6,
78302
78219
  statSync as statSync11,
78303
- writeFileSync as writeFileSync15
78220
+ writeFileSync as writeFileSync14
78304
78221
  } from "node:fs";
78305
78222
  import { tmpdir as tmpdir2 } from "node:os";
78306
- import { dirname as dirname16, join as join28 } from "node:path";
78223
+ import { dirname as dirname15, join as join27 } from "node:path";
78307
78224
  import { spawn as spawn4 } from "node:child_process";
78308
78225
 
78309
78226
  // ../../packages/shared/src/update-channels.ts
@@ -78383,7 +78300,7 @@ function resolveHarnessManifestChannel(explicit, releaseVersion) {
78383
78300
  return "alpha";
78384
78301
  }
78385
78302
  function harnessDownloadDir(homeRoot) {
78386
- return join28(homeRoot, ".download");
78303
+ return join27(homeRoot, ".download");
78387
78304
  }
78388
78305
  function harnessArtifactDownloadKey(opts) {
78389
78306
  const digest = opts.digestSha256?.trim().toLowerCase();
@@ -78397,11 +78314,11 @@ function harnessPartialPath(homeRoot, key) {
78397
78314
  if (!key || key.includes("..") || key.includes("/") || key.includes("\\")) {
78398
78315
  throw new Error(`unsafe download key: ${key}`);
78399
78316
  }
78400
- return join28(harnessDownloadDir(homeRoot), `${key}.partial`);
78317
+ return join27(harnessDownloadDir(homeRoot), `${key}.partial`);
78401
78318
  }
78402
78319
  function extractTgzWithSystemTar(tgzPath, destDir) {
78403
- return new Promise((resolve14, reject) => {
78404
- mkdirSync20(destDir, { recursive: true });
78320
+ return new Promise((resolve15, reject) => {
78321
+ mkdirSync19(destDir, { recursive: true });
78405
78322
  const child = spawn4("tar", ["-xzf", tgzPath, "-C", destDir], {
78406
78323
  stdio: ["ignore", "ignore", "pipe"]
78407
78324
  });
@@ -78411,19 +78328,19 @@ function extractTgzWithSystemTar(tgzPath, destDir) {
78411
78328
  });
78412
78329
  child.on("error", (err) => reject(new Error(`tar spawn failed: ${err.message}`)));
78413
78330
  child.on("close", (code) => {
78414
- if (code === 0) resolve14();
78331
+ if (code === 0) resolve15();
78415
78332
  else reject(new Error(`tar extract failed (exit ${code}): ${stderr.slice(-500)}`));
78416
78333
  });
78417
78334
  });
78418
78335
  }
78419
78336
  function installPackageDir(packageDir, prefix, nodeModulesRel) {
78420
- const dest = join28(prefix, "lib", "node_modules", ...nodeModulesRel.split("/"));
78421
- const parent = dirname16(dest);
78422
- mkdirSync20(parent, { recursive: true });
78423
- if (existsSync32(dest)) {
78337
+ const dest = join27(prefix, "lib", "node_modules", ...nodeModulesRel.split("/"));
78338
+ const parent = dirname15(dest);
78339
+ mkdirSync19(parent, { recursive: true });
78340
+ if (existsSync31(dest)) {
78424
78341
  rmSync6(dest, { recursive: true, force: true });
78425
78342
  }
78426
- const staging = join28(
78343
+ const staging = join27(
78427
78344
  parent,
78428
78345
  `.staging-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`
78429
78346
  );
@@ -78431,7 +78348,7 @@ function installPackageDir(packageDir, prefix, nodeModulesRel) {
78431
78348
  renameSync4(packageDir, staging);
78432
78349
  renameSync4(staging, dest);
78433
78350
  } catch (err) {
78434
- if (existsSync32(staging)) rmSync6(staging, { recursive: true, force: true });
78351
+ if (existsSync31(staging)) rmSync6(staging, { recursive: true, force: true });
78435
78352
  throw err instanceof Error ? err : new Error(`failed to place package into ${dest}: ${String(err)}`);
78436
78353
  }
78437
78354
  return dest;
@@ -78453,8 +78370,8 @@ function resolveCodexNativeUnderPrefix(prefix) {
78453
78370
  if (!triple) return null;
78454
78371
  const binaryName = process.platform === "win32" ? "codex.exe" : "codex";
78455
78372
  const candidates = [
78456
- join28(prefix, "lib", "node_modules", "@openai", "codex", "vendor", triple, "bin", binaryName),
78457
- join28(
78373
+ join27(prefix, "lib", "node_modules", "@openai", "codex", "vendor", triple, "bin", binaryName),
78374
+ join27(
78458
78375
  prefix,
78459
78376
  "lib",
78460
78377
  "node_modules",
@@ -78467,7 +78384,7 @@ function resolveCodexNativeUnderPrefix(prefix) {
78467
78384
  )
78468
78385
  ];
78469
78386
  for (const c of candidates) {
78470
- if (existsSync32(c) && statSync11(c).isFile()) return c;
78387
+ if (existsSync31(c) && statSync11(c).isFile()) return c;
78471
78388
  }
78472
78389
  return null;
78473
78390
  }
@@ -78477,17 +78394,17 @@ function resolveManagedTarballBinary(id, installRoot) {
78477
78394
  }
78478
78395
  function readRuntimeVersionFromRoot(id, installRoot) {
78479
78396
  try {
78480
- const metaPath = join28(installRoot, "install-meta.json");
78481
- if (existsSync32(metaPath)) {
78482
- const raw = JSON.parse(readFileSync18(metaPath, "utf8"));
78397
+ const metaPath = join27(installRoot, "install-meta.json");
78398
+ if (existsSync31(metaPath)) {
78399
+ const raw = JSON.parse(readFileSync17(metaPath, "utf8"));
78483
78400
  if (raw.runtimeVersion) return raw.runtimeVersion;
78484
78401
  }
78485
78402
  } catch {
78486
78403
  }
78487
78404
  try {
78488
- const pkgPath = id === "claude" ? null : join28(installRoot, "lib", "node_modules", "@openai", "codex", "package.json");
78489
- if (pkgPath && existsSync32(pkgPath)) {
78490
- const raw = JSON.parse(readFileSync18(pkgPath, "utf8"));
78405
+ const pkgPath = id === "claude" ? null : join27(installRoot, "lib", "node_modules", "@openai", "codex", "package.json");
78406
+ if (pkgPath && existsSync31(pkgPath)) {
78407
+ const raw = JSON.parse(readFileSync17(pkgPath, "utf8"));
78491
78408
  const v2 = raw.version?.trim();
78492
78409
  if (!v2) return null;
78493
78410
  return v2.replace(/-(darwin|linux|win32)-(arm64|x64)$/, "");
@@ -78522,7 +78439,7 @@ function createManagedTarballInstaller(opts = {}) {
78522
78439
  return {
78523
78440
  async install(id, home, onProgress) {
78524
78441
  const prefix = managedHarnessPrefix(home.root, id);
78525
- mkdirSync20(prefix, { recursive: true });
78442
+ mkdirSync19(prefix, { recursive: true });
78526
78443
  const pins = managedPackagePins(id);
78527
78444
  const versionDir = managedVersionDir(prefix, pins.runtimeVersion);
78528
78445
  const previousPointer = readCurrentPointer(prefix)?.runtimeVersion ?? null;
@@ -78564,7 +78481,7 @@ function createManagedTarballInstaller(opts = {}) {
78564
78481
  const artifactPin = await resolveArtifactPin(id, channel, opts, fetchJson);
78565
78482
  let packageSpec = "";
78566
78483
  let source = "npm-tarball";
78567
- mkdirSync20(versionDir, { recursive: true });
78484
+ mkdirSync19(versionDir, { recursive: true });
78568
78485
  for (const pkg of pins.packages) {
78569
78486
  const npmName = artifactPin?.npmName ?? pkg.name;
78570
78487
  const npmVersion = artifactPin?.npmVersion ?? pkg.version;
@@ -78576,7 +78493,7 @@ function createManagedTarballInstaller(opts = {}) {
78576
78493
  npmVersion
78577
78494
  });
78578
78495
  const partialPath = harnessPartialPath(home.root, downloadKey);
78579
- const work = mkdtempSync2(join28(tmpdir2(), `superone-harness-${id}-`));
78496
+ const work = mkdtempSync2(join27(tmpdir2(), `superone-harness-${id}-`));
78580
78497
  try {
78581
78498
  const { from } = await fetchTarballWithFallback({
78582
78499
  destPath: partialPath,
@@ -78590,23 +78507,23 @@ function createManagedTarballInstaller(opts = {}) {
78590
78507
  log: log2
78591
78508
  });
78592
78509
  source = from;
78593
- const extractRoot = join28(work, "out");
78510
+ const extractRoot = join27(work, "out");
78594
78511
  await extractTgz(partialPath, extractRoot);
78595
- const packageDir = join28(extractRoot, "package");
78596
- if (!existsSync32(packageDir) || !statSync11(packageDir).isDirectory()) {
78512
+ const packageDir = join27(extractRoot, "package");
78513
+ if (!existsSync31(packageDir) || !statSync11(packageDir).isDirectory()) {
78597
78514
  throw new Error(`tarball for ${packageSpec} has no package/ directory`);
78598
78515
  }
78599
78516
  installPackageDir(packageDir, versionDir, npmName);
78600
78517
  try {
78601
- if (existsSync32(partialPath)) rmSync6(partialPath, { force: true });
78518
+ if (existsSync31(partialPath)) rmSync6(partialPath, { force: true });
78602
78519
  } catch {
78603
78520
  }
78604
78521
  } finally {
78605
78522
  rmSync6(work, { recursive: true, force: true });
78606
78523
  }
78607
78524
  }
78608
- writeFileSync15(
78609
- join28(versionDir, "install-meta.json"),
78525
+ writeFileSync14(
78526
+ join27(versionDir, "install-meta.json"),
78610
78527
  JSON.stringify(
78611
78528
  {
78612
78529
  harnessId: id,
@@ -78838,7 +78755,7 @@ function isAuthSatisfied(id, deps) {
78838
78755
 
78839
78756
  // ../../packages/runtime/src/harness/enable.ts
78840
78757
  init_environment();
78841
- import { accessSync, constants, existsSync as existsSync33, realpathSync as realpathSync3, statSync as statSync12 } from "node:fs";
78758
+ import { accessSync, constants, existsSync as existsSync32, realpathSync as realpathSync3, statSync as statSync12 } from "node:fs";
78842
78759
  import { isAbsolute as isAbsolute4, resolve as resolve8 } from "node:path";
78843
78760
  async function enableHarness(manager, input, deps) {
78844
78761
  const id = input.harnessId;
@@ -79057,7 +78974,7 @@ function requireRegularReadableFile(path) {
79057
78974
  throw new Error(`path must be absolute: ${path}`);
79058
78975
  }
79059
78976
  const abs = resolve8(path);
79060
- if (!existsSync33(abs) || !statSync12(abs).isFile()) {
78977
+ if (!existsSync32(abs) || !statSync12(abs).isFile()) {
79061
78978
  throw new Error(`not a regular file: ${abs}`);
79062
78979
  }
79063
78980
  accessSync(abs, constants.R_OK);
@@ -79066,7 +78983,7 @@ function requireRegularReadableFile(path) {
79066
78983
  function resolveExternalCommand(explicit, searchNames) {
79067
78984
  if (explicit) {
79068
78985
  const abs = isAbsolute4(explicit) ? explicit : resolve8(explicit);
79069
- if (!existsSync33(abs)) return null;
78986
+ if (!existsSync32(abs)) return null;
79070
78987
  try {
79071
78988
  if (!statSync12(abs).isFile()) return null;
79072
78989
  accessSync(abs, constants.X_OK);
@@ -79081,7 +78998,7 @@ function resolveExternalCommand(explicit, searchNames) {
79081
78998
  for (const dir of dirs) {
79082
78999
  if (!dir) continue;
79083
79000
  const candidate = resolve8(dir, name);
79084
- if (!existsSync33(candidate)) continue;
79001
+ if (!existsSync32(candidate)) continue;
79085
79002
  try {
79086
79003
  if (!statSync12(candidate).isFile()) continue;
79087
79004
  accessSync(candidate, constants.X_OK);
@@ -79136,7 +79053,7 @@ function looksLikeSecretArg(value) {
79136
79053
  }
79137
79054
 
79138
79055
  // src/session/harness-host.ts
79139
- import { existsSync as existsSync34 } from "node:fs";
79056
+ import { existsSync as existsSync33 } from "node:fs";
79140
79057
  init_src2();
79141
79058
  init_claude_turn_runner();
79142
79059
  init_codex_turn_runner();
@@ -79144,7 +79061,7 @@ init_resolve_service();
79144
79061
  setHarnessReleaseVersionProvider(resolveCliReleaseVersion);
79145
79062
  function envBinaryExists(envName) {
79146
79063
  const v2 = process.env[envName]?.trim();
79147
- return Boolean(v2 && existsSync34(v2));
79064
+ return Boolean(v2 && existsSync33(v2));
79148
79065
  }
79149
79066
  var cliHarnessResolver = {
79150
79067
  resolveBinary(id, harnesses) {
@@ -79154,7 +79071,7 @@ var cliHarnessResolver = {
79154
79071
  return null;
79155
79072
  }
79156
79073
  const command = harnesses.get(id).command;
79157
- return command && existsSync34(command) ? command : null;
79074
+ return command && existsSync33(command) ? command : null;
79158
79075
  },
79159
79076
  isRunnableWithoutCatalog(id) {
79160
79077
  if (id === "claude") return isClaudeRuntimeRunnable();
@@ -79167,7 +79084,7 @@ var cliHarnessResolver = {
79167
79084
  autoRuntime(id) {
79168
79085
  if (id === "claude") {
79169
79086
  const sdk = resolveSdkClaudeBinary();
79170
- if (sdk && existsSync34(sdk)) return { command: sdk, source: "agent-sdk-optional" };
79087
+ if (sdk && existsSync33(sdk)) return { command: sdk, source: "agent-sdk-optional" };
79171
79088
  return null;
79172
79089
  }
79173
79090
  const fromEnv = resolveCodexBinaryPath({});
@@ -79309,7 +79226,7 @@ async function startNodeServer2(opts) {
79309
79226
 
79310
79227
  // src/terminal/manager.ts
79311
79228
  import { createRequire as createRequire5 } from "node:module";
79312
- import { existsSync as existsSync35 } from "node:fs";
79229
+ import { existsSync as existsSync34 } from "node:fs";
79313
79230
  var nodeRequire = createRequire5(import.meta.url);
79314
79231
  var { spawn: spawn5 } = nodeRequire("node-pty");
79315
79232
  var SNAPSHOT_SOFT_LIMIT = 64 * 1024;
@@ -79324,7 +79241,7 @@ var NodeTerminalManager = class {
79324
79241
  }
79325
79242
  byId = /* @__PURE__ */ new Map();
79326
79243
  create(opts) {
79327
- if (!existsSync35(opts.cwd)) {
79244
+ if (!existsSync34(opts.cwd)) {
79328
79245
  throw Object.assign(new Error(`cwd does not exist: ${opts.cwd}`), { code: "invalid_argument" });
79329
79246
  }
79330
79247
  const terminalId = crypto.randomUUID();
@@ -79464,38 +79381,83 @@ var NodeTerminalManager = class {
79464
79381
  };
79465
79382
 
79466
79383
  // ../../packages/runtime/src/workspace/project-registry.ts
79467
- import { basename as basename2, resolve as resolve9 } from "node:path";
79468
- import { existsSync as existsSync36, realpathSync as realpathSync4, statSync as statSync13 } from "node:fs";
79384
+ import { basename as basename2, resolve as resolve10 } from "node:path";
79385
+ import { existsSync as existsSync35, realpathSync as realpathSync4, statSync as statSync13 } from "node:fs";
79469
79386
  import { createHash as createHash7 } from "node:crypto";
79470
79387
  import { execFileSync as execFileSync2 } from "node:child_process";
79388
+
79389
+ // ../../packages/shared/src/project-extra-dirs.ts
79390
+ var MAX_PROJECT_EXTRA_DIRS = 16;
79391
+ function parseProjectExtraDirs(raw) {
79392
+ if (typeof raw !== "string" || !raw.trim()) return [];
79393
+ try {
79394
+ const parsed = JSON.parse(raw);
79395
+ if (!Array.isArray(parsed)) return [];
79396
+ return dedupeDirs(parsed.filter((d) => typeof d === "string" && d.trim().length > 0));
79397
+ } catch {
79398
+ return [];
79399
+ }
79400
+ }
79401
+ function dedupeDirs(dirs) {
79402
+ return [...new Set(dirs)];
79403
+ }
79404
+ function resolveProjectExtraDirs(current, patch) {
79405
+ if (patch.extraDirs !== void 0) return [...patch.extraDirs];
79406
+ if (patch.addExtraDirs === void 0 && patch.removeExtraDirs === void 0) return null;
79407
+ const removed = new Set(patch.removeExtraDirs ?? []);
79408
+ return [...current.filter((d) => !removed.has(d)), ...patch.addExtraDirs ?? []];
79409
+ }
79410
+
79411
+ // ../../packages/shared/src/project-extra-dirs-node.ts
79412
+ import { resolve as resolve9 } from "node:path";
79413
+ function normalizeProjectExtraDirs(dirs, projectPath) {
79414
+ const root = resolve9(projectPath);
79415
+ const normalized = dirs.filter((d) => typeof d === "string" && d.trim().length > 0).map((d) => resolve9(d.trim())).filter((d) => d !== root);
79416
+ return dedupeDirs(normalized).slice(0, MAX_PROJECT_EXTRA_DIRS);
79417
+ }
79418
+
79419
+ // ../../packages/runtime/src/workspace/project-registry.ts
79471
79420
  var ProjectRegistry = class {
79472
79421
  constructor(db) {
79473
79422
  this.db = db;
79474
79423
  }
79475
79424
  list() {
79476
79425
  const rows = this.db.prepare(
79477
- `SELECT project_id, path, name, repo_identity, opened_at, last_active_at FROM projects ORDER BY last_active_at DESC`
79426
+ `SELECT project_id, path, name, repo_identity, opened_at, last_active_at, extra_dirs_json FROM projects ORDER BY last_active_at DESC`
79478
79427
  ).all();
79479
79428
  return rows.map((r) => this.toSnapshot(r));
79480
79429
  }
79481
79430
  get(projectId) {
79482
79431
  const r = this.db.prepare(
79483
- `SELECT project_id, path, name, repo_identity, opened_at, last_active_at FROM projects WHERE project_id = ?`
79432
+ `SELECT project_id, path, name, repo_identity, opened_at, last_active_at, extra_dirs_json FROM projects WHERE project_id = ?`
79484
79433
  ).get(projectId);
79485
79434
  if (!r) return null;
79486
79435
  return this.toSnapshot(r);
79487
79436
  }
79437
+ /**
79438
+ * `open()` stores the realpath, so a caller handing back the path the user
79439
+ * typed must be canonicalized the same way or it misses whenever a parent is
79440
+ * a symlink (`/var` on macOS). Belongs here rather than at each call site:
79441
+ * `update({ path })` and `remove({ path })` both take user-facing spellings.
79442
+ */
79488
79443
  getByPath(path) {
79489
- const abs = resolve9(path);
79444
+ const abs = resolve10(path);
79490
79445
  const r = this.db.prepare(
79491
- `SELECT project_id, path, name, repo_identity, opened_at, last_active_at FROM projects WHERE path = ?`
79446
+ `SELECT project_id, path, name, repo_identity, opened_at, last_active_at, extra_dirs_json FROM projects WHERE path = ?`
79492
79447
  ).get(abs);
79493
- if (!r) return null;
79494
- return this.toSnapshot(r);
79448
+ if (r) return this.toSnapshot(r);
79449
+ let real;
79450
+ try {
79451
+ real = realpathSync4(abs);
79452
+ } catch {
79453
+ return null;
79454
+ }
79455
+ if (real === abs) return null;
79456
+ return this.getByPath(real);
79495
79457
  }
79496
79458
  open(path, name) {
79497
- let abs = resolve9(path);
79498
- if (!existsSync36(abs) || !statSync13(abs).isDirectory()) {
79459
+ let abs = resolve10(path);
79460
+ if (!existsSync35(abs) || !statSync13(abs).isDirectory()) {
79499
79461
  throw Object.assign(new Error(`project path is not a directory: ${abs}`), {
79500
79462
  code: "invalid_argument"
79501
79463
  });
@@ -79518,6 +79480,36 @@ var ProjectRegistry = class {
79518
79480
  ).run(projectId, abs, name || basename2(abs), repoIdentity, now, now);
79519
79481
  return this.get(projectId);
79520
79482
  }
79483
+ /**
79484
+ * Apply an Edit Project submission or an `/add-dir` delta.
79485
+ *
79486
+ * Both fields are optional and independent so one patch covers whatever the
79487
+ * user actually touched. Unlike `open()`, a name given here is authoritative:
79488
+ * it is an explicit rename, not a basename refresh.
79489
+ */
79490
+ update(input) {
79491
+ const existing = input.projectId ? this.get(input.projectId) : input.path ? this.getByPath(input.path) : null;
79492
+ if (!existing) return null;
79493
+ let nextName = null;
79494
+ if (input.name !== void 0) {
79495
+ const trimmed = input.name.trim();
79496
+ if (!trimmed) {
79497
+ throw Object.assign(new Error("project name cannot be empty"), {
79498
+ code: "invalid_argument"
79499
+ });
79500
+ }
79501
+ nextName = trimmed.slice(0, 200);
79502
+ }
79503
+ const resolved = resolveProjectExtraDirs(existing.extraDirs ?? [], input);
79504
+ const nextExtraDirs = resolved === null ? null : JSON.stringify(normalizeProjectExtraDirs(resolved, existing.path));
79505
+ this.db.prepare(
79506
+ `UPDATE projects
79507
+ SET name = COALESCE(?, name),
79508
+ extra_dirs_json = COALESCE(?, extra_dirs_json)
79509
+ WHERE project_id = ?`
79510
+ ).run(nextName, nextExtraDirs, existing.projectId);
79511
+ return this.get(existing.projectId);
79512
+ }
79521
79513
  touch(projectId) {
79522
79514
  this.db.prepare(`UPDATE projects SET last_active_at = ? WHERE project_id = ?`).run(Date.now(), projectId);
79523
79515
  }
@@ -79548,6 +79540,7 @@ var ProjectRegistry = class {
79548
79540
  path: r.path,
79549
79541
  name: r.name,
79550
79542
  ...missing ? { missing: true } : {},
79543
+ extraDirs: parseProjectExtraDirs(r.extra_dirs_json),
79551
79544
  repoIdentity: r.repo_identity,
79552
79545
  openedAt: r.opened_at ?? void 0,
79553
79546
  lastActiveAt: r.last_active_at ?? void 0
@@ -79569,7 +79562,7 @@ function detectRepoIdentity(abs) {
79569
79562
  if (remote) return `git:${remote}`;
79570
79563
  } catch {
79571
79564
  }
79572
- return `gitdir:${resolve9(abs, out)}`;
79565
+ return `gitdir:${resolve10(abs, out)}`;
79573
79566
  } catch {
79574
79567
  return null;
79575
79568
  }
@@ -79579,20 +79572,20 @@ function detectRepoIdentity(abs) {
79579
79572
  init_fs();
79580
79573
  import {
79581
79574
  closeSync,
79582
- existsSync as existsSync37,
79575
+ existsSync as existsSync36,
79583
79576
  fstatSync,
79584
- mkdirSync as mkdirSync21,
79577
+ mkdirSync as mkdirSync20,
79585
79578
  openSync,
79586
79579
  readSync,
79587
79580
  readdirSync as readdirSync11,
79588
- readFileSync as readFileSync19,
79581
+ readFileSync as readFileSync18,
79589
79582
  renameSync as renameSync5,
79590
79583
  rmSync as rmSync7,
79591
79584
  statSync as statSync14,
79592
79585
  unlinkSync,
79593
- writeFileSync as writeFileSync16
79586
+ writeFileSync as writeFileSync15
79594
79587
  } from "node:fs";
79595
- import { dirname as dirname17, join as join29, relative as relative2 } from "node:path";
79588
+ import { dirname as dirname16, join as join28, relative as relative2 } from "node:path";
79596
79589
  import { createHash as createHash8 } from "node:crypto";
79597
79590
  function normalizeRel(path) {
79598
79591
  return path.replace(/\\/g, "/").replace(/\/+$/, "") || ".";
@@ -79638,7 +79631,7 @@ var WorkspaceFsService = class {
79638
79631
  if (!resolved.ok) {
79639
79632
  throw Object.assign(new Error(resolved.reason), { code: "invalid_argument" });
79640
79633
  }
79641
- if (!existsSync37(resolved.absolutePath)) {
79634
+ if (!existsSync36(resolved.absolutePath)) {
79642
79635
  throw Object.assign(new Error("path not found"), { code: "not_found" });
79643
79636
  }
79644
79637
  const st = statSync14(resolved.absolutePath);
@@ -79648,7 +79641,7 @@ var WorkspaceFsService = class {
79648
79641
  this.projects.touch(projectId);
79649
79642
  const ents = readdirSync11(resolved.absolutePath, { withFileTypes: true });
79650
79643
  return ents.map((ent) => {
79651
- const abs = join29(resolved.absolutePath, ent.name);
79644
+ const abs = join28(resolved.absolutePath, ent.name);
79652
79645
  let size;
79653
79646
  let mtimeMs;
79654
79647
  try {
@@ -79673,7 +79666,7 @@ var WorkspaceFsService = class {
79673
79666
  if (!resolved.ok) {
79674
79667
  throw Object.assign(new Error(resolved.reason), { code: "invalid_argument" });
79675
79668
  }
79676
- if (!existsSync37(resolved.absolutePath)) {
79669
+ if (!existsSync36(resolved.absolutePath)) {
79677
79670
  throw Object.assign(new Error("file not found"), { code: "not_found" });
79678
79671
  }
79679
79672
  const st = statSync14(resolved.absolutePath);
@@ -79712,7 +79705,7 @@ var WorkspaceFsService = class {
79712
79705
  if (!resolved.ok) {
79713
79706
  throw Object.assign(new Error(resolved.reason), { code: "invalid_argument" });
79714
79707
  }
79715
- if (existsSync37(resolved.absolutePath) && expectedHash) {
79708
+ if (existsSync36(resolved.absolutePath) && expectedHash) {
79716
79709
  const st = statSync14(resolved.absolutePath);
79717
79710
  if (st.size > MAX_READ_BYTES) {
79718
79711
  throw Object.assign(
@@ -79725,13 +79718,13 @@ var WorkspaceFsService = class {
79725
79718
  throw Object.assign(new Error("content hash mismatch"), { code: "conflict" });
79726
79719
  }
79727
79720
  }
79728
- mkdirSync21(dirname17(resolved.absolutePath), { recursive: true });
79721
+ mkdirSync20(dirname16(resolved.absolutePath), { recursive: true });
79729
79722
  const data = typeof content === "string" ? Buffer.from(content, "utf8") : Buffer.from(content);
79730
79723
  if (data.length > MAX_READ_BYTES) {
79731
79724
  throw Object.assign(new Error("write payload too large"), { code: "invalid_argument" });
79732
79725
  }
79733
79726
  let mode = 384;
79734
- if (existsSync37(resolved.absolutePath)) {
79727
+ if (existsSync36(resolved.absolutePath)) {
79735
79728
  try {
79736
79729
  mode = statSync14(resolved.absolutePath).mode & 511;
79737
79730
  } catch {
@@ -79740,7 +79733,7 @@ var WorkspaceFsService = class {
79740
79733
  const tmp = `${resolved.absolutePath}.tmp-${crypto.randomUUID()}`;
79741
79734
  let renamed = false;
79742
79735
  try {
79743
- writeFileSync16(tmp, data, { mode });
79736
+ writeFileSync15(tmp, data, { mode });
79744
79737
  const again = resolveProjectPath(root, relativePath);
79745
79738
  if (!again.ok || again.absolutePath !== resolved.absolutePath) {
79746
79739
  throw Object.assign(new Error("path changed during write"), { code: "failed_precondition" });
@@ -79801,7 +79794,7 @@ var WorkspaceFsService = class {
79801
79794
  for (const ent of ents) {
79802
79795
  if (hits.length >= MAX_SEARCH_HITS) return;
79803
79796
  if (ent.name === ".git" || ent.name === "node_modules") continue;
79804
- const abs = join29(dir, ent.name);
79797
+ const abs = join28(dir, ent.name);
79805
79798
  const rel = relative2(root, abs).split("\\").join("/");
79806
79799
  const check2 = resolveProjectPath(root, rel);
79807
79800
  if (!check2.ok) continue;
@@ -79813,7 +79806,7 @@ var WorkspaceFsService = class {
79813
79806
  try {
79814
79807
  const st = statSync14(abs);
79815
79808
  if (st.size > MAX_SEARCH_FILE_BYTES) continue;
79816
- const text = readFileSync19(abs, "utf8");
79809
+ const text = readFileSync18(abs, "utf8");
79817
79810
  const lines = text.split(/\r?\n/);
79818
79811
  for (let i = 0; i < lines.length; i++) {
79819
79812
  if (lines[i].includes(query)) {
@@ -79875,7 +79868,7 @@ var WorkspaceFsService = class {
79875
79868
  if (!resolved.ok) {
79876
79869
  throw Object.assign(new Error(resolved.reason), { code: "invalid_argument" });
79877
79870
  }
79878
- if (existsSync37(resolved.absolutePath)) {
79871
+ if (existsSync36(resolved.absolutePath)) {
79879
79872
  const st = statSync14(resolved.absolutePath);
79880
79873
  if (!st.isDirectory()) {
79881
79874
  throw Object.assign(new Error("path exists and is not a directory"), { code: "conflict" });
@@ -79883,7 +79876,7 @@ var WorkspaceFsService = class {
79883
79876
  this.projects.touch(projectId);
79884
79877
  return { path: rel };
79885
79878
  }
79886
- mkdirSync21(resolved.absolutePath, { recursive: true });
79879
+ mkdirSync20(resolved.absolutePath, { recursive: true });
79887
79880
  this.projects.touch(projectId);
79888
79881
  return { path: rel };
79889
79882
  }
@@ -79898,7 +79891,7 @@ var WorkspaceFsService = class {
79898
79891
  if (!resolved.ok) {
79899
79892
  throw Object.assign(new Error(resolved.reason), { code: "invalid_argument" });
79900
79893
  }
79901
- if (!existsSync37(resolved.absolutePath)) {
79894
+ if (!existsSync36(resolved.absolutePath)) {
79902
79895
  throw Object.assign(new Error("path not found"), { code: "not_found" });
79903
79896
  }
79904
79897
  if (resolved.absolutePath === root) {
@@ -79922,19 +79915,19 @@ var WorkspaceFsService = class {
79922
79915
  if (!from.ok) {
79923
79916
  throw Object.assign(new Error(from.reason), { code: "invalid_argument" });
79924
79917
  }
79925
- if (!existsSync37(from.absolutePath)) {
79918
+ if (!existsSync36(from.absolutePath)) {
79926
79919
  throw Object.assign(new Error("source not found"), { code: "not_found" });
79927
79920
  }
79928
79921
  const to = resolveProjectPath(root, toN);
79929
79922
  if (!to.ok) {
79930
79923
  throw Object.assign(new Error(to.reason), { code: "invalid_argument" });
79931
79924
  }
79932
- if (existsSync37(to.absolutePath)) {
79925
+ if (existsSync36(to.absolutePath)) {
79933
79926
  throw Object.assign(new Error(`target already exists: ${baseNameRel(toN)}`), {
79934
79927
  code: "conflict"
79935
79928
  });
79936
79929
  }
79937
- mkdirSync21(dirname17(to.absolutePath), { recursive: true });
79930
+ mkdirSync20(dirname16(to.absolutePath), { recursive: true });
79938
79931
  renameSync5(from.absolutePath, to.absolutePath);
79939
79932
  this.projects.touch(projectId);
79940
79933
  return { from: fromN, to: toN };
@@ -79959,8 +79952,8 @@ function hashFileBounded(absolutePath, size) {
79959
79952
  }
79960
79953
 
79961
79954
  // src/workspace/git-service.ts
79962
- import { existsSync as existsSync38, mkdirSync as mkdirSync22, realpathSync as realpathSync5, rmSync as rmSync8, writeFileSync as writeFileSync17 } from "node:fs";
79963
- import { join as join31, resolve as resolve11 } from "node:path";
79955
+ import { existsSync as existsSync37, mkdirSync as mkdirSync21, realpathSync as realpathSync5, rmSync as rmSync8, writeFileSync as writeFileSync16 } from "node:fs";
79956
+ import { join as join30, resolve as resolve12 } from "node:path";
79964
79957
  import { tmpdir as tmpdir3 } from "node:os";
79965
79958
  import { randomUUID as randomUUID8 } from "node:crypto";
79966
79959
 
@@ -80037,19 +80030,19 @@ function gitRunSync(folderPath, args, env) {
80037
80030
  }
80038
80031
 
80039
80032
  // ../../packages/runtime/src/git/worktree-plan.ts
80040
- import { basename as basename3, dirname as dirname18, join as join30, resolve as resolve10, sep as sep4 } from "node:path";
80033
+ import { basename as basename3, dirname as dirname17, join as join29, resolve as resolve11, sep as sep4 } from "node:path";
80041
80034
  import { homedir as homedir8 } from "node:os";
80042
80035
  function resolveMainDirFromCommonDir(folderPath, gitCommonDir) {
80043
- const repoRoot = resolve10(folderPath, gitCommonDir.trim());
80044
- return repoRoot.endsWith(`${sep4}.git`) || repoRoot.endsWith("/.git") ? dirname18(repoRoot) : repoRoot;
80036
+ const repoRoot = resolve11(folderPath, gitCommonDir.trim());
80037
+ return repoRoot.endsWith(`${sep4}.git`) || repoRoot.endsWith("/.git") ? dirname17(repoRoot) : repoRoot;
80045
80038
  }
80046
80039
  function planNewWorktreePaths(input) {
80047
80040
  const home = input.homeDir ?? homedir8();
80048
80041
  const repoName = basename3(input.mainDir);
80049
80042
  const epoch = Math.floor((input.nowMs ?? Date.now()) / 1e3).toString(36);
80050
80043
  const short = input.shortHash.slice(0, 7);
80051
- const wtDir = join30(home, ".worktrees", repoName);
80052
- const wtPath = join30(wtDir, `${epoch}-${short}`);
80044
+ const wtDir = join29(home, ".worktrees", repoName);
80045
+ const wtPath = join29(wtDir, `${epoch}-${short}`);
80053
80046
  return { wtDir, wtPath };
80054
80047
  }
80055
80048
  function worktreeAddArgs(mode, wtPath, baseRef, branchName) {
@@ -80108,11 +80101,11 @@ function resolveMainWorktreeDir(folderPath) {
80108
80101
  }
80109
80102
  function samePath(a, b2) {
80110
80103
  try {
80111
- const ra = existsSync38(a) ? realpathSync5(a) : resolve11(a);
80112
- const rb = existsSync38(b2) ? realpathSync5(b2) : resolve11(b2);
80104
+ const ra = existsSync37(a) ? realpathSync5(a) : resolve12(a);
80105
+ const rb = existsSync37(b2) ? realpathSync5(b2) : resolve12(b2);
80113
80106
  return ra === rb;
80114
80107
  } catch {
80115
- return resolve11(a) === resolve11(b2);
80108
+ return resolve12(a) === resolve12(b2);
80116
80109
  }
80117
80110
  }
80118
80111
  var WorkspaceGitService = class {
@@ -80141,7 +80134,7 @@ var WorkspaceGitService = class {
80141
80134
  * --ignored walks the whole tree of ignored paths and dominates remote latency.
80142
80135
  */
80143
80136
  statusForCwd(cwd) {
80144
- if (!existsSync38(join31(cwd, ".git")) && !isGitWorktree(cwd)) {
80137
+ if (!existsSync37(join30(cwd, ".git")) && !isGitWorktree(cwd)) {
80145
80138
  return { isRepo: false, branch: null, dirty: false, ahead: 0, behind: 0, porcelain: "" };
80146
80139
  }
80147
80140
  try {
@@ -80248,19 +80241,19 @@ var WorkspaceGitService = class {
80248
80241
  if (worktreePath.includes("\0") || worktreePath.includes("..")) {
80249
80242
  throw Object.assign(new Error("invalid worktree path"), { code: "invalid_argument" });
80250
80243
  }
80251
- const abs = resolve11(worktreePath);
80252
- const main2 = resolve11(this.root(projectId));
80253
- if (samePath(abs, main2)) return existsSync38(abs) ? realpathSync5(abs) : abs;
80244
+ const abs = resolve12(worktreePath);
80245
+ const main2 = resolve12(this.root(projectId));
80246
+ if (samePath(abs, main2)) return existsSync37(abs) ? realpathSync5(abs) : abs;
80254
80247
  const listed = this.worktrees(projectId);
80255
80248
  for (const wt of listed) {
80256
80249
  if (samePath(abs, wt.path)) {
80257
- return existsSync38(abs) ? realpathSync5(abs) : resolve11(wt.path);
80250
+ return existsSync37(abs) ? realpathSync5(abs) : resolve12(wt.path);
80258
80251
  }
80259
80252
  }
80260
80253
  try {
80261
- if (existsSync38(abs) && isGitWorktree(abs)) {
80262
- const commonA = resolve11(abs, git(abs, ["rev-parse", "--git-common-dir"]).trim());
80263
- const commonB = resolve11(main2, git(main2, ["rev-parse", "--git-common-dir"]).trim());
80254
+ if (existsSync37(abs) && isGitWorktree(abs)) {
80255
+ const commonA = resolve12(abs, git(abs, ["rev-parse", "--git-common-dir"]).trim());
80256
+ const commonB = resolve12(main2, git(main2, ["rev-parse", "--git-common-dir"]).trim());
80264
80257
  if (samePath(commonA, commonB)) {
80265
80258
  return realpathSync5(abs);
80266
80259
  }
@@ -80300,7 +80293,7 @@ var WorkspaceGitService = class {
80300
80293
  mainDir,
80301
80294
  shortHash: commitHash.slice(0, 7)
80302
80295
  });
80303
- if (!existsSync38(wtDir)) mkdirSync22(wtDir, { recursive: true });
80296
+ if (!existsSync37(wtDir)) mkdirSync21(wtDir, { recursive: true });
80304
80297
  try {
80305
80298
  const addArgs = worktreeAddArgs(mode, wtPath, baseBranch, safeBranchName);
80306
80299
  git(folderPath, ["worktree", ...addArgs]);
@@ -80396,8 +80389,8 @@ var WorkspaceGitService = class {
80396
80389
  const mainStatus = git(diff.mainDir, ["status", "--porcelain"]).trim();
80397
80390
  if (mainStatus) return { ok: false, reason: "main-dirty" };
80398
80391
  const patch = git(diff.worktreePath, ["diff", "--binary", diff.base, diff.tree]);
80399
- const patchFile = join31(tmpdir3(), `s1-handoff-${randomUUID8()}.patch`);
80400
- writeFileSync17(patchFile, `${patch}
80392
+ const patchFile = join30(tmpdir3(), `s1-handoff-${randomUUID8()}.patch`);
80393
+ writeFileSync16(patchFile, `${patch}
80401
80394
  `);
80402
80395
  if (git(diff.mainDir, ["status", "--porcelain"]).trim()) {
80403
80396
  rmSync8(patchFile, { force: true });
@@ -80458,7 +80451,7 @@ var WorkspaceGitService = class {
80458
80451
  };
80459
80452
  }
80460
80453
  writeWorkingTree(worktreePath) {
80461
- const tmpIndex = join31(tmpdir3(), `s1-handoff-${randomUUID8()}.index`);
80454
+ const tmpIndex = join30(tmpdir3(), `s1-handoff-${randomUUID8()}.index`);
80462
80455
  const env = { GIT_INDEX_FILE: tmpIndex };
80463
80456
  try {
80464
80457
  git(worktreePath, ["read-tree", "HEAD"], env);
@@ -80654,7 +80647,7 @@ init_codex_turn_runner();
80654
80647
  init_agent_types();
80655
80648
  init_environment();
80656
80649
  import { createHash as createHash9, randomBytes as randomBytes5, randomUUID as randomUUID10 } from "node:crypto";
80657
- import { existsSync as existsSync39, statSync as statSync15 } from "node:fs";
80650
+ import { existsSync as existsSync38, statSync as statSync15 } from "node:fs";
80658
80651
  import { resolve as pathResolve2 } from "node:path";
80659
80652
 
80660
80653
  // ../../packages/shared/src/harness/acp-brand.ts
@@ -81650,7 +81643,7 @@ var CollaborationService = class {
81650
81643
  const project = this.deps.projects.get(projectId);
81651
81644
  const fallback = parentCwd || project?.path || process.cwd();
81652
81645
  const cwd = pathResolve2(config2.cwd || fallback);
81653
- if (!existsSync39(cwd) || !statSync15(cwd).isDirectory()) {
81646
+ if (!existsSync38(cwd) || !statSync15(cwd).isDirectory()) {
81654
81647
  throw Object.assign(new Error(`Working directory does not exist: ${cwd}`), {
81655
81648
  code: "invalid_argument"
81656
81649
  });
@@ -81802,8 +81795,8 @@ var CollaborationService = class {
81802
81795
  };
81803
81796
 
81804
81797
  // src/provider/secret-crypto.ts
81805
- import { existsSync as existsSync40, mkdirSync as mkdirSync23, readFileSync as readFileSync20, writeFileSync as writeFileSync18, chmodSync as chmodSync2 } from "node:fs";
81806
- import { dirname as dirname19 } from "node:path";
81798
+ import { existsSync as existsSync39, mkdirSync as mkdirSync22, readFileSync as readFileSync19, writeFileSync as writeFileSync17, chmodSync as chmodSync2 } from "node:fs";
81799
+ import { dirname as dirname18 } from "node:path";
81807
81800
  import { createCipheriv, createDecipheriv, randomBytes as randomBytes6 } from "node:crypto";
81808
81801
  var ENC_PREFIX2 = "enc:v1:";
81809
81802
  var KEY_BYTES = 32;
@@ -81811,13 +81804,13 @@ function isEncryptedSecret(value) {
81811
81804
  return typeof value === "string" && value.startsWith(ENC_PREFIX2);
81812
81805
  }
81813
81806
  function ensureKeyFile(keyPath) {
81814
- if (existsSync40(keyPath)) {
81815
- const raw = readFileSync20(keyPath);
81807
+ if (existsSync39(keyPath)) {
81808
+ const raw = readFileSync19(keyPath);
81816
81809
  if (raw.length === KEY_BYTES) return raw;
81817
81810
  }
81818
- mkdirSync23(dirname19(keyPath), { recursive: true, mode: 448 });
81811
+ mkdirSync22(dirname18(keyPath), { recursive: true, mode: 448 });
81819
81812
  const key = randomBytes6(KEY_BYTES);
81820
- writeFileSync18(keyPath, key, { mode: 384 });
81813
+ writeFileSync17(keyPath, key, { mode: 384 });
81821
81814
  try {
81822
81815
  chmodSync2(keyPath, 384);
81823
81816
  } catch {
@@ -81899,9 +81892,9 @@ var WorkspaceWatchService = class {
81899
81892
  try {
81900
81893
  while (!closed) {
81901
81894
  if (queue.length === 0) {
81902
- await new Promise((resolve14) => {
81903
- wake = resolve14;
81904
- setTimeout(() => resolve14(), 100);
81895
+ await new Promise((resolve15) => {
81896
+ wake = resolve15;
81897
+ setTimeout(() => resolve15(), 100);
81905
81898
  });
81906
81899
  wake = null;
81907
81900
  continue;
@@ -81959,7 +81952,7 @@ var WorkspaceWatchService = class {
81959
81952
 
81960
81953
  // src/workspace/tail-watch-service.ts
81961
81954
  init_fs();
81962
- import { existsSync as existsSync41, fstatSync as fstatSync2, openSync as openSync2, closeSync as closeSync2, statSync as statSync16, readSync as readSync2, realpathSync as realpathSync6 } from "node:fs";
81955
+ import { existsSync as existsSync40, fstatSync as fstatSync2, openSync as openSync2, closeSync as closeSync2, statSync as statSync16, readSync as readSync2, realpathSync as realpathSync6 } from "node:fs";
81963
81956
  var MAX_POLL_BYTES = 10 * 1024 * 1024;
81964
81957
  var WorkspaceTailWatchService = class {
81965
81958
  constructor(projects, fs) {
@@ -81981,7 +81974,7 @@ var WorkspaceTailWatchService = class {
81981
81974
  );
81982
81975
  }
81983
81976
  try {
81984
- resolvedAbs = existsSync41(absolutePath) ? realpathSync6(absolutePath) : absolutePath;
81977
+ resolvedAbs = existsSync40(absolutePath) ? realpathSync6(absolutePath) : absolutePath;
81985
81978
  } catch {
81986
81979
  resolvedAbs = absolutePath;
81987
81980
  }
@@ -82012,7 +82005,7 @@ var WorkspaceTailWatchService = class {
82012
82005
  code: "invalid_argument"
82013
82006
  });
82014
82007
  }
82015
- if (existsSync41(resolvedAbs)) {
82008
+ if (existsSync40(resolvedAbs)) {
82016
82009
  try {
82017
82010
  const st = statSync16(resolvedAbs);
82018
82011
  if (!st.isFile()) {
@@ -82063,7 +82056,7 @@ var WorkspaceTailWatchService = class {
82063
82056
  { code: "invalid_argument" }
82064
82057
  );
82065
82058
  }
82066
- if (!existsSync41(absolutePath)) {
82059
+ if (!existsSync40(absolutePath)) {
82067
82060
  return {
82068
82061
  content: "",
82069
82062
  encoding: "base64",
@@ -82909,7 +82902,7 @@ var readBodyDirect = (request) => {
82909
82902
  request[bodyBufferKey] = buffered;
82910
82903
  return Promise.resolve(buffered);
82911
82904
  }
82912
- const promise2 = new Promise((resolve14, reject) => {
82905
+ const promise2 = new Promise((resolve15, reject) => {
82913
82906
  const chunks = [];
82914
82907
  let settled = false;
82915
82908
  const finish = (callback) => {
@@ -82927,7 +82920,7 @@ var readBodyDirect = (request) => {
82927
82920
  else if (recovered === void 0) reject(error51 ?? normalizeAbortError(request, incoming));
82928
82921
  else {
82929
82922
  request[bodyBufferKey] = recovered;
82930
- resolve14(recovered);
82923
+ resolve15(recovered);
82931
82924
  }
82932
82925
  });
82933
82926
  return true;
@@ -82939,7 +82932,7 @@ var readBodyDirect = (request) => {
82939
82932
  finish(() => {
82940
82933
  const buffer = chunks.length === 1 ? chunks[0] : Buffer.concat(chunks);
82941
82934
  request[bodyBufferKey] = buffer;
82942
- resolve14(buffer);
82935
+ resolve15(buffer);
82943
82936
  });
82944
82937
  };
82945
82938
  const onError = (error51) => {
@@ -83464,7 +83457,7 @@ var responseViaResponseObject = async (res, outgoing, options = {}) => {
83464
83457
  });
83465
83458
  if (!chunk) {
83466
83459
  if (i === 1) {
83467
- await new Promise((resolve14) => setTimeout(resolve14));
83460
+ await new Promise((resolve15) => setTimeout(resolve15));
83468
83461
  maxReadCount = 3;
83469
83462
  continue;
83470
83463
  }
@@ -85678,9 +85671,9 @@ data:
85678
85671
  const initRequest = messages.find((m2) => isInitializeRequest(m2));
85679
85672
  const clientProtocolVersion = initRequest ? initRequest.params.protocolVersion : req.headers.get("mcp-protocol-version") ?? DEFAULT_NEGOTIATED_PROTOCOL_VERSION;
85680
85673
  if (this._enableJsonResponse) {
85681
- return new Promise((resolve14) => {
85674
+ return new Promise((resolve15) => {
85682
85675
  this._streamMapping.set(streamId, {
85683
- resolveJson: resolve14,
85676
+ resolveJson: resolve15,
85684
85677
  cleanup: () => {
85685
85678
  this._streamMapping.delete(streamId);
85686
85679
  }
@@ -91997,7 +91990,7 @@ var Protocol = class {
91997
91990
  return;
91998
91991
  }
91999
91992
  const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
92000
- await new Promise((resolve14) => setTimeout(resolve14, pollInterval));
91993
+ await new Promise((resolve15) => setTimeout(resolve15, pollInterval));
92001
91994
  options?.signal?.throwIfAborted();
92002
91995
  }
92003
91996
  } catch (error51) {
@@ -92014,7 +92007,7 @@ var Protocol = class {
92014
92007
  */
92015
92008
  request(request, resultSchema, options) {
92016
92009
  const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
92017
- return new Promise((resolve14, reject) => {
92010
+ return new Promise((resolve15, reject) => {
92018
92011
  const earlyReject = (error51) => {
92019
92012
  reject(error51);
92020
92013
  };
@@ -92092,7 +92085,7 @@ var Protocol = class {
92092
92085
  if (!parseResult.success) {
92093
92086
  reject(parseResult.error);
92094
92087
  } else {
92095
- resolve14(parseResult.data);
92088
+ resolve15(parseResult.data);
92096
92089
  }
92097
92090
  } catch (error51) {
92098
92091
  reject(error51);
@@ -92353,12 +92346,12 @@ var Protocol = class {
92353
92346
  }
92354
92347
  } catch {
92355
92348
  }
92356
- return new Promise((resolve14, reject) => {
92349
+ return new Promise((resolve15, reject) => {
92357
92350
  if (signal.aborted) {
92358
92351
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
92359
92352
  return;
92360
92353
  }
92361
- const timeoutId = setTimeout(resolve14, interval);
92354
+ const timeoutId = setTimeout(resolve15, interval);
92362
92355
  signal.addEventListener("abort", () => {
92363
92356
  clearTimeout(timeoutId);
92364
92357
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
@@ -93453,7 +93446,7 @@ var McpServer = class {
93453
93446
  let task = createTaskResult.task;
93454
93447
  const pollInterval = task.pollInterval ?? 5e3;
93455
93448
  while (task.status !== "completed" && task.status !== "failed" && task.status !== "cancelled") {
93456
- await new Promise((resolve14) => setTimeout(resolve14, pollInterval));
93449
+ await new Promise((resolve15) => setTimeout(resolve15, pollInterval));
93457
93450
  const updatedTask = await extra.taskStore.getTask(taskId);
93458
93451
  if (!updatedTask) {
93459
93452
  throw new McpError(ErrorCode.InternalError, `Task ${taskId} not found during polling`);
@@ -94469,11 +94462,11 @@ async function startHostActionMcpServer(opts) {
94469
94462
  writeHttpError(res, 500, err instanceof Error ? err.message : "Internal MCP server error");
94470
94463
  }
94471
94464
  }
94472
- await new Promise((resolve14, reject) => {
94465
+ await new Promise((resolve15, reject) => {
94473
94466
  httpServer.once("error", reject);
94474
94467
  httpServer.listen(0, "127.0.0.1", () => {
94475
94468
  httpServer.off("error", reject);
94476
- resolve14();
94469
+ resolve15();
94477
94470
  });
94478
94471
  });
94479
94472
  const address = httpServer.address();
@@ -94526,8 +94519,8 @@ async function startHostActionMcpServer(opts) {
94526
94519
  }
94527
94520
  httpSessions.clear();
94528
94521
  httpSessionsBySuperone.clear();
94529
- await new Promise((resolve14) => {
94530
- httpServer.close(() => resolve14());
94522
+ await new Promise((resolve15) => {
94523
+ httpServer.close(() => resolve15());
94531
94524
  });
94532
94525
  }
94533
94526
  };
@@ -95858,7 +95851,7 @@ async function startNodeRuntime(partial2 = {}) {
95858
95851
  startedAt,
95859
95852
  simulatedHarness
95860
95853
  });
95861
- writeFileSync19(
95854
+ writeFileSync18(
95862
95855
  paths.runtimeJson,
95863
95856
  JSON.stringify(
95864
95857
  {
@@ -95933,9 +95926,9 @@ function createLocalPairingToken(nodeHome) {
95933
95926
  }
95934
95927
  function readRuntimeStatus(nodeHome) {
95935
95928
  const paths = nodePaths(resolveRuntimeConfig({ nodeHome }).nodeHome);
95936
- if (!existsSync42(paths.runtimeJson)) return null;
95929
+ if (!existsSync41(paths.runtimeJson)) return null;
95937
95930
  try {
95938
- return JSON.parse(readFileSync21(paths.runtimeJson, "utf8"));
95931
+ return JSON.parse(readFileSync20(paths.runtimeJson, "utf8"));
95939
95932
  } catch {
95940
95933
  return null;
95941
95934
  }
@@ -95943,8 +95936,8 @@ function readRuntimeStatus(nodeHome) {
95943
95936
 
95944
95937
  // src/systemd/install.ts
95945
95938
  import { spawnSync as spawnSync2 } from "node:child_process";
95946
- import { chmodSync as chmodSync3, existsSync as existsSync43, mkdirSync as mkdirSync24, unlinkSync as unlinkSync2, writeFileSync as writeFileSync20 } from "node:fs";
95947
- import { dirname as dirname20 } from "node:path";
95939
+ import { chmodSync as chmodSync3, existsSync as existsSync42, mkdirSync as mkdirSync23, unlinkSync as unlinkSync2, writeFileSync as writeFileSync19 } from "node:fs";
95940
+ import { dirname as dirname19 } from "node:path";
95948
95941
 
95949
95942
  // src/systemd/unit.ts
95950
95943
  function renderSystemdUserUnit(opts) {
@@ -96001,8 +95994,8 @@ function checkLinger(user) {
96001
95994
  return { enabled: null, raw };
96002
95995
  }
96003
95996
  function writeSystemdUserUnit(opts, unitPath = systemdUserUnitPath()) {
96004
- mkdirSync24(dirname20(unitPath), { recursive: true });
96005
- writeFileSync20(unitPath, renderSystemdUserUnit(opts), { encoding: "utf8", mode: 420 });
95997
+ mkdirSync23(dirname19(unitPath), { recursive: true });
95998
+ writeFileSync19(unitPath, renderSystemdUserUnit(opts), { encoding: "utf8", mode: 420 });
96006
95999
  try {
96007
96000
  chmodSync3(unitPath, 420);
96008
96001
  } catch {
@@ -96055,7 +96048,7 @@ function uninstallSystemdUserService(removeUnitFile = true) {
96055
96048
  }
96056
96049
  if (removeUnitFile) {
96057
96050
  const path = systemdUserUnitPath();
96058
- if (existsSync43(path)) {
96051
+ if (existsSync42(path)) {
96059
96052
  try {
96060
96053
  unlinkSync2(path);
96061
96054
  } catch (err) {
@@ -96078,8 +96071,8 @@ function systemdUserStatus() {
96078
96071
 
96079
96072
  // src/session/harness-cli.ts
96080
96073
  init_environment();
96081
- import { accessSync as accessSync2, constants as constants3, existsSync as existsSync44, realpathSync as realpathSync7, statSync as statSync17 } from "node:fs";
96082
- import { isAbsolute as isAbsolute5, resolve as resolve12 } from "node:path";
96074
+ import { accessSync as accessSync2, constants as constants3, existsSync as existsSync43, realpathSync as realpathSync7, statSync as statSync17 } from "node:fs";
96075
+ import { isAbsolute as isAbsolute5, resolve as resolve13 } from "node:path";
96083
96076
  import { homedir as homedir9 } from "node:os";
96084
96077
  var DEFERRED_FLAGS = /* @__PURE__ */ new Set([
96085
96078
  "--env-file",
@@ -96619,7 +96612,7 @@ function resolveExternalCommand2(explicit, pathCandidates) {
96619
96612
  ];
96620
96613
  for (const name of pathCandidates) {
96621
96614
  for (const dir of [...dirs, ...extra]) {
96622
- const candidate = resolve12(dir, name);
96615
+ const candidate = resolve13(dir, name);
96623
96616
  const ok = isUsableExecutable(candidate);
96624
96617
  if (ok) return ok;
96625
96618
  }
@@ -96627,7 +96620,7 @@ function resolveExternalCommand2(explicit, pathCandidates) {
96627
96620
  return null;
96628
96621
  }
96629
96622
  function isUsableExecutable(path) {
96630
- if (!existsSync44(path)) return null;
96623
+ if (!existsSync43(path)) return null;
96631
96624
  let st;
96632
96625
  try {
96633
96626
  st = statSync17(path);
@@ -96647,7 +96640,7 @@ function isUsableExecutable(path) {
96647
96640
  }
96648
96641
  }
96649
96642
  function probeExecutableIssues(path) {
96650
- if (!existsSync44(path)) return ["command_missing"];
96643
+ if (!existsSync43(path)) return ["command_missing"];
96651
96644
  let st;
96652
96645
  try {
96653
96646
  st = statSync17(path);
@@ -96663,7 +96656,7 @@ function probeExecutableIssues(path) {
96663
96656
  return [];
96664
96657
  }
96665
96658
  function probeReadableFileIssues(path) {
96666
- if (!existsSync44(path)) return ["artifact_missing"];
96659
+ if (!existsSync43(path)) return ["artifact_missing"];
96667
96660
  try {
96668
96661
  if (!statSync17(path).isFile()) return ["artifact_not_file"];
96669
96662
  } catch {
@@ -97003,7 +96996,7 @@ async function main() {
97003
96996
  }
97004
96997
  if (cmd === "install-systemd") {
97005
96998
  const nodeHome = resolveNodeHome(argValue(rest, "--home"));
97006
- const execStart = argValue(rest, "--exec") || resolve13(process.argv[1] || "superone");
96999
+ const execStart = argValue(rest, "--exec") || resolve14(process.argv[1] || "superone");
97007
97000
  const host = argValue(rest, "--host") || DEFAULT_BIND_HOST;
97008
97001
  const port = Number(argValue(rest, "--port") || DEFAULT_BIND_PORT);
97009
97002
  const result = installSystemdUserService({