Commit Graph

1601 Commits

Author SHA1 Message Date
Ran Shemtov 91c465a500 fix(sdk-js): preserve Zod v4 state fields in LangGraph output_schema
Adds a `zodState` helper that attaches a `~standard.jsonSchema.input`
hook to Standard-Schema-compatible schemas (e.g. Zod). Without this,
Zod v4 fields carry `~standard.validate` + `vendor` only, so
LangGraph's `isStandardJSONSchema()` returns false and
`getJsonSchemaFromSchema` (called from `StateSchema.getJsonSchema`)
silently drops them from the graph's `output_schema`. AG-UI
`STATE_SNAPSHOT` events then filter the field out of the payload sent
to the frontend, even though the underlying thread state has it.

Wraps the internal `copilotkit` field in `copilotKitStateSchema` with
`zodState(...)` and exports the helper for user state schemas.

Bumps `@ag-ui/langgraph` to 0.0.30 and `@langchain/{core,langgraph}` /
`langchain` to the v1.1.41 / v1.2.9 / v1.3.4 line, which is the source
of the Zod v4 behavior this fix targets.

Recreates the sdk-js portion of #4320.

https://claude.ai/code/session_015B7RT1QxqyMmGDQYyaN7At
2026-04-29 11:29:04 +02:00
github-actions[bot] b3522d4959 style: auto-fix formatting 2026-04-29 09:26:15 +02:00
Ran Shem Tov 50a2174c38 feat: add agentcore memory runner 2026-04-29 09:26:15 +02:00
Jordan Ritter 8d7e850c22 chore: bump @copilotkit/aimock to latest (v1.16.1)
Needed for turnIndex/sequenceIndex fixture matching in D5 multi-turn
conversations. Updated in both packages/runtime (devDep) and
showcase/scripts (dep).
2026-04-28 22:21:02 -07:00
Jordan Ritter 9c9af7665f fix: update express wildcard routes for Express 4.20+ compat
Express 4.20+ uses path-to-regexp v8 which requires named wildcard
params. Bare * is no longer valid — use {*splat} syntax instead.

