Commit Graph

6618 Commits

Author SHA1 Message Date
Maxim 2f78aac5f0 fix: handle async callback rejections and guard unthrottled path
- Extract safeCall helper that catches synchronous throws and attaches
  .catch() for async (MaybePromise<void>) rejections, preventing
  unhandled promise rejections from crashing Node.js (SSR) or producing
  cryptic browser errors
- Wrap onMessagesChanged/onStateChanged in the unthrottled path with the
  same error protection, so a throwing subscriber cannot corrupt the
  agent's notification loop regardless of whether throttling is active
- Simplify flushPending by delegating to safeCall

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 22:09:09 +02:00
Maxim ee84bce204 fix: harden subscribeToAgent with try-catch and add core-level tests
Address review findings from PR #3734:

- Wrap flushPending callback invocations in try-catch so a thrown
  exception in onMessagesChanged/onStateChanged does not permanently
  deadlock the throttle state machine or skip the sibling flush
- Add 21 dedicated unit tests for CopilotKitCore.subscribeToAgent
  covering leading/trailing edge, shared window (bidirectional),
  burst coalescing, run lifecycle passthrough, unsubscribe cleanup,
  resolution cascade, invalid values, and exception safety
- Use named CopilotKitCoreSubscription return type
- Fix Angular test stub to accept the options parameter and document
  that it bypasses throttle logic

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 22:09:08 +02:00
Maxim f1fc008314 refactor: move throttle logic from useAgent hook to CopilotKitCore.subscribeToAgent
Moves the leading+trailing throttle algorithm from the React-specific
useAgent hook into a framework-agnostic subscribeToAgent method on
CopilotKitCore. This consolidates throttle cascade resolution
(throttleMs ?? defaultThrottleMs ?? 0), validation, and the throttle
algorithm into a single location.

Key changes:
- Add subscribeToAgent() to CopilotKitCore with shared throttle gate
  for onMessagesChanged and onStateChanged (run lifecycle events are
  never throttled)
- Fix setDefaultThrottleMs to log errors and preserve previous value
  on invalid input instead of silently erasing
- Simplify useAgent by removing ~60 lines of inline throttle logic
- Angular AgentStore now uses subscribeToAgent, getting throttle
  support via provider-level defaultThrottleMs for free
