@copilotkit/react-ui 1.58.0 → 1.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,11 @@
1
1
  import requireCpkPrefix from "./require-cpk-prefix.mjs";
2
+ import noSingleArgZodRecord from "./no-single-arg-zod-record.mjs";
2
3
 
3
4
  const plugin = {
4
5
  meta: { name: "copilotkit" },
5
6
  rules: {
6
7
  "require-cpk-prefix": requireCpkPrefix,
8
+ "no-single-arg-zod-record": noSingleArgZodRecord,
7
9
  },
8
10
  };
9
11
 
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Oxlint rule: no-single-arg-zod-record
3
+ *
4
+ * Bans the single-argument `z.record(valueType)` form in favor of the
5
+ * two-argument `z.record(z.string(), valueType)` form.
6
+ *
7
+ * Zod 4 made the key schema mandatory for z.record, so the single-argument
8
+ * `z.record(valueType)` form is a compile-time error (TS2554) when built
9
+ * against Zod 4 — even though it still parses fine at runtime under both Zod
10
+ * majors. Packages that allow a Zod 4 peer (e.g. `@copilotkit/react-core`
11
+ * declares `zod: ">=3.0.0"`) are affected. The two-argument
12
+ * `z.record(z.string(), valueType)` form is valid under both Zod 3 and Zod 4.
13
+ *
14
+ * See GitHub issue #4295.
15
+ *
16
+ * Matches `z.record(...)` specifically (the conventional zod import alias in
17
+ * this repo) to avoid flagging unrelated single-argument `.record()` calls.
18
+ */
19
+
20
+ const rule = {
21
+ meta: {
22
+ type: "problem",
23
+ docs: {
24
+ description:
25
+ "Disallow the single-argument z.record() form, which is removed in Zod 4",
26
+ },
27
+ fixable: "code",
28
+ schema: [],
29
+ messages: {
30
+ singleArgRecord:
31
+ "Use the two-argument form `z.record(z.string(), …)`. Zod 4 requires an explicit key schema, so the single-argument `z.record(value)` form is a compile-time error (TS2554) when built against Zod 4 (GitHub #4295).",
32
+ },
33
+ },
34
+
35
+ create(context) {
36
+ return {
37
+ CallExpression(node) {
38
+ const callee = node.callee;
39
+ if (
40
+ !callee ||
41
+ callee.type !== "MemberExpression" ||
42
+ callee.computed ||
43
+ !callee.object ||
44
+ callee.object.type !== "Identifier" ||
45
+ callee.object.name !== "z" ||
46
+ !callee.property ||
47
+ callee.property.type !== "Identifier" ||
48
+ callee.property.name !== "record"
49
+ ) {
50
+ return;
51
+ }
52
+ if (node.arguments.length !== 1) return;
53
+
54
+ const arg = node.arguments[0];
55
+ // A spread argument cannot be safely rewritten — report without a fix.
56
+ if (arg.type === "SpreadElement") {
57
+ context.report({ node, messageId: "singleArgRecord" });
58
+ return;
59
+ }
60
+
61
+ context.report({
62
+ node,
63
+ messageId: "singleArgRecord",
64
+ fix(fixer) {
65
+ return fixer.insertTextBefore(arg, "z.string(), ");
66
+ },
67
+ });
68
+ },
69
+ };
70
+ },
71
+ };
72
+
73
+ export default rule;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copilotkit/react-ui",
3
- "version": "1.58.0",
3
+ "version": "1.59.0",
4
4
  "private": false,
5
5
  "keywords": [
6
6
  "ai",
@@ -48,9 +48,9 @@
48
48
  "rehype-raw": "^7.0.0",
49
49
  "remark-gfm": "^4.0.1",
50
50
  "remark-math": "^6.0.0",
51
- "@copilotkit/react-core": "1.58.0",
52
- "@copilotkit/shared": "1.58.0",
53
- "@copilotkit/runtime-client-gql": "1.58.0"
51
+ "@copilotkit/react-core": "1.59.0",
52
+ "@copilotkit/runtime-client-gql": "1.59.0",
53
+ "@copilotkit/shared": "1.59.0"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/react": "^19.1.0",
@@ -62,8 +62,8 @@
62
62
  "tsdown": "^0.20.3",
63
63
  "typescript": "^5.2.3",
64
64
  "vitest": "^3.2.4",
65
- "tsconfig": "1.4.12",
66
- "tailwind-config": "1.4.12"
65
+ "tailwind-config": "1.4.12",
66
+ "tsconfig": "1.4.12"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "react": "^18 || ^19 || ^19.0.0-rc"