Repository navigation
chore(react-textarea): mark CopilotTextarea declarations as deprecated - #6836
BenTaylorDev wants to merge 1 commit into
Conversation
The generated v1 notices tag the re-export specifiers in
`packages/react-textarea/src/index.tsx`, but the declarations themselves
carried no `@deprecated` JSDoc. Two consequences:
- Resolving `CopilotTextarea` or `CopilotTextareaProps` through the
components barrel or at the definition gave no IDE warning.
- More importantly, the dts bundler collapses the tagged specifiers into
a bare `export { ... }`, so the published `dist/index.d.cts` and
`dist/index.d.mts` shipped zero `@deprecated` tags. npm consumers saw
no deprecation at all, including through the package root.
Tag both declarations with the same text the generator emits. The
file-level generated notice is unaffected, so
`scripts/deprecations/v1-source-notices.mjs --check` stays clean and
regeneration is a no-op for this file.
Refs #6819
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe change adds ChangesCopilotTextarea deprecation
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to This change only adds deprecation guidance to the CopilotTextarea declarations; it does not alter runtime behavior or package exports. The supplied checks pass, and no actionable merge-blocking risk remains beyond normal review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Linked Issues checkExplanation The changes satisfy issue Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkit/angular
@copilotkit/channels
@copilotkit/channels-core
@copilotkit/channels-discord
@copilotkit/channels-intelligence
@copilotkit/channels-slack
@copilotkit/channels-teams
@copilotkit/channels-telegram
@copilotkit/channels-ui
@copilotkit/channels-whatsapp
@copilotkit/core
@copilotkit/react-core
@copilotkit/react-native
@copilotkit/react-textarea
@copilotkit/react-ui
@copilotkit/runtime
@copilotkit/runtime-client-gql
@copilotkit/sdk-js
@copilotkit/shared
@copilotkit/sqlite-runner
@copilotkit/voice
@copilotkit/vue
@copilotkit/web-components
@copilotkit/web-inspector
commit: |
|
Size Change: +333 B (+0.02%) Total Size: 1.58 MB 📦 View Changed
ℹ️ View Unchanged
|
…s, v1 actions, textarea, docs) (#6931) Fixes the surfaces orphaned by the v1.50.0 re-implementation that fail **silently or wrongly**, where a deprecation notice is not an adequate answer. Full context and the other findings: #6408. ## What changed **`50f5384` — the CopilotTextarea insertion crash** CopilotTextarea's insertion hook had its request stubbed out with an object literal that has no `asStream`, then called `runtimeClient.asStream(...)` on it. Returns an empty stream now, matching the sibling autosuggestions hook, with a one-time warning. This commit also carried the MCP `sse` auth-header fix. That half was contributed independently and merged to main as e9cbe1c (#6930), so `6df3b5c` removes it here — the merged result is identical either way. **`9331641` — adapter provider config for ollama, unify, google** `3f8b5e2360` fixed adapters discarding their configuration by adding `getLanguageModel()`, and reached OpenAI, Anthropic and Groq. This extends it to three more. `f755fa7` below closes two further gaps this commit left. `ExperimentalOllamaAdapter` also gains a `baseUrl` option — it previously had no way to name a host, which is why pointing `OPENAI_BASE_URL` at Ollama was the only workaround. `BedrockAdapter` is deliberately untouched: it needs `@ai-sdk/amazon-bedrock`, a new dependency on a deprecated adapter, which is a separate decision. **`6dfae2b` — v1 `actions` and `mcpServers` execute again** This replaces the earlier approach in `5bb9b77`, which threw on any `actions` or `mcpServers` config. **That premise was wrong.** The executor deleted in v1.50.0 (`remote-actions.ts`) handled *remote* endpoints over `POST actions/execute`. In-process `action.handler` and the live `MCPTool.execute` returned by `createMCPClient` were never part of it — only the wiring to them was lost. `getToolsFromActions` dropped `action.handler` and `getToolsFromMCP` dropped `tool.execute`, substituting `execute: () => Promise.resolve()` in both. The model called the tool, the result was `undefined`, `JSON.stringify(undefined)` is not a string, and the emitted `TOOL_CALL_RESULT` lost its required `content` — reaching the browser as a Zod error. Both are now restored. Where an action genuinely cannot run — no `handler`, or a handler that returns nothing — `execute` returns a readable string instead of `undefined`, so the tool result stays well formed. `mcpServers` is also attached independently of `actions`. The old `if (actions)` gate meant an MCP-only runtime never received its tools at all. **`079a939` — tool attachment is idempotent** `assignToolsToAgents` appended unconditionally and mutates the agent. The endpoint factory calls `handleServiceAdapter` every time it runs, and the documented v1 route builds the endpoint inside the request handler, so a module-scope runtime lands there once per request. Three requests advertised three copies of every action to the model. Harmless while `execute` was a no-op; not harmless now. Names the agent already carries are skipped, which also leaves a tool the agent defines itself in place instead of shadowing it. **`acc518f` — MCP endpoints retry after a failed first connection** `getToolsFromMCP` cached an empty tool list when `createMCPClient` threw. A server briefly unreachable at first resolution stayed toolless for the life of the runtime, even after it recovered. **`f755fa7` — Unify's placeholder key, Google's dropped `apiVersion`** Two gaps in `9331641`, both pre-existing and both untested. `UnifyAdapter` stored the literal `"UNIFY_API_KEY"` — the *name* of the environment variable — whenever no key was passed, and ignored the variable itself. Both `process()` and `getLanguageModel()` read that field, so the default path authenticated with a placeholder and came back 401. Restoring execution is what made it reachable. `GoogleGenerativeAIAdapter` accepted an `apiVersion` option and dropped it, because `createGoogleGenerativeAI` has no such option and carries the version on the base URL instead. That one is honoured **only when the caller sets it**. The provider default is `v1beta`, and that has been the live default ever since `getLanguageModel` started routing around `process()`; forcing the adapter's documented `"v1"` would strand models `v1` does not serve. A test pins that and fails if the default is ever set unconditionally. **`717f400` — docs** `mcp.mdx` taught the v1 `createMCPClient` path; the `ai-powered-textarea` tutorial sits under `integrations/built-in-agent` where it reads as current v2 guidance; `CopilotKitRemoteEndpoint`'s docstring did not say its `actions` are never invoked. That last one stays accurate — `CopilotKitRemoteEndpoint` actions travel over `POST actions/execute`, and that client genuinely was deleted. ## Testing Every claim below was produced by running the code. **v1 tool execution — 9 unit tests plus 2 end-to-end.** Each was written before the fix, watched failing, and then mutation-checked: reverting the mechanism it covers makes exactly that test fail. ``` ✓ src/v1-deprecated/lib/runtime/__tests__/v1-tool-execution.test.ts (9 tests) ✓ src/v1-deprecated/lib/runtime/__tests__/v1-tool-execution-e2e.test.ts (2 tests) Test Files 2 passed (2) Tests 11 passed (11) ``` The end-to-end pair is the one that matters. The unit tests only prove the tool definitions carry a working `execute`; they do not prove `BuiltInAgent` ever calls it. The e2e test resolves the agent, runs it, takes the tool the AI SDK actually received, invokes it the way the SDK does, and replays the output through the real emission path in `agent/index.ts:1729`. Reverting `execute` to `() => Promise.resolve()` makes it reproduce the reported bug exactly: ``` AssertionError: expected 'undefined' to be 'string' ``` `JSON.stringify(undefined)` returns `undefined` rather than throwing, so the `try/catch` at the emission site never fires and `content` is left unset. That is #2915 and #3198, through the real code path. **Tool duplication and MCP recovery**, measured on one runtime instance: ``` actions, 3 endpoint constructions before: 3 copies of `greet` after: 1 mcpServers, transient outage before: 1 connect attempt, tools 0/0/0 (never recovers) after: 2 connect attempts, tools 0/0/1 (recovers) ``` Recovery lands one resolution after the reconnect, because `handleServiceAdapter` chains onto the previous promise. The test asserts that real sequence. **Adapters** — 6 tests. Two caught real bugs in the fix itself: the google implementation first crashed on `this` before `super()`, then returned the *default* model, because `this.model` was only assigned inside the chain closure that does not run until a request arrives. ``` ✓ tests/service-adapters/ollama/ollama-adapter-language-model.test.ts (3 tests) ✓ tests/service-adapters/unify/unify-adapter-language-model.test.ts (3 tests) ✓ tests/service-adapters/google/google-adapter-language-model.test.ts (4 tests) Test Files 12 passed (12) Tests 54 passed (54) ``` The three added for `f755fa7` were mutation-checked the same way. One of them is a guard rather than a fix: forcing Google's `baseURL` unconditionally makes it fail, so the decision to leave the provider default alone cannot be undone silently. **Public API manifest** regenerated for the new `baseUrl` key on `OllamaAdapterOptions`. Without it the manifest test reddened all six unit shards. **Whole runtime suite, before and after:** identical — `16 failed | 145 passed` test files, `3 failed | 2160 passed` tests. The 16 are suite-collection errors from unbuilt `@copilotkit/channels*` in a worktree; the 3 are pre-existing `google-genai-adapter` failures that fail identically at the merge base. `tsc` reports no errors in any edited file, and `oxlint` warning counts are unchanged. ## Notes for review - **`LangChainAdapter` still throws.** `getLanguageModel` routes *around* `process()` rather than restoring it, and a `chainFn` cannot be expressed as a pre-configured `LanguageModel`. #3217's real ask needs a design decision, not another adapter method. - **CopilotTextarea `@deprecated` JSDoc is not here.** That is what #6836 did and it was closed; not re-landing it without knowing why. - **This will conflict with the draft stack #6653 → #6654 → #6655**, which touches `copilot-runtime.ts` and 32 files under `service-adapters/`. Landing this first and rebasing that stack is the agreed sequence. ## What this closes **Closes #2915** — Express backend actions. All four v1 integrations route through `handleServiceAdapter`; `copilotRuntimeNodeExpressEndpoint` and `copilotRuntimeNestEndpoint` both delegate to `copilotRuntimeNodeHttpEndpoint`. The reporter's exact symptom — `TOOL_CALL_RESULT` with no `content` — is what the e2e test reproduces and the fix removes. **Closes #3198** — the same defect reported against the function form of `actions`. The function form is invoked and its handlers now run. **Closes #2930** — `ExperimentalOllamaAdapter` builds a real model and accepts a `baseUrl`. *Correcting my own earlier draft, which said these should be `Refs` because the PR only made them fail loudly. They now execute, so they close.* ## What this does not close **Refs #7116** — the v1 shim resolves agents once and so cannot use the per-request agent factory that #2941 delivered in v2. Filed off the back of this PR. It is what stands between here and per-request MCP credentials, a per-run client lifecycle, and dynamic `actions` receiving real request properties. **Refs #2407, #2409** — both sit on the v1 MCP path. That path executes again now, so neither is unreachable any more, but neither is repaired. #2407 needs per-request client keying, and #2409 needs server-name prefixing. Both are covered by the plan in #7116. **Refs #3217** — `LangChainAdapter` still throws. Needs a design call. **Refs #6408** — the tracker. **#6927 is already closed** — fixed on main by #6930, not by this branch. The duplicated hunk was removed here, so nothing in this PR closes it. **Not addressed here at all:** #6928, the single-route multipart rejection that makes `/transcribe` unreachable. That one hits v2 as well and needs its own design decision. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added language-model support for Google, Unify, and Ollama adapters, including custom Ollama server URLs. - Improved runtime action and MCP tool execution, including retries and duplicate-tool prevention. - **Bug Fixes** - Preserved adapter credentials, API versions, and model configuration. - Ensured tool execution consistently returns valid results. - **Deprecations** - CopilotTextarea autosuggestions and insertion no longer connect to a backend. - Documented migration from legacy MCP and action APIs to agent-level configuration. - **Tests** - Added coverage for adapter configuration and v1 tool execution. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Closes #6819
Problem
@copilotkit/react-textareais a deprecated v1 package.scripts/deprecations/v1-source-notices.mjsalready writes two things for it:/* V1 SDK DEPRECATED */block comment at the top ofcopilot-textarea.tsx— attached to no symbol, so no IDE reacts to it;@deprecatedJSDoc on the re-export specifiers inpackages/react-textarea/src/index.tsx.The declarations of
CopilotTextareaandCopilotTextareaPropshad no@deprecatedtag of their own. That has a bigger consequence than the issue anticipated.In-repo: resolving either symbol through the components barrel, or hovering it at its definition, produced no deprecation warning.
For npm consumers: nothing warned at all, including through the package root. The dts bundler collapses the tagged specifiers in
index.tsxinto a single bare re-export line, so the tags never reach the shipped declarations:A build of
mainemits zero@deprecatedtags intodist/index.d.ctsanddist/index.d.mts.Change
Add
@deprecatedJSDoc to both declarations, using the exact textrenderDeprecationJsDocemits for an export with no 1:1 v2 replacement (scripts/deprecations/v1-public-api.mjs:888).CopilotTextareaPropshad a//line comment; it is promoted to JSDoc so the tag binds to the declaration, with its original wording kept.Comments only. No runtime behavior changes, no exports added, renamed, or removed.
Testing
1. The warning now resolves at every import path — with a before/after mutation check.
Probe built on the TypeScript API, walking the alias chain the way tsserver does when it decides to strike a symbol through. Run against
HEAD(baseline) and against this branch:The root row is the control: it warns in both runs, so the probe is reading real resolution rather than reporting a constant.
2. Emitted declarations retain the tags (the issue's third scope item).
Both land directly on the declarations:
3. The generator stays clean and regeneration is a no-op for this file.
v1-source-notices.mjsrebuilds a source file asnotice + "\n\n" + body, stripping only the leading notice block, so JSDoc further down survives. Confirmed empirically:The 11 files that script does report stale are pre-existing on
mainand untouched here.4. Package build and type checks pass.
Not in this PR
The same gap affects the other 12 exports of this entrypoint —
BaseCopilotTextarea,AutosuggestionsConfig, and the rest also ship no@deprecatedtag indist. #6819 scopes to the twoCopilotTextareasymbols, so this PR does too.The durable fix is for
v1-source-notices.mjsto emit per-symbol@deprecatedJSDoc onto the declarations, not only onto entrypoint specifiers — worth a follow-up issue, since hand-tagging 96 declaration files across react-core, react-ui, runtime, and react-textarea does not scale.🤖 Generated with Claude Code
Summary by CodeRabbit