@yanlinglabs/winter-runtime-sdk 0.0.1 → 0.0.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.
package/dist/index.js CHANGED
@@ -1,421 +1,48 @@
1
+ import {
2
+ EXECUTION_INDIRECTION_ENV_NAMES,
3
+ EXECUTION_INDIRECTION_ENV_PREFIXES,
4
+ NotImplementedYet,
5
+ OFFICIAL_DISCLOSURES,
6
+ OfficialConfigurationError,
7
+ OfficialConnectionError,
8
+ OfficialContainmentBreachError,
9
+ OfficialExecutableNotFoundError,
10
+ OfficialInvalidResumeError,
11
+ OfficialKilledError,
12
+ OfficialMcpError,
13
+ OfficialNonzeroExitError,
14
+ OfficialStdoutUnterminatedError,
15
+ PINNED_OFFICIAL_RUNTIME,
16
+ RuntimeHandoffRequiredError,
17
+ RuntimeLaunchInputError,
18
+ RuntimeSdkDisposedError,
19
+ RuntimeSdkError,
20
+ RuntimeSdkVersionError,
21
+ TRAFFIC_OPT_OUT_VARIABLES,
22
+ TRAFFIC_OPT_OUT_VARIABLE_NAMES,
23
+ UnaddressableEntryError,
24
+ VENDOR_HOME_SEGMENT_RE,
25
+ authVariableSetKey,
26
+ buildOfficialChildEnv,
27
+ containmentDecisionFor,
28
+ containmentDispositions,
29
+ containmentPaths,
30
+ fetchAuthCredentials,
31
+ isExecutionIndirectionVariable,
32
+ minimalOsEnvironmentFrom,
33
+ officialBranchLabel,
34
+ officialDisallowedTools,
35
+ officialToolAliases,
36
+ resolveSavedApprovalDisposition,
37
+ targetsForbiddenPath
38
+ } from "./index-mfd2rg7x.js";
39
+
1
40
  // src/index.ts
2
41
  export * from "@yanlinglabs/winter-agent-sdk";
3
42
 
4
- // src/errors.ts
5
- class RuntimeSdkError extends Error {
6
- constructor(message, options) {
7
- super(message, options);
8
- this.name = new.target.name;
9
- const capture = Error.captureStackTrace;
10
- if (typeof capture === "function")
11
- capture(this, new.target);
12
- }
13
- }
14
-
15
- class RuntimeHandoffRequiredError extends RuntimeSdkError {
16
- from;
17
- to;
18
- address;
19
- constructor(args) {
20
- super(`winter-runtime-sdk: ${args.address} is persisted on the ${args.from} runtime and this query asks for ${args.to}. A runtime change mid-session is \`sdk.handoff(session, "${args.to}")\` — WS-05 §12's certified transfer — or a visible fork (\`forkSession\`); serving the new runtime on the old transcript would be the silent rewrite D13 forbids`);
21
- this.from = args.from;
22
- this.to = args.to;
23
- this.address = args.address;
24
- }
25
- }
26
-
27
- class RuntimeLaunchInputError extends RuntimeSdkError {
28
- field;
29
- constructor(args) {
30
- super(`winter-runtime-sdk: the official leg needs \`${args.field}\` — ${args.reason}`);
31
- this.field = args.field;
32
- }
33
- }
34
-
35
- class UnaddressableEntryError extends RuntimeSdkError {
36
- address;
37
- constructor(address) {
38
- super(`winter-runtime-sdk: ${JSON.stringify(address)} is not a canonical runtime address, so a directory row under it would be listed to the model by ListAgents and refused by every resolution door (WS-15 §6.1). Build it with serializeRuntimeAddress(buildSessionAddress(<winter session id>)) — the canonical forms are "session:<id>" and "agent:<parent>:<child>"`);
39
- this.address = address;
40
- }
41
- }
42
-
43
- class RuntimeSdkVersionError extends RuntimeSdkError {
44
- expected;
45
- actual;
46
- constructor(args) {
47
- super(args.message ?? `winter-runtime-sdk: version matrix refuses this peer set — expected ${args.expected}, got ${args.actual}`);
48
- this.expected = args.expected;
49
- this.actual = args.actual;
50
- }
51
- }
52
-
53
- class NotImplementedYet extends RuntimeSdkError {
54
- lane;
55
- seam;
56
- constructor(lane, seam) {
57
- super(`winter-runtime-sdk: ${seam} is not implemented yet — Phase 7b ${lane} owns it (the spine ships the signature, not the behaviour)`);
58
- this.lane = lane;
59
- this.seam = seam;
60
- }
61
- }
62
-
63
- class RuntimeSdkDisposedError extends RuntimeSdkError {
64
- constructor(method) {
65
- super(`winter-runtime-sdk: ${method}() was called after dispose()`);
66
- }
67
- }
68
-
69
43
  // src/door.ts
70
44
  import { buildChildAddress, buildSessionAddress, serializeRuntimeAddress } from "@yanlinglabs/winter-agent-sdk/messaging";
