Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Discriminate status-dependent record and option types (RunRecord, SessionIndexEntry, InputState, durable-only options)

Đang mở
#1,799 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@jherr đang làm issue này rồi.

Từ ngày 16/10/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

enhancement waiting-on: maintainer
TanStack AI version

feat/harness-core branch (PR #1755), unreleased @tanstack/ai-harness, @tanstack/ai-persistence, @tanstack/ai.

Framework/Library version

Not framework specific.

Describe the change

Several record types are optional bags whose fields depend on a status or kind field. The code checks the combination at runtime, or papers over it with a fallback. Each one is a candidate for a discriminated union, so the type says what the runtime already enforces.

PR #1755 did this for Receipt, InputSettlement, MediaRecord, and AgentRun in @tanstack/ai-harness. These are deferred because each needs a wider change than one package's types:

Records keyed by status

  • RunRecord (packages/ai/src/activities/chat/middleware/run-store.ts): parentRunId, subagentRunId, and name are all-or-none for a child run. finishedAt and error depend on status.
  • SessionIndexEntry (packages/ai-persistence/src/types.ts): parentThreadId and parentToolCallId go together.
  • InputState (packages/ai-harness/src/log.ts): applied needs operationId, joined needs into, rejected needs reason, settled needs settlement. Two sites fill the hole with ?? '', and one of them can pass an empty operation id when it fails a stopped agent (session/harness-session.ts, failStoppedAgent).
  • QueuedTurn (packages/ai-harness/src/session/types.ts): a kind bag of prompt, resolve, reset, continue, and wake.

Options that only mean something on a durable host

  • HarnessHostOptions.project, reduce, and coalesceMs are read only when stores.log is set. Keying the options on the persistence shape needs the two HarnessPersistence arms exported under names.
  • AgentStartOptions.resume, TurnAdditions.records, and OpenSessionOptions.logId need stores.log. The first two throw a clear error without it. logId is ignored in silence. A type fix means a TDurable parameter from createHarnessHost through to the session type.

Not worth a union

  • HarnessConfig.adapter: a plugin or stored model name can supply the model at runtime, so the NO_MODEL runtime check stays.
  • HarnessConfig.routing with no root agents: a one-time warning fits better than a type.
Suggested order
  1. InputState, because it hides a real bug.
  2. RunRecord and SessionIndexEntry, because every store implementation sees them.
  3. HarnessHostOptions, once the persistence arms have names.
  4. The durable-only options, if the TDurable plumbing turns out to be small.
Ngôn ngữ chính
TypeScript
Star
3.2k
Fork
361
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
266

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của TanStack/ai

Tất cả issue của TanStack/ai

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.