denchclaw 2.0.1 → 2.0.4

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 (126) hide show
  1. package/README.md +1 -1
  2. package/apps/web/.next/standalone/apps/web/.env +1 -0
  3. package/apps/web/.next/standalone/apps/web/.next/BUILD_ID +1 -1
  4. package/apps/web/.next/standalone/apps/web/.next/app-build-manifest.json +105 -104
  5. package/apps/web/.next/standalone/apps/web/.next/app-path-routes-manifest.json +30 -30
  6. package/apps/web/.next/standalone/apps/web/.next/build-manifest.json +2 -2
  7. package/apps/web/.next/standalone/apps/web/.next/server/app/_not-found/page.js +2 -2
  8. package/apps/web/.next/standalone/apps/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  9. package/apps/web/.next/standalone/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  10. package/apps/web/.next/standalone/apps/web/.next/server/app/_not-found.html +1 -1
  11. package/apps/web/.next/standalone/apps/web/.next/server/app/_not-found.rsc +14 -13
  12. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/active/route_client-reference-manifest.js +1 -1
  13. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/route.js +2 -2
  14. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/route.js.nft.json +1 -1
  15. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/route_client-reference-manifest.js +1 -1
  16. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/stop/route.js +1 -1
  17. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/stop/route.js.nft.json +1 -1
  18. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/stop/route_client-reference-manifest.js +1 -1
  19. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/stream/route_client-reference-manifest.js +1 -1
  20. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/subagents/route_client-reference-manifest.js +1 -1
  21. package/apps/web/.next/standalone/apps/web/.next/server/app/api/cron/jobs/[jobId]/runs/route_client-reference-manifest.js +1 -1
  22. package/apps/web/.next/standalone/apps/web/.next/server/app/api/cron/jobs/route_client-reference-manifest.js +1 -1
  23. package/apps/web/.next/standalone/apps/web/.next/server/app/api/cron/runs/[sessionId]/route_client-reference-manifest.js +1 -1
  24. package/apps/web/.next/standalone/apps/web/.next/server/app/api/cron/runs/search-transcript/route_client-reference-manifest.js +1 -1
  25. package/apps/web/.next/standalone/apps/web/.next/server/app/api/memories/route_client-reference-manifest.js +1 -1
  26. package/apps/web/.next/standalone/apps/web/.next/server/app/api/profiles/route_client-reference-manifest.js +1 -1
  27. package/apps/web/.next/standalone/apps/web/.next/server/app/api/profiles/switch/route_client-reference-manifest.js +1 -1
  28. package/apps/web/.next/standalone/apps/web/.next/server/app/api/sessions/[sessionId]/route_client-reference-manifest.js +1 -1
  29. package/apps/web/.next/standalone/apps/web/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
  30. package/apps/web/.next/standalone/apps/web/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  31. package/apps/web/.next/standalone/apps/web/.next/server/app/api/web-sessions/[id]/messages/route_client-reference-manifest.js +1 -1
  32. package/apps/web/.next/standalone/apps/web/.next/server/app/api/web-sessions/[id]/route_client-reference-manifest.js +1 -1
  33. package/apps/web/.next/standalone/apps/web/.next/server/app/api/web-sessions/route.js +1 -1
  34. package/apps/web/.next/standalone/apps/web/.next/server/app/api/web-sessions/route.js.nft.json +1 -1
  35. package/apps/web/.next/standalone/apps/web/.next/server/app/api/web-sessions/route_client-reference-manifest.js +1 -1
  36. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/assets/[...path]/route_client-reference-manifest.js +1 -1
  37. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/browse/route_client-reference-manifest.js +1 -1
  38. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/browse-file/route_client-reference-manifest.js +1 -1
  39. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/context/route_client-reference-manifest.js +1 -1
  40. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/copy/route_client-reference-manifest.js +1 -1
  41. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/db/introspect/route_client-reference-manifest.js +1 -1
  42. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/db/query/route_client-reference-manifest.js +1 -1
  43. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/delete/route.js +1 -1
  44. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/delete/route.js.nft.json +1 -1
  45. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/delete/route_client-reference-manifest.js +1 -1
  46. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/file/route_client-reference-manifest.js +1 -1
  47. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/init/route.js +4 -4
  48. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/init/route.js.nft.json +1 -1
  49. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/init/route_client-reference-manifest.js +1 -1
  50. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/list/route_client-reference-manifest.js +1 -1
  51. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/mkdir/route_client-reference-manifest.js +1 -1
  52. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/move/route_client-reference-manifest.js +1 -1
  53. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/display-field/route_client-reference-manifest.js +1 -1
  54. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/[id]/route_client-reference-manifest.js +1 -1
  55. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/bulk-delete/route_client-reference-manifest.js +1 -1
  56. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/options/route_client-reference-manifest.js +1 -1
  57. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/route.js +1 -1
  58. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/route.js.nft.json +1 -1
  59. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/route_client-reference-manifest.js +1 -1
  60. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/fields/[fieldId]/enum-rename/route_client-reference-manifest.js +1 -1
  61. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/fields/[fieldId]/route_client-reference-manifest.js +1 -1
  62. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/fields/reorder/route_client-reference-manifest.js +1 -1
  63. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/route_client-reference-manifest.js +1 -1
  64. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/views/route_client-reference-manifest.js +1 -1
  65. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/open-file/route_client-reference-manifest.js +1 -1
  66. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/path-info/route_client-reference-manifest.js +1 -1
  67. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/query/route_client-reference-manifest.js +1 -1
  68. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/raw-file/route_client-reference-manifest.js +1 -1
  69. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/rename/route_client-reference-manifest.js +1 -1
  70. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/reports/execute/route.js +1 -1
  71. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/reports/execute/route.js.nft.json +1 -1
  72. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/reports/execute/route_client-reference-manifest.js +1 -1
  73. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/search-index/route_client-reference-manifest.js +1 -1
  74. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/suggest-files/route_client-reference-manifest.js +1 -1
  75. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/switch/route.js +1 -1
  76. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/switch/route.js.nft.json +1 -1
  77. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/switch/route_client-reference-manifest.js +1 -1
  78. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/thumbnail/route_client-reference-manifest.js +1 -1
  79. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/tree/route_client-reference-manifest.js +1 -1
  80. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/upload/route.js +1 -1
  81. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/upload/route.js.nft.json +1 -1
  82. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/upload/route_client-reference-manifest.js +1 -1
  83. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/virtual-file/route_client-reference-manifest.js +1 -1
  84. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/watch/route_client-reference-manifest.js +1 -1
  85. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/write-binary/route_client-reference-manifest.js +1 -1
  86. package/apps/web/.next/standalone/apps/web/.next/server/app/index.html +2 -2
  87. package/apps/web/.next/standalone/apps/web/.next/server/app/index.rsc +18 -17
  88. package/apps/web/.next/standalone/apps/web/.next/server/app/page.js +3 -3
  89. package/apps/web/.next/standalone/apps/web/.next/server/app/page.js.nft.json +1 -1
  90. package/apps/web/.next/standalone/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
  91. package/apps/web/.next/standalone/apps/web/.next/server/app/workspace/page.js +9 -9
  92. package/apps/web/.next/standalone/apps/web/.next/server/app/workspace/page.js.nft.json +1 -1
  93. package/apps/web/.next/standalone/apps/web/.next/server/app/workspace/page_client-reference-manifest.js +1 -1
  94. package/apps/web/.next/standalone/apps/web/.next/server/app/workspace.html +1 -1
  95. package/apps/web/.next/standalone/apps/web/.next/server/app/workspace.rsc +18 -17
  96. package/apps/web/.next/standalone/apps/web/.next/server/app-paths-manifest.json +30 -30
  97. package/apps/web/.next/standalone/apps/web/.next/server/chunks/3180.js +9 -0
  98. package/apps/web/.next/standalone/apps/web/.next/server/chunks/3536.js +1 -0
  99. package/apps/web/.next/standalone/apps/web/.next/server/functions-config-manifest.json +19 -19
  100. package/apps/web/.next/standalone/apps/web/.next/server/pages/404.html +1 -1
  101. package/apps/web/.next/standalone/apps/web/.next/server/pages/500.html +1 -1
  102. package/apps/web/.next/{static/chunks/9978-67863ef76a85970a.js → standalone/apps/web/.next/static/chunks/9978-a2bf90231d08284f.js} +1 -1
  103. package/apps/web/.next/standalone/apps/web/.next/static/chunks/app/layout-292b6d5625f1c941.js +1 -0
  104. package/apps/web/.next/standalone/apps/web/.next/static/chunks/app/workspace/page-a9c68aaa3f71a7fe.js +1 -0
  105. package/apps/web/.next/standalone/apps/web/.next/static/chunks/df90ee31-33cbf7968acd3b6e.js +1 -0
  106. package/apps/web/.next/standalone/apps/web/package.json +3 -1
  107. package/apps/web/.next/standalone/package.json +2 -1
  108. package/apps/web/.next/{standalone/apps/web/.next/static/chunks/9978-67863ef76a85970a.js → static/chunks/9978-a2bf90231d08284f.js} +1 -1
  109. package/apps/web/.next/static/chunks/app/layout-292b6d5625f1c941.js +1 -0
  110. package/apps/web/.next/static/chunks/app/workspace/page-a9c68aaa3f71a7fe.js +1 -0
  111. package/apps/web/.next/static/chunks/df90ee31-33cbf7968acd3b6e.js +1 -0
  112. package/dist/{cli-name-8WJ6gVD5.js → cli-name-yhDyCrts.js} +1 -1
  113. package/dist/entry.js +2 -2
  114. package/dist/{program-DhxRjAOe.js → program-BjjW6tCn.js} +326 -32
  115. package/dist/{run-main-oHgYgpCR.js → run-main-CZ4r6_2T.js} +9 -6
  116. package/dist/telemetry-Drjj3hin.js +118 -0
  117. package/package.json +2 -1
  118. package/apps/web/.next/standalone/apps/web/.next/server/chunks/9402.js +0 -9
  119. package/apps/web/.next/standalone/apps/web/.next/static/chunks/app/layout-3095921daec5aebc.js +0 -1
  120. package/apps/web/.next/standalone/apps/web/.next/static/chunks/app/workspace/page-d499296a443bbbf0.js +0 -1
  121. package/apps/web/.next/static/chunks/app/layout-3095921daec5aebc.js +0 -1
  122. package/apps/web/.next/static/chunks/app/workspace/page-d499296a443bbbf0.js +0 -1
  123. /package/apps/web/.next/standalone/apps/web/.next/static/{InPdqFM6GAVmsiSfDz98A → uJ5FgQAeCz2zbk8ixyWyc}/_buildManifest.js +0 -0
  124. /package/apps/web/.next/standalone/apps/web/.next/static/{InPdqFM6GAVmsiSfDz98A → uJ5FgQAeCz2zbk8ixyWyc}/_ssgManifest.js +0 -0
  125. /package/apps/web/.next/static/{InPdqFM6GAVmsiSfDz98A → uJ5FgQAeCz2zbk8ixyWyc}/_buildManifest.js +0 -0
  126. /package/apps/web/.next/static/{InPdqFM6GAVmsiSfDz98A → uJ5FgQAeCz2zbk8ixyWyc}/_ssgManifest.js +0 -0
