@adhdev/daemon-core 0.8.74 → 0.8.76

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/src/index.ts CHANGED
@@ -205,6 +205,8 @@ export {
205
205
  prepareSessionChatTailUpdate,
206
206
  prepareSessionModalUpdate,
207
207
  } from './chat/subscription-updates.js';
208
+ export { runAsyncBatch } from './chat/async-batch.js';
209
+ export type { AsyncBatchOptions } from './chat/async-batch.js';
208
210
  export type {
209
211
  ChatTailSubscriptionCursor,
210
212
  PrepareSessionChatTailUpdateInput,
@@ -214,6 +214,33 @@ function buildExtensionAgentSession(
214
214
  };
215
215
  }
216
216
 
217
+ function shouldIncludeExtensionSession(ext: ExtensionProviderState): boolean {
218
+ const status = String(ext.status || '').trim().toLowerCase();
219
+ const hasActiveChat = !!ext.activeChat;
220
+ const hasMessages = Array.isArray(ext.activeChat?.messages) && ext.activeChat!.messages.length > 0;
221
+ const hasModal = !!ext.activeChat?.activeModal;
222
+ const hasStreams = Array.isArray((ext as any).agentStreams) && (ext as any).agentStreams.length > 0;
223
+ const hasProviderSessionId = typeof ext.providerSessionId === 'string' && ext.providerSessionId.trim().length > 0;
224
+ const hasControlValues = !!(ext.controlValues && Object.keys(ext.controlValues).length > 0);
225
+ const hasProviderControls = Array.isArray(ext.providerControls) && ext.providerControls.length > 0;
226
+ const hasOpenPanelCapability = Array.isArray(ext.sessionCapabilities) && ext.sessionCapabilities.includes('open_panel');
227
+ const hasSummaryMetadata = !!ext.summaryMetadata;
228
+ const hasError = typeof ext.errorMessage === 'string' && ext.errorMessage.trim().length > 0;
229
+ const hasInterestingStatus = !!status && !['idle', 'panel_hidden', 'disconnected', 'not_monitored'].includes(status);
230
+
231
+ return hasActiveChat
232
+ || hasMessages
233
+ || hasModal
234
+ || hasStreams
235
+ || hasProviderSessionId
236
+ || hasControlValues
237
+ || hasProviderControls
238
+ || hasOpenPanelCapability
239
+ || hasSummaryMetadata
240
+ || hasError
241
+ || hasInterestingStatus;
242
+ }
243
+
217
244
  function buildCliSession(state: CliProviderState, options: SessionEntryBuildOptions): SessionEntry {
218
245
  const profile = options.profile || 'full';
219
246
  const activeChat = normalizeActiveChatData(state.activeChat, getActiveChatOptions(profile));
@@ -305,6 +332,7 @@ export function buildSessionEntries(
305
332
  for (const state of ideStates) {
306
333
  sessions.push(buildIdeWorkspaceSession(state, cdpManagers, options));
307
334
  for (const ext of state.extensions as ExtensionProviderState[]) {
335
+ if (!shouldIncludeExtensionSession(ext)) continue;
308
336
  sessions.push(buildExtensionAgentSession(state, ext, options));
309
337
  }
310
338
  }