@adhdev/daemon-core 0.9.82-rc.225 → 0.9.82-rc.227

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,
@@ -30267,7 +30275,8 @@ var CliProviderInstance = class {
30267
30275
  typeof adapterStatus?.providerSessionId === "string" ? adapterStatus.providerSessionId : ""
30268
30276
  );
30269
30277
  const autoApproveActive = this.maybeAutoApproveStatus(adapterStatus, Date.now());
30270
- 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;
30271
30280
  const externalNativeFinal = this.getExternalNativeFinalReconciliation(parsedStatus?.messages, adapterStatus);
30272
30281
  if (externalNativeFinal && isCliGeneratingLikeStatus(visibleStatus)) {
30273
30282
  visibleStatus = "idle";
@@ -30354,7 +30363,7 @@ var CliProviderInstance = class {
30354
30363
  summaryMetadata: this.summaryMetadata,
30355
30364
  controlValues: this.controlValues
30356
30365
  });
30357
- 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;
30358
30367
  const hasInteractivePrompt = !!this.activeInteractivePrompt;
30359
30368
  const finalStatus = hasInteractivePrompt ? "waiting_choice" : visibleStatus;
30360
30369
  const finalChatStatus = hasInteractivePrompt ? "waiting_choice" : activeChatStatus;
@@ -30369,7 +30378,7 @@ var CliProviderInstance = class {
30369
30378
  title: parsedStatus?.title || dirName,
30370
30379
  status: finalChatStatus,
30371
30380
  messages: statusMessages,
30372
- activeModal: autoApproveActive ? null : parsedStatus?.activeModal ?? adapterStatus.activeModal,
30381
+ activeModal: autoApproveActive || autoApproveHoldIdle ? null : parsedStatus?.activeModal ?? adapterStatus.activeModal,
30373
30382
  activeInteractivePrompt: this.activeInteractivePrompt,
30374
30383
  inputContent: ""
30375
30384
  },
@@ -30411,7 +30420,8 @@ var CliProviderInstance = class {
30411
30420
  getHotChatSessionState() {
30412
30421
  const adapterStatus = this.adapter.getStatus({ allowParse: false });
30413
30422
  const autoApproveActive = adapterStatus.status === "waiting_approval" && this.shouldAutoApprove();
30414
- const visibleStatus = autoApproveActive ? "generating" : adapterStatus.status;
30423
+ const autoApproveHoldIdle = this.autoApproveBusy && adapterStatus.status === "idle";
30424
+ const visibleStatus = autoApproveActive || autoApproveHoldIdle ? "generating" : adapterStatus.status;
30415
30425
  const runtime = this.adapter.getRuntimeMetadata();
30416
30426
  return {
30417
30427
  id: this.instanceId,
@@ -30425,7 +30435,8 @@ var CliProviderInstance = class {
30425
30435
  getSessionModalState(sessionId) {
30426
30436
  const adapterStatus = this.adapter.getStatus({ allowParse: true });
30427
30437
  const autoApproveActive = adapterStatus.status === "waiting_approval" && this.shouldAutoApprove();
30428
- const visibleStatus = autoApproveActive ? "generating" : adapterStatus.status;
30438
+ const autoApproveHoldIdle = this.autoApproveBusy && adapterStatus.status === "idle";
30439
+ const visibleStatus = autoApproveActive || autoApproveHoldIdle ? "generating" : adapterStatus.status;
30429
30440
  const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
30430
30441
  return {
30431
30442
  // Honor the caller-supplied sessionId — InstanceMgr rejects the
@@ -30435,7 +30446,7 @@ var CliProviderInstance = class {
30435
30446
  id: sessionId ?? this.instanceId,
30436
30447
  status: visibleStatus,
30437
30448
  title: dirName,
30438
- activeModal: autoApproveActive ? null : adapterStatus.activeModal
30449
+ activeModal: autoApproveActive || autoApproveHoldIdle ? null : adapterStatus.activeModal
30439
30450
  };
30440
30451
  }
30441
30452
  updateSettings(newSettings) {
@@ -30893,7 +30904,7 @@ var CliProviderInstance = class {
30893
30904
  const latestStatus = this.adapter.getStatus({ allowParse: false });
30894
30905
  const latestAutoApproveActive = latestStatus.status === "waiting_approval" && this.shouldAutoApprove();
30895
30906
  const externalNativeFinal = this.getExternalNativeFinalReconciliation(void 0, latestStatus);
30896
- const latestVisibleStatus = externalNativeFinal && isCliGeneratingLikeStatus(latestStatus.status) ? "idle" : latestAutoApproveActive ? "generating" : latestStatus.status;
30907
+ const latestVisibleStatus = externalNativeFinal && isCliGeneratingLikeStatus(latestStatus.status) ? "idle" : latestAutoApproveActive || this.autoApproveBusy ? "generating" : latestStatus.status;
30897
30908
  LOG.debug("CLI", `[${this.type}] flush attempt: adapterStatus=${latestStatus.status} latestVisible=${latestVisibleStatus} externalNativeFinal=${!!externalNativeFinal} generatingStartedAt=${this.generatingStartedAt} isWaitingForResponse=${!!this.adapter?.isWaitingForResponse} hasPartial=${!!this.adapter.getPartialResponse?.()}`);
30898
30909
  if (latestVisibleStatus !== "idle") {
30899
30910
  LOG.info("CLI", `[${this.type}] cancelled pending completed (resumed ${latestVisibleStatus})`);
@@ -30989,7 +31000,7 @@ var CliProviderInstance = class {
30989
31000
  this.autoApproveBusy = false;
30990
31001
  this.autoApproveBusyTimer = null;
30991
31002
  this.lastAutoApprovalSignature = "";
30992
- }, 2e3);
31003
+ }, 5e3);
30993
31004
  this.recordAutoApproval(modal?.message, buttonLabel, now);
30994
31005
  setTimeout(() => {
30995
31006
  this.adapter.resolveModal(buttonIndex);
@@ -33370,6 +33381,7 @@ var DaemonCliManager = class {
33370
33381
  transport: "pty",
33371
33382
  adapterKey: key,
33372
33383
  instanceKey: key,
33384
+ workspace: resolvedDir,
33373
33385
  // attachExisting === true means we're restoring an already-spawned
33374
33386
  // hosted runtime after a daemon restart, not starting a fresh PTY.
33375
33387
  // The real spawn time is in the past and we don't have it on the
@@ -33433,7 +33445,8 @@ ${installInfo}`
33433
33445
  providerType: normalizedType,
33434
33446
  transport: "acp",
33435
33447
  adapterKey: key,
33436
- instanceKey: key
33448
+ instanceKey: key,
33449
+ workspace: resolvedDir
33437
33450
  });
33438
33451
  this.adapters.set(key, {
33439
33452
  cliType: normalizedType,