@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.
@@ -7,6 +7,9 @@ export interface SessionRuntimeTarget {
7
7
  cdpManagerKey?: string;
8
8
  adapterKey?: string;
9
9
  instanceKey?: string;
10
+ /** Working directory for CLI/ACP sessions. Used by read_chat to resolve
11
+ * native history when there is no live adapter (e.g. subscription path). */
12
+ workspace?: string;
10
13
  /** Wall clock at register time. native-history readers use it as a
11
14
  * cutoff so a fresh session can't show records from a prior one. */
12
15
  spawnedAtMs?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/daemon-core",
3
- "version": "0.9.82-rc.225",
3
+ "version": "0.9.82-rc.227",
4
4
  "description": "ADHDev daemon core — CDP, IDE detection, providers, command execution",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -673,6 +673,7 @@ export class DaemonCliManager {
673
673
  transport: 'pty',
674
674
  adapterKey: key,
675
675
  instanceKey: key,
676
+ workspace: resolvedDir,
676
677
  // attachExisting === true means we're restoring an already-spawned
677
678
  // hosted runtime after a daemon restart, not starting a fresh PTY.
678
679
  // The real spawn time is in the past and we don't have it on the
@@ -757,6 +758,7 @@ export class DaemonCliManager {
757
758
  transport: 'acp',
758
759
  adapterKey: key,
759
760
  instanceKey: key,
761
+ workspace: resolvedDir,
760
762
  });
761
763
 
762
764
  // Register ACP entry in adapter map (getStatus queries from acpInstance in real-time)
@@ -388,6 +388,7 @@ function buildRulesSection(coordinatorCliType?: string): string {
388
388
  - **Refinery is config-driven.** \`mesh_refine_node\` must run validation from \`.adhdev/refine.{json,yaml,yml}\` or \`repo-mesh.refine.*\`. Heuristics are scaffolding only.
389
389
  - **Submodule reachability = publish-needed.** \`submodule_reachability_failed\` → classify as \`blocked_review\`, request user approval to push to submodule main, then rerun \`mesh_refine_node\`.
390
390
  - **Honor per-node instructions.** When a node carries a 📌 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 — quote it verbatim so the worker agent sees exactly what the user wrote.
391
+ - **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 → \`abandoned\`.
391
392
  - **Never fabricate tool results.** Always call the actual tool.
392
393
  - **Keep the user informed.** One or two sentences after each delegation round.${coordinatorNote}`;
393
394
  }
@@ -282,6 +282,17 @@ export function tryAssignQueueTask(
282
282
  }
283
283
  }
284
284
 
