cwm-assistant 0.3.11 → 0.3.12

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.
@@ -6,9 +6,9 @@ var __export = (target, all) => {
6
6
 
7
7
  // src/cli.ts
8
8
  import { spawn as spawn8 } from "node:child_process";
9
- import fs25 from "node:fs";
9
+ import fs26 from "node:fs";
10
10
  import os9 from "node:os";
11
- import path28 from "node:path";
11
+ import path29 from "node:path";
12
12
  import { createInterface } from "node:readline/promises";
13
13
 
14
14
  // ../../node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
@@ -2619,7 +2619,7 @@ var Type = type_exports2;
2619
2619
 
2620
2620
  // ../../packages/contracts/src/assistant.ts
2621
2621
  var ASSISTANT_PROTOCOL = 1;
2622
- var ASSISTANT_VERSION = "0.3.11";
2622
+ var ASSISTANT_VERSION = "0.3.12";
2623
2623
  var ASSISTANT_PORT = 46322;
2624
2624
 
2625
2625
  // ../../packages/contracts/src/index.ts
@@ -2913,15 +2913,18 @@ function removeLocalWorkspace(options) {
2913
2913
  const extraFiles = [];
2914
2914
  const warnings = [];
2915
2915
  const isFinderMetadata = (p) => path2.basename(p) === ".DS_Store" && fs2.lstatSync(p).isFile();
2916
- if (otherMounts.some((m) => {
2916
+ const blocking = otherMounts.filter((m) => {
2917
2917
  try {
2918
2918
  const p = fs2.realpathSync(m.folder_path);
2919
2919
  return p === root || inside(root, p);
2920
2920
  } catch {
2921
2921
  return false;
2922
2922
  }
2923
- }))
2924
- throw new Error("\u76EE\u5F55\u4ECD\u88AB\u5176\u4ED6 Workspace \u6302\u8F7D\uFF0C\u8BF7\u5148\u89E3\u9664\u5F15\u7528");
2923
+ });
2924
+ if (blocking.length)
2925
+ throw new Error(
2926
+ blocking.some((m) => m.workspaceId !== id) ? "\u76EE\u5F55\u4ECD\u88AB\u5176\u4ED6 Workspace \u6302\u8F7D\uFF0C\u8BF7\u5148\u89E3\u9664\u5F15\u7528" : "\u8BE5\u76EE\u5F55\u8FD8\u88AB\u540C\u4E00 Workspace \u5728\u5176\u4ED6\u8D26\u53F7\u4E0B\u7684\u672C\u673A\u526F\u672C\u5F15\u7528\uFF0C\u8BF7\u5148\u5207\u6362\u5230\u90A3\u4E2A\u8D26\u53F7\u79FB\u9664"
2927
+ );
2925
2928
  const inspect = (directory) => {
2926
2929
  for (const entry of fs2.readdirSync(directory, { withFileTypes: true })) {
2927
2930
  const p = path2.join(directory, entry.name);
@@ -3337,6 +3340,13 @@ function macApplication(name) {
3337
3340
  (candidate) => fs5.existsSync(candidate)
3338
3341
  ) || "";
3339
3342
  }
3343
+ function appBundleBinary(bundle, binary) {
3344
+ const candidate = path6.join(bundle, "Contents/Resources/app/bin", binary);
3345
+ return fs5.existsSync(candidate) ? candidate : "";
3346
+ }
3347
+ function macBundleBinary(app, binary) {
3348
+ return [path6.join("/Applications", app), path6.join(os3.homedir(), "Applications", app)].map((bundle) => appBundleBinary(bundle, binary)).find(Boolean) || "";
3349
+ }
3340
3350
  function detectToolCommands() {
3341
3351
  if (process.platform === "win32") {
3342
3352
  return {
@@ -3350,8 +3360,8 @@ function detectToolCommands() {
3350
3360
  };
3351
3361
  }
3352
3362
  return {
3353
- vscode: commandOnPath("code") || macApplication("Visual Studio Code.app"),
3354
- cursor: commandOnPath("cursor") || macApplication("Cursor.app"),
3363
+ vscode: commandOnPath("code") || macBundleBinary("Visual Studio Code.app", "code"),
3364
+ cursor: commandOnPath("cursor") || macBundleBinary("Cursor.app", "cursor"),
3355
3365
  idea: toolboxIdeaScript() || commandOnPath("idea") || macApplication("IntelliJ IDEA.app"),
3356
3366
  claude: commandOnPath("claude"),
3357
3367
  codex: commandOnPath("codex"),
@@ -3521,14 +3531,10 @@ function launchIde(workspaceFile, ide, configuredCommand = "", targetKind = "wor
3521
3531
  if (ide === "idea") return launchIntelliJIdea(workingDirectory, configuredCommand);
3522
3532
  const cursorLike = ide === "cursor" || ide === "cursor-agent";
3523
3533
  let command = configuredCommand || (ide === "codex" ? process.env.CWM_CODEX_PATH : cursorLike ? process.env.CWM_CURSOR_PATH : process.env.CWM_VSCODE_PATH) || "";
3534
+ const bundleBinary = cursorLike ? "cursor" : "code";
3535
+ if (command) command = appBundleBinary(command, bundleBinary) || command;
3524
3536
  if (!command && ide !== "codex" && process.platform === "darwin") {
3525
- const app = cursorLike ? "Cursor.app" : "Visual Studio Code.app";
3526
- const binary = cursorLike ? "cursor" : "code";
3527
- const candidates = [
3528
- path7.join("/Applications", app, "Contents/Resources/app/bin", binary),
3529
- path7.join(os4.homedir(), "Applications", app, "Contents/Resources/app/bin", binary)
3530
- ];
3531
- command = candidates.find((candidate) => fs6.existsSync(candidate)) || "";
3537
+ command = macBundleBinary(cursorLike ? "Cursor.app" : "Visual Studio Code.app", bundleBinary);
3532
3538
  }
3533
3539
  if (!command && process.platform === "win32" && (cursorLike || ide === "vscode" || ide === "codex")) {
3534
3540
  command = ide === "codex" ? windowsCodexExecutable() : windowsCliShim(cursorLike ? "cursor" : "vscode");
@@ -4174,9 +4180,12 @@ function registerDeleteRoute(app, store, jobs) {
4174
4180
  store,
4175
4181
  { ...grant, userId: mount.userId, workbenchId: mount.workbenchId },
4176
4182
  mount.workspaceId
4177
- ).folders.map((folder) => ({ folder_path: folder.path }));
4183
+ ).folders.map((folder) => ({
4184
+ folder_path: folder.path,
4185
+ workspaceId: mount.workspaceId
4186
+ }));
4178
4187
  } catch {
4179
- return [{ folder_path: mount.directory }];
4188
+ return [{ folder_path: mount.directory, workspaceId: mount.workspaceId }];
4180
4189
  }
4181
4190
  });
4182
4191
  const removalKey = scopeKey(grant.workbenchId, grant.userId, id);
@@ -4957,7 +4966,9 @@ async function fetchWorkbenchIdentity(origin) {
4957
4966
  }
4958
4967
 
4959
4968
  // src/query-routes.ts
4969
+ import fs23 from "node:fs";
4960
4970
  import os8 from "node:os";
4971
+ import path25 from "node:path";
4961
4972
 
4962
4973
  // ../../packages/runtime/src/agent-sessions/service.ts
4963
4974
  import path23 from "node:path";
@@ -5658,23 +5669,32 @@ async function readWorkspaceCommits(mount, offset = 0, refresh = false) {
5658
5669
  // src/query-routes.ts
5659
5670
  function registerQueryRoutes(app, store) {
5660
5671
  const git4 = (fn) => gitExecution.run({ executable: store.state.git }, fn);
5672
+ const cachePath = (root, target) => {
5673
+ let resolved = root;
5674
+ try {
5675
+ resolved = fs23.realpathSync(root);
5676
+ } catch {
5677
+ }
5678
+ return target.startsWith(path25.join(resolved, ".cwm") + path25.sep);
5679
+ };
5661
5680
  app.get("/v1/repositories", async (request) => {
5662
5681
  const grant = requestGrant(request);
5663
5682
  const prefix = scopeKey(grant.workbenchId, grant.userId, "");
5664
- return Object.entries(store.state.repositories).filter(([key]) => key.startsWith(prefix)).map(([key, path29]) => ({ id: key.slice(prefix.length), path: path29 }));
5683
+ const root = store.state.root;
5684
+ return Object.entries(store.state.repositories).filter(([key]) => key.startsWith(prefix)).map(([key, path30]) => ({ id: key.slice(prefix.length), path: path30 })).filter((entry) => !cachePath(root, entry.path));
5665
5685
  });
5666
5686
  app.post("/v1/repositories/inspect", async (request) => {
5667
5687
  const body = request.body;
5668
- const path29 = body.path;
5669
- if (!path29 || !(await import("node:path")).default.isAbsolute(path29))
5688
+ const path30 = body.path;
5689
+ if (!path30 || !(await import("node:path")).default.isAbsolute(path30))
5670
5690
  throw new Error("\u8BF7\u9009\u62E9\u7EDD\u5BF9\u8DEF\u5F84");
5671
5691
  return git4(async () => ({
5672
- root: await runGit(path29, ["rev-parse", "--show-toplevel"]),
5673
- remoteUrl: (await runGit(path29, ["remote", "get-url", "origin"]).catch(() => "")).replace(
5692
+ root: await runGit(path30, ["rev-parse", "--show-toplevel"]),
5693
+ remoteUrl: (await runGit(path30, ["remote", "get-url", "origin"]).catch(() => "")).replace(
5674
5694
  /(https?:\/\/)[^/@\s]+@/gi,
5675
5695
  "$1"
5676
5696
  ),
5677
- branches: (await runGit(path29, [
5697
+ branches: (await runGit(path30, [
5678
5698
  "for-each-ref",
5679
5699
  "--format=%(refname:short)",
5680
5700
  "refs/heads",
@@ -5728,11 +5748,11 @@ function registerQueryRoutes(app, store) {
5728
5748
  }
5729
5749
 
5730
5750
  // src/review-route.ts
5731
- import path26 from "node:path";
5751
+ import path27 from "node:path";
5732
5752
 
5733
5753
  // ../../packages/runtime/src/reviews/audit.ts
5734
- import fs23 from "node:fs";
5735
- import path25 from "node:path";
5754
+ import fs24 from "node:fs";
5755
+ import path26 from "node:path";
5736
5756
 
5737
5757
  // ../../packages/runtime/src/reviews/branch-scope.ts
5738
5758
  var lines = (text) => text ? text.split("\n") : [];
@@ -5933,14 +5953,14 @@ async function auditLocalVersion(initial, root, runId, inputHash, body, log) {
5933
5953
  const valid = (value) => typeof value === "string" && /^[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(value) && !value.includes("..") && !value.endsWith("/");
5934
5954
  if (!valid(production) || !valid(staging) || production === staging)
5935
5955
  throw new Error("\u8BF7\u586B\u5199\u4E0D\u540C\u7684\u6709\u6548\u751F\u4EA7\u3001UAT \u5206\u652F\u540D");
5936
- fs23.mkdirSync(root, { recursive: true });
5956
+ fs24.mkdirSync(root, { recursive: true });
5937
5957
  const results = [], folders = [];
5938
5958
  const groups = [...new Set(includedMounts.map((mount) => mount.repository_id))];
5939
5959
  log("\u5BA1\u67E5\u4ED3\u5E93\u603B\u6570\uFF1A" + groups.length);
5940
5960
  excludedRepositories.forEach((repo) => log("\u5DF2\u6392\u9664\uFF1A" + repo.alias + "\uFF08" + repo.reason + "\uFF09"));
5941
5961
  for (const repositoryId of groups) {
5942
5962
  const entries = includedMounts.filter((entry) => entry.repository_id === repositoryId), repo = entries[0];
5943
- const directory = path25.join(root, repositoryId.replace(/[^a-zA-Z0-9_-]/g, "_"));
5963
+ const directory = path26.join(root, repositoryId.replace(/[^a-zA-Z0-9_-]/g, "_"));
5944
5964
  const result2 = {
5945
5965
  repositoryId,
5946
5966
  alias: repo.alias,
@@ -5956,10 +5976,10 @@ async function auditLocalVersion(initial, root, runId, inputHash, body, log) {
5956
5976
  let remote = repo.remote_url?.trim() || "";
5957
5977
  let localOrigin = false;
5958
5978
  if (!remote) {
5959
- if (!repo.canonical_path || !fs23.existsSync(repo.canonical_path))
5979
+ if (!repo.canonical_path || !fs24.existsSync(repo.canonical_path))
5960
5980
  throw new Error("\u8BF7\u914D\u7F6E\u8FDC\u7A0B\u4ED3\u5E93\u5730\u5740\u6216\u6709\u6548\u672C\u5730\u6765\u6E90");
5961
5981
  remote = await git3(repo.canonical_path, ["config", "--get", "remote.origin.url"]);
5962
- localOrigin = path25.isAbsolute(remote) && fs23.existsSync(remote);
5982
+ localOrigin = path26.isAbsolute(remote) && fs24.existsSync(remote);
5963
5983
  }
5964
5984
  if (!localOrigin && !/^(https:\/\/|ssh:\/\/|[\w.-]+@[\w.-]+:)/.test(remote) || remote.includes("::") || /[\s\x00-\x1f]/.test(remote) || /https?:\/\/[^/]*@/.test(remote))
5965
5985
  throw new Error("\u8FDC\u7AEF\u5730\u5740\u65E0\u6548");
@@ -6021,11 +6041,11 @@ async function auditLocalVersion(initial, root, runId, inputHash, body, log) {
6021
6041
  );
6022
6042
  const stale = false;
6023
6043
  const result = stale ? "STALE" : results.some((repo) => ["ERROR", "CONFLICT"].includes(repo.status)) ? "BLOCKED" : uncoveredRequirements.length || results.some((repo) => repo.status === "WARN") ? "WARN" : "PASS";
6024
- const workspaceFile = path25.join(
6044
+ const workspaceFile = path26.join(
6025
6045
  root,
6026
6046
  "version-" + initial.version.name.replace(/[^A-Za-z0-9._-]/g, "-") + ".code-workspace"
6027
6047
  );
6028
- fs23.writeFileSync(
6048
+ fs24.writeFileSync(
6029
6049
  workspaceFile,
6030
6050
  JSON.stringify(
6031
6051
  { folders, settings: { "codeWorkspace.description": "\u9694\u79BB\u5BA1\u67E5\u5FEB\u7167\uFF1B\u8BF7\u52FF\u7528\u4E8E\u53D1\u5E03\u63A8\u9001" } },
@@ -6048,8 +6068,8 @@ async function auditLocalVersion(initial, root, runId, inputHash, body, log) {
6048
6068
  stale
6049
6069
  };
6050
6070
  const report = readableReport(snapshot, result, createdAt, runId);
6051
- fs23.writeFileSync(path25.join(root, "report.md"), report, { mode: 384 });
6052
- fs23.writeFileSync(path25.join(root, "snapshot.json"), JSON.stringify(snapshot, null, 2), {
6071
+ fs24.writeFileSync(path26.join(root, "report.md"), report, { mode: 384 });
6072
+ fs24.writeFileSync(path26.join(root, "snapshot.json"), JSON.stringify(snapshot, null, 2), {
6053
6073
  mode: 384
6054
6074
  });
6055
6075
  return { runId, result, report, workspaceFile, snapshot, createdAt };
@@ -6081,7 +6101,7 @@ function registerReviewRoute(app, store, jobs) {
6081
6101
  },
6082
6102
  (log) => auditLocalVersion(
6083
6103
  snapshot,
6084
- path26.join(store.directory, "reviews", body.id),
6104
+ path27.join(store.directory, "reviews", body.id),
6085
6105
  body.id,
6086
6106
  body.inputHash,
6087
6107
  body,
@@ -6094,25 +6114,25 @@ function registerReviewRoute(app, store, jobs) {
6094
6114
 
6095
6115
  // src/upgrade.ts
6096
6116
  import { spawn as spawn7 } from "node:child_process";
6097
- import fs24 from "node:fs";
6098
- import path27 from "node:path";
6117
+ import fs25 from "node:fs";
6118
+ import path28 from "node:path";
6099
6119
  function packageRoot(entry) {
6100
- let directory = path27.dirname(path27.resolve(entry));
6120
+ let directory = path28.dirname(path28.resolve(entry));
6101
6121
  for (let depth = 0; depth < 4; depth++) {
6102
- if (fs24.existsSync(path27.join(directory, "package.json"))) return directory;
6103
- directory = path27.dirname(directory);
6122
+ if (fs25.existsSync(path28.join(directory, "package.json"))) return directory;
6123
+ directory = path28.dirname(directory);
6104
6124
  }
6105
- return path27.dirname(path27.dirname(path27.resolve(entry)));
6125
+ return path28.dirname(path28.dirname(path28.resolve(entry)));
6106
6126
  }
6107
6127
  function isGlobalInstall(root, prefix) {
6108
6128
  if (!prefix) return false;
6109
- const relative = path27.relative(path27.resolve(prefix), path27.resolve(root));
6110
- return Boolean(relative) && !relative.startsWith("..") && !path27.isAbsolute(relative);
6129
+ const relative = path28.relative(path28.resolve(prefix), path28.resolve(root));
6130
+ return Boolean(relative) && !relative.startsWith("..") && !path28.isAbsolute(relative);
6111
6131
  }
6112
6132
  function looksGlobal(root) {
6113
- const modules = path27.dirname(path27.resolve(root));
6114
- if (path27.basename(modules) !== "node_modules") return false;
6115
- return !fs24.existsSync(path27.join(path27.dirname(modules), "package.json"));
6133
+ const modules = path28.dirname(path28.resolve(root));
6134
+ if (path28.basename(modules) !== "node_modules") return false;
6135
+ return !fs25.existsSync(path28.join(path28.dirname(modules), "package.json"));
6116
6136
  }
6117
6137
  function isNewer(candidate, current) {
6118
6138
  const parse = (value) => value.split("-")[0].split(".").map((part) => Number(part) || 0);
@@ -6133,10 +6153,10 @@ async function latestPublished() {
6133
6153
  if (!data.version) throw new Error("npm \u8FD4\u56DE\u7684\u7248\u672C\u4FE1\u606F\u65E0\u6548");
6134
6154
  return data.version;
6135
6155
  }
6136
- var statusFile = (store) => path27.join(store.directory, "upgrade.json");
6156
+ var statusFile = (store) => path28.join(store.directory, "upgrade.json");
6137
6157
  function readStatus(store) {
6138
6158
  try {
6139
- return JSON.parse(fs24.readFileSync(statusFile(store), "utf8"));
6159
+ return JSON.parse(fs25.readFileSync(statusFile(store), "utf8"));
6140
6160
  } catch {
6141
6161
  return void 0;
6142
6162
  }
@@ -6180,7 +6200,7 @@ function registerUpgradeRoutes(app, store, entry, options = {}) {
6180
6200
  return reply.code(502).send({ error: cause.message });
6181
6201
  }
6182
6202
  if (!isNewer(latest, ASSISTANT_VERSION)) return { latest, started: false };
6183
- fs24.writeFileSync(
6203
+ fs25.writeFileSync(
6184
6204
  statusFile(store),
6185
6205
  JSON.stringify({ target: latest, state: "running", startedAt: (/* @__PURE__ */ new Date()).toISOString() }),
6186
6206
  { mode: 384 }
@@ -6188,7 +6208,7 @@ function registerUpgradeRoutes(app, store, entry, options = {}) {
6188
6208
  const child = spawn7(
6189
6209
  process.execPath,
6190
6210
  [
6191
- path27.join(root, "scripts", "upgrade.mjs"),
6211
+ path28.join(root, "scripts", "upgrade.mjs"),
6192
6212
  "--version",
6193
6213
  latest,
6194
6214
  "--state-dir",
@@ -6222,7 +6242,7 @@ async function buildAssistant(store, options = {}, entry, upgrade = {}) {
6222
6242
  return;
6223
6243
  }
6224
6244
  const origin = request.headers.origin || "";
6225
- const path29 = request.url.split("?")[0];
6245
+ const path30 = request.url.split("?")[0];
6226
6246
  let workbench = store.state.workbenches[origin];
6227
6247
  if (!workbench && trustedOrigin(origin)) {
6228
6248
  try {
@@ -6245,7 +6265,7 @@ async function buildAssistant(store, options = {}, entry, upgrade = {}) {
6245
6265
  reply.header("Access-Control-Allow-Headers", "Authorization, Content-Type, X-CWM-Binding");
6246
6266
  return reply.code(204).send();
6247
6267
  }
6248
- if (path29 === "/v1/health" || path29 === "/v1/pairings") return;
6268
+ if (path30 === "/v1/health" || path30 === "/v1/pairings") return;
6249
6269
  try {
6250
6270
  const token = request.headers.authorization?.replace(/^Bearer /, "") || "";
6251
6271
  const grant = verifyGrant(token, workbench.publicKey);
@@ -6419,7 +6439,7 @@ async function cli(args, entry) {
6419
6439
  return;
6420
6440
  }
6421
6441
  const dirIndex = args.indexOf("--state-dir");
6422
- const directory = dirIndex >= 0 ? path28.resolve(args[dirIndex + 1]) : defaultStateDirectory();
6442
+ const directory = dirIndex >= 0 ? path29.resolve(args[dirIndex + 1]) : defaultStateDirectory();
6423
6443
  const command = args[0] || "status";
6424
6444
  const store = new StateStore(directory);
6425
6445
  const control = async (action) => {
@@ -6445,7 +6465,7 @@ async function cli(args, entry) {
6445
6465
  }
6446
6466
  if (store.state.autostart) await startAutostart();
6447
6467
  else {
6448
- const log = fs25.openSync(path28.join(directory, "assistant.log"), "a", 384);
6468
+ const log = fs26.openSync(path29.join(directory, "assistant.log"), "a", 384);
6449
6469
  const child = spawn8(process.execPath, [entry, "serve", "--state-dir", directory], {
6450
6470
  detached: true,
6451
6471
  windowsHide: true,
@@ -6455,7 +6475,7 @@ async function cli(args, entry) {
6455
6475
  cwd: directory
6456
6476
  });
6457
6477
  child.unref();
6458
- fs25.closeSync(log);
6478
+ fs26.closeSync(log);
6459
6479
  }
6460
6480
  const deadline = Date.now() + 1e4;
6461
6481
  while (Date.now() < deadline) {
@@ -6470,18 +6490,18 @@ async function cli(args, entry) {
6470
6490
  throw new Error("\u542F\u52A8\u5931\u8D25\uFF0C\u8BF7\u8FD0\u884C cwm-assistant logs \u68C0\u67E5\u7AEF\u53E3\u548C\u8FD0\u884C\u73AF\u5883");
6471
6491
  }
6472
6492
  if (command === "serve") {
6473
- const lock = path28.join(directory, "process.lock");
6474
- if (fs25.existsSync(lock)) {
6475
- const pid = Number(fs25.readFileSync(lock, "utf8"));
6493
+ const lock = path29.join(directory, "process.lock");
6494
+ if (fs26.existsSync(lock)) {
6495
+ const pid = Number(fs26.readFileSync(lock, "utf8"));
6476
6496
  try {
6477
6497
  process.kill(pid, 0);
6478
6498
  throw new Error("Workspace \u52A9\u624B\u5DF2\u8FD0\u884C");
6479
6499
  } catch (error) {
6480
6500
  if (error.code !== "ESRCH") throw error;
6481
- fs25.unlinkSync(lock);
6501
+ fs26.unlinkSync(lock);
6482
6502
  }
6483
6503
  }
6484
- fs25.writeFileSync(lock, String(process.pid), { flag: "wx", mode: 384 });
6504
+ fs26.writeFileSync(lock, String(process.pid), { flag: "wx", mode: 384 });
6485
6505
  store.reload();
6486
6506
  store.recover();
6487
6507
  const { app, jobs } = await buildAssistant(store, {}, entry);
@@ -6505,12 +6525,12 @@ async function cli(args, entry) {
6505
6525
  return reply.code(400).send({ error: "\u63A7\u5236\u64CD\u4F5C\u65E0\u6548" });
6506
6526
  });
6507
6527
  app.addHook("onClose", async () => {
6508
- fs25.rmSync(lock, { force: true });
6528
+ fs26.rmSync(lock, { force: true });
6509
6529
  });
6510
6530
  try {
6511
6531
  await app.listen({ host: "127.0.0.1", port: ASSISTANT_PORT });
6512
6532
  } catch (error) {
6513
- fs25.rmSync(lock, { force: true });
6533
+ fs26.rmSync(lock, { force: true });
6514
6534
  throw error;
6515
6535
  }
6516
6536
  for (const signal of ["SIGTERM", "SIGINT"])
@@ -6535,7 +6555,7 @@ async function cli(args, entry) {
6535
6555
  await control("stop").catch(() => {
6536
6556
  });
6537
6557
  const deadline = Date.now() + 1e4;
6538
- while (fs25.existsSync(path28.join(directory, "process.lock")) && Date.now() < deadline) {
6558
+ while (fs26.existsSync(path29.join(directory, "process.lock")) && Date.now() < deadline) {
6539
6559
  await new Promise((resolve) => setTimeout(resolve, 100));
6540
6560
  }
6541
6561
  }
@@ -6567,9 +6587,9 @@ async function cli(args, entry) {
6567
6587
  return;
6568
6588
  }
6569
6589
  if (command === "logs") {
6570
- const file = path28.join(directory, "assistant.log");
6590
+ const file = path29.join(directory, "assistant.log");
6571
6591
  console.log(
6572
- fs25.existsSync(file) ? fs25.readFileSync(file, "utf8").split("\n").slice(-100).join("\n") : "\u6682\u65E0\u65E5\u5FD7"
6592
+ fs26.existsSync(file) ? fs26.readFileSync(file, "utf8").split("\n").slice(-100).join("\n") : "\u6682\u65E0\u65E5\u5FD7"
6573
6593
  );
6574
6594
  return;
6575
6595
  }
@@ -6584,10 +6604,10 @@ async function cli(args, entry) {
6584
6604
  await control("stop").catch(() => {
6585
6605
  });
6586
6606
  const deadline = Date.now() + 1e4;
6587
- while (fs25.existsSync(path28.join(directory, "process.lock")) && Date.now() < deadline) {
6607
+ while (fs26.existsSync(path29.join(directory, "process.lock")) && Date.now() < deadline) {
6588
6608
  await new Promise((resolve) => setTimeout(resolve, 100));
6589
6609
  }
6590
- if (fs25.existsSync(path28.join(directory, "process.lock")))
6610
+ if (fs26.existsSync(path29.join(directory, "process.lock")))
6591
6611
  throw new Error("\u52A9\u624B\u5C1A\u672A\u505C\u6B62\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\uFF1B\u672A\u4FEE\u6539\u672C\u5730\u72B6\u6001");
6592
6612
  }
6593
6613
  store.reload();
@@ -6622,11 +6642,11 @@ async function cli(args, entry) {
6622
6642
  {
6623
6643
  node: process.version,
6624
6644
  nodePath: process.execPath,
6625
- entryExists: fs25.existsSync(entry),
6645
+ entryExists: fs26.existsSync(entry),
6626
6646
  git: store.state.git,
6627
6647
  gitVersion,
6628
6648
  platform: process.platform,
6629
- rootExists: Boolean(store.state.root && fs25.existsSync(store.state.root)),
6649
+ rootExists: Boolean(store.state.root && fs26.existsSync(store.state.root)),
6630
6650
  configuredWorkbenches: Object.keys(store.state.workbenches),
6631
6651
  autostart: store.state.autostart,
6632
6652
  process: await control("status").catch(() => "\u672A\u8FD0\u884C")
@@ -6667,9 +6687,9 @@ async function cli(args, entry) {
6667
6687
  }
6668
6688
  }
6669
6689
  if (rootArg) {
6670
- if (!path28.isAbsolute(rootArg) || !fs25.statSync(rootArg).isDirectory())
6690
+ if (!path29.isAbsolute(rootArg) || !fs26.statSync(rootArg).isDirectory())
6671
6691
  throw new Error("\u5DE5\u4F5C\u76EE\u5F55\u5FC5\u987B\u662F\u5DF2\u5B58\u5728\u7684\u7EDD\u5BF9\u8DEF\u5F84");
6672
- store.state.root = fs25.realpathSync(rootArg);
6692
+ store.state.root = fs26.realpathSync(rootArg);
6673
6693
  }
6674
6694
  const auto = wantAutostart || !assumeYes && await ask("\u767B\u5F55\u7535\u8111\u65F6\u81EA\u52A8\u542F\u52A8\uFF1F[Y/n] ") !== "n";
6675
6695
  store.save();
@@ -6699,4 +6719,4 @@ async function cli(args, entry) {
6699
6719
  export {
6700
6720
  cli
6701
6721
  };
6702
- //# sourceMappingURL=cli-GT7E2KGC.js.map
6722
+ //# sourceMappingURL=cli-33RDLVJY.js.map