@adhdev/daemon-core 0.9.82-rc.224 → 0.9.82-rc.226

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.mjs CHANGED
@@ -1885,6 +1885,7 @@ function buildRulesSection(coordinatorCliType) {
1885
1885
  - **Refinery is config-driven.** \`mesh_refine_node\` must run validation from \`.adhdev/refine.{json,yaml,yml}\` or \`repo-mesh.refine.*\`. Heuristics are scaffolding only.
1886
1886
  - **Submodule reachability = publish-needed.** \`submodule_reachability_failed\` \u2192 classify as \`blocked_review\`, request user approval to push to submodule main, then rerun \`mesh_refine_node\`.
1887
1887
  - **Honor per-node instructions.** When a node carries a \u{1F4CC} Node instruction in the nodes section, include the relevant parts of that instruction in the task message you send to that node. Don't paraphrase the instruction into your own words \u2014 quote it verbatim so the worker agent sees exactly what the user wrote.
1888
+ - **Mission status does not update itself.** When a mission's tasks are all done or the work is abandoned, explicitly call \`mesh_mission_upsert\` to set status \`completed\` or \`abandoned\`. Never leave a finished mission in \`active\`. All-cancelled tasks with no further work \u2192 \`abandoned\`.
1888
1889
  - **Never fabricate tool results.** Always call the actual tool.
1889
1890
  - **Keep the user informed.** One or two sentences after each delegation round.${coordinatorNote}`;
1890
1891
  }
@@ -6688,6 +6689,13 @@ function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType)
6688
6689
  return true;
6689
6690
  }
6690
6691
  }
