@adhdev/daemon-standalone 1.0.58-rc.35 → 1.0.58-rc.36

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
@@ -36911,10 +36911,10 @@ var require_dist3 = __commonJS({
36911
36911
  }
36912
36912
  function getDaemonBuildInfo() {
36913
36913
  if (cached2) return cached2;
36914
- const commit = readInjected(true ? "ca85193f9b10354f9f7f42ddd9fe18890a891f94" : void 0) ?? "unknown";
36915
- const commitShort = readInjected(true ? "ca85193f" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36916
- const version2 = readInjected(true ? "1.0.58-rc.35" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36917
- const builtAt = readInjected(true ? "2026-08-29T00:50:08.576Z" : void 0);
36914
+ const commit = readInjected(true ? "36d1ddf006d119717fb82a4830dfdc8a0ce0c963" : void 0) ?? "unknown";
36915
+ const commitShort = readInjected(true ? "36d1ddf0" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36916
+ const version2 = readInjected(true ? "1.0.58-rc.36" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36917
+ const builtAt = readInjected(true ? "2026-08-29T01:41:18.148Z" : void 0);
36918
36918
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
36919
36919
  return cached2;
36920
36920
  }
@@ -59133,6 +59133,9 @@ CREATE TABLE IF NOT EXISTS sq_archive (
59133
59133
  } else if (node) {
59134
59134
  LOG2.info("Seqscribe", `mesh dual-write disabled (${MESH_DUAL_WRITE_ENV}=off)`);
59135
59135
  }
59136
+ if (node && discoveredMeshIds.size > 0) {
59137
+ activateMeshTopicsNow(discoveredMeshIds);
59138
+ }
59136
59139
  }
59137
59140
  function ensureTopic(node, meshId) {
59138
59141
  const topic = meshEventsTopic(meshId);
@@ -59160,17 +59163,62 @@ CREATE TABLE IF NOT EXISTS sq_archive (
59160
59163
  return null;
59161
59164
  }
59162
59165
  }
59163
- function activateKnownMeshTopics(meshIds) {
59166
+ function ensureHandoffTopic(node, meshId) {
59167
+ if (!node.authorityEnabled) return null;
59168
+ const topic = meshHandoffTopic(meshId);
59169
+ const known = definedTopics.get(topic);
59170
+ if (known === true) return topic;
59171
+ if (known === false) return null;
59172
+ if (node.topics.some((d) => d.topic === topic)) {
59173
+ definedTopics.set(topic, true);
59174
+ return topic;
59175
+ }
59176
+ try {
59177
+ const policy = meshHandoffPolicy();
59178
+ node.node.defineTopic(topic, policy);
59179
+ node.topics.push({ topic, policy });
59180
+ definedTopics.set(topic, true);
59181
+ LOG2.info("Seqscribe", `mesh handoff topic defined topic=${topic}`);
59182
+ announceTopicActivated(node, topic);
59183
+ return topic;
59184
+ } catch (error48) {
59185
+ definedTopics.set(topic, false);
59186
+ counters2.topicErrors++;
59187
+ LOG2.warn(
59188
+ "Seqscribe",
59189
+ `handoff replication disabled for this mesh \u2014 defineTopic failed topic=${topic}: ${error48 instanceof Error ? error48.message : String(error48)}`
59190
+ );
59191
+ return null;
59192
+ }
59193
+ }
59194
+ function activateMeshTopicsNow(meshIds) {
59164
59195
  const node = activeNode2;
59165
- if (!node || activeMode === "off") return 0;
59196
+ if (!node) return 0;
59166
59197
  let activated = 0;
59167
59198
  for (const meshId of meshIds) {
59168
- const topic = meshEventsTopic(meshId);
59169
- const before = definedTopics.get(topic);
59170
- if (ensureTopic(node, meshId) !== null && before === void 0) activated++;
59199
+ const eventTopic = meshEventsTopic(meshId);
59200
+ const handoffTopic = meshHandoffTopic(meshId);
59201
+ const eventWasKnown = definedTopics.has(eventTopic);
59202
+ const handoffWasKnown = definedTopics.has(handoffTopic);
59203
+ if (activeMode !== "off") ensureTopic(node, meshId);
59204
+ ensureHandoffTopic(node, meshId);
59205
+ if (!eventWasKnown && definedTopics.get(eventTopic) === true || !handoffWasKnown && definedTopics.get(handoffTopic) === true) {
59206
+ activated++;
59207
+ }
59171
59208
  }
59172
59209
  return activated;
59173
59210
  }
59211
+ function activateKnownMeshTopics(meshIds) {
59212
+ const normalizedMeshIds = [];
59213
+ for (const meshId of meshIds) {
59214
+ if (typeof meshId !== "string") continue;
59215
+ const normalized = meshId.trim();
59216
+ if (!normalized) continue;
59217
+ discoveredMeshIds.add(normalized);
59218
+ normalizedMeshIds.push(normalized);
59219
+ }
59220
+ return activateMeshTopicsNow(normalizedMeshIds);
59221
+ }
59174
59222
  function recordMeshEventShadow(meshId, entry) {
59175
59223
  recordMeshEvent(meshId, entry, "inline");
59176
59224
  }
@@ -59245,6 +59293,7 @@ CREATE TABLE IF NOT EXISTS sq_archive (
59245
59293
  activeNode2 = null;
59246
59294
  activeMode = "shadow";
59247
59295
  definedTopics.clear();
59296
+ discoveredMeshIds.clear();
59248
59297
  inflight = 0;
59249
59298
  warnedOnce2.clear();
59250
59299
  counters2.written = 0;
@@ -59259,6 +59308,7 @@ CREATE TABLE IF NOT EXISTS sq_archive (
59259
59308
  var MAX_INFLIGHT;
59260
59309
  var counters2;
59261
59310
  var definedTopics;
59311
+ var discoveredMeshIds;
59262
59312
  var activeNode2;
59263
59313
  var activeMode;
59264
59314
  var inflight;
@@ -59282,6 +59332,7 @@ CREATE TABLE IF NOT EXISTS sq_archive (
59282
59332
  oversized: 0
59283
59333
  };
59284
59334
  definedTopics = /* @__PURE__ */ new Map();
59335
+ discoveredMeshIds = /* @__PURE__ */ new Set();
59285
59336
  activeNode2 = null;
59286
59337
  activeMode = "shadow";
59287
59338
  inflight = 0;
@@ -138777,6 +138828,7 @@ ${ptyResult.output.slice(-2e3)}`);
138777
138828
  );
138778
138829
  init_dist();
138779
138830
  init_logger();
138831
+ init_mesh_dual_write();
138780
138832
  var fs56 = __toESM2(require("fs"));
138781
138833
  var path57 = __toESM2(require("path"));
138782
138834
  init_config_dir();
@@ -139947,6 +139999,20 @@ ${ptyResult.output.slice(-2e3)}`);
139947
139999
  }
139948
140000
  return base;
139949
140001
  }
140002
+ function meshIdsRevealedByCommandArgs(args) {
140003
+ const root = readObjectRecord(args);
140004
+ const meshContext = readObjectRecord(root.meshContext);
140005
+ const inlineMesh = readObjectRecord(root.inlineMesh);
140006
+ const settings = readObjectRecord(root.settings);
140007
+ const ids = [
140008
+ readStringValue(root.meshId),
140009
+ readStringValue(root.meshNodeFor),
140010
+ readStringValue(meshContext.meshId),
140011
+ readStringValue(inlineMesh.id),
140012
+ readStringValue(settings.meshNodeFor)
140013
+ ].filter((value) => value !== void 0);
140014
+ return [...new Set(ids)];
140015
+ }
139950
140016
  function normalizeStandaloneHostCommandUrl(hostAddress) {
139951
140017
  const raw = hostAddress.trim();
139952
140018
  if (!raw) throw new Error("hostAddress required");
@@ -140518,6 +140584,16 @@ ${ptyResult.output.slice(-2e3)}`);
140518
140584
  const logSource = normalizeCommandSource(source);
140519
140585
  const normalizedArgs = normalizeCommandArgsWithInteractionId(args);
140520
140586
  const interactionId = typeof normalizedArgs._interactionId === "string" ? normalizedArgs._interactionId : void 0;
140587
+ const revealedMeshIds = meshIdsRevealedByCommandArgs(normalizedArgs);
140588
+ if (revealedMeshIds.length > 0) {
140589
+ const activated = activateKnownMeshTopics(revealedMeshIds);
140590
+ if (activated > 0) {
140591
+ LOG2.info(
140592
+ "Seqscribe",
140593
+ `activated ${activated} mesh topic scope(s) from runtime command ${cmd}`
140594
+ );
140595
+ }
140596
+ }
140521
140597
  recordDebugTrace2({
140522
140598
  interactionId,
140523
140599
  category: "command",
@@ -151434,7 +151510,7 @@ ${upgradeFailureNotice.notice}${supersededHint}`);
151434
151510
  if (activated > 0) {
151435
151511
  LOG2.info(
151436
151512
  "Seqscribe",
151437
- `activated ${activated} known mesh event topic(s) at boot \u2014 consumers converge without waiting for a local write`
151513
+ `activated ${activated} known mesh topic scope(s) at boot \u2014 consumers converge without waiting for a local write`
151438
151514
  );
151439
151515
  }
151440
151516
  } catch (error48) {