@rayss-dev/openclaude 0.30.1-by-rayss → 0.30.2-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/README.md +2 -2
- package/dist/acp.mjs +870 -607
- package/dist/cli.mjs +139 -132
- package/dist/sdk.mjs +294 -161
- package/package.json +1 -1
package/dist/sdk.mjs
CHANGED
|
@@ -7551,8 +7551,7 @@ var init_zai = __esm(() => {
|
|
|
7551
7551
|
validation: {
|
|
7552
7552
|
kind: "credential-env",
|
|
7553
7553
|
routing: {
|
|
7554
|
-
matchDefaultBaseUrl: true
|
|
7555
|
-
matchBaseUrlHosts: ["api.z.ai"]
|
|
7554
|
+
matchDefaultBaseUrl: true
|
|
7556
7555
|
},
|
|
7557
7556
|
credentialEnvVars: ["OPENAI_API_KEY"],
|
|
7558
7557
|
missingCredentialMessage: "OPENAI_API_KEY is required for Z.AI GLM Coding Plan."
|
|
@@ -7560,6 +7559,22 @@ var init_zai = __esm(() => {
|
|
|
7560
7559
|
catalog: {
|
|
7561
7560
|
source: "static",
|
|
7562
7561
|
models: [
|
|
7562
|
+
{
|
|
7563
|
+
id: "glm-5.3-flash",
|
|
7564
|
+
apiName: "glm-5.3-flash",
|
|
7565
|
+
label: "GLM-5.3-Flash",
|
|
7566
|
+
modelDescriptorId: "glm-5.3-flash",
|
|
7567
|
+
reasoning: {
|
|
7568
|
+
mode: "levels",
|
|
7569
|
+
levels: ["low", "high", "xhigh"],
|
|
7570
|
+
wireFormat: "zai_compatible"
|
|
7571
|
+
},
|
|
7572
|
+
transportOverrides: {
|
|
7573
|
+
openaiShim: {
|
|
7574
|
+
enableToolStreaming: true
|
|
7575
|
+
}
|
|
7576
|
+
}
|
|
7577
|
+
},
|
|
7563
7578
|
{
|
|
7564
7579
|
id: "glm-5.3",
|
|
7565
7580
|
apiName: "glm-5.3",
|
|
@@ -9434,7 +9449,7 @@ var init_version = __esm(() => {
|
|
|
9434
9449
|
import_semver = __toESM(require_semver2(), 1);
|
|
9435
9450
|
fallbackBuildVersion = (() => {
|
|
9436
9451
|
try {
|
|
9437
|
-
return "0.30.
|
|
9452
|
+
return "0.30.2-by-rayss";
|
|
9438
9453
|
} catch {
|
|
9439
9454
|
return "0.0.0";
|
|
9440
9455
|
}
|
|
@@ -12681,6 +12696,7 @@ var init_glm = __esm(() => {
|
|
|
12681
12696
|
supportsPreciseTokenCount: false
|
|
12682
12697
|
},
|
|
12683
12698
|
modelIds: [
|
|
12699
|
+
"glm-5.3-flash",
|
|
12684
12700
|
"glm-5.3",
|
|
12685
12701
|
"glm-5.2",
|
|
12686
12702
|
"GLM-5.1",
|
|
@@ -17697,6 +17713,21 @@ var init_glm2 = __esm(() => {
|
|
|
17697
17713
|
supportsPreciseTokenCount: false
|
|
17698
17714
|
};
|
|
17699
17715
|
glm_default2 = [
|
|
17716
|
+
defineModel({
|
|
17717
|
+
id: "glm-5.3-flash",
|
|
17718
|
+
label: "GLM 5.3 Flash",
|
|
17719
|
+
brandId: "glm",
|
|
17720
|
+
vendorId: "zai",
|
|
17721
|
+
classification: ["chat", "reasoning", "vision", "coding"],
|
|
17722
|
+
defaultModel: "glm-5.3-flash",
|
|
17723
|
+
capabilities: {
|
|
17724
|
+
...glmCapabilities,
|
|
17725
|
+
supportsVision: true
|
|
17726
|
+
},
|
|
17727
|
+
contextWindow: 1e6,
|
|
17728
|
+
maxOutputTokens: 131072,
|
|
17729
|
+
runtimeMetadataScope: "catalog"
|
|
17730
|
+
}),
|
|
17700
17731
|
glmModel("glm-5.3", "GLM 5.3", 1e6, 131072, "catalog"),
|
|
17701
17732
|
defineModel({
|
|
17702
17733
|
id: "glm-5v-turbo",
|
|
@@ -31516,6 +31547,9 @@ function normalizeComparableBaseUrl(baseUrl) {
|
|
|
31516
31547
|
return baseUrl.trim().replace(/\/+$/, "").toLowerCase() || null;
|
|
31517
31548
|
}
|
|
31518
31549
|
}
|
|
31550
|
+
function isCanonicalZaiCodingPlanBaseUrl(value) {
|
|
31551
|
+
return normalizeComparableBaseUrl(value) === normalizeComparableBaseUrl(ZAI_CODING_PLAN_BASE_URL);
|
|
31552
|
+
}
|
|
31519
31553
|
function normalizeHost2(baseUrl) {
|
|
31520
31554
|
if (!baseUrl?.trim()) {
|
|
31521
31555
|
return null;
|
|
@@ -32101,6 +32135,9 @@ function profileRouteHonorsBaseUrlBoundary(routeId, baseUrl) {
|
|
|
32101
32135
|
if (routeId === "llmtr") {
|
|
32102
32136
|
return isCanonicalLlmtrInferenceBaseUrl(baseUrl);
|
|
32103
32137
|
}
|
|
32138
|
+
if (routeId === "zai") {
|
|
32139
|
+
return !baseUrl || isCanonicalZaiCodingPlanBaseUrl(baseUrl);
|
|
32140
|
+
}
|
|
32104
32141
|
return true;
|
|
32105
32142
|
}
|
|
32106
32143
|
function resolveActiveRouteIdFromEnv(processEnv = process.env, options) {
|
|
@@ -32119,20 +32156,22 @@ function resolveActiveRouteIdFromEnv(processEnv = process.env, options) {
|
|
|
32119
32156
|
if (isEnvTruthy(processEnv.CLAUDE_CODE_USE_VERTEX)) {
|
|
32120
32157
|
return "vertex";
|
|
32121
32158
|
}
|
|
32122
|
-
const
|
|
32123
|
-
|
|
32159
|
+
const anthropicBaseUrl = hasNonEmptyEnvValue(processEnv.ANTHROPIC_BASE_URL) ? processEnv.ANTHROPIC_BASE_URL : undefined;
|
|
32160
|
+
const knownAnthropicRoute = resolveRouteIdFromBaseUrl(anthropicBaseUrl);
|
|
32161
|
+
if (!isEnvTruthy(processEnv.CLAUDE_CODE_USE_OPENAI) && anthropicBaseUrl && hasNonEmptyEnvValue(processEnv.ANTHROPIC_MODEL) && (hasNonEmptyEnvValue(processEnv.ANTHROPIC_AUTH_TOKEN) || hasNonEmptyEnvValue(processEnv.ANTHROPIC_API_KEY)) && !isFirstPartyAnthropicBaseUrlForEnv(processEnv) && (hasNonEmptyEnvValue(processEnv.ANTHROPIC_AUTH_TOKEN) || knownAnthropicRoute === "custom-anthropic" || !knownAnthropicRoute)) {
|
|
32124
32162
|
return "custom-anthropic";
|
|
32125
32163
|
}
|
|
32126
32164
|
const envOnlyRouteId = resolveEnvOnlyProviderRouteId(processEnv);
|
|
32127
32165
|
if (envOnlyRouteId)
|
|
32128
32166
|
return envOnlyRouteId;
|
|
32129
32167
|
if (isEnvTruthy(processEnv.CLAUDE_CODE_USE_OPENAI)) {
|
|
32130
|
-
const baseUrl = processEnv.OPENAI_BASE_URL
|
|
32168
|
+
const baseUrl = hasNonEmptyEnvValue(processEnv.OPENAI_BASE_URL) ? processEnv.OPENAI_BASE_URL : hasNonEmptyEnvValue(processEnv.OPENAI_API_BASE) ? processEnv.OPENAI_API_BASE : undefined;
|
|
32169
|
+
const hasExplicitBaseUrl = baseUrl !== undefined;
|
|
32131
32170
|
const matchedRoute = resolveRouteIdFromBaseUrl(baseUrl);
|
|
32132
32171
|
if (matchedRoute) {
|
|
32133
32172
|
return matchedRoute;
|
|
32134
32173
|
}
|
|
32135
|
-
if (options?.activeProfileProvider) {
|
|
32174
|
+
if (!hasExplicitBaseUrl && options?.activeProfileProvider) {
|
|
32136
32175
|
const route = resolveProfileRoute(options.activeProfileProvider);
|
|
32137
32176
|
if (route.routeId !== "unknown-fallback" && route.routeId !== "openai" && route.routeId !== "custom" && profileRouteHonorsBaseUrlBoundary(route.routeId, options.activeProfileBaseUrl ?? baseUrl)) {
|
|
32138
32177
|
return route.routeId;
|
|
@@ -32149,7 +32188,7 @@ function resolveActiveRouteIdFromEnv(processEnv = process.env, options) {
|
|
|
32149
32188
|
}
|
|
32150
32189
|
return "custom";
|
|
32151
32190
|
}
|
|
32152
|
-
if (options?.activeProfileProvider) {
|
|
32191
|
+
if (!anthropicBaseUrl && options?.activeProfileProvider) {
|
|
32153
32192
|
const route = resolveProfileRoute(options.activeProfileProvider);
|
|
32154
32193
|
if (route.routeId !== "unknown-fallback" && route.routeId !== "openai" && route.routeId !== "custom" && profileRouteHonorsBaseUrlBoundary(route.routeId, options.activeProfileBaseUrl)) {
|
|
32155
32194
|
return route.routeId;
|
|
@@ -32164,7 +32203,7 @@ function resolveActiveRouteIdFromEnv(processEnv = process.env, options) {
|
|
|
32164
32203
|
function getTransportKindForRoute(routeId) {
|
|
32165
32204
|
return getRouteDescriptor(routeId)?.transportConfig.kind ?? null;
|
|
32166
32205
|
}
|
|
32167
|
-
var XIAOMI_MIMO_PRIMARY_HOST = "api.xiaomimimo.com", XIAOMI_MIMO_STALE_DOCS_HOST = "api.mimo-v2.com", XIAOMI_MIMO_TOKEN_PLAN_HOSTS, XIAOMI_MIMO_PRIMARY_BASE_URL, CONCENTRATE_CANONICAL_INFERENCE_BASE_URL = "https://api.concentrate.ai/v1", LLMTR_CANONICAL_INFERENCE_BASE_URL = "https://llmtr.com/v1", APISMART_CANONICAL_INFERENCE_BASE_URL = "https://gw.apismart.ai/v1";
|
|
32206
|
+
var XIAOMI_MIMO_PRIMARY_HOST = "api.xiaomimimo.com", XIAOMI_MIMO_STALE_DOCS_HOST = "api.mimo-v2.com", XIAOMI_MIMO_TOKEN_PLAN_HOSTS, XIAOMI_MIMO_PRIMARY_BASE_URL, ZAI_CODING_PLAN_BASE_URL = "https://api.z.ai/api/coding/paas/v4", CONCENTRATE_CANONICAL_INFERENCE_BASE_URL = "https://api.concentrate.ai/v1", LLMTR_CANONICAL_INFERENCE_BASE_URL = "https://llmtr.com/v1", APISMART_CANONICAL_INFERENCE_BASE_URL = "https://gw.apismart.ai/v1";
|
|
32168
32207
|
var init_routeMetadata = __esm(() => {
|
|
32169
32208
|
init_integrations();
|
|
32170
32209
|
init_credentialPool();
|
|
@@ -68084,7 +68123,7 @@ function resolveModelRuntimeLimits(options) {
|
|
|
68084
68123
|
if (options.baseUrl !== undefined) {
|
|
68085
68124
|
runtimeEnv.OPENAI_BASE_URL = options.baseUrl;
|
|
68086
68125
|
}
|
|
68087
|
-
const routeId = resolveActiveRouteIdFromEnv(runtimeEnv, {
|
|
68126
|
+
const routeId = options.resolvedRouteId !== undefined ? options.resolvedRouteId : resolveActiveRouteIdFromEnv(runtimeEnv, {
|
|
68088
68127
|
activeProfileProvider: options?.activeProfileProvider,
|
|
68089
68128
|
activeProfileBaseUrl: options?.baseUrl
|
|
68090
68129
|
});
|
|
@@ -68097,10 +68136,9 @@ function resolveModelRuntimeLimits(options) {
|
|
|
68097
68136
|
const externalContextWindow = getOpenAIContextWindowMatches(modelApiName, runtimeEnv);
|
|
68098
68137
|
const externalMaxOutputTokens = getOpenAIMaxOutputTokenMatches(modelApiName, runtimeEnv);
|
|
68099
68138
|
const settings = getInitialSettings();
|
|
68100
|
-
const resolvedWindow = settings.maxContextWindow !== undefined ? settings.maxContextWindow : externalContextWindow.exact ?? catalogEntry3?.contextWindow ?? cachedCatalogEntry?.contextWindow ?? externalContextWindow.prefix ?? externalContextWindow.settings ?? modelDescriptor?.contextWindow;
|
|
68101
68139
|
return {
|
|
68102
|
-
contextWindow:
|
|
68103
|
-
maxOutputTokens: externalMaxOutputTokens.exact ?? catalogEntry3?.maxOutputTokens ??
|
|
68140
|
+
contextWindow: settings.maxContextWindow !== undefined ? settings.maxContextWindow : externalContextWindow.exact ?? catalogEntry3?.contextWindow ?? externalContextWindow.prefix ?? externalContextWindow.settings ?? cachedCatalogEntry?.contextWindow ?? modelDescriptor?.contextWindow,
|
|
68141
|
+
maxOutputTokens: externalMaxOutputTokens.exact ?? catalogEntry3?.maxOutputTokens ?? externalMaxOutputTokens.prefix ?? externalMaxOutputTokens.settings ?? cachedCatalogEntry?.maxOutputTokens ?? modelDescriptor?.maxOutputTokens
|
|
68104
68142
|
};
|
|
68105
68143
|
}
|
|
68106
68144
|
function usesAnthropicNativeMessageFormat(options) {
|
|
@@ -69144,7 +69182,7 @@ function getAttributionHeader(fingerprint, policy) {
|
|
|
69144
69182
|
if (!policy.generate) {
|
|
69145
69183
|
return "";
|
|
69146
69184
|
}
|
|
69147
|
-
const version2 = `${"0.30.
|
|
69185
|
+
const version2 = `${"0.30.2-by-rayss"}.${fingerprint}`;
|
|
69148
69186
|
const entrypoint = process.env.CLAUDE_CODE_ENTRYPOINT ?? "unknown";
|
|
69149
69187
|
const cch = "";
|
|
69150
69188
|
const workload = getWorkload();
|
|
@@ -98650,6 +98688,9 @@ function resolveProfileCapabilityRouteId(provider, baseUrl) {
|
|
|
98650
98688
|
if (routeIdFromBaseUrl) {
|
|
98651
98689
|
return routeIdFromBaseUrl;
|
|
98652
98690
|
}
|
|
98691
|
+
if (providerRouteId === "zai" && baseUrl) {
|
|
98692
|
+
return "custom";
|
|
98693
|
+
}
|
|
98653
98694
|
if ((providerRouteId === "cloudflare" || providerRouteId === "longcat" || providerRouteId === "concentrate" || providerRouteId === "llmtr") && baseUrl && !(providerRouteId === "cloudflare" ? isCloudflareBaseUrl(baseUrl) : providerRouteId === "longcat" ? isLongcatBaseUrl(baseUrl) : providerRouteId === "concentrate" ? isCanonicalConcentrateInferenceBaseUrl(baseUrl) : isCanonicalLlmtrInferenceBaseUrl(baseUrl))) {
|
|
98654
98695
|
return "custom";
|
|
98655
98696
|
}
|
|
@@ -102709,7 +102750,7 @@ var init_metadata = __esm(() => {
|
|
|
102709
102750
|
COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
|
|
102710
102751
|
WHITESPACE_REGEX = /\s+/;
|
|
102711
102752
|
getVersionBase = memoize_default(() => {
|
|
102712
|
-
const match = "0.30.
|
|
102753
|
+
const match = "0.30.2-by-rayss".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
|
|
102713
102754
|
return match ? match[0] : undefined;
|
|
102714
102755
|
});
|
|
102715
102756
|
buildEnvContext = memoize_default(async () => {
|
|
@@ -102749,9 +102790,9 @@ var init_metadata = __esm(() => {
|
|
|
102749
102790
|
isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
|
|
102750
102791
|
isClaudeCodeAction: isEnvTruthy(process.env.CLAUDE_CODE_ACTION),
|
|
102751
102792
|
isClaudeAiAuth: isClaudeAISubscriber(),
|
|
102752
|
-
version: "0.30.
|
|
102793
|
+
version: "0.30.2-by-rayss",
|
|
102753
102794
|
versionBase: getVersionBase(),
|
|
102754
|
-
buildTime: "2026-09-
|
|
102795
|
+
buildTime: "2026-09-05T03:58:52.070Z",
|
|
102755
102796
|
deploymentEnvironment: env2.detectDeploymentEnvironment(),
|
|
102756
102797
|
...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
|
|
102757
102798
|
githubEventName: process.env.GITHUB_EVENT_NAME,
|
|
@@ -111474,7 +111515,7 @@ var init_effort = __esm(() => {
|
|
|
111474
111515
|
|
|
111475
111516
|
// src/utils/userAgent.ts
|
|
111476
111517
|
function getClaudeCodeUserAgent() {
|
|
111477
|
-
return `claude-code/${"0.30.
|
|
111518
|
+
return `claude-code/${"0.30.2-by-rayss"}`;
|
|
111478
111519
|
}
|
|
111479
111520
|
|
|
111480
111521
|
// src/utils/http.ts
|
|
@@ -111483,7 +111524,7 @@ function getUserAgent() {
|
|
|
111483
111524
|
const clientApp = process.env.CLAUDE_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}` : "";
|
|
111484
111525
|
const workload = getWorkload();
|
|
111485
111526
|
const workloadSuffix = workload ? `, workload/${workload}` : "";
|
|
111486
|
-
return `claude-cli/${"0.30.
|
|
111527
|
+
return `claude-cli/${"0.30.2-by-rayss"} (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
|
|
111487
111528
|
}
|
|
111488
111529
|
function getMCPUserAgent() {
|
|
111489
111530
|
const parts = [];
|
|
@@ -111497,7 +111538,7 @@ function getMCPUserAgent() {
|
|
|
111497
111538
|
parts.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`);
|
|
111498
111539
|
}
|
|
111499
111540
|
const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
111500
|
-
return `claude-code/${"0.30.
|
|
111541
|
+
return `claude-code/${"0.30.2-by-rayss"}${suffix}`;
|
|
111501
111542
|
}
|
|
111502
111543
|
function getWebFetchUserAgent() {
|
|
111503
111544
|
const supportUrl = isFirstPartyAnthropicProvider() ? "https://support.anthropic.com/" : "https://github.com/rayss868/openclaude";
|
|
@@ -133449,16 +133490,8 @@ async function callInner(file_path, fullFilePath, resolvedFilePath, ext, offset,
|
|
|
133449
133490
|
});
|
|
133450
133491
|
context2.nestedMemoryAttachmentTriggers?.add(fullFilePath);
|
|
133451
133492
|
return {
|
|
133452
|
-
data:
|
|
133453
|
-
|
|
133454
|
-
file: {
|
|
133455
|
-
filePath: file_path,
|
|
133456
|
-
content: metadataText,
|
|
133457
|
-
numLines: 1,
|
|
133458
|
-
startLine: 1,
|
|
133459
|
-
totalLines: 1
|
|
133460
|
-
}
|
|
133461
|
-
}
|
|
133493
|
+
data: await readImageWithTokenBudget(resolvedFilePath, maxTokens),
|
|
133494
|
+
newMessages: [createUserMessage({ content: metadataText, isMeta: true })]
|
|
133462
133495
|
};
|
|
133463
133496
|
}
|
|
133464
133497
|
if (isPDFExtension(ext)) {
|
|
@@ -155158,7 +155191,7 @@ function computeFingerprint(messageText2, version2) {
|
|
|
155158
155191
|
}
|
|
155159
155192
|
function computeFingerprintFromMessages(messages) {
|
|
155160
155193
|
const firstMessageText = extractFirstMessageText(messages);
|
|
155161
|
-
return computeFingerprint(firstMessageText, "0.30.
|
|
155194
|
+
return computeFingerprint(firstMessageText, "0.30.2-by-rayss");
|
|
155162
155195
|
}
|
|
155163
155196
|
var FINGERPRINT_SALT = "59cf53e54c78";
|
|
155164
155197
|
var init_fingerprint = () => {};
|
|
@@ -156525,7 +156558,7 @@ var init_client2 = __esm(() => {
|
|
|
156525
156558
|
const client = new Client({
|
|
156526
156559
|
name: "claude-code",
|
|
156527
156560
|
title: "OpenClaude",
|
|
156528
|
-
version: "0.30.
|
|
156561
|
+
version: "0.30.2-by-rayss",
|
|
156529
156562
|
description: "OpenClaude — coding-agent CLI for any LLM provider",
|
|
156530
156563
|
websiteUrl: PRODUCT_URL
|
|
156531
156564
|
}, {
|
|
@@ -233491,7 +233524,7 @@ function getAnthropicEnvMetadata() {
|
|
|
233491
233524
|
function getBuildAgeMinutes() {
|
|
233492
233525
|
if (false)
|
|
233493
233526
|
;
|
|
233494
|
-
const buildTime = new Date("2026-09-
|
|
233527
|
+
const buildTime = new Date("2026-09-05T03:58:52.070Z").getTime();
|
|
233495
233528
|
if (isNaN(buildTime))
|
|
233496
233529
|
return;
|
|
233497
233530
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -235660,6 +235693,83 @@ var init_LocalShellTask = __esm(() => {
|
|
|
235660
235693
|
};
|
|
235661
235694
|
});
|
|
235662
235695
|
|
|
235696
|
+
// src/tools/BashTool/commandRepair.ts
|
|
235697
|
+
import { writeFile as writeFile19 } from "fs/promises";
|
|
235698
|
+
import { join as join79 } from "path";
|
|
235699
|
+
function findInlineScripts(command) {
|
|
235700
|
+
const results = [];
|
|
235701
|
+
const nodePatterns = [
|
|
235702
|
+
/(^|\s|&&|\|\|)(node\s+(?:--input-type=\S+\s+)?-e)\s+('(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*")/g,
|
|
235703
|
+
/(^|\s|&&|\|\|)(node\s+(?:--input-type=\S+\s+)?-e)\s+(\$'[^']+')/g
|
|
235704
|
+
];
|
|
235705
|
+
const pythonPatterns = [
|
|
235706
|
+
/(^|\s|&&|\|\|)((?:python3?|pypy3?)\s+-c)\s+('(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*")/g,
|
|
235707
|
+
/(^|\s|&&|\|\|)((?:python3?|pypy3?)\s+-c)\s+(\$'[^']+')/g
|
|
235708
|
+
];
|
|
235709
|
+
for (const pattern of [...nodePatterns, ...pythonPatterns]) {
|
|
235710
|
+
let match;
|
|
235711
|
+
while ((match = pattern.exec(command)) !== null) {
|
|
235712
|
+
const lang = match[2].startsWith("node") ? "node" : "python";
|
|
235713
|
+
const raw = match[3];
|
|
235714
|
+
const code = raw.startsWith("'") && raw.endsWith("'") || raw.startsWith('"') && raw.endsWith('"') ? raw.slice(1, -1) : raw;
|
|
235715
|
+
results.push({
|
|
235716
|
+
full: match[0],
|
|
235717
|
+
prefix: match[2],
|
|
235718
|
+
lang,
|
|
235719
|
+
code,
|
|
235720
|
+
start: match.index,
|
|
235721
|
+
end: match.index + match[0].length
|
|
235722
|
+
});
|
|
235723
|
+
}
|
|
235724
|
+
}
|
|
235725
|
+
return results;
|
|
235726
|
+
}
|
|
235727
|
+
function needsRepair(code) {
|
|
235728
|
+
if (code.includes("!"))
|
|
235729
|
+
return true;
|
|
235730
|
+
if (code.includes("`"))
|
|
235731
|
+
return true;
|
|
235732
|
+
if (code.length > 300)
|
|
235733
|
+
return true;
|
|
235734
|
+
return false;
|
|
235735
|
+
}
|
|
235736
|
+
function getRunner(lang) {
|
|
235737
|
+
if (lang === "node") {
|
|
235738
|
+
return { ext: ".mjs", cmd: "node" };
|
|
235739
|
+
}
|
|
235740
|
+
return { ext: ".py", cmd: "python" };
|
|
235741
|
+
}
|
|
235742
|
+
async function repairCommand(command) {
|
|
235743
|
+
const scripts = findInlineScripts(command);
|
|
235744
|
+
if (scripts.length === 0)
|
|
235745
|
+
return command;
|
|
235746
|
+
const needsRepairAny = scripts.some((s) => needsRepair(s.code));
|
|
235747
|
+
if (!needsRepairAny)
|
|
235748
|
+
return command;
|
|
235749
|
+
let result = command;
|
|
235750
|
+
for (const script of [...scripts].reverse()) {
|
|
235751
|
+
if (!needsRepair(script.code))
|
|
235752
|
+
continue;
|
|
235753
|
+
const { ext, cmd } = getRunner(script.lang);
|
|
235754
|
+
const id = Math.random().toString(36).slice(2, 10);
|
|
235755
|
+
const tempDir = getClaudeTempDir();
|
|
235756
|
+
const tempFile = join79(tempDir, `_inline_${id}${ext}`);
|
|
235757
|
+
let cleanCode = script.code;
|
|
235758
|
+
if (script.lang === "node") {
|
|
235759
|
+
cleanCode = cleanCode.replace(/\\\$/g, "$").replace(/\\\`/g, "`").replace(/\\\\/g, "\\");
|
|
235760
|
+
}
|
|
235761
|
+
await writeFile19(tempFile, cleanCode, "utf8");
|
|
235762
|
+
const runCmd = `( trap 'rm -f "${tempFile}"' EXIT; ${cmd} "${tempFile}" )`;
|
|
235763
|
+
result = runCmd;
|
|
235764
|
+
logForDebugging(`[commandRepair] Rewrote inline ${script.lang} script (${script.code.length} chars) to temp file: ${tempFile}`);
|
|
235765
|
+
}
|
|
235766
|
+
return result;
|
|
235767
|
+
}
|
|
235768
|
+
var init_commandRepair = __esm(() => {
|
|
235769
|
+
init_filesystem();
|
|
235770
|
+
init_debug();
|
|
235771
|
+
});
|
|
235772
|
+
|
|
235663
235773
|
// src/utils/claudeCodeHints.ts
|
|
235664
235774
|
function extractClaudeCodeHints(output, command) {
|
|
235665
235775
|
if (!output.includes("<claude-code-hint")) {
|
|
@@ -236384,8 +236494,8 @@ var init_types9 = __esm(() => {
|
|
|
236384
236494
|
|
|
236385
236495
|
// src/services/teamMemorySync/index.ts
|
|
236386
236496
|
import { createHash as createHash11 } from "crypto";
|
|
236387
|
-
import { mkdir as mkdir22, readdir as readdir16, readFile as readFile21, stat as stat24, writeFile as
|
|
236388
|
-
import { join as
|
|
236497
|
+
import { mkdir as mkdir22, readdir as readdir16, readFile as readFile21, stat as stat24, writeFile as writeFile20 } from "fs/promises";
|
|
236498
|
+
import { join as join80, relative as relative14, sep as sep20 } from "path";
|
|
236389
236499
|
function createSyncState() {
|
|
236390
236500
|
return {
|
|
236391
236501
|
lastKnownChecksum: null,
|
|
@@ -236701,7 +236811,7 @@ async function collectLocalTeamMemoryFiles(teamDir, deps) {
|
|
|
236701
236811
|
throw e;
|
|
236702
236812
|
}
|
|
236703
236813
|
for (const entry of dirEntries) {
|
|
236704
|
-
const fullPath =
|
|
236814
|
+
const fullPath = join80(dir, entry.name);
|
|
236705
236815
|
if (entry.isDirectory()) {
|
|
236706
236816
|
await walkDir(fullPath);
|
|
236707
236817
|
continue;
|
|
@@ -237115,7 +237225,7 @@ var init_teamMemorySync = __esm(() => {
|
|
|
237115
237225
|
validateTeamMemKey,
|
|
237116
237226
|
readFile: (path13) => readFile21(path13, "utf8"),
|
|
237117
237227
|
mkdir: (path13, options2) => mkdir22(path13, options2),
|
|
237118
|
-
writeFile: (path13, content) =>
|
|
237228
|
+
writeFile: (path13, content) => writeFile20(path13, content, "utf8")
|
|
237119
237229
|
};
|
|
237120
237230
|
});
|
|
237121
237231
|
|
|
@@ -237132,7 +237242,7 @@ __export(exports_watcher, {
|
|
|
237132
237242
|
});
|
|
237133
237243
|
import { watch as watch2 } from "fs";
|
|
237134
237244
|
import { mkdir as mkdir23, stat as stat25 } from "fs/promises";
|
|
237135
|
-
import { join as
|
|
237245
|
+
import { join as join81 } from "path";
|
|
237136
237246
|
function isPermanentFailure(r) {
|
|
237137
237247
|
if (r.errorType === "no_oauth" || r.errorType === "no_repo")
|
|
237138
237248
|
return true;
|
|
@@ -237230,7 +237340,7 @@ async function startFileWatcher(teamDir) {
|
|
|
237230
237340
|
return;
|
|
237231
237341
|
}
|
|
237232
237342
|
if (pushSuppressedReason !== null) {
|
|
237233
|
-
stat25(
|
|
237343
|
+
stat25(join81(teamDir, filename)).catch((err2) => {
|
|
237234
237344
|
if (err2.code !== "ENOENT")
|
|
237235
237345
|
return;
|
|
237236
237346
|
if (pushSuppressedReason !== null) {
|
|
@@ -237747,7 +237857,14 @@ function getSimplePrompt() {
|
|
|
237747
237857
|
sleepSubitems,
|
|
237748
237858
|
...embedded ? [
|
|
237749
237859
|
"When using `find -regex` with alternation, put the longest alternative first. Example: use `'.*\\.\\(tsx\\|ts\\)'` not `'.*\\.\\(ts\\|tsx\\)'` — the second form silently skips `.tsx` files."
|
|
237750
|
-
] : []
|
|
237860
|
+
] : [],
|
|
237861
|
+
"Inline scripts (node -e / python -c):",
|
|
237862
|
+
[
|
|
237863
|
+
"NEVER use `node -e` or `python -c` with inline code that contains the `!` character. Bash interprets `!` as history expansion BEFORE passing the string to the interpreter, causing syntax errors. Examples of breaking code: `!!`, `!==`, `!!value`.",
|
|
237864
|
+
"For short one-liners without `!`, inline is fine.",
|
|
237865
|
+
'For complex or multi-line scripts, ALWAYS write the code to a temporary file first using the Write tool, then execute the file (e.g. `node "$TMPDIR/script.mjs"` or `python "$TMPDIR/script.py"`).',
|
|
237866
|
+
"If you must use inline with `!`, prefix with `set +H` to disable history expansion, or use the temp-file approach above."
|
|
237867
|
+
]
|
|
237751
237868
|
];
|
|
237752
237869
|
return [
|
|
237753
237870
|
"Executes a given bash command and returns its output.",
|
|
@@ -238463,7 +238580,11 @@ async function* runShellCommand({
|
|
|
238463
238580
|
});
|
|
238464
238581
|
}
|
|
238465
238582
|
const shouldAutoBackground = !isBackgroundTasksDisabled2 && isAutobackgroundingAllowed(command);
|
|
238466
|
-
|
|
238583
|
+
let finalCommand = command;
|
|
238584
|
+
try {
|
|
238585
|
+
finalCommand = await repairCommand(command);
|
|
238586
|
+
} catch {}
|
|
238587
|
+
const shellCommand = await exec2(finalCommand, abortController.signal, "bash", {
|
|
238467
238588
|
timeout: timeoutMs,
|
|
238468
238589
|
onProgress(lastLines, allLines, totalLines, totalBytes, isIncomplete) {
|
|
238469
238590
|
lastProgressOutput = lastLines;
|
|
@@ -238662,6 +238783,7 @@ var init_BashTool = __esm(() => {
|
|
|
238662
238783
|
init_LocalShellTask();
|
|
238663
238784
|
init_ast();
|
|
238664
238785
|
init_commands2();
|
|
238786
|
+
init_commandRepair();
|
|
238665
238787
|
init_claudeCodeHints();
|
|
238666
238788
|
init_codeIndexing();
|
|
238667
238789
|
init_envUtils();
|
|
@@ -239319,12 +239441,12 @@ import {
|
|
|
239319
239441
|
basename as basename23,
|
|
239320
239442
|
dirname as dirname42,
|
|
239321
239443
|
isAbsolute as isAbsolute23,
|
|
239322
|
-
join as
|
|
239444
|
+
join as join82,
|
|
239323
239445
|
sep as pathSep,
|
|
239324
239446
|
relative as relative15
|
|
239325
239447
|
} from "path";
|
|
239326
239448
|
function getProjectSkillsPaths(dir) {
|
|
239327
|
-
return PROJECT_CONFIG_DIR_NAMES.map((configDirName) =>
|
|
239449
|
+
return PROJECT_CONFIG_DIR_NAMES.map((configDirName) => join82(dir, configDirName, "skills"));
|
|
239328
239450
|
}
|
|
239329
239451
|
function prefersOpenClaudeConfigDir(path13) {
|
|
239330
239452
|
return path13.split(pathSep).includes(".openclaude") ? 0 : 1;
|
|
@@ -239348,7 +239470,7 @@ function isPlainObject5(value) {
|
|
|
239348
239470
|
}
|
|
239349
239471
|
async function readSkillJsonMetadata(skillDirPath) {
|
|
239350
239472
|
try {
|
|
239351
|
-
const raw = await getFsImplementation().readFile(
|
|
239473
|
+
const raw = await getFsImplementation().readFile(join82(skillDirPath, "skill.json"), {
|
|
239352
239474
|
encoding: "utf-8"
|
|
239353
239475
|
});
|
|
239354
239476
|
const parsed = JSON.parse(raw);
|
|
@@ -239521,7 +239643,7 @@ async function findSkillMarkdownFiles(basePath) {
|
|
|
239521
239643
|
}
|
|
239522
239644
|
const childDirs = [];
|
|
239523
239645
|
for (const entry of entries2) {
|
|
239524
|
-
const entryPath =
|
|
239646
|
+
const entryPath = join82(skillDirPath, entry.name);
|
|
239525
239647
|
if (isSkillFile2(entryPath)) {
|
|
239526
239648
|
skillFiles.push(entryPath);
|
|
239527
239649
|
continue;
|
|
@@ -239556,7 +239678,7 @@ async function findSkillMarkdownFiles(basePath) {
|
|
|
239556
239678
|
}
|
|
239557
239679
|
const topLevelDirs = [];
|
|
239558
239680
|
for (const entry of entries) {
|
|
239559
|
-
const entryPath =
|
|
239681
|
+
const entryPath = join82(basePath, entry.name);
|
|
239560
239682
|
if (entry.isDirectory()) {
|
|
239561
239683
|
topLevelDirs.push(entryPath);
|
|
239562
239684
|
continue;
|
|
@@ -239852,8 +239974,8 @@ var init_loadSkillsDir = __esm(() => {
|
|
|
239852
239974
|
init_types2();
|
|
239853
239975
|
import_ignore2 = __toESM(require_ignore(), 1);
|
|
239854
239976
|
getSkillDirCommands = memoize_default(async (cwd2) => {
|
|
239855
|
-
const userSkillsDir =
|
|
239856
|
-
const managedSkillsDir =
|
|
239977
|
+
const userSkillsDir = join82(getClaudeConfigHomeDir(), "skills");
|
|
239978
|
+
const managedSkillsDir = join82(getManagedFilePath(), ".openclaude", "skills");
|
|
239857
239979
|
const projectSkillsDirs = getProjectDirsUpToHome("skills", cwd2).sort(compareSkillDirPrecedence);
|
|
239858
239980
|
logForDebugging(`Loading skills from: managed=${managedSkillsDir}, user=${userSkillsDir}, project=[${projectSkillsDirs.join(", ")}]`);
|
|
239859
239981
|
const additionalDirs = getAdditionalDirectoriesForClaudeMd();
|
|
@@ -241043,8 +241165,8 @@ var init_toolSearch = __esm(() => {
|
|
|
241043
241165
|
|
|
241044
241166
|
// src/services/vcr.ts
|
|
241045
241167
|
import { createHash as createHash12, randomUUID as randomUUID19 } from "crypto";
|
|
241046
|
-
import { mkdir as mkdir24, readFile as readFile22, writeFile as
|
|
241047
|
-
import { dirname as dirname43, join as
|
|
241168
|
+
import { mkdir as mkdir24, readFile as readFile22, writeFile as writeFile21 } from "fs/promises";
|
|
241169
|
+
import { dirname as dirname43, join as join83 } from "path";
|
|
241048
241170
|
function shouldUseVCR() {
|
|
241049
241171
|
if (false) {}
|
|
241050
241172
|
if (process.env.USER_TYPE === "ant" && isEnvTruthy(process.env.FORCE_VCR)) {
|
|
@@ -241057,7 +241179,7 @@ async function withFixture(input, fixtureName, f) {
|
|
|
241057
241179
|
return await f();
|
|
241058
241180
|
}
|
|
241059
241181
|
const hash = createHash12("sha1").update(jsonStringify(input)).digest("hex").slice(0, 12);
|
|
241060
|
-
const filename =
|
|
241182
|
+
const filename = join83(process.env.CLAUDE_CODE_TEST_FIXTURES_ROOT ?? getCwd(), `fixtures/${fixtureName}-${hash}.json`);
|
|
241061
241183
|
try {
|
|
241062
241184
|
const cached3 = jsonParse(await readFile22(filename, { encoding: "utf8" }));
|
|
241063
241185
|
return cached3;
|
|
@@ -241072,7 +241194,7 @@ async function withFixture(input, fixtureName, f) {
|
|
|
241072
241194
|
}
|
|
241073
241195
|
const result = await f();
|
|
241074
241196
|
await mkdir24(dirname43(filename), { recursive: true });
|
|
241075
|
-
await
|
|
241197
|
+
await writeFile21(filename, jsonStringify(result, null, 2), {
|
|
241076
241198
|
encoding: "utf8"
|
|
241077
241199
|
});
|
|
241078
241200
|
return result;
|
|
@@ -241091,7 +241213,7 @@ async function withVCR(messages, f) {
|
|
|
241091
241213
|
return true;
|
|
241092
241214
|
}));
|
|
241093
241215
|
const dehydratedInput = mapMessages(messagesForAPI.map((_) => _.message.content), dehydrateValue);
|
|
241094
|
-
const filename =
|
|
241216
|
+
const filename = join83(process.env.CLAUDE_CODE_TEST_FIXTURES_ROOT ?? getCwd(), `fixtures/${dehydratedInput.map((_) => createHash12("sha1").update(jsonStringify(_)).digest("hex").slice(0, 6)).join("-")}.json`);
|
|
241095
241217
|
try {
|
|
241096
241218
|
const cached3 = jsonParse(await readFile22(filename, { encoding: "utf8" }));
|
|
241097
241219
|
cached3.output.forEach(addCachedCostToTotalSessionCost);
|
|
@@ -241111,7 +241233,7 @@ ${jsonStringify(dehydratedInput, null, 2)}`);
|
|
|
241111
241233
|
return results;
|
|
241112
241234
|
}
|
|
241113
241235
|
await mkdir24(dirname43(filename), { recursive: true });
|
|
241114
|
-
await
|
|
241236
|
+
await writeFile21(filename, jsonStringify({
|
|
241115
241237
|
input: dehydratedInput,
|
|
241116
241238
|
output: results.map((message, index) => mapMessage(message, dehydrateValue, index))
|
|
241117
241239
|
}, null, 2), { encoding: "utf8" });
|
|
@@ -242242,9 +242364,9 @@ var init_postCompactCleanup = __esm(() => {
|
|
|
242242
242364
|
|
|
242243
242365
|
// src/services/SessionMemory/prompts.ts
|
|
242244
242366
|
import { readFile as readFile23 } from "fs/promises";
|
|
242245
|
-
import { join as
|
|
242367
|
+
import { join as join84 } from "path";
|
|
242246
242368
|
async function loadSessionMemoryTemplate() {
|
|
242247
|
-
const templatePath =
|
|
242369
|
+
const templatePath = join84(getClaudeConfigHomeDir(), "session-memory", "config", "template.md");
|
|
242248
242370
|
try {
|
|
242249
242371
|
return await readFile23(templatePath, { encoding: "utf-8" });
|
|
242250
242372
|
} catch (e) {
|
|
@@ -243550,7 +243672,7 @@ function prepareOpenAIRequest({
|
|
|
243550
243672
|
model: runtimeModel,
|
|
243551
243673
|
baseUrl: request.baseUrl,
|
|
243552
243674
|
processEnv: requestProcessEnv,
|
|
243553
|
-
|
|
243675
|
+
resolvedRouteId: runtimeShimContext.routeId
|
|
243554
243676
|
});
|
|
243555
243677
|
const shimConfig = runtimeShimContext.openaiShimConfig;
|
|
243556
243678
|
const effectiveTransport = shimConfig.endpointPath === "/responses" ? "responses" : shimConfig.endpointPath === "/messages" ? "anthropic_messages" : shimConfig.endpointPath?.startsWith("/models/gemini-") ? "gemini" : request.transport;
|
|
@@ -243675,10 +243797,11 @@ function prepareOpenAIRequest({
|
|
|
243675
243797
|
let responsesInput;
|
|
243676
243798
|
let responsesMessages;
|
|
243677
243799
|
const getResponsesInput = () => {
|
|
243678
|
-
responsesMessages ??= effectiveTransport === "chat_completions" ? fastPath.skipToolHistoryCompression || skipCompressionForPrefixCache ? rawMessages : compressToolHistory(rawMessages,
|
|
243800
|
+
responsesMessages ??= effectiveTransport === "chat_completions" ? fastPath.skipToolHistoryCompression || skipCompressionForPrefixCache ? rawMessages : compressToolHistory(rawMessages, runtimeModel, {
|
|
243679
243801
|
textBlockSeparator: `
|
|
243680
243802
|
`,
|
|
243681
|
-
omitOldUserImages: true
|
|
243803
|
+
omitOldUserImages: true,
|
|
243804
|
+
runtimeLimits
|
|
243682
243805
|
}) : compressedMessages;
|
|
243683
243806
|
responsesInput ??= convertAnthropicMessagesToResponsesInput(responsesMessages, effectiveTransport === "responses_compat");
|
|
243684
243807
|
return responsesInput;
|
|
@@ -253998,7 +254121,7 @@ var init_permissionSetup = __esm(() => {
|
|
|
253998
254121
|
import { statSync as statSync6 } from "fs";
|
|
253999
254122
|
import { lstat as lstat6, readdir as readdir17, readFile as readFile24, realpath as realpath9, stat as stat26 } from "fs/promises";
|
|
254000
254123
|
import { homedir as homedir22 } from "os";
|
|
254001
|
-
import { dirname as dirname44, join as
|
|
254124
|
+
import { dirname as dirname44, join as join85, resolve as resolve30, sep as sep21 } from "path";
|
|
254002
254125
|
function getMaxMarkdownFileSizeBytes() {
|
|
254003
254126
|
const raw = process.env.CLAUDE_CODE_MAX_MARKDOWN_FILE_SIZE_BYTES;
|
|
254004
254127
|
if (!raw)
|
|
@@ -254106,7 +254229,7 @@ function getProjectDirsUpToHome(subdir, cwd2) {
|
|
|
254106
254229
|
break;
|
|
254107
254230
|
}
|
|
254108
254231
|
for (const configDirName of PROJECT_CONFIG_DIR_NAMES) {
|
|
254109
|
-
const configSubdir =
|
|
254232
|
+
const configSubdir = join85(current, configDirName, subdir);
|
|
254110
254233
|
try {
|
|
254111
254234
|
statSync6(configSubdir);
|
|
254112
254235
|
dirs.push(configSubdir);
|
|
@@ -254154,7 +254277,7 @@ async function findMarkdownFilesNative(dir, signal) {
|
|
|
254154
254277
|
if (signal.aborted) {
|
|
254155
254278
|
break;
|
|
254156
254279
|
}
|
|
254157
|
-
const fullPath =
|
|
254280
|
+
const fullPath = join85(currentDir, entry.name);
|
|
254158
254281
|
try {
|
|
254159
254282
|
if (entry.isSymbolicLink()) {
|
|
254160
254283
|
try {
|
|
@@ -254263,17 +254386,17 @@ var init_markdownConfigLoader = __esm(() => {
|
|
|
254263
254386
|
oversizedMarkdownSkips = new Map;
|
|
254264
254387
|
loadMarkdownFilesForSubdir = memoize_default(async function(subdir, cwd2) {
|
|
254265
254388
|
const searchStartTime = Date.now();
|
|
254266
|
-
const userDir =
|
|
254267
|
-
const managedDir =
|
|
254389
|
+
const userDir = join85(getClaudeConfigHomeDir(), subdir);
|
|
254390
|
+
const managedDir = join85(getManagedFilePath(), ".openclaude", subdir);
|
|
254268
254391
|
const projectDirs = getProjectDirsUpToHome(subdir, cwd2);
|
|
254269
254392
|
const gitRoot = findGitRoot(cwd2);
|
|
254270
254393
|
const canonicalRoot = findCanonicalGitRoot(cwd2);
|
|
254271
254394
|
if (gitRoot && canonicalRoot && canonicalRoot !== gitRoot) {
|
|
254272
|
-
const worktreeSubdirs = PROJECT_CONFIG_DIR_NAMES.map((configDirName) => normalizePathForComparison(
|
|
254395
|
+
const worktreeSubdirs = PROJECT_CONFIG_DIR_NAMES.map((configDirName) => normalizePathForComparison(join85(gitRoot, configDirName, subdir)));
|
|
254273
254396
|
const worktreeHasSubdir = projectDirs.some((dir) => worktreeSubdirs.includes(normalizePathForComparison(dir)));
|
|
254274
254397
|
if (!worktreeHasSubdir) {
|
|
254275
254398
|
for (const configDirName of PROJECT_CONFIG_DIR_NAMES) {
|
|
254276
|
-
const mainConfigSubdir =
|
|
254399
|
+
const mainConfigSubdir = join85(canonicalRoot, configDirName, subdir);
|
|
254277
254400
|
if (!projectDirs.includes(mainConfigSubdir)) {
|
|
254278
254401
|
projectDirs.push(mainConfigSubdir);
|
|
254279
254402
|
}
|
|
@@ -255618,8 +255741,18 @@ function getUserMessageText(message) {
|
|
|
255618
255741
|
}
|
|
255619
255742
|
function textForResubmit(msg) {
|
|
255620
255743
|
const content = getUserMessageText(msg);
|
|
255621
|
-
if (content === null)
|
|
255744
|
+
if (content === null) {
|
|
255745
|
+
if (Array.isArray(msg.message.content)) {
|
|
255746
|
+
const imageCount = msg.message.content.filter((block2) => block2.type === "image").length;
|
|
255747
|
+
if (imageCount > 0) {
|
|
255748
|
+
return {
|
|
255749
|
+
text: Array.from({ length: imageCount }, (_, index) => `[Image #${msg.imagePasteIds?.[index] ?? index + 1}]`).join(" "),
|
|
255750
|
+
mode: "prompt"
|
|
255751
|
+
};
|
|
255752
|
+
}
|
|
255753
|
+
}
|
|
255622
255754
|
return null;
|
|
255755
|
+
}
|
|
255623
255756
|
const bash = extractTag(content, "bash-input");
|
|
255624
255757
|
if (bash)
|
|
255625
255758
|
return { text: bash, mode: "bash" };
|
|
@@ -258914,10 +259047,10 @@ __export(exports_replayIndex, {
|
|
|
258914
259047
|
loadReplayIndex: () => loadReplayIndex,
|
|
258915
259048
|
fileExists: () => fileExists
|
|
258916
259049
|
});
|
|
258917
|
-
import { chmod as chmod5, readFile as readFile25, writeFile as
|
|
258918
|
-
import { join as
|
|
259050
|
+
import { chmod as chmod5, readFile as readFile25, writeFile as writeFile22, stat as stat27 } from "fs/promises";
|
|
259051
|
+
import { join as join86, dirname as dirname46 } from "path";
|
|
258919
259052
|
function getReplayIndexPath(sessionId, transcriptPath) {
|
|
258920
|
-
return
|
|
259053
|
+
return join86(dirname46(transcriptPath), `${sessionId}.replay.json`);
|
|
258921
259054
|
}
|
|
258922
259055
|
async function fileExists(path13) {
|
|
258923
259056
|
try {
|
|
@@ -258989,7 +259122,7 @@ async function writeReplayIndex(sessionId, transcriptPath, index) {
|
|
|
258989
259122
|
const { mkdir: mkdir25 } = await import("fs/promises");
|
|
258990
259123
|
await mkdir25(dir, { recursive: true, mode: 448 });
|
|
258991
259124
|
}
|
|
258992
|
-
await
|
|
259125
|
+
await writeFile22(replayPath, JSON.stringify(index, null, 2), {
|
|
258993
259126
|
encoding: "utf-8",
|
|
258994
259127
|
mode: 384
|
|
258995
259128
|
});
|
|
@@ -259113,9 +259246,9 @@ import {
|
|
|
259113
259246
|
readFile as readFile26,
|
|
259114
259247
|
stat as stat28,
|
|
259115
259248
|
unlink as unlink10,
|
|
259116
|
-
writeFile as
|
|
259249
|
+
writeFile as writeFile23
|
|
259117
259250
|
} from "fs/promises";
|
|
259118
|
-
import { basename as basename25, dirname as dirname47, join as
|
|
259251
|
+
import { basename as basename25, dirname as dirname47, join as join87 } from "path";
|
|
259119
259252
|
function getBuiltInCommandNames() {
|
|
259120
259253
|
if (builtInCommandNamesCache)
|
|
259121
259254
|
return builtInCommandNamesCache;
|
|
@@ -259324,14 +259457,14 @@ function isEphemeralToolProgress(dataType) {
|
|
|
259324
259457
|
}
|
|
259325
259458
|
function getTranscriptPath() {
|
|
259326
259459
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
259327
|
-
return
|
|
259460
|
+
return join87(projectDir, `${getSessionId()}.jsonl`);
|
|
259328
259461
|
}
|
|
259329
259462
|
function getTranscriptPathForSession(sessionId) {
|
|
259330
259463
|
if (sessionId === getSessionId()) {
|
|
259331
259464
|
return getTranscriptPath();
|
|
259332
259465
|
}
|
|
259333
259466
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
259334
|
-
return
|
|
259467
|
+
return join87(projectDir, `${sessionId}.jsonl`);
|
|
259335
259468
|
}
|
|
259336
259469
|
function setAgentTranscriptSubdir(agentId, subdir) {
|
|
259337
259470
|
agentTranscriptSubdirs.set(agentId, subdir);
|
|
@@ -259343,8 +259476,8 @@ function getAgentTranscriptPath(agentId) {
|
|
|
259343
259476
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
259344
259477
|
const sessionId = getSessionId();
|
|
259345
259478
|
const subdir = agentTranscriptSubdirs.get(agentId);
|
|
259346
|
-
const base2 = subdir ?
|
|
259347
|
-
return
|
|
259479
|
+
const base2 = subdir ? join87(projectDir, sessionId, "subagents", subdir) : join87(projectDir, sessionId, "subagents");
|
|
259480
|
+
return join87(base2, `agent-${agentId}.jsonl`);
|
|
259348
259481
|
}
|
|
259349
259482
|
function getAgentMetadataPath(agentId) {
|
|
259350
259483
|
return getAgentTranscriptPath(agentId).replace(/\.jsonl$/, ".meta.json");
|
|
@@ -259367,15 +259500,15 @@ async function readAgentMetadata(agentId) {
|
|
|
259367
259500
|
}
|
|
259368
259501
|
function getRemoteAgentsDir() {
|
|
259369
259502
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
259370
|
-
return
|
|
259503
|
+
return join87(projectDir, getSessionId(), "remote-agents");
|
|
259371
259504
|
}
|
|
259372
259505
|
function getRemoteAgentMetadataPath(taskId) {
|
|
259373
|
-
return
|
|
259506
|
+
return join87(getRemoteAgentsDir(), `remote-agent-${taskId}.meta.json`);
|
|
259374
259507
|
}
|
|
259375
259508
|
async function writeRemoteAgentMetadata(taskId, metadata) {
|
|
259376
259509
|
const path13 = getRemoteAgentMetadataPath(taskId);
|
|
259377
259510
|
await mkdir25(dirname47(path13), { recursive: true });
|
|
259378
|
-
await
|
|
259511
|
+
await writeFile23(path13, JSON.stringify(metadata));
|
|
259379
259512
|
}
|
|
259380
259513
|
async function readRemoteAgentMetadata(taskId) {
|
|
259381
259514
|
const path13 = getRemoteAgentMetadataPath(taskId);
|
|
@@ -259413,7 +259546,7 @@ async function listRemoteAgentMetadata() {
|
|
|
259413
259546
|
if (!entry.isFile() || !entry.name.endsWith(".meta.json"))
|
|
259414
259547
|
continue;
|
|
259415
259548
|
try {
|
|
259416
|
-
const raw = await readFile26(
|
|
259549
|
+
const raw = await readFile26(join87(dir, entry.name), "utf-8");
|
|
259417
259550
|
results.push(JSON.parse(raw));
|
|
259418
259551
|
} catch (e) {
|
|
259419
259552
|
logForDebugging(`listRemoteAgentMetadata: skipping ${entry.name}: ${String(e)}`);
|
|
@@ -259423,7 +259556,7 @@ async function listRemoteAgentMetadata() {
|
|
|
259423
259556
|
}
|
|
259424
259557
|
function sessionIdExists(sessionId) {
|
|
259425
259558
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
259426
|
-
const sessionFile =
|
|
259559
|
+
const sessionFile = join87(projectDir, `${sessionId}.jsonl`);
|
|
259427
259560
|
const fs2 = getFsImplementation();
|
|
259428
259561
|
try {
|
|
259429
259562
|
fs2.statSync(sessionFile);
|
|
@@ -259459,7 +259592,7 @@ function getProject() {
|
|
|
259459
259592
|
if (!shouldSkipSessionPersistence()) {
|
|
259460
259593
|
const { writeReplayIndex: writeReplayIndex2 } = await Promise.resolve().then(() => (init_replayIndex(), exports_replayIndex));
|
|
259461
259594
|
for (const { sessionId, builder, projectDir } of replayBuilders) {
|
|
259462
|
-
const transcriptPath = projectDir ?
|
|
259595
|
+
const transcriptPath = projectDir ? join87(projectDir, `${sessionId}.jsonl`) : getTranscriptPathForSession(sessionId);
|
|
259463
259596
|
const index = builder.build(sessionId);
|
|
259464
259597
|
await writeReplayIndex2(sessionId, transcriptPath, index);
|
|
259465
259598
|
}
|
|
@@ -261875,7 +262008,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
261875
262008
|
};
|
|
261876
262009
|
}
|
|
261877
262010
|
async function loadSessionFile(sessionId) {
|
|
261878
|
-
const sessionFile =
|
|
262011
|
+
const sessionFile = join87(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), `${sessionId}.jsonl`);
|
|
261879
262012
|
return loadTranscriptFile(sessionFile);
|
|
261880
262013
|
}
|
|
261881
262014
|
function clearSessionMessagesCache() {
|
|
@@ -261947,7 +262080,7 @@ async function loadAllProjectsMessageLogsFull(limit) {
|
|
|
261947
262080
|
} catch {
|
|
261948
262081
|
return [];
|
|
261949
262082
|
}
|
|
261950
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
262083
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join87(projectsDir, dirent.name));
|
|
261951
262084
|
const logsPerProject = await Promise.all(projectDirs.map((projectDir) => getLogsWithoutIndex(projectDir, limit)));
|
|
261952
262085
|
const allLogs = logsPerProject.flat();
|
|
261953
262086
|
const deduped = new Map;
|
|
@@ -261972,7 +262105,7 @@ async function loadAllProjectsMessageLogsProgressive(limit, initialEnrichCount =
|
|
|
261972
262105
|
} catch {
|
|
261973
262106
|
return { logs: [], allStatLogs: [], nextIndex: 0 };
|
|
261974
262107
|
}
|
|
261975
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
262108
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join87(projectsDir, dirent.name));
|
|
261976
262109
|
const rawLogs = [];
|
|
261977
262110
|
for (const projectDir of projectDirs) {
|
|
261978
262111
|
rawLogs.push(...await getSessionFilesLite(projectDir, limit));
|
|
@@ -262033,7 +262166,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
|
|
|
262033
262166
|
for (const { path: wtPath, prefix } of indexed) {
|
|
262034
262167
|
if (dirName === prefix || dirName.startsWith(prefix + "-")) {
|
|
262035
262168
|
seenDirs.add(dirName);
|
|
262036
|
-
allLogs.push(...await getSessionFilesLite(
|
|
262169
|
+
allLogs.push(...await getSessionFilesLite(join87(projectsDir, dirent.name), undefined, wtPath));
|
|
262037
262170
|
break;
|
|
262038
262171
|
}
|
|
262039
262172
|
}
|
|
@@ -262102,7 +262235,7 @@ async function loadSubagentTranscripts(agentIds) {
|
|
|
262102
262235
|
return transcripts;
|
|
262103
262236
|
}
|
|
262104
262237
|
async function loadAllSubagentTranscriptsFromDisk() {
|
|
262105
|
-
const subagentsDir =
|
|
262238
|
+
const subagentsDir = join87(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), getSessionId(), "subagents");
|
|
262106
262239
|
let entries;
|
|
262107
262240
|
try {
|
|
262108
262241
|
entries = await readdir18(subagentsDir, { withFileTypes: true });
|
|
@@ -262230,7 +262363,7 @@ async function getSessionFilesWithMtime(projectDir) {
|
|
|
262230
262363
|
const sessionId = validateUuid2(basename25(dirent.name, ".jsonl"));
|
|
262231
262364
|
if (!sessionId)
|
|
262232
262365
|
continue;
|
|
262233
|
-
candidates.push({ sessionId, filePath:
|
|
262366
|
+
candidates.push({ sessionId, filePath: join87(projectDir, dirent.name) });
|
|
262234
262367
|
}
|
|
262235
262368
|
await Promise.all(candidates.map(async ({ sessionId, filePath }) => {
|
|
262236
262369
|
try {
|
|
@@ -262658,7 +262791,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
262658
262791
|
init_slowOperations();
|
|
262659
262792
|
init_transcriptFileLock();
|
|
262660
262793
|
init_uuid();
|
|
262661
|
-
VERSION3 = typeof MACRO !== "undefined" ? "0.30.
|
|
262794
|
+
VERSION3 = typeof MACRO !== "undefined" ? "0.30.2-by-rayss" : "unknown";
|
|
262662
262795
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
262663
262796
|
TRANSCRIPT_COPY_CHUNK_BYTES = 64 * 1024;
|
|
262664
262797
|
transcriptRewriteHooksForTesting = {};
|
|
@@ -262673,7 +262806,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
262673
262806
|
MAX_TRANSCRIPT_READ_BYTES = 50 * 1024 * 1024;
|
|
262674
262807
|
agentTranscriptSubdirs = new Map;
|
|
262675
262808
|
getProjectDir2 = memoize_default((projectDir) => {
|
|
262676
|
-
return
|
|
262809
|
+
return join87(getProjectsDir(), sanitizePath(projectDir));
|
|
262677
262810
|
});
|
|
262678
262811
|
PERSISTED_OUTPUT_TAG2 = Buffer.from("<persisted-output>");
|
|
262679
262812
|
TOOL_USE_RESULT_KEY = Buffer.from('"toolUseResult":');
|
|
@@ -263036,41 +263169,41 @@ var init_memdir = __esm(() => {
|
|
|
263036
263169
|
});
|
|
263037
263170
|
|
|
263038
263171
|
// src/tools/AgentTool/agentMemory.ts
|
|
263039
|
-
import { join as
|
|
263172
|
+
import { join as join88, normalize as normalize12, sep as sep22 } from "path";
|
|
263040
263173
|
function sanitizeAgentTypeForPath(agentType) {
|
|
263041
263174
|
return agentType.replace(/:/g, "-");
|
|
263042
263175
|
}
|
|
263043
263176
|
function getLocalAgentMemoryDir(dirName) {
|
|
263044
263177
|
if (process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR) {
|
|
263045
|
-
return
|
|
263178
|
+
return join88(process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR, "projects", sanitizePath(findCanonicalGitRoot(getProjectRoot()) ?? getProjectRoot()), "agent-memory-local", dirName) + sep22;
|
|
263046
263179
|
}
|
|
263047
|
-
return
|
|
263180
|
+
return join88(getCwd(), ".openclaude", "agent-memory-local", dirName) + sep22;
|
|
263048
263181
|
}
|
|
263049
263182
|
function getAgentMemoryDir(agentType, scope) {
|
|
263050
263183
|
const dirName = sanitizeAgentTypeForPath(agentType);
|
|
263051
263184
|
switch (scope) {
|
|
263052
263185
|
case "project":
|
|
263053
|
-
return
|
|
263186
|
+
return join88(getCwd(), ".openclaude", "agent-memory", dirName) + sep22;
|
|
263054
263187
|
case "local":
|
|
263055
263188
|
return getLocalAgentMemoryDir(dirName);
|
|
263056
263189
|
case "user":
|
|
263057
|
-
return
|
|
263190
|
+
return join88(getMemoryBaseDir(), "agent-memory", dirName) + sep22;
|
|
263058
263191
|
}
|
|
263059
263192
|
}
|
|
263060
263193
|
function isAgentMemoryPath(absolutePath) {
|
|
263061
263194
|
const normalizedPath = normalize12(absolutePath);
|
|
263062
263195
|
const memoryBase = getMemoryBaseDir();
|
|
263063
|
-
if (normalizedPath.startsWith(
|
|
263196
|
+
if (normalizedPath.startsWith(join88(memoryBase, "agent-memory") + sep22)) {
|
|
263064
263197
|
return true;
|
|
263065
263198
|
}
|
|
263066
|
-
if (normalizedPath.startsWith(
|
|
263199
|
+
if (normalizedPath.startsWith(join88(getCwd(), ".openclaude", "agent-memory") + sep22)) {
|
|
263067
263200
|
return true;
|
|
263068
263201
|
}
|
|
263069
263202
|
if (process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR) {
|
|
263070
|
-
if (normalizedPath.includes(sep22 + "agent-memory-local" + sep22) && normalizedPath.startsWith(
|
|
263203
|
+
if (normalizedPath.includes(sep22 + "agent-memory-local" + sep22) && normalizedPath.startsWith(join88(process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR, "projects") + sep22)) {
|
|
263071
263204
|
return true;
|
|
263072
263205
|
}
|
|
263073
|
-
} else if (normalizedPath.startsWith(
|
|
263206
|
+
} else if (normalizedPath.startsWith(join88(getCwd(), ".openclaude", "agent-memory-local") + sep22)) {
|
|
263074
263207
|
return true;
|
|
263075
263208
|
}
|
|
263076
263209
|
return false;
|
|
@@ -263145,7 +263278,7 @@ __export(exports_filesystem, {
|
|
|
263145
263278
|
});
|
|
263146
263279
|
import { randomBytes as randomBytes10 } from "crypto";
|
|
263147
263280
|
import { homedir as homedir23, tmpdir as tmpdir6 } from "os";
|
|
263148
|
-
import { join as
|
|
263281
|
+
import { join as join89, normalize as normalize13, posix as posix6, sep as sep23 } from "path";
|
|
263149
263282
|
function normalizeCaseForComparison(path13) {
|
|
263150
263283
|
return path13.toLowerCase();
|
|
263151
263284
|
}
|
|
@@ -263154,11 +263287,11 @@ function getClaudeSkillScope(filePath) {
|
|
|
263154
263287
|
const absolutePathLower = normalizeCaseForComparison(absolutePath);
|
|
263155
263288
|
const bases = [
|
|
263156
263289
|
{
|
|
263157
|
-
dir: expandPath(
|
|
263290
|
+
dir: expandPath(join89(getOriginalCwd(), ".openclaude", "skills")),
|
|
263158
263291
|
prefix: "/.openclaude/skills/"
|
|
263159
263292
|
},
|
|
263160
263293
|
{
|
|
263161
|
-
dir: expandPath(
|
|
263294
|
+
dir: expandPath(join89(homedir23(), ".openclaude", "skills")),
|
|
263162
263295
|
prefix: "~/.openclaude/skills/"
|
|
263163
263296
|
}
|
|
263164
263297
|
];
|
|
@@ -263213,13 +263346,13 @@ function isClaudeConfigFilePath(filePath) {
|
|
|
263213
263346
|
if (isClaudeSettingsPath(filePath)) {
|
|
263214
263347
|
return true;
|
|
263215
263348
|
}
|
|
263216
|
-
const commandsDir =
|
|
263217
|
-
const agentsDir =
|
|
263218
|
-
const skillsDir =
|
|
263349
|
+
const commandsDir = join89(getOriginalCwd(), ".openclaude", "commands");
|
|
263350
|
+
const agentsDir = join89(getOriginalCwd(), ".openclaude", "agents");
|
|
263351
|
+
const skillsDir = join89(getOriginalCwd(), ".openclaude", "skills");
|
|
263219
263352
|
return pathInWorkingPath(filePath, commandsDir) || pathInWorkingPath(filePath, agentsDir) || pathInWorkingPath(filePath, skillsDir);
|
|
263220
263353
|
}
|
|
263221
263354
|
function isPlanFilePath(plansDir, planSlug, absolutePath) {
|
|
263222
|
-
const expectedPrefix =
|
|
263355
|
+
const expectedPrefix = join89(plansDir, planSlug);
|
|
263223
263356
|
const normalizedPath = normalize13(absolutePath);
|
|
263224
263357
|
if (!normalizedPath.endsWith(".md")) {
|
|
263225
263358
|
return false;
|
|
@@ -263227,7 +263360,7 @@ function isPlanFilePath(plansDir, planSlug, absolutePath) {
|
|
|
263227
263360
|
if (normalizedPath === expectedPrefix + ".md") {
|
|
263228
263361
|
return true;
|
|
263229
263362
|
}
|
|
263230
|
-
const agentPrefix =
|
|
263363
|
+
const agentPrefix = join89(plansDir, AGENT_PLANS_SUBDIR, `${planSlug}-agent-`);
|
|
263231
263364
|
if (!normalizedPath.startsWith(agentPrefix)) {
|
|
263232
263365
|
return false;
|
|
263233
263366
|
}
|
|
@@ -263242,10 +263375,10 @@ function isSessionPlanFile(absolutePath) {
|
|
|
263242
263375
|
return isResolvedPathWithinPlansDir(absolutePath, plansDir);
|
|
263243
263376
|
}
|
|
263244
263377
|
function getSessionMemoryDir() {
|
|
263245
|
-
return
|
|
263378
|
+
return join89(getProjectDir2(getCwd()), getSessionId(), "session-memory") + sep23;
|
|
263246
263379
|
}
|
|
263247
263380
|
function getSessionMemoryPath() {
|
|
263248
|
-
return
|
|
263381
|
+
return join89(getSessionMemoryDir(), "summary.md");
|
|
263249
263382
|
}
|
|
263250
263383
|
function isSessionMemoryPath(absolutePath) {
|
|
263251
263384
|
const normalizedPath = normalize13(absolutePath);
|
|
@@ -263268,15 +263401,15 @@ function getClaudeTempDirName() {
|
|
|
263268
263401
|
}
|
|
263269
263402
|
function ensureUsableTempDir(fs2, dirPath) {
|
|
263270
263403
|
fs2.mkdirSync(dirPath, { mode: 448 });
|
|
263271
|
-
const probeDir =
|
|
263404
|
+
const probeDir = join89(dirPath, `.write-probe-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2)}`);
|
|
263272
263405
|
fs2.mkdirSync(probeDir, { mode: 448 });
|
|
263273
263406
|
fs2.rmdirSync(probeDir);
|
|
263274
263407
|
}
|
|
263275
263408
|
function getProjectTempDir() {
|
|
263276
|
-
return
|
|
263409
|
+
return join89(getClaudeTempDir(), sanitizePath(getOriginalCwd())) + sep23;
|
|
263277
263410
|
}
|
|
263278
263411
|
function getScratchpadDir() {
|
|
263279
|
-
return
|
|
263412
|
+
return join89(getProjectTempDir(), getSessionId(), "scratchpad");
|
|
263280
263413
|
}
|
|
263281
263414
|
async function ensureScratchpadDir() {
|
|
263282
263415
|
if (!isScratchpadEnabled()) {
|
|
@@ -263327,7 +263460,7 @@ function getActiveSessionPlanFilePath(agentId) {
|
|
|
263327
263460
|
return getPlanFilePath2(agentId);
|
|
263328
263461
|
}
|
|
263329
263462
|
function isOpenClaudeCommitMessagePath(absolutePath) {
|
|
263330
|
-
const expectedPath =
|
|
263463
|
+
const expectedPath = join89(getOriginalCwd(), ".git", "OPENCLAUDE_COMMIT_MSG");
|
|
263331
263464
|
const expectedForms = getPathsForPermissionCheck(expectedPath);
|
|
263332
263465
|
const targetForms = getPathsForPermissionCheck(absolutePath);
|
|
263333
263466
|
return targetForms.length > 0 && targetForms.every((target) => expectedForms.some((expected) => pathsEqualForPermission(target, expected)));
|
|
@@ -263903,7 +264036,7 @@ function checkEditableInternalPath(absolutePath, input, toolPermissionContext) {
|
|
|
263903
264036
|
}
|
|
263904
264037
|
};
|
|
263905
264038
|
}
|
|
263906
|
-
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(
|
|
264039
|
+
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(join89(getOriginalCwd(), ".openclaude", "launch.json"))) {
|
|
263907
264040
|
return {
|
|
263908
264041
|
behavior: "allow",
|
|
263909
264042
|
updatedInput: input,
|
|
@@ -264010,7 +264143,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
264010
264143
|
}
|
|
264011
264144
|
};
|
|
264012
264145
|
}
|
|
264013
|
-
const tasksDir =
|
|
264146
|
+
const tasksDir = join89(getClaudeConfigHomeDir(), "tasks") + sep23;
|
|
264014
264147
|
if (normalizedPath === tasksDir.slice(0, -1) || normalizedPath.startsWith(tasksDir)) {
|
|
264015
264148
|
return {
|
|
264016
264149
|
behavior: "allow",
|
|
@@ -264021,7 +264154,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
264021
264154
|
}
|
|
264022
264155
|
};
|
|
264023
264156
|
}
|
|
264024
|
-
const teamsReadDir =
|
|
264157
|
+
const teamsReadDir = join89(getClaudeConfigHomeDir(), "teams") + sep23;
|
|
264025
264158
|
if (normalizedPath === teamsReadDir.slice(0, -1) || normalizedPath.startsWith(teamsReadDir)) {
|
|
264026
264159
|
return {
|
|
264027
264160
|
behavior: "allow",
|
|
@@ -264099,14 +264232,14 @@ var init_filesystem = __esm(() => {
|
|
|
264099
264232
|
try {
|
|
264100
264233
|
resolvedBaseTmpDir = fs2.realpathSync(baseTmpDir);
|
|
264101
264234
|
} catch {}
|
|
264102
|
-
const fullPath =
|
|
264235
|
+
const fullPath = join89(resolvedBaseTmpDir, getClaudeTempDirName()) + sep23;
|
|
264103
264236
|
try {
|
|
264104
264237
|
ensureUsableTempDir(fs2, fullPath);
|
|
264105
264238
|
} catch (e) {
|
|
264106
264239
|
if (isFsInaccessible(e)) {
|
|
264107
264240
|
const fallbackDirs = [
|
|
264108
|
-
|
|
264109
|
-
|
|
264241
|
+
join89(tmpdir6(), "claude-code", getClaudeTempDirName()) + sep23,
|
|
264242
|
+
join89(getClaudeConfigHomeDir(), "tmp", getClaudeTempDirName()) + sep23
|
|
264110
264243
|
];
|
|
264111
264244
|
for (const fallbackDir of fallbackDirs) {
|
|
264112
264245
|
try {
|
|
@@ -264125,7 +264258,7 @@ var init_filesystem = __esm(() => {
|
|
|
264125
264258
|
});
|
|
264126
264259
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
264127
264260
|
const nonce = randomBytes10(16).toString("hex");
|
|
264128
|
-
return
|
|
264261
|
+
return join89(getClaudeTempDir(), "bundled-skills", "0.30.2-by-rayss", nonce);
|
|
264129
264262
|
});
|
|
264130
264263
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
264131
264264
|
});
|
|
@@ -264139,10 +264272,10 @@ import {
|
|
|
264139
264272
|
symlink as symlink3,
|
|
264140
264273
|
unlink as unlink11
|
|
264141
264274
|
} from "fs/promises";
|
|
264142
|
-
import { join as
|
|
264275
|
+
import { join as join90 } from "path";
|
|
264143
264276
|
function getTaskOutputDir() {
|
|
264144
264277
|
if (_taskOutputDir === undefined) {
|
|
264145
|
-
_taskOutputDir =
|
|
264278
|
+
_taskOutputDir = join90(getProjectTempDir(), getSessionId(), "tasks");
|
|
264146
264279
|
}
|
|
264147
264280
|
return _taskOutputDir;
|
|
264148
264281
|
}
|
|
@@ -264150,7 +264283,7 @@ async function ensureOutputDir() {
|
|
|
264150
264283
|
await mkdir26(getTaskOutputDir(), { recursive: true });
|
|
264151
264284
|
}
|
|
264152
264285
|
function getTaskOutputPath(taskId) {
|
|
264153
|
-
return
|
|
264286
|
+
return join90(getTaskOutputDir(), `${taskId}.output`);
|
|
264154
264287
|
}
|
|
264155
264288
|
function track(p) {
|
|
264156
264289
|
_pendingOps.add(p);
|
|
@@ -265445,7 +265578,7 @@ __export(exports_hookChains, {
|
|
|
265445
265578
|
});
|
|
265446
265579
|
import { createHash as createHash14 } from "crypto";
|
|
265447
265580
|
import { statSync as statSync7 } from "fs";
|
|
265448
|
-
import { join as
|
|
265581
|
+
import { join as join91, resolve as resolve32 } from "path";
|
|
265449
265582
|
function asAnalyticsString(value) {
|
|
265450
265583
|
return value;
|
|
265451
265584
|
}
|
|
@@ -265474,7 +265607,7 @@ function getConfigPath(pathOverride) {
|
|
|
265474
265607
|
if (configuredPath) {
|
|
265475
265608
|
return resolve32(getSafeOriginalCwd(), configuredPath);
|
|
265476
265609
|
}
|
|
265477
|
-
return
|
|
265610
|
+
return join91(getSafeOriginalCwd(), DEFAULT_HOOK_CHAINS_RELATIVE_PATH);
|
|
265478
265611
|
}
|
|
265479
265612
|
function getSafeOriginalCwd() {
|
|
265480
265613
|
try {
|
|
@@ -266403,7 +266536,7 @@ var init_hookChains = __esm(() => {
|
|
|
266403
266536
|
init_teammate();
|
|
266404
266537
|
init_teammateMailbox();
|
|
266405
266538
|
init_v4();
|
|
266406
|
-
DEFAULT_HOOK_CHAINS_RELATIVE_PATH =
|
|
266539
|
+
DEFAULT_HOOK_CHAINS_RELATIVE_PATH = join91(".openclaude", "hook-chains.json");
|
|
266407
266540
|
MAX_GUARD_WINDOW_MS = 24 * 60 * 60 * 1000;
|
|
266408
266541
|
CONFIG_CACHE_MAX_AGE_MS = 5 * 60 * 1000;
|
|
266409
266542
|
HookChainOutcomeSchema = exports_external.enum(["success", "failed", "timeout", "unknown"]);
|
|
@@ -269512,7 +269645,7 @@ import {
|
|
|
269512
269645
|
symlink as symlink4,
|
|
269513
269646
|
utimes as utimes2
|
|
269514
269647
|
} from "fs/promises";
|
|
269515
|
-
import { basename as basename27, dirname as dirname49, join as
|
|
269648
|
+
import { basename as basename27, dirname as dirname49, join as join92 } from "path";
|
|
269516
269649
|
function validateWorktreeSlug(slug) {
|
|
269517
269650
|
if (slug.length > MAX_WORKTREE_SLUG_LENGTH) {
|
|
269518
269651
|
throw new Error(`Invalid worktree name: must be ${MAX_WORKTREE_SLUG_LENGTH} characters or fewer (got ${slug.length})`);
|
|
@@ -269535,8 +269668,8 @@ async function symlinkDirectories(repoRootPath, worktreePath, dirsToSymlink) {
|
|
|
269535
269668
|
logForDebugging(`Skipping symlink for "${dir}": path traversal detected`, { level: "warn" });
|
|
269536
269669
|
continue;
|
|
269537
269670
|
}
|
|
269538
|
-
const sourcePath =
|
|
269539
|
-
const destPath =
|
|
269671
|
+
const sourcePath = join92(repoRootPath, dir);
|
|
269672
|
+
const destPath = join92(worktreePath, dir);
|
|
269540
269673
|
try {
|
|
269541
269674
|
await symlink4(sourcePath, destPath, "dir");
|
|
269542
269675
|
logForDebugging(`Symlinked ${dir} from main repository to worktree to avoid disk bloat`);
|
|
@@ -269570,7 +269703,7 @@ async function withGitWorktreeMutationLock(repoRoot, fn) {
|
|
|
269570
269703
|
}
|
|
269571
269704
|
}
|
|
269572
269705
|
function worktreesDir(repoRoot) {
|
|
269573
|
-
return
|
|
269706
|
+
return join92(repoRoot, ".openclaude", "worktrees");
|
|
269574
269707
|
}
|
|
269575
269708
|
function flattenSlug(slug) {
|
|
269576
269709
|
return slug.replaceAll("/", "+");
|
|
@@ -269584,7 +269717,7 @@ function buildRevParseFailureMessage(baseBranch, stderr, exitCode) {
|
|
|
269584
269717
|
return `Failed to resolve base branch "${baseBranch}": ${detail}${hint}`;
|
|
269585
269718
|
}
|
|
269586
269719
|
function worktreePathFor(repoRoot, slug) {
|
|
269587
|
-
return
|
|
269720
|
+
return join92(worktreesDir(repoRoot), flattenSlug(slug));
|
|
269588
269721
|
}
|
|
269589
269722
|
async function autoConfigureLongPathsForWorktrees(repoRoot) {
|
|
269590
269723
|
if (_testDeps.getPlatform() !== "windows") {
|
|
@@ -269701,7 +269834,7 @@ async function getOrCreateWorktree(repoRoot, slug, options2) {
|
|
|
269701
269834
|
async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
269702
269835
|
let includeContent;
|
|
269703
269836
|
try {
|
|
269704
|
-
includeContent = await readFile27(
|
|
269837
|
+
includeContent = await readFile27(join92(repoRoot, ".worktreeinclude"), "utf-8");
|
|
269705
269838
|
} catch {
|
|
269706
269839
|
return [];
|
|
269707
269840
|
}
|
|
@@ -269756,8 +269889,8 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
|
269756
269889
|
}
|
|
269757
269890
|
const copied = [];
|
|
269758
269891
|
for (const relativePath2 of files) {
|
|
269759
|
-
const srcPath =
|
|
269760
|
-
const destPath =
|
|
269892
|
+
const srcPath = join92(repoRoot, relativePath2);
|
|
269893
|
+
const destPath = join92(worktreePath, relativePath2);
|
|
269761
269894
|
try {
|
|
269762
269895
|
await mkdir27(dirname49(destPath), { recursive: true });
|
|
269763
269896
|
await copyFile6(srcPath, destPath);
|
|
@@ -269773,9 +269906,9 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
|
269773
269906
|
}
|
|
269774
269907
|
async function performPostCreationSetup(repoRoot, worktreePath) {
|
|
269775
269908
|
const localSettingsRelativePath = getRelativeSettingsFilePathForSource("localSettings");
|
|
269776
|
-
const sourceSettingsLocal =
|
|
269909
|
+
const sourceSettingsLocal = join92(repoRoot, localSettingsRelativePath);
|
|
269777
269910
|
try {
|
|
269778
|
-
const destSettingsLocal =
|
|
269911
|
+
const destSettingsLocal = join92(worktreePath, localSettingsRelativePath);
|
|
269779
269912
|
await mkdirRecursive(dirname49(destSettingsLocal));
|
|
269780
269913
|
await copyFile6(sourceSettingsLocal, destSettingsLocal);
|
|
269781
269914
|
logForDebugging(`Copied settings.local.json to worktree: ${destSettingsLocal}`);
|
|
@@ -269785,8 +269918,8 @@ async function performPostCreationSetup(repoRoot, worktreePath) {
|
|
|
269785
269918
|
logForDebugging(`Failed to copy settings.local.json: ${e.message}`, { level: "warn" });
|
|
269786
269919
|
}
|
|
269787
269920
|
}
|
|
269788
|
-
const huskyPath =
|
|
269789
|
-
const gitHooksPath =
|
|
269921
|
+
const huskyPath = join92(repoRoot, ".husky");
|
|
269922
|
+
const gitHooksPath = join92(repoRoot, ".git", "hooks");
|
|
269790
269923
|
let hooksPath = null;
|
|
269791
269924
|
for (const candidatePath of [huskyPath, gitHooksPath]) {
|
|
269792
269925
|
try {
|
|
@@ -273130,9 +273263,9 @@ function assertFunction(value, field) {
|
|
|
273130
273263
|
|
|
273131
273264
|
// src/utils/imageStore.ts
|
|
273132
273265
|
import { mkdir as mkdir28, open as open10 } from "fs/promises";
|
|
273133
|
-
import { join as
|
|
273266
|
+
import { join as join93 } from "path";
|
|
273134
273267
|
function getImageStoreDir() {
|
|
273135
|
-
return
|
|
273268
|
+
return join93(getClaudeConfigHomeDir(), IMAGE_STORE_DIR, getSessionId());
|
|
273136
273269
|
}
|
|
273137
273270
|
async function ensureImageStoreDir() {
|
|
273138
273271
|
const dir = getImageStoreDir();
|
|
@@ -273140,7 +273273,7 @@ async function ensureImageStoreDir() {
|
|
|
273140
273273
|
}
|
|
273141
273274
|
function getImagePath(imageId, mediaType) {
|
|
273142
273275
|
const extension2 = mediaType.split("/")[1] || "png";
|
|
273143
|
-
return
|
|
273276
|
+
return join93(getImageStoreDir(), `${imageId}.${extension2}`);
|
|
273144
273277
|
}
|
|
273145
273278
|
async function storeImage(content) {
|
|
273146
273279
|
if (content.type !== "image") {
|
|
@@ -278664,7 +278797,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
278664
278797
|
slash_commands: inputs.commands.filter((c7) => c7.userInvocable !== false).map((c7) => c7.name),
|
|
278665
278798
|
apiKeySource: getAnthropicApiKeyWithSource().source,
|
|
278666
278799
|
betas: getSdkBetas(),
|
|
278667
|
-
claude_code_version: "0.30.
|
|
278800
|
+
claude_code_version: "0.30.2-by-rayss",
|
|
278668
278801
|
output_style: outputStyle,
|
|
278669
278802
|
agents: inputs.agents.map((agent) => agent.agentType),
|
|
278670
278803
|
skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
|
|
@@ -280870,9 +281003,9 @@ __export(exports_upstreamproxy, {
|
|
|
280870
281003
|
getUpstreamProxyEnv: () => getUpstreamProxyEnv,
|
|
280871
281004
|
SESSION_TOKEN_PATH: () => SESSION_TOKEN_PATH
|
|
280872
281005
|
});
|
|
280873
|
-
import { mkdir as mkdir29, readFile as readFile28, unlink as unlink13, writeFile as
|
|
281006
|
+
import { mkdir as mkdir29, readFile as readFile28, unlink as unlink13, writeFile as writeFile24 } from "fs/promises";
|
|
280874
281007
|
import { homedir as homedir25 } from "os";
|
|
280875
|
-
import { join as
|
|
281008
|
+
import { join as join94 } from "path";
|
|
280876
281009
|
async function initUpstreamProxy(opts) {
|
|
280877
281010
|
if (!isEnvTruthy(process.env.CLAUDE_CODE_REMOTE)) {
|
|
280878
281011
|
return state2;
|
|
@@ -280893,7 +281026,7 @@ async function initUpstreamProxy(opts) {
|
|
|
280893
281026
|
}
|
|
280894
281027
|
setNonDumpable();
|
|
280895
281028
|
const baseUrl = opts?.ccrBaseUrl ?? process.env.ANTHROPIC_BASE_URL ?? "https://api.anthropic.com";
|
|
280896
|
-
const caBundlePath = opts?.caBundlePath ??
|
|
281029
|
+
const caBundlePath = opts?.caBundlePath ?? join94(homedir25(), ".ccr", "ca-bundle.crt");
|
|
280897
281030
|
const caOk = await downloadCaBundle(baseUrl, opts?.systemCaPath ?? SYSTEM_CA_BUNDLE, caBundlePath);
|
|
280898
281031
|
if (!caOk)
|
|
280899
281032
|
return state2;
|
|
@@ -281011,8 +281144,8 @@ async function downloadCaBundle(baseUrl, systemCaPath, outPath) {
|
|
|
281011
281144
|
return false;
|
|
281012
281145
|
}
|
|
281013
281146
|
const systemCa = await readFile28(systemCaPath, "utf8").catch(() => "");
|
|
281014
|
-
await mkdir29(
|
|
281015
|
-
await
|
|
281147
|
+
await mkdir29(join94(outPath, ".."), { recursive: true });
|
|
281148
|
+
await writeFile24(outPath, systemCa + `
|
|
281016
281149
|
` + ccrCa, "utf8");
|
|
281017
281150
|
return true;
|
|
281018
281151
|
} catch (err2) {
|
|
@@ -281065,25 +281198,25 @@ var init_InvalidConfigDialog = __esm(() => {
|
|
|
281065
281198
|
|
|
281066
281199
|
// src/entrypoints/init.ts
|
|
281067
281200
|
import { existsSync as existsSync8, mkdirSync as mkdirSync6, copyFileSync as copyFileSync2 } from "fs";
|
|
281068
|
-
import { join as
|
|
281201
|
+
import { join as join95, dirname as dirname50 } from "path";
|
|
281069
281202
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
281070
281203
|
function copyDefaultConfigFiles() {
|
|
281071
281204
|
try {
|
|
281072
281205
|
const { homedir: homedir26 } = __require("os");
|
|
281073
|
-
const configDir =
|
|
281206
|
+
const configDir = join95(homedir26(), ".openclaude");
|
|
281074
281207
|
if (!existsSync8(configDir)) {
|
|
281075
281208
|
mkdirSync6(configDir, { recursive: true });
|
|
281076
281209
|
}
|
|
281077
281210
|
const __filename2 = fileURLToPath4(import.meta.url);
|
|
281078
|
-
const packageDir =
|
|
281079
|
-
const defaultsDir =
|
|
281080
|
-
const claudeMdPath =
|
|
281081
|
-
const defaultClaudeMd =
|
|
281211
|
+
const packageDir = join95(dirname50(__filename2), "..");
|
|
281212
|
+
const defaultsDir = join95(packageDir, "config", "defaults");
|
|
281213
|
+
const claudeMdPath = join95(configDir, "CLAUDE.md");
|
|
281214
|
+
const defaultClaudeMd = join95(defaultsDir, "CLAUDE.md");
|
|
281082
281215
|
if (!existsSync8(claudeMdPath) && existsSync8(defaultClaudeMd)) {
|
|
281083
281216
|
copyFileSync2(defaultClaudeMd, claudeMdPath);
|
|
281084
281217
|
}
|
|
281085
|
-
const settingsPath =
|
|
281086
|
-
const defaultSettings =
|
|
281218
|
+
const settingsPath = join95(configDir, "settings.json");
|
|
281219
|
+
const defaultSettings = join95(defaultsDir, "settings.json");
|
|
281087
281220
|
if (!existsSync8(settingsPath) && existsSync8(defaultSettings)) {
|
|
281088
281221
|
copyFileSync2(defaultSettings, settingsPath);
|
|
281089
281222
|
}
|
|
@@ -281320,8 +281453,8 @@ var init_shared2 = __esm(() => {
|
|
|
281320
281453
|
|
|
281321
281454
|
// src/entrypoints/sdk/sessions.ts
|
|
281322
281455
|
import { randomUUID as randomUUID34 } from "crypto";
|
|
281323
|
-
import { appendFile as appendFile3, mkdir as mkdir30, unlink as unlink14, writeFile as
|
|
281324
|
-
import { dirname as dirname51, join as
|
|
281456
|
+
import { appendFile as appendFile3, mkdir as mkdir30, unlink as unlink14, writeFile as writeFile25 } from "fs/promises";
|
|
281457
|
+
import { dirname as dirname51, join as join96 } from "path";
|
|
281325
281458
|
function toSDKSessionInfo(info) {
|
|
281326
281459
|
return {
|
|
281327
281460
|
sessionId: info.sessionId,
|
|
@@ -281487,7 +281620,7 @@ async function forkSession(sessionId, options2) {
|
|
|
281487
281620
|
}
|
|
281488
281621
|
const forkSessionId = randomUUID34();
|
|
281489
281622
|
const targetDir = dirname51(resolved.filePath);
|
|
281490
|
-
const forkPath =
|
|
281623
|
+
const forkPath = join96(targetDir, `${forkSessionId}.jsonl`);
|
|
281491
281624
|
const uuidMap = new Map;
|
|
281492
281625
|
const mainEntries = [];
|
|
281493
281626
|
const metadataEntries = [];
|
|
@@ -281540,7 +281673,7 @@ async function forkSession(sessionId, options2) {
|
|
|
281540
281673
|
};
|
|
281541
281674
|
lines.push(JSON.stringify(forkedEntry));
|
|
281542
281675
|
}
|
|
281543
|
-
await
|
|
281676
|
+
await writeFile25(forkPath, lines.join(`
|
|
281544
281677
|
`) + `
|
|
281545
281678
|
`, {
|
|
281546
281679
|
encoding: "utf8",
|
|
@@ -283259,4 +283392,4 @@ export {
|
|
|
283259
283392
|
AbortError
|
|
283260
283393
|
};
|
|
283261
283394
|
|
|
283262
|
-
//# debugId=
|
|
283395
|
+
//# debugId=7D221E548F40893364756E2164756E21
|