@clawos-dev/clawd 0.2.47-beta.70.6ec7522 → 0.2.47-beta.72.f1d7f9e

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 (41) hide show
  1. package/dist/cli.cjs +217 -115
  2. package/dist/persona-defaults/persona-knowledge-base/.claude/skills/karpathy-llm-wiki/SKILL.md +187 -0
  3. package/dist/persona-defaults/persona-knowledge-base/.claude/skills/karpathy-llm-wiki/references/archive-template.md +21 -0
  4. package/dist/persona-defaults/persona-knowledge-base/.claude/skills/karpathy-llm-wiki/references/article-template.md +20 -0
  5. package/dist/persona-defaults/persona-knowledge-base/.claude/skills/karpathy-llm-wiki/references/index-template.md +18 -0
  6. package/dist/persona-defaults/persona-knowledge-base/.claude/skills/karpathy-llm-wiki/references/raw-template.md +7 -0
  7. package/dist/persona-defaults/persona-knowledge-base/CLAUDE.md +105 -0
  8. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/README.md +119 -0
  9. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/SKILL.md +108 -0
  10. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/reference/continuation.md +167 -0
  11. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/reference/html-generation.md +103 -0
  12. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/reference/methodology.md +421 -0
  13. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/reference/quality-gates.md +192 -0
  14. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/reference/report-assembly.md +130 -0
  15. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/reference/weasyprint_guidelines.md +324 -0
  16. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/requirements.txt +14 -0
  17. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/schemas/claim.schema.json +49 -0
  18. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/schemas/evidence.schema.json +43 -0
  19. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/schemas/run_manifest.schema.json +97 -0
  20. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/schemas/source.schema.json +49 -0
  21. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/scripts/citation_manager.py +300 -0
  22. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/scripts/evidence_store.py +205 -0
  23. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/scripts/extract_claims.py +358 -0
  24. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/scripts/md_to_html.py +330 -0
  25. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/scripts/research_engine.py +584 -0
  26. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/scripts/source_evaluator.py +292 -0
  27. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/scripts/validate_report.py +354 -0
  28. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/scripts/verify_citations.py +426 -0
  29. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/scripts/verify_claim_support.py +344 -0
  30. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/scripts/verify_html.py +220 -0
  31. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/templates/mckinsey_report_template.html +443 -0
  32. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/templates/report_template.md +414 -0
  33. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/tests/fixtures/invalid_report.md +27 -0
  34. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/tests/fixtures/valid_report.md +114 -0
  35. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/tests/test_citation_manager.py +195 -0
  36. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/tests/test_evidence_store.py +166 -0
  37. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/tests/test_extract_claims.py +213 -0
  38. package/dist/persona-defaults/persona-researcher/.claude/skills/deep-research/tests/test_verify_claim_support.py +230 -0
  39. package/dist/persona-defaults/persona-researcher/CLAUDE.md +30 -0
  40. package/dist/persona-defaults/persona-researcher/skills-lock.json +11 -0
  41. package/package.json +2 -2
