@adhdev/daemon-core 0.9.9 → 0.9.11

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/session-host-core",
3
- "version": "0.9.9",
3
+ "version": "0.9.11",
4
4
  "description": "ADHDev local session host core \u2014 session registry, protocol, buffers",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/daemon-core",
3
- "version": "0.9.9",
3
+ "version": "0.9.11",
4
4
  "description": "ADHDev daemon core \u2014 CDP, IDE detection, providers, command execution",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -350,7 +350,7 @@ export class ProviderCliAdapter implements CliAdapter {
350
350
  private readonly sendDelayMs: number;
351
351
  private readonly sendKey: string;
352
352
  private readonly submitStrategy: 'wait_for_echo' | 'immediate';
353
- private static readonly SCRIPT_STATUS_DEBOUNCE_MS = 1000;
353
+ private static readonly SCRIPT_STATUS_DEBOUNCE_MS = 3000;
354
354
 
355
355
  constructor(
356
356
  provider: CliProviderModule,
@@ -18,6 +18,7 @@ import type { ReadChatCursor, ReadChatSyncMode, SessionTransport } from '../shar
18
18
  import { normalizeChatMessages } from '../providers/chat-message-normalization.js';
19
19
 
20
20
  const RECENT_SEND_WINDOW_MS = 1200;
21
+ export const READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS = 25_000;
21
22
  const recentSendByTarget = new Map<string, number>();
22
23
 
23
24
  interface ApprovalSelectableInstance extends ProviderInstance {
@@ -400,7 +401,7 @@ function didProviderConfirmSend(result: any): boolean {
400
401
 
401
402
  async function readExtensionChatState(h: CommandHelpers): Promise<any | null> {
402
403
  try {
403
- const evalResult = await h.evaluateProviderScript('readChat', undefined, 50000);
404
+ const evalResult = await h.evaluateProviderScript('readChat', undefined, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS);
404
405
  if (!evalResult?.result) return null;
405
406
  const parsed = parseMaybeJson(evalResult.result);
406
407
  return parsed && typeof parsed === 'object' ? parsed : null;
@@ -513,7 +514,7 @@ export async function handleReadChat(h: CommandHelpers, args: any): Promise<Comm
513
514
  ? parsedRecord.providerSessionId
514
515
  : undefined;
515
516
  if (status) {
516
- LOG.info('Command', `[read_chat] cli-like resolved provider=${adapter.cliType} target=${String(args?.targetSessionId || '')} adapterStatus=${String(adapterStatus.status || '')} parsedStatus=${String(parsedRecord?.status || '')} shouldPreferAdapterMessages=${String(shouldPreferAdapterMessages)} adapterMsgCount=${Array.isArray(adapterStatus.messages) ? adapterStatus.messages.length : 0} parsedMsgCount=${Array.isArray(parsedRecord?.messages) ? parsedRecord.messages.length : 0} returnedMsgCount=${Array.isArray((status as any).messages) ? (status as any).messages.length : 0}`);
517
+ LOG.debug('Command', `[read_chat] cli-like resolved provider=${adapter.cliType} target=${String(args?.targetSessionId || '')} adapterStatus=${String(adapterStatus.status || '')} parsedStatus=${String(parsedRecord?.status || '')} shouldPreferAdapterMessages=${String(shouldPreferAdapterMessages)} adapterMsgCount=${Array.isArray(adapterStatus.messages) ? adapterStatus.messages.length : 0} parsedMsgCount=${Array.isArray(parsedRecord?.messages) ? parsedRecord.messages.length : 0} returnedMsgCount=${Array.isArray((status as any).messages) ? (status as any).messages.length : 0}`);
517
518
  return buildReadChatCommandResult({
518
519
  messages: (status as any).messages || [],
519
520
  status: status.status,
@@ -540,7 +541,7 @@ export async function handleReadChat(h: CommandHelpers, args: any): Promise<Comm
540
541
  // Extension transport: evaluateInSession
541
542
  if (isExtensionTransport(transport)) {
542
543
  try {
543
- const evalResult = await h.evaluateProviderScript('readChat', undefined, 50000);
544
+ const evalResult = await h.evaluateProviderScript('readChat', undefined, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS);
544
545
  if (evalResult?.result) {
545
546
  let parsed = evalResult.result;
546
547
  if (typeof parsed === 'string') { try { parsed = JSON.parse(parsed); } catch { } }
@@ -643,7 +644,7 @@ export async function handleReadChat(h: CommandHelpers, args: any): Promise<Comm
643
644
  const script = h.getProviderScript('readChat') || h.getProviderScript('read_chat');
644
645
  if (script) {
645
646
  try {
646
- const evalResult = await h.evaluateProviderScript('readChat', undefined, 50000);
647
+ const evalResult = await h.evaluateProviderScript('readChat', undefined, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS);
647
648
  if (evalResult?.result) {
648
649
  let parsed: any = evalResult.result;
649
650
  if (typeof parsed === 'string') { try { parsed = JSON.parse(parsed); } catch { } }
@@ -576,7 +576,7 @@ export class CliProviderInstance implements ProviderInstance {
576
576
  }
577
577
 
578
578
  if (!this.generatingStartedAt) this.generatingStartedAt = now;
579
- // Defer the generating_started event — if idle comes back within 1s,
579
+ // Defer the generating_started event — if idle comes back within 3s,
580
580
  // the whole started→completed pair was a false positive from PTY noise
581
581
  if (this.generatingDebounceTimer) clearTimeout(this.generatingDebounceTimer);
582
582
  this.generatingDebouncePending = { chatTitle, timestamp: now };
@@ -586,7 +586,7 @@ export class CliProviderInstance implements ProviderInstance {
586
586
  this.generatingDebouncePending = null;
587
587
  }
588
588
  this.generatingDebounceTimer = null;
589
- }, 1000);
589
+ }, 3000);
590
590
  } else if (newStatus === 'waiting_approval') {
591
591
  this.suppressIdleHistoryReplay = false;
592
592
  // Flush pending generating_started if debounce still pending
@@ -626,7 +626,7 @@ export class CliProviderInstance implements ProviderInstance {
626
626
  this.generatingDebouncePending = null;
627
627
  this.generatingStartedAt = 0;
628
628
  } else {
629
- // Debounce completed — wait 2s, if still idle then emit
629
+ // Debounce completed — wait 3s, if still idle then emit
630
630
  if (this.completedDebounceTimer) clearTimeout(this.completedDebounceTimer);
631
631
  this.completedDebouncePending = { chatTitle, duration, timestamp: now };
632
632
  this.completedDebounceTimer = setTimeout(() => {
@@ -637,7 +637,7 @@ export class CliProviderInstance implements ProviderInstance {
637
637
  this.generatingStartedAt = 0;
638
638
  }
639
639
  this.completedDebounceTimer = null;
640
- }, 2000);
640
+ }, 3000);
641
641
  }
642
642
  } else if (newStatus === 'stopped') {
643
643
  // Cancel any pending debounce