@clawos-dev/clawd 0.2.68 → 0.2.69-beta.120.2a41cd5

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 +81 -148
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -605,8 +605,8 @@ var init_parseUtil = __esm({
605
605
  init_errors2();
606
606
  init_en();
607
607
  makeIssue = (params) => {
608
- const { data, path: path32, errorMaps, issueData } = params;
609
- const fullPath = [...path32, ...issueData.path || []];
608
+ const { data, path: path31, errorMaps, issueData } = params;
609
+ const fullPath = [...path31, ...issueData.path || []];
610
610
  const fullIssue = {
611
611
  ...issueData,
612
612
  path: fullPath
@@ -917,11 +917,11 @@ var init_types = __esm({
917
917
  init_parseUtil();
918
918
  init_util();
919
919
  ParseInputLazyPath = class {
920
- constructor(parent, value, path32, key) {
920
+ constructor(parent, value, path31, key) {
921
921
  this._cachedPath = [];
922
922
  this.parent = parent;
923
923
  this.data = value;
924
- this._path = path32;
924
+ this._path = path31;
925
925
  this._key = key;
926
926
  }
927
927
  get path() {
@@ -4331,11 +4331,9 @@ var init_attachment_schemas = __esm({
4331
4331
  stale: external_exports.boolean().optional()
4332
4332
  });
4333
4333
  AttachmentSignUrlArgs = external_exports.object({
4334
- /** 群文件所属的 session */
4335
- sessionId: external_exports.string().min(1),
4336
- /** 相对 session.cwd 的路径;允许传绝对路径,daemon 端会归一化(必须在 cwd 内) */
4337
- relPath: external_exports.string().min(1),
4338
- /** TTL 秒数;缺省 24h;null 走永久 URL(不带 exp 字段) */
4334
+ /** 要分享的绝对路径;签名只关心 absPath,不区分 persona/session */
4335
+ absPath: external_exports.string().min(1),
4336
+ /** TTL 秒数;缺省 24h;'never' null 不带 exp 字段(永久有效) */
4339
4337
  ttlSeconds: external_exports.number().int().positive().nullable().optional()
4340
4338
  });
4341
4339
  AttachmentSignUrlResponseSchema = external_exports.object({
@@ -5335,8 +5333,8 @@ var require_req = __commonJS({
5335
5333
  if (req.originalUrl) {
5336
5334
  _req.url = req.originalUrl;
5337
5335
  } else {
5338
- const path32 = req.path;
5339
- _req.url = typeof path32 === "string" ? path32 : req.url ? req.url.path || req.url : void 0;
5336
+ const path31 = req.path;
5337
+ _req.url = typeof path31 === "string" ? path31 : req.url ? req.url.path || req.url : void 0;
5340
5338
  }
5341
5339
  if (req.query) {
5342
5340
  _req.query = req.query;
@@ -5501,14 +5499,14 @@ var require_redact = __commonJS({
5501
5499
  }
5502
5500
  return obj;
5503
5501
  }
5504
- function parsePath(path32) {
5502
+ function parsePath(path31) {
5505
5503
  const parts = [];
5506
5504
  let current = "";
5507
5505
  let inBrackets = false;
5508
5506
  let inQuotes = false;
5509
5507
  let quoteChar = "";
5510
- for (let i = 0; i < path32.length; i++) {
5511
- const char = path32[i];
5508
+ for (let i = 0; i < path31.length; i++) {
5509
+ const char = path31[i];
5512
5510
  if (!inBrackets && char === ".") {
5513
5511
  if (current) {
5514
5512
  parts.push(current);
@@ -5639,10 +5637,10 @@ var require_redact = __commonJS({
5639
5637
  return current;
5640
5638
  }
5641
5639
  function redactPaths(obj, paths, censor, remove = false) {
5642
- for (const path32 of paths) {
5643
- const parts = parsePath(path32);
5640
+ for (const path31 of paths) {
5641
+ const parts = parsePath(path31);
5644
5642
  if (parts.includes("*")) {
5645
- redactWildcardPath(obj, parts, censor, path32, remove);
5643
+ redactWildcardPath(obj, parts, censor, path31, remove);
5646
5644
  } else {
5647
5645
  if (remove) {
5648
5646
  removeKey(obj, parts);
@@ -5727,8 +5725,8 @@ var require_redact = __commonJS({
5727
5725
  }
5728
5726
  } else {
5729
5727
  if (afterWildcard.includes("*")) {
5730
- const wrappedCensor = typeof censor === "function" ? (value, path32) => {
5731
- const fullPath = [...pathArray.slice(0, pathLength), ...path32];
5728
+ const wrappedCensor = typeof censor === "function" ? (value, path31) => {
5729
+ const fullPath = [...pathArray.slice(0, pathLength), ...path31];
5732
5730
  return censor(value, fullPath);
5733
5731
  } : censor;
5734
5732
  redactWildcardPath(current, afterWildcard, wrappedCensor, originalPath, remove);
@@ -5763,8 +5761,8 @@ var require_redact = __commonJS({
5763
5761
  return null;
5764
5762
  }
5765
5763
  const pathStructure = /* @__PURE__ */ new Map();
5766
- for (const path32 of pathsToClone) {
5767
- const parts = parsePath(path32);
5764
+ for (const path31 of pathsToClone) {
5765
+ const parts = parsePath(path31);
5768
5766
  let current = pathStructure;
5769
5767
  for (let i = 0; i < parts.length; i++) {
5770
5768
  const part = parts[i];
@@ -5816,24 +5814,24 @@ var require_redact = __commonJS({
5816
5814
  }
5817
5815
  return cloneSelectively(obj, pathStructure);
5818
5816
  }
5819
- function validatePath(path32) {
5820
- if (typeof path32 !== "string") {
5817
+ function validatePath(path31) {
5818
+ if (typeof path31 !== "string") {
5821
5819
  throw new Error("Paths must be (non-empty) strings");
5822
5820
  }
5823
- if (path32 === "") {
5821
+ if (path31 === "") {
5824
5822
  throw new Error("Invalid redaction path ()");
5825
5823
  }
5826
- if (path32.includes("..")) {
5827
- throw new Error(`Invalid redaction path (${path32})`);
5824
+ if (path31.includes("..")) {
5825
+ throw new Error(`Invalid redaction path (${path31})`);
5828
5826
  }
5829
- if (path32.includes(",")) {
5830
- throw new Error(`Invalid redaction path (${path32})`);
5827
+ if (path31.includes(",")) {
5828
+ throw new Error(`Invalid redaction path (${path31})`);
5831
5829
  }
5832
5830
  let bracketCount = 0;
5833
5831
  let inQuotes = false;
5834
5832
  let quoteChar = "";
5835
- for (let i = 0; i < path32.length; i++) {
5836
- const char = path32[i];
5833
+ for (let i = 0; i < path31.length; i++) {
5834
+ const char = path31[i];
5837
5835
  if ((char === '"' || char === "'") && bracketCount > 0) {
5838
5836
  if (!inQuotes) {
5839
5837
  inQuotes = true;
@@ -5847,20 +5845,20 @@ var require_redact = __commonJS({
5847
5845
  } else if (char === "]" && !inQuotes) {
5848
5846
  bracketCount--;
5849
5847
  if (bracketCount < 0) {
5850
- throw new Error(`Invalid redaction path (${path32})`);
5848
+ throw new Error(`Invalid redaction path (${path31})`);
5851
5849
  }
5852
5850
  }
5853
5851
  }
5854
5852
  if (bracketCount !== 0) {
5855
- throw new Error(`Invalid redaction path (${path32})`);
5853
+ throw new Error(`Invalid redaction path (${path31})`);
5856
5854
  }
5857
5855
  }
5858
5856
  function validatePaths(paths) {
5859
5857
  if (!Array.isArray(paths)) {
5860
5858
  throw new TypeError("paths must be an array");
5861
5859
  }
5862
- for (const path32 of paths) {
5863
- validatePath(path32);
5860
+ for (const path31 of paths) {
5861
+ validatePath(path31);
5864
5862
  }
5865
5863
  }
5866
5864
  function slowRedact(options = {}) {
@@ -6028,8 +6026,8 @@ var require_redaction = __commonJS({
6028
6026
  if (shape[k2] === null) {
6029
6027
  o[k2] = (value) => topCensor(value, [k2]);
6030
6028
  } else {
6031
- const wrappedCensor = typeof censor === "function" ? (value, path32) => {
6032
- return censor(value, [k2, ...path32]);
6029
+ const wrappedCensor = typeof censor === "function" ? (value, path31) => {
6030
+ return censor(value, [k2, ...path31]);
6033
6031
  } : censor;
6034
6032
  o[k2] = Redact({
6035
6033
  paths: shape[k2],
@@ -6250,7 +6248,7 @@ var require_sonic_boom = __commonJS({
6250
6248
  var fs28 = require("fs");
6251
6249
  var EventEmitter2 = require("events");
6252
6250
  var inherits = require("util").inherits;
6253
- var path32 = require("path");
6251
+ var path31 = require("path");
6254
6252
  var sleep = require_atomic_sleep();
6255
6253
  var assert = require("assert");
6256
6254
  var BUSY_WRITE_TIMEOUT = 100;
@@ -6304,7 +6302,7 @@ var require_sonic_boom = __commonJS({
6304
6302
  const mode = sonic.mode;
6305
6303
  if (sonic.sync) {
6306
6304
  try {
6307
- if (sonic.mkdir) fs28.mkdirSync(path32.dirname(file), { recursive: true });
6305
+ if (sonic.mkdir) fs28.mkdirSync(path31.dirname(file), { recursive: true });
6308
6306
  const fd = fs28.openSync(file, flags, mode);
6309
6307
  fileOpened(null, fd);
6310
6308
  } catch (err) {
@@ -6312,7 +6310,7 @@ var require_sonic_boom = __commonJS({
6312
6310
  throw err;
6313
6311
  }
6314
6312
  } else if (sonic.mkdir) {
6315
- fs28.mkdir(path32.dirname(file), { recursive: true }, (err) => {
6313
+ fs28.mkdir(path31.dirname(file), { recursive: true }, (err) => {
6316
6314
  if (err) return fileOpened(err);
6317
6315
  fs28.open(file, flags, mode, fileOpened);
6318
6316
  });
@@ -9943,11 +9941,11 @@ var init_lib = __esm({
9943
9941
  }
9944
9942
  }
9945
9943
  },
9946
- addToPath: function addToPath(path32, added, removed, oldPosInc, options) {
9947
- var last = path32.lastComponent;
9944
+ addToPath: function addToPath(path31, added, removed, oldPosInc, options) {
9945
+ var last = path31.lastComponent;
9948
9946
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
9949
9947
  return {
9950
- oldPos: path32.oldPos + oldPosInc,
9948
+ oldPos: path31.oldPos + oldPosInc,
9951
9949
  lastComponent: {
9952
9950
  count: last.count + 1,
9953
9951
  added,
@@ -9957,7 +9955,7 @@ var init_lib = __esm({
9957
9955
  };
9958
9956
  } else {
9959
9957
  return {
9960
- oldPos: path32.oldPos + oldPosInc,
9958
+ oldPos: path31.oldPos + oldPosInc,
9961
9959
  lastComponent: {
9962
9960
  count: 1,
9963
9961
  added,
@@ -10388,10 +10386,10 @@ function attachmentToHistoryMessage(o, ts) {
10388
10386
  const memories = raw.map((m2) => {
10389
10387
  if (!m2 || typeof m2 !== "object") return null;
10390
10388
  const rec = m2;
10391
- const path32 = typeof rec.path === "string" ? rec.path : null;
10389
+ const path31 = typeof rec.path === "string" ? rec.path : null;
10392
10390
  const content = typeof rec.content === "string" ? rec.content : null;
10393
- if (!path32 || content == null) return null;
10394
- const entry = { path: path32, content };
10391
+ if (!path31 || content == null) return null;
10392
+ const entry = { path: path31, content };
10395
10393
  if (typeof rec.mtimeMs === "number") entry.mtimeMs = rec.mtimeMs;
10396
10394
  return entry;
10397
10395
  }).filter((m2) => m2 !== null);
@@ -11195,10 +11193,10 @@ function parseAttachment(obj) {
11195
11193
  const memories = raw.map((m2) => {
11196
11194
  if (!m2 || typeof m2 !== "object") return null;
11197
11195
  const rec = m2;
11198
- const path32 = typeof rec.path === "string" ? rec.path : null;
11196
+ const path31 = typeof rec.path === "string" ? rec.path : null;
11199
11197
  const content = typeof rec.content === "string" ? rec.content : null;
11200
- if (!path32 || content == null) return null;
11201
- const out = { path: path32, content };
11198
+ if (!path31 || content == null) return null;
11199
+ const out = { path: path31, content };
11202
11200
  if (typeof rec.mtimeMs === "number") out.mtimeMs = rec.mtimeMs;
11203
11201
  return out;
11204
11202
  }).filter((m2) => m2 !== null);
@@ -20112,7 +20110,7 @@ var require_websocket_server = __commonJS({
20112
20110
  // src/run-case/recorder.ts
20113
20111
  function startRunCaseRecorder(opts) {
20114
20112
  const now = opts.now ?? Date.now;
20115
- const dir = import_node_path28.default.dirname(opts.recordPath);
20113
+ const dir = import_node_path27.default.dirname(opts.recordPath);
20116
20114
  let stream = null;
20117
20115
  let closing = false;
20118
20116
  let closedSettled = false;
@@ -20152,12 +20150,12 @@ function startRunCaseRecorder(opts) {
20152
20150
  };
20153
20151
  return { tap, close, closed };
20154
20152
  }
20155
- var import_node_fs25, import_node_path28;
20153
+ var import_node_fs25, import_node_path27;
20156
20154
  var init_recorder = __esm({
20157
20155
  "src/run-case/recorder.ts"() {
20158
20156
  "use strict";
20159
20157
  import_node_fs25 = __toESM(require("fs"), 1);
20160
- import_node_path28 = __toESM(require("path"), 1);
20158
+ import_node_path27 = __toESM(require("path"), 1);
20161
20159
  }
20162
20160
  });
20163
20161
 
@@ -20200,7 +20198,7 @@ var init_wire = __esm({
20200
20198
  // src/run-case/controller.ts
20201
20199
  async function runController(opts) {
20202
20200
  const now = opts.now ?? Date.now;
20203
- const cwd = opts.cwd ?? (0, import_node_fs26.mkdtempSync)(import_node_path29.default.join(import_node_os14.default.tmpdir(), "clawd-runcase-"));
20201
+ const cwd = opts.cwd ?? (0, import_node_fs26.mkdtempSync)(import_node_path28.default.join(import_node_os14.default.tmpdir(), "clawd-runcase-"));
20204
20202
  const ownsCwd = opts.cwd === void 0;
20205
20203
  const recorder = startRunCaseRecorder({ recordPath: opts.record, now });
20206
20204
  const spawnCtx = { cwd };
@@ -20367,13 +20365,13 @@ async function runController(opts) {
20367
20365
  }
20368
20366
  return exitCode ?? 0;
20369
20367
  }
20370
- var import_node_fs26, import_node_os14, import_node_path29;
20368
+ var import_node_fs26, import_node_os14, import_node_path28;
20371
20369
  var init_controller = __esm({
20372
20370
  "src/run-case/controller.ts"() {
20373
20371
  "use strict";
20374
20372
  import_node_fs26 = require("fs");
20375
20373
  import_node_os14 = __toESM(require("os"), 1);
20376
- import_node_path29 = __toESM(require("path"), 1);
20374
+ import_node_path28 = __toESM(require("path"), 1);
20377
20375
  init_claude();
20378
20376
  init_stdout_splitter();
20379
20377
  init_permission_stdio();
@@ -20605,7 +20603,7 @@ Env (advanced):
20605
20603
  `;
20606
20604
 
20607
20605
  // src/index.ts
20608
- var import_node_path27 = __toESM(require("path"), 1);
20606
+ var import_node_path26 = __toESM(require("path"), 1);
20609
20607
  var import_node_fs24 = __toESM(require("fs"), 1);
20610
20608
 
20611
20609
  // src/logger.ts
@@ -26852,24 +26850,14 @@ var AUTH_FILE_NAME = "auth.json";
26852
26850
  function authFilePath(dataDir) {
26853
26851
  return import_node_path22.default.join(dataDir, AUTH_FILE_NAME);
26854
26852
  }
26855
- function loadOrCreateAuthFile(opts) {
26853
+ function loadOrCreateAuthToken(opts) {
26856
26854
  const file = authFilePath(opts.dataDir);
26857
- const generate = opts.generate ?? defaultGenerate;
26858
- const now = opts.now ?? (() => /* @__PURE__ */ new Date());
26859
26855
  const existing = readAuthFile(file);
26860
- if (existing && existing.token && existing.signSecret) {
26861
- return {
26862
- token: existing.token,
26863
- signSecret: existing.signSecret,
26864
- createdAt: existing.createdAt ?? (/* @__PURE__ */ new Date(0)).toISOString()
26865
- };
26866
- }
26867
- const token = existing?.token || generate();
26868
- const signSecret = existing?.signSecret || generate();
26869
- const createdAt = existing?.createdAt || now().toISOString();
26870
- const next = { token, signSecret, createdAt };
26871
- writeAuthFile(file, next);
26872
- return next;
26856
+ if (existing && existing.token) return existing.token;
26857
+ const token = (opts.generate ?? defaultGenerate)();
26858
+ const now = (opts.now ?? (() => /* @__PURE__ */ new Date()))();
26859
+ writeAuthFile(file, { token, createdAt: now.toISOString() });
26860
+ return token;
26873
26861
  }
26874
26862
  function defaultGenerate() {
26875
26863
  return import_node_crypto8.default.randomBytes(32).toString("base64url");
@@ -26878,14 +26866,13 @@ function readAuthFile(file) {
26878
26866
  try {
26879
26867
  const raw = import_node_fs20.default.readFileSync(file, "utf8");
26880
26868
  const parsed = JSON.parse(raw);
26881
- if (typeof parsed?.token !== "string" || parsed.token.length === 0) {
26882
- return null;
26869
+ if (typeof parsed?.token === "string" && parsed.token.length > 0) {
26870
+ return {
26871
+ token: parsed.token,
26872
+ createdAt: typeof parsed.createdAt === "string" ? parsed.createdAt : (/* @__PURE__ */ new Date(0)).toISOString()
26873
+ };
26883
26874
  }
26884
- return {
26885
- token: parsed.token,
26886
- signSecret: typeof parsed.signSecret === "string" && parsed.signSecret.length > 0 ? parsed.signSecret : void 0,
26887
- createdAt: typeof parsed.createdAt === "string" ? parsed.createdAt : void 0
26888
- };
26875
+ return null;
26889
26876
  } catch (err) {
26890
26877
  const code = err?.code;
26891
26878
  if (code === "ENOENT") return null;
@@ -27554,7 +27541,6 @@ function buildPersonaHandlers(deps) {
27554
27541
  }
27555
27542
 
27556
27543
  // src/handlers/attachment.ts
27557
- var import_node_path26 = __toESM(require("path"), 1);
27558
27544
  init_protocol();
27559
27545
  init_protocol();
27560
27546
  var DEFAULT_TTL_SECONDS = 24 * 3600;
@@ -27579,51 +27565,8 @@ function buildAttachmentHandlers(deps) {
27579
27565
  "httpBaseUrl unavailable (daemon HTTP not ready)"
27580
27566
  );
27581
27567
  }
27582
- if (!deps.sessionStore || !deps.getSessionScope || !deps.groupFileStore) {
27583
- throw new ClawdError(
27584
- ERROR_CODES.METHOD_NOT_IMPLEMENTED,
27585
- "signUrl requires session/group stores"
27586
- );
27587
- }
27588
- const sessionFile = deps.sessionStore.read(args.sessionId);
27589
- if (!sessionFile) {
27590
- throw new ClawdError(
27591
- ERROR_CODES.VALIDATION_ERROR,
27592
- `session ${args.sessionId} not found`
27593
- );
27594
- }
27595
- const scope = deps.getSessionScope(args.sessionId);
27596
- if (!scope) {
27597
- throw new ClawdError(
27598
- ERROR_CODES.VALIDATION_ERROR,
27599
- `session ${args.sessionId} scope unresolved`
27600
- );
27601
- }
27602
- const cwdAbs = import_node_path26.default.resolve(sessionFile.cwd);
27603
- const candidateAbs = import_node_path26.default.isAbsolute(args.relPath) ? import_node_path26.default.resolve(args.relPath) : import_node_path26.default.resolve(cwdAbs, args.relPath);
27604
- if (!isContainedIn2(candidateAbs, cwdAbs)) {
27605
- throw new ClawdError(
27606
- ERROR_CODES.VALIDATION_ERROR,
27607
- "relPath escapes session cwd"
27608
- );
27609
- }
27610
- const relPath = import_node_path26.default.relative(cwdAbs, candidateAbs);
27611
- if (relPath === "" || relPath.startsWith("..")) {
27612
- throw new ClawdError(
27613
- ERROR_CODES.VALIDATION_ERROR,
27614
- "relPath escapes session cwd"
27615
- );
27616
- }
27617
- const entries = deps.groupFileStore.list(scope, args.sessionId);
27618
- const entry = entries.find((e) => e.relPath === relPath && !e.stale);
27619
- if (!entry) {
27620
- throw new ClawdError(
27621
- ERROR_CODES.VALIDATION_ERROR,
27622
- `relPath not in session group files or stale: ${relPath}`
27623
- );
27624
- }
27625
27568
  const ttl = args.ttlSeconds === null ? null : args.ttlSeconds ?? DEFAULT_TTL_SECONDS;
27626
- const parts = signUrlParts(secret, candidateAbs, ttl);
27569
+ const parts = signUrlParts(secret, args.absPath, ttl);
27627
27570
  const url = buildSignedFileUrl(httpBaseUrl, parts);
27628
27571
  return {
27629
27572
  response: {
@@ -27709,12 +27652,6 @@ function buildAttachmentHandlers(deps) {
27709
27652
  "attachment.groupListPersona": groupListPersona
27710
27653
  };
27711
27654
  }
27712
- function isContainedIn2(abs, root) {
27713
- const normalized = import_node_path26.default.resolve(abs);
27714
- const normalizedRoot = import_node_path26.default.resolve(root);
27715
- if (normalized === normalizedRoot) return true;
27716
- return normalized.startsWith(normalizedRoot + import_node_path26.default.sep);
27717
- }
27718
27655
 
27719
27656
  // src/handlers/index.ts
27720
27657
  function buildMethodHandlers(deps) {
@@ -27738,7 +27675,7 @@ function buildMethodHandlers(deps) {
27738
27675
  async function startDaemon(config) {
27739
27676
  const logger = createLogger({
27740
27677
  level: config.logLevel,
27741
- file: import_node_path27.default.join(config.dataDir, "clawd.log")
27678
+ file: import_node_path26.default.join(config.dataDir, "clawd.log")
27742
27679
  });
27743
27680
  logger.info("starting clawd", { version, config: { port: config.port, host: config.host, dataDir: config.dataDir } });
27744
27681
  const stateMgr = new StateFileManager({ dataDir: config.dataDir });
@@ -27750,12 +27687,10 @@ async function startDaemon(config) {
27750
27687
  logger.warn("stale state file detected, overwriting", { pid: pre.existing.pid });
27751
27688
  }
27752
27689
  let resolvedAuthToken = null;
27753
- let authFile = null;
27754
27690
  if (config.authToken && config.authToken.trim()) {
27755
27691
  resolvedAuthToken = config.authToken.trim();
27756
27692
  } else if (config.tunnel) {
27757
- authFile = loadOrCreateAuthFile({ dataDir: config.dataDir });
27758
- resolvedAuthToken = authFile.token;
27693
+ resolvedAuthToken = loadOrCreateAuthToken({ dataDir: config.dataDir });
27759
27694
  }
27760
27695
  const authMode = resolvedAuthToken == null ? "none" : "first-message";
27761
27696
  let wsServer = null;
@@ -27772,7 +27707,7 @@ async function startDaemon(config) {
27772
27707
  const agents = new AgentsScanner();
27773
27708
  const history = new ClaudeHistoryReader();
27774
27709
  let transport = null;
27775
- const personaStore = new PersonaStore(import_node_path27.default.join(config.dataDir, "personas"));
27710
+ const personaStore = new PersonaStore(import_node_path26.default.join(config.dataDir, "personas"));
27776
27711
  const defaultsRoot = findDefaultsRoot();
27777
27712
  if (defaultsRoot) {
27778
27713
  seedDefaultPersonas({ store: personaStore, defaultsRoot, logger });
@@ -27787,7 +27722,7 @@ async function startDaemon(config) {
27787
27722
  getAdapter,
27788
27723
  historyReader: history,
27789
27724
  dataDir: config.dataDir,
27790
- personaRoot: import_node_path27.default.join(config.dataDir, "personas"),
27725
+ personaRoot: import_node_path26.default.join(config.dataDir, "personas"),
27791
27726
  personaStore,
27792
27727
  ownerDisplayName,
27793
27728
  mode: config.mode,
@@ -27810,7 +27745,7 @@ async function startDaemon(config) {
27810
27745
  // 文件可能 agent 写完又被自己删(罕见),用 size=0 / fallback mime 兜底。
27811
27746
  attachmentGroup: {
27812
27747
  onFileEdit: (input) => {
27813
- const absPath = import_node_path27.default.isAbsolute(input.relPath) ? input.relPath : import_node_path27.default.join(input.cwd, input.relPath);
27748
+ const absPath = import_node_path26.default.isAbsolute(input.relPath) ? input.relPath : import_node_path26.default.join(input.cwd, input.relPath);
27814
27749
  let size = 0;
27815
27750
  try {
27816
27751
  size = import_node_fs24.default.statSync(absPath).size;
@@ -27911,12 +27846,11 @@ async function startDaemon(config) {
27911
27846
  // 根据 sessionId 反查 scope 写盘。
27912
27847
  attachment: {
27913
27848
  groupFileStore,
27914
- sessionStore: store,
27915
27849
  getHttpBaseUrl,
27916
- // HMAC sign secret:~/.clawd/auth.json signSecret 字段(与 WS Bearer token 独立)。
27917
- // --auth-token CLI 模式 / noAuth 模式 authFile 为 null → handler 自己返 NOT_IMPLEMENTED。
27918
- getSignSecret: () => authFile?.signSecret ?? "",
27919
- // group RPC + sign 都用:根据 sessionId 反查 scope;owner-mode persona session 走
27850
+ // HMAC sign secret:复用 ~/.clawd/auth.json owner token(持久跨重启)。
27851
+ // noAuth 模式 resolvedAuthToken 为 null → handler 自己返 NOT_IMPLEMENTED。
27852
+ getSignSecret: () => resolvedAuthToken ?? "",
27853
+ // group RPC:根据 sessionId 反查 scope;owner-mode persona session 走
27920
27854
  // 'persona/<pid>/owner',default 走 'default'。
27921
27855
  getSessionScope: (sessionId) => {
27922
27856
  const file = store.read(sessionId);
@@ -27939,9 +27873,8 @@ async function startDaemon(config) {
27939
27873
  personaStore,
27940
27874
  groupFileStore,
27941
27875
  sessionStore: store,
27942
- // /files HMAC verify auth.json signSecret 字段(与 attachment.signUrl 同源)。
27943
- // --auth-token CLI 模式没 signSecret → 路由返 501,sign URL 功能整体禁用。
27944
- getSignSecret: () => authFile?.signSecret ?? null
27876
+ // /files HMAC verify 用同一份 owner token secret(与 attachment.signUrl 同源)
27877
+ getSignSecret: () => resolvedAuthToken ?? null
27945
27878
  });
27946
27879
  wsServer = new LocalWsServer({
27947
27880
  host: config.host,
@@ -28079,8 +28012,8 @@ async function startDaemon(config) {
28079
28012
  const lines = [
28080
28013
  `Tunnel: ${r.url}`,
28081
28014
  ...resolvedAuthToken ? [`Connect: ${connectUrl}`] : [],
28082
- `Frpc config: ${import_node_path27.default.join(config.dataDir, "frpc.toml")}`,
28083
- `Frpc log: ${import_node_path27.default.join(config.dataDir, "frpc.log")}`
28015
+ `Frpc config: ${import_node_path26.default.join(config.dataDir, "frpc.toml")}`,
28016
+ `Frpc log: ${import_node_path26.default.join(config.dataDir, "frpc.log")}`
28084
28017
  ];
28085
28018
  const width = Math.max(...lines.map((l) => l.length));
28086
28019
  const bar = "\u2550".repeat(width + 4);
@@ -28093,7 +28026,7 @@ ${bar}
28093
28026
 
28094
28027
  `);
28095
28028
  try {
28096
- const connectPath = import_node_path27.default.join(config.dataDir, "connect.txt");
28029
+ const connectPath = import_node_path26.default.join(config.dataDir, "connect.txt");
28097
28030
  import_node_fs24.default.writeFileSync(connectPath, lines.join("\n") + "\n", { mode: 384 });
28098
28031
  } catch {
28099
28032
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawos-dev/clawd",
3
- "version": "0.2.68",
3
+ "version": "0.2.69-beta.120.2a41cd5",
4
4
  "description": "Standalone clawd daemon — Claude Code (and future Codex) session server over WebSocket",
5
5
  "type": "module",
6
6
  "license": "MIT",