@@ -1,5 +1,6 @@
1
- import { c as hasFlag, d as applyCliProfileEnv, f as expandHomePrefix, i as defaultRuntime, p as resolveRequiredHomeDir, s as getPrimaryCommand, t as isTruthyEnvValue, u as hasRootVersionAlias } from "./entry.js";
2
- import { a as hasEmittedCliBanner, c as theme, i as formatCliBannerLine, n as resolveCliName, o as VERSION, s as isRich, t as replaceCliName } from "./cli-name-8WJ6gVD5.js";
1
+ import { a as readTelemetryConfig, i as markNoticeShown, o as writeTelemetryConfig, r as track, t as isTelemetryEnabled } from "./telemetry-Drjj3hin.js";
2
+ import { a as defaultRuntime, c as getPrimaryCommand, d as hasRootVersionAlias, f as applyCliProfileEnv, l as hasFlag, m as resolveRequiredHomeDir, p as expandHomePrefix, t as isTruthyEnvValue } from "./entry.js";
3
+ import { a as hasEmittedCliBanner, c as theme, i as formatCliBannerLine, n as resolveCliName, o as VERSION, s as isRich, t as replaceCliName } from "./cli-name-yhDyCrts.js";
3
4
  import { execFileSync, spawn } from "node:child_process";
