Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
37103ea
spec: 设计重构的架构和数据模型、前端架构
hifizz Aug 26, 2026
b0553be
feat(thread-chat): complete normalized contracts gate
hifizz Aug 26, 2026
e386a45
feat(thread-chat): complete normalized backend gate
hifizz Aug 26, 2026
e4d956c
feat(thread-chat): complete stream and api gate
hifizz Aug 26, 2026
1ebfbcd
feat(thread-chat): add normalized client foundation
hifizz Aug 26, 2026
cdcf6ea
fix(thread-chat): replay ai sdk stream chunks safely
hifizz Aug 26, 2026
6152da2
test(thread-chat): verify v1 routes against postgres
hifizz Aug 26, 2026
91cb5bf
feat(thread-chat): complete normalized client gate
hifizz Aug 26, 2026
e34830b
feat(thread-chat): complete normalized cutover gate
hifizz Aug 26, 2026
04655ca
fix: 修复样式
hifizz Aug 27, 2026
c3fd262
fix(thread-chat): treat user stop as cancellation
hifizz Aug 27, 2026
d40c725
fix(thread-chat): avoid background flash before stream connects
hifizz Aug 27, 2026
b46614f
fix thread chat recoverable tool error outcome
hifizz Aug 27, 2026
9b11f4d
Fix thread chat reasoning part rendering
hifizz Aug 27, 2026
2edfc03
Add local AI SDK debugging skills
hifizz Aug 27, 2026
f500ea0
fix: generate thread chat titles
hifizz Aug 27, 2026
d4472eb
refactor: rename finish message callback
hifizz Aug 27, 2026
ee14d10
docs(openspec): plan agent observability and evaluation
hifizz Aug 28, 2026
7266d30
chore(observability): establish runtime and dependencies
hifizz Aug 28, 2026
98b8ac8
feat(observability): add telemetry foundation and devtools
hifizz Aug 28, 2026
482731c
feat(observability): trace agent generation lifecycle
hifizz Aug 28, 2026
d570c16
feat(observability): trace search provider attempts
hifizz Aug 28, 2026
16599a6
feat(observability): mirror product feedback scores
hifizz Aug 28, 2026
ffbe8a3
chore(observability): add Langfuse rollout gates
hifizz Aug 28, 2026
23803e3
feat(evals): establish agent evaluation harness
hifizz Aug 28, 2026
f23dedb
feat(evals): add agent suites and scorers
hifizz Aug 28, 2026
ff3615d
feat(evals): add continuous comparison loop
hifizz Aug 28, 2026
0a8672e
docs(observability): complete local acceptance
hifizz Aug 28, 2026
586c132
fix(observability): preserve domain observation outcomes
hifizz Aug 29, 2026
fb2391f
fix(evals): enforce remote case privacy policy
hifizz Aug 29, 2026
20e7b02
fix(evals): execute each experiment case once
hifizz Aug 29, 2026
30a540a
fix(evals): collect provider attempts per run
hifizz Aug 29, 2026
8636ef9
fix(evals): propagate evaluation cancellation
hifizz Aug 29, 2026
9973bd8
fix(evals): harden evaluation database isolation
hifizz Aug 29, 2026
ed48d2d
fix(evals): exercise production context pipeline
hifizz Aug 29, 2026
316eafe
fix(observability): persist feedback score delivery
hifizz Aug 29, 2026
4848310
fix(evals): enforce exact mode manifests
hifizz Aug 29, 2026
54bc076
docs(project): add workspace design research
hifizz Aug 29, 2026
4d9eb5b
docs(project): 补充依赖支线成果交接场景
hifizz Aug 30, 2026
7875a99
docs(project): 收敛引用与 Outcome 初步方案
hifizz Aug 30, 2026
7485666
docs(project): 冻结 Project MVP 范围与开发节奏
hifizz Aug 30, 2026
1675ed3
spec(project): 初始化 Project Workspace MVP OpenSpec
hifizz Aug 30, 2026
bf379eb
spec(project): 添加 Project Workspace MVP proposal
hifizz Aug 30, 2026
0570adb
spec(project): 添加 Project Workspace MVP design
hifizz Aug 30, 2026
ed34702
spec(project): 添加 Project Workspace MVP requirements
hifizz Aug 30, 2026
f63bce6
spec(project): 添加 Project Workspace MVP tasks
hifizz Aug 30, 2026
5e6599e
feat(project): add workspace data contracts
hifizz Aug 30, 2026
1aa1f9f
feat(project): add workspace server APIs
hifizz Aug 30, 2026
07e7891
feat(project): inject contract and project files
hifizz Aug 30, 2026
c170f6a
ci(project): add temporary workspace validation
hifizz Aug 30, 2026
b1e0ce5
feat(project): add workspace client state
hifizz Aug 30, 2026
d7b0381
ci(project): patch legacy workspace fixtures
hifizz Aug 30, 2026
fae299e
test(project): update legacy workspace fixtures [skip ci]
github-actions[bot] Aug 30, 2026
6d727c1
ci(project): rerun workspace validation
hifizz Aug 30, 2026
311154a
refactor(ai): remove relay legacy environment fallback
hifizz Aug 30, 2026
7febea9
feat(chat): group model selector by provider
hifizz Aug 30, 2026
2f30247
style: compact model selector popover
hifizz Aug 31, 2026
f3471d7
feat(project): add project file upload client
hifizz Aug 31, 2026
15db869
feat(project): unify project workspace panel
hifizz Aug 31, 2026
afd3837
style(project): add project panel workspace styles
hifizz Aug 31, 2026
4965cfa
feat(project): expose project workspace from topbar
hifizz Aug 31, 2026
0a6ad27
fix(project): keep project panel compatible with workspace shell
hifizz Aug 31, 2026
2b2c48b
fix(project): preserve typed ui messages in attachment context
hifizz Aug 31, 2026
35529bb
ci(project): keep legacy harness compatible with workspace client
hifizz Aug 31, 2026
a1a0e4e
test(project): update legacy workspace fixtures [skip ci]
github-actions[bot] Aug 31, 2026
5225574
docs(openspec): record project workspace ui implementation
hifizz Aug 31, 2026
29eecdf
test(project): complete legacy workspace client mock
hifizz Aug 31, 2026
ac412a4
test(project): complete workspace client fixture [skip ci]
github-actions[bot] Aug 31, 2026
4b6ee46
ci(project): remove one-shot compatibility patch
hifizz Aug 31, 2026
5467b8d
docs(openspec): mark completed project workspace tasks
hifizz Aug 31, 2026
8c19d42
test(project): cover contract generation boundaries
hifizz Aug 31, 2026
33db755
refactor(project): extract attachment content resolver
hifizz Aug 31, 2026
641c2ea
refactor(project): use shared attachment content resolver
hifizz Aug 31, 2026
6d2041d
docs(openspec): complete contract boundary and resolver tasks
hifizz Aug 31, 2026
da14e99
refactor(project): bind project panel to normalized store
hifizz Aug 31, 2026
048907d
feat(project): bind project panel resources to conversation store
hifizz Aug 31, 2026
5488635
ci(project): apply store-bound panel integration
hifizz Aug 31, 2026
13c2803
ci(project): wire store-bound project panel
hifizz Aug 31, 2026
c776880
ci(project): trigger store-bound panel patch
hifizz Aug 31, 2026
7fff1ff
refactor(project): share project panel conversation store
hifizz Aug 31, 2026
1d5f1ff
ci(project): restore read-only workspace validation
hifizz Aug 31, 2026
ed07333
ci(project): remove one-shot panel patch workflow
hifizz Aug 31, 2026
73dfcf0
feat(project): expose stable message anchors for provenance
hifizz Aug 31, 2026
b25d9f7
feat(project): locate and highlight artifact source message
hifizz Aug 31, 2026
eb72c3c
test(project): preserve workspace state across panel refresh
hifizz Aug 31, 2026
84367f2
ci(project): verify project panel workspace isolation
hifizz Aug 31, 2026
6abeeff
docs(openspec): complete project panel workspace tasks
hifizz Aug 31, 2026
4d878a5
test(project): cover workspace schema commands and repositories
hifizz Aug 31, 2026
eed024d
refactor(project): extract deterministic attachment context policy
hifizz Aug 31, 2026
9423d3b
refactor(project): apply pure attachment context policy
hifizz Aug 31, 2026
58fba19
test(project): make pdf retrieval policy injectable
hifizz Aug 31, 2026
07fdd67
test(project): cover deterministic project context policies
hifizz Aug 31, 2026
fddb626
ci(project): run project workspace database acceptance
hifizz Aug 31, 2026
1bdae60
test(project): cover workspace API isolation and bootstrap
hifizz Aug 31, 2026
5276376
ci(project): run workspace API integration
hifizz Aug 31, 2026
1ac26d5
test(project): cover project panel UI contract
hifizz Aug 31, 2026
53bae75
feat(evals): model project workspace context in agent cases
hifizz Aug 31, 2026
77e3bf9
feat(evals): seed project contract and project files
hifizz Aug 31, 2026
fcf62ed
test(evals): add project workspace coverage cases
hifizz Aug 31, 2026
ab35aeb
test(evals): verify project workspace production seed
hifizz Aug 31, 2026
d2efd6a
test(project): fix contract boundary generation setup
hifizz Aug 31, 2026
053d0f3
test(project): verify workspace history stability
hifizz Aug 31, 2026
b5730b0
test(project): prevent implicit artifact cross-thread context
hifizz Aug 31, 2026
e92a827
ci(project): run complete project workspace acceptance suite
hifizz Aug 31, 2026
19f8853
spec(project): clarify bootstrap isolation semantics
hifizz Aug 31, 2026
3c78503
spec(project): preserve empty bootstrap shell semantics
hifizz Aug 31, 2026
1dc0257
test(project): align bootstrap shell isolation semantics
hifizz Aug 31, 2026
fbb14c7
ci(project): run correct agent eval command
hifizz Aug 31, 2026
57bb1e8
eval(project): register workspace cases in manifests
hifizz Aug 31, 2026
2bc3997
spec(project): mark project workspace test suite complete
hifizz Aug 31, 2026
f97a3ea
test(project): verify workspace migration on legacy data
hifizz Aug 31, 2026
55a18c9
ci(project): verify migration compatibility and schema sync
hifizz Aug 31, 2026
2f0f58c
ci(project): capture generated workspace migration snapshot
hifizz Aug 31, 2026
391d83b
ci(project): add one-time drizzle snapshot repair
hifizz Aug 31, 2026
19adc44
fix(db): add project workspace drizzle snapshot
github-actions[bot] Aug 31, 2026
e88aeb2
ci(project): remove one-time snapshot repair
hifizz Aug 31, 2026
8002d59
ci(project): restore migration sync validation
hifizz Aug 31, 2026
0bfda9b
spec(project): mark migration validation complete
hifizz Aug 31, 2026
b5ee42d
ci(project): add release validation gates
hifizz Aug 31, 2026
95dca07
refactor(project): remove obsolete duplicate artifact drawer
hifizz Aug 31, 2026
167017d
refactor(project): remove effect-driven panel state sync
hifizz Aug 31, 2026
0a4a7df
ci(project): lint active project panel implementation
hifizz Aug 31, 2026
4d0713c
refactor(project): add thin legacy harness adapter
hifizz Aug 31, 2026
d402573
ci(project): lint legacy panel adapter too
hifizz Aug 31, 2026
ebf8003
refactor(ai): remove relay legacy environment fallback
hifizz Aug 30, 2026
a30b2c9
feat(chat): group model selector by provider
hifizz Aug 30, 2026
4a1d425
style: compact model selector popover
hifizz Aug 31, 2026
32fe44a
chore(db): remove PR migration artifacts
hifizz Sep 1, 2026
95b3dc6
feat(thread-chat): protect selection bubble draft from lossy dismissal
hifizz Sep 1, 2026
3750019
fix(thread-chat): restore selection bubble focus and entrance
hifizz Sep 1, 2026
2fc186a
style: 优化样式
hifizz Sep 1, 2026
1e58754
style: update markdown style
hifizz Sep 1, 2026
db9a507
style: 优化样式
hifizz Sep 2, 2026
86f9576
Merge branch 'p0-resume-messages' into refactor-arch
hifizz Sep 2, 2026
7c359b4
docs(composer): add issue 68 research handoff
hifizz Sep 1, 2026
e0ca368
docs(composer): define attachment demo MVP
hifizz Sep 1, 2026
df60826
spec(composer): scaffold attachment composer demo change
hifizz Sep 1, 2026
65a8380
spec(composer): add attachment demo proposal
hifizz Sep 1, 2026
8ac21df
spec(composer): define attachment demo requirements
hifizz Sep 1, 2026
f3e7e50
spec(composer): add attachment demo design
hifizz Sep 1, 2026
fd9a2e3
spec(composer): add attachment demo tasks
hifizz Sep 1, 2026
dd50fa6
feat(composer): apply attachment demo spec
hifizz Sep 1, 2026
7e311f6
Merge pull request #53 from hifizz/codex/research-project-workspace-d…
hifizz Sep 2, 2026
9370b2f
merge: resolve refactor-arch conflicts in PR #50
hifizz Sep 2, 2026
0133ca7
Merge pull request #50 from hifizz/codex/feat-agent-observability-eva…
hifizz Sep 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
78 changes: 78 additions & 0 deletions .agents/skills/ai-sdk/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
name: ai-sdk
description: 'Answer questions about the AI SDK and help build AI-powered features. Use when developers: (1) Ask about AI SDK functions like generateText, streamText, ToolLoopAgent, embed, or tools, (2) Want to build AI agents, chatbots, RAG systems, or text generation features, (3) Have questions about AI providers (OpenAI, Anthropic, Google, etc.), streaming, tool calling, structured output, or embeddings, (4) Use React hooks like useChat or useCompletion. Triggers on: "AI SDK", "Vercel AI SDK", "generateText", "streamText", "add AI to my app", "build an agent", "tool calling", "structured output", "useChat".'
---