285
+ // Stamp mesh context onto the session so completion events route correctly
286
+ // via setupMeshEventForwarding. Without this, manually-opened idle sessions
287
+ // (mesh_launch_session without auto-launch) lack meshNodeFor/meshNodeId and
288
+ // agent:generating_completed is silently dropped as isMeshDelegate=false.
289
+ try {
290
+ const inst = components.instanceManager.getInstance(sessionId);
291
+ if (inst && typeof inst.updateSettings === 'function') {
292
+ inst.updateSettings({ meshNodeFor: meshId, meshNodeId: nodeId, launchedByCoordinator: true });
293
+ }
294
+ } catch { /* best-effort — dispatch still proceeds */ }
295
+
285
296
  const delivery = createSessionDelivery({
286
297
  meshId,
287
298
  nodeId,
@@ -595,9 +595,10 @@ export class CliProviderInstance implements ProviderInstance {
595
595
  typeof adapterStatus?.providerSessionId === 'string' ? adapterStatus.providerSessionId : '',
596
596
  );
597
597
  const autoApproveActive = this.maybeAutoApproveStatus(adapterStatus, Date.now());
598
+ const autoApproveHoldIdle = this.autoApproveBusy && adapterStatus.status === 'idle';
598
599
  let visibleStatus = parseErrorMessage || parsedStatus?.status === 'error'
599
600
  ? 'error'
600
- : (autoApproveActive ? 'generating' : adapterStatus.status);
601
+ : (autoApproveActive || autoApproveHoldIdle ? 'generating' : adapterStatus.status);
601
602
  const externalNativeFinal = this.getExternalNativeFinalReconciliation(parsedStatus?.messages, adapterStatus);
602
603
  if (externalNativeFinal && isCliGeneratingLikeStatus(visibleStatus)) {
603
604
  visibleStatus = 'idle';
@@ -718,7 +719,7 @@ export class CliProviderInstance implements ProviderInstance {
718
719
  });
719
720
  const activeChatStatus = parseErrorMessage
720
721
  ? 'error'
721
- : autoApproveActive && parsedStatus?.status === 'waiting_approval'
722
+ : (autoApproveActive && parsedStatus?.status === 'waiting_approval') || autoApproveHoldIdle
722
723
  ? 'generating'
723
724
  : (adapterStatus.status !== 'idle'
724
725
  ? visibleStatus
@@ -743,7 +744,7 @@ export class CliProviderInstance implements ProviderInstance {
743
744
  title: parsedStatus?.title || dirName,
744
745
  status: finalChatStatus,
745
746
  messages: statusMessages,
746
- activeModal: autoApproveActive ? null : (parsedStatus?.activeModal ?? adapterStatus.activeModal),
747
+ activeModal: (autoApproveActive || autoApproveHoldIdle) ? null : (parsedStatus?.activeModal ?? adapterStatus.activeModal),
747
748
  activeInteractivePrompt: this.activeInteractivePrompt,
748
749
  inputContent: '',
749
750
  },
@@ -788,7 +789,8 @@ export class CliProviderInstance implements ProviderInstance {
788
789
  getHotChatSessionState(): HotChatSessionState {
789
790
  const adapterStatus = this.adapter.getStatus({ allowParse: false });
790
791
  const autoApproveActive = adapterStatus.status === 'waiting_approval' && this.shouldAutoApprove();
791
- const visibleStatus = autoApproveActive ? 'generating' : adapterStatus.status;
792
+ const autoApproveHoldIdle = this.autoApproveBusy && adapterStatus.status === 'idle';
793
+ const visibleStatus = autoApproveActive || autoApproveHoldIdle ? 'generating' : adapterStatus.status;
792
794
  const runtime = this.adapter.getRuntimeMetadata();
793
795
  return {
794
796
  id: this.instanceId,
@@ -803,7 +805,8 @@ export class CliProviderInstance implements ProviderInstance {
803
805
  getSessionModalState(sessionId?: string): SessionModalState {
804
806
  const adapterStatus = this.adapter.getStatus({ allowParse: true });
805
807
  const autoApproveActive = adapterStatus.status === 'waiting_approval' && this.shouldAutoApprove();
806
- const visibleStatus = autoApproveActive ? 'generating' : adapterStatus.status;
808
+ const autoApproveHoldIdle = this.autoApproveBusy && adapterStatus.status === 'idle';
809
+ const visibleStatus = autoApproveActive || autoApproveHoldIdle ? 'generating' : adapterStatus.status;
807
810
  const dirName = this.workingDir.split('/').filter(Boolean).pop() || 'session';
808
811
  return {
809
812
  // Honor the caller-supplied sessionId — InstanceMgr rejects the
@@ -813,7 +816,7 @@ export class CliProviderInstance implements ProviderInstance {
813
816
  id: sessionId ?? this.instanceId,
814
817
  status: visibleStatus,
815
818
  title: dirName,
816
- activeModal: autoApproveActive ? null : adapterStatus.activeModal,
819
+ activeModal: (autoApproveActive || autoApproveHoldIdle) ? null : adapterStatus.activeModal,
817
820
  };
818
821
  }
819
822
 
@@ -1340,7 +1343,7 @@ export class CliProviderInstance implements ProviderInstance {
1340
1343
  const externalNativeFinal = this.getExternalNativeFinalReconciliation(undefined, latestStatus);
1341
1344
  const latestVisibleStatus = externalNativeFinal && isCliGeneratingLikeStatus(latestStatus.status)
1342
1345
  ? 'idle'
1343
- : (latestAutoApproveActive ? 'generating' : latestStatus.status);
1346
+ : (latestAutoApproveActive || this.autoApproveBusy ? 'generating' : latestStatus.status);
1344
1347
  LOG.debug('CLI', `[${this.type}] flush attempt: adapterStatus=${latestStatus.status} latestVisible=${latestVisibleStatus} externalNativeFinal=${!!externalNativeFinal} generatingStartedAt=${this.generatingStartedAt} isWaitingForResponse=${!!(this.adapter as any)?.isWaitingForResponse} hasPartial=${!!this.adapter.getPartialResponse?.()}`);
1345
1348
  if (latestVisibleStatus !== 'idle') {
1346
1349
  LOG.info('CLI', `[${this.type}] cancelled pending completed (resumed ${latestVisibleStatus})`);
@@ -1457,7 +1460,7 @@ export class CliProviderInstance implements ProviderInstance {
1457
1460
  this.autoApproveBusy = false;
1458
1461
  this.autoApproveBusyTimer = null;
1459
1462
  this.lastAutoApprovalSignature = '';
1460
- }, 2000);
1463
+ }, 5000);
1461
1464
  this.recordAutoApproval(modal?.message, buttonLabel, now);
1462
1465
  setTimeout(() => {
1463
1466
  this.adapter.resolveModal(buttonIndex);
@@ -8,6 +8,9 @@ export interface SessionRuntimeTarget {
8
8
  cdpManagerKey?: string;
9
9
  adapterKey?: string;
10
10
  instanceKey?: string;
11
+ /** Working directory for CLI/ACP sessions. Used by read_chat to resolve
12
+ * native history when there is no live adapter (e.g. subscription path). */
13
+ workspace?: string;
11
14
  /** Wall clock at register time. native-history readers use it as a
12
15
  * cutoff so a fresh session can't show records from a prior one. */
13
16
  spawnedAtMs?: number;