@adhdev/daemon-core 0.5.32 → 0.5.34
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.d.ts +1 -0
- package/dist/index.js +28 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/agent-stream/manager.ts +5 -2
- package/src/agent-stream/provider-adapter.ts +2 -1
- package/src/providers/cli-provider-instance.ts +11 -5
- package/src/providers/extension-provider-instance.ts +7 -1
package/package.json
CHANGED
|
@@ -47,9 +47,11 @@ export class DaemonAgentStreamManager {
|
|
|
47
47
|
if (providerLoader) {
|
|
48
48
|
const allExtProviders = providerLoader.getByCategory('extension');
|
|
49
49
|
for (const p of allExtProviders) {
|
|
50
|
-
const
|
|
50
|
+
const resolved = providerLoader.resolve(p.type);
|
|
51
|
+
if (!resolved) continue;
|
|
52
|
+
const adapter = new ProviderStreamAdapter(resolved);
|
|
51
53
|
this.allAdapters.push(adapter);
|
|
52
|
-
this.logFn(`[AgentStream] Adapter created: ${p.type} (${p.name})`);
|
|
54
|
+
this.logFn(`[AgentStream] Adapter created: ${p.type} (${p.name}) scripts=${Object.keys(resolved.scripts || {}).join(',') || 'none'}`);
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
}
|
|
@@ -147,6 +149,7 @@ export class DaemonAgentStreamManager {
|
|
|
147
149
|
const evaluate: AgentEvaluateFn = (expr, timeout) =>
|
|
148
150
|
cdp.evaluateInSessionFrame(agent.sessionId, expr, timeout);
|
|
149
151
|
const state = await agent.adapter.readChat(evaluate);
|
|
152
|
+
this.logFn(`[AgentStream] readChat(${type}) result: status=${state.status} msgs=${state.messages?.length || 0} model=${state.model || ''}${state.status === 'error' ? ' error=' + JSON.stringify((state as any).error || (state as any)._error || 'unknown') : ''}`);
|
|
150
153
|
agent.lastState = state;
|
|
151
154
|
agent.lastError = null;
|
|
152
155
|
if (state.status === 'panel_hidden') {
|
|
@@ -28,6 +28,7 @@ export class CliProviderInstance implements ProviderInstance {
|
|
|
28
28
|
private monitor: StatusMonitor;
|
|
29
29
|
private generatingDebounceTimer: NodeJS.Timeout | null = null;
|
|
30
30
|
private generatingDebouncePending: { chatTitle: string; timestamp: number } | null = null;
|
|
31
|
+
private lastApprovalEventAt = 0;
|
|
31
32
|
private historyWriter: ChatHistoryWriter;
|
|
32
33
|
readonly instanceId: string;
|
|
33
34
|
|
|
@@ -195,11 +196,16 @@ export class CliProviderInstance implements ProviderInstance {
|
|
|
195
196
|
if (!this.generatingStartedAt) this.generatingStartedAt = now;
|
|
196
197
|
const modal = adapterStatus.activeModal;
|
|
197
198
|
LOG.info('CLI', `[${this.type}] approval modal: "${modal?.message?.slice(0, 80) ?? 'none'}"`);
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
// Only push event if not already in waiting_approval (prevent flood from rapid cycles)
|
|
200
|
+
const approvalCooldown = 5000;
|
|
201
|
+
if (this.lastStatus !== 'waiting_approval' && (!this.lastApprovalEventAt || now - this.lastApprovalEventAt > approvalCooldown)) {
|
|
202
|
+
this.lastApprovalEventAt = now;
|
|
203
|
+
this.pushEvent({
|
|
204
|
+
event: 'agent:waiting_approval', chatTitle, timestamp: now,
|
|
205
|
+
modalMessage: modal?.message,
|
|
206
|
+
modalButtons: modal?.buttons,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
203
209
|
} else if (newStatus === 'idle' && (this.lastStatus === 'generating' || this.lastStatus === 'waiting_approval')) {
|
|
204
210
|
const duration = this.generatingStartedAt ? Math.round((now - this.generatingStartedAt) / 1000) : 0;
|
|
205
211
|
// If debounce still pending (generating lasted < 1s), cancel both events
|
|
@@ -125,7 +125,13 @@ export class ExtensionProviderInstance implements ProviderInstance {
|
|
|
125
125
|
this.pushEvent({ event: 'agent:generating_started', chatTitle, timestamp: now });
|
|
126
126
|
} else if (agentStatus === 'waiting_approval') {
|
|
127
127
|
if (!this.generatingStartedAt) this.generatingStartedAt = now;
|
|
128
|
-
this.pushEvent({
|
|
128
|
+
this.pushEvent({
|
|
129
|
+
event: 'agent:waiting_approval', chatTitle, timestamp: now,
|
|
130
|
+
ideType: this.ideType,
|
|
131
|
+
agentType: this.type,
|
|
132
|
+
modalMessage: data?.activeModal?.message || data?.modalMessage,
|
|
133
|
+
modalButtons: data?.activeModal?.buttons || data?.modalButtons,
|
|
134
|
+
});
|
|
129
135
|
} else if (agentStatus === 'idle' && (this.lastAgentStatus === 'generating' || this.lastAgentStatus === 'waiting_approval')) {
|
|
130
136
|
const duration = this.generatingStartedAt ? Math.round((now - this.generatingStartedAt) / 1000) : 0;
|
|
131
137
|
this.pushEvent({ event: 'agent:generating_completed', chatTitle, duration, timestamp: now });
|