@adhdev/daemon-standalone 0.9.82-rc.401 → 0.9.82-rc.403

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
@@ -30127,10 +30127,10 @@ var require_dist3 = __commonJS({
30127
30127
  }
30128
30128
  function getDaemonBuildInfo() {
30129
30129
  if (cached2) return cached2;
30130
- const commit = readInjected(true ? "c31eb449e8febc28e378bd25394830a96a67594e" : void 0) ?? "unknown";
30131
- const commitShort = readInjected(true ? "c31eb449" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30132
- const version2 = readInjected(true ? "0.9.82-rc.401" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30133
- const builtAt = readInjected(true ? "2026-06-27T16:15:03.175Z" : void 0);
30130
+ const commit = readInjected(true ? "9522954406c86758c979231d4f96b280d09efd7a" : void 0) ?? "unknown";
30131
+ const commitShort = readInjected(true ? "95229544" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30132
+ const version2 = readInjected(true ? "0.9.82-rc.403" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30133
+ const builtAt = readInjected(true ? "2026-06-27T17:54:31.546Z" : void 0);
30134
30134
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
30135
30135
  return cached2;
30136
30136
  }
@@ -34263,6 +34263,177 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
34263
34263
  ledgerImportDone = /* @__PURE__ */ new Set();
34264
34264
  }
34265
34265
  });
34266
+ function resolveDeliveryDecision(sessionStatus, opts) {
34267
+ const status = (sessionStatus || "").trim().toLowerCase();
34268
+ if (!status) {
34269
+ return {
34270
+ decision: "rejected",
34271
+ reason: "unknown_session_status",
34272
+ message: "Session status is unknown. Delivery rejected (fail-closed). Use mesh_launch_session to start a fresh session."
34273
+ };
34274
+ }
34275
+ if (IMMEDIATE_DELIVERY_STATUSES.has(status)) {
34276
+ return {
34277
+ decision: "immediate",
34278
+ reason: `session_${status}`,
34279
+ message: `Session is ${status} \u2014 delivery allowed immediately.`
34280
+ };
34281
+ }
34282
+ if (BUSY_DELIVERY_STATUSES.has(status)) {
34283
+ if (opts?.allowBusyInjection) {
34284
+ return {
34285
+ decision: "immediate",
34286
+ reason: `session_${status}_busy_injection_allowed`,
34287
+ message: `Session is ${status} but provider supports busy injection. Delivered immediately.`
34288
+ };
34289
+ }
34290
+ if (status === "waiting_approval" && opts?.kind === "approval") {
34291
+ return {
34292
+ decision: "immediate",
34293
+ reason: "session_waiting_approval_approval_message",
34294
+ message: "Session is waiting for approval \u2014 approval message delivered immediately."
34295
+ };
34296
+ }
34297
+ return {
34298
+ decision: "queued",
34299
+ reason: `session_${status}_busy`,
34300
+ message: `Session is ${status}. Task queued for delivery when session becomes idle. Do not inject directly into a busy session.`
34301
+ };
34302
+ }
34303
+ if (TERMINAL_DELIVERY_STATUSES.has(status)) {
34304
+ return {
34305
+ decision: "rejected",
34306
+ reason: `session_${status}_terminal`,
34307
+ message: `Session is ${status} (terminal). Delivery rejected. Launch a new session before dispatching tasks.`
34308
+ };
34309
+ }
34310
+ return {
34311
+ decision: "rejected",
34312
+ reason: "unrecognized_session_status",
34313
+ message: `Session status '${sessionStatus}' is not recognized. Delivery rejected (fail-closed). Inspect session state before retrying.`
34314
+ };
34315
+ }
34316
+ function createSessionDelivery(opts) {
34317
+ const now = (/* @__PURE__ */ new Date()).toISOString();
34318
+ const id = (0, import_crypto5.randomUUID)();
34319
+ const record2 = {
34320
+ id,
34321
+ meshId: opts.meshId,
34322
+ nodeId: opts.nodeId,
34323
+ sessionId: opts.sessionId,
34324
+ providerType: opts.providerType,
34325
+ taskId: opts.taskId,
34326
+ kind: opts.kind,
34327
+ priority: opts.priority ?? 0,
34328
+ message: opts.message,
34329
+ status: opts.status,
34330
+ deliverAfter: opts.deliverAfter,
34331
+ expiresAt: opts.expiresAt,
34332
+ attemptCount: 0,
34333
+ sourceCoordinatorSessionId: opts.sourceCoordinatorSessionId,
34334
+ sourceCoordinatorDaemonId: opts.sourceCoordinatorDaemonId,
34335
+ createdAt: now,
34336
+ updatedAt: now
34337
+ };
34338
+ MeshRuntimeStore.getInstance().insertSessionDelivery({
34339
+ id,
34340
+ meshId: opts.meshId,
34341
+ nodeId: opts.nodeId,
34342
+ sessionId: opts.sessionId,
34343
+ providerType: opts.providerType,
34344
+ taskId: opts.taskId,
34345
+ kind: opts.kind,
34346
+ priority: opts.priority ?? 0,
34347
+ message: opts.message,
34348
+ status: opts.status,
34349
+ deliverAfter: opts.deliverAfter,
34350
+ expiresAt: opts.expiresAt,
34351
+ sourceCoordinatorSessionId: opts.sourceCoordinatorSessionId,
34352
+ sourceCoordinatorDaemonId: opts.sourceCoordinatorDaemonId,
34353
+ createdAt: now,
34354
+ updatedAt: now
34355
+ });
34356
+ return record2;
34357
+ }
34358
+ function updateSessionDeliveryStatus(id, status, opts) {
34359
+ try {
34360
+ MeshRuntimeStore.getInstance().updateSessionDeliveryStatus(id, status, opts);
34361
+ } catch {
34362
+ }
34363
+ }
34364
+ function getActiveSessionDeliveries(meshId, sessionId) {
34365
+ try {
34366
+ return MeshRuntimeStore.getInstance().getActiveSessionDeliveries(meshId, sessionId);
34367
+ } catch {
34368
+ return [];
34369
+ }
34370
+ }
34371
+ function recordCompletionConflict(opts) {
34372
+ try {
34373
+ MeshRuntimeStore.getInstance().recordCompletionConflict({
34374
+ id: (0, import_crypto5.randomUUID)(),
34375
+ meshId: opts.meshId,
34376
+ fingerprint: opts.fingerprint,
34377
+ conflictingTaskId: opts.conflictingTaskId,
34378
+ conflictingSessionId: opts.conflictingSessionId,
34379
+ originalTaskId: opts.originalTaskId,
34380
+ originalSessionId: opts.originalSessionId,
34381
+ event: opts.event,
34382
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
34383
+ });
34384
+ } catch {
34385
+ }
34386
+ }
34387
+ function getRecentCompletionConflicts(meshId, limitMs) {
34388
+ try {
34389
+ return MeshRuntimeStore.getInstance().getRecentCompletionConflicts(meshId, limitMs);
34390
+ } catch {
34391
+ return [];
34392
+ }
34393
+ }
34394
+ function markSessionDeliveriesTerminal(meshId, sessionId, terminalStatus) {
34395
+ try {
34396
+ const active = MeshRuntimeStore.getInstance().getActiveSessionDeliveries(meshId, sessionId);
34397
+ for (const delivery of active) {
34398
+ MeshRuntimeStore.getInstance().updateSessionDeliveryStatus(delivery.id, terminalStatus);
34399
+ }
34400
+ } catch {
34401
+ }
34402
+ }
34403
+ var import_crypto5;
34404
+ var IMMEDIATE_DELIVERY_STATUSES;
34405
+ var BUSY_DELIVERY_STATUSES;
34406
+ var TERMINAL_DELIVERY_STATUSES;
34407
+ var init_mesh_delivery_policy = __esm2({
34408
+ "src/mesh/mesh-delivery-policy.ts"() {
34409
+ "use strict";
34410
+ import_crypto5 = require("crypto");
34411
+ init_mesh_runtime_store();
34412
+ IMMEDIATE_DELIVERY_STATUSES = /* @__PURE__ */ new Set([
34413
+ "idle",
34414
+ "waiting_input",
34415
+ "ready"
34416
+ ]);
34417
+ BUSY_DELIVERY_STATUSES = /* @__PURE__ */ new Set([
34418
+ "generating",
34419
+ "running",
34420
+ "streaming",
34421
+ "busy",
34422
+ "starting",
34423
+ "initializing",
34424
+ "waiting_approval"
34425
+ ]);
34426
+ TERMINAL_DELIVERY_STATUSES = /* @__PURE__ */ new Set([
34427
+ "stopped",
34428
+ "failed",
34429
+ "terminated",
34430
+ "exited",
34431
+ "closed",
34432
+ "deleted",
34433
+ "error"
34434
+ ]);
34435
+ }
34436
+ });
34266
34437
  var mesh_work_queue_exports = {};
34267
34438
  __export2(mesh_work_queue_exports, {
34268
34439
  ACTIVE_MESH_QUEUE_STATUSES: () => ACTIVE_MESH_QUEUE_STATUSES,
@@ -34623,7 +34794,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
34623
34794
  if (!modeValidation.valid) {
34624
34795
  throw new Error(`live_debug_readonly_guardrail_violation: forbidden operations (${modeValidation.violations.join(", ")})`);
34625
34796
  }
34626
- const id = typeof opts?.id === "string" && opts.id.trim() ? opts.id.trim() : (0, import_crypto5.randomUUID)();
34797
+ const id = typeof opts?.id === "string" && opts.id.trim() ? opts.id.trim() : (0, import_crypto6.randomUUID)();
34627
34798
  const dependsOn = normalizeDependsOn(opts?.dependsOn);
34628
34799
  return withQueueLock(meshId, () => {
34629
34800
  if (MeshRuntimeStore.getInstance().findQueueEntryById(meshId, id)) {
@@ -34684,6 +34855,18 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
34684
34855
  updatedAt: now
34685
34856
  };
34686
34857
  MeshRuntimeStore.getInstance().insertQueueEntry(entry);
34858
+ try {
34859
+ createSessionDelivery({
34860
+ meshId,
34861
+ ...opts.assignedNodeId ? { nodeId: opts.assignedNodeId } : {},
34862
+ ...opts.assignedSessionId ? { sessionId: opts.assignedSessionId } : {},
34863
+ taskId,
34864
+ kind: "task",
34865
+ message,
34866
+ status: "delivered"
34867
+ });
34868
+ } catch {
34869
+ }
34687
34870
  return entry;
34688
34871
  });
34689
34872
  }
@@ -34957,7 +35140,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
34957
35140
  return { rateLimitExceeded: false, callsInWindow: 0, advisory: null };
34958
35141
  }
34959
35142
  }
34960
- var import_crypto5;
35143
+ var import_crypto6;
34961
35144
  var ACTIVE_MESH_QUEUE_STATUSES;
34962
35145
  var HISTORICAL_MESH_QUEUE_STATUSES;
34963
35146
  var MESH_TASK_MODES;
@@ -34971,13 +35154,14 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
34971
35154
  var init_mesh_work_queue = __esm2({
34972
35155
  "src/mesh/mesh-work-queue.ts"() {
34973
35156
  "use strict";
34974
- import_crypto5 = require("crypto");
35157
+ import_crypto6 = require("crypto");
34975
35158
  init_mesh_host_ownership();
34976
35159
  init_repo_mesh_types();
34977
35160
  init_mesh_runtime_store();
34978
35161
  init_mesh_config();
34979
35162
  init_logger();
34980
35163
  init_mesh_ledger();
35164
+ init_mesh_delivery_policy();
34981
35165
  ACTIVE_MESH_QUEUE_STATUSES = ["pending", "assigned"];
34982
35166
  HISTORICAL_MESH_QUEUE_STATUSES = ["completed", "failed", "cancelled"];
34983
35167
  MESH_TASK_MODES = ["code_change", "validation", "live_debug_readonly", "launch_app", "convergence"];
@@ -36629,7 +36813,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
36629
36813
  if (input.status !== void 0 && !MESH_MISSION_STATUSES.includes(input.status)) {
36630
36814
  throw new Error(`invalid_mission_status: '${input.status}' (valid: ${MESH_MISSION_STATUSES.join(", ")})`);
36631
36815
  }
36632
- const id = typeof input.id === "string" && input.id.trim() ? input.id.trim() : (0, import_crypto6.randomUUID)();
36816
+ const id = typeof input.id === "string" && input.id.trim() ? input.id.trim() : (0, import_crypto7.randomUUID)();
36633
36817
  const store = MeshRuntimeStore.getInstance();
36634
36818
  const existing = store.getMission(meshId, id);
36635
36819
  const record2 = {
@@ -36745,14 +36929,14 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
36745
36929
  );
36746
36930
  return lines.join("\n");
36747
36931
  }
36748
- var import_crypto6;
36932
+ var import_crypto7;
36749
36933
  var MESH_MISSION_STATUSES;
36750
36934
  var GOAL_PREVIEW_MAX;
36751
36935
  var COMPACT_STATUS_GOAL_PREVIEW_MAX;
36752
36936
  var init_mesh_missions = __esm2({
36753
36937
  "src/mesh/mesh-missions.ts"() {
36754
36938
  "use strict";
36755
- import_crypto6 = require("crypto");
36939
+ import_crypto7 = require("crypto");
36756
36940
  init_mesh_runtime_store();
36757
36941
  init_mesh_work_queue();
36758
36942
  init_mesh_task_stats();
@@ -39834,7 +40018,7 @@ Next step: ${nextStep}`;
39834
40018
  let sqliteOk = false;
39835
40019
  try {
39836
40020
  MeshRuntimeStore.getInstance().insertPendingEvent({
39837
- id: (0, import_crypto7.randomUUID)(),
40021
+ id: (0, import_crypto8.randomUUID)(),
39838
40022
  meshId: event.meshId,
39839
40023
  coordinatorDaemonId: event.targetCoordinatorDaemonId ?? null,
39840
40024
  event: event.event,
@@ -40024,7 +40208,7 @@ Next step: ${nextStep}`;
40024
40208
  }
40025
40209
  var import_fs10;
40026
40210
  var import_path9;
40027
- var import_crypto7;
40211
+ var import_crypto8;
40028
40212
  var REFINE_TERMINAL_EVENTS;
40029
40213
  var TERMINAL_COMPLETION_EVENTS;
40030
40214
  var MAX_PENDING_EVENTS_BYTES;
@@ -40034,7 +40218,7 @@ Next step: ${nextStep}`;
40034
40218
  "use strict";
40035
40219
  import_fs10 = require("fs");
40036
40220
  import_path9 = require("path");
40037
- import_crypto7 = require("crypto");
40221
+ import_crypto8 = require("crypto");
40038
40222
  init_logger();
40039
40223
  init_mesh_ledger();
40040
40224
  init_mesh_runtime_store();
@@ -40046,177 +40230,6 @@ Next step: ${nextStep}`;
40046
40230
  MAX_PENDING_EVENTS_KEEP = 50;
40047
40231
  }
40048
40232
  });
40049
- function resolveDeliveryDecision(sessionStatus, opts) {
40050
- const status = (sessionStatus || "").trim().toLowerCase();
40051
- if (!status) {
40052
- return {
40053
- decision: "rejected",
40054
- reason: "unknown_session_status",
40055
- message: "Session status is unknown. Delivery rejected (fail-closed). Use mesh_launch_session to start a fresh session."
40056
- };
40057
- }
40058
- if (IMMEDIATE_DELIVERY_STATUSES.has(status)) {
40059
- return {
40060
- decision: "immediate",
40061
- reason: `session_${status}`,
40062
- message: `Session is ${status} \u2014 delivery allowed immediately.`
40063
- };
40064
- }
40065
- if (BUSY_DELIVERY_STATUSES.has(status)) {
40066
- if (opts?.allowBusyInjection) {
40067
- return {
40068
- decision: "immediate",
40069
- reason: `session_${status}_busy_injection_allowed`,
40070
- message: `Session is ${status} but provider supports busy injection. Delivered immediately.`
40071
- };
40072
- }
40073
- if (status === "waiting_approval" && opts?.kind === "approval") {
40074
- return {
40075
- decision: "immediate",
40076
- reason: "session_waiting_approval_approval_message",
40077
- message: "Session is waiting for approval \u2014 approval message delivered immediately."
40078
- };
40079
- }
40080
- return {
40081
- decision: "queued",
40082
- reason: `session_${status}_busy`,
40083
- message: `Session is ${status}. Task queued for delivery when session becomes idle. Do not inject directly into a busy session.`
40084
- };
40085
- }
40086
- if (TERMINAL_DELIVERY_STATUSES.has(status)) {
40087
- return {
40088
- decision: "rejected",
40089
- reason: `session_${status}_terminal`,
40090
- message: `Session is ${status} (terminal). Delivery rejected. Launch a new session before dispatching tasks.`
40091
- };
40092
- }
40093
- return {
40094
- decision: "rejected",
40095
- reason: "unrecognized_session_status",
40096
- message: `Session status '${sessionStatus}' is not recognized. Delivery rejected (fail-closed). Inspect session state before retrying.`
40097
- };
40098
- }
40099
- function createSessionDelivery(opts) {
40100
- const now = (/* @__PURE__ */ new Date()).toISOString();
40101
- const id = (0, import_crypto8.randomUUID)();
40102
- const record2 = {
40103
- id,
40104
- meshId: opts.meshId,
40105
- nodeId: opts.nodeId,
40106
- sessionId: opts.sessionId,
40107
- providerType: opts.providerType,
40108
- taskId: opts.taskId,
40109
- kind: opts.kind,
40110
- priority: opts.priority ?? 0,
40111
- message: opts.message,
40112
- status: opts.status,
40113
- deliverAfter: opts.deliverAfter,
40114
- expiresAt: opts.expiresAt,
40115
- attemptCount: 0,
40116
- sourceCoordinatorSessionId: opts.sourceCoordinatorSessionId,
40117
- sourceCoordinatorDaemonId: opts.sourceCoordinatorDaemonId,
40118
- createdAt: now,
40119
- updatedAt: now
40120
- };
40121
- MeshRuntimeStore.getInstance().insertSessionDelivery({
40122
- id,
40123
- meshId: opts.meshId,
40124
- nodeId: opts.nodeId,
40125
- sessionId: opts.sessionId,
40126
- providerType: opts.providerType,
40127
- taskId: opts.taskId,
40128
- kind: opts.kind,
40129
- priority: opts.priority ?? 0,
40130
- message: opts.message,
40131
- status: opts.status,
40132
- deliverAfter: opts.deliverAfter,
40133
- expiresAt: opts.expiresAt,
40134
- sourceCoordinatorSessionId: opts.sourceCoordinatorSessionId,
40135
- sourceCoordinatorDaemonId: opts.sourceCoordinatorDaemonId,
40136
- createdAt: now,
40137
- updatedAt: now
40138
- });
40139
- return record2;
40140
- }
40141
- function updateSessionDeliveryStatus(id, status, opts) {
40142
- try {
40143
- MeshRuntimeStore.getInstance().updateSessionDeliveryStatus(id, status, opts);
40144
- } catch {
40145
- }
40146
- }
40147
- function getActiveSessionDeliveries(meshId, sessionId) {
40148
- try {
40149
- return MeshRuntimeStore.getInstance().getActiveSessionDeliveries(meshId, sessionId);
40150
- } catch {
40151
- return [];
40152
- }
40153
- }
40154
- function recordCompletionConflict(opts) {
40155
- try {
40156
- MeshRuntimeStore.getInstance().recordCompletionConflict({
40157
- id: (0, import_crypto8.randomUUID)(),
40158
- meshId: opts.meshId,
40159
- fingerprint: opts.fingerprint,
40160
- conflictingTaskId: opts.conflictingTaskId,
40161
- conflictingSessionId: opts.conflictingSessionId,
40162
- originalTaskId: opts.originalTaskId,
40163
- originalSessionId: opts.originalSessionId,
40164
- event: opts.event,
40165
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
40166
- });
40167
- } catch {
40168
- }
40169
- }
40170
- function getRecentCompletionConflicts(meshId, limitMs) {
40171
- try {
40172
- return MeshRuntimeStore.getInstance().getRecentCompletionConflicts(meshId, limitMs);
40173
- } catch {
40174
- return [];
40175
- }
40176
- }
40177
- function markSessionDeliveriesTerminal(meshId, sessionId, terminalStatus) {
40178
- try {
40179
- const active = MeshRuntimeStore.getInstance().getActiveSessionDeliveries(meshId, sessionId);
40180
- for (const delivery of active) {
40181
- MeshRuntimeStore.getInstance().updateSessionDeliveryStatus(delivery.id, terminalStatus);
40182
- }
40183
- } catch {
40184
- }
40185
- }
40186
- var import_crypto8;
40187
- var IMMEDIATE_DELIVERY_STATUSES;
40188
- var BUSY_DELIVERY_STATUSES;
40189
- var TERMINAL_DELIVERY_STATUSES;
40190
- var init_mesh_delivery_policy = __esm2({
40191
- "src/mesh/mesh-delivery-policy.ts"() {
40192
- "use strict";
40193
- import_crypto8 = require("crypto");
40194
- init_mesh_runtime_store();
40195
- IMMEDIATE_DELIVERY_STATUSES = /* @__PURE__ */ new Set([
40196
- "idle",
40197
- "waiting_input",
40198
- "ready"
40199
- ]);
40200
- BUSY_DELIVERY_STATUSES = /* @__PURE__ */ new Set([
40201
- "generating",
40202
- "running",
40203
- "streaming",
40204
- "busy",
40205
- "starting",
40206
- "initializing",
40207
- "waiting_approval"
40208
- ]);
40209
- TERMINAL_DELIVERY_STATUSES = /* @__PURE__ */ new Set([
40210
- "stopped",
40211
- "failed",
40212
- "terminated",
40213
- "exited",
40214
- "closed",
40215
- "deleted",
40216
- "error"
40217
- ]);
40218
- }
40219
- });
40220
40233
  function findRecentTerminalLedgerEvidence(args) {
40221
40234
  if (!args.sessionId && !args.nodeId) return null;
40222
40235
  const entries = readLedgerEntries(args.meshId, { tail: 200 });
@@ -70872,6 +70885,42 @@ ${body}
70872
70885
  }
70873
70886
  } else if (newStatus === "idle" && this.lastStatus === "starting") {
70874
70887
  this.emitAgentReadyOnce(chatTitle, now);
70888
+ const startedTurnTaskId = typeof this.adapter?.currentTurnTaskId === "string" && this.adapter.currentTurnTaskId.trim() ? this.adapter.currentTurnTaskId : void 0;
70889
+ const fastCollapsed = !!startedTurnTaskId && !this.hasAdapterPendingResponse() && !this.generatingStartedAt && !this.generatingDebouncePending;
70890
+ if (fastCollapsed) {
70891
+ let fcFinalSummary;
70892
+ let fcEvidenceSource = "unavailable";
70893
+ try {
70894
+ const parsedMessages = this.adapter?.getScriptParsedStatus()?.messages;
70895
+ const evidence = this.completionFinalAssistantEvidence(parsedMessages);
70896
+ fcEvidenceSource = evidence.source;
70897
+ fcFinalSummary = extractFinalSummaryFromMessages(evidence.messages);
70898
+ } catch {
70899
+ }
70900
+ const missingEvidence = (this.provider.requiresFinalAssistantBeforeIdle === true || fcEvidenceSource === "external-native") && !fcFinalSummary;
70901
+ const hasMeshContext = !!(this.settings.meshNodeFor || this.settings.meshActiveTaskId || this.settings.launchedByCoordinator);
70902
+ if (missingEvidence && !hasMeshContext) {
70903
+ LOG2.info("CLI", `[${this.type}] startup-grace fast-collapse suppressed: missing final assistant evidence, no mesh context (source=${fcEvidenceSource})`);
70904
+ } else {
70905
+ LOG2.info("CLI", `[${this.type}] startup-grace fast-collapse: synthesizing started+completed (taskId=${startedTurnTaskId} source=${fcEvidenceSource} hadFinalSummary=${!!fcFinalSummary})`);
70906
+ this.pushEvent({ event: "agent:generating_started", chatTitle, timestamp: now });
70907
+ if (this.isMeshWorkerSession()) {
70908
+ traceMeshEventStage("fired", this.meshTraceCtx(), `startup-grace fast-collapse (source=${fcEvidenceSource})`);
70909
+ }
70910
+ this.pushEvent({
70911
+ event: "agent:generating_completed",
70912
+ chatTitle,
70913
+ duration: 0,
70914
+ timestamp: now,
70915
+ finalSummary: fcFinalSummary,
70916
+ completionDiagnostic: {
70917
+ reason: "startup_grace_fast_collapse",
70918
+ finalAssistantEvidenceSource: fcEvidenceSource,
70919
+ ...missingEvidence ? { blockReason: "missing_final_assistant" } : {}
70920
+ }
70921
+ });
70922
+ }
70923
+ }
70875
70924
  } else if (newStatus === "error") {
70876
70925
  if (this.generatingDebounceTimer) {
70877
70926
  clearTimeout(this.generatingDebounceTimer);