(namespace: string, opts?: { machineId?: string })
| 760 | } |
| 761 | |
| 762 | listLocalResumableSessions(namespace: string, opts?: { machineId?: string }): ResumableSession[] { |
| 763 | return this.getSessionsByNamespace(namespace) |
| 764 | .map((session) => this.resolveLocalResumeTarget(session.id, namespace)) |
| 765 | .filter((result): result is { type: 'success'; target: LocalResumeTarget } => result.type === 'success') |
| 766 | .map(({ target }) => { |
| 767 | const session = this.getSessionByNamespace(target.sessionId, namespace) |
| 768 | return { |
| 769 | sessionId: target.sessionId, |
| 770 | flavor: target.flavor, |
| 771 | directory: target.directory, |
| 772 | machineId: target.machineId, |
| 773 | host: target.host, |
| 774 | active: target.active, |
| 775 | thinking: target.thinking, |
| 776 | controlledByUser: target.controlledByUser, |
| 777 | agentSessionId: target.agentSessionId, |
| 778 | model: target.model, |
| 779 | effort: target.effort, |
| 780 | modelReasoningEffort: target.modelReasoningEffort, |
| 781 | permissionMode: target.permissionMode, |
| 782 | collaborationMode: target.collaborationMode, |
| 783 | updatedAt: session?.updatedAt ?? 0, |
| 784 | name: session?.metadata?.name, |
| 785 | summary: session?.metadata?.summary?.text, |
| 786 | firstUserMessage: this.resolveFirstUserMessage(target.sessionId) |
| 787 | } |
| 788 | }) |
| 789 | .filter((session) => !opts?.machineId || session.machineId === opts.machineId) |
| 790 | .sort((a, b) => b.updatedAt - a.updatedAt) |
| 791 | } |
| 792 | |
| 793 | private resolveFirstUserMessage(sessionId: string): string | undefined { |
| 794 | for (const message of this.store.messages.getFirstMessages(sessionId, 50)) { |
no test coverage detected