@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.js CHANGED
@@ -2283,7 +2283,7 @@ var init_provider_cli_adapter = __esm({
2283
2283
  }
2284
2284
  getFreshParsedStatusCache() {
2285
2285
  const cached = this.parsedStatusCache;
2286
- 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) {
2286
+ 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) {
2287
2287
  return cached.result;
2288
2288
  }
2289
2289
  return null;
@@ -3531,7 +3531,7 @@ var init_provider_cli_adapter = __esm({
3531
3531
  getScriptParsedStatus() {
3532
3532
  const screenText = this.readTerminalScreenText();
3533
3533
  const cached = this.parsedStatusCache;
3534
- 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) {
3534
+ 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) {
3535
3535
  return cached.result;
3536
3536
  }
3537
3537
  const parsed = this.parseCurrentTranscript(
@@ -3650,12 +3650,10 @@ var init_provider_cli_adapter = __esm({
3650
3650
  currentTurnScope: this.currentTurnScope,
3651
3651
  recentOutputBuffer: this.recentOutputBuffer,
3652
3652
  accumulatedBuffer: this.accumulatedBuffer,
3653
- accumulatedRawBuffer: this.accumulatedRawBuffer,
3654
3653
  screenText,
3655
3654
  currentStatus: this.currentStatus,
3656
3655
  activeModal: this.activeModal,
3657
3656
  cliName: this.cliName,
3658
- lastOutputAt: this.lastOutputAt,
3659
3657
  result
3660
3658
  };
3661
3659
  return result;
@@ -8521,6 +8519,15 @@ var ExtensionProviderInstance = class {
8521
8519
  pendingEvents: this.flushEvents()
8522
8520
  };
8523
8521
  }
8522
+ getSessionModalState(sessionId) {
8523
+ if (sessionId && sessionId !== this.instanceId) return null;
8524
+ return {
8525
+ id: this.instanceId,
8526
+ status: this.currentStatus,
8527
+ title: this.chatTitle || this.agentName || this.provider.name,
8528
+ activeModal: this.activeModal
8529
+ };
8530
+ }
8524
8531
  onEvent(event, data) {
8525
8532
  if (event === "stream_update") {
8526
8533
  if (data?.streams) this.agentStreams = data.streams;
@@ -8987,6 +8994,23 @@ var IdeProviderInstance = class {
8987
8994
  pendingEvents: this.flushEvents()
8988
8995
  };
8989
8996
  }
8997
+ getSessionModalState(sessionId) {
8998
+ if (sessionId && sessionId !== this.instanceId) {
8999
+ for (const ext of this.extensions.values()) {
9000
+ const projected = ext.getSessionModalState?.(sessionId);
9001
+ if (projected?.id === sessionId) return projected;
9002
+ }
9003
+ return null;
9004
+ }
9005
+ const autoApproveActive = (this.currentStatus === "waiting_approval" || this.cachedChat?.status === "waiting_approval") && this.canAutoApprove();
9006
+ const visibleStatus = autoApproveActive ? "generating" : this.currentStatus;
9007
+ return {
9008
+ id: this.instanceId,
9009
+ status: autoApproveActive && this.cachedChat?.status === "waiting_approval" ? "generating" : this.cachedChat?.status || visibleStatus,
9010
+ title: this.cachedChat?.title || this.type,
9011
+ activeModal: autoApproveActive ? null : this.cachedChat?.activeModal || null
9012
+ };
9013
+ }
8990
9014
  onEvent(event, data) {
8991
9015
  if (event === "cdp_connected") {
8992
9016
  } else if (event === "cdp_disconnected") {
@@ -13651,6 +13675,18 @@ var CliProviderInstance = class {
13651
13675
  runtimeRecoveryState: runtime?.recoveryState ?? null
13652
13676
  };
13653
13677
  }
13678
+ getSessionModalState() {
13679
+ const adapterStatus = this.adapter.getStatus({ allowParse: false });
13680
+ const autoApproveActive = adapterStatus.status === "waiting_approval" && this.shouldAutoApprove();
13681
+ const visibleStatus = autoApproveActive ? "generating" : adapterStatus.status;
13682
+ const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
13683
+ return {
13684
+ id: this.instanceId,
13685
+ status: visibleStatus,
13686
+ title: dirName,
13687
+ activeModal: autoApproveActive ? null : adapterStatus.activeModal
13688
+ };
13689
+ }
13654
13690
  updateSettings(newSettings) {
13655
13691
  this.settings = { ...newSettings };
13656
13692
  this.adapter.updateRuntimeSettings?.(this.settings);
@@ -14378,6 +14414,18 @@ var AcpProviderInstance = class {
14378
14414
  this.detectStatusTransition();
14379
14415
  }
14380
14416
  }
14417
+ getSessionModalState() {
14418
+ const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
14419
+ return {
14420
+ id: this.instanceId,
14421
+ status: this.currentStatus,
14422
+ title: `${this.provider.name} \xB7 ${dirName}`,
14423
+ activeModal: this.currentStatus === "waiting_approval" ? {
14424
+ message: this.activeToolCalls.find((t) => t.status === "running")?.name || "Permission requested",
14425
+ buttons: ["Approve", "Reject"]
14426
+ } : null
14427
+ };
14428
+ }
14381
14429
  getState() {
14382
14430
  const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
14383
14431
  const recentMessages = normalizeChatMessages(this.messages.map((m) => {
@@ -21260,6 +21308,29 @@ var ProviderInstanceManager = class {
21260
21308
  }
21261
21309
  return sessions;
21262
21310
  }
21311
+ getSessionModalState(sessionId, options = {}) {
21312
+ if (!sessionId) return null;
21313
+ const candidates = [sessionId];
21314
+ if (options.instanceKey && options.instanceKey !== sessionId) {
21315
+ candidates.push(options.instanceKey);
21316
+ }
21317
+ for (const id of candidates) {
21318
+ const instance = this.instances.get(id);
21319
+ if (!instance?.getSessionModalState) continue;
21320
+ try {
21321
+ const projected = instance.getSessionModalState(sessionId);
21322
+ if (!projected?.id) continue;
21323
+ if (projected.id !== sessionId) {
21324
+ LOG.warn("InstanceMgr", `[InstanceManager] Ignoring mismatched session modal projection from ${id}: requested=${sessionId} projected=${projected.id}`);
21325
+ continue;
21326
+ }
21327
+ return projected;
21328
+ } catch (e) {
21329
+ LOG.warn("InstanceMgr", `[InstanceManager] Failed to project session modal metadata from ${id}: ${e.message}`);
21330
+ }
21331
+ }
21332
+ return null;
21333
+ }
21263
21334
  /**
21264
21335
  * Per-category status collect
21265
21336
  */