@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.js CHANGED
@@ -1887,6 +1887,7 @@ function buildRulesSection(coordinatorCliType) {
1887
1887
  - **Refinery is config-driven.** \`mesh_refine_node\` must run validation from \`.adhdev/refine.{json,yaml,yml}\` or \`repo-mesh.refine.*\`. Heuristics are scaffolding only.
1888
1888
  - **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\`.
1889
1889
  - **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.
1890
+ - **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\`.
1890
1891
  - **Never fabricate tool results.** Always call the actual tool.
1891
1892
  - **Keep the user informed.** One or two sentences after each delegation round.${coordinatorNote}`;
1892
1893
  }
@@ -6694,6 +6695,13 @@ function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType)
6694
6695
  return true;
6695
6696
  }
6696
6697
  }
6698
+ try {
6699
+ const inst = components.instanceManager.getInstance(sessionId);
6700
+ if (inst && typeof inst.updateSettings === "function") {
6701
+ inst.updateSettings({ meshNodeFor: meshId, meshNodeId: nodeId, launchedByCoordinator: true });
6702
+ }
6703
+ } catch {
6704
+ }
6697
6705
  const delivery = createSessionDelivery({
6698
6706
  meshId,
6699
6707
  nodeId,
@@ -7693,7 +7701,9 @@ var init_mesh_events_coordinator = __esm({
7693
7701
  "monitor:long_generating",
7694
7702
  "refine:accepted",
7695
7703
  "refine:completed",
7696
- "refine:failed"
7704
+ "refine:failed",
7705
+ "worktree_bootstrap_complete",
7706
+ "worktree_bootstrap_failed"
7697
7707
  ]);
7698
7708
  EVENT_TO_LEDGER_KIND = {
7699
7709
  "agent:generating_completed": "task_completed",
@@ -30597,7 +30607,8 @@ var CliProviderInstance = class {
30597
30607
  typeof adapterStatus?.providerSessionId === "string" ? adapterStatus.providerSessionId : ""
30598
30608
  );
30599
30609
  const autoApproveActive = this.maybeAutoApproveStatus(adapterStatus, Date.now());
30600
- let visibleStatus = parseErrorMessage || parsedStatus?.status === "error" ? "error" : autoApproveActive ? "generating" : adapterStatus.status;
30610
+ const autoApproveHoldIdle = this.autoApproveBusy && adapterStatus.status === "idle";
30611
+ let visibleStatus = parseErrorMessage || parsedStatus?.status === "error" ? "error" : autoApproveActive || autoApproveHoldIdle ? "generating" : adapterStatus.status;
30601
30612
  const externalNativeFinal = this.getExternalNativeFinalReconciliation(parsedStatus?.messages, adapterStatus);
30602
30613
  if (externalNativeFinal && isCliGeneratingLikeStatus(visibleStatus)) {
30603
30614
  visibleStatus = "idle";
@@ -30684,7 +30695,7 @@ var CliProviderInstance = class {
30684
30695
  summaryMetadata: this.summaryMetadata,
30685
30696
  controlValues: this.controlValues
30686
30697
  });
30687
- const activeChatStatus = parseErrorMessage ? "error" : autoApproveActive && parsedStatus?.status === "waiting_approval" ? "generating" : adapterStatus.status !== "idle" ? visibleStatus : suppressStaleParsedBusyStatus ? visibleStatus : parsedChatStatus || visibleStatus;
30698
+ const activeChatStatus = parseErrorMessage ? "error" : autoApproveActive && parsedStatus?.status === "waiting_approval" || autoApproveHoldIdle ? "generating" : adapterStatus.status !== "idle" ? visibleStatus : suppressStaleParsedBusyStatus ? visibleStatus : parsedChatStatus || visibleStatus;
30688
30699
  const hasInteractivePrompt = !!this.activeInteractivePrompt;
30689
30700
  const finalStatus = hasInteractivePrompt ? "waiting_choice" : visibleStatus;
30690
30701
  const finalChatStatus = hasInteractivePrompt ? "waiting_choice" : activeChatStatus;
@@ -30699,7 +30710,7 @@ var CliProviderInstance = class {
30699
30710
  title: parsedStatus?.title || dirName,
30700
30711
  status: finalChatStatus,
30701
30712
  messages: statusMessages,
30702
- activeModal: autoApproveActive ? null : parsedStatus?.activeModal ?? adapterStatus.activeModal,
30713
+ activeModal: autoApproveActive || autoApproveHoldIdle ? null : parsedStatus?.activeModal ?? adapterStatus.activeModal,
30703
30714
  activeInteractivePrompt: this.activeInteractivePrompt,
30704
30715
  inputContent: ""
30705
30716
  },
@@ -30741,7 +30752,8 @@ var CliProviderInstance = class {
30741
30752
  getHotChatSessionState() {
30742
30753
  const adapterStatus = this.adapter.getStatus({ allowParse: false });
30743
30754
  const autoApproveActive = adapterStatus.status === "waiting_approval" && this.shouldAutoApprove();
30744
- const visibleStatus = autoApproveActive ? "generating" : adapterStatus.status;
30755
+ const autoApproveHoldIdle = this.autoApproveBusy && adapterStatus.status === "idle";
30756
+ const visibleStatus = autoApproveActive || autoApproveHoldIdle ? "generating" : adapterStatus.status;
30745
30757
  const runtime = this.adapter.getRuntimeMetadata();
30746
30758
  return {
30747
30759
  id: this.instanceId,
@@ -30755,7 +30767,8 @@ var CliProviderInstance = class {
30755
30767
  getSessionModalState(sessionId) {
30756
30768
  const adapterStatus = this.adapter.getStatus({ allowParse: true });
30757
30769
  const autoApproveActive = adapterStatus.status === "waiting_approval" && this.shouldAutoApprove();
30758
- const visibleStatus = autoApproveActive ? "generating" : adapterStatus.status;
30770
+ const autoApproveHoldIdle = this.autoApproveBusy && adapterStatus.status === "idle";
30771
+ const visibleStatus = autoApproveActive || autoApproveHoldIdle ? "generating" : adapterStatus.status;
30759
30772
  const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
30760
30773
  return {
30761
30774
  // Honor the caller-supplied sessionId — InstanceMgr rejects the
@@ -30765,7 +30778,7 @@ var CliProviderInstance = class {
30765
30778
  id: sessionId ?? this.instanceId,
30766
30779
  status: visibleStatus,
30767
30780
  title: dirName,
30768
- activeModal: autoApproveActive ? null : adapterStatus.activeModal
30781
+ activeModal: autoApproveActive || autoApproveHoldIdle ? null : adapterStatus.activeModal
30769
30782
  };
30770
30783
  }
30771
30784
  updateSettings(newSettings) {
@@ -31341,7 +31354,8 @@ var CliProviderInstance = class {
31341
31354
  const rawStatus = adapterStatus.status;
31342
31355
  const autoApproveActive = this.maybeAutoApproveStatus(adapterStatus, now);
31343
31356
  const externalNativeFinal = this.getExternalNativeFinalReconciliation(void 0, adapterStatus);
31344
- const newStatus = externalNativeFinal && isCliGeneratingLikeStatus(rawStatus) ? "idle" : autoApproveActive ? "generating" : rawStatus;
31357
+ const autoApproveHoldIdle = this.autoApproveBusy && rawStatus === "idle";
31358
+ const newStatus = externalNativeFinal && isCliGeneratingLikeStatus(rawStatus) ? "idle" : autoApproveActive || autoApproveHoldIdle ? "generating" : rawStatus;
31345
31359
  const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
31346
31360
  const chatTitle = `${this.provider.name} \xB7 ${dirName}`;
31347
31361
  const partial = this.adapter.getPartialResponse();
@@ -44031,26 +44045,34 @@ ${tail}` : ""
44031
44045
  const emitBootstrapEvent = (eventStatus2, bootstrapState2, startedAtMs, extraPayload) => {
44032
44046
  try {
44033
44047
  const durationMs = Date.now() - startedAtMs;
44034
- const eventPayload = {
44035
- event: `worktree_${eventStatus2}`,
44048
+ const event = `worktree_${eventStatus2}`;
44049
+ const metadataEvent = {
44050
+ source: "clone_mesh_node_bootstrap",
44051
+ nodeId: node.id,
44052
+ status: eventStatus2,
44053
+ worktreePath: result.worktreePath,
44054
+ durationMs,
44055
+ bootstrapStatus: bootstrapState2.status,
44056
+ ...bootstrapState2.error ? { error: bootstrapState2.error } : {},
44057
+ ...bootstrapState2.exitCode !== void 0 ? { exitCode: bootstrapState2.exitCode } : {},
44058
+ ...extraPayload || {}
44059
+ };
44060
+ if (typeof this.deps.instanceManager?.getByCategory === "function") {
44061
+ const forwarded = handleMeshForwardEvent(
44062
+ { instanceManager: this.deps.instanceManager },
44063
+ { event, meshId, nodeId: node.id, workspace: result.worktreePath, metadataEvent }
44064
+ );
44065
+ if (forwarded?.success === true) return;
44066
+ }
44067
+ queuePendingMeshCoordinatorEvent({
44068
+ event,
44036
44069
  meshId,
44037
44070
  nodeLabel: node.id,
44038
44071
  nodeId: node.id,
44039
44072
  workspace: result.worktreePath,
44040
- metadataEvent: {
44041
- source: "clone_mesh_node_bootstrap",
44042
- nodeId: node.id,
44043
- status: eventStatus2,
44044
- worktreePath: result.worktreePath,
44045
- durationMs,
44046
- bootstrapStatus: bootstrapState2.status,
44047
- ...bootstrapState2.error ? { error: bootstrapState2.error } : {},
44048
- ...bootstrapState2.exitCode !== void 0 ? { exitCode: bootstrapState2.exitCode } : {},
44049
- ...extraPayload || {}
44050
- },
44073
+ metadataEvent,
44051
44074
  queuedAt: Date.now()
44052
- };
44053
- queuePendingMeshCoordinatorEvent(eventPayload);
44075
+ });
44054
44076
  } catch {
44055
44077
  }
44056
44078
  };