## What the AI SDK Is

The AI SDK by Vercel (the `ai` package on npm) is a TypeScript toolkit for building AI applications. It provides a unified API across model providers for text generation, structured output, tool calling, agents, embeddings, and framework UI integrations.

- Repository: https://github.com/vercel/ai
- Documentation: https://ai-sdk.dev/docs

## Critical: Do Not Trust Your Own Memory

Whatever you remember about the AI SDK is likely outdated. The SDK changes frequently across versions - APIs are renamed, removed, and added. Your training data almost certainly contains obsolete APIs, deprecated patterns, and model IDs that no longer exist. UI hooks like `useChat` are among the most frequently changed APIs, so be especially careful with client code.

**Never write AI SDK code from memory.** Always verify every API, option, and pattern against the documentation and source code for the version that is actually installed in the project.

## Use the Bundled, Version-Matched Docs

The `ai` package ships its full documentation and source code inside `node_modules`. These always match the installed version, so trust them over anything you remember.

1. Ensure `ai` is installed. If `node_modules/ai/` does not exist, install **only** the `ai` package using the project's package manager (e.g. `pnpm add ai`). Install provider packages (e.g. `@ai-sdk/openai`) and framework packages (e.g. `@ai-sdk/react`) later, when the task requires them.
2. Read and grep the bundled docs at `node_modules/ai/docs/` and the source at `node_modules/ai/src/`.
3. Provider and framework packages bundle their own docs at `node_modules/@ai-sdk/<name>/docs/`.
4. If something isn't in the bundled docs, search https://ai-sdk.dev/docs. You can append `.md` to any docs page URL to get its markdown, and search via `https://ai-sdk.dev/api/search-docs?q=your_query`.
5. If you cannot find support for an answer in the docs or source, say so explicitly — do not guess.

