@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/dist/index.d.ts
CHANGED
|
@@ -2607,6 +2607,7 @@ declare class CliProviderInstance implements ProviderInstance {
|
|
|
2607
2607
|
private monitor;
|
|
2608
2608
|
private generatingDebounceTimer;
|
|
2609
2609
|
private generatingDebouncePending;
|
|
2610
|
+
private lastApprovalEventAt;
|
|
2610
2611
|
private historyWriter;
|
|
2611
2612
|
readonly instanceId: string;
|
|
2612
2613
|
constructor(provider: ProviderModule, workingDir: string, cliArgs?: string[], instanceId?: string);
|
package/dist/index.js
CHANGED
|
@@ -2221,7 +2221,15 @@ var ExtensionProviderInstance = class {
|
|
|
2221
2221
|
this.pushEvent({ event: "agent:generating_started", chatTitle, timestamp: now });
|
|
2222
2222
|
} else if (agentStatus === "waiting_approval") {
|
|
2223
2223
|
if (!this.generatingStartedAt) this.generatingStartedAt = now;
|
|
2224
|
-
this.pushEvent({
|
|
2224
|
+
this.pushEvent({
|
|
2225
|
+
event: "agent:waiting_approval",
|
|
2226
|
+
chatTitle,
|
|
2227
|
+
timestamp: now,
|
|
2228
|
+
ideType: this.ideType,
|
|
2229
|
+
agentType: this.type,
|
|
2230
|
+
modalMessage: data?.activeModal?.message || data?.modalMessage,
|
|
2231
|
+
modalButtons: data?.activeModal?.buttons || data?.modalButtons
|
|
2232
|
+
});
|
|
2225
2233
|
} else if (agentStatus === "idle" && (this.lastAgentStatus === "generating" || this.lastAgentStatus === "waiting_approval")) {
|
|
2226
2234
|
const duration = this.generatingStartedAt ? Math.round((now - this.generatingStartedAt) / 1e3) : 0;
|
|
2227
2235
|
this.pushEvent({ event: "agent:generating_completed", chatTitle, duration, timestamp: now });
|
|
@@ -7336,6 +7344,7 @@ var CliProviderInstance = class {
|
|
|
7336
7344
|
monitor;
|
|
7337
7345
|
generatingDebounceTimer = null;
|
|
7338
7346
|
generatingDebouncePending = null;
|
|
7347
|
+
lastApprovalEventAt = 0;
|
|
7339
7348
|
historyWriter;
|
|
7340
7349
|
instanceId;
|
|
7341
7350
|
// ─── Lifecycle ─────────────────────────────────
|
|
@@ -7466,13 +7475,17 @@ var CliProviderInstance = class {
|
|
|
7466
7475
|
if (!this.generatingStartedAt) this.generatingStartedAt = now;
|
|
7467
7476
|
const modal = adapterStatus.activeModal;
|
|
7468
7477
|
LOG.info("CLI", `[${this.type}] approval modal: "${modal?.message?.slice(0, 80) ?? "none"}"`);
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7478
|
+
const approvalCooldown = 5e3;
|
|
7479
|
+
if (this.lastStatus !== "waiting_approval" && (!this.lastApprovalEventAt || now - this.lastApprovalEventAt > approvalCooldown)) {
|
|
7480
|
+
this.lastApprovalEventAt = now;
|
|
7481
|
+
this.pushEvent({
|
|
7482
|
+
event: "agent:waiting_approval",
|
|
7483
|
+
chatTitle,
|
|
7484
|
+
timestamp: now,
|
|
7485
|
+
modalMessage: modal?.message,
|
|
7486
|
+
modalButtons: modal?.buttons
|
|
7487
|
+
});
|
|
7488
|
+
}
|
|
7476
7489
|
} else if (newStatus === "idle" && (this.lastStatus === "generating" || this.lastStatus === "waiting_approval")) {
|
|
7477
7490
|
const duration = this.generatingStartedAt ? Math.round((now - this.generatingStartedAt) / 1e3) : 0;
|
|
7478
7491
|
if (this.generatingDebouncePending) {
|
|
@@ -8905,7 +8918,8 @@ var ProviderStreamAdapter = class {
|
|
|
8905
8918
|
extensionId: this.extensionId,
|
|
8906
8919
|
status: "error",
|
|
8907
8920
|
messages: [],
|
|
8908
|
-
inputContent: ""
|
|
8921
|
+
inputContent: "",
|
|
8922
|
+
_error: message
|
|
8909
8923
|
};
|
|
8910
8924
|
}
|
|
8911
8925
|
};
|
|
@@ -8924,9 +8938,11 @@ var DaemonAgentStreamManager = class {
|
|
|
8924
8938
|
if (providerLoader) {
|
|
8925
8939
|
const allExtProviders = providerLoader.getByCategory("extension");
|
|
8926
8940
|
for (const p of allExtProviders) {
|
|
8927
|
-
const
|
|
8941
|
+
const resolved = providerLoader.resolve(p.type);
|
|
8942
|
+
if (!resolved) continue;
|
|
8943
|
+
const adapter = new ProviderStreamAdapter(resolved);
|
|
8928
8944
|
this.allAdapters.push(adapter);
|
|
8929
|
-
this.logFn(`[AgentStream] Adapter created: ${p.type} (${p.name})`);
|
|
8945
|
+
this.logFn(`[AgentStream] Adapter created: ${p.type} (${p.name}) scripts=${Object.keys(resolved.scripts || {}).join(",") || "none"}`);
|
|
8930
8946
|
}
|
|
8931
8947
|
}
|
|
8932
8948
|
}
|
|
@@ -9013,6 +9029,7 @@ var DaemonAgentStreamManager = class {
|
|
|
9013
9029
|
try {
|
|
9014
9030
|
const evaluate = (expr, timeout) => cdp.evaluateInSessionFrame(agent.sessionId, expr, timeout);
|
|
9015
9031
|
const state = await agent.adapter.readChat(evaluate);
|
|
9032
|
+
this.logFn(`[AgentStream] readChat(${type}) result: status=${state.status} msgs=${state.messages?.length || 0} model=${state.model || ""}${state.status === "error" ? " error=" + JSON.stringify(state.error || state._error || "unknown") : ""}`);
|
|
9016
9033
|
agent.lastState = state;
|
|
9017
9034
|
agent.lastError = null;
|
|
9018
9035
|
if (state.status === "panel_hidden") {
|