@rayss-dev/openclaude 0.28.0-by-rayss → 0.28.1-by-rayss

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/sdk.mjs CHANGED
@@ -17092,7 +17092,7 @@ var init_version = __esm(() => {
17092
17092
  import_semver = __toESM(require_semver2(), 1);
17093
17093
  fallbackBuildVersion = (() => {
17094
17094
  try {
17095
- return "0.28.0-by-rayss";
17095
+ return "0.28.1-by-rayss";
17096
17096
  } catch {
17097
17097
  return "0.0.0";
17098
17098
  }
@@ -63843,6 +63843,10 @@ var init_types2 = __esm(() => {
63843
63843
  contextWindow: exports_external.number().int().positive().optional().describe("Total context window size in tokens."),
63844
63844
  maxOutputTokens: exports_external.number().int().positive().optional().describe("Maximum output tokens per response.")
63845
63845
  })).optional().describe("Per-model overrides for context window and max output tokens. " + "Used for OpenAI-compatible models whose limits are not in the built-in catalog. " + "Keys are matched against the model name (exact match preferred, then prefix). " + "CLAUDE_CODE_OPENAI_CONTEXT_WINDOWS / CLAUDE_CODE_OPENAI_MAX_OUTPUT_TOKENS env vars take precedence. " + 'Example: { "qwen3.6-plus": { "contextWindow": 1048576, "maxOutputTokens": 32768 } }'),
63846
+ apiRetry: exports_external.object({
63847
+ maxRetries: exports_external.union([exports_external.number().int().nonnegative(), exports_external.literal("unlimited")]).optional().describe("How many times a retryable request is retried (rate limits like 429, " + "capacity 529, 5xx, transient network errors). Set 0 to never retry, " + 'any positive integer, or "unlimited" to keep retrying (with the fixed ' + "delayMs below) until the request succeeds or you cancel. " + "When unset, the OPENCLAUDE_MAX_RETRIES env var is used (default 10)."),
63848
+ delayMs: exports_external.number().int().nonnegative().optional().describe("Fixed delay in milliseconds between retry attempts when this is set. " + "Set 5000 for 5 seconds, or 0 to retry immediately. A server-provided " + "Retry-After that is even longer is still honored. When unset, the " + "default exponential backoff (and OPENCLAUDE_RETRY_DELAY_MS env var) apply.")
63849
+ }).optional().describe("Network retry policy. Use this to tune how OpenClaude handles rate limits " + "(429), capacity issues (529) and transient errors — including unlimited " + "retrying with a fixed delay to ride out a persistent rate limit."),
63846
63850
  fastMode: exports_external.boolean().optional().describe("When true, fast mode is enabled. When absent or false, fast mode is off."),
63847
63851
  fastModePerSessionOptIn: exports_external.boolean().optional().describe("When true, fast mode does not persist across sessions. Each session starts with fast mode off."),
63848
63852
  promptSuggestionEnabled: exports_external.boolean().optional().describe("When false, prompt suggestions are disabled. When absent or true, " + "prompt suggestions are enabled."),
@@ -65900,10 +65904,9 @@ function resolveModelRuntimeLimits(options) {
65900
65904
  const externalContextWindow = getOpenAIContextWindowMatches(modelApiName, runtimeEnv);
65901
65905
  const externalMaxOutputTokens = getOpenAIMaxOutputTokenMatches(modelApiName, runtimeEnv);
65902
65906
  const settings = getInitialSettings();
65903
- const resolvedWindow = externalContextWindow.exact ?? catalogEntry3?.contextWindow ?? cachedCatalogEntry?.contextWindow ?? externalContextWindow.prefix ?? externalContextWindow.settings ?? modelDescriptor?.contextWindow;
65904
- const contextWindow = settings.maxContextWindow !== undefined && resolvedWindow !== undefined ? Math.min(settings.maxContextWindow, resolvedWindow) : settings.maxContextWindow ?? resolvedWindow;
65907
+ const resolvedWindow = settings.maxContextWindow !== undefined ? settings.maxContextWindow : externalContextWindow.exact ?? catalogEntry3?.contextWindow ?? cachedCatalogEntry?.contextWindow ?? externalContextWindow.prefix ?? externalContextWindow.settings ?? modelDescriptor?.contextWindow;
65905
65908
  return {
65906
- contextWindow,
65909
+ contextWindow: resolvedWindow,
65907
65910
  maxOutputTokens: externalMaxOutputTokens.exact ?? catalogEntry3?.maxOutputTokens ?? cachedCatalogEntry?.maxOutputTokens ?? externalMaxOutputTokens.prefix ?? externalMaxOutputTokens.settings ?? modelDescriptor?.maxOutputTokens
65908
65911
  };
65909
65912
  }
@@ -66947,7 +66950,7 @@ function getAttributionHeader(fingerprint) {
66947
66950
  if (!isAttributionHeaderEnabled()) {
66948
66951
  return "";
66949
66952
  }
66950
- const version2 = `${"0.28.0-by-rayss"}.${fingerprint}`;
66953
+ const version2 = `${"0.28.1-by-rayss"}.${fingerprint}`;
66951
66954
  const entrypoint = process.env.CLAUDE_CODE_ENTRYPOINT ?? "unknown";
66952
66955
  const cch = "";
66953
66956
  const workload = getWorkload();
@@ -100277,7 +100280,7 @@ var init_metadata = __esm(() => {
100277
100280
  COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
100278
100281
  WHITESPACE_REGEX = /\s+/;
100279
100282
  getVersionBase = memoize_default(() => {
100280
- const match = "0.28.0-by-rayss".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
100283
+ const match = "0.28.1-by-rayss".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
100281
100284
  return match ? match[0] : undefined;
100282
100285
  });
100283
100286
  buildEnvContext = memoize_default(async () => {
@@ -100317,9 +100320,9 @@ var init_metadata = __esm(() => {
100317
100320
  isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
100318
100321
  isClaudeCodeAction: isEnvTruthy(process.env.CLAUDE_CODE_ACTION),
100319
100322
  isClaudeAiAuth: isClaudeAISubscriber(),
100320
- version: "0.28.0-by-rayss",
100323
+ version: "0.28.1-by-rayss",
100321
100324
  versionBase: getVersionBase(),
100322
- buildTime: "2026-08-11T18:21:58.775Z",
100325
+ buildTime: "2026-08-13T14:38:49.133Z",
100323
100326
  deploymentEnvironment: env2.detectDeploymentEnvironment(),
100324
100327
  ...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
100325
100328
  githubEventName: process.env.GITHUB_EVENT_NAME,
@@ -108980,7 +108983,7 @@ var init_effort = __esm(() => {
108980
108983
 
108981
108984
  // src/utils/userAgent.ts
108982
108985
  function getClaudeCodeUserAgent() {
108983
- return `claude-code/${"0.28.0-by-rayss"}`;
108986
+ return `claude-code/${"0.28.1-by-rayss"}`;
108984
108987
  }
108985
108988
 
108986
108989
  // src/utils/http.ts
@@ -108989,7 +108992,7 @@ function getUserAgent() {
108989
108992
  const clientApp = process.env.CLAUDE_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}` : "";
108990
108993
  const workload = getWorkload();
108991
108994
  const workloadSuffix = workload ? `, workload/${workload}` : "";
108992
- return `claude-cli/${"0.28.0-by-rayss"} (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
108995
+ return `claude-cli/${"0.28.1-by-rayss"} (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
108993
108996
  }
108994
108997
  function getMCPUserAgent() {
108995
108998
  const parts = [];
@@ -109003,7 +109006,7 @@ function getMCPUserAgent() {
109003
109006
  parts.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`);
109004
109007
  }
109005
109008
  const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
109006
- return `claude-code/${"0.28.0-by-rayss"}${suffix}`;
109009
+ return `claude-code/${"0.28.1-by-rayss"}${suffix}`;
109007
109010
  }
109008
109011
  function getWebFetchUserAgent() {
109009
109012
  const supportUrl = isFirstPartyAnthropicProvider() ? "https://support.anthropic.com/" : "https://github.com/rayss868/openclaude";
@@ -120140,141 +120143,6 @@ var init_rateLimitMocking = __esm(() => {
120140
120143
  init_mockRateLimits();
120141
120144
  });
120142
120145
 
120143
- // src/services/api/errorUtils.ts
120144
- function extractConnectionErrorDetails(error40) {
120145
- if (!error40 || typeof error40 !== "object") {
120146
- return null;
120147
- }
120148
- let current = error40;
120149
- const maxDepth = 5;
120150
- let depth = 0;
120151
- while (current && depth < maxDepth) {
120152
- if (current instanceof Error && "code" in current && typeof current.code === "string") {
120153
- const code = current.code;
120154
- const isSSLError = SSL_ERROR_CODES.has(code);
120155
- return {
120156
- code,
120157
- message: current.message,
120158
- isSSLError
120159
- };
120160
- }
120161
- if (current instanceof Error && "cause" in current && current.cause !== current) {
120162
- current = current.cause;
120163
- depth++;
120164
- } else {
120165
- break;
120166
- }
120167
- }
120168
- return null;
120169
- }
120170
- function sanitizeMessageHTML(message) {
120171
- if (message.includes("<!DOCTYPE html") || message.includes("<html")) {
120172
- const titleMatch = message.match(/<title>([^<]+)<\/title>/);
120173
- if (titleMatch && titleMatch[1]) {
120174
- return titleMatch[1].trim();
120175
- }
120176
- return "";
120177
- }
120178
- return message;
120179
- }
120180
- function sanitizeAPIError(apiError) {
120181
- const message = apiError.message;
120182
- if (!message) {
120183
- return "";
120184
- }
120185
- return sanitizeMessageHTML(message);
120186
- }
120187
- function hasNestedError(value) {
120188
- return typeof value === "object" && value !== null && "error" in value && typeof value.error === "object" && value.error !== null;
120189
- }
120190
- function extractNestedErrorMessage(error40) {
120191
- if (!hasNestedError(error40)) {
120192
- return null;
120193
- }
120194
- const narrowed = error40;
120195
- const nested = narrowed.error;
120196
- const deepMsg = nested?.error?.message;
120197
- if (typeof deepMsg === "string" && deepMsg.length > 0) {
120198
- const sanitized = sanitizeMessageHTML(deepMsg);
120199
- if (sanitized.length > 0) {
120200
- return sanitized;
120201
- }
120202
- }
120203
- const msg = nested?.message;
120204
- if (typeof msg === "string" && msg.length > 0) {
120205
- const sanitized = sanitizeMessageHTML(msg);
120206
- if (sanitized.length > 0) {
120207
- return sanitized;
120208
- }
120209
- }
120210
- return null;
120211
- }
120212
- function formatAPIError(error40) {
120213
- const connectionDetails = extractConnectionErrorDetails(error40);
120214
- if (connectionDetails) {
120215
- const { code, isSSLError } = connectionDetails;
120216
- if (code === "ETIMEDOUT") {
120217
- return "Request timed out. Check your internet connection and proxy settings";
120218
- }
120219
- if (isSSLError) {
120220
- switch (code) {
120221
- case "UNABLE_TO_VERIFY_LEAF_SIGNATURE":
120222
- case "UNABLE_TO_GET_ISSUER_CERT":
120223
- case "UNABLE_TO_GET_ISSUER_CERT_LOCALLY":
120224
- return "Unable to connect to API: SSL certificate verification failed. Check your proxy or corporate SSL certificates";
120225
- case "CERT_HAS_EXPIRED":
120226
- return "Unable to connect to API: SSL certificate has expired";
120227
- case "CERT_REVOKED":
120228
- return "Unable to connect to API: SSL certificate has been revoked";
120229
- case "DEPTH_ZERO_SELF_SIGNED_CERT":
120230
- case "SELF_SIGNED_CERT_IN_CHAIN":
120231
- return "Unable to connect to API: Self-signed certificate detected. Check your proxy or corporate SSL certificates";
120232
- case "ERR_TLS_CERT_ALTNAME_INVALID":
120233
- case "HOSTNAME_MISMATCH":
120234
- return "Unable to connect to API: SSL certificate hostname mismatch";
120235
- case "CERT_NOT_YET_VALID":
120236
- return "Unable to connect to API: SSL certificate is not yet valid";
120237
- default:
120238
- return `Unable to connect to API: SSL error (${code})`;
120239
- }
120240
- }
120241
- }
120242
- if (error40.message === "Connection error.") {
120243
- if (connectionDetails?.code) {
120244
- return `Unable to connect to API (${connectionDetails.code})`;
120245
- }
120246
- return "Unable to connect to API. Check your internet connection";
120247
- }
120248
- if (!error40.message) {
120249
- return extractNestedErrorMessage(error40) ?? `API error (status ${error40.status ?? "unknown"})`;
120250
- }
120251
- const sanitizedMessage = sanitizeAPIError(error40);
120252
- return sanitizedMessage !== error40.message && sanitizedMessage.length > 0 ? sanitizedMessage : error40.message;
120253
- }
120254
- var SSL_ERROR_CODES;
120255
- var init_errorUtils = __esm(() => {
120256
- SSL_ERROR_CODES = new Set([
120257
- "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
120258
- "UNABLE_TO_GET_ISSUER_CERT",
120259
- "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
120260
- "CERT_SIGNATURE_FAILURE",
120261
- "CERT_NOT_YET_VALID",
120262
- "CERT_HAS_EXPIRED",
120263
- "CERT_REVOKED",
120264
- "CERT_REJECTED",
120265
- "CERT_UNTRUSTED",
120266
- "DEPTH_ZERO_SELF_SIGNED_CERT",
120267
- "SELF_SIGNED_CERT_IN_CHAIN",
120268
- "CERT_CHAIN_TOO_LONG",
120269
- "PATH_LENGTH_EXCEEDED",
120270
- "ERR_TLS_CERT_ALTNAME_INVALID",
120271
- "HOSTNAME_MISMATCH",
120272
- "ERR_TLS_HANDSHAKE_TIMEOUT",
120273
- "ERR_SSL_WRONG_VERSION_NUMBER",
120274
- "ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC"
120275
- ]);
120276
- });
120277
-
120278
120146
  // src/services/api/openaiErrorClassification.ts
120279
120147
  function markOpenAIRequestNonReplayable(error40) {
120280
120148
  Object.defineProperty(error40, NON_REPLAYABLE_OPENAI_REQUEST, {
@@ -120648,13 +120516,6 @@ function isQuotaExhausted(error40) {
120648
120516
  function isTransientCapacityError(error40) {
120649
120517
  return is529Error(error40) || error40 instanceof APIError2 && error40.status === 429;
120650
120518
  }
120651
- function isStaleConnectionError(error40) {
120652
- if (!(error40 instanceof APIConnectionError)) {
120653
- return false;
120654
- }
120655
- const details = extractConnectionErrorDetails(error40);
120656
- return details?.code === "ECONNRESET" || details?.code === "EPIPE";
120657
- }
120658
120519
  async function* withRetry(getClient, operation, options) {
120659
120520
  const maxRetries = getMaxRetries(options);
120660
120521
  const persistentRetryEnabled = isPersistentRetryEnabled();
@@ -120679,12 +120540,11 @@ async function* withRetry(getClient, operation, options) {
120679
120540
  throw mockError;
120680
120541
  }
120681
120542
  }
120682
- const isStaleConnection = isStaleConnectionError(lastError);
120683
- if (isStaleConnection && getFeatureValue_CACHED_MAY_BE_STALE("tengu_disable_keepalive_on_econnreset", false)) {
120684
- logForDebugging("Stale connection (ECONNRESET/EPIPE) — disabling keep-alive for retry");
120543
+ if (lastError != null) {
120544
+ logForDebugging(`Dropping pooled connection for retry ${attempt} — using a fresh client/socket`);
120685
120545
  disableKeepAlive();
120686
120546
  }
120687
- if (client === null || lastError instanceof APIError2 && lastError.status === 401 || isOAuthTokenRevokedError(lastError) || isBedrockAuthError(lastError) || isVertexAuthError(lastError) || isStaleConnection) {
120547
+ if (client === null || lastError != null) {
120688
120548
  if (lastError instanceof APIError2 && lastError.status === 401 || isOAuthTokenRevokedError(lastError)) {
120689
120549
  const failedAccessToken = getClaudeAIOAuthTokens()?.accessToken;
120690
120550
  if (failedAccessToken) {
@@ -120829,7 +120689,14 @@ async function* withRetry(getClient, operation, options) {
120829
120689
  persistentAttempt++;
120830
120690
  delayMs = Math.min(getRetryDelay(persistentAttempt, retryAfter, PERSISTENT_MAX_BACKOFF_MS), PERSISTENT_RESET_CAP_MS);
120831
120691
  } else {
120832
- delayMs = getRetryDelay(attempt, retryAfter);
120692
+ const fixedDelayMs = getConfiguredRetryDelayMs();
120693
+ if (fixedDelayMs !== null) {
120694
+ const seconds = retryAfter ? parseInt(retryAfter, 10) : NaN;
120695
+ const retryAfterMs = isNaN(seconds) ? null : seconds * 1000;
120696
+ delayMs = resolveRetryDelayMs(fixedDelayMs, retryAfterMs);
120697
+ } else {
120698
+ delayMs = getRetryDelay(attempt, retryAfter);
120699
+ }
120833
120700
  }
120834
120701
  const reportedAttempt = persistent ? persistentAttempt : attempt;
120835
120702
  logEvent("tengu_api_retry", {
@@ -121047,7 +120914,20 @@ function shouldRetry(error40, persistentRetryEnabled) {
121047
120914
  return true;
121048
120915
  return false;
121049
120916
  }
120917
+ function apiRetryMaxRetriesToNumber(configured) {
120918
+ if (configured === undefined)
120919
+ return;
120920
+ return configured === "unlimited" ? Number.POSITIVE_INFINITY : configured;
120921
+ }
120922
+ function resolveRetryDelayMs(fixedDelayMs, retryAfterMs) {
120923
+ if (fixedDelayMs === null)
120924
+ return null;
120925
+ return retryAfterMs !== null && retryAfterMs > fixedDelayMs ? retryAfterMs : fixedDelayMs;
120926
+ }
121050
120927
  function getDefaultMaxRetries() {
120928
+ const configuredMax = apiRetryMaxRetriesToNumber(getApiRetrySettings()?.maxRetries);
120929
+ if (configuredMax !== undefined)
120930
+ return configuredMax;
121051
120931
  const openClaudeMaxRetries = process.env.OPENCLAUDE_MAX_RETRIES;
121052
120932
  if (openClaudeMaxRetries) {
121053
120933
  return validateRetryAttemptsEnvVar("OPENCLAUDE_MAX_RETRIES", openClaudeMaxRetries);
@@ -121059,6 +120939,13 @@ function getDefaultMaxRetries() {
121059
120939
  }
121060
120940
  return DEFAULT_MAX_RETRIES;
121061
120941
  }
120942
+ function getApiRetrySettings() {
120943
+ return getInitialSettings().apiRetry;
120944
+ }
120945
+ function getConfiguredRetryDelayMs() {
120946
+ const delayMs = getApiRetrySettings()?.delayMs;
120947
+ return typeof delayMs === "number" && Number.isFinite(delayMs) && delayMs >= 0 ? delayMs : null;
120948
+ }
121062
120949
  function getDefaultRetryDelayMs() {
121063
120950
  return validateBoundedIntEnvVar("OPENCLAUDE_RETRY_DELAY_MS", process.env.OPENCLAUDE_RETRY_DELAY_MS, DEFAULT_RETRY_DELAY_MS, MAX_RETRY_DELAY_BASE_MS).effective;
121064
120951
  }
@@ -121138,6 +121025,7 @@ var init_withRetry = __esm(() => {
121138
121025
  init_log2();
121139
121026
  init_messages();
121140
121027
  init_providers();
121028
+ init_settings2();
121141
121029
  init_auth();
121142
121030
  init_envUtils();
121143
121031
  init_envValidation();
@@ -121145,10 +121033,8 @@ var init_withRetry = __esm(() => {
121145
121033
  init_fastMode();
121146
121034
  init_model();
121147
121035
  init_proxy();
121148
- init_growthbook();
121149
121036
  init_rateLimitMocking();
121150
121037
  init_errors4();
121151
- init_errorUtils();
121152
121038
  init_openaiErrorClassification();
121153
121039
  FOREGROUND_529_RETRY_SOURCES = new Set([
121154
121040
  "repl_main_thread",
@@ -149535,7 +149421,7 @@ function computeFingerprint(messageText, version2) {
149535
149421
  }
149536
149422
  function computeFingerprintFromMessages(messages) {
149537
149423
  const firstMessageText = extractFirstMessageText(messages);
149538
- return computeFingerprint(firstMessageText, "0.28.0-by-rayss");
149424
+ return computeFingerprint(firstMessageText, "0.28.1-by-rayss");
149539
149425
  }
149540
149426
  var FINGERPRINT_SALT = "59cf53e54c78";
149541
149427
  var init_fingerprint = () => {};
@@ -149577,7 +149463,7 @@ async function sideQuery(opts) {
149577
149463
  betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
149578
149464
  }
149579
149465
  const messageText = extractFirstUserMessageText(messages);
149580
- const fingerprint = computeFingerprint(messageText, "0.28.0-by-rayss");
149466
+ const fingerprint = computeFingerprint(messageText, "0.28.1-by-rayss");
149581
149467
  const attributionHeader = getAttributionHeader(fingerprint);
149582
149468
  const systemBlocks = [
149583
149469
  attributionHeader ? { type: "text", text: attributionHeader } : null,
@@ -150897,7 +150783,7 @@ var init_client2 = __esm(() => {
150897
150783
  const client = new Client({
150898
150784
  name: "claude-code",
150899
150785
  title: "OpenClaude",
150900
- version: "0.28.0-by-rayss",
150786
+ version: "0.28.1-by-rayss",
150901
150787
  description: "OpenClaude — coding-agent CLI for any LLM provider",
150902
150788
  websiteUrl: PRODUCT_URL
150903
150789
  }, {
@@ -227968,6 +227854,141 @@ var init_emptyUsage = __esm(() => {
227968
227854
  };
227969
227855
  });
227970
227856
 
227857
+ // src/services/api/errorUtils.ts
227858
+ function extractConnectionErrorDetails(error40) {
227859
+ if (!error40 || typeof error40 !== "object") {
227860
+ return null;
227861
+ }
227862
+ let current = error40;
227863
+ const maxDepth = 5;
227864
+ let depth = 0;
227865
+ while (current && depth < maxDepth) {
227866
+ if (current instanceof Error && "code" in current && typeof current.code === "string") {
227867
+ const code = current.code;
227868
+ const isSSLError = SSL_ERROR_CODES.has(code);
227869
+ return {
227870
+ code,
227871
+ message: current.message,
227872
+ isSSLError
227873
+ };
227874
+ }
227875
+ if (current instanceof Error && "cause" in current && current.cause !== current) {
227876
+ current = current.cause;
227877
+ depth++;
227878
+ } else {
227879
+ break;
227880
+ }
227881
+ }
227882
+ return null;
227883
+ }
227884
+ function sanitizeMessageHTML(message) {
227885
+ if (message.includes("<!DOCTYPE html") || message.includes("<html")) {
227886
+ const titleMatch = message.match(/<title>([^<]+)<\/title>/);
227887
+ if (titleMatch && titleMatch[1]) {
227888
+ return titleMatch[1].trim();
227889
+ }
227890
+ return "";
227891
+ }
227892
+ return message;
227893
+ }
227894
+ function sanitizeAPIError(apiError) {
227895
+ const message = apiError.message;
227896
+ if (!message) {
227897
+ return "";
227898
+ }
227899
+ return sanitizeMessageHTML(message);
227900
+ }
227901
+ function hasNestedError(value) {
227902
+ return typeof value === "object" && value !== null && "error" in value && typeof value.error === "object" && value.error !== null;
227903
+ }
227904
+ function extractNestedErrorMessage(error40) {
227905
+ if (!hasNestedError(error40)) {
227906
+ return null;
227907
+ }
227908
+ const narrowed = error40;
227909
+ const nested = narrowed.error;
227910
+ const deepMsg = nested?.error?.message;
227911
+ if (typeof deepMsg === "string" && deepMsg.length > 0) {
227912
+ const sanitized = sanitizeMessageHTML(deepMsg);
227913
+ if (sanitized.length > 0) {
227914
+ return sanitized;
227915
+ }
227916
+ }
227917
+ const msg = nested?.message;
227918
+ if (typeof msg === "string" && msg.length > 0) {
227919
+ const sanitized = sanitizeMessageHTML(msg);
227920
+ if (sanitized.length > 0) {
227921
+ return sanitized;
227922
+ }
227923
+ }
227924
+ return null;
227925
+ }
227926
+ function formatAPIError(error40) {
227927
+ const connectionDetails = extractConnectionErrorDetails(error40);
227928
+ if (connectionDetails) {
227929
+ const { code, isSSLError } = connectionDetails;
227930
+ if (code === "ETIMEDOUT") {
227931
+ return "Request timed out. Check your internet connection and proxy settings";
227932
+ }
227933
+ if (isSSLError) {
227934
+ switch (code) {
227935
+ case "UNABLE_TO_VERIFY_LEAF_SIGNATURE":
227936
+ case "UNABLE_TO_GET_ISSUER_CERT":
227937
+ case "UNABLE_TO_GET_ISSUER_CERT_LOCALLY":
227938
+ return "Unable to connect to API: SSL certificate verification failed. Check your proxy or corporate SSL certificates";
227939
+ case "CERT_HAS_EXPIRED":
227940
+ return "Unable to connect to API: SSL certificate has expired";
227941
+ case "CERT_REVOKED":
227942
+ return "Unable to connect to API: SSL certificate has been revoked";
227943
+ case "DEPTH_ZERO_SELF_SIGNED_CERT":
227944
+ case "SELF_SIGNED_CERT_IN_CHAIN":
227945
+ return "Unable to connect to API: Self-signed certificate detected. Check your proxy or corporate SSL certificates";
227946
+ case "ERR_TLS_CERT_ALTNAME_INVALID":
227947
+ case "HOSTNAME_MISMATCH":
227948
+ return "Unable to connect to API: SSL certificate hostname mismatch";
227949
+ case "CERT_NOT_YET_VALID":
227950
+ return "Unable to connect to API: SSL certificate is not yet valid";
227951
+ default:
227952
+ return `Unable to connect to API: SSL error (${code})`;
227953
+ }
227954
+ }
227955
+ }
227956
+ if (error40.message === "Connection error.") {
227957
+ if (connectionDetails?.code) {
227958
+ return `Unable to connect to API (${connectionDetails.code})`;
227959
+ }
227960
+ return "Unable to connect to API. Check your internet connection";
227961
+ }
227962
+ if (!error40.message) {
227963
+ return extractNestedErrorMessage(error40) ?? `API error (status ${error40.status ?? "unknown"})`;
227964
+ }
227965
+ const sanitizedMessage = sanitizeAPIError(error40);
227966
+ return sanitizedMessage !== error40.message && sanitizedMessage.length > 0 ? sanitizedMessage : error40.message;
227967
+ }
227968
+ var SSL_ERROR_CODES;
227969
+ var init_errorUtils = __esm(() => {
227970
+ SSL_ERROR_CODES = new Set([
227971
+ "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
227972
+ "UNABLE_TO_GET_ISSUER_CERT",
227973
+ "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
227974
+ "CERT_SIGNATURE_FAILURE",
227975
+ "CERT_NOT_YET_VALID",
227976
+ "CERT_HAS_EXPIRED",
227977
+ "CERT_REVOKED",
227978
+ "CERT_REJECTED",
227979
+ "CERT_UNTRUSTED",
227980
+ "DEPTH_ZERO_SELF_SIGNED_CERT",
227981
+ "SELF_SIGNED_CERT_IN_CHAIN",
227982
+ "CERT_CHAIN_TOO_LONG",
227983
+ "PATH_LENGTH_EXCEEDED",
227984
+ "ERR_TLS_CERT_ALTNAME_INVALID",
227985
+ "HOSTNAME_MISMATCH",
227986
+ "ERR_TLS_HANDSHAKE_TIMEOUT",
227987
+ "ERR_SSL_WRONG_VERSION_NUMBER",
227988
+ "ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC"
227989
+ ]);
227990
+ });
227991
+
227971
227992
  // src/services/api/logging.ts
227972
227993
  import { APIError as APIError3 } from "@anthropic-ai/sdk";
227973
227994
  function getErrorMessage2(error40) {
@@ -228019,7 +228040,7 @@ function getAnthropicEnvMetadata() {
228019
228040
  function getBuildAgeMinutes() {
228020
228041
  if (false)
228021
228042
  ;
228022
- const buildTime = new Date("2026-08-11T18:21:58.775Z").getTime();
228043
+ const buildTime = new Date("2026-08-13T14:38:49.133Z").getTime();
228023
228044
  if (isNaN(buildTime))
228024
228045
  return;
228025
228046
  return Math.floor((Date.now() - buildTime) / 60000);
@@ -258593,7 +258614,7 @@ var init_sessionStorage = __esm(() => {
258593
258614
  init_slowOperations();
258594
258615
  init_transcriptFileLock();
258595
258616
  init_uuid();
258596
- VERSION3 = typeof MACRO !== "undefined" ? "0.28.0-by-rayss" : "unknown";
258617
+ VERSION3 = typeof MACRO !== "undefined" ? "0.28.1-by-rayss" : "unknown";
258597
258618
  MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
258598
258619
  TRANSCRIPT_COPY_CHUNK_BYTES = 64 * 1024;
258599
258620
  transcriptRewriteHooksForTesting = {};
@@ -260060,7 +260081,7 @@ var init_filesystem = __esm(() => {
260060
260081
  });
260061
260082
  getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
260062
260083
  const nonce = randomBytes10(16).toString("hex");
260063
- return join86(getClaudeTempDir(), "bundled-skills", "0.28.0-by-rayss", nonce);
260084
+ return join86(getClaudeTempDir(), "bundled-skills", "0.28.1-by-rayss", nonce);
260064
260085
  });
260065
260086
  getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
260066
260087
  });
@@ -274456,7 +274477,7 @@ function buildSystemInitMessage(inputs) {
274456
274477
  slash_commands: inputs.commands.filter((c7) => c7.userInvocable !== false).map((c7) => c7.name),
274457
274478
  apiKeySource: getAnthropicApiKeyWithSource().source,
274458
274479
  betas: getSdkBetas(),
274459
- claude_code_version: "0.28.0-by-rayss",
274480
+ claude_code_version: "0.28.1-by-rayss",
274460
274481
  output_style: outputStyle,
274461
274482
  agents: inputs.agents.map((agent) => agent.agentType),
274462
274483
  skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
@@ -278922,4 +278943,4 @@ export {
278922
278943
  AbortError
278923
278944
  };
278924
278945
 
278925
- //# debugId=C4DBF29BD916482664756E2164756E21
278946
+ //# debugId=F48A846A1F06A7D464756E2164756E21
@@ -60,7 +60,7 @@ Optional tuning fields: `simpleMaxChars`, `simpleMaxWords`.
60
60
 
61
61
  ### `maxContextWindow` (number)
62
62
 
63
- Global override for the max context window in tokens, applied to all models. This takes the highest precedence — above per-model `modelLimits`, environment variables, and catalog limits.
63
+ Global override for the max context window in tokens, applied to all models. This is an explicit override: it wins over env vars, the catalog/discovery cache, and descriptor defaults, and can raise or lower the effective limit. If unset, the normal resolution chain applies.
64
64
 
65
65
  ```json
66
66
  {
@@ -80,6 +80,26 @@ Per-model overrides for `contextWindow` and `maxOutputTokens`. Used for OpenAI-c
80
80
  }
81
81
  ```
82
82
 
83
+ ### `apiRetry` (object)
84
+
85
+ Network retry policy for transient errors (rate limits `429`, capacity `529`, `5xx`, and brief network failure). Use it to control both how many times a `429` is retried and how long to wait between attempts. Both sub-fields can also be edited interactively from `/config`.
86
+
87
+ - `maxRetries`: number of retry attempts, `0` to never retry, or `"unlimited"` to keep retrying until the request succeeds (or you cancel). Default is `10` when unset.
88
+ - `delayMs`: fixed milliseconds to wait between retries, e.g. `5000` for 5 seconds, or `0` to retry immediately. When set, it replaces the default exponential backoff. A server-provided `Retry-After` longer than this is still honored.
89
+
90
+ ```json
91
+ {
92
+ "apiRetry": {
93
+ "maxRetries": "unlimited",
94
+ "delayMs": 5000
95
+ }
96
+ }
97
+ ```
98
+
99
+ The `OPENCLAUDE_MAX_RETRIES` / `OPENCLAUDE_RETRY_DELAY_MS` env vars are used only when the corresponding config field is unset.
100
+
101
+ Every retry drops the pooled connection and reconnects fresh — keep-alive is disabled and a new client is created, so a retry never reuses the connection that just failed.
102
+
83
103
  ### `fastMode` (boolean)
84
104
 
85
105
  Fast mode for the CLI (same model family, faster output). Off when absent or `false`.
@@ -121,6 +141,7 @@ These behave as in stock configuration but are worth knowing about:
121
141
 
122
142
  - `model` — the model to use, per provider profile.
123
143
  - `permissions` — `allow` / `deny` / `ask` rules, `defaultMode`, `additionalDirectories`.
144
+ - `defaultMode` can be `default`, `plan`, `acceptEdits`, `dontAsk`, `bypassPermissions`, or `fullAccess`. Both `Bypass Permissions` and `Full Access` are selectable directly in the `/config` permission picker. Runtime still enforces org policy and `disableBypassPermissionsMode`.
124
145
  - `hooks` — lifecycle hooks (PreToolUse, PostToolUse, Stop, etc.); see `docs/hooks.md`.
125
146
  - `env` — environment variables to set for your session.
126
147
  - `includeCoAuthoredBy` / `git.addAICoAuthor` / `git.addGeneratedWithFooter` — legacy and current git attribution opt-ins. Attribution for this fork uses `openclaude@rayss868.com`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rayss-dev/openclaude",
3
- "version": "0.28.0-by-rayss",
3
+ "version": "0.28.1-by-rayss",
4
4
  "description": "OpenClaude opens coding-agent workflows to any LLM — OpenAI, Gemini, DeepSeek, Ollama, and 200+ models",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,6 +9,7 @@
9
9
  "exports": {
10
10
  "./package.json": "./package.json",
11
11
  "./dist/cli.mjs": "./dist/cli.mjs",
12
+ "./acp": "./dist/acp.mjs",
12
13
  "./sdk": {
13
14
  "types": "./src/entrypoints/sdk.d.ts",
14
15
  "import": "./dist/sdk.mjs"
@@ -18,6 +19,8 @@
18
19
  "bin/",
19
20
  "dist/cli.mjs",
20
21
  "dist/sdk.mjs",
22
+ "dist/acp.mjs",
23
+ "dist/acp-web.mjs",
21
24
  "src/entrypoints/sdk.d.ts",
22
25
  "src/entrypoints/sdk/coreTypes.generated.ts",
23
26
  "scripts/windows/openclaude-aliases.ps1",
@@ -54,6 +57,8 @@
54
57
  "dev:code": "bun run profile:code && bun run dev:profile",
55
58
  "dev:grpc": "bun run scripts/start-grpc.ts",
56
59
  "dev:grpc:cli": "bun run scripts/grpc-cli.ts",
60
+ "dev:acp": "bun run build && node dist/acp.mjs",
61
+ "dev:acp:web": "node scripts/acp-web-server.mjs",
57
62
  "start": "node bin/openclaude",
58
63
  "web:dev": "bun run --cwd web dev",
59
64
  "web:build": "bun run --cwd web build",