## AI Gateway: The Fastest Way to Start

The Vercel AI Gateway is the fastest way to get started with the AI SDK. It provides access to models from OpenAI, Anthropic, Google, and other providers through a single API, without installing provider packages or managing multiple API keys.

To set it up:

1. Authenticate with OIDC (for Vercel deployments) or get an AI Gateway API key.
2. Provide it to your app via the `AI_GATEWAY_API_KEY` environment variable.
3. Reference models with `provider/model` strings.

For exact setup, authentication, and usage, read the bundled guide and the AI Gateway docs.

### Choosing a Model

Never use model IDs from memory — models are released and retired frequently. Fetch the current list before writing code that references a model. Do not truncate the list (e.g. with `head`) so you can find the newest models:

```bash
# All available models
curl -s https://ai-gateway.vercel.sh/v1/models | jq -r '.data[].id'

# Filter by provider (e.g. anthropic, openai, google)
curl -s https://ai-gateway.vercel.sh/v1/models | jq -r '[.data[] | select(.id | startswith("anthropic/")) | .id] | reverse | .[]'
```

When multiple versions of a model exist, prefer the one with the highest version number.

## Building and Consuming Agents

Use the SDK's built-in agent abstraction (such as `ToolLoopAgent`) rather than hand-rolling tool-calling loops. For end-to-end type safety, infer the UI message type from your agent definition when consuming it on the client (e.g. with `useChat`). Consuming an agent is framework-specific: check `package.json` to detect the stack, then follow the matching quickstart.

