@adhdev/daemon-standalone 1.0.58-rc.43 → 1.0.58-rc.44

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 ? "47890c7d415cdbcb3ce67972b0351e36477e8a27" : void 0) ?? "unknown";
36915
- const commitShort = readInjected(true ? "47890c7d" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36916
- const version2 = readInjected(true ? "1.0.58-rc.43" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36917
- const builtAt = readInjected(true ? "2026-08-29T16:10:45.187Z" : void 0);
36914
+ const commit = readInjected(true ? "2c9a4f385d00c90bde2c4b0ae4b682cd9e5120a6" : void 0) ?? "unknown";
36915
+ const commitShort = readInjected(true ? "2c9a4f38" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36916
+ const version2 = readInjected(true ? "1.0.58-rc.44" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36917
+ const builtAt = readInjected(true ? "2026-08-29T18:43:13.498Z" : void 0);
36918
36918
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
36919
36919
  return cached2;
36920
36920
  }
@@ -79188,6 +79188,47 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
79188
79188
  recordAutoLaunchEvent(meshId, { phase: "skipped", taskId: task.id, reason: "awaiting_launched_session_claim_backoff", nodeId, sessionId });
79189
79189
  return "backoff";
79190
79190
  }
79191
+ function remoteGeneratingKey(meshId, sessionId) {
79192
+ return `${meshId}::${sessionId}`;
79193
+ }
79194
+ function markRemoteSessionGenerating(meshId, sessionId) {
79195
+ if (!meshId || !sessionId) return;
79196
+ remoteGeneratingSessions.add(remoteGeneratingKey(meshId, sessionId));
79197
+ }
79198
+ function markRemoteSessionIdle(meshId, sessionId) {
79199
+ if (!meshId || !sessionId) return;
79200
+ remoteGeneratingSessions.delete(remoteGeneratingKey(meshId, sessionId));
79201
+ }
79202
+ function isRemoteSessionMarkedGenerating(meshId, sessionId) {
79203
+ if (!meshId || !sessionId) return false;
79204
+ return remoteGeneratingSessions.has(remoteGeneratingKey(meshId, sessionId));
79205
+ }
79206
+ function claimAfterRemoteAutoLaunch(components, meshId, nodeId, sessionId, providerType, assignQueueTask) {
79207
+ if (!sessionId) return "no_session";
79208
+ if (isRemoteSessionMarkedGenerating(meshId, sessionId)) {
79209
+ LOG2.info("MeshQueue", `Remote auto-launch claim skipped for session ${sessionId} on node ${nodeId} (mesh ${meshId}): generating_started observed \u2014 fail-closed, will not inject into a mid-turn worker`);
79210
+ return "skipped_generating";
79211
+ }
79212
+ try {
79213
+ MeshRuntimeStore.getInstance().setRemoteIdleSession(
79214
+ meshId,
79215
+ nodeId,
79216
+ sessionId,
79217
+ providerType,
79218
+ Date.now() + AUTO_LAUNCH_REMOTE_IDLE_TTL_MS
79219
+ );
79220
+ } catch {
79221
+ }
79222
+ const assigned = assignQueueTask(components, meshId, nodeId, sessionId, providerType);
79223
+ if (assigned) {
79224
+ try {
79225
+ MeshRuntimeStore.getInstance().deleteRemoteIdleSession(meshId, nodeId, sessionId);
79226
+ } catch {
79227
+ }
79228
+ return "claimed";
79229
+ }
79230
+ return "registered";
79231
+ }
79191
79232
  var AUTO_LAUNCH_AWAIT_CLAIM_MS;
79192
79233
  var AUTO_LAUNCH_AWAIT_CLAIM_BACKOFF_CAP_CYCLES;
79193
79234
  var AUTO_LAUNCH_REMOTE_IDLE_TTL_MS;
@@ -79196,6 +79237,7 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
79196
79237
  var autoLaunchOrphanFirstSeenAtMs;
79197
79238
  var AUTO_LAUNCH_ORPHAN_GRACE_MS;
79198
79239
  var autoLaunchAwaitClaimBackoff;
79240
+ var remoteGeneratingSessions;
79199
79241
  var init_mesh_autolaunch_integrity = __esm2({
79200
79242
  "src/mesh/mesh-autolaunch-integrity.ts"() {
79201
79243
  "use strict";
@@ -79216,6 +79258,7 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
79216
79258
  autoLaunchOrphanFirstSeenAtMs = /* @__PURE__ */ new Map();
79217
79259
  AUTO_LAUNCH_ORPHAN_GRACE_MS = 3e4;
79218
79260
  autoLaunchAwaitClaimBackoff = /* @__PURE__ */ new Map();
79261
+ remoteGeneratingSessions = /* @__PURE__ */ new Set();
79219
79262
  }
79220
79263
  });
79221
79264
  function classifiedDifficultiesForSlot(slot) {
@@ -81035,12 +81078,18 @@ ${block2.text}`,
81035
81078
  if (!localId) continue;
81036
81079
  const inlineMatch = cachedNodes.find((cachedNode) => meshNodeIdMatches(cachedNode, localId));
81037
81080
  if (!inlineMatch) continue;
81038
- if (!inlineBootstrapIsFresher(inlineMatch.worktreeBootstrap, localNode.worktreeBootstrap)) continue;
81081
+ const bootstrapFresher = inlineBootstrapIsFresher(inlineMatch.worktreeBootstrap, localNode.worktreeBootstrap);
81082
+ const inlineGit = inlineMatch.lastGit ?? inlineMatch.last_git;
81083
+ if (!bootstrapFresher && !inlineGit) continue;
81039
81084
  if (!overlaid) {
81040
81085
  overlaidLocalNodes = [...localNodes];
81041
81086
  overlaid = true;
81042
81087
  }
81043
- overlaidLocalNodes[i] = { ...localNode, worktreeBootstrap: inlineMatch.worktreeBootstrap };
81088
+ overlaidLocalNodes[i] = {
81089
+ ...localNode,
81090
+ ...bootstrapFresher ? { worktreeBootstrap: inlineMatch.worktreeBootstrap } : {},
81091
+ ...inlineGit ? { lastGit: inlineGit, last_git: inlineGit } : {}
81092
+ };
81044
81093
  }
81045
81094
  if (!cacheOnly.length && !overlaid) return localMesh;
81046
81095
  return { ...localMesh, nodes: [...overlaidLocalNodes, ...cacheOnly] };
@@ -81337,7 +81386,12 @@ ${block2.text}`,
81337
81386
  return void 0;
81338
81387
  }
81339
81388
  })();
