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/cli/index.js CHANGED
@@ -5510,6 +5510,15 @@ var init_extension_provider_instance = __esm({
5510
5510
  pendingEvents: this.flushEvents()
5511
5511
  };
5512
5512
  }
5513
+ getSessionModalState(sessionId) {
5514
+ if (sessionId && sessionId !== this.instanceId) return null;
5515
+ return {
5516
+ id: this.instanceId,
5517
+ status: this.currentStatus,
5518
+ title: this.chatTitle || this.agentName || this.provider.name,
5519
+ activeModal: this.activeModal
5520
+ };
5521
+ }
5513
5522
  onEvent(event, data) {
5514
5523
  if (event === "stream_update") {
5515
5524
  if (data?.streams) this.agentStreams = data.streams;
@@ -6137,6 +6146,23 @@ var init_ide_provider_instance = __esm({
6137
6146
  pendingEvents: this.flushEvents()
6138
6147
  };
6139
6148
  }
6149
+ getSessionModalState(sessionId) {
6150
+ if (sessionId && sessionId !== this.instanceId) {
6151
+ for (const ext of this.extensions.values()) {
6152
+ const projected = ext.getSessionModalState?.(sessionId);
6153
+ if (projected?.id === sessionId) return projected;
6154
+ }
6155
+ return null;
6156
+ }
6157
+ const autoApproveActive = (this.currentStatus === "waiting_approval" || this.cachedChat?.status === "waiting_approval") && this.canAutoApprove();
6158
+ const visibleStatus = autoApproveActive ? "generating" : this.currentStatus;
6159
+ return {
6160
+ id: this.instanceId,
6161
+ status: autoApproveActive && this.cachedChat?.status === "waiting_approval" ? "generating" : this.cachedChat?.status || visibleStatus,
6162
+ title: this.cachedChat?.title || this.type,
6163
+ activeModal: autoApproveActive ? null : this.cachedChat?.activeModal || null
6164
+ };
6165
+ }
6140
6166
  onEvent(event, data) {
6141
6167
  if (event === "cdp_connected") {
6142
6168
  } else if (event === "cdp_disconnected") {
@@ -12971,7 +12997,7 @@ var init_provider_cli_adapter = __esm({
12971
12997
  }
12972
12998
  getFreshParsedStatusCache() {
12973
12999
  const cached2 = this.parsedStatusCache;
12974
- 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) {
13000
+ 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) {
12975
13001
  return cached2.result;
12976
13002
  }
12977
13003
  return null;
@@ -14219,7 +14245,7 @@ var init_provider_cli_adapter = __esm({
14219
14245
  getScriptParsedStatus() {
14220
14246
  const screenText = this.readTerminalScreenText();
14221
14247
  const cached2 = this.parsedStatusCache;
14222
- 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) {
14248
+ 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) {
14223
14249
  return cached2.result;
14224
14250
  }
14225
14251
  const parsed = this.parseCurrentTranscript(
@@ -14338,12 +14364,10 @@ var init_provider_cli_adapter = __esm({
14338
14364
  currentTurnScope: this.currentTurnScope,
14339
14365
  recentOutputBuffer: this.recentOutputBuffer,
14340
14366
  accumulatedBuffer: this.accumulatedBuffer,
14341
- accumulatedRawBuffer: this.accumulatedRawBuffer,
14342
14367
  screenText,
14343
14368
  currentStatus: this.currentStatus,
14344
14369
  activeModal: this.activeModal,
14345
14370
  cliName: this.cliName,
14346
- lastOutputAt: this.lastOutputAt,
14347
14371
  result
14348
14372
  };
14349
14373
  return result;
@@ -15432,6 +15456,18 @@ var init_cli_provider_instance = __esm({
15432
15456
  runtimeRecoveryState: runtime?.recoveryState ?? null
15433
15457
  };
15434
15458
  }
15459
+ getSessionModalState() {
15460
+ const adapterStatus = this.adapter.getStatus({ allowParse: false });
15461
+ const autoApproveActive = adapterStatus.status === "waiting_approval" && this.shouldAutoApprove();
15462
+ const visibleStatus = autoApproveActive ? "generating" : adapterStatus.status;
15463
+ const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
15464
+ return {
15465
+ id: this.instanceId,
15466
+ status: visibleStatus,
15467
+ title: dirName,
15468
+ activeModal: autoApproveActive ? null : adapterStatus.activeModal
15469
+ };
15470
+ }
15435
15471
  updateSettings(newSettings) {
15436
15472
  this.settings = { ...newSettings };
15437
15473
  this.adapter.updateRuntimeSettings?.(this.settings);
@@ -32469,6 +32505,18 @@ var init_acp_provider_instance = __esm({
32469
32505
  this.detectStatusTransition();
32470
32506
  }
32471
32507
  }
32508
+ getSessionModalState() {
32509
+ const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
32510
+ return {
32511
+ id: this.instanceId,
32512
+ status: this.currentStatus,
32513
+ title: `${this.provider.name} \xB7 ${dirName}`,
32514
+ activeModal: this.currentStatus === "waiting_approval" ? {
32515
+ message: this.activeToolCalls.find((t) => t.status === "running")?.name || "Permission requested",
32516
+ buttons: ["Approve", "Reject"]
32517
+ } : null
32518
+ };
32519
+ }
32472
32520
  getState() {
32473
32521
  const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
32474
32522
  const recentMessages = normalizeChatMessages(this.messages.map((m) => {
@@ -41266,6 +41314,29 @@ var init_provider_instance_manager = __esm({
41266
41314
  }
41267
41315
  return sessions;
41268
41316
  }
41317
+ getSessionModalState(sessionId, options = {}) {
41318
+ if (!sessionId) return null;
41319
+ const candidates = [sessionId];
41320
+ if (options.instanceKey && options.instanceKey !== sessionId) {
41321
+ candidates.push(options.instanceKey);
41322
+ }
41323
+ for (const id of candidates) {
41324
+ const instance = this.instances.get(id);
41325
+ if (!instance?.getSessionModalState) continue;
41326
+ try {
41327
+ const projected = instance.getSessionModalState(sessionId);
41328
+ if (!projected?.id) continue;
41329
+ if (projected.id !== sessionId) {
41330
+ LOG.warn("InstanceMgr", `[InstanceManager] Ignoring mismatched session modal projection from ${id}: requested=${sessionId} projected=${projected.id}`);
41331
+ continue;
41332
+ }
41333
+ return projected;
41334
+ } catch (e) {
41335
+ LOG.warn("InstanceMgr", `[InstanceManager] Failed to project session modal metadata from ${id}: ${e.message}`);
41336
+ }
41337
+ }
41338
+ return null;
41339
+ }
41269
41340
  /**
41270
41341
  * Per-category status collect
41271
41342
  */
@@ -88320,7 +88391,7 @@ var init_adhdev_daemon = __esm({
88320
88391
  init_version();
88321
88392
  init_src();
88322
88393
  init_runtime_defaults();
88323
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.40" });
88394
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.41" });
88324
88395
  AdhdevDaemon = class _AdhdevDaemon {
88325
88396
  localHttpServer = null;
88326
88397
  localWss = null;
@@ -88636,37 +88707,20 @@ var init_adhdev_daemon = __esm({
88636
88707
  async (subscription) => this.buildSessionHostDiagnosticsUpdateForSubscription(subscription)
88637
88708
  );
88638
88709
  }
88639
- findProviderStateBySessionId(sessionId) {
88710
+ findSessionModalStateBySessionId(sessionId) {
88640
88711
  if (!this.components || !sessionId) return null;
88641
- const directInstance = this.components.instanceManager.getInstance(sessionId);
88642
- if (directInstance) {
88643
- try {
88644
- return directInstance.getState();
88645
- } catch (error48) {
88646
- LOG.warn("P2P", `Failed to collect subscribed session state for ${sessionId}: ${error48?.message || String(error48)}`);
88647
- return null;
88648
- }
88649
- }
88650
- for (const instance of this.components.instanceManager.getByCategory("ide")) {
88651
- try {
88652
- const state = instance.getState();
88653
- if (state.instanceId === sessionId) return state;
88654
- if (state.category !== "ide") continue;
88655
- const child = state.extensions.find((entry) => entry.instanceId === sessionId);
88656
- if (child) return child;
88657
- } catch (error48) {
88658
- LOG.warn("P2P", `Failed to collect IDE child state for ${sessionId}: ${error48?.message || String(error48)}`);
88659
- }
88660
- }
88661
- return null;
88712
+ const target = this.components.sessionRegistry.get(sessionId);
88713
+ return this.components.instanceManager.getSessionModalState(sessionId, {
88714
+ instanceKey: target?.instanceKey
88715
+ });
88662
88716
  }
88663
88717
  buildSessionModalUpdateForSubscription(subscription) {
88664
- const state = this.findProviderStateBySessionId(subscription.params.targetSessionId);
88718
+ const state = this.findSessionModalStateBySessionId(subscription.params.targetSessionId);
88665
88719
  if (!state) return null;
88666
88720
  const now = Date.now();
88667
- const activeModal = state.activeChat?.activeModal;
88668
- const status = String(state.activeChat?.status || state.status || "idle");
88669
- const title = typeof state.activeChat?.title === "string" ? state.activeChat.title : void 0;
88721
+ const activeModal = state.activeModal;
88722
+ const status = String(state.status || "idle");
88723
+ const title = typeof state.title === "string" ? state.title : void 0;
88670
88724
  const interactionId = this.getSessionInteractionId(subscription.params.targetSessionId);
88671
88725
  const prepared = prepareSessionModalUpdate({
88672
88726
  key: subscription.key,