Look up the current agent, tool, and type-safety APIs in the bundled docs (`node_modules/ai/docs/`, especially the agents section) or at https://ai-sdk.dev/docs.

## DevTools

AI SDK DevTools captures your AI SDK calls - requests, responses, tool calls, token usage, and multi-step runs - so you can inspect exactly what your agents do. Use it while developing to debug generations. It is a separate package and is intended for local development only.

For setup instructions, read the bundled DevTools documentation.

## Keep the SDK Current

Outdated installs are the most common source of errors. Compare the installed version against the latest:

- **Installed:** the `version` field in `node_modules/ai/package.json`.
- **Latest:** run `npm view ai version`.

If the installed version is a major version (or more) behind the latest, tell the user they are on an old release, and recommend upgrading before continuing. Migration guides are at https://ai-sdk.dev/docs/migration-guides.

## After Making Changes

Run the project's type checker. Be minimal — only set options that differ from the defaults, checking docs or source for the defaults rather than over-specifying. Most type errors come from remembered, now-changed APIs; re-check the current docs and source when they occur.
121 changes: 121 additions & 0 deletions .agents/skills/debug-root/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
---
name: debug-root
description: Use for complex, high-risk, or ambiguous debugging and code-fix tasks, especially when the user requires diagnosis before changes, explicit solution confirmation, preservation of an existing design, or comparison with reference implementations. 适用于复杂、高风险或边界不清的调试与修复任务。
---

