(
id: string,
stack: readonly string[] = [],
)
| 868 | } |
| 869 | |
| 870 | private resumeAgent( |
| 871 | id: string, |
| 872 | stack: readonly string[] = [], |
| 873 | ): Promise<ResumedAgent> { |
| 874 | if (stack.includes(id)) { |
| 875 | throw new KimiError( |
| 876 | ErrorCodes.SESSION_STATE_INVALID, |
| 877 | `Session agent parent chain contains a cycle: ${[...stack, id].join(' -> ')}`, |
| 878 | ); |
| 879 | } |
| 880 | |
| 881 | const entry = this.agents.get(id); |
| 882 | if (entry !== undefined) return this.resolveAgentEntry(entry); |
| 883 | |
| 884 | const promise = this.resumePersistedAgent(id, stack); |
| 885 | this.agents.set(id, promise); |
| 886 | return promise; |
| 887 | } |
| 888 | |
| 889 | private async resumePersistedAgent( |
| 890 | id: string, |
no test coverage detected