81340
- const bootstrapGateNode = inlineBootstrapNode ?? node;
81389
+ const bootstrapGateNode = (() => {
81390
+ const base = inlineBootstrapNode ?? node;
81391
+ if (!base) return base;
81392
+ const git3 = inlineBootstrapNode?.lastGit ?? inlineBootstrapNode?.last_git ?? node?.lastGit ?? node?.last_git;
81393
+ return git3 ? { ...base, lastGit: git3, last_git: git3 } : base;
81394
+ })();
81341
81395
  if (bootstrapGateNode?.worktreeBootstrap?.status === "running") {
81342
81396
  if (!shouldDeferDispatchForBootstrap(bootstrapGateNode)) {
81343
81397
  logWorktreeBootstrapStaleBypass(meshId, nodeId, sessionId);
@@ -82130,6 +82184,7 @@ ${block2.text}`,
82130
82184
  await waitForRemoteSessionReady(meshId, nodeId, remoteSessionId, {
82131
82185
  isReady: remoteSessionReadyProbe(meshId, nodeId, remoteSessionId)
82132
82186
  }).catch(() => false);
82187
+ claimAfterRemoteAutoLaunch(components, meshId, nodeId, remoteSessionId, effectiveProviderType, tryAssignQueueTask);
82133
82188
  }
82134
82189
  return true;
82135
82190
  }
@@ -85973,6 +86028,7 @@ ${cleanBody}`;
85973
86028
  }
85974
86029
  if (nodeId && providerType) {
85975
86030
  if (!isFalseIdle) {
86031
+ markRemoteSessionIdle(args.meshId, sessionId);
85976
86032
  sweepExpiredRemoteIdleSessions();
85977
86033
  try {
85978
86034
  MeshRuntimeStore.getInstance().setRemoteIdleSession(args.meshId, nodeId, sessionId, providerType, Date.now() + REMOTE_IDLE_SESSION_TTL_MS);
@@ -86050,6 +86106,7 @@ ${cleanBody}`;
86050
86106
  worktreeBootstrapPending = node?.worktreeBootstrap?.status === "running";
86051
86107
  } catch {
86052
86108
  }
86109
+ markRemoteSessionIdle(args.meshId, sessionId);
86053
86110
  sweepExpiredRemoteIdleSessions();
86054
86111
  try {
86055
86112
  MeshRuntimeStore.getInstance().setRemoteIdleSession(args.meshId, nodeId, sessionId, providerType, Date.now() + REMOTE_IDLE_SESSION_TTL_MS);
@@ -86080,6 +86137,7 @@ ${cleanBody}`;
86080
86137
  }
86081
86138
  }
86082
86139
  if (sessionId) {
86140
+ markRemoteSessionGenerating(args.meshId, sessionId);
86083
86141
  const startedTaskId = readNonEmptyString(args.metadataEvent.taskId) || void 0;
86084
86142
  const startedNonce = typeof args.metadataEvent.dispatchNonce === "number" ? args.metadataEvent.dispatchNonce : void 0;
86085
86143
  if (startedTaskId && startedNonce !== void 0) {
@@ -86187,6 +86245,7 @@ ${cleanBody}`;
86187
86245
  }
86188
86246
  }
86189
86247
  if (sessionId) {
86248
+ markRemoteSessionIdle(args.meshId, sessionId);
86190
86249
  directDispatchTaskIdForLedger = readNonEmptyString(args.metadataEvent.taskId) || resolveActiveDirectDispatchTaskId(args.meshId, sessionId);
86191
86250
  completedTaskForLedger = markSessionTerminal(sessionId, "failed");
86192
86251
  }
@@ -86850,6 +86909,7 @@ ${cleanBody}`;
86850
86909
  init_mesh_event_classify();
86851
86910
  init_mesh_turn_ledger();
86852
86911
  init_mesh_queue_assignment();
86912
+ init_mesh_autolaunch_integrity();
86853
86913
  init_mesh_event_suppression();
86854
86914
  init_mesh_event_suppression();
86855
86915
  REMOTE_IDLE_SESSION_TTL_MS = 5 * 60 * 1e3;