4
5
  import process$1 from "node:process";
5
6
  import os from "node:os";
@@ -681,7 +682,7 @@ Your browser automation behavior is defined by the Browser skill at:
681
682
 
682
683
  ## Links
683
684
 
684
- - Website: https://denchclaw.sh
685
+ - Website: https://denchclaw.com
685
686
  - GitHub: https://github.com/DenchHQ/denchclaw
686
687
  - Skills Store: https://skills.sh
687
688
 
@@ -833,6 +834,10 @@ const MAX_PORT_SCAN_ATTEMPTS = 100;
833
834
  const DEFAULT_BOOTSTRAP_ROLLOUT_STAGE = "default";
834
835
  const DEFAULT_GATEWAY_LAUNCH_AGENT_LABEL = "ai.openclaw.gateway";
835
836
  const REQUIRED_TOOLS_PROFILE = "full";
837
+ const OPENCLAW_CLI_CHECK_CACHE_TTL_MS = 5 * 6e4;
838
+ const OPENCLAW_UPDATE_PROMPT_SUPPRESS_AFTER_INSTALL_MS = 5 * 6e4;
839
+ const OPENCLAW_CLI_CHECK_CACHE_FILE = "openclaw-cli-check.json";
840
+ const OPENCLAW_SETUP_PROGRESS_BAR_WIDTH = 16;
836
841
  function resolveCommandForPlatform(command) {
837
842
  if (process$1.platform !== "win32") return command;
838
843
  if (path.extname(command)) return command;
@@ -869,10 +874,20 @@ async function runCommandWithTimeout(argv, options) {
869
874
  child.kill("SIGKILL");
870
875
  }, options.timeoutMs);
871
876
  child.stdout?.on("data", (chunk) => {
872
- stdout += String(chunk);
877
+ const text = String(chunk);
878
+ stdout += text;
879
+ if (options.onOutputLine) for (const segment of text.split(/\r?\n/)) {
880
+ const line = segment.trim();
881
+ if (line.length > 0) options.onOutputLine(line, "stdout");
882
+ }
873
883
  });
874
884
  child.stderr?.on("data", (chunk) => {
875
- stderr += String(chunk);
885
+ const text = String(chunk);
886
+ stderr += text;
887
+ if (options.onOutputLine) for (const segment of text.split(/\r?\n/)) {
888
+ const line = segment.trim();
889
+ if (line.length > 0) options.onOutputLine(line, "stderr");
890
+ }
876
891
  });
877
892
  child.once("error", (error) => {
878
893
  if (settled) return;
@@ -1042,11 +1057,12 @@ async function ensureToolsProfile(openclawCommand, profile) {
1042
1057
  errorMessage: `Failed to set tools.profile=${REQUIRED_TOOLS_PROFILE}.`
1043
1058
  });
1044
1059
  }
1045
- async function runOpenClaw(openclawCommand, args, timeoutMs, ioMode = "capture", env) {
1060
+ async function runOpenClaw(openclawCommand, args, timeoutMs, ioMode = "capture", env, onOutputLine) {
1046
1061
  return await runCommandWithTimeout([openclawCommand, ...args], {
1047
1062
  timeoutMs,
1048
1063
  ioMode,
1049
- env
1064
+ env,
1065
+ onOutputLine
1050
1066
  });
1051
1067
  }
1052
1068
  async function runOpenClawOrThrow(params) {
@@ -1143,7 +1159,92 @@ function parseJsonPayload(raw) {
1143
1159
  }
1144
1160
  }
1145
1161
  }
