localclawd 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +607 -674
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -86651,7 +86651,7 @@ function getDefaultLocalLLMConfig(provider = "vllm") {
|
|
|
86651
86651
|
function getLocalLLMProviderLabel(provider) {
|
|
86652
86652
|
switch (provider) {
|
|
86653
86653
|
case "vllm":
|
|
86654
|
-
return "
|
|
86654
|
+
return "Local endpoint";
|
|
86655
86655
|
case "ollama":
|
|
86656
86656
|
return "Ollama";
|
|
86657
86657
|
case "openai":
|
|
@@ -87564,7 +87564,7 @@ var init_isEqual = __esm(() => {
|
|
|
87564
87564
|
|
|
87565
87565
|
// src/utils/userAgent.ts
|
|
87566
87566
|
function getClaudeCodeUserAgent() {
|
|
87567
|
-
return `claude-code/${"1.3.
|
|
87567
|
+
return `claude-code/${"1.3.3"}`;
|
|
87568
87568
|
}
|
|
87569
87569
|
|
|
87570
87570
|
// src/utils/workloadContext.ts
|
|
@@ -87586,7 +87586,7 @@ function getUserAgent() {
|
|
|
87586
87586
|
const clientApp = process.env.CLAUDE_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}` : "";
|
|
87587
87587
|
const workload = getWorkload();
|
|
87588
87588
|
const workloadSuffix = workload ? `, workload/${workload}` : "";
|
|
87589
|
-
return `claude-cli/${"1.3.
|
|
87589
|
+
return `claude-cli/${"1.3.3"} (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
|
|
87590
87590
|
}
|
|
87591
87591
|
function getMCPUserAgent() {
|
|
87592
87592
|
const parts = [];
|
|
@@ -87600,7 +87600,7 @@ function getMCPUserAgent() {
|
|
|
87600
87600
|
parts.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`);
|
|
87601
87601
|
}
|
|
87602
87602
|
const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
87603
|
-
return `claude-code/${"1.3.
|
|
87603
|
+
return `claude-code/${"1.3.3"}${suffix}`;
|
|
87604
87604
|
}
|
|
87605
87605
|
function getWebFetchUserAgent() {
|
|
87606
87606
|
return `Claude-User (${getClaudeCodeUserAgent()}; +https://support.anthropic.com/)`;
|
|
@@ -130791,7 +130791,7 @@ function getAttributionHeader(fingerprint) {
|
|
|
130791
130791
|
if (!isAttributionHeaderEnabled()) {
|
|
130792
130792
|
return "";
|
|
130793
130793
|
}
|
|
130794
|
-
const version = `${"1.3.
|
|
130794
|
+
const version = `${"1.3.3"}.${fingerprint}`;
|
|
130795
130795
|
const entrypoint = process.env.CLAUDE_CODE_ENTRYPOINT ?? "unknown";
|
|
130796
130796
|
const cch = "";
|
|
130797
130797
|
const workload = getWorkload();
|
|
@@ -146980,7 +146980,7 @@ var init_metadata = __esm(() => {
|
|
|
146980
146980
|
COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
|
|
146981
146981
|
WHITESPACE_REGEX = /\s+/;
|
|
146982
146982
|
getVersionBase = memoize_default(() => {
|
|
146983
|
-
const match = "1.3.
|
|
146983
|
+
const match = "1.3.3".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
|
|
146984
146984
|
return match ? match[0] : undefined;
|
|
146985
146985
|
});
|
|
146986
146986
|
buildEnvContext = memoize_default(async () => {
|
|
@@ -147020,9 +147020,9 @@ var init_metadata = __esm(() => {
|
|
|
147020
147020
|
isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
|
|
147021
147021
|
isClaudeCodeAction: isEnvTruthy(process.env.CLAUDE_CODE_ACTION),
|
|
147022
147022
|
isClaudeAiAuth: isClaudeAISubscriber(),
|
|
147023
|
-
version: "1.3.
|
|
147023
|
+
version: "1.3.3",
|
|
147024
147024
|
versionBase: getVersionBase(),
|
|
147025
|
-
buildTime: "2026-04-
|
|
147025
|
+
buildTime: "2026-04-23T19:20:47.066Z",
|
|
147026
147026
|
deploymentEnvironment: env3.detectDeploymentEnvironment(),
|
|
147027
147027
|
...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
|
|
147028
147028
|
githubEventName: process.env.GITHUB_EVENT_NAME,
|
|
@@ -179501,7 +179501,7 @@ function getTelemetryAttributes() {
|
|
|
179501
179501
|
attributes["session.id"] = sessionId;
|
|
179502
179502
|
}
|
|
179503
179503
|
if (shouldIncludeAttribute("OTEL_METRICS_INCLUDE_VERSION")) {
|
|
179504
|
-
attributes["app.version"] = "1.3.
|
|
179504
|
+
attributes["app.version"] = "1.3.3";
|
|
179505
179505
|
}
|
|
179506
179506
|
const oauthAccount = getOauthAccountInfo();
|
|
179507
179507
|
if (oauthAccount) {
|
|
@@ -242293,7 +242293,7 @@ function getInstallationEnv() {
|
|
|
242293
242293
|
return;
|
|
242294
242294
|
}
|
|
242295
242295
|
function getClaudeCodeVersion() {
|
|
242296
|
-
return "1.3.
|
|
242296
|
+
return "1.3.3";
|
|
242297
242297
|
}
|
|
242298
242298
|
async function getInstalledVSCodeExtensionVersion(command) {
|
|
242299
242299
|
const { stdout } = await execFileNoThrow(command, ["--list-extensions", "--show-versions"], {
|
|
@@ -247567,7 +247567,7 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
|
|
|
247567
247567
|
const client4 = new Client({
|
|
247568
247568
|
name: "localclawd",
|
|
247569
247569
|
title: "localclawd",
|
|
247570
|
-
version: "1.3.
|
|
247570
|
+
version: "1.3.3",
|
|
247571
247571
|
description: "local-first AI coding tool",
|
|
247572
247572
|
websiteUrl: PRODUCT_URL
|
|
247573
247573
|
}, {
|
|
@@ -247909,7 +247909,7 @@ var init_client9 = __esm(() => {
|
|
|
247909
247909
|
const client4 = new Client({
|
|
247910
247910
|
name: "localclawd",
|
|
247911
247911
|
title: "localclawd",
|
|
247912
|
-
version: "1.3.
|
|
247912
|
+
version: "1.3.3",
|
|
247913
247913
|
description: "local-first AI coding tool",
|
|
247914
247914
|
websiteUrl: PRODUCT_URL
|
|
247915
247915
|
}, {
|
|
@@ -262299,7 +262299,7 @@ function computeFingerprint(messageText, version) {
|
|
|
262299
262299
|
}
|
|
262300
262300
|
function computeFingerprintFromMessages(messages) {
|
|
262301
262301
|
const firstMessageText = extractFirstMessageText(messages);
|
|
262302
|
-
return computeFingerprint(firstMessageText, "1.3.
|
|
262302
|
+
return computeFingerprint(firstMessageText, "1.3.3");
|
|
262303
262303
|
}
|
|
262304
262304
|
var FINGERPRINT_SALT = "59cf53e54c78";
|
|
262305
262305
|
var init_fingerprint = () => {};
|
|
@@ -262341,7 +262341,7 @@ async function sideQuery(opts) {
|
|
|
262341
262341
|
betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
|
|
262342
262342
|
}
|
|
262343
262343
|
const messageText = extractFirstUserMessageText(messages);
|
|
262344
|
-
const fingerprint = computeFingerprint(messageText, "1.3.
|
|
262344
|
+
const fingerprint = computeFingerprint(messageText, "1.3.3");
|
|
262345
262345
|
const attributionHeader = getAttributionHeader(fingerprint);
|
|
262346
262346
|
const systemBlocks = [
|
|
262347
262347
|
attributionHeader ? { type: "text", text: attributionHeader } : null,
|
|
@@ -283065,7 +283065,7 @@ var init_user = __esm(() => {
|
|
|
283065
283065
|
deviceId,
|
|
283066
283066
|
sessionId: getSessionId(),
|
|
283067
283067
|
email: getEmail(),
|
|
283068
|
-
appVersion: "1.3.
|
|
283068
|
+
appVersion: "1.3.3",
|
|
283069
283069
|
platform: getHostPlatformForAnalytics(),
|
|
283070
283070
|
organizationUuid,
|
|
283071
283071
|
accountUuid,
|
|
@@ -284130,7 +284130,7 @@ async function initializeBetaTracing(resource) {
|
|
|
284130
284130
|
});
|
|
284131
284131
|
logs.setGlobalLoggerProvider(loggerProvider);
|
|
284132
284132
|
setLoggerProvider(loggerProvider);
|
|
284133
|
-
const eventLogger = logs.getLogger("com.anthropic.claude_code.events", "1.3.
|
|
284133
|
+
const eventLogger = logs.getLogger("com.anthropic.claude_code.events", "1.3.3");
|
|
284134
284134
|
setEventLogger(eventLogger);
|
|
284135
284135
|
process.on("beforeExit", async () => {
|
|
284136
284136
|
await loggerProvider?.forceFlush();
|
|
@@ -284170,7 +284170,7 @@ async function initializeTelemetry() {
|
|
|
284170
284170
|
const platform2 = getPlatform();
|
|
284171
284171
|
const baseAttributes = {
|
|
284172
284172
|
[ATTR_SERVICE_NAME4]: "claude-code",
|
|
284173
|
-
[ATTR_SERVICE_VERSION4]: "1.3.
|
|
284173
|
+
[ATTR_SERVICE_VERSION4]: "1.3.3"
|
|
284174
284174
|
};
|
|
284175
284175
|
if (platform2 === "wsl") {
|
|
284176
284176
|
const wslVersion = getWslVersion();
|
|
@@ -284215,7 +284215,7 @@ async function initializeTelemetry() {
|
|
|
284215
284215
|
} catch {}
|
|
284216
284216
|
};
|
|
284217
284217
|
registerCleanup(shutdownTelemetry2);
|
|
284218
|
-
return meterProvider2.getMeter("com.anthropic.claude_code", "1.3.
|
|
284218
|
+
return meterProvider2.getMeter("com.anthropic.claude_code", "1.3.3");
|
|
284219
284219
|
}
|
|
284220
284220
|
const meterProvider = new MeterProvider4({
|
|
284221
284221
|
resource,
|
|
@@ -284235,7 +284235,7 @@ async function initializeTelemetry() {
|
|
|
284235
284235
|
});
|
|
284236
284236
|
logs.setGlobalLoggerProvider(loggerProvider);
|
|
284237
284237
|
setLoggerProvider(loggerProvider);
|
|
284238
|
-
const eventLogger = logs.getLogger("com.anthropic.claude_code.events", "1.3.
|
|
284238
|
+
const eventLogger = logs.getLogger("com.anthropic.claude_code.events", "1.3.3");
|
|
284239
284239
|
setEventLogger(eventLogger);
|
|
284240
284240
|
logForDebugging("[3P telemetry] Event logger set successfully");
|
|
284241
284241
|
process.on("beforeExit", async () => {
|
|
@@ -284297,7 +284297,7 @@ Current timeout: ${timeoutMs}ms
|
|
|
284297
284297
|
}
|
|
284298
284298
|
};
|
|
284299
284299
|
registerCleanup(shutdownTelemetry);
|
|
284300
|
-
return meterProvider.getMeter("com.anthropic.claude_code", "1.3.
|
|
284300
|
+
return meterProvider.getMeter("com.anthropic.claude_code", "1.3.3");
|
|
284301
284301
|
}
|
|
284302
284302
|
async function flushTelemetry() {
|
|
284303
284303
|
const meterProvider = getMeterProvider();
|
|
@@ -285487,7 +285487,7 @@ function detectLinuxGlobPatternWarnings() {
|
|
|
285487
285487
|
}
|
|
285488
285488
|
async function getDoctorDiagnostic() {
|
|
285489
285489
|
const installationType = await getCurrentInstallationType();
|
|
285490
|
-
const version = typeof MACRO !== "undefined" ? "1.3.
|
|
285490
|
+
const version = typeof MACRO !== "undefined" ? "1.3.3" : "unknown";
|
|
285491
285491
|
const installationPath = await getInstallationPath();
|
|
285492
285492
|
const invokedBinary = getInvokedBinary();
|
|
285493
285493
|
const multipleInstallations = await detectMultipleInstallations();
|
|
@@ -286428,8 +286428,8 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
286428
286428
|
const maxVersion = await getMaxVersion();
|
|
286429
286429
|
if (maxVersion && gt(version, maxVersion)) {
|
|
286430
286430
|
logForDebugging(`Native installer: maxVersion ${maxVersion} is set, capping update from ${version} to ${maxVersion}`);
|
|
286431
|
-
if (gte("1.3.
|
|
286432
|
-
logForDebugging(`Native installer: current version ${"1.3.
|
|
286431
|
+
if (gte("1.3.3", maxVersion)) {
|
|
286432
|
+
logForDebugging(`Native installer: current version ${"1.3.3"} is already at or above maxVersion ${maxVersion}, skipping update`);
|
|
286433
286433
|
logEvent("tengu_native_update_skipped_max_version", {
|
|
286434
286434
|
latency_ms: Date.now() - startTime,
|
|
286435
286435
|
max_version: maxVersion,
|
|
@@ -286440,7 +286440,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
286440
286440
|
version = maxVersion;
|
|
286441
286441
|
}
|
|
286442
286442
|
}
|
|
286443
|
-
if (!forceReinstall && version === "1.3.
|
|
286443
|
+
if (!forceReinstall && version === "1.3.3" && await versionIsAvailable(version) && await isPossibleLocalClawdBinary(executablePath)) {
|
|
286444
286444
|
logForDebugging(`Found ${version} at ${executablePath}, skipping install`);
|
|
286445
286445
|
logEvent("tengu_native_update_complete", {
|
|
286446
286446
|
latency_ms: Date.now() - startTime,
|
|
@@ -330829,7 +330829,7 @@ function getAnthropicEnvMetadata() {
|
|
|
330829
330829
|
function getBuildAgeMinutes() {
|
|
330830
330830
|
if (false)
|
|
330831
330831
|
;
|
|
330832
|
-
const buildTime = new Date("2026-04-
|
|
330832
|
+
const buildTime = new Date("2026-04-23T19:20:47.066Z").getTime();
|
|
330833
330833
|
if (isNaN(buildTime))
|
|
330834
330834
|
return;
|
|
330835
330835
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -359154,7 +359154,7 @@ function Feedback({
|
|
|
359154
359154
|
platform: env3.platform,
|
|
359155
359155
|
gitRepo: envInfo.isGit,
|
|
359156
359156
|
terminal: env3.terminal,
|
|
359157
|
-
version: "1.3.
|
|
359157
|
+
version: "1.3.3",
|
|
359158
359158
|
transcript: normalizeMessagesForAPI(messages),
|
|
359159
359159
|
errors: sanitizedErrors,
|
|
359160
359160
|
lastApiRequest: getLastAPIRequest(),
|
|
@@ -359346,7 +359346,7 @@ function Feedback({
|
|
|
359346
359346
|
", ",
|
|
359347
359347
|
env3.terminal,
|
|
359348
359348
|
", v",
|
|
359349
|
-
"1.3.
|
|
359349
|
+
"1.3.3"
|
|
359350
359350
|
]
|
|
359351
359351
|
}, undefined, true, undefined, this)
|
|
359352
359352
|
]
|
|
@@ -359452,7 +359452,7 @@ ${sanitizedDescription}
|
|
|
359452
359452
|
` + `**Environment Info**
|
|
359453
359453
|
` + `- Platform: ${env3.platform}
|
|
359454
359454
|
` + `- Terminal: ${env3.terminal}
|
|
359455
|
-
` + `- Version: ${"1.3.
|
|
359455
|
+
` + `- Version: ${"1.3.3"}
|
|
359456
359456
|
` + `- Feedback ID: ${feedbackId}
|
|
359457
359457
|
` + `
|
|
359458
359458
|
**Errors**
|
|
@@ -362080,7 +362080,7 @@ function buildPrimarySection() {
|
|
|
362080
362080
|
}, undefined, false, undefined, this);
|
|
362081
362081
|
return [{
|
|
362082
362082
|
label: "Version",
|
|
362083
|
-
value: "1.3.
|
|
362083
|
+
value: "1.3.3"
|
|
362084
362084
|
}, {
|
|
362085
362085
|
label: "Session name",
|
|
362086
362086
|
value: nameValue
|
|
@@ -363546,64 +363546,60 @@ async function fetchAvailableModels(baseUrl, provider, apiKey, signal) {
|
|
|
363546
363546
|
return { ok: false, error: `Could not reach ${trimmed}: ${msg}` };
|
|
363547
363547
|
}
|
|
363548
363548
|
}
|
|
363549
|
-
|
|
363550
|
-
|
|
363551
|
-
|
|
363549
|
+
var MODEL_SCAN_TIMEOUT_MS = 5000;
|
|
363550
|
+
|
|
363551
|
+
// src/utils/model/endpointHistory.ts
|
|
363552
|
+
import { mkdir as mkdir27, readFile as readFile36, writeFile as writeFile29 } from "fs/promises";
|
|
363553
|
+
import { join as join104 } from "path";
|
|
363554
|
+
import { homedir as homedir26 } from "os";
|
|
363555
|
+
async function loadEndpointHistory() {
|
|
363552
363556
|
try {
|
|
363553
|
-
const
|
|
363554
|
-
const
|
|
363555
|
-
|
|
363556
|
-
|
|
363557
|
-
|
|
363558
|
-
try {
|
|
363559
|
-
res = await fetch(`${url3}/models`, { signal: controller.signal });
|
|
363560
|
-
} finally {
|
|
363561
|
-
clearTimeout(timer);
|
|
363562
|
-
parentSignal.removeEventListener("abort", onParentAbort);
|
|
363563
|
-
}
|
|
363564
|
-
if (!res.ok)
|
|
363565
|
-
return null;
|
|
363566
|
-
const json = await res.json();
|
|
363567
|
-
const models = (json.data ?? []).map((m2) => m2.id).filter(Boolean);
|
|
363568
|
-
return models.length > 0 ? models : null;
|
|
363557
|
+
const raw = await readFile36(HISTORY_PATH, "utf-8");
|
|
363558
|
+
const parsed = JSON.parse(raw);
|
|
363559
|
+
if (parsed.version !== 1)
|
|
363560
|
+
return [];
|
|
363561
|
+
return parsed.entries ?? [];
|
|
363569
363562
|
} catch {
|
|
363570
|
-
return
|
|
363563
|
+
return [];
|
|
363571
363564
|
}
|
|
363572
363565
|
}
|
|
363573
|
-
async function
|
|
363574
|
-
|
|
363575
|
-
|
|
363576
|
-
|
|
363577
|
-
|
|
363578
|
-
|
|
363579
|
-
}
|
|
363580
|
-
|
|
363581
|
-
|
|
363582
|
-
|
|
363583
|
-
|
|
363584
|
-
|
|
363585
|
-
|
|
363586
|
-
|
|
363587
|
-
|
|
363588
|
-
|
|
363589
|
-
|
|
363590
|
-
|
|
363591
|
-
|
|
363592
|
-
|
|
363593
|
-
|
|
363594
|
-
|
|
363595
|
-
|
|
363596
|
-
|
|
363597
|
-
|
|
363598
|
-
|
|
363566
|
+
async function recordEndpointUse(url3, provider) {
|
|
363567
|
+
try {
|
|
363568
|
+
const existing = await loadEndpointHistory();
|
|
363569
|
+
const filtered = existing.filter((e) => e.url !== url3);
|
|
363570
|
+
filtered.unshift({ url: url3, provider, lastUsed: Date.now() });
|
|
363571
|
+
const capped = filtered.slice(0, MAX_ENTRIES);
|
|
363572
|
+
await mkdir27(join104(homedir26(), ".claude"), { recursive: true });
|
|
363573
|
+
await writeFile29(HISTORY_PATH, JSON.stringify({ version: 1, entries: capped }, null, 2), "utf-8");
|
|
363574
|
+
} catch {}
|
|
363575
|
+
}
|
|
363576
|
+
function commonPresetsForProvider(provider) {
|
|
363577
|
+
switch (provider) {
|
|
363578
|
+
case "vllm":
|
|
363579
|
+
return [
|
|
363580
|
+
"http://127.0.0.1:8000/v1",
|
|
363581
|
+
"http://localhost:8000/v1",
|
|
363582
|
+
"http://<hostname>.local:8000/v1"
|
|
363583
|
+
];
|
|
363584
|
+
case "ollama":
|
|
363585
|
+
return [
|
|
363586
|
+
"http://127.0.0.1:11434/v1",
|
|
363587
|
+
"http://localhost:11434/v1",
|
|
363588
|
+
"http://<hostname>.local:11434/v1"
|
|
363589
|
+
];
|
|
363590
|
+
case "openai":
|
|
363591
|
+
return [
|
|
363592
|
+
"https://api.openai.com/v1",
|
|
363593
|
+
"https://api.groq.com/openai/v1",
|
|
363594
|
+
"https://openrouter.ai/api/v1"
|
|
363595
|
+
];
|
|
363596
|
+
default:
|
|
363597
|
+
return [];
|
|
363599
363598
|
}
|
|
363600
|
-
const workers = Array.from({ length: NETWORK_CONCURRENCY }, () => worker());
|
|
363601
|
-
await Promise.all(workers);
|
|
363602
|
-
return found;
|
|
363603
363599
|
}
|
|
363604
|
-
var
|
|
363605
|
-
var
|
|
363606
|
-
|
|
363600
|
+
var HISTORY_PATH, MAX_ENTRIES = 10;
|
|
363601
|
+
var init_endpointHistory = __esm(() => {
|
|
363602
|
+
HISTORY_PATH = join104(homedir26(), ".claude", "endpoints.json");
|
|
363607
363603
|
});
|
|
363608
363604
|
|
|
363609
363605
|
// src/components/Spinner/TriangleSpinner.tsx
|
|
@@ -363644,7 +363640,7 @@ var init_TriangleSpinner = __esm(() => {
|
|
|
363644
363640
|
|
|
363645
363641
|
// src/components/LocalBackendSetup.tsx
|
|
363646
363642
|
function SimpleMenu({ items, isActive, onSelect, onCancel }) {
|
|
363647
|
-
const VISIBLE = Math.min(
|
|
363643
|
+
const VISIBLE = Math.min(8, items.length);
|
|
363648
363644
|
const [focusIdx, setFocusIdx] = import_react99.useState(0);
|
|
363649
363645
|
const [fromIdx, setFromIdx] = import_react99.useState(0);
|
|
363650
363646
|
const doneRef = import_react99.useRef(false);
|
|
@@ -363701,7 +363697,7 @@ function SimpleMenu({ items, isActive, onSelect, onCancel }) {
|
|
|
363701
363697
|
children: item.label
|
|
363702
363698
|
}, undefined, false, undefined, this)
|
|
363703
363699
|
]
|
|
363704
|
-
}, String(item.value)
|
|
363700
|
+
}, `${String(item.value)}-${i2}`, true, undefined, this);
|
|
363705
363701
|
}),
|
|
363706
363702
|
showScrollDown && /* @__PURE__ */ jsx_dev_runtime169.jsxDEV(ThemedText, {
|
|
363707
363703
|
dimColor: true,
|
|
@@ -363714,8 +363710,8 @@ function getProviderGuidance(provider) {
|
|
|
363714
363710
|
switch (provider) {
|
|
363715
363711
|
case "vllm":
|
|
363716
363712
|
return {
|
|
363717
|
-
baseUrl: "
|
|
363718
|
-
model: "Select a model discovered from your
|
|
363713
|
+
baseUrl: "Enter the URL of your server. For mDNS-enabled LANs use http://<hostname>.local:<port>/v1.",
|
|
363714
|
+
model: "Select a model discovered from your server, or type a name to override.",
|
|
363719
363715
|
apiKey: "Leave blank for local servers without auth, or paste the gateway token if required."
|
|
363720
363716
|
};
|
|
363721
363717
|
case "ollama":
|
|
@@ -363737,7 +363733,7 @@ function LocalBackendSetup({
|
|
|
363737
363733
|
onComplete,
|
|
363738
363734
|
onCancel,
|
|
363739
363735
|
title = "Configure your model backend",
|
|
363740
|
-
description = "localclawd speaks to OpenAI-compatible chat completion APIs. Pick a backend,
|
|
363736
|
+
description = "localclawd speaks to OpenAI-compatible chat completion APIs. Pick a backend, confirm the URL, and select a model.",
|
|
363741
363737
|
showSaveGloballyOption = false
|
|
363742
363738
|
}) {
|
|
363743
363739
|
const normalizedInitial = import_react99.useMemo(() => normalizeLocalLLMConfig(initialConfig), [initialConfig]);
|
|
@@ -363750,18 +363746,13 @@ function LocalBackendSetup({
|
|
|
363750
363746
|
const [error5, setError] = import_react99.useState(null);
|
|
363751
363747
|
const [availableModels, setAvailableModels] = import_react99.useState([]);
|
|
363752
363748
|
const [scanError, setScanError] = import_react99.useState(null);
|
|
363753
|
-
const [
|
|
363754
|
-
const [discoveredEndpoints, setDiscoveredEndpoints] = import_react99.useState([]);
|
|
363755
|
-
const networkAbortRef = import_react99.useRef(null);
|
|
363749
|
+
const [history, setHistory] = import_react99.useState([]);
|
|
363756
363750
|
const modelScanAbortRef = import_react99.useRef(null);
|
|
363757
|
-
const discoveredSnapshotRef = import_react99.useRef([]);
|
|
363758
363751
|
const scanStepDoneRef = import_react99.useRef(false);
|
|
363759
363752
|
import_react99.useEffect(() => {
|
|
363760
|
-
|
|
363761
|
-
networkAbortRef.current?.abort();
|
|
363762
|
-
modelScanAbortRef.current?.abort();
|
|
363763
|
-
};
|
|
363753
|
+
loadEndpointHistory().then(setHistory);
|
|
363764
363754
|
}, []);
|
|
363755
|
+
import_react99.useEffect(() => () => modelScanAbortRef.current?.abort(), []);
|
|
363765
363756
|
import_react99.useEffect(() => {
|
|
363766
363757
|
scanStepDoneRef.current = false;
|
|
363767
363758
|
}, [step]);
|
|
@@ -363772,14 +363763,7 @@ function LocalBackendSetup({
|
|
|
363772
363763
|
use_input_default((_input, key) => {
|
|
363773
363764
|
if (scanStepDoneRef.current)
|
|
363774
363765
|
return;
|
|
363775
|
-
if (step === "
|
|
363776
|
-
if (key.escape || key.return) {
|
|
363777
|
-
scanStepDoneRef.current = true;
|
|
363778
|
-
networkAbortRef.current?.abort();
|
|
363779
|
-
setDiscoveredEndpoints(discoveredSnapshotRef.current);
|
|
363780
|
-
setStep("selectEndpoint");
|
|
363781
|
-
}
|
|
363782
|
-
} else if (step === "scanningModels") {
|
|
363766
|
+
if (step === "scanningModels") {
|
|
363783
363767
|
if (key.escape) {
|
|
363784
363768
|
scanStepDoneRef.current = true;
|
|
363785
363769
|
modelScanAbortRef.current?.abort();
|
|
@@ -363792,22 +363776,18 @@ function LocalBackendSetup({
|
|
|
363792
363776
|
setStep("model");
|
|
363793
363777
|
}
|
|
363794
363778
|
}
|
|
363795
|
-
}, { isActive: step === "
|
|
363779
|
+
}, { isActive: step === "scanningModels" });
|
|
363796
363780
|
function goBack() {
|
|
363797
363781
|
setError(null);
|
|
363798
363782
|
switch (step) {
|
|
363799
363783
|
case "provider":
|
|
363800
363784
|
onCancel?.();
|
|
363801
363785
|
break;
|
|
363802
|
-
case "
|
|
363803
|
-
networkAbortRef.current?.abort();
|
|
363804
|
-
setStep("provider");
|
|
363805
|
-
break;
|
|
363806
|
-
case "selectEndpoint":
|
|
363786
|
+
case "pickUrl":
|
|
363807
363787
|
setStep("provider");
|
|
363808
363788
|
break;
|
|
363809
363789
|
case "baseUrl":
|
|
363810
|
-
setStep(
|
|
363790
|
+
setStep("pickUrl");
|
|
363811
363791
|
break;
|
|
363812
363792
|
case "scanningModels":
|
|
363813
363793
|
modelScanAbortRef.current?.abort();
|
|
@@ -363833,43 +363813,17 @@ function LocalBackendSetup({
|
|
|
363833
363813
|
setError(null);
|
|
363834
363814
|
setScanError(null);
|
|
363835
363815
|
setAvailableModels([]);
|
|
363836
|
-
|
|
363837
|
-
if (nextProvider === "vllm")
|
|
363838
|
-
startNetworkScan(defaults2.baseUrl);
|
|
363839
|
-
else
|
|
363840
|
-
setStep("baseUrl");
|
|
363841
|
-
}
|
|
363842
|
-
function startNetworkScan(defaultUrl) {
|
|
363843
|
-
networkAbortRef.current?.abort();
|
|
363844
|
-
const abort = new AbortController;
|
|
363845
|
-
networkAbortRef.current = abort;
|
|
363846
|
-
discoveredSnapshotRef.current = [];
|
|
363847
|
-
setDiscoveredEndpoints([]);
|
|
363848
|
-
setNetworkProgress(null);
|
|
363849
|
-
setStep("networkScan");
|
|
363850
|
-
scanLocalNetworkForVllm("192.168.1", abort.signal, (progress) => {
|
|
363851
|
-
if (abort.signal.aborted)
|
|
363852
|
-
return;
|
|
363853
|
-
discoveredSnapshotRef.current = [...discoveredSnapshotRef.current];
|
|
363854
|
-
setNetworkProgress(progress);
|
|
363855
|
-
}).then((endpoints) => {
|
|
363856
|
-
if (abort.signal.aborted)
|
|
363857
|
-
return;
|
|
363858
|
-
discoveredSnapshotRef.current = endpoints;
|
|
363859
|
-
setDiscoveredEndpoints(endpoints);
|
|
363860
|
-
setStep("selectEndpoint");
|
|
363861
|
-
}).catch(() => {
|
|
363862
|
-
if (abort.signal.aborted)
|
|
363863
|
-
return;
|
|
363864
|
-
setDiscoveredEndpoints([]);
|
|
363865
|
-
setStep("selectEndpoint");
|
|
363866
|
-
});
|
|
363816
|
+
setStep("pickUrl");
|
|
363867
363817
|
}
|
|
363868
|
-
function
|
|
363818
|
+
function pickUrl(url3) {
|
|
363869
363819
|
if (url3 === "__manual__") {
|
|
363870
363820
|
setStep("baseUrl");
|
|
363871
363821
|
return;
|
|
363872
363822
|
}
|
|
363823
|
+
if (url3.includes("<hostname>")) {
|
|
363824
|
+
setStep("baseUrl");
|
|
363825
|
+
return;
|
|
363826
|
+
}
|
|
363873
363827
|
setBaseUrl(url3);
|
|
363874
363828
|
setError(null);
|
|
363875
363829
|
startModelScan(url3);
|
|
@@ -363933,6 +363887,7 @@ function LocalBackendSetup({
|
|
|
363933
363887
|
const nextConfig = { provider, baseUrl, model, apiKey: value.trim() };
|
|
363934
363888
|
setApiKey(nextConfig.apiKey);
|
|
363935
363889
|
setError(null);
|
|
363890
|
+
recordEndpointUse(baseUrl, provider);
|
|
363936
363891
|
if (showSaveGloballyOption) {
|
|
363937
363892
|
setStep("saveScope");
|
|
363938
363893
|
return;
|
|
@@ -363944,13 +363899,24 @@ function LocalBackendSetup({
|
|
|
363944
363899
|
const apiKeyPlaceholder = provider === "ollama" ? "ollama" : "Leave blank if your endpoint does not require auth";
|
|
363945
363900
|
const guidance = getProviderGuidance(provider);
|
|
363946
363901
|
const modelMenuItems = availableModels.map((m2) => ({ label: m2, value: m2 }));
|
|
363947
|
-
const
|
|
363948
|
-
|
|
363949
|
-
|
|
363950
|
-
|
|
363951
|
-
|
|
363952
|
-
|
|
363953
|
-
|
|
363902
|
+
const matchingHistory = history.filter((h) => h.provider === provider).slice(0, 5);
|
|
363903
|
+
const presets = commonPresetsForProvider(provider);
|
|
363904
|
+
const seen = new Set;
|
|
363905
|
+
const urlPickerItems = [];
|
|
363906
|
+
for (const h of matchingHistory) {
|
|
363907
|
+
if (seen.has(h.url))
|
|
363908
|
+
continue;
|
|
363909
|
+
seen.add(h.url);
|
|
363910
|
+
const when = timeAgo(h.lastUsed);
|
|
363911
|
+
urlPickerItems.push({ label: `${h.url} (used ${when})`, value: h.url });
|
|
363912
|
+
}
|
|
363913
|
+
for (const p of presets) {
|
|
363914
|
+
if (seen.has(p))
|
|
363915
|
+
continue;
|
|
363916
|
+
seen.add(p);
|
|
363917
|
+
urlPickerItems.push({ label: p, value: p });
|
|
363918
|
+
}
|
|
363919
|
+
urlPickerItems.push({ label: "Enter URL manually", value: "__manual__" });
|
|
363954
363920
|
const saveScopeItems = [
|
|
363955
363921
|
{ label: "Save as global default (recommended)", value: "global" },
|
|
363956
363922
|
{ label: "Use only for this launch", value: "session" }
|
|
@@ -363988,66 +363954,20 @@ function LocalBackendSetup({
|
|
|
363988
363954
|
}, undefined, false, undefined, this)
|
|
363989
363955
|
]
|
|
363990
363956
|
}, undefined, true, undefined, this) : null,
|
|
363991
|
-
step === "
|
|
363992
|
-
flexDirection: "column",
|
|
363993
|
-
gap: 1,
|
|
363957
|
+
step === "pickUrl" ? /* @__PURE__ */ jsx_dev_runtime169.jsxDEV(jsx_dev_runtime169.Fragment, {
|
|
363994
363958
|
children: [
|
|
363995
|
-
/* @__PURE__ */ jsx_dev_runtime169.jsxDEV(
|
|
363996
|
-
|
|
363997
|
-
children: [
|
|
363998
|
-
/* @__PURE__ */ jsx_dev_runtime169.jsxDEV(TriangleSpinner, {}, undefined, false, undefined, this),
|
|
363999
|
-
/* @__PURE__ */ jsx_dev_runtime169.jsxDEV(ThemedText, {
|
|
364000
|
-
children: [
|
|
364001
|
-
"Scanning ",
|
|
364002
|
-
/* @__PURE__ */ jsx_dev_runtime169.jsxDEV(ThemedText, {
|
|
364003
|
-
bold: true,
|
|
364004
|
-
children: "192.168.1.0/24"
|
|
364005
|
-
}, undefined, false, undefined, this),
|
|
364006
|
-
" for vLLM endpoints"
|
|
364007
|
-
]
|
|
364008
|
-
}, undefined, true, undefined, this)
|
|
364009
|
-
]
|
|
364010
|
-
}, undefined, true, undefined, this),
|
|
364011
|
-
networkProgress ? /* @__PURE__ */ jsx_dev_runtime169.jsxDEV(ThemedText, {
|
|
364012
|
-
dimColor: true,
|
|
364013
|
-
children: [
|
|
364014
|
-
networkProgress.scanned,
|
|
364015
|
-
"/",
|
|
364016
|
-
networkProgress.total,
|
|
364017
|
-
" hosts probed",
|
|
364018
|
-
networkProgress.found > 0 ? ` · ${networkProgress.found} found` : ""
|
|
364019
|
-
]
|
|
364020
|
-
}, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime169.jsxDEV(ThemedText, {
|
|
364021
|
-
dimColor: true,
|
|
364022
|
-
children: "Starting…"
|
|
363959
|
+
/* @__PURE__ */ jsx_dev_runtime169.jsxDEV(ThemedText, {
|
|
363960
|
+
children: "Pick an endpoint URL, or enter one manually:"
|
|
364023
363961
|
}, undefined, false, undefined, this),
|
|
364024
363962
|
/* @__PURE__ */ jsx_dev_runtime169.jsxDEV(ThemedText, {
|
|
364025
363963
|
dimColor: true,
|
|
364026
|
-
|
|
364027
|
-
|
|
364028
|
-
]
|
|
364029
|
-
}, undefined, true, undefined, this) : null,
|
|
364030
|
-
step === "selectEndpoint" ? /* @__PURE__ */ jsx_dev_runtime169.jsxDEV(jsx_dev_runtime169.Fragment, {
|
|
364031
|
-
children: [
|
|
364032
|
-
discoveredEndpoints.length > 0 ? /* @__PURE__ */ jsx_dev_runtime169.jsxDEV(ThemedText, {
|
|
364033
|
-
children: [
|
|
364034
|
-
"Found ",
|
|
364035
|
-
/* @__PURE__ */ jsx_dev_runtime169.jsxDEV(ThemedText, {
|
|
364036
|
-
bold: true,
|
|
364037
|
-
children: discoveredEndpoints.length
|
|
364038
|
-
}, undefined, false, undefined, this),
|
|
364039
|
-
" vLLM endpoint",
|
|
364040
|
-
discoveredEndpoints.length !== 1 ? "s" : "",
|
|
364041
|
-
" on 192.168.1.0/24"
|
|
364042
|
-
]
|
|
364043
|
-
}, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime169.jsxDEV(ThemedText, {
|
|
364044
|
-
dimColor: true,
|
|
364045
|
-
children: "No vLLM endpoints found on 192.168.1.0/24 — enter the URL manually."
|
|
363964
|
+
wrap: "wrap",
|
|
363965
|
+
children: "Tip: for a machine on your LAN, use its mDNS name (e.g. http://my-box.local:8000/v1) or its IP (e.g. http://192.168.1.42:8000/v1). No network scanning — just pick or paste."
|
|
364046
363966
|
}, undefined, false, undefined, this),
|
|
364047
363967
|
/* @__PURE__ */ jsx_dev_runtime169.jsxDEV(SimpleMenu, {
|
|
364048
|
-
items:
|
|
364049
|
-
isActive: step === "
|
|
364050
|
-
onSelect: (value) =>
|
|
363968
|
+
items: urlPickerItems,
|
|
363969
|
+
isActive: step === "pickUrl",
|
|
363970
|
+
onSelect: (value) => pickUrl(value),
|
|
364051
363971
|
onCancel: () => setStep("provider")
|
|
364052
363972
|
}, undefined, false, undefined, this),
|
|
364053
363973
|
/* @__PURE__ */ jsx_dev_runtime169.jsxDEV(ThemedText, {
|
|
@@ -364056,7 +363976,7 @@ function LocalBackendSetup({
|
|
|
364056
363976
|
}, undefined, false, undefined, this)
|
|
364057
363977
|
]
|
|
364058
363978
|
}, undefined, true, undefined, this) : null,
|
|
364059
|
-
step !== "provider" && step !== "
|
|
363979
|
+
step !== "provider" && step !== "pickUrl" ? /* @__PURE__ */ jsx_dev_runtime169.jsxDEV(jsx_dev_runtime169.Fragment, {
|
|
364060
363980
|
children: [
|
|
364061
363981
|
/* @__PURE__ */ jsx_dev_runtime169.jsxDEV(ThemedText, {
|
|
364062
363982
|
children: [
|
|
@@ -364100,7 +364020,7 @@ function LocalBackendSetup({
|
|
|
364100
364020
|
/* @__PURE__ */ jsx_dev_runtime169.jsxDEV(TriangleSpinner, {}, undefined, false, undefined, this),
|
|
364101
364021
|
/* @__PURE__ */ jsx_dev_runtime169.jsxDEV(ThemedText, {
|
|
364102
364022
|
children: [
|
|
364103
|
-
"
|
|
364023
|
+
"Connecting to ",
|
|
364104
364024
|
/* @__PURE__ */ jsx_dev_runtime169.jsxDEV(ThemedText, {
|
|
364105
364025
|
bold: true,
|
|
364106
364026
|
children: baseUrl
|
|
@@ -364224,17 +364144,30 @@ function LocalBackendSetup({
|
|
|
364224
364144
|
]
|
|
364225
364145
|
}, undefined, true, undefined, this);
|
|
364226
364146
|
}
|
|
364147
|
+
function timeAgo(timestamp) {
|
|
364148
|
+
const sec = Math.max(0, Math.floor((Date.now() - timestamp) / 1000));
|
|
364149
|
+
if (sec < 60)
|
|
364150
|
+
return `${sec}s ago`;
|
|
364151
|
+
const min = Math.floor(sec / 60);
|
|
364152
|
+
if (min < 60)
|
|
364153
|
+
return `${min}m ago`;
|
|
364154
|
+
const hr = Math.floor(min / 60);
|
|
364155
|
+
if (hr < 24)
|
|
364156
|
+
return `${hr}h ago`;
|
|
364157
|
+
const d = Math.floor(hr / 24);
|
|
364158
|
+
return `${d}d ago`;
|
|
364159
|
+
}
|
|
364227
364160
|
var import_react99, jsx_dev_runtime169, PROVIDER_OPTIONS;
|
|
364228
364161
|
var init_LocalBackendSetup = __esm(() => {
|
|
364229
364162
|
init_ink2();
|
|
364230
364163
|
init_providers();
|
|
364231
|
-
|
|
364164
|
+
init_endpointHistory();
|
|
364232
364165
|
init_TriangleSpinner();
|
|
364233
364166
|
init_TextInput();
|
|
364234
364167
|
import_react99 = __toESM(require_react(), 1);
|
|
364235
364168
|
jsx_dev_runtime169 = __toESM(require_jsx_dev_runtime(), 1);
|
|
364236
364169
|
PROVIDER_OPTIONS = [
|
|
364237
|
-
{ label: "Local vLLM
|
|
364170
|
+
{ label: "Local endpoint (vLLM / LM Studio / any OpenAI-compatible server)", value: "vllm" },
|
|
364238
364171
|
{ label: "Local Ollama server", value: "ollama" },
|
|
364239
364172
|
{ label: "Hosted OpenAI-compatible API or gateway", value: "openai" }
|
|
364240
364173
|
];
|
|
@@ -366679,7 +366612,7 @@ function Config({
|
|
|
366679
366612
|
}
|
|
366680
366613
|
}, undefined, false, undefined, this)
|
|
366681
366614
|
}, undefined, false, undefined, this) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsx_dev_runtime175.jsxDEV(ChannelDowngradeDialog, {
|
|
366682
|
-
currentVersion: "1.3.
|
|
366615
|
+
currentVersion: "1.3.3",
|
|
366683
366616
|
onChoice: (choice) => {
|
|
366684
366617
|
setShowSubmenu(null);
|
|
366685
366618
|
setTabsHidden(false);
|
|
@@ -366691,7 +366624,7 @@ function Config({
|
|
|
366691
366624
|
autoUpdatesChannel: "stable"
|
|
366692
366625
|
};
|
|
366693
366626
|
if (choice === "stay") {
|
|
366694
|
-
newSettings.minimumVersion = "1.3.
|
|
366627
|
+
newSettings.minimumVersion = "1.3.3";
|
|
366695
366628
|
}
|
|
366696
366629
|
updateSettingsForSource("userSettings", newSettings);
|
|
366697
366630
|
setSettingsData((prev_27) => ({
|
|
@@ -371317,7 +371250,7 @@ var exports_Doctor = {};
|
|
|
371317
371250
|
__export(exports_Doctor, {
|
|
371318
371251
|
Doctor: () => Doctor
|
|
371319
371252
|
});
|
|
371320
|
-
import { join as
|
|
371253
|
+
import { join as join105 } from "path";
|
|
371321
371254
|
function DistTagsDisplay(t0) {
|
|
371322
371255
|
const $2 = c3(8);
|
|
371323
371256
|
const {
|
|
@@ -371447,8 +371380,8 @@ function Doctor(t0) {
|
|
|
371447
371380
|
t5 = () => {
|
|
371448
371381
|
getDoctorDiagnostic().then(setDiagnostic);
|
|
371449
371382
|
(async () => {
|
|
371450
|
-
const userAgentsDir =
|
|
371451
|
-
const projectAgentsDir =
|
|
371383
|
+
const userAgentsDir = join105(getClaudeConfigHomeDir(), "agents");
|
|
371384
|
+
const projectAgentsDir = join105(getOriginalCwd(), ".claude", "agents");
|
|
371452
371385
|
const {
|
|
371453
371386
|
activeAgents,
|
|
371454
371387
|
allAgents,
|
|
@@ -371471,7 +371404,7 @@ function Doctor(t0) {
|
|
|
371471
371404
|
}, async () => toolPermissionContext);
|
|
371472
371405
|
setContextWarnings(warnings);
|
|
371473
371406
|
if (isPidBasedLockingEnabled()) {
|
|
371474
|
-
const locksDir =
|
|
371407
|
+
const locksDir = join105(getXDGStateHome(), "claude", "locks");
|
|
371475
371408
|
const staleLocksCleaned = cleanupStaleLocks(locksDir);
|
|
371476
371409
|
const locks = getAllLockInfo(locksDir);
|
|
371477
371410
|
setVersionLockInfo({
|
|
@@ -372630,9 +372563,9 @@ var init_telegramSignals = __esm(() => {
|
|
|
372630
372563
|
|
|
372631
372564
|
// src/services/telegram/telegramKill.ts
|
|
372632
372565
|
import { readdir as readdir21, unlink as unlink15 } from "fs/promises";
|
|
372633
|
-
import { join as
|
|
372566
|
+
import { join as join106 } from "path";
|
|
372634
372567
|
async function killAllInstances() {
|
|
372635
|
-
const sessionsDir =
|
|
372568
|
+
const sessionsDir = join106(getClaudeConfigHomeDir(), "sessions");
|
|
372636
372569
|
let files;
|
|
372637
372570
|
try {
|
|
372638
372571
|
files = await readdir21(sessionsDir);
|
|
@@ -372651,7 +372584,7 @@ async function killAllInstances() {
|
|
|
372651
372584
|
killed++;
|
|
372652
372585
|
logForDebugging(`[telegram-kill] Sent SIGTERM to PID ${pid}`);
|
|
372653
372586
|
} catch {
|
|
372654
|
-
await unlink15(
|
|
372587
|
+
await unlink15(join106(sessionsDir, file)).catch(() => {});
|
|
372655
372588
|
}
|
|
372656
372589
|
}
|
|
372657
372590
|
return killed;
|
|
@@ -372678,20 +372611,20 @@ function createEmptyState() {
|
|
|
372678
372611
|
}
|
|
372679
372612
|
|
|
372680
372613
|
// src/services/director/directorMemoryOps.ts
|
|
372681
|
-
import { mkdir as
|
|
372682
|
-
import { basename as basename34, join as
|
|
372683
|
-
import { homedir as
|
|
372614
|
+
import { mkdir as mkdir28, readdir as readdir22, readFile as readFile38, stat as stat37, writeFile as writeFile30 } from "fs/promises";
|
|
372615
|
+
import { basename as basename34, join as join107, resolve as resolve36 } from "path";
|
|
372616
|
+
import { homedir as homedir27 } from "os";
|
|
372684
372617
|
function setDirectorProjectRoot(projectPath) {
|
|
372685
|
-
_projectStateDir =
|
|
372618
|
+
_projectStateDir = join107(projectPath, ".claude");
|
|
372686
372619
|
}
|
|
372687
372620
|
function getStatePath() {
|
|
372688
372621
|
if (_projectStateDir)
|
|
372689
|
-
return
|
|
372690
|
-
return
|
|
372622
|
+
return join107(_projectStateDir, "director-memory.json");
|
|
372623
|
+
return join107(GLOBAL_DIRECTOR_DIR, "state.json");
|
|
372691
372624
|
}
|
|
372692
372625
|
async function loadDirectorState() {
|
|
372693
372626
|
try {
|
|
372694
|
-
const raw = await
|
|
372627
|
+
const raw = await readFile38(getStatePath(), "utf-8");
|
|
372695
372628
|
const parsed = JSON.parse(raw);
|
|
372696
372629
|
if (parsed.version !== 1)
|
|
372697
372630
|
return createEmptyState();
|
|
@@ -372702,16 +372635,16 @@ async function loadDirectorState() {
|
|
|
372702
372635
|
}
|
|
372703
372636
|
async function saveDirectorState(state) {
|
|
372704
372637
|
const dir = _projectStateDir || GLOBAL_DIRECTOR_DIR;
|
|
372705
|
-
await
|
|
372706
|
-
await
|
|
372638
|
+
await mkdir28(dir, { recursive: true });
|
|
372639
|
+
await writeFile30(getStatePath(), JSON.stringify(state, null, 2), "utf-8");
|
|
372707
372640
|
}
|
|
372708
372641
|
function slugify(path12) {
|
|
372709
372642
|
return basename34(resolve36(path12)).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
372710
372643
|
}
|
|
372711
372644
|
async function detectGitRemote(projectPath) {
|
|
372712
372645
|
try {
|
|
372713
|
-
const configPath =
|
|
372714
|
-
const config2 = await
|
|
372646
|
+
const configPath = join107(projectPath, ".git", "config");
|
|
372647
|
+
const config2 = await readFile38(configPath, "utf-8");
|
|
372715
372648
|
const match = config2.match(/\[remote "origin"\][^[]*url\s*=\s*(.+)/m);
|
|
372716
372649
|
return match?.[1]?.trim();
|
|
372717
372650
|
} catch {
|
|
@@ -372720,12 +372653,12 @@ async function detectGitRemote(projectPath) {
|
|
|
372720
372653
|
}
|
|
372721
372654
|
async function detectDescription(projectPath) {
|
|
372722
372655
|
try {
|
|
372723
|
-
const pkg = JSON.parse(await
|
|
372656
|
+
const pkg = JSON.parse(await readFile38(join107(projectPath, "package.json"), "utf-8"));
|
|
372724
372657
|
if (pkg.description)
|
|
372725
372658
|
return pkg.description;
|
|
372726
372659
|
} catch {}
|
|
372727
372660
|
try {
|
|
372728
|
-
const readme = await
|
|
372661
|
+
const readme = await readFile38(join107(projectPath, "README.md"), "utf-8");
|
|
372729
372662
|
const firstLine = readme.split(`
|
|
372730
372663
|
`).find((l) => l.trim() && !l.startsWith("#"));
|
|
372731
372664
|
if (firstLine)
|
|
@@ -372779,9 +372712,9 @@ async function indexProjectFiles(state, projectId, projectPath) {
|
|
|
372779
372712
|
const absPath = resolve36(projectPath);
|
|
372780
372713
|
for (const name of KEY_FILES) {
|
|
372781
372714
|
try {
|
|
372782
|
-
const filePath =
|
|
372715
|
+
const filePath = join107(absPath, name);
|
|
372783
372716
|
await stat37(filePath);
|
|
372784
|
-
const content = await
|
|
372717
|
+
const content = await readFile38(filePath, "utf-8");
|
|
372785
372718
|
const firstLine = content.split(`
|
|
372786
372719
|
`).find((l) => l.trim())?.trim() ?? name;
|
|
372787
372720
|
entries.push({
|
|
@@ -372794,7 +372727,7 @@ async function indexProjectFiles(state, projectId, projectPath) {
|
|
|
372794
372727
|
} catch {}
|
|
372795
372728
|
}
|
|
372796
372729
|
try {
|
|
372797
|
-
const srcDir =
|
|
372730
|
+
const srcDir = join107(absPath, "src");
|
|
372798
372731
|
const srcFiles = await readdir22(srcDir);
|
|
372799
372732
|
for (const file of srcFiles.slice(0, 30)) {
|
|
372800
372733
|
if (!file.endsWith(".ts") && !file.endsWith(".tsx") && !file.endsWith(".js") && !file.endsWith(".py") && !file.endsWith(".rs") && !file.endsWith(".go"))
|
|
@@ -372866,8 +372799,8 @@ function getProjectContext(state, projectId) {
|
|
|
372866
372799
|
var GLOBAL_DIRECTOR_DIR, DIRECTOR_MEMORY_DIR, _projectStateDir = "", KEY_FILES, MAX_FILE_ENTRIES = 100, MAX_TASKS = 200, PRUNE_INTERVAL_MS, PROJECT_STALE_MS, IMPORTANCE_DECAY = 0.95;
|
|
372867
372800
|
var init_directorMemoryOps = __esm(() => {
|
|
372868
372801
|
init_debug();
|
|
372869
|
-
GLOBAL_DIRECTOR_DIR =
|
|
372870
|
-
DIRECTOR_MEMORY_DIR =
|
|
372802
|
+
GLOBAL_DIRECTOR_DIR = join107(homedir27(), ".claude", "director");
|
|
372803
|
+
DIRECTOR_MEMORY_DIR = join107(GLOBAL_DIRECTOR_DIR, "memory");
|
|
372871
372804
|
KEY_FILES = [
|
|
372872
372805
|
"package.json",
|
|
372873
372806
|
"README.md",
|
|
@@ -373219,11 +373152,11 @@ async function initSlack() {
|
|
|
373219
373152
|
let userId = process.env.SLACK_USER_ID;
|
|
373220
373153
|
if (!token || !channelId) {
|
|
373221
373154
|
try {
|
|
373222
|
-
const { readFile:
|
|
373223
|
-
const { join:
|
|
373224
|
-
const { homedir:
|
|
373225
|
-
const configPath =
|
|
373226
|
-
const raw = await
|
|
373155
|
+
const { readFile: readFile39 } = await import("fs/promises");
|
|
373156
|
+
const { join: join108 } = await import("path");
|
|
373157
|
+
const { homedir: homedir28 } = await import("os");
|
|
373158
|
+
const configPath = join108(homedir28(), ".claude", "slack.json");
|
|
373159
|
+
const raw = await readFile39(configPath, "utf-8");
|
|
373227
373160
|
const config2 = JSON.parse(raw);
|
|
373228
373161
|
if (config2.token && config2.channelId) {
|
|
373229
373162
|
token = config2.token;
|
|
@@ -373531,11 +373464,11 @@ async function initDiscord() {
|
|
|
373531
373464
|
let userId = process.env.DISCORD_USER_ID;
|
|
373532
373465
|
if (!token || !channelId) {
|
|
373533
373466
|
try {
|
|
373534
|
-
const { readFile:
|
|
373535
|
-
const { join:
|
|
373536
|
-
const { homedir:
|
|
373537
|
-
const configPath =
|
|
373538
|
-
const raw = await
|
|
373467
|
+
const { readFile: readFile39 } = await import("fs/promises");
|
|
373468
|
+
const { join: join108 } = await import("path");
|
|
373469
|
+
const { homedir: homedir28 } = await import("os");
|
|
373470
|
+
const configPath = join108(homedir28(), ".claude", "discord.json");
|
|
373471
|
+
const raw = await readFile39(configPath, "utf-8");
|
|
373539
373472
|
const config2 = JSON.parse(raw);
|
|
373540
373473
|
if (config2.token && config2.channelId) {
|
|
373541
373474
|
token = config2.token;
|
|
@@ -373921,12 +373854,12 @@ __export(exports_scheduler, {
|
|
|
373921
373854
|
getSchedules: () => getSchedules,
|
|
373922
373855
|
addSchedule: () => addSchedule
|
|
373923
373856
|
});
|
|
373924
|
-
import { mkdir as
|
|
373925
|
-
import { join as
|
|
373926
|
-
import { homedir as
|
|
373857
|
+
import { mkdir as mkdir29, readFile as readFile39, writeFile as writeFile31 } from "fs/promises";
|
|
373858
|
+
import { join as join108 } from "path";
|
|
373859
|
+
import { homedir as homedir28 } from "os";
|
|
373927
373860
|
async function loadSchedules() {
|
|
373928
373861
|
try {
|
|
373929
|
-
const raw = await
|
|
373862
|
+
const raw = await readFile39(SCHEDULES_PATH, "utf-8");
|
|
373930
373863
|
const parsed = JSON.parse(raw);
|
|
373931
373864
|
if (parsed.version !== 1)
|
|
373932
373865
|
return { version: 1, schedules: [] };
|
|
@@ -373936,8 +373869,8 @@ async function loadSchedules() {
|
|
|
373936
373869
|
}
|
|
373937
373870
|
}
|
|
373938
373871
|
async function saveSchedules(file) {
|
|
373939
|
-
await
|
|
373940
|
-
await
|
|
373872
|
+
await mkdir29(join108(homedir28(), ".claude"), { recursive: true });
|
|
373873
|
+
await writeFile31(SCHEDULES_PATH, JSON.stringify(file, null, 2), "utf-8");
|
|
373941
373874
|
}
|
|
373942
373875
|
function nextRunTime(expr, from = Date.now()) {
|
|
373943
373876
|
const trimmed = expr.trim().toLowerCase();
|
|
@@ -374140,7 +374073,7 @@ function validateScheduleExpression(expr) {
|
|
|
374140
374073
|
var SCHEDULES_PATH, TICK_INTERVAL_MS = 30000, _tickTimer = null;
|
|
374141
374074
|
var init_scheduler = __esm(() => {
|
|
374142
374075
|
init_debug();
|
|
374143
|
-
SCHEDULES_PATH =
|
|
374076
|
+
SCHEDULES_PATH = join108(homedir28(), ".claude", "schedules.json");
|
|
374144
374077
|
});
|
|
374145
374078
|
|
|
374146
374079
|
// src/services/telegram/telegramBot.ts
|
|
@@ -374271,11 +374204,11 @@ async function initTelegram() {
|
|
|
374271
374204
|
let chatIdStr = process.env.TELEGRAM_CHAT_ID;
|
|
374272
374205
|
if (!token || !chatIdStr) {
|
|
374273
374206
|
try {
|
|
374274
|
-
const { readFile:
|
|
374275
|
-
const { join:
|
|
374276
|
-
const { homedir:
|
|
374277
|
-
const configPath =
|
|
374278
|
-
const raw = await
|
|
374207
|
+
const { readFile: readFile40 } = await import("fs/promises");
|
|
374208
|
+
const { join: join109 } = await import("path");
|
|
374209
|
+
const { homedir: homedir29 } = await import("os");
|
|
374210
|
+
const configPath = join109(homedir29(), ".claude", "telegram.json");
|
|
374211
|
+
const raw = await readFile40(configPath, "utf-8");
|
|
374279
374212
|
const config2 = JSON.parse(raw);
|
|
374280
374213
|
if (config2.token && config2.chatId) {
|
|
374281
374214
|
token = config2.token;
|
|
@@ -374798,9 +374731,9 @@ var exports_telegram = {};
|
|
|
374798
374731
|
__export(exports_telegram, {
|
|
374799
374732
|
call: () => call20
|
|
374800
374733
|
});
|
|
374801
|
-
import { writeFile as
|
|
374802
|
-
import { join as
|
|
374803
|
-
import { homedir as
|
|
374734
|
+
import { writeFile as writeFile32, mkdir as mkdir30 } from "fs/promises";
|
|
374735
|
+
import { join as join109 } from "path";
|
|
374736
|
+
import { homedir as homedir29 } from "os";
|
|
374804
374737
|
function TelegramSetup({ onDone }) {
|
|
374805
374738
|
const [step, setStep] = React59.useState("instructions");
|
|
374806
374739
|
const [token, setToken] = React59.useState("");
|
|
@@ -375076,10 +375009,10 @@ function TelegramSetupDone({
|
|
|
375076
375009
|
}, undefined, true, undefined, this);
|
|
375077
375010
|
}
|
|
375078
375011
|
async function saveTelegramConfig(token, chatId) {
|
|
375079
|
-
const configDir =
|
|
375080
|
-
await
|
|
375081
|
-
const configPath =
|
|
375082
|
-
await
|
|
375012
|
+
const configDir = join109(homedir29(), ".claude");
|
|
375013
|
+
await mkdir30(configDir, { recursive: true });
|
|
375014
|
+
const configPath = join109(configDir, "telegram.json");
|
|
375015
|
+
await writeFile32(configPath, JSON.stringify({ token, chatId }, null, 2), "utf-8");
|
|
375083
375016
|
}
|
|
375084
375017
|
function TelegramStatus({
|
|
375085
375018
|
onDone
|
|
@@ -375288,9 +375221,9 @@ var exports_slack = {};
|
|
|
375288
375221
|
__export(exports_slack, {
|
|
375289
375222
|
call: () => call21
|
|
375290
375223
|
});
|
|
375291
|
-
import { writeFile as
|
|
375292
|
-
import { join as
|
|
375293
|
-
import { homedir as
|
|
375224
|
+
import { writeFile as writeFile33, mkdir as mkdir31 } from "fs/promises";
|
|
375225
|
+
import { join as join110 } from "path";
|
|
375226
|
+
import { homedir as homedir30 } from "os";
|
|
375294
375227
|
function SlackSetup({ onDone }) {
|
|
375295
375228
|
const [step, setStep] = React60.useState("instructions");
|
|
375296
375229
|
const [token, setToken] = React60.useState("");
|
|
@@ -375644,10 +375577,10 @@ function SlackSetupDone({
|
|
|
375644
375577
|
}, undefined, true, undefined, this);
|
|
375645
375578
|
}
|
|
375646
375579
|
async function saveSlackConfig(token, channelId, userId) {
|
|
375647
|
-
const configDir =
|
|
375648
|
-
await
|
|
375649
|
-
const configPath =
|
|
375650
|
-
await
|
|
375580
|
+
const configDir = join110(homedir30(), ".claude");
|
|
375581
|
+
await mkdir31(configDir, { recursive: true });
|
|
375582
|
+
const configPath = join110(configDir, "slack.json");
|
|
375583
|
+
await writeFile33(configPath, JSON.stringify({ token, channelId, userId: userId ?? null }, null, 2), "utf-8");
|
|
375651
375584
|
}
|
|
375652
375585
|
function SlackStatus({
|
|
375653
375586
|
onDone
|
|
@@ -375855,9 +375788,9 @@ var exports_discord = {};
|
|
|
375855
375788
|
__export(exports_discord, {
|
|
375856
375789
|
call: () => call22
|
|
375857
375790
|
});
|
|
375858
|
-
import { writeFile as
|
|
375859
|
-
import { join as
|
|
375860
|
-
import { homedir as
|
|
375791
|
+
import { writeFile as writeFile34, mkdir as mkdir32 } from "fs/promises";
|
|
375792
|
+
import { join as join111 } from "path";
|
|
375793
|
+
import { homedir as homedir31 } from "os";
|
|
375861
375794
|
function DiscordSetup({ onDone }) {
|
|
375862
375795
|
const [step, setStep] = React61.useState("instructions");
|
|
375863
375796
|
const [token, setToken] = React61.useState("");
|
|
@@ -376150,9 +376083,9 @@ function DiscordSetupDone({
|
|
|
376150
376083
|
}, undefined, true, undefined, this);
|
|
376151
376084
|
}
|
|
376152
376085
|
async function saveConfig2(token, channelId, userId) {
|
|
376153
|
-
const configDir =
|
|
376154
|
-
await
|
|
376155
|
-
await
|
|
376086
|
+
const configDir = join111(homedir31(), ".claude");
|
|
376087
|
+
await mkdir32(configDir, { recursive: true });
|
|
376088
|
+
await writeFile34(join111(configDir, "discord.json"), JSON.stringify({ token, channelId, userId: userId ?? null }, null, 2), "utf-8");
|
|
376156
376089
|
}
|
|
376157
376090
|
function DiscordStatus({
|
|
376158
376091
|
onDone
|
|
@@ -376646,9 +376579,9 @@ var init_schedule2 = __esm(() => {
|
|
|
376646
376579
|
});
|
|
376647
376580
|
|
|
376648
376581
|
// src/services/sessionSearch/sessionSummarize.ts
|
|
376649
|
-
import { readdir as readdir23, readFile as
|
|
376650
|
-
import { join as
|
|
376651
|
-
import { homedir as
|
|
376582
|
+
import { readdir as readdir23, readFile as readFile40, writeFile as writeFile35, mkdir as mkdir33, stat as stat38 } from "fs/promises";
|
|
376583
|
+
import { join as join112 } from "path";
|
|
376584
|
+
import { homedir as homedir32 } from "os";
|
|
376652
376585
|
function extractText(obj) {
|
|
376653
376586
|
if (typeof obj === "string")
|
|
376654
376587
|
return obj;
|
|
@@ -376682,20 +376615,20 @@ async function listUnsummarized() {
|
|
|
376682
376615
|
for (const f of files) {
|
|
376683
376616
|
if (!f.endsWith(".json"))
|
|
376684
376617
|
continue;
|
|
376685
|
-
const s = await stat38(
|
|
376618
|
+
const s = await stat38(join112(SUMMARIES_DIR, f)).catch(() => null);
|
|
376686
376619
|
if (s)
|
|
376687
376620
|
existing.set(f.replace(/\.json$/, ""), s.mtimeMs);
|
|
376688
376621
|
}
|
|
376689
376622
|
} catch {}
|
|
376690
376623
|
for (const slug of slugs) {
|
|
376691
|
-
const slugDir =
|
|
376624
|
+
const slugDir = join112(PROJECTS_DIR, slug);
|
|
376692
376625
|
try {
|
|
376693
376626
|
const entries = await readdir23(slugDir);
|
|
376694
376627
|
for (const entry of entries) {
|
|
376695
376628
|
if (!entry.endsWith(".jsonl"))
|
|
376696
376629
|
continue;
|
|
376697
376630
|
const sessionId = entry.replace(/\.jsonl$/, "");
|
|
376698
|
-
const full =
|
|
376631
|
+
const full = join112(slugDir, entry);
|
|
376699
376632
|
const s = await stat38(full).catch(() => null);
|
|
376700
376633
|
if (!s)
|
|
376701
376634
|
continue;
|
|
@@ -376774,7 +376707,7 @@ function parseSummaryResponse(text) {
|
|
|
376774
376707
|
return { summary, tags };
|
|
376775
376708
|
}
|
|
376776
376709
|
async function summarizeSession(sessionId, slug, filePath, mtime) {
|
|
376777
|
-
const content = await
|
|
376710
|
+
const content = await readFile40(filePath, "utf-8").catch(() => "");
|
|
376778
376711
|
if (!content)
|
|
376779
376712
|
return null;
|
|
376780
376713
|
const { transcript, messageCount, firstUser } = buildTranscript(content);
|
|
@@ -376805,7 +376738,7 @@ ${transcript}`;
|
|
|
376805
376738
|
};
|
|
376806
376739
|
}
|
|
376807
376740
|
async function summarizeAllPending(limit = 20, onProgress) {
|
|
376808
|
-
await
|
|
376741
|
+
await mkdir33(SUMMARIES_DIR, { recursive: true });
|
|
376809
376742
|
const pending = await listUnsummarized();
|
|
376810
376743
|
pending.sort((a, b3) => b3.mtime - a.mtime);
|
|
376811
376744
|
const slice = pending.slice(0, limit);
|
|
@@ -376820,7 +376753,7 @@ async function summarizeAllPending(limit = 20, onProgress) {
|
|
|
376820
376753
|
continue;
|
|
376821
376754
|
}
|
|
376822
376755
|
try {
|
|
376823
|
-
await
|
|
376756
|
+
await writeFile35(join112(SUMMARIES_DIR, `${p.sessionId}.json`), JSON.stringify(summary, null, 2), "utf-8");
|
|
376824
376757
|
summarized++;
|
|
376825
376758
|
} catch (e) {
|
|
376826
376759
|
logForDebugging(`[session-summarize] write failed: ${e}`);
|
|
@@ -376837,7 +376770,7 @@ async function loadAllSummaries() {
|
|
|
376837
376770
|
if (!f.endsWith(".json"))
|
|
376838
376771
|
continue;
|
|
376839
376772
|
try {
|
|
376840
|
-
const raw = await
|
|
376773
|
+
const raw = await readFile40(join112(SUMMARIES_DIR, f), "utf-8");
|
|
376841
376774
|
summaries.push(JSON.parse(raw));
|
|
376842
376775
|
} catch {}
|
|
376843
376776
|
}
|
|
@@ -376850,14 +376783,14 @@ var PROJECTS_DIR, SUMMARIES_DIR, MAX_TRANSCRIPT_CHARS = 12000;
|
|
|
376850
376783
|
var init_sessionSummarize = __esm(() => {
|
|
376851
376784
|
init_debug();
|
|
376852
376785
|
init_providers();
|
|
376853
|
-
PROJECTS_DIR =
|
|
376854
|
-
SUMMARIES_DIR =
|
|
376786
|
+
PROJECTS_DIR = join112(homedir32(), ".claude", "projects");
|
|
376787
|
+
SUMMARIES_DIR = join112(homedir32(), ".claude", "session-summaries");
|
|
376855
376788
|
});
|
|
376856
376789
|
|
|
376857
376790
|
// src/services/sessionSearch/sessionSearch.ts
|
|
376858
|
-
import { readdir as readdir24, readFile as
|
|
376859
|
-
import { join as
|
|
376860
|
-
import { homedir as
|
|
376791
|
+
import { readdir as readdir24, readFile as readFile41, stat as stat39 } from "fs/promises";
|
|
376792
|
+
import { join as join113 } from "path";
|
|
376793
|
+
import { homedir as homedir33 } from "os";
|
|
376861
376794
|
function tokenize6(text) {
|
|
376862
376795
|
return text.toLowerCase().split(/[^a-z0-9_]+/).filter((t) => t.length >= 2);
|
|
376863
376796
|
}
|
|
@@ -376889,13 +376822,13 @@ async function listSessionFiles() {
|
|
|
376889
376822
|
return result;
|
|
376890
376823
|
}
|
|
376891
376824
|
for (const slug of projects) {
|
|
376892
|
-
const slugDir =
|
|
376825
|
+
const slugDir = join113(PROJECTS_DIR2, slug);
|
|
376893
376826
|
try {
|
|
376894
376827
|
const entries = await readdir24(slugDir);
|
|
376895
376828
|
for (const entry of entries) {
|
|
376896
376829
|
if (!entry.endsWith(".jsonl"))
|
|
376897
376830
|
continue;
|
|
376898
|
-
const full =
|
|
376831
|
+
const full = join113(slugDir, entry);
|
|
376899
376832
|
try {
|
|
376900
376833
|
const s = await stat39(full);
|
|
376901
376834
|
if (s.size > MAX_FILE_BYTES)
|
|
@@ -376911,7 +376844,7 @@ async function listSessionFiles() {
|
|
|
376911
376844
|
async function scoreSession(terms, filePath) {
|
|
376912
376845
|
let content;
|
|
376913
376846
|
try {
|
|
376914
|
-
content = await
|
|
376847
|
+
content = await readFile41(filePath, "utf-8");
|
|
376915
376848
|
} catch {
|
|
376916
376849
|
return { score: 0, messageCount: 0, snippet: "", preview: "" };
|
|
376917
376850
|
}
|
|
@@ -377041,7 +376974,7 @@ function formatMatches(matches) {
|
|
|
377041
376974
|
var PROJECTS_DIR2, MAX_FILE_BYTES, MAX_SESSIONS_TO_SCAN = 200, MAX_SNIPPET_LEN = 160;
|
|
377042
376975
|
var init_sessionSearch = __esm(() => {
|
|
377043
376976
|
init_sessionSummarize();
|
|
377044
|
-
PROJECTS_DIR2 =
|
|
376977
|
+
PROJECTS_DIR2 = join113(homedir33(), ".claude", "projects");
|
|
377045
376978
|
MAX_FILE_BYTES = 5 * 1024 * 1024;
|
|
377046
376979
|
});
|
|
377047
376980
|
|
|
@@ -377204,9 +377137,9 @@ var init_summarize_sessions2 = __esm(() => {
|
|
|
377204
377137
|
});
|
|
377205
377138
|
|
|
377206
377139
|
// src/services/sessionSearch/trajectoryCompress.ts
|
|
377207
|
-
import { readFile as
|
|
377208
|
-
import { join as
|
|
377209
|
-
import { homedir as
|
|
377140
|
+
import { readFile as readFile42, writeFile as writeFile36, readdir as readdir25, mkdir as mkdir34, stat as stat40 } from "fs/promises";
|
|
377141
|
+
import { join as join114 } from "path";
|
|
377142
|
+
import { homedir as homedir34 } from "os";
|
|
377210
377143
|
function flattenText(obj) {
|
|
377211
377144
|
if (typeof obj === "string")
|
|
377212
377145
|
return obj;
|
|
@@ -377285,11 +377218,11 @@ function mergeConsecutive(messages) {
|
|
|
377285
377218
|
return out;
|
|
377286
377219
|
}
|
|
377287
377220
|
async function compressSession(sessionId, projectSlug) {
|
|
377288
|
-
const sourcePath =
|
|
377221
|
+
const sourcePath = join114(PROJECTS_DIR3, projectSlug, `${sessionId}.jsonl`);
|
|
377289
377222
|
let source;
|
|
377290
377223
|
let sourceStat;
|
|
377291
377224
|
try {
|
|
377292
|
-
source = await
|
|
377225
|
+
source = await readFile42(sourcePath, "utf-8");
|
|
377293
377226
|
const s = await stat40(sourcePath);
|
|
377294
377227
|
sourceStat = { mtimeMs: s.mtimeMs, size: s.size };
|
|
377295
377228
|
} catch {
|
|
@@ -377317,8 +377250,8 @@ async function compressSession(sessionId, projectSlug) {
|
|
|
377317
377250
|
};
|
|
377318
377251
|
const serialized = JSON.stringify(trajectory, null, 0);
|
|
377319
377252
|
trajectory.compressedBytes = Buffer.byteLength(serialized, "utf-8");
|
|
377320
|
-
await
|
|
377321
|
-
await
|
|
377253
|
+
await mkdir34(TRAJECTORIES_DIR, { recursive: true });
|
|
377254
|
+
await writeFile36(join114(TRAJECTORIES_DIR, `${sessionId}.json`), JSON.stringify(trajectory), "utf-8");
|
|
377322
377255
|
return trajectory;
|
|
377323
377256
|
}
|
|
377324
377257
|
async function compressAllPending(limit = 20) {
|
|
@@ -377334,7 +377267,7 @@ async function compressAllPending(limit = 20) {
|
|
|
377334
377267
|
for (const f of files) {
|
|
377335
377268
|
if (!f.endsWith(".json"))
|
|
377336
377269
|
continue;
|
|
377337
|
-
const s = await stat40(
|
|
377270
|
+
const s = await stat40(join114(TRAJECTORIES_DIR, f)).catch(() => null);
|
|
377338
377271
|
if (s)
|
|
377339
377272
|
existing.set(f.replace(/\.json$/, ""), s.mtimeMs);
|
|
377340
377273
|
}
|
|
@@ -377342,12 +377275,12 @@ async function compressAllPending(limit = 20) {
|
|
|
377342
377275
|
const pending = [];
|
|
377343
377276
|
for (const slug of slugs) {
|
|
377344
377277
|
try {
|
|
377345
|
-
const entries = await readdir25(
|
|
377278
|
+
const entries = await readdir25(join114(PROJECTS_DIR3, slug));
|
|
377346
377279
|
for (const entry of entries) {
|
|
377347
377280
|
if (!entry.endsWith(".jsonl"))
|
|
377348
377281
|
continue;
|
|
377349
377282
|
const sessionId = entry.replace(/\.jsonl$/, "");
|
|
377350
|
-
const s = await stat40(
|
|
377283
|
+
const s = await stat40(join114(PROJECTS_DIR3, slug, entry)).catch(() => null);
|
|
377351
377284
|
if (!s)
|
|
377352
377285
|
continue;
|
|
377353
377286
|
const have = existing.get(sessionId);
|
|
@@ -377384,8 +377317,8 @@ async function compressAllPending(limit = 20) {
|
|
|
377384
377317
|
var PROJECTS_DIR3, TRAJECTORIES_DIR, MAX_TOOL_RESULT_CHARS = 4000;
|
|
377385
377318
|
var init_trajectoryCompress = __esm(() => {
|
|
377386
377319
|
init_debug();
|
|
377387
|
-
PROJECTS_DIR3 =
|
|
377388
|
-
TRAJECTORIES_DIR =
|
|
377320
|
+
PROJECTS_DIR3 = join114(homedir34(), ".claude", "projects");
|
|
377321
|
+
TRAJECTORIES_DIR = join114(homedir34(), ".claude", "trajectories");
|
|
377389
377322
|
});
|
|
377390
377323
|
|
|
377391
377324
|
// src/commands/compress-sessions/compress-sessions.tsx
|
|
@@ -377465,9 +377398,9 @@ var init_compress_sessions2 = __esm(() => {
|
|
|
377465
377398
|
});
|
|
377466
377399
|
|
|
377467
377400
|
// src/services/skills/skillDistill.ts
|
|
377468
|
-
import { readFile as
|
|
377469
|
-
import { join as
|
|
377470
|
-
import { homedir as
|
|
377401
|
+
import { readFile as readFile43, readdir as readdir26, stat as stat41 } from "fs/promises";
|
|
377402
|
+
import { join as join115 } from "path";
|
|
377403
|
+
import { homedir as homedir35 } from "os";
|
|
377471
377404
|
function extractText3(obj) {
|
|
377472
377405
|
if (typeof obj === "string")
|
|
377473
377406
|
return obj;
|
|
@@ -377492,13 +377425,13 @@ async function findMostRecentSession() {
|
|
|
377492
377425
|
const slugs = await readdir26(PROJECTS_DIR4);
|
|
377493
377426
|
let best = null;
|
|
377494
377427
|
for (const slug of slugs) {
|
|
377495
|
-
const slugDir =
|
|
377428
|
+
const slugDir = join115(PROJECTS_DIR4, slug);
|
|
377496
377429
|
try {
|
|
377497
377430
|
const entries = await readdir26(slugDir);
|
|
377498
377431
|
for (const entry of entries) {
|
|
377499
377432
|
if (!entry.endsWith(".jsonl"))
|
|
377500
377433
|
continue;
|
|
377501
|
-
const full =
|
|
377434
|
+
const full = join115(slugDir, entry);
|
|
377502
377435
|
const s = await stat41(full).catch(() => null);
|
|
377503
377436
|
if (!s)
|
|
377504
377437
|
continue;
|
|
@@ -377514,7 +377447,7 @@ async function findMostRecentSession() {
|
|
|
377514
377447
|
}
|
|
377515
377448
|
}
|
|
377516
377449
|
async function buildTranscript2(sessionPath) {
|
|
377517
|
-
const content = await
|
|
377450
|
+
const content = await readFile43(sessionPath, "utf-8");
|
|
377518
377451
|
const lines = content.split(`
|
|
377519
377452
|
`).filter(Boolean);
|
|
377520
377453
|
const parts = [];
|
|
@@ -377622,7 +377555,7 @@ var PROJECTS_DIR4, MAX_TRANSCRIPT_CHARS2 = 1e4;
|
|
|
377622
377555
|
var init_skillDistill = __esm(() => {
|
|
377623
377556
|
init_debug();
|
|
377624
377557
|
init_providers();
|
|
377625
|
-
PROJECTS_DIR4 =
|
|
377558
|
+
PROJECTS_DIR4 = join115(homedir35(), ".claude", "projects");
|
|
377626
377559
|
});
|
|
377627
377560
|
|
|
377628
377561
|
// src/commands/distill-skill/distill-skill.tsx
|
|
@@ -378632,8 +378565,8 @@ var init_versions2 = __esm(() => {
|
|
|
378632
378565
|
});
|
|
378633
378566
|
|
|
378634
378567
|
// src/components/memory/MemoryFileSelector.tsx
|
|
378635
|
-
import { mkdir as
|
|
378636
|
-
import { join as
|
|
378568
|
+
import { mkdir as mkdir35 } from "fs/promises";
|
|
378569
|
+
import { join as join116 } from "path";
|
|
378637
378570
|
function MemoryFileSelector(t0) {
|
|
378638
378571
|
const $2 = c3(58);
|
|
378639
378572
|
const {
|
|
@@ -378641,8 +378574,8 @@ function MemoryFileSelector(t0) {
|
|
|
378641
378574
|
onCancel
|
|
378642
378575
|
} = t0;
|
|
378643
378576
|
const existingMemoryFiles = import_react112.use(getMemoryFiles());
|
|
378644
|
-
const userMemoryPath =
|
|
378645
|
-
const projectMemoryPath =
|
|
378577
|
+
const userMemoryPath = join116(getClaudeConfigHomeDir(), "CLAUDE.md");
|
|
378578
|
+
const projectMemoryPath = join116(getOriginalCwd(), "CLAUDE.md");
|
|
378646
378579
|
const hasUserMemory = existingMemoryFiles.some((f) => f.path === userMemoryPath);
|
|
378647
378580
|
const hasProjectMemory = existingMemoryFiles.some((f_0) => f_0.path === projectMemoryPath);
|
|
378648
378581
|
const allMemoryFiles = [...existingMemoryFiles.filter(_temp79).map(_temp230), ...hasUserMemory ? [] : [{
|
|
@@ -378981,7 +378914,7 @@ function MemoryFileSelector(t0) {
|
|
|
378981
378914
|
t20 = (value) => {
|
|
378982
378915
|
if (value.startsWith(OPEN_FOLDER_PREFIX)) {
|
|
378983
378916
|
const folderPath = value.slice(OPEN_FOLDER_PREFIX.length);
|
|
378984
|
-
|
|
378917
|
+
mkdir35(folderPath, {
|
|
378985
378918
|
recursive: true
|
|
378986
378919
|
}).catch(_temp86).then(() => openPath(folderPath));
|
|
378987
378920
|
return;
|
|
@@ -379091,10 +379024,10 @@ var init_MemoryFileSelector = __esm(() => {
|
|
|
379091
379024
|
});
|
|
379092
379025
|
|
|
379093
379026
|
// src/components/memory/MemoryUpdateNotification.tsx
|
|
379094
|
-
import { homedir as
|
|
379027
|
+
import { homedir as homedir36 } from "os";
|
|
379095
379028
|
import { relative as relative24 } from "path";
|
|
379096
379029
|
function getRelativeMemoryPath(path12) {
|
|
379097
|
-
const homeDir =
|
|
379030
|
+
const homeDir = homedir36();
|
|
379098
379031
|
const cwd2 = getCwd();
|
|
379099
379032
|
const relativeToHome = path12.startsWith(homeDir) ? "~" + path12.slice(homeDir.length) : null;
|
|
379100
379033
|
const relativeToCwd = path12.startsWith(cwd2) ? "./" + relative24(cwd2, path12) : null;
|
|
@@ -379341,19 +379274,19 @@ var exports_memory = {};
|
|
|
379341
379274
|
__export(exports_memory, {
|
|
379342
379275
|
call: () => call35
|
|
379343
379276
|
});
|
|
379344
|
-
import { mkdir as
|
|
379277
|
+
import { mkdir as mkdir36, writeFile as writeFile37 } from "fs/promises";
|
|
379345
379278
|
function MemoryCommand({
|
|
379346
379279
|
onDone
|
|
379347
379280
|
}) {
|
|
379348
379281
|
const handleSelectMemoryFile = async (memoryPath) => {
|
|
379349
379282
|
try {
|
|
379350
379283
|
if (memoryPath.includes(getClaudeConfigHomeDir())) {
|
|
379351
|
-
await
|
|
379284
|
+
await mkdir36(getClaudeConfigHomeDir(), {
|
|
379352
379285
|
recursive: true
|
|
379353
379286
|
});
|
|
379354
379287
|
}
|
|
379355
379288
|
try {
|
|
379356
|
-
await
|
|
379289
|
+
await writeFile37(memoryPath, "", {
|
|
379357
379290
|
encoding: "utf8",
|
|
379358
379291
|
flag: "wx"
|
|
379359
379292
|
});
|
|
@@ -380275,7 +380208,7 @@ function Help(t0) {
|
|
|
380275
380208
|
let t6;
|
|
380276
380209
|
if ($2[31] !== tabs) {
|
|
380277
380210
|
t6 = /* @__PURE__ */ jsx_dev_runtime216.jsxDEV(Tabs, {
|
|
380278
|
-
title: `localclawd v${"1.3.
|
|
380211
|
+
title: `localclawd v${"1.3.3"}`,
|
|
380279
380212
|
color: "professionalBlue",
|
|
380280
380213
|
defaultTab: "general",
|
|
380281
380214
|
children: tabs
|
|
@@ -381653,7 +381586,7 @@ var exports_keybindings = {};
|
|
|
381653
381586
|
__export(exports_keybindings, {
|
|
381654
381587
|
call: () => call38
|
|
381655
381588
|
});
|
|
381656
|
-
import { mkdir as
|
|
381589
|
+
import { mkdir as mkdir37, writeFile as writeFile38 } from "fs/promises";
|
|
381657
381590
|
import { dirname as dirname47 } from "path";
|
|
381658
381591
|
async function call38() {
|
|
381659
381592
|
if (!isKeybindingCustomizationEnabled()) {
|
|
@@ -381664,9 +381597,9 @@ async function call38() {
|
|
|
381664
381597
|
}
|
|
381665
381598
|
const keybindingsPath = getKeybindingsPath();
|
|
381666
381599
|
let fileExists = false;
|
|
381667
|
-
await
|
|
381600
|
+
await mkdir37(dirname47(keybindingsPath), { recursive: true });
|
|
381668
381601
|
try {
|
|
381669
|
-
await
|
|
381602
|
+
await writeFile38(keybindingsPath, generateKeybindingsTemplate(), {
|
|
381670
381603
|
encoding: "utf-8",
|
|
381671
381604
|
flag: "wx"
|
|
381672
381605
|
});
|
|
@@ -385976,7 +385909,7 @@ __export(exports_pluginStartupCheck, {
|
|
|
385976
385909
|
findMissingPlugins: () => findMissingPlugins,
|
|
385977
385910
|
checkEnabledPlugins: () => checkEnabledPlugins
|
|
385978
385911
|
});
|
|
385979
|
-
import { join as
|
|
385912
|
+
import { join as join117 } from "path";
|
|
385980
385913
|
async function checkEnabledPlugins() {
|
|
385981
385914
|
const settings = getInitialSettings();
|
|
385982
385915
|
const enabledPlugins = [];
|
|
@@ -386111,7 +386044,7 @@ async function installSelectedPlugins(pluginsToInstall, onProgress, scope = "use
|
|
|
386111
386044
|
} else {
|
|
386112
386045
|
registerPluginInstallation({
|
|
386113
386046
|
pluginId,
|
|
386114
|
-
installPath:
|
|
386047
|
+
installPath: join117(marketplaceInstallLocation, entry.source),
|
|
386115
386048
|
version: entry.version
|
|
386116
386049
|
}, scope, projectPath);
|
|
386117
386050
|
}
|
|
@@ -386143,7 +386076,7 @@ var init_pluginStartupCheck = __esm(() => {
|
|
|
386143
386076
|
});
|
|
386144
386077
|
|
|
386145
386078
|
// src/utils/plugins/parseMarketplaceInput.ts
|
|
386146
|
-
import { homedir as
|
|
386079
|
+
import { homedir as homedir37 } from "os";
|
|
386147
386080
|
import { resolve as resolve37 } from "path";
|
|
386148
386081
|
async function parseMarketplaceInput(input) {
|
|
386149
386082
|
const trimmed = input.trim();
|
|
@@ -386179,7 +386112,7 @@ async function parseMarketplaceInput(input) {
|
|
|
386179
386112
|
const isWindows2 = process.platform === "win32";
|
|
386180
386113
|
const isWindowsPath = isWindows2 && (trimmed.startsWith(".\\") || trimmed.startsWith("..\\") || /^[a-zA-Z]:[/\\]/.test(trimmed));
|
|
386181
386114
|
if (trimmed.startsWith("./") || trimmed.startsWith("../") || trimmed.startsWith("/") || trimmed.startsWith("~") || isWindowsPath) {
|
|
386182
|
-
const resolvedPath = resolve37(trimmed.startsWith("~") ? trimmed.replace(/^~/,
|
|
386115
|
+
const resolvedPath = resolve37(trimmed.startsWith("~") ? trimmed.replace(/^~/, homedir37()) : trimmed);
|
|
386183
386116
|
let stats;
|
|
386184
386117
|
try {
|
|
386185
386118
|
stats = await fs4.stat(resolvedPath);
|
|
@@ -386429,15 +386362,15 @@ var init_AddMarketplace = __esm(() => {
|
|
|
386429
386362
|
|
|
386430
386363
|
// src/utils/plugins/installCounts.ts
|
|
386431
386364
|
import { randomBytes as randomBytes16 } from "crypto";
|
|
386432
|
-
import { readFile as
|
|
386433
|
-
import { join as
|
|
386365
|
+
import { readFile as readFile44, rename as rename7, unlink as unlink16, writeFile as writeFile39 } from "fs/promises";
|
|
386366
|
+
import { join as join118 } from "path";
|
|
386434
386367
|
function getInstallCountsCachePath() {
|
|
386435
|
-
return
|
|
386368
|
+
return join118(getPluginsDirectory(), INSTALL_COUNTS_CACHE_FILENAME);
|
|
386436
386369
|
}
|
|
386437
386370
|
async function loadInstallCountsCache() {
|
|
386438
386371
|
const cachePath = getInstallCountsCachePath();
|
|
386439
386372
|
try {
|
|
386440
|
-
const content = await
|
|
386373
|
+
const content = await readFile44(cachePath, { encoding: "utf-8" });
|
|
386441
386374
|
const parsed = jsonParse(content);
|
|
386442
386375
|
if (typeof parsed !== "object" || parsed === null || !("version" in parsed) || !("fetchedAt" in parsed) || !("counts" in parsed)) {
|
|
386443
386376
|
logForDebugging("Install counts cache has invalid structure");
|
|
@@ -386487,7 +386420,7 @@ async function saveInstallCountsCache(cache3) {
|
|
|
386487
386420
|
const pluginsDir = getPluginsDirectory();
|
|
386488
386421
|
await getFsImplementation().mkdir(pluginsDir);
|
|
386489
386422
|
const content = jsonStringify(cache3, null, 2);
|
|
386490
|
-
await
|
|
386423
|
+
await writeFile39(tempPath, content, {
|
|
386491
386424
|
encoding: "utf-8",
|
|
386492
386425
|
mode: 384
|
|
386493
386426
|
});
|
|
@@ -389174,7 +389107,7 @@ var init_DiscoverPlugins = __esm(() => {
|
|
|
389174
389107
|
});
|
|
389175
389108
|
|
|
389176
389109
|
// src/services/plugins/pluginOperations.ts
|
|
389177
|
-
import { dirname as dirname48, join as
|
|
389110
|
+
import { dirname as dirname48, join as join119 } from "path";
|
|
389178
389111
|
function assertInstallableScope(scope) {
|
|
389179
389112
|
if (!VALID_INSTALLABLE_SCOPES.includes(scope)) {
|
|
389180
389113
|
throw new Error(`Invalid scope "${scope}". Must be one of: ${VALID_INSTALLABLE_SCOPES.join(", ")}`);
|
|
@@ -389652,7 +389585,7 @@ async function performPluginUpdate({
|
|
|
389652
389585
|
throw e;
|
|
389653
389586
|
}
|
|
389654
389587
|
const marketplaceDir = marketplaceStats.isDirectory() ? marketplaceInstallLocation : dirname48(marketplaceInstallLocation);
|
|
389655
|
-
sourcePath =
|
|
389588
|
+
sourcePath = join119(marketplaceDir, entry.source);
|
|
389656
389589
|
try {
|
|
389657
389590
|
await fs4.stat(sourcePath);
|
|
389658
389591
|
} catch (e) {
|
|
@@ -389667,7 +389600,7 @@ async function performPluginUpdate({
|
|
|
389667
389600
|
throw e;
|
|
389668
389601
|
}
|
|
389669
389602
|
let pluginManifest;
|
|
389670
|
-
const manifestPath =
|
|
389603
|
+
const manifestPath = join119(sourcePath, ".claude-plugin", "plugin.json");
|
|
389671
389604
|
try {
|
|
389672
389605
|
pluginManifest = await loadPluginManifest(manifestPath, entry.name, entry.source);
|
|
389673
389606
|
} catch {}
|
|
@@ -390884,10 +390817,10 @@ var init_ManageMarketplaces = __esm(() => {
|
|
|
390884
390817
|
|
|
390885
390818
|
// src/utils/plugins/pluginFlagging.ts
|
|
390886
390819
|
import { randomBytes as randomBytes17 } from "crypto";
|
|
390887
|
-
import { readFile as
|
|
390888
|
-
import { join as
|
|
390820
|
+
import { readFile as readFile45, rename as rename8, unlink as unlink17, writeFile as writeFile40 } from "fs/promises";
|
|
390821
|
+
import { join as join120 } from "path";
|
|
390889
390822
|
function getFlaggedPluginsPath() {
|
|
390890
|
-
return
|
|
390823
|
+
return join120(getPluginsDirectory(), FLAGGED_PLUGINS_FILENAME);
|
|
390891
390824
|
}
|
|
390892
390825
|
function parsePluginsData(content) {
|
|
390893
390826
|
const parsed = jsonParse(content);
|
|
@@ -390911,7 +390844,7 @@ function parsePluginsData(content) {
|
|
|
390911
390844
|
}
|
|
390912
390845
|
async function readFromDisk() {
|
|
390913
390846
|
try {
|
|
390914
|
-
const content = await
|
|
390847
|
+
const content = await readFile45(getFlaggedPluginsPath(), {
|
|
390915
390848
|
encoding: "utf-8"
|
|
390916
390849
|
});
|
|
390917
390850
|
return parsePluginsData(content);
|
|
@@ -390925,7 +390858,7 @@ async function writeToDisk(plugins) {
|
|
|
390925
390858
|
try {
|
|
390926
390859
|
await getFsImplementation().mkdir(getPluginsDirectory());
|
|
390927
390860
|
const content = jsonStringify({ plugins }, null, 2);
|
|
390928
|
-
await
|
|
390861
|
+
await writeFile40(tempPath, content, {
|
|
390929
390862
|
encoding: "utf-8",
|
|
390930
390863
|
mode: 384
|
|
390931
390864
|
});
|
|
@@ -394179,7 +394112,7 @@ function parsePluginArgs(args) {
|
|
|
394179
394112
|
}
|
|
394180
394113
|
|
|
394181
394114
|
// src/utils/plugins/validatePlugin.ts
|
|
394182
|
-
import { readdir as readdir28, readFile as
|
|
394115
|
+
import { readdir as readdir28, readFile as readFile47, stat as stat43 } from "fs/promises";
|
|
394183
394116
|
import * as path14 from "path";
|
|
394184
394117
|
import { z as z76 } from "zod/v4";
|
|
394185
394118
|
function detectManifestType(filePath) {
|
|
@@ -394220,7 +394153,7 @@ async function validatePluginManifest(filePath) {
|
|
|
394220
394153
|
const absolutePath = path14.resolve(filePath);
|
|
394221
394154
|
let content;
|
|
394222
394155
|
try {
|
|
394223
|
-
content = await
|
|
394156
|
+
content = await readFile47(absolutePath, { encoding: "utf-8" });
|
|
394224
394157
|
} catch (error5) {
|
|
394225
394158
|
const code = getErrnoCode(error5);
|
|
394226
394159
|
let message;
|
|
@@ -394344,7 +394277,7 @@ async function validateMarketplaceManifest(filePath) {
|
|
|
394344
394277
|
const absolutePath = path14.resolve(filePath);
|
|
394345
394278
|
let content;
|
|
394346
394279
|
try {
|
|
394347
|
-
content = await
|
|
394280
|
+
content = await readFile47(absolutePath, { encoding: "utf-8" });
|
|
394348
394281
|
} catch (error5) {
|
|
394349
394282
|
const code = getErrnoCode(error5);
|
|
394350
394283
|
let message;
|
|
@@ -394430,7 +394363,7 @@ async function validateMarketplaceManifest(filePath) {
|
|
|
394430
394363
|
const pluginJsonPath = path14.join(marketplaceRoot, entry.source, ".claude-plugin", "plugin.json");
|
|
394431
394364
|
let manifestVersion;
|
|
394432
394365
|
try {
|
|
394433
|
-
const raw = await
|
|
394366
|
+
const raw = await readFile47(pluginJsonPath, { encoding: "utf-8" });
|
|
394434
394367
|
const parsed2 = jsonParse(raw);
|
|
394435
394368
|
if (typeof parsed2.version === "string") {
|
|
394436
394369
|
manifestVersion = parsed2.version;
|
|
@@ -394547,7 +394480,7 @@ function validateComponentFile(filePath, content, fileType) {
|
|
|
394547
394480
|
async function validateHooksJson(filePath) {
|
|
394548
394481
|
let content;
|
|
394549
394482
|
try {
|
|
394550
|
-
content = await
|
|
394483
|
+
content = await readFile47(filePath, { encoding: "utf-8" });
|
|
394551
394484
|
} catch (e) {
|
|
394552
394485
|
const code = getErrnoCode(e);
|
|
394553
394486
|
if (code === "ENOENT") {
|
|
@@ -394640,7 +394573,7 @@ async function validatePluginContents(pluginDir) {
|
|
|
394640
394573
|
for (const filePath of files) {
|
|
394641
394574
|
let content;
|
|
394642
394575
|
try {
|
|
394643
|
-
content = await
|
|
394576
|
+
content = await readFile47(filePath, { encoding: "utf-8" });
|
|
394644
394577
|
} catch (e) {
|
|
394645
394578
|
if (isENOENT(e))
|
|
394646
394579
|
continue;
|
|
@@ -394709,7 +394642,7 @@ async function validateManifest2(filePath) {
|
|
|
394709
394642
|
return validateMarketplaceManifest(filePath);
|
|
394710
394643
|
case "unknown": {
|
|
394711
394644
|
try {
|
|
394712
|
-
const content = await
|
|
394645
|
+
const content = await readFile47(absolutePath, { encoding: "utf-8" });
|
|
394713
394646
|
const parsed = jsonParse(content);
|
|
394714
394647
|
if (Array.isArray(parsed.plugins)) {
|
|
394715
394648
|
return validateMarketplaceManifest(filePath);
|
|
@@ -396387,10 +396320,10 @@ ${args ? "Additional user input: " + args : ""}
|
|
|
396387
396320
|
});
|
|
396388
396321
|
|
|
396389
396322
|
// src/utils/releaseNotes.ts
|
|
396390
|
-
import { mkdir as
|
|
396391
|
-
import { dirname as dirname50, join as
|
|
396323
|
+
import { mkdir as mkdir38, readFile as readFile48, writeFile as writeFile41 } from "fs/promises";
|
|
396324
|
+
import { dirname as dirname50, join as join123 } from "path";
|
|
396392
396325
|
function getChangelogCachePath() {
|
|
396393
|
-
return
|
|
396326
|
+
return join123(getClaudeConfigHomeDir(), "cache", "changelog.md");
|
|
396394
396327
|
}
|
|
396395
396328
|
async function migrateChangelogFromConfig() {
|
|
396396
396329
|
const config2 = getGlobalConfig();
|
|
@@ -396399,8 +396332,8 @@ async function migrateChangelogFromConfig() {
|
|
|
396399
396332
|
}
|
|
396400
396333
|
const cachePath = getChangelogCachePath();
|
|
396401
396334
|
try {
|
|
396402
|
-
await
|
|
396403
|
-
await
|
|
396335
|
+
await mkdir38(dirname50(cachePath), { recursive: true });
|
|
396336
|
+
await writeFile41(cachePath, config2.cachedChangelog, {
|
|
396404
396337
|
encoding: "utf-8",
|
|
396405
396338
|
flag: "wx"
|
|
396406
396339
|
});
|
|
@@ -396421,8 +396354,8 @@ async function fetchAndStoreChangelog() {
|
|
|
396421
396354
|
return;
|
|
396422
396355
|
}
|
|
396423
396356
|
const cachePath = getChangelogCachePath();
|
|
396424
|
-
await
|
|
396425
|
-
await
|
|
396357
|
+
await mkdir38(dirname50(cachePath), { recursive: true });
|
|
396358
|
+
await writeFile41(cachePath, changelogContent, { encoding: "utf-8" });
|
|
396426
396359
|
changelogMemoryCache = changelogContent;
|
|
396427
396360
|
const changelogLastFetched = Date.now();
|
|
396428
396361
|
saveGlobalConfig((current) => ({
|
|
@@ -396437,7 +396370,7 @@ async function getStoredChangelog() {
|
|
|
396437
396370
|
}
|
|
396438
396371
|
const cachePath = getChangelogCachePath();
|
|
396439
396372
|
try {
|
|
396440
|
-
const content = await
|
|
396373
|
+
const content = await readFile48(cachePath, "utf-8");
|
|
396441
396374
|
changelogMemoryCache = content;
|
|
396442
396375
|
return content;
|
|
396443
396376
|
} catch {
|
|
@@ -396508,7 +396441,7 @@ function getAllReleaseNotes(changelogContent = getStoredChangelogFromMemory()) {
|
|
|
396508
396441
|
return [];
|
|
396509
396442
|
}
|
|
396510
396443
|
}
|
|
396511
|
-
async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.3.
|
|
396444
|
+
async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.3.3") {
|
|
396512
396445
|
if (process.env.USER_TYPE === "ant") {
|
|
396513
396446
|
const changelog = MACRO.VERSION_CHANGELOG;
|
|
396514
396447
|
if (changelog) {
|
|
@@ -396535,7 +396468,7 @@ async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.3.2") {
|
|
|
396535
396468
|
releaseNotes
|
|
396536
396469
|
};
|
|
396537
396470
|
}
|
|
396538
|
-
function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "1.3.
|
|
396471
|
+
function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "1.3.3") {
|
|
396539
396472
|
if (process.env.USER_TYPE === "ant") {
|
|
396540
396473
|
const changelog = MACRO.VERSION_CHANGELOG;
|
|
396541
396474
|
if (changelog) {
|
|
@@ -397793,7 +397726,7 @@ function getRecentActivitySync() {
|
|
|
397793
397726
|
return cachedActivity;
|
|
397794
397727
|
}
|
|
397795
397728
|
function getLogoDisplayData() {
|
|
397796
|
-
const version = process.env.DEMO_VERSION ?? "1.3.
|
|
397729
|
+
const version = process.env.DEMO_VERSION ?? "1.3.3";
|
|
397797
397730
|
const serverUrl = getDirectConnectServerUrl();
|
|
397798
397731
|
const displayPath = process.env.DEMO_VERSION ? "/code/claude" : getDisplayPath(getCwd());
|
|
397799
397732
|
const cwd2 = serverUrl ? `${displayPath} in ${serverUrl.replace(/^https?:\/\//, "")}` : displayPath;
|
|
@@ -398306,7 +398239,7 @@ var init_referral = __esm(() => {
|
|
|
398306
398239
|
});
|
|
398307
398240
|
|
|
398308
398241
|
// src/components/Logo/feedConfigs.tsx
|
|
398309
|
-
import { homedir as
|
|
398242
|
+
import { homedir as homedir38 } from "os";
|
|
398310
398243
|
function createRecentActivityFeed(activities) {
|
|
398311
398244
|
const lines = activities.map((log2) => {
|
|
398312
398245
|
const time = formatRelativeTimeAgo(log2.modified);
|
|
@@ -398351,7 +398284,7 @@ function createProjectOnboardingFeed(steps) {
|
|
|
398351
398284
|
text: `${checkmark}${text}`
|
|
398352
398285
|
};
|
|
398353
398286
|
});
|
|
398354
|
-
const warningText = getCwd() ===
|
|
398287
|
+
const warningText = getCwd() === homedir38() ? "Note: You have launched claude in your home directory. For the best experience, launch it in a project directory instead." : undefined;
|
|
398355
398288
|
if (warningText) {
|
|
398356
398289
|
lines.push({
|
|
398357
398290
|
text: warningText
|
|
@@ -398900,7 +398833,7 @@ function Logo() {
|
|
|
398900
398833
|
if ($2[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
398901
398834
|
t2 = () => {
|
|
398902
398835
|
const currentConfig = getGlobalConfig();
|
|
398903
|
-
if (currentConfig.lastReleaseNotesSeen === "1.3.
|
|
398836
|
+
if (currentConfig.lastReleaseNotesSeen === "1.3.3") {
|
|
398904
398837
|
return;
|
|
398905
398838
|
}
|
|
398906
398839
|
saveGlobalConfig(_temp326);
|
|
@@ -399559,12 +399492,12 @@ function Logo() {
|
|
|
399559
399492
|
return t41;
|
|
399560
399493
|
}
|
|
399561
399494
|
function _temp326(current) {
|
|
399562
|
-
if (current.lastReleaseNotesSeen === "1.3.
|
|
399495
|
+
if (current.lastReleaseNotesSeen === "1.3.3") {
|
|
399563
399496
|
return current;
|
|
399564
399497
|
}
|
|
399565
399498
|
return {
|
|
399566
399499
|
...current,
|
|
399567
|
-
lastReleaseNotesSeen: "1.3.
|
|
399500
|
+
lastReleaseNotesSeen: "1.3.3"
|
|
399568
399501
|
};
|
|
399569
399502
|
}
|
|
399570
399503
|
function _temp241(s_0) {
|
|
@@ -416921,8 +416854,8 @@ __export(exports_thinkback, {
|
|
|
416921
416854
|
call: () => call52
|
|
416922
416855
|
});
|
|
416923
416856
|
import { execa as execa11 } from "execa";
|
|
416924
|
-
import { readFile as
|
|
416925
|
-
import { join as
|
|
416857
|
+
import { readFile as readFile49 } from "fs/promises";
|
|
416858
|
+
import { join as join124 } from "path";
|
|
416926
416859
|
function getMarketplaceName() {
|
|
416927
416860
|
return OFFICIAL_MARKETPLACE_NAME;
|
|
416928
416861
|
}
|
|
@@ -416940,17 +416873,17 @@ async function getThinkbackSkillDir() {
|
|
|
416940
416873
|
if (!thinkbackPlugin) {
|
|
416941
416874
|
return null;
|
|
416942
416875
|
}
|
|
416943
|
-
const skillDir =
|
|
416876
|
+
const skillDir = join124(thinkbackPlugin.path, "skills", SKILL_NAME);
|
|
416944
416877
|
if (await pathExists(skillDir)) {
|
|
416945
416878
|
return skillDir;
|
|
416946
416879
|
}
|
|
416947
416880
|
return null;
|
|
416948
416881
|
}
|
|
416949
416882
|
async function playAnimation(skillDir) {
|
|
416950
|
-
const dataPath =
|
|
416951
|
-
const playerPath =
|
|
416883
|
+
const dataPath = join124(skillDir, "year_in_review.js");
|
|
416884
|
+
const playerPath = join124(skillDir, "player.js");
|
|
416952
416885
|
try {
|
|
416953
|
-
await
|
|
416886
|
+
await readFile49(dataPath);
|
|
416954
416887
|
} catch (e) {
|
|
416955
416888
|
if (isENOENT(e)) {
|
|
416956
416889
|
return {
|
|
@@ -416965,7 +416898,7 @@ async function playAnimation(skillDir) {
|
|
|
416965
416898
|
};
|
|
416966
416899
|
}
|
|
416967
416900
|
try {
|
|
416968
|
-
await
|
|
416901
|
+
await readFile49(playerPath);
|
|
416969
416902
|
} catch (e) {
|
|
416970
416903
|
if (isENOENT(e)) {
|
|
416971
416904
|
return {
|
|
@@ -416996,7 +416929,7 @@ async function playAnimation(skillDir) {
|
|
|
416996
416929
|
} catch {} finally {
|
|
416997
416930
|
inkInstance.exitAlternateScreen();
|
|
416998
416931
|
}
|
|
416999
|
-
const htmlPath =
|
|
416932
|
+
const htmlPath = join124(skillDir, "year_in_review.html");
|
|
417000
416933
|
if (await pathExists(htmlPath)) {
|
|
417001
416934
|
const platform3 = getPlatform();
|
|
417002
416935
|
const openCmd = platform3 === "macos" ? "open" : platform3 === "windows" ? "start" : "xdg-open";
|
|
@@ -417332,7 +417265,7 @@ function ThinkbackFlow(t0) {
|
|
|
417332
417265
|
if (!skillDir) {
|
|
417333
417266
|
return;
|
|
417334
417267
|
}
|
|
417335
|
-
const dataPath =
|
|
417268
|
+
const dataPath = join124(skillDir, "year_in_review.js");
|
|
417336
417269
|
pathExists(dataPath).then((exists) => {
|
|
417337
417270
|
logForDebugging(`Checking for ${dataPath}: ${exists ? "found" : "not found"}`);
|
|
417338
417271
|
setHasGenerated(exists);
|
|
@@ -417503,7 +417436,7 @@ var exports_thinkback_play = {};
|
|
|
417503
417436
|
__export(exports_thinkback_play, {
|
|
417504
417437
|
call: () => call53
|
|
417505
417438
|
});
|
|
417506
|
-
import { join as
|
|
417439
|
+
import { join as join125 } from "path";
|
|
417507
417440
|
function getPluginId2() {
|
|
417508
417441
|
const marketplaceName = process.env.USER_TYPE === "ant" ? INTERNAL_MARKETPLACE_NAME : OFFICIAL_MARKETPLACE_NAME;
|
|
417509
417442
|
return `thinkback@${marketplaceName}`;
|
|
@@ -417525,7 +417458,7 @@ async function call53() {
|
|
|
417525
417458
|
value: "Thinkback plugin installation path not found."
|
|
417526
417459
|
};
|
|
417527
417460
|
}
|
|
417528
|
-
const skillDir =
|
|
417461
|
+
const skillDir = join125(firstInstall.installPath, "skills", SKILL_NAME2);
|
|
417529
417462
|
const result = await playAnimation(skillDir);
|
|
417530
417463
|
return { type: "text", value: result.message };
|
|
417531
417464
|
}
|
|
@@ -423560,7 +423493,7 @@ __export(exports_branch, {
|
|
|
423560
423493
|
call: () => call61
|
|
423561
423494
|
});
|
|
423562
423495
|
import { randomUUID as randomUUID27 } from "crypto";
|
|
423563
|
-
import { mkdir as
|
|
423496
|
+
import { mkdir as mkdir39, readFile as readFile50, writeFile as writeFile42 } from "fs/promises";
|
|
423564
423497
|
function deriveFirstPrompt(firstUserMessage) {
|
|
423565
423498
|
const content = firstUserMessage?.message?.content;
|
|
423566
423499
|
if (!content)
|
|
@@ -423576,10 +423509,10 @@ async function createFork(customTitle) {
|
|
|
423576
423509
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
423577
423510
|
const forkSessionPath = getTranscriptPathForSession(forkSessionId);
|
|
423578
423511
|
const currentTranscriptPath = getTranscriptPath();
|
|
423579
|
-
await
|
|
423512
|
+
await mkdir39(projectDir, { recursive: true, mode: 448 });
|
|
423580
423513
|
let transcriptContent;
|
|
423581
423514
|
try {
|
|
423582
|
-
transcriptContent = await
|
|
423515
|
+
transcriptContent = await readFile50(currentTranscriptPath);
|
|
423583
423516
|
} catch {
|
|
423584
423517
|
throw new Error("No conversation to branch");
|
|
423585
423518
|
}
|
|
@@ -423624,7 +423557,7 @@ async function createFork(customTitle) {
|
|
|
423624
423557
|
};
|
|
423625
423558
|
lines.push(jsonStringify(forkedReplacementEntry));
|
|
423626
423559
|
}
|
|
423627
|
-
await
|
|
423560
|
+
await writeFile42(forkSessionPath, lines.join(`
|
|
423628
423561
|
`) + `
|
|
423629
423562
|
`, {
|
|
423630
423563
|
encoding: "utf8",
|
|
@@ -423886,8 +423819,8 @@ var init_types11 = __esm(() => {
|
|
|
423886
423819
|
});
|
|
423887
423820
|
|
|
423888
423821
|
// src/components/agents/agentFileUtils.ts
|
|
423889
|
-
import { mkdir as
|
|
423890
|
-
import { join as
|
|
423822
|
+
import { mkdir as mkdir40, open as open12, unlink as unlink18 } from "fs/promises";
|
|
423823
|
+
import { join as join126 } from "path";
|
|
423891
423824
|
function formatAgentAsMarkdown(agentType, whenToUse, tools, systemPrompt, color3, model, memory2, effort) {
|
|
423892
423825
|
const escapedWhenToUse = whenToUse.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\\\n");
|
|
423893
423826
|
const isAllTools = tools === undefined || tools.length === 1 && tools[0] === "*";
|
|
@@ -423914,26 +423847,26 @@ function getAgentDirectoryPath(location) {
|
|
|
423914
423847
|
case "flagSettings":
|
|
423915
423848
|
throw new Error(`Cannot get directory path for ${location} agents`);
|
|
423916
423849
|
case "userSettings":
|
|
423917
|
-
return
|
|
423850
|
+
return join126(getClaudeConfigHomeDir(), AGENT_PATHS.AGENTS_DIR);
|
|
423918
423851
|
case "projectSettings":
|
|
423919
|
-
return
|
|
423852
|
+
return join126(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
423920
423853
|
case "policySettings":
|
|
423921
|
-
return
|
|
423854
|
+
return join126(getManagedFilePath(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
423922
423855
|
case "localSettings":
|
|
423923
|
-
return
|
|
423856
|
+
return join126(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
423924
423857
|
}
|
|
423925
423858
|
}
|
|
423926
423859
|
function getRelativeAgentDirectoryPath(location) {
|
|
423927
423860
|
switch (location) {
|
|
423928
423861
|
case "projectSettings":
|
|
423929
|
-
return
|
|
423862
|
+
return join126(".", AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
423930
423863
|
default:
|
|
423931
423864
|
return getAgentDirectoryPath(location);
|
|
423932
423865
|
}
|
|
423933
423866
|
}
|
|
423934
423867
|
function getNewAgentFilePath(agent) {
|
|
423935
423868
|
const dirPath = getAgentDirectoryPath(agent.source);
|
|
423936
|
-
return
|
|
423869
|
+
return join126(dirPath, `${agent.agentType}.md`);
|
|
423937
423870
|
}
|
|
423938
423871
|
function getActualAgentFilePath(agent) {
|
|
423939
423872
|
if (agent.source === "built-in") {
|
|
@@ -423944,14 +423877,14 @@ function getActualAgentFilePath(agent) {
|
|
|
423944
423877
|
}
|
|
423945
423878
|
const dirPath = getAgentDirectoryPath(agent.source);
|
|
423946
423879
|
const filename = agent.filename || agent.agentType;
|
|
423947
|
-
return
|
|
423880
|
+
return join126(dirPath, `${filename}.md`);
|
|
423948
423881
|
}
|
|
423949
423882
|
function getNewRelativeAgentFilePath(agent) {
|
|
423950
423883
|
if (agent.source === "built-in") {
|
|
423951
423884
|
return "Built-in";
|
|
423952
423885
|
}
|
|
423953
423886
|
const dirPath = getRelativeAgentDirectoryPath(agent.source);
|
|
423954
|
-
return
|
|
423887
|
+
return join126(dirPath, `${agent.agentType}.md`);
|
|
423955
423888
|
}
|
|
423956
423889
|
function getActualRelativeAgentFilePath(agent) {
|
|
423957
423890
|
if (isBuiltInAgent(agent)) {
|
|
@@ -423965,11 +423898,11 @@ function getActualRelativeAgentFilePath(agent) {
|
|
|
423965
423898
|
}
|
|
423966
423899
|
const dirPath = getRelativeAgentDirectoryPath(agent.source);
|
|
423967
423900
|
const filename = agent.filename || agent.agentType;
|
|
423968
|
-
return
|
|
423901
|
+
return join126(dirPath, `${filename}.md`);
|
|
423969
423902
|
}
|
|
423970
423903
|
async function ensureAgentDirectoryExists(source) {
|
|
423971
423904
|
const dirPath = getAgentDirectoryPath(source);
|
|
423972
|
-
await
|
|
423905
|
+
await mkdir40(dirPath, { recursive: true });
|
|
423973
423906
|
return dirPath;
|
|
423974
423907
|
}
|
|
423975
423908
|
async function saveAgentToFile(source, agentType, whenToUse, tools, systemPrompt, checkExists = true, color3, model, memory2, effort) {
|
|
@@ -429952,8 +429885,8 @@ var init_rewind = __esm(() => {
|
|
|
429952
429885
|
|
|
429953
429886
|
// src/utils/heapDumpService.ts
|
|
429954
429887
|
import { createWriteStream as createWriteStream2, writeFileSync as writeFileSync4 } from "fs";
|
|
429955
|
-
import { readdir as readdir29, readFile as
|
|
429956
|
-
import { join as
|
|
429888
|
+
import { readdir as readdir29, readFile as readFile51, writeFile as writeFile43 } from "fs/promises";
|
|
429889
|
+
import { join as join127 } from "path";
|
|
429957
429890
|
import { pipeline as pipeline2 } from "stream/promises";
|
|
429958
429891
|
import {
|
|
429959
429892
|
getHeapSnapshot,
|
|
@@ -429977,7 +429910,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
429977
429910
|
} catch {}
|
|
429978
429911
|
let smapsRollup;
|
|
429979
429912
|
try {
|
|
429980
|
-
smapsRollup = await
|
|
429913
|
+
smapsRollup = await readFile51("/proc/self/smaps_rollup", "utf8");
|
|
429981
429914
|
} catch {}
|
|
429982
429915
|
const nativeMemory = usage.rss - usage.heapUsed;
|
|
429983
429916
|
const bytesPerSecond = uptimeSeconds > 0 ? usage.rss / uptimeSeconds : 0;
|
|
@@ -430043,7 +429976,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
430043
429976
|
smapsRollup,
|
|
430044
429977
|
platform: process.platform,
|
|
430045
429978
|
nodeVersion: process.version,
|
|
430046
|
-
ccVersion: "1.3.
|
|
429979
|
+
ccVersion: "1.3.3"
|
|
430047
429980
|
};
|
|
430048
429981
|
}
|
|
430049
429982
|
async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
@@ -430061,9 +429994,9 @@ async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
|
430061
429994
|
const suffix = dumpNumber > 0 ? `-dump${dumpNumber}` : "";
|
|
430062
429995
|
const heapFilename = `${sessionId}${suffix}.heapsnapshot`;
|
|
430063
429996
|
const diagFilename = `${sessionId}${suffix}-diagnostics.json`;
|
|
430064
|
-
const heapPath =
|
|
430065
|
-
const diagPath =
|
|
430066
|
-
await
|
|
429997
|
+
const heapPath = join127(dumpDir, heapFilename);
|
|
429998
|
+
const diagPath = join127(dumpDir, diagFilename);
|
|
429999
|
+
await writeFile43(diagPath, jsonStringify(diagnostics, null, 2), {
|
|
430067
430000
|
mode: 384
|
|
430068
430001
|
});
|
|
430069
430002
|
logForDebugging(`[HeapDump] Diagnostics written to ${diagPath}`);
|
|
@@ -430628,7 +430561,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
430628
430561
|
var call68 = async () => {
|
|
430629
430562
|
return {
|
|
430630
430563
|
type: "text",
|
|
430631
|
-
value: `${"1.3.
|
|
430564
|
+
value: `${"1.3.3"} (built ${"2026-04-23T19:20:47.066Z"})`
|
|
430632
430565
|
};
|
|
430633
430566
|
}, version, version_default;
|
|
430634
430567
|
var init_version = __esm(() => {
|
|
@@ -431995,8 +431928,8 @@ var init_advisor2 = __esm(() => {
|
|
|
431995
431928
|
|
|
431996
431929
|
// src/skills/bundledSkills.ts
|
|
431997
431930
|
import { constants as fsConstants4 } from "fs";
|
|
431998
|
-
import { mkdir as
|
|
431999
|
-
import { dirname as dirname51, isAbsolute as isAbsolute24, join as
|
|
431931
|
+
import { mkdir as mkdir41, open as open13 } from "fs/promises";
|
|
431932
|
+
import { dirname as dirname51, isAbsolute as isAbsolute24, join as join128, normalize as normalize12, sep as pathSep2 } from "path";
|
|
432000
431933
|
function registerBundledSkill(definition) {
|
|
432001
431934
|
const { files: files2 } = definition;
|
|
432002
431935
|
let skillRoot;
|
|
@@ -432044,7 +431977,7 @@ function getBundledSkills() {
|
|
|
432044
431977
|
return [...bundledSkills];
|
|
432045
431978
|
}
|
|
432046
431979
|
function getBundledSkillExtractDir(skillName) {
|
|
432047
|
-
return
|
|
431980
|
+
return join128(getBundledSkillsRoot(), skillName);
|
|
432048
431981
|
}
|
|
432049
431982
|
async function extractBundledSkillFiles(skillName, files2) {
|
|
432050
431983
|
const dir = getBundledSkillExtractDir(skillName);
|
|
@@ -432069,7 +432002,7 @@ async function writeSkillFiles(dir, files2) {
|
|
|
432069
432002
|
byParent.set(parent2, [entry]);
|
|
432070
432003
|
}
|
|
432071
432004
|
await Promise.all([...byParent].map(async ([parent2, entries]) => {
|
|
432072
|
-
await
|
|
432005
|
+
await mkdir41(parent2, { recursive: true, mode: 448 });
|
|
432073
432006
|
await Promise.all(entries.map(([p, c5]) => safeWriteFile(p, c5)));
|
|
432074
432007
|
}));
|
|
432075
432008
|
}
|
|
@@ -432086,7 +432019,7 @@ function resolveSkillFilePath(baseDir, relPath) {
|
|
|
432086
432019
|
if (isAbsolute24(normalized) || normalized.split(pathSep2).includes("..") || normalized.split("/").includes("..")) {
|
|
432087
432020
|
throw new Error(`bundled skill file path escapes skill dir: ${relPath}`);
|
|
432088
432021
|
}
|
|
432089
|
-
return
|
|
432022
|
+
return join128(baseDir, normalized);
|
|
432090
432023
|
}
|
|
432091
432024
|
function prependBaseDir(blocks, baseDir) {
|
|
432092
432025
|
const prefix = `Base directory for this skill: ${baseDir}
|
|
@@ -432445,7 +432378,7 @@ var init_exit2 = __esm(() => {
|
|
|
432445
432378
|
});
|
|
432446
432379
|
|
|
432447
432380
|
// src/components/ExportDialog.tsx
|
|
432448
|
-
import { join as
|
|
432381
|
+
import { join as join129 } from "path";
|
|
432449
432382
|
function ExportDialog({
|
|
432450
432383
|
content,
|
|
432451
432384
|
defaultFilename,
|
|
@@ -432478,7 +432411,7 @@ function ExportDialog({
|
|
|
432478
432411
|
};
|
|
432479
432412
|
const handleFilenameSubmit = () => {
|
|
432480
432413
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
432481
|
-
const filepath =
|
|
432414
|
+
const filepath = join129(getCwd(), finalFilename);
|
|
432482
432415
|
try {
|
|
432483
432416
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
432484
432417
|
encoding: "utf-8",
|
|
@@ -432701,7 +432634,7 @@ __export(exports_export, {
|
|
|
432701
432634
|
extractFirstPrompt: () => extractFirstPrompt,
|
|
432702
432635
|
call: () => call72
|
|
432703
432636
|
});
|
|
432704
|
-
import { join as
|
|
432637
|
+
import { join as join130 } from "path";
|
|
432705
432638
|
function formatTimestamp(date2) {
|
|
432706
432639
|
const year = date2.getFullYear();
|
|
432707
432640
|
const month = String(date2.getMonth() + 1).padStart(2, "0");
|
|
@@ -432745,7 +432678,7 @@ async function call72(onDone, context7, args) {
|
|
|
432745
432678
|
const filename = args.trim();
|
|
432746
432679
|
if (filename) {
|
|
432747
432680
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
432748
|
-
const filepath =
|
|
432681
|
+
const filepath = join130(getCwd(), finalFilename);
|
|
432749
432682
|
try {
|
|
432750
432683
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
432751
432684
|
encoding: "utf-8",
|
|
@@ -434290,7 +434223,7 @@ var init_asciichart = __esm(() => {
|
|
|
434290
434223
|
// src/utils/statsCache.ts
|
|
434291
434224
|
import { randomBytes as randomBytes18 } from "crypto";
|
|
434292
434225
|
import { open as open14 } from "fs/promises";
|
|
434293
|
-
import { join as
|
|
434226
|
+
import { join as join131 } from "path";
|
|
434294
434227
|
async function withStatsCacheLock(fn) {
|
|
434295
434228
|
while (statsCacheLockPromise) {
|
|
434296
434229
|
await statsCacheLockPromise;
|
|
@@ -434307,7 +434240,7 @@ async function withStatsCacheLock(fn) {
|
|
|
434307
434240
|
}
|
|
434308
434241
|
}
|
|
434309
434242
|
function getStatsCachePath() {
|
|
434310
|
-
return
|
|
434243
|
+
return join131(getClaudeConfigHomeDir(), STATS_CACHE_FILENAME);
|
|
434311
434244
|
}
|
|
434312
434245
|
function getEmptyCache() {
|
|
434313
434246
|
return {
|
|
@@ -434973,16 +434906,16 @@ var init_ansiToPng = __esm(() => {
|
|
|
434973
434906
|
});
|
|
434974
434907
|
|
|
434975
434908
|
// src/utils/screenshotClipboard.ts
|
|
434976
|
-
import { mkdir as
|
|
434909
|
+
import { mkdir as mkdir42, unlink as unlink19, writeFile as writeFile44 } from "fs/promises";
|
|
434977
434910
|
import { tmpdir as tmpdir8 } from "os";
|
|
434978
|
-
import { join as
|
|
434911
|
+
import { join as join132 } from "path";
|
|
434979
434912
|
async function copyAnsiToClipboard(ansiText, options) {
|
|
434980
434913
|
try {
|
|
434981
|
-
const tempDir =
|
|
434982
|
-
await
|
|
434983
|
-
const pngPath =
|
|
434914
|
+
const tempDir = join132(tmpdir8(), "claude-code-screenshots");
|
|
434915
|
+
await mkdir42(tempDir, { recursive: true });
|
|
434916
|
+
const pngPath = join132(tempDir, `screenshot-${Date.now()}.png`);
|
|
434984
434917
|
const pngBuffer = ansiToPng(ansiText, options);
|
|
434985
|
-
await
|
|
434918
|
+
await writeFile44(pngPath, pngBuffer);
|
|
434986
434919
|
const result = await copyPngToClipboard(pngPath);
|
|
434987
434920
|
try {
|
|
434988
434921
|
await unlink19(pngPath);
|
|
@@ -435051,7 +434984,7 @@ var init_screenshotClipboard = __esm(() => {
|
|
|
435051
434984
|
|
|
435052
434985
|
// src/utils/stats.ts
|
|
435053
434986
|
import { open as open15 } from "fs/promises";
|
|
435054
|
-
import { basename as basename39, join as
|
|
434987
|
+
import { basename as basename39, join as join133, sep as sep30 } from "path";
|
|
435055
434988
|
async function processSessionFiles(sessionFiles, options = {}) {
|
|
435056
434989
|
const { fromDate, toDate } = options;
|
|
435057
434990
|
const fs5 = getFsImplementation();
|
|
@@ -435229,17 +435162,17 @@ async function getAllSessionFiles() {
|
|
|
435229
435162
|
return [];
|
|
435230
435163
|
throw e;
|
|
435231
435164
|
}
|
|
435232
|
-
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
435165
|
+
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) => join133(projectsDir, dirent.name));
|
|
435233
435166
|
const projectResults = await Promise.all(projectDirs.map(async (projectDir) => {
|
|
435234
435167
|
try {
|
|
435235
435168
|
const entries = await fs5.readdir(projectDir);
|
|
435236
|
-
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) =>
|
|
435169
|
+
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) => join133(projectDir, dirent.name));
|
|
435237
435170
|
const sessionDirs = entries.filter((dirent) => dirent.isDirectory());
|
|
435238
435171
|
const subagentResults = await Promise.all(sessionDirs.map(async (sessionDir) => {
|
|
435239
|
-
const subagentsDir =
|
|
435172
|
+
const subagentsDir = join133(projectDir, sessionDir.name, "subagents");
|
|
435240
435173
|
try {
|
|
435241
435174
|
const subagentEntries = await fs5.readdir(subagentsDir);
|
|
435242
|
-
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) =>
|
|
435175
|
+
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) => join133(subagentsDir, dirent.name));
|
|
435243
435176
|
} catch {
|
|
435244
435177
|
return [];
|
|
435245
435178
|
}
|
|
@@ -437109,16 +437042,16 @@ import { execFileSync as execFileSync3 } from "child_process";
|
|
|
437109
437042
|
import { constants as fsConstants5 } from "fs";
|
|
437110
437043
|
import {
|
|
437111
437044
|
copyFile as copyFile9,
|
|
437112
|
-
mkdir as
|
|
437045
|
+
mkdir as mkdir43,
|
|
437113
437046
|
mkdtemp,
|
|
437114
437047
|
readdir as readdir30,
|
|
437115
|
-
readFile as
|
|
437048
|
+
readFile as readFile52,
|
|
437116
437049
|
rm as rm10,
|
|
437117
437050
|
unlink as unlink20,
|
|
437118
|
-
writeFile as
|
|
437051
|
+
writeFile as writeFile45
|
|
437119
437052
|
} from "fs/promises";
|
|
437120
437053
|
import { tmpdir as tmpdir9 } from "os";
|
|
437121
|
-
import { extname as extname13, join as
|
|
437054
|
+
import { extname as extname13, join as join134 } from "path";
|
|
437122
437055
|
function getAnalysisModel() {
|
|
437123
437056
|
return getDefaultOpusModel();
|
|
437124
437057
|
}
|
|
@@ -437126,13 +437059,13 @@ function getInsightsModel() {
|
|
|
437126
437059
|
return getDefaultOpusModel();
|
|
437127
437060
|
}
|
|
437128
437061
|
function getDataDir() {
|
|
437129
|
-
return
|
|
437062
|
+
return join134(getClaudeConfigHomeDir(), "usage-data");
|
|
437130
437063
|
}
|
|
437131
437064
|
function getFacetsDir() {
|
|
437132
|
-
return
|
|
437065
|
+
return join134(getDataDir(), "facets");
|
|
437133
437066
|
}
|
|
437134
437067
|
function getSessionMetaDir() {
|
|
437135
|
-
return
|
|
437068
|
+
return join134(getDataDir(), "session-meta");
|
|
437136
437069
|
}
|
|
437137
437070
|
function getLanguageFromPath(filePath) {
|
|
437138
437071
|
const ext = extname13(filePath).toLowerCase();
|
|
@@ -437477,9 +437410,9 @@ async function formatTranscriptWithSummarization(log2) {
|
|
|
437477
437410
|
`);
|
|
437478
437411
|
}
|
|
437479
437412
|
async function loadCachedFacets(sessionId) {
|
|
437480
|
-
const facetPath =
|
|
437413
|
+
const facetPath = join134(getFacetsDir(), `${sessionId}.json`);
|
|
437481
437414
|
try {
|
|
437482
|
-
const content = await
|
|
437415
|
+
const content = await readFile52(facetPath, { encoding: "utf-8" });
|
|
437483
437416
|
const parsed = jsonParse(content);
|
|
437484
437417
|
if (!isValidSessionFacets(parsed)) {
|
|
437485
437418
|
try {
|
|
@@ -437494,18 +437427,18 @@ async function loadCachedFacets(sessionId) {
|
|
|
437494
437427
|
}
|
|
437495
437428
|
async function saveFacets(facets) {
|
|
437496
437429
|
try {
|
|
437497
|
-
await
|
|
437430
|
+
await mkdir43(getFacetsDir(), { recursive: true });
|
|
437498
437431
|
} catch {}
|
|
437499
|
-
const facetPath =
|
|
437500
|
-
await
|
|
437432
|
+
const facetPath = join134(getFacetsDir(), `${facets.session_id}.json`);
|
|
437433
|
+
await writeFile45(facetPath, jsonStringify(facets, null, 2), {
|
|
437501
437434
|
encoding: "utf-8",
|
|
437502
437435
|
mode: 384
|
|
437503
437436
|
});
|
|
437504
437437
|
}
|
|
437505
437438
|
async function loadCachedSessionMeta(sessionId) {
|
|
437506
|
-
const metaPath =
|
|
437439
|
+
const metaPath = join134(getSessionMetaDir(), `${sessionId}.json`);
|
|
437507
437440
|
try {
|
|
437508
|
-
const content = await
|
|
437441
|
+
const content = await readFile52(metaPath, { encoding: "utf-8" });
|
|
437509
437442
|
return jsonParse(content);
|
|
437510
437443
|
} catch {
|
|
437511
437444
|
return null;
|
|
@@ -437513,10 +437446,10 @@ async function loadCachedSessionMeta(sessionId) {
|
|
|
437513
437446
|
}
|
|
437514
437447
|
async function saveSessionMeta(meta) {
|
|
437515
437448
|
try {
|
|
437516
|
-
await
|
|
437449
|
+
await mkdir43(getSessionMetaDir(), { recursive: true });
|
|
437517
437450
|
} catch {}
|
|
437518
|
-
const metaPath =
|
|
437519
|
-
await
|
|
437451
|
+
const metaPath = join134(getSessionMetaDir(), `${meta.session_id}.json`);
|
|
437452
|
+
await writeFile45(metaPath, jsonStringify(meta, null, 2), {
|
|
437520
437453
|
encoding: "utf-8",
|
|
437521
437454
|
mode: 384
|
|
437522
437455
|
});
|
|
@@ -438572,7 +438505,7 @@ function generateHtmlReport(data, insights) {
|
|
|
438572
438505
|
</html>`;
|
|
438573
438506
|
}
|
|
438574
438507
|
function buildExportData(data, insights, facets, remoteStats) {
|
|
438575
|
-
const version2 = typeof MACRO !== "undefined" ? "1.3.
|
|
438508
|
+
const version2 = typeof MACRO !== "undefined" ? "1.3.3" : "unknown";
|
|
438576
438509
|
const remote_hosts_collected = remoteStats?.hosts.filter((h) => h.sessionCount > 0).map((h) => h.name);
|
|
438577
438510
|
const facets_summary = {
|
|
438578
438511
|
total: facets.size,
|
|
@@ -438623,7 +438556,7 @@ async function scanAllSessions() {
|
|
|
438623
438556
|
} catch {
|
|
438624
438557
|
return [];
|
|
438625
438558
|
}
|
|
438626
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
438559
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join134(projectsDir, dirent.name));
|
|
438627
438560
|
const allSessions = [];
|
|
438628
438561
|
for (let i2 = 0;i2 < projectDirs.length; i2++) {
|
|
438629
438562
|
const sessionFiles = await getSessionFilesWithMtime(projectDirs[i2]);
|
|
@@ -438645,7 +438578,7 @@ async function scanAllSessions() {
|
|
|
438645
438578
|
async function generateUsageReport(options) {
|
|
438646
438579
|
let remoteStats;
|
|
438647
438580
|
if (process.env.USER_TYPE === "ant" && options?.collectRemote) {
|
|
438648
|
-
const destDir =
|
|
438581
|
+
const destDir = join134(getClaudeConfigHomeDir(), "projects");
|
|
438649
438582
|
const { hosts, totalCopied } = await collectAllRemoteHostData(destDir);
|
|
438650
438583
|
remoteStats = { hosts, totalCopied };
|
|
438651
438584
|
}
|
|
@@ -438782,10 +438715,10 @@ async function generateUsageReport(options) {
|
|
|
438782
438715
|
const insights = await generateParallelInsights(aggregated, facets);
|
|
438783
438716
|
const htmlReport = generateHtmlReport(aggregated, insights);
|
|
438784
438717
|
try {
|
|
438785
|
-
await
|
|
438718
|
+
await mkdir43(getDataDir(), { recursive: true });
|
|
438786
438719
|
} catch {}
|
|
438787
|
-
const htmlPath =
|
|
438788
|
-
await
|
|
438720
|
+
const htmlPath = join134(getDataDir(), "report.html");
|
|
438721
|
+
await writeFile45(htmlPath, htmlReport, {
|
|
438789
438722
|
encoding: "utf-8",
|
|
438790
438723
|
mode: 384
|
|
438791
438724
|
});
|
|
@@ -438880,13 +438813,13 @@ var init_insights = __esm(() => {
|
|
|
438880
438813
|
} : async () => 0;
|
|
438881
438814
|
collectFromRemoteHost = process.env.USER_TYPE === "ant" ? async (homespace, destDir) => {
|
|
438882
438815
|
const result = { copied: 0, skipped: 0 };
|
|
438883
|
-
const tempDir = await mkdtemp(
|
|
438816
|
+
const tempDir = await mkdtemp(join134(tmpdir9(), "claude-hs-"));
|
|
438884
438817
|
try {
|
|
438885
438818
|
const scpResult = await execFileNoThrow("scp", ["-rq", `${homespace}.coder:/root/.claude/projects/`, tempDir], { timeout: 300000 });
|
|
438886
438819
|
if (scpResult.code !== 0) {
|
|
438887
438820
|
return result;
|
|
438888
438821
|
}
|
|
438889
|
-
const projectsDir =
|
|
438822
|
+
const projectsDir = join134(tempDir, "projects");
|
|
438890
438823
|
let projectDirents;
|
|
438891
438824
|
try {
|
|
438892
438825
|
projectDirents = await readdir30(projectsDir, { withFileTypes: true });
|
|
@@ -438895,13 +438828,13 @@ var init_insights = __esm(() => {
|
|
|
438895
438828
|
}
|
|
438896
438829
|
await Promise.all(projectDirents.map(async (dirent) => {
|
|
438897
438830
|
const projectName = dirent.name;
|
|
438898
|
-
const projectPath =
|
|
438831
|
+
const projectPath = join134(projectsDir, projectName);
|
|
438899
438832
|
if (!dirent.isDirectory())
|
|
438900
438833
|
return;
|
|
438901
438834
|
const destProjectName = `${projectName}__${homespace}`;
|
|
438902
|
-
const destProjectPath =
|
|
438835
|
+
const destProjectPath = join134(destDir, destProjectName);
|
|
438903
438836
|
try {
|
|
438904
|
-
await
|
|
438837
|
+
await mkdir43(destProjectPath, { recursive: true });
|
|
438905
438838
|
} catch {}
|
|
438906
438839
|
let files2;
|
|
438907
438840
|
try {
|
|
@@ -438913,8 +438846,8 @@ var init_insights = __esm(() => {
|
|
|
438913
438846
|
const fileName = fileDirent.name;
|
|
438914
438847
|
if (!fileName.endsWith(".jsonl"))
|
|
438915
438848
|
return;
|
|
438916
|
-
const srcFile =
|
|
438917
|
-
const destFile =
|
|
438849
|
+
const srcFile = join134(projectPath, fileName);
|
|
438850
|
+
const destFile = join134(destProjectPath, fileName);
|
|
438918
438851
|
try {
|
|
438919
438852
|
await copyFile9(srcFile, destFile, fsConstants5.COPYFILE_EXCL);
|
|
438920
438853
|
result.copied++;
|
|
@@ -439908,14 +439841,14 @@ import { closeSync as closeSync4, fstatSync, openSync as openSync5, readSync as
|
|
|
439908
439841
|
import {
|
|
439909
439842
|
appendFile as fsAppendFile,
|
|
439910
439843
|
open as fsOpen2,
|
|
439911
|
-
mkdir as
|
|
439844
|
+
mkdir as mkdir44,
|
|
439912
439845
|
readdir as readdir31,
|
|
439913
|
-
readFile as
|
|
439846
|
+
readFile as readFile53,
|
|
439914
439847
|
stat as stat44,
|
|
439915
439848
|
unlink as unlink21,
|
|
439916
|
-
writeFile as
|
|
439849
|
+
writeFile as writeFile46
|
|
439917
439850
|
} from "fs/promises";
|
|
439918
|
-
import { basename as basename40, dirname as dirname53, join as
|
|
439851
|
+
import { basename as basename40, dirname as dirname53, join as join135 } from "path";
|
|
439919
439852
|
function isTranscriptMessage(entry) {
|
|
439920
439853
|
return entry.type === "user" || entry.type === "assistant" || entry.type === "attachment" || entry.type === "system";
|
|
439921
439854
|
}
|
|
@@ -439929,18 +439862,18 @@ function isEphemeralToolProgress(dataType) {
|
|
|
439929
439862
|
return typeof dataType === "string" && EPHEMERAL_PROGRESS_TYPES.has(dataType);
|
|
439930
439863
|
}
|
|
439931
439864
|
function getProjectsDir2() {
|
|
439932
|
-
return
|
|
439865
|
+
return join135(getClaudeConfigHomeDir(), "projects");
|
|
439933
439866
|
}
|
|
439934
439867
|
function getTranscriptPath() {
|
|
439935
439868
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
439936
|
-
return
|
|
439869
|
+
return join135(projectDir, `${getSessionId()}.jsonl`);
|
|
439937
439870
|
}
|
|
439938
439871
|
function getTranscriptPathForSession(sessionId) {
|
|
439939
439872
|
if (sessionId === getSessionId()) {
|
|
439940
439873
|
return getTranscriptPath();
|
|
439941
439874
|
}
|
|
439942
439875
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
439943
|
-
return
|
|
439876
|
+
return join135(projectDir, `${sessionId}.jsonl`);
|
|
439944
439877
|
}
|
|
439945
439878
|
function setAgentTranscriptSubdir(agentId, subdir) {
|
|
439946
439879
|
agentTranscriptSubdirs.set(agentId, subdir);
|
|
@@ -439952,21 +439885,21 @@ function getAgentTranscriptPath(agentId) {
|
|
|
439952
439885
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
439953
439886
|
const sessionId = getSessionId();
|
|
439954
439887
|
const subdir = agentTranscriptSubdirs.get(agentId);
|
|
439955
|
-
const base = subdir ?
|
|
439956
|
-
return
|
|
439888
|
+
const base = subdir ? join135(projectDir, sessionId, "subagents", subdir) : join135(projectDir, sessionId, "subagents");
|
|
439889
|
+
return join135(base, `agent-${agentId}.jsonl`);
|
|
439957
439890
|
}
|
|
439958
439891
|
function getAgentMetadataPath(agentId) {
|
|
439959
439892
|
return getAgentTranscriptPath(agentId).replace(/\.jsonl$/, ".meta.json");
|
|
439960
439893
|
}
|
|
439961
439894
|
async function writeAgentMetadata(agentId, metadata) {
|
|
439962
439895
|
const path15 = getAgentMetadataPath(agentId);
|
|
439963
|
-
await
|
|
439964
|
-
await
|
|
439896
|
+
await mkdir44(dirname53(path15), { recursive: true });
|
|
439897
|
+
await writeFile46(path15, JSON.stringify(metadata));
|
|
439965
439898
|
}
|
|
439966
439899
|
async function readAgentMetadata(agentId) {
|
|
439967
439900
|
const path15 = getAgentMetadataPath(agentId);
|
|
439968
439901
|
try {
|
|
439969
|
-
const raw = await
|
|
439902
|
+
const raw = await readFile53(path15, "utf-8");
|
|
439970
439903
|
return JSON.parse(raw);
|
|
439971
439904
|
} catch (e) {
|
|
439972
439905
|
if (isFsInaccessible(e))
|
|
@@ -439976,20 +439909,20 @@ async function readAgentMetadata(agentId) {
|
|
|
439976
439909
|
}
|
|
439977
439910
|
function getRemoteAgentsDir() {
|
|
439978
439911
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
439979
|
-
return
|
|
439912
|
+
return join135(projectDir, getSessionId(), "remote-agents");
|
|
439980
439913
|
}
|
|
439981
439914
|
function getRemoteAgentMetadataPath(taskId) {
|
|
439982
|
-
return
|
|
439915
|
+
return join135(getRemoteAgentsDir(), `remote-agent-${taskId}.meta.json`);
|
|
439983
439916
|
}
|
|
439984
439917
|
async function writeRemoteAgentMetadata(taskId, metadata) {
|
|
439985
439918
|
const path15 = getRemoteAgentMetadataPath(taskId);
|
|
439986
|
-
await
|
|
439987
|
-
await
|
|
439919
|
+
await mkdir44(dirname53(path15), { recursive: true });
|
|
439920
|
+
await writeFile46(path15, JSON.stringify(metadata));
|
|
439988
439921
|
}
|
|
439989
439922
|
async function readRemoteAgentMetadata(taskId) {
|
|
439990
439923
|
const path15 = getRemoteAgentMetadataPath(taskId);
|
|
439991
439924
|
try {
|
|
439992
|
-
const raw = await
|
|
439925
|
+
const raw = await readFile53(path15, "utf-8");
|
|
439993
439926
|
return JSON.parse(raw);
|
|
439994
439927
|
} catch (e) {
|
|
439995
439928
|
if (isFsInaccessible(e))
|
|
@@ -440022,7 +439955,7 @@ async function listRemoteAgentMetadata() {
|
|
|
440022
439955
|
if (!entry.isFile() || !entry.name.endsWith(".meta.json"))
|
|
440023
439956
|
continue;
|
|
440024
439957
|
try {
|
|
440025
|
-
const raw = await
|
|
439958
|
+
const raw = await readFile53(join135(dir, entry.name), "utf-8");
|
|
440026
439959
|
results.push(JSON.parse(raw));
|
|
440027
439960
|
} catch (e) {
|
|
440028
439961
|
logForDebugging(`listRemoteAgentMetadata: skipping ${entry.name}: ${String(e)}`);
|
|
@@ -440032,7 +439965,7 @@ async function listRemoteAgentMetadata() {
|
|
|
440032
439965
|
}
|
|
440033
439966
|
function sessionIdExists(sessionId) {
|
|
440034
439967
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
440035
|
-
const sessionFile =
|
|
439968
|
+
const sessionFile = join135(projectDir, `${sessionId}.jsonl`);
|
|
440036
439969
|
const fs5 = getFsImplementation();
|
|
440037
439970
|
try {
|
|
440038
439971
|
fs5.statSync(sessionFile);
|
|
@@ -440172,7 +440105,7 @@ class Project {
|
|
|
440172
440105
|
try {
|
|
440173
440106
|
await fsAppendFile(filePath, data, { mode: 384 });
|
|
440174
440107
|
} catch {
|
|
440175
|
-
await
|
|
440108
|
+
await mkdir44(dirname53(filePath), { recursive: true, mode: 448 });
|
|
440176
440109
|
await fsAppendFile(filePath, data, { mode: 384 });
|
|
440177
440110
|
}
|
|
440178
440111
|
}
|
|
@@ -440364,7 +440297,7 @@ class Project {
|
|
|
440364
440297
|
logForDebugging(`Skipping tombstone removal: session file too large (${formatFileSize(fileSize)})`, { level: "warn" });
|
|
440365
440298
|
return;
|
|
440366
440299
|
}
|
|
440367
|
-
const content = await
|
|
440300
|
+
const content = await readFile53(this.sessionFile, { encoding: "utf-8" });
|
|
440368
440301
|
const lines = content.split(`
|
|
440369
440302
|
`).filter((line) => {
|
|
440370
440303
|
if (!line.trim())
|
|
@@ -440376,7 +440309,7 @@ class Project {
|
|
|
440376
440309
|
return true;
|
|
440377
440310
|
}
|
|
440378
440311
|
});
|
|
440379
|
-
await
|
|
440312
|
+
await writeFile46(this.sessionFile, lines.join(`
|
|
440380
440313
|
`), {
|
|
440381
440314
|
encoding: "utf8"
|
|
440382
440315
|
});
|
|
@@ -440713,11 +440646,11 @@ async function hydrateRemoteSession(sessionId, ingressUrl) {
|
|
|
440713
440646
|
try {
|
|
440714
440647
|
const remoteLogs = await getSessionLogs(sessionId, ingressUrl) || [];
|
|
440715
440648
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
440716
|
-
await
|
|
440649
|
+
await mkdir44(projectDir, { recursive: true, mode: 448 });
|
|
440717
440650
|
const sessionFile = getTranscriptPathForSession(sessionId);
|
|
440718
440651
|
const content = remoteLogs.map((e) => jsonStringify(e) + `
|
|
440719
440652
|
`).join("");
|
|
440720
|
-
await
|
|
440653
|
+
await writeFile46(sessionFile, content, { encoding: "utf8", mode: 384 });
|
|
440721
440654
|
logForDebugging(`Hydrated ${remoteLogs.length} entries from remote`);
|
|
440722
440655
|
return remoteLogs.length > 0;
|
|
440723
440656
|
} catch (error5) {
|
|
@@ -440745,11 +440678,11 @@ async function hydrateFromCCRv2InternalEvents(sessionId) {
|
|
|
440745
440678
|
return false;
|
|
440746
440679
|
}
|
|
440747
440680
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
440748
|
-
await
|
|
440681
|
+
await mkdir44(projectDir, { recursive: true, mode: 448 });
|
|
440749
440682
|
const sessionFile = getTranscriptPathForSession(sessionId);
|
|
440750
440683
|
const fgContent = events2.map((e) => jsonStringify(e.payload) + `
|
|
440751
440684
|
`).join("");
|
|
440752
|
-
await
|
|
440685
|
+
await writeFile46(sessionFile, fgContent, { encoding: "utf8", mode: 384 });
|
|
440753
440686
|
logForDebugging(`Hydrated ${events2.length} foreground entries from CCR v2 internal events`);
|
|
440754
440687
|
let subagentEventCount = 0;
|
|
440755
440688
|
const subagentReader = project2.getInternalSubagentEventReader();
|
|
@@ -440771,10 +440704,10 @@ async function hydrateFromCCRv2InternalEvents(sessionId) {
|
|
|
440771
440704
|
}
|
|
440772
440705
|
for (const [agentId, entries] of byAgent) {
|
|
440773
440706
|
const agentFile = getAgentTranscriptPath(asAgentId(agentId));
|
|
440774
|
-
await
|
|
440707
|
+
await mkdir44(dirname53(agentFile), { recursive: true, mode: 448 });
|
|
440775
440708
|
const agentContent = entries.map((p) => jsonStringify(p) + `
|
|
440776
440709
|
`).join("");
|
|
440777
|
-
await
|
|
440710
|
+
await writeFile46(agentFile, agentContent, {
|
|
440778
440711
|
encoding: "utf8",
|
|
440779
440712
|
mode: 384
|
|
440780
440713
|
});
|
|
@@ -441174,7 +441107,7 @@ async function loadTranscriptFromFile(filePath) {
|
|
|
441174
441107
|
worktreeSession: worktreeStates.has(sessionId) ? worktreeStates.get(sessionId) : undefined
|
|
441175
441108
|
};
|
|
441176
441109
|
}
|
|
441177
|
-
const content = await
|
|
441110
|
+
const content = await readFile53(filePath, { encoding: "utf-8" });
|
|
441178
441111
|
let parsed;
|
|
441179
441112
|
try {
|
|
441180
441113
|
parsed = jsonParse(content);
|
|
@@ -441836,7 +441769,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
441836
441769
|
}
|
|
441837
441770
|
}
|
|
441838
441771
|
}
|
|
441839
|
-
buf ??= await
|
|
441772
|
+
buf ??= await readFile53(filePath);
|
|
441840
441773
|
if (!opts?.keepAllLeaves && !hasPreservedSegment && !isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_PRECOMPACT_SKIP) && buf.length > SKIP_PRECOMPACT_THRESHOLD) {
|
|
441841
441774
|
buf = walkChainBeforeParse(buf);
|
|
441842
441775
|
}
|
|
@@ -442001,7 +441934,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
442001
441934
|
};
|
|
442002
441935
|
}
|
|
442003
441936
|
async function loadSessionFile(sessionId) {
|
|
442004
|
-
const sessionFile =
|
|
441937
|
+
const sessionFile = join135(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), `${sessionId}.jsonl`);
|
|
442005
441938
|
return loadTranscriptFile(sessionFile);
|
|
442006
441939
|
}
|
|
442007
441940
|
function clearSessionMessagesCache() {
|
|
@@ -442069,7 +442002,7 @@ async function loadAllProjectsMessageLogsFull(limit) {
|
|
|
442069
442002
|
} catch {
|
|
442070
442003
|
return [];
|
|
442071
442004
|
}
|
|
442072
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
442005
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join135(projectsDir, dirent.name));
|
|
442073
442006
|
const logsPerProject = await Promise.all(projectDirs.map((projectDir) => getLogsWithoutIndex(projectDir, limit)));
|
|
442074
442007
|
const allLogs = logsPerProject.flat();
|
|
442075
442008
|
const deduped = new Map;
|
|
@@ -442094,7 +442027,7 @@ async function loadAllProjectsMessageLogsProgressive(limit, initialEnrichCount =
|
|
|
442094
442027
|
} catch {
|
|
442095
442028
|
return { logs: [], allStatLogs: [], nextIndex: 0 };
|
|
442096
442029
|
}
|
|
442097
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
442030
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join135(projectsDir, dirent.name));
|
|
442098
442031
|
const rawLogs = [];
|
|
442099
442032
|
for (const projectDir of projectDirs) {
|
|
442100
442033
|
rawLogs.push(...await getSessionFilesLite(projectDir, limit));
|
|
@@ -442155,7 +442088,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
|
|
|
442155
442088
|
for (const { path: wtPath, prefix } of indexed) {
|
|
442156
442089
|
if (dirName === prefix || dirName.startsWith(prefix + "-")) {
|
|
442157
442090
|
seenDirs.add(dirName);
|
|
442158
|
-
allLogs.push(...await getSessionFilesLite(
|
|
442091
|
+
allLogs.push(...await getSessionFilesLite(join135(projectsDir, dirent.name), undefined, wtPath));
|
|
442159
442092
|
break;
|
|
442160
442093
|
}
|
|
442161
442094
|
}
|
|
@@ -442224,7 +442157,7 @@ async function loadSubagentTranscripts(agentIds) {
|
|
|
442224
442157
|
return transcripts;
|
|
442225
442158
|
}
|
|
442226
442159
|
async function loadAllSubagentTranscriptsFromDisk() {
|
|
442227
|
-
const subagentsDir =
|
|
442160
|
+
const subagentsDir = join135(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), getSessionId(), "subagents");
|
|
442228
442161
|
let entries;
|
|
442229
442162
|
try {
|
|
442230
442163
|
entries = await readdir31(subagentsDir, { withFileTypes: true });
|
|
@@ -442352,7 +442285,7 @@ async function getSessionFilesWithMtime(projectDir) {
|
|
|
442352
442285
|
const sessionId = validateUuid2(basename40(dirent.name, ".jsonl"));
|
|
442353
442286
|
if (!sessionId)
|
|
442354
442287
|
continue;
|
|
442355
|
-
candidates.push({ sessionId, filePath:
|
|
442288
|
+
candidates.push({ sessionId, filePath: join135(projectDir, dirent.name) });
|
|
442356
442289
|
}
|
|
442357
442290
|
await Promise.all(candidates.map(async ({ sessionId, filePath }) => {
|
|
442358
442291
|
try {
|
|
@@ -442736,7 +442669,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
442736
442669
|
init_settings2();
|
|
442737
442670
|
init_slowOperations();
|
|
442738
442671
|
init_uuid();
|
|
442739
|
-
VERSION6 = typeof MACRO !== "undefined" ? "1.3.
|
|
442672
|
+
VERSION6 = typeof MACRO !== "undefined" ? "1.3.3" : "unknown";
|
|
442740
442673
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
442741
442674
|
SKIP_FIRST_PROMPT_PATTERN = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
|
|
442742
442675
|
EPHEMERAL_PROGRESS_TYPES = new Set([
|
|
@@ -442748,7 +442681,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
442748
442681
|
MAX_TRANSCRIPT_READ_BYTES = 50 * 1024 * 1024;
|
|
442749
442682
|
agentTranscriptSubdirs = new Map;
|
|
442750
442683
|
getProjectDir2 = memoize_default((projectDir) => {
|
|
442751
|
-
return
|
|
442684
|
+
return join135(getProjectsDir2(), sanitizePath2(projectDir));
|
|
442752
442685
|
});
|
|
442753
442686
|
METADATA_TYPE_MARKERS = [
|
|
442754
442687
|
'"type":"summary"',
|
|
@@ -442984,41 +442917,41 @@ var init_memdir = __esm(() => {
|
|
|
442984
442917
|
});
|
|
442985
442918
|
|
|
442986
442919
|
// src/tools/AgentTool/agentMemory.ts
|
|
442987
|
-
import { join as
|
|
442920
|
+
import { join as join136, normalize as normalize13, sep as sep31 } from "path";
|
|
442988
442921
|
function sanitizeAgentTypeForPath(agentType) {
|
|
442989
442922
|
return agentType.replace(/:/g, "-");
|
|
442990
442923
|
}
|
|
442991
442924
|
function getLocalAgentMemoryDir(dirName) {
|
|
442992
442925
|
if (process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR) {
|
|
442993
|
-
return
|
|
442926
|
+
return join136(process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR, "projects", sanitizePath2(findCanonicalGitRoot(getProjectRoot()) ?? getProjectRoot()), "agent-memory-local", dirName) + sep31;
|
|
442994
442927
|
}
|
|
442995
|
-
return
|
|
442928
|
+
return join136(getCwd(), ".claude", "agent-memory-local", dirName) + sep31;
|
|
442996
442929
|
}
|
|
442997
442930
|
function getAgentMemoryDir(agentType, scope) {
|
|
442998
442931
|
const dirName = sanitizeAgentTypeForPath(agentType);
|
|
442999
442932
|
switch (scope) {
|
|
443000
442933
|
case "project":
|
|
443001
|
-
return
|
|
442934
|
+
return join136(getCwd(), ".claude", "agent-memory", dirName) + sep31;
|
|
443002
442935
|
case "local":
|
|
443003
442936
|
return getLocalAgentMemoryDir(dirName);
|
|
443004
442937
|
case "user":
|
|
443005
|
-
return
|
|
442938
|
+
return join136(getMemoryBaseDir(), "agent-memory", dirName) + sep31;
|
|
443006
442939
|
}
|
|
443007
442940
|
}
|
|
443008
442941
|
function isAgentMemoryPath(absolutePath) {
|
|
443009
442942
|
const normalizedPath = normalize13(absolutePath);
|
|
443010
442943
|
const memoryBase = getMemoryBaseDir();
|
|
443011
|
-
if (normalizedPath.startsWith(
|
|
442944
|
+
if (normalizedPath.startsWith(join136(memoryBase, "agent-memory") + sep31)) {
|
|
443012
442945
|
return true;
|
|
443013
442946
|
}
|
|
443014
|
-
if (normalizedPath.startsWith(
|
|
442947
|
+
if (normalizedPath.startsWith(join136(getCwd(), ".claude", "agent-memory") + sep31)) {
|
|
443015
442948
|
return true;
|
|
443016
442949
|
}
|
|
443017
442950
|
if (process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR) {
|
|
443018
|
-
if (normalizedPath.includes(sep31 + "agent-memory-local" + sep31) && normalizedPath.startsWith(
|
|
442951
|
+
if (normalizedPath.includes(sep31 + "agent-memory-local" + sep31) && normalizedPath.startsWith(join136(process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR, "projects") + sep31)) {
|
|
443019
442952
|
return true;
|
|
443020
442953
|
}
|
|
443021
|
-
} else if (normalizedPath.startsWith(
|
|
442954
|
+
} else if (normalizedPath.startsWith(join136(getCwd(), ".claude", "agent-memory-local") + sep31)) {
|
|
443022
442955
|
return true;
|
|
443023
442956
|
}
|
|
443024
442957
|
return false;
|
|
@@ -443026,7 +442959,7 @@ function isAgentMemoryPath(absolutePath) {
|
|
|
443026
442959
|
function getMemoryScopeDisplay(memory2) {
|
|
443027
442960
|
switch (memory2) {
|
|
443028
442961
|
case "user":
|
|
443029
|
-
return `User (${
|
|
442962
|
+
return `User (${join136(getMemoryBaseDir(), "agent-memory")}/)`;
|
|
443030
442963
|
case "project":
|
|
443031
442964
|
return "Project (.claude/agent-memory/)";
|
|
443032
442965
|
case "local":
|
|
@@ -443068,8 +443001,8 @@ var init_agentMemory = __esm(() => {
|
|
|
443068
443001
|
|
|
443069
443002
|
// src/utils/permissions/filesystem.ts
|
|
443070
443003
|
import { randomBytes as randomBytes19 } from "crypto";
|
|
443071
|
-
import { homedir as
|
|
443072
|
-
import { join as
|
|
443004
|
+
import { homedir as homedir39, tmpdir as tmpdir10 } from "os";
|
|
443005
|
+
import { join as join137, normalize as normalize14, posix as posix8, sep as sep32 } from "path";
|
|
443073
443006
|
function normalizeCaseForComparison(path15) {
|
|
443074
443007
|
return path15.toLowerCase();
|
|
443075
443008
|
}
|
|
@@ -443078,11 +443011,11 @@ function getClaudeSkillScope(filePath) {
|
|
|
443078
443011
|
const absolutePathLower = normalizeCaseForComparison(absolutePath);
|
|
443079
443012
|
const bases = [
|
|
443080
443013
|
{
|
|
443081
|
-
dir: expandPath(
|
|
443014
|
+
dir: expandPath(join137(getOriginalCwd(), ".claude", "skills")),
|
|
443082
443015
|
prefix: "/.claude/skills/"
|
|
443083
443016
|
},
|
|
443084
443017
|
{
|
|
443085
|
-
dir: expandPath(
|
|
443018
|
+
dir: expandPath(join137(homedir39(), ".claude", "skills")),
|
|
443086
443019
|
prefix: "~/.claude/skills/"
|
|
443087
443020
|
}
|
|
443088
443021
|
];
|
|
@@ -443137,21 +443070,21 @@ function isClaudeConfigFilePath(filePath) {
|
|
|
443137
443070
|
if (isClaudeSettingsPath(filePath)) {
|
|
443138
443071
|
return true;
|
|
443139
443072
|
}
|
|
443140
|
-
const commandsDir =
|
|
443141
|
-
const agentsDir =
|
|
443142
|
-
const skillsDir =
|
|
443073
|
+
const commandsDir = join137(getOriginalCwd(), ".claude", "commands");
|
|
443074
|
+
const agentsDir = join137(getOriginalCwd(), ".claude", "agents");
|
|
443075
|
+
const skillsDir = join137(getOriginalCwd(), ".claude", "skills");
|
|
443143
443076
|
return pathInWorkingPath(filePath, commandsDir) || pathInWorkingPath(filePath, agentsDir) || pathInWorkingPath(filePath, skillsDir);
|
|
443144
443077
|
}
|
|
443145
443078
|
function isSessionPlanFile(absolutePath) {
|
|
443146
|
-
const expectedPrefix =
|
|
443079
|
+
const expectedPrefix = join137(getPlansDirectory(), getPlanSlug());
|
|
443147
443080
|
const normalizedPath = normalize14(absolutePath);
|
|
443148
443081
|
return normalizedPath.startsWith(expectedPrefix) && normalizedPath.endsWith(".md");
|
|
443149
443082
|
}
|
|
443150
443083
|
function getSessionMemoryDir() {
|
|
443151
|
-
return
|
|
443084
|
+
return join137(getProjectDir2(getCwd()), getSessionId(), "session-memory") + sep32;
|
|
443152
443085
|
}
|
|
443153
443086
|
function getSessionMemoryPath() {
|
|
443154
|
-
return
|
|
443087
|
+
return join137(getSessionMemoryDir(), "summary.md");
|
|
443155
443088
|
}
|
|
443156
443089
|
function isSessionMemoryPath(absolutePath) {
|
|
443157
443090
|
const normalizedPath = normalize14(absolutePath);
|
|
@@ -443173,10 +443106,10 @@ function getClaudeTempDirName() {
|
|
|
443173
443106
|
return `claude-${uid}`;
|
|
443174
443107
|
}
|
|
443175
443108
|
function getProjectTempDir() {
|
|
443176
|
-
return
|
|
443109
|
+
return join137(getClaudeTempDir(), sanitizePath2(getOriginalCwd())) + sep32;
|
|
443177
443110
|
}
|
|
443178
443111
|
function getScratchpadDir() {
|
|
443179
|
-
return
|
|
443112
|
+
return join137(getProjectTempDir(), getSessionId(), "scratchpad");
|
|
443180
443113
|
}
|
|
443181
443114
|
async function ensureScratchpadDir() {
|
|
443182
443115
|
if (!isScratchpadEnabled()) {
|
|
@@ -443396,7 +443329,7 @@ function patternWithRoot(pattern, source) {
|
|
|
443396
443329
|
} else if (pattern.startsWith(`~${DIR_SEP}`)) {
|
|
443397
443330
|
return {
|
|
443398
443331
|
relativePattern: pattern.slice(1),
|
|
443399
|
-
root:
|
|
443332
|
+
root: homedir39().normalize("NFC")
|
|
443400
443333
|
};
|
|
443401
443334
|
} else if (pattern.startsWith(DIR_SEP)) {
|
|
443402
443335
|
return {
|
|
@@ -443754,7 +443687,7 @@ function checkEditableInternalPath(absolutePath, input) {
|
|
|
443754
443687
|
}
|
|
443755
443688
|
};
|
|
443756
443689
|
}
|
|
443757
|
-
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(
|
|
443690
|
+
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(join137(getOriginalCwd(), ".claude", "launch.json"))) {
|
|
443758
443691
|
return {
|
|
443759
443692
|
behavior: "allow",
|
|
443760
443693
|
updatedInput: input,
|
|
@@ -443851,7 +443784,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
443851
443784
|
}
|
|
443852
443785
|
};
|
|
443853
443786
|
}
|
|
443854
|
-
const tasksDir =
|
|
443787
|
+
const tasksDir = join137(getClaudeConfigHomeDir(), "tasks") + sep32;
|
|
443855
443788
|
if (normalizedPath === tasksDir.slice(0, -1) || normalizedPath.startsWith(tasksDir)) {
|
|
443856
443789
|
return {
|
|
443857
443790
|
behavior: "allow",
|
|
@@ -443862,7 +443795,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
443862
443795
|
}
|
|
443863
443796
|
};
|
|
443864
443797
|
}
|
|
443865
|
-
const teamsReadDir =
|
|
443798
|
+
const teamsReadDir = join137(getClaudeConfigHomeDir(), "teams") + sep32;
|
|
443866
443799
|
if (normalizedPath === teamsReadDir.slice(0, -1) || normalizedPath.startsWith(teamsReadDir)) {
|
|
443867
443800
|
return {
|
|
443868
443801
|
behavior: "allow",
|
|
@@ -443934,11 +443867,11 @@ var init_filesystem = __esm(() => {
|
|
|
443934
443867
|
try {
|
|
443935
443868
|
resolvedBaseTmpDir = fs5.realpathSync(baseTmpDir);
|
|
443936
443869
|
} catch {}
|
|
443937
|
-
return
|
|
443870
|
+
return join137(resolvedBaseTmpDir, getClaudeTempDirName()) + sep32;
|
|
443938
443871
|
});
|
|
443939
443872
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
443940
443873
|
const nonce = randomBytes19(16).toString("hex");
|
|
443941
|
-
return
|
|
443874
|
+
return join137(getClaudeTempDir(), "bundled-skills", "1.3.3", nonce);
|
|
443942
443875
|
});
|
|
443943
443876
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
443944
443877
|
});
|
|
@@ -443946,24 +443879,24 @@ var init_filesystem = __esm(() => {
|
|
|
443946
443879
|
// src/utils/task/diskOutput.ts
|
|
443947
443880
|
import { constants as fsConstants6 } from "fs";
|
|
443948
443881
|
import {
|
|
443949
|
-
mkdir as
|
|
443882
|
+
mkdir as mkdir45,
|
|
443950
443883
|
open as open16,
|
|
443951
443884
|
stat as stat45,
|
|
443952
443885
|
symlink as symlink4,
|
|
443953
443886
|
unlink as unlink22
|
|
443954
443887
|
} from "fs/promises";
|
|
443955
|
-
import { join as
|
|
443888
|
+
import { join as join138 } from "path";
|
|
443956
443889
|
function getTaskOutputDir() {
|
|
443957
443890
|
if (_taskOutputDir === undefined) {
|
|
443958
|
-
_taskOutputDir =
|
|
443891
|
+
_taskOutputDir = join138(getProjectTempDir(), getSessionId(), "tasks");
|
|
443959
443892
|
}
|
|
443960
443893
|
return _taskOutputDir;
|
|
443961
443894
|
}
|
|
443962
443895
|
async function ensureOutputDir() {
|
|
443963
|
-
await
|
|
443896
|
+
await mkdir45(getTaskOutputDir(), { recursive: true });
|
|
443964
443897
|
}
|
|
443965
443898
|
function getTaskOutputPath(taskId) {
|
|
443966
|
-
return
|
|
443899
|
+
return join138(getTaskOutputDir(), `${taskId}.output`);
|
|
443967
443900
|
}
|
|
443968
443901
|
function track(p) {
|
|
443969
443902
|
_pendingOps.add(p);
|
|
@@ -448222,14 +448155,14 @@ __export(exports_worktree, {
|
|
|
448222
448155
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
448223
448156
|
import {
|
|
448224
448157
|
copyFile as copyFile10,
|
|
448225
|
-
mkdir as
|
|
448158
|
+
mkdir as mkdir46,
|
|
448226
448159
|
readdir as readdir32,
|
|
448227
|
-
readFile as
|
|
448160
|
+
readFile as readFile54,
|
|
448228
448161
|
stat as stat47,
|
|
448229
448162
|
symlink as symlink5,
|
|
448230
448163
|
utimes as utimes2
|
|
448231
448164
|
} from "fs/promises";
|
|
448232
|
-
import { basename as basename42, dirname as dirname54, join as
|
|
448165
|
+
import { basename as basename42, dirname as dirname54, join as join139 } from "path";
|
|
448233
448166
|
function validateWorktreeSlug(slug) {
|
|
448234
448167
|
if (slug.length > MAX_WORKTREE_SLUG_LENGTH) {
|
|
448235
448168
|
throw new Error(`Invalid worktree name: must be ${MAX_WORKTREE_SLUG_LENGTH} characters or fewer (got ${slug.length})`);
|
|
@@ -448244,7 +448177,7 @@ function validateWorktreeSlug(slug) {
|
|
|
448244
448177
|
}
|
|
448245
448178
|
}
|
|
448246
448179
|
async function mkdirRecursive(dirPath) {
|
|
448247
|
-
await
|
|
448180
|
+
await mkdir46(dirPath, { recursive: true });
|
|
448248
448181
|
}
|
|
448249
448182
|
async function symlinkDirectories(repoRootPath, worktreePath, dirsToSymlink) {
|
|
448250
448183
|
for (const dir of dirsToSymlink) {
|
|
@@ -448252,8 +448185,8 @@ async function symlinkDirectories(repoRootPath, worktreePath, dirsToSymlink) {
|
|
|
448252
448185
|
logForDebugging(`Skipping symlink for "${dir}": path traversal detected`, { level: "warn" });
|
|
448253
448186
|
continue;
|
|
448254
448187
|
}
|
|
448255
|
-
const sourcePath =
|
|
448256
|
-
const destPath =
|
|
448188
|
+
const sourcePath = join139(repoRootPath, dir);
|
|
448189
|
+
const destPath = join139(worktreePath, dir);
|
|
448257
448190
|
try {
|
|
448258
448191
|
await symlink5(sourcePath, destPath, "dir");
|
|
448259
448192
|
logForDebugging(`Symlinked ${dir} from main repository to worktree to avoid disk bloat`);
|
|
@@ -448277,7 +448210,7 @@ function generateTmuxSessionName(repoPath, branch2) {
|
|
|
448277
448210
|
return combined.replace(/[/.]/g, "_");
|
|
448278
448211
|
}
|
|
448279
448212
|
function worktreesDir(repoRoot) {
|
|
448280
|
-
return
|
|
448213
|
+
return join139(repoRoot, ".claude", "worktrees");
|
|
448281
448214
|
}
|
|
448282
448215
|
function flattenSlug(slug) {
|
|
448283
448216
|
return slug.replaceAll("/", "+");
|
|
@@ -448286,7 +448219,7 @@ function worktreeBranchName(slug) {
|
|
|
448286
448219
|
return `worktree-${flattenSlug(slug)}`;
|
|
448287
448220
|
}
|
|
448288
448221
|
function worktreePathFor(repoRoot, slug) {
|
|
448289
|
-
return
|
|
448222
|
+
return join139(worktreesDir(repoRoot), flattenSlug(slug));
|
|
448290
448223
|
}
|
|
448291
448224
|
async function getOrCreateWorktree(repoRoot, slug, options) {
|
|
448292
448225
|
const worktreePath = worktreePathFor(repoRoot, slug);
|
|
@@ -448300,7 +448233,7 @@ async function getOrCreateWorktree(repoRoot, slug, options) {
|
|
|
448300
448233
|
existed: true
|
|
448301
448234
|
};
|
|
448302
448235
|
}
|
|
448303
|
-
await
|
|
448236
|
+
await mkdir46(worktreesDir(repoRoot), { recursive: true });
|
|
448304
448237
|
const fetchEnv = { ...process.env, ...GIT_NO_PROMPT_ENV2 };
|
|
448305
448238
|
let baseBranch;
|
|
448306
448239
|
let baseSha = null;
|
|
@@ -448367,7 +448300,7 @@ async function getOrCreateWorktree(repoRoot, slug, options) {
|
|
|
448367
448300
|
async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
448368
448301
|
let includeContent;
|
|
448369
448302
|
try {
|
|
448370
|
-
includeContent = await
|
|
448303
|
+
includeContent = await readFile54(join139(repoRoot, ".worktreeinclude"), "utf-8");
|
|
448371
448304
|
} catch {
|
|
448372
448305
|
return [];
|
|
448373
448306
|
}
|
|
@@ -448422,10 +448355,10 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
|
448422
448355
|
}
|
|
448423
448356
|
const copied = [];
|
|
448424
448357
|
for (const relativePath2 of files2) {
|
|
448425
|
-
const srcPath =
|
|
448426
|
-
const destPath =
|
|
448358
|
+
const srcPath = join139(repoRoot, relativePath2);
|
|
448359
|
+
const destPath = join139(worktreePath, relativePath2);
|
|
448427
448360
|
try {
|
|
448428
|
-
await
|
|
448361
|
+
await mkdir46(dirname54(destPath), { recursive: true });
|
|
448429
448362
|
await copyFile10(srcPath, destPath);
|
|
448430
448363
|
copied.push(relativePath2);
|
|
448431
448364
|
} catch (e) {
|
|
@@ -448439,9 +448372,9 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
|
448439
448372
|
}
|
|
448440
448373
|
async function performPostCreationSetup(repoRoot, worktreePath) {
|
|
448441
448374
|
const localSettingsRelativePath = getRelativeSettingsFilePathForSource("localSettings");
|
|
448442
|
-
const sourceSettingsLocal =
|
|
448375
|
+
const sourceSettingsLocal = join139(repoRoot, localSettingsRelativePath);
|
|
448443
448376
|
try {
|
|
448444
|
-
const destSettingsLocal =
|
|
448377
|
+
const destSettingsLocal = join139(worktreePath, localSettingsRelativePath);
|
|
448445
448378
|
await mkdirRecursive(dirname54(destSettingsLocal));
|
|
448446
448379
|
await copyFile10(sourceSettingsLocal, destSettingsLocal);
|
|
448447
448380
|
logForDebugging(`Copied settings.local.json to worktree: ${destSettingsLocal}`);
|
|
@@ -448451,8 +448384,8 @@ async function performPostCreationSetup(repoRoot, worktreePath) {
|
|
|
448451
448384
|
logForDebugging(`Failed to copy settings.local.json: ${e.message}`, { level: "warn" });
|
|
448452
448385
|
}
|
|
448453
448386
|
}
|
|
448454
|
-
const huskyPath =
|
|
448455
|
-
const gitHooksPath =
|
|
448387
|
+
const huskyPath = join139(repoRoot, ".husky");
|
|
448388
|
+
const gitHooksPath = join139(repoRoot, ".git", "hooks");
|
|
448456
448389
|
let hooksPath = null;
|
|
448457
448390
|
for (const candidatePath of [huskyPath, gitHooksPath]) {
|
|
448458
448391
|
try {
|
|
@@ -448727,7 +448660,7 @@ async function cleanupStaleAgentWorktrees(cutoffDate) {
|
|
|
448727
448660
|
if (!EPHEMERAL_WORKTREE_PATTERNS.some((p) => p.test(slug))) {
|
|
448728
448661
|
continue;
|
|
448729
448662
|
}
|
|
448730
|
-
const worktreePath =
|
|
448663
|
+
const worktreePath = join139(dir, slug);
|
|
448731
448664
|
if (currentPath === worktreePath) {
|
|
448732
448665
|
continue;
|
|
448733
448666
|
}
|
|
@@ -451604,9 +451537,9 @@ __export(exports_upstreamproxy, {
|
|
|
451604
451537
|
getUpstreamProxyEnv: () => getUpstreamProxyEnv,
|
|
451605
451538
|
SESSION_TOKEN_PATH: () => SESSION_TOKEN_PATH
|
|
451606
451539
|
});
|
|
451607
|
-
import { mkdir as
|
|
451608
|
-
import { homedir as
|
|
451609
|
-
import { join as
|
|
451540
|
+
import { mkdir as mkdir47, readFile as readFile55, unlink as unlink23, writeFile as writeFile47 } from "fs/promises";
|
|
451541
|
+
import { homedir as homedir40 } from "os";
|
|
451542
|
+
import { join as join140 } from "path";
|
|
451610
451543
|
async function initUpstreamProxy(opts) {
|
|
451611
451544
|
if (!isEnvTruthy(process.env.CLAUDE_CODE_REMOTE)) {
|
|
451612
451545
|
return state;
|
|
@@ -451627,7 +451560,7 @@ async function initUpstreamProxy(opts) {
|
|
|
451627
451560
|
}
|
|
451628
451561
|
setNonDumpable();
|
|
451629
451562
|
const baseUrl = opts?.ccrBaseUrl ?? process.env.ANTHROPIC_BASE_URL ?? "https://api.anthropic.com";
|
|
451630
|
-
const caBundlePath = opts?.caBundlePath ??
|
|
451563
|
+
const caBundlePath = opts?.caBundlePath ?? join140(homedir40(), ".ccr", "ca-bundle.crt");
|
|
451631
451564
|
const caOk = await downloadCaBundle(baseUrl, opts?.systemCaPath ?? SYSTEM_CA_BUNDLE, caBundlePath);
|
|
451632
451565
|
if (!caOk)
|
|
451633
451566
|
return state;
|
|
@@ -451685,7 +451618,7 @@ function resetUpstreamProxyForTests() {
|
|
|
451685
451618
|
}
|
|
451686
451619
|
async function readToken(path15) {
|
|
451687
451620
|
try {
|
|
451688
|
-
const raw = await
|
|
451621
|
+
const raw = await readFile55(path15, "utf8");
|
|
451689
451622
|
return raw.trim() || null;
|
|
451690
451623
|
} catch (err2) {
|
|
451691
451624
|
if (isENOENT(err2))
|
|
@@ -451726,9 +451659,9 @@ async function downloadCaBundle(baseUrl, systemCaPath, outPath) {
|
|
|
451726
451659
|
return false;
|
|
451727
451660
|
}
|
|
451728
451661
|
const ccrCa = await resp.text();
|
|
451729
|
-
const systemCa = await
|
|
451730
|
-
await
|
|
451731
|
-
await
|
|
451662
|
+
const systemCa = await readFile55(systemCaPath, "utf8").catch(() => "");
|
|
451663
|
+
await mkdir47(join140(outPath, ".."), { recursive: true });
|
|
451664
|
+
await writeFile47(outPath, systemCa + `
|
|
451732
451665
|
` + ccrCa, "utf8");
|
|
451733
451666
|
return true;
|
|
451734
451667
|
} catch (err2) {
|
|
@@ -453223,7 +453156,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
453223
453156
|
slash_commands: inputs.commands.filter((c5) => c5.userInvocable !== false).map((c5) => c5.name),
|
|
453224
453157
|
apiKeySource: getAnthropicApiKeyWithSource().source,
|
|
453225
453158
|
betas: getSdkBetas(),
|
|
453226
|
-
claude_code_version: "1.3.
|
|
453159
|
+
claude_code_version: "1.3.3",
|
|
453227
453160
|
output_style: outputStyle2,
|
|
453228
453161
|
agents: inputs.agents.map((agent) => agent.agentType),
|
|
453229
453162
|
skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
|
|
@@ -459581,8 +459514,8 @@ var init_ShowInIDEPrompt = __esm(() => {
|
|
|
459581
459514
|
});
|
|
459582
459515
|
|
|
459583
459516
|
// src/components/permissions/FilePermissionDialog/permissionOptions.tsx
|
|
459584
|
-
import { homedir as
|
|
459585
|
-
import { basename as basename46, join as
|
|
459517
|
+
import { homedir as homedir41 } from "os";
|
|
459518
|
+
import { basename as basename46, join as join141, sep as sep33 } from "path";
|
|
459586
459519
|
function isInClaudeFolder(filePath) {
|
|
459587
459520
|
const absolutePath = expandPath(filePath);
|
|
459588
459521
|
const claudeFolderPath = expandPath(`${getOriginalCwd()}/.claude`);
|
|
@@ -459592,7 +459525,7 @@ function isInClaudeFolder(filePath) {
|
|
|
459592
459525
|
}
|
|
459593
459526
|
function isInGlobalClaudeFolder(filePath) {
|
|
459594
459527
|
const absolutePath = expandPath(filePath);
|
|
459595
|
-
const globalClaudeFolderPath =
|
|
459528
|
+
const globalClaudeFolderPath = join141(homedir41(), ".claude");
|
|
459596
459529
|
const normalizedAbsolutePath = normalizeCaseForComparison(absolutePath);
|
|
459597
459530
|
const normalizedGlobalClaudeFolderPath = normalizeCaseForComparison(globalClaudeFolderPath);
|
|
459598
459531
|
return normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + sep33.toLowerCase()) || normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + "/");
|
|
@@ -467802,7 +467735,7 @@ var init_useVoiceEnabled = __esm(() => {
|
|
|
467802
467735
|
function getSemverPart(version2) {
|
|
467803
467736
|
return `${import_semver10.major(version2, { loose: true })}.${import_semver10.minor(version2, { loose: true })}.${import_semver10.patch(version2, { loose: true })}`;
|
|
467804
467737
|
}
|
|
467805
|
-
function useUpdateNotification(updatedVersion, initialVersion = "1.3.
|
|
467738
|
+
function useUpdateNotification(updatedVersion, initialVersion = "1.3.3") {
|
|
467806
467739
|
const [lastNotifiedSemver, setLastNotifiedSemver] = import_react214.useState(() => getSemverPart(initialVersion));
|
|
467807
467740
|
if (!updatedVersion) {
|
|
467808
467741
|
return null;
|
|
@@ -467842,7 +467775,7 @@ function AutoUpdater({
|
|
|
467842
467775
|
return;
|
|
467843
467776
|
}
|
|
467844
467777
|
if (false) {}
|
|
467845
|
-
const currentVersion = "1.3.
|
|
467778
|
+
const currentVersion = "1.3.3";
|
|
467846
467779
|
const channel = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
467847
467780
|
let latestVersion = await getLatestVersion(channel);
|
|
467848
467781
|
const isDisabled = isAutoUpdaterDisabled();
|
|
@@ -468053,12 +467986,12 @@ function NativeAutoUpdater({
|
|
|
468053
467986
|
logEvent("tengu_native_auto_updater_start", {});
|
|
468054
467987
|
try {
|
|
468055
467988
|
const maxVersion = await getMaxVersion();
|
|
468056
|
-
if (maxVersion && gt("1.3.
|
|
467989
|
+
if (maxVersion && gt("1.3.3", maxVersion)) {
|
|
468057
467990
|
const msg = await getMaxVersionMessage();
|
|
468058
467991
|
setMaxVersionIssue(msg ?? "affects your version");
|
|
468059
467992
|
}
|
|
468060
467993
|
const result = await installLatest(channel);
|
|
468061
|
-
const currentVersion = "1.3.
|
|
467994
|
+
const currentVersion = "1.3.3";
|
|
468062
467995
|
const latencyMs = Date.now() - startTime;
|
|
468063
467996
|
if (result.lockFailed) {
|
|
468064
467997
|
logEvent("tengu_native_auto_updater_lock_contention", {
|
|
@@ -468193,17 +468126,17 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
468193
468126
|
const maxVersion = await getMaxVersion();
|
|
468194
468127
|
if (maxVersion && latest && gt(latest, maxVersion)) {
|
|
468195
468128
|
logForDebugging(`PackageManagerAutoUpdater: maxVersion ${maxVersion} is set, capping update from ${latest} to ${maxVersion}`);
|
|
468196
|
-
if (gte("1.3.
|
|
468197
|
-
logForDebugging(`PackageManagerAutoUpdater: current version ${"1.3.
|
|
468129
|
+
if (gte("1.3.3", maxVersion)) {
|
|
468130
|
+
logForDebugging(`PackageManagerAutoUpdater: current version ${"1.3.3"} is already at or above maxVersion ${maxVersion}, skipping update`);
|
|
468198
468131
|
setUpdateAvailable(false);
|
|
468199
468132
|
return;
|
|
468200
468133
|
}
|
|
468201
468134
|
latest = maxVersion;
|
|
468202
468135
|
}
|
|
468203
|
-
const hasUpdate = latest && !gte("1.3.
|
|
468136
|
+
const hasUpdate = latest && !gte("1.3.3", latest) && !shouldSkipVersion(latest);
|
|
468204
468137
|
setUpdateAvailable(!!hasUpdate);
|
|
468205
468138
|
if (hasUpdate) {
|
|
468206
|
-
logForDebugging(`PackageManagerAutoUpdater: Update available ${"1.3.
|
|
468139
|
+
logForDebugging(`PackageManagerAutoUpdater: Update available ${"1.3.3"} -> ${latest}`);
|
|
468207
468140
|
}
|
|
468208
468141
|
};
|
|
468209
468142
|
$2[0] = t1;
|
|
@@ -468237,7 +468170,7 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
468237
468170
|
wrap: "truncate",
|
|
468238
468171
|
children: [
|
|
468239
468172
|
"currentVersion: ",
|
|
468240
|
-
"1.3.
|
|
468173
|
+
"1.3.3"
|
|
468241
468174
|
]
|
|
468242
468175
|
}, undefined, true, undefined, this);
|
|
468243
468176
|
$2[3] = verbose;
|
|
@@ -475795,7 +475728,7 @@ function buildStatusLineCommandInput(permissionMode, exceeds200kTokens, settings
|
|
|
475795
475728
|
project_dir: getOriginalCwd(),
|
|
475796
475729
|
added_dirs: addedDirs
|
|
475797
475730
|
},
|
|
475798
|
-
version: "1.3.
|
|
475731
|
+
version: "1.3.3",
|
|
475799
475732
|
output_style: {
|
|
475800
475733
|
name: outputStyleName
|
|
475801
475734
|
},
|
|
@@ -481879,9 +481812,9 @@ function initSkillImprovement() {
|
|
|
481879
481812
|
async function applySkillImprovement(skillName, updates) {
|
|
481880
481813
|
if (!skillName)
|
|
481881
481814
|
return;
|
|
481882
|
-
const { join:
|
|
481815
|
+
const { join: join142 } = await import("path");
|
|
481883
481816
|
const fs5 = await import("fs/promises");
|
|
481884
|
-
const filePath =
|
|
481817
|
+
const filePath = join142(getCwd(), ".claude", "skills", skillName, "SKILL.md");
|
|
481885
481818
|
let currentContent;
|
|
481886
481819
|
try {
|
|
481887
481820
|
currentContent = await fs5.readFile(filePath, "utf-8");
|
|
@@ -482139,8 +482072,8 @@ var init_cacache = __esm(() => {
|
|
|
482139
482072
|
|
|
482140
482073
|
// src/utils/cleanup.ts
|
|
482141
482074
|
import * as fs5 from "fs/promises";
|
|
482142
|
-
import { homedir as
|
|
482143
|
-
import { join as
|
|
482075
|
+
import { homedir as homedir42 } from "os";
|
|
482076
|
+
import { join as join142 } from "path";
|
|
482144
482077
|
function getCutoffDate() {
|
|
482145
482078
|
const settings = getSettings_DEPRECATED() || {};
|
|
482146
482079
|
const cleanupPeriodDays = settings.cleanupPeriodDays ?? DEFAULT_CLEANUP_PERIOD_DAYS;
|
|
@@ -482165,7 +482098,7 @@ async function cleanupOldFilesInDirectory(dirPath, cutoffDate, isMessagePath) {
|
|
|
482165
482098
|
try {
|
|
482166
482099
|
const timestamp = convertFileNameToDate(file.name);
|
|
482167
482100
|
if (timestamp < cutoffDate) {
|
|
482168
|
-
await getFsImplementation().unlink(
|
|
482101
|
+
await getFsImplementation().unlink(join142(dirPath, file.name));
|
|
482169
482102
|
if (isMessagePath) {
|
|
482170
482103
|
result.messages++;
|
|
482171
482104
|
} else {
|
|
@@ -482196,7 +482129,7 @@ async function cleanupOldMessageFiles() {
|
|
|
482196
482129
|
} catch {
|
|
482197
482130
|
return result;
|
|
482198
482131
|
}
|
|
482199
|
-
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) =>
|
|
482132
|
+
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) => join142(baseCachePath, dirent.name));
|
|
482200
482133
|
for (const mcpLogDir of mcpLogDirs) {
|
|
482201
482134
|
result = addCleanupResults(result, await cleanupOldFilesInDirectory(mcpLogDir, cutoffDate, true));
|
|
482202
482135
|
await tryRmdir(mcpLogDir, fsImpl);
|
|
@@ -482235,7 +482168,7 @@ async function cleanupOldSessionFiles() {
|
|
|
482235
482168
|
for (const projectDirent of projectDirents) {
|
|
482236
482169
|
if (!projectDirent.isDirectory())
|
|
482237
482170
|
continue;
|
|
482238
|
-
const projectDir =
|
|
482171
|
+
const projectDir = join142(projectsDir, projectDirent.name);
|
|
482239
482172
|
let entries;
|
|
482240
482173
|
try {
|
|
482241
482174
|
entries = await fsImpl.readdir(projectDir);
|
|
@@ -482249,15 +482182,15 @@ async function cleanupOldSessionFiles() {
|
|
|
482249
482182
|
continue;
|
|
482250
482183
|
}
|
|
482251
482184
|
try {
|
|
482252
|
-
if (await unlinkIfOld(
|
|
482185
|
+
if (await unlinkIfOld(join142(projectDir, entry.name), cutoffDate, fsImpl)) {
|
|
482253
482186
|
result.messages++;
|
|
482254
482187
|
}
|
|
482255
482188
|
} catch {
|
|
482256
482189
|
result.errors++;
|
|
482257
482190
|
}
|
|
482258
482191
|
} else if (entry.isDirectory()) {
|
|
482259
|
-
const sessionDir =
|
|
482260
|
-
const toolResultsDir =
|
|
482192
|
+
const sessionDir = join142(projectDir, entry.name);
|
|
482193
|
+
const toolResultsDir = join142(sessionDir, TOOL_RESULTS_SUBDIR);
|
|
482261
482194
|
let toolDirs;
|
|
482262
482195
|
try {
|
|
482263
482196
|
toolDirs = await fsImpl.readdir(toolResultsDir);
|
|
@@ -482268,14 +482201,14 @@ async function cleanupOldSessionFiles() {
|
|
|
482268
482201
|
for (const toolEntry of toolDirs) {
|
|
482269
482202
|
if (toolEntry.isFile()) {
|
|
482270
482203
|
try {
|
|
482271
|
-
if (await unlinkIfOld(
|
|
482204
|
+
if (await unlinkIfOld(join142(toolResultsDir, toolEntry.name), cutoffDate, fsImpl)) {
|
|
482272
482205
|
result.messages++;
|
|
482273
482206
|
}
|
|
482274
482207
|
} catch {
|
|
482275
482208
|
result.errors++;
|
|
482276
482209
|
}
|
|
482277
482210
|
} else if (toolEntry.isDirectory()) {
|
|
482278
|
-
const toolDirPath =
|
|
482211
|
+
const toolDirPath = join142(toolResultsDir, toolEntry.name);
|
|
482279
482212
|
let toolFiles;
|
|
482280
482213
|
try {
|
|
482281
482214
|
toolFiles = await fsImpl.readdir(toolDirPath);
|
|
@@ -482286,7 +482219,7 @@ async function cleanupOldSessionFiles() {
|
|
|
482286
482219
|
if (!tf.isFile())
|
|
482287
482220
|
continue;
|
|
482288
482221
|
try {
|
|
482289
|
-
if (await unlinkIfOld(
|
|
482222
|
+
if (await unlinkIfOld(join142(toolDirPath, tf.name), cutoffDate, fsImpl)) {
|
|
482290
482223
|
result.messages++;
|
|
482291
482224
|
}
|
|
482292
482225
|
} catch {
|
|
@@ -482318,7 +482251,7 @@ async function cleanupSingleDirectory(dirPath, extension2, removeEmptyDir = true
|
|
|
482318
482251
|
if (!dirent.isFile() || !dirent.name.endsWith(extension2))
|
|
482319
482252
|
continue;
|
|
482320
482253
|
try {
|
|
482321
|
-
if (await unlinkIfOld(
|
|
482254
|
+
if (await unlinkIfOld(join142(dirPath, dirent.name), cutoffDate, fsImpl)) {
|
|
482322
482255
|
result.messages++;
|
|
482323
482256
|
}
|
|
482324
482257
|
} catch {
|
|
@@ -482331,7 +482264,7 @@ async function cleanupSingleDirectory(dirPath, extension2, removeEmptyDir = true
|
|
|
482331
482264
|
return result;
|
|
482332
482265
|
}
|
|
482333
482266
|
function cleanupOldPlanFiles() {
|
|
482334
|
-
const plansDir =
|
|
482267
|
+
const plansDir = join142(getClaudeConfigHomeDir(), "plans");
|
|
482335
482268
|
return cleanupSingleDirectory(plansDir, ".md");
|
|
482336
482269
|
}
|
|
482337
482270
|
async function cleanupOldFileHistoryBackups() {
|
|
@@ -482340,14 +482273,14 @@ async function cleanupOldFileHistoryBackups() {
|
|
|
482340
482273
|
const fsImpl = getFsImplementation();
|
|
482341
482274
|
try {
|
|
482342
482275
|
const configDir = getClaudeConfigHomeDir();
|
|
482343
|
-
const fileHistoryStorageDir =
|
|
482276
|
+
const fileHistoryStorageDir = join142(configDir, "file-history");
|
|
482344
482277
|
let dirents;
|
|
482345
482278
|
try {
|
|
482346
482279
|
dirents = await fsImpl.readdir(fileHistoryStorageDir);
|
|
482347
482280
|
} catch {
|
|
482348
482281
|
return result;
|
|
482349
482282
|
}
|
|
482350
|
-
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
482283
|
+
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join142(fileHistoryStorageDir, dirent.name));
|
|
482351
482284
|
await Promise.all(fileHistorySessionsDirs.map(async (fileHistorySessionDir) => {
|
|
482352
482285
|
try {
|
|
482353
482286
|
const stats2 = await fsImpl.stat(fileHistorySessionDir);
|
|
@@ -482374,14 +482307,14 @@ async function cleanupOldSessionEnvDirs() {
|
|
|
482374
482307
|
const fsImpl = getFsImplementation();
|
|
482375
482308
|
try {
|
|
482376
482309
|
const configDir = getClaudeConfigHomeDir();
|
|
482377
|
-
const sessionEnvBaseDir =
|
|
482310
|
+
const sessionEnvBaseDir = join142(configDir, "session-env");
|
|
482378
482311
|
let dirents;
|
|
482379
482312
|
try {
|
|
482380
482313
|
dirents = await fsImpl.readdir(sessionEnvBaseDir);
|
|
482381
482314
|
} catch {
|
|
482382
482315
|
return result;
|
|
482383
482316
|
}
|
|
482384
|
-
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
482317
|
+
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join142(sessionEnvBaseDir, dirent.name));
|
|
482385
482318
|
for (const sessionEnvDir of sessionEnvDirs) {
|
|
482386
482319
|
try {
|
|
482387
482320
|
const stats2 = await fsImpl.stat(sessionEnvDir);
|
|
@@ -482403,7 +482336,7 @@ async function cleanupOldDebugLogs() {
|
|
|
482403
482336
|
const cutoffDate = getCutoffDate();
|
|
482404
482337
|
const result = { messages: 0, errors: 0 };
|
|
482405
482338
|
const fsImpl = getFsImplementation();
|
|
482406
|
-
const debugDir =
|
|
482339
|
+
const debugDir = join142(getClaudeConfigHomeDir(), "debug");
|
|
482407
482340
|
let dirents;
|
|
482408
482341
|
try {
|
|
482409
482342
|
dirents = await fsImpl.readdir(debugDir);
|
|
@@ -482415,7 +482348,7 @@ async function cleanupOldDebugLogs() {
|
|
|
482415
482348
|
continue;
|
|
482416
482349
|
}
|
|
482417
482350
|
try {
|
|
482418
|
-
if (await unlinkIfOld(
|
|
482351
|
+
if (await unlinkIfOld(join142(debugDir, dirent.name), cutoffDate, fsImpl)) {
|
|
482419
482352
|
result.messages++;
|
|
482420
482353
|
}
|
|
482421
482354
|
} catch {
|
|
@@ -482425,7 +482358,7 @@ async function cleanupOldDebugLogs() {
|
|
|
482425
482358
|
return result;
|
|
482426
482359
|
}
|
|
482427
482360
|
async function cleanupNpmCacheForAnthropicPackages() {
|
|
482428
|
-
const markerPath =
|
|
482361
|
+
const markerPath = join142(getClaudeConfigHomeDir(), ".npm-cache-cleanup");
|
|
482429
482362
|
try {
|
|
482430
482363
|
const stat49 = await fs5.stat(markerPath);
|
|
482431
482364
|
if (Date.now() - stat49.mtimeMs < ONE_DAY_MS) {
|
|
@@ -482440,7 +482373,7 @@ async function cleanupNpmCacheForAnthropicPackages() {
|
|
|
482440
482373
|
return;
|
|
482441
482374
|
}
|
|
482442
482375
|
logForDebugging("npm cache cleanup: starting");
|
|
482443
|
-
const npmCachePath =
|
|
482376
|
+
const npmCachePath = join142(homedir42(), ".npm", "_cacache");
|
|
482444
482377
|
const NPM_CACHE_RETENTION_COUNT = 5;
|
|
482445
482378
|
const startTime = Date.now();
|
|
482446
482379
|
try {
|
|
@@ -482495,7 +482428,7 @@ async function cleanupNpmCacheForAnthropicPackages() {
|
|
|
482495
482428
|
}
|
|
482496
482429
|
}
|
|
482497
482430
|
async function cleanupOldVersionsThrottled() {
|
|
482498
|
-
const markerPath =
|
|
482431
|
+
const markerPath = join142(getClaudeConfigHomeDir(), ".version-cleanup");
|
|
482499
482432
|
try {
|
|
482500
482433
|
const stat49 = await fs5.stat(markerPath);
|
|
482501
482434
|
if (Date.now() - stat49.mtimeMs < ONE_DAY_MS) {
|
|
@@ -485725,7 +485658,7 @@ __export(exports_asciicast, {
|
|
|
485725
485658
|
_resetRecordingStateForTesting: () => _resetRecordingStateForTesting
|
|
485726
485659
|
});
|
|
485727
485660
|
import { appendFile as appendFile5, rename as rename10 } from "fs/promises";
|
|
485728
|
-
import { basename as basename55, dirname as dirname55, join as
|
|
485661
|
+
import { basename as basename55, dirname as dirname55, join as join144 } from "path";
|
|
485729
485662
|
function getRecordFilePath() {
|
|
485730
485663
|
if (recordingState.filePath !== null) {
|
|
485731
485664
|
return recordingState.filePath;
|
|
@@ -485736,10 +485669,10 @@ function getRecordFilePath() {
|
|
|
485736
485669
|
if (!isEnvTruthy(process.env.CLAUDE_CODE_TERMINAL_RECORDING)) {
|
|
485737
485670
|
return null;
|
|
485738
485671
|
}
|
|
485739
|
-
const projectsDir =
|
|
485740
|
-
const projectDir =
|
|
485672
|
+
const projectsDir = join144(getClaudeConfigHomeDir(), "projects");
|
|
485673
|
+
const projectDir = join144(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
485741
485674
|
recordingState.timestamp = Date.now();
|
|
485742
|
-
recordingState.filePath =
|
|
485675
|
+
recordingState.filePath = join144(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
485743
485676
|
return recordingState.filePath;
|
|
485744
485677
|
}
|
|
485745
485678
|
function _resetRecordingStateForTesting() {
|
|
@@ -485748,13 +485681,13 @@ function _resetRecordingStateForTesting() {
|
|
|
485748
485681
|
}
|
|
485749
485682
|
function getSessionRecordingPaths() {
|
|
485750
485683
|
const sessionId = getSessionId();
|
|
485751
|
-
const projectsDir =
|
|
485752
|
-
const projectDir =
|
|
485684
|
+
const projectsDir = join144(getClaudeConfigHomeDir(), "projects");
|
|
485685
|
+
const projectDir = join144(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
485753
485686
|
try {
|
|
485754
485687
|
const entries = getFsImplementation().readdirSync(projectDir);
|
|
485755
485688
|
const names = typeof entries[0] === "string" ? entries : entries.map((e) => e.name);
|
|
485756
485689
|
const files2 = names.filter((f) => f.startsWith(sessionId) && f.endsWith(".cast")).sort();
|
|
485757
|
-
return files2.map((f) =>
|
|
485690
|
+
return files2.map((f) => join144(projectDir, f));
|
|
485758
485691
|
} catch {
|
|
485759
485692
|
return [];
|
|
485760
485693
|
}
|
|
@@ -485764,9 +485697,9 @@ async function renameRecordingForSession() {
|
|
|
485764
485697
|
if (!oldPath || recordingState.timestamp === 0) {
|
|
485765
485698
|
return;
|
|
485766
485699
|
}
|
|
485767
|
-
const projectsDir =
|
|
485768
|
-
const projectDir =
|
|
485769
|
-
const newPath =
|
|
485700
|
+
const projectsDir = join144(getClaudeConfigHomeDir(), "projects");
|
|
485701
|
+
const projectDir = join144(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
485702
|
+
const newPath = join144(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
485770
485703
|
if (oldPath === newPath) {
|
|
485771
485704
|
return;
|
|
485772
485705
|
}
|
|
@@ -487348,7 +487281,7 @@ var init_useDynamicConfig = __esm(() => {
|
|
|
487348
487281
|
});
|
|
487349
487282
|
|
|
487350
487283
|
// src/components/FeedbackSurvey/submitTranscriptShare.ts
|
|
487351
|
-
import { readFile as
|
|
487284
|
+
import { readFile as readFile56, stat as stat49 } from "fs/promises";
|
|
487352
487285
|
async function submitTranscriptShare(messages, trigger, appearanceId) {
|
|
487353
487286
|
try {
|
|
487354
487287
|
logForDebugging("Collecting transcript for sharing", { level: "info" });
|
|
@@ -487360,14 +487293,14 @@ async function submitTranscriptShare(messages, trigger, appearanceId) {
|
|
|
487360
487293
|
const transcriptPath = getTranscriptPath();
|
|
487361
487294
|
const { size } = await stat49(transcriptPath);
|
|
487362
487295
|
if (size <= MAX_TRANSCRIPT_READ_BYTES) {
|
|
487363
|
-
rawTranscriptJsonl = await
|
|
487296
|
+
rawTranscriptJsonl = await readFile56(transcriptPath, "utf-8");
|
|
487364
487297
|
} else {
|
|
487365
487298
|
logForDebugging(`Skipping raw transcript read: file too large (${size} bytes)`, { level: "warn" });
|
|
487366
487299
|
}
|
|
487367
487300
|
} catch {}
|
|
487368
487301
|
const data = {
|
|
487369
487302
|
trigger,
|
|
487370
|
-
version: "1.3.
|
|
487303
|
+
version: "1.3.3",
|
|
487371
487304
|
platform: process.platform,
|
|
487372
487305
|
transcript,
|
|
487373
487306
|
subagentTranscripts: Object.keys(subagentTranscripts).length > 0 ? subagentTranscripts : undefined,
|
|
@@ -488579,7 +488512,7 @@ var init_useAwaySummary = __esm(() => {
|
|
|
488579
488512
|
});
|
|
488580
488513
|
|
|
488581
488514
|
// src/utils/plugins/officialMarketplaceStartupCheck.ts
|
|
488582
|
-
import { join as
|
|
488515
|
+
import { join as join145 } from "path";
|
|
488583
488516
|
function isOfficialMarketplaceAutoInstallDisabled() {
|
|
488584
488517
|
return isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL);
|
|
488585
488518
|
}
|
|
@@ -488662,7 +488595,7 @@ async function checkAndInstallOfficialMarketplace() {
|
|
|
488662
488595
|
return { installed: false, skipped: true, reason: "policy_blocked" };
|
|
488663
488596
|
}
|
|
488664
488597
|
const cacheDir = getMarketplacesCacheDir();
|
|
488665
|
-
const installLocation =
|
|
488598
|
+
const installLocation = join145(cacheDir, OFFICIAL_MARKETPLACE_NAME);
|
|
488666
488599
|
const gcsSha = await fetchOfficialMarketplaceFromGcs(installLocation, cacheDir);
|
|
488667
488600
|
if (gcsSha !== null) {
|
|
488668
488601
|
const known = await loadKnownMarketplacesConfig();
|
|
@@ -488918,7 +488851,7 @@ var init_tipHistory = __esm(() => {
|
|
|
488918
488851
|
|
|
488919
488852
|
// src/utils/desktopDeepLink.ts
|
|
488920
488853
|
import { readdir as readdir33 } from "fs/promises";
|
|
488921
|
-
import { join as
|
|
488854
|
+
import { join as join146 } from "path";
|
|
488922
488855
|
function isDevMode() {
|
|
488923
488856
|
if (true) {
|
|
488924
488857
|
return true;
|
|
@@ -488981,7 +488914,7 @@ async function getDesktopVersion() {
|
|
|
488981
488914
|
if (!localAppData) {
|
|
488982
488915
|
return null;
|
|
488983
488916
|
}
|
|
488984
|
-
const installDir =
|
|
488917
|
+
const installDir = join146(localAppData, "AnthropicClaude");
|
|
488985
488918
|
try {
|
|
488986
488919
|
const entries = await readdir33(installDir);
|
|
488987
488920
|
const versions = entries.filter((e) => e.startsWith("app-")).map((e) => e.slice(4)).filter((v2) => import_semver14.coerce(v2) !== null).sort((a, b3) => {
|
|
@@ -492013,7 +491946,7 @@ var init_usePluginRecommendationBase = __esm(() => {
|
|
|
492013
491946
|
});
|
|
492014
491947
|
|
|
492015
491948
|
// src/hooks/useLspPluginRecommendation.tsx
|
|
492016
|
-
import { extname as extname15, join as
|
|
491949
|
+
import { extname as extname15, join as join147 } from "path";
|
|
492017
491950
|
function useLspPluginRecommendation() {
|
|
492018
491951
|
const $2 = c3(12);
|
|
492019
491952
|
const trackedFiles = useAppState(_temp204);
|
|
@@ -492098,7 +492031,7 @@ function useLspPluginRecommendation() {
|
|
|
492098
492031
|
case "yes": {
|
|
492099
492032
|
installPluginAndNotify(pluginId, pluginName, "lsp-plugin", addNotification, async (pluginData) => {
|
|
492100
492033
|
logForDebugging(`[useLspPluginRecommendation] Installing plugin: ${pluginId}`);
|
|
492101
|
-
const localSourcePath = typeof pluginData.entry.source === "string" ?
|
|
492034
|
+
const localSourcePath = typeof pluginData.entry.source === "string" ? join147(pluginData.marketplaceInstallLocation, pluginData.entry.source) : undefined;
|
|
492102
492035
|
await cacheAndRegisterPlugin(pluginId, pluginData.entry, "user", undefined, localSourcePath);
|
|
492103
492036
|
const settings = getSettingsForSource("userSettings");
|
|
492104
492037
|
updateSettingsForSource("userSettings", {
|
|
@@ -494930,9 +494863,9 @@ var exports_REPL = {};
|
|
|
494930
494863
|
__export(exports_REPL, {
|
|
494931
494864
|
REPL: () => REPL
|
|
494932
494865
|
});
|
|
494933
|
-
import { dirname as dirname57, join as
|
|
494866
|
+
import { dirname as dirname57, join as join148 } from "path";
|
|
494934
494867
|
import { tmpdir as tmpdir11 } from "os";
|
|
494935
|
-
import { writeFile as
|
|
494868
|
+
import { writeFile as writeFile49 } from "fs/promises";
|
|
494936
494869
|
import { randomUUID as randomUUID46 } from "crypto";
|
|
494937
494870
|
function TranscriptModeFooter(t0) {
|
|
494938
494871
|
const $2 = c3(9);
|
|
@@ -497500,8 +497433,8 @@ Note: ctrl + z now suspends localclawd, ctrl + _ undoes input.
|
|
|
497500
497433
|
const w2 = Math.max(80, (process.stdout.columns ?? 80) - 6);
|
|
497501
497434
|
const raw = await renderMessagesToPlainText(deferredMessages, tools, w2);
|
|
497502
497435
|
const text = raw.replace(/[ \t]+$/gm, "");
|
|
497503
|
-
const path17 =
|
|
497504
|
-
await
|
|
497436
|
+
const path17 = join148(tmpdir11(), `cc-transcript-${Date.now()}.txt`);
|
|
497437
|
+
await writeFile49(path17, text);
|
|
497505
497438
|
const opened = openFileInExternalEditor(path17);
|
|
497506
497439
|
setStatus(opened ? `opening ${path17}` : `wrote ${path17} · no $VISUAL/$EDITOR set`);
|
|
497507
497440
|
} catch (e) {
|
|
@@ -499164,7 +499097,7 @@ var exports_TrustDialog = {};
|
|
|
499164
499097
|
__export(exports_TrustDialog, {
|
|
499165
499098
|
TrustDialog: () => TrustDialog
|
|
499166
499099
|
});
|
|
499167
|
-
import { homedir as
|
|
499100
|
+
import { homedir as homedir43 } from "os";
|
|
499168
499101
|
function TrustDialog({ onDone }) {
|
|
499169
499102
|
const [focusIdx, setFocusIdx] = import_react307.useState(0);
|
|
499170
499103
|
const doneRef = import_react307.useRef(false);
|
|
@@ -499182,7 +499115,7 @@ function TrustDialog({ onDone }) {
|
|
|
499182
499115
|
gracefulShutdownSync(1);
|
|
499183
499116
|
} else {
|
|
499184
499117
|
try {
|
|
499185
|
-
if (
|
|
499118
|
+
if (homedir43() !== getCwd()) {
|
|
499186
499119
|
try {
|
|
499187
499120
|
saveCurrentProjectConfig((c5) => ({ ...c5, hasTrustDialogAccepted: true }));
|
|
499188
499121
|
} catch {}
|
|
@@ -503777,12 +503710,12 @@ var init_createDirectConnectSession = __esm(() => {
|
|
|
503777
503710
|
});
|
|
503778
503711
|
|
|
503779
503712
|
// src/utils/errorLogSink.ts
|
|
503780
|
-
import { dirname as dirname59, join as
|
|
503713
|
+
import { dirname as dirname59, join as join149 } from "path";
|
|
503781
503714
|
function getErrorsPath() {
|
|
503782
|
-
return
|
|
503715
|
+
return join149(CACHE_PATHS.errors(), DATE + ".jsonl");
|
|
503783
503716
|
}
|
|
503784
503717
|
function getMCPLogsPath(serverName) {
|
|
503785
|
-
return
|
|
503718
|
+
return join149(CACHE_PATHS.mcpLogs(serverName), DATE + ".jsonl");
|
|
503786
503719
|
}
|
|
503787
503720
|
function createJsonlWriter(options) {
|
|
503788
503721
|
const writer = createBufferedWriter(options);
|
|
@@ -503826,7 +503759,7 @@ function appendToLog(path17, message) {
|
|
|
503826
503759
|
cwd: getFsImplementation().cwd(),
|
|
503827
503760
|
userType: process.env.USER_TYPE,
|
|
503828
503761
|
sessionId: getSessionId(),
|
|
503829
|
-
version: "1.3.
|
|
503762
|
+
version: "1.3.3"
|
|
503830
503763
|
};
|
|
503831
503764
|
getLogWriter(path17).write(messageWithTimestamp);
|
|
503832
503765
|
}
|
|
@@ -503925,7 +503858,7 @@ var init_sinks = __esm(() => {
|
|
|
503925
503858
|
});
|
|
503926
503859
|
|
|
503927
503860
|
// src/services/SessionMemory/sessionMemory.ts
|
|
503928
|
-
import { writeFile as
|
|
503861
|
+
import { writeFile as writeFile50 } from "fs/promises";
|
|
503929
503862
|
function isSessionMemoryGateEnabled() {
|
|
503930
503863
|
return getFeatureValue_CACHED_MAY_BE_STALE("tengu_session_memory", false);
|
|
503931
503864
|
}
|
|
@@ -503979,13 +503912,13 @@ async function setupSessionMemoryFile(toolUseContext) {
|
|
|
503979
503912
|
await fs6.mkdir(sessionMemoryDir, { mode: 448 });
|
|
503980
503913
|
const memoryPath = getSessionMemoryPath();
|
|
503981
503914
|
try {
|
|
503982
|
-
await
|
|
503915
|
+
await writeFile50(memoryPath, "", {
|
|
503983
503916
|
encoding: "utf-8",
|
|
503984
503917
|
mode: 384,
|
|
503985
503918
|
flag: "wx"
|
|
503986
503919
|
});
|
|
503987
503920
|
const template = await loadSessionMemoryTemplate();
|
|
503988
|
-
await
|
|
503921
|
+
await writeFile50(memoryPath, template, {
|
|
503989
503922
|
encoding: "utf-8",
|
|
503990
503923
|
mode: 384
|
|
503991
503924
|
});
|
|
@@ -504121,8 +504054,8 @@ var init_sessionMemory = __esm(() => {
|
|
|
504121
504054
|
|
|
504122
504055
|
// src/utils/iTermBackup.ts
|
|
504123
504056
|
import { copyFile as copyFile11, stat as stat51 } from "fs/promises";
|
|
504124
|
-
import { homedir as
|
|
504125
|
-
import { join as
|
|
504057
|
+
import { homedir as homedir44 } from "os";
|
|
504058
|
+
import { join as join150 } from "path";
|
|
504126
504059
|
function markITerm2SetupComplete() {
|
|
504127
504060
|
saveGlobalConfig((current) => ({
|
|
504128
504061
|
...current,
|
|
@@ -504137,7 +504070,7 @@ function getIterm2RecoveryInfo() {
|
|
|
504137
504070
|
};
|
|
504138
504071
|
}
|
|
504139
504072
|
function getITerm2PlistPath() {
|
|
504140
|
-
return
|
|
504073
|
+
return join150(homedir44(), "Library", "Preferences", "com.googlecode.iterm2.plist");
|
|
504141
504074
|
}
|
|
504142
504075
|
async function checkAndRestoreITerm2Backup() {
|
|
504143
504076
|
const { inProgress, backupPath } = getIterm2RecoveryInfo();
|
|
@@ -507531,8 +507464,8 @@ var init_idleTimeout = __esm(() => {
|
|
|
507531
507464
|
|
|
507532
507465
|
// src/bridge/inboundAttachments.ts
|
|
507533
507466
|
import { randomUUID as randomUUID49 } from "crypto";
|
|
507534
|
-
import { mkdir as
|
|
507535
|
-
import { basename as basename56, join as
|
|
507467
|
+
import { mkdir as mkdir48, writeFile as writeFile51 } from "fs/promises";
|
|
507468
|
+
import { basename as basename56, join as join151 } from "path";
|
|
507536
507469
|
import { z as z94 } from "zod/v4";
|
|
507537
507470
|
function debug3(msg) {
|
|
507538
507471
|
logForDebugging(`[bridge:inbound-attach] ${msg}`);
|
|
@@ -507549,7 +507482,7 @@ function sanitizeFileName(name) {
|
|
|
507549
507482
|
return base || "attachment";
|
|
507550
507483
|
}
|
|
507551
507484
|
function uploadsDir() {
|
|
507552
|
-
return
|
|
507485
|
+
return join151(getClaudeConfigHomeDir(), "uploads", getSessionId());
|
|
507553
507486
|
}
|
|
507554
507487
|
async function resolveOne(att) {
|
|
507555
507488
|
const token = getBridgeAccessToken();
|
|
@@ -507578,10 +507511,10 @@ async function resolveOne(att) {
|
|
|
507578
507511
|
const safeName = sanitizeFileName(att.file_name);
|
|
507579
507512
|
const prefix = (att.file_uuid.slice(0, 8) || randomUUID49().slice(0, 8)).replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
507580
507513
|
const dir = uploadsDir();
|
|
507581
|
-
const outPath =
|
|
507514
|
+
const outPath = join151(dir, `${prefix}-${safeName}`);
|
|
507582
507515
|
try {
|
|
507583
|
-
await
|
|
507584
|
-
await
|
|
507516
|
+
await mkdir48(dir, { recursive: true });
|
|
507517
|
+
await writeFile51(outPath, data);
|
|
507585
507518
|
} catch (e) {
|
|
507586
507519
|
debug3(`write ${outPath} failed: ${e}`);
|
|
507587
507520
|
return;
|
|
@@ -507676,11 +507609,11 @@ var init_sessionUrl = __esm(() => {
|
|
|
507676
507609
|
});
|
|
507677
507610
|
|
|
507678
507611
|
// src/utils/plugins/zipCacheAdapters.ts
|
|
507679
|
-
import { readFile as
|
|
507680
|
-
import { join as
|
|
507612
|
+
import { readFile as readFile57 } from "fs/promises";
|
|
507613
|
+
import { join as join152 } from "path";
|
|
507681
507614
|
async function readZipCacheKnownMarketplaces() {
|
|
507682
507615
|
try {
|
|
507683
|
-
const content = await
|
|
507616
|
+
const content = await readFile57(getZipCacheKnownMarketplacesPath(), "utf-8");
|
|
507684
507617
|
const parsed = KnownMarketplacesFileSchema().safeParse(jsonParse(content));
|
|
507685
507618
|
if (!parsed.success) {
|
|
507686
507619
|
logForDebugging(`Invalid known_marketplaces.json in zip cache: ${parsed.error.message}`, { level: "error" });
|
|
@@ -507702,18 +507635,18 @@ async function saveMarketplaceJsonToZipCache(marketplaceName, installLocation) {
|
|
|
507702
507635
|
const content = await readMarketplaceJsonContent(installLocation);
|
|
507703
507636
|
if (content !== null) {
|
|
507704
507637
|
const relPath = getMarketplaceJsonRelativePath(marketplaceName);
|
|
507705
|
-
await atomicWriteToZipCache(
|
|
507638
|
+
await atomicWriteToZipCache(join152(zipCachePath, relPath), content);
|
|
507706
507639
|
}
|
|
507707
507640
|
}
|
|
507708
507641
|
async function readMarketplaceJsonContent(dir) {
|
|
507709
507642
|
const candidates = [
|
|
507710
|
-
|
|
507711
|
-
|
|
507643
|
+
join152(dir, ".claude-plugin", "marketplace.json"),
|
|
507644
|
+
join152(dir, "marketplace.json"),
|
|
507712
507645
|
dir
|
|
507713
507646
|
];
|
|
507714
507647
|
for (const candidate of candidates) {
|
|
507715
507648
|
try {
|
|
507716
|
-
return await
|
|
507649
|
+
return await readFile57(candidate, "utf-8");
|
|
507717
507650
|
} catch {}
|
|
507718
507651
|
}
|
|
507719
507652
|
return null;
|
|
@@ -507838,8 +507771,8 @@ async function getEnvLessBridgeConfig() {
|
|
|
507838
507771
|
}
|
|
507839
507772
|
async function checkEnvLessBridgeMinVersion() {
|
|
507840
507773
|
const cfg = await getEnvLessBridgeConfig();
|
|
507841
|
-
if (cfg.min_version && lt("1.3.
|
|
507842
|
-
return `Your version of localclawd (${"1.3.
|
|
507774
|
+
if (cfg.min_version && lt("1.3.3", cfg.min_version)) {
|
|
507775
|
+
return `Your version of localclawd (${"1.3.3"}) is too old for Remote Control.
|
|
507843
507776
|
Version ${cfg.min_version} or higher is required. Run \`localclawd update\` to update.`;
|
|
507844
507777
|
}
|
|
507845
507778
|
return null;
|
|
@@ -508164,17 +508097,17 @@ __export(exports_bridgePointer, {
|
|
|
508164
508097
|
clearBridgePointer: () => clearBridgePointer,
|
|
508165
508098
|
BRIDGE_POINTER_TTL_MS: () => BRIDGE_POINTER_TTL_MS
|
|
508166
508099
|
});
|
|
508167
|
-
import { mkdir as
|
|
508168
|
-
import { dirname as dirname60, join as
|
|
508100
|
+
import { mkdir as mkdir49, readFile as readFile58, stat as stat52, unlink as unlink24, writeFile as writeFile52 } from "fs/promises";
|
|
508101
|
+
import { dirname as dirname60, join as join153 } from "path";
|
|
508169
508102
|
import { z as z96 } from "zod/v4";
|
|
508170
508103
|
function getBridgePointerPath(dir) {
|
|
508171
|
-
return
|
|
508104
|
+
return join153(getProjectsDir(), sanitizePath2(dir), "bridge-pointer.json");
|
|
508172
508105
|
}
|
|
508173
508106
|
async function writeBridgePointer(dir, pointer) {
|
|
508174
508107
|
const path17 = getBridgePointerPath(dir);
|
|
508175
508108
|
try {
|
|
508176
|
-
await
|
|
508177
|
-
await
|
|
508109
|
+
await mkdir49(dirname60(path17), { recursive: true });
|
|
508110
|
+
await writeFile52(path17, jsonStringify(pointer), "utf8");
|
|
508178
508111
|
logForDebugging(`[bridge:pointer] wrote ${path17}`);
|
|
508179
508112
|
} catch (err2) {
|
|
508180
508113
|
logForDebugging(`[bridge:pointer] write failed: ${err2}`, { level: "warn" });
|
|
@@ -508186,7 +508119,7 @@ async function readBridgePointer(dir) {
|
|
|
508186
508119
|
let mtimeMs;
|
|
508187
508120
|
try {
|
|
508188
508121
|
mtimeMs = (await stat52(path17)).mtimeMs;
|
|
508189
|
-
raw = await
|
|
508122
|
+
raw = await readFile58(path17, "utf8");
|
|
508190
508123
|
} catch {
|
|
508191
508124
|
return null;
|
|
508192
508125
|
}
|
|
@@ -508311,7 +508244,7 @@ async function initBridgeCore(params) {
|
|
|
508311
508244
|
const rawApi = createBridgeApiClient({
|
|
508312
508245
|
baseUrl,
|
|
508313
508246
|
getAccessToken,
|
|
508314
|
-
runnerVersion: "1.3.
|
|
508247
|
+
runnerVersion: "1.3.3",
|
|
508315
508248
|
onDebug: logForDebugging,
|
|
508316
508249
|
onAuth401,
|
|
508317
508250
|
getTrustedDeviceToken
|
|
@@ -510172,7 +510105,7 @@ __export(exports_print, {
|
|
|
510172
510105
|
createCanUseToolWithPermissionPrompt: () => createCanUseToolWithPermissionPrompt,
|
|
510173
510106
|
canBatchWith: () => canBatchWith
|
|
510174
510107
|
});
|
|
510175
|
-
import { readFile as
|
|
510108
|
+
import { readFile as readFile59, stat as stat53 } from "fs/promises";
|
|
510176
510109
|
import { dirname as dirname61 } from "path";
|
|
510177
510110
|
import { cwd as cwd2 } from "process";
|
|
510178
510111
|
import { randomUUID as randomUUID52 } from "crypto";
|
|
@@ -511522,7 +511455,7 @@ ${m2.text}
|
|
|
511522
511455
|
const normalizedPath = expandPath(message.request.path);
|
|
511523
511456
|
const diskMtime = Math.floor((await stat53(normalizedPath)).mtimeMs);
|
|
511524
511457
|
if (diskMtime <= message.request.mtime) {
|
|
511525
|
-
const raw = await
|
|
511458
|
+
const raw = await readFile59(normalizedPath, "utf-8");
|
|
511526
511459
|
const content = (raw.charCodeAt(0) === 65279 ? raw.slice(1) : raw).replaceAll(`\r
|
|
511527
511460
|
`, `
|
|
511528
511461
|
`);
|
|
@@ -514030,7 +513963,7 @@ async function startMCPServer(cwd3, debug4, verbose) {
|
|
|
514030
513963
|
setCwd(cwd3);
|
|
514031
513964
|
const server = new Server({
|
|
514032
513965
|
name: "claude/tengu",
|
|
514033
|
-
version: "1.3.
|
|
513966
|
+
version: "1.3.3"
|
|
514034
513967
|
}, {
|
|
514035
513968
|
capabilities: {
|
|
514036
513969
|
tools: {}
|
|
@@ -514160,16 +514093,16 @@ __export(exports_appDesktop, {
|
|
|
514160
514093
|
readClaudeDesktopMcpServers: () => readClaudeDesktopMcpServers,
|
|
514161
514094
|
getClaudeDesktopConfigPath: () => getClaudeDesktopConfigPath
|
|
514162
514095
|
});
|
|
514163
|
-
import { readdir as readdir34, readFile as
|
|
514164
|
-
import { homedir as
|
|
514165
|
-
import { join as
|
|
514096
|
+
import { readdir as readdir34, readFile as readFile60, stat as stat54 } from "fs/promises";
|
|
514097
|
+
import { homedir as homedir45 } from "os";
|
|
514098
|
+
import { join as join154 } from "path";
|
|
514166
514099
|
async function getClaudeDesktopConfigPath() {
|
|
514167
514100
|
const platform3 = getPlatform();
|
|
514168
514101
|
if (!SUPPORTED_PLATFORMS.includes(platform3)) {
|
|
514169
514102
|
throw new Error(`Unsupported platform: ${platform3} - desktop app integration only works on macOS and WSL.`);
|
|
514170
514103
|
}
|
|
514171
514104
|
if (platform3 === "macos") {
|
|
514172
|
-
return
|
|
514105
|
+
return join154(homedir45(), "Library", "Application Support", "Claude", "claude_desktop_config.json");
|
|
514173
514106
|
}
|
|
514174
514107
|
const windowsHome = process.env.USERPROFILE ? process.env.USERPROFILE.replace(/\\/g, "/") : null;
|
|
514175
514108
|
if (windowsHome) {
|
|
@@ -514188,7 +514121,7 @@ async function getClaudeDesktopConfigPath() {
|
|
|
514188
514121
|
if (user.name === "Public" || user.name === "Default" || user.name === "Default User" || user.name === "All Users") {
|
|
514189
514122
|
continue;
|
|
514190
514123
|
}
|
|
514191
|
-
const potentialConfigPath =
|
|
514124
|
+
const potentialConfigPath = join154(usersDir, user.name, "AppData", "Roaming", "Claude", "claude_desktop_config.json");
|
|
514192
514125
|
try {
|
|
514193
514126
|
await stat54(potentialConfigPath);
|
|
514194
514127
|
return potentialConfigPath;
|
|
@@ -514208,7 +514141,7 @@ async function readClaudeDesktopMcpServers() {
|
|
|
514208
514141
|
const configPath = await getClaudeDesktopConfigPath();
|
|
514209
514142
|
let configContent;
|
|
514210
514143
|
try {
|
|
514211
|
-
configContent = await
|
|
514144
|
+
configContent = await readFile60(configPath, { encoding: "utf8" });
|
|
514212
514145
|
} catch (e) {
|
|
514213
514146
|
const code = getErrnoCode(e);
|
|
514214
514147
|
if (code === "ENOENT") {
|
|
@@ -515111,7 +515044,7 @@ function WelcomeLogo() {
|
|
|
515111
515044
|
dimColor: true,
|
|
515112
515045
|
children: [
|
|
515113
515046
|
"v",
|
|
515114
|
-
"1.3.
|
|
515047
|
+
"1.3.3"
|
|
515115
515048
|
]
|
|
515116
515049
|
}, undefined, true, undefined, this)
|
|
515117
515050
|
]
|
|
@@ -515302,7 +515235,7 @@ __export(exports_update, {
|
|
|
515302
515235
|
});
|
|
515303
515236
|
async function update() {
|
|
515304
515237
|
logEvent("tengu_update_check", {});
|
|
515305
|
-
writeToStdout(`Current version: ${"1.3.
|
|
515238
|
+
writeToStdout(`Current version: ${"1.3.3"}
|
|
515306
515239
|
`);
|
|
515307
515240
|
const channel = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
515308
515241
|
writeToStdout(`Checking for updates to ${channel} version...
|
|
@@ -515377,8 +515310,8 @@ async function update() {
|
|
|
515377
515310
|
writeToStdout(`localclawd is managed by Homebrew.
|
|
515378
515311
|
`);
|
|
515379
515312
|
const latest = await getLatestVersion(channel);
|
|
515380
|
-
if (latest && !gte("1.3.
|
|
515381
|
-
writeToStdout(`Update available: ${"1.3.
|
|
515313
|
+
if (latest && !gte("1.3.3", latest)) {
|
|
515314
|
+
writeToStdout(`Update available: ${"1.3.3"} → ${latest}
|
|
515382
515315
|
`);
|
|
515383
515316
|
writeToStdout(`
|
|
515384
515317
|
`);
|
|
@@ -515394,8 +515327,8 @@ async function update() {
|
|
|
515394
515327
|
writeToStdout(`localclawd is managed by winget.
|
|
515395
515328
|
`);
|
|
515396
515329
|
const latest = await getLatestVersion(channel);
|
|
515397
|
-
if (latest && !gte("1.3.
|
|
515398
|
-
writeToStdout(`Update available: ${"1.3.
|
|
515330
|
+
if (latest && !gte("1.3.3", latest)) {
|
|
515331
|
+
writeToStdout(`Update available: ${"1.3.3"} → ${latest}
|
|
515399
515332
|
`);
|
|
515400
515333
|
writeToStdout(`
|
|
515401
515334
|
`);
|
|
@@ -515409,8 +515342,8 @@ async function update() {
|
|
|
515409
515342
|
writeToStdout(`localclawd is managed by apk.
|
|
515410
515343
|
`);
|
|
515411
515344
|
const latest = await getLatestVersion(channel);
|
|
515412
|
-
if (latest && !gte("1.3.
|
|
515413
|
-
writeToStdout(`Update available: ${"1.3.
|
|
515345
|
+
if (latest && !gte("1.3.3", latest)) {
|
|
515346
|
+
writeToStdout(`Update available: ${"1.3.3"} → ${latest}
|
|
515414
515347
|
`);
|
|
515415
515348
|
writeToStdout(`
|
|
515416
515349
|
`);
|
|
@@ -515475,11 +515408,11 @@ async function update() {
|
|
|
515475
515408
|
`);
|
|
515476
515409
|
await gracefulShutdown(1);
|
|
515477
515410
|
}
|
|
515478
|
-
if (result.latestVersion === "1.3.
|
|
515479
|
-
writeToStdout(source_default.green(`localclawd is up to date (${"1.3.
|
|
515411
|
+
if (result.latestVersion === "1.3.3") {
|
|
515412
|
+
writeToStdout(source_default.green(`localclawd is up to date (${"1.3.3"})`) + `
|
|
515480
515413
|
`);
|
|
515481
515414
|
} else {
|
|
515482
|
-
writeToStdout(source_default.green(`Successfully updated from ${"1.3.
|
|
515415
|
+
writeToStdout(source_default.green(`Successfully updated from ${"1.3.3"} to version ${result.latestVersion}`) + `
|
|
515483
515416
|
`);
|
|
515484
515417
|
await regenerateCompletionCache();
|
|
515485
515418
|
}
|
|
@@ -515539,12 +515472,12 @@ async function update() {
|
|
|
515539
515472
|
`);
|
|
515540
515473
|
await gracefulShutdown(1);
|
|
515541
515474
|
}
|
|
515542
|
-
if (latestVersion === "1.3.
|
|
515543
|
-
writeToStdout(source_default.green(`localclawd is up to date (${"1.3.
|
|
515475
|
+
if (latestVersion === "1.3.3") {
|
|
515476
|
+
writeToStdout(source_default.green(`localclawd is up to date (${"1.3.3"})`) + `
|
|
515544
515477
|
`);
|
|
515545
515478
|
await gracefulShutdown(0);
|
|
515546
515479
|
}
|
|
515547
|
-
writeToStdout(`New version available: ${latestVersion} (current: ${"1.3.
|
|
515480
|
+
writeToStdout(`New version available: ${latestVersion} (current: ${"1.3.3"})
|
|
515548
515481
|
`);
|
|
515549
515482
|
writeToStdout(`Installing update...
|
|
515550
515483
|
`);
|
|
@@ -515589,7 +515522,7 @@ async function update() {
|
|
|
515589
515522
|
logForDebugging(`update: Installation status: ${status2}`);
|
|
515590
515523
|
switch (status2) {
|
|
515591
515524
|
case "success":
|
|
515592
|
-
writeToStdout(source_default.green(`Successfully updated from ${"1.3.
|
|
515525
|
+
writeToStdout(source_default.green(`Successfully updated from ${"1.3.3"} to version ${latestVersion}`) + `
|
|
515593
515526
|
`);
|
|
515594
515527
|
await regenerateCompletionCache();
|
|
515595
515528
|
break;
|
|
@@ -516831,7 +516764,7 @@ Run with --debug for more details.
|
|
|
516831
516764
|
}
|
|
516832
516765
|
}
|
|
516833
516766
|
logForDiagnosticsNoPII("info", "started", {
|
|
516834
|
-
version: "1.3.
|
|
516767
|
+
version: "1.3.3",
|
|
516835
516768
|
is_native_binary: isInBundledMode()
|
|
516836
516769
|
});
|
|
516837
516770
|
registerCleanup(async () => {
|
|
@@ -517615,7 +517548,7 @@ Usage: localclawd --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
517615
517548
|
pendingHookMessages
|
|
517616
517549
|
}, renderAndRun);
|
|
517617
517550
|
}
|
|
517618
|
-
}).version("1.3.
|
|
517551
|
+
}).version("1.3.3 (localclawd)", "-v, --version", "Output the version number");
|
|
517619
517552
|
program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
517620
517553
|
program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
|
|
517621
517554
|
if (canUserConfigureAdvisor()) {
|
|
@@ -518115,7 +518048,7 @@ if (false) {}
|
|
|
518115
518048
|
async function main2() {
|
|
518116
518049
|
const args = process.argv.slice(2);
|
|
518117
518050
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
518118
|
-
console.log(`${"1.3.
|
|
518051
|
+
console.log(`${"1.3.3"} (localclawd)`);
|
|
518119
518052
|
return;
|
|
518120
518053
|
}
|
|
518121
518054
|
const {
|
|
@@ -518198,4 +518131,4 @@ localclawd crashed: ${msg}
|
|
|
518198
518131
|
process.exit(1);
|
|
518199
518132
|
});
|
|
518200
518133
|
|
|
518201
|
-
//# debugId=
|
|
518134
|
+
//# debugId=8FDDB568D66A0F5764756E2164756E21
|