@hasna/switcher 0.2.17 → 0.2.18

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.
@@ -20,7 +20,7 @@ import { lstat as lstat4, opendir as opendir2, realpath as realpath2, stat as st
20
20
  import { lstatSync as lstatSync3 } from "node:fs";
21
21
  import { isAbsolute as isAbsolute3, join as join4, relative as relative2, resolve as resolve3 } from "node:path";
22
22
 
23
- // node_modules/zod/v3/external.js
23
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/external.js
24
24
  var exports_external = {};
25
25
  __export(exports_external, {
26
26
  void: () => voidType,
@@ -132,7 +132,7 @@ __export(exports_external, {
132
132
  BRAND: () => BRAND
133
133
  });
134
134
 
135
- // node_modules/zod/v3/helpers/util.js
135
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/util.js
136
136
  var util;
137
137
  (function(util2) {
138
138
  util2.assertEqual = (_) => {};
@@ -263,7 +263,7 @@ var getParsedType = (data) => {
263
263
  }
264
264
  };
265
265
 
266
- // node_modules/zod/v3/ZodError.js
266
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/ZodError.js
267
267
  var ZodIssueCode = util.arrayToEnum([
268
268
  "invalid_type",
269
269
  "invalid_literal",
@@ -382,7 +382,7 @@ ZodError.create = (issues) => {
382
382
  return error;
383
383
  };
384
384
 
385
- // node_modules/zod/v3/locales/en.js
385
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/locales/en.js
386
386
  var errorMap = (issue, _ctx) => {
387
387
  let message;
388
388
  switch (issue.code) {
@@ -485,7 +485,7 @@ var errorMap = (issue, _ctx) => {
485
485
  };
486
486
  var en_default = errorMap;
487
487
 
488
- // node_modules/zod/v3/errors.js
488
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/errors.js
489
489
  var overrideErrorMap = en_default;
490
490
  function setErrorMap(map) {
491
491
  overrideErrorMap = map;
@@ -493,7 +493,7 @@ function setErrorMap(map) {
493
493
  function getErrorMap() {
494
494
  return overrideErrorMap;
495
495
  }
496
- // node_modules/zod/v3/helpers/parseUtil.js
496
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
497
497
  var makeIssue = (params) => {
498
498
  const { data, path, errorMaps, issueData } = params;
499
499
  const fullPath = [...path, ...issueData.path || []];
@@ -599,14 +599,14 @@ var isAborted = (x) => x.status === "aborted";
599
599
  var isDirty = (x) => x.status === "dirty";
600
600
  var isValid = (x) => x.status === "valid";
601
601
  var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
602
- // node_modules/zod/v3/helpers/errorUtil.js
602
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js
603
603
  var errorUtil;
604
604
  (function(errorUtil2) {
605
605
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
606
606
  errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
607
607
  })(errorUtil || (errorUtil = {}));
608
608
 
609
- // node_modules/zod/v3/types.js
609
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/types.js
610
610
  class ParseInputLazyPath {
611
611
  constructor(parent, value, path, key) {
612
612
  this._cachedPath = [];
package/dist/cli/index.js CHANGED
@@ -514,7 +514,7 @@ function canonicalPolicyJSON(value) {
514
514
  return JSON.stringify(value, (_key, item) => item && typeof item === "object" && !Array.isArray(item) ? Object.fromEntries(Object.entries(item).sort(([a], [b]) => a.localeCompare(b))) : item);
515
515
  }
516
516
  // package.json
517
- var version = "0.2.17";
517
+ var version = "0.2.18";
518
518
 
519
519
  // src/version.ts
520
520
  var VERSION = version;
@@ -2570,7 +2570,7 @@ var openapi_default = {
2570
2570
  openapi: "3.0.3",
2571
2571
  info: {
2572
2572
  title: "Switcher API",
2573
- version: "0.2.17",
2573
+ version: "0.2.18",
2574
2574
  description: "Authenticated provider/profile/catalog control plane. Launches run locally; the API never returns provider credentials."
2575
2575
  },
2576
2576
  security: [
@@ -13314,7 +13314,78 @@ async function withNativeStateLock(state, operation) {
13314
13314
  }
13315
13315
  }
13316
13316
  }
13317
- async function assertShareableTree(path, budget = { entries: 0 }, depth = 0) {
13317
+ var ownedByUser = (entry) => entry.uid === process.getuid?.();
13318
+ var ownerProbe = ownedByUser;
13319
+ function strictlyInside(root, path) {
13320
+ const suffix = relative5(root, path);
13321
+ return suffix !== "" && suffix !== ".." && !suffix.startsWith("../") && !isAbsolute16(suffix);
13322
+ }
13323
+ async function assertCorpusLink(link3, root) {
13324
+ const refuse = (why) => new Fault(422, "native_state_entry", `The shared native state entry ${displayPath(link3)} is a symbolic link that ${why}. Shared entries must be regular files, directories, or links you own to another entry inside ${displayPath(root)}.`);
13325
+ const unsafe = (path) => refuse(`resolves through ${displayPath(path)}, which is not owned by you or is writable by other users. ${writeFix}`);
13326
+ const absent2 = (error) => ["ENOENT", "ENOTDIR"].includes(error.code ?? "");
13327
+ const unreadable = (path, error) => refuse(`cannot be inspected at ${displayPath(path)} (${String(error.code ?? "error").replace(/[^A-Z0-9_]/gi, "")})`);
13328
+ const inspect = async (path, operation) => {
13329
+ try {
13330
+ return await operation();
13331
+ } catch (error) {
13332
+ if (absent2(error))
13333
+ throw refuse(`is dangling (its target ${displayPath(path)} was removed); remove the link ${displayPath(link3)} to continue`);
13334
+ throw unreadable(path, error);
13335
+ }
13336
+ };
13337
+ let current = link3;
13338
+ for (let hop = 0;; hop++) {
13339
+ if (hop > 8)
13340
+ throw refuse("resolves through more than 8 links");
13341
+ const entry = await inspect(current, () => lstat8(current));
13342
+ if (!ownerProbe(entry, current))
13343
+ throw unsafe(current);
13344
+ if (!entry.isSymbolicLink()) {
13345
+ if (writableByOthers(entry))
13346
+ throw unsafe(current);
13347
+ if (entry.isDirectory() || entry.isFile() && entry.nlink === 1)
13348
+ break;
13349
+ throw refuse(`resolves to ${displayPath(current)}, which is not a directory or a regular file with a single link`);
13350
+ }
13351
+ const text = await inspect(current, () => readlink(current));
13352
+ const raw = text.startsWith("/") ? text : `${dirname8(current)}/${text}`;
13353
+ const lexical = resolve10(raw);
13354
+ if (lexical === root)
13355
+ throw refuse("points at the shared directory itself");
13356
+ if (!strictlyInside(root, lexical))
13357
+ throw refuse(`leaves ${displayPath(root)} for ${displayPath(raw)}`);
13358
+ const last = raw.slice(raw.lastIndexOf("/") + 1);
13359
+ let canonical;
13360
+ if (last === "" || last === "." || last === "..")
13361
+ canonical = await inspect(raw, () => realpath6(raw));
13362
+ else {
13363
+ const parent = await inspect(raw, () => realpath6(raw.slice(0, raw.length - last.length)));
13364
+ canonical = join17(parent, last);
13365
+ }
13366
+ if (canonical === root)
13367
+ throw refuse("points at the shared directory itself");
13368
+ if (!strictlyInside(root, canonical))
13369
+ throw refuse(`leaves ${displayPath(root)} for ${displayPath(raw)}`);
13370
+ if (strictlyInside(canonical, link3))
13371
+ throw refuse(`points at its own ancestor ${displayPath(canonical)}`);
13372
+ for (let directory = dirname8(canonical);directory !== root; directory = dirname8(directory)) {
13373
+ const item2 = await inspect(directory, () => lstat8(directory));
13374
+ if (!item2.isDirectory() || !ownerProbe(item2, directory) || writableByOthers(item2))
13375
+ throw unsafe(directory);
13376
+ }
13377
+ current = canonical;
13378
+ }
13379
+ let resolved;
13380
+ try {
13381
+ resolved = await realpath6(link3);
13382
+ } catch (error) {
13383
+ throw refuse(`does not resolve through the kernel (${String(error.code ?? "error").replace(/[^A-Z0-9_]/gi, "")})`);
13384
+ }
13385
+ if (resolved !== current)
13386
+ throw refuse(`resolves through the kernel to ${displayPath(resolved)}, not the checked ${displayPath(current)}`);
13387
+ }
13388
+ async function assertShareableTree(path, budget = { entries: 0 }, depth = 0, root = path) {
13318
13389
  if (depth > 32)
13319
13390
  throw new Fault(422, "native_state_inventory_limit", "The shared native corpus exceeds the safe projection inventory limit.");
13320
13391
  if (depth === 0)
@@ -13323,15 +13394,17 @@ async function assertShareableTree(path, budget = { entries: 0 }, depth = 0) {
13323
13394
  const nested = join17(path, child.name);
13324
13395
  if (++budget.entries > 1e5)
13325
13396
  throw new Fault(422, "native_state_inventory_limit", `The shared native corpus exceeds the safe projection inventory limit of 100,000 entries at ${displayPath(nested)}.`);
13326
- if (child.isSymbolicLink())
13327
- throw new Fault(422, "native_state_entry", `The shared native state entry ${displayPath(nested)} is a symbolic link. Shared entries must be regular files and directories.`);
13397
+ if (child.isSymbolicLink()) {
13398
+ await assertCorpusLink(nested, root);
13399
+ continue;
13400
+ }
13328
13401
  const entry = await lstat8(nested);
13329
- if (entry.uid !== process.getuid?.() || writableByOthers(entry))
13402
+ if (!ownerProbe(entry, nested) || writableByOthers(entry))
13330
13403
  throw new Fault(422, "native_state_entry", `The shared native state entry ${displayPath(nested)} is not owned by you or is writable by other users. ${writeFix}.`);
13331
13404
  if (child.isDirectory()) {
13332
13405
  if (!entry.isDirectory())
13333
13406
  throw new Fault(422, "native_state_entry", `The shared native state directory ${displayPath(nested)} changed during inspection.`);
13334
- await assertShareableTree(nested, budget, depth + 1);
13407
+ await assertShareableTree(nested, budget, depth + 1, root);
13335
13408
  continue;
13336
13409
  }
13337
13410
  if (!child.isFile() || !entry.isFile() || entry.nlink !== 1)
@@ -14071,7 +14144,11 @@ var preferences = new Set([
14071
14144
  ]);
14072
14145
  var routing3 = new Set(["model", "modelPicker", "fallbackModel", "modelSettings"]);
14073
14146
  var credentialHelpers = new Set(["apiKeyHelper", "awsAuthRefresh", "awsCredentialExport", "otelHeadersHelper", "forceLoginMethod", "forceLoginOrgUUID"]);
14147
+ var budgetEnvironmentKeys = new Set(["MAX_THINKING_TOKENS", "CLAUDE_CODE_MAX_OUTPUT_TOKENS", "MAX_MCP_OUTPUT_TOKENS", "CLAUDE_CODE_MAX_CONTEXT_TOKENS"]);
14148
+ var routingEnvironmentKeys = new Set(["CLAUDE_CODE_SUBAGENT_MODEL", "CLAUDE_CODE_SUBAGENT_MODEL_FORCE"]);
14074
14149
  function routingOrCredentialEnvironmentKey(key) {
14150
+ if (budgetEnvironmentKeys.has(key))
14151
+ return false;
14075
14152
  return /^(?:ANTHROPIC_|CLAUDE_CODE_USE_|CLAUDE_CODE_OAUTH|AWS_|GOOGLE_|VERTEX_|CLOUD_ML_|AZURE_|OTEL_EXPORTER_OTLP_HEADERS)/i.test(key) || /TOKEN|KEY|SECRET|PASSWORD|CREDENTIAL|AUTH|PROXY/i.test(key);
14076
14153
  }
14077
14154
  var invalid4 = (path) => new Fault(422, "claude_user_settings", `Claude user settings ${displayPath(path)} cannot be safely projected. Use a regular JSON file with a single link, owned by you and not writable by other users, with supported preferences and permission policy.`);
@@ -14118,14 +14195,20 @@ function project(settings2, existing, path) {
14118
14195
  if (key === "env") {
14119
14196
  if (!value || typeof value !== "object" || Array.isArray(value))
14120
14197
  throw unsupported3("env", "which is not an object of string values");
14198
+ const environment = {};
14121
14199
  for (const [name, item2] of Object.entries(value)) {
14200
+ if (routingEnvironmentKeys.has(name)) {
14201
+ dropped.push(`env.${name}`);
14202
+ continue;
14203
+ }
14122
14204
  if (routingOrCredentialEnvironmentKey(name))
14123
14205
  throw unsupported3(`env.${name}`, "which routes or authenticates requests or may carry a credential");
14124
14206
  if (typeof item2 !== "string")
14125
14207
  throw unsupported3(`env.${name}`, "which is not a string");
14208
+ environment[name] = item2;
14126
14209
  }
14127
- if (Object.keys(value).length)
14128
- result[key] = value;
14210
+ if (Object.keys(environment).length)
14211
+ result[key] = environment;
14129
14212
  continue;
14130
14213
  }
14131
14214
  if (!preferences.has(key)) {
@@ -14251,7 +14334,7 @@ async function prepareClaudeDesktopLaunch(input, app, sessionDir, system) {
14251
14334
  // src/codex-session-discovery.ts
14252
14335
  import { spawn as spawn3 } from "child_process";
14253
14336
  import { createInterface as createInterface2 } from "readline/promises";
14254
- import { basename as basename3, resolve as resolve12 } from "path";
14337
+ import { basename as basename4, resolve as resolve12 } from "path";
14255
14338
  var object6 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
14256
14339
  var unavailable2 = () => new Fault(422, "codex_session_discovery", "Native Codex session discovery failed. No conversation was started. Retry discovery or provide an exact session ID.");
14257
14340
  async function listCodexSessions(prepared, cwd, query) {
@@ -14420,7 +14503,7 @@ async function resolveCodexResumeArguments(prepared, nativeArgs, cwd, list = lis
14420
14503
  try {
14421
14504
  for (;; ) {
14422
14505
  console.error("Codex conversations across providers:");
14423
- page.data.forEach((thread, i) => console.error(` ${i + 1}. ${display(thread.name ?? thread.id)} \u2014 workspace ${display(basename3(thread.cwd) || "unknown")}`));
14506
+ page.data.forEach((thread, i) => console.error(` ${i + 1}. ${display(thread.name ?? thread.id)} \u2014 workspace ${display(basename4(thread.cwd) || "unknown")}`));
14424
14507
  const answer = (await reader.question("Number, search text, or n for next page (Ctrl-C cancels): ", { signal: controller.signal }).catch((error) => {
14425
14508
  throw controller.signal.aborted ? controller.signal.reason : error;
14426
14509
  })).trim();
@@ -14458,7 +14541,7 @@ import { closeSync as closeSync3, openSync as openSync3 } from "fs";
14458
14541
  import { createHash as createHash16, randomBytes as randomBytes2, randomUUID as randomUUID7 } from "crypto";
14459
14542
  import { constants as constants10 } from "fs";
14460
14543
  import { chmod as chmod3, lstat as lstat10, mkdir as mkdir12, open as open7, readdir as readdir7, rename as rename4, rm as rm5, unlink as unlink3 } from "fs/promises";
14461
- import { basename as basename4, dirname as dirname9, isAbsolute as isAbsolute17, join as join22, resolve as resolve13 } from "path";
14544
+ import { basename as basename5, dirname as dirname9, isAbsolute as isAbsolute17, join as join22, resolve as resolve13 } from "path";
14462
14545
  import { z as z10 } from "zod";
14463
14546
 
14464
14547
  // src/process-table.ts
@@ -14831,7 +14914,7 @@ async function writePrivate(path, text) {
14831
14914
  async function launchStateDirectory(path) {
14832
14915
  if (path === undefined)
14833
14916
  return;
14834
- if (!isAbsolute17(path) || resolve13(path) !== path || !/^launch-[A-Za-z0-9]{6}$/.test(basename4(path)))
14917
+ if (!isAbsolute17(path) || resolve13(path) !== path || !/^launch-[A-Za-z0-9]{6}$/.test(basename5(path)))
14835
14918
  throw new Fault(400, "invalid_state_dir", "The launch state directory must be an absolute launch-XXXXXX directory.");
14836
14919
  const info2 = await lstat10(path).catch(() => {
14837
14920
  return;
@@ -16174,7 +16257,7 @@ async function ensureLaunchProfile(client, provider, harness, model3, modelPolic
16174
16257
  import { createHash as createHash18 } from "crypto";
16175
16258
  import { constants as constants11 } from "fs";
16176
16259
  import { lstat as lstat12, open as open9, opendir as opendir2, link as link3, rmdir as rmdir2, unlink as unlink5 } from "fs/promises";
16177
- import { basename as basename5, dirname as dirname11, isAbsolute as isAbsolute19, join as join25, relative as relative6, resolve as resolve15 } from "path";
16260
+ import { basename as basename6, dirname as dirname11, isAbsolute as isAbsolute19, join as join25, relative as relative6, resolve as resolve15 } from "path";
16178
16261
  var MAX_FILES = 1e5;
16179
16262
  var MAX_BYTES2 = 2 * 1024 * 1024 * 1024;
16180
16263
  var refused = () => new Fault(409, "native_state_import_conflict", "Native state import found changed, unsafe or divergent data. No existing file will be replaced. Keep the original directory and resolve the conflict explicitly.");
@@ -16195,7 +16278,7 @@ var inside3 = (parent, child) => {
16195
16278
  };
16196
16279
  var SESSION_ID = /^[a-f\d]{8}(?:-[a-f\d]{4}){3}-[a-f\d]{12}$/i;
16197
16280
  async function sessionId(path, expected) {
16198
- const nameId = basename5(path).match(/([a-f\d]{8}(?:-[a-f\d]{4}){3}-[a-f\d]{12})\.jsonl$/i)?.[1]?.toLowerCase();
16281
+ const nameId = basename6(path).match(/([a-f\d]{8}(?:-[a-f\d]{4}){3}-[a-f\d]{12})\.jsonl$/i)?.[1]?.toLowerCase();
16199
16282
  const handle = await open9(path, constants11.O_RDONLY | constants11.O_NOFOLLOW);
16200
16283
  try {
16201
16284
  const before = await handle.stat();
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ var __export = (target, all) => {
13
13
  });
14
14
  };
15
15
 
16
- // node_modules/zod/v3/external.js
16
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/external.js
17
17
  var exports_external = {};
18
18
  __export(exports_external, {
19
19
  void: () => voidType,
@@ -125,7 +125,7 @@ __export(exports_external, {
125
125
  BRAND: () => BRAND
126
126
  });
127
127
 
128
- // node_modules/zod/v3/helpers/util.js
128
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/util.js
129
129
  var util;
130
130
  (function(util2) {
131
131
  util2.assertEqual = (_) => {};
@@ -256,7 +256,7 @@ var getParsedType = (data) => {
256
256
  }
257
257
  };
258
258
 
259
- // node_modules/zod/v3/ZodError.js
259
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/ZodError.js
260
260
  var ZodIssueCode = util.arrayToEnum([
261
261
  "invalid_type",
262
262
  "invalid_literal",
@@ -375,7 +375,7 @@ ZodError.create = (issues) => {
375
375
  return error;
376
376
  };
377
377
 
378
- // node_modules/zod/v3/locales/en.js
378
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/locales/en.js
379
379
  var errorMap = (issue, _ctx) => {
380
380
  let message;
381
381
  switch (issue.code) {
@@ -478,7 +478,7 @@ var errorMap = (issue, _ctx) => {
478
478
  };
479
479
  var en_default = errorMap;
480
480
 
481
- // node_modules/zod/v3/errors.js
481
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/errors.js
482
482
  var overrideErrorMap = en_default;
483
483
  function setErrorMap(map) {
484
484
  overrideErrorMap = map;
@@ -486,7 +486,7 @@ function setErrorMap(map) {
486
486
  function getErrorMap() {
487
487
  return overrideErrorMap;
488
488
  }
489
- // node_modules/zod/v3/helpers/parseUtil.js
489
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
490
490
  var makeIssue = (params) => {
491
491
  const { data, path, errorMaps, issueData } = params;
492
492
  const fullPath = [...path, ...issueData.path || []];
@@ -592,14 +592,14 @@ var isAborted = (x) => x.status === "aborted";
592
592
  var isDirty = (x) => x.status === "dirty";
593
593
  var isValid = (x) => x.status === "valid";
594
594
  var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
595
- // node_modules/zod/v3/helpers/errorUtil.js
595
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js
596
596
  var errorUtil;
597
597
  (function(errorUtil2) {
598
598
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
599
599
  errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
600
600
  })(errorUtil || (errorUtil = {}));
601
601
 
602
- // node_modules/zod/v3/types.js
602
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/types.js
603
603
  class ParseInputLazyPath {
604
604
  constructor(parent, value, path, key) {
605
605
  this._cachedPath = [];
@@ -4200,7 +4200,7 @@ async function boundedJson(response, maxBytes = MAX_BYTES) {
4200
4200
  }
4201
4201
  }
4202
4202
 
4203
- // node_modules/@hasna/contracts/dist/client/transport.js
4203
+ // ../contracts/dist/client/transport.js
4204
4204
  import { isIP } from "net";
4205
4205
  import { spawnSync } from "child_process";
4206
4206
  import { closeSync as closeSync2, fstatSync as fstatSync2, openSync as openSync2, readFileSync as readFileSync2 } from "fs";
package/dist/mcp/index.js CHANGED
@@ -19,7 +19,7 @@ var __export = (target, all) => {
19
19
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
20
20
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
21
21
 
22
- // node_modules/zod/v3/external.js
22
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/external.js
23
23
  var exports_external = {};
24
24
  __export(exports_external, {
25
25
  void: () => voidType,
@@ -131,7 +131,7 @@ __export(exports_external, {
131
131
  BRAND: () => BRAND
132
132
  });
133
133
 
134
- // node_modules/zod/v3/helpers/util.js
134
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/util.js
135
135
  var util;
136
136
  (function(util2) {
137
137
  util2.assertEqual = (_) => {};
@@ -262,7 +262,7 @@ var getParsedType = (data) => {
262
262
  }
263
263
  };
264
264
 
265
- // node_modules/zod/v3/ZodError.js
265
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/ZodError.js
266
266
  var ZodIssueCode = util.arrayToEnum([
267
267
  "invalid_type",
268
268
  "invalid_literal",
@@ -381,7 +381,7 @@ ZodError.create = (issues) => {
381
381
  return error;
382
382
  };
383
383
 
384
- // node_modules/zod/v3/locales/en.js
384
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/locales/en.js
385
385
  var errorMap = (issue, _ctx) => {
386
386
  let message;
387
387
  switch (issue.code) {
@@ -484,7 +484,7 @@ var errorMap = (issue, _ctx) => {
484
484
  };
485
485
  var en_default = errorMap;
486
486
 
487
- // node_modules/zod/v3/errors.js
487
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/errors.js
488
488
  var overrideErrorMap = en_default;
489
489
  function setErrorMap(map) {
490
490
  overrideErrorMap = map;
@@ -492,7 +492,7 @@ function setErrorMap(map) {
492
492
  function getErrorMap() {
493
493
  return overrideErrorMap;
494
494
  }
495
- // node_modules/zod/v3/helpers/parseUtil.js
495
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
496
496
  var makeIssue = (params) => {
497
497
  const { data, path, errorMaps, issueData } = params;
498
498
  const fullPath = [...path, ...issueData.path || []];
@@ -598,14 +598,14 @@ var isAborted = (x) => x.status === "aborted";
598
598
  var isDirty = (x) => x.status === "dirty";
599
599
  var isValid = (x) => x.status === "valid";
600
600
  var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
601
- // node_modules/zod/v3/helpers/errorUtil.js
601
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js
602
602
  var errorUtil;
603
603
  (function(errorUtil2) {
604
604
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
605
605
  errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
606
606
  })(errorUtil || (errorUtil = {}));
607
607
 
608
- // node_modules/zod/v3/types.js
608
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/types.js
609
609
  class ParseInputLazyPath {
610
610
  constructor(parent, value, path, key) {
611
611
  this._cachedPath = [];
@@ -4049,7 +4049,7 @@ function canonicalPolicyJSON(value) {
4049
4049
  return JSON.stringify(value, (_key, item) => item && typeof item === "object" && !Array.isArray(item) ? Object.fromEntries(Object.entries(item).sort(([a], [b]) => a.localeCompare(b))) : item);
4050
4050
  }
4051
4051
  // package.json
4052
- var version = "0.2.17";
4052
+ var version = "0.2.18";
4053
4053
 
4054
4054
  // src/version.ts
4055
4055
  var VERSION = version;
@@ -4243,7 +4243,7 @@ async function boundedJson(response, maxBytes = MAX_BYTES) {
4243
4243
  }
4244
4244
  }
4245
4245
 
4246
- // node_modules/@hasna/contracts/dist/client/transport.js
4246
+ // ../contracts/dist/client/transport.js
4247
4247
  import { isIP } from "net";
4248
4248
  import { spawnSync } from "child_process";
4249
4249
  import { closeSync as closeSync2, fstatSync as fstatSync2, openSync as openSync2, readFileSync as readFileSync2 } from "fs";
@@ -5919,7 +5919,7 @@ import { chmod, mkdir } from "fs/promises";
5919
5919
  import { dirname as dirname2, resolve } from "path";
5920
5920
  import { createHash as createHash2 } from "crypto";
5921
5921
 
5922
- // node_modules/@hasna/contracts/dist/auth/index.js
5922
+ // ../contracts/dist/auth/index.js
5923
5923
  import { createHash, createHmac, randomBytes, timingSafeEqual } from "crypto";
5924
5924
  var MAX_TENANT_ID_LENGTH = 64;
5925
5925
  var TENANT_ID_PATTERN = new RegExp(`^[A-Za-z0-9][A-Za-z0-9._-]{0,${MAX_TENANT_ID_LENGTH - 1}}$`);
@@ -7080,7 +7080,7 @@ var openapi_default = {
7080
7080
  openapi: "3.0.3",
7081
7081
  info: {
7082
7082
  title: "Switcher API",
7083
- version: "0.2.17",
7083
+ version: "0.2.18",
7084
7084
  description: "Authenticated provider/profile/catalog control plane. Launches run locally; the API never returns provider credentials."
7085
7085
  },
7086
7086
  security: [
@@ -11693,7 +11693,7 @@ async function openCliRuntime(env = process.env, resolveCredential2) {
11693
11693
  return { client: new SwitcherClient({ baseUrl: service.url, apiKey }), mode: "local", providerEnv, close: service.close };
11694
11694
  }
11695
11695
 
11696
- // node_modules/@hasna/contracts/dist/executable-trust.js
11696
+ // ../contracts/dist/executable-trust.js
11697
11697
  import { constants as constants2 } from "fs";
11698
11698
  import { access as access2, lstat as lstat2, open, readlink, realpath, rename, unlink } from "fs/promises";
11699
11699
  import { dirname as dirname3, isAbsolute as isAbsolute3, join as join5, parse as parse2, sep as sep2 } from "path";
@@ -39,6 +39,30 @@ export declare function ensureNativeStateDirectory(path: string, create?: boolea
39
39
  * Keep existing links intact; a different isolated profile is an explicit choice. */
40
40
  export declare function assertNativeStateIsolation(tool: SharedNativeTool, home: string, environment?: NodeJS.ProcessEnv): Promise<void>;
41
41
  export declare function withNativeStateLock<T>(state: NativeState, operation: () => Promise<T>): Promise<T>;
42
+ type OwnerProbe = (entry: Stats, path: string) => boolean;
43
+ /** Tests only: replace the owned-by-you predicate for shared corpus entries. Omit the probe to restore it. */
44
+ export declare function setOwnerProbeForTesting(probe?: OwnerProbe): void;
45
+ /** Claude Code links one session's transcript to another's when a session
46
+ * resumes under a new id. This applies to every shared top-level directory of
47
+ * either tool (Claude projects, todos, skills, instructions; Codex sessions,
48
+ * skills and the others). A link is accepted only when:
49
+ * - the link and every further link hop are owned by you (ownership only: a
50
+ * link's mode bits are not consulted, and Linux links are always 0777);
51
+ * - each hop, resolved in kernel order (the link text joined by concatenation,
52
+ * never normalised; the directory part resolved by realpath before the last
53
+ * segment applies, so a ".." after a directory link is checked where the
54
+ * kernel takes it), lies strictly inside the real path of the same top-level
55
+ * directory, is not that directory and is not an ancestor of the link;
56
+ * - every real directory from that hop's resolved parent up to, not including,
57
+ * the top-level directory is owned by you and not writable by others;
58
+ * - the final target is owned by you, not writable by others, and a directory
59
+ * (walked separately) or a regular file with a single link;
60
+ * - the kernel's own realpath of the link equals the checked target.
61
+ * Directories outside the corpus that the link text names before realpath
62
+ * collapses them are not checked; the resolved target must still be inside.
63
+ * Every failure, including any errno, refuses with the link's path. Switcher
64
+ * never writes through an accepted link. */
65
+ export declare function assertCorpusLink(link: string, root: string): Promise<void>;
42
66
  /** A nested CLI keeps its authentication home. Refuse conflicting instruction
43
67
  * overlays rather than rewriting account config or exposing instructions in argv. */
44
68
  export declare function assertNativeInstructionOverlay(state: NativeState, overlayHome: string): Promise<void>;
package/dist/sdk.js CHANGED
@@ -13,7 +13,7 @@ var __export = (target, all) => {
13
13
  });
14
14
  };
15
15
 
16
- // node_modules/zod/v3/external.js
16
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/external.js
17
17
  var exports_external = {};
18
18
  __export(exports_external, {
19
19
  void: () => voidType,
@@ -125,7 +125,7 @@ __export(exports_external, {
125
125
  BRAND: () => BRAND
126
126
  });
127
127
 
128
- // node_modules/zod/v3/helpers/util.js
128
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/util.js
129
129
  var util;
130
130
  (function(util2) {
131
131
  util2.assertEqual = (_) => {};
@@ -256,7 +256,7 @@ var getParsedType = (data) => {
256
256
  }
257
257
  };
258
258
 
259
- // node_modules/zod/v3/ZodError.js
259
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/ZodError.js
260
260
  var ZodIssueCode = util.arrayToEnum([
261
261
  "invalid_type",
262
262
  "invalid_literal",
@@ -375,7 +375,7 @@ ZodError.create = (issues) => {
375
375
  return error;
376
376
  };
377
377
 
378
- // node_modules/zod/v3/locales/en.js
378
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/locales/en.js
379
379
  var errorMap = (issue, _ctx) => {
380
380
  let message;
381
381
  switch (issue.code) {
@@ -478,7 +478,7 @@ var errorMap = (issue, _ctx) => {
478
478
  };
479
479
  var en_default = errorMap;
480
480
 
481
- // node_modules/zod/v3/errors.js
481
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/errors.js
482
482
  var overrideErrorMap = en_default;
483
483
  function setErrorMap(map) {
484
484
  overrideErrorMap = map;
@@ -486,7 +486,7 @@ function setErrorMap(map) {
486
486
  function getErrorMap() {
487
487
  return overrideErrorMap;
488
488
  }
489
- // node_modules/zod/v3/helpers/parseUtil.js
489
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
490
490
  var makeIssue = (params) => {
491
491
  const { data, path, errorMaps, issueData } = params;
492
492
  const fullPath = [...path, ...issueData.path || []];
@@ -592,14 +592,14 @@ var isAborted = (x) => x.status === "aborted";
592
592
  var isDirty = (x) => x.status === "dirty";
593
593
  var isValid = (x) => x.status === "valid";
594
594
  var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
595
- // node_modules/zod/v3/helpers/errorUtil.js
595
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js
596
596
  var errorUtil;
597
597
  (function(errorUtil2) {
598
598
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
599
599
  errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
600
600
  })(errorUtil || (errorUtil = {}));
601
601
 
602
- // node_modules/zod/v3/types.js
602
+ // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/types.js
603
603
  class ParseInputLazyPath {
604
604
  constructor(parent, value, path, key) {
605
605
  this._cachedPath = [];
@@ -4200,7 +4200,7 @@ async function boundedJson(response, maxBytes = MAX_BYTES) {
4200
4200
  }
4201
4201
  }
4202
4202
 
4203
- // node_modules/@hasna/contracts/dist/client/transport.js
4203
+ // ../contracts/dist/client/transport.js
4204
4204
  import { isIP } from "net";
4205
4205
  import { spawnSync } from "child_process";
4206
4206
  import { closeSync as closeSync2, fstatSync as fstatSync2, openSync as openSync2, readFileSync as readFileSync2 } from "fs";
@@ -68,7 +68,7 @@ function canonicalPolicyJSON(value) {
68
68
  return JSON.stringify(value, (_key, item) => item && typeof item === "object" && !Array.isArray(item) ? Object.fromEntries(Object.entries(item).sort(([a], [b]) => a.localeCompare(b))) : item);
69
69
  }
70
70
  // package.json
71
- var version = "0.2.17";
71
+ var version = "0.2.18";
72
72
 
73
73
  // src/version.ts
74
74
  var VERSION = version;
@@ -922,7 +922,7 @@ var openapi_default = {
922
922
  openapi: "3.0.3",
923
923
  info: {
924
924
  title: "Switcher API",
925
- version: "0.2.17",
925
+ version: "0.2.18",
926
926
  description: "Authenticated provider/profile/catalog control plane. Launches run locally; the API never returns provider credentials."
927
927
  },
928
928
  security: [
@@ -4,7 +4,7 @@
4
4
  "name": "switcher",
5
5
  "class": "cli-with-store",
6
6
  "contractVersion": "v1",
7
- "kitVersion": "1.3.8",
7
+ "kitVersion": "1.3.10",
8
8
  "description": "Universal provider and model switcher with API-first local and hosted operation. CLI, MCP and SDK resolve one authenticated HTTP authority through @hasna/contracts and fail closed when hosted configuration is missing or invalid. HASNA_SWITCHER_LOCAL=1 deliberately selects an owned loopback API backed by SQLite; hosted https://api.hasna.com/switcher uses PostgreSQL and signed revocable API keys. Provider credentials remain local to the launcher and are never stored or returned by the service.",
9
9
  "bins": [
10
10
  "switcher",
package/openapi.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.0.3",
3
3
  "info": {
4
4
  "title": "Switcher API",
5
- "version": "0.2.17",
5
+ "version": "0.2.18",
6
6
  "description": "Authenticated provider/profile/catalog control plane. Launches run locally; the API never returns provider credentials."
7
7
  },
8
8
  "security": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/switcher",
3
- "version": "0.2.17",
3
+ "version": "0.2.18",
4
4
  "type": "module",
5
5
  "description": "Universal provider and model switcher for coding harnesses with an API, SDK and self-hosted storage",
6
6
  "license": "Apache-2.0",
@@ -78,7 +78,7 @@
78
78
  "@types/pg": "8.23.1"
79
79
  },
80
80
  "dependencies": {
81
- "@hasna/contracts": "1.3.8",
81
+ "@hasna/contracts": "1.3.10",
82
82
  "@modelcontextprotocol/sdk": "^1.29.0",
83
83
  "jsonc-parser": "3.3.1",
84
84
  "yaml": "2.9.0",