package/dist/cli.cjs CHANGED
@@ -296,8 +296,8 @@ var require_req = __commonJS({
296
296
  if (req.originalUrl) {
297
297
  _req.url = req.originalUrl;
298
298
  } else {
299
- const path24 = req.path;
300
- _req.url = typeof path24 === "string" ? path24 : req.url ? req.url.path || req.url : void 0;
299
+ const path25 = req.path;
300
+ _req.url = typeof path25 === "string" ? path25 : req.url ? req.url.path || req.url : void 0;
301
301
  }
302
302
  if (req.query) {
303
303
  _req.query = req.query;
@@ -462,14 +462,14 @@ var require_redact = __commonJS({
462
462
  }
463
463
  return obj;
464
464
  }
465
- function parsePath(path24) {
465
+ function parsePath(path25) {
466
466
  const parts = [];
467
467
  let current = "";
468
468
  let inBrackets = false;
469
469
  let inQuotes = false;
470
470
  let quoteChar = "";
471
- for (let i = 0; i < path24.length; i++) {
472
- const char = path24[i];
471
+ for (let i = 0; i < path25.length; i++) {
472
+ const char = path25[i];
473
473
  if (!inBrackets && char === ".") {
474
474
  if (current) {
475
475
  parts.push(current);
@@ -600,10 +600,10 @@ var require_redact = __commonJS({
600
600
  return current;
601
601
  }
602
602
  function redactPaths(obj, paths, censor, remove = false) {
603
- for (const path24 of paths) {
604
- const parts = parsePath(path24);
603
+ for (const path25 of paths) {
604
+ const parts = parsePath(path25);
605
605
  if (parts.includes("*")) {
606
- redactWildcardPath(obj, parts, censor, path24, remove);
606
+ redactWildcardPath(obj, parts, censor, path25, remove);
607
607
  } else {
608
608
  if (remove) {
609
609
  removeKey(obj, parts);
@@ -688,8 +688,8 @@ var require_redact = __commonJS({
688
688
  }
689
689
  } else {
690
690
  if (afterWildcard.includes("*")) {
691
- const wrappedCensor = typeof censor === "function" ? (value, path24) => {
692
- const fullPath = [...pathArray.slice(0, pathLength), ...path24];
691
+ const wrappedCensor = typeof censor === "function" ? (value, path25) => {
692
+ const fullPath = [...pathArray.slice(0, pathLength), ...path25];
693
693
  return censor(value, fullPath);
694
694
  } : censor;
695
695
  redactWildcardPath(current, afterWildcard, wrappedCensor, originalPath, remove);
@@ -724,8 +724,8 @@ var require_redact = __commonJS({
724
724
  return null;
725
725
  }
726
726
  const pathStructure = /* @__PURE__ */ new Map();
727
- for (const path24 of pathsToClone) {
728
- const parts = parsePath(path24);
727
+ for (const path25 of pathsToClone) {
728
+ const parts = parsePath(path25);
729
729
  let current = pathStructure;
730
730
  for (let i = 0; i < parts.length; i++) {
731
731
  const part = parts[i];
@@ -777,24 +777,24 @@ var require_redact = __commonJS({
777
777
  }
778
778
  return cloneSelectively(obj, pathStructure);
779
779
  }
780
- function validatePath(path24) {
781
- if (typeof path24 !== "string") {
780
+ function validatePath(path25) {
781
+ if (typeof path25 !== "string") {
782
782
  throw new Error("Paths must be (non-empty) strings");
783
783
  }
784
- if (path24 === "") {
784
+ if (path25 === "") {
785
785
  throw new Error("Invalid redaction path ()");
786
786
  }
787
- if (path24.includes("..")) {
788
- throw new Error(`Invalid redaction path (${path24})`);
787
+ if (path25.includes("..")) {
788
+ throw new Error(`Invalid redaction path (${path25})`);
789
789
  }
790
- if (path24.includes(",")) {
791
- throw new Error(`Invalid redaction path (${path24})`);
790
+ if (path25.includes(",")) {
791
+ throw new Error(`Invalid redaction path (${path25})`);
792
792
  }
793
793
  let bracketCount = 0;
794
794
  let inQuotes = false;
795
795
  let quoteChar = "";
796
- for (let i = 0; i < path24.length; i++) {
797
- const char = path24[i];
796
+ for (let i = 0; i < path25.length; i++) {
797
+ const char = path25[i];
798
798
  if ((char === '"' || char === "'") && bracketCount > 0) {
799
799
  if (!inQuotes) {
800
800
  inQuotes = true;
@@ -808,20 +808,20 @@ var require_redact = __commonJS({
808
808
  } else if (char === "]" && !inQuotes) {
809
809
  bracketCount--;
810
810
  if (bracketCount < 0) {
811
- throw new Error(`Invalid redaction path (${path24})`);
811
+ throw new Error(`Invalid redaction path (${path25})`);
812
812
  }
813
813
  }
814
814
  }
815
815
  if (bracketCount !== 0) {
816
- throw new Error(`Invalid redaction path (${path24})`);
816
+ throw new Error(`Invalid redaction path (${path25})`);
817
817
  }
818
818
  }
819
819
  function validatePaths(paths) {
820
820
  if (!Array.isArray(paths)) {
821
821
  throw new TypeError("paths must be an array");
822
822
  }
823
- for (const path24 of paths) {
824
- validatePath(path24);
823
+ for (const path25 of paths) {
824
+ validatePath(path25);
825
825
  }
826
826
  }
827
827
  function slowRedact(options = {}) {
@@ -989,8 +989,8 @@ var require_redaction = __commonJS({
989
989
  if (shape[k] === null) {
990
990
  o[k] = (value) => topCensor(value, [k]);
991
991
  } else {
992
- const wrappedCensor = typeof censor === "function" ? (value, path24) => {
993
- return censor(value, [k, ...path24]);
992
+ const wrappedCensor = typeof censor === "function" ? (value, path25) => {
993
+ return censor(value, [k, ...path25]);
994
994
  } : censor;
995
995
  o[k] = Redact({
996
996
  paths: shape[k],
@@ -1208,10 +1208,10 @@ var require_atomic_sleep = __commonJS({
1208
1208
  var require_sonic_boom = __commonJS({
1209
1209
  "../node_modules/.pnpm/sonic-boom@4.2.1/node_modules/sonic-boom/index.js"(exports2, module2) {
1210
1210
  "use strict";
1211
- var fs23 = require("fs");
1211
+ var fs24 = require("fs");
1212
1212
  var EventEmitter = require("events");
1213
1213
  var inherits = require("util").inherits;
1214
- var path24 = require("path");
1214
+ var path25 = require("path");
1215
1215
  var sleep = require_atomic_sleep();
1216
1216
  var assert = require("assert");
1217
1217
  var BUSY_WRITE_TIMEOUT = 100;
@@ -1265,20 +1265,20 @@ var require_sonic_boom = __commonJS({
1265
1265
  const mode = sonic.mode;
1266
1266
  if (sonic.sync) {
1267
1267
  try {
1268
- if (sonic.mkdir) fs23.mkdirSync(path24.dirname(file), { recursive: true });
1269
- const fd = fs23.openSync(file, flags, mode);
1268
+ if (sonic.mkdir) fs24.mkdirSync(path25.dirname(file), { recursive: true });
1269
+ const fd = fs24.openSync(file, flags, mode);
1270
1270
  fileOpened(null, fd);
1271
1271
  } catch (err) {
1272
1272
  fileOpened(err);
1273
1273
  throw err;
1274
1274
  }
1275
1275
  } else if (sonic.mkdir) {
1276
- fs23.mkdir(path24.dirname(file), { recursive: true }, (err) => {
1276
+ fs24.mkdir(path25.dirname(file), { recursive: true }, (err) => {
1277
1277
  if (err) return fileOpened(err);
1278
- fs23.open(file, flags, mode, fileOpened);
1278
+ fs24.open(file, flags, mode, fileOpened);
1279
1279
  });
1280
1280
  } else {
1281
- fs23.open(file, flags, mode, fileOpened);
1281
+ fs24.open(file, flags, mode, fileOpened);
1282
1282
  }
1283
1283
  }
1284
1284
  function SonicBoom(opts) {
@@ -1319,8 +1319,8 @@ var require_sonic_boom = __commonJS({
1319
1319
  this.flush = flushBuffer;
1320
1320
  this.flushSync = flushBufferSync;
1321
1321
  this._actualWrite = actualWriteBuffer;
1322
- fsWriteSync = () => fs23.writeSync(this.fd, this._writingBuf);
1323
- fsWrite = () => fs23.write(this.fd, this._writingBuf, this.release);
1322
+ fsWriteSync = () => fs24.writeSync(this.fd, this._writingBuf);
1323
+ fsWrite = () => fs24.write(this.fd, this._writingBuf, this.release);
1324
1324
  } else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
1325
1325
  this._writingBuf = "";
1326
1326
  this.write = write;
@@ -1329,15 +1329,15 @@ var require_sonic_boom = __commonJS({
1329
1329
  this._actualWrite = actualWrite;
1330
1330
  fsWriteSync = () => {
1331
1331
  if (Buffer.isBuffer(this._writingBuf)) {
1332
- return fs23.writeSync(this.fd, this._writingBuf);
1332
+ return fs24.writeSync(this.fd, this._writingBuf);
1333
1333
  }
1334
- return fs23.writeSync(this.fd, this._writingBuf, "utf8");
1334
+ return fs24.writeSync(this.fd, this._writingBuf, "utf8");
1335
1335
  };
1336
1336
  fsWrite = () => {
1337
1337
  if (Buffer.isBuffer(this._writingBuf)) {
1338
- return fs23.write(this.fd, this._writingBuf, this.release);
1338
+ return fs24.write(this.fd, this._writingBuf, this.release);
1339
1339
  }
1340
- return fs23.write(this.fd, this._writingBuf, "utf8", this.release);
1340
+ return fs24.write(this.fd, this._writingBuf, "utf8", this.release);
1341
1341
  };
1342
1342
  } else {
1343
1343
  throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
@@ -1394,7 +1394,7 @@ var require_sonic_boom = __commonJS({
1394
1394
  }
1395
1395
  }
1396
1396
  if (this._fsync) {
1397
- fs23.fsyncSync(this.fd);
1397
+ fs24.fsyncSync(this.fd);
1398
1398
  }
1399
1399
  const len = this._len;
1400
1400
  if (this._reopening) {
@@ -1508,7 +1508,7 @@ var require_sonic_boom = __commonJS({
1508
1508
  const onDrain = () => {
1509
1509
  if (!this._fsync) {
1510
1510
  try {
1511
- fs23.fsync(this.fd, (err) => {
1511
+ fs24.fsync(this.fd, (err) => {
1512
1512
  this._flushPending = false;
1513
1513
  cb(err);
1514
1514
  });
@@ -1610,7 +1610,7 @@ var require_sonic_boom = __commonJS({
1610
1610
  const fd = this.fd;
1611
1611
  this.once("ready", () => {
1612
1612
  if (fd !== this.fd) {
1613
- fs23.close(fd, (err) => {
1613
+ fs24.close(fd, (err) => {
1614
1614
  if (err) {
1615
1615
  return this.emit("error", err);
1616
1616
  }
@@ -1659,7 +1659,7 @@ var require_sonic_boom = __commonJS({
1659
1659
  buf = this._bufs[0];
1660
1660
  }
1661
1661
  try {
1662
- const n = Buffer.isBuffer(buf) ? fs23.writeSync(this.fd, buf) : fs23.writeSync(this.fd, buf, "utf8");
1662
+ const n = Buffer.isBuffer(buf) ? fs24.writeSync(this.fd, buf) : fs24.writeSync(this.fd, buf, "utf8");
1663
1663
  const releasedBufObj = releaseWritingBuf(buf, this._len, n);
1664
1664
  buf = releasedBufObj.writingBuf;
1665
1665
  this._len = releasedBufObj.len;
@@ -1675,7 +1675,7 @@ var require_sonic_boom = __commonJS({
1675
1675
  }
1676
1676
  }
1677
1677
  try {
1678
- fs23.fsyncSync(this.fd);
1678
+ fs24.fsyncSync(this.fd);
1679
1679
  } catch {
1680
1680
  }
1681
1681
  }
@@ -1696,7 +1696,7 @@ var require_sonic_boom = __commonJS({
1696
1696
  buf = mergeBuf(this._bufs[0], this._lens[0]);
1697
1697
  }
1698
1698
  try {
1699
- const n = fs23.writeSync(this.fd, buf);
1699
+ const n = fs24.writeSync(this.fd, buf);
1700
1700
  buf = buf.subarray(n);
1701
1701
  this._len = Math.max(this._len - n, 0);
1702
1702
  if (buf.length <= 0) {
@@ -1724,13 +1724,13 @@ var require_sonic_boom = __commonJS({
1724
1724
  this._writingBuf = this._writingBuf.length ? this._writingBuf : this._bufs.shift() || "";
1725
1725
  if (this.sync) {
1726
1726
  try {
1727
- const written = Buffer.isBuffer(this._writingBuf) ? fs23.writeSync(this.fd, this._writingBuf) : fs23.writeSync(this.fd, this._writingBuf, "utf8");
1727
+ const written = Buffer.isBuffer(this._writingBuf) ? fs24.writeSync(this.fd, this._writingBuf) : fs24.writeSync(this.fd, this._writingBuf, "utf8");
1728
1728
  release(null, written);
1729
1729
  } catch (err) {
1730
1730
  release(err);
1731
1731
  }
1732
1732
  } else {
1733
- fs23.write(this.fd, this._writingBuf, release);
1733
+ fs24.write(this.fd, this._writingBuf, release);
1734
1734
  }
1735
1735
  }
1736
1736
  function actualWriteBuffer() {
@@ -1739,7 +1739,7 @@ var require_sonic_boom = __commonJS({
1739
1739
  this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
1740
1740
  if (this.sync) {
1741
1741
  try {
1742
- const written = fs23.writeSync(this.fd, this._writingBuf);
1742
+ const written = fs24.writeSync(this.fd, this._writingBuf);
1743
1743
  release(null, written);
1744
1744
  } catch (err) {
1745
1745
  release(err);
@@ -1748,7 +1748,7 @@ var require_sonic_boom = __commonJS({
1748
1748
  if (kCopyBuffer) {
1749
1749
  this._writingBuf = Buffer.from(this._writingBuf);
1750
1750
  }
1751
- fs23.write(this.fd, this._writingBuf, release);
1751
+ fs24.write(this.fd, this._writingBuf, release);
1752
1752
  }
1753
1753
  }
1754
1754
  function actualClose(sonic) {
@@ -1764,12 +1764,12 @@ var require_sonic_boom = __commonJS({
1764
1764
  sonic._lens = [];
1765
1765
  assert(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
1766
1766
  try {
1767
- fs23.fsync(sonic.fd, closeWrapped);
1767
+ fs24.fsync(sonic.fd, closeWrapped);
1768
1768
  } catch {
1769
1769
  }
1770
1770
  function closeWrapped() {
1771
1771
  if (sonic.fd !== 1 && sonic.fd !== 2) {
1772
- fs23.close(sonic.fd, done);
1772
+ fs24.close(sonic.fd, done);
1773
1773
  } else {
1774
1774
  done();
1775
1775
  }
@@ -2026,7 +2026,7 @@ var require_thread_stream = __commonJS({
2026
2026
  var { version: version2 } = require_package();
2027
2027
  var { EventEmitter } = require("events");
2028
2028
  var { Worker } = require("worker_threads");
2029
- var { join: join3 } = require("path");
2029
+ var { join: join4 } = require("path");
2030
2030
  var { pathToFileURL } = require("url");
2031
2031
  var { wait } = require_wait();
2032
2032
  var {
@@ -2062,7 +2062,7 @@ var require_thread_stream = __commonJS({
2062
2062
  function createWorker(stream, opts) {
2063
2063
  const { filename, workerData } = opts;
2064
2064
  const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
2065
- const toExecute = bundlerOverrides["thread-stream-worker"] || join3(__dirname, "lib", "worker.js");
2065
+ const toExecute = bundlerOverrides["thread-stream-worker"] || join4(__dirname, "lib", "worker.js");
2066
2066
  const worker = new Worker(toExecute, {
2067
2067
  ...opts.workerOpts,
2068
2068
  trackUnmanagedFds: false,
@@ -2448,7 +2448,7 @@ var require_transport = __commonJS({
2448
2448
  "use strict";
2449
2449
  var { createRequire } = require("module");
2450
2450
  var getCallers = require_caller();
2451
- var { join: join3, isAbsolute, sep } = require("path");
2451
+ var { join: join4, isAbsolute, sep } = require("path");
2452
2452
  var sleep = require_atomic_sleep();
2453
2453
  var onExit = require_on_exit_leak_free();
2454
2454
  var ThreadStream = require_thread_stream();
@@ -2511,7 +2511,7 @@ var require_transport = __commonJS({
2511
2511
  throw new Error("only one of target or targets can be specified");
2512
2512
  }
2513
2513
  if (targets) {
2514
- target = bundlerOverrides["pino-worker"] || join3(__dirname, "worker.js");
2514
+ target = bundlerOverrides["pino-worker"] || join4(__dirname, "worker.js");
2515
2515
  options.targets = targets.filter((dest) => dest.target).map((dest) => {
2516
2516
  return {
2517
2517
  ...dest,
@@ -2529,7 +2529,7 @@ var require_transport = __commonJS({
2529
2529
  });
2530
2530
  });
2531
2531
  } else if (pipeline2) {
2532
- target = bundlerOverrides["pino-worker"] || join3(__dirname, "worker.js");
2532
+ target = bundlerOverrides["pino-worker"] || join4(__dirname, "worker.js");
2533
2533
  options.pipelines = [pipeline2.map((dest) => {
2534
2534
  return {
2535
2535
  ...dest,
@@ -2551,7 +2551,7 @@ var require_transport = __commonJS({
2551
2551
  return origin;
2552
2552
  }
2553
2553
  if (origin === "pino/file") {
2554
- return join3(__dirname, "..", "file.js");
2554
+ return join4(__dirname, "..", "file.js");
2555
2555
  }
2556
2556
  let fixTarget2;
2557
2557
  for (const filePath of callers) {
@@ -3541,7 +3541,7 @@ var require_safe_stable_stringify = __commonJS({
3541
3541
  return circularValue;
3542
3542
  }
3543
3543
  let res = "";
3544
- let join3 = ",";
3544
+ let join4 = ",";
3545
3545
  const originalIndentation = indentation;
3546
3546
  if (Array.isArray(value)) {
3547
3547
  if (value.length === 0) {
@@ -3555,7 +3555,7 @@ var require_safe_stable_stringify = __commonJS({
3555
3555
  indentation += spacer;
3556
3556
  res += `
3557
3557
  ${indentation}`;
3558
- join3 = `,
3558
+ join4 = `,
3559
3559
  ${indentation}`;
3560
3560
  }
3561
3561
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -3563,13 +3563,13 @@ ${indentation}`;
3563
3563
  for (; i < maximumValuesToStringify - 1; i++) {
3564
3564
  const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
3565
3565
  res += tmp2 !== void 0 ? tmp2 : "null";
3566
- res += join3;
3566
+ res += join4;
3567
3567
  }
3568
3568
  const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
3569
3569
  res += tmp !== void 0 ? tmp : "null";
3570
3570
  if (value.length - 1 > maximumBreadth) {
3571
3571
  const removedKeys = value.length - maximumBreadth - 1;
3572
- res += `${join3}"... ${getItemCount(removedKeys)} not stringified"`;
3572
+ res += `${join4}"... ${getItemCount(removedKeys)} not stringified"`;
3573
3573
  }
3574
3574
  if (spacer !== "") {
3575
3575
  res += `
@@ -3590,7 +3590,7 @@ ${originalIndentation}`;
3590
3590
  let separator = "";
3591
3591
  if (spacer !== "") {
3592
3592
  indentation += spacer;
3593
- join3 = `,
3593
+ join4 = `,
3594
3594
  ${indentation}`;
3595
3595
  whitespace = " ";
3596
3596
  }
@@ -3604,13 +3604,13 @@ ${indentation}`;
3604
3604
  const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
3605
3605
  if (tmp !== void 0) {
3606
3606
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
3607
- separator = join3;
3607
+ separator = join4;
3608
3608
  }
3609
3609
  }
3610
3610
  if (keyLength > maximumBreadth) {
3611
3611
  const removedKeys = keyLength - maximumBreadth;
3612
3612
  res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
3613
- separator = join3;
3613
+ separator = join4;
3614
3614
  }
3615
3615
  if (spacer !== "" && separator.length > 1) {
3616
3616
  res = `
@@ -3651,7 +3651,7 @@ ${originalIndentation}`;
3651
3651
  }
3652
3652
  const originalIndentation = indentation;
3653
3653
  let res = "";
3654
- let join3 = ",";
3654
+ let join4 = ",";
3655
3655
  if (Array.isArray(value)) {
3656
3656
  if (value.length === 0) {
3657
3657
  return "[]";
@@ -3664,7 +3664,7 @@ ${originalIndentation}`;
3664
3664
  indentation += spacer;
3665
3665
  res += `
3666
3666
  ${indentation}`;
3667
- join3 = `,
3667
+ join4 = `,
3668
3668
  ${indentation}`;
3669
3669
  }
3670
3670
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -3672,13 +3672,13 @@ ${indentation}`;
3672
3672
  for (; i < maximumValuesToStringify - 1; i++) {
3673
3673
  const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
3674
3674
  res += tmp2 !== void 0 ? tmp2 : "null";
3675
- res += join3;
3675
+ res += join4;
3676
3676
  }
3677
3677
  const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
3678
3678
  res += tmp !== void 0 ? tmp : "null";
3679
3679
  if (value.length - 1 > maximumBreadth) {
3680
3680
  const removedKeys = value.length - maximumBreadth - 1;
3681
- res += `${join3}"... ${getItemCount(removedKeys)} not stringified"`;
3681
+ res += `${join4}"... ${getItemCount(removedKeys)} not stringified"`;
3682
3682
  }
3683
3683
  if (spacer !== "") {
3684
3684
  res += `
@@ -3691,7 +3691,7 @@ ${originalIndentation}`;
3691
3691
  let whitespace = "";
3692
3692
  if (spacer !== "") {
3693
3693
  indentation += spacer;
3694
- join3 = `,
3694
+ join4 = `,
3695
3695
  ${indentation}`;
3696
3696
  whitespace = " ";
3697
3697
  }
@@ -3700,7 +3700,7 @@ ${indentation}`;
3700
3700
  const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
3701
3701
  if (tmp !== void 0) {
3702
3702
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
3703
- separator = join3;
3703
+ separator = join4;
3704
3704
  }
3705
3705
  }
3706
3706
  if (spacer !== "" && separator.length > 1) {
@@ -3758,20 +3758,20 @@ ${originalIndentation}`;
3758
3758
  indentation += spacer;
3759
3759
  let res2 = `
3760
3760
  ${indentation}`;
3761
- const join4 = `,
3761
+ const join5 = `,
3762
3762
  ${indentation}`;
3763
3763
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
3764
3764
  let i = 0;
3765
3765
  for (; i < maximumValuesToStringify - 1; i++) {
3766
3766
  const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
3767
3767
  res2 += tmp2 !== void 0 ? tmp2 : "null";
3768
- res2 += join4;
3768
+ res2 += join5;
3769
3769
  }
3770
3770
  const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
3771
3771
  res2 += tmp !== void 0 ? tmp : "null";
3772
3772
  if (value.length - 1 > maximumBreadth) {
3773
3773
  const removedKeys = value.length - maximumBreadth - 1;
3774
- res2 += `${join4}"... ${getItemCount(removedKeys)} not stringified"`;
3774
+ res2 += `${join5}"... ${getItemCount(removedKeys)} not stringified"`;
3775
3775
  }
3776
3776
  res2 += `
3777
3777
  ${originalIndentation}`;
@@ -3787,16 +3787,16 @@ ${originalIndentation}`;
3787
3787
  return '"[Object]"';
3788
3788
  }
3789
3789
  indentation += spacer;
3790
- const join3 = `,
3790
+ const join4 = `,
3791
3791
  ${indentation}`;
3792
3792
  let res = "";
3793
3793
  let separator = "";
3794
3794
  let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
3795
3795
  if (isTypedArrayWithEntries(value)) {
3796
- res += stringifyTypedArray(value, join3, maximumBreadth);
3796
+ res += stringifyTypedArray(value, join4, maximumBreadth);
3797
3797
  keys = keys.slice(value.length);
3798
3798
  maximumPropertiesToStringify -= value.length;
3799
- separator = join3;
3799
+ separator = join4;
3800
3800
  }
3801
3801
  if (deterministic) {
3802
3802
  keys = sort(keys, comparator);
@@ -3807,13 +3807,13 @@ ${indentation}`;
3807
3807
  const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
3808
3808
  if (tmp !== void 0) {
3809
3809
  res += `${separator}${strEscape(key2)}: ${tmp}`;
3810
- separator = join3;
3810
+ separator = join4;
3811
3811
  }
3812
3812
  }
3813
3813
  if (keyLength > maximumBreadth) {
3814
3814
  const removedKeys = keyLength - maximumBreadth;
3815
3815
  res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
3816
- separator = join3;
3816
+ separator = join4;
3817
3817
  }
3818
3818
  if (separator !== "") {
3819
3819
  res = `
@@ -4895,8 +4895,8 @@ var init_parseUtil = __esm({
4895
4895
  init_errors2();
4896
4896
  init_en();
4897
4897
  makeIssue = (params) => {
4898
- const { data, path: path24, errorMaps, issueData } = params;
4899
- const fullPath = [...path24, ...issueData.path || []];
4898
+ const { data, path: path25, errorMaps, issueData } = params;
4899
+ const fullPath = [...path25, ...issueData.path || []];
4900
4900
  const fullIssue = {
4901
4901
  ...issueData,
4902
4902
  path: fullPath
@@ -5207,11 +5207,11 @@ var init_types = __esm({
5207
5207
  init_parseUtil();
5208
5208
  init_util();
5209
5209
  ParseInputLazyPath = class {
5210
- constructor(parent, value, path24, key) {
5210
+ constructor(parent, value, path25, key) {
5211
5211
  this._cachedPath = [];
5212
5212
  this.parent = parent;
5213
5213
  this.data = value;
5214
- this._path = path24;
5214
+ this._path = path25;
5215
5215
  this._key = key;
5216
5216
  }
5217
5217
  get path() {
@@ -9823,11 +9823,11 @@ var init_lib = __esm({
9823
9823
  }
9824
9824
  }
9825
9825
  },
9826
- addToPath: function addToPath(path24, added, removed, oldPosInc, options) {
9827
- var last = path24.lastComponent;
9826
+ addToPath: function addToPath(path25, added, removed, oldPosInc, options) {
9827
+ var last = path25.lastComponent;
9828
9828
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
9829
9829
  return {
9830
- oldPos: path24.oldPos + oldPosInc,
9830
+ oldPos: path25.oldPos + oldPosInc,
9831
9831
  lastComponent: {
9832
9832
  count: last.count + 1,
9833
9833
  added,
@@ -9837,7 +9837,7 @@ var init_lib = __esm({
9837
9837
  };
9838
9838
  } else {
9839
9839
  return {
9840
- oldPos: path24.oldPos + oldPosInc,
9840
+ oldPos: path25.oldPos + oldPosInc,
9841
9841
  lastComponent: {
9842
9842
  count: 1,
9843
9843
  added,
@@ -9895,7 +9895,7 @@ var init_lib = __esm({
9895
9895
  tokenize: function tokenize(value) {
9896
9896
  return Array.from(value);
9897
9897
  },
9898
- join: function join2(chars) {
9898
+ join: function join3(chars) {
9899
9899
  return chars.join("");
9900
9900
  },
9901
9901
  postProcess: function postProcess(changeObjects) {
@@ -10268,10 +10268,10 @@ function attachmentToHistoryMessage(o, ts) {
10268
10268
  const memories = raw.map((m) => {
10269
10269
  if (!m || typeof m !== "object") return null;
10270
10270
  const rec = m;
10271
- const path24 = typeof rec.path === "string" ? rec.path : null;
10271
+ const path25 = typeof rec.path === "string" ? rec.path : null;
10272
10272
  const content = typeof rec.content === "string" ? rec.content : null;
10273
- if (!path24 || content == null) return null;
10274
- const entry = { path: path24, content };
10273
+ if (!path25 || content == null) return null;
10274
+ const entry = { path: path25, content };
10275
10275
  if (typeof rec.mtimeMs === "number") entry.mtimeMs = rec.mtimeMs;
10276
10276
  return entry;
10277
10277
  }).filter((m) => m !== null);
@@ -11075,10 +11075,10 @@ function parseAttachment(obj) {
11075
11075
  const memories = raw.map((m) => {
11076
11076
  if (!m || typeof m !== "object") return null;
11077
11077
  const rec = m;
11078
- const path24 = typeof rec.path === "string" ? rec.path : null;
11078
+ const path25 = typeof rec.path === "string" ? rec.path : null;
11079
11079
  const content = typeof rec.content === "string" ? rec.content : null;
11080
- if (!path24 || content == null) return null;
11081
- const out = { path: path24, content };
11080
+ if (!path25 || content == null) return null;
11081
+ const out = { path: path25, content };
11082
11082
  if (typeof rec.mtimeMs === "number") out.mtimeMs = rec.mtimeMs;
11083
11083
  return out;
11084
11084
  }).filter((m) => m !== null);
@@ -14950,11 +14950,11 @@ function startRunCaseRecorder(opts) {
14950
14950
  let closing = false;
14951
14951
  let closedSettled = false;
14952
14952
  let closedResolve;
14953
- const closed = new Promise((resolve) => {
14953
+ const closed = new Promise((resolve2) => {
14954
14954
  closedResolve = () => {
14955
14955
  if (closedSettled) return;
14956
14956
  closedSettled = true;
14957
- resolve();
14957
+ resolve2();
14958
14958
  };
14959
14959
  });
14960
14960
  const ensureStream = () => {
@@ -15046,8 +15046,8 @@ async function runController(opts) {
15046
15046
  let exitCode = null;
15047
15047
  let procExited = false;
15048
15048
  let resolveProcExit;
15049
- const procExitPromise = new Promise((resolve) => {
15050
- resolveProcExit = resolve;
15049
+ const procExitPromise = new Promise((resolve2) => {
15050
+ resolveProcExit = resolve2;
15051
15051
  });
15052
15052
  const writeEvent = (event) => {
15053
15053
  try {
@@ -16305,8 +16305,8 @@ function startRecorder(opts) {
16305
16305
  const filePath = import_node_path4.default.join(dir, `${tsForFilename(now())}.jsonl`);
16306
16306
  let stream = null;
16307
16307
  let closedResolve;
16308
- const closed = new Promise((resolve) => {
16309
- closedResolve = resolve;
16308
+ const closed = new Promise((resolve2) => {
16309
+ closedResolve = resolve2;
16310
16310
  });
16311
16311
  let exited = false;
16312
16312
  const ensureStream = () => {
@@ -16447,13 +16447,13 @@ var SessionRunner = class {
16447
16447
  // 已经停止则立即 resolve;超时(默认 3000ms)抛错由上层透传成 RPC error
16448
16448
  async waitUntilStopped(timeoutMs = DEFAULT_WAIT_STOP_TIMEOUT_MS) {
16449
16449
  if (!this.state.procAlive) return;
16450
- return new Promise((resolve, reject) => {
16450
+ return new Promise((resolve2, reject) => {
16451
16451
  let settled = false;
16452
16452
  const onStop = () => {
16453
16453
  if (settled) return;
16454
16454
  settled = true;
16455
16455
  clearTimeout(timer);
16456
- resolve();
16456
+ resolve2();
16457
16457
  };
16458
16458
  const timer = setTimeout(() => {
16459
16459
  if (settled) return;
@@ -16498,7 +16498,7 @@ var SessionRunner = class {
16498
16498
  };
16499
16499
  const payload = JSON.stringify(frame) + "\n";
16500
16500
  const timeoutMs = opts.timeoutMs ?? DEFAULT_CONTROL_REQUEST_TIMEOUT_MS;
16501
- return new Promise((resolve, reject) => {
16501
+ return new Promise((resolve2, reject) => {
16502
16502
  const timer = setTimeout(() => {
16503
16503
  const pending = this.pendingControlRequests.get(requestId);
16504
16504
  if (!pending) return;
@@ -16506,7 +16506,7 @@ var SessionRunner = class {
16506
16506
  reject(new Error(`control_request timeout: ${subtype}`));
16507
16507
  }, timeoutMs);
16508
16508
  timer.unref?.();
16509
- this.pendingControlRequests.set(requestId, { resolve, reject, timer });
16509
+ this.pendingControlRequests.set(requestId, { resolve: resolve2, reject, timer });
16510
16510
  try {
16511
16511
  proc.stdin?.write(payload);
16512
16512
  this.recorder?.tapStdinWrite(payload);
@@ -17919,6 +17919,102 @@ var PersonaManager = class {
17919
17919
  }
17920
17920
  };
17921
17921
 
17922
+ // src/persona/seed.ts
17923
+ var fs7 = __toESM(require("fs"), 1);
17924
+ var path7 = __toESM(require("path"), 1);
17925
+ var import_node_url = require("url");
17926
+ var import_meta = {};
17927
+ var DEFAULT_PERSONAS = [
17928
+ {
17929
+ personaId: "persona-researcher",
17930
+ label: "\u8C03\u7814\u5458",
17931
+ model: "opus",
17932
+ iconKey: "research",
17933
+ public: false
17934
+ },
17935
+ {
17936
+ personaId: "persona-knowledge-base",
17937
+ label: "\u77E5\u8BC6\u5E93\u7BA1\u7406\u5458",
17938
+ model: "opus",
17939
+ iconKey: "reading",
17940
+ public: false
17941
+ }
17942
+ ];
17943
+ function findDefaultsRoot() {
17944
+ const candidates = [];
17945
+ try {
17946
+ const here = path7.dirname((0, import_node_url.fileURLToPath)(import_meta.url));
17947
+ candidates.push(path7.resolve(here, "defaults"));
17948
+ candidates.push(path7.resolve(here, "persona-defaults"));
17949
+ } catch {
17950
+ }
17951
+ if (process.argv[1]) {
17952
+ const argvDir = path7.dirname(process.argv[1]);
17953
+ candidates.push(path7.resolve(argvDir, "persona-defaults"));
17954
+ }
17955
+ for (const c of candidates) {
17956
+ try {
17957
+ if (fs7.statSync(c).isDirectory()) return c;
17958
+ } catch {
17959
+ }
17960
+ }
17961
+ return null;
17962
+ }
17963
+ function seedDefaultPersonas(args) {
17964
+ const entries = args.entries ?? DEFAULT_PERSONAS;
17965
+ for (const entry of entries) {
17966
+ if (args.store.has(entry.personaId)) {
17967
+ args.logger.info("persona.seed.skip", { personaId: entry.personaId, reason: "exists" });
17968
+ continue;
17969
+ }
17970
+ const bundleDir = path7.join(args.defaultsRoot, entry.personaId);
17971
+ if (!fs7.existsSync(bundleDir)) {
17972
+ args.logger.warn("persona.seed.skip", {
17973
+ personaId: entry.personaId,
17974
+ reason: "bundle-missing",
17975
+ bundleDir
17976
+ });
17977
+ continue;
17978
+ }
17979
+ const claudeMdPath = path7.join(bundleDir, "CLAUDE.md");
17980
+ if (!fs7.existsSync(claudeMdPath)) {
17981
+ args.logger.warn("persona.seed.skip", {
17982
+ personaId: entry.personaId,
17983
+ reason: "no-CLAUDE.md",
17984
+ bundleDir
17985
+ });
17986
+ continue;
17987
+ }
17988
+ const personality = fs7.readFileSync(claudeMdPath, "utf8");
17989
+ const now = Date.now();
17990
+ const persona = {
17991
+ personaId: entry.personaId,
17992
+ label: entry.label,
17993
+ model: entry.model,
17994
+ public: entry.public,
17995
+ iconKey: entry.iconKey,
17996
+ tokenMap: {},
17997
+ createdAt: now,
17998
+ updatedAt: now
17999
+ };
18000
+ args.store.write(persona, personality);
18001
+ copyBundleExtras(bundleDir, args.store.personaDirPath(entry.personaId));
18002
+ args.logger.info("persona.seed.created", { personaId: entry.personaId });
18003
+ }
18004
+ }
18005
+ function copyBundleExtras(srcDir, dstDir) {
18006
+ for (const entry of fs7.readdirSync(srcDir, { withFileTypes: true })) {
18007
+ if (entry.name === "CLAUDE.md" || entry.name === ".clawd") continue;
18008
+ const srcPath = path7.join(srcDir, entry.name);
18009
+ const dstPath = path7.join(dstDir, entry.name);
18010
+ if (entry.isDirectory()) {
18011
+ fs7.cpSync(srcPath, dstPath, { recursive: true, dereference: true });
18012
+ } else if (entry.isFile()) {
18013
+ fs7.copyFileSync(srcPath, dstPath);
18014
+ }
18015
+ }
18016
+ }
18017
+
17922
18018
  // src/index.ts
17923
18019
  init_claude();
17924
18020
  init_claude_history();
@@ -18680,7 +18776,7 @@ var LocalWsServer = class {
18680
18776
  pingIntervalMs;
18681
18777
  async start() {
18682
18778
  const host = this.opts.host ?? "127.0.0.1";
18683
- await new Promise((resolve, reject) => {
18779
+ await new Promise((resolve2, reject) => {
18684
18780
  const wss = new import_websocket_server.default({
18685
18781
  host,
18686
18782
  port: this.opts.port,
@@ -18688,7 +18784,7 @@ var LocalWsServer = class {
18688
18784
  });
18689
18785
  wss.on("listening", () => {
18690
18786
  this.logger?.info("ws listening", { host, port: this.opts.port });
18691
- resolve();
18787
+ resolve2();
18692
18788
  });
18693
18789
  wss.on("error", (err) => {
18694
18790
  this.logger?.error("ws server error", { err: err.message });
@@ -18708,8 +18804,8 @@ var LocalWsServer = class {
18708
18804
  if (c.pingTimer) clearInterval(c.pingTimer);
18709
18805
  }
18710
18806
  this.clients.clear();
18711
- await new Promise((resolve) => {
18712
- this.wss?.close(() => resolve());
18807
+ await new Promise((resolve2) => {
18808
+ this.wss?.close(() => resolve2());
18713
18809
  });
18714
18810
  this.wss = null;
18715
18811
  }
@@ -19516,10 +19612,10 @@ async function extractFrpcFromTarball(tarball, binDir, version2, platform, destB
19516
19612
  const work = import_node_path14.default.join(binDir, `extract-${process.pid}-${Date.now()}`);
19517
19613
  import_node_fs14.default.mkdirSync(work, { recursive: true });
19518
19614
  try {
19519
- await new Promise((resolve, reject) => {
19615
+ await new Promise((resolve2, reject) => {
19520
19616
  const proc = (0, import_node_child_process3.spawn)("tar", ["xzf", tarball, "-C", work], { stdio: "pipe" });
19521
19617
  proc.on("error", reject);
19522
- proc.on("exit", (code) => code === 0 ? resolve() : reject(new Error(`tar exited ${code}`)));
19618
+ proc.on("exit", (code) => code === 0 ? resolve2() : reject(new Error(`tar exited ${code}`)));
19523
19619
  });
19524
19620
  const dirName = `frp_${version2}_${platform.os}_${platform.arch}`;
19525
19621
  const src = import_node_path14.default.join(work, dirName, "frpc");
@@ -19597,17 +19693,17 @@ var TunnelManager = class {
19597
19693
  this.proc = null;
19598
19694
  if (!proc) return;
19599
19695
  proc.kill("SIGTERM");
19600
- await new Promise((resolve) => {
19696
+ await new Promise((resolve2) => {
19601
19697
  const t = setTimeout(() => {
19602
19698
  try {
19603
19699
  proc.kill("SIGKILL");
19604
19700
  } catch {
19605
19701
  }
19606
- resolve();
19702
+ resolve2();
19607
19703
  }, 5e3);
19608
19704
  proc.once("exit", () => {
19609
19705
  clearTimeout(t);
19610
- resolve();
19706
+ resolve2();
19611
19707
  });
19612
19708
  });
19613
19709
  }
@@ -19708,14 +19804,14 @@ function formatFrpcTail(raw, maxLines = 12) {
19708
19804
  return ["\u2500\u2500\u2500 frpc output (last lines) \u2500\u2500\u2500", tail, "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"].join("\n");
19709
19805
  }
19710
19806
  async function waitForFrpcReady(proc, timeoutMs) {
19711
- return new Promise((resolve) => {
19807
+ return new Promise((resolve2) => {
19712
19808
  let settled = false;
19713
19809
  let buf = "";
19714
19810
  const finish = (r) => {
19715
19811
  if (settled) return;
19716
19812
  settled = true;
19717
19813
  cleanup();
19718
- resolve(r);
19814
+ resolve2(r);
19719
19815
  };
19720
19816
  const onData = (chunk) => {
19721
19817
  buf += String(chunk);
@@ -20675,6 +20771,12 @@ async function startDaemon(config) {
20675
20771
  const history = new ClaudeHistoryReader();
20676
20772
  let transport = null;
20677
20773
  const personaStore = new PersonaStore(import_node_path20.default.join(config.dataDir, "personas"));
20774
+ const defaultsRoot = findDefaultsRoot();
20775
+ if (defaultsRoot) {
20776
+ seedDefaultPersonas({ store: personaStore, defaultsRoot, logger });
20777
+ } else {
20778
+ logger.warn("persona.seed.skip", { reason: "defaults-root-not-found" });
20779
+ }
20678
20780
  const ownerDisplayName = loadOwnerDisplayName(config.dataDir);
20679
20781
  const manager = new SessionManager({
20680
20782
  store,