4515 Commits

Author SHA1 Message Date
github-actions[bot] ea746d4629 chore(post-release): update version to 1.54.0 v1.54.0 2026-03-12 22:32:04 +00:00
Tyler Slaton a62a97a195 chore: release 1.54.0
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
2026-03-12 18:27:53 -04:00
Jordan Ritter 13da6bde76 feat: consolidate 73 standalone demo repos into monorepo (#3418)
## Summary

Migrates 47 standalone demo repositories from the CopilotKit GitHub org
into the monorepo under `examples/`, organized by category
(integrations, showcases, canvas). History is intentionally dropped —
shallow clone + file copy only.

Also migrates the `copilotkit` CLI package from CopilotCloud into
`packages/v1/cli` (previously stacked as PR #3419, now merged into this
branch).

### Demo consolidation

- **47 demos** imported across 4 groups (A=22, B=21, C=2, D=2)
- **26 repos excluded** — all 13 experiments (old/irrelevant
prototypes), 6 showcases (autotale, agui, campaign-manager, chat-sso,
crewai-enterprise, crm), and 7 starters (textarea, todos-app,
coagents-langgraph, coagents-crewai-flows, llamaindex-hitl,
enterprise-runner, react-vite-agent) dropped to reduce consolidation
footprint
- **Git LFS** tracks binary assets (png, jpg, jpeg, gif, mp4, webm, pdf)
— svg removed from LFS (text-based, breaks `GIT_LFS_SKIP_SMUDGE=1` clone
instructions)
- **Image deduplication** via `examples/images/` with symlinks from
individual examples
- **Tutorial branches** imported as `start/` and `final/` subdirectories
- **Cross-link rewriting** — all standalone repo URLs in READMEs and
docs updated to monorepo paths
- **Doc updates** — 18 tutorial/doc files updated with new clone
instructions and paths
- **Renovate config** — `examples/**` dependencies grouped into weekly
Monday PRs, v1/v2 legacy dirs excluded
- **`examples/README.md`** — full index of all 47 demos by category
- **Archive script** — `scripts/archive-demo-repos.sh` ready to
deprecate+archive original repos post-merge
- **Prettier** — all example files formatted to match monorepo standards
- **Example bug fixes** — Gemini agents (unguarded variables, sync
blocking, dead OpenAI route), langgraph-python (debug print, docstring
placement), StackBlitz URLs

### CLI migration (from CopilotCloud)

- `TEMPLATE_REPOS` updated to use monorepo subdirectory sparse checkout
for all CopilotKit-owned templates
- Tarball download fallback preserved for external repos
(ag2ai/ag2-copilotkit-starter)
- Package metadata (bugs, homepage, repository) updated to point to
monorepo
- Removed stale tsconfig paths/references to non-existent
`@repo/trpc-cli`
- **Pre-existing bug fixes:**
  - `base-command.ts`: unguarded `fetch()` crashed CLI when offline
  - `init.ts`: dropped all user flags when delegating to `create`
- `detect-endpoint-type.utils.ts`: Promise.all destructuring mismatch (5
promises, 4 variables)
- `auth.service.ts`: OAuth state validated after analytics, Promise
never settled on mismatch

### Category breakdown

| Category | Count | Path |
|----------|-------|------|
| Integrations | 17 | `examples/integrations/` |
| Canvas | 7 | `examples/canvas/` |
| Showcases | 23 | `examples/showcases/` |

### What happens after merge
- Run `scripts/archive-demo-repos.sh` to deprecate+archive the 47
consolidated repos
- 26 excluded repos (experiments + 6 showcases + 7 starters) left as-is
on GitHub
- Community announcement (Slack draft prepared)
- Post-merge verification (README rendering, LFS quotas, CLI test)

## Test plan

- [ ] `examples/README.md` renders correctly on GitHub with all links
working
- [ ] LFS-tracked images render in GitHub READMEs
- [ ] Spot-check 3-5 examples can `npm install && npm run dev`
successfully
- [ ] Symlinks in `examples/images/` resolve correctly
- [ ] No `.git/`, `.github/`, `node_modules/`, or `.env` files in any
example
- [ ] Doc tutorial paths point to existing `start/`/`final/` directories
- [ ] No remaining standalone repo URLs in docs
- [ ] `nx run copilotkit:test` passes (46/46)
- [ ] `copilotkit create` scaffolds from monorepo subdirectory
- [ ] CLI works offline (version check doesn't crash)

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-03-12 16:29:54 -04:00
Jordan Ritter 1d72b9ce1b chore: strip starters from consolidation, update metadata to 47 repos 2026-03-12 13:06:04 -07:00
Jordan Ritter fd34bbfbf6 style: format all example files with prettier
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.
2026-03-12 13:06:04 -07:00
Jordan Ritter eab4855e67 fix: address review findings in consolidated examples
- 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
2026-03-12 13:06:04 -07:00
Jordan Ritter 34268b756a fix: remove SVG from LFS tracking
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).
2026-03-12 13:06:03 -07:00
Jordan Ritter f36dcc708f fix: resolve pre-existing bugs in CLI package
- 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
2026-03-12 13:06:03 -07:00
Jordan Ritter ad81aaa524 fix: address review findings in migrated CLI package
- 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)
2026-03-12 13:06:03 -07:00
Jordan Ritter bee70690bb feat: move CLI package from CopilotCloud into 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).
2026-03-12 13:06:03 -07:00
Jordan Ritter 22f5d61396 chore: configure Renovate for consolidated examples
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.
2026-03-12 13:06:03 -07:00
Jordan Ritter 79bdaddf0c docs: update tutorials and READMEs for consolidated demo paths
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.
2026-03-12 13:06:03 -07:00
Jordan Ritter 4b73c33d2f chore: add migration and archive scripts for demo repo consolidation
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.
2026-03-12 13:06:02 -07:00
Jordan Ritter ec3a5ff114 feat: consolidate 47 demo repos into examples/ 2026-03-12 13:06:02 -07:00
github-actions[bot] 98890426e5 chore(post-release): update version to 1.54.0-next.9 2026-03-12 19:08:50 +00:00
Alem Tuzlak 3780c6ae74 chore: deprecate all @copilotkitnext/* packages
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.
2026-03-12 15:05:29 -04:00
github-actions[bot] b443706792 chore(post-release): update version to 1.54.0-next.8 2026-03-12 16:52:13 +00:00
Ran Shemtov 989dc26f56 fix: inject useCopilotReadable context into connectAgent (#3422) 2026-03-12 17:44:52 +01:00
Ran Shemtov f1571ef73e chore: add changeset 2026-03-12 16:43:01 +01:00
Ran Shem Tov ad85914b8c fix: inject useCopilotReadable context into connectAgent 2026-03-12 16:16:20 +01:00
github-actions[bot] ecd76256ed chore(post-release): update version to 1.54.0-next.7 2026-03-12 14:26:14 +00:00
Ran Shemtov d92adea27c fix(react): yield to React scheduler before follow-up agent run to pr… (#3421) 2026-03-12 15:22:30 +01:00
Ran Shem Tov aa2f2c1af9 fix(react): use flushSync 2026-03-12 13:38:02 +01:00
Ran Shemtov eb1e0bf2f9 chore: add changeset 2026-03-12 10:56:07 +01:00
Ran Shem Tov cad191176a fix(react): yield to React scheduler before follow-up agent run to prevent stale useAgentContext 2026-03-12 10:54:39 +01:00
Jordan Ritter 1a3ae544cb chore: add LFS tracking for jpeg, webm, and svg assets
Extend .gitattributes to track *.jpeg, *.webm, and *.svg via Git LFS,
complementing existing patterns (gif, jpg, png, pdf, mp4).
2026-03-11 21:48:44 -07:00
github-actions[bot] ed34d9daef chore(post-release): update version to 1.54.0-next.6 2026-03-11 16:22:53 +00:00
Maxim 768109afce feat(core): add copilotkit.runTool() for programmatic tool execution (#3286)
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
2026-03-11 20:19:29 +04:00
Maxim a042d74a77 Merge branch 'main' into claude/condescending-turing 2026-03-11 20:09:15 +04:00
Ran Shemtov 94351043ae fix(sdk-python): add dict_repr method to LangGraphAGUIAgent (#2676) 2026-03-11 16:36:32 +01:00
Ran Shemtov de02e9cef0 Merge branch 'main' into fix/2667-langgraph-agui-agent-dict-repr 2026-03-11 16:27:00 +01:00
github-actions[bot] e9cb7dfe26 chore(post-release): update version to 1.54.0-next.5 2026-03-11 15:20:13 +00:00
Ran Shemtov 0d14984b8c feat: set default a2ui theme to fit cpk main theme (#3408) 2026-03-11 16:16:46 +01:00
Ran Shemtov 4c0f92ac58 Merge branch 'main' into feat/a2ui-cpk-theme 2026-03-11 16:16:36 +01:00
Ran Shem Tov 5433fc33da fix: refine default theme 2026-03-11 15:54:59 +01:00
Maxim bbea168304 docs: add runTool() API reference and programmatic control example
- 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>
2026-03-11 18:17:25 +04:00
Maxim 8554ca674b fix: preserve graceful arg-parse error handling in executeSpecificTool
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>
2026-03-11 17:36:38 +04:00
Tyler Slaton c80498ec9a chore: add changeset 2026-03-11 17:25:19 +04:00
Tyler Slaton 8224d761a3 style: fix prettier formatting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 17:25:19 +04:00
Tyler Slaton 3efbf86314 feat(core): add copilotkit.runTool() for programmatic tool execution
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>
2026-03-11 17:24:22 +04:00
github-actions[bot] 190eb07f09 chore(post-release): update version to 1.54.0-next.4 2026-03-11 12:50:08 +00:00
Maxim 4d116b0738 fix: render tool call registration lost under React Strict Mode (#3416)
## 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)
2026-03-11 16:46:32 +04:00
Maxim c233c260d1 fix(react): update standard-schema test mock for hook-based render tool calls
Same fix as zod-regression — the mock was missing addHookRenderToolCall
and removeHookRenderToolCall methods.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 15:52:06 +04:00
Maxim e5cbcb670a fix(react): update zod-regression test mock for hook-based render tool calls
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>
2026-03-11 15:39:27 +04:00
Maxim 46d58ac3bf chore(sdk-python): regenerate poetry.lock
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 15:28:26 +04:00
Maxim a57dc40fca fix(react): remove as casts and clean up unused imports
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>
2026-03-11 15:28:26 +04:00
Maxim c5ec0f8512 fix(sdk-python): guard assistant message with content check
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>
2026-03-11 15:28:26 +04:00
Maxim af11b1ea57 chore: add changeset 2026-03-11 15:28:26 +04:00
Maxim fd44b5ba5f test(react): add StrictMode render tool call preservation tests
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>
2026-03-11 15:28:26 +04:00
Maxim 829589a625 fix(react): separate hook vs prop render tool call storage to fix StrictMode race
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>
2026-03-11 15:28:26 +04:00