@adhdev/daemon-core 0.8.61 → 0.8.63

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.8.61",
3
+ "version": "0.8.63",
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.8.61",
3
+ "version": "0.8.63",
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",
@@ -739,6 +739,19 @@ export class ProviderCliAdapter implements CliAdapter {
739
739
  || screenStableMs < holdMs;
740
740
  }
741
741
 
742
+ private shouldDeferIdleTimeoutFinish(): boolean {
743
+ if (!this.isWaitingForResponse || this.currentStatus === 'waiting_approval') {
744
+ return false;
745
+ }
746
+ const latestStatus = this.runDetectStatus(this.recentOutputBuffer) || this.currentStatus;
747
+ if (latestStatus === 'generating') {
748
+ this.settledBuffer = this.recentOutputBuffer;
749
+ this.evaluateSettled();
750
+ return true;
751
+ }
752
+ return false;
753
+ }
754
+
742
755
  private getStartupConfirmationModal(screenText: string): { message: string; buttons: string[] } | null {
743
756
  const text = sanitizeTerminalText(String(screenText || ''));
744
757
  if (!text.trim()) return null;
@@ -930,6 +943,7 @@ export class ProviderCliAdapter implements CliAdapter {
930
943
  if (this.idleTimeout) clearTimeout(this.idleTimeout);
931
944
  this.idleTimeout = setTimeout(() => {
932
945
  if (this.isWaitingForResponse && this.currentStatus !== 'waiting_approval') {
946
+ if (this.shouldDeferIdleTimeoutFinish()) return;
933
947
  this.finishResponse();
934
948
  }
935
949
  }, this.timeouts.generatingIdle);
@@ -963,6 +977,7 @@ export class ProviderCliAdapter implements CliAdapter {
963
977
  if (this.idleTimeout) clearTimeout(this.idleTimeout);
964
978
  this.idleTimeout = setTimeout(() => {
965
979
  if (this.isWaitingForResponse && this.currentStatus !== 'waiting_approval') {
980
+ if (this.shouldDeferIdleTimeoutFinish()) return;
966
981
  this.finishResponse();
967
982
  }
968
983
  }, this.timeouts.generatingIdle);
@@ -1012,7 +1027,10 @@ export class ProviderCliAdapter implements CliAdapter {
1012
1027
  // Reset idle timeout
1013
1028
  if (this.idleTimeout) clearTimeout(this.idleTimeout);
1014
1029
  this.idleTimeout = setTimeout(() => {
1015
- if (this.isWaitingForResponse) this.finishResponse();
1030
+ if (this.isWaitingForResponse) {
1031
+ if (this.shouldDeferIdleTimeoutFinish()) return;
1032
+ this.finishResponse();
1033
+ }
1016
1034
  }, this.timeouts.generatingIdle);
1017
1035
  this.onStatusChange?.();
1018
1036
  return;
@@ -1091,6 +1109,7 @@ export class ProviderCliAdapter implements CliAdapter {
1091
1109
  if (this.idleTimeout) clearTimeout(this.idleTimeout);
1092
1110
  this.idleTimeout = setTimeout(() => {
1093
1111
  if (this.isWaitingForResponse && this.currentStatus !== 'waiting_approval') {
1112
+ if (this.shouldDeferIdleTimeoutFinish()) return;
1094
1113
  this.clearIdleFinishCandidate('idle_timeout_finish');
1095
1114
  this.finishResponse();
1096
1115
  }
@@ -1219,6 +1238,7 @@ export class ProviderCliAdapter implements CliAdapter {
1219
1238
  tail: text.slice(-500),
1220
1239
  screenText,
1221
1240
  rawBuffer: this.accumulatedRawBuffer,
1241
+ isWaitingForResponse: this.isWaitingForResponse,
1222
1242
  screen: buildCliScreenSnapshot(screenText),
1223
1243
  tailScreen: buildCliScreenSnapshot(text.slice(-500)),
1224
1244
  });
@@ -1350,6 +1370,7 @@ export class ProviderCliAdapter implements CliAdapter {
1350
1370
  terminalScreenText: this.terminalScreen.getText(),
1351
1371
  baseMessages: this.committedMessages,
1352
1372
  partialResponse: this.responseBuffer,
1373
+ isWaitingForResponse: this.isWaitingForResponse,
1353
1374
  scope: this.currentTurnScope,
1354
1375
  runtimeSettings: this.runtimeSettings,
1355
1376
  });
@@ -1369,6 +1390,7 @@ export class ProviderCliAdapter implements CliAdapter {
1369
1390
  terminalScreenText: this.terminalScreen.getText(),
1370
1391
  baseMessages,
1371
1392
  partialResponse,
1393
+ isWaitingForResponse: this.isWaitingForResponse,
1372
1394
  scope,
1373
1395
  runtimeSettings: this.runtimeSettings,
1374
1396
  });
@@ -24,6 +24,7 @@ export declare function buildCliParseInput(options: {
24
24
  terminalScreenText: string;
25
25
  baseMessages: CliChatMessage[];
26
26
  partialResponse: string;
27
+ isWaitingForResponse?: boolean;
27
28
  scope?: TurnParseScope | null;
28
29
  runtimeSettings: Record<string, any>;
29
30
  }): CliScriptInput;
@@ -123,6 +123,7 @@ export function buildCliParseInput(options: {
123
123
  terminalScreenText: string;
124
124
  baseMessages: CliChatMessage[];
125
125
  partialResponse: string;
126
+ isWaitingForResponse?: boolean;
126
127
  scope?: TurnParseScope | null;
127
128
  runtimeSettings: Record<string, any>;
128
129
  }): CliScriptInput {
@@ -133,6 +134,7 @@ export function buildCliParseInput(options: {
133
134
  terminalScreenText,
134
135
  baseMessages,
135
136
  partialResponse,
137
+ isWaitingForResponse,
136
138
  scope,
137
139
  runtimeSettings,
138
140
  } = options;
@@ -155,6 +157,7 @@ export function buildCliParseInput(options: {
155
157
  recentScreen: buildCliScreenSnapshot(recentBuffer),
156
158
  messages: [...baseMessages],
157
159
  partialResponse,
160
+ isWaitingForResponse,
158
161
  promptText: scope?.prompt || '',
159
162
  settings: { ...runtimeSettings },
160
163
  };
@@ -62,6 +62,7 @@ export interface CliScriptInput {
62
62
  recentScreen: CliScreenSnapshot;
63
63
  messages: CliChatMessage[];
64
64
  partialResponse: string;
65
+ isWaitingForResponse?: boolean;
65
66
  promptText?: string;
66
67
  settings?: Record<string, any>;
67
68
  args?: Record<string, any>;
@@ -70,6 +71,7 @@ export interface CliStatusInput {
70
71
  tail: string;
71
72
  screenText?: string;
72
73
  rawBuffer?: string;
74
+ isWaitingForResponse?: boolean;
73
75
  screen: CliScreenSnapshot;
74
76
  tailScreen: CliScreenSnapshot;
75
77
  }
@@ -66,6 +66,7 @@ export interface CliScriptInput {
66
66
  recentScreen: CliScreenSnapshot;
67
67
  messages: CliChatMessage[];
68
68
  partialResponse: string;
69
+ isWaitingForResponse?: boolean;
69
70
  promptText?: string;
70
71
  settings?: Record<string, any>;
71
72
  args?: Record<string, any>;
@@ -75,6 +76,7 @@ export interface CliStatusInput {
75
76
  tail: string;
76
77
  screenText?: string;
77
78
  rawBuffer?: string;
79
+ isWaitingForResponse?: boolean;
78
80
  screen: CliScreenSnapshot;
79
81
  tailScreen: CliScreenSnapshot;
80
82
  }