Updated production code (express.ts) and test (express-fetch-bridge).
Restores express >=4.20.0 override now that code is compatible.
2026-04-28 10:33:05 -07:00
Jordan Ritter a23bdccb6c fix: use /* instead of * in express route for Express 4.20+ compat
Express 4.20+ uses path-to-regexp v8 which rejects bare * as a route
pattern. Use /* which is the forward-compatible syntax.
2026-04-28 10:33:05 -07:00
Jordan Ritter 868f6b1716 fix: deep security vulnerability sweep — 155 → 3 remaining
Phase 2: upgrade existing overrides to higher patched versions
Phase 3: add 36 new safe overrides for all resolvable transitive deps
Phase 4: bump storybook devDeps, vite in react-router, vitest in demo-agents, next canary

Remaining 3 are truly unfixable:
- parse-git-config: no patch exists (danger devDep)
- elliptic: no patch exists (storybook crypto chain)
- next: example on 15.x canary, advisory needs 16.x

Part of CPK-7320
2026-04-28 10:33:05 -07:00
Alem Tuzlak c089d5969e Merge remote-tracking branch 'origin/main' into worktree-mossy-tumbling-unicorn
# Conflicts:
#	.github/workflows/showcase_deploy.yml
#	showcase/integrations/built-in-agent/.env.example
#	showcase/integrations/built-in-agent/Dockerfile
#	showcase/integrations/built-in-agent/README.md
#	showcase/integrations/built-in-agent/docs-links.json
#	showcase/integrations/built-in-agent/entrypoint.sh
#	showcase/integrations/built-in-agent/next.config.ts
#	showcase/integrations/built-in-agent/package-lock.json
#	showcase/integrations/built-in-agent/package.json
#	showcase/integrations/built-in-agent/playwright.config.ts
#	showcase/integrations/built-in-agent/postcss.config.mjs
#	showcase/integrations/built-in-agent/public/.gitkeep
#	showcase/integrations/built-in-agent/qa/agentic-chat.md
#	showcase/integrations/built-in-agent/qa/gen-ui-agent.md
#	showcase/integrations/built-in-agent/qa/gen-ui-tool-based.md
#	showcase/integrations/built-in-agent/qa/hitl-in-chat.md
#	showcase/integrations/built-in-agent/qa/sales-dashboard.md
#	showcase/integrations/built-in-agent/qa/shared-state-read-write.md
#	showcase/integrations/built-in-agent/qa/shared-state-streaming.md
#	showcase/integrations/built-in-agent/qa/subagents.md
#	showcase/integrations/built-in-agent/qa/tool-rendering.md
#	showcase/integrations/built-in-agent/src/app/api/copilotkit/[[...slug]]/route.ts
#	showcase/integrations/built-in-agent/src/app/api/health/route.ts
#	showcase/integrations/built-in-agent/src/app/copilotkit-overrides.css
#	showcase/integrations/built-in-agent/src/app/demos/agentic-chat/page.tsx
#	showcase/integrations/built-in-agent/src/app/demos/gen-ui-agent/page.tsx
#	showcase/integrations/built-in-agent/src/app/demos/gen-ui-tool-based/page.tsx
#	showcase/integrations/built-in-agent/src/app/demos/hitl/page.tsx
#	showcase/integrations/built-in-agent/src/app/demos/shared-state-read-write/page.tsx
#	showcase/integrations/built-in-agent/src/app/demos/shared-state-streaming/page.tsx
#	showcase/integrations/built-in-agent/src/app/demos/subagents/page.tsx
#	showcase/integrations/built-in-agent/src/app/demos/tool-rendering/page.tsx
#	showcase/integrations/built-in-agent/src/app/globals.css
#	showcase/integrations/built-in-agent/src/app/layout.tsx
#	showcase/integrations/built-in-agent/src/app/page.tsx
#	showcase/integrations/built-in-agent/src/lib/factory/server-tools.ts
#	showcase/integrations/built-in-agent/src/lib/factory/state-tools.ts
#	showcase/integrations/built-in-agent/src/lib/factory/subagent-tools.ts
#	showcase/integrations/built-in-agent/src/lib/factory/tanstack-factory.ts
#	showcase/integrations/built-in-agent/tests/e2e/agentic-chat.spec.ts
#	showcase/integrations/built-in-agent/tests/e2e/gen-ui-agent.spec.ts
#	showcase/integrations/built-in-agent/tests/e2e/gen-ui-tool-based.spec.ts
#	showcase/integrations/built-in-agent/tests/e2e/hitl-in-chat.spec.ts
#	showcase/integrations/built-in-agent/tests/e2e/shared-state-read.spec.ts
#	showcase/integrations/built-in-agent/tests/e2e/shared-state-streaming.spec.ts
#	showcase/integrations/built-in-agent/tests/e2e/shared-state-write.spec.ts
#	showcase/integrations/built-in-agent/tests/e2e/subagents.spec.ts
#	showcase/integrations/built-in-agent/tests/e2e/tool-rendering.spec.ts
#	showcase/integrations/built-in-agent/tsconfig.json
2026-04-28 18:13:21 +02:00
Alem Tuzlak b2d14a847e Merge remote-tracking branch 'origin/worktree-mossy-tumbling-unicorn' into worktree-mossy-tumbling-unicorn 2026-04-28 13:55:50 +02:00
Alem Tuzlak 46eeb21924 Merge remote-tracking branch 'origin/main' into worktree-mossy-tumbling-unicorn
# Conflicts:
#	showcase/scripts/__tests__/generate-catalog.test.ts
2026-04-28 13:54:22 +02:00
github-actions[bot] 30c0c41c89 style: auto-fix formatting 2026-04-28 11:26:25 +00:00
Ran Shem Tov 6c14258a39 feat(langgraph): add state injection to copilotkit middleware 2026-04-28 13:24:41 +02:00
Jordan Ritter 36d8cb33fd chore: remove VS Code extension — migrated to CopilotKit/vscode-extension
The extension is a leaf node in the monorepo dependency graph (nothing
depends on it) and has its own independent release cycle. The standalone
repo at CopilotKit/vscode-extension has full git history, working CI,
verified OIDC publishing, and branch protection.
2026-04-27 14:21:44 -07:00
BenTaylorDev f19afade44 chore: release monorepo v1.56.4 2026-04-27 15:05:59 -05:00
github-actions[bot] 8334dcdde6 style: auto-fix formatting 2026-04-27 16:32:58 +00:00
Alem Tuzlak 18f6c1e2e5 fix(runtime): close open reasoning message in REASONING_END and on REASONING_START reopen 2026-04-27 18:30:01 +02:00
Alem Tuzlak a48e9a17b3 fix(runtime): align TanStack state-tool detection on rawContent ?? raw.result fallback 2026-04-27 18:16:15 +02:00
Alem Tuzlak 7bcd2f81ee fix(runtime): track REASONING message-open and run-open separately to avoid duplicate REASONING_MESSAGE_END 2026-04-27 18:01:54 +02:00
Alem Tuzlak e0abb77703 chore: merge main, resolve conflicts on built-in-agent slug 2026-04-27 16:53:16 +02:00
Ran Shemtov cfd8ec51c2 Merge branch 'main' into claude/add-stateschema-export-DtPiG 2026-04-27 15:15:43 +02:00
Alem Tuzlak d128257dd2 feat(runtime): auto-close open REASONING lifecycle in TanStack converter 2026-04-27 13:50:50 +02:00
Alem Tuzlak 6f77116aee feat(runtime): pass through REASONING_* chunks in TanStack converter 2026-04-27 13:47:02 +02:00
Alem Tuzlak d07c1d109e test(runtime): assert TanStack converter does not emit STATE_* for non-state tools 2026-04-27 13:42:24 +02:00
Alem Tuzlak a0be5455ab feat(runtime): emit STATE_DELTA on AGUISendStateDelta in TanStack converter 2026-04-27 13:40:38 +02:00
Alem Tuzlak 5f233a1987 feat(runtime): emit STATE_SNAPSHOT on AGUISendStateSnapshot in TanStack converter 2026-04-27 13:37:36 +02:00
Alem Tuzlak 71005252b8 test(runtime): add TanStack tool-result + reasoning chunk helpers 2026-04-27 13:17:09 +02:00
Martha Schumann 91986238fe feat(inspector): redesign threads early-access modal
Replaces the locked-card UI inside the threads gate with the new
private-beta modal: kicker pill, gradient "Threads" title with body
copy, three checkmark bullets, dark MonoPillButton CTA that opens the
HubSpot waitlist form in a new tab, and a dashed divider over the
invite-code row.

Adds an "unlocking" confirmation card (gradient circle, "Welcome to
Threads", "Loading your conversations…") shown for ~2s after a valid
code before the real Threads UI is revealed.

Invalid-code state now flashes a red input border + "That code isn't
valid. Double-check your invite email." copy that auto-clears after
1600ms, matching the design.

Backdrop (gradient + blurred ellipses) is intentionally preserved.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 15:37:39 -07:00
Martha Schumann 2465d1f1b1 fix(inspector): pin panel toggle flush to drawer + slide drawer open/close
Drawer-toggle button used to get pushed off-screen when the drawer was
open because the tab list shared flex space with it. Toggle now stays
visible at all times, anchored at the right edge of the tabs row, and
visually distinct from the tabs (vertical separator, lavender filled
state when active — no bottom-border indicator that would mistake it
for "another tab").

The drawer slides open/closed via a width transition (always rendered)
instead of popping in/out, and the resize divider floats over the
drawer's left edge so the toggle and drawer touch directly with no
flex-gap between them.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 15:37:38 -07:00
Mike Ryan ae978b95b1 test(runtime): align intelligence telemetry mock platform 2026-04-24 11:22:49 -07:00
github-actions[bot] 5bd77b35f0 style: auto-fix formatting 2026-04-24 11:22:49 -07:00
Mike Ryan e202dfd18f test: update react-core connect replay expectation 2026-04-24 11:22:49 -07:00
Mike Ryan f28ef5f916 fix(core): reset replay cursor on thread restore 2026-04-24 11:22:49 -07:00
Mike Ryan 5743fd051d fix(core): align intelligence reconnect catch-up 2026-04-24 11:22:49 -07:00
Mike Ryan 4b430b58a9 fix(core): align intelligence agent realtime connect 2026-04-24 11:22:49 -07:00
Mike Ryan ad7a383095 fix(runtime): tighten realtime startup handling 2026-04-24 11:22:49 -07:00
Mike Ryan 17bd39cd26 fix(runtime): finalize realtime connection responses 2026-04-24 11:22:49 -07:00
Mike Ryan 05aa15f908 fix(runtime): align intelligence realtime contracts 2026-04-24 11:22:49 -07:00
Martha Kelly Schumann ac9881c572 Merge branch 'main' into claude/add-stateschema-export-DtPiG 2026-04-24 09:29:29 -07:00
github-actions[bot] 2c8239c5f3 style: auto-fix formatting 2026-04-24 16:23:02 +00:00
Benjamin Taylor b8e7b575c3 refactor(runtime): drop framework tag from v2 telemetry
The framework label was only meaningful for Segment's per-event
properties. Scarf receives only the event name, so the label has no
destination. Removes the `framework` option on createCopilotRuntimeHandler
and its pass-through from the hono/express adapters, plus the now-unused
setGlobalProperties/globalProperties/flattenObject on the telemetry
client.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 11:01:27 -05:00
github-actions[bot] dfeedce2b5 style: auto-fix formatting 2026-04-24 11:01:27 -05:00
Benjamin Taylor 3ba588cad4 refactor(runtime): remove Segment channel from v2 telemetry client
The v2 TelemetryClient still pings Scarf for pixel-style event counts,
but no longer ships per-event properties to Segment. Drops the
`@segment/analytics-node` import, anonymousId, write key, and track call;
the dep stays in package.json until a follow-up lockfile update.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 11:01:27 -05:00
Benjamin Taylor bf4a071388 fix(runtime): Restore telemetry calls lost in fetch migration 2026-04-24 11:01:27 -05:00
Claude 301e8e427e feat(sdk-js): add CopilotKitStateSchema for LangGraph StateSchema API
LangGraph now recommends the `StateSchema` API over `Annotation.Root` for
defining TypeScript agent state. Expose a `CopilotKitStateSchema` (and
`CopilotKitPropertiesSchema`) built on that API so TypeScript users can
compose CopilotKit state with the modern pattern:

    import { StateSchema } from "@langchain/langgraph";
    import { CopilotKitStateSchema } from "@copilotkit/sdk-js/langgraph";
    import { z } from "zod";

    export const AgentStateSchema = new StateSchema({
      language: z.enum(["english", "spanish"]).default("english"),
      ...CopilotKitStateSchema.fields,
    });

The existing `CopilotKitStateAnnotation` export continues to work; this
change is purely additive.

Docs under `docs/content/docs/integrations/langgraph/**` are migrated to
the new pattern. The `deepagents` docs pages are introduced in PR #3707;
the deprecation callout added there can be removed once both land.
2026-04-24 15:10:22 +00:00
Max Korp bec1fd0811 fix(a2ui): document id="root" entry-point requirement in generation guidelines
The A2UI React renderer (packages/a2ui-renderer/src/react-renderer/a2ui-react/A2uiSurface.tsx:152)
always begins rendering at the component with id="root":

    export const A2uiSurface: React.FC<{...}> = ({ surface }) => {
      // The root component always has ID 'root' and base path '/'
      return <DeferredChild surface={surface} id="root" basePath="/" />;
    };

If no component has that ID, DeferredChild falls through to its loading-
shimmer placeholder, so the surface silently renders as an empty ~30px
rectangle regardless of how many other components are on the surface.

The generation guidelines shipped to the sub-LLM (in @copilotkit/shared
and copilotkit sdk-python) never stated this requirement. Fixed-schema
demos hard-code a component with id="root" in their JSON and work; dynamic
demos relied on the LLM guessing, which it sometimes did and sometimes
didn't. The failure mode is particularly nasty: no error, no warning,
just a loading spinner that never resolves.

Adds the requirement to COMPONENT ID RULES in both the TS and Python
guideline strings. Both strings are injected into the sub-LLM's context
by A2UICatalogContext (packages/react-core) and
copilotkit.a2ui.a2ui_prompt() respectively, so every A2UI-enabled app
picks it up automatically — no per-demo change needed.

Stacked on #4216, which restores the same instruction to the
langgraph-python-threads demo's tool docstring (belt-and-braces until
consumers update their shared package version).
2026-04-23 13:21:07 -07:00
Tyler Slaton 13890e460a fix(react-core): overlay chat input on scroll area (#4185)
## What does this PR do?

Fixes the guillotine cut where long messages hit the flat top of the
chat input and get sliced mid-line. Most visible in
`autoScroll=\"pin-to-send\"` mode (where the user reads at their own
pace and routinely lingers with a line butted against the input), but
applies to all scroll modes.

### The problem

`CopilotChatView` rendered the attachment queue + input as flex siblings
beneath the scroll area, so the scroll content stopped at the input's
flat rectangular boundary. The previously-shipped feather gradient
masked this visually but clashed with host themes whose `--background`
didn't match its hard-coded white / near-black —
[b621e96ee](https://github.com/CopilotKit/CopilotKit/commit/b621e96ee)
defaulted the feather to an empty div, which then revealed the
underlying layout bug.

### The fix

Wrap attachments + input in a single absolute-positioned overlay wrapper
at the `CopilotChatView` level. The scroll content now fills full height
and passes behind the rounded pill, matching ChatGPT's layout. The
scroll content's bottom padding reflects the measured overlay height so
the last line clears the pill when scrolled to the bottom.

Changes:
- `CopilotChatView.tsx` — replace flex-sibling attachments + input with
a single absolute overlay wrapper; move `inputContainerRef` onto the
wrapper so the `ResizeObserver` measures the full stack (attachments +
pill + disclaimer); add `inputContainerHeight` to scroll-content bottom
padding
- `CopilotChatAttachmentQueue.tsx` — add
`data-testid=\"copilot-attachment-queue\"` for test hooks
- `CopilotChatView.stories.tsx` — add a `PinToSend` story as
manual-verification scaffolding
- New test file `CopilotChatView.inputOverlay.test.tsx` with four tests:
overlay wrapper is absolute-positioned, attachments render above the
input inside the wrapper, welcome-screen input is NOT wrapped, scroll
content reserves `inputContainerHeight` as bottom padding

Not changed:
- `CopilotChatInput.tsx` public API (still accepts `positioning:
\"static\" | \"absolute\"`, same `bottomAnchored` flag, same
`containerRef`)
- `use-pin-to-send.ts` anchor math
- The `feather` slot itself — still empty-div default from
[b621e96ee](https://github.com/CopilotKit/CopilotKit/commit/b621e96ee);
hosts who want a themed fade supply their own via `scrollView={{
feather: ... }}`
- Welcome-screen input (stays inline)
- Angular parallel (follow-up if desired)

## Related PRs and Issues

- Builds on [#4158](https://github.com/CopilotKit/CopilotKit/pull/4158)
(pin-to-send anchoring/spacer/feather fixes)
- Builds on
[b621e96ee](https://github.com/CopilotKit/CopilotKit/commit/b621e96ee)
(feather defaulted to empty div)

## Checklist

- [x] I have read the [Contribution
Guide](https://github.com/copilotkit/copilotkit/blob/master/CONTRIBUTING.md)
- [ ] If the PR changes or adds functionality, I have updated the
relevant documentation

## Test plan

- [x] Unit tests — 4 new tests in
`CopilotChatView.inputOverlay.test.tsx` cover overlay structure,
attachment ordering, welcome-screen exclusion, and padding formula
- [x] Full `@copilotkit/react-core` suite (1153 tests) passes
- [x] Manual verification in Storybook (`UI/CopilotChatView → Default`,
`PinToSend`): content flows cleanly under the pill, last line reachable,
no guillotine cut
- [ ] Reviewer: check `WithSuggestions` story (padding formula switches
between `+4` and `+32`)
- [ ] Reviewer: check that `scrollView={{ feather: MyFeather }}`
override still works (the `slots.e2e` test covers this, but worth a
manual sanity check)
2026-04-23 09:02:39 -07:00
github-actions[bot] b3339c7c29 style: auto-fix formatting 2026-04-23 01:59:07 +00:00
Martha Schumann 68e247a78d refactor(inspector): port thread UI from Angular to Lit + add per-thread events/state endpoints
Replaces the Angular-backed cpk-thread-list / cpk-thread-details custom
elements with native Lit implementations inside @copilotkit/web-inspector,
so React, Vanilla, and any other non-Angular consumer of the inspector
gets full functionality without pulling the Angular runtime. The
@copilotkit/web-inspector-angular package is deleted entirely, and the
Angular demo no longer calls defineInspectorElements.

Backend: adds GET /threads/:id/events and GET /threads/:id/state to the
runtime (in-memory runner path). The Intelligence path returns 501 with
a clear "not yet supported on this runtime" empty state — coordination
with the Intelligence team is tracked separately (CPK-7453).

Also guards attachToCore's getThreadStores call so consumers on an older
@copilotkit/core don't throw when assigning inspector.core, and drops
two unrelated showcase-whitelist lines that landed in
scripts/hooks/check-binaries.sh during a prior merge.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 18:54:10 -07:00
Tyler Slaton f9eee688be fix(react-core): overlay chat input on scroll area
`CopilotChatView` rendered the attachment queue + input as flex siblings
beneath the scroll area, so long messages hit the input's flat top edge
and were sliced mid-line. Most visible in pin-to-send mode where the user
reads at their own pace. The previously-shipped feather gradient masked
this but clashed with host themes whose `--background` didn't match its
hard-coded white/near-black (b621e96ee defaulted it to an empty div).

Wrap attachments + input in a single absolute-positioned overlay so the
scroll content fills full height and passes behind the rounded pill. Pad
scroll-content bottom by the measured overlay height so the last line
clears the pill. Welcome-screen input is unchanged (stays inline). The
`feather` slot remains — hosts who want a themed fade supply their own
gradient.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 16:40:48 -07:00
Max Korp 47a6c0e7f4 test(core): bootstrap STATE_SNAPSHOT hydrates state on thread resume
Covers the shared-state thread-resume path that was missing coverage:
on resume, the /connect bootstrap plan replays STATE_SNAPSHOT events
captured during the original run, and agent.state (both on the direct
IntelligenceAgent and through the ProxiedCopilotRuntimeAgent bridge)
must reflect the final snapshot so UI reading from agent.state renders
the persisted state.

Both tests pass against the current implementation, ruling out these
layers as the source of the shared-state demo regression.
2026-04-22 15:56:07 -07:00