Commit Graph

1601 Commits

Author SHA1 Message Date
Jordan Ritter 6c4162c2d0 fix: support per-request agent factory function (#2941)
Add AgentsFactory type that accepts a function receiving request context,
enabling multi-tenant and request-scoped agent configuration. The agents
option now accepts a static record, a Promise, or a factory function.
2026-04-12 16:09:41 -07:00
Jordan Ritter 2cf4021eaa fix: skip content_block_delta events for unknown tool_use blocks
When mode is null (unknown tool skipped), content_block_delta events
with input_json_delta would still call sendActionExecutionArgs using
the previous valid tool call ID, corrupting its arguments.
2026-04-12 15:31:50 -07:00
github-actions[bot] 45d4e36280 style: auto-fix formatting 2026-04-12 22:27:35 +00:00
github-actions[bot] 65b8f05e8d style: auto-fix formatting 2026-04-12 22:26:58 +00:00
github-actions[bot] c4d50a3ec7 style: auto-fix formatting 2026-04-12 22:26:58 +00:00
Jordan Ritter f94367ffd7 fix: support dynamic headers function prop for auth token refresh (#2779) 2026-04-12 15:25:17 -07:00
Jordan Ritter 49be36eeb9 fix: scope .dark CSS selectors to CopilotKit elements (#2920) 2026-04-12 15:24:54 -07:00
Jordan Ritter fac52dbf9b fix: handle anyOf/oneOf/ in JSON schema to Zod conversion (#2220) 2026-04-12 15:24:46 -07:00
Jordan Ritter 39a9eb81ca fix: preserve jsonSchema structure in MCP tool parameter extraction (#1936)
extractParametersFromSchema now preserves enum values as structured
data on string parameters, recursively extracts nested object
attributes, and converts object arrays to object[] type with
attributes. This ensures complex MCP tool schemas survive the
Parameter[] -> Zod conversion without losing nested structure.
2026-04-12 15:17:02 -07:00
Jordan Ritter 00b14e54ba fix: pass urlTransform prop through to ReactMarkdown (#1921)
The Markdown component accepted components but not urlTransform,
preventing users from customizing URL sanitization. Added urlTransform
as an optional prop with passthrough to MemoizedReactMarkdown.
2026-04-12 15:16:55 -07:00
Jordan Ritter 0099c1d3e2 fix: honor Retry-After header on 429 responses (#3637)
Parse Retry-After as seconds or HTTP-date and use it as the retry delay
instead of exponential backoff. Throw if the server requests a wait
longer than maxRetryAfterSeconds (60s default) to avoid hanging.
2026-04-12 15:16:35 -07:00
Jordan Ritter 3aadfb34f4 fix: prevent "Unknown provider" regression for LangChainAdapter (#3217)
When getLanguageModel() returns null and provider/model are undefined
(as with LangChainAdapter), the code constructed "undefined/undefined"
as a model string, causing a cryptic "Unknown provider" error.

Now checks each source of model info explicitly and throws a clear
error message directing users to provide an explicit agents config
when using adapters that don't expose model metadata.
2026-04-12 15:16:34 -07:00
Jordan Ritter 6afe64b3ef fix: forward credentials on all agent registration paths (#3141)
applyCredentialsToAgents/applyCredentialsToAgent were defined but never
called from initialize(), setAgents__unsafe_dev_only(), or
addAgent__unsafe_dev_only(). Only remote agents received credentials
via constructor. Local agents now receive credentials alongside headers.
2026-04-12 15:16:34 -07:00
Jordan Ritter 41e7d70bbe fix: add IME composition guard in CopilotChatInput (#3318)
Skip keydown handling during IME composition (e.g. CJK input) by
checking isComposing/keyCode 229, and guard textarea measurement
from resetting value mid-composition.
2026-04-12 15:10:28 -07:00
Jordan Ritter 2e85fd6428 fix: show loading indicator during tool execution (#3055)
The loading spinner only appeared when the last message had role "user".
During tool execution the last message can have role "tool", hiding the
indicator. Now also show it when the trailing message is a tool result.
2026-04-12 15:09:37 -07:00
Jordan Ritter 18b0d7a831 fix: normalize array content in TOOL_CALL_RESULT for MCP adapters (#2922)
langchain-mcp-adapters sends tool call result content as an array of
{type:"text", text:string} objects. Extract and join text parts so
downstream consumers always receive a plain string.
2026-04-12 15:09:33 -07:00
Jordan Ritter 6b653d6580 fix: wrap Button with forwardRef to fix DropdownMenuTrigger ref warning (#2947)
Radix UI's asChild pattern requires the child component to forward
refs. The Button component was a plain function, causing a React
warning when nested inside DropdownMenuTrigger. Converted to
React.forwardRef so the ref is properly passed through to the
underlying DOM element.
2026-04-12 15:05:28 -07:00
Jordan Ritter 6b360916b9 fix: always generate unique message IDs in LangChain adapter (#2929)
GoogleGenerativeAI returns "0" as lc_kwargs.id for every message,
which is truthy and bypassed the randomId() fallback. All streamed
messages then shared the same ID, breaking message deduplication.
Now we always use randomId() for new message streams.
2026-04-12 15:05:20 -07:00
Jordan Ritter f07501bbb8 fix: skip version check when showDevConsole is false (#2751)
checkForUpdates() fired unconditionally on mount, making a network
request even when the dev console was disabled. Now the useEffect
short-circuits when showDevConsole is false.
2026-04-12 15:05:06 -07:00
Jordan Ritter 1dcaf752d4 fix: handle null-union types in convertJsonSchemaToParameter (#2651)
JSON schemas from tools like Zod can produce union types like
["string", "null"]. The switch statement only handles single type
strings, causing these to fall through silently. Now we detect
Array.isArray(schema.type), filter out "null", and recurse with
the resolved scalar type.
2026-04-12 15:04:51 -07:00
Jordan Ritter 7e02057885 fix: skip unknown tool_use blocks in Anthropic adapter to prevent crashes (#2504) 2026-04-12 15:02:45 -07:00
Jordan Ritter 859304a770 fix: use div instead of p tag in Markdown to prevent hydration errors (#2234) 2026-04-12 15:01:34 -07:00
Jordan Ritter f278eda07d fix: export CopilotModal and CopilotModalProps from react-ui (#2194) 2026-04-12 14:59:37 -07:00
Jordan Ritter 3528a1f200 fix: ensure TextMessageOutput.id is never null by falling back to randomId() (#2118) 2026-04-12 14:59:03 -07:00
Jordan Ritter 10b967384e fix: increase LangGraph agent pagination limit from 10 to 100 (#2056) 2026-04-12 14:59:02 -07:00
Jordan Ritter 0db1fda63c fix: configurable audio mediaType and release mic tracks on stop (#2049, #2050) 2026-04-12 14:59:02 -07:00
Jordan Ritter 8cd2facb7d fix: pass hookParams to onAfterRequest instead of empty object (#2124)
The onAfterRequest middleware callback was being called with an empty
object `{}` instead of the available hook parameters (threadId, runId,
messages, path). Extract and forward these from the hookParams that the
v2 runtime provides.
2026-04-12 13:33:31 -07:00
Jordan Ritter e121937a6d fix: replace non-unique provider IDs like txt-0 with UUIDs (#3410, #3623)
Providers like @ai-sdk/openai-compatible emit sequential IDs (txt-0,
reasoning-0, msg-0) that collide across requests. The existing check
only caught the literal "0". Expand the check to match the
^(txt|reasoning|msg)-0$ pattern and always use randomUUID() for these.
2026-04-12 13:33:05 -07:00
github-actions[bot] dd9c1f99c7 style: auto-fix formatting 2026-04-12 20:29:12 +00:00
github-actions[bot] 3469d5ecd0 style: auto-fix formatting 2026-04-12 20:27:36 +00:00
Jordan Ritter 3c89f2ef79 fix: guard CopilotListeners against empty agents map to prevent useAgent throw (#3249) 2026-04-12 13:24:50 -07:00
Jordan Ritter a82c1f09cc fix: use duck-type check for Request instead of instanceof (#2986)
When @hono/node-server polyfills the Request class, instanceof fails
because the polyfilled object has a different prototype chain.

Replace `reqOrRequest instanceof Request` with a duck-type check
that verifies url, method, and headers properties exist, which
works with both native and polyfilled Request objects.
2026-04-12 13:22:58 -07:00
Jordan Ritter 477d17e3da fix: surface TOAST/BANNER errors even when showDevConsole=false (#2431)
The routeError function returned early for ALL errors when
showDevConsole was false, suppressing user-visible errors
(TOAST and BANNER visibility) in production.

Now only DEV_ONLY and SILENT errors are suppressed in production.
TOAST and BANNER errors are always surfaced to the chat UI.
2026-04-12 13:22:48 -07:00
Jordan Ritter f1ff6dea4a fix: return null instead of throwing when agent not found in useRenderCustomMessages (#3497) 2026-04-12 13:22:18 -07:00
Jordan Ritter c9aaa3f507 fix: exclude tools with available:"disabled" from buildFrontendTools (#3020)
The filter only checked `available !== false` but "disabled" is a
string, not boolean false, so disabled tools were still sent to agents.
2026-04-12 13:21:53 -07:00
Jordan Ritter a12134ce35 fix: replace hardcoded width 97% with 100% on messages footer (#2325)
The .copilotKitMessagesFooter used width:97% which caused horizontal
overflow in constrained containers. Changed to width:100% with
box-sizing:border-box so padding is included in the width calculation.
2026-04-12 13:21:43 -07:00
Jordan Ritter b99df1e2dc fix: pass AssistantMessage to onThumbsUp/Down callbacks instead of SyntheticEvent (#3457) 2026-04-12 13:21:27 -07:00
Jordan Ritter 641da3350e fix: increase Anthropic adapter default max_tokens from 1024 to 4096 (#2354)
The hardcoded 1024 default was too restrictive for most use cases,
causing truncated responses. Increase to 4096 as a more reasonable
default while still respecting user-provided maxTokens.
2026-04-12 13:21:00 -07:00
Jordan Ritter d1ac73da4c fix: handle void return from sendFunction in usePushToTalk (#3011)
sendMessage returns Promise<void> but usePushToTalk accessed .id on
the result, causing a TypeError crash. Guard the .id access with an
existence check and update the SendFunction type to accept void.
2026-04-12 13:20:10 -07:00
tylerslaton 4a682bb92b chore: release cli v1.0.2 2026-04-11 07:05:02 +00:00
tylerslaton ccdd276a6d chore: release monorepo v1.55.3 2026-04-11 06:24:17 +00:00
github-actions[bot] 087cbae689 chore: version packages 2026-04-10 23:38:59 +00:00
Martha Schumann 6fdf106620 fix(react-ui): remove min-height from CopilotSidebarContentWrapper
818e4e767 added min-height: 100vh / height: 100% to
.copilotKitSidebarContentWrapper and its children in an attempt to
support full-height children inside the sidebar. This caused empty
space equal to the full viewport height to appear below the app
content whenever CopilotSidebar was mounted, even when collapsed.

The wrapper only needs to push the page content left (via margin-right)
when the sidebar expands — it does not need to control its own height.
Remove the height rules; child layout is the responsibility of the
app, not the sidebar wrapper.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 15:35:33 -07:00
Martha Schumann 1121ea6150 fix(react-ui): pin chat body wrapper to fill window height
The drag-and-drop wrapper div added in fc1cfa09d (attachments feature)
broke the flex layout of the chat window. The div had no class when
not dragging, so no CSS rule applied flex-grow — messages and input
collapsed to their natural height instead of filling the window.

Add copilotKitChatBody class to the wrapper and give it flex: 1 1 0%
so it claims the remaining window height, restoring the input-pinned-
to-bottom behaviour present in 1.51.1.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 15:29:14 -07:00
github-actions[bot] 4fcfe35fc5 style: auto-fix formatting 2026-04-10 14:02:10 -05:00
Max Korp 215bfd9385 test(runtime): add thread route coverage to fetch-router tests 2026-04-10 14:02:10 -05:00
Max Korp 395e10059c fix(runtime): restore thread routes dropped during fetch-handler rewrite 2026-04-10 14:02:10 -05:00
github-actions[bot] 3e43f35131 chore: version packages (next) 2026-04-10 18:29:58 +00:00
Alem Tuzlak 1bae2fc899 Merge branch 'main' into chore/oxlint-new-rules 2026-04-10 19:43:20 +02:00
Alem Tuzlak ff2093102c chore(lint): add new oxlint rules and auto-fix violations
Enable stricter oxlint rules for better code health:
- typescript/consistent-type-imports: enforce `import type` for type-only imports
- typescript/no-import-type-side-effects: prefer top-level type imports
- import/consistent-type-specifier-style: consistent type specifier placement
- typescript/no-unnecessary-type-assertion: bump to error
- react/self-closing-comp: enforce self-closing JSX components
- unicorn/prefer-optional-catch-binding: drop unused catch params
- eslint/no-useless-computed-key: simplify object keys
- unicorn/prefer-string-slice: prefer .slice() over .substring()
- unicorn/prefer-array-flat-map: prefer .flatMap() over .map().flat()

All existing violations auto-fixed via oxlint --fix.
2026-04-10 19:29:32 +02:00