@adhdev/daemon-standalone 1.0.58-rc.29 → 1.0.58-rc.30

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
@@ -36885,10 +36885,10 @@ var require_dist3 = __commonJS({
36885
36885
  }
36886
36886
  function getDaemonBuildInfo() {
36887
36887
  if (cached2) return cached2;
36888
- const commit = readInjected(true ? "e767bd9b61dce1fd657b98aae517e9c405bdcb92" : void 0) ?? "unknown";
36889
- const commitShort = readInjected(true ? "e767bd9b" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36890
- const version2 = readInjected(true ? "1.0.58-rc.29" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36891
- const builtAt = readInjected(true ? "2026-08-27T16:04:41.136Z" : void 0);
36888
+ const commit = readInjected(true ? "2b2c70723e15856b63170cd9496e217fe6d8e02a" : void 0) ?? "unknown";
36889
+ const commitShort = readInjected(true ? "2b2c7072" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36890
+ const version2 = readInjected(true ? "1.0.58-rc.30" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36891
+ const builtAt = readInjected(true ? "2026-08-28T01:12:45.223Z" : void 0);
36892
36892
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
36893
36893
  return cached2;
36894
36894
  }
@@ -52199,7 +52199,7 @@ The instruction it carried was never delivered to anyone. If it still matters, r
52199
52199
  const timers = o.timers ?? defaultTimers;
52200
52200
  let stopped = false;
52201
52201
  let timer = null;
52202
- const runOnce = async () => {
52202
+ const runOnce2 = async () => {
52203
52203
  let issued = 0;
52204
52204
  for (const topic of o.topics) {
52205
52205
  try {
@@ -52217,7 +52217,7 @@ The instruction it carried was never delivered to anyone. If it still matters, r
52217
52217
  const tick = () => {
52218
52218
  if (stopped)
52219
52219
  return;
52220
- void runOnce().finally(() => {
52220
+ void runOnce2().finally(() => {
52221
52221
  if (!stopped)
52222
52222
  timer = timers.setTimeout(tick, o.intervalMs);
52223
52223
  });
@@ -52229,7 +52229,7 @@ The instruction it carried was never delivered to anyone. If it still matters, r
52229
52229
  if (timer !== null)
52230
52230
  timers.clearTimeout(timer);
52231
52231
  },
52232
- runOnce
52232
+ runOnce: runOnce2
52233
52233
  };
52234
52234
  }
52235
52235
  function loadOrCreateWriterId(storage, o) {
@@ -57466,6 +57466,9 @@ CREATE TABLE IF NOT EXISTS sq_archive (
57466
57466
  bySeq.set(e.seq, e);
57467
57467
  for (const { entry } of store.entriesRange(topic, o.writer, fromSeq, windowEnd))
57468
57468
  bySeq.set(entry.seq, entry);
57469
+ for (const e of core2.ringTail(topic))
57470
+ if (e.writer === o.writer && e.seq >= fromSeq && e.seq <= windowEnd)
57471
+ bySeq.set(e.seq, e);
57469
57472
  const entries2 = [...bySeq.values()].sort((a, b) => a.seq - b.seq);
57470
57473
  const complete2 = windowEnd >= toSeq;
57471
57474
  const firstAvail = entries2[0]?.seq;
@@ -96965,6 +96968,9 @@ ${e?.stderr || ""}`;
96965
96968
  ESC: () => ESC,
96966
96969
  FINALITY_INTERVAL_MS: () => FINALITY_INTERVAL_MS,
96967
96970
  FLEET_SECRET_FILE: () => FLEET_SECRET_FILE,
96971
+ FLEET_STATUS_APPEND_SETTLE_MS: () => FLEET_STATUS_APPEND_SETTLE_MS,
96972
+ FLEET_STATUS_PARITY_INTERVAL_MS: () => FLEET_STATUS_PARITY_INTERVAL_MS,
96973
+ FLEET_STATUS_PARITY_SUMMARY_INTERVAL_MS: () => FLEET_STATUS_PARITY_SUMMARY_INTERVAL_MS,
96968
96974
  FLEET_STATUS_RING: () => FLEET_STATUS_RING,
96969
96975
  FLEET_STATUS_TOPIC: () => FLEET_STATUS_TOPIC,
96970
96976
  FsmDriver: () => FsmDriver,
@@ -97083,6 +97089,7 @@ ${e?.stderr || ""}`;
97083
97089
  WORKSPACE_SAGA_LEASE_MS: () => WORKSPACE_SAGA_LEASE_MS,
97084
97090
  WRITER_ID_PREFIX: () => WRITER_ID_PREFIX,
97085
97091
  WorkspaceSagaPermanentError: () => WorkspaceSagaPermanentError,
97092
+ __resetFleetStatusParityForTests: () => __resetFleetStatusParityForTests,
97086
97093
  __resetMeshDualWriteForTests: () => __resetMeshDualWriteForTests,
97087
97094
  __resetMeshParityForTests: () => __resetMeshParityForTests,
97088
97095
  __resetMeshReadModelForTests: () => __resetMeshReadModelForTests,
@@ -97174,6 +97181,7 @@ ${e?.stderr || ""}`;
97174
97181
  computeProviderTreeDigest: () => computeProviderTreeDigest,
97175
97182
  configSettingsPolicy: () => configSettingsPolicy,
97176
97183
  configureDebugTraceStore: () => configureDebugTraceStore,
97184
+ configureFleetStatusParity: () => configureFleetStatusParity,
97177
97185
  configureMeshDualWrite: () => configureMeshDualWrite,
97178
97186
  configureMeshReadModel: () => configureMeshReadModel,
97179
97187
  connectCdpManager: () => connectCdpManager,
@@ -97222,6 +97230,7 @@ ${e?.stderr || ""}`;
97222
97230
  enqueueTaskGraph: () => enqueueTaskGraph,
97223
97231
  ensureSessionHostReady: () => ensureSessionHostReady2,
97224
97232
  estimateProjectedEntryBytes: () => estimateProjectedEntryBytes,
97233
+ evaluateFleetStatusReadiness: () => evaluateFleetStatusReadiness,
97225
97234
  evaluateFsm: () => evaluateFsm,
97226
97235
  evaluateMeshReadReadiness: () => evaluateMeshReadReadiness,
97227
97236
  evaluateProviderQuotaGate: () => evaluateProviderQuotaGate,
@@ -97244,6 +97253,7 @@ ${e?.stderr || ""}`;
97244
97253
  findCdpManager: () => findCdpManager,
97245
97254
  findTasksOrphanedBySessionStop: () => findTasksOrphanedBySessionStop,
97246
97255
  flattenMessageParts: () => flattenMessageParts,
97256
+ fleetStatusParityCounters: () => fleetStatusParityCounters,
97247
97257
  fleetStatusPolicy: () => fleetStatusPolicy,
97248
97258
  foldUsageRecords: () => foldUsageRecords,
97249
97259
  forceRefreshQuota: () => forceRefreshQuota2,
@@ -97435,6 +97445,7 @@ ${e?.stderr || ""}`;
97435
97445
  normalizeSessionModalFields: () => normalizeSessionModalFields,
97436
97446
  notifyCoordinatorOfOrphanedPins: () => notifyCoordinatorOfOrphanedPins,
97437
97447
  notifyCoordinatorOfParkedTaskDropped: () => notifyCoordinatorOfParkedTaskDropped,
97448
+ observeFleetStatusWsProjection: () => observeFleetStatusWsProjection,
97438
97449
  onTopicActivated: () => onTopicActivated,
97439
97450
  openSeqscribeNode: () => openSeqscribeNode,
97440
97451
  otherTrackConfigDir: () => otherTrackConfigDir,
@@ -111746,7 +111757,7 @@ exec "${portableNode}" "${cliEntry}" "$@"
111746
111757
  ...effectiveTimeout === void 0 ? {} : { timeout: effectiveTimeout },
111747
111758
  ...options.stdio ? { stdio: options.stdio } : {}
111748
111759
  };
111749
- const runOnce = () => {
111760
+ const runOnce2 = () => {
111750
111761
  if (options.execFileSync) {
111751
111762
  const runnerOptions = surface?.execOptions || getNpmExecOptions();
111752
111763
  return String(options.execFileSync(
@@ -111766,7 +111777,7 @@ exec "${portableNode}" "${cliEntry}" "$@"
111766
111777
  let lastError;
111767
111778
  for (let attempt = 1; attempt <= attempts; attempt++) {
111768
111779
  try {
111769
- return runOnce();
111780
+ return runOnce2();
111770
111781
  } catch (error48) {
111771
111782
  lastError = error48;
111772
111783
  if (attempt >= attempts || effectiveTimeout === void 0 || !isSpawnTimeoutError(error48)) throw error48;
@@ -139262,13 +139273,13 @@ ${ptyResult.output.slice(-2e3)}`);
139262
139273
  var MAX_INFLIGHT2 = 32;
139263
139274
  function resolveFleetStatusMode(env2 = process.env) {
139264
139275
  const raw = env2[FLEET_STATUS_ENV]?.trim().toLowerCase();
139265
- if (!raw) return "off";
139276
+ if (!raw) return "shadow";
139266
139277
  if (raw === "off") return "off";
139267
139278
  if (raw === "shadow") return "shadow";
139268
139279
  warnOnce3(
139269
- `unrecognized ${FLEET_STATUS_ENV}=${raw}; treating as 'off'. Valid values are 'shadow' and 'off' (default).`
139280
+ `unrecognized ${FLEET_STATUS_ENV}=${raw}; treating as 'shadow'. Valid values are 'shadow' (default) and 'off'.`
139270
139281
  );
139271
- return "off";
139282
+ return "shadow";
139272
139283
  }
139273
139284
  var counters3 = {
139274
139285
  written: 0,
@@ -139280,6 +139291,21 @@ ${ptyResult.output.slice(-2e3)}`);
139280
139291
  var activeMode2 = "off";
139281
139292
  var inflight2 = 0;
139282
139293
  var topicUsable = null;
139294
+ var configurationGeneration = 0;
139295
+ var appendGeneration = 0;
139296
+ var lastAppendedGeneration = 0;
139297
+ var lastAppendedEntryForParity = null;
139298
+ function freezeParitySnapshot(entry) {
139299
+ const snapshot = {
139300
+ daemonId: entry.daemonId,
139301
+ at: entry.at,
139302
+ onlineState: entry.onlineState,
139303
+ p2pActive: entry.p2pActive,
139304
+ sessionCounts: Object.freeze({ ...entry.sessionCounts }),
139305
+ ...entry.seqscribe ? { seqscribe: Object.freeze({ ...entry.seqscribe }) } : {}
139306
+ };
139307
+ return Object.freeze(snapshot);
139308
+ }
139283
139309
  var warnedOnce3 = /* @__PURE__ */ new Set();
139284
139310
  function warnOnce3(message) {
139285
139311
  if (warnedOnce3.has(message)) return;
@@ -139291,6 +139317,10 @@ ${ptyResult.output.slice(-2e3)}`);
139291
139317
  activeMode2 = resolveFleetStatusMode(env2);
139292
139318
  topicUsable = null;
139293
139319
  inflight2 = 0;
139320
+ configurationGeneration++;
139321
+ appendGeneration = 0;
139322
+ lastAppendedGeneration = 0;
139323
+ lastAppendedEntryForParity = null;
139294
139324
  if (node && activeMode2 === "shadow") {
139295
139325
  LOG2.info("Seqscribe", `fleet.status shadow armed writer=${node.writerId}`);
139296
139326
  }
@@ -139333,11 +139363,19 @@ ${ptyResult.output.slice(-2e3)}`);
139333
139363
  );
139334
139364
  return false;
139335
139365
  }
139366
+ const configuredNode = node;
139367
+ const configuredGeneration = configurationGeneration;
139368
+ const thisAppendGeneration = ++appendGeneration;
139369
+ const paritySnapshot = freezeParitySnapshot(entry);
139336
139370
  inflight2++;
139337
139371
  void node.node.log(FLEET_STATUS_TOPIC).append(FLEET_STATUS_ENTRY_KIND, payload).then(
139338
139372
  () => {
139339
139373
  inflight2--;
139340
139374
  counters3.written++;
139375
+ if (activeNode3 === configuredNode && activeMode2 === "shadow" && configurationGeneration === configuredGeneration && thisAppendGeneration >= lastAppendedGeneration) {
139376
+ lastAppendedGeneration = thisAppendGeneration;
139377
+ lastAppendedEntryForParity = paritySnapshot;
139378
+ }
139341
139379
  },
139342
139380
  (error48) => {
139343
139381
  inflight2--;
@@ -139356,6 +139394,192 @@ ${ptyResult.output.slice(-2e3)}`);
139356
139394
  return false;
139357
139395
  }
139358
139396
  }
139397
+ function isFleetStatusShadowActive() {
139398
+ return activeNode3 !== null && activeMode2 === "shadow";
139399
+ }
139400
+ function getLastAppendedEntryForParity() {
139401
+ if (activeMode2 !== "shadow" || activeNode3 === null) return null;
139402
+ return lastAppendedEntryForParity;
139403
+ }
139404
+ init_logger();
139405
+ var FLEET_STATUS_PARITY_INTERVAL_MS = 6e4;
139406
+ var FLEET_STATUS_PARITY_SUMMARY_INTERVAL_MS = 6e4;
139407
+ var FLEET_STATUS_APPEND_SETTLE_MS = 5e3;
139408
+ var EXPECTATION_TAIL = 128;
139409
+ var MISMATCH_KINDS = [
139410
+ "missing_shadow_append",
139411
+ "unexpected_shadow_append",
139412
+ "ide_count",
139413
+ "cli_count",
139414
+ "acp_count",
139415
+ "idle_count",
139416
+ "generating_count",
139417
+ "waiting_approval_count",
139418
+ "errored_count",
139419
+ "online_state"
139420
+ ];
139421
+ var COUNT_AXES = [
139422
+ ["ideCount", "ide_count"],
139423
+ ["cliCount", "cli_count"],
139424
+ ["acpCount", "acp_count"],
139425
+ ["idleCount", "idle_count"],
139426
+ ["generatingCount", "generating_count"],
139427
+ ["waitingApprovalCount", "waiting_approval_count"],
139428
+ ["erroredCount", "errored_count"]
139429
+ ];
139430
+ function emptyBuckets() {
139431
+ return Object.fromEntries(MISMATCH_KINDS.map((kind) => [kind, 0]));
139432
+ }
139433
+ var counters4 = {
139434
+ runs: 0,
139435
+ compared: 0,
139436
+ mismatches: 0,
139437
+ buckets: emptyBuckets()
139438
+ };
139439
+ var activeHandle = null;
139440
+ var activeTimer = null;
139441
+ var activeClock = () => Date.now();
139442
+ var activeLog = (message) => LOG2.info("Seqscribe", message);
139443
+ var summaryIntervalMs = FLEET_STATUS_PARITY_SUMMARY_INTERVAL_MS;
139444
+ var appendSettleMs = FLEET_STATUS_APPEND_SETTLE_MS;
139445
+ var lastSummaryAt = null;
139446
+ var summaryPending = false;
139447
+ var nextGeneration = 1;
139448
+ var expectations = [];
139449
+ function isOnlineState(value) {
139450
+ return value === "online" || value === "reconnecting" || value === "offline";
139451
+ }
139452
+ function readCounts(value) {
139453
+ if (!value || typeof value !== "object") return null;
139454
+ const record2 = value;
139455
+ const result = {};
139456
+ for (const [axis] of COUNT_AXES) {
139457
+ const count = record2[axis];
139458
+ if (typeof count !== "number" || !Number.isInteger(count) || count < 0) return null;
139459
+ result[axis] = count;
139460
+ }
139461
+ return result;
139462
+ }
139463
+ function normalizeExpectation(value) {
139464
+ if (!value || typeof value.at !== "string" || value.at.length === 0) return null;
139465
+ if (!isOnlineState(value.onlineState)) return null;
139466
+ const sessionCounts = readCounts(value.sessionCounts);
139467
+ if (!sessionCounts) return null;
139468
+ return { at: value.at, sessionCounts, onlineState: value.onlineState };
139469
+ }
139470
+ function summaryLine() {
139471
+ return [
139472
+ "fleet.status parity summary",
139473
+ `runs=${counters4.runs}`,
139474
+ `compared=${counters4.compared}`,
139475
+ `mismatches=${counters4.mismatches}`,
139476
+ ...MISMATCH_KINDS.map((kind) => `${kind}=${counters4.buckets[kind]}`)
139477
+ ].join(" ");
139478
+ }
139479
+ function recordVerdict(result) {
139480
+ counters4.runs++;
139481
+ if (result.compared) counters4.compared++;
139482
+ for (const kind of result.mismatches) {
139483
+ counters4.buckets[kind]++;
139484
+ counters4.mismatches++;
139485
+ }
139486
+ if (result.mismatches.length > 0) summaryPending = true;
139487
+ const now = activeClock();
139488
+ if (summaryPending && (lastSummaryAt === null || now - lastSummaryAt >= summaryIntervalMs)) {
139489
+ activeLog(summaryLine());
139490
+ lastSummaryAt = now;
139491
+ summaryPending = false;
139492
+ }
139493
+ return result;
139494
+ }
139495
+ function runOnce() {
139496
+ const handle = activeHandle;
139497
+ if (!handle) return null;
139498
+ const now = activeClock();
139499
+ const settled = expectations.filter((item) => now - item.observedAt >= appendSettleMs).at(-1);
139500
+ const actual = getLastAppendedEntryForParity();
139501
+ if (!actual) {
139502
+ return settled ? recordVerdict({ compared: false, mismatches: ["missing_shadow_append"] }) : null;
139503
+ }
139504
+ let expected;
139505
+ for (let index = expectations.length - 1; index >= 0; index--) {
139506
+ if (expectations[index]?.at === actual.at) {
139507
+ expected = expectations[index];
139508
+ break;
139509
+ }
139510
+ }
139511
+ if (!expected) return recordVerdict({ compared: false, mismatches: ["unexpected_shadow_append"] });
139512
+ if (settled && expected.generation < settled.generation) {
139513
+ return recordVerdict({ compared: false, mismatches: ["missing_shadow_append"] });
139514
+ }
139515
+ const mismatches = [];
139516
+ for (const [axis, bucket2] of COUNT_AXES) {
139517
+ if (expected.sessionCounts[axis] !== actual.sessionCounts[axis]) mismatches.push(bucket2);
139518
+ }
139519
+ if (expected.onlineState !== actual.onlineState) mismatches.push("online_state");
139520
+ return recordVerdict({ compared: true, mismatches });
139521
+ }
139522
+ function observeFleetStatusWsProjection(build) {
139523
+ if (!activeHandle) return false;
139524
+ try {
139525
+ const value = normalizeExpectation(build());
139526
+ if (!value) return false;
139527
+ const observed = {
139528
+ ...value,
139529
+ generation: nextGeneration++,
139530
+ observedAt: activeClock()
139531
+ };
139532
+ const duplicate = expectations.findIndex((item) => item.at === observed.at);
139533
+ if (duplicate >= 0) expectations.splice(duplicate, 1);
139534
+ expectations.push(observed);
139535
+ if (expectations.length > EXPECTATION_TAIL) expectations.splice(0, expectations.length - EXPECTATION_TAIL);
139536
+ return true;
139537
+ } catch {
139538
+ return false;
139539
+ }
139540
+ }
139541
+ function configureFleetStatusParity(handle, opts = {}) {
139542
+ if (activeTimer) clearInterval(activeTimer);
139543
+ activeTimer = null;
139544
+ activeHandle = null;
139545
+ expectations.length = 0;
139546
+ nextGeneration = 1;
139547
+ summaryPending = false;
139548
+ lastSummaryAt = null;
139549
+ if (!handle || !isFleetStatusShadowActive()) return null;
139550
+ activeHandle = handle;
139551
+ activeClock = opts.clock ?? (() => Date.now());
139552
+ activeLog = opts.log ?? ((message) => LOG2.info("Seqscribe", message));
139553
+ summaryIntervalMs = Math.max(1, opts.summaryIntervalMs ?? FLEET_STATUS_PARITY_SUMMARY_INTERVAL_MS);
139554
+ appendSettleMs = Math.max(0, opts.appendSettleMs ?? FLEET_STATUS_APPEND_SETTLE_MS);
139555
+ if (!opts.once) {
139556
+ activeTimer = setInterval(runOnce, Math.max(1, opts.intervalMs ?? FLEET_STATUS_PARITY_INTERVAL_MS));
139557
+ activeTimer.unref?.();
139558
+ }
139559
+ LOG2.info("Seqscribe", "fleet.status parity loop armed");
139560
+ const ownedHandle = handle;
139561
+ return {
139562
+ runOnce: () => activeHandle === ownedHandle ? runOnce() : null,
139563
+ stop() {
139564
+ if (activeHandle !== ownedHandle) return;
139565
+ configureFleetStatusParity(null);
139566
+ }
139567
+ };
139568
+ }
139569
+ function fleetStatusParityCounters() {
139570
+ return { ...counters4, buckets: { ...counters4.buckets } };
139571
+ }
139572
+ function __resetFleetStatusParityForTests() {
139573
+ configureFleetStatusParity(null);
139574
+ counters4.runs = 0;
139575
+ counters4.compared = 0;
139576
+ counters4.mismatches = 0;
139577
+ counters4.buckets = emptyBuckets();
139578
+ activeClock = () => Date.now();
139579
+ activeLog = (message) => LOG2.info("Seqscribe", message);
139580
+ summaryIntervalMs = FLEET_STATUS_PARITY_SUMMARY_INTERVAL_MS;
139581
+ appendSettleMs = FLEET_STATUS_APPEND_SETTLE_MS;
139582
+ }
139359
139583
  function buildCloudP2PSummary(p2p) {
139360
139584
  if (!p2p) return void 0;
139361
139585
  const counter = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : void 0;
@@ -139745,6 +139969,15 @@ ${ptyResult.output.slice(-2e3)}`);
139745
139969
  );
139746
139970
  }
139747
139971
  }
139972
+ const fleetOnlineState = serverConnected ? "online" : p2pConnected ? "reconnecting" : "offline";
139973
+ observeFleetStatusWsProjection(() => {
139974
+ const wsProjection = buildCloudStatusReportPayload(payload.sessions, payload.p2p, now);
139975
+ return {
139976
+ at: new Date(now).toISOString(),
139977
+ sessionCounts: countFleetSessions(wsProjection.sessions),
139978
+ onlineState: fleetOnlineState
139979
+ };
139980
+ });
139748
139981
  recordFleetStatusShadow(fleetStatusEntry({
139749
139982
  daemonId: this.deps.instanceId,
139750
139983
  sessions: payload.sessions,
@@ -139754,7 +139987,7 @@ ${ptyResult.output.slice(-2e3)}`);
139754
139987
  // effectively unreachable from here — `sendUnifiedStatusReport`
139755
139988
  // returns early when neither transport is up — and is kept in the
139756
139989
  // enum for a consumer that infers it from a stale `at`.
139757
- onlineState: serverConnected ? "online" : p2pConnected ? "reconnecting" : "offline",
139990
+ onlineState: fleetOnlineState,
139758
139991
  p2pActive: p2pConnected,
139759
139992
  timestamp: now,
139760
139993
  seqscribe: this.deps.getSeqscribeStats?.() || void 0
@@ -148146,7 +148379,7 @@ data: ${JSON.stringify(msg.data)}
148146
148379
  `parity backfill mesh=${meshId} mirrored=${mirrored} failed=${failed}` + (skipped > 0 ? ` deferred=${skipped} (cap=${backfillCap}, next sweep)` : "") + " \u2014 these entries were appended by a process with no armed shadow leg (see mesh-dual-write.ts process-boundary note)"
148147
148380
  );
148148
148381
  };
148149
- const runOnce = async () => {
148382
+ const runOnce2 = async () => {
148150
148383
  if (stopped) return;
148151
148384
  let meshIds;
148152
148385
  try {
@@ -148188,7 +148421,7 @@ data: ${JSON.stringify(msg.data)}
148188
148421
  let timer = null;
148189
148422
  if (!opts.once) {
148190
148423
  timer = setInterval(() => {
148191
- void runOnce();
148424
+ void runOnce2();
148192
148425
  }, opts.intervalMs ?? PARITY_INTERVAL_MS);
148193
148426
  timer.unref?.();
148194
148427
  }
@@ -148199,7 +148432,7 @@ data: ${JSON.stringify(msg.data)}
148199
148432
  stopped = true;
148200
148433
  if (timer) clearInterval(timer);
148201
148434
  },
148202
- runOnce
148435
+ runOnce: runOnce2
148203
148436
  };
148204
148437
  }
148205
148438
  init_mesh_read_model();
@@ -148587,6 +148820,7 @@ ${upgradeFailureNotice.notice}${supersededHint}`);
148587
148820
  configureMeshDualWrite(components.seqscribeNode ?? null);
148588
148821
  configureMeshReadModel(components.seqscribeNode ?? null);
148589
148822
  configureFleetStatusShadow(components.seqscribeNode ?? null);
148823
+ configureFleetStatusParity(components.seqscribeNode ?? null);
148590
148824
  if (components.seqscribeNode) {
148591
148825
  pruneStaleConsumersAtBoot();
148592
148826
  components.seqscribeParityLoop = startMeshParityLoop(components.seqscribeNode);
@@ -148694,6 +148928,10 @@ ${upgradeFailureNotice.notice}${supersededHint}`);
148694
148928
  configureMeshDualWrite(null);
148695
148929
  } catch {
148696
148930
  }
148931
+ try {
148932
+ configureFleetStatusParity(null);
148933
+ } catch {
148934
+ }
148697
148935
  try {
148698
148936
  configureFleetStatusShadow(null);
148699
148937
  } catch {
@@ -149185,6 +149423,22 @@ ${upgradeFailureNotice.notice}${supersededHint}`);
149185
149423
  init_mesh_read_model_consumers();
149186
149424
  init_mesh_event_projection();
149187
149425
  init_mesh_parity();
149426
+ init_topics2();
149427
+ function evaluateFleetStatusReadiness(input = {}, parity = fleetStatusParityCounters()) {
149428
+ const topicPresent = input.node?.topics.some((definition) => definition.topic === FLEET_STATUS_TOPIC) === true;
149429
+ const topicGranted = input.grantedTopics?.has(FLEET_STATUS_TOPIC) === true;
149430
+ if (!topicPresent || !topicGranted) {
149431
+ return { ready: false, reason: "topic_or_grant_unavailable" };
149432
+ }
149433
+ if (input.caughtUp !== true) return { ready: false, reason: "not_caught_up" };
149434
+ if (parity.runs < 1 || parity.mismatches !== 0) {
149435
+ return { ready: false, reason: "parity_unclean" };
149436
+ }
149437
+ if (input.primaryIntent !== true) {
149438
+ return { ready: false, reason: "primary_not_intended" };
149439
+ }
149440
+ return { ready: true, reason: null };
149441
+ }
149188
149442
  }
149189
149443
  });
149190
149444