Discriminate status-dependent record and option types (RunRecord, SessionIndexEntry, InputState, durable-only options)
维护者通常 1 天内回复
@jherr 已经在做这个了。
开始于 2026年10月16日。
评估
这个 Issue 还没有评估数据。
描述
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, andnameare all-or-none for a child run.finishedAtanderrordepend onstatus.SessionIndexEntry(packages/ai-persistence/src/types.ts):parentThreadIdandparentToolCallIdgo together.InputState(packages/ai-harness/src/log.ts):appliedneedsoperationId,joinedneedsinto,rejectedneedsreason,settledneedssettlement. 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, andcoalesceMsare read only whenstores.logis set. Keying the options on the persistence shape needs the twoHarnessPersistencearms exported under names.AgentStartOptions.resume,TurnAdditions.records, andOpenSessionOptions.logIdneedstores.log. The first two throw a clear error without it.logIdis ignored in silence. A type fix means aTDurableparameter fromcreateHarnessHostthrough to the session type.
Not worth a union
HarnessConfig.adapter: a plugin or stored model name can supply the model at runtime, so theNO_MODELruntime check stays.HarnessConfig.routingwith no root agents: a one-time warning fits better than a type.
Suggested order
InputState, because it hides a real bug.RunRecordandSessionIndexEntry, because every store implementation sees them.HarnessHostOptions, once the persistence arms have names.- The durable-only options, if the
TDurableplumbing turns out to be small.
- 主要语言
- TypeScript
- 星标
- 3.2k
- 派生
- 372
- 平均合并
- 1 天 12 小时
- 30 天内合并 PR
- 266
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TanStack/ai 的其他 Issue
-
Durable resume through withPersistence never fills ctx.inputResponse for mcp_input interrupts可能已有人在做 @tombeckenham 于 2 天前认领。 未关闭waiting-on: maintainer
维护者通常 1 天内回复
-
ai, ai-persistence: a nested subagent that waits runs again from the start under withPersistence可能已有人在做 @tombeckenham 于 3 天前认领。 未关闭waiting-on: maintainer
维护者通常 1 天内回复
-
ai-ollama: streamed chat() reports finishReason "stop" when done_reason is "length"可能已有人在做 @AlemTuzlak 于 3 天前认领。 未关闭waiting-on: maintainer
维护者通常 1 天内回复
-
move to modelschemas可能已有人在做 @jherr 于 10 天前认领。 未关闭has-pr waiting-on: maintainer
维护者通常 1 天内回复
-
chat(): sign the state of a suspended run so a resume without persistence cannot change it可能已有人在做 @AlemTuzlak 于 12 天前认领。 未关闭waiting-on: maintainer
TanStack/ai#1740 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
相似的 Issue
-
freshness freshness:observed-only
难度 2/5 1-3 小时 新手友好度 68/100
thoroc/context-radar#282 ·
-
bug P2 rust
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
area: web
难度 2/5 1-3 小时 新手友好度 85/100
gabe-santana/arkdraw#25 ·
-
bug require-triage
难度 2/5 1-3 小时 新手友好度 72/100
expressjs/expressjs.com#2549 · 1 个 reaction ·
维护者通常 1 天内回复
-
bug good first issue hacktoberfest
难度 2/5 1-3 小时 新手友好度 88/100
codercops/discord-bot#101 · 1 条评论 ·
维护者通常 1 天内回复