@adhdev/daemon-standalone 0.9.82-rc.263 → 0.9.82-rc.264

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.
package/dist/index.js CHANGED
@@ -29973,10 +29973,10 @@ var require_dist3 = __commonJS({
29973
29973
  }
29974
29974
  function getDaemonBuildInfo() {
29975
29975
  if (cached2) return cached2;
29976
- const commit = readInjected(true ? "2cf602f99ce68b3d3f1af02b429f6fb7a7c8e686" : void 0) ?? "unknown";
29977
- const commitShort = readInjected(true ? "2cf602f" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
29978
- const version2 = readInjected(true ? "0.9.82-rc.263" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
29979
- const builtAt = readInjected(true ? "2026-06-14T13:49:22.236Z" : void 0);
29976
+ const commit = readInjected(true ? "751232919b0935654ee3d75d7cee4607594d6836" : void 0) ?? "unknown";
29977
+ const commitShort = readInjected(true ? "7512329" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
29978
+ const version2 = readInjected(true ? "0.9.82-rc.264" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
29979
+ const builtAt = readInjected(true ? "2026-06-14T15:25:15.217Z" : void 0);
29980
29980
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
29981
29981
  return cached2;
29982
29982
  }
@@ -30045,6 +30045,30 @@ var require_dist3 = __commonJS({
30045
30045
  );
30046
30046
  }
30047
30047
  }
30048
+ async function classifyDaemonBuildChange(repoPath, buildCommit, options) {
30049
+ try {
30050
+ const diff = await runGit(repoPath, ["diff", "--name-only", `${buildCommit}..HEAD`], options);
30051
+ const files = diff.stdout.split("\n").map((line) => line.trim()).filter(Boolean);
30052
+ if (files.length === 0) {
30053
+ return { isDaemonAffecting: true, affectedPackages: [] };
30054
+ }
30055
+ const pkgs = /* @__PURE__ */ new Set();
30056
+ let sawNonPackageOrUnknown = false;
30057
+ for (const file2 of files) {
30058
+ const match = file2.match(/(?:^|\/)packages\/([^/]+)\//);
30059
+ if (!match) {
30060
+ sawNonPackageOrUnknown = true;
30061
+ continue;
30062
+ }
30063
+ pkgs.add(match[1]);
30064
+ }
30065
+ const affectedPackages = [...pkgs].sort();
30066
+ const allWebOnly = !sawNonPackageOrUnknown && affectedPackages.length > 0 && affectedPackages.every((p) => WEB_ONLY_PACKAGES.has(p) && !DAEMON_RUNTIME_PACKAGES.has(p));
30067
+ return { isDaemonAffecting: !allWebOnly, affectedPackages };
30068
+ } catch {
30069
+ return { isDaemonAffecting: true, affectedPackages: [] };
30070
+ }
30071
+ }
30048
30072
  async function detectDaemonBuildBehind(repo, submodules, options) {
30049
30073
  const build = options.daemonBuildInfo ?? getDaemonBuildInfo();
30050
30074
  if (!build.commit || build.commit === "unknown") return void 0;
@@ -30061,12 +30085,21 @@ var require_dist3 = __commonJS({
30061
30085
  const head = headResult.stdout.trim();
30062
30086
  if (!head || head === build.commit) continue;
30063
30087
  await runGit(repoPath, ["merge-base", "--is-ancestor", build.commit, "HEAD"], options);
30088
+ const { isDaemonAffecting, affectedPackages } = await classifyDaemonBuildChange(
30089
+ repoPath,
30090
+ build.commit,
30091
+ options
30092
+ );
30093
+ const scopeLabel = scope === "root" ? "workspace" : scope;
30094
+ const warning = isDaemonAffecting ? `Live daemon was built from ${build.commitShort} which is behind ${scopeLabel} HEAD ${head.slice(0, 7)}. Merged code is NOT live until the daemon is rebuilt/redeployed and restarted \u2014 a local dist rebuild alone does not update a cloud daemon.` : `Live daemon was built from ${build.commitShort} which is behind ${scopeLabel} HEAD ${head.slice(0, 7)}, but only web packages changed (${(affectedPackages || []).join(", ") || "web"}). Daemon restart NOT required \u2014 redeploy the web app to reflect the change.`;
30064
30095
  return {
30065
30096
  buildCommit: build.commit,
30066
30097
  buildCommitShort: build.commitShort,
30067
30098
  head,
30068
30099
  scope,
30069
- warning: `Live daemon was built from ${build.commitShort} which is behind ${scope === "root" ? "workspace" : scope} HEAD ${head.slice(0, 7)}. Merged code is NOT live until the daemon is rebuilt/redeployed and restarted \u2014 a local dist rebuild alone does not update a cloud daemon.`
30100
+ isDaemonAffecting,
30101
+ ...affectedPackages && affectedPackages.length > 0 ? { affectedPackages } : {},
30102
+ warning
30070
30103
  };
30071
30104
  } catch {
30072
30105
  continue;
@@ -30286,11 +30319,30 @@ var require_dist3 = __commonJS({
30286
30319
  }
30287
30320
  return submodules;
30288
30321
  }
30322
+ var DAEMON_RUNTIME_PACKAGES;
30323
+ var WEB_ONLY_PACKAGES;
30289
30324
  var init_git_status = __esm2({
30290
30325
  "src/git/git-status.ts"() {
30291
30326
  "use strict";
30292
30327
  init_git_executor();
30293
30328
  init_build_info();
30329
+ DAEMON_RUNTIME_PACKAGES = /* @__PURE__ */ new Set([
30330
+ "daemon-core",
30331
+ "daemon-standalone",
30332
+ "session-host-core",
30333
+ "session-host-daemon",
30334
+ "terminal-mux-core",
30335
+ "terminal-mux-control",
30336
+ "terminal-mux-cli",
30337
+ "ghostty-vt-node",
30338
+ "mcp-server"
30339
+ ]);
30340
+ WEB_ONLY_PACKAGES = /* @__PURE__ */ new Set([
30341
+ "web-core",
30342
+ "web-standalone",
30343
+ "web-devconsole",
30344
+ "terminal-render-web"
30345
+ ]);
30294
30346
  }
30295
30347
  });
30296
30348
  var git_diff_exports = {};
@@ -73053,10 +73105,31 @@ ${hintLines.join("\n")}` : "",
73053
73105
  };
73054
73106
  }
73055
73107
  const cleanupStarted = Date.now();
73108
+ const refineSessionCleanupMode = this.normalizeMeshSessionCleanupMode(
73109
+ mesh?.policy?.sessionCleanupOnNodeRemove
73110
+ );
73111
+ let refineSessionIds;
73112
+ if (refineSessionCleanupMode !== "preserve" && this.deps.sessionHostControl) {
73113
+ try {
73114
+ const liveSessions = await this.deps.sessionHostControl.listSessions();
73115
+ const workspace = typeof node.workspace === "string" ? node.workspace : "";
73116
+ refineSessionIds = liveSessions.filter((record2) => {
73117
+ const sid = typeof record2?.sessionId === "string" ? record2.sessionId : "";
73118
+ if (!sid) return false;
73119
+ if (readStringValue(record2?.meta?.meshCoordinatorFor) === meshId) return false;
73120
+ const boundToNode = readStringValue(record2?.meta?.meshNodeId) === nodeId;
73121
+ const matchedByWorkspace = !!workspace && record2?.workspace === workspace;
73122
+ return boundToNode || matchedByWorkspace;
73123
+ }).map((record2) => String(record2.sessionId));
73124
+ } catch {
73125
+ refineSessionIds = void 0;
73126
+ }
73127
+ }
73056
73128
  const removeResult = await this.execute("remove_mesh_node", {
73057
73129
  meshId,
73058
73130
  nodeId,
73059
- sessionCleanupMode: "preserve",
73131
+ sessionCleanupMode: refineSessionCleanupMode,
73132
+ ...refineSessionIds && refineSessionIds.length > 0 ? { sessionIds: refineSessionIds } : {},
73060
73133
  inlineMesh: args?.inlineMesh
73061
73134
  });
73062
73135
  recordMeshRefineStage(refineStages, "cleanup", removeResult?.success === false ? "failed" : "passed", cleanupStarted, {
@@ -75126,6 +75199,23 @@ ${hintLines.join("\n")}` : "",
75126
75199
  const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
75127
75200
  const nodeId = typeof args?.nodeId === "string" ? args.nodeId.trim() : "";
75128
75201
  if (!meshId || !nodeId) return { success: false, error: "meshId and nodeId required" };
75202
+ const isDryRun = args?.dryRun !== false && args?.execute !== true;
75203
+ if (isDryRun) {
75204
+ const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
75205
+ const mesh = meshRecord?.mesh;
75206
+ const node = mesh?.nodes?.find((n) => n.id === nodeId || n.nodeId === nodeId);
75207
+ if (!node?.workspace) return { success: false, error: `Node '${nodeId}' workspace not found` };
75208
+ return {
75209
+ success: true,
75210
+ dryRun: true,
75211
+ nodeId,
75212
+ workspace: node.workspace,
75213
+ validationPlan: buildMeshRefineValidationPlan(mesh, node.workspace),
75214
+ mergeWillRun: false,
75215
+ cleanupWillRun: false,
75216
+ hint: "Dry-run only \u2014 no merge/push/cleanup performed. Re-invoke with execute:true to converge this node."
75217
+ };
75218
+ }
75129
75219
  return this.startMeshRefineJob(meshId, nodeId, args);
75130
75220
  }
75131
75221
  case "batch_refine_mesh_nodes": {
@@ -75147,9 +75237,17 @@ ${hintLines.join("\n")}` : "",
75147
75237
  const sessionCleanupMode = this.normalizeMeshSessionCleanupMode(
75148
75238
  args?.sessionCleanupMode ?? args?.session_cleanup_mode ?? mesh?.policy?.sessionCleanupOnNodeRemove
75149
75239
  );
75240
+ const explicitSessionIds = Array.isArray(args?.sessionIds) ? args.sessionIds.filter((v) => typeof v === "string" && v.trim().length > 0).map((v) => v.trim()) : void 0;
75150
75241
  let sessionCleanup;
75151
75242
  if (node && sessionCleanupMode !== "preserve") {
75152
- sessionCleanup = await this.cleanupMeshSessions({ meshId, nodeId, node, mode: sessionCleanupMode, source: "mesh_remove_node" });
75243
+ sessionCleanup = await this.cleanupMeshSessions({
75244
+ meshId,
75245
+ nodeId,
75246
+ node,
75247
+ mode: sessionCleanupMode,
75248
+ ...explicitSessionIds && explicitSessionIds.length > 0 ? { sessionIds: explicitSessionIds } : {},
75249
+ source: "mesh_remove_node"
75250
+ });
75153
75251
  if (sessionCleanup.success === false) return { success: false, removed: false, sessionCleanup };
75154
75252
  }
75155
75253
  let worktreeCleanup;