@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/acp.mjs
CHANGED
|
@@ -7498,8 +7498,7 @@ var init_zai = __esm(() => {
|
|
|
7498
7498
|
validation: {
|
|
7499
7499
|
kind: "credential-env",
|
|
7500
7500
|
routing: {
|
|
7501
|
-
matchDefaultBaseUrl: true
|
|
7502
|
-
matchBaseUrlHosts: ["api.z.ai"]
|
|
7501
|
+
matchDefaultBaseUrl: true
|
|
7503
7502
|
},
|
|
7504
7503
|
credentialEnvVars: ["OPENAI_API_KEY"],
|
|
7505
7504
|
missingCredentialMessage: "OPENAI_API_KEY is required for Z.AI GLM Coding Plan."
|
|
@@ -7507,6 +7506,22 @@ var init_zai = __esm(() => {
|
|
|
7507
7506
|
catalog: {
|
|
7508
7507
|
source: "static",
|
|
7509
7508
|
models: [
|
|
7509
|
+
{
|
|
7510
|
+
id: "glm-5.3-flash",
|
|
7511
|
+
apiName: "glm-5.3-flash",
|
|
7512
|
+
label: "GLM-5.3-Flash",
|
|
7513
|
+
modelDescriptorId: "glm-5.3-flash",
|
|
7514
|
+
reasoning: {
|
|
7515
|
+
mode: "levels",
|
|
7516
|
+
levels: ["low", "high", "xhigh"],
|
|
7517
|
+
wireFormat: "zai_compatible"
|
|
7518
|
+
},
|
|
7519
|
+
transportOverrides: {
|
|
7520
|
+
openaiShim: {
|
|
7521
|
+
enableToolStreaming: true
|
|
7522
|
+
}
|
|
7523
|
+
}
|
|
7524
|
+
},
|
|
7510
7525
|
{
|
|
7511
7526
|
id: "glm-5.3",
|
|
7512
7527
|
apiName: "glm-5.3",
|
|
@@ -9380,14 +9395,14 @@ function getReleaseTagUrl(version = publicBuildVersion) {
|
|
|
9380
9395
|
return `${OPENCLAUDE_RELEASES_URL}/tag/v${normalizePublicVersion(version)}`;
|
|
9381
9396
|
}
|
|
9382
9397
|
function getPublicBuildVersion() {
|
|
9383
|
-
return "0.30.
|
|
9398
|
+
return "0.30.2-by-rayss";
|
|
9384
9399
|
}
|
|
9385
9400
|
var import_semver, OPENCLAUDE_RELEASES_URL = "https://github.com/rayss868/openclaude/releases", fallbackBuildVersion, publicBuildVersion;
|
|
9386
9401
|
var init_version = __esm(() => {
|
|
9387
9402
|
import_semver = __toESM(require_semver2(), 1);
|
|
9388
9403
|
fallbackBuildVersion = (() => {
|
|
9389
9404
|
try {
|
|
9390
|
-
return "0.30.
|
|
9405
|
+
return "0.30.2-by-rayss";
|
|
9391
9406
|
} catch {
|
|
9392
9407
|
return "0.0.0";
|
|
9393
9408
|
}
|
|
@@ -12702,6 +12717,7 @@ var init_glm = __esm(() => {
|
|
|
12702
12717
|
supportsPreciseTokenCount: false
|
|
12703
12718
|
},
|
|
12704
12719
|
modelIds: [
|
|
12720
|
+
"glm-5.3-flash",
|
|
12705
12721
|
"glm-5.3",
|
|
12706
12722
|
"glm-5.2",
|
|
12707
12723
|
"GLM-5.1",
|
|
@@ -17718,6 +17734,21 @@ var init_glm2 = __esm(() => {
|
|
|
17718
17734
|
supportsPreciseTokenCount: false
|
|
17719
17735
|
};
|
|
17720
17736
|
glm_default2 = [
|
|
17737
|
+
defineModel({
|
|
17738
|
+
id: "glm-5.3-flash",
|
|
17739
|
+
label: "GLM 5.3 Flash",
|
|
17740
|
+
brandId: "glm",
|
|
17741
|
+
vendorId: "zai",
|
|
17742
|
+
classification: ["chat", "reasoning", "vision", "coding"],
|
|
17743
|
+
defaultModel: "glm-5.3-flash",
|
|
17744
|
+
capabilities: {
|
|
17745
|
+
...glmCapabilities,
|
|
17746
|
+
supportsVision: true
|
|
17747
|
+
},
|
|
17748
|
+
contextWindow: 1e6,
|
|
17749
|
+
maxOutputTokens: 131072,
|
|
17750
|
+
runtimeMetadataScope: "catalog"
|
|
17751
|
+
}),
|
|
17721
17752
|
glmModel("glm-5.3", "GLM 5.3", 1e6, 131072, "catalog"),
|
|
17722
17753
|
defineModel({
|
|
17723
17754
|
id: "glm-5v-turbo",
|
|
@@ -32124,6 +32155,9 @@ function normalizeComparableBaseUrl(baseUrl) {
|
|
|
32124
32155
|
return baseUrl.trim().replace(/\/+$/, "").toLowerCase() || null;
|
|
32125
32156
|
}
|
|
32126
32157
|
}
|
|
32158
|
+
function isCanonicalZaiCodingPlanBaseUrl(value) {
|
|
32159
|
+
return normalizeComparableBaseUrl(value) === normalizeComparableBaseUrl(ZAI_CODING_PLAN_BASE_URL);
|
|
32160
|
+
}
|
|
32127
32161
|
function normalizeHost2(baseUrl) {
|
|
32128
32162
|
if (!baseUrl?.trim()) {
|
|
32129
32163
|
return null;
|
|
@@ -32741,6 +32775,9 @@ function profileRouteHonorsBaseUrlBoundary(routeId, baseUrl) {
|
|
|
32741
32775
|
if (routeId === "llmtr") {
|
|
32742
32776
|
return isCanonicalLlmtrInferenceBaseUrl(baseUrl);
|
|
32743
32777
|
}
|
|
32778
|
+
if (routeId === "zai") {
|
|
32779
|
+
return !baseUrl || isCanonicalZaiCodingPlanBaseUrl(baseUrl);
|
|
32780
|
+
}
|
|
32744
32781
|
return true;
|
|
32745
32782
|
}
|
|
32746
32783
|
function resolveActiveRouteIdFromEnv(processEnv = process.env, options) {
|
|
@@ -32759,20 +32796,22 @@ function resolveActiveRouteIdFromEnv(processEnv = process.env, options) {
|
|
|
32759
32796
|
if (isEnvTruthy(processEnv.CLAUDE_CODE_USE_VERTEX)) {
|
|
32760
32797
|
return "vertex";
|
|
32761
32798
|
}
|
|
32762
|
-
const
|
|
32763
|
-
|
|
32799
|
+
const anthropicBaseUrl = hasNonEmptyEnvValue(processEnv.ANTHROPIC_BASE_URL) ? processEnv.ANTHROPIC_BASE_URL : undefined;
|
|
32800
|
+
const knownAnthropicRoute = resolveRouteIdFromBaseUrl(anthropicBaseUrl);
|
|
32801
|
+
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)) {
|
|
32764
32802
|
return "custom-anthropic";
|
|
32765
32803
|
}
|
|
32766
32804
|
const envOnlyRouteId = resolveEnvOnlyProviderRouteId(processEnv);
|
|
32767
32805
|
if (envOnlyRouteId)
|
|
32768
32806
|
return envOnlyRouteId;
|
|
32769
32807
|
if (isEnvTruthy(processEnv.CLAUDE_CODE_USE_OPENAI)) {
|
|
32770
|
-
const baseUrl = processEnv.OPENAI_BASE_URL
|
|
32808
|
+
const baseUrl = hasNonEmptyEnvValue(processEnv.OPENAI_BASE_URL) ? processEnv.OPENAI_BASE_URL : hasNonEmptyEnvValue(processEnv.OPENAI_API_BASE) ? processEnv.OPENAI_API_BASE : undefined;
|
|
32809
|
+
const hasExplicitBaseUrl = baseUrl !== undefined;
|
|
32771
32810
|
const matchedRoute = resolveRouteIdFromBaseUrl(baseUrl);
|
|
32772
32811
|
if (matchedRoute) {
|
|
32773
32812
|
return matchedRoute;
|
|
32774
32813
|
}
|
|
32775
|
-
if (options?.activeProfileProvider) {
|
|
32814
|
+
if (!hasExplicitBaseUrl && options?.activeProfileProvider) {
|
|
32776
32815
|
const route = resolveProfileRoute(options.activeProfileProvider);
|
|
32777
32816
|
if (route.routeId !== "unknown-fallback" && route.routeId !== "openai" && route.routeId !== "custom" && profileRouteHonorsBaseUrlBoundary(route.routeId, options.activeProfileBaseUrl ?? baseUrl)) {
|
|
32778
32817
|
return route.routeId;
|
|
@@ -32789,7 +32828,7 @@ function resolveActiveRouteIdFromEnv(processEnv = process.env, options) {
|
|
|
32789
32828
|
}
|
|
32790
32829
|
return "custom";
|
|
32791
32830
|
}
|
|
32792
|
-
if (options?.activeProfileProvider) {
|
|
32831
|
+
if (!anthropicBaseUrl && options?.activeProfileProvider) {
|
|
32793
32832
|
const route = resolveProfileRoute(options.activeProfileProvider);
|
|
32794
32833
|
if (route.routeId !== "unknown-fallback" && route.routeId !== "openai" && route.routeId !== "custom" && profileRouteHonorsBaseUrlBoundary(route.routeId, options.activeProfileBaseUrl)) {
|
|
32795
32834
|
return route.routeId;
|
|
@@ -32804,7 +32843,7 @@ function resolveActiveRouteIdFromEnv(processEnv = process.env, options) {
|
|
|
32804
32843
|
function getTransportKindForRoute(routeId) {
|
|
32805
32844
|
return getRouteDescriptor(routeId)?.transportConfig.kind ?? null;
|
|
32806
32845
|
}
|
|
32807
|
-
var TRANSPORT_KIND_PROVIDER_TYPE_LABELS, 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";
|
|
32846
|
+
var TRANSPORT_KIND_PROVIDER_TYPE_LABELS, 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";
|
|
32808
32847
|
var init_routeMetadata = __esm(() => {
|
|
32809
32848
|
init_integrations();
|
|
32810
32849
|
init_credentialPool();
|
|
@@ -106275,6 +106314,9 @@ function resolveProfileCapabilityRouteId(provider, baseUrl) {
|
|
|
106275
106314
|
if (routeIdFromBaseUrl) {
|
|
106276
106315
|
return routeIdFromBaseUrl;
|
|
106277
106316
|
}
|
|
106317
|
+
if (providerRouteId === "zai" && baseUrl) {
|
|
106318
|
+
return "custom";
|
|
106319
|
+
}
|
|
106278
106320
|
if ((providerRouteId === "cloudflare" || providerRouteId === "longcat" || providerRouteId === "concentrate" || providerRouteId === "llmtr") && baseUrl && !(providerRouteId === "cloudflare" ? isCloudflareBaseUrl(baseUrl) : providerRouteId === "longcat" ? isLongcatBaseUrl(baseUrl) : providerRouteId === "concentrate" ? isCanonicalConcentrateInferenceBaseUrl(baseUrl) : isCanonicalLlmtrInferenceBaseUrl(baseUrl))) {
|
|
106279
106321
|
return "custom";
|
|
106280
106322
|
}
|
|
@@ -109602,7 +109644,7 @@ var init_metadata = __esm(() => {
|
|
|
109602
109644
|
COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
|
|
109603
109645
|
WHITESPACE_REGEX = /\s+/;
|
|
109604
109646
|
getVersionBase = memoize_default(() => {
|
|
109605
|
-
const match = "0.30.
|
|
109647
|
+
const match = "0.30.2-by-rayss".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
|
|
109606
109648
|
return match ? match[0] : undefined;
|
|
109607
109649
|
});
|
|
109608
109650
|
buildEnvContext = memoize_default(async () => {
|
|
@@ -109642,9 +109684,9 @@ var init_metadata = __esm(() => {
|
|
|
109642
109684
|
isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
|
|
109643
109685
|
isClaudeCodeAction: isEnvTruthy(process.env.CLAUDE_CODE_ACTION),
|
|
109644
109686
|
isClaudeAiAuth: isClaudeAISubscriber(),
|
|
109645
|
-
version: "0.30.
|
|
109687
|
+
version: "0.30.2-by-rayss",
|
|
109646
109688
|
versionBase: getVersionBase(),
|
|
109647
|
-
buildTime: "2026-09-
|
|
109689
|
+
buildTime: "2026-09-05T03:58:56.896Z",
|
|
109648
109690
|
deploymentEnvironment: env2.detectDeploymentEnvironment(),
|
|
109649
109691
|
...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
|
|
109650
109692
|
githubEventName: process.env.GITHUB_EVENT_NAME,
|
|
@@ -173301,7 +173343,7 @@ var init_codeIndexing = __esm(() => {
|
|
|
173301
173343
|
|
|
173302
173344
|
// src/utils/userAgent.ts
|
|
173303
173345
|
function getClaudeCodeUserAgent() {
|
|
173304
|
-
return `claude-code/${"0.30.
|
|
173346
|
+
return `claude-code/${"0.30.2-by-rayss"}`;
|
|
173305
173347
|
}
|
|
173306
173348
|
|
|
173307
173349
|
// src/utils/workloadContext.ts
|
|
@@ -173320,7 +173362,7 @@ function getUserAgent() {
|
|
|
173320
173362
|
const clientApp = process.env.CLAUDE_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}` : "";
|
|
173321
173363
|
const workload = getWorkload();
|
|
173322
173364
|
const workloadSuffix = workload ? `, workload/${workload}` : "";
|
|
173323
|
-
return `claude-cli/${"0.30.
|
|
173365
|
+
return `claude-cli/${"0.30.2-by-rayss"} (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
|
|
173324
173366
|
}
|
|
173325
173367
|
function getMCPUserAgent() {
|
|
173326
173368
|
const parts = [];
|
|
@@ -173334,7 +173376,7 @@ function getMCPUserAgent() {
|
|
|
173334
173376
|
parts.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`);
|
|
173335
173377
|
}
|
|
173336
173378
|
const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
173337
|
-
return `claude-code/${"0.30.
|
|
173379
|
+
return `claude-code/${"0.30.2-by-rayss"}${suffix}`;
|
|
173338
173380
|
}
|
|
173339
173381
|
function getWebFetchUserAgent() {
|
|
173340
173382
|
const supportUrl = isFirstPartyAnthropicProvider() ? "https://support.anthropic.com/" : "https://github.com/rayss868/openclaude";
|
|
@@ -178409,7 +178451,7 @@ function getAttributionHeader(fingerprint, policy) {
|
|
|
178409
178451
|
if (!policy.generate) {
|
|
178410
178452
|
return "";
|
|
178411
178453
|
}
|
|
178412
|
-
const version2 = `${"0.30.
|
|
178454
|
+
const version2 = `${"0.30.2-by-rayss"}.${fingerprint}`;
|
|
178413
178455
|
const entrypoint = process.env.CLAUDE_CODE_ENTRYPOINT ?? "unknown";
|
|
178414
178456
|
const cch = "";
|
|
178415
178457
|
const workload = getWorkload();
|
|
@@ -182193,7 +182235,7 @@ function prepareOpenAIRequest({
|
|
|
182193
182235
|
model: runtimeModel,
|
|
182194
182236
|
baseUrl: request.baseUrl,
|
|
182195
182237
|
processEnv: requestProcessEnv,
|
|
182196
|
-
|
|
182238
|
+
resolvedRouteId: runtimeShimContext.routeId
|
|
182197
182239
|
});
|
|
182198
182240
|
const shimConfig = runtimeShimContext.openaiShimConfig;
|
|
182199
182241
|
const effectiveTransport = shimConfig.endpointPath === "/responses" ? "responses" : shimConfig.endpointPath === "/messages" ? "anthropic_messages" : shimConfig.endpointPath?.startsWith("/models/gemini-") ? "gemini" : request.transport;
|
|
@@ -182318,10 +182360,11 @@ function prepareOpenAIRequest({
|
|
|
182318
182360
|
let responsesInput;
|
|
182319
182361
|
let responsesMessages;
|
|
182320
182362
|
const getResponsesInput = () => {
|
|
182321
|
-
responsesMessages ??= effectiveTransport === "chat_completions" ? fastPath.skipToolHistoryCompression || skipCompressionForPrefixCache ? rawMessages : compressToolHistory(rawMessages,
|
|
182363
|
+
responsesMessages ??= effectiveTransport === "chat_completions" ? fastPath.skipToolHistoryCompression || skipCompressionForPrefixCache ? rawMessages : compressToolHistory(rawMessages, runtimeModel, {
|
|
182322
182364
|
textBlockSeparator: `
|
|
182323
182365
|
`,
|
|
182324
|
-
omitOldUserImages: true
|
|
182366
|
+
omitOldUserImages: true,
|
|
182367
|
+
runtimeLimits
|
|
182325
182368
|
}) : compressedMessages;
|
|
182326
182369
|
responsesInput ??= convertAnthropicMessagesToResponsesInput(responsesMessages, effectiveTransport === "responses_compat");
|
|
182327
182370
|
return responsesInput;
|
|
@@ -186504,7 +186547,7 @@ function computeFingerprint(messageText2, version2) {
|
|
|
186504
186547
|
}
|
|
186505
186548
|
function computeFingerprintFromMessages(messages) {
|
|
186506
186549
|
const firstMessageText = extractFirstMessageText(messages);
|
|
186507
|
-
return computeFingerprint(firstMessageText, "0.30.
|
|
186550
|
+
return computeFingerprint(firstMessageText, "0.30.2-by-rayss");
|
|
186508
186551
|
}
|
|
186509
186552
|
var FINGERPRINT_SALT = "59cf53e54c78";
|
|
186510
186553
|
var init_fingerprint = () => {};
|
|
@@ -187871,7 +187914,7 @@ var init_client3 = __esm(() => {
|
|
|
187871
187914
|
const client = new Client({
|
|
187872
187915
|
name: "claude-code",
|
|
187873
187916
|
title: "OpenClaude",
|
|
187874
|
-
version: "0.30.
|
|
187917
|
+
version: "0.30.2-by-rayss",
|
|
187875
187918
|
description: "OpenClaude — coding-agent CLI for any LLM provider",
|
|
187876
187919
|
websiteUrl: PRODUCT_URL
|
|
187877
187920
|
}, {
|
|
@@ -250859,6 +250902,83 @@ var init_LocalShellTask = __esm(() => {
|
|
|
250859
250902
|
};
|
|
250860
250903
|
});
|
|
250861
250904
|
|
|
250905
|
+
// src/tools/BashTool/commandRepair.ts
|
|
250906
|
+
import { writeFile as writeFile12 } from "fs/promises";
|
|
250907
|
+
import { join as join64 } from "path";
|
|
250908
|
+
function findInlineScripts(command) {
|
|
250909
|
+
const results = [];
|
|
250910
|
+
const nodePatterns = [
|
|
250911
|
+
/(^|\s|&&|\|\|)(node\s+(?:--input-type=\S+\s+)?-e)\s+('(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*")/g,
|
|
250912
|
+
/(^|\s|&&|\|\|)(node\s+(?:--input-type=\S+\s+)?-e)\s+(\$'[^']+')/g
|
|
250913
|
+
];
|
|
250914
|
+
const pythonPatterns = [
|
|
250915
|
+
/(^|\s|&&|\|\|)((?:python3?|pypy3?)\s+-c)\s+('(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*")/g,
|
|
250916
|
+
/(^|\s|&&|\|\|)((?:python3?|pypy3?)\s+-c)\s+(\$'[^']+')/g
|
|
250917
|
+
];
|
|
250918
|
+
for (const pattern of [...nodePatterns, ...pythonPatterns]) {
|
|
250919
|
+
let match;
|
|
250920
|
+
while ((match = pattern.exec(command)) !== null) {
|
|
250921
|
+
const lang = match[2].startsWith("node") ? "node" : "python";
|
|
250922
|
+
const raw = match[3];
|
|
250923
|
+
const code = raw.startsWith("'") && raw.endsWith("'") || raw.startsWith('"') && raw.endsWith('"') ? raw.slice(1, -1) : raw;
|
|
250924
|
+
results.push({
|
|
250925
|
+
full: match[0],
|
|
250926
|
+
prefix: match[2],
|
|
250927
|
+
lang,
|
|
250928
|
+
code,
|
|
250929
|
+
start: match.index,
|
|
250930
|
+
end: match.index + match[0].length
|
|
250931
|
+
});
|
|
250932
|
+
}
|
|
250933
|
+
}
|
|
250934
|
+
return results;
|
|
250935
|
+
}
|
|
250936
|
+
function needsRepair(code) {
|
|
250937
|
+
if (code.includes("!"))
|
|
250938
|
+
return true;
|
|
250939
|
+
if (code.includes("`"))
|
|
250940
|
+
return true;
|
|
250941
|
+
if (code.length > 300)
|
|
250942
|
+
return true;
|
|
250943
|
+
return false;
|
|
250944
|
+
}
|
|
250945
|
+
function getRunner(lang) {
|
|
250946
|
+
if (lang === "node") {
|
|
250947
|
+
return { ext: ".mjs", cmd: "node" };
|
|
250948
|
+
}
|
|
250949
|
+
return { ext: ".py", cmd: "python" };
|
|
250950
|
+
}
|
|
250951
|
+
async function repairCommand(command) {
|
|
250952
|
+
const scripts = findInlineScripts(command);
|
|
250953
|
+
if (scripts.length === 0)
|
|
250954
|
+
return command;
|
|
250955
|
+
const needsRepairAny = scripts.some((s) => needsRepair(s.code));
|
|
250956
|
+
if (!needsRepairAny)
|
|
250957
|
+
return command;
|
|
250958
|
+
let result = command;
|
|
250959
|
+
for (const script of [...scripts].reverse()) {
|
|
250960
|
+
if (!needsRepair(script.code))
|
|
250961
|
+
continue;
|
|
250962
|
+
const { ext, cmd } = getRunner(script.lang);
|
|
250963
|
+
const id = Math.random().toString(36).slice(2, 10);
|
|
250964
|
+
const tempDir = getClaudeTempDir();
|
|
250965
|
+
const tempFile = join64(tempDir, `_inline_${id}${ext}`);
|
|
250966
|
+
let cleanCode = script.code;
|
|
250967
|
+
if (script.lang === "node") {
|
|
250968
|
+
cleanCode = cleanCode.replace(/\\\$/g, "$").replace(/\\\`/g, "`").replace(/\\\\/g, "\\");
|
|
250969
|
+
}
|
|
250970
|
+
await writeFile12(tempFile, cleanCode, "utf8");
|
|
250971
|
+
const runCmd = `( trap 'rm -f "${tempFile}"' EXIT; ${cmd} "${tempFile}" )`;
|
|
250972
|
+
result = runCmd;
|
|
250973
|
+
logForDebugging(`[commandRepair] Rewrote inline ${script.lang} script (${script.code.length} chars) to temp file: ${tempFile}`);
|
|
250974
|
+
}
|
|
250975
|
+
return result;
|
|
250976
|
+
}
|
|
250977
|
+
var init_commandRepair = __esm(() => {
|
|
250978
|
+
init_filesystem();
|
|
250979
|
+
init_debug();
|
|
250980
|
+
});
|
|
250981
|
+
|
|
250862
250982
|
// src/utils/claudeCodeHints.ts
|
|
250863
250983
|
function extractClaudeCodeHints(output, command) {
|
|
250864
250984
|
if (!output.includes("<claude-code-hint")) {
|
|
@@ -251657,7 +251777,7 @@ var init_generatedFiles = __esm(() => {
|
|
|
251657
251777
|
|
|
251658
251778
|
// src/utils/commitAttribution.ts
|
|
251659
251779
|
import { stat as stat23 } from "fs/promises";
|
|
251660
|
-
import { isAbsolute as isAbsolute22, join as
|
|
251780
|
+
import { isAbsolute as isAbsolute22, join as join65, relative as relative15, sep as sep17 } from "path";
|
|
251661
251781
|
function getAttributionRepoRoot() {
|
|
251662
251782
|
const cwd2 = getCwd();
|
|
251663
251783
|
return findGitRoot(cwd2) ?? getOriginalCwd();
|
|
@@ -251745,7 +251865,7 @@ async function calculateCommitAttribution(states2, stagedFiles) {
|
|
|
251745
251865
|
if (isGeneratedFile(file2)) {
|
|
251746
251866
|
return { type: "generated", file: file2 };
|
|
251747
251867
|
}
|
|
251748
|
-
const absPath =
|
|
251868
|
+
const absPath = join65(cwd2, file2);
|
|
251749
251869
|
const fileState = mergedFileStates.get(file2);
|
|
251750
251870
|
const baseline = mergedBaselines.get(file2);
|
|
251751
251871
|
const fileSurface = states2[0].surface;
|
|
@@ -255785,7 +255905,7 @@ import {
|
|
|
255785
255905
|
dirname as dirname35,
|
|
255786
255906
|
extname as extname9,
|
|
255787
255907
|
isAbsolute as isAbsolute23,
|
|
255788
|
-
join as
|
|
255908
|
+
join as join66,
|
|
255789
255909
|
parse as parse10,
|
|
255790
255910
|
relative as relative16,
|
|
255791
255911
|
sep as sep18
|
|
@@ -256045,7 +256165,7 @@ async function processMdRules({
|
|
|
256045
256165
|
throw e;
|
|
256046
256166
|
}
|
|
256047
256167
|
for (const entry of entries) {
|
|
256048
|
-
const entryPath =
|
|
256168
|
+
const entryPath = join66(rulesDir, entry.name);
|
|
256049
256169
|
const { resolvedPath: resolvedEntryPath, isSymlink: isSymlink2 } = safeResolvePath(fs2, entryPath);
|
|
256050
256170
|
const stats = isSymlink2 ? await fs2.stat(resolvedEntryPath) : null;
|
|
256051
256171
|
const isDirectory = stats ? stats.isDirectory() : entry.isDirectory();
|
|
@@ -256120,14 +256240,14 @@ async function getMemoryFilesForNestedDirectory(dir, targetPath, processedPaths)
|
|
|
256120
256240
|
if (isSettingSourceEnabled("projectSettings")) {
|
|
256121
256241
|
const projectPath = getProjectInstructionFilePath(dir, getFsImplementation().existsSync);
|
|
256122
256242
|
result.push(...await processMemoryFile(projectPath, "Project", processedPaths, false));
|
|
256123
|
-
const dotClaudePath =
|
|
256243
|
+
const dotClaudePath = join66(dir, ".openclaude", "CLAUDE.md");
|
|
256124
256244
|
result.push(...await processMemoryFile(dotClaudePath, "Project", processedPaths, false));
|
|
256125
256245
|
}
|
|
256126
256246
|
if (isSettingSourceEnabled("localSettings")) {
|
|
256127
|
-
const localPath =
|
|
256247
|
+
const localPath = join66(dir, "CLAUDE.local.md");
|
|
256128
256248
|
result.push(...await processMemoryFile(localPath, "Local", processedPaths, false));
|
|
256129
256249
|
}
|
|
256130
|
-
const rulesDir =
|
|
256250
|
+
const rulesDir = join66(dir, ".openclaude", "rules");
|
|
256131
256251
|
const unconditionalProcessedPaths = new Set(processedPaths);
|
|
256132
256252
|
result.push(...await processMdRules({
|
|
256133
256253
|
rulesDir,
|
|
@@ -256143,7 +256263,7 @@ async function getMemoryFilesForNestedDirectory(dir, targetPath, processedPaths)
|
|
|
256143
256263
|
return result;
|
|
256144
256264
|
}
|
|
256145
256265
|
async function getConditionalRulesForCwdLevelDirectory(dir, targetPath, processedPaths) {
|
|
256146
|
-
const rulesDir =
|
|
256266
|
+
const rulesDir = join66(dir, ".openclaude", "rules");
|
|
256147
256267
|
return processConditionedMdRules(targetPath, rulesDir, "Project", processedPaths, false);
|
|
256148
256268
|
}
|
|
256149
256269
|
async function processConditionedMdRules(targetPath, rulesDir, type, processedPaths, includeExternal) {
|
|
@@ -256428,9 +256548,9 @@ var init_claudemd = __esm(() => {
|
|
|
256428
256548
|
if (isSettingSourceEnabled("projectSettings") && !skipProject) {
|
|
256429
256549
|
const projectPath = getProjectInstructionFilePath(dir, getFsImplementation().existsSync);
|
|
256430
256550
|
result.push(...await processMemoryFile(projectPath, "Project", processedPaths, includeExternal));
|
|
256431
|
-
const dotClaudePath =
|
|
256551
|
+
const dotClaudePath = join66(dir, ".openclaude", "CLAUDE.md");
|
|
256432
256552
|
result.push(...await processMemoryFile(dotClaudePath, "Project", processedPaths, includeExternal));
|
|
256433
|
-
const rulesDir =
|
|
256553
|
+
const rulesDir = join66(dir, ".openclaude", "rules");
|
|
256434
256554
|
result.push(...await processMdRules({
|
|
256435
256555
|
rulesDir,
|
|
256436
256556
|
type: "Project",
|
|
@@ -256440,7 +256560,7 @@ var init_claudemd = __esm(() => {
|
|
|
256440
256560
|
}));
|
|
256441
256561
|
}
|
|
256442
256562
|
if (isSettingSourceEnabled("localSettings")) {
|
|
256443
|
-
const localPath =
|
|
256563
|
+
const localPath = join66(dir, "CLAUDE.local.md");
|
|
256444
256564
|
result.push(...await processMemoryFile(localPath, "Local", processedPaths, includeExternal));
|
|
256445
256565
|
}
|
|
256446
256566
|
}
|
|
@@ -256449,9 +256569,9 @@ var init_claudemd = __esm(() => {
|
|
|
256449
256569
|
for (const dir of additionalDirs) {
|
|
256450
256570
|
const projectPath = getProjectInstructionFilePath(dir, getFsImplementation().existsSync);
|
|
256451
256571
|
result.push(...await processMemoryFile(projectPath, "Project", processedPaths, includeExternal));
|
|
256452
|
-
const dotClaudePath =
|
|
256572
|
+
const dotClaudePath = join66(dir, ".openclaude", "CLAUDE.md");
|
|
256453
256573
|
result.push(...await processMemoryFile(dotClaudePath, "Project", processedPaths, includeExternal));
|
|
256454
|
-
const rulesDir =
|
|
256574
|
+
const rulesDir = join66(dir, ".openclaude", "rules");
|
|
256455
256575
|
result.push(...await processMdRules({
|
|
256456
256576
|
rulesDir,
|
|
256457
256577
|
type: "Project",
|
|
@@ -256525,8 +256645,8 @@ var init_claudemd = __esm(() => {
|
|
|
256525
256645
|
|
|
256526
256646
|
// src/services/teamMemorySync/index.ts
|
|
256527
256647
|
import { createHash as createHash13 } from "crypto";
|
|
256528
|
-
import { mkdir as mkdir15, readdir as readdir9, readFile as readFile16, stat as stat24, writeFile as
|
|
256529
|
-
import { join as
|
|
256648
|
+
import { mkdir as mkdir15, readdir as readdir9, readFile as readFile16, stat as stat24, writeFile as writeFile13 } from "fs/promises";
|
|
256649
|
+
import { join as join67, relative as relative17, sep as sep19 } from "path";
|
|
256530
256650
|
function createSyncState() {
|
|
256531
256651
|
return {
|
|
256532
256652
|
lastKnownChecksum: null,
|
|
@@ -256842,7 +256962,7 @@ async function collectLocalTeamMemoryFiles(teamDir, deps) {
|
|
|
256842
256962
|
throw e;
|
|
256843
256963
|
}
|
|
256844
256964
|
for (const entry of dirEntries) {
|
|
256845
|
-
const fullPath =
|
|
256965
|
+
const fullPath = join67(dir, entry.name);
|
|
256846
256966
|
if (entry.isDirectory()) {
|
|
256847
256967
|
await walkDir(fullPath);
|
|
256848
256968
|
continue;
|
|
@@ -257256,7 +257376,7 @@ var init_teamMemorySync = __esm(() => {
|
|
|
257256
257376
|
validateTeamMemKey,
|
|
257257
257377
|
readFile: (path13) => readFile16(path13, "utf8"),
|
|
257258
257378
|
mkdir: (path13, options2) => mkdir15(path13, options2),
|
|
257259
|
-
writeFile: (path13, content) =>
|
|
257379
|
+
writeFile: (path13, content) => writeFile13(path13, content, "utf8")
|
|
257260
257380
|
};
|
|
257261
257381
|
});
|
|
257262
257382
|
|
|
@@ -257273,7 +257393,7 @@ __export(exports_watcher, {
|
|
|
257273
257393
|
});
|
|
257274
257394
|
import { watch as watch2 } from "fs";
|
|
257275
257395
|
import { mkdir as mkdir16, stat as stat25 } from "fs/promises";
|
|
257276
|
-
import { join as
|
|
257396
|
+
import { join as join68 } from "path";
|
|
257277
257397
|
function isPermanentFailure(r) {
|
|
257278
257398
|
if (r.errorType === "no_oauth" || r.errorType === "no_repo")
|
|
257279
257399
|
return true;
|
|
@@ -257371,7 +257491,7 @@ async function startFileWatcher(teamDir) {
|
|
|
257371
257491
|
return;
|
|
257372
257492
|
}
|
|
257373
257493
|
if (pushSuppressedReason !== null) {
|
|
257374
|
-
stat25(
|
|
257494
|
+
stat25(join68(teamDir, filename)).catch((err2) => {
|
|
257375
257495
|
if (err2.code !== "ENOENT")
|
|
257376
257496
|
return;
|
|
257377
257497
|
if (pushSuppressedReason !== null) {
|
|
@@ -257883,8 +258003,8 @@ var init_gitSettings = __esm(() => {
|
|
|
257883
258003
|
});
|
|
257884
258004
|
|
|
257885
258005
|
// src/utils/tasks.ts
|
|
257886
|
-
import { mkdir as mkdir17, readdir as readdir10, readFile as readFile17, unlink as unlink8, writeFile as
|
|
257887
|
-
import { join as
|
|
258006
|
+
import { mkdir as mkdir17, readdir as readdir10, readFile as readFile17, unlink as unlink8, writeFile as writeFile14 } from "fs/promises";
|
|
258007
|
+
import { join as join69 } from "path";
|
|
257888
258008
|
function setLeaderTeamName(teamName) {
|
|
257889
258009
|
if (leaderTeamName === teamName)
|
|
257890
258010
|
return;
|
|
@@ -257903,7 +258023,7 @@ function notifyTasksUpdated() {
|
|
|
257903
258023
|
} catch {}
|
|
257904
258024
|
}
|
|
257905
258025
|
function getHighWaterMarkPath(taskListId) {
|
|
257906
|
-
return
|
|
258026
|
+
return join69(getTasksDir(taskListId), HIGH_WATER_MARK_FILE);
|
|
257907
258027
|
}
|
|
257908
258028
|
async function readHighWaterMark(taskListId) {
|
|
257909
258029
|
const path13 = getHighWaterMarkPath(taskListId);
|
|
@@ -257917,7 +258037,7 @@ async function readHighWaterMark(taskListId) {
|
|
|
257917
258037
|
}
|
|
257918
258038
|
async function writeHighWaterMark(taskListId, value) {
|
|
257919
258039
|
const path13 = getHighWaterMarkPath(taskListId);
|
|
257920
|
-
await
|
|
258040
|
+
await writeFile14(path13, String(value));
|
|
257921
258041
|
}
|
|
257922
258042
|
function isTodoV2Enabled() {
|
|
257923
258043
|
if (isEnvTruthy(process.env.CLAUDE_CODE_ENABLE_TASKS)) {
|
|
@@ -257946,7 +258066,7 @@ async function resetTaskList(taskListId) {
|
|
|
257946
258066
|
}
|
|
257947
258067
|
for (const file2 of files) {
|
|
257948
258068
|
if (file2.endsWith(".json") && !file2.startsWith(".")) {
|
|
257949
|
-
const filePath =
|
|
258069
|
+
const filePath = join69(dir, file2);
|
|
257950
258070
|
try {
|
|
257951
258071
|
await unlink8(filePath);
|
|
257952
258072
|
} catch {}
|
|
@@ -257973,10 +258093,10 @@ function sanitizePathComponent(input) {
|
|
|
257973
258093
|
return input.replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
257974
258094
|
}
|
|
257975
258095
|
function getTasksDir(taskListId) {
|
|
257976
|
-
return
|
|
258096
|
+
return join69(getClaudeConfigHomeDir(), "tasks", sanitizePathComponent(taskListId));
|
|
257977
258097
|
}
|
|
257978
258098
|
function getTaskPath(taskListId, taskId) {
|
|
257979
|
-
return
|
|
258099
|
+
return join69(getTasksDir(taskListId), `${sanitizePathComponent(taskId)}.json`);
|
|
257980
258100
|
}
|
|
257981
258101
|
async function ensureTasksDir(taskListId) {
|
|
257982
258102
|
const dir = getTasksDir(taskListId);
|
|
@@ -258020,7 +258140,7 @@ async function createTask(taskListId, taskData) {
|
|
|
258020
258140
|
const id = String(highestId + 1);
|
|
258021
258141
|
const task = { id, ...taskData };
|
|
258022
258142
|
const path13 = getTaskPath(taskListId, id);
|
|
258023
|
-
await
|
|
258143
|
+
await writeFile14(path13, jsonStringify(task, null, 2));
|
|
258024
258144
|
notifyTasksUpdated();
|
|
258025
258145
|
return id;
|
|
258026
258146
|
} finally {
|
|
@@ -258066,7 +258186,7 @@ async function updateTaskUnsafe(taskListId, taskId, updates) {
|
|
|
258066
258186
|
}
|
|
258067
258187
|
const updated = { ...existing, ...updates, id: taskId };
|
|
258068
258188
|
const path13 = getTaskPath(taskListId, taskId);
|
|
258069
|
-
await
|
|
258189
|
+
await writeFile14(path13, jsonStringify(updated, null, 2));
|
|
258070
258190
|
notifyTasksUpdated();
|
|
258071
258191
|
return updated;
|
|
258072
258192
|
}
|
|
@@ -258153,13 +258273,13 @@ async function blockTask(taskListId, fromTaskId, toTaskId) {
|
|
|
258153
258273
|
return true;
|
|
258154
258274
|
}
|
|
258155
258275
|
function getTaskListLockPath(taskListId) {
|
|
258156
|
-
return
|
|
258276
|
+
return join69(getTasksDir(taskListId), ".lock");
|
|
258157
258277
|
}
|
|
258158
258278
|
async function ensureTaskListLockFile(taskListId) {
|
|
258159
258279
|
await ensureTasksDir(taskListId);
|
|
258160
258280
|
const lockPath = getTaskListLockPath(taskListId);
|
|
258161
258281
|
try {
|
|
258162
|
-
await
|
|
258282
|
+
await writeFile14(lockPath, "", { flag: "wx" });
|
|
258163
258283
|
} catch {}
|
|
258164
258284
|
return lockPath;
|
|
258165
258285
|
}
|
|
@@ -258837,7 +258957,14 @@ function getSimplePrompt() {
|
|
|
258837
258957
|
sleepSubitems,
|
|
258838
258958
|
...embedded ? [
|
|
258839
258959
|
"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."
|
|
258840
|
-
] : []
|
|
258960
|
+
] : [],
|
|
258961
|
+
"Inline scripts (node -e / python -c):",
|
|
258962
|
+
[
|
|
258963
|
+
"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`.",
|
|
258964
|
+
"For short one-liners without `!`, inline is fine.",
|
|
258965
|
+
'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"`).',
|
|
258966
|
+
"If you must use inline with `!`, prefix with `set +H` to disable history expansion, or use the temp-file approach above."
|
|
258967
|
+
]
|
|
258841
258968
|
];
|
|
258842
258969
|
return [
|
|
258843
258970
|
"Executes a given bash command and returns its output.",
|
|
@@ -260292,7 +260419,11 @@ async function* runShellCommand({
|
|
|
260292
260419
|
});
|
|
260293
260420
|
}
|
|
260294
260421
|
const shouldAutoBackground = !isBackgroundTasksDisabled && isAutobackgroundingAllowed(command);
|
|
260295
|
-
|
|
260422
|
+
let finalCommand = command;
|
|
260423
|
+
try {
|
|
260424
|
+
finalCommand = await repairCommand(command);
|
|
260425
|
+
} catch {}
|
|
260426
|
+
const shellCommand = await exec3(finalCommand, abortController.signal, "bash", {
|
|
260296
260427
|
timeout: timeoutMs,
|
|
260297
260428
|
onProgress(lastLines, allLines, totalLines, totalBytes, isIncomplete) {
|
|
260298
260429
|
lastProgressOutput = lastLines;
|
|
@@ -260491,6 +260622,7 @@ var init_BashTool = __esm(() => {
|
|
|
260491
260622
|
init_LocalShellTask();
|
|
260492
260623
|
init_ast();
|
|
260493
260624
|
init_commands2();
|
|
260625
|
+
init_commandRepair();
|
|
260494
260626
|
init_claudeCodeHints();
|
|
260495
260627
|
init_codeIndexing();
|
|
260496
260628
|
init_envUtils();
|
|
@@ -268175,7 +268307,7 @@ var init_promptShellExecution = __esm(() => {
|
|
|
268175
268307
|
});
|
|
268176
268308
|
|
|
268177
268309
|
// src/utils/plugins/loadPluginCommands.ts
|
|
268178
|
-
import { basename as basename20, dirname as dirname36, join as
|
|
268310
|
+
import { basename as basename20, dirname as dirname36, join as join70 } from "path";
|
|
268179
268311
|
function isSkillFile2(filePath) {
|
|
268180
268312
|
return /^skill\.md$/i.test(basename20(filePath));
|
|
268181
268313
|
}
|
|
@@ -268365,7 +268497,7 @@ async function validatePluginSkillFilePath(pluginPath, skillFilePath) {
|
|
|
268365
268497
|
async function loadSkillsFromDirectory(skillsPath, pluginName, sourceName, pluginManifest, pluginPath, loadedPaths) {
|
|
268366
268498
|
const fs2 = getFsImplementation();
|
|
268367
268499
|
const skills = [];
|
|
268368
|
-
const directSkillPath =
|
|
268500
|
+
const directSkillPath = join70(skillsPath, "SKILL.md");
|
|
268369
268501
|
let directSkillContent = null;
|
|
268370
268502
|
try {
|
|
268371
268503
|
if (await validatePluginSkillFilePath(pluginPath, directSkillPath)) {
|
|
@@ -268418,8 +268550,8 @@ async function loadSkillsFromDirectory(skillsPath, pluginName, sourceName, plugi
|
|
|
268418
268550
|
if (!entry.isDirectory() && !entry.isSymbolicLink()) {
|
|
268419
268551
|
return;
|
|
268420
268552
|
}
|
|
268421
|
-
const skillDirPath =
|
|
268422
|
-
const skillFilePath =
|
|
268553
|
+
const skillDirPath = join70(skillsPath, entry.name);
|
|
268554
|
+
const skillFilePath = join70(skillDirPath, "SKILL.md");
|
|
268423
268555
|
let content;
|
|
268424
268556
|
try {
|
|
268425
268557
|
if (!await validatePluginSkillFilePath(pluginPath, skillFilePath)) {
|
|
@@ -268526,7 +268658,7 @@ var init_loadPluginCommands = __esm(() => {
|
|
|
268526
268658
|
if (plugin.commandsMetadata) {
|
|
268527
268659
|
for (const [name, metadata] of Object.entries(plugin.commandsMetadata)) {
|
|
268528
268660
|
if (metadata.source) {
|
|
268529
|
-
const fullMetadataPath =
|
|
268661
|
+
const fullMetadataPath = join70(plugin.path, metadata.source);
|
|
268530
268662
|
if (commandPath === fullMetadataPath) {
|
|
268531
268663
|
commandName = `${plugin.name}:${name}`;
|
|
268532
268664
|
metadataOverride = metadata;
|
|
@@ -268776,10 +268908,10 @@ import {
|
|
|
268776
268908
|
rename as rename2,
|
|
268777
268909
|
rm as rm3,
|
|
268778
268910
|
stat as stat27,
|
|
268779
|
-
writeFile as
|
|
268911
|
+
writeFile as writeFile15
|
|
268780
268912
|
} from "fs/promises";
|
|
268781
268913
|
import { tmpdir as tmpdir5 } from "os";
|
|
268782
|
-
import { basename as basename22, dirname as dirname37, join as
|
|
268914
|
+
import { basename as basename22, dirname as dirname37, join as join71 } from "path";
|
|
268783
268915
|
function isPluginZipCacheEnabled() {
|
|
268784
268916
|
return isEnvTruthy(process.env.CLAUDE_CODE_PLUGIN_USE_ZIP_CACHE);
|
|
268785
268917
|
}
|
|
@@ -268790,7 +268922,7 @@ async function getSessionPluginCachePath() {
|
|
|
268790
268922
|
if (!sessionPluginCachePromise) {
|
|
268791
268923
|
sessionPluginCachePromise = (async () => {
|
|
268792
268924
|
const suffix = randomBytes12(8).toString("hex");
|
|
268793
|
-
const dir =
|
|
268925
|
+
const dir = join71(tmpdir5(), `claude-plugin-session-${suffix}`);
|
|
268794
268926
|
await getFsImplementation().mkdir(dir);
|
|
268795
268927
|
sessionPluginCachePath = dir;
|
|
268796
268928
|
logForDebugging(`Created session plugin cache at ${dir}`);
|
|
@@ -268803,12 +268935,12 @@ async function atomicWriteToZipCache(targetPath, data) {
|
|
|
268803
268935
|
const dir = dirname37(targetPath);
|
|
268804
268936
|
await getFsImplementation().mkdir(dir);
|
|
268805
268937
|
const tmpName = `.${basename22(targetPath)}.tmp.${randomBytes12(4).toString("hex")}`;
|
|
268806
|
-
const tmpPath =
|
|
268938
|
+
const tmpPath = join71(dir, tmpName);
|
|
268807
268939
|
try {
|
|
268808
268940
|
if (typeof data === "string") {
|
|
268809
|
-
await
|
|
268941
|
+
await writeFile15(tmpPath, data, { encoding: "utf-8" });
|
|
268810
268942
|
} else {
|
|
268811
|
-
await
|
|
268943
|
+
await writeFile15(tmpPath, data);
|
|
268812
268944
|
}
|
|
268813
268945
|
await rename2(tmpPath, targetPath);
|
|
268814
268946
|
} catch (error40) {
|
|
@@ -268828,7 +268960,7 @@ async function createZipFromDirectory(sourceDir) {
|
|
|
268828
268960
|
return zipData;
|
|
268829
268961
|
}
|
|
268830
268962
|
async function collectFilesForZip(baseDir, relativePath, files, visited) {
|
|
268831
|
-
const currentDir = relativePath ?
|
|
268963
|
+
const currentDir = relativePath ? join71(baseDir, relativePath) : baseDir;
|
|
268832
268964
|
let entries;
|
|
268833
268965
|
try {
|
|
268834
268966
|
entries = await readdir11(currentDir);
|
|
@@ -268852,7 +268984,7 @@ async function collectFilesForZip(baseDir, relativePath, files, visited) {
|
|
|
268852
268984
|
if (entry === ".git") {
|
|
268853
268985
|
continue;
|
|
268854
268986
|
}
|
|
268855
|
-
const fullPath =
|
|
268987
|
+
const fullPath = join71(currentDir, entry);
|
|
268856
268988
|
const relPath = relativePath ? `${relativePath}/${entry}` : entry;
|
|
268857
268989
|
let fileStat;
|
|
268858
268990
|
try {
|
|
@@ -268893,12 +269025,12 @@ async function extractZipToDirectory(zipPath, targetDir) {
|
|
|
268893
269025
|
await getFsImplementation().mkdir(targetDir);
|
|
268894
269026
|
for (const [relPath, data] of Object.entries(files)) {
|
|
268895
269027
|
if (relPath.endsWith("/")) {
|
|
268896
|
-
await getFsImplementation().mkdir(
|
|
269028
|
+
await getFsImplementation().mkdir(join71(targetDir, relPath));
|
|
268897
269029
|
continue;
|
|
268898
269030
|
}
|
|
268899
|
-
const fullPath =
|
|
269031
|
+
const fullPath = join71(targetDir, relPath);
|
|
268900
269032
|
await getFsImplementation().mkdir(dirname37(fullPath));
|
|
268901
|
-
await
|
|
269033
|
+
await writeFile15(fullPath, data);
|
|
268902
269034
|
const mode = modes[relPath];
|
|
268903
269035
|
if (mode && mode & 73) {
|
|
268904
269036
|
await chmod5(fullPath, mode & 511).catch(() => {});
|
|
@@ -268921,8 +269053,8 @@ var init_zipCache = __esm(() => {
|
|
|
268921
269053
|
});
|
|
268922
269054
|
|
|
268923
269055
|
// src/utils/plugins/cacheUtils.ts
|
|
268924
|
-
import { readdir as readdir12, rm as rm4, stat as stat28, unlink as unlink11, writeFile as
|
|
268925
|
-
import { join as
|
|
269056
|
+
import { readdir as readdir12, rm as rm4, stat as stat28, unlink as unlink11, writeFile as writeFile16 } from "fs/promises";
|
|
269057
|
+
import { join as join72 } from "path";
|
|
268926
269058
|
function clearAllPluginCaches() {
|
|
268927
269059
|
clearPluginCache();
|
|
268928
269060
|
clearPluginCommandCache();
|
|
@@ -268942,13 +269074,13 @@ function clearAllCaches() {
|
|
|
268942
269074
|
}
|
|
268943
269075
|
async function markPluginVersionOrphaned(versionPath) {
|
|
268944
269076
|
try {
|
|
268945
|
-
await
|
|
269077
|
+
await writeFile16(getOrphanedAtPath(versionPath), `${Date.now()}`, "utf-8");
|
|
268946
269078
|
} catch (error40) {
|
|
268947
269079
|
logForDebugging(`Failed to write .orphaned_at: ${versionPath}: ${error40}`);
|
|
268948
269080
|
}
|
|
268949
269081
|
}
|
|
268950
269082
|
function getOrphanedAtPath(versionPath) {
|
|
268951
|
-
return
|
|
269083
|
+
return join72(versionPath, ORPHANED_AT_FILENAME2);
|
|
268952
269084
|
}
|
|
268953
269085
|
var ORPHANED_AT_FILENAME2 = ".orphaned_at", CLEANUP_AGE_MS;
|
|
268954
269086
|
var init_cacheUtils = __esm(() => {
|
|
@@ -269294,8 +269426,8 @@ var init_officialMarketplace = __esm(() => {
|
|
|
269294
269426
|
});
|
|
269295
269427
|
|
|
269296
269428
|
// src/utils/plugins/officialMarketplaceGcs.ts
|
|
269297
|
-
import { chmod as chmod6, mkdir as mkdir18, readFile as readFile19, rename as rename3, rm as rm5, writeFile as
|
|
269298
|
-
import { dirname as dirname38, join as
|
|
269429
|
+
import { chmod as chmod6, mkdir as mkdir18, readFile as readFile19, rename as rename3, rm as rm5, writeFile as writeFile17 } from "fs/promises";
|
|
269430
|
+
import { dirname as dirname38, join as join73, resolve as resolve32, sep as sep21 } from "path";
|
|
269299
269431
|
async function fetchOfficialMarketplaceFromGcs(installLocation, marketplacesCacheDir) {
|
|
269300
269432
|
const cacheDir = resolve32(marketplacesCacheDir);
|
|
269301
269433
|
const resolvedLoc = resolve32(installLocation);
|
|
@@ -269318,7 +269450,7 @@ async function fetchOfficialMarketplaceFromGcs(installLocation, marketplacesCach
|
|
|
269318
269450
|
if (!sha) {
|
|
269319
269451
|
throw new Error("latest pointer returned empty body");
|
|
269320
269452
|
}
|
|
269321
|
-
const sentinelPath =
|
|
269453
|
+
const sentinelPath = join73(installLocation, ".gcs-sha");
|
|
269322
269454
|
const currentSha = await readFile19(sentinelPath, "utf8").then((s) => s.trim(), () => null);
|
|
269323
269455
|
if (currentSha === sha) {
|
|
269324
269456
|
outcome = "noop";
|
|
@@ -269341,15 +269473,15 @@ async function fetchOfficialMarketplaceFromGcs(installLocation, marketplacesCach
|
|
|
269341
269473
|
const rel = arcPath.slice(ARC_PREFIX.length);
|
|
269342
269474
|
if (!rel || rel.endsWith("/"))
|
|
269343
269475
|
continue;
|
|
269344
|
-
const dest =
|
|
269476
|
+
const dest = join73(staging, rel);
|
|
269345
269477
|
await mkdir18(dirname38(dest), { recursive: true });
|
|
269346
|
-
await
|
|
269478
|
+
await writeFile17(dest, data);
|
|
269347
269479
|
const mode = modes[arcPath];
|
|
269348
269480
|
if (mode && mode & 73) {
|
|
269349
269481
|
await chmod6(dest, mode & 511).catch(() => {});
|
|
269350
269482
|
}
|
|
269351
269483
|
}
|
|
269352
|
-
await
|
|
269484
|
+
await writeFile17(join73(staging, ".gcs-sha"), sha);
|
|
269353
269485
|
await rm5(installLocation, { recursive: true, force: true });
|
|
269354
269486
|
await rename3(staging, installLocation);
|
|
269355
269487
|
outcome = "updated";
|
|
@@ -269414,8 +269546,8 @@ var init_officialMarketplaceGcs = __esm(() => {
|
|
|
269414
269546
|
});
|
|
269415
269547
|
|
|
269416
269548
|
// src/utils/plugins/marketplaceManager.ts
|
|
269417
|
-
import { writeFile as
|
|
269418
|
-
import { basename as basename23, dirname as dirname39, isAbsolute as isAbsolute25, join as
|
|
269549
|
+
import { writeFile as writeFile18 } from "fs/promises";
|
|
269550
|
+
import { basename as basename23, dirname as dirname39, isAbsolute as isAbsolute25, join as join74, resolve as resolve33, sep as sep22 } from "path";
|
|
269419
269551
|
function flipLastAlphaCase(p) {
|
|
269420
269552
|
for (let i3 = p.length - 1;i3 >= 0; i3--) {
|
|
269421
269553
|
const c6 = p[i3];
|
|
@@ -269453,10 +269585,10 @@ function pathsEqualForFs(a2, b, probeDir) {
|
|
|
269453
269585
|
return isCaseInsensitiveFsAt(probeDir) ? a2.toLowerCase() === b.toLowerCase() : a2 === b;
|
|
269454
269586
|
}
|
|
269455
269587
|
function getKnownMarketplacesFile() {
|
|
269456
|
-
return
|
|
269588
|
+
return join74(getPluginsDirectory(), "known_marketplaces.json");
|
|
269457
269589
|
}
|
|
269458
269590
|
function getMarketplacesCacheDir() {
|
|
269459
|
-
return
|
|
269591
|
+
return join74(getPluginsDirectory(), "marketplaces");
|
|
269460
269592
|
}
|
|
269461
269593
|
function clearMarketplacesCache() {
|
|
269462
269594
|
getMarketplace.cache?.clear?.();
|
|
@@ -269525,7 +269657,7 @@ async function saveKnownMarketplacesConfig(config2) {
|
|
|
269525
269657
|
throw new ConfigParseError(`Invalid marketplace config: ${parsed.error.message}`, configFile, config2);
|
|
269526
269658
|
}
|
|
269527
269659
|
const fs2 = getFsImplementation();
|
|
269528
|
-
const dir =
|
|
269660
|
+
const dir = join74(configFile, "..");
|
|
269529
269661
|
await fs2.mkdir(dir);
|
|
269530
269662
|
writeFileSync_DEPRECATED(configFile, jsonStringify(parsed.data, null, 2), {
|
|
269531
269663
|
encoding: "utf-8",
|
|
@@ -269576,7 +269708,7 @@ async function gitPull(cwd2, ref, options2) {
|
|
|
269576
269708
|
async function gitSubmoduleUpdate(cwd2, credentialArgs, env4, sparsePaths) {
|
|
269577
269709
|
if (sparsePaths && sparsePaths.length > 0)
|
|
269578
269710
|
return;
|
|
269579
|
-
const hasGitmodules = await getFsImplementation().stat(
|
|
269711
|
+
const hasGitmodules = await getFsImplementation().stat(join74(cwd2, ".gitmodules")).then(() => true, () => false);
|
|
269580
269712
|
if (!hasGitmodules)
|
|
269581
269713
|
return;
|
|
269582
269714
|
const result = await execFileNoThrowWithCwd(gitExe(), [
|
|
@@ -269942,7 +270074,7 @@ Technical details: ${error40.message}`);
|
|
|
269942
270074
|
}
|
|
269943
270075
|
logPluginFetch("marketplace_url", url3, "success", performance.now() - fetchStarted);
|
|
269944
270076
|
safeCallProgress(onProgress, "Saving marketplace to cache");
|
|
269945
|
-
const cacheDir =
|
|
270077
|
+
const cacheDir = join74(cachePath, "..");
|
|
269946
270078
|
await fs2.mkdir(cacheDir);
|
|
269947
270079
|
writeFileSync_DEPRECATED(cachePath, jsonStringify(result.data, null, 2), {
|
|
269948
270080
|
encoding: "utf-8",
|
|
@@ -269979,7 +270111,7 @@ async function loadAndCacheMarketplace(source, onProgress) {
|
|
|
269979
270111
|
try {
|
|
269980
270112
|
switch (source.source) {
|
|
269981
270113
|
case "url": {
|
|
269982
|
-
temporaryCachePath =
|
|
270114
|
+
temporaryCachePath = join74(cacheDir, `${tempName}.json`);
|
|
269983
270115
|
cleanupNeeded = true;
|
|
269984
270116
|
await cacheMarketplaceFromUrl(source.url, temporaryCachePath, source.headers, onProgress);
|
|
269985
270117
|
marketplacePath = temporaryCachePath;
|
|
@@ -269988,7 +270120,7 @@ async function loadAndCacheMarketplace(source, onProgress) {
|
|
|
269988
270120
|
case "github": {
|
|
269989
270121
|
const sshUrl = `git@github.com:${source.repo}.git`;
|
|
269990
270122
|
const httpsUrl = `https://github.com/${source.repo}.git`;
|
|
269991
|
-
temporaryCachePath =
|
|
270123
|
+
temporaryCachePath = join74(cacheDir, tempName);
|
|
269992
270124
|
cleanupNeeded = true;
|
|
269993
270125
|
let lastError = null;
|
|
269994
270126
|
const sshConfigured = await isGitHubSshLikelyConfigured();
|
|
@@ -270033,14 +270165,14 @@ async function loadAndCacheMarketplace(source, onProgress) {
|
|
|
270033
270165
|
if (lastError) {
|
|
270034
270166
|
throw lastError;
|
|
270035
270167
|
}
|
|
270036
|
-
marketplacePath =
|
|
270168
|
+
marketplacePath = join74(temporaryCachePath, source.path || ".claude-plugin/marketplace.json");
|
|
270037
270169
|
break;
|
|
270038
270170
|
}
|
|
270039
270171
|
case "git": {
|
|
270040
|
-
temporaryCachePath =
|
|
270172
|
+
temporaryCachePath = join74(cacheDir, tempName);
|
|
270041
270173
|
cleanupNeeded = true;
|
|
270042
270174
|
await cacheMarketplaceFromGit(source.url, temporaryCachePath, source.ref, source.sparsePaths, onProgress);
|
|
270043
|
-
marketplacePath =
|
|
270175
|
+
marketplacePath = join74(temporaryCachePath, source.path || ".claude-plugin/marketplace.json");
|
|
270044
270176
|
break;
|
|
270045
270177
|
}
|
|
270046
270178
|
case "npm": {
|
|
@@ -270055,17 +270187,17 @@ async function loadAndCacheMarketplace(source, onProgress) {
|
|
|
270055
270187
|
}
|
|
270056
270188
|
case "directory": {
|
|
270057
270189
|
const absPath = resolve33(source.path);
|
|
270058
|
-
marketplacePath =
|
|
270190
|
+
marketplacePath = join74(absPath, ".claude-plugin", "marketplace.json");
|
|
270059
270191
|
temporaryCachePath = absPath;
|
|
270060
270192
|
cleanupNeeded = false;
|
|
270061
270193
|
break;
|
|
270062
270194
|
}
|
|
270063
270195
|
case "settings": {
|
|
270064
|
-
temporaryCachePath =
|
|
270065
|
-
marketplacePath =
|
|
270196
|
+
temporaryCachePath = join74(cacheDir, source.name);
|
|
270197
|
+
marketplacePath = join74(temporaryCachePath, ".claude-plugin", "marketplace.json");
|
|
270066
270198
|
cleanupNeeded = false;
|
|
270067
270199
|
await fs2.mkdir(dirname39(marketplacePath));
|
|
270068
|
-
await
|
|
270200
|
+
await writeFile18(marketplacePath, jsonStringify({
|
|
270069
270201
|
name: source.name,
|
|
270070
270202
|
owner: source.owner ?? { name: "settings" },
|
|
270071
270203
|
plugins: source.plugins
|
|
@@ -270085,7 +270217,7 @@ async function loadAndCacheMarketplace(source, onProgress) {
|
|
|
270085
270217
|
}
|
|
270086
270218
|
throw new Error(`Failed to parse marketplace file at ${marketplacePath}: ${errorMessage(e)}`);
|
|
270087
270219
|
}
|
|
270088
|
-
const finalCachePath =
|
|
270220
|
+
const finalCachePath = join74(cacheDir, marketplace.name.toLowerCase());
|
|
270089
270221
|
const resolvedFinal = resolve33(finalCachePath);
|
|
270090
270222
|
const resolvedCacheDir = resolve33(cacheDir);
|
|
270091
270223
|
if (!resolvedFinal.startsWith(resolvedCacheDir + sep22)) {
|
|
@@ -270210,9 +270342,9 @@ async function removeMarketplaceSource(name) {
|
|
|
270210
270342
|
await saveKnownMarketplacesConfig(config2);
|
|
270211
270343
|
const fs2 = getFsImplementation();
|
|
270212
270344
|
const cacheDir = getMarketplacesCacheDir();
|
|
270213
|
-
const cachePath = entry.installLocation ??
|
|
270345
|
+
const cachePath = entry.installLocation ?? join74(cacheDir, name.toLowerCase());
|
|
270214
270346
|
await fs2.rm(cachePath, { recursive: true, force: true });
|
|
270215
|
-
const jsonCachePath =
|
|
270347
|
+
const jsonCachePath = join74(cacheDir, `${name}.json`);
|
|
270216
270348
|
await fs2.rm(jsonCachePath, { force: true });
|
|
270217
270349
|
const editableSources = ["userSettings", "projectSettings", "localSettings"];
|
|
270218
270350
|
for (const source of editableSources) {
|
|
@@ -270265,7 +270397,7 @@ async function removeMarketplaceSource(name) {
|
|
|
270265
270397
|
logForDebugging(`Removed marketplace source: ${name}`);
|
|
270266
270398
|
}
|
|
270267
270399
|
async function readCachedMarketplace(installLocation) {
|
|
270268
|
-
const nestedPath =
|
|
270400
|
+
const nestedPath = join74(installLocation, ".claude-plugin", "marketplace.json");
|
|
270269
270401
|
try {
|
|
270270
270402
|
return await parseFileWithSchema(nestedPath, PluginMarketplaceSchema());
|
|
270271
270403
|
} catch (e) {
|
|
@@ -270529,9 +270661,9 @@ var init_marketplaceManager = __esm(() => {
|
|
|
270529
270661
|
});
|
|
270530
270662
|
|
|
270531
270663
|
// src/utils/plugins/installedPluginsManager.ts
|
|
270532
|
-
import { dirname as dirname40, join as
|
|
270664
|
+
import { dirname as dirname40, join as join75 } from "path";
|
|
270533
270665
|
function getInstalledPluginsFilePath() {
|
|
270534
|
-
return
|
|
270666
|
+
return join75(getPluginsDirectory(), "installed_plugins.json");
|
|
270535
270667
|
}
|
|
270536
270668
|
function readInstalledPluginsFileRaw() {
|
|
270537
270669
|
const fs2 = getFsImplementation();
|
|
@@ -270877,7 +271009,7 @@ var init_pluginVersioning = __esm(() => {
|
|
|
270877
271009
|
// src/utils/plugins/pluginInstallationHelpers.ts
|
|
270878
271010
|
import { randomBytes as randomBytes13 } from "crypto";
|
|
270879
271011
|
import { rename as rename4, rm as rm6 } from "fs/promises";
|
|
270880
|
-
import { dirname as dirname41, join as
|
|
271012
|
+
import { dirname as dirname41, join as join76, resolve as resolve34, sep as sep23 } from "path";
|
|
270881
271013
|
function getCurrentTimestamp() {
|
|
270882
271014
|
return new Date().toISOString();
|
|
270883
271015
|
}
|
|
@@ -270906,7 +271038,7 @@ async function cacheAndRegisterPlugin(pluginId, entry, scope = "user", projectPa
|
|
|
270906
271038
|
const normalizedCachePath = cacheResult.path.endsWith(sep23) ? cacheResult.path : cacheResult.path + sep23;
|
|
270907
271039
|
const isSubdirectory = versionedPath.startsWith(normalizedCachePath);
|
|
270908
271040
|
if (isSubdirectory) {
|
|
270909
|
-
const tempPath =
|
|
271041
|
+
const tempPath = join76(dirname41(cacheResult.path), `.claude-plugin-temp-${Date.now()}-${randomBytes13(4).toString("hex")}`);
|
|
270910
271042
|
await rename4(cacheResult.path, tempPath);
|
|
270911
271043
|
await getFsImplementation().mkdir(dirname41(versionedPath));
|
|
270912
271044
|
await rename4(tempPath, versionedPath);
|
|
@@ -271136,16 +271268,16 @@ import {
|
|
|
271136
271268
|
stat as stat29,
|
|
271137
271269
|
symlink as symlink2
|
|
271138
271270
|
} from "fs/promises";
|
|
271139
|
-
import { basename as basename24, dirname as dirname42, isAbsolute as isAbsolute26, join as
|
|
271271
|
+
import { basename as basename24, dirname as dirname42, isAbsolute as isAbsolute26, join as join77, relative as relative18, resolve as resolve35, sep as sep24 } from "path";
|
|
271140
271272
|
function getPluginCachePath() {
|
|
271141
|
-
return
|
|
271273
|
+
return join77(getPluginsDirectory(), "cache");
|
|
271142
271274
|
}
|
|
271143
271275
|
function getVersionedCachePathIn(baseDir, pluginId, version2) {
|
|
271144
271276
|
const { name: pluginName, marketplace } = parsePluginIdentifier(pluginId);
|
|
271145
271277
|
const sanitizedMarketplace = (marketplace || "unknown").replace(/[^a-zA-Z0-9\-_]/g, "-");
|
|
271146
271278
|
const sanitizedPlugin = (pluginName || pluginId).replace(/[^a-zA-Z0-9\-_]/g, "-");
|
|
271147
271279
|
const sanitizedVersion = version2.replace(/[^a-zA-Z0-9\-_.]/g, "-");
|
|
271148
|
-
return
|
|
271280
|
+
return join77(baseDir, "cache", sanitizedMarketplace, sanitizedPlugin, sanitizedVersion);
|
|
271149
271281
|
}
|
|
271150
271282
|
function getVersionedCachePath(pluginId, version2) {
|
|
271151
271283
|
return getVersionedCachePathIn(getPluginsDirectory(), pluginId, version2);
|
|
@@ -271171,7 +271303,7 @@ async function probeSeedCacheAnyVersion(pluginId) {
|
|
|
271171
271303
|
const versions2 = await readdir13(pluginDir);
|
|
271172
271304
|
if (versions2.length !== 1)
|
|
271173
271305
|
continue;
|
|
271174
|
-
const versionDir =
|
|
271306
|
+
const versionDir = join77(pluginDir, versions2[0]);
|
|
271175
271307
|
const entries = await readdir13(versionDir);
|
|
271176
271308
|
if (entries.length > 0)
|
|
271177
271309
|
return versionDir;
|
|
@@ -271183,8 +271315,8 @@ async function copyDir(src, dest) {
|
|
|
271183
271315
|
await getFsImplementation().mkdir(dest);
|
|
271184
271316
|
const entries = await readdir13(src, { withFileTypes: true });
|
|
271185
271317
|
for (const entry of entries) {
|
|
271186
|
-
const srcPath =
|
|
271187
|
-
const destPath =
|
|
271318
|
+
const srcPath = join77(src, entry.name);
|
|
271319
|
+
const destPath = join77(dest, entry.name);
|
|
271188
271320
|
if (entry.isDirectory()) {
|
|
271189
271321
|
await copyDir(srcPath, destPath);
|
|
271190
271322
|
} else if (entry.isFile()) {
|
|
@@ -271207,7 +271339,7 @@ async function copyDir(src, dest) {
|
|
|
271207
271339
|
const srcPrefix = resolvedSrc.endsWith(sep24) ? resolvedSrc : resolvedSrc + sep24;
|
|
271208
271340
|
if (resolvedTarget.startsWith(srcPrefix) || resolvedTarget === resolvedSrc) {
|
|
271209
271341
|
const targetRelativeToSrc = relative18(resolvedSrc, resolvedTarget);
|
|
271210
|
-
const destTargetPath =
|
|
271342
|
+
const destTargetPath = join77(dest, targetRelativeToSrc);
|
|
271211
271343
|
const relativeLinkPath = relative18(dirname42(destPath), destTargetPath);
|
|
271212
271344
|
await symlink2(relativeLinkPath, destPath);
|
|
271213
271345
|
} else {
|
|
@@ -271255,7 +271387,7 @@ async function copyPluginToVersionedCache(sourcePath, pluginId, version2, entry,
|
|
|
271255
271387
|
logForDebugging(`Copying plugin ${pluginId} to versioned cache (fallback to full copy)`);
|
|
271256
271388
|
await copyDir(sourcePath, cachePath);
|
|
271257
271389
|
}
|
|
271258
|
-
const gitPath =
|
|
271390
|
+
const gitPath = join77(cachePath, ".git");
|
|
271259
271391
|
await rm7(gitPath, { recursive: true, force: true });
|
|
271260
271392
|
const cacheEntries = await readdir13(cachePath);
|
|
271261
271393
|
if (cacheEntries.length === 0) {
|
|
@@ -271286,10 +271418,10 @@ function validateGitUrl(url3) {
|
|
|
271286
271418
|
}
|
|
271287
271419
|
}
|
|
271288
271420
|
async function installFromNpm(packageName, targetPath, options2 = {}) {
|
|
271289
|
-
const npmCachePath =
|
|
271421
|
+
const npmCachePath = join77(getPluginsDirectory(), "npm-cache");
|
|
271290
271422
|
await getFsImplementation().mkdir(npmCachePath);
|
|
271291
271423
|
const packageSpec = options2.version ? `${packageName}@${options2.version}` : packageName;
|
|
271292
|
-
const packagePath =
|
|
271424
|
+
const packagePath = join77(npmCachePath, "node_modules", packageName);
|
|
271293
271425
|
const needsInstall = !await pathExists(packagePath);
|
|
271294
271426
|
if (needsInstall) {
|
|
271295
271427
|
logForDebugging(`Installing npm package ${packageSpec} to cache`);
|
|
@@ -271448,7 +271580,7 @@ async function installFromLocal(sourcePath, targetPath) {
|
|
|
271448
271580
|
throw new Error(`Source path does not exist: ${sourcePath}`);
|
|
271449
271581
|
}
|
|
271450
271582
|
await copyDir(sourcePath, targetPath);
|
|
271451
|
-
const gitPath =
|
|
271583
|
+
const gitPath = join77(targetPath, ".git");
|
|
271452
271584
|
await rm7(gitPath, { recursive: true, force: true });
|
|
271453
271585
|
}
|
|
271454
271586
|
function generateTemporaryCacheNameForPlugin(source) {
|
|
@@ -271484,7 +271616,7 @@ async function cachePlugin(source, options2) {
|
|
|
271484
271616
|
const cachePath = getPluginCachePath();
|
|
271485
271617
|
await getFsImplementation().mkdir(cachePath);
|
|
271486
271618
|
const tempName = generateTemporaryCacheNameForPlugin(source);
|
|
271487
|
-
const tempPath =
|
|
271619
|
+
const tempPath = join77(cachePath, tempName);
|
|
271488
271620
|
let shouldCleanup = false;
|
|
271489
271621
|
let gitCommitSha;
|
|
271490
271622
|
try {
|
|
@@ -271528,8 +271660,8 @@ async function cachePlugin(source, options2) {
|
|
|
271528
271660
|
}
|
|
271529
271661
|
throw error40;
|
|
271530
271662
|
}
|
|
271531
|
-
const manifestPath =
|
|
271532
|
-
const legacyManifestPath =
|
|
271663
|
+
const manifestPath = join77(tempPath, ".claude-plugin", "plugin.json");
|
|
271664
|
+
const legacyManifestPath = join77(tempPath, "plugin.json");
|
|
271533
271665
|
let manifest;
|
|
271534
271666
|
if (await pathExists(manifestPath)) {
|
|
271535
271667
|
try {
|
|
@@ -271586,7 +271718,7 @@ async function cachePlugin(source, options2) {
|
|
|
271586
271718
|
};
|
|
271587
271719
|
}
|
|
271588
271720
|
const finalName = manifest.name.replace(/[^a-zA-Z0-9-_]/g, "-");
|
|
271589
|
-
const finalPath =
|
|
271721
|
+
const finalPath = join77(cachePath, finalName);
|
|
271590
271722
|
if (await pathExists(finalPath)) {
|
|
271591
271723
|
logForDebugging(`Removing old cached version at ${finalPath}`);
|
|
271592
271724
|
await rm7(finalPath, { recursive: true, force: true });
|
|
@@ -271712,7 +271844,7 @@ function isPathInside(rootPath, targetPath) {
|
|
|
271712
271844
|
}
|
|
271713
271845
|
async function createPluginFromPath(pluginPath, source, enabled, fallbackName, strict = true) {
|
|
271714
271846
|
const errors3 = [];
|
|
271715
|
-
const manifestPath =
|
|
271847
|
+
const manifestPath = join77(pluginPath, ".claude-plugin", "plugin.json");
|
|
271716
271848
|
const manifest = await loadPluginManifest(manifestPath, fallbackName, source);
|
|
271717
271849
|
const plugin = {
|
|
271718
271850
|
name: manifest.name,
|
|
@@ -271889,8 +272021,8 @@ async function createPluginFromPath(pluginPath, source, enabled, fallbackName, s
|
|
|
271889
272021
|
}
|
|
271890
272022
|
let mergedHooks;
|
|
271891
272023
|
const loadedHookPaths = new Set;
|
|
271892
|
-
const standardHooksPath =
|
|
271893
|
-
const standardHooks = await resolveExistingPluginComponentPath(pluginPath,
|
|
272024
|
+
const standardHooksPath = join77(pluginPath, "hooks", "hooks.json");
|
|
272025
|
+
const standardHooks = await resolveExistingPluginComponentPath(pluginPath, join77("hooks", "hooks.json"));
|
|
271894
272026
|
if (standardHooks.outOfBounds) {
|
|
271895
272027
|
logForDebugging(`Hooks path hooks/hooks.json resolves outside plugin directory ${pluginPath} for ${manifest.name}`, { level: "warn" });
|
|
271896
272028
|
errors3.push({
|
|
@@ -271928,7 +272060,7 @@ async function createPluginFromPath(pluginPath, source, enabled, fallbackName, s
|
|
|
271928
272060
|
for (const hookSpec of manifestHooksArray) {
|
|
271929
272061
|
if (typeof hookSpec === "string") {
|
|
271930
272062
|
const resolvedHookFile = await resolveExistingPluginComponentPath(pluginPath, hookSpec);
|
|
271931
|
-
const hookFilePath = resolvedHookFile.fullPath ??
|
|
272063
|
+
const hookFilePath = resolvedHookFile.fullPath ?? join77(pluginPath, hookSpec);
|
|
271932
272064
|
if (resolvedHookFile.outOfBounds) {
|
|
271933
272065
|
logForDebugging(`Hooks file ${hookSpec} specified in manifest resolves outside plugin directory ${pluginPath} for ${manifest.name}`, { level: "warn" });
|
|
271934
272066
|
errors3.push({
|
|
@@ -272028,7 +272160,7 @@ function parsePluginSettings(raw) {
|
|
|
272028
272160
|
return data;
|
|
272029
272161
|
}
|
|
272030
272162
|
async function loadPluginSettings(pluginPath, manifest) {
|
|
272031
|
-
const settingsJsonPath =
|
|
272163
|
+
const settingsJsonPath = join77(pluginPath, "settings.json");
|
|
272032
272164
|
try {
|
|
272033
272165
|
const content = await readFile20(settingsJsonPath, { encoding: "utf-8" });
|
|
272034
272166
|
const parsed = jsonParse(content);
|
|
@@ -272171,7 +272303,7 @@ async function loadPluginFromMarketplaceEntryCacheOnly(entry, marketplaceInstall
|
|
|
272171
272303
|
if (typeof entry.source === "string") {
|
|
272172
272304
|
let marketplaceDir;
|
|
272173
272305
|
try {
|
|
272174
|
-
marketplaceDir = (await stat29(marketplaceInstallLocation)).isDirectory() ? marketplaceInstallLocation :
|
|
272306
|
+
marketplaceDir = (await stat29(marketplaceInstallLocation)).isDirectory() ? marketplaceInstallLocation : join77(marketplaceInstallLocation, "..");
|
|
272175
272307
|
} catch {
|
|
272176
272308
|
errorsOut.push({
|
|
272177
272309
|
type: "plugin-cache-miss",
|
|
@@ -272181,7 +272313,7 @@ async function loadPluginFromMarketplaceEntryCacheOnly(entry, marketplaceInstall
|
|
|
272181
272313
|
});
|
|
272182
272314
|
return null;
|
|
272183
272315
|
}
|
|
272184
|
-
pluginPath =
|
|
272316
|
+
pluginPath = join77(marketplaceDir, entry.source);
|
|
272185
272317
|
} else {
|
|
272186
272318
|
if (!installPath || !await pathExists(installPath)) {
|
|
272187
272319
|
errorsOut.push({
|
|
@@ -272196,7 +272328,7 @@ async function loadPluginFromMarketplaceEntryCacheOnly(entry, marketplaceInstall
|
|
|
272196
272328
|
}
|
|
272197
272329
|
if (isPluginZipCacheEnabled() && pluginPath.endsWith(".zip")) {
|
|
272198
272330
|
const sessionDir = await getSessionPluginCachePath();
|
|
272199
|
-
const extractDir =
|
|
272331
|
+
const extractDir = join77(sessionDir, pluginId.replace(/[^a-zA-Z0-9@\-_]/g, "-"));
|
|
272200
272332
|
try {
|
|
272201
272333
|
await extractZipToDirectory(pluginPath, extractDir);
|
|
272202
272334
|
pluginPath = extractDir;
|
|
@@ -272219,8 +272351,8 @@ async function loadPluginFromMarketplaceEntry(entry, marketplaceInstallLocation,
|
|
|
272219
272351
|
logForDebugging(`Loading plugin ${entry.name} from source: ${jsonStringify(entry.source)}`);
|
|
272220
272352
|
let pluginPath;
|
|
272221
272353
|
if (typeof entry.source === "string") {
|
|
272222
|
-
const marketplaceDir = (await stat29(marketplaceInstallLocation)).isDirectory() ? marketplaceInstallLocation :
|
|
272223
|
-
const sourcePluginPath =
|
|
272354
|
+
const marketplaceDir = (await stat29(marketplaceInstallLocation)).isDirectory() ? marketplaceInstallLocation : join77(marketplaceInstallLocation, "..");
|
|
272355
|
+
const sourcePluginPath = join77(marketplaceDir, entry.source);
|
|
272224
272356
|
if (!await pathExists(sourcePluginPath)) {
|
|
272225
272357
|
const error40 = new Error(`Plugin path not found: ${sourcePluginPath}`);
|
|
272226
272358
|
logForDebugging(`Plugin path not found: ${sourcePluginPath}`, {
|
|
@@ -272235,7 +272367,7 @@ async function loadPluginFromMarketplaceEntry(entry, marketplaceInstallLocation,
|
|
|
272235
272367
|
return null;
|
|
272236
272368
|
}
|
|
272237
272369
|
try {
|
|
272238
|
-
const manifestPath =
|
|
272370
|
+
const manifestPath = join77(sourcePluginPath, ".claude-plugin", "plugin.json");
|
|
272239
272371
|
let pluginManifest;
|
|
272240
272372
|
try {
|
|
272241
272373
|
pluginManifest = await loadPluginManifest(manifestPath, entry.name, entry.source);
|
|
@@ -272291,7 +272423,7 @@ async function loadPluginFromMarketplaceEntry(entry, marketplaceInstallLocation,
|
|
|
272291
272423
|
}
|
|
272292
272424
|
if (isPluginZipCacheEnabled() && pluginPath.endsWith(".zip")) {
|
|
272293
272425
|
const sessionDir = await getSessionPluginCachePath();
|
|
272294
|
-
const extractDir =
|
|
272426
|
+
const extractDir = join77(sessionDir, pluginId.replace(/[^a-zA-Z0-9@\-_]/g, "-"));
|
|
272295
272427
|
try {
|
|
272296
272428
|
await extractZipToDirectory(pluginPath, extractDir);
|
|
272297
272429
|
logForDebugging(`Extracted plugin ZIP to session dir: ${extractDir}`);
|
|
@@ -272306,7 +272438,7 @@ async function loadPluginFromMarketplaceEntry(entry, marketplaceInstallLocation,
|
|
|
272306
272438
|
}
|
|
272307
272439
|
async function finishLoadingPluginFromPath(entry, pluginId, enabled, errorsOut, pluginPath) {
|
|
272308
272440
|
const errors3 = [];
|
|
272309
|
-
const manifestPath =
|
|
272441
|
+
const manifestPath = join77(pluginPath, ".claude-plugin", "plugin.json");
|
|
272310
272442
|
const hasManifest = await pathExists(manifestPath);
|
|
272311
272443
|
const { plugin, errors: pluginErrors } = await createPluginFromPath(pluginPath, pluginId, enabled, entry.name, entry.strict ?? true);
|
|
272312
272444
|
errors3.push(...pluginErrors);
|
|
@@ -274191,13 +274323,13 @@ import {
|
|
|
274191
274323
|
statSync as statSync5,
|
|
274192
274324
|
writeFileSync as writeFileSync4
|
|
274193
274325
|
} from "fs";
|
|
274194
|
-
import { join as
|
|
274326
|
+
import { join as join78 } from "path";
|
|
274195
274327
|
function getCacheDir() {
|
|
274196
|
-
return
|
|
274328
|
+
return join78(getClaudeConfigHomeDir(), "repomap-cache");
|
|
274197
274329
|
}
|
|
274198
274330
|
function getCacheFilePath(root2) {
|
|
274199
274331
|
const hash = createHash16("sha256").update(root2).digest("hex");
|
|
274200
|
-
return
|
|
274332
|
+
return join78(getCacheDir(), `${hash}.json`);
|
|
274201
274333
|
}
|
|
274202
274334
|
function emptyCache() {
|
|
274203
274335
|
return { version: CACHE_VERSION, entries: {}, renderedEntries: {} };
|
|
@@ -274270,7 +274402,7 @@ function computeMapHash(files, maxTokens, focusFiles, focusSymbols, root2, fileS
|
|
|
274270
274402
|
}
|
|
274271
274403
|
function statFile(root2, filePath) {
|
|
274272
274404
|
try {
|
|
274273
|
-
const stat30 = statSync5(
|
|
274405
|
+
const stat30 = statSync5(join78(root2, filePath));
|
|
274274
274406
|
return { mtimeMs: stat30.mtimeMs, size: stat30.size };
|
|
274275
274407
|
} catch {
|
|
274276
274408
|
return null;
|
|
@@ -274331,7 +274463,7 @@ var init_cache = __esm(() => {
|
|
|
274331
274463
|
// src/context/repoMap/gitFiles.ts
|
|
274332
274464
|
import { execFile as execFile3 } from "child_process";
|
|
274333
274465
|
import { readdirSync as readdirSync3 } from "fs";
|
|
274334
|
-
import { join as
|
|
274466
|
+
import { join as join79, relative as relative19 } from "path";
|
|
274335
274467
|
function getLanguageForFile(filePath) {
|
|
274336
274468
|
const dotIndex = filePath.lastIndexOf(".");
|
|
274337
274469
|
if (dotIndex === -1) {
|
|
@@ -274377,11 +274509,11 @@ function walkDirectory(root2, currentDir = root2) {
|
|
|
274377
274509
|
const name = entry.name;
|
|
274378
274510
|
if (entry.isDirectory()) {
|
|
274379
274511
|
if (!EXCLUDED_DIRS.has(name) && !name.startsWith(".")) {
|
|
274380
|
-
results.push(...walkDirectory(root2,
|
|
274512
|
+
results.push(...walkDirectory(root2, join79(currentDir, name)));
|
|
274381
274513
|
}
|
|
274382
274514
|
} else if (entry.isFile()) {
|
|
274383
274515
|
if (!EXCLUDED_FILES.has(name)) {
|
|
274384
|
-
results.push(normalizeRepoPath(relative19(root2,
|
|
274516
|
+
results.push(normalizeRepoPath(relative19(root2, join79(currentDir, name))));
|
|
274385
274517
|
}
|
|
274386
274518
|
}
|
|
274387
274519
|
}
|
|
@@ -278587,7 +278719,7 @@ var init_queries = __esm(() => {
|
|
|
278587
278719
|
});
|
|
278588
278720
|
|
|
278589
278721
|
// src/context/repoMap/parser.ts
|
|
278590
|
-
import { join as
|
|
278722
|
+
import { join as join80, posix as posix7, resolve as resolve36, win32 as win323 } from "path";
|
|
278591
278723
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
278592
278724
|
import { createRequire as createRequire3 } from "module";
|
|
278593
278725
|
function resolveProjectRoot(filePath) {
|
|
@@ -278599,18 +278731,18 @@ function resolveProjectRoot(filePath) {
|
|
|
278599
278731
|
function getTreeSitterWasmPath() {
|
|
278600
278732
|
try {
|
|
278601
278733
|
const webTsDir = resolve36(require3.resolve("web-tree-sitter/package.json"), "..");
|
|
278602
|
-
return
|
|
278734
|
+
return join80(webTsDir, "tree-sitter.wasm");
|
|
278603
278735
|
} catch {
|
|
278604
|
-
return
|
|
278736
|
+
return join80(__projectRoot, "node_modules", "web-tree-sitter", "tree-sitter.wasm");
|
|
278605
278737
|
}
|
|
278606
278738
|
}
|
|
278607
278739
|
function getLanguageWasmPath(language) {
|
|
278608
278740
|
const wasmName = language === "typescript" ? "tree-sitter-typescript" : language === "tsx" ? "tree-sitter-tsx" : language === "javascript" ? "tree-sitter-javascript" : `tree-sitter-${language}`;
|
|
278609
278741
|
try {
|
|
278610
278742
|
const wasmDir = resolve36(require3.resolve("tree-sitter-wasms/package.json"), "..", "out");
|
|
278611
|
-
return
|
|
278743
|
+
return join80(wasmDir, `${wasmName}.wasm`);
|
|
278612
278744
|
} catch {
|
|
278613
|
-
return
|
|
278745
|
+
return join80(__projectRoot, "node_modules", "tree-sitter-wasms", "out", `${wasmName}.wasm`);
|
|
278614
278746
|
}
|
|
278615
278747
|
}
|
|
278616
278748
|
async function initParser() {
|
|
@@ -278690,7 +278822,7 @@ var init_parser5 = __esm(() => {
|
|
|
278690
278822
|
|
|
278691
278823
|
// src/context/repoMap/symbolExtractor.ts
|
|
278692
278824
|
import { readFileSync as readFileSync12 } from "fs";
|
|
278693
|
-
import { join as
|
|
278825
|
+
import { join as join81 } from "path";
|
|
278694
278826
|
async function getQuery(language) {
|
|
278695
278827
|
const cached3 = queryCache2.get(language);
|
|
278696
278828
|
if (cached3)
|
|
@@ -278723,7 +278855,7 @@ async function extractTags(filePath, root2) {
|
|
|
278723
278855
|
const language = getLanguageForFile(filePath);
|
|
278724
278856
|
if (!language)
|
|
278725
278857
|
return null;
|
|
278726
|
-
const absolutePath =
|
|
278858
|
+
const absolutePath = join81(root2, filePath);
|
|
278727
278859
|
let source;
|
|
278728
278860
|
try {
|
|
278729
278861
|
source = readFileSync12(absolutePath, "utf-8");
|
|
@@ -279736,9 +279868,9 @@ var init_postCompactCleanup = __esm(() => {
|
|
|
279736
279868
|
|
|
279737
279869
|
// src/services/SessionMemory/prompts.ts
|
|
279738
279870
|
import { readFile as readFile21 } from "fs/promises";
|
|
279739
|
-
import { join as
|
|
279871
|
+
import { join as join82 } from "path";
|
|
279740
279872
|
async function loadSessionMemoryTemplate() {
|
|
279741
|
-
const templatePath =
|
|
279873
|
+
const templatePath = join82(getClaudeConfigHomeDir(), "session-memory", "config", "template.md");
|
|
279742
279874
|
try {
|
|
279743
279875
|
return await readFile21(templatePath, { encoding: "utf-8" });
|
|
279744
279876
|
} catch (e) {
|
|
@@ -282222,7 +282354,7 @@ var init_memoryTypes = __esm(() => {
|
|
|
282222
282354
|
|
|
282223
282355
|
// src/memdir/memoryScan.ts
|
|
282224
282356
|
import { readdir as readdir14 } from "fs/promises";
|
|
282225
|
-
import { join as
|
|
282357
|
+
import { join as join83 } from "path";
|
|
282226
282358
|
async function scanMemoryFiles(memoryDir, signal) {
|
|
282227
282359
|
return scanMemoryFilesWithDependencies(memoryDir, signal, defaultDependencies2);
|
|
282228
282360
|
}
|
|
@@ -282279,8 +282411,8 @@ async function* walkMarkdownFiles(memoryDir, signal, deps) {
|
|
|
282279
282411
|
}
|
|
282280
282412
|
for (const entry of entries) {
|
|
282281
282413
|
signal.throwIfAborted();
|
|
282282
|
-
const relativePath = current.relativePath ?
|
|
282283
|
-
const absolutePath =
|
|
282414
|
+
const relativePath = current.relativePath ? join83(current.relativePath, entry.name) : entry.name;
|
|
282415
|
+
const absolutePath = join83(memoryDir, relativePath);
|
|
282284
282416
|
const isMarkdownMemoryFile = entry.name.endsWith(".md") && entry.name !== "MEMORY.md";
|
|
282285
282417
|
if (entry.isSymbolicLink()) {
|
|
282286
282418
|
if (isMarkdownMemoryFile) {
|
|
@@ -282303,7 +282435,7 @@ async function* walkMarkdownFiles(memoryDir, signal, deps) {
|
|
|
282303
282435
|
}
|
|
282304
282436
|
async function readMemoryHeader(memoryDir, relativePath, signal, deps) {
|
|
282305
282437
|
signal.throwIfAborted();
|
|
282306
|
-
const filePath =
|
|
282438
|
+
const filePath = join83(memoryDir, relativePath);
|
|
282307
282439
|
const { content, mtimeMs } = await deps.readFileInRange(filePath, 0, FRONTMATTER_MAX_LINES, FRONTMATTER_MAX_BYTES, signal, { truncateOnByteLimit: true });
|
|
282308
282440
|
const { frontmatter } = parseFrontmatter(content, filePath);
|
|
282309
282441
|
const description = typeof frontmatter.description === "string" && frontmatter.description ? frontmatter.description : null;
|
|
@@ -282848,7 +282980,7 @@ var init_consolidationPrompt = __esm(() => {
|
|
|
282848
282980
|
|
|
282849
282981
|
// src/utils/listSessionsImpl.ts
|
|
282850
282982
|
import { readdir as readdir15, stat as stat30 } from "fs/promises";
|
|
282851
|
-
import { basename as basename26, join as
|
|
282983
|
+
import { basename as basename26, join as join84 } from "path";
|
|
282852
282984
|
function parseSessionInfoFromLite(sessionId, lite, projectPath) {
|
|
282853
282985
|
const { head, tail, mtime, size } = lite;
|
|
282854
282986
|
const firstNewline = head.indexOf(`
|
|
@@ -282900,7 +283032,7 @@ async function listCandidates(projectDir, doStat, projectPath) {
|
|
|
282900
283032
|
const sessionId = validateUuid(name.slice(0, -6));
|
|
282901
283033
|
if (!sessionId)
|
|
282902
283034
|
return null;
|
|
282903
|
-
const filePath =
|
|
283035
|
+
const filePath = join84(projectDir, name);
|
|
282904
283036
|
if (!doStat)
|
|
282905
283037
|
return { sessionId, filePath, mtime: 0, projectPath };
|
|
282906
283038
|
try {
|
|
@@ -283025,7 +283157,7 @@ async function gatherProjectCandidates(dir, includeWorktrees, doStat) {
|
|
|
283025
283157
|
const isMatch = dirName === prefix || prefix.length >= MAX_SANITIZED_LENGTH && dirName.startsWith(prefix + "-");
|
|
283026
283158
|
if (isMatch) {
|
|
283027
283159
|
seenDirs.add(dirName);
|
|
283028
|
-
all4.push(...await listCandidates(
|
|
283160
|
+
all4.push(...await listCandidates(join84(projectsDir, dirent.name), doStat, wtPath));
|
|
283029
283161
|
break;
|
|
283030
283162
|
}
|
|
283031
283163
|
}
|
|
@@ -283040,7 +283172,7 @@ async function gatherAllCandidates(doStat) {
|
|
|
283040
283172
|
} catch {
|
|
283041
283173
|
return [];
|
|
283042
283174
|
}
|
|
283043
|
-
const perProject = await Promise.all(dirents.filter((d) => d.isDirectory()).map((d) => listCandidates(
|
|
283175
|
+
const perProject = await Promise.all(dirents.filter((d) => d.isDirectory()).map((d) => listCandidates(join84(projectsDir, d.name), doStat)));
|
|
283044
283176
|
return perProject.flat();
|
|
283045
283177
|
}
|
|
283046
283178
|
async function listSessionsImpl(options2) {
|
|
@@ -283060,10 +283192,10 @@ var init_listSessionsImpl = __esm(() => {
|
|
|
283060
283192
|
});
|
|
283061
283193
|
|
|
283062
283194
|
// src/services/autoDream/consolidationLock.ts
|
|
283063
|
-
import { mkdir as mkdir19, readFile as readFile23, stat as stat31, unlink as unlink12, utimes, writeFile as
|
|
283064
|
-
import { join as
|
|
283195
|
+
import { mkdir as mkdir19, readFile as readFile23, stat as stat31, unlink as unlink12, utimes, writeFile as writeFile19 } from "fs/promises";
|
|
283196
|
+
import { join as join85 } from "path";
|
|
283065
283197
|
function lockPath() {
|
|
283066
|
-
return
|
|
283198
|
+
return join85(getAutoMemPath(), LOCK_FILE);
|
|
283067
283199
|
}
|
|
283068
283200
|
async function readLastConsolidatedAt() {
|
|
283069
283201
|
try {
|
|
@@ -283080,7 +283212,7 @@ async function rollbackConsolidationLock(priorMtime) {
|
|
|
283080
283212
|
await unlink12(path13);
|
|
283081
283213
|
return;
|
|
283082
283214
|
}
|
|
283083
|
-
await
|
|
283215
|
+
await writeFile19(path13, "");
|
|
283084
283216
|
const t = priorMtime / 1000;
|
|
283085
283217
|
await utimes(path13, t, t);
|
|
283086
283218
|
} catch (e) {
|
|
@@ -283095,7 +283227,7 @@ async function listSessionsTouchedSince(sinceMs) {
|
|
|
283095
283227
|
async function recordConsolidation() {
|
|
283096
283228
|
try {
|
|
283097
283229
|
await mkdir19(getAutoMemPath(), { recursive: true });
|
|
283098
|
-
await
|
|
283230
|
+
await writeFile19(lockPath(), String(process.pid));
|
|
283099
283231
|
} catch (e) {
|
|
283100
283232
|
logForDebugging(`[autoDream] recordConsolidation write failed: ${e.message}`);
|
|
283101
283233
|
}
|
|
@@ -286151,7 +286283,7 @@ function getAnthropicEnvMetadata() {
|
|
|
286151
286283
|
function getBuildAgeMinutes() {
|
|
286152
286284
|
if (false)
|
|
286153
286285
|
;
|
|
286154
|
-
const buildTime = new Date("2026-09-
|
|
286286
|
+
const buildTime = new Date("2026-09-05T03:58:56.896Z").getTime();
|
|
286155
286287
|
if (isNaN(buildTime))
|
|
286156
286288
|
return;
|
|
286157
286289
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -287971,7 +288103,7 @@ var init_notifications = __esm(() => {
|
|
|
287971
288103
|
|
|
287972
288104
|
// src/utils/imagePaste.ts
|
|
287973
288105
|
import { randomBytes as randomBytes14 } from "crypto";
|
|
287974
|
-
import { basename as basename27, extname as extname10, isAbsolute as isAbsolute27, join as
|
|
288106
|
+
import { basename as basename27, extname as extname10, isAbsolute as isAbsolute27, join as join86 } from "path";
|
|
287975
288107
|
function escapePowerShellSingleQuotedString(value) {
|
|
287976
288108
|
return value.replace(/'/g, "''");
|
|
287977
288109
|
}
|
|
@@ -287990,9 +288122,9 @@ function getClipboardCommands() {
|
|
|
287990
288122
|
const baseTmpDir = process.env.CLAUDE_CODE_TMPDIR || (platform3 === "win32" ? process.env.TEMP || "C:\\Temp" : "/tmp");
|
|
287991
288123
|
const screenshotFilename = "claude_cli_latest_screenshot.png";
|
|
287992
288124
|
const tempPaths = {
|
|
287993
|
-
darwin:
|
|
287994
|
-
linux:
|
|
287995
|
-
win32:
|
|
288125
|
+
darwin: join86(baseTmpDir, screenshotFilename),
|
|
288126
|
+
linux: join86(baseTmpDir, screenshotFilename),
|
|
288127
|
+
win32: join86(baseTmpDir, screenshotFilename)
|
|
287996
288128
|
};
|
|
287997
288129
|
const screenshotPath = tempPaths[platform3] || tempPaths.linux;
|
|
287998
288130
|
const commands = {
|
|
@@ -288298,7 +288430,7 @@ var init_projectOnboardingState = __esm(() => {
|
|
|
288298
288430
|
// src/utils/appleTerminalBackup.ts
|
|
288299
288431
|
import { stat as stat32 } from "fs/promises";
|
|
288300
288432
|
import { homedir as homedir22 } from "os";
|
|
288301
|
-
import { join as
|
|
288433
|
+
import { join as join87 } from "path";
|
|
288302
288434
|
function markTerminalSetupInProgress(backupPath) {
|
|
288303
288435
|
saveGlobalConfig((current) => ({
|
|
288304
288436
|
...current,
|
|
@@ -288320,7 +288452,7 @@ function getTerminalRecoveryInfo() {
|
|
|
288320
288452
|
};
|
|
288321
288453
|
}
|
|
288322
288454
|
function getTerminalPlistPath() {
|
|
288323
|
-
return
|
|
288455
|
+
return join87(homedir22(), "Library", "Preferences", "com.apple.Terminal.plist");
|
|
288324
288456
|
}
|
|
288325
288457
|
async function backupTerminalPreferences() {
|
|
288326
288458
|
const terminalPlistPath = getTerminalPlistPath();
|
|
@@ -288402,9 +288534,9 @@ __export(exports_terminalSetup, {
|
|
|
288402
288534
|
call: () => call
|
|
288403
288535
|
});
|
|
288404
288536
|
import { randomBytes as randomBytes15 } from "crypto";
|
|
288405
|
-
import { copyFile as copyFile7, mkdir as mkdir20, readFile as readFile24, writeFile as
|
|
288537
|
+
import { copyFile as copyFile7, mkdir as mkdir20, readFile as readFile24, writeFile as writeFile20 } from "fs/promises";
|
|
288406
288538
|
import { homedir as homedir23, platform as platform3 } from "os";
|
|
288407
|
-
import { dirname as dirname43, join as
|
|
288539
|
+
import { dirname as dirname43, join as join88 } from "path";
|
|
288408
288540
|
import { pathToFileURL as pathToFileURL4 } from "url";
|
|
288409
288541
|
function isVSCodeRemoteSSH() {
|
|
288410
288542
|
const askpassMain = process.env.VSCODE_GIT_ASKPASS_MAIN ?? "";
|
|
@@ -288538,8 +288670,8 @@ async function installBindingsForVSCodeTerminal(editor = "VSCode", theme) {
|
|
|
288538
288670
|
]`)}${EOL4}`;
|
|
288539
288671
|
}
|
|
288540
288672
|
const editorDir = editor === "VSCode" ? "Code" : editor;
|
|
288541
|
-
const userDirPath =
|
|
288542
|
-
const keybindingsPath =
|
|
288673
|
+
const userDirPath = join88(homedir23(), platform3() === "win32" ? join88("AppData", "Roaming", editorDir, "User") : platform3() === "darwin" ? join88("Library", "Application Support", editorDir, "User") : join88(".config", editorDir, "User"));
|
|
288674
|
+
const keybindingsPath = join88(userDirPath, "keybindings.json");
|
|
288543
288675
|
try {
|
|
288544
288676
|
await mkdir20(userDirPath, {
|
|
288545
288677
|
recursive: true
|
|
@@ -288579,7 +288711,7 @@ async function installBindingsForVSCodeTerminal(editor = "VSCode", theme) {
|
|
|
288579
288711
|
when: "terminalFocus"
|
|
288580
288712
|
};
|
|
288581
288713
|
const updatedContent = addItemToJSONCArray(content, newKeybinding);
|
|
288582
|
-
await
|
|
288714
|
+
await writeFile20(keybindingsPath, updatedContent, {
|
|
288583
288715
|
encoding: "utf-8"
|
|
288584
288716
|
});
|
|
288585
288717
|
return `${color("success", theme)(`Installed ${editor} terminal Shift+Enter key binding`)}${EOL4}${source_default.dim(`See ${formatPathLink(keybindingsPath)}`)}${EOL4}`;
|
|
@@ -288680,14 +288812,14 @@ chars = "\\u001B\\r"`;
|
|
|
288680
288812
|
const configPaths = [];
|
|
288681
288813
|
const xdgConfigHome = process.env.XDG_CONFIG_HOME;
|
|
288682
288814
|
if (xdgConfigHome) {
|
|
288683
|
-
configPaths.push(
|
|
288815
|
+
configPaths.push(join88(xdgConfigHome, "alacritty", "alacritty.toml"));
|
|
288684
288816
|
} else {
|
|
288685
|
-
configPaths.push(
|
|
288817
|
+
configPaths.push(join88(homedir23(), ".config", "alacritty", "alacritty.toml"));
|
|
288686
288818
|
}
|
|
288687
288819
|
if (platform3() === "win32") {
|
|
288688
288820
|
const appData = process.env.APPDATA;
|
|
288689
288821
|
if (appData) {
|
|
288690
|
-
configPaths.push(
|
|
288822
|
+
configPaths.push(join88(appData, "alacritty", "alacritty.toml"));
|
|
288691
288823
|
}
|
|
288692
288824
|
}
|
|
288693
288825
|
let configPath = null;
|
|
@@ -288738,7 +288870,7 @@ chars = "\\u001B\\r"`;
|
|
|
288738
288870
|
updatedContent += `
|
|
288739
288871
|
` + ALACRITTY_KEYBINDING + `
|
|
288740
288872
|
`;
|
|
288741
|
-
await
|
|
288873
|
+
await writeFile20(configPath, updatedContent, {
|
|
288742
288874
|
encoding: "utf-8"
|
|
288743
288875
|
});
|
|
288744
288876
|
return `${color("success", theme)("Installed Alacritty Shift+Enter key binding")}${EOL4}${color("success", theme)("You may need to restart Alacritty for changes to take effect")}${EOL4}${source_default.dim(`See ${formatPathLink(configPath)}`)}${EOL4}`;
|
|
@@ -288748,8 +288880,8 @@ chars = "\\u001B\\r"`;
|
|
|
288748
288880
|
}
|
|
288749
288881
|
}
|
|
288750
288882
|
async function installBindingsForZed(theme) {
|
|
288751
|
-
const zedDir =
|
|
288752
|
-
const keymapPath =
|
|
288883
|
+
const zedDir = join88(homedir23(), ".config", "zed");
|
|
288884
|
+
const keymapPath = join88(zedDir, "keymap.json");
|
|
288753
288885
|
try {
|
|
288754
288886
|
await mkdir20(zedDir, {
|
|
288755
288887
|
recursive: true
|
|
@@ -288792,7 +288924,7 @@ async function installBindingsForZed(theme) {
|
|
|
288792
288924
|
"shift-enter": ["terminal::SendText", "\x1B\r"]
|
|
288793
288925
|
}
|
|
288794
288926
|
});
|
|
288795
|
-
await
|
|
288927
|
+
await writeFile20(keymapPath, jsonStringify(keymap, null, 2) + `
|
|
288796
288928
|
`, {
|
|
288797
288929
|
encoding: "utf-8"
|
|
288798
288930
|
});
|
|
@@ -288829,23 +288961,23 @@ var init_terminalSetup = __esm(() => {
|
|
|
288829
288961
|
|
|
288830
288962
|
// src/utils/pasteStore.ts
|
|
288831
288963
|
import { createHash as createHash18 } from "crypto";
|
|
288832
|
-
import { mkdir as mkdir21, readdir as readdir16, readFile as readFile25, stat as stat33, unlink as unlink13, writeFile as
|
|
288833
|
-
import { join as
|
|
288964
|
+
import { mkdir as mkdir21, readdir as readdir16, readFile as readFile25, stat as stat33, unlink as unlink13, writeFile as writeFile21 } from "fs/promises";
|
|
288965
|
+
import { join as join89 } from "path";
|
|
288834
288966
|
function getPasteStoreDir() {
|
|
288835
|
-
return
|
|
288967
|
+
return join89(getClaudeConfigHomeDir(), PASTE_STORE_DIR);
|
|
288836
288968
|
}
|
|
288837
288969
|
function hashPastedText(content) {
|
|
288838
288970
|
return createHash18("sha256").update(content).digest("hex").slice(0, 16);
|
|
288839
288971
|
}
|
|
288840
288972
|
function getPastePath(hash) {
|
|
288841
|
-
return
|
|
288973
|
+
return join89(getPasteStoreDir(), `${hash}.txt`);
|
|
288842
288974
|
}
|
|
288843
288975
|
async function storePastedText(hash, content) {
|
|
288844
288976
|
try {
|
|
288845
288977
|
const dir = getPasteStoreDir();
|
|
288846
288978
|
await mkdir21(dir, { recursive: true });
|
|
288847
288979
|
const pastePath = getPastePath(hash);
|
|
288848
|
-
await
|
|
288980
|
+
await writeFile21(pastePath, content, { encoding: "utf8", mode: 384 });
|
|
288849
288981
|
logForDebugging(`Stored paste ${hash} to ${pastePath}`);
|
|
288850
288982
|
} catch (error40) {
|
|
288851
288983
|
logForDebugging(`Failed to store paste: ${error40}`);
|
|
@@ -288859,8 +288991,8 @@ var init_pasteStore = __esm(() => {
|
|
|
288859
288991
|
});
|
|
288860
288992
|
|
|
288861
288993
|
// src/history.ts
|
|
288862
|
-
import { appendFile as appendFile3, writeFile as
|
|
288863
|
-
import { join as
|
|
288994
|
+
import { appendFile as appendFile3, writeFile as writeFile22 } from "fs/promises";
|
|
288995
|
+
import { join as join90 } from "path";
|
|
288864
288996
|
function getPastedTextRefNumLines(text) {
|
|
288865
288997
|
return (text.match(/\r\n|\r|\n/g) || []).length;
|
|
288866
288998
|
}
|
|
@@ -288897,8 +289029,8 @@ async function immediateFlushHistory() {
|
|
|
288897
289029
|
}
|
|
288898
289030
|
let release;
|
|
288899
289031
|
try {
|
|
288900
|
-
const historyPath =
|
|
288901
|
-
await
|
|
289032
|
+
const historyPath = join90(getClaudeConfigHomeDir(), "history.jsonl");
|
|
289033
|
+
await writeFile22(historyPath, "", {
|
|
288902
289034
|
encoding: "utf8",
|
|
288903
289035
|
mode: 384,
|
|
288904
289036
|
flag: "a"
|
|
@@ -291492,7 +291624,7 @@ var init_TextInput = __esm(() => {
|
|
|
291492
291624
|
});
|
|
291493
291625
|
|
|
291494
291626
|
// src/utils/suggestions/directoryCompletion.ts
|
|
291495
|
-
import { basename as basename29, dirname as dirname44, join as
|
|
291627
|
+
import { basename as basename29, dirname as dirname44, join as join91, sep as sep25 } from "path";
|
|
291496
291628
|
function parsePartialPath(partialPath, basePath) {
|
|
291497
291629
|
if (!partialPath) {
|
|
291498
291630
|
const directory2 = basePath || getCwd();
|
|
@@ -291516,7 +291648,7 @@ async function scanDirectory(dirPath) {
|
|
|
291516
291648
|
const entries = await fs2.readdir(dirPath);
|
|
291517
291649
|
const directories = entries.filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => ({
|
|
291518
291650
|
name: entry.name,
|
|
291519
|
-
path:
|
|
291651
|
+
path: join91(dirPath, entry.name),
|
|
291520
291652
|
type: "directory"
|
|
291521
291653
|
})).slice(0, 100);
|
|
291522
291654
|
directoryCache.set(dirPath, directories);
|
|
@@ -291597,9 +291729,9 @@ var init_ConfigurableShortcutHint = __esm(() => {
|
|
|
291597
291729
|
|
|
291598
291730
|
// src/utils/imageStore.ts
|
|
291599
291731
|
import { mkdir as mkdir22, open as open10 } from "fs/promises";
|
|
291600
|
-
import { join as
|
|
291732
|
+
import { join as join92 } from "path";
|
|
291601
291733
|
function getImageStoreDir() {
|
|
291602
|
-
return
|
|
291734
|
+
return join92(getClaudeConfigHomeDir(), IMAGE_STORE_DIR, getSessionId());
|
|
291603
291735
|
}
|
|
291604
291736
|
async function ensureImageStoreDir() {
|
|
291605
291737
|
const dir = getImageStoreDir();
|
|
@@ -291607,7 +291739,7 @@ async function ensureImageStoreDir() {
|
|
|
291607
291739
|
}
|
|
291608
291740
|
function getImagePath(imageId, mediaType) {
|
|
291609
291741
|
const extension2 = mediaType.split("/")[1] || "png";
|
|
291610
|
-
return
|
|
291742
|
+
return join92(getImageStoreDir(), `${imageId}.${extension2}`);
|
|
291611
291743
|
}
|
|
291612
291744
|
async function storeImage(content) {
|
|
291613
291745
|
if (content.type !== "image") {
|
|
@@ -296624,7 +296756,7 @@ function Feedback({
|
|
|
296624
296756
|
platform: env2.platform,
|
|
296625
296757
|
gitRepo: envInfo.isGit,
|
|
296626
296758
|
terminal: env2.terminal,
|
|
296627
|
-
version: "0.30.
|
|
296759
|
+
version: "0.30.2-by-rayss",
|
|
296628
296760
|
transcript: normalizeMessagesForAPI(messages),
|
|
296629
296761
|
errors: sanitizedErrors,
|
|
296630
296762
|
lastApiRequest: getLastAPIRequest(),
|
|
@@ -296813,7 +296945,7 @@ function Feedback({
|
|
|
296813
296945
|
", ",
|
|
296814
296946
|
env2.terminal,
|
|
296815
296947
|
", v",
|
|
296816
|
-
"0.30.
|
|
296948
|
+
"0.30.2-by-rayss"
|
|
296817
296949
|
]
|
|
296818
296950
|
}, undefined, true, undefined, this)
|
|
296819
296951
|
]
|
|
@@ -296921,7 +297053,7 @@ ${sanitizedDescription}
|
|
|
296921
297053
|
` + `**Environment Info**
|
|
296922
297054
|
` + `- Platform: ${env2.platform}
|
|
296923
297055
|
` + `- Terminal: ${env2.terminal}
|
|
296924
|
-
` + `- Version: ${"0.30.
|
|
297056
|
+
` + `- Version: ${"0.30.2-by-rayss"}
|
|
296925
297057
|
` + feedbackIdLine + `
|
|
296926
297058
|
**Errors**
|
|
296927
297059
|
\`\`\`json
|
|
@@ -297612,7 +297744,7 @@ var init_shellProvider = __esm(() => {
|
|
|
297612
297744
|
});
|
|
297613
297745
|
|
|
297614
297746
|
// src/utils/hooks/hooksSettings.ts
|
|
297615
|
-
import { join as
|
|
297747
|
+
import { join as join93, resolve as resolve37 } from "path";
|
|
297616
297748
|
function isHookEqual(a2, b) {
|
|
297617
297749
|
if (a2.type !== b.type)
|
|
297618
297750
|
return false;
|
|
@@ -297708,7 +297840,7 @@ function hookSourceDescriptionDisplayString(source) {
|
|
|
297708
297840
|
const filePath = getSettingsFilePathForSource(settingsSource);
|
|
297709
297841
|
return filePath ? getDisplayPath(filePath) : "settings.json";
|
|
297710
297842
|
};
|
|
297711
|
-
const pluginHooksPath = getDisplayPath(
|
|
297843
|
+
const pluginHooksPath = getDisplayPath(join93(getClaudeConfigHomeDir(), "plugins", "*", "hooks", "hooks.json")).replace(/\\/g, "/");
|
|
297712
297844
|
switch (source) {
|
|
297713
297845
|
case "userSettings":
|
|
297714
297846
|
return `User settings (${settingsPath("userSettings")})`;
|
|
@@ -298142,8 +298274,8 @@ __export(exports_permissions_anthropic, {
|
|
|
298142
298274
|
var permissions_anthropic_default = "";
|
|
298143
298275
|
|
|
298144
298276
|
// src/utils/permissions/yoloClassifier.ts
|
|
298145
|
-
import { mkdir as mkdir23, writeFile as
|
|
298146
|
-
import { dirname as dirname45, join as
|
|
298277
|
+
import { mkdir as mkdir23, writeFile as writeFile23 } from "fs/promises";
|
|
298278
|
+
import { dirname as dirname45, join as join94 } from "path";
|
|
298147
298279
|
function txtRequire(mod) {
|
|
298148
298280
|
return typeof mod === "string" ? mod : mod.default;
|
|
298149
298281
|
}
|
|
@@ -298154,7 +298286,7 @@ function isUsingExternalPermissions() {
|
|
|
298154
298286
|
return config2?.forceExternalPermissions === true;
|
|
298155
298287
|
}
|
|
298156
298288
|
function getAutoModeDumpDir() {
|
|
298157
|
-
return
|
|
298289
|
+
return join94(getClaudeTempDir(), "auto-mode");
|
|
298158
298290
|
}
|
|
298159
298291
|
async function maybeDumpAutoMode(request, response, timestamp, suffix) {
|
|
298160
298292
|
if (process.env.USER_TYPE !== "ant")
|
|
@@ -298164,13 +298296,13 @@ async function maybeDumpAutoMode(request, response, timestamp, suffix) {
|
|
|
298164
298296
|
const base2 = suffix ? `${timestamp}.${suffix}` : `${timestamp}`;
|
|
298165
298297
|
try {
|
|
298166
298298
|
await mkdir23(getAutoModeDumpDir(), { recursive: true });
|
|
298167
|
-
await
|
|
298168
|
-
await
|
|
298299
|
+
await writeFile23(join94(getAutoModeDumpDir(), `${base2}.req.json`), jsonStringify(request, null, 2), "utf-8");
|
|
298300
|
+
await writeFile23(join94(getAutoModeDumpDir(), `${base2}.res.json`), jsonStringify(response, null, 2), "utf-8");
|
|
298169
298301
|
logForDebugging(`Dumped auto mode req/res to ${getAutoModeDumpDir()}/${base2}.{req,res}.json`);
|
|
298170
298302
|
} catch {}
|
|
298171
298303
|
}
|
|
298172
298304
|
function getAutoModeClassifierErrorDumpPath() {
|
|
298173
|
-
return
|
|
298305
|
+
return join94(getClaudeTempDir(), "auto-mode-classifier-errors", `${getSessionId()}.txt`);
|
|
298174
298306
|
}
|
|
298175
298307
|
async function dumpErrorPrompts(systemPrompt, userPrompt, error40, contextInfo) {
|
|
298176
298308
|
try {
|
|
@@ -298198,7 +298330,7 @@ ${systemPrompt}
|
|
|
298198
298330
|
` + `=== USER PROMPT (transcript) ===
|
|
298199
298331
|
${userPrompt}
|
|
298200
298332
|
`;
|
|
298201
|
-
await
|
|
298333
|
+
await writeFile23(path13, content, "utf-8");
|
|
298202
298334
|
logForDebugging(`Dumped auto mode classifier error prompts to ${path13}`);
|
|
298203
298335
|
return path13;
|
|
298204
298336
|
} catch {
|
|
@@ -300662,8 +300794,8 @@ var init_types7 = __esm(() => {
|
|
|
300662
300794
|
// src/services/policyLimits/index.ts
|
|
300663
300795
|
import { createHash as createHash19 } from "crypto";
|
|
300664
300796
|
import { readFileSync as fsReadFileSync } from "fs";
|
|
300665
|
-
import { unlink as unlink14, writeFile as
|
|
300666
|
-
import { join as
|
|
300797
|
+
import { unlink as unlink14, writeFile as writeFile24 } from "fs/promises";
|
|
300798
|
+
import { join as join95 } from "path";
|
|
300667
300799
|
function isNodeError(e) {
|
|
300668
300800
|
return e instanceof Error;
|
|
300669
300801
|
}
|
|
@@ -300685,7 +300817,7 @@ function initializePolicyLimitsLoadingPromise() {
|
|
|
300685
300817
|
}
|
|
300686
300818
|
}
|
|
300687
300819
|
function getCachePath() {
|
|
300688
|
-
return
|
|
300820
|
+
return join95(getClaudeConfigHomeDir(), CACHE_FILENAME);
|
|
300689
300821
|
}
|
|
300690
300822
|
function getPolicyLimitsEndpoint() {
|
|
300691
300823
|
return `${getOauthConfig().BASE_API_URL}/api/claude_code/policy_limits`;
|
|
@@ -300870,7 +301002,7 @@ async function saveCachedRestrictions(restrictions) {
|
|
|
300870
301002
|
try {
|
|
300871
301003
|
const path13 = getCachePath();
|
|
300872
301004
|
const data = { restrictions };
|
|
300873
|
-
await
|
|
301005
|
+
await writeFile24(path13, jsonStringify(data, null, 2), {
|
|
300874
301006
|
encoding: "utf-8",
|
|
300875
301007
|
mode: 384
|
|
300876
301008
|
});
|
|
@@ -302763,7 +302895,7 @@ var init_user = __esm(() => {
|
|
|
302763
302895
|
deviceId,
|
|
302764
302896
|
sessionId: getSessionId(),
|
|
302765
302897
|
email: getEmail(),
|
|
302766
|
-
appVersion: "0.30.
|
|
302898
|
+
appVersion: "0.30.2-by-rayss",
|
|
302767
302899
|
platform: getHostPlatformForAnalytics(),
|
|
302768
302900
|
organizationUuid,
|
|
302769
302901
|
accountUuid,
|
|
@@ -303219,19 +303351,19 @@ async function installGlobalPackage() {
|
|
|
303219
303351
|
}
|
|
303220
303352
|
|
|
303221
303353
|
// src/utils/localInstaller.ts
|
|
303222
|
-
import { access as access3, chmod as chmod7, writeFile as
|
|
303223
|
-
import { join as
|
|
303354
|
+
import { access as access3, chmod as chmod7, writeFile as writeFile25 } from "fs/promises";
|
|
303355
|
+
import { join as join96 } from "path";
|
|
303224
303356
|
function getLocalInstallDir() {
|
|
303225
|
-
return
|
|
303357
|
+
return join96(getClaudeConfigHomeDir(), "local");
|
|
303226
303358
|
}
|
|
303227
303359
|
function getCandidateLocalInstallDirs(options2) {
|
|
303228
303360
|
const configHomeDir = options2?.configHomeDir ?? getClaudeConfigHomeDir();
|
|
303229
|
-
return [
|
|
303361
|
+
return [join96(configHomeDir, "local")];
|
|
303230
303362
|
}
|
|
303231
303363
|
function getCandidateLocalBinaryPaths(localInstallDir) {
|
|
303232
303364
|
return [
|
|
303233
|
-
|
|
303234
|
-
|
|
303365
|
+
join96(localInstallDir, "node_modules", ".bin", "openclaude"),
|
|
303366
|
+
join96(localInstallDir, "node_modules", ".bin", "claude")
|
|
303235
303367
|
];
|
|
303236
303368
|
}
|
|
303237
303369
|
function isManagedLocalInstallationPath(execPath2) {
|
|
@@ -303239,14 +303371,14 @@ function isManagedLocalInstallationPath(execPath2) {
|
|
|
303239
303371
|
return normalizedExecPath.includes("/.openclaude/local/node_modules/");
|
|
303240
303372
|
}
|
|
303241
303373
|
function getLocalClaudePath() {
|
|
303242
|
-
return
|
|
303374
|
+
return join96(getLocalInstallDir(), "openclaude");
|
|
303243
303375
|
}
|
|
303244
303376
|
function isRunningFromLocalInstallation() {
|
|
303245
303377
|
return isManagedLocalInstallationPath(process.argv[1] || "");
|
|
303246
303378
|
}
|
|
303247
303379
|
async function writeIfMissing(path13, content, mode) {
|
|
303248
303380
|
try {
|
|
303249
|
-
await
|
|
303381
|
+
await writeFile25(path13, content, { encoding: "utf8", flag: "wx", mode });
|
|
303250
303382
|
return true;
|
|
303251
303383
|
} catch (e) {
|
|
303252
303384
|
if (getErrnoCode(e) === "EEXIST")
|
|
@@ -303258,7 +303390,7 @@ async function ensureLocalPackageEnvironment() {
|
|
|
303258
303390
|
try {
|
|
303259
303391
|
const localInstallDir = getLocalInstallDir();
|
|
303260
303392
|
await getFsImplementation().mkdir(localInstallDir);
|
|
303261
|
-
await writeIfMissing(
|
|
303393
|
+
await writeIfMissing(join96(localInstallDir, "package.json"), jsonStringify({ name: "openclaude-local", version: "0.0.1", private: true }, null, 2));
|
|
303262
303394
|
const wrapperPath = getLocalClaudePath();
|
|
303263
303395
|
const created = await writeIfMissing(wrapperPath, `#!/bin/sh
|
|
303264
303396
|
exec "${localInstallDir}/node_modules/.bin/openclaude" "$@"`, 493);
|
|
@@ -303522,15 +303654,15 @@ function hasNativeDistribution() {
|
|
|
303522
303654
|
// src/utils/shellConfig.ts
|
|
303523
303655
|
import { open as open12, readFile as readFile28, stat as stat35 } from "fs/promises";
|
|
303524
303656
|
import { homedir as osHomedir } from "os";
|
|
303525
|
-
import { join as
|
|
303657
|
+
import { join as join97 } from "path";
|
|
303526
303658
|
function getShellConfigPaths(options2) {
|
|
303527
303659
|
const home = options2?.homedir ?? osHomedir();
|
|
303528
303660
|
const env4 = options2?.env ?? process.env;
|
|
303529
303661
|
const zshConfigDir = env4.ZDOTDIR || home;
|
|
303530
303662
|
return {
|
|
303531
|
-
zsh:
|
|
303532
|
-
bash:
|
|
303533
|
-
fish:
|
|
303663
|
+
zsh: join97(zshConfigDir, ".zshrc"),
|
|
303664
|
+
bash: join97(home, ".bashrc"),
|
|
303665
|
+
fish: join97(home, ".config/fish/config.fish")
|
|
303534
303666
|
};
|
|
303535
303667
|
}
|
|
303536
303668
|
async function readFileLines(filePath) {
|
|
@@ -303585,7 +303717,7 @@ var init_shellConfig = __esm(() => {
|
|
|
303585
303717
|
// src/utils/doctorDiagnostic.ts
|
|
303586
303718
|
import { readFile as readFile29, realpath as realpath10 } from "fs/promises";
|
|
303587
303719
|
import { homedir as homedir24 } from "os";
|
|
303588
|
-
import { delimiter as delimiter2, join as
|
|
303720
|
+
import { delimiter as delimiter2, join as join98, posix as posix8, win32 as win324 } from "path";
|
|
303589
303721
|
function getCliBinaryName() {
|
|
303590
303722
|
return "openclaude";
|
|
303591
303723
|
}
|
|
@@ -303679,7 +303811,7 @@ async function getInstallationPath() {
|
|
|
303679
303811
|
}
|
|
303680
303812
|
} catch {}
|
|
303681
303813
|
try {
|
|
303682
|
-
const nativeBinaryPath =
|
|
303814
|
+
const nativeBinaryPath = join98(homedir24(), ".local", "bin", getCliBinaryName());
|
|
303683
303815
|
await getFsImplementation().stat(nativeBinaryPath);
|
|
303684
303816
|
return nativeBinaryPath;
|
|
303685
303817
|
} catch {}
|
|
@@ -303718,7 +303850,7 @@ async function detectMultipleInstallations() {
|
|
|
303718
303850
|
if (npmResult.code === 0 && npmResult.stdout) {
|
|
303719
303851
|
const npmPrefix = npmResult.stdout.trim();
|
|
303720
303852
|
const isWindows2 = getPlatform() === "windows";
|
|
303721
|
-
const globalBinPath = isWindows2 ?
|
|
303853
|
+
const globalBinPath = isWindows2 ? join98(npmPrefix, getCliBinaryName()) : join98(npmPrefix, "bin", getCliBinaryName());
|
|
303722
303854
|
let globalBinExists = false;
|
|
303723
303855
|
try {
|
|
303724
303856
|
await fs2.stat(globalBinPath);
|
|
@@ -303737,7 +303869,7 @@ async function detectMultipleInstallations() {
|
|
|
303737
303869
|
}
|
|
303738
303870
|
} else {
|
|
303739
303871
|
for (const packageName of packagesToCheck) {
|
|
303740
|
-
const globalPackagePath = isWindows2 ?
|
|
303872
|
+
const globalPackagePath = isWindows2 ? join98(npmPrefix, "node_modules", packageName) : join98(npmPrefix, "lib", "node_modules", packageName);
|
|
303741
303873
|
try {
|
|
303742
303874
|
await fs2.stat(globalPackagePath);
|
|
303743
303875
|
installations.push({
|
|
@@ -303748,14 +303880,14 @@ async function detectMultipleInstallations() {
|
|
|
303748
303880
|
}
|
|
303749
303881
|
}
|
|
303750
303882
|
}
|
|
303751
|
-
const nativeBinPath =
|
|
303883
|
+
const nativeBinPath = join98(homedir24(), ".local", "bin", getCliBinaryName());
|
|
303752
303884
|
try {
|
|
303753
303885
|
await fs2.stat(nativeBinPath);
|
|
303754
303886
|
installations.push({ type: "native", path: nativeBinPath });
|
|
303755
303887
|
} catch {}
|
|
303756
303888
|
const config2 = getGlobalConfig();
|
|
303757
303889
|
if (config2.installMethod === "native") {
|
|
303758
|
-
const nativeDataPath =
|
|
303890
|
+
const nativeDataPath = join98(homedir24(), ".local", "share", getNativeDataDirName());
|
|
303759
303891
|
try {
|
|
303760
303892
|
await fs2.stat(nativeDataPath);
|
|
303761
303893
|
if (!installations.some((i3) => i3.type === "native")) {
|
|
@@ -303775,7 +303907,7 @@ async function detectConfigurationIssues(type) {
|
|
|
303775
303907
|
warnings.push(staleProjectSettingsWarning);
|
|
303776
303908
|
}
|
|
303777
303909
|
try {
|
|
303778
|
-
const raw = await readFile29(
|
|
303910
|
+
const raw = await readFile29(join98(getManagedFilePath(), "managed-settings.json"), "utf-8");
|
|
303779
303911
|
const parsed = jsonParse(raw);
|
|
303780
303912
|
const field = parsed && typeof parsed === "object" ? parsed.strictPluginOnlyCustomization : undefined;
|
|
303781
303913
|
if (field !== undefined && typeof field !== "boolean") {
|
|
@@ -303803,7 +303935,7 @@ async function detectConfigurationIssues(type) {
|
|
|
303803
303935
|
const path13 = process.env.PATH || "";
|
|
303804
303936
|
const pathDirectories = path13.split(delimiter2);
|
|
303805
303937
|
const homeDir = homedir24();
|
|
303806
|
-
const localBinPath =
|
|
303938
|
+
const localBinPath = join98(homeDir, ".local", "bin");
|
|
303807
303939
|
let normalizedLocalBinPath = localBinPath;
|
|
303808
303940
|
if (getPlatform() === "windows") {
|
|
303809
303941
|
normalizedLocalBinPath = localBinPath.split(win324.sep).join(posix8.sep);
|
|
@@ -303897,7 +304029,7 @@ function detectLinuxGlobPatternWarnings() {
|
|
|
303897
304029
|
}
|
|
303898
304030
|
async function getDoctorDiagnostic() {
|
|
303899
304031
|
const installationType = await getCurrentInstallationType();
|
|
303900
|
-
const version2 = typeof MACRO !== "undefined" ? "0.30.
|
|
304032
|
+
const version2 = typeof MACRO !== "undefined" ? "0.30.2-by-rayss" : "unknown";
|
|
303901
304033
|
const installationPath = await getInstallationPath();
|
|
303902
304034
|
const invokedBinary = getInvokedBinary();
|
|
303903
304035
|
const multipleInstallations = await detectMultipleInstallations();
|
|
@@ -303986,7 +304118,7 @@ var init_doctorDiagnostic = __esm(() => {
|
|
|
303986
304118
|
|
|
303987
304119
|
// src/utils/xdg.ts
|
|
303988
304120
|
import { homedir as osHomedir2 } from "os";
|
|
303989
|
-
import { join as
|
|
304121
|
+
import { join as join99 } from "path";
|
|
303990
304122
|
function resolveOptions(options2) {
|
|
303991
304123
|
return {
|
|
303992
304124
|
env: options2?.env ?? process.env,
|
|
@@ -303995,26 +304127,26 @@ function resolveOptions(options2) {
|
|
|
303995
304127
|
}
|
|
303996
304128
|
function getXDGStateHome(options2) {
|
|
303997
304129
|
const { env: env4, home } = resolveOptions(options2);
|
|
303998
|
-
return env4.XDG_STATE_HOME ??
|
|
304130
|
+
return env4.XDG_STATE_HOME ?? join99(home, ".local", "state");
|
|
303999
304131
|
}
|
|
304000
304132
|
function getXDGCacheHome(options2) {
|
|
304001
304133
|
const { env: env4, home } = resolveOptions(options2);
|
|
304002
|
-
return env4.XDG_CACHE_HOME ??
|
|
304134
|
+
return env4.XDG_CACHE_HOME ?? join99(home, ".cache");
|
|
304003
304135
|
}
|
|
304004
304136
|
function getXDGDataHome(options2) {
|
|
304005
304137
|
const { env: env4, home } = resolveOptions(options2);
|
|
304006
|
-
return env4.XDG_DATA_HOME ??
|
|
304138
|
+
return env4.XDG_DATA_HOME ?? join99(home, ".local", "share");
|
|
304007
304139
|
}
|
|
304008
304140
|
function getUserBinDir(options2) {
|
|
304009
304141
|
const { home } = resolveOptions(options2);
|
|
304010
|
-
return
|
|
304142
|
+
return join99(home, ".local", "bin");
|
|
304011
304143
|
}
|
|
304012
304144
|
var init_xdg = () => {};
|
|
304013
304145
|
|
|
304014
304146
|
// src/utils/nativeInstaller/download.ts
|
|
304015
304147
|
import { createHash as createHash21 } from "crypto";
|
|
304016
|
-
import { chmod as chmod8, writeFile as
|
|
304017
|
-
import { join as
|
|
304148
|
+
import { chmod as chmod8, writeFile as writeFile26 } from "fs/promises";
|
|
304149
|
+
import { join as join100 } from "path";
|
|
304018
304150
|
async function getLatestVersionFromArtifactory(tag2 = "latest") {
|
|
304019
304151
|
if (!ARTIFACTORY_REGISTRY_URL) {
|
|
304020
304152
|
throw new Error("Internal artifactory registry URL is not configured");
|
|
@@ -304162,8 +304294,8 @@ async function downloadVersionFromArtifactory(version2, stagingPath) {
|
|
|
304162
304294
|
}
|
|
304163
304295
|
}
|
|
304164
304296
|
};
|
|
304165
|
-
writeFileSync_DEPRECATED(
|
|
304166
|
-
writeFileSync_DEPRECATED(
|
|
304297
|
+
writeFileSync_DEPRECATED(join100(stagingPath, "package.json"), jsonStringify(packageJson, null, 2), { encoding: "utf8", flush: true });
|
|
304298
|
+
writeFileSync_DEPRECATED(join100(stagingPath, "package-lock.json"), jsonStringify(packageLock, null, 2), { encoding: "utf8", flush: true });
|
|
304167
304299
|
const result = await execFileNoThrowWithCwd("npm", ["ci", "--prefer-online", "--registry", ARTIFACTORY_REGISTRY_URL], {
|
|
304168
304300
|
timeout: 60000,
|
|
304169
304301
|
preserveOutputOnError: true,
|
|
@@ -304210,7 +304342,7 @@ async function downloadAndVerifyBinary(binaryUrl, expectedChecksum, binaryPath,
|
|
|
304210
304342
|
if (actualChecksum !== expectedChecksum) {
|
|
304211
304343
|
throw new Error(`Checksum mismatch: expected ${expectedChecksum}, got ${actualChecksum}`);
|
|
304212
304344
|
}
|
|
304213
|
-
await
|
|
304345
|
+
await writeFile26(binaryPath, Buffer.from(response.data));
|
|
304214
304346
|
await chmod8(binaryPath, 493);
|
|
304215
304347
|
return;
|
|
304216
304348
|
} catch (error40) {
|
|
@@ -304269,7 +304401,7 @@ async function downloadVersionFromBinaryRepo(version2, stagingPath, baseUrl, aut
|
|
|
304269
304401
|
const binaryName = getBinaryName(platform4);
|
|
304270
304402
|
const binaryUrl = `${baseUrl}/${version2}/${platform4}/${binaryName}`;
|
|
304271
304403
|
await fs2.mkdir(stagingPath);
|
|
304272
|
-
const binaryPath =
|
|
304404
|
+
const binaryPath = join100(stagingPath, binaryName);
|
|
304273
304405
|
try {
|
|
304274
304406
|
await downloadAndVerifyBinary(binaryUrl, expectedChecksum, binaryPath, authConfig || {});
|
|
304275
304407
|
const latencyMs = Date.now() - startTime;
|
|
@@ -304322,7 +304454,7 @@ var init_download = __esm(() => {
|
|
|
304322
304454
|
});
|
|
304323
304455
|
|
|
304324
304456
|
// src/utils/nativeInstaller/pidLock.ts
|
|
304325
|
-
import { basename as basename30, join as
|
|
304457
|
+
import { basename as basename30, join as join101 } from "path";
|
|
304326
304458
|
function isPidBasedLockingEnabled() {
|
|
304327
304459
|
const envVar = process.env.ENABLE_PID_BASED_VERSION_LOCKING;
|
|
304328
304460
|
if (isEnvTruthy(envVar)) {
|
|
@@ -304475,7 +304607,7 @@ function getAllLockInfo(locksDir) {
|
|
|
304475
304607
|
try {
|
|
304476
304608
|
const lockFiles = fs2.readdirStringSync(locksDir).filter((f) => f.endsWith(".lock"));
|
|
304477
304609
|
for (const lockFile of lockFiles) {
|
|
304478
|
-
const lockFilePath =
|
|
304610
|
+
const lockFilePath = join101(locksDir, lockFile);
|
|
304479
304611
|
const content = readLockContent(lockFilePath);
|
|
304480
304612
|
if (content) {
|
|
304481
304613
|
lockInfos.push({
|
|
@@ -304502,7 +304634,7 @@ function cleanupStaleLocks(locksDir) {
|
|
|
304502
304634
|
try {
|
|
304503
304635
|
const lockEntries = fs2.readdirStringSync(locksDir).filter((f) => f.endsWith(".lock"));
|
|
304504
304636
|
for (const lockEntry of lockEntries) {
|
|
304505
|
-
const lockFilePath =
|
|
304637
|
+
const lockFilePath = join101(locksDir, lockEntry);
|
|
304506
304638
|
try {
|
|
304507
304639
|
const stats = fs2.lstatSync(lockFilePath);
|
|
304508
304640
|
if (stats.isDirectory()) {
|
|
@@ -304554,10 +304686,10 @@ import {
|
|
|
304554
304686
|
stat as stat36,
|
|
304555
304687
|
symlink as symlink3,
|
|
304556
304688
|
unlink as unlink16,
|
|
304557
|
-
writeFile as
|
|
304689
|
+
writeFile as writeFile27
|
|
304558
304690
|
} from "fs/promises";
|
|
304559
304691
|
import { homedir as homedir25 } from "os";
|
|
304560
|
-
import { basename as basename31, delimiter as delimiter3, dirname as dirname46, join as
|
|
304692
|
+
import { basename as basename31, delimiter as delimiter3, dirname as dirname46, join as join102, resolve as resolve38 } from "path";
|
|
304561
304693
|
function getPlatform2() {
|
|
304562
304694
|
const os4 = env2.platform;
|
|
304563
304695
|
const arch = process.arch === "x64" ? "x64" : process.arch === "arm64" ? "arm64" : null;
|
|
@@ -304582,10 +304714,10 @@ function getBaseDirectories() {
|
|
|
304582
304714
|
const platform4 = getPlatform2();
|
|
304583
304715
|
const executableName = getExecutableName(platform4);
|
|
304584
304716
|
return {
|
|
304585
|
-
versions:
|
|
304586
|
-
staging:
|
|
304587
|
-
locks:
|
|
304588
|
-
executable:
|
|
304717
|
+
versions: join102(getXDGDataHome(), "claude", "versions"),
|
|
304718
|
+
staging: join102(getXDGCacheHome(), "claude", "staging"),
|
|
304719
|
+
locks: join102(getXDGStateHome(), "claude", "locks"),
|
|
304720
|
+
executable: join102(getUserBinDir(), executableName)
|
|
304589
304721
|
};
|
|
304590
304722
|
}
|
|
304591
304723
|
async function isPossibleClaudeBinary(filePath) {
|
|
@@ -304606,14 +304738,14 @@ async function getVersionPaths(version2) {
|
|
|
304606
304738
|
await Promise.all(dirsToCreate.map((dir) => mkdir24(dir, { recursive: true })));
|
|
304607
304739
|
const executableParentDir = dirname46(dirs.executable);
|
|
304608
304740
|
await mkdir24(executableParentDir, { recursive: true });
|
|
304609
|
-
const installPath =
|
|
304741
|
+
const installPath = join102(dirs.versions, version2);
|
|
304610
304742
|
try {
|
|
304611
304743
|
await stat36(installPath);
|
|
304612
304744
|
} catch {
|
|
304613
|
-
await
|
|
304745
|
+
await writeFile27(installPath, "", { encoding: "utf8" });
|
|
304614
304746
|
}
|
|
304615
304747
|
return {
|
|
304616
|
-
stagingPath:
|
|
304748
|
+
stagingPath: join102(dirs.staging, version2),
|
|
304617
304749
|
installPath
|
|
304618
304750
|
};
|
|
304619
304751
|
}
|
|
@@ -304714,7 +304846,7 @@ async function atomicMoveToInstallPath(stagedBinaryPath, installPath) {
|
|
|
304714
304846
|
}
|
|
304715
304847
|
async function installVersionFromPackage(stagingPath, installPath) {
|
|
304716
304848
|
try {
|
|
304717
|
-
const nodeModulesDir =
|
|
304849
|
+
const nodeModulesDir = join102(stagingPath, "node_modules", "@anthropic-ai");
|
|
304718
304850
|
const entries = await readdir17(nodeModulesDir);
|
|
304719
304851
|
const nativePackage = entries.find((entry) => entry.startsWith("claude-cli-native-"));
|
|
304720
304852
|
if (!nativePackage) {
|
|
@@ -304725,7 +304857,7 @@ async function installVersionFromPackage(stagingPath, installPath) {
|
|
|
304725
304857
|
const error40 = new Error("Could not find platform-specific native package");
|
|
304726
304858
|
throw error40;
|
|
304727
304859
|
}
|
|
304728
|
-
const stagedBinaryPath =
|
|
304860
|
+
const stagedBinaryPath = join102(nodeModulesDir, nativePackage, "cli");
|
|
304729
304861
|
try {
|
|
304730
304862
|
await stat36(stagedBinaryPath);
|
|
304731
304863
|
} catch {
|
|
@@ -304755,7 +304887,7 @@ async function installVersionFromBinary(stagingPath, installPath) {
|
|
|
304755
304887
|
try {
|
|
304756
304888
|
const platform4 = getPlatform2();
|
|
304757
304889
|
const binaryName = getBinaryName(platform4);
|
|
304758
|
-
const stagedBinaryPath =
|
|
304890
|
+
const stagedBinaryPath = join102(stagingPath, binaryName);
|
|
304759
304891
|
try {
|
|
304760
304892
|
await stat36(stagedBinaryPath);
|
|
304761
304893
|
} catch {
|
|
@@ -304824,8 +304956,8 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
304824
304956
|
const maxVersion = await getMaxVersion();
|
|
304825
304957
|
if (maxVersion && gt(version2, maxVersion)) {
|
|
304826
304958
|
logForDebugging(`Native installer: maxVersion ${maxVersion} is set, capping update from ${version2} to ${maxVersion}`);
|
|
304827
|
-
if (gte("0.30.
|
|
304828
|
-
logForDebugging(`Native installer: current version ${"0.30.
|
|
304959
|
+
if (gte("0.30.2-by-rayss", maxVersion)) {
|
|
304960
|
+
logForDebugging(`Native installer: current version ${"0.30.2-by-rayss"} is already at or above maxVersion ${maxVersion}, skipping update`);
|
|
304829
304961
|
logEvent("tengu_native_update_skipped_max_version", {
|
|
304830
304962
|
latency_ms: Date.now() - startTime,
|
|
304831
304963
|
max_version: maxVersion,
|
|
@@ -304836,7 +304968,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
304836
304968
|
version2 = maxVersion;
|
|
304837
304969
|
}
|
|
304838
304970
|
}
|
|
304839
|
-
if (!forceReinstall && version2 === "0.30.
|
|
304971
|
+
if (!forceReinstall && version2 === "0.30.2-by-rayss" && await versionIsAvailable(version2) && await isPossibleClaudeBinary(executablePath)) {
|
|
304840
304972
|
logForDebugging(`Found ${version2} at ${executablePath}, skipping install`);
|
|
304841
304973
|
logEvent("tengu_native_update_complete", {
|
|
304842
304974
|
latency_ms: Date.now() - startTime,
|
|
@@ -305162,7 +305294,7 @@ async function getVersionFromSymlink(symlinkPath) {
|
|
|
305162
305294
|
}
|
|
305163
305295
|
function getLockFilePathFromVersionPath(dirs, versionPath) {
|
|
305164
305296
|
const versionName = basename31(versionPath);
|
|
305165
|
-
return
|
|
305297
|
+
return join102(dirs.locks, `${versionName}.lock`);
|
|
305166
305298
|
}
|
|
305167
305299
|
function logLockAcquisitionError(versionPath, lockError) {
|
|
305168
305300
|
logError2(new Error(`NON-FATAL: Lock acquisition failed for ${versionPath} (expected in multi-process scenarios)`, { cause: lockError }));
|
|
@@ -305199,7 +305331,7 @@ async function cleanupOldVersions() {
|
|
|
305199
305331
|
continue;
|
|
305200
305332
|
}
|
|
305201
305333
|
try {
|
|
305202
|
-
await unlink16(
|
|
305334
|
+
await unlink16(join102(executableDir, file2));
|
|
305203
305335
|
cleanedCount++;
|
|
305204
305336
|
} catch {}
|
|
305205
305337
|
}
|
|
@@ -305216,7 +305348,7 @@ async function cleanupOldVersions() {
|
|
|
305216
305348
|
const stagingEntries = await readdir17(dirs.staging);
|
|
305217
305349
|
let stagingCleanedCount = 0;
|
|
305218
305350
|
for (const entry of stagingEntries) {
|
|
305219
|
-
const stagingPath =
|
|
305351
|
+
const stagingPath = join102(dirs.staging, entry);
|
|
305220
305352
|
try {
|
|
305221
305353
|
const stats = await stat36(stagingPath);
|
|
305222
305354
|
if (stats.mtime.getTime() < oneHourAgo) {
|
|
@@ -305258,7 +305390,7 @@ async function cleanupOldVersions() {
|
|
|
305258
305390
|
const versionFiles = [];
|
|
305259
305391
|
let tempFilesCleanedCount = 0;
|
|
305260
305392
|
for (const entry of versionEntries) {
|
|
305261
|
-
const entryPath =
|
|
305393
|
+
const entryPath = join102(dirs.versions, entry);
|
|
305262
305394
|
if (/\.tmp\.\d+\.\d+$/.test(entry)) {
|
|
305263
305395
|
try {
|
|
305264
305396
|
const stats = await stat36(entryPath);
|
|
@@ -306656,10 +306788,10 @@ import {
|
|
|
306656
306788
|
rmSync as rmSync5,
|
|
306657
306789
|
writeFileSync as writeFileSync5
|
|
306658
306790
|
} from "node:fs";
|
|
306659
|
-
import { dirname as dirname47, join as
|
|
306791
|
+
import { dirname as dirname47, join as join103 } from "node:path";
|
|
306660
306792
|
import { createHash as createHash22, randomUUID as randomUUID19 } from "node:crypto";
|
|
306661
306793
|
function statePath() {
|
|
306662
|
-
return
|
|
306794
|
+
return join103(getClaudeConfigHomeDir(), "aimlapi-topup.json");
|
|
306663
306795
|
}
|
|
306664
306796
|
function jitteredLockDelay() {
|
|
306665
306797
|
return LOCK_RETRY_MS + Math.floor(Math.random() * LOCK_RETRY_MS);
|
|
@@ -307024,7 +307156,7 @@ function refreshAimlapiExchangeLeaseAsync(expected, owner) {
|
|
|
307024
307156
|
return withStateLockAsync(() => refreshExchangeLeaseOperation(expected, owner));
|
|
307025
307157
|
}
|
|
307026
307158
|
function signInKeyPath() {
|
|
307027
|
-
return
|
|
307159
|
+
return join103(getClaudeConfigHomeDir(), "aimlapi-signin-key.json");
|
|
307028
307160
|
}
|
|
307029
307161
|
function isSignInKeyEntry(value) {
|
|
307030
307162
|
if (typeof value !== "object" || value === null)
|
|
@@ -307099,7 +307231,7 @@ function clearAimlapiSignInKeyAsync(email3, apiKeyId) {
|
|
|
307099
307231
|
return withStateLockAsync(() => clearSignInKeyOperation(normalizedEmail, apiKeyId), signInKeyPath());
|
|
307100
307232
|
}
|
|
307101
307233
|
function signInLeasePath() {
|
|
307102
|
-
return
|
|
307234
|
+
return join103(getClaudeConfigHomeDir(), "aimlapi-signin-lease.json");
|
|
307103
307235
|
}
|
|
307104
307236
|
function isSignInLeaseRecord(value) {
|
|
307105
307237
|
if (typeof value !== "object" || value === null)
|
|
@@ -309747,21 +309879,21 @@ __export(exports_teammateMailbox, {
|
|
|
309747
309879
|
PlanApprovalRequestMessageSchema: () => PlanApprovalRequestMessageSchema,
|
|
309748
309880
|
ModeSetRequestMessageSchema: () => ModeSetRequestMessageSchema
|
|
309749
309881
|
});
|
|
309750
|
-
import { mkdir as mkdir25, readFile as readFile30, writeFile as
|
|
309751
|
-
import { join as
|
|
309882
|
+
import { mkdir as mkdir25, readFile as readFile30, writeFile as writeFile28 } from "fs/promises";
|
|
309883
|
+
import { join as join104 } from "path";
|
|
309752
309884
|
function getInboxPath(agentName, teamName) {
|
|
309753
309885
|
const team = teamName || getTeamName() || "default";
|
|
309754
309886
|
const safeTeam = sanitizePathComponent(team);
|
|
309755
309887
|
const safeAgentName = sanitizePathComponent(agentName);
|
|
309756
|
-
const inboxDir =
|
|
309757
|
-
const fullPath =
|
|
309888
|
+
const inboxDir = join104(getTeamsDir(), safeTeam, "inboxes");
|
|
309889
|
+
const fullPath = join104(inboxDir, `${safeAgentName}.json`);
|
|
309758
309890
|
logForDebugging(`[TeammateMailbox] getInboxPath: agent=${agentName}, team=${team}, fullPath=${fullPath}`);
|
|
309759
309891
|
return fullPath;
|
|
309760
309892
|
}
|
|
309761
309893
|
async function ensureInboxDir(teamName) {
|
|
309762
309894
|
const team = teamName || getTeamName() || "default";
|
|
309763
309895
|
const safeTeam = sanitizePathComponent(team);
|
|
309764
|
-
const inboxDir =
|
|
309896
|
+
const inboxDir = join104(getTeamsDir(), safeTeam, "inboxes");
|
|
309765
309897
|
await mkdir25(inboxDir, { recursive: true });
|
|
309766
309898
|
logForDebugging(`[TeammateMailbox] Ensured inbox directory: ${inboxDir}`);
|
|
309767
309899
|
}
|
|
@@ -309796,7 +309928,7 @@ async function writeToMailbox(recipientName, message, teamName) {
|
|
|
309796
309928
|
const lockFilePath = `${inboxPath}.lock`;
|
|
309797
309929
|
logForDebugging(`[TeammateMailbox] writeToMailbox: recipient=${recipientName}, from=${message.from}, path=${inboxPath}`);
|
|
309798
309930
|
try {
|
|
309799
|
-
await
|
|
309931
|
+
await writeFile28(inboxPath, "[]", { encoding: "utf-8", flag: "wx" });
|
|
309800
309932
|
logForDebugging(`[TeammateMailbox] writeToMailbox: created new inbox file`);
|
|
309801
309933
|
} catch (error40) {
|
|
309802
309934
|
const code = getErrnoCode(error40);
|
|
@@ -309818,7 +309950,7 @@ async function writeToMailbox(recipientName, message, teamName) {
|
|
|
309818
309950
|
read: false
|
|
309819
309951
|
};
|
|
309820
309952
|
messages.push(newMessage);
|
|
309821
|
-
await
|
|
309953
|
+
await writeFile28(inboxPath, jsonStringify(messages, null, 2), "utf-8");
|
|
309822
309954
|
logForDebugging(`[TeammateMailbox] Wrote message to ${recipientName}'s inbox from ${message.from}`);
|
|
309823
309955
|
} catch (error40) {
|
|
309824
309956
|
logForDebugging(`Failed to write to inbox for ${recipientName}: ${error40}`);
|
|
@@ -309853,7 +309985,7 @@ async function markMessageAsReadByIndex(agentName, teamName, messageIndex) {
|
|
|
309853
309985
|
return;
|
|
309854
309986
|
}
|
|
309855
309987
|
messages[messageIndex] = { ...message, read: true };
|
|
309856
|
-
await
|
|
309988
|
+
await writeFile28(inboxPath, jsonStringify(messages, null, 2), "utf-8");
|
|
309857
309989
|
logForDebugging(`[TeammateMailbox] markMessageAsReadByIndex: marked message at index ${messageIndex} as read`);
|
|
309858
309990
|
} catch (error40) {
|
|
309859
309991
|
const code = getErrnoCode(error40);
|
|
@@ -309892,7 +310024,7 @@ async function markMessagesAsRead(agentName, teamName) {
|
|
|
309892
310024
|
logForDebugging(`[TeammateMailbox] markMessagesAsRead: ${unreadCount} unread of ${messages.length} total`);
|
|
309893
310025
|
for (const m of messages)
|
|
309894
310026
|
m.read = true;
|
|
309895
|
-
await
|
|
310027
|
+
await writeFile28(inboxPath, jsonStringify(messages, null, 2), "utf-8");
|
|
309896
310028
|
logForDebugging(`[TeammateMailbox] markMessagesAsRead: WROTE ${unreadCount} message(s) as read to ${inboxPath}`);
|
|
309897
310029
|
} catch (error40) {
|
|
309898
310030
|
const code = getErrnoCode(error40);
|
|
@@ -309912,7 +310044,7 @@ async function markMessagesAsRead(agentName, teamName) {
|
|
|
309912
310044
|
async function clearMailbox(agentName, teamName) {
|
|
309913
310045
|
const inboxPath = getInboxPath(agentName, teamName);
|
|
309914
310046
|
try {
|
|
309915
|
-
await
|
|
310047
|
+
await writeFile28(inboxPath, "[]", { encoding: "utf-8", flag: "r+" });
|
|
309916
310048
|
logForDebugging(`[TeammateMailbox] Cleared inbox for ${agentName}`);
|
|
309917
310049
|
} catch (error40) {
|
|
309918
310050
|
const code = getErrnoCode(error40);
|
|
@@ -310187,7 +310319,7 @@ async function markMessagesAsReadByPredicate(agentName, predicate, teamName) {
|
|
|
310187
310319
|
return;
|
|
310188
310320
|
}
|
|
310189
310321
|
const updatedMessages = messages.map((m) => !m.read && predicate(m) ? { ...m, read: true } : m);
|
|
310190
|
-
await
|
|
310322
|
+
await writeFile28(inboxPath, jsonStringify(updatedMessages, null, 2), "utf-8");
|
|
310191
310323
|
} catch (error40) {
|
|
310192
310324
|
const code = getErrnoCode(error40);
|
|
310193
310325
|
if (code === "ENOENT") {
|
|
@@ -312761,8 +312893,8 @@ __export(exports_teamHelpers, {
|
|
|
312761
312893
|
addHiddenPaneId: () => addHiddenPaneId
|
|
312762
312894
|
});
|
|
312763
312895
|
import { mkdirSync as mkdirSync7, readFileSync as readFileSync14, writeFileSync as writeFileSync6 } from "fs";
|
|
312764
|
-
import { mkdir as mkdir26, readFile as readFile31, rm as rm9, writeFile as
|
|
312765
|
-
import { join as
|
|
312896
|
+
import { mkdir as mkdir26, readFile as readFile31, rm as rm9, writeFile as writeFile29 } from "fs/promises";
|
|
312897
|
+
import { join as join105 } from "path";
|
|
312766
312898
|
function sanitizeName(name) {
|
|
312767
312899
|
return name.replace(/[^a-zA-Z0-9]/g, "-").toLowerCase();
|
|
312768
312900
|
}
|
|
@@ -312770,10 +312902,10 @@ function sanitizeAgentName(name) {
|
|
|
312770
312902
|
return name.replace(/@/g, "-");
|
|
312771
312903
|
}
|
|
312772
312904
|
function getTeamDir(teamName) {
|
|
312773
|
-
return
|
|
312905
|
+
return join105(getTeamsDir(), sanitizeName(teamName));
|
|
312774
312906
|
}
|
|
312775
312907
|
function getTeamFilePath(teamName) {
|
|
312776
|
-
return
|
|
312908
|
+
return join105(getTeamDir(teamName), "config.json");
|
|
312777
312909
|
}
|
|
312778
312910
|
function readTeamFile(teamName) {
|
|
312779
312911
|
try {
|
|
@@ -312805,7 +312937,7 @@ function writeTeamFile(teamName, teamFile) {
|
|
|
312805
312937
|
async function writeTeamFileAsync(teamName, teamFile) {
|
|
312806
312938
|
const teamDir = getTeamDir(teamName);
|
|
312807
312939
|
await mkdir26(teamDir, { recursive: true });
|
|
312808
|
-
await
|
|
312940
|
+
await writeFile29(getTeamFilePath(teamName), jsonStringify(teamFile, null, 2));
|
|
312809
312941
|
}
|
|
312810
312942
|
function removeTeammateFromTeamFile(teamName, identifier) {
|
|
312811
312943
|
const identifierStr = identifier.agentId || identifier.name;
|
|
@@ -312964,15 +313096,15 @@ async function setMemberActive(teamName, memberName, isActive) {
|
|
|
312964
313096
|
logForDebugging(`[TeammateTool] Set member ${memberName} in team ${teamName} to ${isActive ? "active" : "idle"}`);
|
|
312965
313097
|
}
|
|
312966
313098
|
async function destroyWorktree(worktreePath) {
|
|
312967
|
-
const gitFilePath =
|
|
313099
|
+
const gitFilePath = join105(worktreePath, ".git");
|
|
312968
313100
|
let mainRepoPath = null;
|
|
312969
313101
|
try {
|
|
312970
313102
|
const gitFileContent = (await readFile31(gitFilePath, "utf-8")).trim();
|
|
312971
313103
|
const match = gitFileContent.match(/^gitdir:\s*(.+)$/);
|
|
312972
313104
|
if (match && match[1]) {
|
|
312973
313105
|
const worktreeGitDir = match[1];
|
|
312974
|
-
const mainGitDir =
|
|
312975
|
-
mainRepoPath =
|
|
313106
|
+
const mainGitDir = join105(worktreeGitDir, "..", "..");
|
|
313107
|
+
mainRepoPath = join105(mainGitDir, "..");
|
|
312976
313108
|
}
|
|
312977
313109
|
} catch {}
|
|
312978
313110
|
if (mainRepoPath) {
|
|
@@ -328996,7 +329128,7 @@ var init_runAgent = __esm(() => {
|
|
|
328996
329128
|
});
|
|
328997
329129
|
|
|
328998
329130
|
// src/services/MagicDocs/prompts.ts
|
|
328999
|
-
import { join as
|
|
329131
|
+
import { join as join106 } from "path";
|
|
329000
329132
|
function getUpdatePromptTemplate() {
|
|
329001
329133
|
return `IMPORTANT: This message and these instructions are NOT part of the actual user conversation. Do NOT include any references to "documentation updates", "magic docs", or these update instructions in the document content.
|
|
329002
329134
|
|
|
@@ -329051,7 +329183,7 @@ REMEMBER: Only update if there is substantial new information. The Magic Doc hea
|
|
|
329051
329183
|
}
|
|
329052
329184
|
async function loadMagicDocsPrompt() {
|
|
329053
329185
|
const fs2 = getFsImplementation();
|
|
329054
|
-
const promptPath =
|
|
329186
|
+
const promptPath = join106(getClaudeConfigHomeDir(), "magic-docs", "prompt.md");
|
|
329055
329187
|
try {
|
|
329056
329188
|
return await fs2.readFile(promptPath, { encoding: "utf-8" });
|
|
329057
329189
|
} catch {
|
|
@@ -346067,14 +346199,14 @@ var require_turndown_cjs = __commonJS((exports, module) => {
|
|
|
346067
346199
|
} else if (node.nodeType === 1) {
|
|
346068
346200
|
replacement = replacementForNode.call(self2, node);
|
|
346069
346201
|
}
|
|
346070
|
-
return
|
|
346202
|
+
return join107(output, replacement);
|
|
346071
346203
|
}, "");
|
|
346072
346204
|
}
|
|
346073
346205
|
function postProcess(output) {
|
|
346074
346206
|
var self2 = this;
|
|
346075
346207
|
this.rules.forEach(function(rule) {
|
|
346076
346208
|
if (typeof rule.append === "function") {
|
|
346077
|
-
output =
|
|
346209
|
+
output = join107(output, rule.append(self2.options));
|
|
346078
346210
|
}
|
|
346079
346211
|
});
|
|
346080
346212
|
return output.replace(/^[\t\r\n]+/, "").replace(/[\t\r\n\s]+$/, "");
|
|
@@ -346087,7 +346219,7 @@ var require_turndown_cjs = __commonJS((exports, module) => {
|
|
|
346087
346219
|
content = content.trim();
|
|
346088
346220
|
return whitespace.leading + rule.replacement(content, node, this.options) + whitespace.trailing;
|
|
346089
346221
|
}
|
|
346090
|
-
function
|
|
346222
|
+
function join107(output, replacement) {
|
|
346091
346223
|
var s1 = trimTrailingNewlines(output);
|
|
346092
346224
|
var s2 = trimLeadingNewlines(replacement);
|
|
346093
346225
|
var nls = Math.max(output.length - s1.length, replacement.length - s2.length);
|
|
@@ -347125,9 +347257,9 @@ __export(exports_copy, {
|
|
|
347125
347257
|
collectRecentAssistantTexts: () => collectRecentAssistantTexts,
|
|
347126
347258
|
call: () => call14
|
|
347127
347259
|
});
|
|
347128
|
-
import { mkdir as mkdir27, writeFile as
|
|
347260
|
+
import { mkdir as mkdir27, writeFile as writeFile30 } from "fs/promises";
|
|
347129
347261
|
import { tmpdir as tmpdir6 } from "os";
|
|
347130
|
-
import { join as
|
|
347262
|
+
import { join as join107 } from "path";
|
|
347131
347263
|
import { useRef as useRef35 } from "react";
|
|
347132
347264
|
import { jsxDEV as jsxDEV149 } from "react/jsx-dev-runtime";
|
|
347133
347265
|
function extractCodeBlocks(markdown) {
|
|
@@ -347171,11 +347303,11 @@ function fileExtension(lang) {
|
|
|
347171
347303
|
return ".txt";
|
|
347172
347304
|
}
|
|
347173
347305
|
async function writeToFile(text, filename) {
|
|
347174
|
-
const filePath =
|
|
347306
|
+
const filePath = join107(COPY_DIR, filename);
|
|
347175
347307
|
await mkdir27(COPY_DIR, {
|
|
347176
347308
|
recursive: true
|
|
347177
347309
|
});
|
|
347178
|
-
await
|
|
347310
|
+
await writeFile30(filePath, text, "utf-8");
|
|
347179
347311
|
return filePath;
|
|
347180
347312
|
}
|
|
347181
347313
|
async function copyOrWriteToFile(text, filename) {
|
|
@@ -347520,7 +347652,7 @@ var init_copy = __esm(() => {
|
|
|
347520
347652
|
init_messages2();
|
|
347521
347653
|
init_stringUtils();
|
|
347522
347654
|
import_react_compiler_runtime116 = __toESM(require_dist4(), 1);
|
|
347523
|
-
COPY_DIR =
|
|
347655
|
+
COPY_DIR = join107(tmpdir6(), "claude");
|
|
347524
347656
|
});
|
|
347525
347657
|
|
|
347526
347658
|
// src/commands/copy/index.ts
|
|
@@ -347537,7 +347669,7 @@ var init_copy2 = __esm(() => {
|
|
|
347537
347669
|
|
|
347538
347670
|
// src/utils/desktopDeepLink.ts
|
|
347539
347671
|
import { readdir as readdir18 } from "fs/promises";
|
|
347540
|
-
import { join as
|
|
347672
|
+
import { join as join108 } from "path";
|
|
347541
347673
|
function isDevMode() {
|
|
347542
347674
|
if (true) {
|
|
347543
347675
|
return true;
|
|
@@ -347600,7 +347732,7 @@ async function getDesktopVersion() {
|
|
|
347600
347732
|
if (!localAppData) {
|
|
347601
347733
|
return null;
|
|
347602
347734
|
}
|
|
347603
|
-
const installDir =
|
|
347735
|
+
const installDir = join108(localAppData, "AnthropicClaude");
|
|
347604
347736
|
try {
|
|
347605
347737
|
const entries = await readdir18(installDir);
|
|
347606
347738
|
const versions2 = entries.filter((e) => e.startsWith("app-")).map((e) => e.slice(4)).filter((v) => import_semver7.coerce(v) !== null).sort((a2, b) => {
|
|
@@ -348759,7 +348891,7 @@ function buildPrimarySection() {
|
|
|
348759
348891
|
}, undefined, false, undefined, this);
|
|
348760
348892
|
return [{
|
|
348761
348893
|
label: "Version",
|
|
348762
|
-
value: "0.30.
|
|
348894
|
+
value: "0.30.2-by-rayss"
|
|
348763
348895
|
}, {
|
|
348764
348896
|
label: "Session name",
|
|
348765
348897
|
value: nameValue
|
|
@@ -353803,7 +353935,7 @@ var init_extraUsage = __esm(() => {
|
|
|
353803
353935
|
});
|
|
353804
353936
|
|
|
353805
353937
|
// src/components/ClaudeMdExternalIncludesDialog.tsx
|
|
353806
|
-
import { join as
|
|
353938
|
+
import { join as join109 } from "path";
|
|
353807
353939
|
import React52 from "react";
|
|
353808
353940
|
import { jsxDEV as jsxDEV158 } from "react/jsx-dev-runtime";
|
|
353809
353941
|
function acceptProject(current) {
|
|
@@ -353819,7 +353951,7 @@ function declineUser(current) {
|
|
|
353819
353951
|
return { ...current, hasClaudeMdExternalIncludesApprovedForUser: false, hasClaudeMdExternalIncludesWarningShownForUser: true };
|
|
353820
353952
|
}
|
|
353821
353953
|
function getUserClaudeMdDisplayPath() {
|
|
353822
|
-
return getDisplayPath(
|
|
353954
|
+
return getDisplayPath(join109(getClaudeConfigHomeDir(), "CLAUDE.md"));
|
|
353823
353955
|
}
|
|
353824
353956
|
function ClaudeMdExternalIncludesDialog(t0) {
|
|
353825
353957
|
const $2 = import_react_compiler_runtime123.c(18);
|
|
@@ -356099,7 +356231,7 @@ function Config({
|
|
|
356099
356231
|
}
|
|
356100
356232
|
}, undefined, false, undefined, this)
|
|
356101
356233
|
}, undefined, false, undefined, this) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsxDEV162(ChannelDowngradeDialog, {
|
|
356102
|
-
currentVersion: "0.30.
|
|
356234
|
+
currentVersion: "0.30.2-by-rayss",
|
|
356103
356235
|
onChoice: (choice) => {
|
|
356104
356236
|
setShowSubmenu(null);
|
|
356105
356237
|
setTabsHidden(false);
|
|
@@ -356111,7 +356243,7 @@ function Config({
|
|
|
356111
356243
|
autoUpdatesChannel: "stable"
|
|
356112
356244
|
};
|
|
356113
356245
|
if (choice === "stay") {
|
|
356114
|
-
newSettings.minimumVersion = "0.30.
|
|
356246
|
+
newSettings.minimumVersion = "0.30.2-by-rayss";
|
|
356115
356247
|
}
|
|
356116
356248
|
updateSettingsForSource("userSettings", newSettings);
|
|
356117
356249
|
setSettingsData((prev_27) => ({
|
|
@@ -364142,7 +364274,7 @@ var init_doctorDistTags = __esm(() => {
|
|
|
364142
364274
|
});
|
|
364143
364275
|
|
|
364144
364276
|
// src/screens/Doctor.tsx
|
|
364145
|
-
import { join as
|
|
364277
|
+
import { join as join110 } from "path";
|
|
364146
364278
|
import React60, { Suspense as Suspense7, use as use8, useEffect as useEffect50, useMemo as useMemo31, useState as useState54 } from "react";
|
|
364147
364279
|
import { jsxDEV as jsxDEV186, Fragment as Fragment36 } from "react/jsx-dev-runtime";
|
|
364148
364280
|
function DistTagsDisplay(t0) {
|
|
@@ -364261,8 +364393,8 @@ function Doctor(t0) {
|
|
|
364261
364393
|
useEffect50(() => {
|
|
364262
364394
|
loadDoctorDiagnostic({ getDoctorDiagnostic }, { setDiagnostic, setDiagnosticLoadFailed });
|
|
364263
364395
|
(async () => {
|
|
364264
|
-
const userAgentsDir =
|
|
364265
|
-
const projectAgentsDir =
|
|
364396
|
+
const userAgentsDir = join110(getClaudeConfigHomeDir(), "agents");
|
|
364397
|
+
const projectAgentsDir = join110(getOriginalCwd(), ".openclaude", "agents");
|
|
364266
364398
|
const {
|
|
364267
364399
|
activeAgents,
|
|
364268
364400
|
allAgents,
|
|
@@ -364285,7 +364417,7 @@ function Doctor(t0) {
|
|
|
364285
364417
|
}, async () => toolPermissionContext);
|
|
364286
364418
|
setContextWarnings(warnings);
|
|
364287
364419
|
if (isPidBasedLockingEnabled()) {
|
|
364288
|
-
const locksDir =
|
|
364420
|
+
const locksDir = join110(getXDGStateHome(), "claude", "locks");
|
|
364289
364421
|
const staleLocksCleaned = cleanupStaleLocks(locksDir);
|
|
364290
364422
|
const locks = getAllLockInfo(locksDir);
|
|
364291
364423
|
setVersionLockInfo({
|
|
@@ -365186,21 +365318,21 @@ function readPackageManager(env4) {
|
|
|
365186
365318
|
}
|
|
365187
365319
|
function readMacroVersion() {
|
|
365188
365320
|
try {
|
|
365189
|
-
return "0.30.
|
|
365321
|
+
return "0.30.2-by-rayss";
|
|
365190
365322
|
} catch {
|
|
365191
365323
|
return;
|
|
365192
365324
|
}
|
|
365193
365325
|
}
|
|
365194
365326
|
function readMacroDisplayVersion() {
|
|
365195
365327
|
try {
|
|
365196
|
-
return "0.30.
|
|
365328
|
+
return "0.30.2-by-rayss";
|
|
365197
365329
|
} catch {
|
|
365198
365330
|
return;
|
|
365199
365331
|
}
|
|
365200
365332
|
}
|
|
365201
365333
|
function readMacroBuildTime() {
|
|
365202
365334
|
try {
|
|
365203
|
-
return "2026-09-
|
|
365335
|
+
return "2026-09-05T03:58:56.896Z";
|
|
365204
365336
|
} catch {
|
|
365205
365337
|
return;
|
|
365206
365338
|
}
|
|
@@ -366449,14 +366581,14 @@ var init_autoExtractFacts = __esm(() => {
|
|
|
366449
366581
|
});
|
|
366450
366582
|
|
|
366451
366583
|
// src/memdir/vectorIndex.ts
|
|
366452
|
-
import { join as
|
|
366584
|
+
import { join as join111, relative as relative21 } from "path";
|
|
366453
366585
|
import { create as create2, insert, search } from "@orama/orama";
|
|
366454
366586
|
import { persist, restore } from "@orama/plugin-data-persistence";
|
|
366455
366587
|
function getIndexPath(memoryDir) {
|
|
366456
|
-
return
|
|
366588
|
+
return join111(memoryDir, INDEX_FILENAME);
|
|
366457
366589
|
}
|
|
366458
366590
|
function getIndexMetaPath(memoryDir) {
|
|
366459
|
-
return
|
|
366591
|
+
return join111(memoryDir, INDEX_META_FILENAME);
|
|
366460
366592
|
}
|
|
366461
366593
|
function clearIndex(memoryDir) {
|
|
366462
366594
|
indices.delete(memoryDir);
|
|
@@ -366471,13 +366603,13 @@ var init_vectorIndex = __esm(() => {
|
|
|
366471
366603
|
|
|
366472
366604
|
// src/utils/conversationArc.ts
|
|
366473
366605
|
import { readFileSync as readFileSync15, writeFileSync as writeFileSync8, existsSync as existsSync8, mkdirSync as mkdirSync9, rmSync as rmSync6, readdirSync as readdirSync4 } from "fs";
|
|
366474
|
-
import { join as
|
|
366606
|
+
import { join as join112 } from "path";
|
|
366475
366607
|
import { randomUUID as randomUUID25 } from "crypto";
|
|
366476
366608
|
function currentProjectKey() {
|
|
366477
366609
|
return getAutoMemPath() || "";
|
|
366478
366610
|
}
|
|
366479
366611
|
function getArcPath(memoryDir) {
|
|
366480
|
-
return
|
|
366612
|
+
return join112(memoryDir, ARC_FILENAME);
|
|
366481
366613
|
}
|
|
366482
366614
|
function safeArcText(value) {
|
|
366483
366615
|
const sanitized = sanitizeMemoryText(value);
|
|
@@ -366666,12 +366798,12 @@ function clearArcArtifacts(memoryDir) {
|
|
|
366666
366798
|
try {
|
|
366667
366799
|
for (const entry of readdirSync4(memoryDir)) {
|
|
366668
366800
|
if (entry.startsWith("session-summary-")) {
|
|
366669
|
-
rmSync6(
|
|
366801
|
+
rmSync6(join112(memoryDir, entry), { force: true });
|
|
366670
366802
|
}
|
|
366671
366803
|
}
|
|
366672
366804
|
} catch {}
|
|
366673
366805
|
for (const name of [".vector-index", ".vector-index-meta.json"]) {
|
|
366674
|
-
const p =
|
|
366806
|
+
const p = join112(memoryDir, name);
|
|
366675
366807
|
if (existsSync8(p)) {
|
|
366676
366808
|
try {
|
|
366677
366809
|
rmSync6(p, { force: true });
|
|
@@ -366718,11 +366850,11 @@ var init_conversationArc = __esm(() => {
|
|
|
366718
366850
|
|
|
366719
366851
|
// src/utils/knowledgeGraph.ts
|
|
366720
366852
|
import { readFileSync as readFileSync16, existsSync as existsSync9, readdirSync as readdirSync5, rmSync as rmSync7, mkdirSync as mkdirSync10, writeFileSync as writeFileSync9, statSync as statSync6 } from "fs";
|
|
366721
|
-
import { join as
|
|
366853
|
+
import { join as join113 } from "path";
|
|
366722
366854
|
import { createRequire as createRequire4 } from "module";
|
|
366723
366855
|
function getFactsDir() {
|
|
366724
366856
|
const memDir = getAutoMemPath();
|
|
366725
|
-
return memDir ?
|
|
366857
|
+
return memDir ? join113(memDir, FACTS_SUBDIR) : "";
|
|
366726
366858
|
}
|
|
366727
366859
|
function currentProjectKey2() {
|
|
366728
366860
|
return `${getProjectsDir()}\x00${sanitizePath(getFsImplementation().cwd())}`;
|
|
@@ -366736,10 +366868,10 @@ function getLegacyProjectKeys() {
|
|
|
366736
366868
|
return [...keys2];
|
|
366737
366869
|
}
|
|
366738
366870
|
function getLegacyGraphPaths() {
|
|
366739
|
-
return getLegacyProjectKeys().map((key) =>
|
|
366871
|
+
return getLegacyProjectKeys().map((key) => join113(getProjectsDir(), key, "knowledge_graph.json"));
|
|
366740
366872
|
}
|
|
366741
366873
|
function getLegacySqlitePaths() {
|
|
366742
|
-
return getLegacyProjectKeys().map((key) =>
|
|
366874
|
+
return getLegacyProjectKeys().map((key) => join113(getProjectsDir(), key, "knowledge.db"));
|
|
366743
366875
|
}
|
|
366744
366876
|
function slugify(text2) {
|
|
366745
366877
|
return text2.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 80);
|
|
@@ -367077,7 +367209,7 @@ function doMigration(data, sources, projectKey) {
|
|
|
367077
367209
|
const memDir = getAutoMemPath();
|
|
367078
367210
|
if (!memDir)
|
|
367079
367211
|
return;
|
|
367080
|
-
const factsDir =
|
|
367212
|
+
const factsDir = join113(memDir, FACTS_SUBDIR);
|
|
367081
367213
|
try {
|
|
367082
367214
|
if (!existsSync9(factsDir)) {
|
|
367083
367215
|
mkdirSync10(factsDir, { recursive: true });
|
|
@@ -367130,7 +367262,7 @@ ${attrsYaml}` : ""}
|
|
|
367130
367262
|
---
|
|
367131
367263
|
Auto-migrated from legacy store: **${safeName}**
|
|
367132
367264
|
`;
|
|
367133
|
-
writeFileSync9(
|
|
367265
|
+
writeFileSync9(join113(factsDir, `fact-${typeSlug}-${nameSlug}.md`), content, "utf-8");
|
|
367134
367266
|
count3++;
|
|
367135
367267
|
}
|
|
367136
367268
|
for (const summary of data.summaries ?? []) {
|
|
@@ -367151,7 +367283,7 @@ source: legacy_migration
|
|
|
367151
367283
|
---
|
|
367152
367284
|
${safeSummary}
|
|
367153
367285
|
`;
|
|
367154
|
-
writeFileSync9(
|
|
367286
|
+
writeFileSync9(join113(factsDir, `fact-summary-${idSlug}.md`), content, "utf-8");
|
|
367155
367287
|
count3++;
|
|
367156
367288
|
}
|
|
367157
367289
|
for (const rule of data.rules ?? []) {
|
|
@@ -367170,7 +367302,7 @@ source: legacy_migration
|
|
|
367170
367302
|
---
|
|
367171
367303
|
${safeRule}
|
|
367172
367304
|
`;
|
|
367173
|
-
writeFileSync9(
|
|
367305
|
+
writeFileSync9(join113(factsDir, `fact-rule-${slug}.md`), content, "utf-8");
|
|
367174
367306
|
count3++;
|
|
367175
367307
|
}
|
|
367176
367308
|
const relations = (data.relations ?? []).flatMap((r) => {
|
|
@@ -367199,7 +367331,7 @@ relationCount: ${relations.length}
|
|
|
367199
367331
|
${relations.map((r) => `${r.sourceId} => ${r.type} => ${r.targetId}`).join(`
|
|
367200
367332
|
`)}
|
|
367201
367333
|
`;
|
|
367202
|
-
writeFileSync9(
|
|
367334
|
+
writeFileSync9(join113(factsDir, `fact-relations-migrated.md`), relContent, "utf-8");
|
|
367203
367335
|
count3++;
|
|
367204
367336
|
}
|
|
367205
367337
|
let retirementFailed = false;
|
|
@@ -367254,7 +367386,7 @@ function getGlobalGraph() {
|
|
|
367254
367386
|
for (const file2 of files) {
|
|
367255
367387
|
if (!file2.endsWith(".md"))
|
|
367256
367388
|
continue;
|
|
367257
|
-
const filePath =
|
|
367389
|
+
const filePath = join113(factsDir, file2);
|
|
367258
367390
|
try {
|
|
367259
367391
|
const raw = readFileSync16(filePath, "utf-8");
|
|
367260
367392
|
const parsed = parseFrontmatter(raw);
|
|
@@ -367324,7 +367456,7 @@ function pruneLegacyGraphArtifacts(projectDir) {
|
|
|
367324
367456
|
for (const entry of readdirSync5(projectDir)) {
|
|
367325
367457
|
if (entry.startsWith("knowledge_graph.json.backup-") || entry.startsWith("knowledge_graph.json.cleared-") || entry.startsWith("knowledge.db.backup-") || entry.startsWith("knowledge.db.cleared-") || entry.startsWith("knowledge.db-wal.cleared-") || entry.startsWith("knowledge.db-shm.cleared-")) {
|
|
367326
367458
|
try {
|
|
367327
|
-
rmSync7(
|
|
367459
|
+
rmSync7(join113(projectDir, entry), { force: true });
|
|
367328
367460
|
} catch {}
|
|
367329
367461
|
}
|
|
367330
367462
|
}
|
|
@@ -367336,10 +367468,10 @@ function retireLegacyArtifacts(projectDir) {
|
|
|
367336
367468
|
if (!existsSync9(projectDir))
|
|
367337
367469
|
return { archived, failures };
|
|
367338
367470
|
const mainArtifacts = [
|
|
367339
|
-
|
|
367340
|
-
|
|
367471
|
+
join113(projectDir, "knowledge_graph.json"),
|
|
367472
|
+
join113(projectDir, "knowledge.db")
|
|
367341
367473
|
];
|
|
367342
|
-
const sidecars = ["-wal", "-shm"].map((s) =>
|
|
367474
|
+
const sidecars = ["-wal", "-shm"].map((s) => join113(projectDir, `knowledge.db${s}`));
|
|
367343
367475
|
const candidates = [...mainArtifacts, ...sidecars].filter((p) => existsSync9(p));
|
|
367344
367476
|
for (const live of candidates) {
|
|
367345
367477
|
const backupPath = `${live}.migration-backup`;
|
|
@@ -367374,7 +367506,7 @@ function resetGlobalGraph() {
|
|
|
367374
367506
|
const memDir = getAutoMemPath();
|
|
367375
367507
|
if (!memDir)
|
|
367376
367508
|
return { archived: [], failures: [] };
|
|
367377
|
-
const factsDir =
|
|
367509
|
+
const factsDir = join113(memDir, FACTS_SUBDIR);
|
|
367378
367510
|
if (existsSync9(factsDir)) {
|
|
367379
367511
|
try {
|
|
367380
367512
|
rmSync7(factsDir, { recursive: true, force: true });
|
|
@@ -367393,12 +367525,12 @@ function resetGlobalGraph() {
|
|
|
367393
367525
|
} catch {}
|
|
367394
367526
|
}
|
|
367395
367527
|
for (const key of getLegacyProjectKeys()) {
|
|
367396
|
-
pruneLegacyGraphArtifacts(
|
|
367528
|
+
pruneLegacyGraphArtifacts(join113(getProjectsDir(), key));
|
|
367397
367529
|
}
|
|
367398
367530
|
const archived = [];
|
|
367399
367531
|
const failures = [];
|
|
367400
367532
|
for (const key of getLegacyProjectKeys()) {
|
|
367401
|
-
const { archived: a2, failures: f } = retireLegacyArtifacts(
|
|
367533
|
+
const { archived: a2, failures: f } = retireLegacyArtifacts(join113(getProjectsDir(), key));
|
|
367402
367534
|
archived.push(...a2);
|
|
367403
367535
|
failures.push(...f);
|
|
367404
367536
|
}
|
|
@@ -367549,13 +367681,13 @@ var init_versions2 = __esm(() => {
|
|
|
367549
367681
|
});
|
|
367550
367682
|
|
|
367551
367683
|
// src/components/memory/memoryFileSelectorPaths.ts
|
|
367552
|
-
import { basename as basename37, join as
|
|
367684
|
+
import { basename as basename37, join as join114 } from "path";
|
|
367553
367685
|
function isLoadedProjectInstructionFile(file2) {
|
|
367554
367686
|
return file2.type === "Project" && file2.parent === undefined && isProjectInstructionFileName(basename37(file2.path));
|
|
367555
367687
|
}
|
|
367556
367688
|
function getProjectMemoryPathForSelector(existingMemoryFiles, cwd2) {
|
|
367557
367689
|
const loadedProjectInstructionPaths = new Set(existingMemoryFiles.filter(isLoadedProjectInstructionFile).map((file2) => file2.path));
|
|
367558
|
-
return findProjectInstructionFilePathInAncestors(cwd2, (path13) => loadedProjectInstructionPaths.has(path13)) ??
|
|
367690
|
+
return findProjectInstructionFilePathInAncestors(cwd2, (path13) => loadedProjectInstructionPaths.has(path13)) ?? join114(cwd2, PRIMARY_PROJECT_INSTRUCTION_FILE);
|
|
367559
367691
|
}
|
|
367560
367692
|
var init_memoryFileSelectorPaths = __esm(() => {
|
|
367561
367693
|
init_projectInstructions();
|
|
@@ -367563,7 +367695,7 @@ var init_memoryFileSelectorPaths = __esm(() => {
|
|
|
367563
367695
|
|
|
367564
367696
|
// src/components/memory/MemoryFileSelector.tsx
|
|
367565
367697
|
import { mkdir as mkdir28 } from "fs/promises";
|
|
367566
|
-
import { basename as basename38, join as
|
|
367698
|
+
import { basename as basename38, join as join115 } from "path";
|
|
367567
367699
|
import { use as use9, useEffect as useEffect51, useState as useState56 } from "react";
|
|
367568
367700
|
import { jsxDEV as jsxDEV189 } from "react/jsx-dev-runtime";
|
|
367569
367701
|
function MemoryFileSelector(t0) {
|
|
@@ -367574,7 +367706,7 @@ function MemoryFileSelector(t0) {
|
|
|
367574
367706
|
} = t0;
|
|
367575
367707
|
const existingMemoryFiles = use9(getMemoryFiles());
|
|
367576
367708
|
const originalCwd = getOriginalCwd();
|
|
367577
|
-
const userMemoryPath =
|
|
367709
|
+
const userMemoryPath = join115(getClaudeConfigHomeDir(), "CLAUDE.md");
|
|
367578
367710
|
const projectMemoryPath = getProjectMemoryPathForSelector(existingMemoryFiles, originalCwd);
|
|
367579
367711
|
const projectMemoryFileName = basename38(projectMemoryPath);
|
|
367580
367712
|
const hasUserMemory = existingMemoryFiles.some((f) => f.path === userMemoryPath);
|
|
@@ -368225,7 +368357,7 @@ var exports_memory = {};
|
|
|
368225
368357
|
__export(exports_memory, {
|
|
368226
368358
|
call: () => call28
|
|
368227
368359
|
});
|
|
368228
|
-
import { mkdir as mkdir29, writeFile as
|
|
368360
|
+
import { mkdir as mkdir29, writeFile as writeFile31 } from "fs/promises";
|
|
368229
368361
|
import * as React61 from "react";
|
|
368230
368362
|
import { jsxDEV as jsxDEV191 } from "react/jsx-dev-runtime";
|
|
368231
368363
|
function MemoryCommand({
|
|
@@ -368239,7 +368371,7 @@ function MemoryCommand({
|
|
|
368239
368371
|
});
|
|
368240
368372
|
}
|
|
368241
368373
|
try {
|
|
368242
|
-
await
|
|
368374
|
+
await writeFile31(memoryPath, "", {
|
|
368243
368375
|
encoding: "utf8",
|
|
368244
368376
|
flag: "wx"
|
|
368245
368377
|
});
|
|
@@ -370883,7 +371015,7 @@ var exports_keybindings = {};
|
|
|
370883
371015
|
__export(exports_keybindings, {
|
|
370884
371016
|
call: () => call32
|
|
370885
371017
|
});
|
|
370886
|
-
import { mkdir as mkdir30, writeFile as
|
|
371018
|
+
import { mkdir as mkdir30, writeFile as writeFile32 } from "fs/promises";
|
|
370887
371019
|
import { dirname as dirname49 } from "path";
|
|
370888
371020
|
async function call32() {
|
|
370889
371021
|
if (!isKeybindingCustomizationEnabled()) {
|
|
@@ -370896,7 +371028,7 @@ async function call32() {
|
|
|
370896
371028
|
let fileExists = false;
|
|
370897
371029
|
await mkdir30(dirname49(keybindingsPath), { recursive: true });
|
|
370898
371030
|
try {
|
|
370899
|
-
await
|
|
371031
|
+
await writeFile32(keybindingsPath, generateKeybindingsTemplate(), {
|
|
370900
371032
|
encoding: "utf-8",
|
|
370901
371033
|
flag: "wx"
|
|
370902
371034
|
});
|
|
@@ -370942,7 +371074,7 @@ var init_keybindings2 = __esm(() => {
|
|
|
370942
371074
|
});
|
|
370943
371075
|
|
|
370944
371076
|
// src/utils/plugins/pluginStartupCheck.ts
|
|
370945
|
-
import { join as
|
|
371077
|
+
import { join as join116 } from "path";
|
|
370946
371078
|
function getPluginEditableScopes() {
|
|
370947
371079
|
const result = new Map;
|
|
370948
371080
|
const addDirPlugins = getAddDirEnabledPlugins();
|
|
@@ -371014,7 +371146,7 @@ async function installSelectedPlugins(pluginsToInstall, onProgress, scope = "use
|
|
|
371014
371146
|
} else {
|
|
371015
371147
|
registerPluginInstallation({
|
|
371016
371148
|
pluginId,
|
|
371017
|
-
installPath:
|
|
371149
|
+
installPath: join116(marketplaceInstallLocation, entry.source),
|
|
371018
371150
|
version: entry.version
|
|
371019
371151
|
}, scope, projectPath);
|
|
371020
371152
|
}
|
|
@@ -371046,7 +371178,7 @@ var init_pluginStartupCheck = __esm(() => {
|
|
|
371046
371178
|
});
|
|
371047
371179
|
|
|
371048
371180
|
// src/services/plugins/pluginOperations.ts
|
|
371049
|
-
import { dirname as dirname50, join as
|
|
371181
|
+
import { dirname as dirname50, join as join117 } from "path";
|
|
371050
371182
|
function assertInstallableScope(scope) {
|
|
371051
371183
|
if (!VALID_INSTALLABLE_SCOPES.includes(scope)) {
|
|
371052
371184
|
throw new Error(`Invalid scope "${scope}". Must be one of: ${VALID_INSTALLABLE_SCOPES.join(", ")}`);
|
|
@@ -371496,7 +371628,7 @@ async function performPluginUpdate({
|
|
|
371496
371628
|
throw e;
|
|
371497
371629
|
}
|
|
371498
371630
|
const marketplaceDir = marketplaceStats.isDirectory() ? marketplaceInstallLocation : dirname50(marketplaceInstallLocation);
|
|
371499
|
-
sourcePath =
|
|
371631
|
+
sourcePath = join117(marketplaceDir, entry.source);
|
|
371500
371632
|
try {
|
|
371501
371633
|
await fs2.stat(sourcePath);
|
|
371502
371634
|
} catch (e) {
|
|
@@ -371511,7 +371643,7 @@ async function performPluginUpdate({
|
|
|
371511
371643
|
throw e;
|
|
371512
371644
|
}
|
|
371513
371645
|
let pluginManifest;
|
|
371514
|
-
const manifestPath =
|
|
371646
|
+
const manifestPath = join117(sourcePath, ".claude-plugin", "plugin.json");
|
|
371515
371647
|
try {
|
|
371516
371648
|
pluginManifest = await loadPluginManifest(manifestPath, entry.name, entry.source);
|
|
371517
371649
|
} catch {}
|
|
@@ -371749,7 +371881,7 @@ var init_lspRecommendation = __esm(() => {
|
|
|
371749
371881
|
});
|
|
371750
371882
|
|
|
371751
371883
|
// src/utils/plugins/officialMarketplaceStartupCheck.ts
|
|
371752
|
-
import { join as
|
|
371884
|
+
import { join as join118 } from "path";
|
|
371753
371885
|
function isOfficialMarketplaceAutoInstallDisabled() {
|
|
371754
371886
|
return isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL);
|
|
371755
371887
|
}
|
|
@@ -371829,7 +371961,7 @@ async function checkAndInstallOfficialMarketplace() {
|
|
|
371829
371961
|
return { installed: false, skipped: true, reason: "policy_blocked" };
|
|
371830
371962
|
}
|
|
371831
371963
|
const cacheDir = getMarketplacesCacheDir();
|
|
371832
|
-
const installLocation =
|
|
371964
|
+
const installLocation = join118(cacheDir, OFFICIAL_MARKETPLACE_NAME);
|
|
371833
371965
|
const gcsSha = await fetchOfficialMarketplaceFromGcs(installLocation, cacheDir);
|
|
371834
371966
|
if (gcsSha !== null) {
|
|
371835
371967
|
const known = await loadKnownMarketplacesConfig();
|
|
@@ -372128,7 +372260,7 @@ __export(exports_lsp, {
|
|
|
372128
372260
|
call: () => call33
|
|
372129
372261
|
});
|
|
372130
372262
|
import { readdir as readdir19, stat as stat37 } from "fs/promises";
|
|
372131
|
-
import { extname as extname11, join as
|
|
372263
|
+
import { extname as extname11, join as join119, resolve as resolve41 } from "path";
|
|
372132
372264
|
async function runLspCommand(args, context2, deps = DEFAULT_DEPS2) {
|
|
372133
372265
|
const { command: command7, rest } = parseCommand3(args);
|
|
372134
372266
|
switch (command7) {
|
|
@@ -372549,7 +372681,7 @@ async function collectFiles(directory, files, depth) {
|
|
|
372549
372681
|
if (files.length >= MAX_DISCOVERY_FILES) {
|
|
372550
372682
|
return;
|
|
372551
372683
|
}
|
|
372552
|
-
const entryPath =
|
|
372684
|
+
const entryPath = join119(directory, entry.name);
|
|
372553
372685
|
if (entry.isDirectory()) {
|
|
372554
372686
|
if (!DISCOVERY_DIRECTORY_IGNORE_SET.has(entry.name)) {
|
|
372555
372687
|
await collectFiles(entryPath, files, depth + 1);
|
|
@@ -384877,10 +385009,10 @@ ${args ? "Additional user input: " + args : ""}
|
|
|
384877
385009
|
});
|
|
384878
385010
|
|
|
384879
385011
|
// src/utils/releaseNotes.ts
|
|
384880
|
-
import { mkdir as mkdir31, readFile as readFile32, writeFile as
|
|
384881
|
-
import { dirname as dirname51, join as
|
|
385012
|
+
import { mkdir as mkdir31, readFile as readFile32, writeFile as writeFile33 } from "fs/promises";
|
|
385013
|
+
import { dirname as dirname51, join as join120 } from "path";
|
|
384882
385014
|
function getChangelogCachePath() {
|
|
384883
|
-
return
|
|
385015
|
+
return join120(getClaudeConfigHomeDir(), "cache", "changelog.md");
|
|
384884
385016
|
}
|
|
384885
385017
|
function sanitizeReleaseNote(note) {
|
|
384886
385018
|
let sanitized = note.replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/`([^`]+)`/g, "$1").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/\*([^*]+)\*/g, "$1").replace(/(^|[\s([{])_([^_\s][^_]*?[^_\s])_(?=$|[\s)\]}:;,.!?])/g, "$1$2").trim();
|
|
@@ -384975,7 +385107,7 @@ async function storeSerializedChangelog(changelogContent) {
|
|
|
384975
385107
|
}
|
|
384976
385108
|
const cachePath = getChangelogCachePath();
|
|
384977
385109
|
await mkdir31(dirname51(cachePath), { recursive: true });
|
|
384978
|
-
await
|
|
385110
|
+
await writeFile33(cachePath, changelogContent, { encoding: "utf-8" });
|
|
384979
385111
|
changelogMemoryCache = changelogContent;
|
|
384980
385112
|
const changelogLastFetched = Date.now();
|
|
384981
385113
|
saveGlobalConfig((current) => ({
|
|
@@ -385594,6 +385726,120 @@ var init_rename2 = __esm(() => {
|
|
|
385594
385726
|
rename_default = rename7;
|
|
385595
385727
|
});
|
|
385596
385728
|
|
|
385729
|
+
// src/utils/sessionPreview.ts
|
|
385730
|
+
function truncateText2(text3, limit) {
|
|
385731
|
+
if (text3.length <= limit)
|
|
385732
|
+
return { text: text3, truncated: false };
|
|
385733
|
+
if (limit <= TRUNCATION_MARKER2.length) {
|
|
385734
|
+
return { text: TRUNCATION_MARKER2.slice(0, limit), truncated: true };
|
|
385735
|
+
}
|
|
385736
|
+
return {
|
|
385737
|
+
text: `${text3.slice(0, limit - TRUNCATION_MARKER2.length)}${TRUNCATION_MARKER2}`,
|
|
385738
|
+
truncated: true
|
|
385739
|
+
};
|
|
385740
|
+
}
|
|
385741
|
+
function boundValue(value, limit, depth = 0, key) {
|
|
385742
|
+
if (typeof value === "string") {
|
|
385743
|
+
const isMetadata = key !== undefined && PRESERVED_STRING_KEYS.has(key);
|
|
385744
|
+
if (!isMetadata && value.length > 0 && limit <= 0) {
|
|
385745
|
+
return { value: TRUNCATION_MARKER2, used: 0, truncated: true };
|
|
385746
|
+
}
|
|
385747
|
+
const result = truncateText2(value, isMetadata ? MAX_PRESERVED_STRING_CHARS : limit);
|
|
385748
|
+
return {
|
|
385749
|
+
value: result.text,
|
|
385750
|
+
used: isMetadata ? 0 : result.text.length,
|
|
385751
|
+
truncated: result.truncated
|
|
385752
|
+
};
|
|
385753
|
+
}
|
|
385754
|
+
if (value === null || typeof value !== "object") {
|
|
385755
|
+
return { value, used: 0, truncated: false };
|
|
385756
|
+
}
|
|
385757
|
+
if (depth >= 6) {
|
|
385758
|
+
return { value: TRUNCATION_MARKER2, used: 0, truncated: true };
|
|
385759
|
+
}
|
|
385760
|
+
if (Array.isArray(value)) {
|
|
385761
|
+
const bounded2 = [];
|
|
385762
|
+
let used2 = 0;
|
|
385763
|
+
let truncated2 = value.length > 64;
|
|
385764
|
+
for (const item of value.slice(0, 64)) {
|
|
385765
|
+
const result = boundValue(item, Math.max(0, limit - used2), depth + 1);
|
|
385766
|
+
bounded2.push(result.value);
|
|
385767
|
+
used2 += result.used;
|
|
385768
|
+
truncated2 ||= result.truncated;
|
|
385769
|
+
}
|
|
385770
|
+
return { value: bounded2, used: used2, truncated: truncated2 };
|
|
385771
|
+
}
|
|
385772
|
+
const bounded = {};
|
|
385773
|
+
let used = 0;
|
|
385774
|
+
let truncated = false;
|
|
385775
|
+
const entries = Object.entries(value);
|
|
385776
|
+
for (const [entryKey, item] of entries.slice(0, 64)) {
|
|
385777
|
+
const result = boundValue(item, Math.max(0, limit - used), depth + 1, entryKey);
|
|
385778
|
+
bounded[entryKey] = result.value;
|
|
385779
|
+
used += result.used;
|
|
385780
|
+
truncated ||= result.truncated;
|
|
385781
|
+
}
|
|
385782
|
+
return {
|
|
385783
|
+
value: bounded,
|
|
385784
|
+
used,
|
|
385785
|
+
truncated: truncated || entries.length > 64
|
|
385786
|
+
};
|
|
385787
|
+
}
|
|
385788
|
+
function boundMessage(message, messageBudget) {
|
|
385789
|
+
const result = boundValue(message, messageBudget);
|
|
385790
|
+
return {
|
|
385791
|
+
message: result.value,
|
|
385792
|
+
truncated: result.truncated,
|
|
385793
|
+
used: result.used
|
|
385794
|
+
};
|
|
385795
|
+
}
|
|
385796
|
+
function createSessionPreview(messages) {
|
|
385797
|
+
const selected = messages.length > SESSION_PREVIEW_MAX_MESSAGES ? [
|
|
385798
|
+
...messages.slice(0, SESSION_PREVIEW_HEAD_MESSAGES),
|
|
385799
|
+
...messages.slice(-SESSION_PREVIEW_TAIL_MESSAGES)
|
|
385800
|
+
] : [...messages];
|
|
385801
|
+
let used = 0;
|
|
385802
|
+
let truncatedMessageCount = 0;
|
|
385803
|
+
const boundedMessages = selected.map((message) => {
|
|
385804
|
+
const remaining = Math.max(0, SESSION_PREVIEW_MAX_TOTAL_CHARS - used);
|
|
385805
|
+
const budget = Math.min(SESSION_PREVIEW_MAX_MESSAGE_CHARS, remaining);
|
|
385806
|
+
const result = boundMessage(message, budget);
|
|
385807
|
+
used += result.used;
|
|
385808
|
+
if (result.truncated)
|
|
385809
|
+
truncatedMessageCount++;
|
|
385810
|
+
return result.message;
|
|
385811
|
+
});
|
|
385812
|
+
return {
|
|
385813
|
+
messages: boundedMessages,
|
|
385814
|
+
omittedMessageCount: Math.max(0, messages.length - selected.length),
|
|
385815
|
+
truncatedMessageCount
|
|
385816
|
+
};
|
|
385817
|
+
}
|
|
385818
|
+
var SESSION_PREVIEW_MAX_MESSAGES = 12, SESSION_PREVIEW_HEAD_MESSAGES = 4, SESSION_PREVIEW_TAIL_MESSAGES = 8, SESSION_PREVIEW_MAX_MESSAGE_CHARS = 4000, SESSION_PREVIEW_MAX_TOTAL_CHARS = 24000, TRUNCATION_MARKER2 = "[message truncated]", PRESERVED_STRING_KEYS, MAX_PRESERVED_STRING_CHARS = 256;
|
|
385819
|
+
var init_sessionPreview = __esm(() => {
|
|
385820
|
+
PRESERVED_STRING_KEYS = new Set([
|
|
385821
|
+
"type",
|
|
385822
|
+
"role",
|
|
385823
|
+
"id",
|
|
385824
|
+
"name",
|
|
385825
|
+
"tool_use_id",
|
|
385826
|
+
"toolUseID",
|
|
385827
|
+
"parentToolUseID",
|
|
385828
|
+
"uuid",
|
|
385829
|
+
"timestamp",
|
|
385830
|
+
"cwd",
|
|
385831
|
+
"userType",
|
|
385832
|
+
"sessionId",
|
|
385833
|
+
"version",
|
|
385834
|
+
"subtype",
|
|
385835
|
+
"level",
|
|
385836
|
+
"displayPath",
|
|
385837
|
+
"path",
|
|
385838
|
+
"filePath",
|
|
385839
|
+
"ideName"
|
|
385840
|
+
]);
|
|
385841
|
+
});
|
|
385842
|
+
|
|
385597
385843
|
// src/utils/set.ts
|
|
385598
385844
|
function every(a2, b) {
|
|
385599
385845
|
for (const item of a2) {
|
|
@@ -388697,6 +388943,7 @@ function SessionPreview(t0) {
|
|
|
388697
388943
|
React83.useEffect(t1, t2);
|
|
388698
388944
|
const isLoading = isLiteLog(log) && fullLog === null;
|
|
388699
388945
|
const displayLog = fullLog ?? log;
|
|
388946
|
+
const preview = createSessionPreview(displayLog.messages);
|
|
388700
388947
|
let t3;
|
|
388701
388948
|
if ($2[3] !== displayLog) {
|
|
388702
388949
|
t3 = getSessionIdFromLog(displayLog) || "";
|
|
@@ -388809,9 +389056,9 @@ function SessionPreview(t0) {
|
|
|
388809
389056
|
t11 = $2[17];
|
|
388810
389057
|
}
|
|
388811
389058
|
let t12;
|
|
388812
|
-
if ($2[18] !== conversationId || $2[19] !==
|
|
389059
|
+
if ($2[18] !== conversationId || $2[19] !== preview.messages) {
|
|
388813
389060
|
t12 = /* @__PURE__ */ jsxDEV233(Messages2, {
|
|
388814
|
-
messages:
|
|
389061
|
+
messages: preview.messages,
|
|
388815
389062
|
tools,
|
|
388816
389063
|
commands: t8,
|
|
388817
389064
|
verbose: true,
|
|
@@ -388822,11 +389069,10 @@ function SessionPreview(t0) {
|
|
|
388822
389069
|
conversationId,
|
|
388823
389070
|
screen: "transcript",
|
|
388824
389071
|
streamingToolUses: t11,
|
|
388825
|
-
showAllInTranscript: true,
|
|
388826
389072
|
isLoading: false
|
|
388827
389073
|
}, undefined, false, undefined, this);
|
|
388828
389074
|
$2[18] = conversationId;
|
|
388829
|
-
$2[19] =
|
|
389075
|
+
$2[19] = preview.messages;
|
|
388830
389076
|
$2[20] = t12;
|
|
388831
389077
|
} else {
|
|
388832
389078
|
t12 = $2[20];
|
|
@@ -388940,6 +389186,14 @@ function SessionPreview(t0) {
|
|
|
388940
389186
|
flexDirection: "column",
|
|
388941
389187
|
marginTop: 1,
|
|
388942
389188
|
children: t12
|
|
389189
|
+
}, undefined, false, undefined, this),
|
|
389190
|
+
preview.omittedMessageCount > 0 && /* @__PURE__ */ jsxDEV233(ThemedText, {
|
|
389191
|
+
dimColor: true,
|
|
389192
|
+
children: `… ${preview.omittedMessageCount} messages omitted …`
|
|
389193
|
+
}, undefined, false, undefined, this),
|
|
389194
|
+
preview.truncatedMessageCount > 0 && /* @__PURE__ */ jsxDEV233(ThemedText, {
|
|
389195
|
+
dimColor: true,
|
|
389196
|
+
children: "[message truncated]"
|
|
388943
389197
|
}, undefined, false, undefined, this)
|
|
388944
389198
|
]
|
|
388945
389199
|
}, undefined, true, undefined, this),
|
|
@@ -388975,6 +389229,7 @@ var init_SessionPreview = __esm(() => {
|
|
|
388975
389229
|
init_tools2();
|
|
388976
389230
|
init_format2();
|
|
388977
389231
|
init_sessionStorage();
|
|
389232
|
+
init_sessionPreview();
|
|
388978
389233
|
init_ConfigurableShortcutHint();
|
|
388979
389234
|
init_Byline();
|
|
388980
389235
|
init_KeyboardShortcutHint();
|
|
@@ -391333,10 +391588,10 @@ __export(exports_replayIndex, {
|
|
|
391333
391588
|
loadReplayIndex: () => loadReplayIndex,
|
|
391334
391589
|
fileExists: () => fileExists
|
|
391335
391590
|
});
|
|
391336
|
-
import { chmod as chmod10, readFile as readFile33, writeFile as
|
|
391337
|
-
import { join as
|
|
391591
|
+
import { chmod as chmod10, readFile as readFile33, writeFile as writeFile34, stat as stat38 } from "fs/promises";
|
|
391592
|
+
import { join as join121, dirname as dirname52 } from "path";
|
|
391338
391593
|
function getReplayIndexPath(sessionId, transcriptPath) {
|
|
391339
|
-
return
|
|
391594
|
+
return join121(dirname52(transcriptPath), `${sessionId}.replay.json`);
|
|
391340
391595
|
}
|
|
391341
391596
|
async function fileExists(path14) {
|
|
391342
391597
|
try {
|
|
@@ -391408,7 +391663,7 @@ async function writeReplayIndex(sessionId, transcriptPath, index) {
|
|
|
391408
391663
|
const { mkdir: mkdir32 } = await import("fs/promises");
|
|
391409
391664
|
await mkdir32(dir, { recursive: true, mode: 448 });
|
|
391410
391665
|
}
|
|
391411
|
-
await
|
|
391666
|
+
await writeFile34(replayPath, JSON.stringify(index, null, 2), {
|
|
391412
391667
|
encoding: "utf-8",
|
|
391413
391668
|
mode: 384
|
|
391414
391669
|
});
|
|
@@ -395480,8 +395735,15 @@ Examples:
|
|
|
395480
395735
|
/set-context-window gpt-4o 200000
|
|
395481
395736
|
/set-context-window status
|
|
395482
395737
|
|
|
395483
|
-
The override takes precedence over
|
|
395484
|
-
|
|
395738
|
+
The override takes precedence over discovery, catalog, and provider defaults
|
|
395739
|
+
for this session only. Use /clear-context-window to remove it.
|
|
395740
|
+
|
|
395741
|
+
For a permanent override (survives restart), use modelLimits in settings.json
|
|
395742
|
+
for custom/discovered models, for example:
|
|
395743
|
+
{ "modelLimits": { "my-model": { "contextWindow": 1000000 } } }
|
|
395744
|
+
For a catalogued model, use an exact CLAUDE_CODE_OPENAI_CONTEXT_WINDOWS entry;
|
|
395745
|
+
catalog values take precedence over modelLimits and prefix env entries.
|
|
395746
|
+
See docs/advanced-setup.md (Per-model limit overrides).`, call48 = async (args, context2) => {
|
|
395485
395747
|
const trimmed = args.trim();
|
|
395486
395748
|
if (!trimmed || trimmed === "help" || trimmed === "-h" || trimmed === "--help") {
|
|
395487
395749
|
return { type: "text", value: HELP };
|
|
@@ -395551,7 +395813,7 @@ var init_share = __esm(() => {
|
|
|
395551
395813
|
|
|
395552
395814
|
// src/utils/openclaudeDisplayPaths.ts
|
|
395553
395815
|
import { homedir as homedir28 } from "os";
|
|
395554
|
-
import { join as
|
|
395816
|
+
import { join as join123 } from "path";
|
|
395555
395817
|
function getUserConfigHomeForDisplay() {
|
|
395556
395818
|
const configDirEnv = resolveConfigDirEnv({
|
|
395557
395819
|
openClaudeConfigDir: process.env.OPENCLAUDE_CONFIG_DIR
|
|
@@ -395565,10 +395827,10 @@ function getUserConfigHomeForDisplay() {
|
|
|
395565
395827
|
return getClaudeConfigHomeDir();
|
|
395566
395828
|
}
|
|
395567
395829
|
function getUserSettingsDisplayPath2() {
|
|
395568
|
-
return getDisplayPath(
|
|
395830
|
+
return getDisplayPath(join123(getUserConfigHomeForDisplay(), "settings.json"));
|
|
395569
395831
|
}
|
|
395570
395832
|
function getUserSkillExampleDisplayPath() {
|
|
395571
|
-
return getDisplayPath(
|
|
395833
|
+
return getDisplayPath(join123(getUserConfigHomeForDisplay(), "skills", "<name>", "SKILL.md"));
|
|
395572
395834
|
}
|
|
395573
395835
|
var init_openclaudeDisplayPaths = __esm(() => {
|
|
395574
395836
|
init_envUtils();
|
|
@@ -402553,7 +402815,7 @@ __export(exports_thinkback, {
|
|
|
402553
402815
|
call: () => call56
|
|
402554
402816
|
});
|
|
402555
402817
|
import { readFile as readFile35 } from "fs/promises";
|
|
402556
|
-
import { join as
|
|
402818
|
+
import { join as join124 } from "path";
|
|
402557
402819
|
import { useEffect as useEffect73, useState as useState85 } from "react";
|
|
402558
402820
|
import { jsxDEV as jsxDEV265 } from "react/jsx-dev-runtime";
|
|
402559
402821
|
function getMarketplaceName() {
|
|
@@ -402573,15 +402835,15 @@ async function getThinkbackSkillDir() {
|
|
|
402573
402835
|
if (!thinkbackPlugin) {
|
|
402574
402836
|
return null;
|
|
402575
402837
|
}
|
|
402576
|
-
const skillDir =
|
|
402838
|
+
const skillDir = join124(thinkbackPlugin.path, "skills", SKILL_NAME);
|
|
402577
402839
|
if (await pathExists(skillDir)) {
|
|
402578
402840
|
return skillDir;
|
|
402579
402841
|
}
|
|
402580
402842
|
return null;
|
|
402581
402843
|
}
|
|
402582
402844
|
async function playAnimation(skillDir) {
|
|
402583
|
-
const dataPath =
|
|
402584
|
-
const playerPath =
|
|
402845
|
+
const dataPath = join124(skillDir, "year_in_review.js");
|
|
402846
|
+
const playerPath = join124(skillDir, "player.js");
|
|
402585
402847
|
try {
|
|
402586
402848
|
await readFile35(dataPath);
|
|
402587
402849
|
} catch (e) {
|
|
@@ -402629,7 +402891,7 @@ async function playAnimation(skillDir) {
|
|
|
402629
402891
|
} catch {} finally {
|
|
402630
402892
|
inkInstance.exitAlternateScreen();
|
|
402631
402893
|
}
|
|
402632
|
-
const htmlPath =
|
|
402894
|
+
const htmlPath = join124(skillDir, "year_in_review.html");
|
|
402633
402895
|
if (await pathExists(htmlPath)) {
|
|
402634
402896
|
const platform5 = getPlatform();
|
|
402635
402897
|
const openCmd = platform5 === "macos" ? "open" : platform5 === "windows" ? "start" : "xdg-open";
|
|
@@ -402965,7 +403227,7 @@ function ThinkbackFlow(t0) {
|
|
|
402965
403227
|
if (!skillDir) {
|
|
402966
403228
|
return;
|
|
402967
403229
|
}
|
|
402968
|
-
const dataPath =
|
|
403230
|
+
const dataPath = join124(skillDir, "year_in_review.js");
|
|
402969
403231
|
pathExists(dataPath).then((exists) => {
|
|
402970
403232
|
logForDebugging(`Checking for ${dataPath}: ${exists ? "found" : "not found"}`);
|
|
402971
403233
|
setHasGenerated(exists);
|
|
@@ -403137,7 +403399,7 @@ var exports_thinkback_play = {};
|
|
|
403137
403399
|
__export(exports_thinkback_play, {
|
|
403138
403400
|
call: () => call57
|
|
403139
403401
|
});
|
|
403140
|
-
import { join as
|
|
403402
|
+
import { join as join125 } from "path";
|
|
403141
403403
|
function getPluginId2() {
|
|
403142
403404
|
const marketplaceName = process.env.USER_TYPE === "ant" ? INTERNAL_MARKETPLACE_NAME : OFFICIAL_MARKETPLACE_NAME;
|
|
403143
403405
|
return `thinkback@${marketplaceName}`;
|
|
@@ -403159,7 +403421,7 @@ async function call57() {
|
|
|
403159
403421
|
value: "Thinkback plugin installation path not found."
|
|
403160
403422
|
};
|
|
403161
403423
|
}
|
|
403162
|
-
const skillDir =
|
|
403424
|
+
const skillDir = join125(firstInstall.installPath, "skills", SKILL_NAME2);
|
|
403163
403425
|
const result = await playAnimation(skillDir);
|
|
403164
403426
|
return { type: "text", value: result.message };
|
|
403165
403427
|
}
|
|
@@ -411612,8 +411874,8 @@ __export(exports_branch, {
|
|
|
411612
411874
|
call: () => call66
|
|
411613
411875
|
});
|
|
411614
411876
|
import { randomUUID as randomUUID29 } from "crypto";
|
|
411615
|
-
import { mkdir as mkdir33, stat as stat40, writeFile as
|
|
411616
|
-
import { dirname as dirname54, join as
|
|
411877
|
+
import { mkdir as mkdir33, stat as stat40, writeFile as writeFile36 } from "fs/promises";
|
|
411878
|
+
import { dirname as dirname54, join as join126 } from "path";
|
|
411617
411879
|
function findLegacyForkRootSessionId(entries) {
|
|
411618
411880
|
const legacyFork = entries.findLast((entry) => {
|
|
411619
411881
|
const forkedFrom = entry.forkedFrom;
|
|
@@ -411711,7 +411973,7 @@ async function createFork(customTitle, currentMessages) {
|
|
|
411711
411973
|
const originalSessionId = getSessionId();
|
|
411712
411974
|
const currentTranscriptPath = getTranscriptPath();
|
|
411713
411975
|
const transcriptDir = dirname54(currentTranscriptPath);
|
|
411714
|
-
const forkSessionPath =
|
|
411976
|
+
const forkSessionPath = join126(transcriptDir, `${forkSessionId}.jsonl`);
|
|
411715
411977
|
await mkdir33(transcriptDir, { recursive: true, mode: 448 });
|
|
411716
411978
|
await flushSessionStorage();
|
|
411717
411979
|
let transcriptSize;
|
|
@@ -411808,7 +412070,7 @@ async function createFork(customTitle, currentMessages) {
|
|
|
411808
412070
|
};
|
|
411809
412071
|
lines.push(jsonStringify(forkedReplacementEntry));
|
|
411810
412072
|
}
|
|
411811
|
-
await
|
|
412073
|
+
await writeFile36(forkSessionPath, lines.join(`
|
|
411812
412074
|
`) + `
|
|
411813
412075
|
`, {
|
|
411814
412076
|
encoding: "utf8",
|
|
@@ -412427,7 +412689,7 @@ var init_types10 = __esm(() => {
|
|
|
412427
412689
|
|
|
412428
412690
|
// src/components/agents/agentFileUtils.ts
|
|
412429
412691
|
import { mkdir as mkdir34, open as open13, unlink as unlink19 } from "fs/promises";
|
|
412430
|
-
import { join as
|
|
412692
|
+
import { join as join127, relative as relative25 } from "path";
|
|
412431
412693
|
function formatAgentAsMarkdown(agentType, whenToUse, tools, systemPrompt, color3, model, memory2, effort) {
|
|
412432
412694
|
const whenToUseStr = typeof whenToUse === "string" ? whenToUse : "";
|
|
412433
412695
|
const escapedWhenToUse = whenToUseStr.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\\\n");
|
|
@@ -412455,26 +412717,26 @@ function getAgentDirectoryPath(location) {
|
|
|
412455
412717
|
case "flagSettings":
|
|
412456
412718
|
throw new Error(`Cannot get directory path for ${location} agents`);
|
|
412457
412719
|
case "userSettings":
|
|
412458
|
-
return
|
|
412720
|
+
return join127(getClaudeConfigHomeDir(), AGENT_PATHS.AGENTS_DIR);
|
|
412459
412721
|
case "projectSettings":
|
|
412460
|
-
return
|
|
412722
|
+
return join127(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
412461
412723
|
case "policySettings":
|
|
412462
|
-
return
|
|
412724
|
+
return join127(getManagedFilePath(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
412463
412725
|
case "localSettings":
|
|
412464
|
-
return
|
|
412726
|
+
return join127(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
412465
412727
|
}
|
|
412466
412728
|
}
|
|
412467
412729
|
function getRelativeAgentDirectoryPath(location) {
|
|
412468
412730
|
switch (location) {
|
|
412469
412731
|
case "projectSettings":
|
|
412470
|
-
return
|
|
412732
|
+
return join127(".", AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
412471
412733
|
default:
|
|
412472
412734
|
return getAgentDirectoryPath(location);
|
|
412473
412735
|
}
|
|
412474
412736
|
}
|
|
412475
412737
|
function getNewAgentFilePath(agent) {
|
|
412476
412738
|
const dirPath = getAgentDirectoryPath(agent.source);
|
|
412477
|
-
return
|
|
412739
|
+
return join127(dirPath, `${agent.agentType}.md`);
|
|
412478
412740
|
}
|
|
412479
412741
|
function getActualAgentFilePath(agent) {
|
|
412480
412742
|
if (agent.source === "built-in") {
|
|
@@ -412488,14 +412750,14 @@ function getActualAgentFilePath(agent) {
|
|
|
412488
412750
|
}
|
|
412489
412751
|
const dirPath = agent.baseDir || getAgentDirectoryPath(agent.source);
|
|
412490
412752
|
const filename = agent.filename || agent.agentType;
|
|
412491
|
-
return
|
|
412753
|
+
return join127(dirPath, `${filename}.md`);
|
|
412492
412754
|
}
|
|
412493
412755
|
function getNewRelativeAgentFilePath(agent) {
|
|
412494
412756
|
if (agent.source === "built-in") {
|
|
412495
412757
|
return "Built-in";
|
|
412496
412758
|
}
|
|
412497
412759
|
const dirPath = getRelativeAgentDirectoryPath(agent.source);
|
|
412498
|
-
return
|
|
412760
|
+
return join127(dirPath, `${agent.agentType}.md`);
|
|
412499
412761
|
}
|
|
412500
412762
|
function getActualRelativeAgentFilePath(agent) {
|
|
412501
412763
|
if (isBuiltInAgent(agent)) {
|
|
@@ -412510,9 +412772,9 @@ function getActualRelativeAgentFilePath(agent) {
|
|
|
412510
412772
|
if (agent.source === "sdk") {
|
|
412511
412773
|
return "SDK agent";
|
|
412512
412774
|
}
|
|
412513
|
-
const dirPath = agent.baseDir && (agent.source === "projectSettings" || agent.source === "localSettings" || agent.source === "policySettings") ?
|
|
412775
|
+
const dirPath = agent.baseDir && (agent.source === "projectSettings" || agent.source === "localSettings" || agent.source === "policySettings") ? join127(".", relative25(getCwd(), agent.baseDir)) : getRelativeAgentDirectoryPath(agent.source);
|
|
412514
412776
|
const filename = agent.filename || agent.agentType;
|
|
412515
|
-
return
|
|
412777
|
+
return join127(dirPath, `${filename}.md`);
|
|
412516
412778
|
}
|
|
412517
412779
|
async function ensureAgentDirectoryExists(source) {
|
|
412518
412780
|
const dirPath = getAgentDirectoryPath(source);
|
|
@@ -413491,7 +413753,7 @@ function _resetForTesting2() {
|
|
|
413491
413753
|
var autoModeActive = false, autoModeFlagCli = false, autoModeCircuitBroken = false;
|
|
413492
413754
|
|
|
413493
413755
|
// src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.ts
|
|
413494
|
-
import { writeFile as
|
|
413756
|
+
import { writeFile as writeFile37 } from "fs/promises";
|
|
413495
413757
|
var autoModeStateModule, permissionSetupModule, allowedPromptSchema, inputSchema18, _sdkInputSchema, outputSchema15, ExitPlanModeV2Tool;
|
|
413496
413758
|
var init_ExitPlanModeV2Tool = __esm(() => {
|
|
413497
413759
|
init_v4();
|
|
@@ -413608,7 +413870,7 @@ var init_ExitPlanModeV2Tool = __esm(() => {
|
|
|
413608
413870
|
const plan2 = inputPlan ?? getPlan(context2.agentId);
|
|
413609
413871
|
if (inputPlan !== undefined && filePath) {
|
|
413610
413872
|
try {
|
|
413611
|
-
await
|
|
413873
|
+
await writeFile37(filePath, inputPlan, "utf-8");
|
|
413612
413874
|
} catch (e) {
|
|
413613
413875
|
logError2(`Failed to write plan to ${filePath}: ${e}`);
|
|
413614
413876
|
throw e;
|
|
@@ -427162,7 +427424,7 @@ var init_GenerateStep = __esm(() => {
|
|
|
427162
427424
|
});
|
|
427163
427425
|
|
|
427164
427426
|
// src/components/agents/new-agent-creation/wizard-steps/LocationStep.tsx
|
|
427165
|
-
import { join as
|
|
427427
|
+
import { join as join128 } from "path";
|
|
427166
427428
|
import { jsxDEV as jsxDEV313 } from "react/jsx-dev-runtime";
|
|
427167
427429
|
function LocationStep() {
|
|
427168
427430
|
const $2 = import_react_compiler_runtime228.c(11);
|
|
@@ -427182,7 +427444,7 @@ function LocationStep() {
|
|
|
427182
427444
|
t0 = $2[0];
|
|
427183
427445
|
}
|
|
427184
427446
|
const locationOptions = [t0, {
|
|
427185
|
-
label: `Personal (${
|
|
427447
|
+
label: `Personal (${join128(getClaudeConfigHomeDir(), "agents")})`,
|
|
427186
427448
|
value: "userSettings"
|
|
427187
427449
|
}];
|
|
427188
427450
|
let t2;
|
|
@@ -429362,10 +429624,10 @@ var init_AddMarketplace = __esm(() => {
|
|
|
429362
429624
|
|
|
429363
429625
|
// src/utils/plugins/installCounts.ts
|
|
429364
429626
|
import { randomBytes as randomBytes16 } from "crypto";
|
|
429365
|
-
import { readFile as readFile36, rename as rename8, unlink as unlink20, writeFile as
|
|
429366
|
-
import { join as
|
|
429627
|
+
import { readFile as readFile36, rename as rename8, unlink as unlink20, writeFile as writeFile38 } from "fs/promises";
|
|
429628
|
+
import { join as join129 } from "path";
|
|
429367
429629
|
function getInstallCountsCachePath() {
|
|
429368
|
-
return
|
|
429630
|
+
return join129(getPluginsDirectory(), INSTALL_COUNTS_CACHE_FILENAME);
|
|
429369
429631
|
}
|
|
429370
429632
|
async function loadInstallCountsCache() {
|
|
429371
429633
|
const cachePath = getInstallCountsCachePath();
|
|
@@ -429420,7 +429682,7 @@ async function saveInstallCountsCache(cache3) {
|
|
|
429420
429682
|
const pluginsDir = getPluginsDirectory();
|
|
429421
429683
|
await getFsImplementation().mkdir(pluginsDir);
|
|
429422
429684
|
const content = jsonStringify(cache3, null, 2);
|
|
429423
|
-
await
|
|
429685
|
+
await writeFile38(tempPath, content, {
|
|
429424
429686
|
encoding: "utf-8",
|
|
429425
429687
|
mode: 384
|
|
429426
429688
|
});
|
|
@@ -433183,10 +433445,10 @@ var init_ManageMarketplaces = __esm(() => {
|
|
|
433183
433445
|
|
|
433184
433446
|
// src/utils/plugins/pluginFlagging.ts
|
|
433185
433447
|
import { randomBytes as randomBytes17 } from "crypto";
|
|
433186
|
-
import { readFile as readFile37, rename as rename9, unlink as unlink21, writeFile as
|
|
433187
|
-
import { join as
|
|
433448
|
+
import { readFile as readFile37, rename as rename9, unlink as unlink21, writeFile as writeFile39 } from "fs/promises";
|
|
433449
|
+
import { join as join130 } from "path";
|
|
433188
433450
|
function getFlaggedPluginsPath() {
|
|
433189
|
-
return
|
|
433451
|
+
return join130(getPluginsDirectory(), FLAGGED_PLUGINS_FILENAME);
|
|
433190
433452
|
}
|
|
433191
433453
|
function parsePluginsData(content) {
|
|
433192
433454
|
const parsed = jsonParse(content);
|
|
@@ -433224,7 +433486,7 @@ async function writeToDisk(plugins) {
|
|
|
433224
433486
|
try {
|
|
433225
433487
|
await getFsImplementation().mkdir(getPluginsDirectory());
|
|
433226
433488
|
const content = jsonStringify({ plugins }, null, 2);
|
|
433227
|
-
await
|
|
433489
|
+
await writeFile39(tempPath, content, {
|
|
433228
433490
|
encoding: "utf-8",
|
|
433229
433491
|
mode: 384
|
|
433230
433492
|
});
|
|
@@ -438304,7 +438566,7 @@ import {
|
|
|
438304
438566
|
rmSync as removeLockSync
|
|
438305
438567
|
} from "node:fs";
|
|
438306
438568
|
import { hostname as hostname3 } from "node:os";
|
|
438307
|
-
import { dirname as dirname56, join as
|
|
438569
|
+
import { dirname as dirname56, join as join133, resolve as resolve44 } from "node:path";
|
|
438308
438570
|
function sameIdentity(left, right) {
|
|
438309
438571
|
if (left.version === right.version && left.host === right.host && left.pid === right.pid && left.token === right.token) {
|
|
438310
438572
|
return left.version === 1 || right.version === 2 && left.processStartId === right.processStartId;
|
|
@@ -438314,7 +438576,7 @@ function sameIdentity(left, right) {
|
|
|
438314
438576
|
function readLockIdentity(lockPath2) {
|
|
438315
438577
|
let raw;
|
|
438316
438578
|
try {
|
|
438317
|
-
raw = getFsImplementation().readFileSync(
|
|
438579
|
+
raw = getFsImplementation().readFileSync(join133(lockPath2, SETTINGS_LOCK_OWNER_FILE), { encoding: "utf8" });
|
|
438318
438580
|
} catch (error40) {
|
|
438319
438581
|
if (getErrnoCode(error40) !== "ENOENT")
|
|
438320
438582
|
return { state: "invalid" };
|
|
@@ -438461,7 +438723,7 @@ function preparePendingLock(lockPath2, owner) {
|
|
|
438461
438723
|
const pendingPath = pendingLockPath(lockPath2, owner);
|
|
438462
438724
|
mkdirExclusiveSync(pendingPath, { mode: 448 });
|
|
438463
438725
|
try {
|
|
438464
|
-
writeFileSyncAndFlush_DEPRECATED(
|
|
438726
|
+
writeFileSyncAndFlush_DEPRECATED(join133(pendingPath, SETTINGS_LOCK_OWNER_FILE), JSON.stringify(owner), { encoding: "utf8", mode: 384 });
|
|
438465
438727
|
} catch (error40) {
|
|
438466
438728
|
removePendingLock(pendingPath);
|
|
438467
438729
|
throw error40;
|
|
@@ -438730,8 +438992,8 @@ var init_rewind = __esm(() => {
|
|
|
438730
438992
|
|
|
438731
438993
|
// src/utils/heapDumpService.ts
|
|
438732
438994
|
import { createWriteStream as createWriteStream5, writeFileSync as writeFileSync10 } from "fs";
|
|
438733
|
-
import { readdir as readdir22, readFile as readFile40, writeFile as
|
|
438734
|
-
import { join as
|
|
438995
|
+
import { readdir as readdir22, readFile as readFile40, writeFile as writeFile40 } from "fs/promises";
|
|
438996
|
+
import { join as join134 } from "path";
|
|
438735
438997
|
import { pipeline as pipeline3 } from "stream/promises";
|
|
438736
438998
|
import {
|
|
438737
438999
|
getHeapSnapshot,
|
|
@@ -438758,8 +439020,8 @@ function getHeapDumpAnalyticsMetadata(trigger, effectiveDumpNumber, success2) {
|
|
|
438758
439020
|
function getHeapDumpFilePaths(sessionId, dumpDir, effectiveDumpNumber) {
|
|
438759
439021
|
const suffix = effectiveDumpNumber > 0 ? `-dump${effectiveDumpNumber}` : "";
|
|
438760
439022
|
return {
|
|
438761
|
-
heapPath:
|
|
438762
|
-
diagPath:
|
|
439023
|
+
heapPath: join134(dumpDir, `${sessionId}${suffix}.heapsnapshot`),
|
|
439024
|
+
diagPath: join134(dumpDir, `${sessionId}${suffix}-diagnostics.json`)
|
|
438763
439025
|
};
|
|
438764
439026
|
}
|
|
438765
439027
|
async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
@@ -438845,7 +439107,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
438845
439107
|
smapsRollup,
|
|
438846
439108
|
platform: process.platform,
|
|
438847
439109
|
nodeVersion: process.version,
|
|
438848
|
-
ccVersion: "0.30.
|
|
439110
|
+
ccVersion: "0.30.2-by-rayss"
|
|
438849
439111
|
};
|
|
438850
439112
|
}
|
|
438851
439113
|
async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
@@ -438863,7 +439125,7 @@ async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
|
438863
439125
|
const dumpDir = getDesktopPath();
|
|
438864
439126
|
await getFsImplementation().mkdir(dumpDir);
|
|
438865
439127
|
const { heapPath, diagPath } = getHeapDumpFilePaths(sessionId, dumpDir, effectiveDumpNumber);
|
|
438866
|
-
await
|
|
439128
|
+
await writeFile40(diagPath, jsonStringify(diagnostics2, null, 2), {
|
|
438867
439129
|
mode: 384
|
|
438868
439130
|
});
|
|
438869
439131
|
logForDebugging(`[HeapDump] Diagnostics written to ${diagPath}`);
|
|
@@ -439112,7 +439374,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
439112
439374
|
var call73 = async () => {
|
|
439113
439375
|
return {
|
|
439114
439376
|
type: "text",
|
|
439115
|
-
value: `${"0.30.
|
|
439377
|
+
value: `${"0.30.2-by-rayss"} (built ${"2026-09-05T03:58:56.896Z"})`
|
|
439116
439378
|
};
|
|
439117
439379
|
}, version2, version_default;
|
|
439118
439380
|
var init_version2 = __esm(() => {
|
|
@@ -439130,7 +439392,7 @@ var init_version2 = __esm(() => {
|
|
|
439130
439392
|
// src/utils/globalPackageManager.ts
|
|
439131
439393
|
import { realpath as realpath12 } from "node:fs/promises";
|
|
439132
439394
|
import { homedir as homedir30 } from "node:os";
|
|
439133
|
-
import { join as
|
|
439395
|
+
import { join as join135, resolve as resolve45, sep as sep30 } from "node:path";
|
|
439134
439396
|
function isUnder(child, parent) {
|
|
439135
439397
|
const p = resolve45(parent);
|
|
439136
439398
|
const c6 = resolve45(child);
|
|
@@ -439180,11 +439442,11 @@ async function getGlobalRoot(pm) {
|
|
|
439180
439442
|
}
|
|
439181
439443
|
case "yarn": {
|
|
439182
439444
|
const r = await execFileNoThrowWithCwd("yarn", ["global", "dir"], opts);
|
|
439183
|
-
return r.code === 0 && r.stdout.trim() ?
|
|
439445
|
+
return r.code === 0 && r.stdout.trim() ? join135(r.stdout.trim(), "node_modules") : null;
|
|
439184
439446
|
}
|
|
439185
439447
|
case "bun": {
|
|
439186
|
-
const bunInstall = process.env.BUN_INSTALL ||
|
|
439187
|
-
return
|
|
439448
|
+
const bunInstall = process.env.BUN_INSTALL || join135(homedir30(), ".bun");
|
|
439449
|
+
return join135(bunInstall, "install", "global", "node_modules");
|
|
439188
439450
|
}
|
|
439189
439451
|
}
|
|
439190
439452
|
} catch (error40) {
|
|
@@ -439678,7 +439940,7 @@ async function call74(onDone, _context, args) {
|
|
|
439678
439940
|
}, undefined, false, undefined, this));
|
|
439679
439941
|
return null;
|
|
439680
439942
|
}
|
|
439681
|
-
var PACKAGE_URL = "@rayss-dev/openclaude", CURRENT_VERSION = "0.30.
|
|
439943
|
+
var PACKAGE_URL = "@rayss-dev/openclaude", CURRENT_VERSION = "0.30.2-by-rayss";
|
|
439682
439944
|
var init_update = __esm(() => {
|
|
439683
439945
|
init_StatusIcon();
|
|
439684
439946
|
init_ink2();
|
|
@@ -439706,25 +439968,25 @@ var init_update2 = __esm(() => {
|
|
|
439706
439968
|
});
|
|
439707
439969
|
|
|
439708
439970
|
// src/services/wiki/paths.ts
|
|
439709
|
-
import { join as
|
|
439971
|
+
import { join as join136 } from "path";
|
|
439710
439972
|
function getWikiPaths(cwd2) {
|
|
439711
|
-
const root2 =
|
|
439973
|
+
const root2 = join136(cwd2, OPENCLAUDE_DIRNAME, WIKI_DIRNAME);
|
|
439712
439974
|
return {
|
|
439713
439975
|
root: root2,
|
|
439714
|
-
pagesDir:
|
|
439715
|
-
sourcesDir:
|
|
439716
|
-
schemaFile:
|
|
439717
|
-
indexFile:
|
|
439718
|
-
logFile:
|
|
439719
|
-
conventionsFile:
|
|
439720
|
-
conventionsCacheFile:
|
|
439976
|
+
pagesDir: join136(root2, "pages"),
|
|
439977
|
+
sourcesDir: join136(root2, "sources"),
|
|
439978
|
+
schemaFile: join136(root2, "schema.md"),
|
|
439979
|
+
indexFile: join136(root2, "index.md"),
|
|
439980
|
+
logFile: join136(root2, "log.md"),
|
|
439981
|
+
conventionsFile: join136(root2, "pages", "conventions.md"),
|
|
439982
|
+
conventionsCacheFile: join136(cwd2, OPENCLAUDE_DIRNAME, ".conventions-cache.json")
|
|
439721
439983
|
};
|
|
439722
439984
|
}
|
|
439723
439985
|
var OPENCLAUDE_DIRNAME = ".openclaude", WIKI_DIRNAME = "wiki";
|
|
439724
439986
|
var init_paths2 = () => {};
|
|
439725
439987
|
|
|
439726
439988
|
// src/services/wiki/init.ts
|
|
439727
|
-
import { mkdir as mkdir35, writeFile as
|
|
439989
|
+
import { mkdir as mkdir35, writeFile as writeFile41 } from "fs/promises";
|
|
439728
439990
|
import { basename as basename43, relative as relative26 } from "path";
|
|
439729
439991
|
function buildSchemaTemplate(projectName) {
|
|
439730
439992
|
return `# OpenClaude Wiki Schema
|
|
@@ -439835,7 +440097,7 @@ Auto-detected conventions for ${projectName}.
|
|
|
439835
440097
|
}
|
|
439836
440098
|
async function ensureFile(filePath, content, createdFiles) {
|
|
439837
440099
|
try {
|
|
439838
|
-
await
|
|
440100
|
+
await writeFile41(filePath, content, { encoding: "utf8", flag: "wx" });
|
|
439839
440101
|
createdFiles.push(filePath);
|
|
439840
440102
|
} catch (error40) {
|
|
439841
440103
|
if (typeof error40 === "object" && error40 !== null && "code" in error40 && error40.code === "EEXIST") {
|
|
@@ -439871,7 +440133,7 @@ var init_init2 = __esm(() => {
|
|
|
439871
440133
|
});
|
|
439872
440134
|
|
|
439873
440135
|
// src/services/wiki/indexBuilder.ts
|
|
439874
|
-
import { readdir as readdir23, readFile as readFile41, writeFile as
|
|
440136
|
+
import { readdir as readdir23, readFile as readFile41, writeFile as writeFile42 } from "fs/promises";
|
|
439875
440137
|
import { basename as basename44, relative as relative27 } from "path";
|
|
439876
440138
|
async function listMarkdownFiles(dir) {
|
|
439877
440139
|
const entries = await readdir23(dir, { withFileTypes: true });
|
|
@@ -439924,7 +440186,7 @@ ${sourceLinks.length > 0 ? sourceLinks.join(`
|
|
|
439924
440186
|
|
|
439925
440187
|
- See [log.md](./log.md)
|
|
439926
440188
|
`;
|
|
439927
|
-
await
|
|
440189
|
+
await writeFile42(paths2.indexFile, content, "utf8");
|
|
439928
440190
|
}
|
|
439929
440191
|
var init_indexBuilder = __esm(() => {
|
|
439930
440192
|
init_paths2();
|
|
@@ -439954,7 +440216,7 @@ function extractTitleFromText(fallbackName, content) {
|
|
|
439954
440216
|
}
|
|
439955
440217
|
|
|
439956
440218
|
// src/services/wiki/ingest.ts
|
|
439957
|
-
import { appendFile as appendFile4, readFile as readFile42, stat as stat43, writeFile as
|
|
440219
|
+
import { appendFile as appendFile4, readFile as readFile42, stat as stat43, writeFile as writeFile43 } from "fs/promises";
|
|
439958
440220
|
import { basename as basename45, extname as extname12, isAbsolute as isAbsolute28, relative as relative28, resolve as resolve46 } from "path";
|
|
439959
440221
|
function buildSourceNote(params) {
|
|
439960
440222
|
const { title, sourcePath, ingestedAt, summary, excerpt } = params;
|
|
@@ -440002,7 +440264,7 @@ async function ingestLocalWikiSource(cwd2, rawPath) {
|
|
|
440002
440264
|
const slug = sanitizeWikiSlug(`${baseName}-${Date.now()}`) || `source-${Date.now()}`;
|
|
440003
440265
|
const paths2 = getWikiPaths(cwd2);
|
|
440004
440266
|
const sourceNotePath = `${paths2.sourcesDir}/${slug}.md`;
|
|
440005
|
-
await
|
|
440267
|
+
await writeFile43(sourceNotePath, buildSourceNote({
|
|
440006
440268
|
title,
|
|
440007
440269
|
sourcePath: relSourcePath,
|
|
440008
440270
|
ingestedAt,
|
|
@@ -440200,7 +440462,7 @@ var init_identity2 = __esm(() => {
|
|
|
440200
440462
|
|
|
440201
440463
|
// src/services/wiki/conventions.ts
|
|
440202
440464
|
import { createHash as createHash23 } from "crypto";
|
|
440203
|
-
import { readFile as readFile44, writeFile as
|
|
440465
|
+
import { readFile as readFile44, writeFile as writeFile44 } from "fs/promises";
|
|
440204
440466
|
async function tryRead(cwd2, ...paths2) {
|
|
440205
440467
|
for (const p of paths2) {
|
|
440206
440468
|
try {
|
|
@@ -440409,14 +440671,14 @@ function formatConventions(identity4, sections) {
|
|
|
440409
440671
|
async function writeCache(cwd2, fingerprint) {
|
|
440410
440672
|
const { conventionsCacheFile } = getWikiPaths(cwd2);
|
|
440411
440673
|
const entry = { fingerprint, scannedAt: new Date().toISOString() };
|
|
440412
|
-
await
|
|
440674
|
+
await writeFile44(conventionsCacheFile, JSON.stringify(entry, null, 2), { encoding: "utf-8" });
|
|
440413
440675
|
}
|
|
440414
440676
|
async function forceScanConventions(cwd2) {
|
|
440415
440677
|
const scan = await scanProjectConventions(cwd2);
|
|
440416
440678
|
const { conventionsFile } = getWikiPaths(cwd2);
|
|
440417
440679
|
let saved = false;
|
|
440418
440680
|
try {
|
|
440419
|
-
await
|
|
440681
|
+
await writeFile44(conventionsFile, scan.markdown, { encoding: "utf-8" });
|
|
440420
440682
|
saved = true;
|
|
440421
440683
|
} catch (error40) {
|
|
440422
440684
|
if (error40.code !== "ENOENT") {
|
|
@@ -441925,7 +442187,7 @@ For example, to get tab context:
|
|
|
441925
442187
|
|
|
441926
442188
|
// src/utils/claudeInChrome/setupPortable.ts
|
|
441927
442189
|
import { readdir as readdir25 } from "fs/promises";
|
|
441928
|
-
import { join as
|
|
442190
|
+
import { join as join137 } from "path";
|
|
441929
442191
|
function getExtensionIds() {
|
|
441930
442192
|
return process.env.USER_TYPE === "ant" ? [PROD_EXTENSION_ID, DEV_EXTENSION_ID, ANT_EXTENSION_ID] : [PROD_EXTENSION_ID];
|
|
441931
442193
|
}
|
|
@@ -441952,7 +442214,7 @@ async function detectExtensionInstallationPortable(browserPaths, log) {
|
|
|
441952
442214
|
}
|
|
441953
442215
|
for (const profile of profileDirs) {
|
|
441954
442216
|
for (const extensionId of extensionIds) {
|
|
441955
|
-
const extensionPath =
|
|
442217
|
+
const extensionPath = join137(browserBasePath, profile, "Extensions", extensionId);
|
|
441956
442218
|
try {
|
|
441957
442219
|
await readdir25(extensionPath);
|
|
441958
442220
|
log?.(`[Claude in Chrome] Extension ${extensionId} found in ${browser} ${profile}`);
|
|
@@ -443326,7 +443588,7 @@ var init_exit2 = __esm(() => {
|
|
|
443326
443588
|
});
|
|
443327
443589
|
|
|
443328
443590
|
// src/utils/exportFormats.ts
|
|
443329
|
-
import { extname as extname13, isAbsolute as isAbsolute29, join as
|
|
443591
|
+
import { extname as extname13, isAbsolute as isAbsolute29, join as join138 } from "path";
|
|
443330
443592
|
function normalizeExportFormat(value) {
|
|
443331
443593
|
const lower = value.toLowerCase().trim();
|
|
443332
443594
|
switch (lower) {
|
|
@@ -443368,7 +443630,7 @@ function ensureExportFilenameExtension(filename, format5, { preserveMarkdownExte
|
|
|
443368
443630
|
return base2 + ext;
|
|
443369
443631
|
}
|
|
443370
443632
|
function resolveExportFilepath(cwd2, filename) {
|
|
443371
|
-
return isAbsolute29(filename) ? filename :
|
|
443633
|
+
return isAbsolute29(filename) ? filename : join138(cwd2, filename);
|
|
443372
443634
|
}
|
|
443373
443635
|
function tokenizeExportArgs(args) {
|
|
443374
443636
|
const tokens = [];
|
|
@@ -447087,7 +447349,7 @@ var init_asciichart = __esm(() => {
|
|
|
447087
447349
|
// src/utils/statsCache.ts
|
|
447088
447350
|
import { randomBytes as randomBytes18 } from "crypto";
|
|
447089
447351
|
import { open as open14 } from "fs/promises";
|
|
447090
|
-
import { join as
|
|
447352
|
+
import { join as join139 } from "path";
|
|
447091
447353
|
async function withStatsCacheLock(fn) {
|
|
447092
447354
|
while (statsCacheLockPromise) {
|
|
447093
447355
|
await statsCacheLockPromise;
|
|
@@ -447104,7 +447366,7 @@ async function withStatsCacheLock(fn) {
|
|
|
447104
447366
|
}
|
|
447105
447367
|
}
|
|
447106
447368
|
function getStatsCachePath() {
|
|
447107
|
-
return
|
|
447369
|
+
return join139(getClaudeConfigHomeDir(), STATS_CACHE_FILENAME);
|
|
447108
447370
|
}
|
|
447109
447371
|
function getEmptyCache() {
|
|
447110
447372
|
return {
|
|
@@ -447826,16 +448088,16 @@ var init_ansiToPng = __esm(() => {
|
|
|
447826
448088
|
});
|
|
447827
448089
|
|
|
447828
448090
|
// src/utils/screenshotClipboard.ts
|
|
447829
|
-
import { mkdir as mkdir36, unlink as unlink22, writeFile as
|
|
448091
|
+
import { mkdir as mkdir36, unlink as unlink22, writeFile as writeFile45 } from "fs/promises";
|
|
447830
448092
|
import { tmpdir as tmpdir7 } from "os";
|
|
447831
|
-
import { join as
|
|
448093
|
+
import { join as join140 } from "path";
|
|
447832
448094
|
async function copyAnsiToClipboard(ansiText, options2) {
|
|
447833
448095
|
try {
|
|
447834
|
-
const tempDir =
|
|
448096
|
+
const tempDir = join140(tmpdir7(), "claude-code-screenshots");
|
|
447835
448097
|
await mkdir36(tempDir, { recursive: true });
|
|
447836
|
-
const pngPath =
|
|
448098
|
+
const pngPath = join140(tempDir, `screenshot-${Date.now()}.png`);
|
|
447837
448099
|
const pngBuffer = ansiToPng(ansiText, options2);
|
|
447838
|
-
await
|
|
448100
|
+
await writeFile45(pngPath, pngBuffer);
|
|
447839
448101
|
const result = await copyPngToClipboard(pngPath);
|
|
447840
448102
|
try {
|
|
447841
448103
|
await unlink22(pngPath);
|
|
@@ -447904,7 +448166,7 @@ var init_screenshotClipboard = __esm(() => {
|
|
|
447904
448166
|
|
|
447905
448167
|
// src/utils/stats.ts
|
|
447906
448168
|
import { open as open15 } from "fs/promises";
|
|
447907
|
-
import { basename as basename47, dirname as dirname57, join as
|
|
448169
|
+
import { basename as basename47, dirname as dirname57, join as join141, sep as sep31 } from "path";
|
|
447908
448170
|
async function processSessionFiles(sessionFiles, options2 = {}) {
|
|
447909
448171
|
const { fromDate, toDate } = options2;
|
|
447910
448172
|
const fs4 = getFsImplementation();
|
|
@@ -448091,17 +448353,17 @@ async function getAllSessionFiles() {
|
|
|
448091
448353
|
return [];
|
|
448092
448354
|
throw e;
|
|
448093
448355
|
}
|
|
448094
|
-
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
448356
|
+
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) => join141(projectsDir, dirent.name));
|
|
448095
448357
|
const projectResults = await Promise.all(projectDirs.map(async (projectDir) => {
|
|
448096
448358
|
try {
|
|
448097
448359
|
const entries = await fs4.readdir(projectDir);
|
|
448098
|
-
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) =>
|
|
448360
|
+
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) => join141(projectDir, dirent.name));
|
|
448099
448361
|
const sessionDirs = entries.filter((dirent) => dirent.isDirectory());
|
|
448100
448362
|
const subagentResults = await Promise.all(sessionDirs.map(async (sessionDir) => {
|
|
448101
|
-
const subagentsDir =
|
|
448363
|
+
const subagentsDir = join141(projectDir, sessionDir.name, "subagents");
|
|
448102
448364
|
try {
|
|
448103
448365
|
const subagentEntries = await fs4.readdir(subagentsDir);
|
|
448104
|
-
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) =>
|
|
448366
|
+
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) => join141(subagentsDir, dirent.name));
|
|
448105
448367
|
} catch {
|
|
448106
448368
|
return [];
|
|
448107
448369
|
}
|
|
@@ -450348,9 +450610,9 @@ import {
|
|
|
450348
450610
|
readdir as readdir26,
|
|
450349
450611
|
readFile as readFile45,
|
|
450350
450612
|
unlink as unlink23,
|
|
450351
|
-
writeFile as
|
|
450613
|
+
writeFile as writeFile46
|
|
450352
450614
|
} from "fs/promises";
|
|
450353
|
-
import { extname as extname14, join as
|
|
450615
|
+
import { extname as extname14, join as join142 } from "path";
|
|
450354
450616
|
function getAnalysisModel() {
|
|
450355
450617
|
return getDefaultOpusModel();
|
|
450356
450618
|
}
|
|
@@ -450358,13 +450620,13 @@ function getInsightsModel() {
|
|
|
450358
450620
|
return getDefaultOpusModel();
|
|
450359
450621
|
}
|
|
450360
450622
|
function getDataDir() {
|
|
450361
|
-
return
|
|
450623
|
+
return join142(getClaudeConfigHomeDir(), "usage-data");
|
|
450362
450624
|
}
|
|
450363
450625
|
function getFacetsDir() {
|
|
450364
|
-
return
|
|
450626
|
+
return join142(getDataDir(), "facets");
|
|
450365
450627
|
}
|
|
450366
450628
|
function getSessionMetaDir() {
|
|
450367
|
-
return
|
|
450629
|
+
return join142(getDataDir(), "session-meta");
|
|
450368
450630
|
}
|
|
450369
450631
|
function getLanguageFromPath(filePath) {
|
|
450370
450632
|
const ext = extname14(filePath).toLowerCase();
|
|
@@ -450709,7 +450971,7 @@ async function formatTranscriptWithSummarization(log) {
|
|
|
450709
450971
|
`);
|
|
450710
450972
|
}
|
|
450711
450973
|
async function loadCachedFacets(sessionId) {
|
|
450712
|
-
const facetPath =
|
|
450974
|
+
const facetPath = join142(getFacetsDir(), `${sessionId}.json`);
|
|
450713
450975
|
try {
|
|
450714
450976
|
const content = await readFile45(facetPath, { encoding: "utf-8" });
|
|
450715
450977
|
const parsed = jsonParse(content);
|
|
@@ -450728,14 +450990,14 @@ async function saveFacets(facets) {
|
|
|
450728
450990
|
try {
|
|
450729
450991
|
await mkdir37(getFacetsDir(), { recursive: true });
|
|
450730
450992
|
} catch {}
|
|
450731
|
-
const facetPath =
|
|
450732
|
-
await
|
|
450993
|
+
const facetPath = join142(getFacetsDir(), `${facets.session_id}.json`);
|
|
450994
|
+
await writeFile46(facetPath, jsonStringify(facets, null, 2), {
|
|
450733
450995
|
encoding: "utf-8",
|
|
450734
450996
|
mode: 384
|
|
450735
450997
|
});
|
|
450736
450998
|
}
|
|
450737
450999
|
async function loadCachedSessionMeta(sessionId) {
|
|
450738
|
-
const metaPath =
|
|
451000
|
+
const metaPath = join142(getSessionMetaDir(), `${sessionId}.json`);
|
|
450739
451001
|
try {
|
|
450740
451002
|
const content = await readFile45(metaPath, { encoding: "utf-8" });
|
|
450741
451003
|
return jsonParse(content);
|
|
@@ -450747,8 +451009,8 @@ async function saveSessionMeta(meta) {
|
|
|
450747
451009
|
try {
|
|
450748
451010
|
await mkdir37(getSessionMetaDir(), { recursive: true });
|
|
450749
451011
|
} catch {}
|
|
450750
|
-
const metaPath =
|
|
450751
|
-
await
|
|
451012
|
+
const metaPath = join142(getSessionMetaDir(), `${meta.session_id}.json`);
|
|
451013
|
+
await writeFile46(metaPath, jsonStringify(meta, null, 2), {
|
|
450752
451014
|
encoding: "utf-8",
|
|
450753
451015
|
mode: 384
|
|
450754
451016
|
});
|
|
@@ -451804,7 +452066,7 @@ function generateHtmlReport(data, insights) {
|
|
|
451804
452066
|
</html>`;
|
|
451805
452067
|
}
|
|
451806
452068
|
function buildExportData(data, insights, facets) {
|
|
451807
|
-
const version3 = typeof MACRO !== "undefined" ? "0.30.
|
|
452069
|
+
const version3 = typeof MACRO !== "undefined" ? "0.30.2-by-rayss" : "unknown";
|
|
451808
452070
|
const facets_summary = {
|
|
451809
452071
|
total: facets.size,
|
|
451810
452072
|
goal_categories: {},
|
|
@@ -451851,7 +452113,7 @@ async function scanAllSessions() {
|
|
|
451851
452113
|
} catch {
|
|
451852
452114
|
return [];
|
|
451853
452115
|
}
|
|
451854
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
452116
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join142(projectsDir, dirent.name));
|
|
451855
452117
|
const allSessions = [];
|
|
451856
452118
|
for (let i3 = 0;i3 < projectDirs.length; i3++) {
|
|
451857
452119
|
const sessionFiles = await getSessionFilesWithMtime(projectDirs[i3]);
|
|
@@ -452006,8 +452268,8 @@ async function generateUsageReport() {
|
|
|
452006
452268
|
try {
|
|
452007
452269
|
await mkdir37(getDataDir(), { recursive: true });
|
|
452008
452270
|
} catch {}
|
|
452009
|
-
const htmlPath =
|
|
452010
|
-
await
|
|
452271
|
+
const htmlPath = join142(getDataDir(), "report.html");
|
|
452272
|
+
await writeFile46(htmlPath, htmlReport, {
|
|
452011
452273
|
encoding: "utf-8",
|
|
452012
452274
|
mode: 384
|
|
452013
452275
|
});
|
|
@@ -453037,9 +453299,9 @@ import {
|
|
|
453037
453299
|
readFile as readFile46,
|
|
453038
453300
|
stat as stat45,
|
|
453039
453301
|
unlink as unlink24,
|
|
453040
|
-
writeFile as
|
|
453302
|
+
writeFile as writeFile47
|
|
453041
453303
|
} from "fs/promises";
|
|
453042
|
-
import { basename as basename48, dirname as dirname58, join as
|
|
453304
|
+
import { basename as basename48, dirname as dirname58, join as join143 } from "path";
|
|
453043
453305
|
function getBuiltInCommandNames() {
|
|
453044
453306
|
if (builtInCommandNamesCache)
|
|
453045
453307
|
return builtInCommandNamesCache;
|
|
@@ -453248,14 +453510,14 @@ function isEphemeralToolProgress(dataType) {
|
|
|
453248
453510
|
}
|
|
453249
453511
|
function getTranscriptPath() {
|
|
453250
453512
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
453251
|
-
return
|
|
453513
|
+
return join143(projectDir, `${getSessionId()}.jsonl`);
|
|
453252
453514
|
}
|
|
453253
453515
|
function getTranscriptPathForSession(sessionId) {
|
|
453254
453516
|
if (sessionId === getSessionId()) {
|
|
453255
453517
|
return getTranscriptPath();
|
|
453256
453518
|
}
|
|
453257
453519
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
453258
|
-
return
|
|
453520
|
+
return join143(projectDir, `${sessionId}.jsonl`);
|
|
453259
453521
|
}
|
|
453260
453522
|
function setAgentTranscriptSubdir(agentId, subdir) {
|
|
453261
453523
|
agentTranscriptSubdirs.set(agentId, subdir);
|
|
@@ -453267,8 +453529,8 @@ function getAgentTranscriptPath(agentId) {
|
|
|
453267
453529
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
453268
453530
|
const sessionId = getSessionId();
|
|
453269
453531
|
const subdir = agentTranscriptSubdirs.get(agentId);
|
|
453270
|
-
const base2 = subdir ?
|
|
453271
|
-
return
|
|
453532
|
+
const base2 = subdir ? join143(projectDir, sessionId, "subagents", subdir) : join143(projectDir, sessionId, "subagents");
|
|
453533
|
+
return join143(base2, `agent-${agentId}.jsonl`);
|
|
453272
453534
|
}
|
|
453273
453535
|
function getAgentMetadataPath(agentId) {
|
|
453274
453536
|
return getAgentTranscriptPath(agentId).replace(/\.jsonl$/, ".meta.json");
|
|
@@ -453291,15 +453553,15 @@ async function readAgentMetadata(agentId) {
|
|
|
453291
453553
|
}
|
|
453292
453554
|
function getRemoteAgentsDir() {
|
|
453293
453555
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
453294
|
-
return
|
|
453556
|
+
return join143(projectDir, getSessionId(), "remote-agents");
|
|
453295
453557
|
}
|
|
453296
453558
|
function getRemoteAgentMetadataPath(taskId) {
|
|
453297
|
-
return
|
|
453559
|
+
return join143(getRemoteAgentsDir(), `remote-agent-${taskId}.meta.json`);
|
|
453298
453560
|
}
|
|
453299
453561
|
async function writeRemoteAgentMetadata(taskId, metadata) {
|
|
453300
453562
|
const path17 = getRemoteAgentMetadataPath(taskId);
|
|
453301
453563
|
await mkdir38(dirname58(path17), { recursive: true });
|
|
453302
|
-
await
|
|
453564
|
+
await writeFile47(path17, JSON.stringify(metadata));
|
|
453303
453565
|
}
|
|
453304
453566
|
async function readRemoteAgentMetadata(taskId) {
|
|
453305
453567
|
const path17 = getRemoteAgentMetadataPath(taskId);
|
|
@@ -453337,7 +453599,7 @@ async function listRemoteAgentMetadata() {
|
|
|
453337
453599
|
if (!entry.isFile() || !entry.name.endsWith(".meta.json"))
|
|
453338
453600
|
continue;
|
|
453339
453601
|
try {
|
|
453340
|
-
const raw = await readFile46(
|
|
453602
|
+
const raw = await readFile46(join143(dir, entry.name), "utf-8");
|
|
453341
453603
|
results.push(JSON.parse(raw));
|
|
453342
453604
|
} catch (e) {
|
|
453343
453605
|
logForDebugging(`listRemoteAgentMetadata: skipping ${entry.name}: ${String(e)}`);
|
|
@@ -453347,7 +453609,7 @@ async function listRemoteAgentMetadata() {
|
|
|
453347
453609
|
}
|
|
453348
453610
|
function sessionIdExists(sessionId) {
|
|
453349
453611
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
453350
|
-
const sessionFile =
|
|
453612
|
+
const sessionFile = join143(projectDir, `${sessionId}.jsonl`);
|
|
453351
453613
|
const fs4 = getFsImplementation();
|
|
453352
453614
|
try {
|
|
453353
453615
|
fs4.statSync(sessionFile);
|
|
@@ -453383,7 +453645,7 @@ function getProject() {
|
|
|
453383
453645
|
if (!shouldSkipSessionPersistence()) {
|
|
453384
453646
|
const { writeReplayIndex: writeReplayIndex2 } = await Promise.resolve().then(() => (init_replayIndex(), exports_replayIndex));
|
|
453385
453647
|
for (const { sessionId, builder, projectDir } of replayBuilders) {
|
|
453386
|
-
const transcriptPath = projectDir ?
|
|
453648
|
+
const transcriptPath = projectDir ? join143(projectDir, `${sessionId}.jsonl`) : getTranscriptPathForSession(sessionId);
|
|
453387
453649
|
const index = builder.build(sessionId);
|
|
453388
453650
|
await writeReplayIndex2(sessionId, transcriptPath, index);
|
|
453389
453651
|
}
|
|
@@ -455799,7 +456061,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
455799
456061
|
};
|
|
455800
456062
|
}
|
|
455801
456063
|
async function loadSessionFile(sessionId) {
|
|
455802
|
-
const sessionFile =
|
|
456064
|
+
const sessionFile = join143(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), `${sessionId}.jsonl`);
|
|
455803
456065
|
return loadTranscriptFile(sessionFile);
|
|
455804
456066
|
}
|
|
455805
456067
|
function clearSessionMessagesCache() {
|
|
@@ -455871,7 +456133,7 @@ async function loadAllProjectsMessageLogsFull(limit) {
|
|
|
455871
456133
|
} catch {
|
|
455872
456134
|
return [];
|
|
455873
456135
|
}
|
|
455874
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
456136
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join143(projectsDir, dirent.name));
|
|
455875
456137
|
const logsPerProject = await Promise.all(projectDirs.map((projectDir) => getLogsWithoutIndex(projectDir, limit)));
|
|
455876
456138
|
const allLogs = logsPerProject.flat();
|
|
455877
456139
|
const deduped = new Map;
|
|
@@ -455896,7 +456158,7 @@ async function loadAllProjectsMessageLogsProgressive(limit, initialEnrichCount =
|
|
|
455896
456158
|
} catch {
|
|
455897
456159
|
return { logs: [], allStatLogs: [], nextIndex: 0 };
|
|
455898
456160
|
}
|
|
455899
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
456161
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join143(projectsDir, dirent.name));
|
|
455900
456162
|
const rawLogs = [];
|
|
455901
456163
|
for (const projectDir of projectDirs) {
|
|
455902
456164
|
rawLogs.push(...await getSessionFilesLite(projectDir, limit));
|
|
@@ -455957,7 +456219,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
|
|
|
455957
456219
|
for (const { path: wtPath, prefix } of indexed) {
|
|
455958
456220
|
if (dirName === prefix || dirName.startsWith(prefix + "-")) {
|
|
455959
456221
|
seenDirs.add(dirName);
|
|
455960
|
-
allLogs.push(...await getSessionFilesLite(
|
|
456222
|
+
allLogs.push(...await getSessionFilesLite(join143(projectsDir, dirent.name), undefined, wtPath));
|
|
455961
456223
|
break;
|
|
455962
456224
|
}
|
|
455963
456225
|
}
|
|
@@ -456026,7 +456288,7 @@ async function loadSubagentTranscripts(agentIds) {
|
|
|
456026
456288
|
return transcripts;
|
|
456027
456289
|
}
|
|
456028
456290
|
async function loadAllSubagentTranscriptsFromDisk() {
|
|
456029
|
-
const subagentsDir =
|
|
456291
|
+
const subagentsDir = join143(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), getSessionId(), "subagents");
|
|
456030
456292
|
let entries;
|
|
456031
456293
|
try {
|
|
456032
456294
|
entries = await readdir27(subagentsDir, { withFileTypes: true });
|
|
@@ -456154,7 +456416,7 @@ async function getSessionFilesWithMtime(projectDir) {
|
|
|
456154
456416
|
const sessionId = validateUuid2(basename48(dirent.name, ".jsonl"));
|
|
456155
456417
|
if (!sessionId)
|
|
456156
456418
|
continue;
|
|
456157
|
-
candidates.push({ sessionId, filePath:
|
|
456419
|
+
candidates.push({ sessionId, filePath: join143(projectDir, dirent.name) });
|
|
456158
456420
|
}
|
|
456159
456421
|
await Promise.all(candidates.map(async ({ sessionId, filePath }) => {
|
|
456160
456422
|
try {
|
|
@@ -456582,7 +456844,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
456582
456844
|
init_slowOperations();
|
|
456583
456845
|
init_transcriptFileLock();
|
|
456584
456846
|
init_uuid();
|
|
456585
|
-
VERSION3 = typeof MACRO !== "undefined" ? "0.30.
|
|
456847
|
+
VERSION3 = typeof MACRO !== "undefined" ? "0.30.2-by-rayss" : "unknown";
|
|
456586
456848
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
456587
456849
|
TRANSCRIPT_COPY_CHUNK_BYTES = 64 * 1024;
|
|
456588
456850
|
transcriptRewriteHooksForTesting = {};
|
|
@@ -456597,7 +456859,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
456597
456859
|
MAX_TRANSCRIPT_READ_BYTES = 50 * 1024 * 1024;
|
|
456598
456860
|
agentTranscriptSubdirs = new Map;
|
|
456599
456861
|
getProjectDir2 = memoize_default((projectDir) => {
|
|
456600
|
-
return
|
|
456862
|
+
return join143(getProjectsDir(), sanitizePath(projectDir));
|
|
456601
456863
|
});
|
|
456602
456864
|
PERSISTED_OUTPUT_TAG2 = Buffer.from("<persisted-output>");
|
|
456603
456865
|
TOOL_USE_RESULT_KEY = Buffer.from('"toolUseResult":');
|
|
@@ -456960,41 +457222,41 @@ var init_memdir = __esm(() => {
|
|
|
456960
457222
|
});
|
|
456961
457223
|
|
|
456962
457224
|
// src/tools/AgentTool/agentMemory.ts
|
|
456963
|
-
import { join as
|
|
457225
|
+
import { join as join144, normalize as normalize13, sep as sep32 } from "path";
|
|
456964
457226
|
function sanitizeAgentTypeForPath(agentType) {
|
|
456965
457227
|
return agentType.replace(/:/g, "-");
|
|
456966
457228
|
}
|
|
456967
457229
|
function getLocalAgentMemoryDir(dirName) {
|
|
456968
457230
|
if (process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR) {
|
|
456969
|
-
return
|
|
457231
|
+
return join144(process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR, "projects", sanitizePath(findCanonicalGitRoot(getProjectRoot()) ?? getProjectRoot()), "agent-memory-local", dirName) + sep32;
|
|
456970
457232
|
}
|
|
456971
|
-
return
|
|
457233
|
+
return join144(getCwd(), ".openclaude", "agent-memory-local", dirName) + sep32;
|
|
456972
457234
|
}
|
|
456973
457235
|
function getAgentMemoryDir(agentType, scope) {
|
|
456974
457236
|
const dirName = sanitizeAgentTypeForPath(agentType);
|
|
456975
457237
|
switch (scope) {
|
|
456976
457238
|
case "project":
|
|
456977
|
-
return
|
|
457239
|
+
return join144(getCwd(), ".openclaude", "agent-memory", dirName) + sep32;
|
|
456978
457240
|
case "local":
|
|
456979
457241
|
return getLocalAgentMemoryDir(dirName);
|
|
456980
457242
|
case "user":
|
|
456981
|
-
return
|
|
457243
|
+
return join144(getMemoryBaseDir(), "agent-memory", dirName) + sep32;
|
|
456982
457244
|
}
|
|
456983
457245
|
}
|
|
456984
457246
|
function isAgentMemoryPath(absolutePath) {
|
|
456985
457247
|
const normalizedPath = normalize13(absolutePath);
|
|
456986
457248
|
const memoryBase = getMemoryBaseDir();
|
|
456987
|
-
if (normalizedPath.startsWith(
|
|
457249
|
+
if (normalizedPath.startsWith(join144(memoryBase, "agent-memory") + sep32)) {
|
|
456988
457250
|
return true;
|
|
456989
457251
|
}
|
|
456990
|
-
if (normalizedPath.startsWith(
|
|
457252
|
+
if (normalizedPath.startsWith(join144(getCwd(), ".openclaude", "agent-memory") + sep32)) {
|
|
456991
457253
|
return true;
|
|
456992
457254
|
}
|
|
456993
457255
|
if (process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR) {
|
|
456994
|
-
if (normalizedPath.includes(sep32 + "agent-memory-local" + sep32) && normalizedPath.startsWith(
|
|
457256
|
+
if (normalizedPath.includes(sep32 + "agent-memory-local" + sep32) && normalizedPath.startsWith(join144(process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR, "projects") + sep32)) {
|
|
456995
457257
|
return true;
|
|
456996
457258
|
}
|
|
456997
|
-
} else if (normalizedPath.startsWith(
|
|
457259
|
+
} else if (normalizedPath.startsWith(join144(getCwd(), ".openclaude", "agent-memory-local") + sep32)) {
|
|
456998
457260
|
return true;
|
|
456999
457261
|
}
|
|
457000
457262
|
return false;
|
|
@@ -457002,7 +457264,7 @@ function isAgentMemoryPath(absolutePath) {
|
|
|
457002
457264
|
function getMemoryScopeDisplay(memory2) {
|
|
457003
457265
|
switch (memory2) {
|
|
457004
457266
|
case "user":
|
|
457005
|
-
return `User (${
|
|
457267
|
+
return `User (${join144(getMemoryBaseDir(), "agent-memory")}/)`;
|
|
457006
457268
|
case "project":
|
|
457007
457269
|
return "Project (.openclaude/agent-memory/)";
|
|
457008
457270
|
case "local":
|
|
@@ -457081,7 +457343,7 @@ __export(exports_filesystem, {
|
|
|
457081
457343
|
});
|
|
457082
457344
|
import { randomBytes as randomBytes19 } from "crypto";
|
|
457083
457345
|
import { homedir as homedir31, tmpdir as tmpdir8 } from "os";
|
|
457084
|
-
import { join as
|
|
457346
|
+
import { join as join145, normalize as normalize14, posix as posix9, sep as sep33 } from "path";
|
|
457085
457347
|
function normalizeCaseForComparison(path17) {
|
|
457086
457348
|
return path17.toLowerCase();
|
|
457087
457349
|
}
|
|
@@ -457090,11 +457352,11 @@ function getClaudeSkillScope(filePath) {
|
|
|
457090
457352
|
const absolutePathLower = normalizeCaseForComparison(absolutePath);
|
|
457091
457353
|
const bases = [
|
|
457092
457354
|
{
|
|
457093
|
-
dir: expandPath(
|
|
457355
|
+
dir: expandPath(join145(getOriginalCwd(), ".openclaude", "skills")),
|
|
457094
457356
|
prefix: "/.openclaude/skills/"
|
|
457095
457357
|
},
|
|
457096
457358
|
{
|
|
457097
|
-
dir: expandPath(
|
|
457359
|
+
dir: expandPath(join145(homedir31(), ".openclaude", "skills")),
|
|
457098
457360
|
prefix: "~/.openclaude/skills/"
|
|
457099
457361
|
}
|
|
457100
457362
|
];
|
|
@@ -457149,13 +457411,13 @@ function isClaudeConfigFilePath(filePath) {
|
|
|
457149
457411
|
if (isClaudeSettingsPath(filePath)) {
|
|
457150
457412
|
return true;
|
|
457151
457413
|
}
|
|
457152
|
-
const commandsDir =
|
|
457153
|
-
const agentsDir =
|
|
457154
|
-
const skillsDir =
|
|
457414
|
+
const commandsDir = join145(getOriginalCwd(), ".openclaude", "commands");
|
|
457415
|
+
const agentsDir = join145(getOriginalCwd(), ".openclaude", "agents");
|
|
457416
|
+
const skillsDir = join145(getOriginalCwd(), ".openclaude", "skills");
|
|
457155
457417
|
return pathInWorkingPath(filePath, commandsDir) || pathInWorkingPath(filePath, agentsDir) || pathInWorkingPath(filePath, skillsDir);
|
|
457156
457418
|
}
|
|
457157
457419
|
function isPlanFilePath(plansDir, planSlug, absolutePath) {
|
|
457158
|
-
const expectedPrefix =
|
|
457420
|
+
const expectedPrefix = join145(plansDir, planSlug);
|
|
457159
457421
|
const normalizedPath = normalize14(absolutePath);
|
|
457160
457422
|
if (!normalizedPath.endsWith(".md")) {
|
|
457161
457423
|
return false;
|
|
@@ -457163,7 +457425,7 @@ function isPlanFilePath(plansDir, planSlug, absolutePath) {
|
|
|
457163
457425
|
if (normalizedPath === expectedPrefix + ".md") {
|
|
457164
457426
|
return true;
|
|
457165
457427
|
}
|
|
457166
|
-
const agentPrefix =
|
|
457428
|
+
const agentPrefix = join145(plansDir, AGENT_PLANS_SUBDIR, `${planSlug}-agent-`);
|
|
457167
457429
|
if (!normalizedPath.startsWith(agentPrefix)) {
|
|
457168
457430
|
return false;
|
|
457169
457431
|
}
|
|
@@ -457178,10 +457440,10 @@ function isSessionPlanFile(absolutePath) {
|
|
|
457178
457440
|
return isResolvedPathWithinPlansDir(absolutePath, plansDir);
|
|
457179
457441
|
}
|
|
457180
457442
|
function getSessionMemoryDir() {
|
|
457181
|
-
return
|
|
457443
|
+
return join145(getProjectDir2(getCwd()), getSessionId(), "session-memory") + sep33;
|
|
457182
457444
|
}
|
|
457183
457445
|
function getSessionMemoryPath() {
|
|
457184
|
-
return
|
|
457446
|
+
return join145(getSessionMemoryDir(), "summary.md");
|
|
457185
457447
|
}
|
|
457186
457448
|
function isSessionMemoryPath(absolutePath) {
|
|
457187
457449
|
const normalizedPath = normalize14(absolutePath);
|
|
@@ -457204,15 +457466,15 @@ function getClaudeTempDirName() {
|
|
|
457204
457466
|
}
|
|
457205
457467
|
function ensureUsableTempDir(fs4, dirPath) {
|
|
457206
457468
|
fs4.mkdirSync(dirPath, { mode: 448 });
|
|
457207
|
-
const probeDir =
|
|
457469
|
+
const probeDir = join145(dirPath, `.write-probe-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2)}`);
|
|
457208
457470
|
fs4.mkdirSync(probeDir, { mode: 448 });
|
|
457209
457471
|
fs4.rmdirSync(probeDir);
|
|
457210
457472
|
}
|
|
457211
457473
|
function getProjectTempDir() {
|
|
457212
|
-
return
|
|
457474
|
+
return join145(getClaudeTempDir(), sanitizePath(getOriginalCwd())) + sep33;
|
|
457213
457475
|
}
|
|
457214
457476
|
function getScratchpadDir() {
|
|
457215
|
-
return
|
|
457477
|
+
return join145(getProjectTempDir(), getSessionId(), "scratchpad");
|
|
457216
457478
|
}
|
|
457217
457479
|
async function ensureScratchpadDir() {
|
|
457218
457480
|
if (!isScratchpadEnabled()) {
|
|
@@ -457263,7 +457525,7 @@ function getActiveSessionPlanFilePath(agentId) {
|
|
|
457263
457525
|
return getPlanFilePath2(agentId);
|
|
457264
457526
|
}
|
|
457265
457527
|
function isOpenClaudeCommitMessagePath(absolutePath) {
|
|
457266
|
-
const expectedPath =
|
|
457528
|
+
const expectedPath = join145(getOriginalCwd(), ".git", "OPENCLAUDE_COMMIT_MSG");
|
|
457267
457529
|
const expectedForms = getPathsForPermissionCheck(expectedPath);
|
|
457268
457530
|
const targetForms = getPathsForPermissionCheck(absolutePath);
|
|
457269
457531
|
return targetForms.length > 0 && targetForms.every((target) => expectedForms.some((expected) => pathsEqualForPermission(target, expected)));
|
|
@@ -457839,7 +458101,7 @@ function checkEditableInternalPath(absolutePath, input, toolPermissionContext) {
|
|
|
457839
458101
|
}
|
|
457840
458102
|
};
|
|
457841
458103
|
}
|
|
457842
|
-
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(
|
|
458104
|
+
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(join145(getOriginalCwd(), ".openclaude", "launch.json"))) {
|
|
457843
458105
|
return {
|
|
457844
458106
|
behavior: "allow",
|
|
457845
458107
|
updatedInput: input,
|
|
@@ -457946,7 +458208,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
457946
458208
|
}
|
|
457947
458209
|
};
|
|
457948
458210
|
}
|
|
457949
|
-
const tasksDir =
|
|
458211
|
+
const tasksDir = join145(getClaudeConfigHomeDir(), "tasks") + sep33;
|
|
457950
458212
|
if (normalizedPath === tasksDir.slice(0, -1) || normalizedPath.startsWith(tasksDir)) {
|
|
457951
458213
|
return {
|
|
457952
458214
|
behavior: "allow",
|
|
@@ -457957,7 +458219,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
457957
458219
|
}
|
|
457958
458220
|
};
|
|
457959
458221
|
}
|
|
457960
|
-
const teamsReadDir =
|
|
458222
|
+
const teamsReadDir = join145(getClaudeConfigHomeDir(), "teams") + sep33;
|
|
457961
458223
|
if (normalizedPath === teamsReadDir.slice(0, -1) || normalizedPath.startsWith(teamsReadDir)) {
|
|
457962
458224
|
return {
|
|
457963
458225
|
behavior: "allow",
|
|
@@ -458035,14 +458297,14 @@ var init_filesystem = __esm(() => {
|
|
|
458035
458297
|
try {
|
|
458036
458298
|
resolvedBaseTmpDir = fs4.realpathSync(baseTmpDir);
|
|
458037
458299
|
} catch {}
|
|
458038
|
-
const fullPath =
|
|
458300
|
+
const fullPath = join145(resolvedBaseTmpDir, getClaudeTempDirName()) + sep33;
|
|
458039
458301
|
try {
|
|
458040
458302
|
ensureUsableTempDir(fs4, fullPath);
|
|
458041
458303
|
} catch (e) {
|
|
458042
458304
|
if (isFsInaccessible(e)) {
|
|
458043
458305
|
const fallbackDirs = [
|
|
458044
|
-
|
|
458045
|
-
|
|
458306
|
+
join145(tmpdir8(), "claude-code", getClaudeTempDirName()) + sep33,
|
|
458307
|
+
join145(getClaudeConfigHomeDir(), "tmp", getClaudeTempDirName()) + sep33
|
|
458046
458308
|
];
|
|
458047
458309
|
for (const fallbackDir of fallbackDirs) {
|
|
458048
458310
|
try {
|
|
@@ -458061,7 +458323,7 @@ var init_filesystem = __esm(() => {
|
|
|
458061
458323
|
});
|
|
458062
458324
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
458063
458325
|
const nonce = randomBytes19(16).toString("hex");
|
|
458064
|
-
return
|
|
458326
|
+
return join145(getClaudeTempDir(), "bundled-skills", "0.30.2-by-rayss", nonce);
|
|
458065
458327
|
});
|
|
458066
458328
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
458067
458329
|
});
|
|
@@ -458075,10 +458337,10 @@ import {
|
|
|
458075
458337
|
symlink as symlink4,
|
|
458076
458338
|
unlink as unlink25
|
|
458077
458339
|
} from "fs/promises";
|
|
458078
|
-
import { join as
|
|
458340
|
+
import { join as join146 } from "path";
|
|
458079
458341
|
function getTaskOutputDir() {
|
|
458080
458342
|
if (_taskOutputDir === undefined) {
|
|
458081
|
-
_taskOutputDir =
|
|
458343
|
+
_taskOutputDir = join146(getProjectTempDir(), getSessionId(), "tasks");
|
|
458082
458344
|
}
|
|
458083
458345
|
return _taskOutputDir;
|
|
458084
458346
|
}
|
|
@@ -458086,7 +458348,7 @@ async function ensureOutputDir() {
|
|
|
458086
458348
|
await mkdir39(getTaskOutputDir(), { recursive: true });
|
|
458087
458349
|
}
|
|
458088
458350
|
function getTaskOutputPath(taskId) {
|
|
458089
|
-
return
|
|
458351
|
+
return join146(getTaskOutputDir(), `${taskId}.output`);
|
|
458090
458352
|
}
|
|
458091
458353
|
function track(p) {
|
|
458092
458354
|
_pendingOps.add(p);
|
|
@@ -459617,7 +459879,7 @@ __export(exports_hookChains, {
|
|
|
459617
459879
|
});
|
|
459618
459880
|
import { createHash as createHash24 } from "crypto";
|
|
459619
459881
|
import { statSync as statSync7 } from "fs";
|
|
459620
|
-
import { join as
|
|
459882
|
+
import { join as join147, resolve as resolve47 } from "path";
|
|
459621
459883
|
function asAnalyticsString(value) {
|
|
459622
459884
|
return value;
|
|
459623
459885
|
}
|
|
@@ -459646,7 +459908,7 @@ function getConfigPath(pathOverride) {
|
|
|
459646
459908
|
if (configuredPath) {
|
|
459647
459909
|
return resolve47(getSafeOriginalCwd(), configuredPath);
|
|
459648
459910
|
}
|
|
459649
|
-
return
|
|
459911
|
+
return join147(getSafeOriginalCwd(), DEFAULT_HOOK_CHAINS_RELATIVE_PATH);
|
|
459650
459912
|
}
|
|
459651
459913
|
function getSafeOriginalCwd() {
|
|
459652
459914
|
try {
|
|
@@ -460575,7 +460837,7 @@ var init_hookChains = __esm(() => {
|
|
|
460575
460837
|
init_teammate();
|
|
460576
460838
|
init_teammateMailbox();
|
|
460577
460839
|
init_v4();
|
|
460578
|
-
DEFAULT_HOOK_CHAINS_RELATIVE_PATH =
|
|
460840
|
+
DEFAULT_HOOK_CHAINS_RELATIVE_PATH = join147(".openclaude", "hook-chains.json");
|
|
460579
460841
|
MAX_GUARD_WINDOW_MS = 24 * 60 * 60 * 1000;
|
|
460580
460842
|
CONFIG_CACHE_MAX_AGE_MS = 5 * 60 * 1000;
|
|
460581
460843
|
HookChainOutcomeSchema = exports_external.enum(["success", "failed", "timeout", "unknown"]);
|
|
@@ -463684,7 +463946,7 @@ import {
|
|
|
463684
463946
|
symlink as symlink5,
|
|
463685
463947
|
utimes as utimes2
|
|
463686
463948
|
} from "fs/promises";
|
|
463687
|
-
import { basename as basename50, dirname as dirname60, join as
|
|
463949
|
+
import { basename as basename50, dirname as dirname60, join as join148 } from "path";
|
|
463688
463950
|
function validateWorktreeSlug(slug) {
|
|
463689
463951
|
if (slug.length > MAX_WORKTREE_SLUG_LENGTH) {
|
|
463690
463952
|
throw new Error(`Invalid worktree name: must be ${MAX_WORKTREE_SLUG_LENGTH} characters or fewer (got ${slug.length})`);
|
|
@@ -463707,8 +463969,8 @@ async function symlinkDirectories(repoRootPath, worktreePath, dirsToSymlink) {
|
|
|
463707
463969
|
logForDebugging(`Skipping symlink for "${dir}": path traversal detected`, { level: "warn" });
|
|
463708
463970
|
continue;
|
|
463709
463971
|
}
|
|
463710
|
-
const sourcePath =
|
|
463711
|
-
const destPath =
|
|
463972
|
+
const sourcePath = join148(repoRootPath, dir);
|
|
463973
|
+
const destPath = join148(worktreePath, dir);
|
|
463712
463974
|
try {
|
|
463713
463975
|
await symlink5(sourcePath, destPath, "dir");
|
|
463714
463976
|
logForDebugging(`Symlinked ${dir} from main repository to worktree to avoid disk bloat`);
|
|
@@ -463742,7 +464004,7 @@ async function withGitWorktreeMutationLock(repoRoot, fn) {
|
|
|
463742
464004
|
}
|
|
463743
464005
|
}
|
|
463744
464006
|
function worktreesDir(repoRoot) {
|
|
463745
|
-
return
|
|
464007
|
+
return join148(repoRoot, ".openclaude", "worktrees");
|
|
463746
464008
|
}
|
|
463747
464009
|
function flattenSlug(slug) {
|
|
463748
464010
|
return slug.replaceAll("/", "+");
|
|
@@ -463756,7 +464018,7 @@ function buildRevParseFailureMessage(baseBranch, stderr, exitCode) {
|
|
|
463756
464018
|
return `Failed to resolve base branch "${baseBranch}": ${detail}${hint}`;
|
|
463757
464019
|
}
|
|
463758
464020
|
function worktreePathFor(repoRoot, slug) {
|
|
463759
|
-
return
|
|
464021
|
+
return join148(worktreesDir(repoRoot), flattenSlug(slug));
|
|
463760
464022
|
}
|
|
463761
464023
|
async function autoConfigureLongPathsForWorktrees(repoRoot) {
|
|
463762
464024
|
if (_testDeps.getPlatform() !== "windows") {
|
|
@@ -463873,7 +464135,7 @@ async function getOrCreateWorktree(repoRoot, slug, options2) {
|
|
|
463873
464135
|
async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
463874
464136
|
let includeContent;
|
|
463875
464137
|
try {
|
|
463876
|
-
includeContent = await readFile47(
|
|
464138
|
+
includeContent = await readFile47(join148(repoRoot, ".worktreeinclude"), "utf-8");
|
|
463877
464139
|
} catch {
|
|
463878
464140
|
return [];
|
|
463879
464141
|
}
|
|
@@ -463928,8 +464190,8 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
|
463928
464190
|
}
|
|
463929
464191
|
const copied = [];
|
|
463930
464192
|
for (const relativePath2 of files2) {
|
|
463931
|
-
const srcPath =
|
|
463932
|
-
const destPath =
|
|
464193
|
+
const srcPath = join148(repoRoot, relativePath2);
|
|
464194
|
+
const destPath = join148(worktreePath, relativePath2);
|
|
463933
464195
|
try {
|
|
463934
464196
|
await mkdir40(dirname60(destPath), { recursive: true });
|
|
463935
464197
|
await copyFile9(srcPath, destPath);
|
|
@@ -463945,9 +464207,9 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
|
463945
464207
|
}
|
|
463946
464208
|
async function performPostCreationSetup(repoRoot, worktreePath) {
|
|
463947
464209
|
const localSettingsRelativePath = getRelativeSettingsFilePathForSource("localSettings");
|
|
463948
|
-
const sourceSettingsLocal =
|
|
464210
|
+
const sourceSettingsLocal = join148(repoRoot, localSettingsRelativePath);
|
|
463949
464211
|
try {
|
|
463950
|
-
const destSettingsLocal =
|
|
464212
|
+
const destSettingsLocal = join148(worktreePath, localSettingsRelativePath);
|
|
463951
464213
|
await mkdirRecursive(dirname60(destSettingsLocal));
|
|
463952
464214
|
await copyFile9(sourceSettingsLocal, destSettingsLocal);
|
|
463953
464215
|
logForDebugging(`Copied settings.local.json to worktree: ${destSettingsLocal}`);
|
|
@@ -463957,8 +464219,8 @@ async function performPostCreationSetup(repoRoot, worktreePath) {
|
|
|
463957
464219
|
logForDebugging(`Failed to copy settings.local.json: ${e.message}`, { level: "warn" });
|
|
463958
464220
|
}
|
|
463959
464221
|
}
|
|
463960
|
-
const huskyPath =
|
|
463961
|
-
const gitHooksPath =
|
|
464222
|
+
const huskyPath = join148(repoRoot, ".husky");
|
|
464223
|
+
const gitHooksPath = join148(repoRoot, ".git", "hooks");
|
|
463962
464224
|
let hooksPath = null;
|
|
463963
464225
|
for (const candidatePath of [huskyPath, gitHooksPath]) {
|
|
463964
464226
|
try {
|
|
@@ -465807,8 +466069,8 @@ var init_toolSearch = __esm(() => {
|
|
|
465807
466069
|
|
|
465808
466070
|
// src/services/vcr.ts
|
|
465809
466071
|
import { createHash as createHash25, randomUUID as randomUUID34 } from "crypto";
|
|
465810
|
-
import { mkdir as mkdir41, readFile as readFile48, writeFile as
|
|
465811
|
-
import { dirname as dirname61, join as
|
|
466072
|
+
import { mkdir as mkdir41, readFile as readFile48, writeFile as writeFile48 } from "fs/promises";
|
|
466073
|
+
import { dirname as dirname61, join as join149 } from "path";
|
|
465812
466074
|
function shouldUseVCR() {
|
|
465813
466075
|
if (false) {}
|
|
465814
466076
|
if (process.env.USER_TYPE === "ant" && isEnvTruthy(process.env.FORCE_VCR)) {
|
|
@@ -465821,7 +466083,7 @@ async function withFixture(input, fixtureName, f) {
|
|
|
465821
466083
|
return await f();
|
|
465822
466084
|
}
|
|
465823
466085
|
const hash = createHash25("sha1").update(jsonStringify(input)).digest("hex").slice(0, 12);
|
|
465824
|
-
const filename =
|
|
466086
|
+
const filename = join149(process.env.CLAUDE_CODE_TEST_FIXTURES_ROOT ?? getCwd(), `fixtures/${fixtureName}-${hash}.json`);
|
|
465825
466087
|
try {
|
|
465826
466088
|
const cached4 = jsonParse(await readFile48(filename, { encoding: "utf8" }));
|
|
465827
466089
|
return cached4;
|
|
@@ -465836,7 +466098,7 @@ async function withFixture(input, fixtureName, f) {
|
|
|
465836
466098
|
}
|
|
465837
466099
|
const result = await f();
|
|
465838
466100
|
await mkdir41(dirname61(filename), { recursive: true });
|
|
465839
|
-
await
|
|
466101
|
+
await writeFile48(filename, jsonStringify(result, null, 2), {
|
|
465840
466102
|
encoding: "utf8"
|
|
465841
466103
|
});
|
|
465842
466104
|
return result;
|
|
@@ -465855,7 +466117,7 @@ async function withVCR(messages, f) {
|
|
|
465855
466117
|
return true;
|
|
465856
466118
|
}));
|
|
465857
466119
|
const dehydratedInput = mapMessages(messagesForAPI.map((_) => _.message.content), dehydrateValue);
|
|
465858
|
-
const filename =
|
|
466120
|
+
const filename = join149(process.env.CLAUDE_CODE_TEST_FIXTURES_ROOT ?? getCwd(), `fixtures/${dehydratedInput.map((_) => createHash25("sha1").update(jsonStringify(_)).digest("hex").slice(0, 6)).join("-")}.json`);
|
|
465859
466121
|
try {
|
|
465860
466122
|
const cached4 = jsonParse(await readFile48(filename, { encoding: "utf8" }));
|
|
465861
466123
|
cached4.output.forEach(addCachedCostToTotalSessionCost);
|
|
@@ -465875,7 +466137,7 @@ ${jsonStringify(dehydratedInput, null, 2)}`);
|
|
|
465875
466137
|
return results;
|
|
465876
466138
|
}
|
|
465877
466139
|
await mkdir41(dirname61(filename), { recursive: true });
|
|
465878
|
-
await
|
|
466140
|
+
await writeFile48(filename, jsonStringify({
|
|
465879
466141
|
input: dehydratedInput,
|
|
465880
466142
|
output: results.map((message, index) => mapMessage(message, dehydrateValue, index))
|
|
465881
466143
|
}, null, 2), { encoding: "utf8" });
|
|
@@ -466354,7 +466616,7 @@ var init_tokenEstimation = __esm(() => {
|
|
|
466354
466616
|
// src/utils/pdf.ts
|
|
466355
466617
|
import { randomUUID as randomUUID35 } from "crypto";
|
|
466356
466618
|
import { mkdir as mkdir42, readdir as readdir29, readFile as readFile49 } from "fs/promises";
|
|
466357
|
-
import { join as
|
|
466619
|
+
import { join as join150 } from "path";
|
|
466358
466620
|
async function readPDF(filePath) {
|
|
466359
466621
|
try {
|
|
466360
466622
|
const fs4 = getFsImplementation();
|
|
@@ -466464,9 +466726,9 @@ async function extractPDFPages(filePath, options2) {
|
|
|
466464
466726
|
};
|
|
466465
466727
|
}
|
|
466466
466728
|
const uuid3 = randomUUID35();
|
|
466467
|
-
const outputDir =
|
|
466729
|
+
const outputDir = join150(getToolResultsDir(), `pdf-${uuid3}`);
|
|
466468
466730
|
await mkdir42(outputDir, { recursive: true });
|
|
466469
|
-
const prefix =
|
|
466731
|
+
const prefix = join150(outputDir, "page");
|
|
466470
466732
|
const args = ["-jpeg", "-r", "100"];
|
|
466471
466733
|
if (options2?.firstPage) {
|
|
466472
466734
|
args.push("-f", String(options2.firstPage));
|
|
@@ -466839,9 +467101,9 @@ var init_UI16 = __esm(() => {
|
|
|
466839
467101
|
});
|
|
466840
467102
|
|
|
466841
467103
|
// src/tools/FileReadTool/FileReadTool.ts
|
|
466842
|
-
import { mkdir as mkdir43, readdir as readdir30, readFile as readFileAsync, writeFile as
|
|
467104
|
+
import { mkdir as mkdir43, readdir as readdir30, readFile as readFileAsync, writeFile as writeFile49 } from "fs/promises";
|
|
466843
467105
|
import * as path17 from "path";
|
|
466844
|
-
import { posix as posix10, win32 as win325, join as
|
|
467106
|
+
import { posix as posix10, win32 as win325, join as join152 } from "path";
|
|
466845
467107
|
import { tmpdir as tmpdir9 } from "node:os";
|
|
466846
467108
|
function isBlockedDevicePath(filePath) {
|
|
466847
467109
|
if (BLOCKED_DEVICE_PATHS.has(filePath))
|
|
@@ -466983,13 +467245,13 @@ async function callInner(file_path, fullFilePath, resolvedFilePath, ext, offset,
|
|
|
466983
467245
|
}
|
|
466984
467246
|
if (IMAGE_EXTENSIONS2.has(ext)) {
|
|
466985
467247
|
const stats2 = await getFsImplementation().stat(resolvedFilePath);
|
|
466986
|
-
const tmpImageDir =
|
|
467248
|
+
const tmpImageDir = join152(tmpdir9(), "openclaude-images");
|
|
466987
467249
|
await mkdir43(tmpImageDir, { recursive: true });
|
|
466988
467250
|
const imageBuffer = await getFsImplementation().readFileBytes(resolvedFilePath);
|
|
466989
467251
|
const detectedMediaType = detectImageFormatFromBuffer(imageBuffer);
|
|
466990
467252
|
const imageExt = detectedMediaType.split("/")[1] || "png";
|
|
466991
|
-
const tmpPath =
|
|
466992
|
-
await
|
|
467253
|
+
const tmpPath = join152(tmpImageDir, `${path17.basename(file_path, path17.extname(file_path))}_${Date.now()}.${imageExt}`);
|
|
467254
|
+
await writeFile49(tmpPath, imageBuffer);
|
|
466993
467255
|
let dimensionsText = "";
|
|
466994
467256
|
let imageDimensions;
|
|
466995
467257
|
try {
|
|
@@ -467008,16 +467270,8 @@ async function callInner(file_path, fullFilePath, resolvedFilePath, ext, offset,
|
|
|
467008
467270
|
});
|
|
467009
467271
|
context2.nestedMemoryAttachmentTriggers?.add(fullFilePath);
|
|
467010
467272
|
return {
|
|
467011
|
-
data:
|
|
467012
|
-
|
|
467013
|
-
file: {
|
|
467014
|
-
filePath: file_path,
|
|
467015
|
-
content: metadataText,
|
|
467016
|
-
numLines: 1,
|
|
467017
|
-
startLine: 1,
|
|
467018
|
-
totalLines: 1
|
|
467019
|
-
}
|
|
467020
|
-
}
|
|
467273
|
+
data: await readImageWithTokenBudget(resolvedFilePath, maxTokens),
|
|
467274
|
+
newMessages: [createUserMessage({ content: metadataText, isMeta: true })]
|
|
467021
467275
|
};
|
|
467022
467276
|
}
|
|
467023
467277
|
if (isPDFExtension(ext)) {
|
|
@@ -470894,8 +471148,18 @@ function getUserMessageText(message) {
|
|
|
470894
471148
|
}
|
|
470895
471149
|
function textForResubmit(msg) {
|
|
470896
471150
|
const content = getUserMessageText(msg);
|
|
470897
|
-
if (content === null)
|
|
471151
|
+
if (content === null) {
|
|
471152
|
+
if (Array.isArray(msg.message.content)) {
|
|
471153
|
+
const imageCount = msg.message.content.filter((block2) => block2.type === "image").length;
|
|
471154
|
+
if (imageCount > 0) {
|
|
471155
|
+
return {
|
|
471156
|
+
text: Array.from({ length: imageCount }, (_, index) => `[Image #${msg.imagePasteIds?.[index] ?? index + 1}]`).join(" "),
|
|
471157
|
+
mode: "prompt"
|
|
471158
|
+
};
|
|
471159
|
+
}
|
|
471160
|
+
}
|
|
470898
471161
|
return null;
|
|
471162
|
+
}
|
|
470899
471163
|
const bash = extractTag(content, "bash-input");
|
|
470900
471164
|
if (bash)
|
|
470901
471165
|
return { text: bash, mode: "bash" };
|
|
@@ -477877,7 +478141,7 @@ var init_permissionSetup = __esm(() => {
|
|
|
477877
478141
|
import { statSync as statSync8 } from "fs";
|
|
477878
478142
|
import { lstat as lstat8, readdir as readdir32, readFile as readFile50, realpath as realpath13, stat as stat50 } from "fs/promises";
|
|
477879
478143
|
import { homedir as homedir32 } from "os";
|
|
477880
|
-
import { dirname as dirname63, join as
|
|
478144
|
+
import { dirname as dirname63, join as join153, resolve as resolve50, sep as sep34 } from "path";
|
|
477881
478145
|
function getMaxMarkdownFileSizeBytes() {
|
|
477882
478146
|
const raw = process.env.CLAUDE_CODE_MAX_MARKDOWN_FILE_SIZE_BYTES;
|
|
477883
478147
|
if (!raw)
|
|
@@ -477985,7 +478249,7 @@ function getProjectDirsUpToHome(subdir, cwd2) {
|
|
|
477985
478249
|
break;
|
|
477986
478250
|
}
|
|
477987
478251
|
for (const configDirName of PROJECT_CONFIG_DIR_NAMES) {
|
|
477988
|
-
const configSubdir =
|
|
478252
|
+
const configSubdir = join153(current, configDirName, subdir);
|
|
477989
478253
|
try {
|
|
477990
478254
|
statSync8(configSubdir);
|
|
477991
478255
|
dirs.push(configSubdir);
|
|
@@ -478033,7 +478297,7 @@ async function findMarkdownFilesNative(dir, signal) {
|
|
|
478033
478297
|
if (signal.aborted) {
|
|
478034
478298
|
break;
|
|
478035
478299
|
}
|
|
478036
|
-
const fullPath =
|
|
478300
|
+
const fullPath = join153(currentDir, entry.name);
|
|
478037
478301
|
try {
|
|
478038
478302
|
if (entry.isSymbolicLink()) {
|
|
478039
478303
|
try {
|
|
@@ -478142,17 +478406,17 @@ var init_markdownConfigLoader = __esm(() => {
|
|
|
478142
478406
|
oversizedMarkdownSkips = new Map;
|
|
478143
478407
|
loadMarkdownFilesForSubdir = memoize_default(async function(subdir, cwd2) {
|
|
478144
478408
|
const searchStartTime = Date.now();
|
|
478145
|
-
const userDir =
|
|
478146
|
-
const managedDir =
|
|
478409
|
+
const userDir = join153(getClaudeConfigHomeDir(), subdir);
|
|
478410
|
+
const managedDir = join153(getManagedFilePath(), ".openclaude", subdir);
|
|
478147
478411
|
const projectDirs = getProjectDirsUpToHome(subdir, cwd2);
|
|
478148
478412
|
const gitRoot = findGitRoot(cwd2);
|
|
478149
478413
|
const canonicalRoot = findCanonicalGitRoot(cwd2);
|
|
478150
478414
|
if (gitRoot && canonicalRoot && canonicalRoot !== gitRoot) {
|
|
478151
|
-
const worktreeSubdirs = PROJECT_CONFIG_DIR_NAMES.map((configDirName) => normalizePathForComparison(
|
|
478415
|
+
const worktreeSubdirs = PROJECT_CONFIG_DIR_NAMES.map((configDirName) => normalizePathForComparison(join153(gitRoot, configDirName, subdir)));
|
|
478152
478416
|
const worktreeHasSubdir = projectDirs.some((dir) => worktreeSubdirs.includes(normalizePathForComparison(dir)));
|
|
478153
478417
|
if (!worktreeHasSubdir) {
|
|
478154
478418
|
for (const configDirName of PROJECT_CONFIG_DIR_NAMES) {
|
|
478155
|
-
const mainConfigSubdir =
|
|
478419
|
+
const mainConfigSubdir = join153(canonicalRoot, configDirName, subdir);
|
|
478156
478420
|
if (!projectDirs.includes(mainConfigSubdir)) {
|
|
478157
478421
|
projectDirs.push(mainConfigSubdir);
|
|
478158
478422
|
}
|
|
@@ -488417,9 +488681,9 @@ __export(exports_upstreamproxy, {
|
|
|
488417
488681
|
getUpstreamProxyEnv: () => getUpstreamProxyEnv,
|
|
488418
488682
|
SESSION_TOKEN_PATH: () => SESSION_TOKEN_PATH
|
|
488419
488683
|
});
|
|
488420
|
-
import { mkdir as mkdir44, readFile as readFile51, unlink as unlink26, writeFile as
|
|
488684
|
+
import { mkdir as mkdir44, readFile as readFile51, unlink as unlink26, writeFile as writeFile50 } from "fs/promises";
|
|
488421
488685
|
import { homedir as homedir33 } from "os";
|
|
488422
|
-
import { join as
|
|
488686
|
+
import { join as join154 } from "path";
|
|
488423
488687
|
async function initUpstreamProxy(opts) {
|
|
488424
488688
|
if (!isEnvTruthy(process.env.CLAUDE_CODE_REMOTE)) {
|
|
488425
488689
|
return state2;
|
|
@@ -488440,7 +488704,7 @@ async function initUpstreamProxy(opts) {
|
|
|
488440
488704
|
}
|
|
488441
488705
|
setNonDumpable();
|
|
488442
488706
|
const baseUrl = opts?.ccrBaseUrl ?? process.env.ANTHROPIC_BASE_URL ?? "https://api.anthropic.com";
|
|
488443
|
-
const caBundlePath = opts?.caBundlePath ??
|
|
488707
|
+
const caBundlePath = opts?.caBundlePath ?? join154(homedir33(), ".ccr", "ca-bundle.crt");
|
|
488444
488708
|
const caOk = await downloadCaBundle(baseUrl, opts?.systemCaPath ?? SYSTEM_CA_BUNDLE, caBundlePath);
|
|
488445
488709
|
if (!caOk)
|
|
488446
488710
|
return state2;
|
|
@@ -488558,8 +488822,8 @@ async function downloadCaBundle(baseUrl, systemCaPath, outPath) {
|
|
|
488558
488822
|
return false;
|
|
488559
488823
|
}
|
|
488560
488824
|
const systemCa = await readFile51(systemCaPath, "utf8").catch(() => "");
|
|
488561
|
-
await mkdir44(
|
|
488562
|
-
await
|
|
488825
|
+
await mkdir44(join154(outPath, ".."), { recursive: true });
|
|
488826
|
+
await writeFile50(outPath, systemCa + `
|
|
488563
488827
|
` + ccrCa, "utf8");
|
|
488564
488828
|
return true;
|
|
488565
488829
|
} catch (err2) {
|
|
@@ -488782,25 +489046,25 @@ var init_InvalidConfigDialog = __esm(() => {
|
|
|
488782
489046
|
|
|
488783
489047
|
// src/entrypoints/init.ts
|
|
488784
489048
|
import { existsSync as existsSync10, mkdirSync as mkdirSync11, copyFileSync as copyFileSync2 } from "fs";
|
|
488785
|
-
import { join as
|
|
489049
|
+
import { join as join155, dirname as dirname65 } from "path";
|
|
488786
489050
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
488787
489051
|
function copyDefaultConfigFiles() {
|
|
488788
489052
|
try {
|
|
488789
489053
|
const { homedir: homedir34 } = __require("os");
|
|
488790
|
-
const configDir =
|
|
489054
|
+
const configDir = join155(homedir34(), ".openclaude");
|
|
488791
489055
|
if (!existsSync10(configDir)) {
|
|
488792
489056
|
mkdirSync11(configDir, { recursive: true });
|
|
488793
489057
|
}
|
|
488794
489058
|
const __filename3 = fileURLToPath6(import.meta.url);
|
|
488795
|
-
const packageDir =
|
|
488796
|
-
const defaultsDir =
|
|
488797
|
-
const claudeMdPath =
|
|
488798
|
-
const defaultClaudeMd =
|
|
489059
|
+
const packageDir = join155(dirname65(__filename3), "..");
|
|
489060
|
+
const defaultsDir = join155(packageDir, "config", "defaults");
|
|
489061
|
+
const claudeMdPath = join155(configDir, "CLAUDE.md");
|
|
489062
|
+
const defaultClaudeMd = join155(defaultsDir, "CLAUDE.md");
|
|
488799
489063
|
if (!existsSync10(claudeMdPath) && existsSync10(defaultClaudeMd)) {
|
|
488800
489064
|
copyFileSync2(defaultClaudeMd, claudeMdPath);
|
|
488801
489065
|
}
|
|
488802
|
-
const settingsPath =
|
|
488803
|
-
const defaultSettings =
|
|
489066
|
+
const settingsPath = join155(configDir, "settings.json");
|
|
489067
|
+
const defaultSettings = join155(defaultsDir, "settings.json");
|
|
488804
489068
|
if (!existsSync10(settingsPath) && existsSync10(defaultSettings)) {
|
|
488805
489069
|
copyFileSync2(defaultSettings, settingsPath);
|
|
488806
489070
|
}
|
|
@@ -489037,8 +489301,8 @@ var init_shared2 = __esm(() => {
|
|
|
489037
489301
|
|
|
489038
489302
|
// src/entrypoints/sdk/sessions.ts
|
|
489039
489303
|
import { randomUUID as randomUUID40 } from "crypto";
|
|
489040
|
-
import { appendFile as appendFile5, mkdir as mkdir45, unlink as unlink27, writeFile as
|
|
489041
|
-
import { dirname as dirname66, join as
|
|
489304
|
+
import { appendFile as appendFile5, mkdir as mkdir45, unlink as unlink27, writeFile as writeFile51 } from "fs/promises";
|
|
489305
|
+
import { dirname as dirname66, join as join156 } from "path";
|
|
489042
489306
|
function toSDKSessionInfo(info) {
|
|
489043
489307
|
return {
|
|
489044
489308
|
sessionId: info.sessionId,
|
|
@@ -489091,7 +489355,7 @@ async function forkSession(sessionId, options2) {
|
|
|
489091
489355
|
}
|
|
489092
489356
|
const forkSessionId = randomUUID40();
|
|
489093
489357
|
const targetDir = dirname66(resolved.filePath);
|
|
489094
|
-
const forkPath =
|
|
489358
|
+
const forkPath = join156(targetDir, `${forkSessionId}.jsonl`);
|
|
489095
489359
|
const uuidMap = new Map;
|
|
489096
489360
|
const mainEntries = [];
|
|
489097
489361
|
const metadataEntries = [];
|
|
@@ -489144,7 +489408,7 @@ async function forkSession(sessionId, options2) {
|
|
|
489144
489408
|
};
|
|
489145
489409
|
lines.push(JSON.stringify(forkedEntry));
|
|
489146
489410
|
}
|
|
489147
|
-
await
|
|
489411
|
+
await writeFile51(forkPath, lines.join(`
|
|
489148
489412
|
`) + `
|
|
489149
489413
|
`, {
|
|
489150
489414
|
encoding: "utf8",
|
|
@@ -491142,7 +491406,7 @@ var init_types13 = __esm(() => {
|
|
|
491142
491406
|
|
|
491143
491407
|
// src/utils/settings/mdm/constants.ts
|
|
491144
491408
|
import { homedir as homedir34, userInfo as userInfo3 } from "os";
|
|
491145
|
-
import { join as
|
|
491409
|
+
import { join as join157 } from "path";
|
|
491146
491410
|
function getMacOSPlistPaths() {
|
|
491147
491411
|
let username = "";
|
|
491148
491412
|
try {
|
|
@@ -491161,7 +491425,7 @@ function getMacOSPlistPaths() {
|
|
|
491161
491425
|
});
|
|
491162
491426
|
if (process.env.USER_TYPE === "ant") {
|
|
491163
491427
|
paths2.push({
|
|
491164
|
-
path:
|
|
491428
|
+
path: join157(homedir34(), "Library", "Preferences", `${MACOS_PREFERENCE_DOMAIN}.plist`),
|
|
491165
491429
|
label: "user preferences (internal-only)"
|
|
491166
491430
|
});
|
|
491167
491431
|
}
|
|
@@ -491232,7 +491496,7 @@ var init_rawRead = __esm(() => {
|
|
|
491232
491496
|
});
|
|
491233
491497
|
|
|
491234
491498
|
// src/utils/settings/mdm/settings.ts
|
|
491235
|
-
import { join as
|
|
491499
|
+
import { join as join158 } from "path";
|
|
491236
491500
|
function getMdmRuntimeState() {
|
|
491237
491501
|
const globalStore = globalThis;
|
|
491238
491502
|
const key = "__openclaudeMdmRuntimeState";
|
|
@@ -491319,7 +491583,7 @@ function consumeRawReadResult(raw) {
|
|
|
491319
491583
|
}
|
|
491320
491584
|
function hasManagedSettingsFile() {
|
|
491321
491585
|
try {
|
|
491322
|
-
const filePath =
|
|
491586
|
+
const filePath = join158(getManagedFilePath(), "managed-settings.json");
|
|
491323
491587
|
const content = readFileSync6(filePath);
|
|
491324
491588
|
const data = safeParseJSON(content, false);
|
|
491325
491589
|
if (data && typeof data === "object" && Object.keys(data).length > 0) {
|
|
@@ -491334,7 +491598,7 @@ function hasManagedSettingsFile() {
|
|
|
491334
491598
|
continue;
|
|
491335
491599
|
}
|
|
491336
491600
|
try {
|
|
491337
|
-
const content = readFileSync6(
|
|
491601
|
+
const content = readFileSync6(join158(dropInDir, d.name));
|
|
491338
491602
|
const data = safeParseJSON(content, false);
|
|
491339
491603
|
if (data && typeof data === "object" && Object.keys(data).length > 0) {
|
|
491340
491604
|
return true;
|
|
@@ -491361,9 +491625,9 @@ var init_settings2 = __esm(() => {
|
|
|
491361
491625
|
});
|
|
491362
491626
|
|
|
491363
491627
|
// src/utils/settings/settings.ts
|
|
491364
|
-
import { dirname as dirname68, join as
|
|
491628
|
+
import { dirname as dirname68, join as join159, resolve as resolve51 } from "path";
|
|
491365
491629
|
function getManagedSettingsFilePath() {
|
|
491366
|
-
return
|
|
491630
|
+
return join159(getManagedFilePath(), "managed-settings.json");
|
|
491367
491631
|
}
|
|
491368
491632
|
function loadManagedFileSettings() {
|
|
491369
491633
|
const errors3 = [];
|
|
@@ -491379,7 +491643,7 @@ function loadManagedFileSettings() {
|
|
|
491379
491643
|
try {
|
|
491380
491644
|
const entries = getFsImplementation().readdirSync(dropInDir).filter((d) => (d.isFile() || d.isSymbolicLink()) && d.name.endsWith(".json") && !d.name.startsWith(".")).map((d) => d.name).sort();
|
|
491381
491645
|
for (const name of entries) {
|
|
491382
|
-
const { settings: settings2, errors: fileErrors } = parseSettingsFile(
|
|
491646
|
+
const { settings: settings2, errors: fileErrors } = parseSettingsFile(join159(dropInDir, name));
|
|
491383
491647
|
errors3.push(...fileErrors);
|
|
491384
491648
|
if (settings2 && Object.keys(settings2).length > 0) {
|
|
491385
491649
|
merged = mergeWith_default(merged, settings2, settingsMergeCustomizer);
|
|
@@ -491477,10 +491741,10 @@ function getUserSettingsFilePath() {
|
|
|
491477
491741
|
function getSettingsFilePathForSource(source) {
|
|
491478
491742
|
switch (source) {
|
|
491479
491743
|
case "userSettings":
|
|
491480
|
-
return
|
|
491744
|
+
return join159(getSettingsRootPathForSource(source), getUserSettingsFilePath());
|
|
491481
491745
|
case "projectSettings":
|
|
491482
491746
|
case "localSettings": {
|
|
491483
|
-
return
|
|
491747
|
+
return join159(getSettingsRootPathForSource(source), getRelativeSettingsFilePathForSource(source));
|
|
491484
491748
|
}
|
|
491485
491749
|
case "policySettings":
|
|
491486
491750
|
return getManagedSettingsFilePath();
|
|
@@ -492234,7 +492498,7 @@ function resolveModelRuntimeLimits(options2) {
|
|
|
492234
492498
|
if (options2.baseUrl !== undefined) {
|
|
492235
492499
|
runtimeEnv.OPENAI_BASE_URL = options2.baseUrl;
|
|
492236
492500
|
}
|
|
492237
|
-
const routeId = resolveActiveRouteIdFromEnv(runtimeEnv, {
|
|
492501
|
+
const routeId = options2.resolvedRouteId !== undefined ? options2.resolvedRouteId : resolveActiveRouteIdFromEnv(runtimeEnv, {
|
|
492238
492502
|
activeProfileProvider: options2?.activeProfileProvider,
|
|
492239
492503
|
activeProfileBaseUrl: options2?.baseUrl
|
|
492240
492504
|
});
|
|
@@ -492247,10 +492511,9 @@ function resolveModelRuntimeLimits(options2) {
|
|
|
492247
492511
|
const externalContextWindow = getOpenAIContextWindowMatches(modelApiName, runtimeEnv);
|
|
492248
492512
|
const externalMaxOutputTokens = getOpenAIMaxOutputTokenMatches(modelApiName, runtimeEnv);
|
|
492249
492513
|
const settings = getInitialSettings();
|
|
492250
|
-
const resolvedWindow = settings.maxContextWindow !== undefined ? settings.maxContextWindow : externalContextWindow.exact ?? catalogEntry3?.contextWindow ?? cachedCatalogEntry?.contextWindow ?? externalContextWindow.prefix ?? externalContextWindow.settings ?? modelDescriptor?.contextWindow;
|
|
492251
492514
|
return {
|
|
492252
|
-
contextWindow:
|
|
492253
|
-
maxOutputTokens: externalMaxOutputTokens.exact ?? catalogEntry3?.maxOutputTokens ??
|
|
492515
|
+
contextWindow: settings.maxContextWindow !== undefined ? settings.maxContextWindow : externalContextWindow.exact ?? catalogEntry3?.contextWindow ?? externalContextWindow.prefix ?? externalContextWindow.settings ?? cachedCatalogEntry?.contextWindow ?? modelDescriptor?.contextWindow,
|
|
492516
|
+
maxOutputTokens: externalMaxOutputTokens.exact ?? catalogEntry3?.maxOutputTokens ?? externalMaxOutputTokens.prefix ?? externalMaxOutputTokens.settings ?? cachedCatalogEntry?.maxOutputTokens ?? modelDescriptor?.maxOutputTokens
|
|
492254
492517
|
};
|
|
492255
492518
|
}
|
|
492256
492519
|
function usesAnthropicNativeMessageFormat(options2) {
|
|
@@ -492294,7 +492557,7 @@ import { existsSync as existsSync12, readFileSync as readFileSync17 } from "node
|
|
|
492294
492557
|
import { createHash as createHash26 } from "node:crypto";
|
|
492295
492558
|
import { isIP as isIP2 } from "node:net";
|
|
492296
492559
|
import { homedir as homedir35 } from "node:os";
|
|
492297
|
-
import { join as
|
|
492560
|
+
import { join as join160 } from "node:path";
|
|
492298
492561
|
function asGithubEnterpriseEnvUrl(value) {
|
|
492299
492562
|
const trimmed = value?.trim();
|
|
492300
492563
|
if (!trimmed || trimmed.toLowerCase() === "undefined") {
|
|
@@ -492878,8 +493141,8 @@ function resolveCodexAuthPath(env4 = process.env) {
|
|
|
492878
493141
|
return explicit;
|
|
492879
493142
|
const codexHome = asTrimmedString(env4.CODEX_HOME);
|
|
492880
493143
|
if (codexHome)
|
|
492881
|
-
return
|
|
492882
|
-
return
|
|
493144
|
+
return join160(codexHome, "auth.json");
|
|
493145
|
+
return join160(homedir35(), ".codex", "auth.json");
|
|
492883
493146
|
}
|
|
492884
493147
|
function loadCodexAuthJson(authPath) {
|
|
492885
493148
|
if (!existsSync12(authPath))
|
|
@@ -496035,7 +496298,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
496035
496298
|
slash_commands: inputs.commands.filter((c6) => c6.userInvocable !== false).map((c6) => c6.name),
|
|
496036
496299
|
apiKeySource: getAnthropicApiKeyWithSource().source,
|
|
496037
496300
|
betas: getSdkBetas(),
|
|
496038
|
-
claude_code_version: "0.30.
|
|
496301
|
+
claude_code_version: "0.30.2-by-rayss",
|
|
496039
496302
|
output_style: outputStyle2,
|
|
496040
496303
|
agents: inputs.agents.map((agent) => agent.agentType),
|
|
496041
496304
|
skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
|
|
@@ -497599,4 +497862,4 @@ export {
|
|
|
497599
497862
|
createAcpServer
|
|
497600
497863
|
};
|
|
497601
497864
|
|
|
497602
|
-
//# debugId=
|
|
497865
|
+
//# debugId=B0E189899778438064756E2164756E21
|