@clawos-dev/clawd 0.2.372 → 0.2.373

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 (2) hide show
  1. package/dist/cli.cjs +206 -170
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -450,8 +450,8 @@ var init_parseUtil = __esm({
450
450
  init_errors();
451
451
  init_en();
452
452
  makeIssue = (params) => {
453
- const { data, path: path85, errorMaps, issueData } = params;
454
- const fullPath = [...path85, ...issueData.path || []];
453
+ const { data, path: path86, errorMaps, issueData } = params;
454
+ const fullPath = [...path86, ...issueData.path || []];
455
455
  const fullIssue = {
456
456
  ...issueData,
457
457
  path: fullPath
@@ -762,11 +762,11 @@ var init_types = __esm({
762
762
  init_parseUtil();
763
763
  init_util();
764
764
  ParseInputLazyPath = class {
765
- constructor(parent, value, path85, key) {
765
+ constructor(parent, value, path86, key) {
766
766
  this._cachedPath = [];
767
767
  this.parent = parent;
768
768
  this.data = value;
769
- this._path = path85;
769
+ this._path = path86;
770
770
  this._key = key;
771
771
  }
772
772
  get path() {
@@ -9003,8 +9003,8 @@ var require_req = __commonJS({
9003
9003
  if (req.originalUrl) {
9004
9004
  _req.url = req.originalUrl;
9005
9005
  } else {
9006
- const path85 = req.path;
9007
- _req.url = typeof path85 === "string" ? path85 : req.url ? req.url.path || req.url : void 0;
9006
+ const path86 = req.path;
9007
+ _req.url = typeof path86 === "string" ? path86 : req.url ? req.url.path || req.url : void 0;
9008
9008
  }
9009
9009
  if (req.query) {
9010
9010
  _req.query = req.query;
@@ -9169,14 +9169,14 @@ var require_redact = __commonJS({
9169
9169
  }
9170
9170
  return obj;
9171
9171
  }
9172
- function parsePath(path85) {
9172
+ function parsePath(path86) {
9173
9173
  const parts = [];
9174
9174
  let current = "";
9175
9175
  let inBrackets = false;
9176
9176
  let inQuotes = false;
9177
9177
  let quoteChar = "";
9178
- for (let i = 0; i < path85.length; i++) {
9179
- const char = path85[i];
9178
+ for (let i = 0; i < path86.length; i++) {
9179
+ const char = path86[i];
9180
9180
  if (!inBrackets && char === ".") {
9181
9181
  if (current) {
9182
9182
  parts.push(current);
@@ -9307,10 +9307,10 @@ var require_redact = __commonJS({
9307
9307
  return current;
9308
9308
  }
9309
9309
  function redactPaths(obj, paths, censor, remove = false) {
9310
- for (const path85 of paths) {
9311
- const parts = parsePath(path85);
9310
+ for (const path86 of paths) {
9311
+ const parts = parsePath(path86);
9312
9312
  if (parts.includes("*")) {
9313
- redactWildcardPath(obj, parts, censor, path85, remove);
9313
+ redactWildcardPath(obj, parts, censor, path86, remove);
9314
9314
  } else {
9315
9315
  if (remove) {
9316
9316
  removeKey(obj, parts);
@@ -9395,8 +9395,8 @@ var require_redact = __commonJS({
9395
9395
  }
9396
9396
  } else {
9397
9397
  if (afterWildcard.includes("*")) {
9398
- const wrappedCensor = typeof censor === "function" ? (value, path85) => {
9399
- const fullPath = [...pathArray.slice(0, pathLength), ...path85];
9398
+ const wrappedCensor = typeof censor === "function" ? (value, path86) => {
9399
+ const fullPath = [...pathArray.slice(0, pathLength), ...path86];
9400
9400
  return censor(value, fullPath);
9401
9401
  } : censor;
9402
9402
  redactWildcardPath(current, afterWildcard, wrappedCensor, originalPath, remove);
@@ -9431,8 +9431,8 @@ var require_redact = __commonJS({
9431
9431
  return null;
9432
9432
  }
9433
9433
  const pathStructure = /* @__PURE__ */ new Map();
9434
- for (const path85 of pathsToClone) {
9435
- const parts = parsePath(path85);
9434
+ for (const path86 of pathsToClone) {
9435
+ const parts = parsePath(path86);
9436
9436
  let current = pathStructure;
9437
9437
  for (let i = 0; i < parts.length; i++) {
9438
9438
  const part = parts[i];
@@ -9484,24 +9484,24 @@ var require_redact = __commonJS({
9484
9484
  }
9485
9485
  return cloneSelectively(obj, pathStructure);
9486
9486
  }
9487
- function validatePath(path85) {
9488
- if (typeof path85 !== "string") {
9487
+ function validatePath(path86) {
9488
+ if (typeof path86 !== "string") {
9489
9489
  throw new Error("Paths must be (non-empty) strings");
9490
9490
  }
9491
- if (path85 === "") {
9491
+ if (path86 === "") {
9492
9492
  throw new Error("Invalid redaction path ()");
9493
9493
  }
9494
- if (path85.includes("..")) {
9495
- throw new Error(`Invalid redaction path (${path85})`);
9494
+ if (path86.includes("..")) {
9495
+ throw new Error(`Invalid redaction path (${path86})`);
9496
9496
  }
9497
- if (path85.includes(",")) {
9498
- throw new Error(`Invalid redaction path (${path85})`);
9497
+ if (path86.includes(",")) {
9498
+ throw new Error(`Invalid redaction path (${path86})`);
9499
9499
  }
9500
9500
  let bracketCount = 0;
9501
9501
  let inQuotes = false;
9502
9502
  let quoteChar = "";
9503
- for (let i = 0; i < path85.length; i++) {
9504
- const char = path85[i];
9503
+ for (let i = 0; i < path86.length; i++) {
9504
+ const char = path86[i];
9505
9505
  if ((char === '"' || char === "'") && bracketCount > 0) {
9506
9506
  if (!inQuotes) {
9507
9507
  inQuotes = true;
@@ -9515,20 +9515,20 @@ var require_redact = __commonJS({
9515
9515
  } else if (char === "]" && !inQuotes) {
9516
9516
  bracketCount--;
9517
9517
  if (bracketCount < 0) {
9518
- throw new Error(`Invalid redaction path (${path85})`);
9518
+ throw new Error(`Invalid redaction path (${path86})`);
9519
9519
  }
9520
9520
  }
9521
9521
  }
9522
9522
  if (bracketCount !== 0) {
9523
- throw new Error(`Invalid redaction path (${path85})`);
9523
+ throw new Error(`Invalid redaction path (${path86})`);
9524
9524
  }
9525
9525
  }
9526
9526
  function validatePaths(paths) {
9527
9527
  if (!Array.isArray(paths)) {
9528
9528
  throw new TypeError("paths must be an array");
9529
9529
  }
9530
- for (const path85 of paths) {
9531
- validatePath(path85);
9530
+ for (const path86 of paths) {
9531
+ validatePath(path86);
9532
9532
  }
9533
9533
  }
9534
9534
  function slowRedact(options = {}) {
@@ -9696,8 +9696,8 @@ var require_redaction = __commonJS({
9696
9696
  if (shape[k2] === null) {
9697
9697
  o[k2] = (value) => topCensor(value, [k2]);
9698
9698
  } else {
9699
- const wrappedCensor = typeof censor === "function" ? (value, path85) => {
9700
- return censor(value, [k2, ...path85]);
9699
+ const wrappedCensor = typeof censor === "function" ? (value, path86) => {
9700
+ return censor(value, [k2, ...path86]);
9701
9701
  } : censor;
9702
9702
  o[k2] = Redact({
9703
9703
  paths: shape[k2],
@@ -9915,10 +9915,10 @@ var require_atomic_sleep = __commonJS({
9915
9915
  var require_sonic_boom = __commonJS({
9916
9916
  "../node_modules/.pnpm/sonic-boom@4.2.1/node_modules/sonic-boom/index.js"(exports2, module2) {
9917
9917
  "use strict";
9918
- var fs76 = require("fs");
9918
+ var fs77 = require("fs");
9919
9919
  var EventEmitter3 = require("events");
9920
9920
  var inherits = require("util").inherits;
9921
- var path85 = require("path");
9921
+ var path86 = require("path");
9922
9922
  var sleep2 = require_atomic_sleep();
9923
9923
  var assert = require("assert");
9924
9924
  var BUSY_WRITE_TIMEOUT = 100;
@@ -9972,20 +9972,20 @@ var require_sonic_boom = __commonJS({
9972
9972
  const mode = sonic.mode;
9973
9973
  if (sonic.sync) {
9974
9974
  try {
9975
- if (sonic.mkdir) fs76.mkdirSync(path85.dirname(file), { recursive: true });
9976
- const fd = fs76.openSync(file, flags, mode);
9975
+ if (sonic.mkdir) fs77.mkdirSync(path86.dirname(file), { recursive: true });
9976
+ const fd = fs77.openSync(file, flags, mode);
9977
9977
  fileOpened(null, fd);
9978
9978
  } catch (err) {
9979
9979
  fileOpened(err);
9980
9980
  throw err;
9981
9981
  }
9982
9982
  } else if (sonic.mkdir) {
9983
- fs76.mkdir(path85.dirname(file), { recursive: true }, (err) => {
9983
+ fs77.mkdir(path86.dirname(file), { recursive: true }, (err) => {
9984
9984
  if (err) return fileOpened(err);
9985
- fs76.open(file, flags, mode, fileOpened);
9985
+ fs77.open(file, flags, mode, fileOpened);
9986
9986
  });
9987
9987
  } else {
9988
- fs76.open(file, flags, mode, fileOpened);
9988
+ fs77.open(file, flags, mode, fileOpened);
9989
9989
  }
9990
9990
  }
9991
9991
  function SonicBoom(opts) {
@@ -10026,8 +10026,8 @@ var require_sonic_boom = __commonJS({
10026
10026
  this.flush = flushBuffer;
10027
10027
  this.flushSync = flushBufferSync;
10028
10028
  this._actualWrite = actualWriteBuffer;
10029
- fsWriteSync = () => fs76.writeSync(this.fd, this._writingBuf);
10030
- fsWrite = () => fs76.write(this.fd, this._writingBuf, this.release);
10029
+ fsWriteSync = () => fs77.writeSync(this.fd, this._writingBuf);
10030
+ fsWrite = () => fs77.write(this.fd, this._writingBuf, this.release);
10031
10031
  } else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
10032
10032
  this._writingBuf = "";
10033
10033
  this.write = write;
@@ -10036,15 +10036,15 @@ var require_sonic_boom = __commonJS({
10036
10036
  this._actualWrite = actualWrite;
10037
10037
  fsWriteSync = () => {
10038
10038
  if (Buffer.isBuffer(this._writingBuf)) {
10039
- return fs76.writeSync(this.fd, this._writingBuf);
10039
+ return fs77.writeSync(this.fd, this._writingBuf);
10040
10040
  }
10041
- return fs76.writeSync(this.fd, this._writingBuf, "utf8");
10041
+ return fs77.writeSync(this.fd, this._writingBuf, "utf8");
10042
10042
  };
10043
10043
  fsWrite = () => {
10044
10044
  if (Buffer.isBuffer(this._writingBuf)) {
10045
- return fs76.write(this.fd, this._writingBuf, this.release);
10045
+ return fs77.write(this.fd, this._writingBuf, this.release);
10046
10046
  }
10047
- return fs76.write(this.fd, this._writingBuf, "utf8", this.release);
10047
+ return fs77.write(this.fd, this._writingBuf, "utf8", this.release);
10048
10048
  };
10049
10049
  } else {
10050
10050
  throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
@@ -10101,7 +10101,7 @@ var require_sonic_boom = __commonJS({
10101
10101
  }
10102
10102
  }
10103
10103
  if (this._fsync) {
10104
- fs76.fsyncSync(this.fd);
10104
+ fs77.fsyncSync(this.fd);
10105
10105
  }
10106
10106
  const len = this._len;
10107
10107
  if (this._reopening) {
@@ -10215,7 +10215,7 @@ var require_sonic_boom = __commonJS({
10215
10215
  const onDrain = () => {
10216
10216
  if (!this._fsync) {
10217
10217
  try {
10218
- fs76.fsync(this.fd, (err) => {
10218
+ fs77.fsync(this.fd, (err) => {
10219
10219
  this._flushPending = false;
10220
10220
  cb(err);
10221
10221
  });
@@ -10317,7 +10317,7 @@ var require_sonic_boom = __commonJS({
10317
10317
  const fd = this.fd;
10318
10318
  this.once("ready", () => {
10319
10319
  if (fd !== this.fd) {
10320
- fs76.close(fd, (err) => {
10320
+ fs77.close(fd, (err) => {
10321
10321
  if (err) {
10322
10322
  return this.emit("error", err);
10323
10323
  }
@@ -10366,7 +10366,7 @@ var require_sonic_boom = __commonJS({
10366
10366
  buf = this._bufs[0];
10367
10367
  }
10368
10368
  try {
10369
- const n = Buffer.isBuffer(buf) ? fs76.writeSync(this.fd, buf) : fs76.writeSync(this.fd, buf, "utf8");
10369
+ const n = Buffer.isBuffer(buf) ? fs77.writeSync(this.fd, buf) : fs77.writeSync(this.fd, buf, "utf8");
10370
10370
  const releasedBufObj = releaseWritingBuf(buf, this._len, n);
10371
10371
  buf = releasedBufObj.writingBuf;
10372
10372
  this._len = releasedBufObj.len;
@@ -10382,7 +10382,7 @@ var require_sonic_boom = __commonJS({
10382
10382
  }
10383
10383
  }
10384
10384
  try {
10385
- fs76.fsyncSync(this.fd);
10385
+ fs77.fsyncSync(this.fd);
10386
10386
  } catch {
10387
10387
  }
10388
10388
  }
@@ -10403,7 +10403,7 @@ var require_sonic_boom = __commonJS({
10403
10403
  buf = mergeBuf(this._bufs[0], this._lens[0]);
10404
10404
  }
10405
10405
  try {
10406
- const n = fs76.writeSync(this.fd, buf);
10406
+ const n = fs77.writeSync(this.fd, buf);
10407
10407
  buf = buf.subarray(n);
10408
10408
  this._len = Math.max(this._len - n, 0);
10409
10409
  if (buf.length <= 0) {
@@ -10431,13 +10431,13 @@ var require_sonic_boom = __commonJS({
10431
10431
  this._writingBuf = this._writingBuf.length ? this._writingBuf : this._bufs.shift() || "";
10432
10432
  if (this.sync) {
10433
10433
  try {
10434
- const written = Buffer.isBuffer(this._writingBuf) ? fs76.writeSync(this.fd, this._writingBuf) : fs76.writeSync(this.fd, this._writingBuf, "utf8");
10434
+ const written = Buffer.isBuffer(this._writingBuf) ? fs77.writeSync(this.fd, this._writingBuf) : fs77.writeSync(this.fd, this._writingBuf, "utf8");
10435
10435
  release(null, written);
10436
10436
  } catch (err) {
10437
10437
  release(err);
10438
10438
  }
10439
10439
  } else {
10440
- fs76.write(this.fd, this._writingBuf, release);
10440
+ fs77.write(this.fd, this._writingBuf, release);
10441
10441
  }
10442
10442
  }
10443
10443
  function actualWriteBuffer() {
@@ -10446,7 +10446,7 @@ var require_sonic_boom = __commonJS({
10446
10446
  this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
10447
10447
  if (this.sync) {
10448
10448
  try {
10449
- const written = fs76.writeSync(this.fd, this._writingBuf);
10449
+ const written = fs77.writeSync(this.fd, this._writingBuf);
10450
10450
  release(null, written);
10451
10451
  } catch (err) {
10452
10452
  release(err);
@@ -10455,7 +10455,7 @@ var require_sonic_boom = __commonJS({
10455
10455
  if (kCopyBuffer) {
10456
10456
  this._writingBuf = Buffer.from(this._writingBuf);
10457
10457
  }
10458
- fs76.write(this.fd, this._writingBuf, release);
10458
+ fs77.write(this.fd, this._writingBuf, release);
10459
10459
  }
10460
10460
  }
10461
10461
  function actualClose(sonic) {
@@ -10471,12 +10471,12 @@ var require_sonic_boom = __commonJS({
10471
10471
  sonic._lens = [];
10472
10472
  assert(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
10473
10473
  try {
10474
- fs76.fsync(sonic.fd, closeWrapped);
10474
+ fs77.fsync(sonic.fd, closeWrapped);
10475
10475
  } catch {
10476
10476
  }
10477
10477
  function closeWrapped() {
10478
10478
  if (sonic.fd !== 1 && sonic.fd !== 2) {
10479
- fs76.close(sonic.fd, done);
10479
+ fs77.close(sonic.fd, done);
10480
10480
  } else {
10481
10481
  done();
10482
10482
  }
@@ -10733,7 +10733,7 @@ var require_thread_stream = __commonJS({
10733
10733
  var { version: version2 } = require_package();
10734
10734
  var { EventEmitter: EventEmitter3 } = require("events");
10735
10735
  var { Worker } = require("worker_threads");
10736
- var { join: join18 } = require("path");
10736
+ var { join: join19 } = require("path");
10737
10737
  var { pathToFileURL } = require("url");
10738
10738
  var { wait } = require_wait();
10739
10739
  var {
@@ -10769,7 +10769,7 @@ var require_thread_stream = __commonJS({
10769
10769
  function createWorker(stream, opts) {
10770
10770
  const { filename, workerData } = opts;
10771
10771
  const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
10772
- const toExecute = bundlerOverrides["thread-stream-worker"] || join18(__dirname, "lib", "worker.js");
10772
+ const toExecute = bundlerOverrides["thread-stream-worker"] || join19(__dirname, "lib", "worker.js");
10773
10773
  const worker = new Worker(toExecute, {
10774
10774
  ...opts.workerOpts,
10775
10775
  trackUnmanagedFds: false,
@@ -11155,7 +11155,7 @@ var require_transport = __commonJS({
11155
11155
  "use strict";
11156
11156
  var { createRequire: createRequire2 } = require("module");
11157
11157
  var getCallers = require_caller();
11158
- var { join: join18, isAbsolute: isAbsolute4, sep: sep5 } = require("path");
11158
+ var { join: join19, isAbsolute: isAbsolute4, sep: sep5 } = require("path");
11159
11159
  var sleep2 = require_atomic_sleep();
11160
11160
  var onExit = require_on_exit_leak_free();
11161
11161
  var ThreadStream = require_thread_stream();
@@ -11218,7 +11218,7 @@ var require_transport = __commonJS({
11218
11218
  throw new Error("only one of target or targets can be specified");
11219
11219
  }
11220
11220
  if (targets) {
11221
- target = bundlerOverrides["pino-worker"] || join18(__dirname, "worker.js");
11221
+ target = bundlerOverrides["pino-worker"] || join19(__dirname, "worker.js");
11222
11222
  options.targets = targets.filter((dest) => dest.target).map((dest) => {
11223
11223
  return {
11224
11224
  ...dest,
@@ -11236,7 +11236,7 @@ var require_transport = __commonJS({
11236
11236
  });
11237
11237
  });
11238
11238
  } else if (pipeline3) {
11239
- target = bundlerOverrides["pino-worker"] || join18(__dirname, "worker.js");
11239
+ target = bundlerOverrides["pino-worker"] || join19(__dirname, "worker.js");
11240
11240
  options.pipelines = [pipeline3.map((dest) => {
11241
11241
  return {
11242
11242
  ...dest,
@@ -11258,7 +11258,7 @@ var require_transport = __commonJS({
11258
11258
  return origin;
11259
11259
  }
11260
11260
  if (origin === "pino/file") {
11261
- return join18(__dirname, "..", "file.js");
11261
+ return join19(__dirname, "..", "file.js");
11262
11262
  }
11263
11263
  let fixTarget2;
11264
11264
  for (const filePath of callers) {
@@ -12248,7 +12248,7 @@ var require_safe_stable_stringify = __commonJS({
12248
12248
  return circularValue;
12249
12249
  }
12250
12250
  let res = "";
12251
- let join18 = ",";
12251
+ let join19 = ",";
12252
12252
  const originalIndentation = indentation;
12253
12253
  if (Array.isArray(value)) {
12254
12254
  if (value.length === 0) {
@@ -12262,7 +12262,7 @@ var require_safe_stable_stringify = __commonJS({
12262
12262
  indentation += spacer;
12263
12263
  res += `
12264
12264
  ${indentation}`;
12265
- join18 = `,
12265
+ join19 = `,
12266
12266
  ${indentation}`;
12267
12267
  }
12268
12268
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -12270,13 +12270,13 @@ ${indentation}`;
12270
12270
  for (; i < maximumValuesToStringify - 1; i++) {
12271
12271
  const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
12272
12272
  res += tmp2 !== void 0 ? tmp2 : "null";
12273
- res += join18;
12273
+ res += join19;
12274
12274
  }
12275
12275
  const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
12276
12276
  res += tmp !== void 0 ? tmp : "null";
12277
12277
  if (value.length - 1 > maximumBreadth) {
12278
12278
  const removedKeys = value.length - maximumBreadth - 1;
12279
- res += `${join18}"... ${getItemCount(removedKeys)} not stringified"`;
12279
+ res += `${join19}"... ${getItemCount(removedKeys)} not stringified"`;
12280
12280
  }
12281
12281
  if (spacer !== "") {
12282
12282
  res += `
@@ -12297,7 +12297,7 @@ ${originalIndentation}`;
12297
12297
  let separator = "";
12298
12298
  if (spacer !== "") {
12299
12299
  indentation += spacer;
12300
- join18 = `,
12300
+ join19 = `,
12301
12301
  ${indentation}`;
12302
12302
  whitespace = " ";
12303
12303
  }
@@ -12311,13 +12311,13 @@ ${indentation}`;
12311
12311
  const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
12312
12312
  if (tmp !== void 0) {
12313
12313
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
12314
- separator = join18;
12314
+ separator = join19;
12315
12315
  }
12316
12316
  }
12317
12317
  if (keyLength > maximumBreadth) {
12318
12318
  const removedKeys = keyLength - maximumBreadth;
12319
12319
  res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
12320
- separator = join18;
12320
+ separator = join19;
12321
12321
  }
12322
12322
  if (spacer !== "" && separator.length > 1) {
12323
12323
  res = `
@@ -12358,7 +12358,7 @@ ${originalIndentation}`;
12358
12358
  }
12359
12359
  const originalIndentation = indentation;
12360
12360
  let res = "";
12361
- let join18 = ",";
12361
+ let join19 = ",";
12362
12362
  if (Array.isArray(value)) {
12363
12363
  if (value.length === 0) {
12364
12364
  return "[]";
@@ -12371,7 +12371,7 @@ ${originalIndentation}`;
12371
12371
  indentation += spacer;
12372
12372
  res += `
12373
12373
  ${indentation}`;
12374
- join18 = `,
12374
+ join19 = `,
12375
12375
  ${indentation}`;
12376
12376
  }
12377
12377
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -12379,13 +12379,13 @@ ${indentation}`;
12379
12379
  for (; i < maximumValuesToStringify - 1; i++) {
12380
12380
  const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
12381
12381
  res += tmp2 !== void 0 ? tmp2 : "null";
12382
- res += join18;
12382
+ res += join19;
12383
12383
  }
12384
12384
  const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
12385
12385
  res += tmp !== void 0 ? tmp : "null";
12386
12386
  if (value.length - 1 > maximumBreadth) {
12387
12387
  const removedKeys = value.length - maximumBreadth - 1;
12388
- res += `${join18}"... ${getItemCount(removedKeys)} not stringified"`;
12388
+ res += `${join19}"... ${getItemCount(removedKeys)} not stringified"`;
12389
12389
  }
12390
12390
  if (spacer !== "") {
12391
12391
  res += `
@@ -12398,7 +12398,7 @@ ${originalIndentation}`;
12398
12398
  let whitespace = "";
12399
12399
  if (spacer !== "") {
12400
12400
  indentation += spacer;
12401
- join18 = `,
12401
+ join19 = `,
12402
12402
  ${indentation}`;
12403
12403
  whitespace = " ";
12404
12404
  }
@@ -12407,7 +12407,7 @@ ${indentation}`;
12407
12407
  const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
12408
12408
  if (tmp !== void 0) {
12409
12409
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
12410
- separator = join18;
12410
+ separator = join19;
12411
12411
  }
12412
12412
  }
12413
12413
  if (spacer !== "" && separator.length > 1) {
@@ -12465,20 +12465,20 @@ ${originalIndentation}`;
12465
12465
  indentation += spacer;
12466
12466
  let res2 = `
12467
12467
  ${indentation}`;
12468
- const join19 = `,
12468
+ const join20 = `,
12469
12469
  ${indentation}`;
12470
12470
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
12471
12471
  let i = 0;
12472
12472
  for (; i < maximumValuesToStringify - 1; i++) {
12473
12473
  const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
12474
12474
  res2 += tmp2 !== void 0 ? tmp2 : "null";
12475
- res2 += join19;
12475
+ res2 += join20;
12476
12476
  }
12477
12477
  const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
12478
12478
  res2 += tmp !== void 0 ? tmp : "null";
12479
12479
  if (value.length - 1 > maximumBreadth) {
12480
12480
  const removedKeys = value.length - maximumBreadth - 1;
12481
- res2 += `${join19}"... ${getItemCount(removedKeys)} not stringified"`;
12481
+ res2 += `${join20}"... ${getItemCount(removedKeys)} not stringified"`;
12482
12482
  }
12483
12483
  res2 += `
12484
12484
  ${originalIndentation}`;
@@ -12494,16 +12494,16 @@ ${originalIndentation}`;
12494
12494
  return '"[Object]"';
12495
12495
  }
12496
12496
  indentation += spacer;
12497
- const join18 = `,
12497
+ const join19 = `,
12498
12498
  ${indentation}`;
12499
12499
  let res = "";
12500
12500
  let separator = "";
12501
12501
  let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
12502
12502
  if (isTypedArrayWithEntries(value)) {
12503
- res += stringifyTypedArray(value, join18, maximumBreadth);
12503
+ res += stringifyTypedArray(value, join19, maximumBreadth);
12504
12504
  keys = keys.slice(value.length);
12505
12505
  maximumPropertiesToStringify -= value.length;
12506
- separator = join18;
12506
+ separator = join19;
12507
12507
  }
12508
12508
  if (deterministic) {
12509
12509
  keys = sort(keys, comparator);
@@ -12514,13 +12514,13 @@ ${indentation}`;
12514
12514
  const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
12515
12515
  if (tmp !== void 0) {
12516
12516
  res += `${separator}${strEscape(key2)}: ${tmp}`;
12517
- separator = join18;
12517
+ separator = join19;
12518
12518
  }
12519
12519
  }
12520
12520
  if (keyLength > maximumBreadth) {
12521
12521
  const removedKeys = keyLength - maximumBreadth;
12522
12522
  res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
12523
- separator = join18;
12523
+ separator = join19;
12524
12524
  }
12525
12525
  if (separator !== "") {
12526
12526
  res = `
@@ -13611,11 +13611,11 @@ var init_lib = __esm({
13611
13611
  }
13612
13612
  }
13613
13613
  },
13614
- addToPath: function addToPath(path85, added, removed, oldPosInc, options) {
13615
- var last = path85.lastComponent;
13614
+ addToPath: function addToPath(path86, added, removed, oldPosInc, options) {
13615
+ var last = path86.lastComponent;
13616
13616
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
13617
13617
  return {
13618
- oldPos: path85.oldPos + oldPosInc,
13618
+ oldPos: path86.oldPos + oldPosInc,
13619
13619
  lastComponent: {
13620
13620
  count: last.count + 1,
13621
13621
  added,
@@ -13625,7 +13625,7 @@ var init_lib = __esm({
13625
13625
  };
13626
13626
  } else {
13627
13627
  return {
13628
- oldPos: path85.oldPos + oldPosInc,
13628
+ oldPos: path86.oldPos + oldPosInc,
13629
13629
  lastComponent: {
13630
13630
  count: 1,
13631
13631
  added,
@@ -14157,10 +14157,10 @@ function attachmentToHistoryMessage(o, ts) {
14157
14157
  const memories = raw.map((m2) => {
14158
14158
  if (!m2 || typeof m2 !== "object") return null;
14159
14159
  const rec4 = m2;
14160
- const path85 = typeof rec4.path === "string" ? rec4.path : null;
14160
+ const path86 = typeof rec4.path === "string" ? rec4.path : null;
14161
14161
  const content = typeof rec4.content === "string" ? rec4.content : null;
14162
- if (!path85 || content == null) return null;
14163
- const entry = { path: path85, content };
14162
+ if (!path86 || content == null) return null;
14163
+ const entry = { path: path86, content };
14164
14164
  if (typeof rec4.mtimeMs === "number") entry.mtimeMs = rec4.mtimeMs;
14165
14165
  return entry;
14166
14166
  }).filter((m2) => m2 !== null);
@@ -15011,10 +15011,10 @@ function parseAttachment(obj) {
15011
15011
  const memories = raw.map((m2) => {
15012
15012
  if (!m2 || typeof m2 !== "object") return null;
15013
15013
  const rec4 = m2;
15014
- const path85 = typeof rec4.path === "string" ? rec4.path : null;
15014
+ const path86 = typeof rec4.path === "string" ? rec4.path : null;
15015
15015
  const content = typeof rec4.content === "string" ? rec4.content : null;
15016
- if (!path85 || content == null) return null;
15017
- const out = { path: path85, content };
15016
+ if (!path86 || content == null) return null;
15017
+ const out = { path: path86, content };
15018
15018
  if (typeof rec4.mtimeMs === "number") out.mtimeMs = rec4.mtimeMs;
15019
15019
  return out;
15020
15020
  }).filter((m2) => m2 !== null);
@@ -29396,8 +29396,8 @@ var require_CronFileParser = __commonJS({
29396
29396
  * @throws If file cannot be read
29397
29397
  */
29398
29398
  static parseFileSync(filePath) {
29399
- const { readFileSync: readFileSync9 } = require("fs");
29400
- const data = readFileSync9(filePath, "utf8");
29399
+ const { readFileSync: readFileSync10 } = require("fs");
29400
+ const data = readFileSync10(filePath, "utf8");
29401
29401
  return _CronFileParser.#parseContent(data);
29402
29402
  }
29403
29403
  /**
@@ -33398,7 +33398,7 @@ var require_BufferList = __commonJS({
33398
33398
  this.head = this.tail = null;
33399
33399
  this.length = 0;
33400
33400
  };
33401
- BufferList.prototype.join = function join18(s) {
33401
+ BufferList.prototype.join = function join19(s) {
33402
33402
  if (this.length === 0) return "";
33403
33403
  var p2 = this.head;
33404
33404
  var ret = "" + p2.data;
@@ -35988,8 +35988,8 @@ var require_utils = __commonJS({
35988
35988
  var result = transform[inputType][outputType](input);
35989
35989
  return result;
35990
35990
  };
35991
- exports2.resolve = function(path85) {
35992
- var parts = path85.split("/");
35991
+ exports2.resolve = function(path86) {
35992
+ var parts = path86.split("/");
35993
35993
  var result = [];
35994
35994
  for (var index = 0; index < parts.length; index++) {
35995
35995
  var part = parts[index];
@@ -41842,18 +41842,18 @@ var require_object = __commonJS({
41842
41842
  var object = new ZipObject(name, zipObjectContent, o);
41843
41843
  this.files[name] = object;
41844
41844
  };
41845
- var parentFolder = function(path85) {
41846
- if (path85.slice(-1) === "/") {
41847
- path85 = path85.substring(0, path85.length - 1);
41845
+ var parentFolder = function(path86) {
41846
+ if (path86.slice(-1) === "/") {
41847
+ path86 = path86.substring(0, path86.length - 1);
41848
41848
  }
41849
- var lastSlash = path85.lastIndexOf("/");
41850
- return lastSlash > 0 ? path85.substring(0, lastSlash) : "";
41849
+ var lastSlash = path86.lastIndexOf("/");
41850
+ return lastSlash > 0 ? path86.substring(0, lastSlash) : "";
41851
41851
  };
41852
- var forceTrailingSlash = function(path85) {
41853
- if (path85.slice(-1) !== "/") {
41854
- path85 += "/";
41852
+ var forceTrailingSlash = function(path86) {
41853
+ if (path86.slice(-1) !== "/") {
41854
+ path86 += "/";
41855
41855
  }
41856
- return path85;
41856
+ return path86;
41857
41857
  };
41858
41858
  var folderAdd = function(name, createFolders) {
41859
41859
  createFolders = typeof createFolders !== "undefined" ? createFolders : defaults.createFolders;
@@ -50229,8 +50229,8 @@ function turnStartInput(text) {
50229
50229
  const items = [];
50230
50230
  let leftover = text;
50231
50231
  for (const m2 of text.matchAll(SKILL_RE)) {
50232
- const [marker, name, path85] = m2;
50233
- items.push({ type: "skill", name, path: path85 });
50232
+ const [marker, name, path86] = m2;
50233
+ items.push({ type: "skill", name, path: path86 });
50234
50234
  leftover = leftover.replace(marker, "");
50235
50235
  }
50236
50236
  for (const m2 of text.matchAll(ATTACHMENT_RE2)) {
@@ -54387,13 +54387,13 @@ function mapSkillsListResponse(res) {
54387
54387
  const r = s ?? {};
54388
54388
  const name = str3(r.name);
54389
54389
  if (!name) continue;
54390
- const path85 = str3(r.path);
54390
+ const path86 = str3(r.path);
54391
54391
  const description = str3(r.description);
54392
54392
  const isPlugin = name.includes(":");
54393
54393
  out.push({
54394
54394
  name,
54395
54395
  source: isPlugin ? "plugin" : "project",
54396
- ...path85 ? { path: path85 } : {},
54396
+ ...path86 ? { path: path86 } : {},
54397
54397
  ...description ? { description } : {},
54398
54398
  ...isPlugin ? { plugin: name.split(":")[0] } : {}
54399
54399
  });
@@ -56495,6 +56495,36 @@ function rmdirIfEmpty(p2) {
56495
56495
  }
56496
56496
  }
56497
56497
 
56498
+ // src/migrations/2026-08-18-drop-seeded-projects.ts
56499
+ var fs44 = __toESM(require("fs"), 1);
56500
+ var path45 = __toESM(require("path"), 1);
56501
+ var DROP_SEEDED_PROJECTS_FLAG = ".projects-seed-dropped.v1.done";
56502
+ function dropSeededProjects(opts) {
56503
+ fs44.mkdirSync(opts.dataDir, { recursive: true });
56504
+ const flag = path45.join(opts.dataDir, DROP_SEEDED_PROJECTS_FLAG);
56505
+ if (fs44.existsSync(flag)) return { skipped: true, dropped: 0, backup: null };
56506
+ const file = path45.join(opts.dataDir, "projects.json");
56507
+ let raw = null;
56508
+ let dropped = 0;
56509
+ try {
56510
+ raw = fs44.readFileSync(file, "utf8");
56511
+ dropped = JSON.parse(raw).projects?.length ?? 0;
56512
+ } catch {
56513
+ }
56514
+ let backup = null;
56515
+ if (raw != null && dropped > 0) {
56516
+ const dir = path45.join(opts.dataDir, "backups");
56517
+ fs44.mkdirSync(dir, { recursive: true });
56518
+ backup = path45.join(dir, `projects.seed-dropped.${(opts.now ?? Date.now)()}.json`);
56519
+ fs44.writeFileSync(backup, raw);
56520
+ }
56521
+ if (raw != null || dropped > 0) {
56522
+ fs44.writeFileSync(file, JSON.stringify({ projects: [] }, null, 2));
56523
+ }
56524
+ fs44.writeFileSync(flag, (/* @__PURE__ */ new Date()).toISOString());
56525
+ return { skipped: false, dropped, backup };
56526
+ }
56527
+
56498
56528
  // src/transport/http-router.ts
56499
56529
  var import_node_fs34 = __toESM(require("fs"), 1);
56500
56530
  var import_node_path38 = __toESM(require("path"), 1);
@@ -58657,9 +58687,9 @@ var CentralClientError = class extends Error {
58657
58687
  code;
58658
58688
  cause;
58659
58689
  };
58660
- async function centralRequest(opts, path85, init) {
58690
+ async function centralRequest(opts, path86, init) {
58661
58691
  const f = opts.fetchImpl ?? globalThis.fetch;
58662
- const url = `${opts.api.replace(/\/+$/, "")}${path85}`;
58692
+ const url = `${opts.api.replace(/\/+$/, "")}${path86}`;
58663
58693
  const ctrl = new AbortController();
58664
58694
  const timer = setTimeout(() => ctrl.abort(), opts.timeoutMs ?? 15e3);
58665
58695
  let res;
@@ -58853,8 +58883,8 @@ function verifyConnectToken(args) {
58853
58883
  }
58854
58884
 
58855
58885
  // src/feishu-auth/server-key.ts
58856
- var fs57 = __toESM(require("fs"), 1);
58857
- var path60 = __toESM(require("path"), 1);
58886
+ var fs58 = __toESM(require("fs"), 1);
58887
+ var path61 = __toESM(require("path"), 1);
58858
58888
  var FILE_NAME2 = "server-signing-key.json";
58859
58889
  var ServerKeyStore = class {
58860
58890
  constructor(dataDir) {
@@ -58862,12 +58892,12 @@ var ServerKeyStore = class {
58862
58892
  }
58863
58893
  dataDir;
58864
58894
  filePath() {
58865
- return path60.join(this.dataDir, FILE_NAME2);
58895
+ return path61.join(this.dataDir, FILE_NAME2);
58866
58896
  }
58867
58897
  /** 读缓存的公钥;无缓存 / 损坏 → null(调用方决定是否触发拉取) */
58868
58898
  read() {
58869
58899
  try {
58870
- const raw = fs57.readFileSync(this.filePath(), "utf8");
58900
+ const raw = fs58.readFileSync(this.filePath(), "utf8");
58871
58901
  const parsed = JSON.parse(raw);
58872
58902
  if (typeof parsed.publicKeyPem === "string" && parsed.publicKeyPem.includes("PUBLIC KEY")) {
58873
58903
  return parsed.publicKeyPem;
@@ -58882,12 +58912,12 @@ var ServerKeyStore = class {
58882
58912
  publicKeyPem,
58883
58913
  fetchedAt: (/* @__PURE__ */ new Date()).toISOString()
58884
58914
  };
58885
- fs57.mkdirSync(this.dataDir, { recursive: true });
58886
- fs57.writeFileSync(this.filePath(), JSON.stringify(content, null, 2), { mode: 384 });
58915
+ fs58.mkdirSync(this.dataDir, { recursive: true });
58916
+ fs58.writeFileSync(this.filePath(), JSON.stringify(content, null, 2), { mode: 384 });
58887
58917
  }
58888
58918
  clear() {
58889
58919
  try {
58890
- fs57.unlinkSync(this.filePath());
58920
+ fs58.unlinkSync(this.filePath());
58891
58921
  } catch {
58892
58922
  }
58893
58923
  }
@@ -59779,7 +59809,7 @@ function buildPermissionHandlers(deps) {
59779
59809
  }
59780
59810
 
59781
59811
  // src/handlers/history.ts
59782
- var path65 = __toESM(require("path"), 1);
59812
+ var path66 = __toESM(require("path"), 1);
59783
59813
  init_protocol();
59784
59814
 
59785
59815
  // src/session/recent-dirs.ts
@@ -59797,7 +59827,7 @@ function listRecentDirs(store, limit = 50) {
59797
59827
  }
59798
59828
 
59799
59829
  // src/permission/persona-paths.ts
59800
- var path64 = __toESM(require("path"), 1);
59830
+ var path65 = __toESM(require("path"), 1);
59801
59831
  function getAllowedPersonaIds(grants, action) {
59802
59832
  const ids = /* @__PURE__ */ new Set();
59803
59833
  for (const g2 of grants) {
@@ -59810,42 +59840,42 @@ function getAllowedPersonaIds(grants, action) {
59810
59840
  return ids;
59811
59841
  }
59812
59842
  function isGuestPathAllowed(grants, absPath, personaRoot, action = "read", userWorkDir) {
59813
- const target = path64.resolve(absPath);
59843
+ const target = path65.resolve(absPath);
59814
59844
  if (userWorkDir) {
59815
- const u = path64.resolve(userWorkDir);
59816
- const usep = u.endsWith(path64.sep) ? "" : path64.sep;
59845
+ const u = path65.resolve(userWorkDir);
59846
+ const usep = u.endsWith(path65.sep) ? "" : path65.sep;
59817
59847
  if (target === u || target.startsWith(u + usep)) return true;
59818
59848
  }
59819
- const root = path64.resolve(personaRoot);
59820
- const sep5 = root.endsWith(path64.sep) ? "" : path64.sep;
59849
+ const root = path65.resolve(personaRoot);
59850
+ const sep5 = root.endsWith(path65.sep) ? "" : path65.sep;
59821
59851
  if (!target.startsWith(root + sep5)) return false;
59822
- const rel = path64.relative(root, target);
59852
+ const rel = path65.relative(root, target);
59823
59853
  if (!rel || rel.startsWith("..")) return false;
59824
- const personaId2 = rel.split(path64.sep)[0];
59854
+ const personaId2 = rel.split(path65.sep)[0];
59825
59855
  if (!personaId2) return false;
59826
59856
  const allowed = getAllowedPersonaIds(grants, action);
59827
59857
  if (allowed === "*") return true;
59828
59858
  return allowed.has(personaId2);
59829
59859
  }
59830
59860
  function personaIdFromPath(absPath, personaRoot) {
59831
- const root = path64.resolve(personaRoot);
59832
- const target = path64.resolve(absPath);
59833
- const sep5 = root.endsWith(path64.sep) ? "" : path64.sep;
59861
+ const root = path65.resolve(personaRoot);
59862
+ const target = path65.resolve(absPath);
59863
+ const sep5 = root.endsWith(path65.sep) ? "" : path65.sep;
59834
59864
  if (!target.startsWith(root + sep5)) return null;
59835
- const rel = path64.relative(root, target);
59865
+ const rel = path65.relative(root, target);
59836
59866
  if (!rel || rel.startsWith("..")) return null;
59837
- const id = rel.split(path64.sep)[0];
59867
+ const id = rel.split(path65.sep)[0];
59838
59868
  return id || null;
59839
59869
  }
59840
59870
  function isPathWithin(dir, absPath) {
59841
- const d = path64.resolve(dir);
59842
- const t = path64.resolve(absPath);
59843
- const sep5 = d.endsWith(path64.sep) ? "" : path64.sep;
59871
+ const d = path65.resolve(dir);
59872
+ const t = path65.resolve(absPath);
59873
+ const sep5 = d.endsWith(path65.sep) ? "" : path65.sep;
59844
59874
  return t === d || t.startsWith(d + sep5);
59845
59875
  }
59846
59876
  function isPathInGuestBoundary(personaRoot, personaId2, userWorkDir, absPath) {
59847
59877
  if (userWorkDir && isPathWithin(userWorkDir, absPath)) return true;
59848
- return personaIdFromPath(path64.resolve(absPath), personaRoot) === personaId2;
59878
+ return personaIdFromPath(path65.resolve(absPath), personaRoot) === personaId2;
59849
59879
  }
59850
59880
 
59851
59881
  // src/handlers/history.ts
@@ -59898,7 +59928,7 @@ function buildHistoryHandlers(deps) {
59898
59928
  if (!pid) return false;
59899
59929
  return isGuestPathAllowed(
59900
59930
  ctx.grants,
59901
- path65.join(personaRoot, pid),
59931
+ path66.join(personaRoot, pid),
59902
59932
  personaRoot,
59903
59933
  "read",
59904
59934
  userWorkDir
@@ -59910,7 +59940,7 @@ function buildHistoryHandlers(deps) {
59910
59940
  };
59911
59941
  const list = async (frame, _client, ctx) => {
59912
59942
  const args = HistoryListArgs.parse(frame);
59913
- assertGuestPath(ctx, path65.resolve(args.projectPath), personaRoot, "history:list", usersRoot);
59943
+ assertGuestPath(ctx, path66.resolve(args.projectPath), personaRoot, "history:list", usersRoot);
59914
59944
  const sessions = await history.listSessions(args);
59915
59945
  return { response: { type: "history:list", sessions } };
59916
59946
  };
@@ -59958,14 +59988,14 @@ function buildHistoryHandlers(deps) {
59958
59988
  };
59959
59989
  const subagents = async (frame, _client, ctx) => {
59960
59990
  const args = HistorySubagentsArgs.parse(frame);
59961
- assertGuestPath(ctx, path65.resolve(args.cwd), personaRoot, "history:subagents", usersRoot);
59991
+ assertGuestPath(ctx, path66.resolve(args.cwd), personaRoot, "history:subagents", usersRoot);
59962
59992
  assertGuestOwnsToolSession(ctx, args.toolSessionId, "history:subagents");
59963
59993
  const subs = await historyReaderForToolSession(args.toolSessionId).listSubagents(args);
59964
59994
  return { response: { type: "history:subagents", subagents: subs } };
59965
59995
  };
59966
59996
  const subagentRead = async (frame, _client, ctx) => {
59967
59997
  const args = HistorySubagentReadArgs.parse(frame);
59968
- assertGuestPath(ctx, path65.resolve(args.cwd), personaRoot, "history:subagent-read", usersRoot);
59998
+ assertGuestPath(ctx, path66.resolve(args.cwd), personaRoot, "history:subagent-read", usersRoot);
59969
59999
  assertGuestOwnsToolSession(ctx, args.toolSessionId, "history:subagent-read");
59970
60000
  const res = await historyReaderForToolSession(args.toolSessionId).readSubagent(args);
59971
60001
  return { response: { type: "history:subagent-read", ...res } };
@@ -59975,7 +60005,7 @@ function buildHistoryHandlers(deps) {
59975
60005
  if (ctx?.principal.kind === "guest" && personaRoot) {
59976
60006
  const userWorkDir = usersRoot ? deriveUserWorkDir(ctx.principal.id, usersRoot) : void 0;
59977
60007
  const filtered = dirs.filter(
59978
- (d) => isGuestPathAllowed(ctx.grants, path65.resolve(d.cwd), personaRoot, "read", userWorkDir)
60008
+ (d) => isGuestPathAllowed(ctx.grants, path66.resolve(d.cwd), personaRoot, "read", userWorkDir)
59979
60009
  );
59980
60010
  return { response: { type: "history:recentDirs", dirs: filtered } };
59981
60011
  }
@@ -59992,17 +60022,17 @@ function buildHistoryHandlers(deps) {
59992
60022
  }
59993
60023
 
59994
60024
  // src/handlers/projects.ts
59995
- var fs61 = __toESM(require("fs"), 1);
60025
+ var fs62 = __toESM(require("fs"), 1);
59996
60026
  var os19 = __toESM(require("os"), 1);
59997
- var path66 = __toESM(require("path"), 1);
60027
+ var path67 = __toESM(require("path"), 1);
59998
60028
  var import_node_child_process13 = require("child_process");
59999
60029
  init_protocol();
60000
- var DEFAULT_PROJECTS_ROOT = path66.join(os19.homedir(), "Documents", "ChatGPT");
60030
+ var DEFAULT_PROJECTS_ROOT = path67.join(os19.homedir(), "Documents", "ChatGPT");
60001
60031
  function allocateDir(root, name) {
60002
- let candidate = path66.join(root, name);
60032
+ let candidate = path67.join(root, name);
60003
60033
  let n = 2;
60004
- while (fs61.existsSync(candidate)) {
60005
- candidate = path66.join(root, `${name} ${n}`);
60034
+ while (fs62.existsSync(candidate)) {
60035
+ candidate = path67.join(root, `${name} ${n}`);
60006
60036
  n += 1;
60007
60037
  }
60008
60038
  return candidate;
@@ -60023,7 +60053,7 @@ function buildProjectHandlers(deps) {
60023
60053
  let target;
60024
60054
  if (args.path) {
60025
60055
  try {
60026
- if (!fs61.statSync(args.path).isDirectory()) throw new Error("not dir");
60056
+ if (!fs62.statSync(args.path).isDirectory()) throw new Error("not dir");
60027
60057
  } catch {
60028
60058
  throw new ClawdError(ERROR_CODES.INVALID_CWD, `not a directory: ${args.path}`);
60029
60059
  }
@@ -60031,15 +60061,15 @@ function buildProjectHandlers(deps) {
60031
60061
  } else {
60032
60062
  const name = args.name;
60033
60063
  try {
60034
- fs61.mkdirSync(root, { recursive: true });
60064
+ fs62.mkdirSync(root, { recursive: true });
60035
60065
  target = allocateDir(root, name);
60036
- fs61.mkdirSync(target);
60066
+ fs62.mkdirSync(target);
60037
60067
  } catch (err) {
60038
60068
  throw new ClawdError(ERROR_CODES.INVALID_CWD, `\u521B\u5EFA\u9879\u76EE\u76EE\u5F55\u5931\u8D25: ${String(err)}`);
60039
60069
  }
60040
60070
  const git = (0, import_node_child_process13.spawnSync)("git", ["init"], { cwd: target, stdio: "ignore" });
60041
60071
  if (git.status !== 0) {
60042
- fs61.rmSync(target, { recursive: true, force: true });
60072
+ fs62.rmSync(target, { recursive: true, force: true });
60043
60073
  throw new ClawdError(
60044
60074
  ERROR_CODES.INVALID_CWD,
60045
60075
  `git init \u5931\u8D25\uFF08${git.error ? String(git.error) : `exit ${git.status}`}\uFF09: ${target}`
@@ -60059,7 +60089,7 @@ function buildProjectHandlers(deps) {
60059
60089
  }
60060
60090
 
60061
60091
  // src/handlers/workspace.ts
60062
- var path67 = __toESM(require("path"), 1);
60092
+ var path68 = __toESM(require("path"), 1);
60063
60093
  var os20 = __toESM(require("os"), 1);
60064
60094
  init_protocol();
60065
60095
  init_protocol();
@@ -60101,22 +60131,22 @@ function buildWorkspaceHandlers(deps) {
60101
60131
  const args = WorkspaceListArgs.parse(frame);
60102
60132
  const isGuest = ctx?.principal.kind === "guest";
60103
60133
  const fallbackCwd = isGuest && personaRoot ? personaRoot : os20.homedir();
60104
- const resolvedCwd = path67.resolve(args.cwd ?? fallbackCwd);
60105
- const target = args.path ? path67.resolve(resolvedCwd, args.path) : resolvedCwd;
60134
+ const resolvedCwd = path68.resolve(args.cwd ?? fallbackCwd);
60135
+ const target = args.path ? path68.resolve(resolvedCwd, args.path) : resolvedCwd;
60106
60136
  assertGuestPath2(ctx, target, personaRoot, "workspace:list", usersRoot);
60107
60137
  const res = workspace.list({ ...args, cwd: resolvedCwd });
60108
60138
  return { response: { type: "workspace:list", ...res } };
60109
60139
  };
60110
60140
  const read = async (frame, _client, ctx) => {
60111
60141
  const args = WorkspaceReadArgs.parse(frame);
60112
- const target = path67.isAbsolute(args.path) ? path67.resolve(args.path) : path67.resolve(args.cwd, args.path);
60142
+ const target = path68.isAbsolute(args.path) ? path68.resolve(args.path) : path68.resolve(args.cwd, args.path);
60113
60143
  assertGuestPath2(ctx, target, personaRoot, "workspace:read", usersRoot);
60114
60144
  const res = workspace.read(args);
60115
60145
  return { response: { type: "workspace:read", ...res } };
60116
60146
  };
60117
60147
  const skillsList = async (frame, _client, ctx) => {
60118
60148
  const args = SkillsListArgs.parse(frame);
60119
- const cwdAbs = path67.resolve(args.cwd);
60149
+ const cwdAbs = path68.resolve(args.cwd);
60120
60150
  assertGuestPath2(ctx, cwdAbs, personaRoot, "skills:list", usersRoot);
60121
60151
  const list2 = await getSkillsForTool(args.tool ?? "claude", cwdAbs);
60122
60152
  if (ctx?.principal.kind === "guest" && personaRoot) {
@@ -60128,7 +60158,7 @@ function buildWorkspaceHandlers(deps) {
60128
60158
  };
60129
60159
  const agentsList = async (frame, _client, ctx) => {
60130
60160
  const args = AgentsListArgs.parse(frame);
60131
- const cwdAbs = path67.resolve(args.cwd);
60161
+ const cwdAbs = path68.resolve(args.cwd);
60132
60162
  assertGuestPath2(ctx, cwdAbs, personaRoot, "agents:list", usersRoot);
60133
60163
  if (args.tool === "codex") {
60134
60164
  return { response: { type: "agents:list", agents: [] } };
@@ -60150,7 +60180,7 @@ function buildWorkspaceHandlers(deps) {
60150
60180
  }
60151
60181
 
60152
60182
  // src/handlers/git.ts
60153
- var path69 = __toESM(require("path"), 1);
60183
+ var path70 = __toESM(require("path"), 1);
60154
60184
  init_protocol();
60155
60185
  init_protocol();
60156
60186
 
@@ -60237,7 +60267,7 @@ async function listGitBranches(cwd) {
60237
60267
  function assertGuestCwd(ctx, cwd, personaRoot, method, usersRoot) {
60238
60268
  if (!ctx || ctx.principal.kind !== "guest" || !personaRoot) return;
60239
60269
  const userWorkDir = usersRoot ? deriveUserWorkDir(ctx.principal.id, usersRoot) : void 0;
60240
- if (!isGuestPathAllowed(ctx.grants, path69.resolve(cwd), personaRoot, "read", userWorkDir)) {
60270
+ if (!isGuestPathAllowed(ctx.grants, path70.resolve(cwd), personaRoot, "read", userWorkDir)) {
60241
60271
  throw new ClawdError(
60242
60272
  ERROR_CODES.UNAUTHORIZED,
60243
60273
  `guest ${ctx.principal.id} cannot ${method} cwd ${cwd}`
@@ -61138,21 +61168,21 @@ function computeMethodAccess(args) {
61138
61168
  }
61139
61169
 
61140
61170
  // src/version.ts
61141
- var version = "0.2.372".length > 0 ? "0.2.372" : "dev";
61171
+ var version = "0.2.373".length > 0 ? "0.2.373" : "dev";
61142
61172
 
61143
61173
  // src/cli-probe/probe.ts
61144
- var fs63 = __toESM(require("fs"), 1);
61145
- var path70 = __toESM(require("path"), 1);
61174
+ var fs64 = __toESM(require("fs"), 1);
61175
+ var path71 = __toESM(require("path"), 1);
61146
61176
  var PKG_NAME = "@clawos-dev/clawd";
61147
61177
  var BIN_NAME = "clawd";
61148
61178
  var MAX_PARENT_HOPS = 5;
61149
61179
  function probeGlobalCli(pathEnv) {
61150
61180
  if (!pathEnv) return null;
61151
- for (const dir of pathEnv.split(path70.delimiter)) {
61181
+ for (const dir of pathEnv.split(path71.delimiter)) {
61152
61182
  if (!dir) continue;
61153
61183
  let real;
61154
61184
  try {
61155
- real = fs63.realpathSync(path70.join(dir, BIN_NAME));
61185
+ real = fs64.realpathSync(path71.join(dir, BIN_NAME));
61156
61186
  } catch {
61157
61187
  continue;
61158
61188
  }
@@ -61162,15 +61192,15 @@ function probeGlobalCli(pathEnv) {
61162
61192
  return null;
61163
61193
  }
61164
61194
  function readOwnPackageVersion(entryPath) {
61165
- let dir = path70.dirname(entryPath);
61195
+ let dir = path71.dirname(entryPath);
61166
61196
  for (let i = 0; i < MAX_PARENT_HOPS; i++) {
61167
61197
  try {
61168
- const raw = fs63.readFileSync(path70.join(dir, "package.json"), "utf8");
61198
+ const raw = fs64.readFileSync(path71.join(dir, "package.json"), "utf8");
61169
61199
  const pkg = JSON.parse(raw);
61170
61200
  if (pkg.name !== PKG_NAME) return null;
61171
61201
  return typeof pkg.version === "string" && pkg.version ? pkg.version : null;
61172
61202
  } catch {
61173
- const parent = path70.dirname(dir);
61203
+ const parent = path71.dirname(dir);
61174
61204
  if (parent === dir) return null;
61175
61205
  dir = parent;
61176
61206
  }
@@ -65062,6 +65092,10 @@ async function startDaemon(config) {
65062
65092
  }
65063
65093
  }
65064
65094
  });
65095
+ const droppedSeed = dropSeededProjects({ dataDir: config.dataDir });
65096
+ if (!droppedSeed.skipped) {
65097
+ logger.info("projects.seed-dropped", { dropped: droppedSeed.dropped, backup: droppedSeed.backup });
65098
+ }
65065
65099
  const projectsStore = new ProjectsStore({
65066
65100
  file: import_node_path68.default.join(config.dataDir, "projects.json"),
65067
65101
  clawdDir: config.dataDir,
@@ -65145,7 +65179,9 @@ async function startDaemon(config) {
65145
65179
  codexHomeFor: (cwd) => resolveCodexHome({
65146
65180
  cwd,
65147
65181
  personaRoot: import_node_path68.default.join(config.dataDir, "personas"),
65148
- projectPaths: projectsStore.list().map((x) => x.path),
65182
+ // 必须用 listMerged(Codex registry ∪ 叠加层):只用本地 list() 的话,用户在
65183
+ // Codex 里建的 project 不在表里,在它下面开的会话会被误判成隔离 → Codex 侧看不到
65184
+ projectPaths: projectsStore.listMerged().map((x) => x.path),
65149
65185
  sharedHome: import_node_path68.default.join(import_node_os24.default.homedir(), ".codex"),
65150
65186
  isolatedHome: codexIsolatedHome
65151
65187
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawos-dev/clawd",
3
- "version": "0.2.372",
3
+ "version": "0.2.373",
4
4
  "description": "Standalone clawd daemon — Claude Code (and future Codex) session server over WebSocket",
5
5
  "type": "module",
6
6
  "license": "MIT",