Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#1,799 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@jherr 已经在做这个了。

开始于 2026年10月16日。

评估

这个 Issue 还没有评估数据。

描述

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.
主要语言
TypeScript
星标
3.2k
派生
372
平均合并
1 天 12 小时
30 天内合并 PR
266

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TanStack/ai 的其他 Issue

查看 TanStack/ai 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。