lark-coding-assistant 0.2.0 → 0.2.1

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.
@@ -2917,10 +2917,41 @@ var AssistantDaemon = class {
2917
2917
  }
2918
2918
  return { mode: "code", bindCode: createBindCode(), expiresInSeconds: 600 };
2919
2919
  }
2920
- async runtimeStatus(sessionId = this.state.activeSessionId) {
2921
- const session = sessionId ? this.state.sessions?.[sessionId] : void 0;
2922
- const pane = session ? await this.tmux.inspect(session.paneId) : void 0;
2923
- return { state: this.state, session, screen: sessionId === this.state.activeSessionId ? this.screen : void 0, paneAlive: Boolean(pane && !pane.dead) };
2920
+ async runtimeStatus(sessionId) {
2921
+ const selectedSessionId = sessionId ?? this.state.activeSessionId;
2922
+ const selected = selectedSessionId ? this.state.sessions?.[selectedSessionId] : void 0;
2923
+ const requestedSessions = sessionId ? selected ? [selected] : [] : Object.values(this.state.sessions ?? {});
2924
+ const sessions = await Promise.all(requestedSessions.map((session) => this.sessionRuntimeStatus(session)));
2925
+ const selectedRuntime = selected ? sessions.find(({ session }) => session.id === selected.id) ?? await this.sessionRuntimeStatus(selected) : void 0;
2926
+ return {
2927
+ state: this.state,
2928
+ session: selected,
2929
+ screen: selectedRuntime?.screen,
2930
+ paneAlive: selectedRuntime?.paneAlive === true,
2931
+ sessions
2932
+ };
2933
+ }
2934
+ async sessionRuntimeStatus(session) {
2935
+ const active = session.id === this.state.activeSessionId;
2936
+ try {
2937
+ const pane = await this.tmux.inspect(session.paneId);
2938
+ if (!pane || pane.dead) {
2939
+ return {
2940
+ session,
2941
+ screen: getAgentAdapter(session.agent).detectScreen("", false),
2942
+ paneAlive: false,
2943
+ active
2944
+ };
2945
+ }
2946
+ const screen = active && this.screen ? this.screen : getAgentAdapter(session.agent).detectScreen(
2947
+ await this.tmux.capture(session.paneId, 160),
2948
+ true,
2949
+ { x: pane.cursorX, y: pane.cursorY }
2950
+ );
2951
+ return { session, screen, paneAlive: true, active };
2952
+ } catch {
2953
+ return { session, active };
2954
+ }
2924
2955
  }
2925
2956
  async tail(lines) {
2926
2957
  const session = this.activeSession();