# 四阶段调试

按顺序执行:确认问题 → 诊断问题 → 确认方案 → 具体实现。除非用户已明确提供某阶段所需决定,不得跳过该阶段。

## 1. 确认问题

用简短文字复述目标、范围和已有约束。

- 若缺少的事实或选择会实质改变实现,先提出一个具体的澄清问题。
- 若任务已足够明确,陈述工作理解后直接进入只读诊断。
- 可开始诊断不代表可开始修改。

## 2. 诊断问题

只使用读取、搜索、复现和无写入验证。不编辑文件、不格式化、不安装依赖、不生成文件、不提交代码。

### 2a. 定位直接原因

在实际实现中寻找证据,定位触发当前现象的直接代码路径。将根因表达为通用不变量,而不是为某个样例、标签或组件打补丁。

### 2b. 横向扩散评估

以直接原因中涉及的 pattern / 抽象 / 接口为锚点:

- 同一 pattern 在项目中还有哪些使用点?
- 这些使用点是否共享同一缺陷条件?
- 如果存在共性缺陷,记录受影响范围及具体位置。

若无扩散证据,明确写"横向扫描未发现扩散",不要强行填充。

### 2c. 纵向归因

追问:为什么这段代码会被写成这样?

- 接口设计是否缺乏约束(类型、校验、契约)?
- 是否缺少防御机制(lint 规则、运行时断言、测试覆盖)?
- 是否属于已知的架构短板或历史 workaround?