- Remove duplicate validation from CopilotKitProvider useEffect
- Add direct unit tests for CopilotKitCore.setDefaultThrottleMs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 22:09:08 +02:00
Markus Ecker 9945d892e5 chore: update langgraph starter lockfile for 1.56.0 2026-04-15 20:41:05 +02:00
Markus Ecker 097bc7ac6c fix: update langgraph starter to use released @copilotkit packages 1.56.0
Replace pkg-pr-new preview URLs with published 1.56.0 versions.
2026-04-15 20:19:30 +02:00
Alem Tuzlak 32fb2635ed chore: release monorepo v1.56.0 (#3936)
## Release monorepo v1.56.0

**Scope:** `monorepo` | **Bump:** `minor`

---

### How this release process works

1. **This PR was created automatically** by the "release / create-pr"
workflow.
   It bumped the `monorepo` packages to `1.56.0`
   and generated AI-enhanced release notes.

2. **CI runs on this PR** — the full test suite (unit tests, lint, type
checks, build)
   must pass before merging. This is the review gate.

3. **Review the release notes** in `release-notes.md` in this PR.
If a Notion draft was created, you can edit the release notes there
before merging.

4. **When this PR is merged**, the `release / publish` workflow
automatically:
   - Builds all packages
   - Publishes the `monorepo` packages to npm at version `1.56.0`
   - Creates git tag `monorepo/v1.56.0`
   - Creates a GitHub Release with the final release notes

### Before merging

- [ ] CI is green (tests, lint, types, build)
- [ ] Version bumps look correct
- [ ] Release notes are accurate (edit in Notion if a draft was created)

---

> **Do not merge until CI is fully green.** The full test suite runs
automatically on this PR.
v1.56.0
2026-04-15 20:07:47 +02:00
Ran Shemtov 4da0999d89 Merge branch 'main' into release/publish/monorepo/v1.56.0 2026-04-15 19:39:10 +02:00
Ran Shemtov f4955ad5fd chore: example state streamin (#3934) 2026-04-15 19:24:38 +02:00
Ran Shemtov d74e32c824 Merge branch 'main' into chore/example-state-streamin 2026-04-15 19:24:23 +02:00
ranst91 cfb5921108 chore: release monorepo v1.56.0 2026-04-15 17:22:27 +00:00
Max Korp 7b9cad5643 feat: add intelligence to langgraph python example (#3649) 2026-04-15 09:53:16 -07:00
Max Korp 246448120a feat: add langgraph-python-threads example 2026-04-15 09:50:03 -07:00
Alem Tuzlak 3ca1ca0cd4 feat(vscode-extension): dynamic component registry with catalog scanning and precise diagnostic positioning 2026-04-15 18:40:03 +02:00
Ran Shemtov e85313521b Merge branch 'main' into chore/example-state-streamin 2026-04-15 18:37:44 +02:00
Ran Shemtov 742318fb94 fix: use latest agui langgraph packages (#3932) 2026-04-15 18:37:14 +02:00
Ran Shemtov 8d45984d17 Merge branch 'main' into fix/use-latest-agui-langgraph 2026-04-15 18:36:16 +02:00
Ran Shem Tov 65500c5fb8 chore: fix state streaming on langgraph prebuilt agents in demos 2026-04-15 18:35:55 +02:00
Jordan Ritter ea9b43efb4 fix: resolve 3 starter crash root causes crashing 7/17 Railway starters (#3933)
## Summary

7 out of 17 Railway-deployed starters are returning 502 (CRASHED). Three
distinct root causes:

1. **EACCES `/home/app`** (langgraph-typescript, claude-sdk-typescript,
mastra) — `npx` at runtime needs a home dir for its cache, but the
non-root `app` user was created with `--no-create-home`. Fix: `mkdir -p
/home/app && chown app:app /home/app` in all 4 Dockerfile templates.

2. **IndexError `Path.parents[4]`** (agno, claude-sdk-python,
ms-agent-python) — `search_flights.py` schema fallback accesses
`parents[4]` but Docker path `/app/agent/tools/search_flights.py` only
has 4 parents (0-3). Fix: wrap in try/except IndexError in shared source
+ regenerate.

3. **Wrong import path** (langroid, crewai-crews) — `from agents.X
import` but starters use `agent/` (singular). `rewritePythonImports()`
in generate-starters.ts now converts these to relative imports.

All fixes applied to upstream sources (templates, shared python,
generation script) so drift check passes.

## Test plan

- [x] 251 generate-starters tests pass
- [x] Drift check passes (`--check`)
- [x] Pre-commit hooks pass (lint, format, unit tests)
- [ ] Deploy to Railway and verify all 17 starters return 200
2026-04-15 09:33:38 -07:00
Alem Tuzlak 45b5295cd5 feat(vscode-extension): deep fixture validation with value checks for A2UI v0.9 protocol 2026-04-15 18:31:03 +02:00
Jordan Ritter cffecf1fc1 fix: resolve 3 starter crash root causes — Docker home dir, path depth, import rewriting
1. EACCES on /home/app: Dockerfile templates now create home dir for
   non-root user before USER app (langgraph-ts, claude-sdk-ts, mastra)
2. IndexError Path.parents[4]: search_flights.py schema fallback now
   guards against shallow Docker paths (agno, claude-sdk-py, ms-agent-py)
3. Wrong import path: rewritePythonImports() now converts
   from agents.X to relative imports in starter agent dirs (langroid, crewai)
2026-04-15 09:27:08 -07:00
Alem Tuzlak 556b311b9f feat(vscode-extension): add live fixture validation with diagnostics on every keystroke 2026-04-15 18:25:49 +02:00
Alem Tuzlak 38cc56e643 feat(vscode-extension): add UserProfile, ProjectBoard, and ChatInterface demo catalogs with fixtures 2026-04-15 18:22:07 +02:00
Alem Tuzlak 8b8c2b9efb feat(vscode-extension): use @tailwindcss/browser CDN for runtime Tailwind JIT, keep CSS extraction for imports 2026-04-15 18:15:37 +02:00
Ran Shem Tov 6986a1c120 fix: use latest agui langgraph packages 2026-04-15 18:11:17 +02:00
Alem Tuzlak d7d9f752a9 feat(vscode-extension): runtime Tailwind JIT and CSS extraction from component imports 2026-04-15 18:08:24 +02:00
Ran Shem Tov c8d4b273aa chore: add state streaming to langgraph example 2026-04-15 17:54:05 +02:00
Alem Tuzlak e436e915ac feat(vscode-extension): add Tailwind CSS to webview with mixed styling demo (inline + Tailwind) 2026-04-15 17:48:52 +02:00
copilotkit-devops-bot[bot] 699f9313e9 chore: auto-sync docs from main (a00950787) (#3931)
Automated docs sync. Clean transforms only.
2026-04-15 15:32:48 +00:00
copilotkit-devops-bot[bot] 068521d0ec chore: auto-sync docs from main (2026-04-15) 2026-04-15 15:32:42 +00:00
Alem Tuzlak a009507873 feat: add debug mode to runtime and client (#3562)
## Summary
- Add `debug` option to `CopilotRuntime` constructor and `<CopilotKit>`
provider for detailed event pipeline logging
- Server-side uses Pino structured logger; client-side uses
`console.debug` at each AG-UI pipeline stage
- Accepts `true` for full output or a granular config: `{ events,
lifecycle, verbose }`
- The two toggles are independent — enabling debug on the client does
not affect the server

## Changes

**`@copilotkit/shared`**
- New `DebugConfig` type, `ResolvedDebugConfig` interface,
`resolveDebugConfig()` normalizer

**`@copilotkit/runtime`**
- `debug` option on `CopilotRuntime({ debug: true })`
- Lifecycle logging: agent run started, SSE stream
opened/completed/errored
- Event logging: every emitted event (verbose = full payload, otherwise
key fields summary)

**`@copilotkit/react-core` + `@copilotkit/core`**
- `debug` prop on `<CopilotKit debug={true}>`
- Threads config through `CopilotKitCore` → `AgentRegistry` →
`ProxiedCopilotRuntimeAgent`

**Companion PR:** ag-ui-protocol/ag-ui#1398 (AG-UI client-side debug
logging)

## Test plan
- [x] All 647 runtime tests pass
- [x] All 352 AG-UI client tests pass
- [x] Lint clean (0 errors)
- [x] All affected packages build successfully
- [ ] Manual: set `debug: true` on runtime and provider, verify
structured logs on server and console output on client

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-04-15 17:31:02 +02:00
Alem Tuzlak b7e009c56b fix: correct verbose default in docs and remove stray vscode-extension README
The docs table and prose claimed `debug: true` sets `verbose: true`,
but the implementation intentionally defaults verbose to false (PII
safety). Fixed the table and explanatory text to match.

Also removed packages/vscode-extension/README.md which was committed
on this branch by mistake — it describes an unrelated VS Code extension
and has nothing to do with debug mode.
2026-04-15 17:18:09 +02:00
Alem Tuzlak 9953b8a264 Merge branch 'main' into worktree-lucky-popping-wren 2026-04-15 17:12:55 +02:00
Markus Ecker e5daf8deff fix: align A2UI schema with v0.9 spec, improve path binding prompts (#3929)
## Summary
- Replace custom `{ name, props }` schema format with A2UI v0.9
spec-aligned inline catalog format (`allOf` + `properties`) — eliminates
LLM "props" nesting confusion
- Restructure generation prompts: inline literal values are the default,
path binding is a narrow schema-driven exception
- Bump `@ag-ui/a2ui-middleware` to `0.0.5` in runtime

## Context
LLMs generating dynamic A2UI sometimes produced invalid output:
1. Nesting properties under a `"props"` key (because our schema used
`props` as a key)
2. Using `{ "path": "..." }` bindings on properties that only accept
literal values (e.g. chart `data`, metric `value`)

Both issues caused silent render failures or runtime crashes.

## Test plan
- [x] Tested with ag-ui dojo — A2UI dynamic schema demo works
- [x] Tested with CopilotKit langgraph-starter — sales dashboard renders
correctly
- [x] `@ag-ui/a2ui-middleware@0.0.5` published to npm

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-04-15 16:48:17 +02:00
Markus Ecker c61ebc5d15 chore: use pkg-pr-new preview packages in langgraph starter 2026-04-15 16:13:47 +02:00
Markus Ecker cfeb1c68c4 chore: update lockfile for @ag-ui/a2ui-middleware 0.0.5 2026-04-15 15:57:34 +02:00
Alem Tuzlak f36f5c3cc9 fix(vscode-extension): wire fixture selection from sidebar through to webview 2026-04-15 15:17:41 +02:00
Alem Tuzlak 01b5db56f5 fix(vscode-extension): add 16px padding around preview content 2026-04-15 15:11:48 +02:00
Alem Tuzlak becb89273c fix(vscode-extension): use Column root with children tree so all components render 2026-04-15 15:10:21 +02:00
Alem Tuzlak bf70d1c23b feat(vscode-extension): add polished demo catalog with weather, metrics, sales, and alerts fixtures 2026-04-15 15:07:07 +02:00
Alem Tuzlak 771069bcb9 fix(vscode-extension): wait for catalog before rendering, fix fixture format and test 2026-04-15 14:59:33 +02:00
Markus Ecker d51140ebbc chore: bump @ag-ui/a2ui-middleware to 0.0.5 2026-04-15 14:56:51 +02:00
Alem Tuzlak be6013f8f7 fix(vscode-extension): use correct A2UI v0.9 message format in fixtures and force provider remount on catalog change 2026-04-15 14:53:39 +02:00
Alem Tuzlak 8c5c22f1e5 fix(vscode-extension): add connect-src to CSP for sourcemap loading 2026-04-15 14:45:56 +02:00
Alem Tuzlak 2f78346286 fix(vscode-extension): use assignment instead of delete for window global cleanup in strict mode 2026-04-15 14:43:06 +02:00
Alem Tuzlak 05687064a1 fix(vscode-extension): resolve a2ui-renderer to TypeScript source to avoid CJS interop TDZ error 2026-04-15 14:41:03 +02:00
Alem Tuzlak 636df24872 fix(vscode-extension): switch webview to ESM format to fix circular dependency in a2ui-renderer 2026-04-15 14:37:58 +02:00
Alem Tuzlak 1c722a99b6 fix(vscode-extension): fix webview bundling — use IIFE with globals, noExternal, and node-resolve-fallback for pnpm 2026-04-15 14:33:48 +02:00
Alem Tuzlak ecef3c2f82 fix(vscode-extension): add node-resolve-fallback plugin to bundle zod and other deps from pnpm 2026-04-15 14:27:32 +02:00
Alem Tuzlak c9b1798b8c fix(vscode-extension): use IIFE output with shared globals to fix bare specifier resolution in webview 2026-04-15 14:18:36 +02:00
Alem Tuzlak c8bfd54f89 feat(vscode-extension): add launch.json to open test workspace on F5 2026-04-15 13:58:45 +02:00