@adhdev/daemon-standalone 0.9.82-rc.368 → 0.9.82-rc.369

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
@@ -30036,10 +30036,10 @@ var require_dist3 = __commonJS({
30036
30036
  }
30037
30037
  function getDaemonBuildInfo() {
30038
30038
  if (cached2) return cached2;
30039
- const commit = readInjected(true ? "8cb6cfc5399f55c6b625095bacc9a27e1741df17" : void 0) ?? "unknown";
30040
- const commitShort = readInjected(true ? "8cb6cfc5" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30041
- const version2 = readInjected(true ? "0.9.82-rc.368" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30042
- const builtAt = readInjected(true ? "2026-06-24T06:15:00.243Z" : void 0);
30039
+ const commit = readInjected(true ? "4464cd9f1effac841aa1fbef3b1691d2f06d64e4" : void 0) ?? "unknown";
30040
+ const commitShort = readInjected(true ? "4464cd9f" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30041
+ const version2 = readInjected(true ? "0.9.82-rc.369" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30042
+ const builtAt = readInjected(true ? "2026-06-24T08:22:41.172Z" : void 0);
30043
30043
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
30044
30044
  return cached2;
30045
30045
  }
@@ -40160,6 +40160,88 @@ Next step: ${nextStep}`;
40160
40160
  CAT = "EvtTrace";
40161
40161
  }
40162
40162
  });
40163
+ function awaitWithWarmupDeadline(work, opts) {
40164
+ const pollMs = Math.max(1, Math.min(opts.pollIntervalMs ?? 200, opts.connectTimeoutMs));
40165
+ return new Promise((resolve24, reject) => {
40166
+ let done = false;
40167
+ let poll;
40168
+ let responseTimer;
40169
+ const startedAt = Date.now();
40170
+ const cleanup = () => {
40171
+ if (poll) {
40172
+ clearInterval(poll);
40173
+ poll = void 0;
40174
+ }
40175
+ if (responseTimer) {
40176
+ clearTimeout(responseTimer);
40177
+ responseTimer = void 0;
40178
+ }
40179
+ };
40180
+ const settle = (fn) => {
40181
+ if (done) return;
40182
+ done = true;
40183
+ cleanup();
40184
+ fn();
40185
+ };
40186
+ const armResponse = () => {
40187
+ if (responseTimer || done) return;
40188
+ responseTimer = setTimeout(
40189
+ () => settle(() => reject(new Error("timeout"))),
40190
+ opts.responseTimeoutMs
40191
+ );
40192
+ if (typeof responseTimer.unref === "function") responseTimer.unref();
40193
+ };
40194
+ const onPoll = () => {
40195
+ if (done) return;
40196
+ if (opts.isConnected()) {
40197
+ if (poll) {
40198
+ clearInterval(poll);
40199
+ poll = void 0;
40200
+ }
40201
+ armResponse();
40202
+ return;
40203
+ }
40204
+ if (Date.now() - startedAt >= opts.connectTimeoutMs) {
40205
+ settle(() => reject(new Error("timeout")));
40206
+ }
40207
+ };
40208
+ if (opts.isConnected()) {
40209
+ armResponse();
40210
+ } else {
40211
+ poll = setInterval(onPoll, pollMs);
40212
+ if (typeof poll.unref === "function") poll.unref();
40213
+ }
40214
+ work.then(
40215
+ (val) => settle(() => resolve24(val)),
40216
+ (err) => settle(() => reject(err))
40217
+ );
40218
+ });
40219
+ }
40220
+ function readWarmupConnectionState(connection) {
40221
+ const state = connection?.state;
40222
+ return typeof state === "string" && state.length > 0 ? state : void 0;
40223
+ }
40224
+ function resolveWarmupDeadlineOpts(opts) {
40225
+ const { getConnection, daemonId, connectTimeoutMs, responseTimeoutMs } = opts;
40226
+ if (getConnection) {
40227
+ return {
40228
+ isConnected: () => readWarmupConnectionState(getConnection(daemonId)) === "connected",
40229
+ connectTimeoutMs,
40230
+ responseTimeoutMs
40231
+ };
40232
+ }
40233
+ opts.onMissingGetter?.(daemonId);
40234
+ return {
40235
+ isConnected: () => false,
40236
+ connectTimeoutMs: connectTimeoutMs + responseTimeoutMs,
40237
+ responseTimeoutMs
40238
+ };
40239
+ }
40240
+ var init_mesh_warmup_deadline = __esm2({
40241
+ "src/mesh/mesh-warmup-deadline.ts"() {
40242
+ "use strict";
40243
+ }
40244
+ });
40163
40245
  function isPlainObject22(value) {
40164
40246
  return !!value && typeof value === "object" && !Array.isArray(value);
40165
40247
  }
@@ -42603,7 +42685,12 @@ ${cleanBody}`;
42603
42685
  return void 0;
42604
42686
  }
42605
42687
  }
42606
- function deliverTaskToSession(dispatchThunk, ctx) {
42688
+ function warnDispatchWarmupGetterMissingOnce(daemonId) {
42689
+ if (dispatchWarmupGetterMissingWarned.has(daemonId)) return;
42690
+ dispatchWarmupGetterMissingWarned.add(daemonId);
42691
+ LOG2.warn("MeshQueue", `Mesh peer connection getter unavailable for ${String(daemonId).slice(0, 12)}; remote task-dispatch warmup deadline degraded to the combined connect+response window. Avoids a cold-open false-timeout but loses warm/cold precision \u2014 wire getMeshPeerConnectionStatus on this daemon.`);
42692
+ }
42693
+ function deliverTaskToSession(dispatchThunk, ctx, warmup) {
42607
42694
  const delivery = createSessionDelivery({
42608
42695
  meshId: ctx.meshId,
42609
42696
  nodeId: ctx.nodeId,
@@ -42623,16 +42710,27 @@ ${cleanBody}`;
42623
42710
  dispatchPromise = Promise.reject(e);
42624
42711
  }
42625
42712
  let timer;
42626
- const guarded = Promise.race([
42627
- dispatchPromise,
42628
- new Promise((_, reject) => {
42629
- timer = setTimeout(
42630
- () => reject(new Error(`dispatch_confirm_timeout after ${DISPATCH_CONFIRM_TIMEOUT_MS}ms`)),
42631
- DISPATCH_CONFIRM_TIMEOUT_MS
42632
- );
42633
- if (typeof timer?.unref === "function") timer.unref();
42634
- })
42635
- ]);
42713
+ let guarded;
42714
+ if (warmup) {
42715
+ guarded = awaitWithWarmupDeadline(dispatchPromise, resolveWarmupDeadlineOpts({
42716
+ getConnection: warmup.getConnection,
42717
+ daemonId: warmup.daemonId,
42718
+ connectTimeoutMs: DISPATCH_CONNECT_TIMEOUT_MS,
42719
+ responseTimeoutMs: DISPATCH_CONFIRM_TIMEOUT_MS,
42720
+ onMissingGetter: warnDispatchWarmupGetterMissingOnce
42721
+ }));
42722
+ } else {
42723
+ guarded = Promise.race([
42724
+ dispatchPromise,
42725
+ new Promise((_, reject) => {
42726
+ timer = setTimeout(
42727
+ () => reject(new Error(`dispatch_confirm_timeout after ${DISPATCH_CONFIRM_TIMEOUT_MS}ms`)),
42728
+ DISPATCH_CONFIRM_TIMEOUT_MS
42729
+ );
42730
+ if (typeof timer?.unref === "function") timer.unref();
42731
+ })
42732
+ ]);
42733
+ }
42636
42734
  guarded.then(() => {
42637
42735
  if (timer) clearTimeout(timer);
42638
42736
  updateSessionDeliveryStatus(delivery.id, "delivered");
@@ -42716,7 +42814,11 @@ ${cleanBody}`;
42716
42814
  transport: "remote",
42717
42815
  ...sourceCoordinatorSessionId ? { sourceCoordinatorSessionId } : {},
42718
42816
  ...localDaemonIdForDispatch ? { sourceCoordinatorDaemonId: localDaemonIdForDispatch } : {}
42719
- }
42817
+ },
42818
+ // Warmup-aware deadline: this dispatch can be the FIRST command to a
42819
+ // peer whose mesh DataChannel is still opening — charge the cold-open
42820
+ // handshake to the connect budget, not the response budget.
42821
+ { daemonId: remoteDaemonId, getConnection: components.getMeshPeerConnectionStatus }
42720
42822
  );
42721
42823
  return true;
42722
42824
  }
@@ -44104,6 +44206,8 @@ ${cleanBody}`;
44104
44206
  var INTENTIONAL_CLEANUP_STOP_SUPPRESSION_MS;
44105
44207
  var RECENT_COMPLETION_FINGERPRINT_TTL_MS;
44106
44208
  var DISPATCH_CONFIRM_TIMEOUT_MS;
44209
+ var DISPATCH_CONNECT_TIMEOUT_MS;
44210
+ var dispatchWarmupGetterMissingWarned;
44107
44211
  var autoLaunchInProgress;
44108
44212
  var autoLaunchCooldownUntil;
44109
44213
  var AUTO_LAUNCH_COOLDOWN_MS;
@@ -44131,6 +44235,7 @@ ${cleanBody}`;
44131
44235
  init_mesh_routing();
44132
44236
  init_mesh_unresolved_forward_outbox();
44133
44237
  init_mesh_event_trace();
44238
+ init_mesh_warmup_deadline();
44134
44239
  init_snapshot();
44135
44240
  init_repo_mesh_types();
44136
44241
  init_dist();
@@ -44144,6 +44249,8 @@ ${cleanBody}`;
44144
44249
  INTENTIONAL_CLEANUP_STOP_SUPPRESSION_MS = 30 * 60 * 1e3;
44145
44250
  RECENT_COMPLETION_FINGERPRINT_TTL_MS = 10 * 60 * 1e3;
44146
44251
  DISPATCH_CONFIRM_TIMEOUT_MS = 12e4;
44252
+ DISPATCH_CONNECT_TIMEOUT_MS = 45e3;
44253
+ dispatchWarmupGetterMissingWarned = /* @__PURE__ */ new Set();
44147
44254
  autoLaunchInProgress = /* @__PURE__ */ new Set();
44148
44255
  autoLaunchCooldownUntil = /* @__PURE__ */ new Map();
44149
44256
  AUTO_LAUNCH_COOLDOWN_MS = 5e3;
@@ -71457,6 +71564,14 @@ Run 'adhdev doctor' for detailed diagnostics.`
71457
71564
  let restored = 0;
71458
71565
  const restoredBindings = /* @__PURE__ */ new Set();
71459
71566
  const managerTag = this.deps.hostedRuntimeManagerTag;
71567
+ const restoredRuntimeIds = /* @__PURE__ */ new Set();
71568
+ const workspaceTypeCounts = /* @__PURE__ */ new Map();
71569
+ for (const r of sessions) {
71570
+ if (!r?.runtimeId || !r?.cliType || !r?.workspace) continue;
71571
+ restoredRuntimeIds.add(r.runtimeId);
71572
+ const key = `${r.workspace}::${r.cliType}`;
71573
+ workspaceTypeCounts.set(key, (workspaceTypeCounts.get(key) || 0) + 1);
71574
+ }
71460
71575
  for (const record2 of sessions) {
71461
71576
  if (!record2?.runtimeId || !record2?.cliType || !record2?.workspace) continue;
71462
71577
  if (!shouldRestoreHostedRuntime(record2, managerTag)) {
@@ -71494,11 +71609,21 @@ Run 'adhdev doctor' for detailed diagnostics.`
71494
71609
  if (!coordinatorEntry?.meshId && record2.workspace) {
71495
71610
  const workspaceCoordinators = listCoordinatorsForWorkspace(record2.workspace).filter((e) => e.meshId && (!e.cliType || e.cliType === record2.cliType));
71496
71611
  if (workspaceCoordinators.length === 1) {
71497
- coordinatorEntry = workspaceCoordinators[0];
71498
- LOG2.info(
71499
- "CLI",
71500
- `\u21BB Rebound coordinator mark by workspace for ${record2.runtimeKey || record2.runtimeId} (mesh ${coordinatorEntry.meshId} @ ${record2.workspace}); registry key did not match runtimeId`
71501
- );
71612
+ const candidate = workspaceCoordinators[0];
71613
+ const coordinatorPresentById = !!candidate.sessionId && restoredRuntimeIds.has(candidate.sessionId);
71614
+ const siblingCount = workspaceTypeCounts.get(`${record2.workspace}::${record2.cliType}`) || 1;
71615
+ if (!coordinatorPresentById && siblingCount === 1) {
71616
+ coordinatorEntry = candidate;
71617
+ LOG2.info(
71618
+ "CLI",
71619
+ `\u21BB Rebound coordinator mark by workspace for ${record2.runtimeKey || record2.runtimeId} (mesh ${candidate.meshId} @ ${record2.workspace}); registry key did not match runtimeId`
71620
+ );
71621
+ } else {
71622
+ LOG2.info(
71623
+ "CLI",
71624
+ `\u21B7 Skipping workspace coordinator rebind for ${record2.runtimeKey || record2.runtimeId} (${record2.cliType} @ ${record2.workspace}): ${coordinatorPresentById ? "registered coordinator is restoring under its own id \u2014 this is a delegated worker" : `ambiguous (${siblingCount} sessions share this workspace+cliType)`}`
71625
+ );
71626
+ }
71502
71627
  }
71503
71628
  }
71504
71629
  if (coordinatorEntry?.meshId) {
@@ -77926,6 +78051,7 @@ ${ptyResult.output.slice(-2e3)}`);
77926
78051
  const remoteGit = await meshGitProbeCache.probe(daemonId, workspace, runNodeProbe);
77927
78052
  if (remoteGit) {
77928
78053
  status.git = remoteGit;
78054
+ status[MESH_NODE_LIVE_TRUTH_MARKER] = true;
77929
78055
  status.health = remoteGit.isGitRepo ? deriveMeshNodeHealthFromGit(remoteGit) : "degraded";
77930
78056
  const connection = readObjectRecord(status.connection);
77931
78057
  const connectionState = readStringValue(connection.state);
@@ -77951,13 +78077,13 @@ ${ptyResult.output.slice(-2e3)}`);
77951
78077
  pendingPeerGitProbe ? { skipGit: true, skipError: true, skipHealth: true } : void 0
77952
78078
  )) {
77953
78079
  applyInlineMeshBranchConvergence(mesh, node, status);
77954
- finalizeMeshNodeStatus({ status, node, daemonId, isSelfNode });
78080
+ finalizeMeshNodeStatus({ status, node, daemonId, isSelfNode, directTruthUnavailable: directTruthUnavailableNodeIds.has(nodeId) });
77955
78081
  nodeStatuses.push(status);
77956
78082
  continue;
77957
78083
  }
77958
78084
  if (meshRecord?.source === "inline_cache" && !isSelfNode) {
77959
78085
  applyInlineMeshBranchConvergence(mesh, node, status);
77960
- finalizeMeshNodeStatus({ status, node, daemonId, isSelfNode });
78086
+ finalizeMeshNodeStatus({ status, node, daemonId, isSelfNode, directTruthUnavailable: directTruthUnavailableNodeIds.has(nodeId) });
77961
78087
  nodeStatuses.push(status);
77962
78088
  continue;
77963
78089
  }
@@ -77966,6 +78092,7 @@ ${ptyResult.output.slice(-2e3)}`);
77966
78092
  try {
77967
78093
  const gitStatus = await getGitRepoStatus(workspace, { timeoutMs: 1e4, refreshUpstream: true });
77968
78094
  status.git = gitStatus;
78095
+ status[MESH_NODE_LIVE_TRUTH_MARKER] = true;
77969
78096
  const reporter = recordInlineMeshDirectGitTruth(node, gitStatus, "selected_coordinator_local_git");
77970
78097
  persistNodeReporterPlatform(meshRecord.source, mesh, nodeId, reporter);
77971
78098
  if (gitStatus.isGitRepo) {
@@ -77984,7 +78111,7 @@ ${ptyResult.output.slice(-2e3)}`);
77984
78111
  applyCachedInlineMeshNodeStatus(status, node);
77985
78112
  }
77986
78113
  applyInlineMeshBranchConvergence(mesh, node, status);
77987
- finalizeMeshNodeStatus({ status, node, daemonId, isSelfNode });
78114
+ finalizeMeshNodeStatus({ status, node, daemonId, isSelfNode, directTruthUnavailable: directTruthUnavailableNodeIds.has(nodeId) });
77988
78115
  nodeStatuses.push(status);
77989
78116
  }
77990
78117
  const callerCoordinatorDaemonId = typeof args?.coordinatorDaemonId === "string" && args.coordinatorDaemonId.trim() ? args.coordinatorDaemonId.trim() : ctx.deps.statusInstanceId || void 0;
@@ -78386,6 +78513,7 @@ ${ptyResult.output.slice(-2e3)}`);
78386
78513
  return { order: ranked.map((a) => a.nodeId), changeAreas: areaById, rationale };
78387
78514
  }
78388
78515
  init_mesh_work_queue();
78516
+ init_mesh_warmup_deadline();
78389
78517
  init_repo_mesh_types();
78390
78518
  var import_os4 = require("os");
78391
78519
  var import_path13 = require("path");
@@ -79127,14 +79255,92 @@ ${ptyResult.output.slice(-2e3)}`);
79127
79255
  status.updatedAt = gitCheckedAt ?? connectionFreshAt;
79128
79256
  }
79129
79257
  }
79258
+ var MESH_NODE_LIVE_TRUTH_MARKER = "__liveTruthProbed";
79259
+ var MESH_FRESHNESS_FRESH_MS = 3e4;
79260
+ var MESH_FRESHNESS_RECENT_MS = 3e5;
79261
+ function classifyMeshNodeStaleness(dataSource, ageMs) {
79262
+ if (dataSource === "self" || dataSource === "live") return "fresh";
79263
+ if (ageMs === null) return "unknown";
79264
+ if (ageMs < MESH_FRESHNESS_FRESH_MS) return "fresh";
79265
+ if (ageMs < MESH_FRESHNESS_RECENT_MS) return "recent";
79266
+ return "stale";
79267
+ }
79268
+ function buildMeshNodeDataFreshness(args) {
79269
+ const { status, node, isSelfNode, daemonId, liveTruthProbed, directTruthUnavailable } = args;
79270
+ const now = args.now ?? Date.now;
79271
+ const connection = readObjectRecord(status.connection);
79272
+ const connectionState = readStringValue(connection.state);
79273
+ const git = readObjectRecord(status.git);
79274
+ const hasGit = readBooleanValue(git.isGitRepo) === true || !!readStringValue(git.branch, git.headCommit, git.head, git.upstream);
79275
+ const connectionFreshAt = toIsoTimestamp(connection.lastCommandAt ?? connection.lastConnectedAt ?? connection.lastStateChangeAt);
79276
+ const liveGitCheckedAt = liveTruthProbed ? toIsoTimestamp(git.lastCheckedAt) : null;
79277
+ const heldGit = readObjectRecord(node?.lastGit ?? node?.last_git);
79278
+ const heldCheckedAt = toIsoTimestamp(heldGit.checkedAt ?? heldGit.checked_at);
79279
+ const cachedStatus = readObjectRecord(node?.cachedStatus);
79280
+ const cachedGitCheckedAt = toIsoTimestamp(readObjectRecord(cachedStatus.git).lastCheckedAt);
79281
+ const lastProbeAt = liveGitCheckedAt ?? heldCheckedAt ?? cachedGitCheckedAt ?? toIsoTimestamp(git.lastCheckedAt) ?? connectionFreshAt ?? toIsoTimestamp(status.updatedAt) ?? toIsoTimestamp(status.lastSeenAt);
79282
+ const connectionReachable = connectionState === "connected" ? true : !connectionState || connectionState === "unknown" || connectionState === "connecting" ? connectionState === "connecting" ? true : null : false;
79283
+ let dataSource;
79284
+ let reachable;
79285
+ if (isSelfNode) {
79286
+ dataSource = "self";
79287
+ reachable = true;
79288
+ } else if (liveTruthProbed) {
79289
+ dataSource = "live";
79290
+ reachable = true;
79291
+ } else if (readBooleanValue(status.gitProbePending) === true) {
79292
+ dataSource = "pending";
79293
+ reachable = connectionReachable;
79294
+ } else if (directTruthUnavailable) {
79295
+ dataSource = "unreachable";
79296
+ reachable = false;
79297
+ } else if (hasGit) {
79298
+ dataSource = "cached";
79299
+ reachable = connectionReachable;
79300
+ } else if (!daemonId) {
79301
+ dataSource = "unconfigured";
79302
+ reachable = null;
79303
+ } else if (connectionState === "connected") {
79304
+ dataSource = "empty";
79305
+ reachable = true;
79306
+ } else {
79307
+ dataSource = "unreachable";
79308
+ reachable = false;
79309
+ }
79310
+ const probeOk = dataSource === "live" || dataSource === "self";
79311
+ let ageMs = null;
79312
+ if (lastProbeAt) {
79313
+ const parsed = Date.parse(lastProbeAt);
79314
+ if (Number.isFinite(parsed)) ageMs = Math.max(0, now() - parsed);
79315
+ }
79316
+ const staleness = classifyMeshNodeStaleness(dataSource, ageMs);
79317
+ return {
79318
+ dataSource,
79319
+ probeOk,
79320
+ reachable,
79321
+ lastProbeAt: lastProbeAt ?? null,
79322
+ ageMs,
79323
+ staleness
79324
+ };
79325
+ }
79130
79326
  function finalizeMeshNodeStatus(args) {
79131
- const { status, node, daemonId, isSelfNode } = args;
79327
+ const { status, node, daemonId, isSelfNode, directTruthUnavailable } = args;
79132
79328
  if (!readStringValue(status.machineStatus)) {
79133
79329
  const cachedStatus = readObjectRecord(node?.cachedStatus);
79134
79330
  const machineStatus = readStringValue(cachedStatus.machineStatus, cachedStatus.machine_status, node?.machineStatus);
79135
79331
  if (machineStatus) status.machineStatus = machineStatus;
79136
79332
  }
79137
79333
  synthesizeMeshNodeFreshnessFromConnection(status);
79334
+ const liveTruthProbed = readBooleanValue(status[MESH_NODE_LIVE_TRUTH_MARKER]) === true;
79335
+ delete status[MESH_NODE_LIVE_TRUTH_MARKER];
79336
+ status.dataFreshness = buildMeshNodeDataFreshness({
79337
+ status,
79338
+ node,
79339
+ isSelfNode,
79340
+ daemonId,
79341
+ liveTruthProbed,
79342
+ directTruthUnavailable
79343
+ });
79138
79344
  const bootstrap = readObjectRecord(node?.worktreeBootstrap);
79139
79345
  if (node?.isLocalWorktree && readStringValue(bootstrap.status)) {
79140
79346
  status.worktreeBootstrap = bootstrap;
@@ -79202,73 +79408,16 @@ ${ptyResult.output.slice(-2e3)}`);
79202
79408
  }
79203
79409
  }
79204
79410
  };