仅在证据充分时归因,不要强行填充。

### 参考实现

将参考实现视为诊断证据,不视为迁移或改造授权。

## 3. 确认方案

### 直接原因

一句话:什么代码在什么条件下产生了当前现象。

### 修复层级判断

| 层级 | 描述 | 本次是否适用 | 依据 |
|------|------|-------------|------|
| 实例修复 | 只修当前触发点 | — | — |
| 抽象修复 | 修底层 pattern / 共享模块 | — | — |
| 防御机制 | 加类型约束 / lint / 测试防止复发 | — | — |

### 修复决策

基于诊断结果,从以下三条路径中选择并论证:

**路径 A:不修复**

- 适用条件:预期行为被误报 / 修复成本远超问题危害 / 根因不在本系统 / 模块即将下线。
- 输出:说明为什么当前行为是合理的,或为什么修复的代价不成立。必须引用具体证据(代码注释、设计文档、产品 spec、历史 issue、数据频率),不允许仅凭推测得出"不需要修"的结论。
- 如果根因在外部系统,说明应由谁处理。

**路径 B:最小修复(治标)**

- 适用条件:问题真实存在、无扩散、无架构短板、修复成本低。
- 输出:具体改动 + 每项改动对应的不变量 + 要维持不变的现有机制和边界。
- 如果治标意味着不根治,说明残留风险。

**路径 C:系统性修复(根治)**

- 适用条件:存在扩散、存在架构短板、问题会反复出现。
- 输出:改动范围 + 受影响模块列表 + 每项改动对应的不变量。
- 明确标注哪些超出当前任务边界,建议后续处理。

**每条路径必须附带:**

- **成本**:改动量、风险、引入的复杂度。
- **收益**:解决的问题范围、防止的未来故障。
- **残留风险**:选这条路之后还剩什么没解决。

### 影响范围和验证方法

说明改动波及的模块、路径,以及验证通过的标准(测试命令、手动复现步骤等)。

### 决策原则

选择路径时以代码证据和产品逻辑为准,不以用户的初始判断为准。若诊断结论与用户预期矛盾,直接陈述矛盾及证据,不要回避或迎合。

---

除非用户已经明确确认这一准确方案,否则以 **"等待确认方案。"** 结束。不要实现。

## 4. 具体实现

只实现已确认的范围并运行约定的验证。

- 不得趁机换架构、扩大范围或重构无关代码。
- 实现中若发现新的关键选择,停止修改并回到"确认方案"。
- 仅在用户明确要求时提交、推送或部署。

## 用户质疑

将"为什么""不满意""重新考虑"等消息视为诊断阶段输入。

- 只回答问题或补充诊断。
- 不得修改代码、不得换方案、不得把质疑视为授权。

## 快速模式

若用户显式表达"快速修""直接改""不用分析"等意图,跳过 2b 和 2c,仅执行 2a → 输出最小修复方案 → 确认后实现。
108 changes: 108 additions & 0 deletions .agents/skills/migrate-ai-sdk-v6-to-v7/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
---
name: migrate-ai-sdk-v6-to-v7
description: Migrate applications from AI SDK 6.x to AI SDK 7.0. Use when upgrading Vercel AI SDK packages, fixing v7 migration errors, or when the user mentions AI SDK v6, v7, upgrade, migration, breaking changes, system to instructions, fullStream, telemetry, tool context, or finalStep.
---

## AI SDK 6 to 7 Migration

Use `content/docs/08-migration-guides/23-migration-guide-7-0.mdx` from the AI SDK repo as the source of truth. This skill is the working checklist; read the guide for exact examples or when behavior is unclear.

## Migration Workflow

