@adhdev/daemon-standalone 0.9.82-rc.388 → 0.9.82-rc.389

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/daemon-standalone",
3
- "version": "0.9.82-rc.388",
3
+ "version": "0.9.82-rc.389",
4
4
  "description": "ADHDev standalone daemon — embedded HTTP/WS server for local dashboard",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -3901,6 +3901,14 @@ async function meshReviewInbox(ctx, args = {}) {
3901
3901
  }
3902
3902
 
3903
3903
  // src/tools/mesh-tools-session.ts
3904
+ function computeIdleDispatchAckRisk(sessionWasIdle, dispatchPreRecorded, sessionId) {
3905
+ if (!sessionWasIdle || dispatchPreRecorded) return {};
3906
+ return {
3907
+ dispatchAcknowledgementRisk: true,
3908
+ dispatchAcknowledgementRiskReason: "idle_dispatch_prerecord_failed",
3909
+ dispatchAcknowledgementNote: `Session '${sessionId}' was idle at dispatch time and the dispatch row could not be pre-recorded, so its completion may be deduplicated as a prior turn and lost. Use mesh_status to verify; if the session remains idle or the completion never lands, launch a fresh session and retry.`
3910
+ };
3911
+ }
3904
3912
  async function meshPruneStaleDirect(ctx, args = {}) {
3905
3913
  await refreshMeshFromDaemon(ctx);
3906
3914
  const execute = args.execute === true && args.dry_run !== true;
@@ -4245,6 +4253,11 @@ async function meshSendTask(ctx, args) {
4245
4253
  dispatchedToIdleSession: sessionWasIdle,
4246
4254
  dispatchedAt
4247
4255
  });
4256
+ let dispatchPreRecorded = false;
4257
+ try {
4258
+ dispatchPreRecorded = (0, import_daemon_core3.getActiveDirectDispatches)(ctx.mesh.id).some((d) => d.taskId === taskId);
4259
+ } catch {
4260
+ }
4248
4261
  const dispatchResult = await commandForNode(ctx, node, "agent_command", {
4249
4262
  targetSessionId: args.session_id,
4250
4263
  agentType: resolvedProviderType,
@@ -4267,6 +4280,7 @@ async function meshSendTask(ctx, args) {
4267
4280
  (0, import_daemon_core3.deleteDirectDispatchesByTaskId)(ctx.mesh.id, [taskId]);
4268
4281
  } catch {
4269
4282
  }
4283
+ dispatchPreRecorded = false;
4270
4284
  const source = dispatchPayload?.success === false ? dispatchPayload : dispatchResult;
4271
4285
  return JSON.stringify({
4272
4286
  ...source && typeof source === "object" ? source : {},
@@ -4316,11 +4330,10 @@ async function meshSendTask(ctx, args) {
4316
4330
  providerType: resolvedProviderType,
4317
4331
  nodeId: args.node_id,
4318
4332
  sessionId: args.session_id,
4319
- ...sessionWasIdle ? {
4320
- dispatchAcknowledgementRisk: true,
4321
- dispatchAcknowledgementRiskReason: "session_was_idle_at_dispatch",
4322
- dispatchAcknowledgementNote: `Session '${args.session_id}' was idle at dispatch time. If it does not transition to generating, this direct task was not acknowledged. Use mesh_status to verify; if the session remains idle, it may appear as stale direct work \u2014 launch a fresh session and retry.`
4323
- } : {}
4333
+ // DISPATCH-ACK-RISK-STALE: only warn on a GENUINE residual loss risk — an idle
4334
+ // session whose dispatch row did NOT survive pre-record. A successfully
4335
+ // pre-recorded idle dispatch (the NOTIF-DROP / CANON-A path) is not at risk.
4336
+ ...computeIdleDispatchAckRisk(sessionWasIdle, dispatchPreRecorded, args.session_id)
4324
4337
  });
4325
4338
  }
4326
4339
  const task = (0, import_daemon_core3.enqueueTask)(ctx.mesh.id, args.message, {