@rayss-dev/openclaude 0.29.2-by-rayss → 0.30.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/acp.mjs +493 -138
- package/dist/cli.mjs +45 -45
- package/dist/sdk.mjs +413 -114
- package/package.json +225 -225
package/dist/acp.mjs
CHANGED
|
@@ -9380,14 +9380,14 @@ function getReleaseTagUrl(version = publicBuildVersion) {
|
|
|
9380
9380
|
return `${OPENCLAUDE_RELEASES_URL}/tag/v${normalizePublicVersion(version)}`;
|
|
9381
9381
|
}
|
|
9382
9382
|
function getPublicBuildVersion() {
|
|
9383
|
-
return "0.
|
|
9383
|
+
return "0.30.1-by-rayss";
|
|
9384
9384
|
}
|
|
9385
9385
|
var import_semver, OPENCLAUDE_RELEASES_URL = "https://github.com/rayss868/openclaude/releases", fallbackBuildVersion, publicBuildVersion;
|
|
9386
9386
|
var init_version = __esm(() => {
|
|
9387
9387
|
import_semver = __toESM(require_semver2(), 1);
|
|
9388
9388
|
fallbackBuildVersion = (() => {
|
|
9389
9389
|
try {
|
|
9390
|
-
return "0.
|
|
9390
|
+
return "0.30.1-by-rayss";
|
|
9391
9391
|
} catch {
|
|
9392
9392
|
return "0.0.0";
|
|
9393
9393
|
}
|
|
@@ -9396,6 +9396,28 @@ var init_version = __esm(() => {
|
|
|
9396
9396
|
});
|
|
9397
9397
|
|
|
9398
9398
|
// src/integrations/aimlapi/config.ts
|
|
9399
|
+
function isManagedAttributionHeaderName(name) {
|
|
9400
|
+
return AIMLAPI_MANAGED_ATTRIBUTION_HEADER_NAMES.has(name.trim().toLowerCase());
|
|
9401
|
+
}
|
|
9402
|
+
function omitManagedAttributionHeaders(headers) {
|
|
9403
|
+
const resolved = {};
|
|
9404
|
+
for (const [name, value] of Object.entries(headers)) {
|
|
9405
|
+
if (isManagedAttributionHeaderName(name))
|
|
9406
|
+
continue;
|
|
9407
|
+
resolved[name] = value;
|
|
9408
|
+
}
|
|
9409
|
+
return resolved;
|
|
9410
|
+
}
|
|
9411
|
+
function collectManagedAttributionValues(headers) {
|
|
9412
|
+
const collected = new Map;
|
|
9413
|
+
for (const [name, value] of Object.entries(headers)) {
|
|
9414
|
+
const key = name.trim().toLowerCase();
|
|
9415
|
+
if (AIMLAPI_MANAGED_ATTRIBUTION_HEADER_NAMES.has(key)) {
|
|
9416
|
+
collected.set(key, value);
|
|
9417
|
+
}
|
|
9418
|
+
}
|
|
9419
|
+
return collected;
|
|
9420
|
+
}
|
|
9399
9421
|
function resolveEndpoints() {
|
|
9400
9422
|
return {
|
|
9401
9423
|
authBaseUrl: process.env.AIMLAPI_AUTH_URL?.trim() || DEFAULT_ENDPOINTS.authBaseUrl,
|
|
@@ -9448,10 +9470,25 @@ function isTrustedAimlapiRequestUrl(url) {
|
|
|
9448
9470
|
}
|
|
9449
9471
|
}
|
|
9450
9472
|
function resolveAimlapiAttributionHeaders(headers, baseUrl) {
|
|
9473
|
+
const rest = omitManagedAttributionHeaders(headers);
|
|
9451
9474
|
if (!baseUrl || isCanonicalAimlapiInferenceBaseUrl(baseUrl)) {
|
|
9452
|
-
|
|
9475
|
+
const collected = collectManagedAttributionValues(headers);
|
|
9476
|
+
const managed = {
|
|
9477
|
+
[PARTNER_HEADER_NAME]: resolvePartnerId(),
|
|
9478
|
+
[SOURCE_HEADER_NAME]: AIMLAPI_SOURCE
|
|
9479
|
+
};
|
|
9480
|
+
for (const [key, canonical] of Object.entries(MANAGED_ATTRIBUTION_HEADER_CANONICAL_NAMES)) {
|
|
9481
|
+
if (key === PARTNER_HEADER_NAME.toLowerCase() || key === SOURCE_HEADER_NAME.toLowerCase()) {
|
|
9482
|
+
continue;
|
|
9483
|
+
}
|
|
9484
|
+
const value = collected.get(key);
|
|
9485
|
+
if (value !== undefined) {
|
|
9486
|
+
managed[canonical] = value;
|
|
9487
|
+
}
|
|
9488
|
+
}
|
|
9489
|
+
return { ...rest, ...managed };
|
|
9453
9490
|
}
|
|
9454
|
-
return
|
|
9491
|
+
return rest;
|
|
9455
9492
|
}
|
|
9456
9493
|
function buildPartnerCheckoutReturnUrls(payBaseUrl, sessionToken) {
|
|
9457
9494
|
const base = requireHttpsBaseUrl(payBaseUrl, "AIMLAPI_PAY_URL").replace(/\/+$/, "");
|
|
@@ -9501,7 +9538,7 @@ function requireHttpsBaseUrl(value, label) {
|
|
|
9501
9538
|
}
|
|
9502
9539
|
return candidate;
|
|
9503
9540
|
}
|
|
9504
|
-
var DEFAULT_ENDPOINTS, DEFAULT_PARTNER_ID = "part_62yQoGYDq4Yqnrj2R1iGrDNJ", DEFAULT_PARTNER_NAME = "Gitlawb", PARTNER_HEADER_NAME = "X-AIMLAPI-Partner-ID", SOURCE_HEADER_NAME = "X-AIMLAPI-Source", AIMLAPI_SOURCE = "agent/openclaude", DEFAULT_MODEL = "gpt-4o", DEFAULT_RETURN_URL = "https://aimlapi.com/app", MIN_AMOUNT_USD_MINOR = 2000, MAX_AMOUNT_USD_MINOR = 1e6, DEFAULT_AMOUNT_USD_MINOR = 2500
|
|
9541
|
+
var DEFAULT_ENDPOINTS, DEFAULT_PARTNER_ID = "part_62yQoGYDq4Yqnrj2R1iGrDNJ", DEFAULT_PARTNER_NAME = "Gitlawb", PARTNER_HEADER_NAME = "X-AIMLAPI-Partner-ID", SOURCE_HEADER_NAME = "X-AIMLAPI-Source", INTEGRATION_REPO_HEADER_NAME = "X-AIMLAPI-Integration-Repo", INTEGRATION_VERSION_HEADER_NAME = "X-AIMLAPI-Integration-Version", REFERER_HEADER_NAME = "HTTP-Referer", TITLE_HEADER_NAME = "X-Title", MANAGED_ATTRIBUTION_HEADER_CANONICAL_NAMES, AIMLAPI_MANAGED_ATTRIBUTION_HEADER_NAMES, AIMLAPI_SOURCE = "agent/openclaude", DEFAULT_MODEL = "gpt-4o", DEFAULT_RETURN_URL = "https://aimlapi.com/app", MIN_AMOUNT_USD_MINOR = 2000, MAX_AMOUNT_USD_MINOR = 1e6, DEFAULT_AMOUNT_USD_MINOR = 2500;
|
|
9505
9542
|
var init_config = __esm(() => {
|
|
9506
9543
|
DEFAULT_ENDPOINTS = {
|
|
9507
9544
|
authBaseUrl: "https://auth.aimlapi.com",
|
|
@@ -9510,14 +9547,15 @@ var init_config = __esm(() => {
|
|
|
9510
9547
|
inferenceBaseUrl: "https://api.aimlapi.com/v1",
|
|
9511
9548
|
verificationBaseUrl: "https://aimlapi.com/app"
|
|
9512
9549
|
};
|
|
9513
|
-
|
|
9514
|
-
PARTNER_HEADER_NAME.toLowerCase(),
|
|
9515
|
-
SOURCE_HEADER_NAME.toLowerCase(),
|
|
9516
|
-
|
|
9517
|
-
|
|
9518
|
-
|
|
9519
|
-
|
|
9520
|
-
|
|
9550
|
+
MANAGED_ATTRIBUTION_HEADER_CANONICAL_NAMES = {
|
|
9551
|
+
[PARTNER_HEADER_NAME.toLowerCase()]: PARTNER_HEADER_NAME,
|
|
9552
|
+
[SOURCE_HEADER_NAME.toLowerCase()]: SOURCE_HEADER_NAME,
|
|
9553
|
+
[INTEGRATION_REPO_HEADER_NAME.toLowerCase()]: INTEGRATION_REPO_HEADER_NAME,
|
|
9554
|
+
[INTEGRATION_VERSION_HEADER_NAME.toLowerCase()]: INTEGRATION_VERSION_HEADER_NAME,
|
|
9555
|
+
[REFERER_HEADER_NAME.toLowerCase()]: REFERER_HEADER_NAME,
|
|
9556
|
+
[TITLE_HEADER_NAME.toLowerCase()]: TITLE_HEADER_NAME
|
|
9557
|
+
};
|
|
9558
|
+
AIMLAPI_MANAGED_ATTRIBUTION_HEADER_NAMES = new Set(Object.keys(MANAGED_ATTRIBUTION_HEADER_CANONICAL_NAMES));
|
|
9521
9559
|
});
|
|
9522
9560
|
|
|
9523
9561
|
// src/integrations/gateways/aimlapi.ts
|
|
@@ -105852,9 +105890,13 @@ function getRouteDiscoveryHeaders(routeId, options) {
|
|
|
105852
105890
|
...transportConfig?.headers ?? {},
|
|
105853
105891
|
...transportConfig?.openaiShim?.headers ?? {}
|
|
105854
105892
|
};
|
|
105855
|
-
const
|
|
105856
|
-
|
|
105857
|
-
...
|
|
105893
|
+
const callerHeaders = options?.headers ?? {};
|
|
105894
|
+
const headers = routeId === "aimlapi" ? resolveAimlapiAttributionHeaders({
|
|
105895
|
+
...callerHeaders,
|
|
105896
|
+
...descriptorHeaders
|
|
105897
|
+
}, getRouteBaseUrl(routeId, options)) : {
|
|
105898
|
+
...descriptorHeaders,
|
|
105899
|
+
...callerHeaders
|
|
105858
105900
|
};
|
|
105859
105901
|
return Object.keys(headers).length > 0 ? headers : undefined;
|
|
105860
105902
|
}
|
|
@@ -107838,6 +107880,7 @@ __export(exports_auth, {
|
|
|
107838
107880
|
isOverageProvisioningAllowed: () => isOverageProvisioningAllowed,
|
|
107839
107881
|
isOtelHeadersHelperFromProjectOrLocalSettings: () => isOtelHeadersHelperFromProjectOrLocalSettings,
|
|
107840
107882
|
isMaxSubscriber: () => isMaxSubscriber,
|
|
107883
|
+
isManagedOAuthContext: () => isManagedOAuthContext,
|
|
107841
107884
|
isGcpAuthRefreshFromProjectSettings: () => isGcpAuthRefreshFromProjectSettings,
|
|
107842
107885
|
isEnterpriseSubscriber: () => isEnterpriseSubscriber,
|
|
107843
107886
|
isCustomApiKeyApproved: () => isCustomApiKeyApproved,
|
|
@@ -107879,7 +107922,7 @@ import { exec } from "child_process";
|
|
|
107879
107922
|
import { mkdir as mkdir3, stat as stat6 } from "fs/promises";
|
|
107880
107923
|
import { join as join27 } from "path";
|
|
107881
107924
|
function isManagedOAuthContext() {
|
|
107882
|
-
return isEnvTruthy(process.env.CLAUDE_CODE_REMOTE) || process.env.CLAUDE_CODE_ENTRYPOINT === "claude-desktop";
|
|
107925
|
+
return isEnvTruthy(process.env.CLAUDE_CODE_REMOTE) || process.env.CLAUDE_CODE_ENTRYPOINT === "claude-desktop" || !!process.env.ANTHROPIC_UNIX_SOCKET && !!process.env.CLAUDE_CODE_OAUTH_TOKEN;
|
|
107883
107926
|
}
|
|
107884
107927
|
function isAnthropicAuthEnabled() {
|
|
107885
107928
|
if (isBareMode())
|
|
@@ -109559,7 +109602,7 @@ var init_metadata = __esm(() => {
|
|
|
109559
109602
|
COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
|
|
109560
109603
|
WHITESPACE_REGEX = /\s+/;
|
|
109561
109604
|
getVersionBase = memoize_default(() => {
|
|
109562
|
-
const match = "0.
|
|
109605
|
+
const match = "0.30.1-by-rayss".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
|
|
109563
109606
|
return match ? match[0] : undefined;
|
|
109564
109607
|
});
|
|
109565
109608
|
buildEnvContext = memoize_default(async () => {
|
|
@@ -109599,9 +109642,9 @@ var init_metadata = __esm(() => {
|
|
|
109599
109642
|
isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
|
|
109600
109643
|
isClaudeCodeAction: isEnvTruthy(process.env.CLAUDE_CODE_ACTION),
|
|
109601
109644
|
isClaudeAiAuth: isClaudeAISubscriber(),
|
|
109602
|
-
version: "0.
|
|
109645
|
+
version: "0.30.1-by-rayss",
|
|
109603
109646
|
versionBase: getVersionBase(),
|
|
109604
|
-
buildTime: "2026-
|
|
109647
|
+
buildTime: "2026-09-01T07:43:44.479Z",
|
|
109605
109648
|
deploymentEnvironment: env2.detectDeploymentEnvironment(),
|
|
109606
109649
|
...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
|
|
109607
109650
|
githubEventName: process.env.GITHUB_EVENT_NAME,
|
|
@@ -173258,7 +173301,7 @@ var init_codeIndexing = __esm(() => {
|
|
|
173258
173301
|
|
|
173259
173302
|
// src/utils/userAgent.ts
|
|
173260
173303
|
function getClaudeCodeUserAgent() {
|
|
173261
|
-
return `claude-code/${"0.
|
|
173304
|
+
return `claude-code/${"0.30.1-by-rayss"}`;
|
|
173262
173305
|
}
|
|
173263
173306
|
|
|
173264
173307
|
// src/utils/workloadContext.ts
|
|
@@ -173277,7 +173320,7 @@ function getUserAgent() {
|
|
|
173277
173320
|
const clientApp = process.env.CLAUDE_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}` : "";
|
|
173278
173321
|
const workload = getWorkload();
|
|
173279
173322
|
const workloadSuffix = workload ? `, workload/${workload}` : "";
|
|
173280
|
-
return `claude-cli/${"0.
|
|
173323
|
+
return `claude-cli/${"0.30.1-by-rayss"} (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
|
|
173281
173324
|
}
|
|
173282
173325
|
function getMCPUserAgent() {
|
|
173283
173326
|
const parts = [];
|
|
@@ -173291,7 +173334,7 @@ function getMCPUserAgent() {
|
|
|
173291
173334
|
parts.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`);
|
|
173292
173335
|
}
|
|
173293
173336
|
const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
173294
|
-
return `claude-code/${"0.
|
|
173337
|
+
return `claude-code/${"0.30.1-by-rayss"}${suffix}`;
|
|
173295
173338
|
}
|
|
173296
173339
|
function getWebFetchUserAgent() {
|
|
173297
173340
|
const supportUrl = isFirstPartyAnthropicProvider() ? "https://support.anthropic.com/" : "https://github.com/rayss868/openclaude";
|
|
@@ -178362,17 +178405,17 @@ function isAttributionHeaderEnabled() {
|
|
|
178362
178405
|
}
|
|
178363
178406
|
return getFeatureValue_CACHED_MAY_BE_STALE("tengu_attribution_header", true);
|
|
178364
178407
|
}
|
|
178365
|
-
function getAttributionHeader(fingerprint) {
|
|
178366
|
-
if (!
|
|
178408
|
+
function getAttributionHeader(fingerprint, policy) {
|
|
178409
|
+
if (!policy.generate) {
|
|
178367
178410
|
return "";
|
|
178368
178411
|
}
|
|
178369
|
-
const version2 = `${"0.
|
|
178412
|
+
const version2 = `${"0.30.1-by-rayss"}.${fingerprint}`;
|
|
178370
178413
|
const entrypoint = process.env.CLAUDE_CODE_ENTRYPOINT ?? "unknown";
|
|
178371
178414
|
const cch = "";
|
|
178372
178415
|
const workload = getWorkload();
|
|
178373
178416
|
const workloadPair = workload ? ` cc_workload=${workload};` : "";
|
|
178374
178417
|
const header = `x-anthropic-billing-header: cc_version=${version2}; cc_entrypoint=${entrypoint};${cch}${workloadPair}`;
|
|
178375
|
-
logForDebugging(`attribution header ${
|
|
178418
|
+
logForDebugging(`attribution header generated: ${policy.reason}`);
|
|
178376
178419
|
return header;
|
|
178377
178420
|
}
|
|
178378
178421
|
var DEFAULT_PREFIX, AGENT_SDK_CLAUDE_CODE_PRESET_PREFIX, AGENT_SDK_PREFIX, CLI_SYSPROMPT_PREFIX_VALUES, CLI_SYSPROMPT_PREFIXES;
|
|
@@ -178393,7 +178436,188 @@ var init_system = __esm(() => {
|
|
|
178393
178436
|
CLI_SYSPROMPT_PREFIXES = new Set(CLI_SYSPROMPT_PREFIX_VALUES);
|
|
178394
178437
|
});
|
|
178395
178438
|
|
|
178439
|
+
// src/utils/anthropicAttribution.ts
|
|
178440
|
+
function resolveAnthropicAttributionAuth({
|
|
178441
|
+
apiKey,
|
|
178442
|
+
authToken,
|
|
178443
|
+
isSubscriber
|
|
178444
|
+
}) {
|
|
178445
|
+
if (apiKey === "external" || authToken === "api_key")
|
|
178446
|
+
return "api_key";
|
|
178447
|
+
if (authToken === "oauth" && isSubscriber)
|
|
178448
|
+
return "oauth_subscription";
|
|
178449
|
+
if (apiKey === "managed")
|
|
178450
|
+
return "api_key";
|
|
178451
|
+
return "unknown";
|
|
178452
|
+
}
|
|
178453
|
+
function resolveAnthropicAttributionPolicy({
|
|
178454
|
+
route,
|
|
178455
|
+
auth,
|
|
178456
|
+
attributionEnabled
|
|
178457
|
+
}) {
|
|
178458
|
+
if (route === "unknown") {
|
|
178459
|
+
return { generate: false, retain: false, reason: "unknown_route" };
|
|
178460
|
+
}
|
|
178461
|
+
if (route !== "official_anthropic") {
|
|
178462
|
+
return { generate: false, retain: false, reason: "non_official_route" };
|
|
178463
|
+
}
|
|
178464
|
+
if (auth === "oauth_subscription") {
|
|
178465
|
+
return {
|
|
178466
|
+
generate: true,
|
|
178467
|
+
retain: true,
|
|
178468
|
+
reason: "official_oauth_required"
|
|
178469
|
+
};
|
|
178470
|
+
}
|
|
178471
|
+
if (auth === "api_key") {
|
|
178472
|
+
return attributionEnabled ? {
|
|
178473
|
+
generate: true,
|
|
178474
|
+
retain: true,
|
|
178475
|
+
reason: "official_api_key_enabled"
|
|
178476
|
+
} : {
|
|
178477
|
+
generate: false,
|
|
178478
|
+
retain: false,
|
|
178479
|
+
reason: "official_api_key_disabled"
|
|
178480
|
+
};
|
|
178481
|
+
}
|
|
178482
|
+
return attributionEnabled ? {
|
|
178483
|
+
generate: true,
|
|
178484
|
+
retain: true,
|
|
178485
|
+
reason: "official_auth_unknown_enabled"
|
|
178486
|
+
} : {
|
|
178487
|
+
generate: false,
|
|
178488
|
+
retain: false,
|
|
178489
|
+
reason: "official_auth_unknown_disabled"
|
|
178490
|
+
};
|
|
178491
|
+
}
|
|
178492
|
+
function isAnthropicBillingAttributionBlock(text) {
|
|
178493
|
+
return text?.startsWith(ANTHROPIC_BILLING_ATTRIBUTION_PREFIX) ?? false;
|
|
178494
|
+
}
|
|
178495
|
+
function getAttributionBlockText(block) {
|
|
178496
|
+
if (typeof block === "string")
|
|
178497
|
+
return block;
|
|
178498
|
+
return block.type === undefined || block.type === "text" ? block.text : undefined;
|
|
178499
|
+
}
|
|
178500
|
+
function applyAnthropicAttributionPolicy(blocks, policy) {
|
|
178501
|
+
let retainedAttribution = false;
|
|
178502
|
+
return blocks.filter((block) => {
|
|
178503
|
+
if (!isAnthropicBillingAttributionBlock(getAttributionBlockText(block))) {
|
|
178504
|
+
return true;
|
|
178505
|
+
}
|
|
178506
|
+
if (!policy.retain || retainedAttribution)
|
|
178507
|
+
return false;
|
|
178508
|
+
retainedAttribution = true;
|
|
178509
|
+
return true;
|
|
178510
|
+
});
|
|
178511
|
+
}
|
|
178512
|
+
function getAnthropicAttributionDiagnostic(policy) {
|
|
178513
|
+
switch (policy.reason) {
|
|
178514
|
+
case "unknown_route":
|
|
178515
|
+
return "[anthropic-attribution] disabled for an unresolved request route";
|
|
178516
|
+
case "official_auth_unknown_enabled":
|
|
178517
|
+
case "official_auth_unknown_disabled":
|
|
178518
|
+
return "[anthropic-attribution] preserved the configured setting for ambiguous official auth";
|
|
178519
|
+
default:
|
|
178520
|
+
return null;
|
|
178521
|
+
}
|
|
178522
|
+
}
|
|
178523
|
+
var ANTHROPIC_BILLING_ATTRIBUTION_PREFIX = "x-anthropic-billing-header";
|
|
178524
|
+
|
|
178396
178525
|
// src/services/api/authRouting.ts
|
|
178526
|
+
function resolveAnthropicAttributionAuthTokenSource(authTokenSource, managedOAuthContext) {
|
|
178527
|
+
if (managedOAuthContext && (authTokenSource === "ANTHROPIC_AUTH_TOKEN" || authTokenSource === "apiKeyHelper")) {
|
|
178528
|
+
return "none";
|
|
178529
|
+
}
|
|
178530
|
+
if (authTokenSource === "ANTHROPIC_AUTH_TOKEN" || authTokenSource === "apiKeyHelper") {
|
|
178531
|
+
return "api_key";
|
|
178532
|
+
}
|
|
178533
|
+
if (authTokenSource === "CLAUDE_CODE_OAUTH_TOKEN" || authTokenSource === "CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR" || authTokenSource === "CCR_OAUTH_TOKEN_FILE" || authTokenSource === "claude.ai") {
|
|
178534
|
+
return "oauth";
|
|
178535
|
+
}
|
|
178536
|
+
return "none";
|
|
178537
|
+
}
|
|
178538
|
+
function isManagedOAuthEffective(authTokenSource, managedOAuthContext, bareMode) {
|
|
178539
|
+
return managedOAuthContext && !bareMode && resolveAnthropicAttributionAuthTokenSource(authTokenSource, false) === "oauth";
|
|
178540
|
+
}
|
|
178541
|
+
function resolveAnthropicAttributionAuthFromSources({
|
|
178542
|
+
apiKeySource,
|
|
178543
|
+
authTokenSource,
|
|
178544
|
+
bareMode,
|
|
178545
|
+
isSubscriber,
|
|
178546
|
+
managedOAuthContext
|
|
178547
|
+
}) {
|
|
178548
|
+
const managedOAuthIsEffective = isManagedOAuthEffective(authTokenSource, managedOAuthContext, bareMode);
|
|
178549
|
+
const apiKey = managedOAuthIsEffective ? "none" : apiKeySource === "ANTHROPIC_API_KEY" || apiKeySource === "apiKeyHelper" ? "external" : apiKeySource === "/login managed key" ? "managed" : "none";
|
|
178550
|
+
const authToken = resolveAnthropicAttributionAuthTokenSource(authTokenSource, managedOAuthIsEffective);
|
|
178551
|
+
return resolveAnthropicAttributionAuth({
|
|
178552
|
+
apiKey,
|
|
178553
|
+
authToken,
|
|
178554
|
+
isSubscriber
|
|
178555
|
+
});
|
|
178556
|
+
}
|
|
178557
|
+
function resolveCurrentAnthropicAttributionAuth() {
|
|
178558
|
+
let apiKeySource = "none";
|
|
178559
|
+
try {
|
|
178560
|
+
({ source: apiKeySource } = getAnthropicApiKeyWithSource({
|
|
178561
|
+
skipRetrievingKeyFromApiKeyHelper: true
|
|
178562
|
+
}));
|
|
178563
|
+
} catch {}
|
|
178564
|
+
let authTokenSource = "none";
|
|
178565
|
+
try {
|
|
178566
|
+
({ source: authTokenSource } = getAuthTokenSource());
|
|
178567
|
+
} catch {
|
|
178568
|
+
return "unknown";
|
|
178569
|
+
}
|
|
178570
|
+
const bareMode = isBareMode();
|
|
178571
|
+
const managedOAuthContext = isManagedOAuthContext();
|
|
178572
|
+
const managedOAuthIsEffective = isManagedOAuthEffective(authTokenSource, managedOAuthContext, bareMode);
|
|
178573
|
+
const hasOAuthToken = resolveAnthropicAttributionAuthTokenSource(authTokenSource, managedOAuthIsEffective) === "oauth";
|
|
178574
|
+
let isSubscriber = false;
|
|
178575
|
+
if (hasOAuthToken) {
|
|
178576
|
+
try {
|
|
178577
|
+
isSubscriber = managedOAuthIsEffective ? getSubscriptionType() !== "free" : isClaudeAISubscriber();
|
|
178578
|
+
} catch {
|
|
178579
|
+
return "unknown";
|
|
178580
|
+
}
|
|
178581
|
+
}
|
|
178582
|
+
return resolveAnthropicAttributionAuthFromSources({
|
|
178583
|
+
apiKeySource,
|
|
178584
|
+
authTokenSource,
|
|
178585
|
+
bareMode,
|
|
178586
|
+
isSubscriber,
|
|
178587
|
+
managedOAuthContext
|
|
178588
|
+
});
|
|
178589
|
+
}
|
|
178590
|
+
function resolveAnthropicAttributionRoute(providerOverride) {
|
|
178591
|
+
if (providerOverride)
|
|
178592
|
+
return "non_official";
|
|
178593
|
+
try {
|
|
178594
|
+
const routeId = resolveActiveRouteIdFromEnv(process.env);
|
|
178595
|
+
if (routeId === "anthropic" && getAPIProvider() === "firstParty" && isFirstPartyAnthropicBaseUrl()) {
|
|
178596
|
+
return "official_anthropic";
|
|
178597
|
+
}
|
|
178598
|
+
if (routeId && getTransportKindForRoute(routeId) !== null) {
|
|
178599
|
+
return "non_official";
|
|
178600
|
+
}
|
|
178601
|
+
return "unknown";
|
|
178602
|
+
} catch {
|
|
178603
|
+
return "unknown";
|
|
178604
|
+
}
|
|
178605
|
+
}
|
|
178606
|
+
function resolveCurrentAnthropicAttributionPolicy({
|
|
178607
|
+
attributionEnabled,
|
|
178608
|
+
providerOverride
|
|
178609
|
+
}) {
|
|
178610
|
+
const route = resolveAnthropicAttributionRoute(providerOverride);
|
|
178611
|
+
const policy = resolveAnthropicAttributionPolicy({
|
|
178612
|
+
route,
|
|
178613
|
+
auth: route === "official_anthropic" ? resolveCurrentAnthropicAttributionAuth() : "unknown",
|
|
178614
|
+
attributionEnabled
|
|
178615
|
+
});
|
|
178616
|
+
const diagnostic = getAnthropicAttributionDiagnostic(policy);
|
|
178617
|
+
if (diagnostic)
|
|
178618
|
+
logForDebugging(diagnostic);
|
|
178619
|
+
return policy;
|
|
178620
|
+
}
|
|
178397
178621
|
function shouldUseFirstPartyAnthropicAuthForProvider({
|
|
178398
178622
|
providerOverride,
|
|
178399
178623
|
apiProvider,
|
|
@@ -178411,6 +178635,10 @@ function shouldUseCustomAnthropicBearerAuth({
|
|
|
178411
178635
|
}
|
|
178412
178636
|
var init_authRouting = __esm(() => {
|
|
178413
178637
|
init_providers2();
|
|
178638
|
+
init_auth();
|
|
178639
|
+
init_routeMetadata();
|
|
178640
|
+
init_debug();
|
|
178641
|
+
init_envUtils();
|
|
178414
178642
|
});
|
|
178415
178643
|
|
|
178416
178644
|
// src/services/api/vertexClient.ts
|
|
@@ -181294,6 +181522,7 @@ var init_microCompact = __esm(() => {
|
|
|
181294
181522
|
var exports_compressToolHistory = {};
|
|
181295
181523
|
__export(exports_compressToolHistory, {
|
|
181296
181524
|
setToolHistoryCompressionEnabledOverrideForTest: () => setToolHistoryCompressionEnabledOverrideForTest,
|
|
181525
|
+
omitOldUserImages: () => omitOldUserImages,
|
|
181297
181526
|
getTiers: () => getTiers,
|
|
181298
181527
|
compressToolHistory: () => compressToolHistory
|
|
181299
181528
|
});
|
|
@@ -181502,6 +181731,52 @@ function shouldCompressBlock(block, toolUsesById) {
|
|
|
181502
181731
|
return true;
|
|
181503
181732
|
return isCompactableTool(toolUse.name);
|
|
181504
181733
|
}
|
|
181734
|
+
function hasCompletedTurn(messages, fromIndex) {
|
|
181735
|
+
for (let i3 = fromIndex + 1;i3 < messages.length; i3++) {
|
|
181736
|
+
const content = getInner(messages[i3]).content;
|
|
181737
|
+
if (!Array.isArray(content))
|
|
181738
|
+
continue;
|
|
181739
|
+
const types = content.map((b) => b?.type);
|
|
181740
|
+
if (types.includes("tool_use"))
|
|
181741
|
+
continue;
|
|
181742
|
+
if ((getInner(messages[i3]).role ?? messages[i3].role) === "assistant") {
|
|
181743
|
+
return true;
|
|
181744
|
+
}
|
|
181745
|
+
}
|
|
181746
|
+
return false;
|
|
181747
|
+
}
|
|
181748
|
+
function omitOldUserImages(messages) {
|
|
181749
|
+
let changed = false;
|
|
181750
|
+
const out = messages.map((msg, i3) => {
|
|
181751
|
+
const inner = getInner(msg);
|
|
181752
|
+
if ((inner.role ?? msg.role) !== "user")
|
|
181753
|
+
return msg;
|
|
181754
|
+
const content = inner.content;
|
|
181755
|
+
if (!Array.isArray(content))
|
|
181756
|
+
return msg;
|
|
181757
|
+
if (!content.some((block) => isInlineImagePayload(block)))
|
|
181758
|
+
return msg;
|
|
181759
|
+
if (!hasCompletedTurn(messages, i3))
|
|
181760
|
+
return msg;
|
|
181761
|
+
let omitted = false;
|
|
181762
|
+
const newContent = content.map((block) => {
|
|
181763
|
+
if (isInlineImagePayload(block)) {
|
|
181764
|
+
omitted = true;
|
|
181765
|
+
return { type: "text", text: OMITTED_USER_IMAGE_MARKER };
|
|
181766
|
+
}
|
|
181767
|
+
return block;
|
|
181768
|
+
});
|
|
181769
|
+
if (!omitted)
|
|
181770
|
+
return msg;
|
|
181771
|
+
changed = true;
|
|
181772
|
+
const newMessage = rewriteMessage(msg, newContent);
|
|
181773
|
+
if (msg.imagePermissionToolUseIds) {
|
|
181774
|
+
return { ...newMessage, imagePermissionToolUseIds: [] };
|
|
181775
|
+
}
|
|
181776
|
+
return newMessage;
|
|
181777
|
+
});
|
|
181778
|
+
return changed ? out : messages;
|
|
181779
|
+
}
|
|
181505
181780
|
function compressToolHistory(messages, model, options = {}) {
|
|
181506
181781
|
const compressionEnabled = toolHistoryCompressionEnabledOverrideForTest ?? getGlobalConfig().toolHistoryCompressionEnabled;
|
|
181507
181782
|
if (!compressionEnabled)
|
|
@@ -181510,10 +181785,11 @@ function compressToolHistory(messages, model, options = {}) {
|
|
|
181510
181785
|
const textBlockSeparator = options.textBlockSeparator ?? `
|
|
181511
181786
|
|
|
181512
181787
|
`;
|
|
181513
|
-
const
|
|
181788
|
+
const working = options.omitOldUserImages ? omitOldUserImages(messages) : messages;
|
|
181789
|
+
const toolResults = indexToolResults(working);
|
|
181514
181790
|
const total = toolResults.length;
|
|
181515
181791
|
if (total <= tiers.recent)
|
|
181516
|
-
return
|
|
181792
|
+
return working;
|
|
181517
181793
|
const positionsByMessage = new Map;
|
|
181518
181794
|
for (let pos = 0;pos < toolResults.length; pos++) {
|
|
181519
181795
|
const { messageIndex, blockIndex } = toolResults[pos];
|
|
@@ -181524,8 +181800,8 @@ function compressToolHistory(messages, model, options = {}) {
|
|
|
181524
181800
|
}
|
|
181525
181801
|
positions.set(blockIndex, pos);
|
|
181526
181802
|
}
|
|
181527
|
-
const toolUsesById = indexToolUses(
|
|
181528
|
-
return
|
|
181803
|
+
const toolUsesById = indexToolUses(working);
|
|
181804
|
+
return working.map((msg, i3) => {
|
|
181529
181805
|
const positions = positionsByMessage.get(i3);
|
|
181530
181806
|
if (!positions)
|
|
181531
181807
|
return msg;
|
|
@@ -181571,7 +181847,7 @@ function compressToolHistory(messages, model, options = {}) {
|
|
|
181571
181847
|
return rewriteMessage(msg, newContent);
|
|
181572
181848
|
});
|
|
181573
181849
|
}
|
|
181574
|
-
var MID_MAX_CHARS = 2000, STUB_ARGS_MAX_CHARS = 200, OMITTED_INLINE_IMAGE_MARKER = "[Inline image omitted from tool history]", toolHistoryCompressionEnabledOverrideForTest, STUB_MARKER_RE, TRUNCATION_MARKER_RE;
|
|
181850
|
+
var MID_MAX_CHARS = 2000, STUB_ARGS_MAX_CHARS = 200, OMITTED_INLINE_IMAGE_MARKER = "[Inline image omitted from tool history]", OMITTED_USER_IMAGE_MARKER = "[Image omitted from history]", toolHistoryCompressionEnabledOverrideForTest, STUB_MARKER_RE, TRUNCATION_MARKER_RE;
|
|
181575
181851
|
var init_compressToolHistory = __esm(() => {
|
|
181576
181852
|
init_autoCompact();
|
|
181577
181853
|
init_microCompact();
|
|
@@ -181927,7 +182203,8 @@ function prepareOpenAIRequest({
|
|
|
181927
182203
|
|
|
181928
182204
|
` : `
|
|
181929
182205
|
`,
|
|
181930
|
-
runtimeLimits
|
|
182206
|
+
runtimeLimits,
|
|
182207
|
+
omitOldUserImages: true
|
|
181931
182208
|
}) : rawMessages;
|
|
181932
182209
|
const useNativeOllamaChat = effectiveTransport === "chat_completions" && !shimConfig.endpointPath && isDirectLocalOllamaEndpoint(request.baseUrl) && isLikelyOllamaEndpoint(request.baseUrl);
|
|
181933
182210
|
const openaiMessages = effectiveTransport === "chat_completions" ? convertMessages(compressedMessages, params.system, {
|
|
@@ -182043,7 +182320,8 @@ function prepareOpenAIRequest({
|
|
|
182043
182320
|
const getResponsesInput = () => {
|
|
182044
182321
|
responsesMessages ??= effectiveTransport === "chat_completions" ? fastPath.skipToolHistoryCompression || skipCompressionForPrefixCache ? rawMessages : compressToolHistory(rawMessages, request.resolvedModel, {
|
|
182045
182322
|
textBlockSeparator: `
|
|
182046
|
-
|
|
182323
|
+
`,
|
|
182324
|
+
omitOldUserImages: true
|
|
182047
182325
|
}) : compressedMessages;
|
|
182048
182326
|
responsesInput ??= convertAnthropicMessagesToResponsesInput(responsesMessages, effectiveTransport === "responses_compat");
|
|
182049
182327
|
return responsesInput;
|
|
@@ -184819,61 +185097,50 @@ function convertSystemPrompt2(system) {
|
|
|
184819
185097
|
}
|
|
184820
185098
|
return String(system);
|
|
184821
185099
|
}
|
|
184822
|
-
function ensureTextPartForImageContent(parts) {
|
|
184823
|
-
if (!parts.some((part) => part.type === "image_url"))
|
|
184824
|
-
return parts;
|
|
184825
|
-
if (parts.some((part) => part.type === "text" && part.text.trim().length > 0))
|
|
184826
|
-
return parts;
|
|
184827
|
-
return [{ type: "text", text: "Image attached." }, ...parts];
|
|
184828
|
-
}
|
|
184829
185100
|
function joinTextContentParts(parts) {
|
|
184830
185101
|
return parts.map((part) => part.type === "text" ? part.text : "").join("");
|
|
184831
185102
|
}
|
|
184832
|
-
function
|
|
184833
|
-
if (typeof content === "string")
|
|
184834
|
-
return isError ? `Error: ${content}` : content;
|
|
185103
|
+
function extractToolResultWithImagePlaceholder(content, isError, options) {
|
|
185104
|
+
if (typeof content === "string") {
|
|
185105
|
+
return { text: isError ? `Error: ${content}` : content, images: [] };
|
|
185106
|
+
}
|
|
184835
185107
|
if (!Array.isArray(content)) {
|
|
184836
|
-
const
|
|
184837
|
-
return isError ? `Error: ${
|
|
185108
|
+
const text2 = JSON.stringify(content ?? "");
|
|
185109
|
+
return { text: isError ? `Error: ${text2}` : text2, images: [] };
|
|
184838
185110
|
}
|
|
184839
|
-
const
|
|
185111
|
+
const textChunks = [];
|
|
185112
|
+
const images = [];
|
|
184840
185113
|
for (const block of content) {
|
|
184841
185114
|
if (block?.type === "text" && typeof block.text === "string") {
|
|
184842
|
-
|
|
185115
|
+
textChunks.push(block.text);
|
|
184843
185116
|
} else if (block?.type === "tool_reference" && typeof block.tool_name === "string") {
|
|
184844
|
-
|
|
185117
|
+
textChunks.push(`Tool "${block.tool_name}" is now loaded and available to call.`);
|
|
184845
185118
|
} else if (block?.type === "image") {
|
|
184846
185119
|
if (options?.supportsImageInputs === false) {
|
|
184847
185120
|
throw new Error("The active provider accepts text-only messages and does not support image inputs.");
|
|
184848
185121
|
}
|
|
185122
|
+
textChunks.push("(see following user message for image)");
|
|
184849
185123
|
const source = block.source;
|
|
184850
|
-
if (source?.type === "url" && source.url)
|
|
184851
|
-
|
|
184852
|
-
else if (source?.type === "base64" && source.media_type && source.data) {
|
|
184853
|
-
|
|
185124
|
+
if (source?.type === "url" && source.url) {
|
|
185125
|
+
images.push({ type: "image_url", image_url: { url: source.url } });
|
|
185126
|
+
} else if (source?.type === "base64" && source.media_type && source.data) {
|
|
185127
|
+
images.push({
|
|
184854
185128
|
type: "image_url",
|
|
184855
185129
|
image_url: { url: `data:${source.media_type};base64,${source.data}` }
|
|
184856
185130
|
});
|
|
184857
185131
|
}
|
|
184858
185132
|
} else if (typeof block?.text === "string") {
|
|
184859
|
-
|
|
185133
|
+
textChunks.push(block.text);
|
|
184860
185134
|
}
|
|
184861
185135
|
}
|
|
184862
|
-
|
|
184863
|
-
return "";
|
|
184864
|
-
if (parts.length === 1 && parts[0].type === "text")
|
|
184865
|
-
return isError ? `Error: ${parts[0].text}` : parts[0].text;
|
|
184866
|
-
if (parts.every((part) => part.type === "text")) {
|
|
184867
|
-
const text = parts.map((part) => part.text).join(`
|
|
185136
|
+
let text = textChunks.join(`
|
|
184868
185137
|
|
|
184869
185138
|
`);
|
|
184870
|
-
|
|
184871
|
-
|
|
184872
|
-
if (
|
|
184873
|
-
|
|
184874
|
-
|
|
184875
|
-
parts.unshift({ type: "text", text: "Error:" });
|
|
184876
|
-
return ensureTextPartForImageContent(parts);
|
|
185139
|
+
if (isError)
|
|
185140
|
+
text = text ? `Error: ${text}` : "Error:";
|
|
185141
|
+
if (!text && images.length === 0)
|
|
185142
|
+
text = "";
|
|
185143
|
+
return { text, images };
|
|
184877
185144
|
}
|
|
184878
185145
|
function convertContentBlocks(content, options) {
|
|
184879
185146
|
if (typeof content === "string")
|
|
@@ -184922,7 +185189,7 @@ function convertContentBlocks(content, options) {
|
|
|
184922
185189
|
return parts.map((part) => part.text).join(`
|
|
184923
185190
|
|
|
184924
185191
|
`);
|
|
184925
|
-
return
|
|
185192
|
+
return parts;
|
|
184926
185193
|
}
|
|
184927
185194
|
function convertMessages(messages, system, options = {}) {
|
|
184928
185195
|
const result = [];
|
|
@@ -184952,6 +185219,7 @@ function convertMessages(messages, system, options = {}) {
|
|
|
184952
185219
|
continue;
|
|
184953
185220
|
}
|
|
184954
185221
|
let otherContent;
|
|
185222
|
+
const toolResultImages = [];
|
|
184955
185223
|
for (const block of content) {
|
|
184956
185224
|
if (block?.type !== "tool_result") {
|
|
184957
185225
|
otherContent ??= [];
|
|
@@ -184960,15 +185228,20 @@ function convertMessages(messages, system, options = {}) {
|
|
|
184960
185228
|
}
|
|
184961
185229
|
const id = block.tool_use_id ?? "unknown";
|
|
184962
185230
|
if (knownToolCallIds.has(id)) {
|
|
185231
|
+
const extracted = extractToolResultWithImagePlaceholder(block.content, block.is_error, options);
|
|
184963
185232
|
result.push({
|
|
184964
185233
|
role: "tool",
|
|
184965
185234
|
tool_call_id: id,
|
|
184966
|
-
content:
|
|
185235
|
+
content: extracted.text
|
|
184967
185236
|
});
|
|
185237
|
+
toolResultImages.push(...extracted.images);
|
|
184968
185238
|
} else {
|
|
184969
185239
|
options.log?.(`Dropping orphan tool_result for ID: ${id} to prevent API error`);
|
|
184970
185240
|
}
|
|
184971
185241
|
}
|
|
185242
|
+
if (toolResultImages.length > 0) {
|
|
185243
|
+
result.push({ role: "user", content: toolResultImages });
|
|
185244
|
+
}
|
|
184972
185245
|
if (otherContent?.length)
|
|
184973
185246
|
result.push({ role: "user", content: convertContentBlocks(otherContent, options) });
|
|
184974
185247
|
continue;
|
|
@@ -186231,7 +186504,7 @@ function computeFingerprint(messageText2, version2) {
|
|
|
186231
186504
|
}
|
|
186232
186505
|
function computeFingerprintFromMessages(messages) {
|
|
186233
186506
|
const firstMessageText = extractFirstMessageText(messages);
|
|
186234
|
-
return computeFingerprint(firstMessageText, "0.
|
|
186507
|
+
return computeFingerprint(firstMessageText, "0.30.1-by-rayss");
|
|
186235
186508
|
}
|
|
186236
186509
|
var FINGERPRINT_SALT = "59cf53e54c78";
|
|
186237
186510
|
var init_fingerprint = () => {};
|
|
@@ -186273,9 +186546,12 @@ async function sideQuery(opts) {
|
|
|
186273
186546
|
betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
|
|
186274
186547
|
}
|
|
186275
186548
|
const messageText2 = extractFirstUserMessageText(messages);
|
|
186276
|
-
const fingerprint = computeFingerprint(messageText2,
|
|
186277
|
-
const
|
|
186278
|
-
|
|
186549
|
+
const fingerprint = computeFingerprint(messageText2, publicBuildVersion);
|
|
186550
|
+
const attributionPolicy = resolveCurrentAnthropicAttributionPolicy({
|
|
186551
|
+
attributionEnabled: isAttributionHeaderEnabled()
|
|
186552
|
+
});
|
|
186553
|
+
const attributionHeader = getAttributionHeader(fingerprint, attributionPolicy);
|
|
186554
|
+
const systemBlocks = applyAnthropicAttributionPolicy([
|
|
186279
186555
|
attributionHeader ? { type: "text", text: attributionHeader } : null,
|
|
186280
186556
|
...skipSystemPromptPrefix ? [] : [
|
|
186281
186557
|
{
|
|
@@ -186287,7 +186563,7 @@ async function sideQuery(opts) {
|
|
|
186287
186563
|
}
|
|
186288
186564
|
],
|
|
186289
186565
|
...Array.isArray(system) ? system : system ? [{ type: "text", text: system }] : []
|
|
186290
|
-
].filter((block) => block !== null);
|
|
186566
|
+
].filter((block) => block !== null), attributionPolicy);
|
|
186291
186567
|
let thinkingConfig;
|
|
186292
186568
|
if (thinking === false) {
|
|
186293
186569
|
thinkingConfig = { type: "disabled" };
|
|
@@ -186335,10 +186611,12 @@ var init_sideQuery = __esm(() => {
|
|
|
186335
186611
|
init_betas();
|
|
186336
186612
|
init_system();
|
|
186337
186613
|
init_claude3();
|
|
186614
|
+
init_authRouting();
|
|
186338
186615
|
init_client2();
|
|
186339
186616
|
init_betas2();
|
|
186340
186617
|
init_fingerprint();
|
|
186341
186618
|
init_model();
|
|
186619
|
+
init_version();
|
|
186342
186620
|
});
|
|
186343
186621
|
|
|
186344
186622
|
// src/utils/claudeInChrome/mcpServer.ts
|
|
@@ -187593,7 +187871,7 @@ var init_client3 = __esm(() => {
|
|
|
187593
187871
|
const client = new Client({
|
|
187594
187872
|
name: "claude-code",
|
|
187595
187873
|
title: "OpenClaude",
|
|
187596
|
-
version: "0.
|
|
187874
|
+
version: "0.30.1-by-rayss",
|
|
187597
187875
|
description: "OpenClaude — coding-agent CLI for any LLM provider",
|
|
187598
187876
|
websiteUrl: PRODUCT_URL
|
|
187599
187877
|
}, {
|
|
@@ -198741,7 +199019,7 @@ function isBashPrefixTool(toolName) {
|
|
|
198741
199019
|
return TOOL_VALIDATION_CONFIG.bashPrefixTools.includes(toolName);
|
|
198742
199020
|
}
|
|
198743
199021
|
function getCustomValidation(toolName) {
|
|
198744
|
-
return TOOL_VALIDATION_CONFIG.customValidation[toolName];
|
|
199022
|
+
return Object.hasOwn(TOOL_VALIDATION_CONFIG.customValidation, toolName) ? TOOL_VALIDATION_CONFIG.customValidation[toolName] : undefined;
|
|
198745
199023
|
}
|
|
198746
199024
|
var TOOL_VALIDATION_CONFIG;
|
|
198747
199025
|
var init_toolValidationConfig = __esm(() => {
|
|
@@ -268837,7 +269115,7 @@ function doesSourceMatchHostPattern(source, pattern) {
|
|
|
268837
269115
|
return false;
|
|
268838
269116
|
}
|
|
268839
269117
|
try {
|
|
268840
|
-
const regex2 = new RegExp(pattern.hostPattern);
|
|
269118
|
+
const regex2 = new RegExp(`^(?:${pattern.hostPattern})$`);
|
|
268841
269119
|
return regex2.test(host);
|
|
268842
269120
|
} catch {
|
|
268843
269121
|
logError2(new Error(`Invalid hostPattern regex: ${pattern.hostPattern}`));
|
|
@@ -280672,8 +280950,11 @@ function logStripOnce(stripped) {
|
|
|
280672
280950
|
loggedStrip = true;
|
|
280673
280951
|
logForDebugging(`[betas] Stripped from tool schemas: [${stripped.join(", ")}] (CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1)`);
|
|
280674
280952
|
}
|
|
280953
|
+
function getSystemPromptTelemetryBlock(systemPrompt) {
|
|
280954
|
+
return splitSysPromptPrefix(systemPrompt).find((block2) => !isAnthropicBillingAttributionBlock(block2.text));
|
|
280955
|
+
}
|
|
280675
280956
|
function logAPIPrefix(systemPrompt) {
|
|
280676
|
-
const
|
|
280957
|
+
const firstSyspromptBlock = getSystemPromptTelemetryBlock(systemPrompt);
|
|
280677
280958
|
const firstSystemPrompt = firstSyspromptBlock?.text;
|
|
280678
280959
|
logEvent("tengu_sysprompt_block", {
|
|
280679
280960
|
snippet: firstSystemPrompt?.slice(0, 20),
|
|
@@ -280695,7 +280976,7 @@ function splitSysPromptPrefix(systemPrompt, options2) {
|
|
|
280695
280976
|
continue;
|
|
280696
280977
|
if (prompt === SYSTEM_PROMPT_DYNAMIC_BOUNDARY)
|
|
280697
280978
|
continue;
|
|
280698
|
-
if (prompt
|
|
280979
|
+
if (isAnthropicBillingAttributionBlock(prompt)) {
|
|
280699
280980
|
attributionHeader2 = prompt;
|
|
280700
280981
|
} else if (CLI_SYSPROMPT_PREFIXES.has(prompt)) {
|
|
280701
280982
|
systemPromptPrefix2 = prompt;
|
|
@@ -280729,7 +281010,7 @@ function splitSysPromptPrefix(systemPrompt, options2) {
|
|
|
280729
281010
|
const block2 = systemPrompt[i3];
|
|
280730
281011
|
if (!block2 || block2 === SYSTEM_PROMPT_DYNAMIC_BOUNDARY)
|
|
280731
281012
|
continue;
|
|
280732
|
-
if (block2
|
|
281013
|
+
if (isAnthropicBillingAttributionBlock(block2)) {
|
|
280733
281014
|
attributionHeader2 = block2;
|
|
280734
281015
|
} else if (CLI_SYSPROMPT_PREFIXES.has(block2)) {
|
|
280735
281016
|
systemPromptPrefix2 = block2;
|
|
@@ -280772,7 +281053,7 @@ function splitSysPromptPrefix(systemPrompt, options2) {
|
|
|
280772
281053
|
for (const block2 of systemPrompt) {
|
|
280773
281054
|
if (!block2)
|
|
280774
281055
|
continue;
|
|
280775
|
-
if (block2
|
|
281056
|
+
if (isAnthropicBillingAttributionBlock(block2)) {
|
|
280776
281057
|
attributionHeader = block2;
|
|
280777
281058
|
} else if (CLI_SYSPROMPT_PREFIXES.has(block2)) {
|
|
280778
281059
|
systemPromptPrefix = block2;
|
|
@@ -285870,7 +286151,7 @@ function getAnthropicEnvMetadata() {
|
|
|
285870
286151
|
function getBuildAgeMinutes() {
|
|
285871
286152
|
if (false)
|
|
285872
286153
|
;
|
|
285873
|
-
const buildTime = new Date("2026-
|
|
286154
|
+
const buildTime = new Date("2026-09-01T07:43:44.479Z").getTime();
|
|
285874
286155
|
if (isNaN(buildTime))
|
|
285875
286156
|
return;
|
|
285876
286157
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -296343,7 +296624,7 @@ function Feedback({
|
|
|
296343
296624
|
platform: env2.platform,
|
|
296344
296625
|
gitRepo: envInfo.isGit,
|
|
296345
296626
|
terminal: env2.terminal,
|
|
296346
|
-
version: "0.
|
|
296627
|
+
version: "0.30.1-by-rayss",
|
|
296347
296628
|
transcript: normalizeMessagesForAPI(messages),
|
|
296348
296629
|
errors: sanitizedErrors,
|
|
296349
296630
|
lastApiRequest: getLastAPIRequest(),
|
|
@@ -296532,7 +296813,7 @@ function Feedback({
|
|
|
296532
296813
|
", ",
|
|
296533
296814
|
env2.terminal,
|
|
296534
296815
|
", v",
|
|
296535
|
-
"0.
|
|
296816
|
+
"0.30.1-by-rayss"
|
|
296536
296817
|
]
|
|
296537
296818
|
}, undefined, true, undefined, this)
|
|
296538
296819
|
]
|
|
@@ -296640,7 +296921,7 @@ ${sanitizedDescription}
|
|
|
296640
296921
|
` + `**Environment Info**
|
|
296641
296922
|
` + `- Platform: ${env2.platform}
|
|
296642
296923
|
` + `- Terminal: ${env2.terminal}
|
|
296643
|
-
` + `- Version: ${"0.
|
|
296924
|
+
` + `- Version: ${"0.30.1-by-rayss"}
|
|
296644
296925
|
` + feedbackIdLine + `
|
|
296645
296926
|
**Errors**
|
|
296646
296927
|
\`\`\`json
|
|
@@ -302482,7 +302763,7 @@ var init_user = __esm(() => {
|
|
|
302482
302763
|
deviceId,
|
|
302483
302764
|
sessionId: getSessionId(),
|
|
302484
302765
|
email: getEmail(),
|
|
302485
|
-
appVersion: "0.
|
|
302766
|
+
appVersion: "0.30.1-by-rayss",
|
|
302486
302767
|
platform: getHostPlatformForAnalytics(),
|
|
302487
302768
|
organizationUuid,
|
|
302488
302769
|
accountUuid,
|
|
@@ -303616,7 +303897,7 @@ function detectLinuxGlobPatternWarnings() {
|
|
|
303616
303897
|
}
|
|
303617
303898
|
async function getDoctorDiagnostic() {
|
|
303618
303899
|
const installationType = await getCurrentInstallationType();
|
|
303619
|
-
const version2 = typeof MACRO !== "undefined" ? "0.
|
|
303900
|
+
const version2 = typeof MACRO !== "undefined" ? "0.30.1-by-rayss" : "unknown";
|
|
303620
303901
|
const installationPath = await getInstallationPath();
|
|
303621
303902
|
const invokedBinary = getInvokedBinary();
|
|
303622
303903
|
const multipleInstallations = await detectMultipleInstallations();
|
|
@@ -304543,8 +304824,8 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
304543
304824
|
const maxVersion = await getMaxVersion();
|
|
304544
304825
|
if (maxVersion && gt(version2, maxVersion)) {
|
|
304545
304826
|
logForDebugging(`Native installer: maxVersion ${maxVersion} is set, capping update from ${version2} to ${maxVersion}`);
|
|
304546
|
-
if (gte("0.
|
|
304547
|
-
logForDebugging(`Native installer: current version ${"0.
|
|
304827
|
+
if (gte("0.30.1-by-rayss", maxVersion)) {
|
|
304828
|
+
logForDebugging(`Native installer: current version ${"0.30.1-by-rayss"} is already at or above maxVersion ${maxVersion}, skipping update`);
|
|
304548
304829
|
logEvent("tengu_native_update_skipped_max_version", {
|
|
304549
304830
|
latency_ms: Date.now() - startTime,
|
|
304550
304831
|
max_version: maxVersion,
|
|
@@ -304555,7 +304836,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
304555
304836
|
version2 = maxVersion;
|
|
304556
304837
|
}
|
|
304557
304838
|
}
|
|
304558
|
-
if (!forceReinstall && version2 === "0.
|
|
304839
|
+
if (!forceReinstall && version2 === "0.30.1-by-rayss" && await versionIsAvailable(version2) && await isPossibleClaudeBinary(executablePath)) {
|
|
304559
304840
|
logForDebugging(`Found ${version2} at ${executablePath}, skipping install`);
|
|
304560
304841
|
logEvent("tengu_native_update_complete", {
|
|
304561
304842
|
latency_ms: Date.now() - startTime,
|
|
@@ -348478,7 +348759,7 @@ function buildPrimarySection() {
|
|
|
348478
348759
|
}, undefined, false, undefined, this);
|
|
348479
348760
|
return [{
|
|
348480
348761
|
label: "Version",
|
|
348481
|
-
value: "0.
|
|
348762
|
+
value: "0.30.1-by-rayss"
|
|
348482
348763
|
}, {
|
|
348483
348764
|
label: "Session name",
|
|
348484
348765
|
value: nameValue
|
|
@@ -355818,7 +356099,7 @@ function Config({
|
|
|
355818
356099
|
}
|
|
355819
356100
|
}, undefined, false, undefined, this)
|
|
355820
356101
|
}, undefined, false, undefined, this) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsxDEV162(ChannelDowngradeDialog, {
|
|
355821
|
-
currentVersion: "0.
|
|
356102
|
+
currentVersion: "0.30.1-by-rayss",
|
|
355822
356103
|
onChoice: (choice) => {
|
|
355823
356104
|
setShowSubmenu(null);
|
|
355824
356105
|
setTabsHidden(false);
|
|
@@ -355830,7 +356111,7 @@ function Config({
|
|
|
355830
356111
|
autoUpdatesChannel: "stable"
|
|
355831
356112
|
};
|
|
355832
356113
|
if (choice === "stay") {
|
|
355833
|
-
newSettings.minimumVersion = "0.
|
|
356114
|
+
newSettings.minimumVersion = "0.30.1-by-rayss";
|
|
355834
356115
|
}
|
|
355835
356116
|
updateSettingsForSource("userSettings", newSettings);
|
|
355836
356117
|
setSettingsData((prev_27) => ({
|
|
@@ -364905,21 +365186,21 @@ function readPackageManager(env4) {
|
|
|
364905
365186
|
}
|
|
364906
365187
|
function readMacroVersion() {
|
|
364907
365188
|
try {
|
|
364908
|
-
return "0.
|
|
365189
|
+
return "0.30.1-by-rayss";
|
|
364909
365190
|
} catch {
|
|
364910
365191
|
return;
|
|
364911
365192
|
}
|
|
364912
365193
|
}
|
|
364913
365194
|
function readMacroDisplayVersion() {
|
|
364914
365195
|
try {
|
|
364915
|
-
return "0.
|
|
365196
|
+
return "0.30.1-by-rayss";
|
|
364916
365197
|
} catch {
|
|
364917
365198
|
return;
|
|
364918
365199
|
}
|
|
364919
365200
|
}
|
|
364920
365201
|
function readMacroBuildTime() {
|
|
364921
365202
|
try {
|
|
364922
|
-
return "2026-
|
|
365203
|
+
return "2026-09-01T07:43:44.479Z";
|
|
364923
365204
|
} catch {
|
|
364924
365205
|
return;
|
|
364925
365206
|
}
|
|
@@ -388626,9 +388907,57 @@ function SessionPreview(t0) {
|
|
|
388626
388907
|
if ($2[30] !== t12 || $2[31] !== t17) {
|
|
388627
388908
|
t18 = /* @__PURE__ */ jsxDEV233(ThemedBox_default, {
|
|
388628
388909
|
flexDirection: "column",
|
|
388910
|
+
paddingX: 1,
|
|
388629
388911
|
children: [
|
|
388630
|
-
|
|
388631
|
-
|
|
388912
|
+
/* @__PURE__ */ jsxDEV233(ThemedBox_default, {
|
|
388913
|
+
flexDirection: "column",
|
|
388914
|
+
borderStyle: "single",
|
|
388915
|
+
borderColor: "promptBorder",
|
|
388916
|
+
paddingX: 1,
|
|
388917
|
+
paddingY: 1,
|
|
388918
|
+
children: [
|
|
388919
|
+
/* @__PURE__ */ jsxDEV233(ThemedText, {
|
|
388920
|
+
color: "brand",
|
|
388921
|
+
bold: true,
|
|
388922
|
+
children: "Session preview"
|
|
388923
|
+
}, undefined, false, undefined, this),
|
|
388924
|
+
/* @__PURE__ */ jsxDEV233(ThemedText, {
|
|
388925
|
+
dimColor: true,
|
|
388926
|
+
children: "Review this conversation before resuming"
|
|
388927
|
+
}, undefined, false, undefined, this)
|
|
388928
|
+
]
|
|
388929
|
+
}, undefined, true, undefined, this),
|
|
388930
|
+
/* @__PURE__ */ jsxDEV233(ThemedBox_default, {
|
|
388931
|
+
flexDirection: "column",
|
|
388932
|
+
marginTop: 1,
|
|
388933
|
+
children: [
|
|
388934
|
+
/* @__PURE__ */ jsxDEV233(ThemedText, {
|
|
388935
|
+
color: "brand",
|
|
388936
|
+
bold: true,
|
|
388937
|
+
children: "Conversation"
|
|
388938
|
+
}, undefined, false, undefined, this),
|
|
388939
|
+
/* @__PURE__ */ jsxDEV233(ThemedBox_default, {
|
|
388940
|
+
flexDirection: "column",
|
|
388941
|
+
marginTop: 1,
|
|
388942
|
+
children: t12
|
|
388943
|
+
}, undefined, false, undefined, this)
|
|
388944
|
+
]
|
|
388945
|
+
}, undefined, true, undefined, this),
|
|
388946
|
+
/* @__PURE__ */ jsxDEV233(ThemedBox_default, {
|
|
388947
|
+
flexShrink: 0,
|
|
388948
|
+
flexDirection: "column",
|
|
388949
|
+
borderTopDimColor: true,
|
|
388950
|
+
borderBottom: false,
|
|
388951
|
+
borderLeft: false,
|
|
388952
|
+
borderRight: false,
|
|
388953
|
+
borderStyle: "single",
|
|
388954
|
+
paddingTop: 1,
|
|
388955
|
+
marginTop: 1,
|
|
388956
|
+
children: [
|
|
388957
|
+
t15,
|
|
388958
|
+
t16
|
|
388959
|
+
]
|
|
388960
|
+
}, undefined, true, undefined, this)
|
|
388632
388961
|
]
|
|
388633
388962
|
}, undefined, true, undefined, this);
|
|
388634
388963
|
$2[30] = t12;
|
|
@@ -390294,7 +390623,7 @@ function LogSelector(t0) {
|
|
|
390294
390623
|
if (logs.length === 0) {
|
|
390295
390624
|
return null;
|
|
390296
390625
|
}
|
|
390297
|
-
if (viewMode === "preview" && previewLog
|
|
390626
|
+
if (viewMode === "preview" && previewLog) {
|
|
390298
390627
|
let t572;
|
|
390299
390628
|
if ($2[160] === Symbol.for("react.memo_cache_sentinel")) {
|
|
390300
390629
|
t572 = () => {
|
|
@@ -390551,7 +390880,11 @@ function LogSelector(t0) {
|
|
|
390551
390880
|
}, undefined, true, undefined, this) : isResumeWithRenameEnabled ? /* @__PURE__ */ jsxDEV236(TreeSelect, {
|
|
390552
390881
|
nodes: treeNodes,
|
|
390553
390882
|
onSelect: (node_0) => {
|
|
390554
|
-
|
|
390883
|
+
setPreviewLog(node_0.value.log);
|
|
390884
|
+
setViewMode("preview");
|
|
390885
|
+
logEvent("tengu_session_preview_opened", {
|
|
390886
|
+
messageCount: node_0.value.log.messageCount
|
|
390887
|
+
});
|
|
390555
390888
|
},
|
|
390556
390889
|
onFocus: handleTreeSelectFocus,
|
|
390557
390890
|
onCancel,
|
|
@@ -390591,7 +390924,11 @@ function LogSelector(t0) {
|
|
|
390591
390924
|
const itemIndex = parseInt(value_0, 10);
|
|
390592
390925
|
const log_13 = displayedLogs[itemIndex];
|
|
390593
390926
|
if (log_13) {
|
|
390594
|
-
|
|
390927
|
+
setPreviewLog(log_13);
|
|
390928
|
+
setViewMode("preview");
|
|
390929
|
+
logEvent("tengu_session_preview_opened", {
|
|
390930
|
+
messageCount: log_13.messageCount
|
|
390931
|
+
});
|
|
390595
390932
|
}
|
|
390596
390933
|
},
|
|
390597
390934
|
visibleOptionCount: visibleCount,
|
|
@@ -438508,7 +438845,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
438508
438845
|
smapsRollup,
|
|
438509
438846
|
platform: process.platform,
|
|
438510
438847
|
nodeVersion: process.version,
|
|
438511
|
-
ccVersion: "0.
|
|
438848
|
+
ccVersion: "0.30.1-by-rayss"
|
|
438512
438849
|
};
|
|
438513
438850
|
}
|
|
438514
438851
|
async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
@@ -438775,7 +439112,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
438775
439112
|
var call73 = async () => {
|
|
438776
439113
|
return {
|
|
438777
439114
|
type: "text",
|
|
438778
|
-
value: `${"0.
|
|
439115
|
+
value: `${"0.30.1-by-rayss"} (built ${"2026-09-01T07:43:44.479Z"})`
|
|
438779
439116
|
};
|
|
438780
439117
|
}, version2, version_default;
|
|
438781
439118
|
var init_version2 = __esm(() => {
|
|
@@ -439341,7 +439678,7 @@ async function call74(onDone, _context, args) {
|
|
|
439341
439678
|
}, undefined, false, undefined, this));
|
|
439342
439679
|
return null;
|
|
439343
439680
|
}
|
|
439344
|
-
var PACKAGE_URL = "@rayss-dev/openclaude", CURRENT_VERSION = "0.
|
|
439681
|
+
var PACKAGE_URL = "@rayss-dev/openclaude", CURRENT_VERSION = "0.30.1-by-rayss";
|
|
439345
439682
|
var init_update = __esm(() => {
|
|
439346
439683
|
init_StatusIcon();
|
|
439347
439684
|
init_ink2();
|
|
@@ -451467,7 +451804,7 @@ function generateHtmlReport(data, insights) {
|
|
|
451467
451804
|
</html>`;
|
|
451468
451805
|
}
|
|
451469
451806
|
function buildExportData(data, insights, facets) {
|
|
451470
|
-
const version3 = typeof MACRO !== "undefined" ? "0.
|
|
451807
|
+
const version3 = typeof MACRO !== "undefined" ? "0.30.1-by-rayss" : "unknown";
|
|
451471
451808
|
const facets_summary = {
|
|
451472
451809
|
total: facets.size,
|
|
451473
451810
|
goal_categories: {},
|
|
@@ -455978,7 +456315,7 @@ async function readLiteMetadata(filePath, fileSize, buf, sessionId) {
|
|
|
455978
456315
|
const projectPath = extractJsonStringField(head, "cwd");
|
|
455979
456316
|
const teamName = extractJsonStringField(head, "teamName");
|
|
455980
456317
|
const agentSetting = extractJsonStringField(head, "agentSetting");
|
|
455981
|
-
const firstPrompt = extractLastJsonStringField(tail, "lastPrompt") ||
|
|
456318
|
+
const firstPrompt = extractFirstPromptFromChunk(head) || extractLastJsonStringField(tail, "lastPrompt") || extractJsonStringFieldPrefix(head, "content", 200) || extractJsonStringFieldPrefix(head, "text", 200) || "";
|
|
455982
456319
|
const customTitle = extractLastJsonStringField(tail, "customTitle") ?? extractLastJsonStringField(head, "customTitle") ?? extractLastJsonStringField(tail, "aiTitle") ?? extractLastJsonStringField(head, "aiTitle");
|
|
455983
456320
|
const summary = extractLastJsonStringField(tail, "summary");
|
|
455984
456321
|
const tagLine = tail.split(`
|
|
@@ -456245,7 +456582,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
456245
456582
|
init_slowOperations();
|
|
456246
456583
|
init_transcriptFileLock();
|
|
456247
456584
|
init_uuid();
|
|
456248
|
-
VERSION3 = typeof MACRO !== "undefined" ? "0.
|
|
456585
|
+
VERSION3 = typeof MACRO !== "undefined" ? "0.30.1-by-rayss" : "unknown";
|
|
456249
456586
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
456250
456587
|
TRANSCRIPT_COPY_CHUNK_BYTES = 64 * 1024;
|
|
456251
456588
|
transcriptRewriteHooksForTesting = {};
|
|
@@ -457724,7 +458061,7 @@ var init_filesystem = __esm(() => {
|
|
|
457724
458061
|
});
|
|
457725
458062
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
457726
458063
|
const nonce = randomBytes19(16).toString("hex");
|
|
457727
|
-
return join144(getClaudeTempDir(), "bundled-skills", "0.
|
|
458064
|
+
return join144(getClaudeTempDir(), "bundled-skills", "0.30.1-by-rayss", nonce);
|
|
457728
458065
|
});
|
|
457729
458066
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
457730
458067
|
});
|
|
@@ -470582,6 +470919,9 @@ function getContentText(content) {
|
|
|
470582
470919
|
}
|
|
470583
470920
|
return null;
|
|
470584
470921
|
}
|
|
470922
|
+
function getUserMessagePreviewText(content) {
|
|
470923
|
+
return getContentText(content)?.trim() || "(no prompt)";
|
|
470924
|
+
}
|
|
470585
470925
|
var STRIPPED_TAGS_RE;
|
|
470586
470926
|
var init_content = __esm(() => {
|
|
470587
470927
|
init_xml();
|
|
@@ -471132,6 +471472,7 @@ __export(exports_messages, {
|
|
|
471132
471472
|
hasSuccessfulToolCall: () => hasSuccessfulToolCall,
|
|
471133
471473
|
handleMessageFromStream: () => handleMessageFromStream,
|
|
471134
471474
|
getUserMessageText: () => getUserMessageText,
|
|
471475
|
+
getUserMessagePreviewText: () => getUserMessagePreviewText,
|
|
471135
471476
|
getToolUseIDs: () => getToolUseIDs,
|
|
471136
471477
|
getToolUseID: () => getToolUseID,
|
|
471137
471478
|
getToolResultIDs: () => getToolResultIDs,
|
|
@@ -490329,7 +490670,7 @@ var init_schemas4 = __esm(() => {
|
|
|
490329
490670
|
}),
|
|
490330
490671
|
exports_external.object({
|
|
490331
490672
|
source: exports_external.literal("hostPattern"),
|
|
490332
|
-
hostPattern: exports_external.string().describe("Regex pattern to match the host/domain extracted from any marketplace source type. " + 'For github sources, matches against "github.com". For git sources (SSH or HTTPS), ' + "extracts the hostname from the URL. Use in strictKnownMarketplaces to allow all " + 'marketplaces from a specific host (e.g., "^github\\.mycompany\\.com$").')
|
|
490673
|
+
hostPattern: exports_external.string().describe("Regex pattern to match the host/domain extracted from any marketplace source type. " + 'For github sources, matches against "github.com". For git sources (SSH or HTTPS), ' + "extracts the hostname from the URL. Use in strictKnownMarketplaces to allow all " + 'marketplaces from a specific host (e.g., "^github\\.mycompany\\.com$"). ' + "The pattern must match the ENTIRE host: it is anchored before use, so " + '"github\\.mycompany\\.com" cannot be satisfied by a lookalike host such as ' + '"github.mycompany.com.evil.example". Use an explicit wildcard (e.g. ' + '".*\\.mycompany\\.com") to allow subdomains.')
|
|
490333
490674
|
}),
|
|
490334
490675
|
exports_external.object({
|
|
490335
490676
|
source: exports_external.literal("pathPattern"),
|
|
@@ -493566,8 +493907,8 @@ ${deferredToolList}
|
|
|
493566
493907
|
}
|
|
493567
493908
|
const hasChromeTools = filteredTools.some((t) => isToolFromMcpServer(t.name, CLAUDE_IN_CHROME_MCP_SERVER_NAME));
|
|
493568
493909
|
const injectChromeHere = useToolSearch && hasChromeTools && !isMcpInstructionsDeltaEnabled();
|
|
493910
|
+
const attributionEnabled = isAttributionHeaderEnabled();
|
|
493569
493911
|
systemPrompt = asSystemPrompt([
|
|
493570
|
-
getAttributionHeader(fingerprint),
|
|
493571
493912
|
getCLISyspromptPrefix({
|
|
493572
493913
|
isNonInteractive: options2.isNonInteractiveSession,
|
|
493573
493914
|
hasAppendSystemPrompt: options2.hasAppendSystemPrompt
|
|
@@ -493576,12 +493917,6 @@ ${deferredToolList}
|
|
|
493576
493917
|
...advisorModel ? [ADVISOR_TOOL_INSTRUCTIONS] : [],
|
|
493577
493918
|
...injectChromeHere ? [CHROME_TOOL_SEARCH_INSTRUCTIONS] : []
|
|
493578
493919
|
].filter(Boolean));
|
|
493579
|
-
logAPIPrefix(systemPrompt);
|
|
493580
|
-
const enablePromptCaching = options2.enablePromptCaching ?? getPromptCachingEnabled(options2.model);
|
|
493581
|
-
const system = buildSystemPromptBlocks(systemPrompt, enablePromptCaching, {
|
|
493582
|
-
skipGlobalCacheForSystemPrompt: needsToolBasedCacheMarker,
|
|
493583
|
-
querySource: options2.querySource
|
|
493584
|
-
});
|
|
493585
493920
|
const useBetas = betas.length > 0;
|
|
493586
493921
|
const extraToolSchemas = [...options2.extraToolSchemas ?? []];
|
|
493587
493922
|
if (advisorModel) {
|
|
@@ -493622,24 +493957,6 @@ ${deferredToolList}
|
|
|
493622
493957
|
}
|
|
493623
493958
|
const sonnet1mExpLatched = getSonnet1mExpTreatmentEnabled(options2.model);
|
|
493624
493959
|
const effort = resolveAppliedEffort(options2.model, options2.effortValue);
|
|
493625
|
-
if (true) {
|
|
493626
|
-
const toolsForCacheDetection = allTools.filter((t) => !(("defer_loading" in t) && t.defer_loading));
|
|
493627
|
-
recordPromptState({
|
|
493628
|
-
system,
|
|
493629
|
-
toolSchemas: toolsForCacheDetection,
|
|
493630
|
-
querySource: options2.querySource,
|
|
493631
|
-
model: options2.model,
|
|
493632
|
-
agentId: options2.agentId,
|
|
493633
|
-
fastMode: fastModeHeaderLatched,
|
|
493634
|
-
globalCacheStrategy,
|
|
493635
|
-
betas,
|
|
493636
|
-
autoModeActive: afkHeaderLatched,
|
|
493637
|
-
isUsingOverage: currentLimits.isUsingOverage ?? false,
|
|
493638
|
-
cachedMCEnabled: cacheEditingHeaderLatched,
|
|
493639
|
-
effortValue: effort,
|
|
493640
|
-
extraBodyParams: getExtraBodyParams()
|
|
493641
|
-
});
|
|
493642
|
-
}
|
|
493643
493960
|
const startIncludingRetries = Date.now();
|
|
493644
493961
|
let start = Date.now();
|
|
493645
493962
|
let attemptNumber = 0;
|
|
@@ -493673,6 +493990,8 @@ ${deferredToolList}
|
|
|
493673
493990
|
const consumedCacheEdits = cachedMCEnabled ? consumePendingCacheEdits() : null;
|
|
493674
493991
|
const consumedPinnedEdits = cachedMCEnabled ? getPinnedCacheEdits() : [];
|
|
493675
493992
|
let lastRequestBetas;
|
|
493993
|
+
let apiPrefixLogged = false;
|
|
493994
|
+
let promptStateRecorded = false;
|
|
493676
493995
|
const paramsFromContext = (retryContext) => {
|
|
493677
493996
|
const betasParams = [...betas];
|
|
493678
493997
|
if (!betasParams.includes(CONTEXT_1M_BETA_HEADER) && sonnet1mExpLatched) {
|
|
@@ -493719,7 +494038,42 @@ ${deferredToolList}
|
|
|
493719
494038
|
isRedactThinkingActive: betasParams.includes(REDACT_THINKING_BETA_HEADER),
|
|
493720
494039
|
clearAllThinking: thinkingClearLatched
|
|
493721
494040
|
});
|
|
493722
|
-
const
|
|
494041
|
+
const enablePromptCaching = options2.enablePromptCaching ?? getPromptCachingEnabled(retryContext.model);
|
|
494042
|
+
const attributionPolicy = resolveCurrentAnthropicAttributionPolicy({
|
|
494043
|
+
attributionEnabled,
|
|
494044
|
+
providerOverride: options2.providerOverride
|
|
494045
|
+
});
|
|
494046
|
+
const requestSystemPrompt = asSystemPrompt(applyAnthropicAttributionPolicy([
|
|
494047
|
+
getAttributionHeader(fingerprint, attributionPolicy),
|
|
494048
|
+
...systemPrompt
|
|
494049
|
+
].filter(Boolean), attributionPolicy));
|
|
494050
|
+
const system = buildSystemPromptBlocks(requestSystemPrompt, enablePromptCaching, {
|
|
494051
|
+
skipGlobalCacheForSystemPrompt: needsToolBasedCacheMarker,
|
|
494052
|
+
querySource: options2.querySource
|
|
494053
|
+
});
|
|
494054
|
+
if (!apiPrefixLogged) {
|
|
494055
|
+
apiPrefixLogged = true;
|
|
494056
|
+
logAPIPrefix(requestSystemPrompt);
|
|
494057
|
+
}
|
|
494058
|
+
if (!promptStateRecorded) {
|
|
494059
|
+
promptStateRecorded = true;
|
|
494060
|
+
const toolsForCacheDetection = allTools.filter((t) => !(("defer_loading" in t) && t.defer_loading));
|
|
494061
|
+
recordPromptState({
|
|
494062
|
+
system,
|
|
494063
|
+
toolSchemas: toolsForCacheDetection,
|
|
494064
|
+
querySource: options2.querySource,
|
|
494065
|
+
model: options2.model,
|
|
494066
|
+
agentId: options2.agentId,
|
|
494067
|
+
fastMode: fastModeHeaderLatched,
|
|
494068
|
+
globalCacheStrategy,
|
|
494069
|
+
betas,
|
|
494070
|
+
autoModeActive: afkHeaderLatched,
|
|
494071
|
+
isUsingOverage: currentLimits.isUsingOverage ?? false,
|
|
494072
|
+
cachedMCEnabled: cacheEditingHeaderLatched,
|
|
494073
|
+
effortValue: effort,
|
|
494074
|
+
extraBodyParams: getExtraBodyParams()
|
|
494075
|
+
});
|
|
494076
|
+
}
|
|
493723
494077
|
let speed;
|
|
493724
494078
|
const isFastModeForRetry = isFastModeEnabled() && isFastModeAvailable() && !isFastModeCooldown() && isFastModeSupportedByModel(options2.model) && !!retryContext.fastMode;
|
|
493725
494079
|
if (isFastModeForRetry) {
|
|
@@ -493743,7 +494097,7 @@ ${deferredToolList}
|
|
|
493743
494097
|
return {
|
|
493744
494098
|
model: normalizeModelStringForAPI(providerRequestModel),
|
|
493745
494099
|
system,
|
|
493746
|
-
messages: addCacheBreakpoints(messagesForAPI,
|
|
494100
|
+
messages: addCacheBreakpoints(messagesForAPI, enablePromptCaching, options2.querySource, useCachedMC, consumedCacheEdits, consumedPinnedEdits, options2.skipCacheWrite),
|
|
493747
494101
|
tools: allTools,
|
|
493748
494102
|
tool_choice: options2.toolChoice,
|
|
493749
494103
|
...useBetas && { betas: betasParams },
|
|
@@ -495012,6 +495366,7 @@ var init_claude3 = __esm(() => {
|
|
|
495012
495366
|
init_manager();
|
|
495013
495367
|
init_utils3();
|
|
495014
495368
|
init_vcr();
|
|
495369
|
+
init_authRouting();
|
|
495015
495370
|
init_client2();
|
|
495016
495371
|
init_errors4();
|
|
495017
495372
|
init_logging();
|
|
@@ -495680,7 +496035,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
495680
496035
|
slash_commands: inputs.commands.filter((c6) => c6.userInvocable !== false).map((c6) => c6.name),
|
|
495681
496036
|
apiKeySource: getAnthropicApiKeyWithSource().source,
|
|
495682
496037
|
betas: getSdkBetas(),
|
|
495683
|
-
claude_code_version: "0.
|
|
496038
|
+
claude_code_version: "0.30.1-by-rayss",
|
|
495684
496039
|
output_style: outputStyle2,
|
|
495685
496040
|
agents: inputs.agents.map((agent) => agent.agentType),
|
|
495686
496041
|
skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
|
|
@@ -497244,4 +497599,4 @@ export {
|
|
|
497244
497599
|
createAcpServer
|
|
497245
497600
|
};
|
|
497246
497601
|
|
|
497247
|
-
//# debugId=
|
|
497602
|
+
//# debugId=CE1CE181E81E55EB64756E2164756E21
|