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.
Replace Zod-specific types (z.ZodType, z.infer) with Standard Schema V1
interfaces across the V2 public API surface. This allows users to use any
Standard Schema V1 compatible library (Zod 3.24+, Valibot v1+, ArkType v2+)
for tool parameters, with zero breaking changes for existing Zod users.
- Add schemaToJsonSchema() utility in shared with Standard JSON Schema V1
support and Zod fallback
- Update FrontendTool, ToolDefinition, useRenderTool, useComponent, and
Angular tool types to accept StandardSchemaV1
- Move zod from dependencies to devDependencies in core and angular
- Add runtime tests (40) and type-level tests (38) across all packages
verifying Zod, Valibot, and ArkType compatibility
CRITICAL 1: ensureObjectArgs (renamed from safeParseToolArgs) in
run-handler.ts now throws on non-object parsed results so the catch
block fires TOOL_ARGUMENT_PARSE_FAILED structured errors.
CRITICAL 2: partialJSONParse return type reverted from
Record<string,unknown> to unknown — callers handle the type.
IMPORTANT 3: safeParseToolArgs consolidated into shared/utils.ts and
exported. Agent/index.ts imports from @copilotkitnext/shared. V1 keeps
a local copy with a comment noting it mirrors the shared version.
IMPORTANT 4: All non-object fallback sites now emit console.warn with
consistent [CopilotKit] prefix format.
IMPORTANT 5: Removed console.warn from getPartialArguments catch block
(incomplete JSON is expected during streaming). Warning is now only in
the try-block non-object guard.
TEST 6: Added run-handler-ensureObjectArgs.test.ts covering valid
object, string, number, array, null, boolean, and undefined inputs.
TEST 7: Added conversion.test.ts for v1 safeParseToolArgs covering
valid object, string, number, array, malformed JSON, null, boolean,
and empty string inputs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Rename ensureObjectArgs to safeParseToolArgs in v2/agent and v1/runtime,
folding JSON.parse into the guard so malformed JSON (e.g. "{broken") is
caught instead of throwing an unhandled SyntaxError up the call stack.
Add console.warn on parse failure in all three locations (v2/agent,
v1/runtime, v1/runtime-client-gql) so malformed tool arguments are
visible in logs rather than silently swallowed.
Update the v2/agent unparseable-JSON test to expect {} instead of throw.
Tests for ensureObjectArgs in @copilotkitnext/agent (via
convertMessagesToVercelAISDKMessages) and getPartialArguments in
@copilotkit/runtime-client-gql (via convertGqlOutputToMessages).
Covers string, array, null, number, boolean, empty args, and
unparseable JSON — all should fall back to {}.
Also documents a pre-existing gap: JSON.parse is unguarded before
ensureObjectArgs in v2/agent, so unparseable JSON throws instead of
falling back to {}. The test explicitly expects the throw.
v1/runtime's convertGqlInputToMessages uses class-transformer which
makes isolated unit testing impractical; the same guard logic is
covered by the other two test suites.
When LLMs return non-object values (e.g. empty string) as tool call
arguments, the parsed result is stored in conversation history. On
subsequent requests, providers like Anthropic reject the non-dictionary
tool_use input with a 400 error, making the conversation permanently
broken.
Fixed in 4 locations across v1 and v2:
- v1 runtime conversion.ts: validate parsed arguments
- v1 client conversion.ts: validate partial arguments
- v2 core run-handler.ts: validate both specific and wildcard tool args
- v2 agent index.ts: validate tool call input conversion
All locations now ensure parsed args are a plain object, falling back to
{} for non-object values.
Fixes#3300
Move V1 test file to __tests__/ directory and add test verifying that
string enum constraints round-trip through convertJsonSchemaToZodSchema.
Add equivalent test for V2's copy.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The string case in convertJsonSchemaToZodSchema produced z.string() and
silently discarded the enum field. When useCopilotAction defines a
parameter with enum: ["todo", "done"], the constraint was lost during
the V1→V2 bridge and never reached the runtime payload.
Add an enum check before falling through to z.string() in both V1
(shared/json-schema.ts) and V2 (agent/index.ts) copies of the function.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace husky with lefthook for git hooks management
- Pre-commit runs lint --fix, format, test, and check:packages in parallel
with auto-staging of fixes via stage_fixed
- Commit-msg runs commitlint
- Add dependsOn ^build to test target in nx.json so dependencies are
built before tests run
- Upgrade @analogjs/vite-plugin-angular and @analogjs/vitest-angular
from ^1.20.2 to ^2.2.3 for vite 7 compatibility
- Add pnpm packageExtensions to declare missing vite peer dependency
on @analogjs/vite-plugin-angular
- Fix lint issues: let -> const in agent and react packages
- Disable nx TUI in pre-commit hooks via NX_TUI env var