Run prettier on ~1,865 files across examples/ to match the monorepo's
formatting standards. These files were imported as-is from standalone
repos that used different prettier configs.
- gemini/stack_agent.py: initialize tool_calls/tool_msg before try
block, guard usage with null check to prevent NameError on failure
- gemini/posts_generator_agent.py: use async generate_content to avoid
blocking event loop, guard grounding_metadata access, replace bare
except with explicit bounds check, remove dead router_function and
redundant static edges
- gemini/app/api/chat/route.ts: remove dead OpenAI route from Gemini
example (mislabeled as Gemini-powered, no frontend references it)
- gemini/package.json: remove unused @ai-sdk/openai, ai, zod deps
- langgraph-python/agent.py: remove debug print(state), move docstring
to first position so chat_node.__doc__ works
- textarea tutorial: fix StackBlitz URLs pointing to use-tasks.tsx
instead of use-emails.tsx
SVG files are text-based XML averaging ~218 bytes each. LFS tracking
adds per-file HTTP fetch overhead with no storage benefit, suppresses
git diff output, and breaks tutorial clone instructions that use
GIT_LFS_SKIP_SMUDGE=1 (users get LFS pointers instead of icons).
- base-command: wrap checkCLIVersion() fetch in try-catch so CLI
doesn't crash when offline (version check is non-critical)
- init: forward argv to Create instead of dropping all flags, remove
misleading flag definitions (init is just a deprecated redirect)
- detect-endpoint-type: fix Promise.all destructuring (5 promises but
only 4 variables caused isCopilot to receive the LangGraph FastAPI
result), add missing isMCP branch, use isLangGraphFastAPI result
- auth.service: validate OAuth state parameter before tracking analytics
with user data, add reject()+server.close() on state mismatch so the
Promise settles instead of hanging the CLI forever
- create.test: fix quote-style assertion to match prettier output
- Remove copy-paste triplication in scaffoldAgent (LangSmith block
duplicated twice, causing duplicate .env entries and redundant writes)
- Update AgentTemplates URLs to point to monorepo paths instead of
archived standalone repos
- Fix flags.projectName → args.projectName in banner logic (projectName
is an Args field, not Flags)
- Remove stale trpc-cli path mapping and project reference from
tsconfig.json (package doesn't exist in this monorepo)
Migrate the copilotkit CLI (npx copilotkit create/init/dev) from
CopilotCloud into packages/v1/cli. TEMPLATE_REPOS updated to use
monorepo subdirectory sparse checkout for all CopilotKit-owned
templates, with tarball fallback for external repos (ag2).
Add package rules to group examples/** dependency updates into weekly
Monday PRs. CopilotKit package bumps are tracked separately. Legacy
examples/v1/ and v2/ directories are excluded from both rules.
Rewrite all standalone repo URLs to monorepo paths across 18 doc files
and the root README. Tutorial clone instructions now use
GIT_LFS_SKIP_SMUDGE=1 and point to examples/ subdirectories. Fix
pre-existing copy-paste bug in textarea tutorial and stale branch refs.
migrate-demos.sh: automates shallow clone + cleanup + copy for all 73
repos, with --group and --dry-run support.
archive-demo-repos.sh: updates each standalone repo's README with a
deprecation notice pointing to the monorepo location, then archives it.
Exits non-zero on any failures.
Mark all publishable @copilotkitnext/* packages as deprecated in
package.json, pointing users to the @copilotkit/* equivalents.
V2 features will be available under the /v2 subpath.
Affected packages: shared, core, agent, angular, react, runtime,
sqlite-runner, web-inspector.
Adds a new `runTool()` method to `CopilotKitCore` that allows
programmatic execution of registered frontend tools without requiring an
LLM turn. This enables UI-driven tool invocations (e.g., button clicks
triggering tool handlers) while maintaining proper message history and
subscriber notifications.
Key changes:
- Extract `executeToolHandler` helper from duplicated logic in
`executeSpecificTool` to share with `runTool`
- Add `runTool()` on `RunHandler` with tool/agent lookup, message
creation, handler execution, and optional follow-up support
- Add `TOOL_NOT_FOUND` and `AGENT_NOT_FOUND` error codes
- Add `CopilotKitCoreRunToolParams` and `CopilotKitCoreRunToolResult`
types
- Add delegation method on `CopilotKitCore`
- Add 16 comprehensive tests covering all runTool behaviors
- Document runTool() params, return value, and usage in useCopilotKit.mdx
- Add tool-from-button example to programmatic-control.mdx
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove throw on isArgumentError — matches main's behavior where parse
errors are emitted via subscribers and the run continues, rather than
crashing.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds a new `runTool()` method to `CopilotKitCore` that allows programmatic
execution of registered frontend tools without requiring an LLM turn. This
enables UI-driven tool invocations (e.g., button clicks triggering tool
handlers) while maintaining proper message history and subscriber notifications.
Key changes:
- Extract `executeToolHandler` helper from duplicated logic in
`executeSpecificTool` to share with `runTool`
- Add `runTool()` on `RunHandler` with tool/agent lookup, message creation,
handler execution, and optional follow-up support
- Add `TOOL_NOT_FOUND` and `AGENT_NOT_FOUND` error codes
- Add `CopilotKitCoreRunToolParams` and `CopilotKitCoreRunToolResult` types
- Add delegation method on `CopilotKitCore`
- Add 16 comprehensive tests covering all runTool behaviors
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
## Summary
- **Root cause**: `CopilotKitProvider`'s `didMountRef` pattern breaks
under React Strict Mode — refs persist across the simulated
unmount/remount cycle, causing the provider's `setRenderToolCalls`
effect to overwrite registrations from `useFrontendTool` and
`useRenderTool` hooks
- **Fix**: Split render tool call storage in `CopilotKitCoreReact` into
two independent layers (prop-based vs hook-based) so the provider and
hooks never overwrite each other
- **Also includes**: Python SDK fix for
`langchain_messages_to_copilotkit` always emitting assistant messages
when AIMessage has tool_calls (independent correctness improvement)
## Details
The `didMountRef` guard in `CopilotKitProvider` skips setter effects on
first mount to avoid overwriting child hook registrations. Under React
Strict Mode (dev only), the mount→unmount→remount cycle leaves
`didMountRef.current = true`, so on remount the provider's effect fires
`setRenderToolCalls(allRenderToolCalls)` — which only contains
prop-based entries — overwriting whatever
`useFrontendTool`/`useRenderTool` just registered.
The fix introduces two new methods on `CopilotKitCoreReact`:
- `addHookRenderToolCall(entry)` — used by hooks
- `removeHookRenderToolCall(name, agentId)` — used by
`useHumanInTheLoop` cleanup
The `renderToolCalls` getter merges both layers with a cached result for
`useSyncExternalStore` referential stability. The `didMountRef` pattern
continues to work as before for prop-based entries — this fix eliminates
the race without changing the provider's effect ordering.
## Test plan
- [x] New test: `useFrontendTool` render registration survives
StrictMode remount (was failing before fix)
- [x] New test: hook + prop render entries coexist through StrictMode
remount
- [x] New test: hook render entries survive provider prop changes
- [x] All 799 existing tests pass (46 files)
- [x] Manual verification: "Get Help" button renders on initial load and
after disconnect/reconnect
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Same fix as zod-regression — the mock was missing addHookRenderToolCall
and removeHookRenderToolCall methods.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The mock was missing addHookRenderToolCall/removeHookRenderToolCall methods
introduced by the separate hook vs prop render tool call storage refactor.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Address review feedback: remove `as ReactToolCallRenderer` cast in
useFrontendTool by guarding with `tool.parameters` check (matching
CopilotKitProvider's pattern). Remove unused ReactToolCallRenderer
imports from use-frontend-tool.tsx and use-render-tool.tsx.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Avoid emitting spurious empty assistant messages for tool-call-only
AIMessages (common with OpenAI models where content is empty string).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add tests verifying:
- useFrontendTool render registrations survive StrictMode remount
- Hook and prop render entries coexist through StrictMode remount
- Hook render entries survive provider prop changes
- Update useRenderTool test mock to match new addHookRenderToolCall API
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
CopilotKitProvider's didMountRef guard breaks under React Strict Mode:
refs persist across the simulated unmount/remount cycle, causing the
provider's setRenderToolCalls effect to overwrite registrations from
useFrontendTool and useRenderTool hooks.
Split render tool call storage in CopilotKitCoreReact into two layers:
- _renderToolCalls: prop-based entries (set by provider)
- _hookRenderToolCalls: hook-based entries (set by useFrontendTool/useRenderTool)
The renderToolCalls getter merges both with a cached result for
useSyncExternalStore referential stability. Provider and hooks can
never overwrite each other, eliminating the race by design.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>