@adhdev/daemon-standalone 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
@@ -30150,7 +30150,7 @@ var require_dist2 = __commonJS({
30150
30150
  }
30151
30151
  getFreshParsedStatusCache() {
30152
30152
  const cached2 = this.parsedStatusCache;
30153
- 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) {
30153
+ 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) {
30154
30154
  return cached2.result;
30155
30155
  }
30156
30156
  return null;
@@ -31398,7 +31398,7 @@ var require_dist2 = __commonJS({
31398
31398
  getScriptParsedStatus() {
31399
31399
  const screenText = this.readTerminalScreenText();
31400
31400
  const cached2 = this.parsedStatusCache;
31401
- 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) {
31401
+ 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) {
31402
31402
  return cached2.result;
31403
31403
  }
31404
31404
  const parsed = this.parseCurrentTranscript(
@@ -31517,12 +31517,10 @@ var require_dist2 = __commonJS({
31517
31517
  currentTurnScope: this.currentTurnScope,
31518
31518
  recentOutputBuffer: this.recentOutputBuffer,
31519
31519
  accumulatedBuffer: this.accumulatedBuffer,
31520
- accumulatedRawBuffer: this.accumulatedRawBuffer,
31521
31520
  screenText,
31522
31521
  currentStatus: this.currentStatus,
31523
31522
  activeModal: this.activeModal,
31524
31523
  cliName: this.cliName,
31525
- lastOutputAt: this.lastOutputAt,
31526
31524
  result
31527
31525
  };
31528
31526
  return result;
@@ -36342,6 +36340,15 @@ ${cleanBody}`;
36342
36340
  pendingEvents: this.flushEvents()
36343
36341
  };
36344
36342
  }
36343
+ getSessionModalState(sessionId) {
36344
+ if (sessionId && sessionId !== this.instanceId) return null;
36345
+ return {
36346
+ id: this.instanceId,
36347
+ status: this.currentStatus,
36348
+ title: this.chatTitle || this.agentName || this.provider.name,
36349
+ activeModal: this.activeModal
36350
+ };
36351
+ }
36345
36352
  onEvent(event, data) {
36346
36353
  if (event === "stream_update") {
36347
36354
  if (data?.streams) this.agentStreams = data.streams;
@@ -36802,6 +36809,23 @@ ${effect.notification.body || ""}`.trim();
36802
36809
  pendingEvents: this.flushEvents()
36803
36810
  };
36804
36811
  }
36812
+ getSessionModalState(sessionId) {
36813
+ if (sessionId && sessionId !== this.instanceId) {
36814
+ for (const ext of this.extensions.values()) {
36815
+ const projected = ext.getSessionModalState?.(sessionId);
36816
+ if (projected?.id === sessionId) return projected;
36817
+ }
36818
+ return null;
36819
+ }
36820
+ const autoApproveActive = (this.currentStatus === "waiting_approval" || this.cachedChat?.status === "waiting_approval") && this.canAutoApprove();
36821
+ const visibleStatus = autoApproveActive ? "generating" : this.currentStatus;
36822
+ return {
36823
+ id: this.instanceId,
36824
+ status: autoApproveActive && this.cachedChat?.status === "waiting_approval" ? "generating" : this.cachedChat?.status || visibleStatus,
36825
+ title: this.cachedChat?.title || this.type,
36826
+ activeModal: autoApproveActive ? null : this.cachedChat?.activeModal || null
36827
+ };
36828
+ }
36805
36829
  onEvent(event, data) {
36806
36830
  if (event === "cdp_connected") {
36807
36831
  } else if (event === "cdp_disconnected") {
@@ -41412,6 +41436,18 @@ ${effect.notification.body || ""}`.trim();
41412
41436
  runtimeRecoveryState: runtime?.recoveryState ?? null
41413
41437
  };
41414
41438
  }
41439
+ getSessionModalState() {
41440
+ const adapterStatus = this.adapter.getStatus({ allowParse: false });
41441
+ const autoApproveActive = adapterStatus.status === "waiting_approval" && this.shouldAutoApprove();
41442
+ const visibleStatus = autoApproveActive ? "generating" : adapterStatus.status;
41443
+ const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
41444
+ return {
41445
+ id: this.instanceId,
41446
+ status: visibleStatus,
41447
+ title: dirName,
41448
+ activeModal: autoApproveActive ? null : adapterStatus.activeModal
41449
+ };
41450
+ }
41415
41451
  updateSettings(newSettings) {
41416
41452
  this.settings = { ...newSettings };
41417
41453
  this.adapter.updateRuntimeSettings?.(this.settings);
@@ -42137,6 +42173,18 @@ ${effect.notification.body || ""}`.trim();
42137
42173
  this.detectStatusTransition();
42138
42174
  }
42139
42175
  }
42176
+ getSessionModalState() {
42177
+ const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
42178
+ return {
42179
+ id: this.instanceId,
42180
+ status: this.currentStatus,
42181
+ title: `${this.provider.name} \xB7 ${dirName}`,
42182
+ activeModal: this.currentStatus === "waiting_approval" ? {
42183
+ message: this.activeToolCalls.find((t) => t.status === "running")?.name || "Permission requested",
42184
+ buttons: ["Approve", "Reject"]
42185
+ } : null
42186
+ };
42187
+ }
42140
42188
  getState() {
42141
42189
  const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
42142
42190
  const recentMessages = normalizeChatMessages(this.messages.map((m) => {
@@ -48971,6 +49019,29 @@ Run 'adhdev doctor' for detailed diagnostics.`
48971
49019
  }
48972
49020
  return sessions;
48973
49021
  }
49022
+ getSessionModalState(sessionId, options = {}) {
49023
+ if (!sessionId) return null;
49024
+ const candidates = [sessionId];
49025
+ if (options.instanceKey && options.instanceKey !== sessionId) {
49026
+ candidates.push(options.instanceKey);
49027
+ }
49028
+ for (const id of candidates) {
49029
+ const instance = this.instances.get(id);
49030
+ if (!instance?.getSessionModalState) continue;
49031
+ try {
49032
+ const projected = instance.getSessionModalState(sessionId);
49033
+ if (!projected?.id) continue;
49034
+ if (projected.id !== sessionId) {
49035
+ LOG2.warn("InstanceMgr", `[InstanceManager] Ignoring mismatched session modal projection from ${id}: requested=${sessionId} projected=${projected.id}`);
49036
+ continue;
49037
+ }
49038
+ return projected;
49039
+ } catch (e) {
49040
+ LOG2.warn("InstanceMgr", `[InstanceManager] Failed to project session modal metadata from ${id}: ${e.message}`);
49041
+ }
49042
+ }
49043
+ return null;
49044
+ }
48974
49045
  /**
48975
49046
  * Per-category status collect
48976
49047
  */
@@ -57219,25 +57290,20 @@ var StandaloneServer = class {
57219
57290
  }
57220
57291
  }
57221
57292
  }
57222
- findProviderStateBySessionId(sessionId) {
57293
+ findSessionModalStateBySessionId(sessionId) {
57223
57294
  if (!this.components || !sessionId) return null;
57224
- const states = this.components.instanceManager.collectAllStates();
57225
- for (const state of states) {
57226
- if (state.instanceId === sessionId) return state;
57227
- if (state.category === "ide") {
57228
- const child = state.extensions.find((entry) => entry.instanceId === sessionId);
57229
- if (child) return child;
57230
- }
57231
- }
57232
- return null;
57295
+ const target = this.components.sessionRegistry.get(sessionId);
57296
+ return this.components.instanceManager.getSessionModalState(sessionId, {
57297
+ instanceKey: target?.instanceKey
57298
+ });
57233
57299
  }
57234
57300
  buildSessionModalUpdate(state, key) {
57235
- const providerState = this.findProviderStateBySessionId(state.request.params.targetSessionId);
57236
- if (!providerState) return null;
57301
+ const modalState = this.findSessionModalStateBySessionId(state.request.params.targetSessionId);
57302
+ if (!modalState) return null;
57237
57303
  const now = Date.now();
57238
- const activeModal = providerState.activeChat?.activeModal;
57239
- const status = String(providerState.activeChat?.status || providerState.status || "idle");
57240
- const title = typeof providerState.activeChat?.title === "string" ? providerState.activeChat.title : void 0;
57304
+ const activeModal = modalState.activeModal;
57305
+ const status = String(modalState.status || "idle");
57306
+ const title = typeof modalState.title === "string" ? modalState.title : void 0;
57241
57307
  const prepared = (0, import_daemon_core2.prepareSessionModalUpdate)({
57242
57308
  key,
57243
57309
  sessionId: state.request.params.targetSessionId,