adhdev 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
@@ -4990,6 +4990,15 @@ var init_extension_provider_instance = __esm({
4990
4990
  pendingEvents: this.flushEvents()
4991
4991
  };
4992
4992
  }
4993
+ getSessionModalState(sessionId) {
4994
+ if (sessionId && sessionId !== this.instanceId) return null;
4995
+ return {
4996
+ id: this.instanceId,
4997
+ status: this.currentStatus,
4998
+ title: this.chatTitle || this.agentName || this.provider.name,
4999
+ activeModal: this.activeModal
5000
+ };
5001
+ }
4993
5002
  onEvent(event, data) {
4994
5003
  if (event === "stream_update") {
4995
5004
  if (data?.streams) this.agentStreams = data.streams;
@@ -5617,6 +5626,23 @@ var init_ide_provider_instance = __esm({
5617
5626
  pendingEvents: this.flushEvents()
5618
5627
  };
5619
5628
  }
5629
+ getSessionModalState(sessionId) {
5630
+ if (sessionId && sessionId !== this.instanceId) {
5631
+ for (const ext of this.extensions.values()) {
5632
+ const projected = ext.getSessionModalState?.(sessionId);
5633
+ if (projected?.id === sessionId) return projected;
5634
+ }
5635
+ return null;
5636
+ }
5637
+ const autoApproveActive = (this.currentStatus === "waiting_approval" || this.cachedChat?.status === "waiting_approval") && this.canAutoApprove();
5638
+ const visibleStatus = autoApproveActive ? "generating" : this.currentStatus;
5639
+ return {
5640
+ id: this.instanceId,
5641
+ status: autoApproveActive && this.cachedChat?.status === "waiting_approval" ? "generating" : this.cachedChat?.status || visibleStatus,
5642
+ title: this.cachedChat?.title || this.type,
5643
+ activeModal: autoApproveActive ? null : this.cachedChat?.activeModal || null
5644
+ };
5645
+ }
5620
5646
  onEvent(event, data) {
5621
5647
  if (event === "cdp_connected") {
5622
5648
  } else if (event === "cdp_disconnected") {
@@ -12015,7 +12041,7 @@ var init_provider_cli_adapter = __esm({
12015
12041
  }
12016
12042
  getFreshParsedStatusCache() {
12017
12043
  const cached2 = this.parsedStatusCache;
12018
- if (cached2 && cached2.committedMessagesRef === this.committedMessages && cached2.responseBuffer === this.responseBuffer && cached2.currentTurnScope === this.currentTurnScope && cached2.recentOutputBuffer === this.recentOutputBuffer && cached2.accumulatedBuffer === this.accumulatedBuffer && cached2.accumulatedRawBuffer === this.accumulatedRawBuffer && cached2.screenText === this.lastScreenText && cached2.currentStatus === this.currentStatus && cached2.activeModal === this.activeModal && cached2.cliName === this.cliName && cached2.lastOutputAt === this.lastOutputAt) {
12044
+ if (cached2 && cached2.committedMessagesRef === this.committedMessages && cached2.responseBuffer === this.responseBuffer && cached2.currentTurnScope === this.currentTurnScope && cached2.recentOutputBuffer === this.recentOutputBuffer && cached2.accumulatedBuffer === this.accumulatedBuffer && cached2.screenText === this.lastScreenText && cached2.currentStatus === this.currentStatus && cached2.activeModal === this.activeModal && cached2.cliName === this.cliName) {
12019
12045
  return cached2.result;
12020
12046
  }
12021
12047
  return null;
@@ -13263,7 +13289,7 @@ var init_provider_cli_adapter = __esm({
13263
13289
  getScriptParsedStatus() {
13264
13290
  const screenText = this.readTerminalScreenText();
13265
13291
  const cached2 = this.parsedStatusCache;
13266
- if (cached2 && cached2.committedMessagesRef === this.committedMessages && cached2.responseBuffer === this.responseBuffer && cached2.currentTurnScope === this.currentTurnScope && cached2.recentOutputBuffer === this.recentOutputBuffer && cached2.accumulatedBuffer === this.accumulatedBuffer && cached2.accumulatedRawBuffer === this.accumulatedRawBuffer && cached2.screenText === screenText && cached2.currentStatus === this.currentStatus && cached2.activeModal === this.activeModal && cached2.cliName === this.cliName && cached2.lastOutputAt === this.lastOutputAt) {
13292
+ if (cached2 && cached2.committedMessagesRef === this.committedMessages && cached2.responseBuffer === this.responseBuffer && cached2.currentTurnScope === this.currentTurnScope && cached2.recentOutputBuffer === this.recentOutputBuffer && cached2.accumulatedBuffer === this.accumulatedBuffer && cached2.screenText === screenText && cached2.currentStatus === this.currentStatus && cached2.activeModal === this.activeModal && cached2.cliName === this.cliName) {
13267
13293
  return cached2.result;
13268
13294
  }
13269
13295
  const parsed = this.parseCurrentTranscript(
@@ -13382,12 +13408,10 @@ var init_provider_cli_adapter = __esm({
13382
13408
  currentTurnScope: this.currentTurnScope,
13383
13409
  recentOutputBuffer: this.recentOutputBuffer,
13384
13410
  accumulatedBuffer: this.accumulatedBuffer,
13385
- accumulatedRawBuffer: this.accumulatedRawBuffer,
13386
13411
  screenText,
13387
13412
  currentStatus: this.currentStatus,
13388
13413
  activeModal: this.activeModal,
13389
13414
  cliName: this.cliName,
13390
- lastOutputAt: this.lastOutputAt,
13391
13415
  result
13392
13416
  };
13393
13417
  return result;
@@ -14476,6 +14500,18 @@ var init_cli_provider_instance = __esm({
14476
14500
  runtimeRecoveryState: runtime?.recoveryState ?? null
14477
14501
  };
14478
14502
  }
14503
+ getSessionModalState() {
14504
+ const adapterStatus = this.adapter.getStatus({ allowParse: false });
14505
+ const autoApproveActive = adapterStatus.status === "waiting_approval" && this.shouldAutoApprove();
14506
+ const visibleStatus = autoApproveActive ? "generating" : adapterStatus.status;
14507
+ const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
14508
+ return {
14509
+ id: this.instanceId,
14510
+ status: visibleStatus,
14511
+ title: dirName,
14512
+ activeModal: autoApproveActive ? null : adapterStatus.activeModal
14513
+ };
14514
+ }
14479
14515
  updateSettings(newSettings) {
14480
14516
  this.settings = { ...newSettings };
14481
14517
  this.adapter.updateRuntimeSettings?.(this.settings);
@@ -31513,6 +31549,18 @@ var init_acp_provider_instance = __esm({
31513
31549
  this.detectStatusTransition();
31514
31550
  }
31515
31551
  }
31552
+ getSessionModalState() {
31553
+ const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
31554
+ return {
31555
+ id: this.instanceId,
31556
+ status: this.currentStatus,
31557
+ title: `${this.provider.name} \xB7 ${dirName}`,
31558
+ activeModal: this.currentStatus === "waiting_approval" ? {
31559
+ message: this.activeToolCalls.find((t) => t.status === "running")?.name || "Permission requested",
31560
+ buttons: ["Approve", "Reject"]
31561
+ } : null
31562
+ };
31563
+ }
31516
31564
  getState() {
31517
31565
  const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
31518
31566
  const recentMessages = normalizeChatMessages(this.messages.map((m) => {
@@ -40310,6 +40358,29 @@ var init_provider_instance_manager = __esm({
40310
40358
  }
40311
40359
  return sessions;
40312
40360
  }
40361
+ getSessionModalState(sessionId, options = {}) {
40362
+ if (!sessionId) return null;
40363
+ const candidates = [sessionId];
40364
+ if (options.instanceKey && options.instanceKey !== sessionId) {
40365
+ candidates.push(options.instanceKey);
40366
+ }
40367
+ for (const id of candidates) {
40368
+ const instance = this.instances.get(id);
40369
+ if (!instance?.getSessionModalState) continue;
40370
+ try {
40371
+ const projected = instance.getSessionModalState(sessionId);
40372
+ if (!projected?.id) continue;
40373
+ if (projected.id !== sessionId) {
40374
+ LOG.warn("InstanceMgr", `[InstanceManager] Ignoring mismatched session modal projection from ${id}: requested=${sessionId} projected=${projected.id}`);
40375
+ continue;
40376
+ }
40377
+ return projected;
40378
+ } catch (e) {
40379
+ LOG.warn("InstanceMgr", `[InstanceManager] Failed to project session modal metadata from ${id}: ${e.message}`);
40380
+ }
40381
+ }
40382
+ return null;
40383
+ }
40313
40384
  /**
40314
40385
  * Per-category status collect
40315
40386
  */
@@ -56600,7 +56671,7 @@ var init_adhdev_daemon = __esm({
56600
56671
  init_version();
56601
56672
  init_src();
56602
56673
  init_runtime_defaults();
56603
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.40" });
56674
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.41" });
56604
56675
  AdhdevDaemon = class _AdhdevDaemon {
56605
56676
  localHttpServer = null;
56606
56677
  localWss = null;
@@ -56916,37 +56987,20 @@ var init_adhdev_daemon = __esm({
56916
56987
  async (subscription) => this.buildSessionHostDiagnosticsUpdateForSubscription(subscription)
56917
56988
  );
56918
56989
  }
56919
- findProviderStateBySessionId(sessionId) {
56990
+ findSessionModalStateBySessionId(sessionId) {
56920
56991
  if (!this.components || !sessionId) return null;
56921
- const directInstance = this.components.instanceManager.getInstance(sessionId);
56922
- if (directInstance) {
56923
- try {
56924
- return directInstance.getState();
56925
- } catch (error48) {
56926
- LOG.warn("P2P", `Failed to collect subscribed session state for ${sessionId}: ${error48?.message || String(error48)}`);
56927
- return null;
56928
- }
56929
- }
56930
- for (const instance of this.components.instanceManager.getByCategory("ide")) {
56931
- try {
56932
- const state = instance.getState();
56933
- if (state.instanceId === sessionId) return state;
56934
- if (state.category !== "ide") continue;
56935
- const child = state.extensions.find((entry) => entry.instanceId === sessionId);
56936
- if (child) return child;
56937
- } catch (error48) {
56938
- LOG.warn("P2P", `Failed to collect IDE child state for ${sessionId}: ${error48?.message || String(error48)}`);
56939
- }
56940
- }
56941
- return null;
56992
+ const target = this.components.sessionRegistry.get(sessionId);
56993
+ return this.components.instanceManager.getSessionModalState(sessionId, {
56994
+ instanceKey: target?.instanceKey
56995
+ });
56942
56996
  }
56943
56997
  buildSessionModalUpdateForSubscription(subscription) {
56944
- const state = this.findProviderStateBySessionId(subscription.params.targetSessionId);
56998
+ const state = this.findSessionModalStateBySessionId(subscription.params.targetSessionId);
56945
56999
  if (!state) return null;
56946
57000
  const now = Date.now();
56947
- const activeModal = state.activeChat?.activeModal;
56948
- const status = String(state.activeChat?.status || state.status || "idle");
56949
- const title = typeof state.activeChat?.title === "string" ? state.activeChat.title : void 0;
57001
+ const activeModal = state.activeModal;
57002
+ const status = String(state.status || "idle");
57003
+ const title = typeof state.title === "string" ? state.title : void 0;
56950
57004
  const interactionId = this.getSessionInteractionId(subscription.params.targetSessionId);
56951
57005
  const prepared = prepareSessionModalUpdate({
56952
57006
  key: subscription.key,