@github/copilot-language-server 1.551.2 → 1.551.3

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.
Files changed (73) hide show
  1. package/dist/main.js +657 -657
  2. package/dist/node_modules/@github/copilot-sdk/dist/cjs/cliVersion.js +1 -1
  3. package/dist/node_modules/@github/copilot-sdk/dist/cjs/client.js +499 -36
  4. package/dist/node_modules/@github/copilot-sdk/dist/cjs/copilotRequestHandler.js +156 -20
  5. package/dist/node_modules/@github/copilot-sdk/dist/cjs/extension.js +11 -9
  6. package/dist/node_modules/@github/copilot-sdk/dist/cjs/ffiRuntimeHost.js +14 -3
  7. package/dist/node_modules/@github/copilot-sdk/dist/cjs/generated/rpc.js +1305 -304
  8. package/dist/node_modules/@github/copilot-sdk/dist/cjs/host.js +67 -0
  9. package/dist/node_modules/@github/copilot-sdk/dist/cjs/index.js +12 -7
  10. package/dist/node_modules/@github/copilot-sdk/dist/cjs/installationConfirmation.js +98 -0
  11. package/dist/node_modules/@github/copilot-sdk/dist/cjs/runtimeArtifacts.js +1 -0
  12. package/dist/node_modules/@github/copilot-sdk/dist/cjs/schema.js +40 -0
  13. package/dist/node_modules/@github/copilot-sdk/dist/cjs/session.js +474 -151
  14. package/dist/node_modules/@github/copilot-sdk/dist/cjs/sessionFsProvider.js +57 -0
  15. package/dist/node_modules/@github/copilot-sdk/dist/cjs/types.js +5 -2
  16. package/dist/node_modules/@github/copilot-sdk/dist/cjs/{factory.js → workflow.js} +33 -33
  17. package/dist/node_modules/@github/copilot-sdk/package.json +27 -16
  18. package/dist/node_modules/zod/locales/package.json +1 -2
  19. package/dist/node_modules/zod/mini/package.json +1 -2
  20. package/dist/node_modules/zod/package.json +1 -1
  21. package/dist/node_modules/zod/v3/package.json +1 -2
  22. package/dist/node_modules/zod/v4/classic/errors.js +2 -2
  23. package/dist/node_modules/zod/v4/classic/from-json-schema.cjs +16 -31
  24. package/dist/node_modules/zod/v4/classic/from-json-schema.js +16 -31
  25. package/dist/node_modules/zod/v4/classic/package.json +1 -2
  26. package/dist/node_modules/zod/v4/classic/schemas.cjs +119 -358
  27. package/dist/node_modules/zod/v4/classic/schemas.js +118 -356
  28. package/dist/node_modules/zod/v4/core/api.cjs +2 -7
  29. package/dist/node_modules/zod/v4/core/api.js +2 -7
  30. package/dist/node_modules/zod/v4/core/core.cjs +1 -3
  31. package/dist/node_modules/zod/v4/core/core.js +2 -4
  32. package/dist/node_modules/zod/v4/core/errors.cjs +23 -26
  33. package/dist/node_modules/zod/v4/core/errors.js +23 -26
  34. package/dist/node_modules/zod/v4/core/json-schema-processors.cjs +20 -16
  35. package/dist/node_modules/zod/v4/core/json-schema-processors.js +20 -16
  36. package/dist/node_modules/zod/v4/core/package.json +1 -2
  37. package/dist/node_modules/zod/v4/core/parse.cjs +7 -7
  38. package/dist/node_modules/zod/v4/core/parse.js +7 -7
  39. package/dist/node_modules/zod/v4/core/regexes.cjs +3 -9
  40. package/dist/node_modules/zod/v4/core/regexes.js +1 -7
  41. package/dist/node_modules/zod/v4/core/schemas.cjs +65 -211
  42. package/dist/node_modules/zod/v4/core/schemas.js +64 -210
  43. package/dist/node_modules/zod/v4/core/to-json-schema.cjs +1 -12
  44. package/dist/node_modules/zod/v4/core/to-json-schema.js +1 -12
  45. package/dist/node_modules/zod/v4/core/util.cjs +30 -54
  46. package/dist/node_modules/zod/v4/core/util.js +32 -55
  47. package/dist/node_modules/zod/v4/core/versions.cjs +2 -2
  48. package/dist/node_modules/zod/v4/core/versions.js +2 -2
  49. package/dist/node_modules/zod/v4/locales/en.cjs +0 -4
  50. package/dist/node_modules/zod/v4/locales/en.js +0 -4
  51. package/dist/node_modules/zod/v4/locales/fr.cjs +7 -24
  52. package/dist/node_modules/zod/v4/locales/fr.js +7 -24
  53. package/dist/node_modules/zod/v4/locales/index.cjs +1 -8
  54. package/dist/node_modules/zod/v4/locales/index.js +0 -3
  55. package/dist/node_modules/zod/v4/locales/it.cjs +1 -1
  56. package/dist/node_modules/zod/v4/locales/it.js +1 -1
  57. package/dist/node_modules/zod/v4/locales/ka.cjs +8 -8
  58. package/dist/node_modules/zod/v4/locales/ka.js +8 -8
  59. package/dist/node_modules/zod/v4/locales/package.json +1 -2
  60. package/dist/node_modules/zod/v4/locales/uz.cjs +0 -1
  61. package/dist/node_modules/zod/v4/locales/uz.js +0 -1
  62. package/dist/node_modules/zod/v4/mini/package.json +1 -2
  63. package/dist/node_modules/zod/v4/mini/schemas.cjs +4 -41
  64. package/dist/node_modules/zod/v4/mini/schemas.js +4 -40
  65. package/dist/node_modules/zod/v4/package.json +1 -2
  66. package/dist/node_modules/zod/v4-mini/package.json +1 -2
  67. package/package.json +20 -20
  68. package/dist/node_modules/zod/v4/locales/el.cjs +0 -136
  69. package/dist/node_modules/zod/v4/locales/el.js +0 -109
  70. package/dist/node_modules/zod/v4/locales/hr.cjs +0 -149
  71. package/dist/node_modules/zod/v4/locales/hr.js +0 -122
  72. package/dist/node_modules/zod/v4/locales/ro.cjs +0 -146
  73. package/dist/node_modules/zod/v4/locales/ro.js +0 -119
