@spencer-kit/coder-studio 0.3.3 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/bin.mjs CHANGED
@@ -885,11 +885,11 @@ function resolveSpawnArgv(argv, deps = {}) {
885
885
  return [];
886
886
  }
887
887
  const restArgs = argv.slice(1);
888
- const readFileSync8 = deps.readFileSync ?? ((file) => fs2.readFileSync(file, "utf8"));
889
- const existsSync11 = deps.existsSync ?? fs2.existsSync;
888
+ const readFileSync9 = deps.readFileSync ?? ((file) => fs2.readFileSync(file, "utf8"));
889
+ const existsSync12 = deps.existsSync ?? fs2.existsSync;
890
890
  const pathEnv = deps.pathEnv ?? process.env.Path ?? process.env.PATH ?? "";
891
891
  const pathExt = deps.pathExt ?? process.env.PATHEXT ?? DEFAULT_PATHEXT;
892
- const resolved = resolveExecutablePath(command, pathEnv, pathExt, existsSync11);
892
+ const resolved = resolveExecutablePath(command, pathEnv, pathExt, existsSync12);
893
893
  if (!resolved) {
894
894
  return [...argv];
895
895
  }
@@ -900,7 +900,7 @@ function resolveSpawnArgv(argv, deps = {}) {
900
900
  if (ext === ".cmd" || ext === ".bat") {
901
901
  let content;
902
902
  try {
903
- content = readFileSync8(resolved);
903
+ content = readFileSync9(resolved);
904
904
  } catch {
905
905
  return ["cmd.exe", "/d", "/s", "/c", resolved, ...restArgs];
906
906
  }
@@ -938,17 +938,17 @@ function expandShimVars(value, dp0Dir) {
938
938
  function parsePathExt(pathExt) {
939
939
  return pathExt.split(";").map((entry) => entry.trim().toLowerCase()).filter((entry) => entry.length > 0);
940
940
  }
941
- function resolveExecutablePath(command, pathEnv, pathExt, existsSync11) {
941
+ function resolveExecutablePath(command, pathEnv, pathExt, existsSync12) {
942
942
  const hasExt = path2.win32.extname(command).length > 0;
943
943
  const extensions = parsePathExt(pathExt);
944
944
  if (path2.win32.isAbsolute(command)) {
945
- if (existsSync11(command)) {
945
+ if (existsSync12(command)) {
946
946
  return command;
947
947
  }
948
948
  if (!hasExt) {
949
949
  for (const ext of extensions) {
950
950
  const candidate = command + ext;
951
- if (existsSync11(candidate)) {
951
+ if (existsSync12(candidate)) {
952
952
  return candidate;
953
953
  }
954
954
  }
@@ -959,14 +959,14 @@ function resolveExecutablePath(command, pathEnv, pathExt, existsSync11) {
959
959
  for (const dir of dirs) {
960
960
  if (hasExt) {
961
961
  const candidate = path2.win32.join(dir, command);
962
- if (existsSync11(candidate)) {
962
+ if (existsSync12(candidate)) {
963
963
  return candidate;
964
964
  }
965
965
  continue;
966
966
  }
967
967
  for (const ext of extensions) {
968
968
  const candidate = path2.win32.join(dir, command + ext);
969
- if (existsSync11(candidate)) {
969
+ if (existsSync12(candidate)) {
970
970
  return candidate;
971
971
  }
972
972
  }
@@ -2129,6 +2129,157 @@ var init_command_check = __esm({
2129
2129
  }
2130
2130
  });
2131
2131
 
2132
+ // packages/server/src/provider-runtime/e2e-provider-mock.ts
2133
+ import { chmodSync, existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "node:fs";
2134
+ import { dirname as dirname3, join as join2 } from "node:path";
2135
+ function createE2EProviderMockOverrides(env = process.env) {
2136
+ const statePath = env.CODER_STUDIO_E2E_PROVIDER_STATE_PATH;
2137
+ if (!statePath) {
2138
+ return null;
2139
+ }
2140
+ const binDir = env.CODER_STUDIO_E2E_PROVIDER_BIN_DIR;
2141
+ const debugLogPath = env.CODER_STUDIO_E2E_PROVIDER_DEBUG_LOG_PATH;
2142
+ appendDebugLog(debugLogPath, `init statePath=${statePath} binDir=${binDir ?? ""}`);
2143
+ const commandExists = async (command) => {
2144
+ const state = readMockState(statePath);
2145
+ const override = state.commands?.[command];
2146
+ appendDebugLog(
2147
+ debugLogPath,
2148
+ `commandExists ${command} override=${String(override)} state=${JSON.stringify(state.commands ?? {})}`
2149
+ );
2150
+ if (typeof override === "boolean") {
2151
+ return override;
2152
+ }
2153
+ return checkCommandAvailable(command);
2154
+ };
2155
+ const runCommand2 = async (file, args, options) => {
2156
+ const providerId = getInstallProviderId(file, args);
2157
+ appendDebugLog(
2158
+ debugLogPath,
2159
+ `runCommand ${file} ${args.join(" ")} provider=${providerId ?? "none"}`
2160
+ );
2161
+ if (!providerId) {
2162
+ return runCommandAsString(file, args, options);
2163
+ }
2164
+ const state = readMockState(statePath);
2165
+ const behavior = state.installBehavior?.[providerId];
2166
+ appendDebugLog(
2167
+ debugLogPath,
2168
+ `behavior ${providerId} ${JSON.stringify(behavior)} state=${JSON.stringify(state)}`
2169
+ );
2170
+ if (!behavior) {
2171
+ return runCommandAsString(file, args, options);
2172
+ }
2173
+ if (behavior.result === "success") {
2174
+ writeMockState(statePath, (draft) => {
2175
+ draft.commands ??= {};
2176
+ draft.commands[providerId] = true;
2177
+ });
2178
+ if (binDir) {
2179
+ ensureProviderCommand(binDir, providerId);
2180
+ }
2181
+ appendDebugLog(debugLogPath, `install success ${providerId}`);
2182
+ return {
2183
+ stdout: `installed ${providerId}`,
2184
+ stderr: ""
2185
+ };
2186
+ }
2187
+ const message = behavior.message ?? (behavior.result === "permission_denied" ? "permission denied" : "command not found");
2188
+ throw Object.assign(new Error(message), {
2189
+ exitCode: 1,
2190
+ stdout: "",
2191
+ stderr: message
2192
+ });
2193
+ };
2194
+ return {
2195
+ commandExists,
2196
+ runCommand: runCommand2
2197
+ };
2198
+ }
2199
+ function getInstallProviderId(file, args) {
2200
+ if (file !== "npm" || args.length !== 3) {
2201
+ return null;
2202
+ }
2203
+ if (args[0] !== "install" || args[1] !== "-g") {
2204
+ return null;
2205
+ }
2206
+ const packageName = args[2];
2207
+ if (packageName === PROVIDER_INSTALL_PACKAGES.claude) {
2208
+ return "claude";
2209
+ }
2210
+ if (packageName === PROVIDER_INSTALL_PACKAGES.codex) {
2211
+ return "codex";
2212
+ }
2213
+ return null;
2214
+ }
2215
+ function readMockState(statePath) {
2216
+ if (!existsSync3(statePath)) {
2217
+ return {};
2218
+ }
2219
+ const raw = readFileSync3(statePath, "utf8");
2220
+ if (!raw.trim()) {
2221
+ return {};
2222
+ }
2223
+ try {
2224
+ return JSON.parse(raw);
2225
+ } catch (error) {
2226
+ throw new Error(
2227
+ `Invalid provider mock state at ${statePath}: ${error instanceof Error ? error.message : String(error)}`
2228
+ );
2229
+ }
2230
+ }
2231
+ function writeMockState(statePath, updater) {
2232
+ const nextState = readMockState(statePath);
2233
+ updater(nextState);
2234
+ mkdirSync2(dirname3(statePath), { recursive: true });
2235
+ writeFileSync2(statePath, JSON.stringify(nextState, null, 2));
2236
+ return nextState;
2237
+ }
2238
+ function ensureProviderCommand(binDir, providerId) {
2239
+ mkdirSync2(binDir, { recursive: true });
2240
+ const scriptPath = join2(binDir, providerId);
2241
+ writeFileSync2(scriptPath, PROVIDER_COMMAND_SCRIPTS[providerId], "utf8");
2242
+ chmodSync(scriptPath, 493);
2243
+ }
2244
+ function appendDebugLog(path10, line) {
2245
+ if (!path10) {
2246
+ return;
2247
+ }
2248
+ mkdirSync2(dirname3(path10), { recursive: true });
2249
+ writeFileSync2(path10, `${line}
2250
+ `, { flag: "a" });
2251
+ }
2252
+ var PROVIDER_INSTALL_PACKAGES, PROVIDER_COMMAND_SCRIPTS;
2253
+ var init_e2e_provider_mock = __esm({
2254
+ "packages/server/src/provider-runtime/e2e-provider-mock.ts"() {
2255
+ "use strict";
2256
+ init_command_check();
2257
+ init_command_runner();
2258
+ PROVIDER_INSTALL_PACKAGES = {
2259
+ claude: "@anthropic-ai/claude-code",
2260
+ codex: "@openai/codex"
2261
+ };
2262
+ PROVIDER_COMMAND_SCRIPTS = {
2263
+ claude: `#!/usr/bin/env bash
2264
+ set -euo pipefail
2265
+ trap 'exit 0' TERM INT
2266
+ printf 'Mock Claude ready\\n'
2267
+ while true; do
2268
+ sleep 1
2269
+ done
2270
+ `,
2271
+ codex: `#!/usr/bin/env bash
2272
+ set -euo pipefail
2273
+ trap 'exit 0' TERM INT
2274
+ printf 'Session ID: abcdef-123456\\n> '
2275
+ while true; do
2276
+ sleep 1
2277
+ done
2278
+ `
2279
+ };
2280
+ }
2281
+ });
2282
+
2132
2283
  // packages/server/src/provider-runtime/install-manager.ts
2133
2284
  import { randomUUID as randomUUID2 } from "node:crypto";
2134
2285
  function getErrorDetails(error) {
@@ -3611,8 +3762,8 @@ var init_database = __esm({
3611
3762
 
3612
3763
  // packages/server/src/storage/db.ts
3613
3764
  import { DatabaseSync } from "node:sqlite";
3614
- import { readFileSync as readFileSync3 } from "fs";
3615
- import { join as join2 } from "path";
3765
+ import { readFileSync as readFileSync4 } from "fs";
3766
+ import { join as join3 } from "path";
3616
3767
  function normalizeSql(sql) {
3617
3768
  return (sql ?? "").replace(/\s+/g, " ").trim();
3618
3769
  }
@@ -3759,8 +3910,8 @@ var init_db = __esm({
3759
3910
  "packages/server/src/storage/db.ts"() {
3760
3911
  "use strict";
3761
3912
  init_database();
3762
- SCHEMA_PATH = join2(import.meta.dirname, "migrations", "001_init.sql");
3763
- SCHEMA_SQL = readFileSync3(SCHEMA_PATH, "utf-8");
3913
+ SCHEMA_PATH = join3(import.meta.dirname, "migrations", "001_init.sql");
3914
+ SCHEMA_SQL = readFileSync4(SCHEMA_PATH, "utf-8");
3764
3915
  LEGACY_TABLES = ["hook_registrations", "_migrations"];
3765
3916
  LEGACY_SESSION_COLUMNS = ["resume_id", "transcript_path"];
3766
3917
  EXPECTED_SCHEMA_ENTRIES = buildExpectedSchemaEntries();
@@ -4692,6 +4843,7 @@ function parseFetchUpdatedRefs(stderr) {
4692
4843
  }
4693
4844
  async function runGitCheckout(cwd, ref, options) {
4694
4845
  const args = ["checkout"];
4846
+ const formatCheckoutError = (error, fallbackMessage) => error instanceof GitError ? error.stderr.trim() || error.message || fallbackMessage : fallbackMessage;
4695
4847
  let isRemoteRef = false;
4696
4848
  try {
4697
4849
  const { stdout: remoteList } = await runGit(cwd, ["remote"]);
@@ -4703,15 +4855,22 @@ async function runGitCheckout(cwd, ref, options) {
4703
4855
  if (isRemoteRef && !options?.createBranch) {
4704
4856
  const remoteSeparatorIndex = ref.indexOf("/");
4705
4857
  const branchName = remoteSeparatorIndex >= 0 ? ref.slice(remoteSeparatorIndex + 1) : ref;
4706
- args.push("-b", branchName, ref);
4858
+ try {
4859
+ await runGit(cwd, ["show-ref", "--verify", "--quiet", `refs/heads/${branchName}`]);
4860
+ const { stdout, stderr } = await runGit(cwd, ["checkout", branchName]);
4861
+ const message = stdout || stderr || `Checkout to ${branchName} completed`;
4862
+ return { success: true, message, branch: branchName };
4863
+ } catch {
4864
+ args.push("-b", branchName, ref);
4865
+ }
4707
4866
  try {
4708
4867
  const { stdout, stderr } = await runGit(cwd, args);
4709
4868
  const message = stdout || stderr || `Checkout to ${ref} completed`;
4710
4869
  return { success: true, message, branch: branchName };
4711
- } catch {
4870
+ } catch (error) {
4712
4871
  return {
4713
4872
  success: false,
4714
- message: `Failed to checkout remote branch '${ref}'`
4873
+ message: formatCheckoutError(error, `Failed to checkout remote branch '${ref}'`)
4715
4874
  };
4716
4875
  }
4717
4876
  } else {
@@ -4725,10 +4884,10 @@ async function runGitCheckout(cwd, ref, options) {
4725
4884
  const branch = branchMatch?.[1] ?? ref;
4726
4885
  const message = stdout || stderr || `Checkout to ${ref} completed`;
4727
4886
  return { success: true, message, branch };
4728
- } catch {
4887
+ } catch (error) {
4729
4888
  return {
4730
4889
  success: false,
4731
- message: `Failed to checkout '${ref}'`
4890
+ message: formatCheckoutError(error, `Failed to checkout '${ref}'`)
4732
4891
  };
4733
4892
  }
4734
4893
  }
@@ -4743,23 +4902,42 @@ async function runGitCreateBranch(cwd, branchName, options) {
4743
4902
  }
4744
4903
  async function runGitListBranches(cwd) {
4745
4904
  const { stdout: localOutput } = await runGit(cwd, ["branch", "--list"]);
4905
+ const { stdout: localVerboseOutput } = await runGit(cwd, ["branch", "--list", "-vv"]);
4746
4906
  const { stdout: remoteOutput } = await runGit(cwd, ["branch", "-r"]);
4747
4907
  const branches = [];
4748
4908
  let current = "";
4909
+ const linkedWorktreePathsByBranch = /* @__PURE__ */ new Map();
4910
+ const localVerboseLines = localVerboseOutput.split("\n").filter((line) => line.trim());
4911
+ for (const line of localVerboseLines) {
4912
+ const normalizedLine = line.replace(/^[*+ ]\s+/, "");
4913
+ const branchMatch = normalizedLine.match(/^([^\s]+)\s+/);
4914
+ const worktreeMatch = line.match(/\((.+?)\)\s/);
4915
+ if (!branchMatch?.[1] || !worktreeMatch?.[1]) {
4916
+ continue;
4917
+ }
4918
+ const worktreePath = worktreeMatch[1];
4919
+ if (worktreePath.startsWith("/") || worktreePath.startsWith("~")) {
4920
+ linkedWorktreePathsByBranch.set(branchMatch[1], worktreePath);
4921
+ }
4922
+ }
4749
4923
  const localLines = localOutput.split("\n").filter((line) => line.trim());
4750
4924
  for (const line of localLines) {
4751
4925
  const isCurrent = line.startsWith("*");
4752
- const name = line.replace(/^\*?\s+/, "").trim();
4926
+ const name = line.replace(/^[*+ ]\s+/, "").trim();
4753
4927
  if (name.startsWith("(HEAD detached")) {
4754
4928
  if (isCurrent) {
4755
4929
  current = "";
4756
4930
  }
4757
4931
  continue;
4758
4932
  }
4933
+ if (linkedWorktreePathsByBranch.has(name) && !isCurrent) {
4934
+ continue;
4935
+ }
4759
4936
  branches.push({
4760
4937
  name,
4761
4938
  isRemote: false,
4762
- isCurrent
4939
+ isCurrent,
4940
+ linkedWorktreePath: linkedWorktreePathsByBranch.get(name)
4763
4941
  });
4764
4942
  if (isCurrent) {
4765
4943
  current = name;
@@ -5208,7 +5386,7 @@ var init_context_builder = __esm({
5208
5386
  });
5209
5387
 
5210
5388
  // packages/server/src/terminal/pty-host.ts
5211
- import { chmodSync, existsSync as existsSync3, statSync } from "node:fs";
5389
+ import { chmodSync as chmodSync2, existsSync as existsSync4, statSync } from "node:fs";
5212
5390
  import { createRequire } from "node:module";
5213
5391
  import path6 from "node:path";
5214
5392
  function ensureNodePtySpawnHelperExecutable(deps = {}) {
@@ -5218,9 +5396,9 @@ function ensureNodePtySpawnHelperExecutable(deps = {}) {
5218
5396
  }
5219
5397
  const arch = deps.arch ?? process.arch;
5220
5398
  const resolve4 = deps.resolve ?? ((id) => require2.resolve(id));
5221
- const fileExists = deps.existsSync ?? existsSync3;
5399
+ const fileExists = deps.existsSync ?? existsSync4;
5222
5400
  const stat7 = deps.statSync ?? statSync;
5223
- const chmod = deps.chmodSync ?? chmodSync;
5401
+ const chmod = deps.chmodSync ?? chmodSync2;
5224
5402
  let packageJsonPath;
5225
5403
  try {
5226
5404
  packageJsonPath = resolve4(NODE_PTY_PKG);
@@ -7290,9 +7468,9 @@ var init_validator = __esm({
7290
7468
  });
7291
7469
 
7292
7470
  // packages/server/src/fs/gitignore.ts
7293
- import { existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
7471
+ import { existsSync as existsSync5, readFileSync as readFileSync5 } from "fs";
7294
7472
  import ignore from "ignore";
7295
- import { join as join3, relative as relative3 } from "path";
7473
+ import { join as join4, relative as relative3 } from "path";
7296
7474
  function normalizePath(path10) {
7297
7475
  return path10.replace(/\\/g, "/");
7298
7476
  }
@@ -7312,26 +7490,26 @@ function isIgnoredByGitignore(ig, path10) {
7312
7490
  return ig.ignores(path10) || ig.ignores(`${path10}/`);
7313
7491
  }
7314
7492
  function createGitignoreFilter(rootPath, dirPath) {
7315
- const gitignorePath = join3(rootPath, ".gitignore");
7316
- if (!existsSync4(gitignorePath)) {
7493
+ const gitignorePath = join4(rootPath, ".gitignore");
7494
+ if (!existsSync5(gitignorePath)) {
7317
7495
  return (name) => !isDefaultTreeIgnored(name);
7318
7496
  }
7319
- const gitignoreContent = readFileSync4(gitignorePath, "utf-8");
7497
+ const gitignoreContent = readFileSync5(gitignorePath, "utf-8");
7320
7498
  const ig = ignore().add(gitignoreContent);
7321
7499
  return (name) => {
7322
7500
  if (isAlwaysTreeIgnored(name)) {
7323
7501
  return false;
7324
7502
  }
7325
- const relativePath = relativeToRoot(rootPath, join3(dirPath, name));
7503
+ const relativePath = relativeToRoot(rootPath, join4(dirPath, name));
7326
7504
  return !isIgnoredByGitignore(ig, relativePath);
7327
7505
  };
7328
7506
  }
7329
7507
  function createWatcherIgnoreFilter(rootPath) {
7330
- const gitignorePath = join3(rootPath, ".gitignore");
7331
- if (!existsSync4(gitignorePath)) {
7508
+ const gitignorePath = join4(rootPath, ".gitignore");
7509
+ if (!existsSync5(gitignorePath)) {
7332
7510
  return (path10) => DEFAULT_WATCHER_IGNORED_PATTERNS.some((p) => p.test(normalizePath(path10)));
7333
7511
  }
7334
- const gitignoreContent = readFileSync4(gitignorePath, "utf-8");
7512
+ const gitignoreContent = readFileSync5(gitignorePath, "utf-8");
7335
7513
  const ig = ignore().add(gitignoreContent);
7336
7514
  return (path10) => {
7337
7515
  const normalizedPath = normalizePath(path10);
@@ -7458,6 +7636,11 @@ var init_manager4 = __esm({
7458
7636
  new WorkspaceWatcher(workspaceId, rootPath, this.deps.broadcaster)
7459
7637
  );
7460
7638
  }
7639
+ hydrateWatchers() {
7640
+ for (const workspace of this.list()) {
7641
+ this.startWatcher(workspace.id, workspace.path);
7642
+ }
7643
+ }
7461
7644
  updateUiState(workspaceId, uiState) {
7462
7645
  const workspace = this.get(workspaceId);
7463
7646
  if (!workspace) {
@@ -8262,8 +8445,12 @@ var init_client = __esm({
8262
8445
  evictedBytesSinceLastWarn = 0;
8263
8446
  lastStreamBufferWarnAt = 0;
8264
8447
  logger;
8448
+ markAlive() {
8449
+ this.isAlive = true;
8450
+ }
8265
8451
  setupSocketHandlers() {
8266
8452
  this.socket.on("message", (data, isBinary) => {
8453
+ this.markAlive();
8267
8454
  if (isBinary) {
8268
8455
  this.messageHandler?.(data);
8269
8456
  return;
@@ -8282,7 +8469,7 @@ var init_client = __esm({
8282
8469
  this.closeHandler?.();
8283
8470
  });
8284
8471
  this.socket.on("pong", () => {
8285
- this.isAlive = true;
8472
+ this.markAlive();
8286
8473
  });
8287
8474
  }
8288
8475
  /**
@@ -8792,6 +8979,10 @@ var init_hub = __esm({
8792
8979
  */
8793
8980
  pingAll() {
8794
8981
  for (const client of this.clients.values()) {
8982
+ if (!client.alive) {
8983
+ client.close(1011, "keepalive_timeout");
8984
+ continue;
8985
+ }
8795
8986
  client.ping();
8796
8987
  }
8797
8988
  }
@@ -8933,7 +9124,7 @@ var init_hub = __esm({
8933
9124
  // packages/server/src/commands/workspace.ts
8934
9125
  import { readdir as readdir2 } from "node:fs/promises";
8935
9126
  import { homedir as homedir2 } from "node:os";
8936
- import { join as join4 } from "node:path";
9127
+ import { join as join5 } from "node:path";
8937
9128
  import { z as z6 } from "zod";
8938
9129
  var init_workspace = __esm({
8939
9130
  "packages/server/src/commands/workspace.ts"() {
@@ -8952,11 +9143,11 @@ var init_workspace = __esm({
8952
9143
  const entries = await readdir2(basePath, { withFileTypes: true });
8953
9144
  const directories = entries.filter((entry) => entry.isDirectory()).map((entry) => ({
8954
9145
  name: entry.name,
8955
- path: join4(basePath, entry.name)
9146
+ path: join5(basePath, entry.name)
8956
9147
  })).sort((a, b) => a.name.localeCompare(b.name));
8957
9148
  return {
8958
9149
  currentPath: basePath,
8959
- parentPath: basePath !== "/" ? join4(basePath, "..") : null,
9150
+ parentPath: basePath !== "/" ? join5(basePath, "..") : null,
8960
9151
  directories
8961
9152
  };
8962
9153
  }
@@ -9050,6 +9241,18 @@ var init_workspace_activity = __esm({
9050
9241
  }
9051
9242
  });
9052
9243
 
9244
+ // packages/server/src/commands/connection.ts
9245
+ import { z as z8 } from "zod";
9246
+ var init_connection = __esm({
9247
+ "packages/server/src/commands/connection.ts"() {
9248
+ "use strict";
9249
+ init_dispatch();
9250
+ registerCommand("connection.probe", z8.object({}).default({}), async () => {
9251
+ return { ok: true };
9252
+ });
9253
+ }
9254
+ });
9255
+
9053
9256
  // packages/server/src/provider-runtime/runtime-status.ts
9054
9257
  function canAutoInstall(provider, platform, missingCommands, missingPrerequisites, availableCommands) {
9055
9258
  const strategies = provider.install.strategies[platform] ?? [];
@@ -9144,7 +9347,7 @@ var init_runtime_status = __esm({
9144
9347
  });
9145
9348
 
9146
9349
  // packages/server/src/commands/session.ts
9147
- import { z as z8 } from "zod";
9350
+ import { z as z9 } from "zod";
9148
9351
  function getProviderFromRegistry(providerId, registry) {
9149
9352
  return registry.find((provider) => provider.id === providerId);
9150
9353
  }
@@ -9155,8 +9358,8 @@ var init_session = __esm({
9155
9358
  init_dispatch();
9156
9359
  registerCommand(
9157
9360
  "session.list",
9158
- z8.object({
9159
- workspaceId: z8.string()
9361
+ z9.object({
9362
+ workspaceId: z9.string()
9160
9363
  }),
9161
9364
  async (args, ctx) => {
9162
9365
  return ctx.sessionMgr.getForWorkspace(args.workspaceId);
@@ -9164,10 +9367,10 @@ var init_session = __esm({
9164
9367
  );
9165
9368
  registerCommand(
9166
9369
  "session.create",
9167
- z8.object({
9168
- workspaceId: z8.string(),
9169
- providerId: z8.string(),
9170
- draft: z8.string().optional()
9370
+ z9.object({
9371
+ workspaceId: z9.string(),
9372
+ providerId: z9.string(),
9373
+ draft: z9.string().optional()
9171
9374
  }),
9172
9375
  async (args, ctx) => {
9173
9376
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9201,8 +9404,8 @@ var init_session = __esm({
9201
9404
  );
9202
9405
  registerCommand(
9203
9406
  "session.stop",
9204
- z8.object({
9205
- sessionId: z8.string()
9407
+ z9.object({
9408
+ sessionId: z9.string()
9206
9409
  }),
9207
9410
  async (args, ctx) => {
9208
9411
  await ctx.sessionMgr.stop(args.sessionId);
@@ -9210,8 +9413,8 @@ var init_session = __esm({
9210
9413
  );
9211
9414
  registerCommand(
9212
9415
  "session.remove",
9213
- z8.object({
9214
- sessionId: z8.string()
9416
+ z9.object({
9417
+ sessionId: z9.string()
9215
9418
  }),
9216
9419
  async (args, ctx) => {
9217
9420
  const session = ctx.sessionMgr.get(args.sessionId);
@@ -9229,9 +9432,9 @@ var init_session = __esm({
9229
9432
 
9230
9433
  // packages/server/src/fs/tree.ts
9231
9434
  import { readdir as readdir3, stat as stat6 } from "fs/promises";
9232
- import { join as join5, relative as relative4 } from "path";
9435
+ import { join as join6, relative as relative4 } from "path";
9233
9436
  async function readTree(rootPath, subdir) {
9234
- const targetPath = subdir ? join5(rootPath, subdir) : rootPath;
9437
+ const targetPath = subdir ? join6(rootPath, subdir) : rootPath;
9235
9438
  const filter = createGitignoreFilter(rootPath, targetPath);
9236
9439
  const entries = await readdir3(targetPath, { withFileTypes: true });
9237
9440
  const nodes = [];
@@ -9239,7 +9442,7 @@ async function readTree(rootPath, subdir) {
9239
9442
  if (!filter(entry.name)) {
9240
9443
  continue;
9241
9444
  }
9242
- const fullPath = join5(targetPath, entry.name);
9445
+ const fullPath = join6(targetPath, entry.name);
9243
9446
  const relPath = relative4(rootPath, fullPath);
9244
9447
  if (entry.isDirectory()) {
9245
9448
  nodes.push({
@@ -9283,7 +9486,7 @@ async function searchFiles(rootPath, query, limit = 10) {
9283
9486
  const filteredEntries = entries.filter((entry) => filter(entry.name));
9284
9487
  filteredEntries.sort((a, b) => a.name.localeCompare(b.name));
9285
9488
  for (const entry of filteredEntries) {
9286
- const fullPath = join5(dirPath, entry.name);
9489
+ const fullPath = join6(dirPath, entry.name);
9287
9490
  const relPath = relative4(rootPath, fullPath);
9288
9491
  if (entry.isDirectory()) {
9289
9492
  await walk(fullPath);
@@ -9376,7 +9579,7 @@ var init_tree = __esm({
9376
9579
  });
9377
9580
 
9378
9581
  // packages/server/src/commands/file.ts
9379
- import { z as z9 } from "zod";
9582
+ import { z as z10 } from "zod";
9380
9583
  var init_file = __esm({
9381
9584
  "packages/server/src/commands/file.ts"() {
9382
9585
  "use strict";
@@ -9385,9 +9588,9 @@ var init_file = __esm({
9385
9588
  init_dispatch();
9386
9589
  registerCommand(
9387
9590
  "file.readTree",
9388
- z9.object({
9389
- workspaceId: z9.string(),
9390
- subPath: z9.string().optional()
9591
+ z10.object({
9592
+ workspaceId: z10.string(),
9593
+ subPath: z10.string().optional()
9391
9594
  }),
9392
9595
  async (args, ctx) => {
9393
9596
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9399,10 +9602,10 @@ var init_file = __esm({
9399
9602
  );
9400
9603
  registerCommand(
9401
9604
  "file.search",
9402
- z9.object({
9403
- workspaceId: z9.string(),
9404
- query: z9.string(),
9405
- limit: z9.number().int().positive().max(50).optional()
9605
+ z10.object({
9606
+ workspaceId: z10.string(),
9607
+ query: z10.string(),
9608
+ limit: z10.number().int().positive().max(50).optional()
9406
9609
  }),
9407
9610
  async (args, ctx) => {
9408
9611
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9414,9 +9617,9 @@ var init_file = __esm({
9414
9617
  );
9415
9618
  registerCommand(
9416
9619
  "file.read",
9417
- z9.object({
9418
- workspaceId: z9.string(),
9419
- path: z9.string()
9620
+ z10.object({
9621
+ workspaceId: z10.string(),
9622
+ path: z10.string()
9420
9623
  }),
9421
9624
  async (args, ctx) => {
9422
9625
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9428,9 +9631,9 @@ var init_file = __esm({
9428
9631
  );
9429
9632
  registerCommand(
9430
9633
  "file.create",
9431
- z9.object({
9432
- workspaceId: z9.string(),
9433
- path: z9.string()
9634
+ z10.object({
9635
+ workspaceId: z10.string(),
9636
+ path: z10.string()
9434
9637
  }),
9435
9638
  async (args, ctx) => {
9436
9639
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9448,9 +9651,9 @@ var init_file = __esm({
9448
9651
  );
9449
9652
  registerCommand(
9450
9653
  "file.mkdir",
9451
- z9.object({
9452
- workspaceId: z9.string(),
9453
- path: z9.string()
9654
+ z10.object({
9655
+ workspaceId: z10.string(),
9656
+ path: z10.string()
9454
9657
  }),
9455
9658
  async (args, ctx) => {
9456
9659
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9468,9 +9671,9 @@ var init_file = __esm({
9468
9671
  );
9469
9672
  registerCommand(
9470
9673
  "file.delete",
9471
- z9.object({
9472
- workspaceId: z9.string(),
9473
- path: z9.string()
9674
+ z10.object({
9675
+ workspaceId: z10.string(),
9676
+ path: z10.string()
9474
9677
  }),
9475
9678
  async (args, ctx) => {
9476
9679
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9488,11 +9691,11 @@ var init_file = __esm({
9488
9691
  );
9489
9692
  registerCommand(
9490
9693
  "file.write",
9491
- z9.object({
9492
- workspaceId: z9.string(),
9493
- path: z9.string(),
9494
- content: z9.string(),
9495
- baseHash: z9.string().optional()
9694
+ z10.object({
9695
+ workspaceId: z10.string(),
9696
+ path: z10.string(),
9697
+ content: z10.string(),
9698
+ baseHash: z10.string().optional()
9496
9699
  // For conflict detection
9497
9700
  }),
9498
9701
  async (args, ctx) => {
@@ -9583,7 +9786,7 @@ var init_git_events = __esm({
9583
9786
  });
9584
9787
 
9585
9788
  // packages/server/src/commands/git.ts
9586
- import { z as z10 } from "zod";
9789
+ import { z as z11 } from "zod";
9587
9790
  async function runGitNetworkOperation(ctx, workspaceId, op) {
9588
9791
  if (!ctx.autoFetch?.runExclusive) {
9589
9792
  return op();
@@ -9598,16 +9801,16 @@ var init_git2 = __esm({
9598
9801
  init_diff();
9599
9802
  init_dispatch();
9600
9803
  init_git_events();
9601
- gitHttpAuthSchema = z10.object({
9602
- username: z10.string(),
9603
- password: z10.string()
9804
+ gitHttpAuthSchema = z11.object({
9805
+ username: z11.string(),
9806
+ password: z11.string()
9604
9807
  });
9605
- gitCommitRevisionSchema = z10.string().regex(/^[0-9a-fA-F]{7,64}$/, "Invalid git commit revision");
9808
+ gitCommitRevisionSchema = z11.string().regex(/^[0-9a-fA-F]{7,64}$/, "Invalid git commit revision");
9606
9809
  GIT_BACKGROUND_FETCH_TIMEOUT_MS = 30 * 1e3;
9607
9810
  registerCommand(
9608
9811
  "git.status",
9609
- z10.object({
9610
- workspaceId: z10.string()
9812
+ z11.object({
9813
+ workspaceId: z11.string()
9611
9814
  }),
9612
9815
  async (args, ctx) => {
9613
9816
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9619,9 +9822,9 @@ var init_git2 = __esm({
9619
9822
  );
9620
9823
  registerCommand(
9621
9824
  "git.stage",
9622
- z10.object({
9623
- workspaceId: z10.string(),
9624
- paths: z10.array(z10.string())
9825
+ z11.object({
9826
+ workspaceId: z11.string(),
9827
+ paths: z11.array(z11.string())
9625
9828
  }),
9626
9829
  async (args, ctx) => {
9627
9830
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9635,10 +9838,10 @@ var init_git2 = __esm({
9635
9838
  );
9636
9839
  registerCommand(
9637
9840
  "git.diff",
9638
- z10.object({
9639
- workspaceId: z10.string(),
9640
- path: z10.string(),
9641
- staged: z10.boolean().optional()
9841
+ z11.object({
9842
+ workspaceId: z11.string(),
9843
+ path: z11.string(),
9844
+ staged: z11.boolean().optional()
9642
9845
  }),
9643
9846
  async (args, ctx) => {
9644
9847
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9652,9 +9855,9 @@ var init_git2 = __esm({
9652
9855
  );
9653
9856
  registerCommand(
9654
9857
  "git.log",
9655
- z10.object({
9656
- workspaceId: z10.string(),
9657
- limit: z10.number().int().min(1).max(50).optional()
9858
+ z11.object({
9859
+ workspaceId: z11.string(),
9860
+ limit: z11.number().int().min(1).max(50).optional()
9658
9861
  }),
9659
9862
  async (args, ctx) => {
9660
9863
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9668,8 +9871,8 @@ var init_git2 = __esm({
9668
9871
  );
9669
9872
  registerCommand(
9670
9873
  "git.show",
9671
- z10.object({
9672
- workspaceId: z10.string(),
9874
+ z11.object({
9875
+ workspaceId: z11.string(),
9673
9876
  sha: gitCommitRevisionSchema
9674
9877
  }),
9675
9878
  async (args, ctx) => {
@@ -9684,9 +9887,9 @@ var init_git2 = __esm({
9684
9887
  );
9685
9888
  registerCommand(
9686
9889
  "git.unstage",
9687
- z10.object({
9688
- workspaceId: z10.string(),
9689
- paths: z10.array(z10.string())
9890
+ z11.object({
9891
+ workspaceId: z11.string(),
9892
+ paths: z11.array(z11.string())
9690
9893
  }),
9691
9894
  async (args, ctx) => {
9692
9895
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9700,9 +9903,9 @@ var init_git2 = __esm({
9700
9903
  );
9701
9904
  registerCommand(
9702
9905
  "git.discard",
9703
- z10.object({
9704
- workspaceId: z10.string(),
9705
- paths: z10.array(z10.string())
9906
+ z11.object({
9907
+ workspaceId: z11.string(),
9908
+ paths: z11.array(z11.string())
9706
9909
  }),
9707
9910
  async (args, ctx) => {
9708
9911
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9718,9 +9921,9 @@ var init_git2 = __esm({
9718
9921
  );
9719
9922
  registerCommand(
9720
9923
  "git.commit",
9721
- z10.object({
9722
- workspaceId: z10.string(),
9723
- message: z10.string()
9924
+ z11.object({
9925
+ workspaceId: z11.string(),
9926
+ message: z11.string()
9724
9927
  }),
9725
9928
  async (args, ctx) => {
9726
9929
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9737,11 +9940,11 @@ var init_git2 = __esm({
9737
9940
  );
9738
9941
  registerCommand(
9739
9942
  "git.push",
9740
- z10.object({
9741
- workspaceId: z10.string(),
9742
- remote: z10.string().optional(),
9743
- branch: z10.string().optional(),
9744
- force: z10.boolean().optional(),
9943
+ z11.object({
9944
+ workspaceId: z11.string(),
9945
+ remote: z11.string().optional(),
9946
+ branch: z11.string().optional(),
9947
+ force: z11.boolean().optional(),
9745
9948
  auth: gitHttpAuthSchema.optional()
9746
9949
  }),
9747
9950
  async (args, ctx) => {
@@ -9768,10 +9971,10 @@ var init_git2 = __esm({
9768
9971
  );
9769
9972
  registerCommand(
9770
9973
  "git.pull",
9771
- z10.object({
9772
- workspaceId: z10.string(),
9773
- remote: z10.string().optional(),
9774
- branch: z10.string().optional(),
9974
+ z11.object({
9975
+ workspaceId: z11.string(),
9976
+ remote: z11.string().optional(),
9977
+ branch: z11.string().optional(),
9775
9978
  auth: gitHttpAuthSchema.optional()
9776
9979
  }),
9777
9980
  async (args, ctx) => {
@@ -9799,12 +10002,12 @@ var init_git2 = __esm({
9799
10002
  );
9800
10003
  registerCommand(
9801
10004
  "git.fetch",
9802
- z10.object({
9803
- workspaceId: z10.string(),
9804
- remote: z10.string().optional(),
9805
- prune: z10.boolean().optional(),
10005
+ z11.object({
10006
+ workspaceId: z11.string(),
10007
+ remote: z11.string().optional(),
10008
+ prune: z11.boolean().optional(),
9806
10009
  auth: gitHttpAuthSchema.optional(),
9807
- background: z10.boolean().optional()
10010
+ background: z11.boolean().optional()
9808
10011
  }),
9809
10012
  async (args, ctx, clientId) => {
9810
10013
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9833,10 +10036,10 @@ var init_git2 = __esm({
9833
10036
  );
9834
10037
  registerCommand(
9835
10038
  "git.checkout",
9836
- z10.object({
9837
- workspaceId: z10.string(),
9838
- ref: z10.string(),
9839
- createBranch: z10.boolean().optional()
10039
+ z11.object({
10040
+ workspaceId: z11.string(),
10041
+ ref: z11.string(),
10042
+ createBranch: z11.boolean().optional()
9840
10043
  }),
9841
10044
  async (args, ctx) => {
9842
10045
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9858,10 +10061,10 @@ var init_git2 = __esm({
9858
10061
  );
9859
10062
  registerCommand(
9860
10063
  "git.branch",
9861
- z10.object({
9862
- workspaceId: z10.string(),
9863
- name: z10.string(),
9864
- startPoint: z10.string().optional()
10064
+ z11.object({
10065
+ workspaceId: z11.string(),
10066
+ name: z11.string(),
10067
+ startPoint: z11.string().optional()
9865
10068
  }),
9866
10069
  async (args, ctx) => {
9867
10070
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9880,8 +10083,8 @@ var init_git2 = __esm({
9880
10083
  );
9881
10084
  registerCommand(
9882
10085
  "git.branches",
9883
- z10.object({
9884
- workspaceId: z10.string()
10086
+ z11.object({
10087
+ workspaceId: z11.string()
9885
10088
  }),
9886
10089
  async (args, ctx) => {
9887
10090
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9895,37 +10098,37 @@ var init_git2 = __esm({
9895
10098
  });
9896
10099
 
9897
10100
  // packages/server/src/config/config-io.ts
9898
- import { existsSync as existsSync5, mkdirSync as mkdirSync2, readFileSync as readFileSync5, renameSync, writeFileSync as writeFileSync2 } from "node:fs";
10101
+ import { existsSync as existsSync6, mkdirSync as mkdirSync3, readFileSync as readFileSync6, renameSync, writeFileSync as writeFileSync3 } from "node:fs";
9899
10102
  import { homedir as homedir3 } from "node:os";
9900
- import { basename as basename2, dirname as dirname3, join as join6 } from "node:path";
10103
+ import { basename as basename2, dirname as dirname4, join as join7 } from "node:path";
9901
10104
  function resolveConfigPath(configType) {
9902
10105
  if (configType === "codex") {
9903
10106
  const testHome = process.env.CODER_STUDIO_CODEX_HOME;
9904
10107
  if (testHome && testHome.trim()) {
9905
- return join6(testHome, "config.toml");
10108
+ return join7(testHome, "config.toml");
9906
10109
  }
9907
10110
  const codexHome = process.env.CODEX_HOME;
9908
10111
  if (codexHome && codexHome.trim()) {
9909
- return join6(codexHome, "config.toml");
10112
+ return join7(codexHome, "config.toml");
9910
10113
  }
9911
- return join6(homedir3(), ".codex", "config.toml");
10114
+ return join7(homedir3(), ".codex", "config.toml");
9912
10115
  }
9913
10116
  if (configType === "claude") {
9914
10117
  const testHome = process.env.CODER_STUDIO_CLAUDE_HOME;
9915
10118
  if (testHome && testHome.trim()) {
9916
- return join6(testHome, "settings.json");
10119
+ return join7(testHome, "settings.json");
9917
10120
  }
9918
- return join6(homedir3(), ".claude", "settings.json");
10121
+ return join7(homedir3(), ".claude", "settings.json");
9919
10122
  }
9920
10123
  throw new Error(`Unknown config type: ${configType}`);
9921
10124
  }
9922
10125
  function readConfigFile(configType) {
9923
10126
  const configPath = resolveConfigPath(configType);
9924
- if (!existsSync5(configPath)) {
10127
+ if (!existsSync6(configPath)) {
9925
10128
  return { configPath, content: "", exists: false };
9926
10129
  }
9927
10130
  try {
9928
- const content = readFileSync5(configPath, "utf-8");
10131
+ const content = readFileSync6(configPath, "utf-8");
9929
10132
  return { configPath, content, exists: true };
9930
10133
  } catch {
9931
10134
  return { configPath, content: "", exists: false };
@@ -9934,16 +10137,16 @@ function readConfigFile(configType) {
9934
10137
  function writeConfigFile(configType, content) {
9935
10138
  try {
9936
10139
  const configPath = resolveConfigPath(configType);
9937
- const parentDir = dirname3(configPath);
9938
- if (!existsSync5(parentDir)) {
9939
- mkdirSync2(parentDir, { recursive: true });
10140
+ const parentDir = dirname4(configPath);
10141
+ if (!existsSync6(parentDir)) {
10142
+ mkdirSync3(parentDir, { recursive: true });
9940
10143
  }
9941
10144
  let backupPath = null;
9942
- if (existsSync5(configPath)) {
10145
+ if (existsSync6(configPath)) {
9943
10146
  backupPath = createBackup(configPath);
9944
10147
  }
9945
10148
  const tempPath = `${configPath}.tmp`;
9946
- writeFileSync2(tempPath, content, "utf-8");
10149
+ writeFileSync3(tempPath, content, "utf-8");
9947
10150
  renameSync(tempPath, configPath);
9948
10151
  return { success: true, backupPath };
9949
10152
  } catch (error) {
@@ -9955,13 +10158,13 @@ function writeConfigFile(configType, content) {
9955
10158
  }
9956
10159
  }
9957
10160
  function createBackup(filePath) {
9958
- const original = readFileSync5(filePath, "utf-8");
10161
+ const original = readFileSync6(filePath, "utf-8");
9959
10162
  const ext = filePath.split(".").pop() ?? "";
9960
10163
  const base = basename2(filePath, `.${ext}`);
9961
- const dir = dirname3(filePath);
10164
+ const dir = dirname4(filePath);
9962
10165
  const ts = formatTimestamp(/* @__PURE__ */ new Date());
9963
- const backupPath = join6(dir, `${base}.bak.${ts}.${ext}`);
9964
- writeFileSync2(backupPath, original, "utf-8");
10166
+ const backupPath = join7(dir, `${base}.bak.${ts}.${ext}`);
10167
+ writeFileSync3(backupPath, original, "utf-8");
9965
10168
  return backupPath;
9966
10169
  }
9967
10170
  function formatTimestamp(d) {
@@ -9975,7 +10178,7 @@ var init_config_io = __esm({
9975
10178
  });
9976
10179
 
9977
10180
  // packages/server/src/commands/settings.ts
9978
- import { z as z11 } from "zod";
10181
+ import { z as z12 } from "zod";
9979
10182
  function flattenSettings(obj, prefix = "") {
9980
10183
  const result = {};
9981
10184
  for (const [key, value] of Object.entries(obj)) {
@@ -9998,27 +10201,28 @@ var init_settings2 = __esm({
9998
10201
  init_provider_config_repo();
9999
10202
  init_settings();
10000
10203
  init_dispatch();
10001
- SettingsSchema = z11.object({
10002
- defaultProviderId: z11.string().optional(),
10003
- notifications: z11.object({
10004
- enabled: z11.boolean().optional(),
10005
- soundEnabled: z11.boolean().optional(),
10204
+ SettingsSchema = z12.object({
10205
+ defaultProviderId: z12.string().optional(),
10206
+ notifications: z12.object({
10207
+ enabled: z12.boolean().optional(),
10208
+ soundEnabled: z12.boolean().optional(),
10006
10209
  // Legacy field — accepted for backward compat with older clients but
10007
10210
  // no longer surfaced in the UI. The web client now picks the channel
10008
10211
  // automatically based on workspace focus + page visibility.
10009
- onlyWhenBackgrounded: z11.boolean().optional()
10212
+ onlyWhenBackgrounded: z12.boolean().optional()
10010
10213
  }).optional(),
10011
- supervisor: z11.object({
10012
- evaluationTimeoutSec: z11.number().int().min(1).max(MAX_SUPERVISOR_EVALUATION_TIMEOUT_SEC).default(DEFAULT_SUPERVISOR_EVALUATION_TIMEOUT_SEC).optional()
10214
+ supervisor: z12.object({
10215
+ evaluationTimeoutSec: z12.number().int().min(1).max(MAX_SUPERVISOR_EVALUATION_TIMEOUT_SEC).default(DEFAULT_SUPERVISOR_EVALUATION_TIMEOUT_SEC).optional()
10013
10216
  }).optional(),
10014
- appearance: z11.object({
10015
- theme: z11.enum(["dark"]).optional(),
10016
- terminalRenderer: z11.enum(["standard", "compatibility"]).optional(),
10017
- locale: z11.enum(["zh", "en"]).optional()
10217
+ appearance: z12.object({
10218
+ theme: z12.enum(["dark"]).optional(),
10219
+ terminalRenderer: z12.enum(["standard", "compatibility"]).optional(),
10220
+ terminalCopyOnSelect: z12.boolean().optional(),
10221
+ locale: z12.enum(["zh", "en"]).optional()
10018
10222
  }).optional(),
10019
10223
  providers: ProviderSettingsSchema.optional()
10020
10224
  });
10021
- registerCommand("settings.get", z11.object({}), async (_args, ctx) => {
10225
+ registerCommand("settings.get", z12.object({}), async (_args, ctx) => {
10022
10226
  const row = ctx.db.prepare("SELECT key, value FROM user_settings").all();
10023
10227
  const settings = {};
10024
10228
  for (const { key, value } of row) {
@@ -10051,7 +10255,7 @@ var init_settings2 = __esm({
10051
10255
  });
10052
10256
  registerCommand(
10053
10257
  "settings.update",
10054
- z11.object({
10258
+ z12.object({
10055
10259
  settings: SettingsSchema
10056
10260
  }),
10057
10261
  async (args, ctx) => {
@@ -10083,10 +10287,10 @@ var init_settings2 = __esm({
10083
10287
  );
10084
10288
  registerCommand(
10085
10289
  "settings.previewCommand",
10086
- z11.object({
10087
- providerId: z11.string(),
10290
+ z12.object({
10291
+ providerId: z12.string(),
10088
10292
  config: ProviderLaunchConfigInputSchema,
10089
- workspacePath: z11.string().optional()
10293
+ workspacePath: z12.string().optional()
10090
10294
  }),
10091
10295
  async (args, ctx) => {
10092
10296
  const provider = ctx.providerRegistry.find((item) => item.id === args.providerId);
@@ -10107,8 +10311,8 @@ var init_settings2 = __esm({
10107
10311
  );
10108
10312
  registerCommand(
10109
10313
  "settings.readConfigFile",
10110
- z11.object({
10111
- configType: z11.enum(["codex", "claude"])
10314
+ z12.object({
10315
+ configType: z12.enum(["codex", "claude"])
10112
10316
  }),
10113
10317
  async (args) => {
10114
10318
  const result = readConfigFile(args.configType);
@@ -10117,9 +10321,9 @@ var init_settings2 = __esm({
10117
10321
  );
10118
10322
  registerCommand(
10119
10323
  "settings.writeConfigFile",
10120
- z11.object({
10121
- configType: z11.enum(["codex", "claude"]),
10122
- content: z11.string()
10324
+ z12.object({
10325
+ configType: z12.enum(["codex", "claude"]),
10326
+ content: z12.string()
10123
10327
  }),
10124
10328
  async (args) => {
10125
10329
  const result = writeConfigFile(args.configType, args.content);
@@ -10130,19 +10334,19 @@ var init_settings2 = __esm({
10130
10334
  });
10131
10335
 
10132
10336
  // packages/server/src/commands/provider.ts
10133
- import { z as z12 } from "zod";
10337
+ import { z as z13 } from "zod";
10134
10338
  var init_provider = __esm({
10135
10339
  "packages/server/src/commands/provider.ts"() {
10136
10340
  "use strict";
10137
10341
  init_runtime_status();
10138
10342
  init_dispatch();
10139
- registerCommand("provider.runtimeStatus", z12.object({}), async (_args, ctx) => {
10343
+ registerCommand("provider.runtimeStatus", z13.object({}), async (_args, ctx) => {
10140
10344
  return buildProviderRuntimeStatus(ctx.providerRegistry, ctx.providerRuntimeDeps);
10141
10345
  });
10142
10346
  registerCommand(
10143
10347
  "provider.install.start",
10144
- z12.object({
10145
- providerId: z12.string()
10348
+ z13.object({
10349
+ providerId: z13.string()
10146
10350
  }),
10147
10351
  async (args, ctx) => {
10148
10352
  if (!ctx.providerInstallMgr) {
@@ -10156,8 +10360,8 @@ var init_provider = __esm({
10156
10360
  );
10157
10361
  registerCommand(
10158
10362
  "provider.install.get",
10159
- z12.object({
10160
- jobId: z12.string()
10363
+ z13.object({
10364
+ jobId: z13.string()
10161
10365
  }),
10162
10366
  async (args, ctx) => {
10163
10367
  if (!ctx.providerInstallMgr) {
@@ -10180,29 +10384,29 @@ var init_provider = __esm({
10180
10384
  });
10181
10385
 
10182
10386
  // packages/server/src/commands/supervisor.ts
10183
- import { z as z13 } from "zod";
10387
+ import { z as z14 } from "zod";
10184
10388
  var supervisorObjectiveSchema, createSupervisorSchema, updateSupervisorSchema, sessionIdSchema, supervisorIdSchema;
10185
10389
  var init_supervisor2 = __esm({
10186
10390
  "packages/server/src/commands/supervisor.ts"() {
10187
10391
  "use strict";
10188
10392
  init_dispatch();
10189
- supervisorObjectiveSchema = z13.string().trim().min(1).max(4e3);
10190
- createSupervisorSchema = z13.object({
10191
- sessionId: z13.string(),
10192
- workspaceId: z13.string(),
10393
+ supervisorObjectiveSchema = z14.string().trim().min(1).max(4e3);
10394
+ createSupervisorSchema = z14.object({
10395
+ sessionId: z14.string(),
10396
+ workspaceId: z14.string(),
10193
10397
  objective: supervisorObjectiveSchema,
10194
- evaluatorProviderId: z13.string()
10398
+ evaluatorProviderId: z14.string()
10195
10399
  }).strict();
10196
- updateSupervisorSchema = z13.object({
10197
- id: z13.string(),
10400
+ updateSupervisorSchema = z14.object({
10401
+ id: z14.string(),
10198
10402
  objective: supervisorObjectiveSchema.optional(),
10199
- evaluatorProviderId: z13.string().optional()
10403
+ evaluatorProviderId: z14.string().optional()
10200
10404
  }).strict().refine(
10201
10405
  (input2) => input2.objective !== void 0 || input2.evaluatorProviderId !== void 0,
10202
10406
  "objective or evaluatorProviderId is required"
10203
10407
  );
10204
- sessionIdSchema = z13.object({ sessionId: z13.string() });
10205
- supervisorIdSchema = z13.object({ id: z13.string() });
10408
+ sessionIdSchema = z14.object({ sessionId: z14.string() });
10409
+ supervisorIdSchema = z14.object({ id: z14.string() });
10206
10410
  registerCommand("supervisor.create", createSupervisorSchema, async (args, ctx) => {
10207
10411
  return {
10208
10412
  supervisor: await ctx.supervisorMgr.create({
@@ -10380,7 +10584,7 @@ var init_worktree = __esm({
10380
10584
 
10381
10585
  // packages/server/src/commands/worktree.ts
10382
10586
  import path9 from "node:path";
10383
- import { z as z14 } from "zod";
10587
+ import { z as z15 } from "zod";
10384
10588
  async function findRelatedWorkspaceIds(ctx, workspacePath) {
10385
10589
  const targetCommonDir = await getGitCommonDirPath(workspacePath);
10386
10590
  const relatedWorkspaceIds = await Promise.all(
@@ -10413,7 +10617,7 @@ var init_worktree2 = __esm({
10413
10617
  init_worktree();
10414
10618
  init_dispatch();
10415
10619
  init_git_events();
10416
- registerCommand("worktree.list", z14.object({ workspaceId: z14.string() }), async (args, ctx) => {
10620
+ registerCommand("worktree.list", z15.object({ workspaceId: z15.string() }), async (args, ctx) => {
10417
10621
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
10418
10622
  if (!workspace) {
10419
10623
  throw { code: "workspace_not_found", message: `Workspace not found: ${args.workspaceId}` };
@@ -10422,7 +10626,7 @@ var init_worktree2 = __esm({
10422
10626
  });
10423
10627
  registerCommand(
10424
10628
  "worktree.status",
10425
- z14.object({ workspaceId: z14.string(), worktreePath: z14.string() }),
10629
+ z15.object({ workspaceId: z15.string(), worktreePath: z15.string() }),
10426
10630
  async (args, ctx) => {
10427
10631
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
10428
10632
  if (!workspace) {
@@ -10434,10 +10638,10 @@ var init_worktree2 = __esm({
10434
10638
  );
10435
10639
  registerCommand(
10436
10640
  "worktree.diff",
10437
- z14.object({
10438
- workspaceId: z14.string(),
10439
- worktreePath: z14.string(),
10440
- staged: z14.boolean().optional().default(false)
10641
+ z15.object({
10642
+ workspaceId: z15.string(),
10643
+ worktreePath: z15.string(),
10644
+ staged: z15.boolean().optional().default(false)
10441
10645
  }),
10442
10646
  async (args, ctx) => {
10443
10647
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -10450,7 +10654,7 @@ var init_worktree2 = __esm({
10450
10654
  );
10451
10655
  registerCommand(
10452
10656
  "worktree.tree",
10453
- z14.object({ workspaceId: z14.string(), worktreePath: z14.string() }),
10657
+ z15.object({ workspaceId: z15.string(), worktreePath: z15.string() }),
10454
10658
  async (args, ctx) => {
10455
10659
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
10456
10660
  if (!workspace) {
@@ -10462,10 +10666,10 @@ var init_worktree2 = __esm({
10462
10666
  );
10463
10667
  registerCommand(
10464
10668
  "worktree.create",
10465
- z14.object({
10466
- workspaceId: z14.string(),
10467
- branch: z14.string(),
10468
- path: z14.string()
10669
+ z15.object({
10670
+ workspaceId: z15.string(),
10671
+ branch: z15.string(),
10672
+ path: z15.string()
10469
10673
  }),
10470
10674
  async (args, ctx) => {
10471
10675
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -10480,10 +10684,10 @@ var init_worktree2 = __esm({
10480
10684
  );
10481
10685
  registerCommand(
10482
10686
  "worktree.remove",
10483
- z14.object({
10484
- workspaceId: z14.string(),
10485
- worktreePath: z14.string(),
10486
- force: z14.boolean().optional().default(false)
10687
+ z15.object({
10688
+ workspaceId: z15.string(),
10689
+ worktreePath: z15.string(),
10690
+ force: z15.boolean().optional().default(false)
10487
10691
  }),
10488
10692
  async (args, ctx) => {
10489
10693
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -10507,7 +10711,7 @@ var init_worktree2 = __esm({
10507
10711
  });
10508
10712
 
10509
10713
  // packages/server/src/commands/fencing.ts
10510
- import { z as z15 } from "zod";
10714
+ import { z as z16 } from "zod";
10511
10715
  function createMockFencingRequest() {
10512
10716
  return {
10513
10717
  ip: "127.0.0.1",
@@ -10520,9 +10724,9 @@ var init_fencing2 = __esm({
10520
10724
  init_dispatch();
10521
10725
  registerCommand(
10522
10726
  "fencing.request",
10523
- z15.object({
10524
- workspaceId: z15.string(),
10525
- tabId: z15.string()
10727
+ z16.object({
10728
+ workspaceId: z16.string(),
10729
+ tabId: z16.string()
10526
10730
  }),
10527
10731
  async (args, ctx, clientId) => {
10528
10732
  return ctx.fencingMgr.requestControl(
@@ -10535,7 +10739,7 @@ var init_fencing2 = __esm({
10535
10739
  );
10536
10740
  registerCommand(
10537
10741
  "fencing.heartbeat",
10538
- z15.object({ workspaceId: z15.string() }),
10742
+ z16.object({ workspaceId: z16.string() }),
10539
10743
  async (args, ctx, clientId) => {
10540
10744
  const success = ctx.fencingMgr.heartbeat(args.workspaceId, clientId);
10541
10745
  return { success };
@@ -10543,13 +10747,13 @@ var init_fencing2 = __esm({
10543
10747
  );
10544
10748
  registerCommand(
10545
10749
  "fencing.release",
10546
- z15.object({ workspaceId: z15.string() }),
10750
+ z16.object({ workspaceId: z16.string() }),
10547
10751
  async (args, ctx, clientId) => {
10548
10752
  ctx.fencingMgr.release(args.workspaceId, clientId);
10549
10753
  return {};
10550
10754
  }
10551
10755
  );
10552
- registerCommand("fencing.status", z15.object({ workspaceId: z15.string() }), async (args, ctx) => {
10756
+ registerCommand("fencing.status", z16.object({ workspaceId: z16.string() }), async (args, ctx) => {
10553
10757
  const controller = ctx.fencingMgr.getController(args.workspaceId);
10554
10758
  const isUnresponsive = ctx.fencingMgr.isControllerUnresponsive(args.workspaceId);
10555
10759
  return {
@@ -10560,9 +10764,9 @@ var init_fencing2 = __esm({
10560
10764
  });
10561
10765
  registerCommand(
10562
10766
  "fencing.takeover",
10563
- z15.object({
10564
- workspaceId: z15.string(),
10565
- tabId: z15.string()
10767
+ z16.object({
10768
+ workspaceId: z16.string(),
10769
+ tabId: z16.string()
10566
10770
  }),
10567
10771
  async (args, ctx, clientId) => {
10568
10772
  return ctx.fencingMgr.forceTakeover(
@@ -10582,6 +10786,7 @@ var init_commands = __esm({
10582
10786
  "use strict";
10583
10787
  init_workspace();
10584
10788
  init_workspace_activity();
10789
+ init_connection();
10585
10790
  init_session();
10586
10791
  init_terminal();
10587
10792
  init_file();
@@ -10665,6 +10870,7 @@ async function createServer(configOverrides) {
10665
10870
  (err) => console.warn("[uploads] cascade cleanup failed", { wsId: workspaceId, err })
10666
10871
  )
10667
10872
  });
10873
+ workspaceMgr.hydrateWatchers();
10668
10874
  const authSessionRepo = new AuthSessionRepo(db);
10669
10875
  const authLoginBlockRepo = new AuthLoginBlockRepo(db);
10670
10876
  const app = await buildFastifyApp({
@@ -10704,10 +10910,13 @@ async function createServer(configOverrides) {
10704
10910
  });
10705
10911
  await sessionMgr.hydrate();
10706
10912
  await supervisorMgr.hydrate();
10707
- const providerRuntimeDeps = {};
10913
+ const providerMockOverrides = createE2EProviderMockOverrides();
10914
+ const providerRuntimeDeps = providerMockOverrides ? {
10915
+ commandExists: providerMockOverrides.commandExists
10916
+ } : {};
10708
10917
  const providerInstallMgr = new ProviderInstallManager(providerRegistry, {
10709
10918
  ...providerRuntimeDeps,
10710
- runCommand: runCommandAsString
10919
+ runCommand: providerMockOverrides?.runCommand ?? runCommandAsString
10711
10920
  });
10712
10921
  commandContext = {
10713
10922
  workspaceMgr,
@@ -10746,11 +10955,16 @@ async function createServer(configOverrides) {
10746
10955
  );
10747
10956
  }, STARTUP_GC_DELAY_MS);
10748
10957
  gcTimer.unref();
10958
+ const wsKeepaliveTimer = setInterval(() => {
10959
+ wsHub.pingAll();
10960
+ }, WS_KEEPALIVE_INTERVAL_MS);
10961
+ wsKeepaliveTimer.unref();
10749
10962
  let stopped = false;
10750
10963
  const stopServer = async () => {
10751
10964
  if (stopped) return;
10752
10965
  stopped = true;
10753
10966
  clearTimeout(gcTimer);
10967
+ clearInterval(wsKeepaliveTimer);
10754
10968
  await app.close();
10755
10969
  autoFetch.stop();
10756
10970
  supervisorMgr.stop();
@@ -10866,6 +11080,7 @@ function createSessionDatabase(db) {
10866
11080
  }
10867
11081
  };
10868
11082
  }
11083
+ var WS_KEEPALIVE_INTERVAL_MS;
10869
11084
  var init_server = __esm({
10870
11085
  async "packages/server/src/server.ts"() {
10871
11086
  "use strict";
@@ -10877,6 +11092,7 @@ var init_server = __esm({
10877
11092
  init_config();
10878
11093
  init_auto_fetch();
10879
11094
  init_command_runner();
11095
+ init_e2e_provider_mock();
10880
11096
  init_install_manager();
10881
11097
  init_manager();
10882
11098
  init_db();
@@ -10897,6 +11113,7 @@ var init_server = __esm({
10897
11113
  init_fencing();
10898
11114
  init_hub();
10899
11115
  init_commands();
11116
+ WS_KEEPALIVE_INTERVAL_MS = 15e3;
10900
11117
  if (isDirectExecution(import.meta.url)) {
10901
11118
  const server = await createServer();
10902
11119
  process.on("SIGINT", async () => {
@@ -11183,20 +11400,20 @@ var init_src4 = __esm({
11183
11400
  });
11184
11401
 
11185
11402
  // packages/cli/src/cli.ts
11186
- import { existsSync as existsSync10 } from "fs";
11187
- import { dirname as dirname5, join as join9 } from "path";
11403
+ import { existsSync as existsSync11 } from "fs";
11404
+ import { dirname as dirname6, join as join10 } from "path";
11188
11405
  import { fileURLToPath as fileURLToPath3 } from "url";
11189
11406
 
11190
11407
  // packages/cli/src/auth-control.ts
11191
11408
  await init_src4();
11192
11409
 
11193
11410
  // packages/cli/src/config-store.ts
11194
- import { existsSync as existsSync6, mkdirSync as mkdirSync3, readFileSync as readFileSync6, writeFileSync as writeFileSync3 } from "fs";
11411
+ import { existsSync as existsSync7, mkdirSync as mkdirSync4, readFileSync as readFileSync7, writeFileSync as writeFileSync4 } from "fs";
11195
11412
  import { homedir as homedir4 } from "os";
11196
- import { basename as basename3, join as join7 } from "path";
11413
+ import { basename as basename3, join as join8 } from "path";
11197
11414
  var DEFAULT_DB_FILE = "coder-studio.db";
11198
11415
  function getCliConfigPath() {
11199
- return join7(homedir4(), ".coder-studio", "config.json");
11416
+ return join8(homedir4(), ".coder-studio", "config.json");
11200
11417
  }
11201
11418
  function normalizeDataDir(input2) {
11202
11419
  if (input2.endsWith(".db")) {
@@ -11205,15 +11422,15 @@ function normalizeDataDir(input2) {
11205
11422
  if (basename3(input2).includes(".")) {
11206
11423
  return input2;
11207
11424
  }
11208
- return join7(input2, DEFAULT_DB_FILE);
11425
+ return join8(input2, DEFAULT_DB_FILE);
11209
11426
  }
11210
11427
  function readCliConfig() {
11211
11428
  const path10 = getCliConfigPath();
11212
- if (!existsSync6(path10)) {
11429
+ if (!existsSync7(path10)) {
11213
11430
  return null;
11214
11431
  }
11215
11432
  try {
11216
- const parsed = JSON.parse(readFileSync6(path10, "utf-8"));
11433
+ const parsed = JSON.parse(readFileSync7(path10, "utf-8"));
11217
11434
  if (parsed.host !== void 0 && typeof parsed.host !== "string" || parsed.port !== void 0 && typeof parsed.port !== "number" || parsed.dataDir !== void 0 && typeof parsed.dataDir !== "string" || parsed.password !== void 0 && typeof parsed.password !== "string") {
11218
11435
  return null;
11219
11436
  }
@@ -11224,17 +11441,17 @@ function readCliConfig() {
11224
11441
  }
11225
11442
  function writeCliConfig(config) {
11226
11443
  const path10 = getCliConfigPath();
11227
- const dir = join7(homedir4(), ".coder-studio");
11444
+ const dir = join8(homedir4(), ".coder-studio");
11228
11445
  const normalizedConfig = {
11229
11446
  ...config.host !== void 0 ? { host: config.host } : {},
11230
11447
  ...config.port !== void 0 && config.port > 0 ? { port: config.port } : {},
11231
11448
  ...config.dataDir !== void 0 ? { dataDir: normalizeDataDir(config.dataDir) } : {},
11232
11449
  ...config.password !== void 0 ? { password: config.password } : {}
11233
11450
  };
11234
- if (!existsSync6(dir)) {
11235
- mkdirSync3(dir, { recursive: true });
11451
+ if (!existsSync7(dir)) {
11452
+ mkdirSync4(dir, { recursive: true });
11236
11453
  }
11237
- writeFileSync3(path10, JSON.stringify(normalizedConfig, null, 2), "utf-8");
11454
+ writeFileSync4(path10, JSON.stringify(normalizedConfig, null, 2), "utf-8");
11238
11455
  }
11239
11456
 
11240
11457
  // packages/cli/src/auth-control.ts
@@ -11298,12 +11515,12 @@ async function openBrowser(url) {
11298
11515
  }
11299
11516
 
11300
11517
  // packages/cli/src/log-excerpt.ts
11301
- import { closeSync, existsSync as existsSync7, openSync, readSync, statSync as statSync2 } from "fs";
11518
+ import { closeSync, existsSync as existsSync8, openSync, readSync, statSync as statSync2 } from "fs";
11302
11519
  var DEFAULT_MAX_LINES = 40;
11303
11520
  var DEFAULT_MAX_CHARS = 4e3;
11304
11521
  var DEFAULT_MAX_BYTES = 16 * 1024;
11305
11522
  var getFileSize = (path10) => {
11306
- if (!existsSync7(path10)) {
11523
+ if (!existsSync8(path10)) {
11307
11524
  return 0;
11308
11525
  }
11309
11526
  try {
@@ -11318,7 +11535,7 @@ var readLogExcerpt = (path10, {
11318
11535
  maxLines = DEFAULT_MAX_LINES,
11319
11536
  maxChars = DEFAULT_MAX_CHARS
11320
11537
  } = {}) => {
11321
- if (!existsSync7(path10)) {
11538
+ if (!existsSync8(path10)) {
11322
11539
  return null;
11323
11540
  }
11324
11541
  const fileSize = getFileSize(path10);
@@ -11397,12 +11614,12 @@ function assertSupportedNodeVersion(version = process.versions.node) {
11397
11614
  }
11398
11615
 
11399
11616
  // packages/cli/src/package-manifest.ts
11400
- import { existsSync as existsSync8, readFileSync as readFileSync7 } from "fs";
11617
+ import { existsSync as existsSync9, readFileSync as readFileSync8 } from "fs";
11401
11618
  function resolveCliPackageManifestUrl(importMetaUrl) {
11402
11619
  const manifestUrl = [
11403
11620
  new URL("../package.json", importMetaUrl),
11404
11621
  new URL("../../package.json", importMetaUrl)
11405
- ].find((candidate) => existsSync8(candidate));
11622
+ ].find((candidate) => existsSync9(candidate));
11406
11623
  if (!manifestUrl) {
11407
11624
  throw new Error("Unable to locate CLI package.json");
11408
11625
  }
@@ -11410,7 +11627,7 @@ function resolveCliPackageManifestUrl(importMetaUrl) {
11410
11627
  }
11411
11628
  function getCliPackageManifest(importMetaUrl) {
11412
11629
  return JSON.parse(
11413
- readFileSync7(resolveCliPackageManifestUrl(importMetaUrl), "utf-8")
11630
+ readFileSync8(resolveCliPackageManifestUrl(importMetaUrl), "utf-8")
11414
11631
  );
11415
11632
  }
11416
11633
  function getCliVersion(importMetaUrl) {
@@ -11619,9 +11836,9 @@ function parseArgs(argv) {
11619
11836
 
11620
11837
  // packages/cli/src/pm2-control.ts
11621
11838
  init_runtime();
11622
- import { mkdirSync as mkdirSync4 } from "fs";
11839
+ import { mkdirSync as mkdirSync5 } from "fs";
11623
11840
  import { homedir as homedir5 } from "os";
11624
- import { join as join8 } from "path";
11841
+ import { join as join9 } from "path";
11625
11842
  var MANAGED_SERVER_NAME = "coder-studio-server";
11626
11843
  var PM2_RESTART_DELAY_MS = 2e3;
11627
11844
  var PM2_MIN_UPTIME = "5s";
@@ -11812,11 +12029,11 @@ var deleteManagedServerInSession = async (pm2, {
11812
12029
  return true;
11813
12030
  };
11814
12031
  var ensureLogDirectory = () => {
11815
- mkdirSync4(join8(homedir5(), ".coder-studio", "logs"), { recursive: true });
12032
+ mkdirSync5(join9(homedir5(), ".coder-studio", "logs"), { recursive: true });
11816
12033
  };
11817
12034
  var getLogPaths = () => ({
11818
- outFile: join8(homedir5(), ".coder-studio", "logs", "server.out.log"),
11819
- errFile: join8(homedir5(), ".coder-studio", "logs", "server.err.log")
12035
+ outFile: join9(homedir5(), ".coder-studio", "logs", "server.out.log"),
12036
+ errFile: join9(homedir5(), ".coder-studio", "logs", "server.err.log")
11820
12037
  });
11821
12038
  var captureStartupLogOffsets = () => {
11822
12039
  const { outFile, errFile } = getLogPaths();
@@ -12002,17 +12219,17 @@ async function getServerStatus() {
12002
12219
  import { fileURLToPath as fileURLToPath2 } from "url";
12003
12220
 
12004
12221
  // packages/cli/src/embed.ts
12005
- import { existsSync as existsSync9 } from "fs";
12006
- import { dirname as dirname4, resolve as resolve3 } from "path";
12222
+ import { existsSync as existsSync10 } from "fs";
12223
+ import { dirname as dirname5, resolve as resolve3 } from "path";
12007
12224
  import { fileURLToPath } from "url";
12008
12225
  var __filename = fileURLToPath(import.meta.url);
12009
- var __dirname = dirname4(__filename);
12226
+ var __dirname = dirname5(__filename);
12010
12227
  var WEB_ASSETS_DIR = resolve3(__dirname, "../web");
12011
12228
  function getStaticAssetsDir() {
12012
12229
  return WEB_ASSETS_DIR;
12013
12230
  }
12014
12231
  function hasWebAssets() {
12015
- return existsSync9(WEB_ASSETS_DIR);
12232
+ return existsSync10(WEB_ASSETS_DIR);
12016
12233
  }
12017
12234
 
12018
12235
  // packages/cli/src/server-runner.ts
@@ -12214,13 +12431,13 @@ function formatAuthBlocks(blocks) {
12214
12431
  }
12215
12432
  function resolveManagedScriptPath() {
12216
12433
  const currentFile = fileURLToPath3(import.meta.url);
12217
- const currentDir = dirname5(currentFile);
12434
+ const currentDir = dirname6(currentFile);
12218
12435
  const candidates = [
12219
- join9(currentDir, "server-runner.js"),
12220
- join9(currentDir, "server-runner.mjs"),
12221
- join9(currentDir, "../src/server-runner.ts")
12436
+ join10(currentDir, "server-runner.js"),
12437
+ join10(currentDir, "server-runner.mjs"),
12438
+ join10(currentDir, "../src/server-runner.ts")
12222
12439
  ];
12223
- const scriptPath = candidates.find((candidate) => existsSync10(candidate));
12440
+ const scriptPath = candidates.find((candidate) => existsSync11(candidate));
12224
12441
  if (!scriptPath) {
12225
12442
  throw new Error("Unable to locate the managed server entry script");
12226
12443
  }