6692
+ try {
6693
+ const inst = components.instanceManager.getInstance(sessionId);
6694
+ if (inst && typeof inst.updateSettings === "function") {
6695
+ inst.updateSettings({ meshNodeFor: meshId, meshNodeId: nodeId, launchedByCoordinator: true });
6696
+ }
6697
+ } catch {
6698
+ }
6691
6699
  const delivery = createSessionDelivery({
6692
6700
  meshId,
6693
6701
  nodeId,
@@ -7686,7 +7694,9 @@ var init_mesh_events_coordinator = __esm({
7686
7694
  "monitor:long_generating",
7687
7695
  "refine:accepted",
7688
7696
  "refine:completed",
7689
- "refine:failed"
7697
+ "refine:failed",
7698
+ "worktree_bootstrap_complete",
7699
+ "worktree_bootstrap_failed"
7690
7700
  ]);
7691
7701
  EVENT_TO_LEDGER_KIND = {
7692
7702
  "agent:generating_completed": "task_completed",
@@ -30265,7 +30275,8 @@ var CliProviderInstance = class {
30265
30275
  typeof adapterStatus?.providerSessionId === "string" ? adapterStatus.providerSessionId : ""
30266
30276
  );
30267
30277
  const autoApproveActive = this.maybeAutoApproveStatus(adapterStatus, Date.now());
30268
- let visibleStatus = parseErrorMessage || parsedStatus?.status === "error" ? "error" : autoApproveActive ? "generating" : adapterStatus.status;
30278
+ const autoApproveHoldIdle = this.autoApproveBusy && adapterStatus.status === "idle";
30279
+ let visibleStatus = parseErrorMessage || parsedStatus?.status === "error" ? "error" : autoApproveActive || autoApproveHoldIdle ? "generating" : adapterStatus.status;
30269
30280
  const externalNativeFinal = this.getExternalNativeFinalReconciliation(parsedStatus?.messages, adapterStatus);
30270
30281
  if (externalNativeFinal && isCliGeneratingLikeStatus(visibleStatus)) {
30271
30282
  visibleStatus = "idle";
@@ -30352,7 +30363,7 @@ var CliProviderInstance = class {
30352
30363
  summaryMetadata: this.summaryMetadata,
30353
30364
  controlValues: this.controlValues
30354
30365
  });
30355
- const activeChatStatus = parseErrorMessage ? "error" : autoApproveActive && parsedStatus?.status === "waiting_approval" ? "generating" : adapterStatus.status !== "idle" ? visibleStatus : suppressStaleParsedBusyStatus ? visibleStatus : parsedChatStatus || visibleStatus;
30366
+ const activeChatStatus = parseErrorMessage ? "error" : autoApproveActive && parsedStatus?.status === "waiting_approval" || autoApproveHoldIdle ? "generating" : adapterStatus.status !== "idle" ? visibleStatus : suppressStaleParsedBusyStatus ? visibleStatus : parsedChatStatus || visibleStatus;
30356
30367
  const hasInteractivePrompt = !!this.activeInteractivePrompt;
30357
30368
  const finalStatus = hasInteractivePrompt ? "waiting_choice" : visibleStatus;
30358
30369
  const finalChatStatus = hasInteractivePrompt ? "waiting_choice" : activeChatStatus;
@@ -30367,7 +30378,7 @@ var CliProviderInstance = class {
30367
30378
  title: parsedStatus?.title || dirName,
30368
30379
  status: finalChatStatus,
30369
30380
  messages: statusMessages,
30370
- activeModal: autoApproveActive ? null : parsedStatus?.activeModal ?? adapterStatus.activeModal,
30381
+ activeModal: autoApproveActive || autoApproveHoldIdle ? null : parsedStatus?.activeModal ?? adapterStatus.activeModal,
30371
30382
  activeInteractivePrompt: this.activeInteractivePrompt,
30372
30383
  inputContent: ""
30373
30384
  },
@@ -30409,7 +30420,8 @@ var CliProviderInstance = class {
30409
30420
  getHotChatSessionState() {
30410
30421
  const adapterStatus = this.adapter.getStatus({ allowParse: false });
30411
30422
  const autoApproveActive = adapterStatus.status === "waiting_approval" && this.shouldAutoApprove();
30412
- const visibleStatus = autoApproveActive ? "generating" : adapterStatus.status;
30423
+ const autoApproveHoldIdle = this.autoApproveBusy && adapterStatus.status === "idle";
30424
+ const visibleStatus = autoApproveActive || autoApproveHoldIdle ? "generating" : adapterStatus.status;
30413
30425
  const runtime = this.adapter.getRuntimeMetadata();
30414
30426
  return {
30415
30427
  id: this.instanceId,
@@ -30423,7 +30435,8 @@ var CliProviderInstance = class {
30423
30435
  getSessionModalState(sessionId) {
30424
30436
  const adapterStatus = this.adapter.getStatus({ allowParse: true });
30425
30437
  const autoApproveActive = adapterStatus.status === "waiting_approval" && this.shouldAutoApprove();
30426
- const visibleStatus = autoApproveActive ? "generating" : adapterStatus.status;
30438
+ const autoApproveHoldIdle = this.autoApproveBusy && adapterStatus.status === "idle";
30439
+ const visibleStatus = autoApproveActive || autoApproveHoldIdle ? "generating" : adapterStatus.status;
30427
30440
  const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
30428
30441
  return {
30429
30442
  // Honor the caller-supplied sessionId — InstanceMgr rejects the
@@ -30433,7 +30446,7 @@ var CliProviderInstance = class {
30433
30446
  id: sessionId ?? this.instanceId,
30434
30447
  status: visibleStatus,
30435
30448
  title: dirName,
30436
- activeModal: autoApproveActive ? null : adapterStatus.activeModal
30449
+ activeModal: autoApproveActive || autoApproveHoldIdle ? null : adapterStatus.activeModal
30437
30450
  };
30438
30451
  }
30439
30452
  updateSettings(newSettings) {
@@ -31009,7 +31022,8 @@ var CliProviderInstance = class {
31009
31022
  const rawStatus = adapterStatus.status;
31010
31023
  const autoApproveActive = this.maybeAutoApproveStatus(adapterStatus, now);
31011
31024
  const externalNativeFinal = this.getExternalNativeFinalReconciliation(void 0, adapterStatus);
31012
- const newStatus = externalNativeFinal && isCliGeneratingLikeStatus(rawStatus) ? "idle" : autoApproveActive ? "generating" : rawStatus;
31025
+ const autoApproveHoldIdle = this.autoApproveBusy && rawStatus === "idle";
31026
+ const newStatus = externalNativeFinal && isCliGeneratingLikeStatus(rawStatus) ? "idle" : autoApproveActive || autoApproveHoldIdle ? "generating" : rawStatus;
31013
31027
  const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
31014
31028
  const chatTitle = `${this.provider.name} \xB7 ${dirName}`;
31015
31029
  const partial = this.adapter.getPartialResponse();
@@ -43704,26 +43718,34 @@ ${tail}` : ""
43704
43718
  const emitBootstrapEvent = (eventStatus2, bootstrapState2, startedAtMs, extraPayload) => {
43705
43719
  try {
43706
43720
  const durationMs = Date.now() - startedAtMs;
43707
- const eventPayload = {
43708
- event: `worktree_${eventStatus2}`,
43721
+ const event = `worktree_${eventStatus2}`;
43722
+ const metadataEvent = {
43723
+ source: "clone_mesh_node_bootstrap",
43724
+ nodeId: node.id,
43725
+ status: eventStatus2,
43726
+ worktreePath: result.worktreePath,
43727
+ durationMs,
43728
+ bootstrapStatus: bootstrapState2.status,
43729
+ ...bootstrapState2.error ? { error: bootstrapState2.error } : {},
43730
+ ...bootstrapState2.exitCode !== void 0 ? { exitCode: bootstrapState2.exitCode } : {},
43731
+ ...extraPayload || {}
43732
+ };
43733
+ if (typeof this.deps.instanceManager?.getByCategory === "function") {
43734
+ const forwarded = handleMeshForwardEvent(
43735
+ { instanceManager: this.deps.instanceManager },
43736
+ { event, meshId, nodeId: node.id, workspace: result.worktreePath, metadataEvent }
43737
+ );
43738
+ if (forwarded?.success === true) return;
43739
+ }
43740
+ queuePendingMeshCoordinatorEvent({
43741
+ event,
43709
43742
  meshId,
43710
43743
  nodeLabel: node.id,
43711
43744
  nodeId: node.id,
43712
43745
  workspace: result.worktreePath,
43713
- metadataEvent: {
43714
- source: "clone_mesh_node_bootstrap",
43715
- nodeId: node.id,
43716
- status: eventStatus2,
43717
- worktreePath: result.worktreePath,
43718
- durationMs,
43719
- bootstrapStatus: bootstrapState2.status,
43720
- ...bootstrapState2.error ? { error: bootstrapState2.error } : {},
43721
- ...bootstrapState2.exitCode !== void 0 ? { exitCode: bootstrapState2.exitCode } : {},
43722
- ...extraPayload || {}
43723
- },
43746
+ metadataEvent,
43724
43747
  queuedAt: Date.now()
43725
- };
43726
- queuePendingMeshCoordinatorEvent(eventPayload);
43748
+ });
43727
43749
  } catch {
43728
43750
  }
43729
43751
  };