@adhdev/daemon-core 0.9.40 → 0.9.41

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.mjs CHANGED
@@ -2280,7 +2280,7 @@ var init_provider_cli_adapter = __esm({
2280
2280
  }
2281
2281
  getFreshParsedStatusCache() {
2282
2282
  const cached = this.parsedStatusCache;
2283
- if (cached && cached.committedMessagesRef === this.committedMessages && cached.responseBuffer === this.responseBuffer && cached.currentTurnScope === this.currentTurnScope && cached.recentOutputBuffer === this.recentOutputBuffer && cached.accumulatedBuffer === this.accumulatedBuffer && cached.accumulatedRawBuffer === this.accumulatedRawBuffer && cached.screenText === this.lastScreenText && cached.currentStatus === this.currentStatus && cached.activeModal === this.activeModal && cached.cliName === this.cliName && cached.lastOutputAt === this.lastOutputAt) {
2283
+ if (cached && cached.committedMessagesRef === this.committedMessages && cached.responseBuffer === this.responseBuffer && cached.currentTurnScope === this.currentTurnScope && cached.recentOutputBuffer === this.recentOutputBuffer && cached.accumulatedBuffer === this.accumulatedBuffer && cached.screenText === this.lastScreenText && cached.currentStatus === this.currentStatus && cached.activeModal === this.activeModal && cached.cliName === this.cliName) {
2284
2284
  return cached.result;
2285
2285
  }
2286
2286
  return null;
@@ -3528,7 +3528,7 @@ var init_provider_cli_adapter = __esm({
3528
3528
  getScriptParsedStatus() {
3529
3529
  const screenText = this.readTerminalScreenText();
3530
3530
  const cached = this.parsedStatusCache;
3531
- if (cached && cached.committedMessagesRef === this.committedMessages && cached.responseBuffer === this.responseBuffer && cached.currentTurnScope === this.currentTurnScope && cached.recentOutputBuffer === this.recentOutputBuffer && cached.accumulatedBuffer === this.accumulatedBuffer && cached.accumulatedRawBuffer === this.accumulatedRawBuffer && cached.screenText === screenText && cached.currentStatus === this.currentStatus && cached.activeModal === this.activeModal && cached.cliName === this.cliName && cached.lastOutputAt === this.lastOutputAt) {
3531
+ if (cached && cached.committedMessagesRef === this.committedMessages && cached.responseBuffer === this.responseBuffer && cached.currentTurnScope === this.currentTurnScope && cached.recentOutputBuffer === this.recentOutputBuffer && cached.accumulatedBuffer === this.accumulatedBuffer && cached.screenText === screenText && cached.currentStatus === this.currentStatus && cached.activeModal === this.activeModal && cached.cliName === this.cliName) {
3532
3532
  return cached.result;
3533
3533
  }
3534
3534
  const parsed = this.parseCurrentTranscript(
@@ -3647,12 +3647,10 @@ var init_provider_cli_adapter = __esm({
3647
3647
  currentTurnScope: this.currentTurnScope,
3648
3648
  recentOutputBuffer: this.recentOutputBuffer,
3649
3649
  accumulatedBuffer: this.accumulatedBuffer,
3650
- accumulatedRawBuffer: this.accumulatedRawBuffer,
3651
3650
  screenText,
3652
3651
  currentStatus: this.currentStatus,
3653
3652
  activeModal: this.activeModal,
3654
3653
  cliName: this.cliName,
3655
- lastOutputAt: this.lastOutputAt,
3656
3654
  result
3657
3655
  };
3658
3656
  return result;
@@ -8368,6 +8366,15 @@ var ExtensionProviderInstance = class {
8368
8366
  pendingEvents: this.flushEvents()
8369
8367
  };
8370
8368
  }
8369
+ getSessionModalState(sessionId) {
8370
+ if (sessionId && sessionId !== this.instanceId) return null;
8371
+ return {
8372
+ id: this.instanceId,
8373
+ status: this.currentStatus,
8374
+ title: this.chatTitle || this.agentName || this.provider.name,
8375
+ activeModal: this.activeModal
8376
+ };
8377
+ }
8371
8378
  onEvent(event, data) {
8372
8379
  if (event === "stream_update") {
8373
8380
  if (data?.streams) this.agentStreams = data.streams;
@@ -8834,6 +8841,23 @@ var IdeProviderInstance = class {
8834
8841
  pendingEvents: this.flushEvents()
8835
8842
  };
8836
8843
  }
8844
+ getSessionModalState(sessionId) {
8845
+ if (sessionId && sessionId !== this.instanceId) {
8846
+ for (const ext of this.extensions.values()) {
8847
+ const projected = ext.getSessionModalState?.(sessionId);
8848
+ if (projected?.id === sessionId) return projected;
8849
+ }
8850
+ return null;
8851
+ }
8852
+ const autoApproveActive = (this.currentStatus === "waiting_approval" || this.cachedChat?.status === "waiting_approval") && this.canAutoApprove();
8853
+ const visibleStatus = autoApproveActive ? "generating" : this.currentStatus;
8854
+ return {
8855
+ id: this.instanceId,
8856
+ status: autoApproveActive && this.cachedChat?.status === "waiting_approval" ? "generating" : this.cachedChat?.status || visibleStatus,
8857
+ title: this.cachedChat?.title || this.type,
8858
+ activeModal: autoApproveActive ? null : this.cachedChat?.activeModal || null
8859
+ };
8860
+ }
8837
8861
  onEvent(event, data) {
8838
8862
  if (event === "cdp_connected") {
8839
8863
  } else if (event === "cdp_disconnected") {
@@ -13498,6 +13522,18 @@ var CliProviderInstance = class {
13498
13522
  runtimeRecoveryState: runtime?.recoveryState ?? null
13499
13523
  };
13500
13524
  }
13525
+ getSessionModalState() {
13526
+ const adapterStatus = this.adapter.getStatus({ allowParse: false });
13527
+ const autoApproveActive = adapterStatus.status === "waiting_approval" && this.shouldAutoApprove();
13528
+ const visibleStatus = autoApproveActive ? "generating" : adapterStatus.status;
13529
+ const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
13530
+ return {
13531
+ id: this.instanceId,
13532
+ status: visibleStatus,
13533
+ title: dirName,
13534
+ activeModal: autoApproveActive ? null : adapterStatus.activeModal
13535
+ };
13536
+ }
13501
13537
  updateSettings(newSettings) {
13502
13538
  this.settings = { ...newSettings };
13503
13539
  this.adapter.updateRuntimeSettings?.(this.settings);
@@ -14230,6 +14266,18 @@ var AcpProviderInstance = class {
14230
14266
  this.detectStatusTransition();
14231
14267
  }
14232
14268
  }
14269
+ getSessionModalState() {
14270
+ const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
14271
+ return {
14272
+ id: this.instanceId,
14273
+ status: this.currentStatus,
14274
+ title: `${this.provider.name} \xB7 ${dirName}`,
14275
+ activeModal: this.currentStatus === "waiting_approval" ? {
14276
+ message: this.activeToolCalls.find((t) => t.status === "running")?.name || "Permission requested",
14277
+ buttons: ["Approve", "Reject"]
14278
+ } : null
14279
+ };
14280
+ }
14233
14281
  getState() {
14234
14282
  const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
14235
14283
  const recentMessages = normalizeChatMessages(this.messages.map((m) => {
@@ -21112,6 +21160,29 @@ var ProviderInstanceManager = class {
21112
21160
  }
21113
21161
  return sessions;
21114
21162
  }
21163
+ getSessionModalState(sessionId, options = {}) {
21164
+ if (!sessionId) return null;
21165
+ const candidates = [sessionId];
21166
+ if (options.instanceKey && options.instanceKey !== sessionId) {
21167
+ candidates.push(options.instanceKey);
21168
+ }
21169
+ for (const id of candidates) {
21170
+ const instance = this.instances.get(id);
21171
+ if (!instance?.getSessionModalState) continue;
21172
+ try {
21173
+ const projected = instance.getSessionModalState(sessionId);
21174
+ if (!projected?.id) continue;
21175
+ if (projected.id !== sessionId) {
21176
+ LOG.warn("InstanceMgr", `[InstanceManager] Ignoring mismatched session modal projection from ${id}: requested=${sessionId} projected=${projected.id}`);
21177
+ continue;
21178
+ }
21179
+ return projected;
21180
+ } catch (e) {
21181
+ LOG.warn("InstanceMgr", `[InstanceManager] Failed to project session modal metadata from ${id}: ${e.message}`);
21182
+ }
21183
+ }
21184
+ return null;
21185
+ }
21115
21186
  /**
21116
21187
  * Per-category status collect
21117
21188
  */