1146
- async function detectGlobalOpenClawInstall() {
1162
+ function resolveOpenClawCliCheckCachePath(stateDir) {
1163
+ return path.join(stateDir, "cache", OPENCLAW_CLI_CHECK_CACHE_FILE);
1164
+ }
1165
+ function readOpenClawCliCheckCache(stateDir) {
1166
+ const cachePath = resolveOpenClawCliCheckCachePath(stateDir);
1167
+ if (!existsSync(cachePath)) return;
1168
+ try {
1169
+ const parsed = JSON.parse(readFileSync(cachePath, "utf-8"));
1170
+ if (typeof parsed.checkedAt !== "number" || !Number.isFinite(parsed.checkedAt) || typeof parsed.pathEnv !== "string" || parsed.pathEnv !== (process$1.env.PATH ?? "") || typeof parsed.available !== "boolean" || !parsed.available || typeof parsed.command !== "string" || parsed.command.length === 0) return;
1171
+ const ageMs = Date.now() - parsed.checkedAt;
1172
+ if (ageMs < 0 || ageMs > OPENCLAW_CLI_CHECK_CACHE_TTL_MS) return;
1173
+ if ((parsed.command.includes(path.sep) || parsed.command.includes("/") || parsed.command.includes("\\")) && !existsSync(parsed.command)) return;
1174
+ return {
1175
+ checkedAt: parsed.checkedAt,
1176
+ pathEnv: parsed.pathEnv,
1177
+ available: parsed.available,
1178
+ command: parsed.command,
1179
+ version: typeof parsed.version === "string" ? parsed.version : void 0,
1180
+ globalBinDir: typeof parsed.globalBinDir === "string" ? parsed.globalBinDir : void 0,
1181
+ shellCommandPath: typeof parsed.shellCommandPath === "string" ? parsed.shellCommandPath : void 0,
1182
+ installedAt: typeof parsed.installedAt === "number" ? parsed.installedAt : void 0
1183
+ };
1184
+ } catch {
1185
+ return;
1186
+ }
1187
+ }
1188
+ function writeOpenClawCliCheckCache(stateDir, cache) {
1189
+ try {
1190
+ const cachePath = resolveOpenClawCliCheckCachePath(stateDir);
1191
+ mkdirSync(path.dirname(cachePath), { recursive: true });
1192
+ const payload = {
1193
+ ...cache,
1194
+ checkedAt: Date.now(),
1195
+ pathEnv: process$1.env.PATH ?? ""
1196
+ };
1197
+ writeFileSync(cachePath, JSON.stringify(payload, null, 2), "utf-8");
1198
+ } catch {}
1199
+ }
1200
+ function createOpenClawSetupProgress(params) {
1201
+ if (!params.enabled || params.totalStages <= 0 || !process$1.stdout.isTTY) {
1202
+ const noop = () => void 0;
1203
+ return {
1204
+ startStage: noop,
1205
+ output: noop,
1206
+ completeStage: noop,
1207
+ finish: noop,
1208
+ fail: noop
1209
+ };
1210
+ }
1211
+ const s = spinner();
1212
+ let completedStages = 0;
1213
+ let activeLabel = "";
1214
+ const renderBar = () => {
1215
+ const ratio = completedStages / params.totalStages;
1216
+ const filled = Math.max(0, Math.min(OPENCLAW_SETUP_PROGRESS_BAR_WIDTH, Math.round(ratio * OPENCLAW_SETUP_PROGRESS_BAR_WIDTH)));
1217
+ return `[${`${"#".repeat(filled)}${"-".repeat(OPENCLAW_SETUP_PROGRESS_BAR_WIDTH - filled)}`}] ${completedStages}/${params.totalStages}`;
1218
+ };
1219
+ const truncate = (value, max = 84) => value.length > max ? `${value.slice(0, max - 3)}...` : value;
1220
+ const renderStageLine = (detail) => {
1221
+ const base = `${renderBar()} ${activeLabel}`.trim();
1222
+ if (!detail) return base;
1223
+ return truncate(`${base} -> ${detail}`);
1224
+ };
1225
+ return {
1226
+ startStage: (label) => {
1227
+ activeLabel = label;
1228
+ s.start(renderStageLine());
1229
+ },
1230
+ output: (line) => {
1231
+ if (!line) return;
1232
+ s.message(renderStageLine(line));
1233
+ },
1234
+ completeStage: (suffix) => {
1235
+ completedStages = Math.min(params.totalStages, completedStages + 1);
1236
+ s.stop(renderStageLine(suffix ?? "done"));
1237
+ },
1238
+ finish: (message) => {
1239
+ completedStages = params.totalStages;
1240
+ s.stop(`${renderBar()} ${truncate(message)}`.trim());
1241
+ },
1242
+ fail: (message) => {
1243
+ s.stop(`${renderBar()} ${truncate(message)}`.trim());
1244
+ }
1245
+ };
1246
+ }
1247
+ async function detectGlobalOpenClawInstall(onOutputLine) {
1147
1248
  const result = await runCommandWithTimeout([
1148
1249
  "npm",
1149
1250
  "ls",
@@ -1152,7 +1253,10 @@ async function detectGlobalOpenClawInstall() {
1152
1253
  "--depth=0",
1153
1254
  "--json",
1154
1255
  "--silent"
1155
- ], { timeoutMs: 15e3 }).catch(() => null);
1256
+ ], {
1257
+ timeoutMs: 15e3,
1258
+ onOutputLine
1259
+ }).catch(() => null);
1156
1260
  const installedVersion = (parseJsonPayload(result?.stdout ?? result?.stderr)?.dependencies)?.openclaw?.version;
1157
1261
  if (typeof installedVersion === "string" && installedVersion.length > 0) return {
1158
1262
  installed: true,
@@ -1160,12 +1264,15 @@ async function detectGlobalOpenClawInstall() {
1160
1264
  };
1161
1265
  return { installed: false };
1162
1266
  }
1163
- async function resolveNpmGlobalBinDir() {
1267
+ async function resolveNpmGlobalBinDir(onOutputLine) {
1164
1268
  const result = await runCommandWithTimeout([
1165
1269
  "npm",
1166
1270
  "prefix",
1167
1271
  "-g"
1168
- ], { timeoutMs: 8e3 }).catch(() => null);
1272
+ ], {
1273
+ timeoutMs: 8e3,
1274
+ onOutputLine
1275
+ }).catch(() => null);
1169
1276
  if (!result || result.code !== 0) return;
1170
1277
  const prefix = firstNonEmptyLine$1(result.stdout);
1171
1278
  if (!prefix) return;
@@ -1175,8 +1282,11 @@ function resolveGlobalOpenClawCommand(globalBinDir) {
1175
1282
  if (!globalBinDir) return;
1176
1283
  return (process$1.platform === "win32" ? [path.join(globalBinDir, "openclaw.cmd"), path.join(globalBinDir, "openclaw.exe")] : [path.join(globalBinDir, "openclaw")]).find((candidate) => existsSync(candidate));
1177
1284
  }
1178
- async function resolveShellOpenClawPath() {
1179
- const result = await runCommandWithTimeout([process$1.platform === "win32" ? "where" : "which", "openclaw"], { timeoutMs: 4e3 }).catch(() => null);
1285
+ async function resolveShellOpenClawPath(onOutputLine) {
1286
+ const result = await runCommandWithTimeout([process$1.platform === "win32" ? "where" : "which", "openclaw"], {
1287
+ timeoutMs: 4e3,
1288
+ onOutputLine
1289
+ }).catch(() => null);
1180
1290
  if (!result || result.code !== 0) return;
1181
1291
  return firstNonEmptyLine$1(result.stdout);
1182
1292
  }
@@ -1184,33 +1294,98 @@ function isProjectLocalOpenClawPath(commandPath) {
1184
1294
  if (!commandPath) return false;
1185
1295
  return commandPath.replaceAll("\\", "/").includes("/node_modules/.bin/openclaw");
1186
1296
  }
1187
- async function ensureOpenClawCliAvailable() {
1188
- const globalBefore = await detectGlobalOpenClawInstall();
1297
+ async function ensureOpenClawCliAvailable(params) {
1298
+ const cached = readOpenClawCliCheckCache(params.stateDir);
1299
+ if (cached) {
1300
+ const ageSeconds = Math.max(0, Math.floor((Date.now() - cached.checkedAt) / 1e3));
1301
+ const progress = createOpenClawSetupProgress({
1302
+ enabled: params.showProgress,
1303
+ totalStages: 1
1304
+ });
1305
+ progress.startStage("Reusing cached OpenClaw install check");
1306
+ progress.completeStage(`cache hit (${ageSeconds}s old)`);
1307
+ return {
1308
+ available: true,
1309
+ installed: false,
1310
+ installedAt: cached.installedAt,
1311
+ version: cached.version,
1312
+ command: cached.command,
1313
+ globalBinDir: cached.globalBinDir,
1314
+ shellCommandPath: cached.shellCommandPath
1315
+ };
1316
+ }
1317
+ const progress = createOpenClawSetupProgress({
1318
+ enabled: params.showProgress,
1319
+ totalStages: 5
1320
+ });
1321
+ progress.startStage("Checking global OpenClaw install");
1322
+ const globalBefore = await detectGlobalOpenClawInstall((line) => {
1323
+ progress.output(`npm ls: ${line}`);
1324
+ });
1325
+ progress.completeStage(globalBefore.installed ? `found ${globalBefore.version ?? "installed"}` : "missing");
1189
1326
  let installed = false;
1327
+ let installedAt;
1328
+ progress.startStage("Ensuring openclaw@latest is installed globally");
1190
1329
  if (!globalBefore.installed) {
1191
1330
  const install = await runCommandWithTimeout([
1192
1331
  "npm",
1193
1332
  "install",
1194
1333
  "-g",
1195
1334
  "openclaw@latest"
1196
- ], { timeoutMs: 10 * 6e4 }).catch(() => null);
1197
- if (!install || install.code !== 0) return {
1198
- available: false,
1199
- installed: false,
1200
- version: void 0,
1201
- command: "openclaw"
1202
- };
1335
+ ], {
1336
+ timeoutMs: 10 * 6e4,
1337
+ onOutputLine: (line) => {
1338
+ progress.output(`npm install: ${line}`);
1339
+ }
1340
+ }).catch(() => null);
1341
+ if (!install || install.code !== 0) {
1342
+ progress.fail("OpenClaw global install failed.");
1343
+ return {
1344
+ available: false,
1345
+ installed: false,
1346
+ version: void 0,
1347
+ command: "openclaw"
1348
+ };
1349
+ }
1203
1350
  installed = true;
1204
- }
1205
- const globalAfter = installed ? await detectGlobalOpenClawInstall() : globalBefore;
1206
- const globalBinDir = await resolveNpmGlobalBinDir();
1351
+ installedAt = Date.now();
1352
+ progress.completeStage("installed openclaw@latest");
1353
+ } else progress.completeStage("already installed; skipping install");
1354
+ progress.startStage("Resolving global and shell OpenClaw paths");
1355
+ const [globalBinDir, shellCommandPath] = await Promise.all([resolveNpmGlobalBinDir((line) => {
1356
+ progress.output(`npm prefix: ${line}`);
1357
+ }), resolveShellOpenClawPath((line) => {
1358
+ progress.output(`${process$1.platform === "win32" ? "where" : "which"}: ${line}`);
1359
+ })]);
1360
+ progress.completeStage("path discovery complete");
1361
+ const globalAfter = installed ? {
1362
+ installed: true,
1363
+ version: globalBefore.version
1364
+ } : globalBefore;
1207
1365
  const command = resolveGlobalOpenClawCommand(globalBinDir) ?? "openclaw";
1208
- const check = await runOpenClaw(command, ["--version"], 4e3).catch(() => null);
1209
- const shellCommandPath = await resolveShellOpenClawPath();
1366
+ progress.startStage("Verifying OpenClaw CLI responsiveness");
1367
+ const check = await runOpenClaw(command, ["--version"], 4e3, "capture", void 0, (line) => {
1368
+ progress.output(`openclaw --version: ${line}`);
1369
+ }).catch(() => null);
1370
+ progress.completeStage(check?.code === 0 ? "OpenClaw responded" : "OpenClaw version probe failed");
1210
1371
  const version = normalizeVersionOutput(check?.stdout || check?.stderr || globalAfter.version);
1372
+ const available = Boolean(globalAfter.installed && check && check.code === 0);
1373
+ progress.startStage("Caching OpenClaw check result");
1374
+ if (available) {
1375
+ writeOpenClawCliCheckCache(params.stateDir, {
1376
+ available,
1377
+ command,
1378
+ version,
1379
+ globalBinDir,
1380
+ shellCommandPath,
1381
+ installedAt
1382
+ });
1383
+ progress.completeStage(`saved (${Math.floor(OPENCLAW_CLI_CHECK_CACHE_TTL_MS / 6e4)}m TTL)`);
1384
+ } else progress.fail("OpenClaw CLI check failed (cache not written).");
1211
1385
  return {
1212
- available: Boolean(globalAfter.installed && check && check.code === 0),
1386
+ available,
1213
1387
  installed,
1388
+ installedAt,
1214
1389
  version,
1215
1390
  command,
1216
1391
  globalBinDir,
@@ -1515,6 +1690,10 @@ function logBootstrapChecklist(diagnostics, runtime) {
1515
1690
  async function shouldRunUpdate(params) {
1516
1691
  if (params.opts.updateNow) return true;
1517
1692
  if (params.opts.skipUpdate || params.opts.nonInteractive || params.opts.json || !process$1.stdin.isTTY) return false;
1693
+ if (params.installResult.installed || typeof params.installResult.installedAt === "number" && Date.now() - params.installResult.installedAt <= OPENCLAW_UPDATE_PROMPT_SUPPRESS_AFTER_INSTALL_MS) {
1694
+ params.runtime.log(theme.muted("Skipping update prompt because OpenClaw was installed moments ago."));
1695
+ return false;
1696
+ }
1518
1697
  const decision = await confirm({
1519
1698
  message: stylePromptMessage("Check and install OpenClaw updates now?"),
1520
1699
  initialValue: false
@@ -1531,8 +1710,21 @@ async function bootstrapCommand(opts, runtime = defaultRuntime) {
1531
1710
  const legacyFallbackEnabled = isLegacyFallbackEnabled();
1532
1711
  const appliedProfile = applyCliProfileEnv({ profile: opts.profile });
1533
1712
  const profile = appliedProfile.effectiveProfile;
1713
+ const stateDir = resolveProfileStateDir(profile);
1714
+ const workspaceDir = resolveBootstrapWorkspaceDir(stateDir);
1534
1715
  if (appliedProfile.warning && !opts.json) runtime.log(theme.warn(appliedProfile.warning));
1535
- const installResult = await ensureOpenClawCliAvailable();
1716
+ const bootstrapStartTime = Date.now();
1717
+ track("cli_bootstrap_started", { version: VERSION });
1718
+ if (!opts.json) {
1719
+ if (!readTelemetryConfig().noticeShown) {
1720
+ runtime.log(theme.muted("DenchClaw collects anonymous telemetry to improve the product.\nNo personal data is ever collected. Disable anytime:\n denchclaw telemetry disable\n DENCHCLAW_TELEMETRY_DISABLED=1\n DO_NOT_TRACK=1\nLearn more: https://github.com/openclaw/openclaw/blob/main/TELEMETRY.md\n"));
1721
+ markNoticeShown();
1722
+ }
1723
+ }
1724
+ const installResult = await ensureOpenClawCliAvailable({
1725
+ stateDir,
1726
+ showProgress: !opts.json
1727
+ });
1536
1728
  if (!installResult.available) throw new Error([
1537
1729
  "OpenClaw CLI is required but unavailable.",
1538
1730
  "Install it with: npm install -g openclaw",
@@ -1541,7 +1733,8 @@ async function bootstrapCommand(opts, runtime = defaultRuntime) {
1541
1733
  const openclawCommand = installResult.command;
1542
1734
  if (await shouldRunUpdate({
1543
1735
  opts,
1544
- runtime
1736
+ runtime,
1737
+ installResult
1545
1738
  })) await runOpenClawWithProgress({
1546
1739
  openclawCommand,
1547
1740
  args: ["update", "--yes"],
@@ -1561,8 +1754,6 @@ async function bootstrapCommand(opts, runtime = defaultRuntime) {
1561
1754
  gatewayPort = availablePort;
1562
1755
  portAutoAssigned = true;
1563
1756
  }
1564
- const stateDir = resolveProfileStateDir(profile);
1565
- const workspaceDir = resolveBootstrapWorkspaceDir(stateDir);
1566
1757
  if (portAutoAssigned && !opts.json) runtime.log(theme.muted(`Default gateway port ${DEFAULT_GATEWAY_PORT} is in use. Using auto-assigned port ${gatewayPort}.`));
1567
1758
  await ensureDefaultWorkspacePath(openclawCommand, profile, workspaceDir);
1568
1759
  const onboardArgv = [
@@ -1695,6 +1886,13 @@ async function bootstrapCommand(opts, runtime = defaultRuntime) {
1695
1886
  webOpened: opened,
1696
1887
  diagnostics
1697
1888
  };
1889
+ track("cli_bootstrap_completed", {
1890
+ duration_ms: Date.now() - bootstrapStartTime,
1891
+ workspace_created: Boolean(workspaceSeed),
1892
+ gateway_reachable: gatewayProbe.ok,
1893
+ web_reachable: webReachable,
1894
+ version: VERSION
1895
+ });
1698
1896
  if (opts.json) runtime.log(JSON.stringify(summary, null, 2));
1699
1897
  return summary;
1700
1898
  }
@@ -1967,6 +2165,63 @@ async function stopWebRuntimeCommand(opts, runtime = defaultRuntime) {
1967
2165
  if (summary.skippedForeignPids.length > 0) runtime.log(theme.warn(`Left non-Dench listener(s) running on ${selectedPort}: ${summary.skippedForeignPids.join(", ")}`));
1968
2166
  return summary;
1969
2167
  }
2168
+ async function startWebRuntimeCommand(opts, runtime = defaultRuntime) {
2169
+ const appliedProfile = applyCliProfileEnv({ profile: opts.profile });
2170
+ const profile = appliedProfile.effectiveProfile;
2171
+ if (appliedProfile.warning && !opts.json) runtime.log(theme.warn(appliedProfile.warning));
2172
+ const stateDir = resolveProfileStateDir(profile);
2173
+ const selectedPort = parseOptionalPort(opts.webPort) ?? readLastKnownWebPort(stateDir);
2174
+ const gatewayPort = resolveGatewayPort(stateDir);
2175
+ const stopResult = await stopManagedWebRuntime({
2176
+ stateDir,
2177
+ port: selectedPort,
2178
+ includeLegacyStandalone: true
2179
+ });
2180
+ if (stopResult.skippedForeignPids.length > 0) throw new Error(`Cannot start on ${selectedPort}; non-Dench listener(s) still own the port: ${stopResult.skippedForeignPids.join(", ")}`);
2181
+ if (!startManagedWebRuntime({
2182
+ stateDir,
2183
+ port: selectedPort,
2184
+ gatewayPort
2185
+ }).started) {
2186
+ const runtimeServerPath = resolveManagedWebRuntimeServerPath(stateDir);
2187
+ throw new Error([`Managed web runtime is missing at ${runtimeServerPath}.`, "Run `dench update` (or `dench bootstrap`) to install/update the web runtime first."].join(" "));
2188
+ }
2189
+ const probe = await waitForWebRuntime(selectedPort);
2190
+ const summary = {
2191
+ profile,
2192
+ webPort: selectedPort,
2193
+ stoppedPids: stopResult.stoppedPids,
2194
+ skippedForeignPids: stopResult.skippedForeignPids,
2195
+ started: probe.ok,
2196
+ reason: probe.reason
2197
+ };
2198
+ if (opts.json) {
2199
+ runtime.log(JSON.stringify(summary, null, 2));
2200
+ return summary;
2201
+ }
2202
+ runtime.log("");
2203
+ runtime.log(theme.heading("Dench web start"));
2204
+ runtime.log(`Profile: ${profile}`);
2205
+ runtime.log(`Web port: ${selectedPort}`);
2206
+ runtime.log(`Restarted managed web runtime: ${summary.started ? "yes" : "no"}`);
2207
+ if (!summary.started) runtime.log(theme.warn(summary.reason));
2208
+ if (!summary.started) throw new Error(`Web runtime failed readiness probe: ${summary.reason}`);
2209
+ return summary;
2210
+ }
2211
+
2212
+ //#endregion
2213
+ //#region src/cli/program/register.start.ts
2214
+ function registerStartCommand(program) {
2215
+ program.command("start").description("Start Dench managed web runtime without updating assets").option("--profile <name>", "Compatibility flag; non-dench values are ignored with a warning").option("--web-port <port>", "Web runtime port override").option("--json", "Output summary as JSON", false).action(async (opts) => {
2216
+ await runCommandWithRuntime(defaultRuntime, async () => {
2217
+ await startWebRuntimeCommand({
2218
+ profile: opts.profile,
2219
+ webPort: opts.webPort,
2220
+ json: Boolean(opts.json)
2221
+ });
2222
+ });
2223
+ });
2224
+ }
1970
2225
 
1971
2226
  //#endregion
1972
2227
  //#region src/cli/program/register.stop.ts
@@ -1982,6 +2237,30 @@ function registerStopCommand(program) {
1982
2237
  });
1983
2238
  }
1984
2239
 
2240
+ //#endregion
2241
+ //#region src/cli/program/register.telemetry.ts
2242
+ function registerTelemetryCommand(program) {
2243
+ const cmd = program.command("telemetry").description("Manage anonymous telemetry for DenchClaw");
2244
+ cmd.command("status").description("Show current telemetry status").action(() => {
2245
+ const config = readTelemetryConfig();
2246
+ const envDisabled = process.env.DO_NOT_TRACK === "1" || process.env.DENCHCLAW_TELEMETRY_DISABLED === "1" || Boolean(process.env.CI);
2247
+ const effective = isTelemetryEnabled();
2248
+ console.log(`Telemetry config: ${config.enabled ? "enabled" : "disabled"}`);
2249
+ if (envDisabled) console.log("Environment override: disabled (DO_NOT_TRACK, DENCHCLAW_TELEMETRY_DISABLED, or CI)");
2250
+ console.log(`Effective status: ${effective ? "enabled" : "disabled"}`);
2251
+ console.log("\nLearn more: https://github.com/openclaw/openclaw/blob/main/TELEMETRY.md");
2252
+ });
2253
+ cmd.command("disable").description("Disable anonymous telemetry").action(() => {
2254
+ writeTelemetryConfig({ enabled: false });
2255
+ console.log("Telemetry has been disabled.");
2256
+ console.log("You can re-enable it anytime with: denchclaw telemetry enable");
2257
+ });
2258
+ cmd.command("enable").description("Enable anonymous telemetry").action(() => {
2259
+ writeTelemetryConfig({ enabled: true });
2260
+ console.log("Telemetry has been enabled. Thank you for helping improve DenchClaw!");
2261
+ });
2262
+ }
2263
+
1985
2264
  //#endregion
1986
2265
  //#region src/cli/program/register.update.ts
1987
2266
  function registerUpdateCommand(program) {
@@ -2021,6 +2300,20 @@ const CORE_CLI_ENTRIES = [
2021
2300
  register: ({ program }) => {
2022
2301
  registerStopCommand(program);
2023
2302
  }
2303
+ },
2304
+ {
2305
+ name: "start",
2306
+ description: "Start Dench managed web runtime",
2307
+ register: ({ program }) => {
2308
+ registerStartCommand(program);
2309
+ }
2310
+ },
2311
+ {
2312
+ name: "telemetry",
2313
+ description: "Manage anonymous telemetry",
2314
+ register: ({ program }) => {
2315
+ registerTelemetryCommand(program);
2316
+ }
2024
2317
  }
2025
2318
  ];
2026
2319
  const CORE_CLI_ENTRY_BY_NAME = new Map(CORE_CLI_ENTRIES.map((entry) => [entry.name, entry]));
@@ -2068,6 +2361,7 @@ const CLI_NAME_PATTERN = escapeRegExp(CLI_NAME);
2068
2361
  const ROOT_COMMANDS_WITH_SUBCOMMANDS = new Set(getCoreCliCommandsWithSubcommands());
2069
2362
  const ROOT_COMMANDS_HINT = "Hint: commands suffixed with * have subcommands. Run <command> --help for details.";
2070
2363
  const EXAMPLES = [
2364
+ ["openclaw start --web-port 3100", "Start the managed web runtime without replacing assets."],
2071
2365
  ["openclaw update", "Refresh the managed web runtime and enforce major upgrade gates."],
2072
2366
  ["openclaw stop --web-port 3100", "Stop only the managed web runtime on a specific port."],
2073
2367
  ["openclaw models --help", "Show detailed help for the models command."],
@@ -1,5 +1,5 @@
1
- import { a as normalizeWindowsArgv, l as hasHelpOrVersion, n as normalizeEnv, o as getCommandPath, s as getPrimaryCommand, t as isTruthyEnvValue } from "./entry.js";
2
- import { n as resolveCliName, o as VERSION, r as emitCliBanner } from "./cli-name-8WJ6gVD5.js";
1
+ import { c as getPrimaryCommand, n as normalizeEnv, o as normalizeWindowsArgv, s as getCommandPath, t as isTruthyEnvValue, u as hasHelpOrVersion } from "./entry.js";
2
+ import { n as resolveCliName, o as VERSION, r as emitCliBanner } from "./cli-name-yhDyCrts.js";
3
3
  import { spawn } from "node:child_process";
4
4
  import process$1 from "node:process";
5
5
  import os from "node:os";
@@ -174,7 +174,11 @@ function shouldDelegateToGlobalOpenClaw(argv, env = process$1.env) {
174
174
  if (isDelegationDisabled(env)) return false;
175
175
  const primary = getPrimaryCommand(argv);
176
176
  if (!primary) return false;
177
- return primary !== "bootstrap" && primary !== "update" && primary !== "stop";
177
+ return primary !== "bootstrap" && primary !== "update" && primary !== "stop" && primary !== "start";
178
+ }
179
+ function shouldHideCliBanner(argv, env = process$1.env) {
180
+ const commandPath = getCommandPath(argv, 2);
181
+ return isTruthyEnvValue(env.DENCHCLAW_HIDE_BANNER) || isTruthyEnvValue(env.OPENCLAW_HIDE_BANNER) || commandPath[0] === "completion" || commandPath[0] === "plugins" && commandPath[1] === "update";
178
182
  }
179
183
  async function delegateToGlobalOpenClaw(argv) {
180
184
  if (isTruthyEnvValue(process$1.env.DENCHCLAW_DELEGATED) || isTruthyEnvValue(process$1.env.OPENCLAW_DELEGATED)) throw new Error("OpenClaw delegation loop detected. Check PATH so `openclaw` resolves to the global OpenClaw CLI.");
@@ -209,14 +213,13 @@ async function runCli(argv = process$1.argv) {
209
213
  normalizeEnv();
210
214
  if (shouldEnsureCliPath(normalizedArgv)) ensureOpenClawCliOnPath();
211
215
  assertSupportedRuntime();
212
- const commandPath = getCommandPath(normalizedArgv, 2);
213
- if (!(isTruthyEnvValue(process$1.env.DENCHCLAW_HIDE_BANNER) || isTruthyEnvValue(process$1.env.OPENCLAW_HIDE_BANNER) || commandPath[0] === "update" || commandPath[0] === "stop" || commandPath[0] === "completion" || commandPath[0] === "plugins" && commandPath[1] === "update")) await emitCliBanner(VERSION, { argv: normalizedArgv });
216
+ if (!shouldHideCliBanner(normalizedArgv, process$1.env)) await emitCliBanner(VERSION, { argv: normalizedArgv });
214
217
  const parseArgv = rewriteBareArgvToBootstrap(rewriteUpdateFlagArgv(normalizedArgv));
215
218
  if (shouldDelegateToGlobalOpenClaw(parseArgv)) {
216
219
  process$1.exitCode = await delegateToGlobalOpenClaw(parseArgv);
217
220
  return;
218
221
  }
219
- const { buildProgram } = await import("./program-DhxRjAOe.js");
222
+ const { buildProgram } = await import("./program-BjjW6tCn.js");
220
223
  await buildProgram().parseAsync(parseArgv);
221
224
  }
222
225
 
@@ -0,0 +1,118 @@
1
+ import { r as resolveStateDir } from "./entry.js";
2
+ import { createRequire } from "node:module";
3
+ import os from "node:os";
4
+ import { dirname, join } from "node:path";
5
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
6
+ import { createHash } from "node:crypto";
7
+ import "posthog-node";
8
+
9
+ //#region \0rolldown/runtime.js
10
+ var __defProp = Object.defineProperty;
11
+ var __exportAll = (all, no_symbols) => {
12
+ let target = {};
13
+ for (var name in all) {
14
+ __defProp(target, name, {
15
+ get: all[name],
16
+ enumerable: true
17
+ });
18
+ }
19
+ if (!no_symbols) {
20
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
21
+ }
22
+ return target;
23
+ };
24
+
25
+ //#endregion
26
+ //#region src/telemetry/config.ts
27
+ const TELEMETRY_FILENAME = "telemetry.json";
28
+ function telemetryConfigPath() {
29
+ return join(resolveStateDir(), TELEMETRY_FILENAME);
30
+ }
31
+ function readTelemetryConfig() {
32
+ const configPath = telemetryConfigPath();
33
+ try {
34
+ if (!existsSync(configPath)) return { enabled: true };
35
+ const raw = JSON.parse(readFileSync(configPath, "utf-8"));
36
+ return {
37
+ enabled: raw.enabled !== false,
38
+ noticeShown: raw.noticeShown === true
39
+ };
40
+ } catch {
41
+ return { enabled: true };
42
+ }
43
+ }
44
+ function writeTelemetryConfig(config) {
45
+ const configPath = telemetryConfigPath();
46
+ const merged = {
47
+ ...readTelemetryConfig(),
48
+ ...config
49
+ };
50
+ try {
51
+ mkdirSync(dirname(configPath), { recursive: true });
52
+ writeFileSync(configPath, JSON.stringify(merged, null, 2) + "\n", "utf-8");
53
+ } catch {}
54
+ }
55
+ function markNoticeShown() {
56
+ writeTelemetryConfig({ noticeShown: true });
57
+ }
58
+
59
+ //#endregion
60
+ //#region src/telemetry/telemetry.ts
61
+ var telemetry_exports = /* @__PURE__ */ __exportAll({
62
+ getAnonymousId: () => getAnonymousId,
63
+ isTelemetryEnabled: () => isTelemetryEnabled,
64
+ shutdownTelemetry: () => shutdownTelemetry,
65
+ track: () => track
66
+ });
67
+ let client = null;
68
+ function isTelemetryEnabled() {
69
+ return false;
70
+ }
71
+ function getAnonymousId() {
72
+ try {
73
+ const raw = `${os.hostname()}:${os.userInfo().username}`;
74
+ return createHash("sha256").update(raw).digest("hex").slice(0, 16);
75
+ } catch {
76
+ return "unknown";
77
+ }
78
+ }
79
+ function getMachineContext() {
80
+ return {
81
+ os: process.platform,
82
+ arch: process.arch,
83
+ node_version: process.version
84
+ };
85
+ }
86
+ function ensureClient() {
87
+ return null;
88
+ }
89
+ function track(event, properties) {
90
+ if (!isTelemetryEnabled()) return;
91
+ if (process.env.DENCHCLAW_TELEMETRY_DEBUG === "1") {
92
+ process.stderr.write(`[telemetry:debug] ${JSON.stringify({
93
+ event,
94
+ properties
95
+ }, null, 2)}\n`);
96
+ return;
97
+ }
98
+ const ph = ensureClient();
99
+ if (!ph) return;
100
+ ph.capture({
101
+ distinctId: getAnonymousId(),
102
+ event,
103
+ properties: {
104
+ ...getMachineContext(),
105
+ ...properties,
106
+ $process_person_profile: false
107
+ }
108
+ });
109
+ }
110
+ async function shutdownTelemetry() {
111
+ if (client) {
112
+ await client.shutdown();
113
+ client = null;
114
+ }
115
+ }
116
+
117
+ //#endregion
118
+ export { readTelemetryConfig as a, markNoticeShown as i, telemetry_exports as n, writeTelemetryConfig as o, track as r, isTelemetryEnabled as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "denchclaw",
3
- "version": "2.0.1",
3
+ "version": "2.0.4",
4
4
  "description": "AI-powered CRM platform with multi-channel agent gateway, DuckDB workspace, and knowledge management",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/openclaw/openclaw#readme",
@@ -58,6 +58,7 @@
58
58
  "commander": "^14.0.3",
59
59
  "gradient-string": "^3.0.0",
60
60
  "json5": "^2.2.3",
61
+ "posthog-node": "^5.27.1",
61
62
  "tslog": "^4.10.2"
62
63
  },
63
64
  "devDependencies": {