MCPcopy Create free account
hub / github.com/anomalyco/opencode / Reply

Class Reply

packages/opencode/test/lib/llm-server.ts:452–562  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

450}
451
452export class Reply {
453 #head: unknown[] = [role()]
454 #tail: unknown[] = []
455 #usage: Usage | undefined
456 #finish: string | undefined
457 #wait: PromiseLike<unknown> | undefined
458 #hang = false
459 #error: unknown
460 #reset = false
461 #seq = 0
462
463 #id() {
464 this.#seq += 1
465 return `call_${this.#seq}`
466 }
467
468 text(value: string) {
469 this.#tail = [...this.#tail, textLine(value)]
470 return this
471 }
472
473 reason(value: string) {
474 this.#tail = [...this.#tail, reasonLine(value)]
475 return this
476 }
477
478 usage(value: Usage) {
479 this.#usage = value
480 return this
481 }
482
483 wait(value: PromiseLike<unknown>) {
484 this.#wait = value
485 return this
486 }
487
488 stop() {
489 this.#finish = "stop"
490 this.#hang = false
491 this.#error = undefined
492 this.#reset = false
493 return this
494 }
495
496 contentFilter() {
497 this.#finish = "content_filter"
498 this.#hang = false
499 this.#error = undefined
500 this.#reset = false
501 return this
502 }
503
504 toolCalls() {
505 this.#finish = "tool_calls"
506 this.#hang = false
507 this.#error = undefined
508 this.#reset = false
509 return this

Callers

nothing calls this directly

Calls 1

roleFunction · 0.85

Tested by

no test coverage detected