1. Ensure the user has a clean backup or committed baseline before editing.
2. Inspect `package.json` and lockfiles to identify installed `ai`, `@ai-sdk/*`, provider, UI, MCP, and telemetry packages.
3. Upgrade AI SDK packages to latest versions, and add `@ai-sdk/otel` only if the project uses OpenTelemetry spans.
4. Update runtime and module assumptions: Node.js must be `>=22`, and AI SDK packages are ESM-only. Replace `require()` imports with ESM imports and add `"type": "module"` or use `.mjs` where needed.
5. Search for the v6 patterns below, migrate only the code that exists, then run typecheck and targeted tests.

Prefer behavior-preserving changes. When v7 changes semantics, decide whether the app wants the new all-steps behavior or the previous final-step-only behavior.

## Core API Changes

- `experimental_customProvider` -> `customProvider`.
- `experimental_generateImage` -> `generateImage`; `Experimental_GenerateImageResult` -> `GenerateImageResult`.
- `experimental_transcribe` -> `transcribe`; `Experimental_TranscriptionResult` -> `TranscriptionResult`.
- `experimental_generateSpeech` -> `generateSpeech`; `Experimental_SpeechResult` -> `SpeechResult`.
- `experimental_output` option/result -> `output` option/result.
- `CallSettings` -> `LanguageModelCallOptions & Omit<RequestOptions, 'timeout'>`; `prepareCallSettings` -> `prepareLanguageModelCallOptions`.
- `stepCountIs` -> `isStepCount`.

## Prompts and Steps

- Rename top-level `system` to `instructions` for `generateText`, `streamText`, `generateObject`, `streamObject`, and `streamUI`.
- Move `{ role: 'system' }` messages from `prompt` or `messages` into top-level `instructions`. Only use `allowSystemInMessages: true` for trusted persisted messages.
- Rename `experimental_prepareStep` to `prepareStep`.
- In `prepareStep`, rename returned `system` to `instructions`.
- In `experimental_repairToolCall`, use `{ instructions }` instead of `{ system }`.
- Audit `prepareStep` behavior: returned `instructions` and `messages` now carry forward into later steps. If code depended on one-step-only overrides, rebuild from `initialInstructions`, `initialMessages`, and `responseMessages` explicitly.

## Lifecycle Callbacks

- `experimental_onStart` -> `onStart`.
- `experimental_onStepStart` -> `onStepStart`.
- `onFinish` -> `onEnd`.
- `onStepFinish` -> `onStepEnd`.
- For `embed`, `embedMany`, and `rerank`, `experimental_onFinish` -> `onEnd`.
- Callback event fields use `instructions` instead of `system`.

## Usage, Telemetry, and Include Options

- `usage.cachedInputTokens` -> `usage.inputTokenDetails.cacheReadTokens`.
- `usage.reasoningTokens` -> `usage.outputTokenDetails.reasoningTokens`.
- OpenTelemetry moved out of `ai`; install `@ai-sdk/otel` and call `registerTelemetry(new OpenTelemetry(...))` at app startup.
- Telemetry is enabled by default once an integration is registered. Remove redundant `isEnabled: true`; use `isEnabled: false` to opt out per call.
- Move `experimental_telemetry.tracer` into the `OpenTelemetry` constructor.
- `experimental_telemetry` -> `telemetry`.
- Telemetry integration callbacks: `onRerankFinish` -> `onRerankEnd`, `onEmbedFinish` -> `onEmbedEnd`. Update tracing-channel subscribers for the same event type names.
- `experimental_include` -> `include`.
- `includeRawChunks` -> `include.rawChunks`.
- Request and response bodies are excluded by default. If code reads `request.body` or `response.body`, opt in with `include.requestBody` and, for `generateText`, `include.responseBody`.

## Streaming, Messages, and Tools