@@ -19,9 +19,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  var sessionFsProvider_exports = {};
20
20
  __export(sessionFsProvider_exports, {
21
21
  SessionFsSqliteTransactionFailure: () => SessionFsSqliteTransactionFailure,
22
+ SessionFsWriteFailure: () => SessionFsWriteFailure,
22
23
  createSessionFsAdapter: () => createSessionFsAdapter
23
24
  });
24
25
  module.exports = __toCommonJS(sessionFsProvider_exports);
26
+ const MAX_BINARY_BYTES = (64 * 1024 * 1024 - 1024) / 4 * 3;
27
+ const MAX_BINARY_CONTENT_LENGTH = Math.ceil(MAX_BINARY_BYTES / 3) * 4;
25
28
  class SessionFsSqliteTransactionFailure extends Error {
26
29
  /** Failure classification reported to the runtime. */
27
30
  errorClass;
@@ -31,6 +34,9 @@ class SessionFsSqliteTransactionFailure extends Error {
31
34
  this.errorClass = errorClass;
32
35
  }
33
36
  }
37
+ class SessionFsWriteFailure extends Error {
38
+ writeChanged = true;
39
+ }
34
40
  function normalizeSqliteParams(params) {
35
41
  if (!params) {
36
42
  return void 0;
@@ -53,10 +59,60 @@ function createSessionFsAdapter(provider) {
53
59
  return { content: "", error: toSessionFsError(err) };
54
60
  }
55
61
  },
62
+ readFileBytes: async ({ path }) => {
63
+ if (!provider.readFileBytes) {
64
+ return {
65
+ content: "",
66
+ error: { code: "UNKNOWN", message: "Binary reads are not supported" }
67
+ };
68
+ }
69
+ try {
70
+ const bytes = await provider.readFileBytes(path);
71
+ if (bytes.length > MAX_BINARY_BYTES) {
72
+ return {
73
+ content: "",
74
+ error: {
75
+ code: "UNKNOWN",
76
+ message: "sessionFs.readFileBytes content exceeds the binary read limit"
77
+ }
78
+ };
79
+ }
80
+ return {
81
+ content: Buffer.from(bytes).toString("base64")
82
+ };
83
+ } catch (err) {
84
+ return { content: "", error: toSessionFsError(err) };
85
+ }
86
+ },
56
87
  writeFile: async ({ path, content, mode }) => {
57
88
  try {
58
89
  await provider.writeFile(path, content, mode);
59
90
  return void 0;
91
+ } catch (err) {
92
+ const error = toSessionFsError(err);
93
+ return err instanceof SessionFsWriteFailure ? { ...error, writeChanged: true } : error;
94
+ }
95
+ },
96
+ writeFileBytes: async ({ path, content, mode }) => {
97
+ if (!provider.writeFileBytes) {
98
+ return { code: "UNKNOWN", message: "Binary writes are not supported" };
99
+ }
100
+ if (content.length > MAX_BINARY_CONTENT_LENGTH) {
101
+ return {
102
+ code: "UNKNOWN",
103
+ message: "sessionFs.writeFileBytes content exceeds the binary write limit"
104
+ };
105
+ }
106
+ const bytes = Buffer.from(content, "base64");
107
+ if (bytes.toString("base64") !== content || bytes.length > MAX_BINARY_BYTES) {
108
+ return {
109
+ code: "UNKNOWN",
110
+ message: "invalid sessionFs.writeFileBytes base64 content"
111
+ };
112
+ }
113
+ try {
114
+ await provider.writeFileBytes(path, bytes, mode);
115
+ return void 0;
60
116
  } catch (err) {
61
117
  return toSessionFsError(err);
62
118
  }
@@ -194,5 +250,6 @@ function toSqliteTransactionError(err) {
194
250
  // Annotate the CommonJS export names for ESM import in node:
195
251
  0 && (module.exports = {
196
252
  SessionFsSqliteTransactionFailure,
253
+ SessionFsWriteFailure,
197
254
  createSessionFsAdapter
198
255
  });
@@ -26,6 +26,7 @@ __export(types_exports, {
26
26
  RuntimeConnection: () => RuntimeConnection,
27
27
  SYSTEM_MESSAGE_SECTIONS: () => SYSTEM_MESSAGE_SECTIONS,
28
28
  SessionFsSqliteTransactionFailure: () => import_sessionFsProvider2.SessionFsSqliteTransactionFailure,
29
+ SessionFsWriteFailure: () => import_sessionFsProvider3.SessionFsWriteFailure,
29
30
  approveAll: () => approveAll,
30
31
  convertMcpCallToolResult: () => convertMcpCallToolResult,
31
32
  createAttributedPermissionResult: () => createAttributedPermissionResult,
@@ -37,6 +38,7 @@ __export(types_exports, {
37
38
  module.exports = __toCommonJS(types_exports);
38
39
  var import_sessionFsProvider = require("./sessionFsProvider.js");
39
40
  var import_sessionFsProvider2 = require("./sessionFsProvider.js");
41
+ var import_sessionFsProvider3 = require("./sessionFsProvider.js");
40
42
  var import_copilotRequestHandler = require("./copilotRequestHandler.js");
41
43
  const RuntimeConnection = {
42
44
  /**
@@ -138,10 +140,10 @@ const SYSTEM_MESSAGE_SECTIONS = {
138
140
  tool_instructions: { description: "Per-tool usage instructions" },
139
141
  custom_instructions: { description: "Repository and organization custom instructions" },
140
142
  runtime_instructions: {
141
- description: "Runtime-provided context and instructions (e.g. system notifications, memories, workspace context, mode-specific instructions, content-exclusion policy)"
143
+ description: "Runtime-provided system-prompt context and instructions, such as system notifications, memories, workspace context, and content-exclusion policy. Mode-specific instructions can travel in transition messages instead."
142
144
  },
143
145
  last_instructions: {
144
- description: "End-of-prompt instructions: parallel tool calling, persistence, task completion"
146
+ description: "End-of-prompt instructions: parallel tool calling, persistence, task completion, and configured subagent-model guidance when the task tool is available"
145
147
  }
146
148
  };
147
149
  function isAttributedPermissionResult(result) {
@@ -182,6 +184,7 @@ const DisableBypassPermissionsModes = {
182
184
  RuntimeConnection,
183
185
  SYSTEM_MESSAGE_SECTIONS,
184
186
  SessionFsSqliteTransactionFailure,
187
+ SessionFsWriteFailure,
185
188
  approveAll,
186
189
  convertMcpCallToolResult,
187
190
  createAttributedPermissionResult,
@@ -16,26 +16,26 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var factory_exports = {};
20
- __export(factory_exports, {
21
- FACTORY_AGENT_OPTION_KEYS: () => FACTORY_AGENT_OPTION_KEYS,
22
- FactoryResumeError: () => FactoryResumeError,
23
- defineFactory: () => defineFactory,
24
- getFactoryDefinition: () => getFactoryDefinition,
25
- isFactoryRunTerminal: () => isFactoryRunTerminal
19
+ var workflow_exports = {};
20
+ __export(workflow_exports, {
21
+ WORKFLOW_AGENT_OPTION_KEYS: () => WORKFLOW_AGENT_OPTION_KEYS,
22
+ WorkflowResumeError: () => WorkflowResumeError,
23
+ defineWorkflow: () => defineWorkflow,
24
+ getWorkflowDefinition: () => getWorkflowDefinition,
25
+ isWorkflowRunTerminal: () => isWorkflowRunTerminal
26
26
  });
27
- module.exports = __toCommonJS(factory_exports);
28
- const FACTORY_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
27
+ module.exports = __toCommonJS(workflow_exports);
28
+ const WORKFLOW_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
29
29
  "completed",
30
30
  "halted",
31
31
  "paused",
32
32
  "cancelled",
33
33
  "error"
34
34
  ]);
35
- function isFactoryRunTerminal(status) {
36
- return FACTORY_TERMINAL_STATUSES.has(status);
35
+ function isWorkflowRunTerminal(status) {
36
+ return WORKFLOW_TERMINAL_STATUSES.has(status);
37
37
  }
38
- const FACTORY_AGENT_OPTION_KEYS = [
38
+ const WORKFLOW_AGENT_OPTION_KEYS = [
39
39
  "label",
40
40
  "schema",
41
41
  "model",
@@ -43,16 +43,16 @@ const FACTORY_AGENT_OPTION_KEYS = [
43
43
  "contextTier",
44
44
  "agent"
45
45
  ];
46
- class FactoryResumeError extends Error {
46
+ class WorkflowResumeError extends Error {
47
47
  constructor(code, message) {
48
48
  super(message);
49
49
  this.code = code;
50
- this.name = "FactoryResumeError";
50
+ this.name = "WorkflowResumeError";
51
51
  }
52
52
  code;
53
53
  }
54
- const factoryHandles = /* @__PURE__ */ new WeakMap();
55
- const MAX_FACTORY_TIMEOUT_SECONDS = 2147483647e-3;
54
+ const workflowHandles = /* @__PURE__ */ new WeakMap();
55
+ const MAX_WORKFLOW_TIMEOUT_SECONDS = 2147483647e-3;
56
56
  const NANO_AIU_PER_AIU = 1e9;
57
57
  function deepFreeze(value) {
58
58
  if (value !== null && typeof value === "object" && !Object.isFrozen(value)) {
@@ -71,24 +71,24 @@ function validateLimits(meta) {
71
71
  for (const field of ["maxConcurrentSubagents", "maxTotalSubagents"]) {
72
72
  const value = limits[field];
73
73
  if (value !== void 0 && (!Number.isInteger(value) || value <= 0)) {
74
- throw new Error(`Factory limit "${field}" must be a positive integer`);
74
+ throw new Error(`Workflow limit "${field}" must be a positive integer`);
75
75
  }
76
76
  }
77
77
  if (limits.timeoutSeconds !== void 0 && (!Number.isFinite(limits.timeoutSeconds) || limits.timeoutSeconds <= 0)) {
78
78
  throw new Error(
79
- 'Factory limit "timeoutSeconds" must be a positive, finite number of seconds'
79
+ 'Workflow limit "timeoutSeconds" must be a positive, finite number of seconds'
80
80
  );
81
81
  }
82
- if (limits.timeoutSeconds !== void 0 && limits.timeoutSeconds > MAX_FACTORY_TIMEOUT_SECONDS) {
82
+ if (limits.timeoutSeconds !== void 0 && limits.timeoutSeconds > MAX_WORKFLOW_TIMEOUT_SECONDS) {
83
83
  throw new Error(
84
- `Factory limit "timeoutSeconds" must not exceed ${MAX_FACTORY_TIMEOUT_SECONDS} seconds`
84
+ `Workflow limit "timeoutSeconds" must not exceed ${MAX_WORKFLOW_TIMEOUT_SECONDS} seconds`
85
85
  );
86
86
  }
87
87
  if (limits.maxAiCredits !== void 0) {
88
88
  const maxNanoAiu = Math.round(limits.maxAiCredits * NANO_AIU_PER_AIU);
89
89
  if (!Number.isFinite(limits.maxAiCredits) || limits.maxAiCredits <= 0 || !Number.isSafeInteger(maxNanoAiu) || maxNanoAiu < 1) {
90
90
  throw new Error(
91
- 'Factory limit "maxAiCredits" must be a positive, finite number that rounds to a safe positive integer nano-AIU ceiling'
91
+ 'Workflow limit "maxAiCredits" must be a positive, finite number that rounds to a safe positive integer nano-AIU ceiling'
92
92
  );
93
93
  }
94
94
  }
@@ -97,15 +97,15 @@ function validatePhases(meta) {
97
97
  const titles = /* @__PURE__ */ new Set();
98
98
  for (const phase of meta.phases) {
99
99
  if (phase.title.trim().length === 0) {
100
- throw new Error("Factory phase titles must not be empty");
100
+ throw new Error("Workflow phase titles must not be empty");
101
101
  }
102
102
  if (titles.has(phase.title)) {
103
- throw new Error(`Factory phase title "${phase.title}" is declared more than once`);
103
+ throw new Error(`Workflow phase title "${phase.title}" is declared more than once`);
104
104
  }
105
105
  titles.add(phase.title);
106
106
  }
107
107
  }
108
- function defineFactory(definition) {
108
+ function defineWorkflow(definition) {
109
109
  const meta = deepFreeze(structuredClone(definition.meta));
110
110
  validateLimits(meta);
111
111
  validatePhases(meta);
@@ -114,21 +114,21 @@ function defineFactory(definition) {
114
114
  run: definition.run
115
115
  };
116
116
  const handle = Object.freeze({ meta });
117
- factoryHandles.set(handle, stored);
117
+ workflowHandles.set(handle, stored);
118
118
  return handle;
119
119
  }
120
- function getFactoryDefinition(handle) {
121
- const definition = factoryHandles.get(handle);
120
+ function getWorkflowDefinition(handle) {
121
+ const definition = workflowHandles.get(handle);
122
122
  if (!definition) {
123
- throw new Error("Invalid factory handle");
123
+ throw new Error("Invalid workflow handle");
124
124
  }
125
125
  return definition;
126
126
  }
127
127
  // Annotate the CommonJS export names for ESM import in node:
128
128
  0 && (module.exports = {
129
- FACTORY_AGENT_OPTION_KEYS,
130
- FactoryResumeError,
131
- defineFactory,
132
- getFactoryDefinition,
133
- isFactoryRunTerminal
129
+ WORKFLOW_AGENT_OPTION_KEYS,
130
+ WorkflowResumeError,
131
+ defineWorkflow,
132
+ getWorkflowDefinition,
133
+ isWorkflowRunTerminal
134
134
  });
@@ -2,10 +2,11 @@
2
2
  "name": "@github/copilot-sdk",
3
3
  "repository": {
4
4
  "type": "git",
5
- "url": "https://github.com/github/copilot-sdk.git"
5
+ "url": "https://github.com/github/copilot-agent-runtime.git",
6
+ "directory": "src/sdk/nodejs"
6
7
  },
7
- "version": "1.0.14",
8
- "copilotCliVersion": "1.0.85",
8
+ "version": "1.0.18",
9
+ "copilotCliVersion": "1.0.94",
9
10
  "description": "TypeScript SDK for programmatic control of GitHub Copilot CLI via JSON-RPC",
10
11
  "main": "./dist/cjs/index.js",
11
12
  "types": "./dist/index.d.ts",
@@ -36,12 +37,13 @@
36
37
  "auth:refresh": "node ../scripts/npm-auth-refresh.mjs --run",
37
38
  "clean": "rimraf --glob dist *.tgz",
38
39
  "build": "tsx esbuild-copilotsdk-nodejs.ts",
39
- "acquire:runtime-packages": "tsx scripts/runtime-package-acquisition.ts",
40
- "pack:release": "tsx scripts/package-sdk.ts",
40
+ "pack:release": "npm run verify:dependency-policy && tsx scripts/package-sdk.ts",
41
+ "verify:dependency-policy": "tsx scripts/verify-dependency-policy.ts",
41
42
  "verify:release-packages": "tsx scripts/verify-release-packages.ts",
42
43
  "release:manifest": "tsx scripts/release-manifest.ts",
43
44
  "prepare:runtime": "tsx scripts/prepare-runtime.ts",
44
45
  "test": "vitest run",
46
+ "test:unit": "vitest run --exclude=\"test/e2e/**\"",
45
47
  "test:watch": "vitest",
46
48
  "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\" --ignore-path .prettierignore",
47
49
  "format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\" --ignore-path .prettierignore",
@@ -64,19 +66,22 @@
64
66
  "author": "GitHub",
65
67
  "license": "MIT",
66
68
  "dependencies": {
67
- "koffi": "^3.2.1",
68
- "vscode-jsonrpc": "^8.2.1",
69
- "zod": "^4.3.6"
69
+ "koffi": "3.2.1",
70
+ "vscode-jsonrpc": "8.2.1",
71
+ "zod": "4.3.6"
70
72
  },
71
73
  "devDependencies": {
74
+ "@microsoft/agent-host-protocol-v09": "npm:@microsoft/agent-host-protocol@0.9.0",
72
75
  "@platformatic/vfs": "^0.3.0",
73
76
  "@types/node": "^25.2.0",
77
+ "@types/semver": "7.8.0",
74
78
  "@types/ws": "^8.18.1",
75
79
  "@typescript-eslint/eslint-plugin": "^8.54.0",
76
80
  "@typescript-eslint/parser": "^8.54.0",
77
81
  "esbuild": "^0.28.1",
78
82
  "eslint": "^9.0.0",
79
83
  "glob": "^13.0.1",
84
+ "hpke-js": "^1.8.0",
80
85
  "json-schema": "^0.4.0",
81
86
  "json-schema-to-typescript": "^15.0.4",
82
87
  "prettier": "^3.8.1",
@@ -94,17 +99,23 @@
94
99
  },
95
100
  "files": [
96
101
  "dist/**/*",
102
+ "!dist/tsconfig.tsbuildinfo",
97
103
  "docs/**/*",
98
104
  "README.md"
99
105
  ],
106
+ "copilotRuntime": {
107
+ "sourceSha": "fdeb5949944ebccf3bb4dda8552a21aa1a09b6f6",
108
+ "version": "1.0.94",
109
+ "visibility": "public"
110
+ },
100
111
  "optionalDependencies": {
101
- "@github/copilot-sdk-darwin-arm64": "1.0.14",
102
- "@github/copilot-sdk-darwin-x64": "1.0.14",
103
- "@github/copilot-sdk-linux-arm64": "1.0.14",
104
- "@github/copilot-sdk-linux-x64": "1.0.14",
105
- "@github/copilot-sdk-linuxmusl-arm64": "1.0.14",
106
- "@github/copilot-sdk-linuxmusl-x64": "1.0.14",
107
- "@github/copilot-sdk-win32-arm64": "1.0.14",
108
- "@github/copilot-sdk-win32-x64": "1.0.14"
112
+ "@github/copilot-sdk-darwin-arm64": "1.0.18",
113
+ "@github/copilot-sdk-darwin-x64": "1.0.18",
114
+ "@github/copilot-sdk-linux-arm64": "1.0.18",
115
+ "@github/copilot-sdk-linux-x64": "1.0.18",
116
+ "@github/copilot-sdk-linuxmusl-arm64": "1.0.18",
117
+ "@github/copilot-sdk-linuxmusl-x64": "1.0.18",
118
+ "@github/copilot-sdk-win32-arm64": "1.0.18",
119
+ "@github/copilot-sdk-win32-x64": "1.0.18"
109
120
  }
110
121
  }
@@ -2,6 +2,5 @@
2
2
  "type": "module",
3
3
  "main": "./index.cjs",
4
4
  "module": "./index.js",
5
- "types": "./index.d.cts",
6
- "sideEffects": false
5
+ "types": "./index.d.cts"
7
6
  }
@@ -2,6 +2,5 @@
2
2
  "type": "module",
3
3
  "main": "./index.cjs",
4
4
  "module": "./index.js",
5
- "types": "./index.d.cts",
6
- "sideEffects": false
5
+ "types": "./index.d.cts"
7
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod",
3
- "version": "4.4.3",
3
+ "version": "4.3.6",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Colin McDonnell <zod@colinhacks.com>",
@@ -2,6 +2,5 @@
2
2
  "type": "module",
3
3
  "main": "./index.cjs",
4
4
  "module": "./index.js",
5
- "types": "./index.d.cts",
6
- "sideEffects": false
5
+ "types": "./index.d.cts"
7
6
  }
@@ -40,8 +40,8 @@ const initializer = (inst, issues) => {
40
40
  // },
41
41
  // });
42
42
  };
43
- export const ZodError = /*@__PURE__*/ core.$constructor("ZodError", initializer);
44
- export const ZodRealError = /*@__PURE__*/ core.$constructor("ZodError", initializer, {
43
+ export const ZodError = core.$constructor("ZodError", initializer);
44
+ export const ZodRealError = core.$constructor("ZodError", initializer, {
45
45
  Parent: Error,
46
46
  });
47
47
  // /** @deprecated Use `z.core.$ZodErrorMapCtx` instead. */
@@ -35,7 +35,7 @@ const z = {
35
35
  iso: _iso,
36
36
  };
37
37
  // Keys that are recognized and handled by the conversion logic
38
- const RECOGNIZED_KEYS = /*@__PURE__*/ new Set([
38
+ const RECOGNIZED_KEYS = new Set([
39
39
  // Schema identification
40
40
  "$schema",
41
41
  "$ref",
@@ -511,6 +511,13 @@ function convertBaseSchema(schema, ctx) {
511
511
  default:
512
512
  throw new Error(`Unsupported type: ${type}`);
513
513
  }
514
+ // Apply metadata
515
+ if (schema.description) {
516
+ zodSchema = zodSchema.describe(schema.description);
517
+ }
518
+ if (schema.default !== undefined) {
519
+ zodSchema = zodSchema.default(schema.default);
520
+ }
514
521
  return zodSchema;
515
522
  }
516
523
  function convertSchema(schema, ctx) {
@@ -555,28 +562,23 @@ function convertSchema(schema, ctx) {
555
562
  if (schema.readOnly === true) {
556
563
  baseSchema = z.readonly(baseSchema);
557
564
  }
558
- // Apply `default` so it wraps the fully-composed schema. This ensures
559
- // `parse(undefined) -> default` works regardless of which branch of
560
- // `convertBaseSchema` produced the inner schema (enum/const/not/typed/etc.).
561
- if (schema.default !== undefined) {
562
- baseSchema = baseSchema.default(schema.default);
563
- }
564
- // Collect non-description annotation metadata into the user-supplied
565
- // registry. Description is handled separately below via `.describe()` to
566
- // preserve the contract that `schema.description` reads from globalRegistry.
565
+ // Collect metadata: core schema keywords and unrecognized keys
567
566
  const extraMeta = {};
567
+ // Core schema keywords that should be captured as metadata
568
568
  const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
569
569
  for (const key of coreMetadataKeys) {
570
570
  if (key in schema) {
571
571
  extraMeta[key] = schema[key];
572
572
  }
573
573
  }
574
+ // Content keywords - store as metadata
574
575
  const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
575
576
  for (const key of contentMetadataKeys) {
576
577
  if (key in schema) {
577
578
  extraMeta[key] = schema[key];
578
579
  }
579
580
  }
581
+ // Unrecognized keys (custom metadata)
580
582
  for (const key of Object.keys(schema)) {
581
583
  if (!RECOGNIZED_KEYS.has(key)) {
582
584
  extraMeta[key] = schema[key];
@@ -585,12 +587,6 @@ function convertSchema(schema, ctx) {
585
587
  if (Object.keys(extraMeta).length > 0) {
586
588
  ctx.registry.add(baseSchema, extraMeta);
587
589
  }
588
- // Apply description last. `.describe()` clones the schema and sets
589
- // `_zod.parent` on the clone, so registry lookups on the returned reference
590
- // still resolve `extraMeta` via parent inheritance.
591
- if (schema.description) {
592
- baseSchema = baseSchema.describe(schema.description);
593
- }
594
590
  return baseSchema;
595
591
  }
596
592
  /**
@@ -600,26 +596,15 @@ function fromJSONSchema(schema, params) {
600
596
  if (typeof schema === "boolean") {
601
597
  return schema ? z.any() : z.never();
602
598
  }
603
- // Normalize input via a JSON round-trip. This guarantees the converter
604
- // walks a plain, finite, JSON-valid object graph: cyclic inputs fail here,
605
- // getter/Proxy-based properties are materialized into static values, and
606
- // class instances collapse to plain objects.
607
- let normalized;
608
- try {
609
- normalized = JSON.parse(JSON.stringify(schema));
610
- }
611
- catch {
612
- throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas");
613
- }
614
- const version = detectVersion(normalized, params?.defaultTarget);
615
- const defs = (normalized.$defs || normalized.definitions || {});
599
+ const version = detectVersion(schema, params?.defaultTarget);
600
+ const defs = (schema.$defs || schema.definitions || {});
616
601
  const ctx = {
617
602
  version,
618
603
  defs,
619
604
  refs: new Map(),
620
605
  processing: new Set(),
621
- rootSchema: normalized,
606
+ rootSchema: schema,
622
607
  registry: params?.registry ?? registries_js_1.globalRegistry,
623
608
  };
624
- return convertSchema(normalized, ctx);
609
+ return convertSchema(schema, ctx);
625
610
  }
@@ -9,7 +9,7 @@ const z = {
9
9
  iso: _iso,
10
10
  };
11
11
  // Keys that are recognized and handled by the conversion logic
12
- const RECOGNIZED_KEYS = /*@__PURE__*/ new Set([
12
+ const RECOGNIZED_KEYS = new Set([
13
13
  // Schema identification
14
14
  "$schema",
15
15
  "$ref",
@@ -485,6 +485,13 @@ function convertBaseSchema(schema, ctx) {
485
485
  default:
486
486
  throw new Error(`Unsupported type: ${type}`);
487
487
  }
488
+ // Apply metadata
489
+ if (schema.description) {
490
+ zodSchema = zodSchema.describe(schema.description);
491
+ }
492
+ if (schema.default !== undefined) {
493
+ zodSchema = zodSchema.default(schema.default);
494
+ }
488
495
  return zodSchema;
489
496
  }
490
497
  function convertSchema(schema, ctx) {
@@ -529,28 +536,23 @@ function convertSchema(schema, ctx) {
529
536
  if (schema.readOnly === true) {
530
537
  baseSchema = z.readonly(baseSchema);
531
538
  }
532
- // Apply `default` so it wraps the fully-composed schema. This ensures
533
- // `parse(undefined) -> default` works regardless of which branch of
534
- // `convertBaseSchema` produced the inner schema (enum/const/not/typed/etc.).
535
- if (schema.default !== undefined) {
536
- baseSchema = baseSchema.default(schema.default);
537
- }
538
- // Collect non-description annotation metadata into the user-supplied
539
- // registry. Description is handled separately below via `.describe()` to
540
- // preserve the contract that `schema.description` reads from globalRegistry.
539
+ // Collect metadata: core schema keywords and unrecognized keys
541
540
  const extraMeta = {};
541
+ // Core schema keywords that should be captured as metadata
542
542
  const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
543
543
  for (const key of coreMetadataKeys) {
544
544
  if (key in schema) {
545
545
  extraMeta[key] = schema[key];
546
546
  }
547
547
  }
548
+ // Content keywords - store as metadata
548
549
  const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
549
550
  for (const key of contentMetadataKeys) {
550
551
  if (key in schema) {
551
552
  extraMeta[key] = schema[key];
552
553
  }
553
554
  }
555
+ // Unrecognized keys (custom metadata)
554
556
  for (const key of Object.keys(schema)) {
555
557
  if (!RECOGNIZED_KEYS.has(key)) {
556
558
  extraMeta[key] = schema[key];
@@ -559,12 +561,6 @@ function convertSchema(schema, ctx) {
559
561
  if (Object.keys(extraMeta).length > 0) {
560
562
  ctx.registry.add(baseSchema, extraMeta);
561
563
  }
562
- // Apply description last. `.describe()` clones the schema and sets
563
- // `_zod.parent` on the clone, so registry lookups on the returned reference
564
- // still resolve `extraMeta` via parent inheritance.
565
- if (schema.description) {
566
- baseSchema = baseSchema.describe(schema.description);
567
- }
568
564
  return baseSchema;
569
565
  }
570
566
  /**
@@ -574,26 +570,15 @@ export function fromJSONSchema(schema, params) {
574
570
  if (typeof schema === "boolean") {
575
571
  return schema ? z.any() : z.never();
576
572
  }
577
- // Normalize input via a JSON round-trip. This guarantees the converter
578
- // walks a plain, finite, JSON-valid object graph: cyclic inputs fail here,
579
- // getter/Proxy-based properties are materialized into static values, and
580
- // class instances collapse to plain objects.
581
- let normalized;
582
- try {
583
- normalized = JSON.parse(JSON.stringify(schema));
584
- }
585
- catch {
586
- throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas");
587
- }
588
- const version = detectVersion(normalized, params?.defaultTarget);
589
- const defs = (normalized.$defs || normalized.definitions || {});
573
+ const version = detectVersion(schema, params?.defaultTarget);
574
+ const defs = (schema.$defs || schema.definitions || {});
590
575
  const ctx = {
591
576
  version,
592
577
  defs,
593
578
  refs: new Map(),
594
579
  processing: new Set(),
595
- rootSchema: normalized,
580
+ rootSchema: schema,
596
581
  registry: params?.registry ?? globalRegistry,
597
582
  };
598
- return convertSchema(normalized, ctx);
583
+ return convertSchema(schema, ctx);
599
584
  }
@@ -2,6 +2,5 @@
2
2
  "type": "module",
3
3
  "main": "./index.cjs",
4
4
  "module": "./index.js",
5
- "types": "./index.d.cts",
6
- "sideEffects": false
5
+ "types": "./index.d.cts"
7
6
  }