@yanlinglabs/winter-runtime-sdk 0.0.2 → 0.0.4

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.
@@ -0,0 +1,1434 @@
1
+ // src/errors.ts
2
+ class RuntimeSdkError extends Error {
3
+ constructor(message, options) {
4
+ super(message, options);
5
+ this.name = new.target.name;
6
+ const capture = Error.captureStackTrace;
7
+ if (typeof capture === "function")
8
+ capture(this, new.target);
9
+ }
10
+ }
11
+
12
+ class RuntimeHandoffRequiredError extends RuntimeSdkError {
13
+ from;
14
+ to;
15
+ address;
16
+ constructor(args) {
17
+ 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`);
18
+ this.from = args.from;
19
+ this.to = args.to;
20
+ this.address = args.address;
21
+ }
22
+ }
23
+
24
+ class RuntimeLaunchInputError extends RuntimeSdkError {
25
+ field;
26
+ constructor(args) {
27
+ super(`winter-runtime-sdk: ${args.leg === undefined ? "" : `the ${args.leg} leg: `}\`${args.field}\` — ${args.reason}`);
28
+ this.field = args.field;
29
+ }
30
+ }
31
+
32
+ class UnaddressableEntryError extends RuntimeSdkError {
33
+ address;
34
+ constructor(address) {
35
+ 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>"`);
36
+ this.address = address;
37
+ }
38
+ }
39
+
40
+ class RuntimeSdkVersionError extends RuntimeSdkError {
41
+ expected;
42
+ actual;
43
+ constructor(args) {
44
+ super(args.message ?? `winter-runtime-sdk: version matrix refuses this peer set — expected ${args.expected}, got ${args.actual}`);
45
+ this.expected = args.expected;
46
+ this.actual = args.actual;
47
+ }
48
+ }
49
+
50
+ class NotImplementedYet extends RuntimeSdkError {
51
+ lane;
52
+ seam;
53
+ constructor(lane, seam) {
54
+ super(`winter-runtime-sdk: ${seam} is not implemented yet — Phase 7b ${lane} owns it (the spine ships the signature, not the behaviour)`);
55
+ this.lane = lane;
56
+ this.seam = seam;
57
+ }
58
+ }
59
+
60
+ class RuntimeSdkDisposedError extends RuntimeSdkError {
61
+ constructor(method) {
62
+ super(`winter-runtime-sdk: ${method}() was called after dispose()`);
63
+ }
64
+ }
65
+
66
+ // src/official/branding.ts
67
+ function officialBranchLabel(brand) {
68
+ return `${brand.processLabel}-claude-agent`;
69
+ }
70
+ var OFFICIAL_DISCLOSURES = [
71
+ {
72
+ id: "signed-binary-identity",
73
+ literal: "com.anthropic.claude-code",
74
+ where: "the code signature of the runtime binary, in process viewers, crash reports and signing displays",
75
+ why: "the binary is never patched, re-signed, or misrepresented as ours — the D12 process label is cosmetic and this is the identity underneath it"
76
+ },
77
+ {
78
+ id: "spool-config-file",
79
+ literal: ".claude.json",
80
+ where: "inside the spool root (CLAUDE_CONFIG_DIR relocates the root; the basename stays literal)",
81
+ why: "the runtime's own config file name; the supported control is the ROOT, not the basename"
82
+ },
83
+ {
84
+ id: "nested-engine-temp",
85
+ literal: "claude-<uid>",
86
+ where: "a subdirectory the engine appends under the configured shared temp root",
87
+ why: "the runtime computes it itself; symlink tricks are rejected by the runtime and forbidden"
88
+ },
89
+ {
90
+ id: "resume-staging",
91
+ literal: "claude-resume-<uuid>",
92
+ where: "the OS temp directory, for a generation resumed out of the shared session store",
93
+ why: "the prefix is fixed by the runtime; only the temp BASE is host-controllable, and only through the SDK parent's own process environment"
94
+ },
95
+ {
96
+ id: "vendor-telemetry-defaults",
97
+ literal: "the runtime's own telemetry defaults",
98
+ where: "inside the child, because §3's allowlist injects no telemetry variable unless the deployment configures one",
99
+ why: "a disable switch is a proxy/telemetry variable like any other and §3 admits none by default, so the vendor's own defaults apply — disclosed rather than silently assumed off (review r1, n2)"
100
+ },
101
+ {
102
+ id: "extraction-cache",
103
+ literal: "claude-agent-sdk-<hash>",
104
+ where: "not present — avoided by packaging the native runtime as an ordinary resource rather than a self-extracting bundle",
105
+ why: "disclosed as avoided rather than omitted, so a later reader can tell an absent cache from an undocumented one"
106
+ }
107
+ ];
108
+
109
+ // src/official/aliases.ts
110
+ import { mcpToolName } from "@yanlinglabs/winter-agent-sdk";
111
+ var ALIASED_BUILTINS = [
112
+ { builtin: "SendMessage", tool: "send_message" },
113
+ { builtin: "ListAgents", tool: "list_agents" },
114
+ { builtin: "ReadNotifications", tool: "read_notifications" },
115
+ { builtin: "advisor", tool: "advisor" }
116
+ ];
117
+ function officialToolAliases(brand) {
118
+ return Object.fromEntries(ALIASED_BUILTINS.map(({ builtin, tool }) => [builtin, mcpToolName(brand, tool)]));
119
+ }
120
+ function aliasTargetFor(builtin, brand) {
121
+ const entry = ALIASED_BUILTINS.find((candidate) => candidate.builtin === builtin);
122
+ if (entry === undefined)
123
+ throw new TypeError(`not an aliased builtin: ${String(builtin)}`);
124
+ return mcpToolName(brand, entry.tool);
125
+ }
126
+ function aliasDenyNames(builtin, brand) {
127
+ return [builtin, aliasTargetFor(builtin, brand)];
128
+ }
129
+
130
+ // src/official/errors.ts
131
+ class OfficialBranchError extends RuntimeSdkError {
132
+ crashClass;
133
+ branch;
134
+ constructor(message, branchLabel, options) {
135
+ super(message, options);
136
+ this.branch = branchLabel;
137
+ }
138
+ }
139
+
140
+ class OfficialConfigurationError extends OfficialBranchError {
141
+ code = "official_configuration_invalid";
142
+ winterClass = "WinterSDKError";
143
+ option;
144
+ constructor(args) {
145
+ super(`${args.branchLabel}: ${args.option} — ${args.reason}`, args.branchLabel);
146
+ this.option = args.option;
147
+ }
148
+ }
149
+
150
+ class OfficialExecutableNotFoundError extends OfficialBranchError {
151
+ code = "official_executable_not_found";
152
+ winterClass = "CLIConnectionError";
153
+ crashClass = "executable-not-found";
154
+ path;
155
+ constructor(args) {
156
+ super(`${args.branchLabel}: the vendored runtime was not found at ${args.path}`, args.branchLabel, args.cause === undefined ? undefined : { cause: args.cause });
157
+ this.path = args.path;
158
+ }
159
+ }
160
+
161
+ class OfficialConnectionError extends OfficialBranchError {
162
+ code = "official_connection_failure";
163
+ winterClass = "CLIConnectionError";
164
+ crashClass = "connection-failure";
165
+ constructor(args) {
166
+ super(`${args.branchLabel}: the runtime connection failed — ${args.reason}`, args.branchLabel, args.cause === undefined ? undefined : { cause: args.cause });
167
+ }
168
+ }
169
+ class OfficialNonzeroExitError extends OfficialBranchError {
170
+ code = "official_nonzero_exit";
171
+ winterClass = "ProcessError";
172
+ crashClass = "nonzero-exit";
173
+ exitCode;
174
+ signal;
175
+ stderrTail;
176
+ constructor(args) {
177
+ super(`${args.branchLabel}: the runtime exited with code ${String(args.exitCode)}${args.signal === null ? "" : ` (signal ${args.signal})`}`, args.branchLabel);
178
+ this.exitCode = args.exitCode;
179
+ this.signal = args.signal;
180
+ this.stderrTail = args.stderrTail;
181
+ }
182
+ }
183
+
184
+ class OfficialKilledError extends OfficialBranchError {
185
+ code = "official_killed";
186
+ winterClass = "ProcessError";
187
+ crashClass = "killed";
188
+ signal;
189
+ constructor(args) {
190
+ super(`${args.branchLabel}: the runtime was killed with ${args.signal} — ${args.reason}`, args.branchLabel);
191
+ this.signal = args.signal;
192
+ }
193
+ }
194
+
195
+ class OfficialContainmentBreachError extends OfficialBranchError {
196
+ code = "official_containment_breach";
197
+ winterClass = "WinterSDKError";
198
+ tool;
199
+ created;
200
+ removed;
201
+ retained;
202
+ constructor(args) {
203
+ 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);
204
+ this.tool = args.toolName;
205
+ this.created = [...args.created];
206
+ this.removed = [...args.removed];
207
+ this.retained = [...args.retained];
208
+ }
209
+ }
210
+
211
+ class OfficialStdoutUnterminatedError extends OfficialBranchError {
212
+ code = "official_stdout_unterminated";
213
+ winterClass = "ProcessError";
214
+ crashClass = "stdout-unterminated";
215
+ graceMs;
216
+ constructor(args) {
217
+ 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);
218
+ this.graceMs = args.graceMs;
219
+ }
220
+ }
221
+ class OfficialMcpError extends OfficialBranchError {
222
+ code = "official_mcp_failure";
223
+ winterClass = "WinterSDKError";
224
+ server;
225
+ constructor(args) {
226
+ super(`${args.branchLabel}: the MCP server ${args.server} failed — ${args.reason}`, args.branchLabel);
227
+ this.server = args.server;
228
+ }
229
+ }
230
+ class OfficialInvalidResumeError extends OfficialBranchError {
231
+ code = "official_invalid_resume";
232
+ winterClass = "WinterSDKError";
233
+ constructor(args) {
234
+ super(`${args.branchLabel}: invalid resume/fork — ${args.reason}`, args.branchLabel);
235
+ }
236
+ }
237
+
238
+ // src/official/containment.ts
239
+ var FORBIDDEN_TARGETS = {
240
+ instructionsFile: "CLAUDE.md",
241
+ projectDir: ".claude",
242
+ userPlansDir: ".claude/plans"
243
+ };
244
+ function containmentPaths(brand) {
245
+ return {
246
+ worktrees: `${brand.projectDirName}/worktrees`,
247
+ workflows: `${brand.projectDirName}/workflows`,
248
+ plans: `${brand.projectDirName}/plans`,
249
+ localSettings: `${brand.projectDirName}/settings.local.json`
250
+ };
251
+ }
252
+ function resolveSavedApprovalDisposition(policy, branchLabel) {
253
+ const disposition = policy.savedWebFetchApprovals ?? "disable";
254
+ if (disposition === "redirect") {
255
+ throw new OfficialConfigurationError({
256
+ option: "containment.savedWebFetchApprovals",
257
+ 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)",
258
+ branchLabel
259
+ });
260
+ }
261
+ return disposition;
262
+ }
263
+ function containmentDispositions(brand, policy = {}) {
264
+ const paths = containmentPaths(brand);
265
+ const savedApprovals = policy.savedWebFetchApprovals ?? "disable";
266
+ return [
267
+ {
268
+ writer: 'EnterWorktree / Agent isolation: "worktree"',
269
+ claudeNamedTarget: `${FORBIDDEN_TARGETS.projectDir}/worktrees/`,
270
+ disposition: "redirect",
271
+ target: paths.worktrees,
272
+ enforcement: (policy.worktrees ?? "deny") === "deny" ? "floor-deny" : "host-implementation",
273
+ note: "the router implements no tools, so until the host installs the schema-compatible replacement the vendor's own writer is denied at the floor"
274
+ },
275
+ {
276
+ writer: "CronCreate with durable: true",
277
+ claudeNamedTarget: `${FORBIDDEN_TARGETS.projectDir}/scheduled_tasks.json`,
278
+ disposition: "disable",
279
+ enforcement: "deny-list",
280
+ note: "the name is in `disallowedTools`, so the runtime refuses it before the callback; the floor also refuses a truthy `durable` for a host that re-enables the tool"
281
+ },
282
+ {
283
+ writer: "named Workflow resolution",
284
+ claudeNamedTarget: `${FORBIDDEN_TARGETS.projectDir}/workflows/`,
285
+ disposition: "redirect",
286
+ target: paths.workflows,
287
+ enforcement: (policy.workflows ?? "deny") === "deny" ? "floor-deny" : "host-implementation",
288
+ note: "named resolution reads the vendor's own directory; denied at the floor until the host's replacement resolves under the product's own"
289
+ },
290
+ {
291
+ writer: "saved WebFetch approval",
292
+ claudeNamedTarget: `${FORBIDDEN_TARGETS.projectDir}/settings.local.json`,
293
+ disposition: savedApprovals,
294
+ ...savedApprovals === "redirect" ? { target: paths.localSettings } : {},
295
+ enforcement: savedApprovals === "disable" ? "approval-stripped" : "host-implementation",
296
+ note: savedApprovals === "disable" ? "saving is disabled on this branch: the approval still applies for the session, and WS-07 keeps its open question (WS-14 §16 q2)" : "durable approvals are routed into the product's own project settings file (WS-07's shared-store answer, chosen explicitly by the host)"
297
+ },
298
+ {
299
+ writer: "/init and config commands",
300
+ claudeNamedTarget: `project ${FORBIDDEN_TARGETS.instructionsFile}, ${FORBIDDEN_TARGETS.projectDir}/`,
301
+ disposition: "owned-by-product",
302
+ enforcement: "host-ui",
303
+ note: "a slash command is user-facing surface, not a tool the model can call: the product owns init/config and its UI never presents the vendor's own /init as the product's"
304
+ },
305
+ {
306
+ writer: "arbitrary Write/Edit/Bash",
307
+ claudeNamedTarget: `any ${FORBIDDEN_TARGETS.instructionsFile}, ${FORBIDDEN_TARGETS.projectDir}/, ~/${FORBIDDEN_TARGETS.userPlansDir}`,
308
+ disposition: "deny",
309
+ enforcement: "floor-deny",
310
+ note: "the permission floor denies residual writes by PATH, case-folded and Unicode-normalized; plansDirectory already redirects plan mode"
311
+ }
312
+ ];
313
+ }
314
+ function officialDisallowedTools(policy = {}, brand) {
315
+ const denied = ["CronCreate"];
316
+ if (policy.deniedAliasedBuiltins !== undefined && brand !== undefined) {
317
+ for (const builtin of policy.deniedAliasedBuiltins)
318
+ denied.push(...aliasDenyNames(builtin, brand));
319
+ }
320
+ return denied;
321
+ }
322
+ var norm = (path) => path.replace(/\\/g, "/").replace(/\/+/g, "/");
323
+ var fold = (value) => value.normalize("NFKC").toLowerCase();
324
+ var FORBIDDEN_PROJECT_DIR = fold(FORBIDDEN_TARGETS.projectDir);
325
+ var FORBIDDEN_INSTRUCTIONS_FILE = fold(FORBIDDEN_TARGETS.instructionsFile);
326
+ function targetsForbiddenPath(rawPath) {
327
+ const segments = norm(rawPath).split("/").filter((segment) => segment.length > 0).map(fold);
328
+ const index = segments.indexOf(FORBIDDEN_PROJECT_DIR);
329
+ if (index >= 0) {
330
+ return { forbidden: true, target: segments[index + 1] === "plans" ? FORBIDDEN_TARGETS.userPlansDir : FORBIDDEN_TARGETS.projectDir };
331
+ }
332
+ if (segments[segments.length - 1] === FORBIDDEN_INSTRUCTIONS_FILE)
333
+ return { forbidden: true, target: FORBIDDEN_TARGETS.instructionsFile };
334
+ return { forbidden: false, target: "" };
335
+ }
336
+ var VENDOR_HOME_SEGMENT_RE = /(^|\/)\.claude(\/|$)/i;
337
+ var PATH_FIELDS = [
338
+ "file_path",
339
+ "filePath",
340
+ "path",
341
+ "notebook_path",
342
+ "notebookPath",
343
+ "directory",
344
+ "dir",
345
+ "target_file",
346
+ "targetFile",
347
+ "file",
348
+ "plan_file_path",
349
+ "planFilePath"
350
+ ];
351
+ var COMMAND_PROJECT_DIR_RE = /(?:^|[^A-Za-z0-9_.\\-])\.claude(?![A-Za-z0-9_-])/i;
352
+ var COMMAND_INSTRUCTIONS_FILE_RE = /(?:^|[^A-Za-z0-9_\\-])claude\.md(?![A-Za-z0-9_.-])/i;
353
+ function isTruthy(value) {
354
+ if (value === true)
355
+ return true;
356
+ if (typeof value === "number")
357
+ return value !== 0;
358
+ if (typeof value !== "string")
359
+ return false;
360
+ return ["true", "1", "yes", "on"].includes(value.trim().toLowerCase());
361
+ }
362
+ var WORKTREE_TOOLS = ["EnterWorktree", "ExitWorktree", "WorktreeCreate"];
363
+ var AGENT_TOOLS = ["Task", "Agent"];
364
+ var WORKFLOW_TOOLS = ["Workflow"];
365
+ function containmentDecisionFor(toolName, input, policy = {}) {
366
+ const deny = (target, what) => ({
367
+ allow: false,
368
+ target,
369
+ 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)`
370
+ });
371
+ for (const field of PATH_FIELDS) {
372
+ const value = input[field];
373
+ if (typeof value !== "string")
374
+ continue;
375
+ const hit = targetsForbiddenPath(value);
376
+ if (hit.forbidden)
377
+ return deny(hit.target, value);
378
+ }
379
+ for (const field of ["command", "script", "code"]) {
380
+ const value = input[field];
381
+ if (typeof value !== "string")
382
+ continue;
383
+ const command = value.normalize("NFKC");
384
+ if (COMMAND_PROJECT_DIR_RE.test(command))
385
+ return deny(FORBIDDEN_TARGETS.projectDir, value);
386
+ if (COMMAND_INSTRUCTIONS_FILE_RE.test(command))
387
+ return deny(FORBIDDEN_TARGETS.instructionsFile, value);
388
+ const unquoted = command.replace(/[\\'"`]/g, "");
389
+ if (COMMAND_PROJECT_DIR_RE.test(unquoted))
390
+ return deny(FORBIDDEN_TARGETS.projectDir, value);
391
+ if (COMMAND_INSTRUCTIONS_FILE_RE.test(unquoted))
392
+ return deny(FORBIDDEN_TARGETS.instructionsFile, value);
393
+ }
394
+ const paths = containmentPaths({ projectDirName: policy.projectDirName ?? "" });
395
+ if ((policy.worktrees ?? "deny") === "deny") {
396
+ if (WORKTREE_TOOLS.includes(toolName)) {
397
+ return {
398
+ allow: false,
399
+ target: `${FORBIDDEN_TARGETS.projectDir}/worktrees/`,
400
+ 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)`
401
+ };
402
+ }
403
+ if (AGENT_TOOLS.includes(toolName) && String(input["isolation"] ?? "") === "worktree") {
404
+ return {
405
+ allow: false,
406
+ target: `${FORBIDDEN_TARGETS.projectDir}/worktrees/`,
407
+ 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)`
408
+ };
409
+ }
410
+ }
411
+ if ((policy.workflows ?? "deny") === "deny" && WORKFLOW_TOOLS.includes(toolName)) {
412
+ return {
413
+ allow: false,
414
+ target: `${FORBIDDEN_TARGETS.projectDir}/workflows/`,
415
+ 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)`
416
+ };
417
+ }
418
+ if (toolName === "CronCreate" && isTruthy(input["durable"])) {
419
+ return {
420
+ allow: false,
421
+ target: `${FORBIDDEN_TARGETS.projectDir}/scheduled_tasks.json`,
422
+ reason: "durable scheduled tasks are unavailable on this branch: the vendor's durable variant persists into its own project directory (WS-14 §8)"
423
+ };
424
+ }
425
+ return { allow: true };
426
+ }
427
+
428
+ // src/official/auth.ts
429
+ var AUTH_FAMILY_VARIABLES = {
430
+ "api-key": ["ANTHROPIC_API_KEY"],
431
+ "console-oauth": ["ANTHROPIC_AUTH_TOKEN", "ANTHROPIC_BASE_URL"],
432
+ 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"],
433
+ vertex: ["CLAUDE_CODE_USE_VERTEX", "ANTHROPIC_VERTEX_PROJECT_ID", "CLOUD_ML_REGION", "GOOGLE_APPLICATION_CREDENTIALS", "ANTHROPIC_VERTEX_BASE_URL"],
434
+ "console-profile": ["ANTHROPIC_PROFILE", "ANTHROPIC_CONFIG_DIR"],
435
+ "claude-oauth": [],
436
+ "local-none": []
437
+ };
438
+ 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)$/;
439
+ function isAuthShapedVariable(name) {
440
+ return AUTH_SHAPED_RE.test(name) || /_(?:API_KEY|AUTH_TOKEN|TOKEN|SECRET|CREDENTIALS|CREDS|PASSWORD|PASSWD)$/.test(name);
441
+ }
442
+ var ALL_AUTH_VARIABLES = Object.values(AUTH_FAMILY_VARIABLES).flat().filter((name, index, all) => all.indexOf(name) === index);
443
+ var NEVER_INJECTED_AUTH_VARIABLES = ["CLAUDE_CODE_OAUTH_TOKEN"];
444
+ function authVariableSetKey(selection) {
445
+ switch (selection.authFamily) {
446
+ case "cloud-credential-chain":
447
+ return selection.providerId.toLowerCase().includes("vertex") ? "vertex" : "bedrock";
448
+ case "custom":
449
+ return "custom";
450
+ default:
451
+ return selection.authFamily;
452
+ }
453
+ }
454
+ function allowedAuthVariables(selection) {
455
+ const key = authVariableSetKey(selection);
456
+ return key === "custom" ? undefined : AUTH_FAMILY_VARIABLES[key];
457
+ }
458
+ function validateAuthEnvironment(args) {
459
+ const names = Object.keys(args.credentials);
460
+ for (const name of names) {
461
+ if (NEVER_INJECTED_AUTH_VARIABLES.includes(name)) {
462
+ throw new OfficialConfigurationError({
463
+ option: `env.${name}`,
464
+ 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)",
465
+ branchLabel: args.branchLabel
466
+ });
467
+ }
468
+ }
469
+ if (args.selection.authFamily === "claude-oauth") {
470
+ if (!args.gate.approved) {
471
+ throw new OfficialConfigurationError({
472
+ option: "selection.authFamily",
473
+ 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",
474
+ branchLabel: args.branchLabel
475
+ });
476
+ }
477
+ if (names.length > 0) {
478
+ throw new OfficialConfigurationError({
479
+ option: "credentials",
480
+ reason: `the Claude OAuth family injects NO credential variable — its stored subscription state lives inside the spool namespace — but ${names.join(", ")} was supplied`,
481
+ branchLabel: args.branchLabel
482
+ });
483
+ }
484
+ return;
485
+ }
486
+ const allowed = allowedAuthVariables(args.selection);
487
+ if (allowed !== undefined) {
488
+ const stray = names.filter((name) => !allowed.includes(name));
489
+ if (stray.length > 0) {
490
+ throw new OfficialConfigurationError({
491
+ option: "credentials",
492
+ 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`,
493
+ branchLabel: args.branchLabel
494
+ });
495
+ }
496
+ if (allowed.includes("ANTHROPIC_AUTH_TOKEN") && names.includes("ANTHROPIC_BASE_URL") && !names.includes("ANTHROPIC_AUTH_TOKEN")) {
497
+ throw new OfficialConfigurationError({
498
+ option: "credentials.ANTHROPIC_BASE_URL",
499
+ 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",
500
+ branchLabel: args.branchLabel
501
+ });
502
+ }
503
+ if (args.selection.authFamily === "console-profile" && names.includes("ANTHROPIC_PROFILE") !== names.includes("ANTHROPIC_CONFIG_DIR")) {
504
+ throw new OfficialConfigurationError({
505
+ option: "credentials",
506
+ reason: "the console-profile family sets ANTHROPIC_PROFILE and ANTHROPIC_CONFIG_DIR together or not at all — one without the other resolves against whatever the CLI's own default profile store holds, silently (router 0.0.4, C1)",
507
+ branchLabel: args.branchLabel
508
+ });
509
+ }
510
+ }
511
+ }
512
+ async function fetchAuthCredentials(args) {
513
+ const out = {};
514
+ for (const entry of args.plan) {
515
+ const material = await args.keychain.read(entry.ref);
516
+ if (material === undefined || material.length === 0) {
517
+ throw new OfficialConfigurationError({
518
+ option: `credentials.${entry.variable}`,
519
+ 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`,
520
+ branchLabel: args.branchLabel
521
+ });
522
+ }
523
+ out[entry.variable] = material;
524
+ }
525
+ return out;
526
+ }
527
+
528
+ // src/official/env-registry.ts
529
+ var NON_CREDENTIAL_ENV_REGISTRY = [
530
+ "AI_AGENT",
531
+ "ALACRITTY_LOG",
532
+ "ALLOW_ANT_COMPUTER_USE_MCP",
533
+ "ANTHROPIC_BEDROCK_SERVICE_TIER",
534
+ "ANTHROPIC_BETAS",
535
+ "ANTHROPIC_CUSTOM_MODEL_OPTION",
536
+ "ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION",
537
+ "ANTHROPIC_CUSTOM_MODEL_OPTION_NAME",
538
+ "ANTHROPIC_DEFAULT_FABLE_MODEL",
539
+ "ANTHROPIC_DEFAULT_FABLE_MODEL_DESCRIPTION",
540
+ "ANTHROPIC_DEFAULT_FABLE_MODEL_NAME",
541
+ "ANTHROPIC_DEFAULT_HAIKU_MODEL",
542
+ "ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION",
543
+ "ANTHROPIC_DEFAULT_HAIKU_MODEL_NAME",
544
+ "ANTHROPIC_DEFAULT_MODEL",
545
+ "ANTHROPIC_DEFAULT_OPUS_MODEL",
546
+ "ANTHROPIC_DEFAULT_OPUS_MODEL_DESCRIPTION",
547
+ "ANTHROPIC_DEFAULT_OPUS_MODEL_NAME",
548
+ "ANTHROPIC_DEFAULT_SONNET_MODEL",
549
+ "ANTHROPIC_DEFAULT_SONNET_MODEL_DESCRIPTION",
550
+ "ANTHROPIC_DEFAULT_SONNET_MODEL_NAME",
551
+ "ANTHROPIC_FEDERATION_RULE_ID",
552
+ "ANTHROPIC_FOUNDRY_RESOURCE",
553
+ "ANTHROPIC_GOOGLE_CLOUD_LOCATION",
554
+ "ANTHROPIC_MODEL",
555
+ "ANTHROPIC_SMALL_FAST_MODEL",
556
+ "ANT_OTEL_EXPORTER_OTLP_PROTOCOL",
557
+ "ANT_OTEL_LOGS_EXPORTER",
558
+ "ANT_OTEL_METRICS_EXPORTER",
559
+ "ANT_OTEL_RESOURCE_ATTRIBUTES",
560
+ "ANT_OTEL_TRACES_EXPORTER",
561
+ "API_FORCE_IDLE_TIMEOUT",
562
+ "API_TIMEOUT_MS",
563
+ "AWS_CONFIG_FILE",
564
+ "AWS_EXECUTION_ENV",
565
+ "AWS_LAMBDA_FUNCTION_NAME",
566
+ "AWS_ROLE_ARN",
567
+ "AZURE_FUNCTIONS_ENVIRONMENT",
568
+ "BASH_ENV",
569
+ "BASH_MAX_OUTPUT_LENGTH",
570
+ "BAT_THEME",
571
+ "BIGINT_FORMAT_RANGES",
572
+ "BUN_CHROME_PATH",
573
+ "BUN_CONFIG_FILE",
574
+ "BUN_INSTALL",
575
+ "CARGO_HOME",
576
+ "CCR_ENABLE_BUNDLE",
577
+ "CCR_FORCE_BUNDLE",
578
+ "CCR_ON_BRANCH_DEFAULT_GUARD",
579
+ "CF_PAGES",
580
+ "CLAUDE_AFK_COUNTDOWN_MS",
581
+ "CLAUDE_AFK_TIMEOUT_MS",
582
+ "CLAUDE_AFTER_LAST_COMPACT",
583
+ "CLAUDE_AGENTS_SELECT",
584
+ "CLAUDE_AGENT_SDK_CLIENT_APP",
585
+ "CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS",
586
+ "CLAUDE_AGENT_SDK_MCP_NO_PREFIX",
587
+ "CLAUDE_AGENT_SDK_VERSION",
588
+ "CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS",
589
+ "CLAUDE_AUTOCOMPACT_PCT_OVERRIDE",
590
+ "CLAUDE_AUTO_BACKGROUND_TASKS",
591
+ "CLAUDE_AX_PREPARK_MS",
592
+ "CLAUDE_AX_SCREEN_READER",
593
+ "CLAUDE_AX_STARTUP_QUIET_MS",
594
+ "CLAUDE_BG_BACKEND",
595
+ "CLAUDE_BG_ISOLATION",
596
+ "CLAUDE_BG_MEMORY_TOGGLED_OFF",
597
+ "CLAUDE_BG_POST_CLEAR_RESPAWN",
598
+ "CLAUDE_BG_RENDEZVOUS_SOCK",
599
+ "CLAUDE_BG_SOURCE",
600
+ "CLAUDE_BG_STARTUP_WEDGE_MS",
601
+ "CLAUDE_BG_TCC_DISCLAIMED",
602
+ "CLAUDE_BRIDGE_REATTACH_GROUPING",
603
+ "CLAUDE_BRIDGE_REATTACH_NO_BACKFILL",
604
+ "CLAUDE_BRIDGE_REATTACH_OUTBOUND_ONLY",
605
+ "CLAUDE_BRIDGE_REATTACH_OWNER_ACCT",
606
+ "CLAUDE_BRIDGE_REATTACH_OWNER_ORG",
607
+ "CLAUDE_BRIDGE_REATTACH_SEQ",
608
+ "CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS",
609
+ "CLAUDE_CHROME_CLASSIFIER_FLOOR",
610
+ "CLAUDE_CHROME_PERMISSION_MODE",
611
+ "CLAUDE_CLIENT_PRESENCE_FILE",
612
+ "CLAUDE_CODE_3P_PROBE_WROTE_OPUS_DEFAULT",
613
+ "CLAUDE_CODE_3P_PROBE_WROTE_SONNET_DEFAULT",
614
+ "CLAUDE_CODE_ACCESSIBILITY",
615
+ "CLAUDE_CODE_ACTION",
616
+ "CLAUDE_CODE_ACT_DONT_REDERIVE",
617
+ "CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD",
618
+ "CLAUDE_CODE_ADDITIONAL_PROTECTION",
619
+ "CLAUDE_CODE_ADOPT_UNDERIVABLE_PARKED_PERMISSION",
620
+ "CLAUDE_CODE_AGENT",
621
+ "CLAUDE_CODE_ALT_SCREEN_FULL_REPAINT",
622
+ "CLAUDE_CODE_ALWAYS_ENABLE_EFFORT",
623
+ "CLAUDE_CODE_AMBER_ASTROLABE",
624
+ "CLAUDE_CODE_ARTIFACT",
625
+ "CLAUDE_CODE_ARTIFACT_ASSETS",
626
+ "CLAUDE_CODE_ARTIFACT_AUTO_OPEN",
627
+ "CLAUDE_CODE_ARTIFACT_COMMENTS",
628
+ "CLAUDE_CODE_ARTIFACT_COMMENTS_AUTOREACT",
629
+ "CLAUDE_CODE_ARTIFACT_COMMENT_FAST_ACK",
630
+ "CLAUDE_CODE_ARTIFACT_COMMENT_FAST_ACK_FIXED",
631
+ "CLAUDE_CODE_ARTIFACT_COMMENT_RESPONDER",
632
+ "CLAUDE_CODE_ARTIFACT_DB",
633
+ "CLAUDE_CODE_ARTIFACT_DELETE",
634
+ "CLAUDE_CODE_ARTIFACT_PREVIEW",
635
+ "CLAUDE_CODE_ARTIFACT_ROOM",
636
+ "CLAUDE_CODE_ARTIFACT_TYPES",
637
+ "CLAUDE_CODE_ARTIFACT_TYPE_CATALOG",
638
+ "CLAUDE_CODE_ARTIFACT_TYPE_CLOUD_CREATE",
639
+ "CLAUDE_CODE_ARTIFACT_VERIFY",
640
+ "CLAUDE_CODE_ATTRIBUTION_HEADER",
641
+ "CLAUDE_CODE_AUTO_BACKGROUND_WORKER_CHECKIN_SECONDS",
642
+ "CLAUDE_CODE_AUTO_COMPACT_WINDOW",
643
+ "CLAUDE_CODE_AUTO_CONNECT_IDE",
644
+ "CLAUDE_CODE_AUTO_MODE_EXTERNAL_PERMISSIONS",
645
+ "CLAUDE_CODE_AUTO_MODE_MODEL",
646
+ "CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS",
647
+ "CLAUDE_CODE_BASALT_COVE",
648
+ "CLAUDE_CODE_BASE_REF",
649
+ "CLAUDE_CODE_BASE_REFS",
650
+ "CLAUDE_CODE_BASH_OUTPUT_AUDIENCE_NOTE",
651
+ "CLAUDE_CODE_BASH_SANDBOX_SHOW_INDICATOR",
652
+ "CLAUDE_CODE_BENCH_LIVE_COUNTS",
653
+ "CLAUDE_CODE_BG_CLASSIFIER_MODEL",
654
+ "CLAUDE_CODE_BG_TASKS_REPORT_RUNNING",
655
+ "CLAUDE_CODE_BISON_CAIRN",
656
+ "CLAUDE_CODE_BLOCKING_LIMIT_OVERRIDE",
657
+ "CLAUDE_CODE_BREEZY_HORIZON",
658
+ "CLAUDE_CODE_BRIDGE_MCP_CARRIER",
659
+ "CLAUDE_CODE_BRIDGE_PROMPT_SHA256",
660
+ "CLAUDE_CODE_BRIEF",
661
+ "CLAUDE_CODE_BRIEF_UPLOAD",
662
+ "CLAUDE_CODE_BUBBLEWRAP",
663
+ "CLAUDE_CODE_BYOC_ENABLE_DATADOG",
664
+ "CLAUDE_CODE_CCR_LAZY_SUBAGENT_HYDRATE",
665
+ "CLAUDE_CODE_CLASSIFIER_SUMMARY",
666
+ "CLAUDE_CODE_COLD_COMPACT",
667
+ "CLAUDE_CODE_CONTAINER_ID",
668
+ "CLAUDE_CODE_COORDINATOR_FORCE_WORKER_INHERIT_MODEL",
669
+ "CLAUDE_CODE_COORDINATOR_WORKER_CHECKIN_SECONDS",
670
+ "CLAUDE_CODE_COWORK_FRAME_ARTIFACTS",
671
+ "CLAUDE_CODE_DAEMON_COLD_START",
672
+ "CLAUDE_CODE_DATADOG_FLUSH_INTERVAL_MS",
673
+ "CLAUDE_CODE_DD_ERROR_TRACKING_FLUSH_INTERVAL_MS",
674
+ "CLAUDE_CODE_DEBUG_LOGS_DIR",
675
+ "CLAUDE_CODE_DEBUG_LOG_LEVEL",
676
+ "CLAUDE_CODE_DEBUG_REPAINTS",
677
+ "CLAUDE_CODE_DECSTBM",
678
+ "CLAUDE_CODE_DIAGNOSTICS_FILE",
679
+ "CLAUDE_CODE_DIR_SYNC_DISABLE_ANCHORING",
680
+ "CLAUDE_CODE_DIR_SYNC_ENGINE",
681
+ "CLAUDE_CODE_DIR_SYNC_FFWD",
682
+ "CLAUDE_CODE_DIR_SYNC_GIT",
683
+ "CLAUDE_CODE_DIR_SYNC_STREAM",
684
+ "CLAUDE_CODE_DISABLE_1M_CONTEXT",
685
+ "CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING",
686
+ "CLAUDE_CODE_DISABLE_ADMIN_ENV_UNION",
687
+ "CLAUDE_CODE_DISABLE_ADVISOR_TOOL",
688
+ "CLAUDE_CODE_DISABLE_AGENT_VIEW",
689
+ "CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN",
690
+ "CLAUDE_CODE_DISABLE_ARTIFACT",
691
+ "CLAUDE_CODE_DISABLE_ATTACHMENTS",
692
+ "CLAUDE_CODE_DISABLE_AUTO_MEMORY",
693
+ "CLAUDE_CODE_DISABLE_BACKGROUND_TASKS",
694
+ "CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_DEFAULT",
695
+ "CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD",
696
+ "CLAUDE_CODE_DISABLE_BG_EXIT_HANDOFF",
697
+ "CLAUDE_CODE_DISABLE_BG_SHELL_PRESSURE_REAP",
698
+ "CLAUDE_CODE_DISABLE_BUNDLED_SKILLS",
699
+ "CLAUDE_CODE_DISABLE_CLAUDE_API_SKILL",
700
+ "CLAUDE_CODE_DISABLE_CLAUDE_CODE_SKILL",
701
+ "CLAUDE_CODE_DISABLE_CLAUDE_MDS",
702
+ "CLAUDE_CODE_DISABLE_CRON",
703
+ "CLAUDE_CODE_DISABLE_DIR_SYNC",
704
+ "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS",
705
+ "CLAUDE_CODE_DISABLE_EXPLORE_INHERIT_CAP",
706
+ "CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS",
707
+ "CLAUDE_CODE_DISABLE_FAST_MODE",
708
+ "CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY",
709
+ "CLAUDE_CODE_DISABLE_FILE_CHECKPOINTING",
710
+ "CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS",
711
+ "CLAUDE_CODE_DISABLE_HOOK_FORWARDING",
712
+ "CLAUDE_CODE_DISABLE_LAUNCH_COMPOSER",
713
+ "CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP",
714
+ "CLAUDE_CODE_DISABLE_MEMORY_BULK_INFLATE",
715
+ "CLAUDE_CODE_DISABLE_MEMORY_MASS_DELETE_HOLD",
716
+ "CLAUDE_CODE_DISABLE_MEMORY_PERIODIC_RESYNC",
717
+ "CLAUDE_CODE_DISABLE_MEMORY_RO_UNSAVED_NOTICE",
718
+ "CLAUDE_CODE_DISABLE_MEMORY_STREAM_LIST",
719
+ "CLAUDE_CODE_DISABLE_MOUSE",
720
+ "CLAUDE_CODE_DISABLE_MOUSE_CLICKS",
721
+ "CLAUDE_CODE_DISABLE_NESTED_CHAIN_IDLE",
722
+ "CLAUDE_CODE_DISABLE_NESTED_USER_REPAIR",
723
+ "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC",
724
+ "CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK",
725
+ "CLAUDE_CODE_DISABLE_NOTIFICATION_PRESENCE_CHECK",
726
+ "CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL",
727
+ "CLAUDE_CODE_DISABLE_ORG_MEMORY",
728
+ "CLAUDE_CODE_DISABLE_PERMISSION_PROMPT_NOTIFY_HOOKS",
729
+ "CLAUDE_CODE_DISABLE_PLUGIN_FORWARDING",
730
+ "CLAUDE_CODE_DISABLE_POLICY_SKILLS",
731
+ "CLAUDE_CODE_DISABLE_PRECOMPACT_SKIP",
732
+ "CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK",
733
+ "CLAUDE_CODE_DISABLE_TERMINAL_TITLE",
734
+ "CLAUDE_CODE_DISABLE_THINKING",
735
+ "CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT",
736
+ "CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL",
737
+ "CLAUDE_CODE_DISABLE_VITALS_EMITTER",
738
+ "CLAUDE_CODE_DISABLE_WORKFLOWS",
739
+ "CLAUDE_CODE_DISABLE_WORKING_SYNC",
740
+ "CLAUDE_CODE_DONT_INHERIT_ENV",
741
+ "CLAUDE_CODE_DOWNLOAD_DEADLINE_MS_FOR_TESTING",
742
+ "CLAUDE_CODE_EAGER_FLUSH",
743
+ "CLAUDE_CODE_EFFORT_LEVEL",
744
+ "CLAUDE_CODE_EMIT_TOOL_USE_SUMMARIES",
745
+ "CLAUDE_CODE_ENABLE_APPEND_SUBAGENT_PROMPT",
746
+ "CLAUDE_CODE_ENABLE_AWAY_SUMMARY",
747
+ "CLAUDE_CODE_ENABLE_BACKGROUND_PLUGIN_REFRESH",
748
+ "CLAUDE_CODE_ENABLE_CFC",
749
+ "CLAUDE_CODE_ENABLE_EXPERIMENTAL_ADVISOR_TOOL",
750
+ "CLAUDE_CODE_ENABLE_FEEDBACK_SURVEY_FOR_OTEL",
751
+ "CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING",
752
+ "CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY",
753
+ "CLAUDE_CODE_ENABLE_LAUNCH_COMPOSER",
754
+ "CLAUDE_CODE_ENABLE_MENU_KIND_LANES",
755
+ "CLAUDE_CODE_ENABLE_NARRATION",
756
+ "CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION",
757
+ "CLAUDE_CODE_ENABLE_REFRESH_MCP_TOOLS",
758
+ "CLAUDE_CODE_ENABLE_REMOTE_RECAP",
759
+ "CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING",
760
+ "CLAUDE_CODE_ENABLE_TASKS",
761
+ "CLAUDE_CODE_ENABLE_TODO_TOOLS",
762
+ "CLAUDE_CODE_ENABLE_XAA",
763
+ "CLAUDE_CODE_ENHANCED_TELEMETRY_BETA",
764
+ "CLAUDE_CODE_ENTRYPOINT",
765
+ "CLAUDE_CODE_ENVIRONMENT_KIND",
766
+ "CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION",
767
+ "CLAUDE_CODE_EXIT_AFTER_FIRST_RENDER",
768
+ "CLAUDE_CODE_EXIT_AFTER_STOP_DELAY",
769
+ "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS",
770
+ "CLAUDE_CODE_EXPERIMENTAL_OBSERVER_AGENTS",
771
+ "CLAUDE_CODE_EXTRA_BODY",
772
+ "CLAUDE_CODE_EXTRA_METADATA",
773
+ "CLAUDE_CODE_FEDERATION_CACHE_DIR",
774
+ "CLAUDE_CODE_FLEETVIEW_SIMPLE",
775
+ "CLAUDE_CODE_FORCE_BRIDGE",
776
+ "CLAUDE_CODE_FORCE_EVALUATE_MEMORY",
777
+ "CLAUDE_CODE_FORCE_FULLSCREEN_UPSELL",
778
+ "CLAUDE_CODE_FORCE_MEMORY_SURVEY",
779
+ "CLAUDE_CODE_FORCE_MID_CONVERSATION_SYSTEM",
780
+ "CLAUDE_CODE_FORCE_STRIKETHROUGH",
781
+ "CLAUDE_CODE_FORCE_SYNC_OUTPUT",
782
+ "CLAUDE_CODE_FORCE_TIP_ID",
783
+ "CLAUDE_CODE_FORK_SUBAGENT",
784
+ "CLAUDE_CODE_FORWARD_SUBAGENT_TEXT",
785
+ "CLAUDE_CODE_FRAME_TIMING_LOG",
786
+ "CLAUDE_CODE_FRAME_TIMING_SAMPLE_EVERY",
787
+ "CLAUDE_CODE_GAULT_KESTREL",
788
+ "CLAUDE_CODE_GB_DISK_CACHE_WHEN_TELEMETRY_OFF",
789
+ "CLAUDE_CODE_GB_REFRESH_INTERVAL_MS",
790
+ "CLAUDE_CODE_GIT_BASH_PATH",
791
+ "CLAUDE_CODE_GLOB_HIDDEN",
792
+ "CLAUDE_CODE_GLOB_NO_IGNORE",
793
+ "CLAUDE_CODE_GLOB_TIMEOUT_SECONDS",
794
+ "CLAUDE_CODE_GOAL_CHECKIN_MINUTES",
795
+ "CLAUDE_CODE_GORSE_PLOVER",
796
+ "CLAUDE_CODE_GZIP_CCR_REQUEST_BODIES",
797
+ "CLAUDE_CODE_GZIP_REQUEST_BODIES",
798
+ "CLAUDE_CODE_HARBOR_KITE",
799
+ "CLAUDE_CODE_HARBOR_KITE_CLOUD",
800
+ "CLAUDE_CODE_HARBOR_KITE_PACING_OFF",
801
+ "CLAUDE_CODE_HIDE_CWD",
802
+ "CLAUDE_CODE_HIDE_SETTINGS_HINT",
803
+ "CLAUDE_CODE_HOLD_REPORT_PARK_AT_INIT",
804
+ "CLAUDE_CODE_HOLD_UNANSWERED_PARKED_PERMISSION",
805
+ "CLAUDE_CODE_HOME_SEED_HOLD_TIMEOUT_MS",
806
+ "CLAUDE_CODE_HOME_SEED_VERDICT_TIMEOUT_MS",
807
+ "CLAUDE_CODE_HOOKS_SAME_THREAD",
808
+ "CLAUDE_CODE_HOVER_REST",
809
+ "CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL",
810
+ "CLAUDE_CODE_IDE_SKIP_VALID_CHECK",
811
+ "CLAUDE_CODE_IDLE_THRESHOLD_MINUTES",
812
+ "CLAUDE_CODE_INCLUDE_PARTIAL_MESSAGES",
813
+ "CLAUDE_CODE_INTRO_FRAME",
814
+ "CLAUDE_CODE_IS_COWORK",
815
+ "CLAUDE_CODE_JUNIPER_SUNDIAL",
816
+ "CLAUDE_CODE_KB_COHESION_FIXES",
817
+ "CLAUDE_CODE_LANTERN_PRISM",
818
+ "CLAUDE_CODE_LARCH_CISTERN",
819
+ "CLAUDE_CODE_LEGACY_BUNDLE",
820
+ "CLAUDE_CODE_LOOP_KEEPALIVE",
821
+ "CLAUDE_CODE_LOOP_PERSISTENT",
822
+ "CLAUDE_CODE_MANAGED_SETTINGS_PATH",
823
+ "CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS",
824
+ "CLAUDE_CODE_MAX_RETRIES",
825
+ "CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH",
826
+ "CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY",
827
+ "CLAUDE_CODE_MAX_TURNS",
828
+ "CLAUDE_CODE_MCP_ALLOWLIST_ENV",
829
+ "CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS",
830
+ "CLAUDE_CODE_MCP_MEMORY_CGROUP",
831
+ "CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT",
832
+ "CLAUDE_CODE_MEMORY_PUSH_DELETE_MODE",
833
+ "CLAUDE_CODE_MOCK_REMOTE_SETTINGS",
834
+ "CLAUDE_CODE_MOCK_TRIAL",
835
+ "CLAUDE_CODE_NANKEEN_KESTREL",
836
+ "CLAUDE_CODE_NATIVE_CURSOR",
837
+ "CLAUDE_CODE_NEW_INIT",
838
+ "CLAUDE_CODE_NO_FLICKER",
839
+ "CLAUDE_CODE_NO_MODEL_FALLBACK",
840
+ "CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH",
841
+ "CLAUDE_CODE_OTEL_DIAG_STDERR",
842
+ "CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS",
843
+ "CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS",
844
+ "CLAUDE_CODE_OVERRIDE_DATE",
845
+ "CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE",
846
+ "CLAUDE_CODE_PARCHMENT_FERN",
847
+ "CLAUDE_CODE_PARKED_PERMISSION_WAIT_MS",
848
+ "CLAUDE_CODE_PARKED_STOP_RETIRES",
849
+ "CLAUDE_CODE_PERFETTO_TRACE",
850
+ "CLAUDE_CODE_PERFETTO_WRITE_INTERVAL_S",
851
+ "CLAUDE_CODE_PERFORCE_MODE",
852
+ "CLAUDE_CODE_PEWTER_OWL",
853
+ "CLAUDE_CODE_PEWTER_OWL_TOOL",
854
+ "CLAUDE_CODE_PLAN_MODE_REQUIRED",
855
+ "CLAUDE_CODE_PLAN_V2_AGENT_COUNT",
856
+ "CLAUDE_CODE_PLAN_V2_EXPLORE_AGENT_COUNT",
857
+ "CLAUDE_CODE_PLUGIN_ATTRIBUTION",
858
+ "CLAUDE_CODE_PLUGIN_BINARY_ASSETS",
859
+ "CLAUDE_CODE_PLUGIN_CACHE_DIR",
860
+ "CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS",
861
+ "CLAUDE_CODE_PLUGIN_KEEP_MARKETPLACE_ON_FAILURE",
862
+ "CLAUDE_CODE_PLUGIN_PREFER_HTTPS",
863
+ "CLAUDE_CODE_PLUGIN_SEED_DIR",
864
+ "CLAUDE_CODE_PLUGIN_USE_ZIP_CACHE",
865
+ "CLAUDE_CODE_POLL_EVENTS",
866
+ "CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY",
867
+ "CLAUDE_CODE_POWERUP_ONBOARDING",
868
+ "CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS",
869
+ "CLAUDE_CODE_PRINT_ENGINE_LOOP",
870
+ "CLAUDE_CODE_PROACTIVE",
871
+ "CLAUDE_CODE_PROMPT_CACHE_TTL",
872
+ "CLAUDE_CODE_PROPAGATE_TRACEPARENT",
873
+ "CLAUDE_CODE_PWSH_PARSE_TIMEOUT_MS",
874
+ "CLAUDE_CODE_QUESTION_PREVIEW_FORMAT",
875
+ "CLAUDE_CODE_RATE_LIMIT_TIER",
876
+ "CLAUDE_CODE_REFUSAL_FALLBACK_CATCH_ALL",
877
+ "CLAUDE_CODE_RELAUNCH_TERMINAL_SIZE",
878
+ "CLAUDE_CODE_REMOTE",
879
+ "CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE",
880
+ "CLAUDE_CODE_REMOTE_HERMETIC_MODE",
881
+ "CLAUDE_CODE_REMOTE_MEMORY_DIR",
882
+ "CLAUDE_CODE_REMOTE_RAW_EVENTS_FILE",
883
+ "CLAUDE_CODE_REMOTE_SEND_KEEPALIVES",
884
+ "CLAUDE_CODE_REMOTE_SETTINGS_PATH",
885
+ "CLAUDE_CODE_REMOTE_SETTINGS_POLL_MS",
886
+ "CLAUDE_CODE_REPL",
887
+ "CLAUDE_CODE_REPORT_FINDINGS",
888
+ "CLAUDE_CODE_REPO_CHECKOUTS",
889
+ "CLAUDE_CODE_RESTRICTED",
890
+ "CLAUDE_CODE_RESUME_INTERRUPTED_TURN",
891
+ "CLAUDE_CODE_RESUME_INTERRUPTED_TURN_MAX_AGE_MS",
892
+ "CLAUDE_CODE_RESUME_PROMPT",
893
+ "CLAUDE_CODE_RESUME_SOURCE_ALIVE",
894
+ "CLAUDE_CODE_RESUME_THRESHOLD_MINUTES",
895
+ "CLAUDE_CODE_RESUME_TOLERATES_CONTEXT_APPENDS",
896
+ "CLAUDE_CODE_RETIRE_UNANSWERED_PARKED_PERMISSION",
897
+ "CLAUDE_CODE_RETRY_WATCHDOG",
898
+ "CLAUDE_CODE_SABLE_THRUSH",
899
+ "CLAUDE_CODE_SAFE_MODE",
900
+ "CLAUDE_CODE_SANDBOXED",
901
+ "CLAUDE_CODE_SCRIPT_CAPS",
902
+ "CLAUDE_CODE_SCROLL_SPEED",
903
+ "CLAUDE_CODE_SEND_FEEDBACK",
904
+ "CLAUDE_CODE_SHELL",
905
+ "CLAUDE_CODE_SHELL_PREFIX",
906
+ "CLAUDE_CODE_SILENT_TURN_REMINDER",
907
+ "CLAUDE_CODE_SILENT_TURN_REMINDER_TEXT",
908
+ "CLAUDE_CODE_SILENT_TURN_REMINDER_TURNS",
909
+ "CLAUDE_CODE_SIMPLE",
910
+ "CLAUDE_CODE_SIMPLE_SYSTEM_PROMPT",
911
+ "CLAUDE_CODE_SKILL_PROPOSALS",
912
+ "CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS",
913
+ "CLAUDE_CODE_SKIP_FAST_MODE_ORG_CHECK",
914
+ "CLAUDE_CODE_SKIP_HFI_VERSION_CHECK",
915
+ "CLAUDE_CODE_SKIP_PLUGIN_MCP_SERVERS",
916
+ "CLAUDE_CODE_SKIP_PLUGIN_MCP_SERVERS_EXCEPT",
917
+ "CLAUDE_CODE_SKIP_PROMPT_HISTORY",
918
+ "CLAUDE_CODE_SKIP_REPO_UPLOAD",
919
+ "CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS",
920
+ "CLAUDE_CODE_SPAWN_TIMESTAMP_MS",
921
+ "CLAUDE_CODE_SSE_PORT",
922
+ "CLAUDE_CODE_STALL_TIMEOUT_MS_FOR_TESTING",
923
+ "CLAUDE_CODE_STOP_HOOK_BLOCK_CAP",
924
+ "CLAUDE_CODE_SUBAGENT_CACHE_EVICT",
925
+ "CLAUDE_CODE_SUBAGENT_MODEL",
926
+ "CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL",
927
+ "CLAUDE_CODE_SUBPROCESS_ENV_SCRUB",
928
+ "CLAUDE_CODE_SUBSCRIPTION_TYPE",
929
+ "CLAUDE_CODE_SUPERVISED",
930
+ "CLAUDE_CODE_SYNC_PLUGINS",
931
+ "CLAUDE_CODE_SYNC_PLUGINS_BUFFERED_DOWNLOAD",
932
+ "CLAUDE_CODE_SYNC_PLUGINS_DOWNLOAD_STALL_MS",
933
+ "CLAUDE_CODE_SYNC_PLUGINS_INSTALL_TIMEOUT_MS",
934
+ "CLAUDE_CODE_SYNC_PLUGINS_MCP_TIMEOUT_MS",
935
+ "CLAUDE_CODE_SYNC_PLUGIN_INSTALL",
936
+ "CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS",
937
+ "CLAUDE_CODE_SYNC_SKILLS",
938
+ "CLAUDE_CODE_SYNC_SKILLS_INSTALL_TIMEOUT_MS",
939
+ "CLAUDE_CODE_SYNC_SKILLS_WAIT_TIMEOUT_MS",
940
+ "CLAUDE_CODE_SYNTAX_HIGHLIGHT",
941
+ "CLAUDE_CODE_SYSTEM_PROMPT_GB_FEATURE",
942
+ "CLAUDE_CODE_TAGS",
943
+ "CLAUDE_CODE_TAG_ISMETA_MESSAGES",
944
+ "CLAUDE_CODE_TASK_LIST_ID",
945
+ "CLAUDE_CODE_TEAM_TEARDOWN_PARK_TIMEOUT_MS",
946
+ "CLAUDE_CODE_TEE_SDK_STDOUT",
947
+ "CLAUDE_CODE_TERMINAL_MCP_TOOLS",
948
+ "CLAUDE_CODE_TERMINAL_RECORDING",
949
+ "CLAUDE_CODE_TEST_ALLOW_REAL_NETWORK",
950
+ "CLAUDE_CODE_TEST_FIXTURES_ROOT",
951
+ "CLAUDE_CODE_TEST_FORCE_DENY",
952
+ "CLAUDE_CODE_TEST_NO_GIT_BASH",
953
+ "CLAUDE_CODE_TEST_NO_PWSH",
954
+ "CLAUDE_CODE_THINKING_DISPLAY_UPDATES",
955
+ "CLAUDE_CODE_THISTLE_GREBE",
956
+ "CLAUDE_CODE_THRIFTY_SONIC",
957
+ "CLAUDE_CODE_TMPDIR",
958
+ "CLAUDE_CODE_TMUX_PREFIX",
959
+ "CLAUDE_CODE_TMUX_PREFIX_CONFLICTS",
960
+ "CLAUDE_CODE_TMUX_TRUECOLOR",
961
+ "CLAUDE_CODE_TOASTY_THIMBLE",
962
+ "CLAUDE_CODE_TODO_REMINDER_MODE",
963
+ "CLAUDE_CODE_TOOL_MEMORY_CGROUP_EXCLUDE",
964
+ "CLAUDE_CODE_TOOL_MEMORY_LIMIT",
965
+ "CLAUDE_CODE_TRANSCRIPT_LOCAL_GC",
966
+ "CLAUDE_CODE_TRIGGER_ID",
967
+ "CLAUDE_CODE_TUI_JUST_SWITCHED",
968
+ "CLAUDE_CODE_TUI_TRIAL",
969
+ "CLAUDE_CODE_TURN_UPDATES",
970
+ "CLAUDE_CODE_TWO_STAGE_CLASSIFIER",
971
+ "CLAUDE_CODE_ULTRAREVIEW_PREFLIGHT_FIXTURE",
972
+ "CLAUDE_CODE_ULTRAREVIEW_QUOTA_FIXTURE",
973
+ "CLAUDE_CODE_USER_DIALOG_TIMEOUT_MS",
974
+ "CLAUDE_CODE_USER_EMAIL",
975
+ "CLAUDE_CODE_USE_ANTHROPIC_AWS",
976
+ "CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD",
977
+ "CLAUDE_CODE_USE_BEDROCK",
978
+ "CLAUDE_CODE_USE_COWORK_PLUGINS",
979
+ "CLAUDE_CODE_USE_FOUNDRY",
980
+ "CLAUDE_CODE_USE_GATEWAY",
981
+ "CLAUDE_CODE_USE_MANTLE",
982
+ "CLAUDE_CODE_USE_NATIVE_FILE_SEARCH",
983
+ "CLAUDE_CODE_USE_POWERSHELL_TOOL",
984
+ "CLAUDE_CODE_USE_VERTEX",
985
+ "CLAUDE_CODE_VOICE_FORWARD_INTERIMS_TYPED",
986
+ "CLAUDE_CODE_WALNUT_SPIRE",
987
+ "CLAUDE_CODE_WEBFETCH_CACHE_TTL_MS",
988
+ "CLAUDE_CODE_WEB_FETCH_AGENT",
989
+ "CLAUDE_CODE_WILLOW_TERN",
990
+ "CLAUDE_CODE_WORKER_EPOCH",
991
+ "CLAUDE_CODE_WORKFLOWS",
992
+ "CLAUDE_CODE_WORKFLOW_PREFIX_STAGGER_MS",
993
+ "CLAUDE_CODE_WORKFLOW_SIZE_WARNING_AGENTS",
994
+ "CLAUDE_CONTEXT_COLLAPSE",
995
+ "CLAUDE_CONTEXT_COLLAPSE_MODEL",
996
+ "CLAUDE_COWORK_MEMORY_EXTRA_GUIDELINES",
997
+ "CLAUDE_COWORK_MEMORY_GUIDELINES",
998
+ "CLAUDE_COWORK_MEMORY_INDEX_CONTENT",
999
+ "CLAUDE_COWORK_MEMORY_PATH_OVERRIDE",
1000
+ "CLAUDE_DEBUG",
1001
+ "CLAUDE_DISABLE_ADOPT",
1002
+ "CLAUDE_ENABLE_BYTE_WATCHDOG",
1003
+ "CLAUDE_ENABLE_BYTE_WATCHDOG_BEDROCK",
1004
+ "CLAUDE_ENABLE_STREAM_WATCHDOG",
1005
+ "CLAUDE_ENV_FILE",
1006
+ "CLAUDE_FORCE_DISPLAY_SURVEY",
1007
+ "CLAUDE_GATEWAY_ALLOW_LOOPBACK",
1008
+ "CLAUDE_GATEWAY_LOG_LEVEL",
1009
+ "CLAUDE_IMPORT_CONVERSATIONS",
1010
+ "CLAUDE_INTERNAL_ASSISTANT_TEAM_NAME",
1011
+ "CLAUDE_INTERNAL_FC_OVERRIDES",
1012
+ "CLAUDE_JOB_DIR",
1013
+ "CLAUDE_MOCK_HEADERLESS_429",
1014
+ "CLAUDE_PTY_HEARTBEAT_MS",
1015
+ "CLAUDE_PTY_ORPHAN_CHECK_MS",
1016
+ "CLAUDE_PTY_RECORD",
1017
+ "CLAUDE_REMOTE_WORKFLOW_ARGS",
1018
+ "CLAUDE_REMOTE_WORKFLOW_SCRIPT",
1019
+ "CLAUDE_REPL_VARIANT",
1020
+ "CLAUDE_RUNNER_ACTIVITY_FD",
1021
+ "CLAUDE_RUNNER_DISABLE_AWAITING_ACTION_OVERRIDE",
1022
+ "CLAUDE_RUNNER_FETCH_DEPTH",
1023
+ "CLAUDE_SERVE_DRAIN_TIMEOUT_MS",
1024
+ "CLAUDE_SLOW_FIRST_BYTE_MS",
1025
+ "CLAUDE_SNIP",
1026
+ "CLAUDE_SSH_LOCAL_BINARY",
1027
+ "CLAUDE_SSH_VERSION",
1028
+ "CLAUDE_STAGE_FILE_ROOT",
1029
+ "CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS",
1030
+ "CLAUDE_STREAM_IDLE_TIMEOUT_MS",
1031
+ "CLAUDE_SUBAGENT_BG_SHELL_MAX_MS",
1032
+ "CLAUDE_TMPDIR",
1033
+ "CLAUDE_WORKFLOW_NAME_ONLY",
1034
+ "CLOUDSDK_CONFIG",
1035
+ "CONTAINER_SANDBOX_MOUNT_POINT",
1036
+ "CURSOR_TRACE_ID",
1037
+ "DAYTONA_WS_ID",
1038
+ "DEBUG_CLAUDE_AGENT_SDK",
1039
+ "DEBUG_SDK",
1040
+ "DEMO_VERSION",
1041
+ "DENO_DEPLOYMENT_ID",
1042
+ "DISABLE_AUTOUPDATER",
1043
+ "DISABLE_AUTO_COMPACT",
1044
+ "DISABLE_BRIEF_MODE_STOP_HOOK",
1045
+ "DISABLE_BUG_COMMAND",
1046
+ "DISABLE_COST_WARNINGS",
1047
+ "DISABLE_DOCTOR_COMMAND",
1048
+ "DISABLE_ERROR_REPORTING",
1049
+ "DISABLE_EXTRA_USAGE_COMMAND",
1050
+ "DISABLE_FEEDBACK_COMMAND",
1051
+ "DISABLE_GROWTHBOOK",
1052
+ "DISABLE_INSTALL_GITHUB_APP_COMMAND",
1053
+ "DISABLE_INTERLEAVED_THINKING",
1054
+ "DISABLE_LOGOUT_COMMAND",
1055
+ "DISABLE_PROMPT_CACHING",
1056
+ "DISABLE_PROMPT_CACHING_FABLE",
1057
+ "DISABLE_PROMPT_CACHING_HAIKU",
1058
+ "DISABLE_PROMPT_CACHING_MYTHOS",
1059
+ "DISABLE_PROMPT_CACHING_OPUS",
1060
+ "DISABLE_PROMPT_CACHING_SONNET",
1061
+ "DISABLE_TELEMETRY",
1062
+ "DISABLE_UPDATES",
1063
+ "DISABLE_UPGRADE_COMMAND",
1064
+ "DOCKER_CONFIG",
1065
+ "DO_NOT_TRACK",
1066
+ "EMBEDDED_SEARCH_TOOLS",
1067
+ "EMPTY_PATH",
1068
+ "ENABLE_BETA_TRACING_DETAILED",
1069
+ "ENABLE_CLAUDEAI_MCP_SERVERS",
1070
+ "ENABLE_ENHANCED_TELEMETRY_BETA",
1071
+ "ENABLE_LOCKLESS_UPDATES",
1072
+ "ENABLE_LSP_TOOL",
1073
+ "ENABLE_MCP_LARGE_OUTPUT_FILES",
1074
+ "ENABLE_PID_BASED_VERSION_LOCKING",
1075
+ "ENABLE_PROMPT_CACHING_1H",
1076
+ "ENABLE_PROMPT_CACHING_1H_BEDROCK",
1077
+ "ENABLE_TOOL_SEARCH",
1078
+ "FALLBACK_FOR_ALL_PRIMARY_MODELS",
1079
+ "FORCE_AUTOUPDATE_PLUGINS",
1080
+ "FORCE_CODE_TERMINAL",
1081
+ "FORCE_COLOR",
1082
+ "FORCE_PROMPT_CACHING_5M",
1083
+ "FORCE_VCR",
1084
+ "GCM_INTERACTIVE",
1085
+ "GITHUB_ACTIONS",
1086
+ "GITHUB_ACTION_INPUTS",
1087
+ "GITHUB_ACTION_PATH",
1088
+ "GITHUB_ACTOR",
1089
+ "GITHUB_ACTOR_ID",
1090
+ "GITHUB_ENV",
1091
+ "GITHUB_EVENT_NAME",
1092
+ "GITHUB_EVENT_PATH",
1093
+ "GITHUB_REPOSITORY",
1094
+ "GITHUB_REPOSITORY_ID",
1095
+ "GITHUB_REPOSITORY_OWNER",
1096
+ "GITHUB_REPOSITORY_OWNER_ID",
1097
+ "GITLAB_CI",
1098
+ "GIT_ASKPASS",
1099
+ "GIT_CONFIG_COUNT",
1100
+ "GIT_CONFIG_GLOBAL",
1101
+ "GIT_CONFIG_SYSTEM",
1102
+ "GIT_SSH_COMMAND",
1103
+ "GIT_TERMINAL_PROMPT",
1104
+ "GNOME_TERMINAL_SERVICE",
1105
+ "GOOGLE_CLOUD_WORKSTATIONS",
1106
+ "GRADLE_USER_HOME",
1107
+ "INK_SCREEN_READER",
1108
+ "INTELLIJ_TERMINAL_COMMAND_BLOCKS",
1109
+ "INTELLIJ_TERMINAL_COMMAND_BLOCKS_REWORKED",
1110
+ "IS_DEMO",
1111
+ "IS_SANDBOX",
1112
+ "JAVA_HOME",
1113
+ "JAVA_TOOL_OPTIONS",
1114
+ "KITTY_WINDOW_ID",
1115
+ "KONSOLE_VERSION",
1116
+ "K_SERVICE",
1117
+ "LC_ALL",
1118
+ "LC_TERMINAL",
1119
+ "LC_TIME",
1120
+ "LOCAL_BRIDGE",
1121
+ "MAX_STRUCTURED_OUTPUT_RETRIES",
1122
+ "MCP_CONNECTION_NONBLOCKING",
1123
+ "MCP_CONNECT_TIMEOUT_MS",
1124
+ "MCP_DISCOVERY_CACHE",
1125
+ "MCP_DISCOVERY_CACHE_MAX_STALE_S",
1126
+ "MCP_DISCOVERY_CACHE_STRIKES",
1127
+ "MCP_DISCOVERY_CACHE_TTL_S",
1128
+ "MCP_PROTOCOL_NEGOTIATION",
1129
+ "MCP_REMOTE_SERVER_CONNECTION_BATCH_SIZE",
1130
+ "MCP_SDK_GENERATION",
1131
+ "MCP_SERVER_CONNECTION_BATCH_SIZE",
1132
+ "MCP_TIMEOUT",
1133
+ "MCP_TOOL_TIMEOUT",
1134
+ "MCP_TRUNCATION_PROMPT_OVERRIDE",
1135
+ "NODE_OPTIONS",
1136
+ "NO_COLOR",
1137
+ "NPM_CONFIG_GLOBALCONFIG",
1138
+ "NPM_CONFIG_USERCONFIG",
1139
+ "NUMBER_FORMAT_RANGES",
1140
+ "OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT",
1141
+ "OTEL_EXPORTER_OTLP_LOGS_PROTOCOL",
1142
+ "OTEL_EXPORTER_OTLP_METRICS_PROTOCOL",
1143
+ "OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE",
1144
+ "OTEL_EXPORTER_OTLP_PROTOCOL",
1145
+ "OTEL_EXPORTER_OTLP_TRACES_PROTOCOL",
1146
+ "OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT",
1147
+ "OTEL_LOGS_EXPORTER",
1148
+ "OTEL_LOGS_EXPORT_INTERVAL",
1149
+ "OTEL_LOG_ASSISTANT_RESPONSES",
1150
+ "OTEL_LOG_RAW_API_BODIES",
1151
+ "OTEL_LOG_TOOL_CONTENT",
1152
+ "OTEL_LOG_TOOL_DETAILS",
1153
+ "OTEL_LOG_USER_PROMPTS",
1154
+ "OTEL_METRICS_EXPORTER",
1155
+ "OTEL_METRIC_EXPORT_INTERVAL",
1156
+ "OTEL_RESOURCE_ATTRIBUTES",
1157
+ "OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT",
1158
+ "OTEL_TRACES_EXPORTER",
1159
+ "OTEL_TRACES_EXPORT_INTERVAL",
1160
+ "PIP_CONFIG_FILE",
1161
+ "PLAYWRIGHT_BROWSERS_PATH",
1162
+ "REPL_ID",
1163
+ "REPL_SLUG",
1164
+ "RUNNER_ENVIRONMENT",
1165
+ "RUNNER_OS",
1166
+ "RUSTUP_HOME",
1167
+ "SDK_NATIVE_BIN",
1168
+ "SLASH_COMMAND_TOOL_CHAR_BUDGET",
1169
+ "SPACE_CREATOR_USER_ID",
1170
+ "SSH_CLIENT",
1171
+ "SSH_CONNECTION",
1172
+ "SSH_TTY",
1173
+ "SUDO_GID",
1174
+ "SUDO_UID",
1175
+ "SUDO_USER",
1176
+ "TASK_MAX_OUTPUT_LENGTH",
1177
+ "TERMINAL_EMULATOR",
1178
+ "TERMINATOR_UUID",
1179
+ "TERMUX_VERSION",
1180
+ "TERM_PROGRAM",
1181
+ "TERM_PROGRAM_VERSION",
1182
+ "TILIX_ID",
1183
+ "TMUX_PANE",
1184
+ "ULTRAPLAN_PROMPT_FILE",
1185
+ "USE_API_CONTEXT_MANAGEMENT",
1186
+ "USE_BUILTIN_RIPGREP",
1187
+ "UV_THREADPOOL_SIZE",
1188
+ "VCR_RECORD",
1189
+ "VITALS_EMITTER_BIN",
1190
+ "VSCODE_GIT_ASKPASS_MAIN",
1191
+ "VTE_VERSION",
1192
+ "WAYLAND_DISPLAY",
1193
+ "WEBSITE_SITE_NAME",
1194
+ "WEBSITE_SKU",
1195
+ "WSL_DISTRO_NAME",
1196
+ "WSL_INTEROP",
1197
+ "XDG_CONFIG_HOME",
1198
+ "XDG_DATA_HOME",
1199
+ "XDG_RUNTIME_DIR",
1200
+ "XTERM_VERSION",
1201
+ "ZED_TERM"
1202
+ ];
1203
+
1204
+ // src/official/env-allowlist.ts
1205
+ var MINIMAL_OS_VARIABLES = ["PATH", "HOME", "USER", "SHELL", "TERM", "LANG"];
1206
+ var MINIMAL_OS_VARIABLE_PREFIXES = ["LC_"];
1207
+ var OFFICIAL_RUNTIME_VARIABLES = {
1208
+ configDir: "CLAUDE_CONFIG_DIR",
1209
+ projectDirName: "CLAUDE_CODE_PROJECT_DIR_NAME",
1210
+ tmpdir: "CLAUDE_CODE_TMPDIR"
1211
+ };
1212
+ var PROXY_AND_TELEMETRY_VARIABLES = [
1213
+ "HTTP_PROXY",
1214
+ "HTTPS_PROXY",
1215
+ "ALL_PROXY",
1216
+ "NO_PROXY",
1217
+ "http_proxy",
1218
+ "https_proxy",
1219
+ "all_proxy",
1220
+ "no_proxy",
1221
+ "CLAUDE_CODE_ENABLE_TELEMETRY",
1222
+ "DISABLE_TELEMETRY",
1223
+ "DISABLE_ERROR_REPORTING"
1224
+ ];
1225
+ var PROXY_AND_TELEMETRY_PREFIXES = ["OTEL_"];
1226
+ var TRAFFIC_OPT_OUT_VARIABLES = {
1227
+ CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1",
1228
+ DISABLE_TELEMETRY: "1",
1229
+ DISABLE_ERROR_REPORTING: "1",
1230
+ DISABLE_AUTOUPDATER: "1"
1231
+ };
1232
+ var TRAFFIC_OPT_OUT_VARIABLE_NAMES = Object.keys(TRAFFIC_OPT_OUT_VARIABLES);
1233
+ var PATH_LIST_VARIABLES = ["PATH"];
1234
+ function sanitizePathListValue(value) {
1235
+ return value.split(":").filter((entry) => entry.length > 0 && !VENDOR_HOME_SEGMENT_RE.test(entry)).join(":");
1236
+ }
1237
+ var EXECUTION_INDIRECTION_ENV_NAMES = [
1238
+ "BASH_ENV",
1239
+ "ENV",
1240
+ "SHELLOPTS",
1241
+ "BASHOPTS",
1242
+ "PS4",
1243
+ "IFS",
1244
+ "CDPATH",
1245
+ "FPATH",
1246
+ "ZDOTDIR",
1247
+ "COMSPEC",
1248
+ "PATH",
1249
+ "PSMODULEPATH",
1250
+ "PROMPT_COMMAND",
1251
+ "NODE_OPTIONS",
1252
+ "NODE_PATH",
1253
+ "NODE_REPL_EXTERNAL_MODULE",
1254
+ "PERLLIB",
1255
+ "GEM_PATH",
1256
+ "GEM_HOME",
1257
+ "JAVA_TOOL_OPTIONS",
1258
+ "_JAVA_OPTIONS",
1259
+ "JDK_JAVA_OPTIONS",
1260
+ "IBM_JAVA_OPTIONS",
1261
+ "OPENJ9_JAVA_OPTIONS",
1262
+ "CLASSPATH",
1263
+ "BUN_OPTIONS",
1264
+ "BUN_INSPECT",
1265
+ "MONO_PATH",
1266
+ "R_PROFILE_USER",
1267
+ "DEVPATH",
1268
+ "GCONV_PATH",
1269
+ "PHPRC",
1270
+ "PHP_INI_SCAN_DIR",
1271
+ "OPENSSL_CONF",
1272
+ "OPENSSL_MODULES",
1273
+ "OPENSSL_ENGINES",
1274
+ "KRB5_CONFIG",
1275
+ "GTK_PATH",
1276
+ "QT_PLUGIN_PATH",
1277
+ "GIO_MODULE_DIR",
1278
+ "SASL_PATH",
1279
+ "XDG_CONFIG_HOME",
1280
+ "SSH_ASKPASS",
1281
+ "SSH_ASKPASS_REQUIRE",
1282
+ "SUDO_ASKPASS",
1283
+ "VSCODE_GIT_ASKPASS_MAIN",
1284
+ "PAGER",
1285
+ "EDITOR",
1286
+ "VISUAL",
1287
+ "CLAUDE_CODE_SHELL",
1288
+ "CLAUDE_CODE_SHELL_PREFIX",
1289
+ "CLAUDE_CODE_GIT_BASH_PATH",
1290
+ "CLAUDE_ENV_FILE",
1291
+ "CLAUDE_CODE_MANAGED_SETTINGS_PATH",
1292
+ "CLAUDE_CODE_REMOTE_SETTINGS_PATH",
1293
+ "CLAUDE_CODE_MOCK_REMOTE_SETTINGS",
1294
+ "CLAUDE_CODE_PLUGIN_SEED_DIR",
1295
+ "CLAUDE_CODE_PLUGIN_CACHE_DIR",
1296
+ "BUN_CONFIG_FILE",
1297
+ "NPM_CONFIG_USERCONFIG",
1298
+ "NPM_CONFIG_GLOBALCONFIG",
1299
+ "PIP_CONFIG_FILE",
1300
+ "CLOUDSDK_CONFIG",
1301
+ "DOCKER_CONFIG",
1302
+ "VITALS_EMITTER_BIN",
1303
+ "CLAUDE_SSH_LOCAL_BINARY",
1304
+ "SDK_NATIVE_BIN",
1305
+ "BUN_CHROME_PATH",
1306
+ "PLAYWRIGHT_BROWSERS_PATH"
1307
+ ];
1308
+ var EXECUTION_INDIRECTION_ENV_PREFIXES = [
1309
+ "LD_",
1310
+ "DYLD_",
1311
+ "BASH_FUNC_",
1312
+ "__BASH_FUNC",
1313
+ "PYTHON",
1314
+ "PERL5",
1315
+ "RUBY",
1316
+ "LUA_",
1317
+ "DOTNET_",
1318
+ "COMPLUS_",
1319
+ "COR_",
1320
+ "CORECLR_",
1321
+ "APPDOMAIN_MANAGER_",
1322
+ "GIT_"
1323
+ ];
1324
+ var EXECUTION_INDIRECTION_FOLDED = new Set(EXECUTION_INDIRECTION_ENV_NAMES.map((name) => name.toUpperCase()));
1325
+ function isExecutionIndirectionVariable(name) {
1326
+ const folded = name.toUpperCase();
1327
+ return EXECUTION_INDIRECTION_FOLDED.has(folded) || EXECUTION_INDIRECTION_ENV_PREFIXES.some((prefix) => folded.startsWith(prefix));
1328
+ }
1329
+ var NON_CREDENTIAL_ENV_REGISTRY_FOLDED = new Set(NON_CREDENTIAL_ENV_REGISTRY.map((name) => name.toUpperCase()));
1330
+ function minimalOsEnvironmentFrom(source) {
1331
+ const out = {};
1332
+ for (const [name, value] of Object.entries(source)) {
1333
+ if (value === undefined)
1334
+ continue;
1335
+ const wanted = MINIMAL_OS_VARIABLES.includes(name) || MINIMAL_OS_VARIABLE_PREFIXES.some((prefix) => name.startsWith(prefix));
1336
+ if (wanted)
1337
+ out[name] = value;
1338
+ }
1339
+ return out;
1340
+ }
1341
+ function buildOfficialChildEnv(input, policy = {}) {
1342
+ const branchLabel = officialBranchLabel(input.brand);
1343
+ if (input.configDir.length === 0) {
1344
+ throw new OfficialConfigurationError({
1345
+ option: "env.CLAUDE_CONFIG_DIR",
1346
+ 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)",
1347
+ branchLabel
1348
+ });
1349
+ }
1350
+ validateAuthEnvironment({ selection: input.selection, credentials: input.credentials, gate: policy.claudeOauth ?? { approved: false }, branchLabel });
1351
+ const env = {
1352
+ [OFFICIAL_RUNTIME_VARIABLES.configDir]: input.configDir
1353
+ };
1354
+ if (input.projectKey !== undefined && input.projectKey.length > 0) {
1355
+ if (!new RegExp(PINNED_PROJECT_DIR_NAME_PATTERN).test(input.projectKey)) {
1356
+ throw new OfficialConfigurationError({
1357
+ option: `env.${OFFICIAL_RUNTIME_VARIABLES.projectDirName}`,
1358
+ 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`,
1359
+ branchLabel
1360
+ });
1361
+ }
1362
+ env[OFFICIAL_RUNTIME_VARIABLES.projectDirName] = input.projectKey;
1363
+ }
1364
+ if (input.sharedTempRoot !== undefined && input.sharedTempRoot.length > 0)
1365
+ env[OFFICIAL_RUNTIME_VARIABLES.tmpdir] = input.sharedTempRoot;
1366
+ if ((policy.remoteConfig ?? "deny") === "deny")
1367
+ for (const [name, value] of Object.entries(TRAFFIC_OPT_OUT_VARIABLES))
1368
+ env[name] = value;
1369
+ for (const [name, value] of Object.entries(input.credentials))
1370
+ env[name] = value;
1371
+ for (const [name, value] of Object.entries(input.base ?? {})) {
1372
+ const wanted = MINIMAL_OS_VARIABLES.includes(name) || MINIMAL_OS_VARIABLE_PREFIXES.some((prefix) => name.startsWith(prefix));
1373
+ if (wanted)
1374
+ env[name] = PATH_LIST_VARIABLES.includes(name) ? sanitizePathListValue(value) : value;
1375
+ }
1376
+ for (const [name, value] of Object.entries(policy.configuredExtras ?? {}))
1377
+ env[name] = value;
1378
+ assertNoForbiddenChildVariables(env, { brand: input.brand, selection: input.selection, policy, branchLabel });
1379
+ return Object.fromEntries(Object.entries(env).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0));
1380
+ }
1381
+ function assertNoForbiddenChildVariables(env, args) {
1382
+ const branchLabel = args.branchLabel ?? officialBranchLabel(args.brand);
1383
+ const declared = new Set(Object.keys(args.policy?.configuredExtras ?? {}));
1384
+ const reviewedExtras = args.policy?.reviewedCredentialShapedExtras ?? [];
1385
+ const reviewedExecution = args.policy?.reviewedExecutionExtras ?? [];
1386
+ const prefixes = [args.brand.envPrefix, ...args.policy?.hostEnvPrefixes ?? []];
1387
+ const runtimeVariables = Object.values(OFFICIAL_RUNTIME_VARIABLES);
1388
+ const familyVariables = args.selection === undefined ? undefined : allowedAuthVariables(args.selection);
1389
+ for (const [name, value] of Object.entries(env)) {
1390
+ const refuse = (reason) => {
1391
+ throw new OfficialConfigurationError({ option: `env.${name}`, reason, branchLabel });
1392
+ };
1393
+ if (prefixes.some((prefix) => prefix.length > 0 && name.startsWith(prefix))) {
1394
+ 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)");
1395
+ }
1396
+ if (NEVER_INJECTED_AUTH_VARIABLES.includes(name)) {
1397
+ 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");
1398
+ }
1399
+ if (familyVariables !== undefined && ALL_AUTH_VARIABLES.includes(name) && !familyVariables.includes(name)) {
1400
+ 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)`);
1401
+ }
1402
+ const foldedName = name.toUpperCase();
1403
+ const isThisFamilysVariable = (familyVariables ?? []).includes(name);
1404
+ if (declared.has(name) && isExecutionIndirectionVariable(name) && !runtimeVariables.includes(name) && !reviewedExecution.includes(name)) {
1405
+ 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)");
1406
+ }
1407
+ if (declared.has(name) && isAuthShapedVariable(foldedName) && !runtimeVariables.includes(name) && !isThisFamilysVariable && !reviewedExtras.includes(name)) {
1408
+ 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");
1409
+ }
1410
+ if (declared.has(name) && !runtimeVariables.includes(name) && !isThisFamilysVariable && !reviewedExtras.includes(name) && !NON_CREDENTIAL_ENV_REGISTRY_FOLDED.has(foldedName)) {
1411
+ 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)");
1412
+ }
1413
+ if (declared.has(name) && runtimeVariables.includes(name)) {
1414
+ 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");
1415
+ }
1416
+ if (declared.has(name) && TRAFFIC_OPT_OUT_VARIABLE_NAMES.includes(name)) {
1417
+ 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)');
1418
+ }
1419
+ 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)))) {
1420
+ 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");
1421
+ }
1422
+ if (VENDOR_HOME_SEGMENT_RE.test(value)) {
1423
+ 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)`);
1424
+ }
1425
+ 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);
1426
+ if (!known) {
1427
+ 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)");
1428
+ }
1429
+ }
1430
+ }
1431
+ var PINNED_OFFICIAL_RUNTIME = "0.3.250";
1432
+ var PINNED_PROJECT_DIR_NAME_PATTERN = "^[A-Za-z0-9_-]{1,64}$";
1433
+
1434
+ export { RuntimeSdkError, RuntimeHandoffRequiredError, RuntimeLaunchInputError, UnaddressableEntryError, RuntimeSdkVersionError, NotImplementedYet, RuntimeSdkDisposedError, officialBranchLabel, OFFICIAL_DISCLOSURES, officialToolAliases, OfficialConfigurationError, OfficialExecutableNotFoundError, OfficialConnectionError, OfficialNonzeroExitError, OfficialKilledError, OfficialContainmentBreachError, OfficialStdoutUnterminatedError, OfficialMcpError, OfficialInvalidResumeError, containmentPaths, resolveSavedApprovalDisposition, containmentDispositions, officialDisallowedTools, targetsForbiddenPath, VENDOR_HOME_SEGMENT_RE, containmentDecisionFor, authVariableSetKey, fetchAuthCredentials, TRAFFIC_OPT_OUT_VARIABLES, TRAFFIC_OPT_OUT_VARIABLE_NAMES, EXECUTION_INDIRECTION_ENV_NAMES, EXECUTION_INDIRECTION_ENV_PREFIXES, isExecutionIndirectionVariable, minimalOsEnvironmentFrom, buildOfficialChildEnv, PINNED_OFFICIAL_RUNTIME };