79205
- function awaitWithWarmupDeadline(work, opts) {
79206
- const pollMs = Math.max(1, Math.min(opts.pollIntervalMs ?? 200, opts.connectTimeoutMs));
79207
- return new Promise((resolve24, reject) => {
79208
- let done = false;
79209
- let poll;
79210
- let responseTimer;
79211
- const startedAt = Date.now();
79212
- const cleanup = () => {
79213
- if (poll) {
79214
- clearInterval(poll);
79215
- poll = void 0;
79216
- }
79217
- if (responseTimer) {
79218
- clearTimeout(responseTimer);
79219
- responseTimer = void 0;
79220
- }
79221
- };
79222
- const settle = (fn) => {
79223
- if (done) return;
79224
- done = true;
79225
- cleanup();
79226
- fn();
79227
- };
79228
- const armResponse = () => {
79229
- if (responseTimer || done) return;
79230
- responseTimer = setTimeout(
79231
- () => settle(() => reject(new Error("timeout"))),
79232
- opts.responseTimeoutMs
79233
- );
79234
- if (typeof responseTimer.unref === "function") responseTimer.unref();
79235
- };
79236
- const onPoll = () => {
79237
- if (done) return;
79238
- if (opts.isConnected()) {
79239
- if (poll) {
79240
- clearInterval(poll);
79241
- poll = void 0;
79242
- }
79243
- armResponse();
79244
- return;
79245
- }
79246
- if (Date.now() - startedAt >= opts.connectTimeoutMs) {
79247
- settle(() => reject(new Error("timeout")));
79248
- }
79249
- };
79250
- if (opts.isConnected()) {
79251
- armResponse();
79252
- } else {
79253
- poll = setInterval(onPoll, pollMs);
79254
- if (typeof poll.unref === "function") poll.unref();
79255
- }
79256
- work.then(
79257
- (val) => settle(() => resolve24(val)),
79258
- (err) => settle(() => reject(err))
79259
- );
79260
- });
79261
- }
79262
79411
  async function probeRemoteMeshGitStatus(args) {
79263
79412
  if (!args.dispatchMeshCommand) return null;
79264
79413
  const dispatch = args.dispatchMeshCommand(args.daemonId, "git_status", { workspace: args.workspace, refreshUpstream: true });
79265
- const getConnection = args.getConnection;
79266
- const isConnected = getConnection ? () => readMeshConnectionState(getConnection(args.daemonId)) === "connected" : () => true;
79267
- const remoteResult = await awaitWithWarmupDeadline(dispatch, {
79268
- isConnected,
79414
+ const remoteResult = await awaitWithWarmupDeadline(dispatch, resolveWarmupDeadlineOpts({
79415
+ getConnection: args.getConnection,
79416
+ daemonId: args.daemonId,
79269
79417
  connectTimeoutMs: args.connectTimeoutMs,
79270
- responseTimeoutMs: args.responseTimeoutMs
79271
- });
79418
+ responseTimeoutMs: args.responseTimeoutMs,
79419
+ onMissingGetter: warnMeshWarmupGetterMissingOnce
79420
+ }));
79272
79421
  const remoteGit = remoteResult?.status ?? remoteResult?.git ?? remoteResult;
79273
79422
  if (!remoteGit || typeof remoteGit !== "object" || typeof remoteGit.isGitRepo !== "boolean") return null;
79274
79423
  const reporterPlatform = readStringValue(remoteResult?.reporterPlatform);
@@ -79282,6 +79431,12 @@ ${ptyResult.output.slice(-2e3)}`);
79282
79431
  function readMeshConnectionState(connection) {
79283
79432
  return readStringValue(connection?.state);
79284
79433
  }
79434
+ var meshWarmupGetterMissingWarned = /* @__PURE__ */ new Set();
79435
+ function warnMeshWarmupGetterMissingOnce(daemonId) {
79436
+ if (meshWarmupGetterMissingWarned.has(daemonId)) return;
79437
+ meshWarmupGetterMissingWarned.add(daemonId);
79438
+ LOG2.warn("Mesh", `Mesh peer connection getter unavailable for ${String(daemonId).slice(0, 12)}; warmup deadline degraded to the combined connect+response window (cannot observe DataChannel open). This avoids a cold-open false-timeout but loses warm/cold precision \u2014 wire getMeshPeerConnectionStatus on this daemon.`);
79439
+ }
79285
79440
  function isMeshConnectionDefinitivelyDown(connection) {
79286
79441
  if (!connection) return true;
79287
79442
  const state = readMeshConnectionState(connection);
@@ -91296,6 +91451,7 @@ data: ${JSON.stringify(msg.data)}
91296
91451
  detectedIdes: detectedIdesRef,
91297
91452
  refreshProviderAvailability,
91298
91453
  dispatchMeshCommand: config2.dispatchMeshCommand,
91454
+ getMeshPeerConnectionStatus: config2.getMeshPeerConnectionStatus,
91299
91455
  onMeshCoordinatorEventForwarded: config2.onMeshCoordinatorEventForwarded,
91300
91456
  statusInstanceId: config2.statusInstanceId
91301
91457
  };