@makerbi/openclaude 0.14.9 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/cli.mjs +854 -407
  2. package/dist/sdk.mjs +288 -80
  3. package/package.json +3 -3
package/dist/sdk.mjs CHANGED
@@ -13193,7 +13193,7 @@ var init_codexOAuthShared = __esm(() => {
13193
13193
  });
13194
13194
 
13195
13195
  // src/utils/codexCredentials.ts
13196
- function getCodexSecureStorage() {
13196
+ function getCodexPrimarySecureStorage() {
13197
13197
  return getSecureStorage({ allowPlainTextFallback: false });
13198
13198
  }
13199
13199
  function parseJwtExpiryMs(token) {
@@ -13231,6 +13231,69 @@ function normalizeCodexCredentialBlob(value) {
13231
13231
  lastRefreshFailureAt
13232
13232
  };
13233
13233
  }
13234
+ function getRecord(data) {
13235
+ return data && typeof data === "object" ? data : {};
13236
+ }
13237
+ function hasStoredCodexRecord(data) {
13238
+ return Object.prototype.hasOwnProperty.call(getRecord(data), CODEX_STORAGE_KEY);
13239
+ }
13240
+ function hasNonCodexStorageFields(data) {
13241
+ return Object.keys(getRecord(data)).some((key) => key !== CODEX_STORAGE_KEY);
13242
+ }
13243
+ function readCodexFromPlainTextStorage() {
13244
+ try {
13245
+ const data = plainTextStorage.read();
13246
+ return normalizeCodexCredentialBlob(data?.[CODEX_STORAGE_KEY]);
13247
+ } catch {
13248
+ return;
13249
+ }
13250
+ }
13251
+ async function readCodexFromPlainTextStorageAsync() {
13252
+ try {
13253
+ const data = await plainTextStorage.readAsync();
13254
+ return normalizeCodexCredentialBlob(data?.[CODEX_STORAGE_KEY]);
13255
+ } catch {
13256
+ return;
13257
+ }
13258
+ }
13259
+ function writeCodexToPlainTextStorage(codex) {
13260
+ try {
13261
+ const previous = plainTextStorage.read() || {};
13262
+ const next = {
13263
+ ...getRecord(previous),
13264
+ [CODEX_STORAGE_KEY]: codex
13265
+ };
13266
+ return plainTextStorage.update(next);
13267
+ } catch {
13268
+ return { success: false };
13269
+ }
13270
+ }
13271
+ function removeCodexFromPlainTextStorage() {
13272
+ try {
13273
+ const previous = plainTextStorage.read();
13274
+ if (!hasStoredCodexRecord(previous)) {
13275
+ return { success: true };
13276
+ }
13277
+ const next = { ...getRecord(previous) };
13278
+ delete next[CODEX_STORAGE_KEY];
13279
+ if (Object.keys(next).length === 0) {
13280
+ return plainTextStorage.delete() ? { success: true } : {
13281
+ success: false,
13282
+ warning: CODEX_PLAINTEXT_CLEANUP_FAILED_WARNING
13283
+ };
13284
+ }
13285
+ const result = plainTextStorage.update(next);
13286
+ return result.success ? { success: true } : {
13287
+ success: false,
13288
+ warning: result.warning ?? CODEX_PLAINTEXT_CLEANUP_FAILED_WARNING
13289
+ };
13290
+ } catch {
13291
+ return {
13292
+ success: false,
13293
+ warning: CODEX_PLAINTEXT_CLEANUP_FAILED_WARNING
13294
+ };
13295
+ }
13296
+ }
13234
13297
  function shouldRefreshCodexToken(blob) {
13235
13298
  const expiresAt = parseJwtExpiryMs(blob.accessToken) ?? parseJwtExpiryMs(blob.idToken);
13236
13299
  if (expiresAt === undefined) {
@@ -13263,21 +13326,23 @@ function readCodexCredentials() {
13263
13326
  if (isBareMode())
13264
13327
  return;
13265
13328
  try {
13266
- const data = getCodexSecureStorage().read();
13267
- return normalizeCodexCredentialBlob(data?.codex);
13268
- } catch {
13269
- return;
13270
- }
13329
+ const data = getCodexPrimarySecureStorage().read();
13330
+ const primaryCodex = normalizeCodexCredentialBlob(data?.codex);
13331
+ if (primaryCodex)
13332
+ return primaryCodex;
13333
+ } catch {}
13334
+ return readCodexFromPlainTextStorage();
13271
13335
  }
13272
13336
  async function readCodexCredentialsAsync() {
13273
13337
  if (isBareMode())
13274
13338
  return;
13275
13339
  try {
13276
- const data = await getCodexSecureStorage().readAsync();
13277
- return normalizeCodexCredentialBlob(data?.codex);
13278
- } catch {
13279
- return;
13280
- }
13340
+ const data = await getCodexPrimarySecureStorage().readAsync();
13341
+ const primaryCodex = normalizeCodexCredentialBlob(data?.codex);
13342
+ if (primaryCodex)
13343
+ return primaryCodex;
13344
+ } catch {}
13345
+ return readCodexFromPlainTextStorageAsync();
13281
13346
  }
13282
13347
  function isCodexRefreshFailureCoolingDown(blob, now = Date.now()) {
13283
13348
  return isWithinRefreshFailureCooldown(blob, now);
@@ -13290,11 +13355,12 @@ function saveCodexCredentials(credentials) {
13290
13355
  if (!normalized) {
13291
13356
  return { success: false, warning: "Codex credentials are incomplete." };
13292
13357
  }
13293
- const secureStorage = getCodexSecureStorage();
13294
- const previous = secureStorage.read() || {};
13295
- const previousCodex = normalizeCodexCredentialBlob(previous[CODEX_STORAGE_KEY]);
13358
+ const secureStorage = getCodexPrimarySecureStorage();
13359
+ const previous = secureStorage.read();
13360
+ const previousNativeCodex = normalizeCodexCredentialBlob(previous?.[CODEX_STORAGE_KEY]);
13361
+ const previousCodex = previousNativeCodex ?? readCodexFromPlainTextStorage();
13296
13362
  const next = {
13297
- ...previous,
13363
+ ...getRecord(previous),
13298
13364
  [CODEX_STORAGE_KEY]: {
13299
13365
  ...normalized,
13300
13366
  profileId: normalized.profileId ?? previousCodex?.profileId,
@@ -13305,8 +13371,37 @@ function saveCodexCredentials(credentials) {
13305
13371
  if (result.success) {
13306
13372
  const storedCodex = normalizeCodexCredentialBlob(next[CODEX_STORAGE_KEY]);
13307
13373
  inMemoryLastRefreshFailureAt = storedCodex?.lastRefreshFailureAt ?? null;
13374
+ const cleanupResult = removeCodexFromPlainTextStorage();
13375
+ if (!cleanupResult.success) {
13376
+ return {
13377
+ success: true,
13378
+ warning: cleanupResult.warning ?? CODEX_PLAINTEXT_CLEANUP_FAILED_WARNING
13379
+ };
13380
+ }
13381
+ return result;
13308
13382
  }
13309
- return result;
13383
+ if (previousNativeCodex && hasNonCodexStorageFields(previous)) {
13384
+ return result;
13385
+ }
13386
+ const fallbackResult = writeCodexToPlainTextStorage(next[CODEX_STORAGE_KEY]);
13387
+ if (fallbackResult.success) {
13388
+ if (previousNativeCodex && !secureStorage.delete()) {
13389
+ return {
13390
+ success: false,
13391
+ warning: CODEX_FALLBACK_NATIVE_DELETE_FAILED_WARNING
13392
+ };
13393
+ }
13394
+ if (!previousNativeCodex && !hasNonCodexStorageFields(previous)) {
13395
+ secureStorage.delete();
13396
+ }
13397
+ const storedCodex = normalizeCodexCredentialBlob(next[CODEX_STORAGE_KEY]);
13398
+ inMemoryLastRefreshFailureAt = storedCodex?.lastRefreshFailureAt ?? null;
13399
+ return {
13400
+ success: true,
13401
+ warning: fallbackResult.warning
13402
+ };
13403
+ }
13404
+ return fallbackResult.warning ? fallbackResult : result;
13310
13405
  }
13311
13406
  function persistCodexRefreshFailure(credentials, occurredAt) {
13312
13407
  const result = saveCodexCredentials({
@@ -13328,7 +13423,8 @@ async function refreshCodexAccessTokenIfNeeded(options) {
13328
13423
  if (!current) {
13329
13424
  return { refreshed: false };
13330
13425
  }
13331
- if (!current.refreshToken) {
13426
+ const refreshToken = current.refreshToken;
13427
+ if (!refreshToken) {
13332
13428
  return { refreshed: false, credentials: current };
13333
13429
  }
13334
13430
  if (!options?.force && !shouldRefreshCodexToken(current)) {
@@ -13346,7 +13442,7 @@ async function refreshCodexAccessTokenIfNeeded(options) {
13346
13442
  const body = new URLSearchParams({
13347
13443
  client_id: getCodexOAuthClientId(),
13348
13444
  grant_type: "refresh_token",
13349
- refresh_token: current.refreshToken
13445
+ refresh_token: refreshToken
13350
13446
  });
13351
13447
  const { signal, cleanup } = createCombinedAbortSignal(undefined, {
13352
13448
  timeoutMs: 15000
@@ -13403,11 +13499,12 @@ async function refreshCodexAccessTokenIfNeeded(options) {
13403
13499
  })();
13404
13500
  return inFlightCodexRefresh;
13405
13501
  }
13406
- var CODEX_STORAGE_KEY = "codex", CODEX_TOKEN_REFRESH_SKEW_MS = 60000, CODEX_TOKEN_REFRESH_RETRY_COOLDOWN_MS = 60000, inFlightCodexRefresh = null, inMemoryLastRefreshFailureAt = null;
13502
+ var CODEX_STORAGE_KEY = "codex", CODEX_TOKEN_REFRESH_SKEW_MS = 60000, CODEX_TOKEN_REFRESH_RETRY_COOLDOWN_MS = 60000, CODEX_FALLBACK_NATIVE_DELETE_FAILED_WARNING = "Codex credentials were written to plaintext fallback, but stale native secure storage could not be removed.", CODEX_PLAINTEXT_CLEANUP_FAILED_WARNING = "Codex credentials were saved, but stale plaintext fallback credentials could not be removed.", inFlightCodexRefresh = null, inMemoryLastRefreshFailureAt = null;
13407
13503
  var init_codexCredentials = __esm(() => {
13408
13504
  init_envUtils();
13409
13505
  init_combinedAbortSignal();
13410
13506
  init_secureStorage();
13507
+ init_plainTextStorage();
13411
13508
  init_codexOAuthShared();
13412
13509
  });
13413
13510
 
@@ -15195,6 +15292,7 @@ var init_gitlawb_opengateway = __esm(() => {
15195
15292
  preset: {
15196
15293
  id: "gitlawb-opengateway",
15197
15294
  description: "Gitlawb Opengateway — free hosted Xiaomi MiMo + GMI Cloud partner models (API key required, mint at https://gitlawb.com/opengateway/keys)",
15295
+ apiKeyEnvVars: ["OPENGATEWAY_API_KEY"],
15198
15296
  label: "Gitlawb Opengateway",
15199
15297
  name: "Gitlawb Opengateway",
15200
15298
  vendorId: "openai",
@@ -17087,6 +17185,9 @@ var init_integrationArtifacts_generated = __esm(() => {
17087
17185
  description: "Gitlawb Opengateway — free hosted Xiaomi MiMo + GMI Cloud partner models (API key required, mint at https://gitlawb.com/opengateway/keys)",
17088
17186
  label: "Gitlawb Opengateway",
17089
17187
  name: "Gitlawb Opengateway",
17188
+ apiKeyEnvVars: [
17189
+ "OPENGATEWAY_API_KEY"
17190
+ ],
17090
17191
  baseUrlEnvVars: [
17091
17192
  "OPENGATEWAY_BASE_URL",
17092
17193
  "OPENAI_BASE_URL"
@@ -34843,6 +34944,8 @@ function normalizePathWithV1(pathname) {
34843
34944
  return `${trimmed}/v1`;
34844
34945
  }
34845
34946
  function isLikelyOllamaEndpoint(baseUrl) {
34947
+ if (!baseUrl)
34948
+ return false;
34846
34949
  try {
34847
34950
  const parsed = new URL(baseUrl);
34848
34951
  const hostname = parsed.hostname.toLowerCase();
@@ -35454,7 +35557,7 @@ function getAttributionHeader(fingerprint) {
35454
35557
  if (!isAttributionHeaderEnabled()) {
35455
35558
  return "";
35456
35559
  }
35457
- const version = `${"0.14.9"}.${fingerprint}`;
35560
+ const version = `${"0.15.1"}.${fingerprint}`;
35458
35561
  const entrypoint = process.env.CLAUDE_CODE_ENTRYPOINT ?? "unknown";
35459
35562
  const cch = "";
35460
35563
  const workload = getWorkload();
@@ -52476,8 +52579,8 @@ var init_types2 = __esm(() => {
52476
52579
  attribution: exports_external.object({
52477
52580
  commit: exports_external.string().optional().describe("Attribution text for git commits, including any trailers. " + "Empty string hides attribution."),
52478
52581
  pr: exports_external.string().optional().describe("Attribution text for pull request descriptions. " + "Empty string hides attribution.")
52479
- }).optional().describe("Customize attribution text for commits and PRs. " + "Each field defaults to the standard Claude Code attribution if not set."),
52480
- includeCoAuthoredBy: exports_external.boolean().optional().describe("Deprecated: Use attribution instead. " + "Whether to include Claude's co-authored by attribution in commits and PRs (defaults to true)"),
52582
+ }).optional().describe("Customize attribution text for commits and PRs. " + "Unspecified fields are off by default; set a non-empty string to opt in."),
52583
+ includeCoAuthoredBy: exports_external.boolean().optional().describe("Deprecated: Use attribution instead. " + "Whether to include Claude's co-authored by attribution in commits and PRs (defaults to false)"),
52481
52584
  includeGitInstructions: exports_external.boolean().optional().describe("Include built-in commit and PR workflow instructions in Claude's system prompt (default: true)"),
52482
52585
  permissions: PermissionsSchema().optional().describe("Tool usage permissions configuration"),
52483
52586
  model: exports_external.string().optional().describe("Override the default model used by Claude Code"),
@@ -193039,7 +193142,7 @@ var init_metadata = __esm(() => {
193039
193142
  COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
193040
193143
  WHITESPACE_REGEX = /\s+/;
193041
193144
  getVersionBase = memoize_default(() => {
193042
- const match = "0.14.9".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
193145
+ const match = "0.15.1".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
193043
193146
  return match ? match[0] : undefined;
193044
193147
  });
193045
193148
  buildEnvContext = memoize_default(async () => {
@@ -193079,9 +193182,9 @@ var init_metadata = __esm(() => {
193079
193182
  isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
193080
193183
  isClaudeCodeAction: isEnvTruthy(process.env.CLAUDE_CODE_ACTION),
193081
193184
  isClaudeAiAuth: isClaudeAISubscriber(),
193082
- version: "0.14.9",
193185
+ version: "0.15.1",
193083
193186
  versionBase: getVersionBase(),
193084
- buildTime: "2026-05-26T10:36:28.963Z",
193187
+ buildTime: "2026-05-27T08:20:37.459Z",
193085
193188
  deploymentEnvironment: env2.detectDeploymentEnvironment(),
193086
193189
  ...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
193087
193190
  githubEventName: process.env.GITHUB_EVENT_NAME,
@@ -201093,6 +201196,10 @@ function modelSupportsThinking(model2) {
201093
201196
  if (descriptorSupportsThinking !== undefined) {
201094
201197
  return descriptorSupportsThinking;
201095
201198
  }
201199
+ const routeId = resolveActiveRouteIdFromEnv(process.env);
201200
+ if (routeId === "ollama") {
201201
+ return false;
201202
+ }
201096
201203
  }
201097
201204
  return canonical.includes("sonnet-4") || canonical.includes("opus-4");
201098
201205
  }
@@ -201121,6 +201228,9 @@ function shouldEnableThinkingByDefault() {
201121
201228
  }
201122
201229
  return true;
201123
201230
  }
201231
+ function shouldUseThinkingForModel(model2, thinkingConfig) {
201232
+ return thinkingConfig.type !== "disabled" && !isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_THINKING) && modelSupportsThinking(model2);
201233
+ }
201124
201234
  var init_thinking = __esm(() => {
201125
201235
  init_growthbook();
201126
201236
  init_integrations();
@@ -201129,6 +201239,7 @@ var init_thinking = __esm(() => {
201129
201239
  init_modelSupportOverrides();
201130
201240
  init_providers();
201131
201241
  init_settings2();
201242
+ init_envUtils();
201132
201243
  });
201133
201244
 
201134
201245
  // src/utils/effort.ts
@@ -201290,7 +201401,7 @@ var init_effort = __esm(() => {
201290
201401
 
201291
201402
  // src/utils/userAgent.ts
201292
201403
  function getClaudeCodeUserAgent() {
201293
- return `claude-code/${"0.14.9"}`;
201404
+ return `claude-code/${"0.15.1"}`;
201294
201405
  }
201295
201406
 
201296
201407
  // src/utils/http.ts
@@ -201299,7 +201410,7 @@ function getUserAgent() {
201299
201410
  const clientApp = process.env.CLAUDE_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}` : "";
201300
201411
  const workload = getWorkload();
201301
201412
  const workloadSuffix = workload ? `, workload/${workload}` : "";
201302
- return `claude-cli/${"0.14.9"} (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
201413
+ return `claude-cli/${"0.15.1"} (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
201303
201414
  }
201304
201415
  function getMCPUserAgent() {
201305
201416
  const parts = [];
@@ -201313,7 +201424,7 @@ function getMCPUserAgent() {
201313
201424
  parts.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`);
201314
201425
  }
201315
201426
  const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
201316
- return `claude-code/${"0.14.9"}${suffix}`;
201427
+ return `claude-code/${"0.15.1"}${suffix}`;
201317
201428
  }
201318
201429
  function getWebFetchUserAgent() {
201319
201430
  const supportUrl = getAPIProvider() === "firstParty" ? "https://support.anthropic.com/" : "https://github.com/AndersonBY/openclaude";
@@ -205526,7 +205637,7 @@ async function initialize() {
205526
205637
  if (dirs.length === 0)
205527
205638
  return;
205528
205639
  logForDebugging(`Watching for changes in setting files ${[...settingsFiles].join(", ")}...${dropInDir ? ` and drop-in directory ${dropInDir}` : ""}`);
205529
- watcher2 = esm_default.watch(dirs, {
205640
+ watcher2 = dependencies.watch(dirs, {
205530
205641
  persistent: true,
205531
205642
  ignoreInitial: true,
205532
205643
  depth: 0,
@@ -205566,8 +205677,10 @@ function dispose() {
205566
205677
  for (const timer of pendingDeletions.values())
205567
205678
  clearTimeout(timer);
205568
205679
  pendingDeletions.clear();
205680
+ clearSettingsDebounce();
205681
+ settingsSourceGenerations.clear();
205569
205682
  lastMdmSnapshot = null;
205570
- clearInternalWrites();
205683
+ dependencies.clearInternalWrites();
205571
205684
  settingsChanged.clear();
205572
205685
  const w = watcher2;
205573
205686
  watcher2 = null;
@@ -205580,7 +205693,7 @@ async function getWatchTargets() {
205580
205693
  if (source === "flagSettings") {
205581
205694
  continue;
205582
205695
  }
205583
- const path9 = getSettingsFilePathForSource(source);
205696
+ const path9 = dependencies.getSettingsFilePathForSource(source);
205584
205697
  if (!path9) {
205585
205698
  continue;
205586
205699
  }
@@ -205590,7 +205703,7 @@ async function getWatchTargets() {
205590
205703
  }
205591
205704
  dirToSettingsFiles.get(dir).add(path9);
205592
205705
  try {
205593
- const stats = await stat10(path9);
205706
+ const stats = await dependencies.stat(path9);
205594
205707
  if (stats.isFile()) {
205595
205708
  dirsWithExistingFiles.add(dir);
205596
205709
  }
@@ -205606,9 +205719,9 @@ async function getWatchTargets() {
205606
205719
  }
205607
205720
  }
205608
205721
  let dropInDir = null;
205609
- const managedDropIn = getManagedSettingsDropInDir();
205722
+ const managedDropIn = dependencies.getManagedSettingsDropInDir();
205610
205723
  try {
205611
- const stats = await stat10(managedDropIn);
205724
+ const stats = await dependencies.stat(managedDropIn);
205612
205725
  if (stats.isDirectory()) {
205613
205726
  dirsWithExistingFiles.add(managedDropIn);
205614
205727
  dropInDir = managedDropIn;
@@ -205630,6 +205743,8 @@ function settingSourceToConfigChangeSource(source) {
205630
205743
  }
205631
205744
  }
205632
205745
  function handleChange(path9) {
205746
+ if (disposed)
205747
+ return;
205633
205748
  const source = getSourceForPath(path9);
205634
205749
  if (!source)
205635
205750
  return;
@@ -205639,19 +205754,24 @@ function handleChange(path9) {
205639
205754
  pendingDeletions.delete(path9);
205640
205755
  logForDebugging(`Cancelled pending deletion of ${path9} — file was recreated`);
205641
205756
  }
205642
- if (consumeInternalWrite(path9, INTERNAL_WRITE_WINDOW_MS)) {
205757
+ if (dependencies.consumeInternalWrite(path9, INTERNAL_WRITE_WINDOW_MS)) {
205643
205758
  return;
205644
205759
  }
205645
205760
  logForDebugging(`Detected change to ${path9}`);
205646
- executeConfigChangeHooks(settingSourceToConfigChangeSource(source), path9).then((results) => {
205647
- if (hasBlockingResult(results)) {
205761
+ const generation = nextSettingsSourceGeneration(source);
205762
+ dependencies.executeConfigChangeHooks(settingSourceToConfigChangeSource(source), path9).then((results) => {
205763
+ if (dependencies.hasBlockingResult(results)) {
205648
205764
  logForDebugging(`ConfigChange hook blocked change to ${path9}`);
205649
205765
  return;
205650
205766
  }
205651
- fanOut(source);
205767
+ if (disposed)
205768
+ return;
205769
+ scheduleFanOut(source, generation);
205652
205770
  });
205653
205771
  }
205654
205772
  function handleAdd(path9) {
205773
+ if (disposed)
205774
+ return;
205655
205775
  const source = getSourceForPath(path9);
205656
205776
  if (!source)
205657
205777
  return;
@@ -205664,31 +205784,38 @@ function handleAdd(path9) {
205664
205784
  handleChange(path9);
205665
205785
  }
205666
205786
  function handleDelete(path9) {
205787
+ if (disposed)
205788
+ return;
205667
205789
  const source = getSourceForPath(path9);
205668
205790
  if (!source)
205669
205791
  return;
205670
205792
  logForDebugging(`Detected deletion of ${path9}`);
205671
205793
  if (pendingDeletions.has(path9))
205672
205794
  return;
205673
- const timer = setTimeout((p, src) => {
205795
+ const generation = nextSettingsSourceGeneration(source);
205796
+ const timer = setTimeout((p, src, gen) => {
205797
+ if (disposed)
205798
+ return;
205674
205799
  pendingDeletions.delete(p);
205675
- executeConfigChangeHooks(settingSourceToConfigChangeSource(src), p).then((results) => {
205676
- if (hasBlockingResult(results)) {
205800
+ dependencies.executeConfigChangeHooks(settingSourceToConfigChangeSource(src), p).then((results) => {
205801
+ if (dependencies.hasBlockingResult(results)) {
205677
205802
  logForDebugging(`ConfigChange hook blocked deletion of ${p}`);
205678
205803
  return;
205679
205804
  }
205680
- fanOut(src);
205805
+ if (disposed)
205806
+ return;
205807
+ scheduleFanOut(src, gen);
205681
205808
  });
205682
- }, testOverrides?.deletionGrace ?? DELETION_GRACE_MS, path9, source);
205809
+ }, testOverrides?.deletionGrace ?? DELETION_GRACE_MS, path9, source, generation);
205683
205810
  pendingDeletions.set(path9, timer);
205684
205811
  }
205685
205812
  function getSourceForPath(path9) {
205686
205813
  const normalizedPath = platformPath.normalize(path9);
205687
- const dropInDir = getManagedSettingsDropInDir();
205814
+ const dropInDir = platformPath.normalize(dependencies.getManagedSettingsDropInDir());
205688
205815
  if (normalizedPath.startsWith(dropInDir + platformPath.sep)) {
205689
205816
  return "policySettings";
205690
205817
  }
205691
- return SETTING_SOURCES.find((source) => getSettingsFilePathForSource(source) === normalizedPath);
205818
+ return SETTING_SOURCES.find((source) => platformPath.normalize(dependencies.getSettingsFilePathForSource(source) ?? "") === normalizedPath);
205692
205819
  }
205693
205820
  function startMdmPoll() {
205694
205821
  const initial = getMdmSettings();
@@ -205723,9 +205850,46 @@ function startMdmPoll() {
205723
205850
  mdmPollTimer.unref();
205724
205851
  }
205725
205852
  function fanOut(source) {
205726
- resetSettingsCache();
205853
+ dependencies.resetSettingsCache();
205727
205854
  settingsChanged.emit(source);
205728
205855
  }
205856
+ function clearSettingsDebounce() {
205857
+ if (settingsDebounceTimer) {
205858
+ clearTimeout(settingsDebounceTimer);
205859
+ settingsDebounceTimer = null;
205860
+ }
205861
+ pendingSettingsSources.clear();
205862
+ }
205863
+ function nextSettingsSourceGeneration(source) {
205864
+ const generation = (settingsSourceGenerations.get(source) ?? 0) + 1;
205865
+ settingsSourceGenerations.set(source, generation);
205866
+ return generation;
205867
+ }
205868
+ function scheduleFanOut(source, generation) {
205869
+ if (disposed)
205870
+ return;
205871
+ if (settingsSourceGenerations.get(source) !== generation)
205872
+ return;
205873
+ pendingSettingsSources.set(source, generation);
205874
+ if (settingsDebounceTimer) {
205875
+ clearTimeout(settingsDebounceTimer);
205876
+ }
205877
+ settingsDebounceTimer = setTimeout(() => {
205878
+ settingsDebounceTimer = null;
205879
+ if (disposed) {
205880
+ pendingSettingsSources.clear();
205881
+ return;
205882
+ }
205883
+ const sources = [...pendingSettingsSources].flatMap(([src, generation2]) => settingsSourceGenerations.get(src) === generation2 ? [src] : []);
205884
+ pendingSettingsSources.clear();
205885
+ if (sources.length === 0)
205886
+ return;
205887
+ dependencies.resetSettingsCache();
205888
+ for (const src of sources) {
205889
+ settingsChanged.emit(src);
205890
+ }
205891
+ }, testOverrides?.settingsDebounce ?? SETTINGS_DEBOUNCE_MS);
205892
+ }
205729
205893
  function notifyChange(source) {
205730
205894
  logForDebugging(`Programmatic settings change notification for ${source}`);
205731
205895
  fanOut(source);
@@ -205738,6 +205902,8 @@ function resetForTesting(overrides) {
205738
205902
  for (const timer of pendingDeletions.values())
205739
205903
  clearTimeout(timer);
205740
205904
  pendingDeletions.clear();
205905
+ clearSettingsDebounce();
205906
+ settingsSourceGenerations.clear();
205741
205907
  lastMdmSnapshot = null;
205742
205908
  initialized2 = false;
205743
205909
  disposed = false;
@@ -205746,7 +205912,7 @@ function resetForTesting(overrides) {
205746
205912
  watcher2 = null;
205747
205913
  return w ? w.close() : Promise.resolve();
205748
205914
  }
205749
- var FILE_STABILITY_THRESHOLD_MS = 1000, FILE_STABILITY_POLL_INTERVAL_MS = 500, INTERNAL_WRITE_WINDOW_MS = 5000, MDM_POLL_INTERVAL_MS, DELETION_GRACE_MS, watcher2 = null, mdmPollTimer = null, lastMdmSnapshot = null, initialized2 = false, disposed = false, pendingDeletions, settingsChanged, testOverrides = null, subscribe, settingsChangeDetector;
205915
+ var FILE_STABILITY_THRESHOLD_MS = 1000, FILE_STABILITY_POLL_INTERVAL_MS = 500, INTERNAL_WRITE_WINDOW_MS = 5000, MDM_POLL_INTERVAL_MS, DELETION_GRACE_MS, SETTINGS_DEBOUNCE_MS = 500, watcher2 = null, mdmPollTimer = null, lastMdmSnapshot = null, initialized2 = false, disposed = false, pendingDeletions, settingsDebounceTimer = null, pendingSettingsSources, settingsSourceGenerations, settingsChanged, testOverrides = null, defaultDependencies, dependencies, subscribe, settingsChangeDetector;
205750
205916
  var init_changeDetector = __esm(() => {
205751
205917
  init_esm2();
205752
205918
  init_state();
@@ -205764,7 +205930,21 @@ var init_changeDetector = __esm(() => {
205764
205930
  MDM_POLL_INTERVAL_MS = 30 * 60 * 1000;
205765
205931
  DELETION_GRACE_MS = FILE_STABILITY_THRESHOLD_MS + FILE_STABILITY_POLL_INTERVAL_MS + 200;
205766
205932
  pendingDeletions = new Map;
205933
+ pendingSettingsSources = new Map;
205934
+ settingsSourceGenerations = new Map;
205767
205935
  settingsChanged = createSignal();
205936
+ defaultDependencies = {
205937
+ clearInternalWrites,
205938
+ consumeInternalWrite,
205939
+ executeConfigChangeHooks,
205940
+ getManagedSettingsDropInDir,
205941
+ getSettingsFilePathForSource,
205942
+ hasBlockingResult,
205943
+ resetSettingsCache,
205944
+ stat: stat10,
205945
+ watch: esm_default.watch.bind(esm_default)
205946
+ };
205947
+ dependencies = defaultDependencies;
205768
205948
  subscribe = settingsChanged.subscribe;
205769
205949
  settingsChangeDetector = {
205770
205950
  initialize,
@@ -207945,6 +208125,7 @@ function getDisableExtglobCommand(shellPath) {
207945
208125
  }
207946
208126
  async function createBashShellProvider(shellPath, options) {
207947
208127
  let currentSandboxTmpDir;
208128
+ const skipSnapshot = options?.skipSnapshot === true;
207948
208129
  const snapshotPromise = options?.skipSnapshot ? Promise.resolve(undefined) : createAndSaveSnapshot(shellPath).catch((error40) => {
207949
208130
  logForDebugging(`Failed to create shell snapshot: ${error40}`);
207950
208131
  return;
@@ -208000,7 +208181,7 @@ async function createBashShellProvider(shellPath, options) {
208000
208181
  return { commandString, cwdFilePath };
208001
208182
  },
208002
208183
  getSpawnArgs(commandString) {
208003
- const skipLoginShell = lastSnapshotFilePath !== undefined;
208184
+ const skipLoginShell = skipSnapshot || lastSnapshotFilePath !== undefined;
208004
208185
  if (skipLoginShell) {
208005
208186
  logForDebugging("Spawning shell without login (-l flag skipped)");
208006
208187
  }
@@ -208185,6 +208366,9 @@ async function findSuitableShell() {
208185
208366
  logForDebugging(`CLAUDE_CODE_SHELL="${shellOverride}" is not a valid bash/zsh path, falling back to detection`);
208186
208367
  }
208187
208368
  }
208369
+ if (getPlatform() === "windows") {
208370
+ return findGitBashPath();
208371
+ }
208188
208372
  const env_shell = process.env.SHELL;
208189
208373
  const isEnvShellSupported = env_shell && (env_shell.includes("bash") || env_shell.includes("zsh"));
208190
208374
  const preferBash = env_shell?.includes("bash");
@@ -208216,7 +208400,9 @@ async function findSuitableShell() {
208216
208400
  }
208217
208401
  async function getShellConfigImpl() {
208218
208402
  const binShell = await findSuitableShell();
208219
- const provider = await createBashShellProvider(binShell);
208403
+ const provider = await createBashShellProvider(binShell, {
208404
+ skipSnapshot: false
208405
+ });
208220
208406
  return { provider };
208221
208407
  }
208222
208408
  async function exec2(command, abortSignal, shellType, options) {
@@ -236719,7 +236905,7 @@ function computeFingerprint(messageText, version2) {
236719
236905
  }
236720
236906
  function computeFingerprintFromMessages(messages) {
236721
236907
  const firstMessageText = extractFirstMessageText(messages);
236722
- return computeFingerprint(firstMessageText, "0.14.9");
236908
+ return computeFingerprint(firstMessageText, "0.15.1");
236723
236909
  }
236724
236910
  var FINGERPRINT_SALT = "59cf53e54c78";
236725
236911
  var init_fingerprint = () => {};
@@ -236761,7 +236947,7 @@ async function sideQuery(opts) {
236761
236947
  betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
236762
236948
  }
236763
236949
  const messageText = extractFirstUserMessageText(messages);
236764
- const fingerprint = computeFingerprint(messageText, "0.14.9");
236950
+ const fingerprint = computeFingerprint(messageText, "0.15.1");
236765
236951
  const attributionHeader = getAttributionHeader(fingerprint);
236766
236952
  const systemBlocks = [
236767
236953
  attributionHeader ? { type: "text", text: attributionHeader } : null,
@@ -238006,7 +238192,7 @@ var init_client2 = __esm(() => {
238006
238192
  const client = new Client({
238007
238193
  name: "claude-code",
238008
238194
  title: "OpenClaude",
238009
- version: "0.14.9",
238195
+ version: "0.15.1",
238010
238196
  description: "OpenClaude — coding-agent CLI for any LLM provider",
238011
238197
  websiteUrl: PRODUCT_URL
238012
238198
  }, {
@@ -247041,6 +247227,16 @@ function getAttributionTexts() {
247041
247227
  }
247042
247228
  return { commit: "", pr: "" };
247043
247229
  }
247230
+ const settings = getInitialSettings();
247231
+ if (settings.attribution) {
247232
+ return {
247233
+ commit: settings.attribution.commit ?? "",
247234
+ pr: settings.attribution.pr ?? ""
247235
+ };
247236
+ }
247237
+ if (settings.includeCoAuthoredBy !== true) {
247238
+ return { commit: "", pr: "" };
247239
+ }
247044
247240
  const model2 = getMainLoopModel();
247045
247241
  const apiProvider = getAPIProvider();
247046
247242
  const modelName = getDefaultCommitCoAuthorName({
@@ -247048,22 +247244,11 @@ function getAttributionTexts() {
247048
247244
  apiProvider,
247049
247245
  isInternalRepo: isInternalModelRepoCached()
247050
247246
  });
247051
- const defaultAttribution = "\uD83E\uDD16 Generated with [OpenClaude](https://github.com/AndersonBY/openclaude)";
247052
247247
  const coAuthorEmail = getDefaultCommitCoAuthorEmail(apiProvider);
247053
247248
  const defaultCommit = isEnvTruthy(process.env.OPENCLAUDE_DISABLE_CO_AUTHORED_BY) ? "" : `Co-Authored-By: ${modelName} <${coAuthorEmail}>`;
247054
- const settings = getInitialSettings();
247055
- if (settings.attribution) {
247056
- return {
247057
- commit: settings.attribution.commit ?? defaultCommit,
247058
- pr: settings.attribution.pr ?? defaultAttribution
247059
- };
247060
- }
247061
- if (settings.includeCoAuthoredBy === false) {
247062
- return { commit: "", pr: "" };
247063
- }
247064
- return { commit: defaultCommit, pr: defaultAttribution };
247249
+ return { commit: defaultCommit, pr: DEFAULT_PR_ATTRIBUTION };
247065
247250
  }
247066
- var MEMORY_ACCESS_TOOL_NAMES;
247251
+ var DEFAULT_PR_ATTRIBUTION = "\uD83E\uDD16 Generated with [OpenClaude](https://github.com/AndersonBY/openclaude)", MEMORY_ACCESS_TOOL_NAMES;
247067
247252
  var init_attribution = __esm(() => {
247068
247253
  init_state();
247069
247254
  init_envUtils();
@@ -254882,12 +255067,23 @@ function getAgentModel(agentModel, parentModel, toolSpecifiedModel, permissionMo
254882
255067
  }
254883
255068
  return resolvedModel;
254884
255069
  };
254885
- if (toolSpecifiedModel) {
254886
- if (aliasMatchesParentTier(toolSpecifiedModel, parentModel)) {
255070
+ const trimmedToolSpecifiedModel = toolSpecifiedModel?.trim();
255071
+ if (trimmedToolSpecifiedModel) {
255072
+ if (trimmedToolSpecifiedModel.toLowerCase() === "inherit") {
255073
+ return getRuntimeMainLoopModel({
255074
+ permissionMode: permissionMode ?? "default",
255075
+ mainLoopModel: parentModel,
255076
+ exceeds200kTokens: false
255077
+ });
255078
+ }
255079
+ if (aliasMatchesParentTier(trimmedToolSpecifiedModel, parentModel)) {
255080
+ assertToolSpecifiedModelAllowed(trimmedToolSpecifiedModel, parentModel);
254887
255081
  return parentModel;
254888
255082
  }
254889
- const model3 = parseUserSpecifiedModel(toolSpecifiedModel);
254890
- return applyParentRegionPrefix(model3, toolSpecifiedModel);
255083
+ const model3 = parseUserSpecifiedModel(trimmedToolSpecifiedModel);
255084
+ const effectiveModel = applyParentRegionPrefix(model3, trimmedToolSpecifiedModel);
255085
+ assertToolSpecifiedModelAllowed(trimmedToolSpecifiedModel, effectiveModel);
255086
+ return effectiveModel;
254891
255087
  }
254892
255088
  const agentModelWithExp = agentModel ?? getDefaultSubagentModel();
254893
255089
  if ((agentModelWithExp === "haiku" || agentModelWithExp === "sonnet") && !checkIsClaudeNativeProvider()) {
@@ -254923,6 +255119,12 @@ function aliasMatchesParentTier(alias, parentModel) {
254923
255119
  return false;
254924
255120
  }
254925
255121
  }
255122
+ function assertToolSpecifiedModelAllowed(requestedModel, effectiveModel) {
255123
+ if (isModelAllowed(requestedModel) || effectiveModel !== requestedModel && isModelAllowed(effectiveModel)) {
255124
+ return;
255125
+ }
255126
+ throw new Error(`Model '${requestedModel}' is not available. Your organization restricts model selection.`);
255127
+ }
254926
255128
  function checkIsClaudeNativeProvider() {
254927
255129
  const provider = getAPIProvider();
254928
255130
  return provider === "bedrock" || provider === "vertex" || provider === "foundry" || provider === "firstParty" && isFirstPartyAnthropicBaseUrl();
@@ -254932,6 +255134,7 @@ var init_agent = __esm(() => {
254932
255134
  init_stringUtils();
254933
255135
  init_aliases();
254934
255136
  init_bedrock2();
255137
+ init_modelAllowlist();
254935
255138
  init_model();
254936
255139
  init_providers();
254937
255140
  AGENT_MODEL_OPTIONS = [...MODEL_ALIASES, "inherit"];
@@ -265870,7 +266073,7 @@ var init_AgentTool = __esm(() => {
265870
266073
  description: exports_external.string().describe("A short (3-5 word) description of the task"),
265871
266074
  prompt: exports_external.string().describe("The task for the agent to perform"),
265872
266075
  subagent_type: exports_external.string().optional().describe("The type of specialized agent to use for this task"),
265873
- model: exports_external.enum(["sonnet", "opus", "haiku"]).optional().describe("Optional model override for this agent. Takes precedence over the agent definition's model frontmatter. If omitted, uses the agent definition's model, or inherits from the parent."),
266076
+ model: exports_external.string().trim().min(1, "Model cannot be empty").optional().describe("Optional model override for this agent. Accepts aliases such as sonnet, opus, haiku, inherit, or a provider-supported model ID. Takes precedence over the agent definition's model frontmatter. If omitted, uses the agent definition's model, or inherits from the parent."),
265874
266077
  run_in_background: exports_external.boolean().optional().describe("Set to true to run this agent in the background. You will be notified when it completes.")
265875
266078
  }));
265876
266079
  fullInputSchema2 = lazySchema(() => {
@@ -265977,6 +266180,8 @@ var init_AgentTool = __esm(() => {
265977
266180
  if (agentDef?.color) {
265978
266181
  setAgentColor(subagent_type, agentDef.color);
265979
266182
  }
266183
+ const rawTeammateModel = model2 ?? agentDef?.model;
266184
+ const resolvedTeammateModel = rawTeammateModel === undefined ? undefined : getAgentModel(agentDef?.model, toolUseContext.options.mainLoopModel, model2, permissionMode);
265980
266185
  const result = await spawnTeammate({
265981
266186
  name,
265982
266187
  prompt,
@@ -265984,7 +266189,7 @@ var init_AgentTool = __esm(() => {
265984
266189
  team_name: teamName,
265985
266190
  use_splitpane: true,
265986
266191
  plan_mode_required: spawnMode === "plan",
265987
- model: model2 ?? agentDef?.model,
266192
+ model: resolvedTeammateModel,
265988
266193
  agent_type: subagent_type,
265989
266194
  invokingRequestId: assistantMessage2?.requestId
265990
266195
  }, toolUseContext);
@@ -313314,7 +313519,7 @@ function getAnthropicEnvMetadata() {
313314
313519
  function getBuildAgeMinutes() {
313315
313520
  if (false)
313316
313521
  ;
313317
- const buildTime = new Date("2026-05-26T10:36:28.963Z").getTime();
313522
+ const buildTime = new Date("2026-05-27T08:20:37.459Z").getTime();
313318
313523
  if (isNaN(buildTime))
313319
313524
  return;
313320
313525
  return Math.floor((Date.now() - buildTime) / 60000);
@@ -347217,7 +347422,7 @@ var init_sessionStorage = __esm(() => {
347217
347422
  init_settings2();
347218
347423
  init_slowOperations();
347219
347424
  init_uuid();
347220
- VERSION3 = typeof MACRO !== "undefined" ? "0.14.9" : "unknown";
347425
+ VERSION3 = typeof MACRO !== "undefined" ? "0.15.1" : "unknown";
347221
347426
  MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
347222
347427
  SKIP_FIRST_PROMPT_PATTERN2 = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
347223
347428
  EPHEMERAL_PROGRESS_TYPES = new Set([
@@ -348519,7 +348724,7 @@ var init_filesystem = __esm(() => {
348519
348724
  });
348520
348725
  getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
348521
348726
  const nonce = randomBytes7(16).toString("hex");
348522
- return join80(getClaudeTempDir(), "bundled-skills", "0.14.9", nonce);
348727
+ return join80(getClaudeTempDir(), "bundled-skills", "0.15.1", nonce);
348523
348728
  });
348524
348729
  getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
348525
348730
  });
@@ -355929,15 +356134,15 @@ ${deferredToolList}
355929
356134
  }
355930
356135
  }
355931
356136
  const maxOutputTokens2 = retryContext?.maxTokensOverride || options2.maxOutputTokensOverride || getMaxOutputTokensForModel(options2.model);
355932
- const hasThinking = thinkingConfig.type !== "disabled" && !isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_THINKING);
356137
+ const hasThinking = shouldUseThinkingForModel(retryContext.model, thinkingConfig);
355933
356138
  let thinking = undefined;
355934
- if (hasThinking && modelSupportsThinking(options2.model)) {
355935
- if (!isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING) && modelSupportsAdaptiveThinking(options2.model)) {
356139
+ if (hasThinking) {
356140
+ if (!isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING) && modelSupportsAdaptiveThinking(retryContext.model)) {
355936
356141
  thinking = {
355937
356142
  type: "adaptive"
355938
356143
  };
355939
356144
  } else {
355940
- let thinkingBudget = getMaxThinkingTokensForModel(options2.model);
356145
+ let thinkingBudget = getMaxThinkingTokensForModel(retryContext.model);
355941
356146
  if (thinkingConfig.type === "enabled" && thinkingConfig.budgetTokens !== undefined) {
355942
356147
  thinkingBudget = thinkingConfig.budgetTokens;
355943
356148
  }
@@ -363693,7 +363898,7 @@ function buildSystemInitMessage(inputs) {
363693
363898
  slash_commands: inputs.commands.filter((c7) => c7.userInvocable !== false).map((c7) => c7.name),
363694
363899
  apiKeySource: getAnthropicApiKeyWithSource().source,
363695
363900
  betas: getSdkBetas2(),
363696
- claude_code_version: "0.14.9",
363901
+ claude_code_version: "0.15.1",
363697
363902
  output_style: outputStyle,
363698
363903
  agents: inputs.agents.map((agent2) => agent2.agentType),
363699
363904
  skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
@@ -364628,6 +364833,9 @@ function preconnectAnthropicApi() {
364628
364833
  if (fired)
364629
364834
  return;
364630
364835
  fired = true;
364836
+ if (isEnvTruthy(process.env.CLAUDE_CODE_USE_OPENAI) || isEnvTruthy(process.env.CLAUDE_CODE_USE_GEMINI) || isEnvTruthy(process.env.CLAUDE_CODE_USE_GITHUB) || isEnvTruthy(process.env.CLAUDE_CODE_USE_MISTRAL)) {
364837
+ return;
364838
+ }
364631
364839
  if (getAPIProvider() !== "firstParty") {
364632
364840
  return;
364633
364841
  }
@@ -367745,4 +367953,4 @@ export {
367745
367953
  AbortError
367746
367954
  };
367747
367955
 
367748
- //# debugId=FA2711202E59EAD264756E2164756E21
367956
+ //# debugId=FD5D1A6CE219B45864756E2164756E21