- `StreamTextResult.fullStream` -> `stream`.
- `streamText` `onChunk` now receives all stream parts, including lifecycle, boundary, finish, abort, and error parts. Guard by `chunk.type` before assuming text/tool/raw content.
- `step.response.messages` is no longer accumulated across previous steps. Use `result.responseMessages` for the full response message history, or flatten `result.steps`.
- Tool execution callbacks: `experimental_onToolCallStart` -> `onToolExecutionStart`, `experimental_onToolCallFinish` -> `onToolExecutionEnd`.
- Tool callback `experimental_context` -> `context`.
- Split shared runtime data from tool-specific data: use top-level `runtimeContext` for orchestration state, declare per-tool `contextSchema`, and pass per-tool values through `toolsContext`.
- Move `needsApproval` from `tool()` / `dynamicTool()` into per-call or agent `toolApproval`.
- `experimental_activeTools` -> `activeTools`.
- `ToolCallOptions` -> `ToolExecutionOptions`.
- `isToolOrDynamicToolUIPart` -> `isToolUIPart`.

## Content Parts and Reasoning

- Tool result `{ type: 'media' }` is removed; use `{ type: 'file-data' }`.
- Migrate `toModelOutput` `image-*`, `file-*`, `file-id`, and `image-file-id` variants to canonical `{ type: 'file', mediaType, data: { type: 'data' | 'url' | 'reference', ... } }`.
- User message `{ type: 'image', image, mediaType? }` is deprecated; use `{ type: 'file', mediaType: 'image' | 'image/*', data }`.
- Add support for the new `reasoning-file` content type in exhaustive switches, renderers, serializers, and validators.
- When adopting top-level `reasoning`, remove overlapping provider-specific reasoning settings from `providerOptions` unless provider-specific settings intentionally take precedence.

## Multi-Step Result Shape

- `result.usage` now includes all steps; `result.totalUsage` is deprecated. Use `result.finalStep.usage` for final-step-only usage.
- Top-level `content`, `toolCalls`, `staticToolCalls`, `dynamicToolCalls`, `toolResults`, `staticToolResults`, `dynamicToolResults`, `files`, `sources`, and `warnings` now include all steps. Use `finalStep` for previous final-step-only behavior.
- Top-level `reasoning`, `reasoningText`, `request`, `response`, and `providerMetadata` are deprecated for final-step data. Use `result.finalStep.*`; for `streamText`, await `result.finalStep`.
- Apply the same result-shape rules to `onEnd` events.

## Stream Response Helpers

The `streamText` result helper methods are deprecated. Replace result methods with top-level stateless helpers:

- `result.toUIMessageStream(...)` -> `toUIMessageStream({ stream: result.stream, ... })`.
- `result.toUIMessageStreamResponse(...)` -> `toUIMessageStream(...)` plus `createUIMessageStreamResponse({ stream })`.
- `result.pipeUIMessageStreamToResponse(response, ...)` -> `toUIMessageStream(...)` plus `pipeUIMessageStreamToResponse({ response, stream })`.
- `result.toTextStreamResponse()` -> `toTextStream({ stream: result.stream })` plus `createTextStreamResponse({ stream })`.
- `result.pipeTextStreamToResponse(response)` -> `toTextStream({ stream: result.stream })` plus `pipeTextStreamToResponse({ response, stream })`.

## Package-Specific Checks

- MCP: `MCPTransportConfig.redirect` now defaults to `'error'`. Only set `redirect: 'follow'` for trusted MCP servers that rely on redirects.
- Vue: `@ai-sdk/vue` `Chat` class is deprecated. Prefer `useChat`, including getter/ref init for reactive chat inputs.
- Anthropic and `@ai-sdk/google-vertex/anthropic`: `providerMetadata.anthropic.cacheCreationInputTokens` was removed. Use `usage.inputTokenDetails.cacheWriteTokens`; raw Anthropic usage remains at `finalStep.providerMetadata?.anthropic?.usage`.
- Google: rename `GoogleGenerativeAI*` types, classes, and functions to `Google*`, e.g. `createGoogleGenerativeAI` -> `createGoogle`. The `google` entry point is unchanged.

## Validation

Run the project typecheck after edits, then the smallest relevant test suite. Also smoke-test streaming, chat UI, tool execution, telemetry, and multi-step flows if the migration touched them. If type errors remain, search the migration guide for the exact removed or renamed symbol before inventing a workaround.
Loading
Loading