71
-
72
- // src/official/branding.ts
73
- function officialBranchLabel(brand) {
74
- return `${brand.processLabel}-claude-agent`;
75
- }
76
-
77
- // src/official/aliases.ts
78
- import { mcpToolName } from "@yanlinglabs/winter-agent-sdk";
79
-
80
- // src/native-args.ts
81
- import { validateToField } from "@yanlinglabs/winter-agent-sdk/messaging";
82
- var SEND_MESSAGE_TO_MAX = 300;
83
- var SEND_MESSAGE_SUMMARY_MAX = 200;
84
- var LIST_AGENTS_FIELD_MAX = 256;
85
- var NATIVE_SEND_MESSAGE_SCHEMA = {
86
- type: "object",
87
- properties: {
88
- to: { type: "string", maxLength: SEND_MESSAGE_TO_MAX, description: 'no newline, no "*" broadcast' },
89
- message: { type: "string", description: 'required; defaults "" for pure idle subscription' },
90
- summary: { type: "string", maxLength: SEND_MESSAGE_SUMMARY_MAX },
91
- notify_when_idle: { type: "boolean", description: "one-shot; main conversation -> same-machine session only" }
92
- },
93
- required: ["to", "message"]
94
- };
95
- var NATIVE_LIST_AGENTS_SCHEMA = {
96
- type: "object",
97
- properties: {
98
- channel: { type: "string", maxLength: LIST_AGENTS_FIELD_MAX, description: "reserved" },
99
- q: { type: "string", maxLength: LIST_AGENTS_FIELD_MAX, description: "reserved" }
100
- }
101
- };
102
- var NATIVE_LIST_AGENTS_OUTPUT_SCHEMA = {
103
- type: "object",
104
- properties: { listing: { type: "string" } },
105
- required: ["listing"]
106
- };
107
- var SEND_MESSAGE_FIELDS = new Set(Object.keys(NATIVE_SEND_MESSAGE_SCHEMA.properties));
108
- var LIST_AGENTS_FIELDS = new Set(Object.keys(NATIVE_LIST_AGENTS_SCHEMA.properties));
109
- function acceptNativeSendMessageArgs(input) {
110
- if (typeof input !== "object" || input === null)
111
- return { ok: false, reason: "expected an object of SendMessage arguments" };
112
- const record = input;
113
- const extra = Object.keys(record).filter((key) => !SEND_MESSAGE_FIELDS.has(key));
114
- if (extra.length > 0)
115
- return { ok: false, reason: `unknown argument(s): ${extra.join(", ")}` };
116
- const to = record["to"];
117
- const validated = validateToField(to);
118
- if (!validated.ok)
119
- return { ok: false, reason: validated.message };
120
- const message = record["message"];
121
- if (typeof message !== "string")
122
- return { ok: false, reason: "`message` is required and must be a string (an empty string is a pure idle subscription)" };
123
- const summary = record["summary"];
124
- if (summary !== undefined && (typeof summary !== "string" || summary.length > SEND_MESSAGE_SUMMARY_MAX)) {
125
- return { ok: false, reason: `\`summary\` must be a string of at most ${SEND_MESSAGE_SUMMARY_MAX} characters` };
126
- }
127
- const notify = record["notify_when_idle"];
128
- if (notify !== undefined && typeof notify !== "boolean")
129
- return { ok: false, reason: "`notify_when_idle` must be a boolean" };
130
- return {
131
- ok: true,
132
- args: {
133
- to,
134
- message,
135
- ...summary === undefined ? {} : { summary },
136
- ...notify === undefined ? {} : { notify_when_idle: notify }
137
- }
138
- };
139
- }
140
- function acceptNativeListAgentsArgs(input) {
141
- if (input === undefined || input === null)
142
- return { ok: true, args: {} };
143
- if (typeof input !== "object")
144
- return { ok: false, reason: "expected an object of ListAgents arguments" };
145
- const record = input;
146
- const extra = Object.keys(record).filter((key) => !LIST_AGENTS_FIELDS.has(key));
147
- if (extra.length > 0)
148
- return { ok: false, reason: `unknown argument(s): ${extra.join(", ")}` };
149
- for (const field of ["channel", "q"]) {
150
- const value = record[field];
151
- if (value !== undefined && (typeof value !== "string" || value.length > LIST_AGENTS_FIELD_MAX)) {
152
- return { ok: false, reason: `\`${field}\` must be a string of at most ${LIST_AGENTS_FIELD_MAX} characters` };
153
- }
154
- }
155
- return {
156
- ok: true,
157
- args: {
158
- ...typeof record["channel"] === "string" ? { channel: record["channel"] } : {},
159
- ...typeof record["q"] === "string" ? { q: record["q"] } : {}
160
- }
161
- };
162
- }
163
-
164
- // src/official/aliases.ts
165
- var ALIASED_BUILTINS = [
166
- { builtin: "SendMessage", tool: "send_message" },
167
- { builtin: "ListAgents", tool: "list_agents" }
168
- ];
169
- function officialToolAliases(brand) {
170
- return Object.fromEntries(ALIASED_BUILTINS.map(({ builtin, tool }) => [builtin, mcpToolName(brand, tool)]));
171
- }
172
- function aliasTargetFor(builtin, brand) {
173
- const entry = ALIASED_BUILTINS.find((candidate) => candidate.builtin === builtin);
174
- if (entry === undefined)
175
- throw new TypeError(`not an aliased builtin: ${String(builtin)}`);
176
- return mcpToolName(brand, entry.tool);
177
- }
178
- function aliasDenyNames(builtin, brand) {
179
- return [builtin, aliasTargetFor(builtin, brand)];
180
- }
181
-
182
- // src/official/errors.ts
183
- class OfficialBranchError extends RuntimeSdkError {
184
- crashClass;
185
- branch;
186
- constructor(message, branchLabel, options) {
187
- super(message, options);
188
- this.branch = branchLabel;
189
- }
190
- }
191
-
192
- class OfficialConfigurationError extends OfficialBranchError {
193
- code = "official_configuration_invalid";
194
- winterClass = "WinterSDKError";
195
- option;
196
- constructor(args) {
197
- super(`${args.branchLabel}: ${args.option} — ${args.reason}`, args.branchLabel);
198
- this.option = args.option;
199
- }
200
- }
201
-
202
- class OfficialExecutableNotFoundError extends OfficialBranchError {
203
- code = "official_executable_not_found";
204
- winterClass = "CLIConnectionError";
205
- crashClass = "executable-not-found";
206
- path;
207
- constructor(args) {
208
- super(`${args.branchLabel}: the vendored runtime was not found at ${args.path}`, args.branchLabel, args.cause === undefined ? undefined : { cause: args.cause });
209
- this.path = args.path;
210
- }
211
- }
212
-
213
- class OfficialConnectionError extends OfficialBranchError {
214
- code = "official_connection_failure";
215
- winterClass = "CLIConnectionError";
216
- crashClass = "connection-failure";
217
- constructor(args) {
218
- super(`${args.branchLabel}: the runtime connection failed — ${args.reason}`, args.branchLabel, args.cause === undefined ? undefined : { cause: args.cause });
219
- }
220
- }
221
- class OfficialNonzeroExitError extends OfficialBranchError {
222
- code = "official_nonzero_exit";
223
- winterClass = "ProcessError";
224
- crashClass = "nonzero-exit";
225
- exitCode;
226
- signal;
227
- stderrTail;
228
- constructor(args) {
229
- super(`${args.branchLabel}: the runtime exited with code ${String(args.exitCode)}${args.signal === null ? "" : ` (signal ${args.signal})`}`, args.branchLabel);
230
- this.exitCode = args.exitCode;
231
- this.signal = args.signal;
232
- this.stderrTail = args.stderrTail;
233
- }
234
- }
235
-
236
- class OfficialKilledError extends OfficialBranchError {
237
- code = "official_killed";
238
- winterClass = "ProcessError";
239
- crashClass = "killed";
240
- signal;
241
- constructor(args) {
242
- super(`${args.branchLabel}: the runtime was killed with ${args.signal} — ${args.reason}`, args.branchLabel);
243
- this.signal = args.signal;
244
- }
245
- }
246
-
247
- class OfficialContainmentBreachError extends OfficialBranchError {
248
- code = "official_containment_breach";
249
- winterClass = "WinterSDKError";
250
- tool;
251
- created;
252
- removed;
253
- retained;
254
- constructor(args) {
255
- super(`${args.branchLabel}: ${args.toolName} created ${args.created.length} vendor-named path(s) that the pre-hoc scan did not see; ${args.removed.length} removed, ${args.retained.length} retained (WS-14 §8)`, args.branchLabel);
256
- this.tool = args.toolName;
257
- this.created = [...args.created];
258
- this.removed = [...args.removed];
259
- this.retained = [...args.retained];
260
- }
261
- }
262
-
263
- class OfficialStdoutUnterminatedError extends OfficialBranchError {
264
- code = "official_stdout_unterminated";
265
- winterClass = "ProcessError";
266
- crashClass = "stdout-unterminated";
267
- graceMs;
268
- constructor(args) {
269
- super(`${args.branchLabel}: the runtime exited but its stdout did not close within ${args.graceMs}ms; the exit was forwarded on the grace timer`, args.branchLabel);
270
- this.graceMs = args.graceMs;
271
- }
272
- }
273
- class OfficialInvalidResumeError extends OfficialBranchError {
274
- code = "official_invalid_resume";
275
- winterClass = "WinterSDKError";
276
- constructor(args) {
277
- super(`${args.branchLabel}: invalid resume/fork — ${args.reason}`, args.branchLabel);
278
- }
279
- }
280
-
281
- // src/official/containment.ts
282
- var FORBIDDEN_TARGETS = {
283
- instructionsFile: "CLAUDE.md",
284
- projectDir: ".claude",
285
- userPlansDir: ".claude/plans"
286
- };
287
- function containmentPaths(brand) {
288
- return {
289
- worktrees: `${brand.projectDirName}/worktrees`,
290
- workflows: `${brand.projectDirName}/workflows`,
291
- plans: `${brand.projectDirName}/plans`,
292
- localSettings: `${brand.projectDirName}/settings.local.json`
293
- };
294
- }
295
- function resolveSavedApprovalDisposition(policy, branchLabel) {
296
- const disposition = policy.savedWebFetchApprovals ?? "disable";
297
- if (disposition === "redirect") {
298
- throw new OfficialConfigurationError({
299
- option: "containment.savedWebFetchApprovals",
300
- reason: "`redirect` cannot be honoured on this branch: nothing routes a durable approval anywhere, so passing it through means the RUNTIME writes its own project settings file — measured, with an ordinary broker. §8 denies that write either way, so this branch supports `disable` until a host replacement exists (WS-14 §8/§16 q2)",
301
- branchLabel
302
- });
303
- }
304
- return disposition;
305
- }
306
- function officialDisallowedTools(policy = {}, brand) {
307
- const denied = ["CronCreate"];
308
- if (policy.deniedAliasedBuiltins !== undefined && brand !== undefined) {
309
- for (const builtin of policy.deniedAliasedBuiltins)
310
- denied.push(...aliasDenyNames(builtin, brand));
311
- }
312
- return denied;
313
- }
314
- var norm = (path) => path.replace(/\\/g, "/").replace(/\/+/g, "/");
315
- var fold = (value) => value.normalize("NFKC").toLowerCase();
316
- var FORBIDDEN_PROJECT_DIR = fold(FORBIDDEN_TARGETS.projectDir);
317
- var FORBIDDEN_INSTRUCTIONS_FILE = fold(FORBIDDEN_TARGETS.instructionsFile);
318
- function targetsForbiddenPath(rawPath) {
319
- const segments = norm(rawPath).split("/").filter((segment) => segment.length > 0).map(fold);
320
- const index = segments.indexOf(FORBIDDEN_PROJECT_DIR);
321
- if (index >= 0) {
322
- return { forbidden: true, target: segments[index + 1] === "plans" ? FORBIDDEN_TARGETS.userPlansDir : FORBIDDEN_TARGETS.projectDir };
323
- }
324
- if (segments[segments.length - 1] === FORBIDDEN_INSTRUCTIONS_FILE)
325
- return { forbidden: true, target: FORBIDDEN_TARGETS.instructionsFile };
326
- return { forbidden: false, target: "" };
327
- }
328
- var VENDOR_HOME_SEGMENT_RE = /(^|\/)\.claude(\/|$)/i;
329
- var PATH_FIELDS = [
330
- "file_path",
331
- "filePath",
332
- "path",
333
- "notebook_path",
334
- "notebookPath",
335
- "directory",
336
- "dir",
337
- "target_file",
338
- "targetFile",
339
- "file",
340
- "plan_file_path",
341
- "planFilePath"
342
- ];
343
- var COMMAND_PROJECT_DIR_RE = /(?:^|[^A-Za-z0-9_.\\-])\.claude(?![A-Za-z0-9_-])/i;
344
- var COMMAND_INSTRUCTIONS_FILE_RE = /(?:^|[^A-Za-z0-9_\\-])claude\.md(?![A-Za-z0-9_.-])/i;
345
- function isTruthy(value) {
346
- if (value === true)
347
- return true;
348
- if (typeof value === "number")
349
- return value !== 0;
350
- if (typeof value !== "string")
351
- return false;
352
- return ["true", "1", "yes", "on"].includes(value.trim().toLowerCase());
353
- }
354
- var WORKTREE_TOOLS = ["EnterWorktree", "ExitWorktree", "WorktreeCreate"];
355
- var AGENT_TOOLS = ["Task", "Agent"];
356
- var WORKFLOW_TOOLS = ["Workflow"];
357
- function containmentDecisionFor(toolName, input, policy = {}) {
358
- const deny = (target, what) => ({
359
- allow: false,
360
- target,
361
- reason: `${toolName} may not create or modify ${what}: this session runs on the product's own project layout, and the vendor-named path is redirected (WS-14 §8)`
362
- });
363
- for (const field of PATH_FIELDS) {
364
- const value = input[field];
365
- if (typeof value !== "string")
366
- continue;
367
- const hit = targetsForbiddenPath(value);
368
- if (hit.forbidden)
369
- return deny(hit.target, value);
370
- }
371
- for (const field of ["command", "script", "code"]) {
372
- const value = input[field];
373
- if (typeof value !== "string")
374
- continue;
375
- const command = value.normalize("NFKC");
376
- if (COMMAND_PROJECT_DIR_RE.test(command))
377
- return deny(FORBIDDEN_TARGETS.projectDir, value);
378
- if (COMMAND_INSTRUCTIONS_FILE_RE.test(command))
379
- return deny(FORBIDDEN_TARGETS.instructionsFile, value);
380
- const unquoted = command.replace(/[\\'"`]/g, "");
381
- if (COMMAND_PROJECT_DIR_RE.test(unquoted))
382
- return deny(FORBIDDEN_TARGETS.projectDir, value);
383
- if (COMMAND_INSTRUCTIONS_FILE_RE.test(unquoted))
384
- return deny(FORBIDDEN_TARGETS.instructionsFile, value);
385
- }
386
- const paths = containmentPaths({ projectDirName: policy.projectDirName ?? "" });
387
- if ((policy.worktrees ?? "deny") === "deny") {
388
- if (WORKTREE_TOOLS.includes(toolName)) {
389
- return {
390
- allow: false,
391
- target: `${FORBIDDEN_TARGETS.projectDir}/worktrees/`,
392
- reason: `${toolName} writes the vendor's own worktree directory; on this branch worktrees belong under ${paths.worktrees || "the product's project directory"} and the host's schema-compatible replacement owns them (WS-14 §8)`
393
- };
394
- }
395
- if (AGENT_TOOLS.includes(toolName) && String(input["isolation"] ?? "") === "worktree") {
396
- return {
397
- allow: false,
398
- target: `${FORBIDDEN_TARGETS.projectDir}/worktrees/`,
399
- reason: `an isolated agent worktree writes the vendor's own worktree directory; on this branch it belongs under ${paths.worktrees || "the product's project directory"} (WS-14 §8)`
400
- };
401
- }
402
- }
403
- if ((policy.workflows ?? "deny") === "deny" && WORKFLOW_TOOLS.includes(toolName)) {
404
- return {
405
- allow: false,
406
- target: `${FORBIDDEN_TARGETS.projectDir}/workflows/`,
407
- reason: `named workflow resolution reads the vendor's own workflows directory; on this branch workflows resolve under ${paths.workflows || "the product's project directory"} (WS-14 §8, D8)`
408
- };
409
- }
410
- if (toolName === "CronCreate" && isTruthy(input["durable"])) {
411
- return {
412
- allow: false,
413
- target: `${FORBIDDEN_TARGETS.projectDir}/scheduled_tasks.json`,
414
- reason: "durable scheduled tasks are unavailable on this branch: the vendor's durable variant persists into its own project directory (WS-14 §8)"
415
- };
416
- }
417
- return { allow: true };
418
- }
45
+ import { transcriptSourceForSessionKey } from "@yanlinglabs/winter-agent-sdk/tools";
419
46
 
420
47
  // src/official/callbacks.ts
421
48
  var DURABLE_APPROVAL_DESTINATIONS = ["userSettings", "projectSettings", "localSettings"];
@@ -426,14 +53,14 @@ function createApprovalBridge(options) {
426
53
  const request = { toolName, input, ...rest };
427
54
  const containment = containmentDecisionFor(toolName, input, containmentPolicy);
428
55
  if (!containment.allow) {
429
- const result = { behavior: "deny", message: containment.reason, toolUseID: request.toolUseID };
430
- options.onDecision?.({ request, result, source: "containment-floor" });
431
- return result;
56
+ const result2 = { behavior: "deny", message: containment.reason, toolUseID: request.toolUseID };
57
+ options.onDecision?.({ request, result: result2, source: "containment-floor" });
58
+ return result2;
432
59
  }
433
60
  if (options.mode === "dontAsk") {
434
- const result = { behavior: "allow", updatedInput: input, toolUseID: request.toolUseID };
435
- options.onDecision?.({ request, result, source: "dont-ask" });
436
- return result;
61
+ const result2 = { behavior: "allow", updatedInput: input, toolUseID: request.toolUseID };
62
+ options.onDecision?.({ request, result: result2, source: "dont-ask" });
63
+ return result2;
437
64
  }
438
65
  const result = await options.broker(request);
439
66
  if (savedApprovals === "disable" && result.behavior === "allow" && result.updatedPermissions !== undefined) {
@@ -480,995 +107,8 @@ function createContainmentHooks(options) {
480
107
  return { PreToolUse: [{ hooks: [guard] }] };
481
108
  }
482
109
 
483
- // src/official/auth.ts
484
- var AUTH_FAMILY_VARIABLES = {
485
- "api-key": ["ANTHROPIC_API_KEY"],
486
- "console-oauth": ["ANTHROPIC_AUTH_TOKEN", "ANTHROPIC_BASE_URL"],
487
- bedrock: ["CLAUDE_CODE_USE_BEDROCK", "AWS_REGION", "AWS_PROFILE", "AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN", "AWS_BEARER_TOKEN_BEDROCK", "ANTHROPIC_BEDROCK_BASE_URL"],
488
- vertex: ["CLAUDE_CODE_USE_VERTEX", "ANTHROPIC_VERTEX_PROJECT_ID", "CLOUD_ML_REGION", "GOOGLE_APPLICATION_CREDENTIALS", "ANTHROPIC_VERTEX_BASE_URL"],
489
- "claude-oauth": [],
490
- "local-none": []
491
- };
492
- var AUTH_SHAPED_RE = /^(?:ANTHROPIC_|AWS_|GOOGLE_|GCP_|AZURE_|CLOUD_ML_|VERTEX_|BEDROCK_|CLAUDE_(?:CODE_)?(?:USE_|SKIP_|HOST_|OAUTH_|SESSION_|BRIDGE_|LOCAL_|SECURESTORAGE_|IDENTITY_))|_(?:API_KEY|AUTH_TOKEN|TOKEN|SECRET|CREDENTIALS|CREDS|PASSWORD|PASSWD)$/;
493
- function isAuthShapedVariable(name) {
494
- return AUTH_SHAPED_RE.test(name) || /_(?:API_KEY|AUTH_TOKEN|TOKEN|SECRET|CREDENTIALS|CREDS|PASSWORD|PASSWD)$/.test(name);
495
- }
496
- var ALL_AUTH_VARIABLES = Object.values(AUTH_FAMILY_VARIABLES).flat().filter((name, index, all) => all.indexOf(name) === index);
497
- var NEVER_INJECTED_AUTH_VARIABLES = ["CLAUDE_CODE_OAUTH_TOKEN"];
498
- function authVariableSetKey(selection) {
499
- switch (selection.authFamily) {
500
- case "cloud-credential-chain":
501
- return selection.providerId.toLowerCase().includes("vertex") ? "vertex" : "bedrock";
502
- case "custom":
503
- return "custom";
504
- default:
505
- return selection.authFamily;
506
- }
507
- }
508
- function allowedAuthVariables(selection) {
509
- const key = authVariableSetKey(selection);
510
- return key === "custom" ? undefined : AUTH_FAMILY_VARIABLES[key];
511
- }
512
- function validateAuthEnvironment(args) {
513
- const names = Object.keys(args.credentials);
514
- for (const name of names) {
515
- if (NEVER_INJECTED_AUTH_VARIABLES.includes(name)) {
516
- throw new OfficialConfigurationError({
517
- option: `env.${name}`,
518
- reason: "this credential is never injected on this branch: D14 gates the subscription-OAuth route, and its supported flow stores credentials inside the spool namespace instead (WS-14 §12, WS-01 §2.5)",
519
- branchLabel: args.branchLabel
520
- });
521
- }
522
- }
523
- if (args.selection.authFamily === "claude-oauth") {
524
- if (!args.gate.approved) {
525
- throw new OfficialConfigurationError({
526
- option: "selection.authFamily",
527
- reason: "the Claude OAuth branch is ship-gated pending written approval (D14); the shippable branch uses API-key, cloud-credential-chain or gateway auth only",
528
- branchLabel: args.branchLabel
529
- });
530
- }
531
- if (names.length > 0) {
532
- throw new OfficialConfigurationError({
533
- option: "credentials",
534
- reason: `the Claude OAuth family injects NO credential variable — its stored subscription state lives inside the spool namespace — but ${names.join(", ")} was supplied`,
535
- branchLabel: args.branchLabel
536
- });
537
- }
538
- return;
539
- }
540
- const allowed = allowedAuthVariables(args.selection);
541
- if (allowed !== undefined) {
542
- const stray = names.filter((name) => !allowed.includes(name));
543
- if (stray.length > 0) {
544
- throw new OfficialConfigurationError({
545
- option: "credentials",
546
- reason: `${stray.join(", ")} does not belong to the ${args.selection.authFamily} family (${allowed.length === 0 ? "which injects nothing" : allowed.join(", ")}); two families in one child are resolved by the runtime's own precedence order, not by the host's selection`,
547
- branchLabel: args.branchLabel
548
- });
549
- }
550
- if (allowed.includes("ANTHROPIC_AUTH_TOKEN") && names.includes("ANTHROPIC_BASE_URL") && !names.includes("ANTHROPIC_AUTH_TOKEN")) {
551
- throw new OfficialConfigurationError({
552
- option: "credentials.ANTHROPIC_BASE_URL",
553
- reason: "a gateway endpoint without its bearer token leaves a stored subscription credential active behind the new endpoint (WS-14 §12's gateway caveat) — set the full pair or neither",
554
- branchLabel: args.branchLabel
555
- });
556
- }
557
- }
558
- }
559
- async function fetchAuthCredentials(args) {
560
- const out = {};
561
- for (const entry of args.plan) {
562
- const material = await args.keychain.read(entry.ref);
563
- if (material === undefined || material.length === 0) {
564
- throw new OfficialConfigurationError({
565
- option: `credentials.${entry.variable}`,
566
- reason: `the host's keychain holds no material for this session's ${entry.ref.kind} credential reference; launching without it would fall through the runtime's precedence order to whatever the spool holds`,
567
- branchLabel: args.branchLabel
568
- });
569
- }
570
- out[entry.variable] = material;
571
- }
572
- return out;
573
- }
574
-
575
- // src/official/env-registry.ts
576
- var NON_CREDENTIAL_ENV_REGISTRY = [
577
- "AI_AGENT",
578
- "ALACRITTY_LOG",
579
- "ALLOW_ANT_COMPUTER_USE_MCP",
580
- "ANTHROPIC_BEDROCK_SERVICE_TIER",
581
- "ANTHROPIC_BETAS",
582
- "ANTHROPIC_CUSTOM_MODEL_OPTION",
583
- "ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION",
584
- "ANTHROPIC_CUSTOM_MODEL_OPTION_NAME",
585
- "ANTHROPIC_DEFAULT_FABLE_MODEL",
586
- "ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION",
587
- "ANTHROPIC_DEFAULT_FABLE_MODEL_NAME",
588
- "ANTHROPIC_DEFAULT_HAIKU_MODEL",
589
- "ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION",
590
- "ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME",
591
- "ANTHROPIC_DEFAULT_MODEL",
592
- "ANTHROPIC_DEFAULT_OPUS_MODEL",
593
- "ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION",
594
- "ANTHROPIC_DEFAULT_OPUS_MODEL_NAME",
595
- "ANTHROPIC_DEFAULT_SONNET_MODEL",
596
- "ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION",
597
- "ANTHROPIC_DEFAULT_SONNET_MODEL_NAME",
598
- "ANTHROPIC_FEDERATION_RULE_ID",
599
- "ANTHROPIC_FOUNDRY_RESOURCE",
600
- "ANTHROPIC_GOOGLE_CLOUD_LOCATION",
601
- "ANTHROPIC_MODEL",
602
- "ANTHROPIC_SMALL_FAST_MODEL",
603
- "ANT_OTEL_EXPORTER_OTLP_PROTOCOL",
604
- "ANT_OTEL_LOGS_EXPORTER",
605
- "ANT_OTEL_METRICS_EXPORTER",
606
- "ANT_OTEL_RESOURCE_ATTRIBUTES",
607
- "ANT_OTEL_TRACES_EXPORTER",
608
- "API_FORCE_IDLE_TIMEOUT",
609
- "API_TIMEOUT_MS",
610
- "AWS_CONFIG_FILE",
611
- "AWS_EXECUTION_ENV",
612
- "AWS_LAMBDA_FUNCTION_NAME",
613
- "AWS_ROLE_ARN",
614
- "AZURE_FUNCTIONS_ENVIRONMENT",
615
- "BASH_ENV",
616
- "BASH_MAX_OUTPUT_LENGTH",
617
- "BAT_THEME",
618
- "BIGINT_FORMAT_RANGES",
619
- "BUN_CHROME_PATH",
620
- "BUN_CONFIG_FILE",
621
- "BUN_INSTALL",
622
- "CARGO_HOME",
623
- "CCR_ENABLE_BUNDLE",
624
- "CCR_FORCE_BUNDLE",
625
- "CCR_ON_BRANCH_DEFAULT_GUARD",
626
- "CF_PAGES",
627
- "CLAUDE_AFK_COUNTDOWN_MS",
628
- "CLAUDE_AFK_TIMEOUT_MS",
629
- "CLAUDE_AFTER_LAST_COMPACT",
630
- "CLAUDE_AGENTS_SELECT",
631
- "CLAUDE_AGENT_SDK_CLIENT_APP",
632
- "CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS",
633
- "CLAUDE_AGENT_SDK_MCP_NO_PREFIX",
634
- "CLAUDE_AGENT_SDK_VERSION",
635
- "CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS",
636
- "CLAUDE_AUTOCOMPACT_PCT_OVERRIDE",
637
- "CLAUDE_AUTO_BACKGROUND_TASKS",
638
- "CLAUDE_AX_PREPARK_MS",
639
- "CLAUDE_AX_SCREEN_READER",
640
- "CLAUDE_AX_STARTUP_QUIET_MS",
641
- "CLAUDE_BG_BACKEND",
642
- "CLAUDE_BG_ISOLATION",
643
- "CLAUDE_BG_MEMORY_TOGGLED_OFF",
644
- "CLAUDE_BG_POST_CLEAR_RESPAWN",
645
- "CLAUDE_BG_RENDEZVOUS_SOCK",
646
- "CLAUDE_BG_SOURCE",
647
- "CLAUDE_BG_STARTUP_WEDGE_MS",
648
- "CLAUDE_BG_TCC_DISCLAIMED",
649
- "CLAUDE_BRIDGE_REATTACH_GROUPING",
650
- "CLAUDE_BRIDGE_REATTACH_NO_BACKFILL",
651
- "CLAUDE_BRIDGE_REATTACH_OUTBOUND_ONLY",
652
- "CLAUDE_BRIDGE_REATTACH_OWNER_ACCT",
653
- "CLAUDE_BRIDGE_REATTACH_OWNER_ORG",
654
- "CLAUDE_BRIDGE_REATTACH_SEQ",
655
- "CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS",
656
- "CLAUDE_CHROME_CLASSIFIER_FLOOR",
657
- "CLAUDE_CHROME_PERMISSION_MODE",
658
- "CLAUDE_CLIENT_PRESENCE_FILE",
659
- "CLAUDE_CODE_3P_PROBE_WROTE_OPUS_DEFAULT",
660
- "CLAUDE_CODE_3P_PROBE_WROTE_SONNET_DEFAULT",
661
- "CLAUDE_CODE_ACCESSIBILITY",
662
- "CLAUDE_CODE_ACTION",
663
- "CLAUDE_CODE_ACT_DONT_REDERIVE",
664
- "CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD",
665
- "CLAUDE_CODE_ADDITIONAL_PROTECTION",
666
- "CLAUDE_CODE_ADOPT_UNDERIVABLE_PARKED_PERMISSION",
667
- "CLAUDE_CODE_AGENT",
668
- "CLAUDE_CODE_ALT_SCREEN_FULL_REPAINT",
669
- "CLAUDE_CODE_ALWAYS_ENABLE_EFFORT",
670
- "CLAUDE_CODE_AMBER_ASTROLABE",
671
- "CLAUDE_CODE_ARTIFACT",
672
- "CLAUDE_CODE_ARTIFACT_ASSETS",
673
- "CLAUDE_CODE_ARTIFACT_AUTO_OPEN",
674
- "CLAUDE_CODE_ARTIFACT_COMMENTS",
675
- "CLAUDE_CODE_ARTIFACT_COMMENTS_AUTOREACT",
676
- "CLAUDE_CODE_ARTIFACT_COMMENT_FAST_ACK",
677
- "CLAUDE_CODE_ARTIFACT_COMMENT_FAST_ACK_FIXED",
678
- "CLAUDE_CODE_ARTIFACT_COMMENT_RESPONDER",
679
- "CLAUDE_CODE_ARTIFACT_DB",
680
- "CLAUDE_CODE_ARTIFACT_DELETE",
681
- "CLAUDE_CODE_ARTIFACT_PREVIEW",
682
- "CLAUDE_CODE_ARTIFACT_ROOM",
683
- "CLAUDE_CODE_ARTIFACT_TYPES",
684
- "CLAUDE_CODE_ARTIFACT_TYPE_CATALOG",
685
- "CLAUDE_CODE_ARTIFACT_TYPE_CLOUD_CREATE",
686
- "CLAUDE_CODE_ARTIFACT_VERIFY",
687
- "CLAUDE_CODE_ATTRIBUTION_HEADER",
688
- "CLAUDE_CODE_AUTO_BACKGROUND_WORKER_CHECKIN_SECONDS",
689
- "CLAUDE_CODE_AUTO_COMPACT_WINDOW",
690
- "CLAUDE_CODE_AUTO_CONNECT_IDE",
691
- "CLAUDE_CODE_AUTO_MODE_EXTERNAL_PERMISSIONS",
692
- "CLAUDE_CODE_AUTO_MODE_MODEL",
693
- "CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS",
694
- "CLAUDE_CODE_BASALT_COVE",
695
- "CLAUDE_CODE_BASE_REF",
696
- "CLAUDE_CODE_BASE_REFS",
697
- "CLAUDE_CODE_BASH_OUTPUT_AUDIENCE_NOTE",
698
- "CLAUDE_CODE_BASH_SANDBOX_SHOW_INDICATOR",
699
- "CLAUDE_CODE_BENCH_LIVE_COUNTS",
700
- "CLAUDE_CODE_BG_CLASSIFIER_MODEL",
701
- "CLAUDE_CODE_BG_TASKS_REPORT_RUNNING",
702
- "CLAUDE_CODE_BISON_CAIRN",
703
- "CLAUDE_CODE_BLOCKING_LIMIT_OVERRIDE",
704
- "CLAUDE_CODE_BREEZY_HORIZON",
705
- "CLAUDE_CODE_BRIDGE_MCP_CARRIER",
706
- "CLAUDE_CODE_BRIDGE_PROMPT_SHA256",
707
- "CLAUDE_CODE_BRIEF",
708
- "CLAUDE_CODE_BRIEF_UPLOAD",
709
- "CLAUDE_CODE_BUBBLEWRAP",
710
- "CLAUDE_CODE_BYOC_ENABLE_DATADOG",
711
- "CLAUDE_CODE_CCR_LAZY_SUBAGENT_HYDRATE",
712
- "CLAUDE_CODE_CLASSIFIER_SUMMARY",
713
- "CLAUDE_CODE_COLD_COMPACT",
714
- "CLAUDE_CODE_CONTAINER_ID",
715
- "CLAUDE_CODE_COORDINATOR_FORCE_WORKER_INHERIT_MODEL",
716
- "CLAUDE_CODE_COORDINATOR_WORKER_CHECKIN_SECONDS",
717
- "CLAUDE_CODE_COWORK_FRAME_ARTIFACTS",
718
- "CLAUDE_CODE_DAEMON_COLD_START",
719
- "CLAUDE_CODE_DATADOG_FLUSH_INTERVAL_MS",
720
- "CLAUDE_CODE_DD_ERROR_TRACKING_FLUSH_INTERVAL_MS",
721
- "CLAUDE_CODE_DEBUG_LOGS_DIR",
722
- "CLAUDE_CODE_DEBUG_LOG_LEVEL",
723
- "CLAUDE_CODE_DEBUG_REPAINTS",
724
- "CLAUDE_CODE_DECSTBM",
725
- "CLAUDE_CODE_DIAGNOSTICS_FILE",
726
- "CLAUDE_CODE_DIR_SYNC_DISABLE_ANCHORING",
727
- "CLAUDE_CODE_DIR_SYNC_ENGINE",
728
- "CLAUDE_CODE_DIR_SYNC_FFWD",
729
- "CLAUDE_CODE_DIR_SYNC_GIT",
730
- "CLAUDE_CODE_DIR_SYNC_STREAM",
731
- "CLAUDE_CODE_DISABLE_1M_CONTEXT",
732
- "CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING",
733
- "CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION",
734
- "CLAUDE_CODE_DISABLE_ADVISOR_TOOL",
735
- "CLAUDE_CODE_DISABLE_AGENT_VIEW",
736
- "CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN",
737
- "CLAUDE_CODE_DISABLE_ARTIFACT",
738
- "CLAUDE_CODE_DISABLE_ATTACHMENTS",
739
- "CLAUDE_CODE_DISABLE_AUTO_MEMORY",
740
- "CLAUDE_CODE_DISABLE_BACKGROUND_TASKS",
741
- "CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_DEFAULT",
742
- "CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD",
743
- "CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF",
744
- "CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP",
745
- "CLAUDE_CODE_DISABLE_BUNDLED_SKILLS",
746
- "CLAUDE_CODE_DISABLE_CLAUDE_API_SKILL",
747
- "CLAUDE_CODE_DISABLE_CLAUDE_CODE_SKILL",
748
- "CLAUDE_CODE_DISABLE_CLAUDE_MDS",
749
- "CLAUDE_CODE_DISABLE_CRON",
750
- "CLAUDE_CODE_DISABLE_DIR_SYNC",
751
- "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS",
752
- "CLAUDE_CODE_DISABLE_EXPLORE_INHERIT_CAP",
753
- "CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS",
754
- "CLAUDE_CODE_DISABLE_FAST_MODE",
755
- "CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY",
756
- "CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING",
757
- "CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS",
758
- "CLAUDE_CODE_DISABLE_HOOK_FORWARDING",
759
- "CLAUDE_CODE_DISABLE_LAUNCH_COMPOSER",
760
- "CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP",
761
- "CLAUDE_CODE_DISABLE_MEMORY_BULK_INFLATE",
762
- "CLAUDE_CODE_DISABLE_MEMORY_MASS_DELETE_HOLD",
763
- "CLAUDE_CODE_DISABLE_MEMORY_PERIODIC_RESYNC",
764
- "CLAUDE_CODE_DISABLE_MEMORY_RO_UNSAVED_NOTICE",
765
- "CLAUDE_CODE_DISABLE_MEMORY_STREAM_LIST",
766
- "CLAUDE_CODE_DISABLE_MOUSE",
767
- "CLAUDE_CODE_DISABLE_MOUSE_CLICKS",
768
- "CLAUDE_CODE_DISABLE_NESTED_CHAIN_IDLE",
769
- "CLAUDE_CODE_DISABLE_NESTED_USER_REPAIR",
770
- "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC",
771
- "CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK",
772
- "CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK",
773
- "CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL",
774
- "CLAUDE_CODE_DISABLE_ORG_MEMORY",
775
- "CLAUDE_CODE_DISABLE_PERMISSION_PROMPT_NOTIFY_HOOKS",
776
- "CLAUDE_CODE_DISABLE_PLUGIN_FORWARDING",
777
- "CLAUDE_CODE_DISABLE_POLICY_SKILLS",
778
- "CLAUDE_CODE_DISABLE_PRECOMPACT_SKIP",
779
- "CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK",
780
- "CLAUDE_CODE_DISABLE_TERMINAL_TITLE",
781
- "CLAUDE_CODE_DISABLE_THINKING",
782
- "CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT",
783
- "CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL",
784
- "CLAUDE_CODE_DISABLE_VITALS_EMITTER",
785
- "CLAUDE_CODE_DISABLE_WORKFLOWS",
786
- "CLAUDE_CODE_DISABLE_WORKING_SYNC",
787
- "CLAUDE_CODE_DONT_INHERIT_ENV",
788
- "CLAUDE_CODE_DOWNLOAD_DEADLINE_MS_FOR_TESTING",
789
- "CLAUDE_CODE_EAGER_FLUSH",
790
- "CLAUDE_CODE_EFFORT_LEVEL",
791
- "CLAUDE_CODE_EMIT_TOOL_USE_SUMMARIES",
792
- "CLAUDE_CODE_ENABLE_APPEND_SUBAGENT_PROMPT",
793
- "CLAUDE_CODE_ENABLE_AWAY_SUMMARY",
794
- "CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH",
795
- "CLAUDE_CODE_ENABLE_CFC",
796
- "CLAUDE_CODE_ENABLE_EXPERIMENTAL_ADVISOR_TOOL",
797
- "CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL",
798
- "CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING",
799
- "CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY",
800
- "CLAUDE_CODE_ENABLE_LAUNCH_COMPOSER",
801
- "CLAUDE_CODE_ENABLE_MENU_KIND_LANES",
802
- "CLAUDE_CODE_ENABLE_NARRATION",
803
- "CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION",
804
- "CLAUDE_CODE_ENABLE_REFRESH_MCP_TOOLS",
805
- "CLAUDE_CODE_ENABLE_REMOTE_RECAP",
806
- "CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING",
807
- "CLAUDE_CODE_ENABLE_TASKS",
808
- "CLAUDE_CODE_ENABLE_TODO_TOOLS",
809
- "CLAUDE_CODE_ENABLE_XAA",
810
- "CLAUDE_CODE_ENHANCED_TELEMETRY_BETA",
811
- "CLAUDE_CODE_ENTRYPOINT",
812
- "CLAUDE_CODE_ENVIRONMENT_KIND",
813
- "CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION",
814
- "CLAUDE_CODE_EXIT_AFTER_FIRST_RENDER",
815
- "CLAUDE_CODE_EXIT_AFTER_STOP_DELAY",
816
- "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS",
817
- "CLAUDE_CODE_EXPERIMENTAL_OBSERVER_AGENTS",
818
- "CLAUDE_CODE_EXTRA_BODY",
819
- "CLAUDE_CODE_EXTRA_METADATA",
820
- "CLAUDE_CODE_FEDERATION_CACHE_DIR",
821
- "CLAUDE_CODE_FLEETVIEW_SIMPLE",
822
- "CLAUDE_CODE_FORCE_BRIDGE",
823
- "CLAUDE_CODE_FORCE_EVALUATE_MEMORY",
824
- "CLAUDE_CODE_FORCE_FULLSCREEN_UPSELL",
825
- "CLAUDE_CODE_FORCE_MEMORY_SURVEY",
826
- "CLAUDE_CODE_FORCE_MID_CONVERSATION_SYSTEM",
827
- "CLAUDE_CODE_FORCE_STRIKETHROUGH",
828
- "CLAUDE_CODE_FORCE_SYNC_OUTPUT",
829
- "CLAUDE_CODE_FORCE_TIP_ID",
830
- "CLAUDE_CODE_FORK_SUBAGENT",
831
- "CLAUDE_CODE_FORWARD_SUBAGENT_TEXT",
832
- "CLAUDE_CODE_FRAME_TIMING_LOG",
833
- "CLAUDE_CODE_FRAME_TIMING_SAMPLE_EVERY",
834
- "CLAUDE_CODE_GAULT_KESTREL",
835
- "CLAUDE_CODE_GB_DISK_CACHE_WHEN_TELEMETRY_OFF",
836
- "CLAUDE_CODE_GB_REFRESH_INTERVAL_MS",
837
- "CLAUDE_CODE_GIT_BASH_PATH",
838
- "CLAUDE_CODE_GLOB_HIDDEN",
839
- "CLAUDE_CODE_GLOB_NO_IGNORE",
840
- "CLAUDE_CODE_GLOB_TIMEOUT_SECONDS",
841
- "CLAUDE_CODE_GOAL_CHECKIN_MINUTES",
842
- "CLAUDE_CODE_GORSE_PLOVER",
843
- "CLAUDE_CODE_GZIP_CCR_REQUEST_BODIES",
844
- "CLAUDE_CODE_GZIP_REQUEST_BODIES",
845
- "CLAUDE_CODE_HARBOR_KITE",
846
- "CLAUDE_CODE_HARBOR_KITE_CLOUD",
847
- "CLAUDE_CODE_HARBOR_KITE_PACING_OFF",
848
- "CLAUDE_CODE_HIDE_CWD",
849
- "CLAUDE_CODE_HIDE_SETTINGS_HINT",
850
- "CLAUDE_CODE_HOLD_REPORT_PARK_AT_INIT",
851
- "CLAUDE_CODE_HOLD_UNANSWERED_PARKED_PERMISSION",
852
- "CLAUDE_CODE_HOME_SEED_HOLD_TIMEOUT_MS",
853
- "CLAUDE_CODE_HOME_SEED_VERDICT_TIMEOUT_MS",
854
- "CLAUDE_CODE_HOOKS_SAME_THREAD",
855
- "CLAUDE_CODE_HOVER_REST",
856
- "CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL",
857
- "CLAUDE_CODE_IDE_SKIP_VALID_CHECK",
858
- "CLAUDE_CODE_IDLE_THRESHOLD_MINUTES",
859
- "CLAUDE_CODE_INCLUDE_PARTIAL_MESSAGES",
860
- "CLAUDE_CODE_INTRO_FRAME",
861
- "CLAUDE_CODE_IS_COWORK",
862
- "CLAUDE_CODE_JUNIPER_SUNDIAL",
863
- "CLAUDE_CODE_KB_COHESION_FIXES",
864
- "CLAUDE_CODE_LANTERN_PRISM",
865
- "CLAUDE_CODE_LARCH_CISTERN",
866
- "CLAUDE_CODE_LEGACY_BUNDLE",
867
- "CLAUDE_CODE_LOOP_KEEPALIVE",
868
- "CLAUDE_CODE_LOOP_PERSISTENT",
869
- "CLAUDE_CODE_MANAGED_SETTINGS_PATH",
870
- "CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS",
871
- "CLAUDE_CODE_MAX_RETRIES",
872
- "CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH",
873
- "CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY",
874
- "CLAUDE_CODE_MAX_TURNS",
875
- "CLAUDE_CODE_MCP_ALLOWLIST_ENV",
876
- "CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS",
877
- "CLAUDE_CODE_MCP_MEMORY_CGROUP",
878
- "CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT",
879
- "CLAUDE_CODE_MEMORY_PUSH_DELETE_MODE",
880
- "CLAUDE_CODE_MOCK_REMOTE_SETTINGS",
881
- "CLAUDE_CODE_MOCK_TRIAL",
882
- "CLAUDE_CODE_NANKEEN_KESTREL",
883
- "CLAUDE_CODE_NATIVE_CURSOR",
884
- "CLAUDE_CODE_NEW_INIT",
885
- "CLAUDE_CODE_NO_FLICKER",
886
- "CLAUDE_CODE_NO_MODEL_FALLBACK",
887
- "CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH",
888
- "CLAUDE_CODE_OTEL_DIAG_STDERR",
889
- "CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS",
890
- "CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS",
891
- "CLAUDE_CODE_OVERRIDE_DATE",
892
- "CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE",
893
- "CLAUDE_CODE_PARCHMENT_FERN",
894
- "CLAUDE_CODE_PARKED_PERMISSION_WAIT_MS",
895
- "CLAUDE_CODE_PARKED_STOP_RETIRES",
896
- "CLAUDE_CODE_PERFETTO_TRACE",
897
- "CLAUDE_CODE_PERFETTO_WRITE_INTERVAL_S",
898
- "CLAUDE_CODE_PERFORCE_MODE",
899
- "CLAUDE_CODE_PEWTER_OWL",
900
- "CLAUDE_CODE_PEWTER_OWL_TOOL",
901
- "CLAUDE_CODE_PLAN_MODE_REQUIRED",
902
- "CLAUDE_CODE_PLAN_V2_AGENT_COUNT",
903
- "CLAUDE_CODE_PLAN_V2_EXPLORE_AGENT_COUNT",
904
- "CLAUDE_CODE_PLUGIN_ATTRIBUTION",
905
- "CLAUDE_CODE_PLUGIN_BINARY_ASSETS",
906
- "CLAUDE_CODE_PLUGIN_CACHE_DIR",
907
- "CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS",
908
- "CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE",
909
- "CLAUDE_CODE_PLUGIN_PREFER_HTTPS",
910
- "CLAUDE_CODE_PLUGIN_SEED_DIR",
911
- "CLAUDE_CODE_PLUGIN_USE_ZIP_CACHE",
912
- "CLAUDE_CODE_POLL_EVENTS",
913
- "CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY",
914
- "CLAUDE_CODE_POWERUP_ONBOARDING",
915
- "CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS",
916
- "CLAUDE_CODE_PRINT_ENGINE_LOOP",
917
- "CLAUDE_CODE_PROACTIVE",
918
- "CLAUDE_CODE_PROMPT_CACHE_TTL",
919
- "CLAUDE_CODE_PROPAGATE_TRACEPARENT",
920
- "CLAUDE_CODE_PWSH_PARSE_TIMEOUT_MS",
921
- "CLAUDE_CODE_QUESTION_PREVIEW_FORMAT",
922
- "CLAUDE_CODE_RATE_LIMIT_TIER",
923
- "CLAUDE_CODE_REFUSAL_FALLBACK_CATCH_ALL",
924
- "CLAUDE_CODE_RELAUNCH_TERMINAL_SIZE",
925
- "CLAUDE_CODE_REMOTE",
926
- "CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE",
927
- "CLAUDE_CODE_REMOTE_HERMETIC_MODE",
928
- "CLAUDE_CODE_REMOTE_MEMORY_DIR",
929
- "CLAUDE_CODE_REMOTE_RAW_EVENTS_FILE",
930
- "CLAUDE_CODE_REMOTE_SEND_KEEPALIVES",
931
- "CLAUDE_CODE_REMOTE_SETTINGS_PATH",
932
- "CLAUDE_CODE_REMOTE_SETTINGS_POLL_MS",
933
- "CLAUDE_CODE_REPL",
934
- "CLAUDE_CODE_REPORT_FINDINGS",
935
- "CLAUDE_CODE_REPO_CHECKOUTS",
936
- "CLAUDE_CODE_RESTRICTED",
937
- "CLAUDE_CODE_RESUME_INTERRUPTED_TURN",
938
- "CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS",
939
- "CLAUDE_CODE_RESUME_PROMPT",
940
- "CLAUDE_CODE_RESUME_SOURCE_ALIVE",
941
- "CLAUDE_CODE_RESUME_THRESHOLD_MINUTES",
942
- "CLAUDE_CODE_RESUME_TOLERATES_CONTEXT_APPENDS",
943
- "CLAUDE_CODE_RETIRE_UNANSWERED_PARKED_PERMISSION",
944
- "CLAUDE_CODE_RETRY_WATCHDOG",
945
- "CLAUDE_CODE_SABLE_THRUSH",
946
- "CLAUDE_CODE_SAFE_MODE",
947
- "CLAUDE_CODE_SANDBOXED",
948
- "CLAUDE_CODE_SCRIPT_CAPS",
949
- "CLAUDE_CODE_SCROLL_SPEED",
950
- "CLAUDE_CODE_SEND_FEEDBACK",
951
- "CLAUDE_CODE_SHELL",
952
- "CLAUDE_CODE_SHELL_PREFIX",
953
- "CLAUDE_CODE_SILENT_TURN_REMINDER",
954
- "CLAUDE_CODE_SILENT_TURN_REMINDER_TEXT",
955
- "CLAUDE_CODE_SILENT_TURN_REMINDER_TURNS",
956
- "CLAUDE_CODE_SIMPLE",
957
- "CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT",
958
- "CLAUDE_CODE_SKILL_PROPOSALS",
959
- "CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS",
960
- "CLAUDE_CODE_SKIP_FAST_MODE_ORG_CHECK",
961
- "CLAUDE_CODE_SKIP_HFI_VERSION_CHECK",
962
- "CLAUDE_CODE_SKIP_PLUGIN_MCP_SERVERS",
963
- "CLAUDE_CODE_SKIP_PLUGIN_MCP_SERVERS_EXCEPT",
964
- "CLAUDE_CODE_SKIP_PROMPT_HISTORY",
965
- "CLAUDE_CODE_SKIP_REPO_UPLOAD",
966
- "CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS",
967
- "CLAUDE_CODE_SPAWN_TIMESTAMP_MS",
968
- "CLAUDE_CODE_SSE_PORT",
969
- "CLAUDE_CODE_STALL_TIMEOUT_MS_FOR_TESTING",
970
- "CLAUDE_CODE_STOP_HOOK_BLOCK_CAP",
971
- "CLAUDE_CODE_SUBAGENT_CACHE_EVICT",
972
- "CLAUDE_CODE_SUBAGENT_MODEL",
973
- "CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL",
974
- "CLAUDE_CODE_SUBPROCESS_ENV_SCRUB",
975
- "CLAUDE_CODE_SUBSCRIPTION_TYPE",
976
- "CLAUDE_CODE_SUPERVISED",
977
- "CLAUDE_CODE_SYNC_PLUGINS",
978
- "CLAUDE_CODE_SYNC_PLUGINS_BUFFERED_DOWNLOAD",
979
- "CLAUDE_CODE_SYNC_PLUGINS_DOWNLOAD_STALL_MS",
980
- "CLAUDE_CODE_SYNC_PLUGINS_INSTALL_TIMEOUT_MS",
981
- "CLAUDE_CODE_SYNC_PLUGINS_MCP_TIMEOUT_MS",
982
- "CLAUDE_CODE_SYNC_PLUGIN_INSTALL",
983
- "CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS",
984
- "CLAUDE_CODE_SYNC_SKILLS",
985
- "CLAUDE_CODE_SYNC_SKILLS_INSTALL_TIMEOUT_MS",
986
- "CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS",
987
- "CLAUDE_CODE_SYNTAX_HIGHLIGHT",
988
- "CLAUDE_CODE_SYSTEM_PROMPT_GB_FEATURE",
989
- "CLAUDE_CODE_TAGS",
990
- "CLAUDE_CODE_TAG_ISMETA_MESSAGES",
991
- "CLAUDE_CODE_TASK_LIST_ID",
992
- "CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS",
993
- "CLAUDE_CODE_TEE_SDK_STDOUT",
994
- "CLAUDE_CODE_TERMINAL_MCP_TOOLS",
995
- "CLAUDE_CODE_TERMINAL_RECORDING",
996
- "CLAUDE_CODE_TEST_ALLOW_REAL_NETWORK",
997
- "CLAUDE_CODE_TEST_FIXTURES_ROOT",
998
- "CLAUDE_CODE_TEST_FORCE_DENY",
999
- "CLAUDE_CODE_TEST_NO_GIT_BASH",
1000
- "CLAUDE_CODE_TEST_NO_PWSH",
1001
- "CLAUDE_CODE_THINKING_DISPLAY_UPDATES",
1002
- "CLAUDE_CODE_THISTLE_GREBE",
1003
- "CLAUDE_CODE_THRIFTY_SONIC",
1004
- "CLAUDE_CODE_TMPDIR",
1005
- "CLAUDE_CODE_TMUX_PREFIX",
1006
- "CLAUDE_CODE_TMUX_PREFIX_CONFLICTS",
1007
- "CLAUDE_CODE_TMUX_TRUECOLOR",
1008
- "CLAUDE_CODE_TOASTY_THIMBLE",
1009
- "CLAUDE_CODE_TODO_REMINDER_MODE",
1010
- "CLAUDE_CODE_TOOL_MEMORY_CGROUP_EXCLUDE",
1011
- "CLAUDE_CODE_TOOL_MEMORY_LIMIT",
1012
- "CLAUDE_CODE_TRANSCRIPT_LOCAL_GC",
1013
- "CLAUDE_CODE_TRIGGER_ID",
1014
- "CLAUDE_CODE_TUI_JUST_SWITCHED",
1015
- "CLAUDE_CODE_TUI_TRIAL",
1016
- "CLAUDE_CODE_TURN_UPDATES",
1017
- "CLAUDE_CODE_TWO_STAGE_CLASSIFIER",
1018
- "CLAUDE_CODE_ULTRAREVIEW_PREFLIGHT_FIXTURE",
1019
- "CLAUDE_CODE_ULTRAREVIEW_QUOTA_FIXTURE",
1020
- "CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS",
1021
- "CLAUDE_CODE_USER_EMAIL",
1022
- "CLAUDE_CODE_USE_ANTHROPIC_AWS",
1023
- "CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD",
1024
- "CLAUDE_CODE_USE_BEDROCK",
1025
- "CLAUDE_CODE_USE_COWORK_PLUGINS",
1026
- "CLAUDE_CODE_USE_FOUNDRY",
1027
- "CLAUDE_CODE_USE_GATEWAY",
1028
- "CLAUDE_CODE_USE_MANTLE",
1029
- "CLAUDE_CODE_USE_NATIVE_FILE_SEARCH",
1030
- "CLAUDE_CODE_USE_POWERSHELL_TOOL",
1031
- "CLAUDE_CODE_USE_VERTEX",
1032
- "CLAUDE_CODE_VOICE_FORWARD_INTERIMS_TYPED",
1033
- "CLAUDE_CODE_WALNUT_SPIRE",
1034
- "CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS",
1035
- "CLAUDE_CODE_WEB_FETCH_AGENT",
1036
- "CLAUDE_CODE_WILLOW_TERN",
1037
- "CLAUDE_CODE_WORKER_EPOCH",
1038
- "CLAUDE_CODE_WORKFLOWS",
1039
- "CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MS",
1040
- "CLAUDE_CODE_WORKFLOW_SIZE_WARNING_AGENTS",
1041
- "CLAUDE_CONTEXT_COLLAPSE",
1042
- "CLAUDE_CONTEXT_COLLAPSE_MODEL",
1043
- "CLAUDE_COWORK_MEMORY_EXTRA_GUIDELINES",
1044
- "CLAUDE_COWORK_MEMORY_GUIDELINES",
1045
- "CLAUDE_COWORK_MEMORY_INDEX_CONTENT",
1046
- "CLAUDE_COWORK_MEMORY_PATH_OVERRIDE",
1047
- "CLAUDE_DEBUG",
1048
- "CLAUDE_DISABLE_ADOPT",
1049
- "CLAUDE_ENABLE_BYTE_WATCHDOG",
1050
- "CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK",
1051
- "CLAUDE_ENABLE_STREAM_WATCHDOG",
1052
- "CLAUDE_ENV_FILE",
1053
- "CLAUDE_FORCE_DISPLAY_SURVEY",
1054
- "CLAUDE_GATEWAY_ALLOW_LOOPBACK",
1055
- "CLAUDE_GATEWAY_LOG_LEVEL",
1056
- "CLAUDE_IMPORT_CONVERSATIONS",
1057
- "CLAUDE_INTERNAL_ASSISTANT_TEAM_NAME",
1058
- "CLAUDE_INTERNAL_FC_OVERRIDES",
1059
- "CLAUDE_JOB_DIR",
1060
- "CLAUDE_MOCK_HEADERLESS_429",
1061
- "CLAUDE_PTY_HEARTBEAT_MS",
1062
- "CLAUDE_PTY_ORPHAN_CHECK_MS",
1063
- "CLAUDE_PTY_RECORD",
1064
- "CLAUDE_REMOTE_WORKFLOW_ARGS",
1065
- "CLAUDE_REMOTE_WORKFLOW_SCRIPT",
1066
- "CLAUDE_REPL_VARIANT",
1067
- "CLAUDE_RUNNER_ACTIVITY_FD",
1068
- "CLAUDE_RUNNER_DISABLE_AWAITING_ACTION_OVERRIDE",
1069
- "CLAUDE_RUNNER_FETCH_DEPTH",
1070
- "CLAUDE_SERVE_DRAIN_TIMEOUT_MS",
1071
- "CLAUDE_SLOW_FIRST_BYTE_MS",
1072
- "CLAUDE_SNIP",
1073
- "CLAUDE_SSH_LOCAL_BINARY",
1074
- "CLAUDE_SSH_VERSION",
1075
- "CLAUDE_STAGE_FILE_ROOT",
1076
- "CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS",
1077
- "CLAUDE_STREAM_IDLE_TIMEOUT_MS",
1078
- "CLAUDE_SUBAGENT_BG_SHELL_MAX_MS",
1079
- "CLAUDE_TMPDIR",
1080
- "CLAUDE_WORKFLOW_NAME_ONLY",
1081
- "CLOUDSDK_CONFIG",
1082
- "CONTAINER_SANDBOX_MOUNT_POINT",
1083
- "CURSOR_TRACE_ID",
1084
- "DAYTONA_WS_ID",
1085
- "DEBUG_CLAUDE_AGENT_SDK",
1086
- "DEBUG_SDK",
1087
- "DEMO_VERSION",
1088
- "DENO_DEPLOYMENT_ID",
1089
- "DISABLE_AUTOUPDATER",
1090
- "DISABLE_AUTO_COMPACT",
1091
- "DISABLE_BRIEF_MODE_STOP_HOOK",
1092
- "DISABLE_BUG_COMMAND",
1093
- "DISABLE_COST_WARNINGS",
1094
- "DISABLE_DOCTOR_COMMAND",
1095
- "DISABLE_ERROR_REPORTING",
1096
- "DISABLE_EXTRA_USAGE_COMMAND",
1097
- "DISABLE_FEEDBACK_COMMAND",
1098
- "DISABLE_GROWTHBOOK",
1099
- "DISABLE_INSTALL_GITHUB_APP_COMMAND",
1100
- "DISABLE_INTERLEAVED_THINKING",
1101
- "DISABLE_LOGOUT_COMMAND",
1102
- "DISABLE_PROMPT_CACHING",
1103
- "DISABLE_PROMPT_CACHING_FABLE",
1104
- "DISABLE_PROMPT_CACHING_HAIKU",
1105
- "DISABLE_PROMPT_CACHING_MYTHOS",
1106
- "DISABLE_PROMPT_CACHING_OPUS",
1107
- "DISABLE_PROMPT_CACHING_SONNET",
1108
- "DISABLE_TELEMETRY",
1109
- "DISABLE_UPDATES",
1110
- "DISABLE_UPGRADE_COMMAND",
1111
- "DOCKER_CONFIG",
1112
- "DO_NOT_TRACK",
1113
- "EMBEDDED_SEARCH_TOOLS",
1114
- "EMPTY_PATH",
1115
- "ENABLE_BETA_TRACING_DETAILED",
1116
- "ENABLE_CLAUDEAI_MCP_SERVERS",
1117
- "ENABLE_ENHANCED_TELEMETRY_BETA",
1118
- "ENABLE_LOCKLESS_UPDATES",
1119
- "ENABLE_LSP_TOOL",
1120
- "ENABLE_MCP_LARGE_OUTPUT_FILES",
1121
- "ENABLE_PID_BASED_VERSION_LOCKING",
1122
- "ENABLE_PROMPT_CACHING_1H",
1123
- "ENABLE_PROMPT_CACHING_1H_BEDROCK",
1124
- "ENABLE_TOOL_SEARCH",
1125
- "FALLBACK_FOR_ALL_PRIMARY_MODELS",
1126
- "FORCE_AUTOUPDATE_PLUGINS",
1127
- "FORCE_CODE_TERMINAL",
1128
- "FORCE_COLOR",
1129
- "FORCE_PROMPT_CACHING_5M",
1130
- "FORCE_VCR",
1131
- "GCM_INTERACTIVE",
1132
- "GITHUB_ACTIONS",
1133
- "GITHUB_ACTION_INPUTS",
1134
- "GITHUB_ACTION_PATH",
1135
- "GITHUB_ACTOR",
1136
- "GITHUB_ACTOR_ID",
1137
- "GITHUB_ENV",
1138
- "GITHUB_EVENT_NAME",
1139
- "GITHUB_EVENT_PATH",
1140
- "GITHUB_REPOSITORY",
1141
- "GITHUB_REPOSITORY_ID",
1142
- "GITHUB_REPOSITORY_OWNER",
1143
- "GITHUB_REPOSITORY_OWNER_ID",
1144
- "GITLAB_CI",
1145
- "GIT_ASKPASS",
1146
- "GIT_CONFIG_COUNT",
1147
- "GIT_CONFIG_GLOBAL",
1148
- "GIT_CONFIG_SYSTEM",
1149
- "GIT_SSH_COMMAND",
1150
- "GIT_TERMINAL_PROMPT",
1151
- "GNOME_TERMINAL_SERVICE",
1152
- "GOOGLE_CLOUD_WORKSTATIONS",
1153
- "GRADLE_USER_HOME",
1154
- "INK_SCREEN_READER",
1155
- "INTELLIJ_TERMINAL_COMMAND_BLOCKS",
1156
- "INTELLIJ_TERMINAL_COMMAND_BLOCKS_REWORKED",
1157
- "IS_DEMO",
1158
- "IS_SANDBOX",
1159
- "JAVA_HOME",
1160
- "JAVA_TOOL_OPTIONS",
1161
- "KITTY_WINDOW_ID",
1162
- "KONSOLE_VERSION",
1163
- "K_SERVICE",
1164
- "LC_ALL",
1165
- "LC_TERMINAL",
1166
- "LC_TIME",
1167
- "LOCAL_BRIDGE",
1168
- "MAX_STRUCTURED_OUTPUT_RETRIES",
1169
- "MCP_CONNECTION_NONBLOCKING",
1170
- "MCP_CONNECT_TIMEOUT_MS",
1171
- "MCP_DISCOVERY_CACHE",
1172
- "MCP_DISCOVERY_CACHE_MAX_STALE_S",
1173
- "MCP_DISCOVERY_CACHE_STRIKES",
1174
- "MCP_DISCOVERY_CACHE_TTL_S",
1175
- "MCP_PROTOCOL_NEGOTIATION",
1176
- "MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE",
1177
- "MCP_SDK_GENERATION",
1178
- "MCP_SERVER_CONNECTION_BATCH_SIZE",
1179
- "MCP_TIMEOUT",
1180
- "MCP_TOOL_TIMEOUT",
1181
- "MCP_TRUNCATION_PROMPT_OVERRIDE",
1182
- "NODE_OPTIONS",
1183
- "NO_COLOR",
1184
- "NPM_CONFIG_GLOBALCONFIG",
1185
- "NPM_CONFIG_USERCONFIG",
1186
- "NUMBER_FORMAT_RANGES",
1187
- "OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT",
1188
- "OTEL_EXPORTER_OTLP_LOGS_PROTOCOL",
1189
- "OTEL_EXPORTER_OTLP_METRICS_PROTOCOL",
1190
- "OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE",
1191
- "OTEL_EXPORTER_OTLP_PROTOCOL",
1192
- "OTEL_EXPORTER_OTLP_TRACES_PROTOCOL",
1193
- "OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT",
1194
- "OTEL_LOGS_EXPORTER",
1195
- "OTEL_LOGS_EXPORT_INTERVAL",
1196
- "OTEL_LOG_ASSISTANT_RESPONSES",
1197
- "OTEL_LOG_RAW_API_BODIES",
1198
- "OTEL_LOG_TOOL_CONTENT",
1199
- "OTEL_LOG_TOOL_DETAILS",
1200
- "OTEL_LOG_USER_PROMPTS",
1201
- "OTEL_METRICS_EXPORTER",
1202
- "OTEL_METRIC_EXPORT_INTERVAL",
1203
- "OTEL_RESOURCE_ATTRIBUTES",
1204
- "OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT",
1205
- "OTEL_TRACES_EXPORTER",
1206
- "OTEL_TRACES_EXPORT_INTERVAL",
1207
- "PIP_CONFIG_FILE",
1208
- "PLAYWRIGHT_BROWSERS_PATH",
1209
- "REPL_ID",
1210
- "REPL_SLUG",
1211
- "RUNNER_ENVIRONMENT",
1212
- "RUNNER_OS",
1213
- "RUSTUP_HOME",
1214
- "SDK_NATIVE_BIN",
1215
- "SLASH_COMMAND_TOOL_CHAR_BUDGET",
1216
- "SPACE_CREATOR_USER_ID",
1217
- "SSH_CLIENT",
1218
- "SSH_CONNECTION",
1219
- "SSH_TTY",
1220
- "SUDO_GID",
1221
- "SUDO_UID",
1222
- "SUDO_USER",
1223
- "TASK_MAX_OUTPUT_LENGTH",
1224
- "TERMINAL_EMULATOR",
1225
- "TERMINATOR_UUID",
1226
- "TERMUX_VERSION",
1227
- "TERM_PROGRAM",
1228
- "TERM_PROGRAM_VERSION",
1229
- "TILIX_ID",
1230
- "TMUX_PANE",
1231
- "ULTRAPLAN_PROMPT_FILE",
1232
- "USE_API_CONTEXT_MANAGEMENT",
1233
- "USE_BUILTIN_RIPGREP",
1234
- "UV_THREADPOOL_SIZE",
1235
- "VCR_RECORD",
1236
- "VITALS_EMITTER_BIN",
1237
- "VSCODE_GIT_ASKPASS_MAIN",
1238
- "VTE_VERSION",
1239
- "WAYLAND_DISPLAY",
1240
- "WEBSITE_SITE_NAME",
1241
- "WEBSITE_SKU",
1242
- "WSL_DISTRO_NAME",
1243
- "WSL_INTEROP",
1244
- "XDG_CONFIG_HOME",
1245
- "XDG_DATA_HOME",
1246
- "XDG_RUNTIME_DIR",
1247
- "XTERM_VERSION",
1248
- "ZED_TERM"
1249
- ];
1250
-
1251
- // src/official/env-allowlist.ts
1252
- var MINIMAL_OS_VARIABLES = ["PATH", "HOME", "USER", "SHELL", "TERM", "LANG"];
1253
- var MINIMAL_OS_VARIABLE_PREFIXES = ["LC_"];
1254
- var OFFICIAL_RUNTIME_VARIABLES = {
1255
- configDir: "CLAUDE_CONFIG_DIR",
1256
- projectDirName: "CLAUDE_CODE_PROJECT_DIR_NAME",
1257
- tmpdir: "CLAUDE_CODE_TMPDIR"
1258
- };
1259
- var PROXY_AND_TELEMETRY_VARIABLES = [
1260
- "HTTP_PROXY",
1261
- "HTTPS_PROXY",
1262
- "ALL_PROXY",
1263
- "NO_PROXY",
1264
- "http_proxy",
1265
- "https_proxy",
1266
- "all_proxy",
1267
- "no_proxy",
1268
- "CLAUDE_CODE_ENABLE_TELEMETRY",
1269
- "DISABLE_TELEMETRY",
1270
- "DISABLE_ERROR_REPORTING"
1271
- ];
1272
- var PROXY_AND_TELEMETRY_PREFIXES = ["OTEL_"];
1273
- var TRAFFIC_OPT_OUT_VARIABLES = {
1274
- CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1",
1275
- DISABLE_TELEMETRY: "1",
1276
- DISABLE_ERROR_REPORTING: "1",
1277
- DISABLE_AUTOUPDATER: "1"
1278
- };
1279
- var TRAFFIC_OPT_OUT_VARIABLE_NAMES = Object.keys(TRAFFIC_OPT_OUT_VARIABLES);
1280
- var PATH_LIST_VARIABLES = ["PATH"];
1281
- function sanitizePathListValue(value) {
1282
- return value.split(":").filter((entry) => entry.length > 0 && !VENDOR_HOME_SEGMENT_RE.test(entry)).join(":");
1283
- }
1284
- var EXECUTION_INDIRECTION_ENV_NAMES = [
1285
- "BASH_ENV",
1286
- "ENV",
1287
- "SHELLOPTS",
1288
- "BASHOPTS",
1289
- "PS4",
1290
- "IFS",
1291
- "CDPATH",
1292
- "FPATH",
1293
- "ZDOTDIR",
1294
- "COMSPEC",
1295
- "PATH",
1296
- "PSMODULEPATH",
1297
- "PROMPT_COMMAND",
1298
- "NODE_OPTIONS",
1299
- "NODE_PATH",
1300
- "NODE_REPL_EXTERNAL_MODULE",
1301
- "PERLLIB",
1302
- "GEM_PATH",
1303
- "GEM_HOME",
1304
- "JAVA_TOOL_OPTIONS",
1305
- "_JAVA_OPTIONS",
1306
- "JDK_JAVA_OPTIONS",
1307
- "IBM_JAVA_OPTIONS",
1308
- "OPENJ9_JAVA_OPTIONS",
1309
- "CLASSPATH",
1310
- "BUN_OPTIONS",
1311
- "BUN_INSPECT",
1312
- "MONO_PATH",
1313
- "R_PROFILE_USER",
1314
- "DEVPATH",
1315
- "GCONV_PATH",
1316
- "PHPRC",
1317
- "PHP_INI_SCAN_DIR",
1318
- "OPENSSL_CONF",
1319
- "OPENSSL_MODULES",
1320
- "OPENSSL_ENGINES",
1321
- "KRB5_CONFIG",
1322
- "GTK_PATH",
1323
- "QT_PLUGIN_PATH",
1324
- "GIO_MODULE_DIR",
1325
- "SASL_PATH",
1326
- "XDG_CONFIG_HOME",
1327
- "SSH_ASKPASS",
1328
- "SSH_ASKPASS_REQUIRE",
1329
- "SUDO_ASKPASS",
1330
- "VSCODE_GIT_ASKPASS_MAIN",
1331
- "PAGER",
1332
- "EDITOR",
1333
- "VISUAL",
1334
- "CLAUDE_CODE_SHELL",
1335
- "CLAUDE_CODE_SHELL_PREFIX",
1336
- "CLAUDE_CODE_GIT_BASH_PATH",
1337
- "CLAUDE_ENV_FILE",
1338
- "CLAUDE_CODE_MANAGED_SETTINGS_PATH",
1339
- "CLAUDE_CODE_REMOTE_SETTINGS_PATH",
1340
- "CLAUDE_CODE_MOCK_REMOTE_SETTINGS",
1341
- "CLAUDE_CODE_PLUGIN_SEED_DIR",
1342
- "CLAUDE_CODE_PLUGIN_CACHE_DIR",
1343
- "BUN_CONFIG_FILE",
1344
- "NPM_CONFIG_USERCONFIG",
1345
- "NPM_CONFIG_GLOBALCONFIG",
1346
- "PIP_CONFIG_FILE",
1347
- "CLOUDSDK_CONFIG",
1348
- "DOCKER_CONFIG",
1349
- "VITALS_EMITTER_BIN",
1350
- "CLAUDE_SSH_LOCAL_BINARY",
1351
- "SDK_NATIVE_BIN",
1352
- "BUN_CHROME_PATH",
1353
- "PLAYWRIGHT_BROWSERS_PATH"
1354
- ];
1355
- var EXECUTION_INDIRECTION_ENV_PREFIXES = [
1356
- "LD_",
1357
- "DYLD_",
1358
- "BASH_FUNC_",
1359
- "__BASH_FUNC",
1360
- "PYTHON",
1361
- "PERL5",
1362
- "RUBY",
1363
- "LUA_",
1364
- "DOTNET_",
1365
- "COMPLUS_",
1366
- "COR_",
1367
- "CORECLR_",
1368
- "APPDOMAIN_MANAGER_",
1369
- "GIT_"
1370
- ];
1371
- var EXECUTION_INDIRECTION_FOLDED = new Set(EXECUTION_INDIRECTION_ENV_NAMES.map((name) => name.toUpperCase()));
1372
- function isExecutionIndirectionVariable(name) {
1373
- const folded = name.toUpperCase();
1374
- return EXECUTION_INDIRECTION_FOLDED.has(folded) || EXECUTION_INDIRECTION_ENV_PREFIXES.some((prefix) => folded.startsWith(prefix));
1375
- }
1376
- var NON_CREDENTIAL_ENV_REGISTRY_FOLDED = new Set(NON_CREDENTIAL_ENV_REGISTRY.map((name) => name.toUpperCase()));
1377
- function buildOfficialChildEnv(input, policy = {}) {
1378
- const branchLabel = officialBranchLabel(input.brand);
1379
- if (input.configDir.length === 0) {
1380
- throw new OfficialConfigurationError({
1381
- option: "env.CLAUDE_CONFIG_DIR",
1382
- reason: "a child with no config dir writes its transcript wherever the SDK parent's own environment points, which on a developer machine is the real vendor home (WS-14 §1/§3)",
1383
- branchLabel
1384
- });
1385
- }
1386
- validateAuthEnvironment({ selection: input.selection, credentials: input.credentials, gate: policy.claudeOauth ?? { approved: false }, branchLabel });
1387
- const env = {
1388
- [OFFICIAL_RUNTIME_VARIABLES.configDir]: input.configDir
1389
- };
1390
- if (input.projectKey !== undefined && input.projectKey.length > 0) {
1391
- if (!new RegExp(PINNED_PROJECT_DIR_NAME_PATTERN).test(input.projectKey)) {
1392
- throw new OfficialConfigurationError({
1393
- option: `env.${OFFICIAL_RUNTIME_VARIABLES.projectDirName}`,
1394
- reason: `${JSON.stringify(input.projectKey)} (${input.projectKey.length} characters) does not match the pinned runtime's own rule ${PINNED_PROJECT_DIR_NAME_PATTERN}, and a key it rejects does not fail — it falls back to the runtime's own cwd-derived name, leaving the directory row, this environment and the auto-memory directory all naming a transcript that is somewhere else (WS-14 §1/§3, R-7b-13). Name a conforming key in \`runtime.official.projectKey\`; the door's own default is the Winter SDK's \`transcriptProjectKey(cwd)\`, which a deep working directory can push past this rule`,
1395
- branchLabel
1396
- });
1397
- }
1398
- env[OFFICIAL_RUNTIME_VARIABLES.projectDirName] = input.projectKey;
1399
- }
1400
- if (input.sharedTempRoot !== undefined && input.sharedTempRoot.length > 0)
1401
- env[OFFICIAL_RUNTIME_VARIABLES.tmpdir] = input.sharedTempRoot;
1402
- if ((policy.remoteConfig ?? "deny") === "deny")
1403
- for (const [name, value] of Object.entries(TRAFFIC_OPT_OUT_VARIABLES))
1404
- env[name] = value;
1405
- for (const [name, value] of Object.entries(input.credentials))
1406
- env[name] = value;
1407
- for (const [name, value] of Object.entries(input.base ?? {})) {
1408
- const wanted = MINIMAL_OS_VARIABLES.includes(name) || MINIMAL_OS_VARIABLE_PREFIXES.some((prefix) => name.startsWith(prefix));
1409
- if (wanted)
1410
- env[name] = PATH_LIST_VARIABLES.includes(name) ? sanitizePathListValue(value) : value;
1411
- }
1412
- for (const [name, value] of Object.entries(policy.configuredExtras ?? {}))
1413
- env[name] = value;
1414
- assertNoForbiddenChildVariables(env, { brand: input.brand, selection: input.selection, policy, branchLabel });
1415
- return Object.fromEntries(Object.entries(env).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0));
1416
- }
1417
- function assertNoForbiddenChildVariables(env, args) {
1418
- const branchLabel = args.branchLabel ?? officialBranchLabel(args.brand);
1419
- const declared = new Set(Object.keys(args.policy?.configuredExtras ?? {}));
1420
- const reviewedExtras = args.policy?.reviewedCredentialShapedExtras ?? [];
1421
- const reviewedExecution = args.policy?.reviewedExecutionExtras ?? [];
1422
- const prefixes = [args.brand.envPrefix, ...args.policy?.hostEnvPrefixes ?? []];
1423
- const runtimeVariables = Object.values(OFFICIAL_RUNTIME_VARIABLES);
1424
- const familyVariables = args.selection === undefined ? undefined : allowedAuthVariables(args.selection);
1425
- for (const [name, value] of Object.entries(env)) {
1426
- const refuse = (reason) => {
1427
- throw new OfficialConfigurationError({ option: `env.${name}`, reason, branchLabel });
1428
- };
1429
- if (prefixes.some((prefix) => prefix.length > 0 && name.startsWith(prefix))) {
1430
- refuse("product/daemon variables never reach this child: it is a vendor runtime configured entirely by the allowlist, and Winter itself never reads the vendor's variables either (WS-14 §3, WS-01 §1 principle 4)");
1431
- }
1432
- if (NEVER_INJECTED_AUTH_VARIABLES.includes(name)) {
1433
- refuse("this credential is never injected on this branch (WS-14 §12 / WS-01 §2.5); the supported subscription flow stores its state inside the spool namespace");
1434
- }
1435
- if (familyVariables !== undefined && ALL_AUTH_VARIABLES.includes(name) && !familyVariables.includes(name)) {
1436
- refuse(`it is a credential variable outside this session's ${args.selection?.authFamily} family (${familyVariables.length === 0 ? "which injects nothing" : familyVariables.join(", ")}); the runtime resolves two families by its own precedence order, not by the host's selection (WS-14 §12)`);
1437
- }
1438
- const foldedName = name.toUpperCase();
1439
- const isThisFamilysVariable = (familyVariables ?? []).includes(name);
1440
- if (declared.has(name) && isExecutionIndirectionVariable(name) && !runtimeVariables.includes(name) && !reviewedExecution.includes(name)) {
1441
- refuse("it is refused explicitly: this name changes how the child EXECUTES code or authenticates (a shell startup file or command prefix, a loader/runtime hook, or an askpass/credential helper the child runs), " + "which no credential-shape rule can see and which the artifact's own registry legitimately declares — so neither of the extras door's two rules would stop it. " + "A deployment that has REVIEWED this exact name and needs it names it in `reviewedExecutionExtras` (WS-14 §3/§12, item 22)");
1442
- }
1443
- if (declared.has(name) && isAuthShapedVariable(foldedName) && !runtimeVariables.includes(name) && !isThisFamilysVariable && !reviewedExtras.includes(name)) {
1444
- refuse("it is credential-bearing by shape, and the configured-extras door carries non-credential variables only: the runtime resolves credentials by its own precedence order, so one of these re-points billing, rate limits and audit at an account this session's persisted selection does not name (WS-14 §12). " + "A deployment that has REVIEWED a specific auth-shaped variable and needs it names it in `reviewedCredentialShapedExtras` — a reviewed compatibility event under WS-17's drift gate, never a silent addition");
1445
- }
1446
- if (declared.has(name) && !runtimeVariables.includes(name) && !isThisFamilysVariable && !reviewedExtras.includes(name) && !NON_CREDENTIAL_ENV_REGISTRY_FOLDED.has(foldedName)) {
1447
- refuse("the configured-extras door is a positive allowlist: only names the PINNED artifact's own environment registry declares, and that an independent name rule classifies as non-credential, ride it. " + "An unknown name is refused because nothing has classified it — name it in `reviewedCredentialShapedExtras` if this deployment has reviewed it (WS-14 §3/§12, review r3 NEW-10)");
1448
- }
1449
- if (declared.has(name) && runtimeVariables.includes(name)) {
1450
- refuse("a configured extra may not override a variable this branch owns: the config dir, the transcript project key and the shared temp root are §1/§3's own, and the record is written against them");
1451
- }
1452
- if (declared.has(name) && TRAFFIC_OPT_OUT_VARIABLE_NAMES.includes(name)) {
1453
- refuse('this is one of the four traffic opt-outs this branch sets itself (R-7b-11), and setting it through the extras door would leave the session\'s recorded `remoteConfig` describing a surface the child does not have — use `OfficialEnvPolicy.remoteConfig` ("allow" opts back in, and the choice is recorded)');
1454
- }
1455
- if (!declared.has(name) && !TRAFFIC_OPT_OUT_VARIABLE_NAMES.includes(name) && (PROXY_AND_TELEMETRY_VARIABLES.includes(name) || PROXY_AND_TELEMETRY_PREFIXES.some((prefix) => name.startsWith(prefix)))) {
1456
- refuse("proxy and telemetry variables reach this child only when the deployment configures them explicitly (WS-14 §3); an inherited one redirects or duplicates traffic invisibly");
1457
- }
1458
- if (VENDOR_HOME_SEGMENT_RE.test(value)) {
1459
- refuse(`its value (${value}) points into the vendor's user-level home; this branch is isolated from it by construction (WS-14 §3, WS-17 row 4)`);
1460
- }
1461
- const known = runtimeVariables.includes(name) || TRAFFIC_OPT_OUT_VARIABLE_NAMES.includes(name) || ALL_AUTH_VARIABLES.includes(name) || MINIMAL_OS_VARIABLES.includes(name) || MINIMAL_OS_VARIABLE_PREFIXES.some((prefix) => name.startsWith(prefix)) || declared.has(name);
1462
- if (!known) {
1463
- refuse("it is not a variable this branch owns, an auth variable for this session, a minimal OS variable, or an explicitly configured addition — the child environment is an allowlist, and anything else is a leak from somewhere (WS-14 §3)");
1464
- }
1465
- }
1466
- }
1467
- var PINNED_OFFICIAL_RUNTIME = "0.3.250";
1468
- var PINNED_PROJECT_DIR_NAME_PATTERN = "^[A-Za-z0-9_-]{1,64}$";
1469
-
1470
110
  // src/official/options-template.ts
1471
- import { mcpToolName as mcpToolName2 } from "@yanlinglabs/winter-agent-sdk";
111
+ import { mcpToolName } from "@yanlinglabs/winter-agent-sdk";
1472
112
  var PINNED_SYSTEM_PROMPT_PRESET = "claude_code";
1473
113
  var AUTO_MEMORY_LOAD_CAP = { lines: 200, bytes: 25 * 1024 };
1474
114
  var DEFAULT_EXCLUDE_DYNAMIC_SECTIONS = { code: true, dispatch: true, chat: true };
@@ -1578,6 +218,127 @@ function assertOptionsInvariants(options, branchLabel) {
1578
218
  }
1579
219
  }
1580
220
 
221
+ // src/official/mcp-descriptors.ts
222
+ import { isWinterMcpServerInstance, mcpToolName as mcpToolName2 } from "@yanlinglabs/winter-agent-sdk";
223
+ import {
224
+ WINTER_DEFAULT_TOOL_DEFINITIONS,
225
+ createAdvisorToolHandler,
226
+ createMessagingToolHandlers
227
+ } from "@yanlinglabs/winter-agent-sdk/tools";
228
+ function mcpResult(handler) {
229
+ return async (args, extra) => {
230
+ const result = await handler(args, extra);
231
+ return { content: [{ type: "text", text: result.text }], ...result.isError === undefined ? {} : { isError: result.isError } };
232
+ };
233
+ }
234
+ function descriptorFor(definition, handler) {
235
+ return {
236
+ tool: definition.toolName,
237
+ description: definition.description,
238
+ inputSchema: definition.inputSchema,
239
+ ...definition.outputSchema === undefined ? {} : { outputSchema: definition.outputSchema },
240
+ ...definition.annotations === undefined ? {} : { annotations: definition.annotations },
241
+ exposure: "deferred",
242
+ permissionClass: definition.permissionClass,
243
+ handler: mcpResult(handler)
244
+ };
245
+ }
246
+ function winterMcpServerDescriptor(args) {
247
+ const messaging = createMessagingToolHandlers(args.port, args.caller);
248
+ const advisor = createAdvisorToolHandler({
249
+ transcriptSource: args.advisor.transcriptSource,
250
+ resolveReviewer: args.advisor.resolveReviewer ?? (() => {
251
+ return;
252
+ }),
253
+ ...args.advisor.maxChars === undefined ? {} : { maxChars: args.advisor.maxChars }
254
+ });
255
+ const handlers = {
256
+ send_message: messaging.sendMessage,
257
+ list_agents: messaging.listAgents,
258
+ read_notifications: messaging.readNotifications,
259
+ advisor
260
+ };
261
+ const tools = WINTER_DEFAULT_TOOL_DEFINITIONS.map((definition) => {
262
+ const handler = handlers[definition.toolName];
263
+ if (handler === undefined)
264
+ throw new OfficialMcpError({ server: args.brand.mcpServerName, reason: `the SDK declares a default tool this branch has no handler for: \`${definition.toolName}\``, branchLabel: "winter-claude-agent" });
265
+ return descriptorFor(definition, handler);
266
+ });
267
+ return { name: args.brand.mcpServerName, version: args.version ?? "1.0.0", tools: [...tools, ...args.capabilities ?? []] };
268
+ }
269
+ function capabilityServerDescriptor(server, version = "1.0.0") {
270
+ if (!isWinterMcpServerInstance(server.instance)) {
271
+ throw new RuntimeLaunchInputError({
272
+ field: "capabilities",
273
+ reason: `the capability server \`${server.name}\` carries no in-process instance the router can call (\`listTools\`/\`callTool\`), so its tools could be forwarded to the Winter leg and never registered on the official one`
274
+ });
275
+ }
276
+ const instance = server.instance;
277
+ const declared = server.tools ?? instance.listTools();
278
+ const tools = declared.map((tool) => {
279
+ const meta = tool._meta;
280
+ const permissionClass = typeof meta?.["permissionClass"] === "string" ? meta["permissionClass"] : server.name;
281
+ return {
282
+ tool: tool.name,
283
+ description: tool.description ?? "",
284
+ inputSchema: capabilityInputSchema(tool.inputSchema, server.name, tool.name),
285
+ ...tool.annotations === undefined ? {} : { annotations: tool.annotations },
286
+ exposure: "eager",
287
+ permissionClass,
288
+ handler: async (rawArgs) => {
289
+ const result = await instance.callTool(tool.name, rawArgs ?? {});
290
+ return { content: result.content, ...result.isError === undefined ? {} : { isError: result.isError } };
291
+ }
292
+ };
293
+ });
294
+ return { name: server.name, version, tools };
295
+ }
296
+ function capabilityNameCollisionError(args) {
297
+ return new RuntimeLaunchInputError({
298
+ field: args.field,
299
+ reason: `\`${args.name}\` is the name of a capability server this handle forwards, and the caller's own \`mcpServers\` already carries it — one of the two would silently not be registered, and the other leg would still have the capability, so the door refuses rather than choose for you`
300
+ });
301
+ }
302
+ function capabilityServerDescriptors(servers) {
303
+ return servers.map((server) => capabilityServerDescriptor(server));
304
+ }
305
+ function capabilityInputSchema(raw, server, tool) {
306
+ const properties = raw["properties"];
307
+ if (raw["type"] !== "object" || properties !== undefined && (typeof properties !== "object" || properties === null)) {
308
+ throw new RuntimeLaunchInputError({
309
+ field: "capabilities",
310
+ reason: `the capability tool \`${tool}\` on \`${server}\` declares an input schema that is not a JSON-Schema object, and the official branch's in-process registration has no conversion for anything else`
311
+ });
312
+ }
313
+ const required = raw["required"];
314
+ const additionalProperties = raw["additionalProperties"];
315
+ return {
316
+ type: "object",
317
+ ...properties === undefined ? {} : { properties },
318
+ ...Array.isArray(required) ? { required: required.map(String) } : {},
319
+ ...typeof additionalProperties === "boolean" ? { additionalProperties } : {}
320
+ };
321
+ }
322
+ function canonicalToolNames(descriptor, brand) {
323
+ return descriptor.tools.map((tool) => mcpToolName2(brand, tool.tool));
324
+ }
325
+ function materializeOfficialMcpServer(args) {
326
+ const { createSdkMcpServer, tool } = args.module;
327
+ if (typeof createSdkMcpServer !== "function" || typeof tool !== "function") {
328
+ throw new OfficialMcpError({
329
+ server: args.descriptor.name,
330
+ reason: "the injected official SDK module exposes no in-process MCP server constructor, so the standing server cannot be registered and every aliased built-in would resolve to a missing tool",
331
+ branchLabel: args.branchLabel
332
+ });
333
+ }
334
+ const tools = args.descriptor.tools.map((descriptor) => tool(descriptor.tool, descriptor.description, args.toInputShape(descriptor.inputSchema), async (rawArgs, extra) => descriptor.handler(rawArgs, extra), descriptor.annotations === undefined ? undefined : { annotations: descriptor.annotations }));
335
+ return createSdkMcpServer({ name: args.descriptor.name, version: args.descriptor.version, tools });
336
+ }
337
+ var OFFICIAL_MATERIALIZATION_DROPS = ["outputSchema", "exposure"];
338
+ function officialMcpServers(args) {
339
+ return { [args.descriptor.name]: materializeOfficialMcpServer(args) };
340
+ }
341
+
1581
342
  // src/vendor-paths.ts
1582
343
  import { tmpdir } from "node:os";
1583
344
  import { join } from "node:path";
@@ -1722,10 +483,60 @@ function officialConnectionEnv(args) {
1722
483
  explicit["ANTHROPIC_BASE_URL"] = baseUrl;
1723
484
  return explicit;
1724
485
  }
486
+ function officialCapabilityServers(deps, args) {
487
+ if (deps.toInputShape === undefined) {
488
+ if (deps.capabilities === undefined)
489
+ return;
490
+ throw new RuntimeLaunchInputError({
491
+ leg: "official",
492
+ field: "toInputShape",
493
+ reason: "this handle was constructed with `capabilities` but no JSON-Schema → validator-shape bridge, and the official runtime registers in-process servers only through its own validator's shape — so those tools would exist on the Winter leg and silently not on this one (WS-14 §11)"
494
+ });
495
+ }
496
+ for (const name of Object.keys(args.hostOwned ?? {})) {
497
+ if ((deps.capabilities ?? []).some((descriptor) => descriptor.name === name))
498
+ throw capabilityNameCollisionError({ field: "runtime.official.mcpServers", name });
499
+ }
500
+ const toInputShape = deps.toInputShape;
501
+ const module = deps.mcpModule;
502
+ if (module === undefined) {
503
+ throw new RuntimeLaunchInputError({
504
+ leg: "official",
505
+ field: "peers.claude",
506
+ reason: "the official leg cannot register the standing server without the official SDK module the servers are registered into"
507
+ });
508
+ }
509
+ const standing = winterMcpServerDescriptor({
510
+ brand: deps.brand,
511
+ port: deps.messaging,
512
+ caller: args.caller,
513
+ advisor: { transcriptSource: args.transcriptSource, ...deps.advisor?.resolveReviewer === undefined ? {} : { resolveReviewer: deps.advisor.resolveReviewer }, ...deps.advisor?.maxChars === undefined ? {} : { maxChars: deps.advisor.maxChars } }
514
+ });
515
+ const servers = {};
516
+ for (const descriptor of [standing, ...deps.capabilities ?? []]) {
517
+ Object.assign(servers, officialMcpServers({ descriptor, module, toInputShape, branchLabel: args.branchLabel }));
518
+ }
519
+ return servers;
520
+ }
1725
521
  function openOfficialLeg(deps, request) {
1726
522
  const branchLabel = officialBranchLabel(deps.brand);
1727
- const parsed = request.input.parentSessionId === undefined ? buildSessionAddress(request.input.sessionId) : buildChildAddress(request.input.parentSessionId, request.input.sessionId);
1728
523
  const address = officialLegAddress(request.input);
524
+ const advisorTranscriptSource = () => ({
525
+ async getEntries() {
526
+ const cwd = request.options.cwd;
527
+ const projectKey = request.input.projectKey ?? (cwd === undefined || cwd.length === 0 ? undefined : deps.transcriptProjectKey(cwd));
528
+ if (projectKey === undefined)
529
+ return [];
530
+ const row = await deps.directory.get(address);
531
+ const sessionId = row?.backendSessionId ?? request.options.sessionId;
532
+ if (sessionId === undefined || sessionId.length === 0)
533
+ return [];
534
+ return transcriptSourceForSessionKey({ projectKey, sessionId }, { store: deps.shared().store }).getEntries();
535
+ }
536
+ });
537
+ const messagingCaller = request.input.parentSessionId === undefined ? { sessionId: request.input.sessionId } : { sessionId: request.input.parentSessionId, agentId: request.input.sessionId };
538
+ const routerBuiltMcpServers = officialCapabilityServers(deps, { caller: messagingCaller, transcriptSource: advisorTranscriptSource(), branchLabel, hostOwned: request.input.mcpServers });
539
+ const parsed = request.input.parentSessionId === undefined ? buildSessionAddress(request.input.sessionId) : buildChildAddress(request.input.parentSessionId, request.input.sessionId);
1729
540
  const stream = typeof request.prompt === "string" ? undefined : createOfficialInputStream();
1730
541
  let detach;
1731
542
  let sawInit = false;
@@ -1821,7 +632,7 @@ function openOfficialLeg(deps, request) {
1821
632
  ...request.input.options ?? {},
1822
633
  advertisesHandoff: request.input.advertisesHandoff ?? true,
1823
634
  env,
1824
- ...request.input.mcpServers === undefined ? {} : { mcpServers: request.input.mcpServers },
635
+ ...routerBuiltMcpServers === undefined && request.input.mcpServers === undefined ? {} : { mcpServers: { ...routerBuiltMcpServers, ...request.input.mcpServers } },
1825
636
  ...bridge === undefined ? {} : { canUseTool: bridge },
1826
637
  ...request.options.permissionMode === undefined ? {} : { permissionMode: request.options.permissionMode },
1827
638
  ...request.options.sessionId === undefined ? {} : { sessionId: request.options.sessionId },
@@ -2123,7 +934,7 @@ function createInMemoryRuntimeDirectoryStore() {
2123
934
  }
2124
935
 
2125
936
  // src/directory/directory.ts
2126
- import { parseRuntimeAddress, resolveTarget, serializeRuntimeAddress as serializeRuntimeAddress3, validateToField as validateToField2 } from "@yanlinglabs/winter-agent-sdk/messaging";
937
+ import { parseRuntimeAddress, resolveTarget, serializeRuntimeAddress as serializeRuntimeAddress3, validateToField } from "@yanlinglabs/winter-agent-sdk/messaging";
2127
938
 
2128
939
  // src/directory/entries.ts
2129
940
  import { buildSessionAddress as buildSessionAddress2, serializeRuntimeAddress as serializeRuntimeAddress2 } from "@yanlinglabs/winter-agent-sdk/messaging";
@@ -2369,7 +1180,7 @@ function createRuntimeDirectory(context, options = {}) {
2369
1180
  return (await store.load()).find((entry) => entry.address === address);
2370
1181
  }
2371
1182
  async function resolveIn(snap, to, ctx) {
2372
- const valid = validateToField2(to);
1183
+ const valid = validateToField(to);
2373
1184
  if (!valid.ok)
2374
1185
  return { kind: "not-found", reason: valid.message };
2375
1186
  const callerOwner = owningSessionIdOf(ctx.from);
@@ -2452,7 +1263,6 @@ function createRuntimeDirectory(context, options = {}) {
2452
1263
  }
2453
1264
  // src/messaging/router.ts
2454
1265
  import {
2455
- callerAddress,
2456
1266
  createLoopGuard,
2457
1267
  createMessagingRouter,
2458
1268
  createNotificationQueue,
@@ -3199,32 +2009,32 @@ function selectChildRuntimePairing(parent, child) {
3199
2009
  };
3200
2010
  }
3201
2011
  var CHILD_PROVIDER_UNAVAILABLE = "child-provider-unavailable";
3202
- function resumeChildSelection(record, context) {
3203
- const input = childInput({ ...context, model: record.modelRef, provider: record.providerId });
3204
- const rows = resolveCandidateRows({ ...input, requested: { ...input.requested, model: record.modelRef } });
2012
+ function resumeChildSelection(record2, context) {
2013
+ const input = childInput({ ...context, model: record2.modelRef, provider: record2.providerId });
2014
+ const rows = resolveCandidateRows({ ...input, requested: { ...input.requested, model: record2.modelRef } });
3205
2015
  if (isRefusal2(rows)) {
3206
2016
  return {
3207
2017
  kind: "unavailable",
3208
2018
  retryable: false,
3209
- reason: `${CHILD_PROVIDER_UNAVAILABLE}: ${record.modelRef} on provider ${record.providerId} — ${rows.detail}`
2019
+ reason: `${CHILD_PROVIDER_UNAVAILABLE}: ${record2.modelRef} on provider ${record2.providerId} — ${rows.detail}`
3210
2020
  };
3211
2021
  }
3212
- const recorded = rows.find((candidate) => candidate.row.key === record.modelRef);
2022
+ const recorded = rows.find((candidate) => candidate.row.key === record2.modelRef);
3213
2023
  if (recorded === undefined) {
3214
2024
  return {
3215
2025
  kind: "unavailable",
3216
2026
  retryable: false,
3217
- reason: `${CHILD_PROVIDER_UNAVAILABLE}: this child is recorded on the row ${record.modelRef} (provider ${record.providerId}), which is no longer among the servable rows for that provider (now: ${rows.map((candidate) => candidate.row.key).join(", ")}); a resumed child re-resolves under its OWN recorded model and provider (WS-10, Phase 6.6 amendment)`
2027
+ reason: `${CHILD_PROVIDER_UNAVAILABLE}: this child is recorded on the row ${record2.modelRef} (provider ${record2.providerId}), which is no longer among the servable rows for that provider (now: ${rows.map((candidate) => candidate.row.key).join(", ")}); a resumed child re-resolves under its OWN recorded model and provider (WS-10, Phase 6.6 amendment)`
3218
2028
  };
3219
2029
  }
3220
- if (recorded.family !== record.family) {
2030
+ if (recorded.family !== record2.family) {
3221
2031
  return {
3222
2032
  kind: "unavailable",
3223
2033
  retryable: false,
3224
- reason: `${CHILD_PROVIDER_UNAVAILABLE}: this child is recorded in the ${record.family} family and its recorded row ${record.modelRef} now resolves into ${recorded.family}; never a substitution, never a different family (WS-13c §4)`
2034
+ reason: `${CHILD_PROVIDER_UNAVAILABLE}: this child is recorded in the ${record2.family} family and its recorded row ${record2.modelRef} now resolves into ${recorded.family}; never a substitution, never a different family (WS-13c §4)`
3225
2035
  };
3226
2036
  }
3227
- return { kind: "resumed", selection: record };
2037
+ return { kind: "resumed", selection: record2 };
3228
2038
  }
3229
2039
 
3230
2040
  // src/messaging/winter-adapter.ts
@@ -3509,8 +2319,8 @@ function createGlobalMessaging(context, options = {}) {
3509
2319
  } catch {
3510
2320
  return;
3511
2321
  }
3512
- for (const record of drained.notifications) {
3513
- await handle.noteIdle(address, { notificationId: record.notification_id, content: record.content });
2322
+ for (const record2 of drained.notifications) {
2323
+ await handle.noteIdle(address, { notificationId: record2.notification_id, content: record2.content });
3514
2324
  }
3515
2325
  if (drained.remaining === 0 || drained.notifications.length === 0)
3516
2326
  return;
@@ -3735,58 +2545,6 @@ function createGlobalMessaging(context, options = {}) {
3735
2545
  };
3736
2546
  return handle;
3737
2547
  }
3738
- function callerAddressOf(caller) {
3739
- return callerAddress(caller);
3740
- }
3741
- // src/messaging/handlers.ts
3742
- var VENDOR_TOOL_USE_ID_META_KEY = "claudecode/toolUseId";
3743
- function toolUseIdFromExtra(extra) {
3744
- if (typeof extra !== "object" || extra === null)
3745
- return;
3746
- const meta = extra._meta;
3747
- if (typeof meta !== "object" || meta === null)
3748
- return;
3749
- const id = meta[VENDOR_TOOL_USE_ID_META_KEY];
3750
- return typeof id === "string" && id.length > 0 ? id : undefined;
3751
- }
3752
- var MODEL_FACING_FAILURES = new Set(["refused", "ambiguous", "not_found", "unavailable"]);
3753
- function text(body, isError = false) {
3754
- return { content: [{ type: "text", text: body }], ...isError ? { isError: true } : {} };
3755
- }
3756
- function createMessagingToolHandlers(messaging, caller) {
3757
- const identity = () => typeof caller === "function" ? caller() : caller;
3758
- return {
3759
- async sendMessage(rawArgs, extra) {
3760
- const accepted = acceptNativeSendMessageArgs(rawArgs);
3761
- if (!accepted.ok)
3762
- return text(accepted.reason, true);
3763
- const bound = identity();
3764
- const perCall = toolUseIdFromExtra(extra);
3765
- const who = perCall === undefined ? bound : { ...bound, toolUseId: perCall };
3766
- const from = callerAddressOf(who);
3767
- const result = await messaging.sendDetailed({
3768
- from,
3769
- to: accepted.args.to,
3770
- body: accepted.args.message,
3771
- ...accepted.args.summary === undefined ? {} : { summary: accepted.args.summary },
3772
- ...accepted.args.notify_when_idle === undefined ? {} : { notifyWhenIdle: accepted.args.notify_when_idle },
3773
- ...who.toolUseId === undefined ? {} : { originToolCallId: who.toolUseId }
3774
- });
3775
- const payload = result.notify === undefined ? result.outcome : { ...result.outcome, notify: result.notify };
3776
- return text(JSON.stringify(payload), MODEL_FACING_FAILURES.has(result.outcome.status));
3777
- },
3778
- async listAgents(rawArgs) {
3779
- const accepted = acceptNativeListAgentsArgs(rawArgs);
3780
- if (!accepted.ok)
3781
- return text(accepted.reason, true);
3782
- const from = callerAddressOf(identity());
3783
- const rows = await messaging.listReachable({ from });
3784
- const listing = rows.length === 0 ? "No agents or sessions are currently reachable." : rows.map((row) => `- ${row.name === undefined ? row.address : `${row.name} (${row.address})`} [${row.objectKind}/${row.runtimeKind}] status=${row.status} mode=${row.mode}`).join(`
3785
- `);
3786
- return text(JSON.stringify({ listing }));
3787
- }
3788
- };
3789
- }
3790
2548
  // src/messaging/index.ts
3791
2549
  function createRuntimeMessaging(context, options = {}) {
3792
2550
  let messaging;
@@ -3928,14 +2686,14 @@ function createSharedSessionStore(input) {
3928
2686
  }
3929
2687
  return state;
3930
2688
  };
3931
- const recordMirrorError = (key, record) => {
2689
+ const recordMirrorError = (key, record2) => {
3932
2690
  const state = stateFor(key);
3933
2691
  state.health = "repair-required";
3934
2692
  state.errors.push({
3935
2693
  projectKey: key.projectKey,
3936
2694
  sessionId: key.sessionId,
3937
2695
  ...key.subpath === undefined ? {} : { subpath: key.subpath },
3938
- ...record,
2696
+ ...record2,
3939
2697
  at: now().toISOString()
3940
2698
  });
3941
2699
  };
@@ -4018,12 +2776,12 @@ function createSharedSessionStore(input) {
4018
2776
  for (const batch of [...batches.values()])
4019
2777
  await flush(batch.key);
4020
2778
  await tail;
4021
- const errors = [...sessions.values()].flatMap((state) => state.errors);
2779
+ const errors = [...sessions.values()].flatMap((state2) => state2.errors);
4022
2780
  return {
4023
2781
  settled: batches.size === 0,
4024
- batchesCommitted: [...sessions.values()].reduce((sum, state) => sum + state.batchesCommitted, 0),
2782
+ batchesCommitted: [...sessions.values()].reduce((sum, state2) => sum + state2.batchesCommitted, 0),
4025
2783
  errors,
4026
- transcriptHealth: [...sessions.values()].some((state) => state.health === "repair-required") ? "repair-required" : "ok"
2784
+ transcriptHealth: [...sessions.values()].some((state2) => state2.health === "repair-required") ? "repair-required" : "ok"
4027
2785
  };
4028
2786
  }
4029
2787
  const session = sessionOf(key);
@@ -4639,7 +3397,7 @@ function sidecarPath(home, key) {
4639
3397
  }
4640
3398
  function writeSidecar(path, records) {
4641
3399
  mkdirSync2(dirname(path), { recursive: true, mode: 448 });
4642
- const lines = records.map((record) => JSON.stringify({ sessionId: PROBE_KEY.sessionId, anchorUuid: record.anchorUuid, provider: "probe", model: "probe", itemIndex: 0, kind: record.kind, payload: "opaque" }));
3400
+ const lines = records.map((record2) => JSON.stringify({ sessionId: PROBE_KEY.sessionId, anchorUuid: record2.anchorUuid, provider: "probe", model: "probe", itemIndex: 0, kind: record2.kind, payload: "opaque" }));
4643
3401
  writeFile(path, Buffer.from(`${lines.join(`
4644
3402
  `)}
4645
3403
  `, "utf8"));
@@ -4734,12 +3492,12 @@ async function probeNoWashBack(context, deps) {
4734
3492
  });
4735
3493
  legs.push(await pinnedLeg("mirror from a decorated copy", deps, async (bed) => {
4736
3494
  const canonicalBeforeResume = readFileSync2(canonicalPath);
4737
- const before = await entryCount(shared, PROBE_KEY);
3495
+ const before2 = await entryCount(shared, PROBE_KEY);
4738
3496
  await bed.freshProcessResume({ home, stagingRoot, key: PROBE_KEY, shared });
4739
3497
  await shared.settle(PROBE_KEY);
4740
- const after = await entryCount(shared, PROBE_KEY);
4741
- if (after <= before) {
4742
- return { passed: false, evidence: `unexercised: the resume from the decorated copy produced no entries (${before} before, ${after} after), so no mirror write was observed` };
3498
+ const after2 = await entryCount(shared, PROBE_KEY);
3499
+ if (after2 <= before2) {
3500
+ return { passed: false, evidence: `unexercised: the resume from the decorated copy produced no entries (${before2} before, ${after2} after), so no mirror write was observed` };
4743
3501
  }
4744
3502
  const canonicalAfterResume = readFileSync2(canonicalPath);
4745
3503
  const prefixIntact = canonicalAfterResume.subarray(0, canonicalBeforeResume.length).equals(canonicalBeforeResume);
@@ -4748,7 +3506,7 @@ async function probeNoWashBack(context, deps) {
4748
3506
  const duplicateUuids = uuids.length - new Set(uuids).size;
4749
3507
  return {
4750
3508
  passed: prefixIntact && stillNoDecoration && duplicateUuids === 0,
4751
- evidence: `after a resume from the decorated copy that mirrored ${after - before} entr(y|ies): canonical prefix intact=${prefixIntact}; decoration still absent=${stillNoDecoration}; duplicate uuids=${duplicateUuids}`
3509
+ evidence: `after a resume from the decorated copy that mirrored ${after2 - before2} entr(y|ies): canonical prefix intact=${prefixIntact}; decoration still absent=${stillNoDecoration}; duplicate uuids=${duplicateUuids}`
4752
3510
  };
4753
3511
  }));
4754
3512
  return legs;
@@ -4799,8 +3557,8 @@ async function probeSidecarRoundTrip(context, deps) {
4799
3557
  const seenUuids = new Set;
4800
3558
  let orderIntact = lines.length > 0;
4801
3559
  for (const line of lines) {
4802
- const parent = parentOf(line);
4803
- if (typeof parent === "string" && !seenUuids.has(parent)) {
3560
+ const parent2 = parentOf(line);
3561
+ if (typeof parent2 === "string" && !seenUuids.has(parent2)) {
4804
3562
  orderIntact = false;
4805
3563
  break;
4806
3564
  }
@@ -5072,11 +3830,11 @@ function createHandoffBarrier(context, deps = {}) {
5072
3830
  };
5073
3831
  const reviewSelectionFor = async (args) => {
5074
3832
  const { persisted, to } = args;
5075
- const stamped = { ...persisted, runtimeKind: to };
3833
+ const stamped2 = { ...persisted, runtimeKind: to };
5076
3834
  if (deps.selectionInputFor === undefined) {
5077
3835
  return {
5078
3836
  kind: "unreviewed",
5079
- selection: stamped,
3837
+ selection: stamped2,
5080
3838
  detail: `no selection input was supplied, so nothing checked whether ${to} can serve ${persisted.providerId}/${persisted.modelRef}; the destination's own init is the first thing that will (supply \`selectionInputFor\` to review it here instead)`
5081
3839
  };
5082
3840
  }
@@ -5112,7 +3870,7 @@ function createHandoffBarrier(context, deps = {}) {
5112
3870
  detail: `the official runtime does not serve ${persisted.providerId}/${persisted.modelRef}`
5113
3871
  };
5114
3872
  }
5115
- return { kind: "servable", selection: stamped, review };
3873
+ return { kind: "servable", selection: stamped2, review };
5116
3874
  };
5117
3875
  const plan = async (session, to) => {
5118
3876
  const entry = await loadEntry(session);
@@ -5138,30 +3896,30 @@ function createHandoffBarrier(context, deps = {}) {
5138
3896
  selection
5139
3897
  };
5140
3898
  };
5141
- const execute = async (plan) => {
3899
+ const execute = async (plan2) => {
5142
3900
  const trail = [];
5143
- const record = (step, ok, detail) => {
3901
+ const record2 = (step, ok, detail) => {
5144
3902
  trail.push({ step, name: HANDOFF_STEPS[step - 1].name, ok, detail });
5145
3903
  };
5146
3904
  const lossy = (step, reason) => {
5147
- record(step, false, reason);
3905
+ record2(step, false, reason);
5148
3906
  return { kind: "lossy-fork-offered", reason, step, detail: reason, steps: trail };
5149
3907
  };
5150
3908
  const blocked = (step, reason, detail) => {
5151
- record(step, false, detail);
3909
+ record2(step, false, detail);
5152
3910
  return { kind: "blocked", reason, step, detail, steps: trail };
5153
3911
  };
5154
- const session = plan.session;
3912
+ const session = plan2.session;
5155
3913
  let shared;
5156
- let winterHome;
3914
+ let winterHome2;
5157
3915
  try {
5158
3916
  shared = sharedOf();
5159
- winterHome = homeOf();
3917
+ winterHome2 = homeOf();
5160
3918
  } catch (error) {
5161
3919
  return lossy(1, `the shared session store could not be resolved, so nothing about this session can be read or written: ${error instanceof Error ? error.message : String(error)}`);
5162
3920
  }
5163
- if (plan.selection.kind === "refused") {
5164
- return lossy(8, plan.selection.refusal.detail);
3921
+ if (plan2.selection.kind === "refused") {
3922
+ return lossy(8, plan2.selection.refusal.detail);
5165
3923
  }
5166
3924
  let lease;
5167
3925
  let stagedRoot;
@@ -5187,13 +3945,13 @@ function createHandoffBarrier(context, deps = {}) {
5187
3945
  try {
5188
3946
  entry = await loadEntry(session);
5189
3947
  assertOneDecoratorStore();
5190
- if (entry.runtimeKind !== plan.from) {
5191
- return lossy(1, `this plan was built when ${plan.from} owned the session and ${entry.runtimeKind} owns it now; re-plan against the current owner`);
3948
+ if (entry.runtimeKind !== plan2.from) {
3949
+ return lossy(1, `this plan was built when ${plan2.from} owned the session and ${entry.runtimeKind} owns it now; re-plan against the current owner`);
5192
3950
  }
5193
- const owner = await deps.participants?.source?.(session, plan.from) ?? undefined;
3951
+ const owner = await deps.participants?.source?.(session, plan2.from) ?? undefined;
5194
3952
  const healthNow = owner?.health === undefined ? undefined : await owner.health();
5195
- const markers = new Map([...markersFor({ entry, to: plan.to, session, ...healthNow === undefined ? {} : { health: healthNow } })]);
5196
- for (const step of plan.steps) {
3953
+ const markers = new Map([...markersFor({ entry, to: plan2.to, session, ...healthNow === undefined ? {} : { health: healthNow } })]);
3954
+ for (const step of plan2.steps) {
5197
3955
  if (step.knownUnprovable !== undefined)
5198
3956
  markers.set(step.step, step.knownUnprovable);
5199
3957
  }
@@ -5208,12 +3966,12 @@ function createHandoffBarrier(context, deps = {}) {
5208
3966
  return blocked(1, "lease-held", error instanceof Error ? error.message : String(error));
5209
3967
  }
5210
3968
  await owner?.stopNewTurns?.();
5211
- record(1, true, "the handoff lease is held by this process and the source is not taking new turns");
3969
+ record2(1, true, "the handoff lease is held by this process and the source is not taking new turns");
5212
3970
  at = 2;
5213
3971
  const drained = owner === undefined ? { ok: true, detail: "there is no live owner to drain" } : await owner.drainToIdleBoundary();
5214
3972
  if (!drained.ok)
5215
3973
  return lossy(2, drained.reason);
5216
- record(2, true, drained.detail ?? "the active turn reached an idle terminal boundary");
3974
+ record2(2, true, drained.detail ?? "the active turn reached an idle terminal boundary");
5217
3975
  at = 3;
5218
3976
  const streamed = owner === undefined ? { ok: true, detail: "there is no live stream to drain" } : await owner.drainStream();
5219
3977
  if (!streamed.ok)
@@ -5221,7 +3979,7 @@ function createHandoffBarrier(context, deps = {}) {
5221
3979
  const settled = await shared.settle(session);
5222
3980
  if (!settled.settled)
5223
3981
  return lossy(3, "the pending append barrier did not settle, so the canonical tail is still moving");
5224
- record(3, true, `${streamed.detail ?? "the stream reached its terminal result"}; ${settled.batchesCommitted} canonical append batch(es) settled`);
3982
+ record2(3, true, `${streamed.detail ?? "the stream reached its terminal result"}; ${settled.batchesCommitted} canonical append batch(es) settled`);
5225
3983
  at = 4;
5226
3984
  const eligibility = owner?.eligibility === undefined ? undefined : await owner.eligibility();
5227
3985
  if (eligibility !== undefined && !eligibility.eligible) {
@@ -5235,11 +3993,11 @@ function createHandoffBarrier(context, deps = {}) {
5235
3993
  if (report.status === "diverged" || report.appended !== comparison.missing) {
5236
3994
  return blocked(4, "repair-required", `the canonical store could not be reconciled against ${localRoot}: ${comparison.missing} entr(y|ies) were missing and ${report.appended} landed (${report.status})`);
5237
3995
  }
5238
- record(4, true, `the canonical tail was ${comparison.missing} entr(y|ies) behind the recorded local-write root and has been reconciled`);
3996
+ record2(4, true, `the canonical tail was ${comparison.missing} entr(y|ies) behind the recorded local-write root and has been reconciled`);
5239
3997
  } else if (comparison.kind === "diverged" || comparison.kind === "canonical-ahead") {
5240
3998
  return blocked(4, "repair-required", comparison.reason);
5241
3999
  } else {
5242
- record(4, true, comparison.reason);
4000
+ record2(4, true, comparison.reason);
5243
4001
  }
5244
4002
  const storeHealth = shared.health(session);
5245
4003
  if (storeHealth.transcriptHealth !== "ok") {
@@ -5247,10 +4005,10 @@ function createHandoffBarrier(context, deps = {}) {
5247
4005
  return blocked(4, "mirror-error", `the mirror recorded ${storeHealth.errors.length} failure(s) for this session${cause === undefined ? "" : ` (last: ${cause.cause})`}, and it is not reconciled`);
5248
4006
  }
5249
4007
  at = 5;
5250
- const validation = await validateSessionTranscript(shared, session, winterHome);
4008
+ const validation = await validateSessionTranscript(shared, session, winterHome2);
5251
4009
  if (!validation.ok)
5252
4010
  return lossy(5, validation.reason);
5253
- record(5, true, validation.detail);
4011
+ record2(5, true, validation.detail);
5254
4012
  at = 6;
5255
4013
  const closed = await owner?.close() ?? undefined;
5256
4014
  if (closed !== undefined && closed.ok === false)
@@ -5266,18 +4024,18 @@ function createHandoffBarrier(context, deps = {}) {
5266
4024
  let staged;
5267
4025
  pendingWritten = true;
5268
4026
  try {
5269
- staged = await markHandoffPending({ shared, session, entry, plan, level, now: now() });
4027
+ staged = await markHandoffPending({ shared, session, entry, plan: plan2, level, now: now() });
5270
4028
  } catch (error) {
5271
4029
  await unwind();
5272
4030
  return lossy(6, `the handoff could not be staged: ${error instanceof Error ? error.message : String(error)}`);
5273
4031
  }
5274
- record(6, true, `the owner is closed, the writer lease was granted to this process, and a pending handoff to ${plan.to} at level ${level} is recorded — ownership has NOT moved`);
4032
+ record2(6, true, `the owner is closed, the writer lease was granted to this process, and a pending handoff to ${plan2.to} at level ${level} is recorded — ownership has NOT moved`);
5275
4033
  at = 7;
5276
4034
  let continuity;
5277
4035
  try {
5278
4036
  const layout = (deps.tempLayoutFor ?? defaultTempLayout(context))(entry, session);
5279
4037
  continuity = materializeTempContinuity({
5280
- to: plan.to,
4038
+ to: plan2.to,
5281
4039
  layout,
5282
4040
  ...owner?.effectiveTempDir === undefined ? {} : { recordedTempDir: owner.effectiveTempDir }
5283
4041
  });
@@ -5285,25 +4043,25 @@ function createHandoffBarrier(context, deps = {}) {
5285
4043
  await unwind();
5286
4044
  return lossy(7, `temp continuity could not be materialized: ${error instanceof Error ? error.message : String(error)}`);
5287
4045
  }
5288
- record(7, true, `${continuity.mode}: the session's scratch is at ${continuity.effectiveTempDir}${continuity.supersededDir === undefined ? "" : `, superseding ${continuity.supersededDir} (retained)`}`);
4046
+ record2(7, true, `${continuity.mode}: the session's scratch is at ${continuity.effectiveTempDir}${continuity.supersededDir === undefined ? "" : `, superseding ${continuity.supersededDir} (retained)`}`);
5289
4047
  at = 8;
5290
- const stagingRoot = plan.to === "claude-agent" ? stagingRootFor(staged.stagingUuid) : undefined;
4048
+ const stagingRoot = plan2.to === "claude-agent" ? stagingRootFor(staged.stagingUuid) : undefined;
5291
4049
  if (stagingRoot !== undefined)
5292
4050
  stagedRoot = stagingRoot;
5293
4051
  const decorated = await decoratorOf().decorate({
5294
4052
  session,
5295
- to: plan.to,
5296
- materializedPath: stagingRoot === undefined ? canonicalTranscriptPath(winterHome, session) : materializedTranscriptPath(stagingRoot, session),
4053
+ to: plan2.to,
4054
+ materializedPath: stagingRoot === undefined ? canonicalTranscriptPath(winterHome2, session) : materializedTranscriptPath(stagingRoot, session),
5297
4055
  decoration: {
5298
4056
  kind: "handoff",
5299
- from: plan.from,
4057
+ from: plan2.from,
5300
4058
  at: now().toISOString(),
5301
- text: (deps.noteText ?? defaultNoteText)({ from: plan.from, to: plan.to, session })
4059
+ text: (deps.noteText ?? defaultNoteText)({ from: plan2.from, to: plan2.to, session })
5302
4060
  }
5303
4061
  });
5304
4062
  target = {
5305
4063
  address: entry.address,
5306
- runtimeKind: plan.to,
4064
+ runtimeKind: plan2.to,
5307
4065
  backendSessionId: session.sessionId,
5308
4066
  projectKey: session.projectKey,
5309
4067
  compatibilityLevel: level,
@@ -5311,9 +4069,9 @@ function createHandoffBarrier(context, deps = {}) {
5311
4069
  ...stagingRoot === undefined ? {} : { stagingRoot, profile: "store-backed-resume" },
5312
4070
  effectiveTempDir: continuity.effectiveTempDir,
5313
4071
  door: decorated.door,
5314
- selection: plan.selection.selection
4072
+ selection: plan2.selection.selection
5315
4073
  };
5316
- const destination = await deps.participants?.destination?.(session, plan.to) ?? undefined;
4074
+ const destination = await deps.participants?.destination?.(session, plan2.to) ?? undefined;
5317
4075
  if (destination === undefined) {
5318
4076
  await unwind();
5319
4077
  return lossy(8, "no destination runtime confirmed the resumed session and level, and the next user message must not be delivered until one does");
@@ -5334,7 +4092,7 @@ function createHandoffBarrier(context, deps = {}) {
5334
4092
  await unwind();
5335
4093
  const reason = `the destination confirmed init but the producer record could not be written: ${error instanceof Error ? error.message : String(error)}`;
5336
4094
  const enriched = target?.stagingRoot === undefined ? reason : `${reason}. The destination is reading ${target.stagingRoot}; that staging copy is retained deliberately and belongs to the host's retention pass.`;
5337
- record(8, false, enriched);
4095
+ record2(8, false, enriched);
5338
4096
  return {
5339
4097
  kind: "lossy-fork-offered",
5340
4098
  reason,
@@ -5346,7 +4104,7 @@ function createHandoffBarrier(context, deps = {}) {
5346
4104
  }
5347
4105
  const notes = [];
5348
4106
  try {
5349
- await syncDirectoryEntry({ context, entry, plan, staged, now: now() });
4107
+ await syncDirectoryEntry({ context, entry, plan: plan2, staged, now: now() });
5350
4108
  } catch (error) {
5351
4109
  notes.push(`the host directory's derived copy is behind and will be repaired on the next plan(): ${error instanceof Error ? error.message : String(error)}`);
5352
4110
  }
@@ -5358,12 +4116,12 @@ function createHandoffBarrier(context, deps = {}) {
5358
4116
  notes.push(`the labelled handoff note could not be appended: ${error instanceof Error ? error.message : String(error)}`);
5359
4117
  }
5360
4118
  }
5361
- record(8, true, confirmed.detail ?? `the destination confirmed ${session.sessionId} at level ${level}, and ownership moved`);
4119
+ record2(8, true, confirmed.detail ?? `the destination confirmed ${session.sessionId} at level ${level}, and ownership moved`);
5362
4120
  return {
5363
4121
  kind: "resumed",
5364
- selection: plan.selection.selection,
4122
+ selection: plan2.selection.selection,
5365
4123
  step: 8,
5366
- detail: `the session resumed on ${plan.to} at level ${level} through the ${decorated.door} decoration door${notes.length === 0 ? "" : ` — ${notes.join("; ")}`}`,
4124
+ detail: `the session resumed on ${plan2.to} at level ${level} through the ${decorated.door} decoration door${notes.length === 0 ? "" : ` — ${notes.join("; ")}`}`,
5367
4125
  target,
5368
4126
  steps: trail
5369
4127
  };
@@ -5372,9 +4130,9 @@ function createHandoffBarrier(context, deps = {}) {
5372
4130
  if (committed && entry !== undefined) {
5373
4131
  return {
5374
4132
  kind: "resumed",
5375
- selection: plan.selection.selection,
4133
+ selection: plan2.selection.selection,
5376
4134
  step: 8,
5377
- detail: `the session resumed on ${plan.to}, but the barrier failed afterwards: ${detail}`,
4135
+ detail: `the session resumed on ${plan2.to}, but the barrier failed afterwards: ${detail}`,
5378
4136
  ...target === undefined ? {} : { target },
5379
4137
  steps: trail
5380
4138
  };
@@ -5423,8 +4181,8 @@ async function compareAgainstLocalRoot(args) {
5423
4181
  continue;
5424
4182
  compared += 1;
5425
4183
  const entries = await args.shared.store.load(key) ?? [];
5426
- const canonicalLines = entries.filter((entry) => entry["type"] !== "agent_metadata").map((entry) => JSON.stringify(entry));
5427
- const comparison = compareTranscriptTail({ localPath, canonicalLines, isDecoration: (uuid) => args.shared.decorations.has(args.session, uuid) });
4184
+ const canonicalLines2 = entries.filter((entry) => entry["type"] !== "agent_metadata").map((entry) => JSON.stringify(entry));
4185
+ const comparison = compareTranscriptTail({ localPath, canonicalLines: canonicalLines2, isDecoration: (uuid) => args.shared.decorations.has(args.session, uuid) });
5428
4186
  const what = key.subpath === undefined ? "the session's transcript" : `subkey ${key.subpath}`;
5429
4187
  switch (comparison.kind) {
5430
4188
  case "match":
@@ -5605,7 +4363,7 @@ async function markHandoffPending(args) {
5605
4363
  const chainable = entries.filter((entry) => typeof entry["uuid"] === "string");
5606
4364
  const cursor = chainable[chainable.length - 1]?.["uuid"] ?? "";
5607
4365
  const health = args.shared.health(args.session);
5608
- const record = {
4366
+ const record2 = {
5609
4367
  type: DIALECT_RECORD_ENTRY_TYPE,
5610
4368
  backendSessionId: args.session.sessionId,
5611
4369
  transcriptProjectKey: args.session.projectKey,
@@ -5625,18 +4383,18 @@ async function markHandoffPending(args) {
5625
4383
  }
5626
4384
  ]);
5627
4385
  await args.shared.settle(args.session);
5628
- return { cursor, stagingUuid: cryptoRandomUuid(), record };
4386
+ return { cursor, stagingUuid: cryptoRandomUuid(), record: record2 };
5629
4387
  }
5630
4388
  async function commitProducerRecord(args) {
5631
- const record = {
4389
+ const record2 = {
5632
4390
  ...args.staged.record,
5633
4391
  ...args.producer?.sdkVersion === undefined ? {} : { producerSdkVersion: args.producer.sdkVersion },
5634
4392
  ...args.producer?.engineVersion === undefined ? {} : { producerEngineVersion: args.producer.engineVersion }
5635
4393
  };
5636
- await args.shared.store.append(args.session, [record]);
4394
+ await args.shared.store.append(args.session, [record2]);
5637
4395
  await args.shared.settle(args.session);
5638
4396
  const summary = await args.shared.canonical.readSessionSummary({ projectKey: args.session.projectKey, sessionId: args.session.sessionId });
5639
- if (summary?.["producerRuntime"] !== record["producerRuntime"]) {
4397
+ if (summary?.["producerRuntime"] !== record2["producerRuntime"]) {
5640
4398
  throw new HandoffCommitError(`the producer record did not land: the summary still names ${String(summary?.["producerRuntime"] ?? "no producer")}`);
5641
4399
  }
5642
4400
  }
@@ -6337,7 +5095,7 @@ class SelectionRefusedError extends RuntimeSdkError {
6337
5095
  import { createRequire as createRequire2 } from "node:module";
6338
5096
  import { dirname as dirname2, join as join7 } from "node:path";
6339
5097
  import { existsSync as existsSync4, readFileSync as readFileSync4 } from "node:fs";
6340
- var SUPPORTED = { winterAgentSdk: ">=0.0.2 <0.1.0", claudeAgentSdk: "0.3.250" };
5098
+ var SUPPORTED = { winterAgentSdk: ">=0.0.3 <0.1.0", claudeAgentSdk: "0.3.250" };
6341
5099
  var SUPPORTED_PROTOCOL_VERSIONS = ["1.0"];
6342
5100
  function parseVersion(raw) {
6343
5101
  const match = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/.exec(raw.trim());
@@ -6400,18 +5158,17 @@ var VERSION_EXPORT_NAMES = ["SDK_VERSION", "VERSION", "PACKAGE_VERSION", "versio
6400
5158
  function readExportedVersion(namespace) {
6401
5159
  if (typeof namespace !== "object" || namespace === null)
6402
5160
  return;
6403
- const record = namespace;
5161
+ const record2 = namespace;
6404
5162
  for (const name of VERSION_EXPORT_NAMES) {
6405
- const value = record[name];
5163
+ const value = record2[name];
6406
5164
  if (typeof value === "string" && parseVersion(value) !== undefined)
6407
5165
  return value;
6408
5166
  }
6409
5167
  return;
6410
5168
  }
6411
- function readResolvedManifestVersion(packageName) {
5169
+ function readResolvedManifestVersion(packageName, resolveEntry = (name) => createRequire2(import.meta.url).resolve(name)) {
6412
5170
  try {
6413
- const require2 = createRequire2(import.meta.url);
6414
- let dir = dirname2(require2.resolve(packageName));
5171
+ let dir = dirname2(resolveEntry(packageName));
6415
5172
  for (let depth = 0;depth < 10; depth++) {
6416
5173
  const manifest = join7(dir, "package.json");
6417
5174
  if (existsSync4(manifest)) {
@@ -6429,19 +5186,25 @@ function readResolvedManifestVersion(packageName) {
6429
5186
  return;
6430
5187
  }
6431
5188
  }
6432
- function identityFor(packageName, namespace, supported) {
5189
+ function identityFor(packageName, namespace, supported, declared, seams) {
5190
+ if (declared !== undefined && parseVersion(declared) !== undefined) {
5191
+ return { packageName, packageVersion: declared, source: "host-declared", supported };
5192
+ }
6433
5193
  const exported = readExportedVersion(namespace);
6434
5194
  if (exported !== undefined)
6435
5195
  return { packageName, packageVersion: exported, source: "peer-export", supported };
6436
- const resolved = readResolvedManifestVersion(packageName);
5196
+ const resolved = readResolvedManifestVersion(packageName, seams.resolveEntry);
6437
5197
  if (resolved !== undefined)
6438
5198
  return { packageName, packageVersion: resolved, source: "resolved-manifest", supported };
6439
5199
  return;
6440
5200
  }
6441
5201
  var UNKNOWN_ACTUAL = "unknown (the injected module exports no version identity and no installed copy could be resolved)";
6442
- function assertVersionMatrix(peers) {
5202
+ function assertVersionMatrix(peers, declared) {
5203
+ return resolveVersionMatrix(peers, declared);
5204
+ }
5205
+ function resolveVersionMatrix(peers, declared, seams = {}) {
6443
5206
  const winterName = "@yanlinglabs/winter-agent-sdk";
6444
- const winterIdentity = identityFor(winterName, peers.winter, SUPPORTED.winterAgentSdk);
5207
+ const winterIdentity = identityFor(winterName, peers.winter, SUPPORTED.winterAgentSdk, declared?.winterAgentSdk, seams);
6445
5208
  if (winterIdentity === undefined) {
6446
5209
  throw new RuntimeSdkVersionError({ expected: `${winterName} ${SUPPORTED.winterAgentSdk}`, actual: UNKNOWN_ACTUAL });
6447
5210
  }
@@ -6470,7 +5233,7 @@ function assertVersionMatrix(peers) {
6470
5233
  if (peers.claude === undefined)
6471
5234
  return report;
6472
5235
  const claudeName = "@anthropic-ai/claude-agent-sdk";
6473
- const claudeIdentity = identityFor(claudeName, peers.claude, SUPPORTED.claudeAgentSdk);
5236
+ const claudeIdentity = identityFor(claudeName, peers.claude, SUPPORTED.claudeAgentSdk, declared?.claudeAgentSdk, seams);
6474
5237
  if (claudeIdentity === undefined) {
6475
5238
  throw new RuntimeSdkVersionError({ expected: `${claudeName} ${SUPPORTED.claudeAgentSdk}`, actual: UNKNOWN_ACTUAL });
6476
5239
  }
@@ -6486,10 +5249,10 @@ function runtimeSdkInternals(sdk) {
6486
5249
  return sdk[INTERNALS];
6487
5250
  }
6488
5251
  var INTERNALS = Symbol.for("winter-runtime-sdk.internals");
6489
- function forwardableOptions(options, brand) {
5252
+ function forwardableOptions(options, brand, capabilityServers) {
6490
5253
  const stripKeys = ROUTER_ONLY_OPTION_KEYS.filter((key) => (key in options));
6491
5254
  const injectBrand = brand !== undefined && options.brand === undefined;
6492
- if (stripKeys.length === 0 && !injectBrand)
5255
+ if (stripKeys.length === 0 && !injectBrand && capabilityServers === undefined)
6493
5256
  return options;
6494
5257
  const forwarded = {};
6495
5258
  for (const key of Object.keys(options)) {
@@ -6499,15 +5262,51 @@ function forwardableOptions(options, brand) {
6499
5262
  }
6500
5263
  if (injectBrand)
6501
5264
  forwarded["brand"] = brand;
5265
+ if (capabilityServers !== undefined)
5266
+ forwarded["mcpServers"] = mergedMcpServers(options.mcpServers, capabilityServers);
6502
5267
  return forwarded;
6503
5268
  }
5269
+ function mergedMcpServers(callerOwned, capabilityServers) {
5270
+ if (callerOwned === undefined)
5271
+ return capabilityServers;
5272
+ assertNoCapabilityCollision(callerOwned, capabilityServers);
5273
+ return { ...callerOwned, ...capabilityServers };
5274
+ }
5275
+ function assertNoCapabilityCollision(callerOwned, capabilityServers) {
5276
+ if (callerOwned === undefined)
5277
+ return;
5278
+ for (const name of Object.keys(capabilityServers)) {
5279
+ if (name in callerOwned)
5280
+ throw capabilityNameCollisionError({ field: "mcpServers", name });
5281
+ }
5282
+ }
5283
+ function capabilityServerRecord(capabilities, brand) {
5284
+ if (capabilities === undefined || capabilities.length === 0)
5285
+ return;
5286
+ const record2 = {};
5287
+ for (const server of capabilities) {
5288
+ if (server.name === brand.mcpServerName) {
5289
+ throw new RuntimeLaunchInputError({
5290
+ field: "capabilities",
5291
+ reason: `\`${server.name}\` is the brand's own standing-server name, which the router registers the messaging tools under on the official branch — a capability server may not claim it (WS-09 §1.3)`
5292
+ });
5293
+ }
5294
+ if (server.name in record2) {
5295
+ throw new RuntimeLaunchInputError({ field: "capabilities", reason: `two capability servers are named \`${server.name}\`, so one of them would never be registered` });
5296
+ }
5297
+ record2[server.name] = server;
5298
+ }
5299
+ return record2;
5300
+ }
6504
5301
  function createRuntimeSdk(opts) {
6505
- const versions = assertVersionMatrix(opts.peers);
5302
+ const versions = assertVersionMatrix(opts.peers, opts.peerVersions);
6506
5303
  const resolved = opts.peers.winter.resolveBrand(opts.brand);
6507
5304
  if (!resolved.ok)
6508
5305
  throw new opts.peers.winter.InvalidBrandError(resolved.reason);
6509
5306
  const brand = resolved.brand;
6510
5307
  const directoryStore = opts.directoryStore ?? createInMemoryRuntimeDirectoryStore();
5308
+ const capabilityServers = capabilityServerRecord(opts.capabilities, brand);
5309
+ const capabilityDescriptors = opts.capabilities === undefined || opts.capabilities.length === 0 ? undefined : capabilityServerDescriptors(opts.capabilities);
6511
5310
  const base = {
6512
5311
  peers: opts.peers,
6513
5312
  keychain: opts.keychain,
@@ -6554,6 +5353,8 @@ function createRuntimeSdk(opts) {
6554
5353
  const queryImpl = (args) => {
6555
5354
  assertLive("query");
6556
5355
  const options = args.options ?? {};
5356
+ if (capabilityServers !== undefined)
5357
+ assertNoCapabilityCollision(options.mcpServers, capabilityServers);
6557
5358
  const runtime = options.runtime;
6558
5359
  const decided = runtime === undefined ? undefined : runtime.selection ?? (runtime.select === undefined ? undefined : decide(runtime.select));
6559
5360
  const ledgerKey = runtime?.official !== undefined ? officialLegAddress(runtime.official) : runtime?.sessionId === undefined ? undefined : sessionLedgerKey(runtime.sessionId);
@@ -6584,10 +5385,14 @@ function createRuntimeSdk(opts) {
6584
5385
  transcriptProjectKey,
6585
5386
  ...opts.vendoredOfficialRuntime === undefined ? {} : { vendoredOfficialRuntime: opts.vendoredOfficialRuntime },
6586
5387
  ...opts.official === undefined ? {} : { policy: opts.official },
5388
+ ...capabilityDescriptors === undefined ? {} : { capabilities: capabilityDescriptors },
5389
+ ...opts.toInputShape === undefined ? {} : { toInputShape: opts.toInputShape },
5390
+ ...opts.peers.claude === undefined ? {} : { mcpModule: opts.peers.claude },
5391
+ ...opts.advisor === undefined ? {} : { advisor: opts.advisor },
6587
5392
  onOpened: noteOpened
6588
5393
  }, { prompt: args.prompt, options: forwardableOptions(options, opts.brand === undefined ? undefined : brand), input: official, selection: decided });
6589
5394
  }
6590
- const winterQuery = opts.peers.winter.query({ prompt: args.prompt, options: forwardableOptions(options, opts.brand === undefined ? undefined : brand) });
5395
+ const winterQuery = opts.peers.winter.query({ prompt: args.prompt, options: forwardableOptions(options, opts.brand === undefined ? undefined : brand, capabilityServers) });
6591
5396
  noteOpened("winter-agent");
6592
5397
  return winterQuery;
6593
5398
  };
@@ -6617,63 +5422,68 @@ function createRuntimeSdk(opts) {
6617
5422
  return sdk;
6618
5423
  }
6619
5424
  export {
6620
- CHILD_PROVIDER_UNAVAILABLE,
6621
- D14_CLAUDE_OAUTH_APPROVED_DEFAULT,
6622
- EXECUTION_INDIRECTION_ENV_NAMES,
6623
- EXECUTION_INDIRECTION_ENV_PREFIXES,
6624
- LIST_AGENTS_FIELD_MAX,
6625
- MATERIALIZED_RESUME_PROBE_REPORTS,
6626
- NATIVE_LIST_AGENTS_OUTPUT_SCHEMA,
6627
- NATIVE_LIST_AGENTS_SCHEMA,
6628
- NATIVE_SEND_MESSAGE_SCHEMA,
6629
- NotImplementedYet,
6630
- RESUME_STAGING_PREFIX,
6631
- ROUTER_ONLY_OPTION_KEYS,
6632
- RuntimeHandoffRequiredError,
6633
- RuntimeLaunchInputError,
6634
- RuntimeSdkDisposedError,
6635
- RuntimeSdkError,
6636
- RuntimeSdkVersionError,
6637
- SELECTION_RULES,
6638
- SEND_MESSAGE_SUMMARY_MAX,
6639
- SEND_MESSAGE_TO_MAX,
6640
- SUPPORTED,
6641
- SUPPORTED_PROTOCOL_VERSIONS,
6642
- SelectionRefusedError,
6643
- TRAFFIC_OPT_OUT_VARIABLES,
6644
- TRAFFIC_OPT_OUT_VARIABLE_NAMES,
6645
- UNKNOWN_VERSION,
6646
- UnaddressableEntryError,
6647
- VERSION_EXPORT_NAMES,
6648
- acceptNativeListAgentsArgs,
6649
- acceptNativeSendMessageArgs,
6650
- assertVersionMatrix,
6651
- createAttachedSessionRegistry,
6652
- createInMemoryRuntimeDirectoryStore,
6653
- createMessagingToolHandlers,
6654
- createOfficialInputStream,
6655
- createRuntimeMessaging,
6656
- createRuntimeSdk,
6657
- forwardableOptions,
6658
- isExecutionIndirectionVariable,
6659
- isOfficialQuery,
6660
- isResumeStagingRoot,
6661
- isSelectionRefusal,
6662
- materializedResumeReportForPin,
6663
- officialConnectionEnv,
6664
- officialCredentialPlan,
6665
- officialUserTurn,
6666
- parseVersion,
6667
- readExportedVersion,
6668
- readResolvedManifestVersion,
6669
- resumeChildSelection,
6670
- resumeStagingRoot,
6671
- reviewPersistedSelection,
6672
- ruleIdOf,
6673
- runtimeSdkInternals,
6674
- satisfiesRange,
6675
- selectChildRuntime,
6676
- selectChildRuntimePairing,
5425
+ winterMcpServerDescriptor,
5426
+ selectionVersionsFrom,
6677
5427
  selectRuntime,
6678
- selectionVersionsFrom
5428
+ selectChildRuntimePairing,
5429
+ selectChildRuntime,
5430
+ satisfiesRange,
5431
+ runtimeSdkInternals,
5432
+ ruleIdOf,
5433
+ reviewPersistedSelection,
5434
+ resumeStagingRoot,
5435
+ resumeChildSelection,
5436
+ renderAttributedTurn,
5437
+ readResolvedManifestVersion,
5438
+ readExportedVersion,
5439
+ parseVersion,
5440
+ officialUserTurn,
5441
+ officialMcpServers,
5442
+ officialDisallowedTools,
5443
+ officialCredentialPlan,
5444
+ officialConnectionEnv,
5445
+ officialBranchLabel,
5446
+ minimalOsEnvironmentFrom,
5447
+ materializedResumeReportForPin,
5448
+ materializeOfficialMcpServer,
5449
+ isSelectionRefusal,
5450
+ isResumeStagingRoot,
5451
+ isOurApprovalBridge,
5452
+ isOfficialQuery,
5453
+ isExecutionIndirectionVariable,
5454
+ forwardableOptions,
5455
+ createRuntimeSdk,
5456
+ createRuntimeMessaging,
5457
+ createOfficialInputStream,
5458
+ createInMemoryRuntimeDirectoryStore,
5459
+ createAttachedSessionRegistry,
5460
+ createApprovalBridge,
5461
+ containmentDispositions,
5462
+ canonicalToolNames,
5463
+ buildOfficialChildEnv,
5464
+ assertVersionMatrix,
5465
+ VERSION_EXPORT_NAMES,
5466
+ UnaddressableEntryError,
5467
+ UNKNOWN_VERSION,
5468
+ TRAFFIC_OPT_OUT_VARIABLE_NAMES,
5469
+ TRAFFIC_OPT_OUT_VARIABLES,
5470
+ SelectionRefusedError,
5471
+ SUPPORTED_PROTOCOL_VERSIONS,
5472
+ SUPPORTED,
5473
+ SELECTION_RULES,
5474
+ RuntimeSdkVersionError,
5475
+ RuntimeSdkError,
5476
+ RuntimeSdkDisposedError,
5477
+ RuntimeLaunchInputError,
5478
+ RuntimeHandoffRequiredError,
5479
+ ROUTER_ONLY_OPTION_KEYS,
5480
+ RESUME_STAGING_PREFIX,
5481
+ OFFICIAL_MATERIALIZATION_DROPS,
5482
+ OFFICIAL_DISCLOSURES,
5483
+ NotImplementedYet,
5484
+ MATERIALIZED_RESUME_PROBE_REPORTS,
5485
+ EXECUTION_INDIRECTION_ENV_PREFIXES,
5486
+ EXECUTION_INDIRECTION_ENV_NAMES,
5487
+ D14_CLAUDE_OAUTH_APPROVED_DEFAULT,
5488
+ CHILD_PROVIDER_UNAVAILABLE
6679
5489
  };