@adhdev/daemon-core 0.5.32 → 0.5.33

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 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
@@ -7336,6 +7336,7 @@ var CliProviderInstance = class {
7336
7336
  monitor;
7337
7337
  generatingDebounceTimer = null;
7338
7338
  generatingDebouncePending = null;
7339
+ lastApprovalEventAt = 0;
7339
7340
  historyWriter;
7340
7341
  instanceId;
7341
7342
  // ─── Lifecycle ─────────────────────────────────
@@ -7466,13 +7467,17 @@ var CliProviderInstance = class {
7466
7467
  if (!this.generatingStartedAt) this.generatingStartedAt = now;
7467
7468
  const modal = adapterStatus.activeModal;
7468
7469
  LOG.info("CLI", `[${this.type}] approval modal: "${modal?.message?.slice(0, 80) ?? "none"}"`);
7469
- this.pushEvent({
7470
- event: "agent:waiting_approval",
7471
- chatTitle,
7472
- timestamp: now,
7473
- modalMessage: modal?.message,
7474
- modalButtons: modal?.buttons
7475
- });
7470
+ const approvalCooldown = 5e3;
7471
+ if (this.lastStatus !== "waiting_approval" && (!this.lastApprovalEventAt || now - this.lastApprovalEventAt > approvalCooldown)) {
7472
+ this.lastApprovalEventAt = now;
7473
+ this.pushEvent({
7474
+ event: "agent:waiting_approval",
7475
+ chatTitle,
7476
+ timestamp: now,
7477
+ modalMessage: modal?.message,
7478
+ modalButtons: modal?.buttons
7479
+ });
7480
+ }
7476
7481
  } else if (newStatus === "idle" && (this.lastStatus === "generating" || this.lastStatus === "waiting_approval")) {
7477
7482
  const duration = this.generatingStartedAt ? Math.round((now - this.generatingStartedAt) / 1e3) : 0;
7478
7483
  if (this.generatingDebouncePending) {
@@ -8905,7 +8910,8 @@ var ProviderStreamAdapter = class {
8905
8910
  extensionId: this.extensionId,
8906
8911
  status: "error",
8907
8912
  messages: [],
8908
- inputContent: ""
8913
+ inputContent: "",
8914
+ _error: message
8909
8915
  };
8910
8916
  }
8911
8917
  };
@@ -8924,9 +8930,11 @@ var DaemonAgentStreamManager = class {
8924
8930
  if (providerLoader) {
8925
8931
  const allExtProviders = providerLoader.getByCategory("extension");
8926
8932
  for (const p of allExtProviders) {
8927
- const adapter = new ProviderStreamAdapter(p);
8933
+ const resolved = providerLoader.resolve(p.type);
8934
+ if (!resolved) continue;
8935
+ const adapter = new ProviderStreamAdapter(resolved);
8928
8936
  this.allAdapters.push(adapter);
8929
- this.logFn(`[AgentStream] Adapter created: ${p.type} (${p.name})`);
8937
+ this.logFn(`[AgentStream] Adapter created: ${p.type} (${p.name}) scripts=${Object.keys(resolved.scripts || {}).join(",") || "none"}`);
8930
8938
  }
8931
8939
  }
8932
8940
  }
@@ -9013,6 +9021,7 @@ var DaemonAgentStreamManager = class {
9013
9021
  try {
9014
9022
  const evaluate = (expr, timeout) => cdp.evaluateInSessionFrame(agent.sessionId, expr, timeout);
9015
9023
  const state = await agent.adapter.readChat(evaluate);
9024
+ 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
9025
  agent.lastState = state;
9017
9026
  agent.lastError = null;
9018
9027
  if (state.status === "panel_hidden") {