(session: ProcessSession, maxOutputTokens?: number)
| 390 | } |
| 391 | |
| 392 | private consume(session: ProcessSession, maxOutputTokens?: number): ProcessSnapshot { |
| 393 | const limit = boundedInteger(maxOutputTokens, DEFAULT_MAX_OUTPUT_TOKENS, 100_000); |
| 394 | const maxCharacters = Math.max(256, limit * 4); |
| 395 | const buffered = session.buffer.drain(maxCharacters); |
| 396 | |
| 397 | return { |
| 398 | sessionId: session.running ? session.id : undefined, |
| 399 | output: buffered.output, |
| 400 | outputTruncated: buffered.truncated, |
| 401 | running: session.running, |
| 402 | exitCode: session.exitCode, |
| 403 | signal: session.signal, |
| 404 | wallTimeMs: Date.now() - session.startedAt, |
| 405 | }; |
| 406 | } |
| 407 | |
| 408 | private getOwnedSession(workspaceId: string, sessionId: number): ProcessSession { |
| 409 | const session = this.sessions.get(sessionId); |
no test coverage detected