localclawd 2.2.5 → 2.3.0
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 +784 -577
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -87646,7 +87646,7 @@ var init_isEqual = __esm(() => {
|
|
|
87646
87646
|
|
|
87647
87647
|
// src/utils/userAgent.ts
|
|
87648
87648
|
function getClaudeCodeUserAgent() {
|
|
87649
|
-
return `claude-code/${"2.
|
|
87649
|
+
return `claude-code/${"2.3.0"}`;
|
|
87650
87650
|
}
|
|
87651
87651
|
|
|
87652
87652
|
// src/utils/workloadContext.ts
|
|
@@ -87668,7 +87668,7 @@ function getUserAgent() {
|
|
|
87668
87668
|
const clientApp = process.env.CLAUDE_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}` : "";
|
|
87669
87669
|
const workload = getWorkload();
|
|
87670
87670
|
const workloadSuffix = workload ? `, workload/${workload}` : "";
|
|
87671
|
-
return `claude-cli/${"2.
|
|
87671
|
+
return `claude-cli/${"2.3.0"} (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
|
|
87672
87672
|
}
|
|
87673
87673
|
function getMCPUserAgent() {
|
|
87674
87674
|
const parts = [];
|
|
@@ -87682,7 +87682,7 @@ function getMCPUserAgent() {
|
|
|
87682
87682
|
parts.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`);
|
|
87683
87683
|
}
|
|
87684
87684
|
const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
87685
|
-
return `claude-code/${"2.
|
|
87685
|
+
return `claude-code/${"2.3.0"}${suffix}`;
|
|
87686
87686
|
}
|
|
87687
87687
|
function getWebFetchUserAgent() {
|
|
87688
87688
|
return `Claude-User (${getClaudeCodeUserAgent()}; +https://support.anthropic.com/)`;
|
|
@@ -130780,7 +130780,7 @@ function getAttributionHeader(fingerprint) {
|
|
|
130780
130780
|
if (!isAttributionHeaderEnabled()) {
|
|
130781
130781
|
return "";
|
|
130782
130782
|
}
|
|
130783
|
-
const version = `${"2.
|
|
130783
|
+
const version = `${"2.3.0"}.${fingerprint}`;
|
|
130784
130784
|
const entrypoint = process.env.CLAUDE_CODE_ENTRYPOINT ?? "unknown";
|
|
130785
130785
|
const cch = "";
|
|
130786
130786
|
const workload = getWorkload();
|
|
@@ -146967,7 +146967,7 @@ var init_metadata = __esm(() => {
|
|
|
146967
146967
|
COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
|
|
146968
146968
|
WHITESPACE_REGEX = /\s+/;
|
|
146969
146969
|
getVersionBase = memoize_default(() => {
|
|
146970
|
-
const match = "2.
|
|
146970
|
+
const match = "2.3.0".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
|
|
146971
146971
|
return match ? match[0] : undefined;
|
|
146972
146972
|
});
|
|
146973
146973
|
buildEnvContext = memoize_default(async () => {
|
|
@@ -147007,9 +147007,9 @@ var init_metadata = __esm(() => {
|
|
|
147007
147007
|
isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
|
|
147008
147008
|
isClaudeCodeAction: isEnvTruthy(process.env.CLAUDE_CODE_ACTION),
|
|
147009
147009
|
isClaudeAiAuth: isClaudeAISubscriber(),
|
|
147010
|
-
version: "2.
|
|
147010
|
+
version: "2.3.0",
|
|
147011
147011
|
versionBase: getVersionBase(),
|
|
147012
|
-
buildTime: "2026-05-
|
|
147012
|
+
buildTime: "2026-05-10T17:25:06.612Z",
|
|
147013
147013
|
deploymentEnvironment: env3.detectDeploymentEnvironment(),
|
|
147014
147014
|
...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
|
|
147015
147015
|
githubEventName: process.env.GITHUB_EVENT_NAME,
|
|
@@ -179551,7 +179551,7 @@ function getTelemetryAttributes() {
|
|
|
179551
179551
|
attributes["session.id"] = sessionId;
|
|
179552
179552
|
}
|
|
179553
179553
|
if (shouldIncludeAttribute("OTEL_METRICS_INCLUDE_VERSION")) {
|
|
179554
|
-
attributes["app.version"] = "2.
|
|
179554
|
+
attributes["app.version"] = "2.3.0";
|
|
179555
179555
|
}
|
|
179556
179556
|
const oauthAccount = getOauthAccountInfo();
|
|
179557
179557
|
if (oauthAccount) {
|
|
@@ -241839,7 +241839,7 @@ function getInstallationEnv() {
|
|
|
241839
241839
|
return;
|
|
241840
241840
|
}
|
|
241841
241841
|
function getClaudeCodeVersion() {
|
|
241842
|
-
return "2.
|
|
241842
|
+
return "2.3.0";
|
|
241843
241843
|
}
|
|
241844
241844
|
async function getInstalledVSCodeExtensionVersion(command) {
|
|
241845
241845
|
const { stdout } = await execFileNoThrow(command, ["--list-extensions", "--show-versions"], {
|
|
@@ -247113,7 +247113,7 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
|
|
|
247113
247113
|
const client4 = new Client({
|
|
247114
247114
|
name: "localclawd",
|
|
247115
247115
|
title: "localclawd",
|
|
247116
|
-
version: "2.
|
|
247116
|
+
version: "2.3.0",
|
|
247117
247117
|
description: "local-first AI coding tool",
|
|
247118
247118
|
websiteUrl: PRODUCT_URL
|
|
247119
247119
|
}, {
|
|
@@ -247455,7 +247455,7 @@ var init_client9 = __esm(() => {
|
|
|
247455
247455
|
const client4 = new Client({
|
|
247456
247456
|
name: "localclawd",
|
|
247457
247457
|
title: "localclawd",
|
|
247458
|
-
version: "2.
|
|
247458
|
+
version: "2.3.0",
|
|
247459
247459
|
description: "local-first AI coding tool",
|
|
247460
247460
|
websiteUrl: PRODUCT_URL
|
|
247461
247461
|
}, {
|
|
@@ -261854,7 +261854,7 @@ function computeFingerprint(messageText, version) {
|
|
|
261854
261854
|
}
|
|
261855
261855
|
function computeFingerprintFromMessages(messages) {
|
|
261856
261856
|
const firstMessageText = extractFirstMessageText(messages);
|
|
261857
|
-
return computeFingerprint(firstMessageText, "2.
|
|
261857
|
+
return computeFingerprint(firstMessageText, "2.3.0");
|
|
261858
261858
|
}
|
|
261859
261859
|
var FINGERPRINT_SALT = "59cf53e54c78";
|
|
261860
261860
|
var init_fingerprint = () => {};
|
|
@@ -261896,7 +261896,7 @@ async function sideQuery(opts) {
|
|
|
261896
261896
|
betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
|
|
261897
261897
|
}
|
|
261898
261898
|
const messageText = extractFirstUserMessageText(messages);
|
|
261899
|
-
const fingerprint = computeFingerprint(messageText, "2.
|
|
261899
|
+
const fingerprint = computeFingerprint(messageText, "2.3.0");
|
|
261900
261900
|
const attributionHeader = getAttributionHeader(fingerprint);
|
|
261901
261901
|
const systemBlocks = [
|
|
261902
261902
|
attributionHeader ? { type: "text", text: attributionHeader } : null,
|
|
@@ -282648,7 +282648,7 @@ var init_user = __esm(() => {
|
|
|
282648
282648
|
deviceId,
|
|
282649
282649
|
sessionId: getSessionId(),
|
|
282650
282650
|
email: getEmail(),
|
|
282651
|
-
appVersion: "2.
|
|
282651
|
+
appVersion: "2.3.0",
|
|
282652
282652
|
platform: getHostPlatformForAnalytics(),
|
|
282653
282653
|
organizationUuid,
|
|
282654
282654
|
accountUuid,
|
|
@@ -283713,7 +283713,7 @@ async function initializeBetaTracing(resource) {
|
|
|
283713
283713
|
});
|
|
283714
283714
|
logs.setGlobalLoggerProvider(loggerProvider);
|
|
283715
283715
|
setLoggerProvider(loggerProvider);
|
|
283716
|
-
const eventLogger = logs.getLogger("com.anthropic.claude_code.events", "2.
|
|
283716
|
+
const eventLogger = logs.getLogger("com.anthropic.claude_code.events", "2.3.0");
|
|
283717
283717
|
setEventLogger(eventLogger);
|
|
283718
283718
|
process.on("beforeExit", async () => {
|
|
283719
283719
|
await loggerProvider?.forceFlush();
|
|
@@ -283753,7 +283753,7 @@ async function initializeTelemetry() {
|
|
|
283753
283753
|
const platform2 = getPlatform();
|
|
283754
283754
|
const baseAttributes = {
|
|
283755
283755
|
[ATTR_SERVICE_NAME4]: "claude-code",
|
|
283756
|
-
[ATTR_SERVICE_VERSION4]: "2.
|
|
283756
|
+
[ATTR_SERVICE_VERSION4]: "2.3.0"
|
|
283757
283757
|
};
|
|
283758
283758
|
if (platform2 === "wsl") {
|
|
283759
283759
|
const wslVersion = getWslVersion();
|
|
@@ -283798,7 +283798,7 @@ async function initializeTelemetry() {
|
|
|
283798
283798
|
} catch {}
|
|
283799
283799
|
};
|
|
283800
283800
|
registerCleanup(shutdownTelemetry2);
|
|
283801
|
-
return meterProvider2.getMeter("com.anthropic.claude_code", "2.
|
|
283801
|
+
return meterProvider2.getMeter("com.anthropic.claude_code", "2.3.0");
|
|
283802
283802
|
}
|
|
283803
283803
|
const meterProvider = new MeterProvider4({
|
|
283804
283804
|
resource,
|
|
@@ -283818,7 +283818,7 @@ async function initializeTelemetry() {
|
|
|
283818
283818
|
});
|
|
283819
283819
|
logs.setGlobalLoggerProvider(loggerProvider);
|
|
283820
283820
|
setLoggerProvider(loggerProvider);
|
|
283821
|
-
const eventLogger = logs.getLogger("com.anthropic.claude_code.events", "2.
|
|
283821
|
+
const eventLogger = logs.getLogger("com.anthropic.claude_code.events", "2.3.0");
|
|
283822
283822
|
setEventLogger(eventLogger);
|
|
283823
283823
|
logForDebugging("[3P telemetry] Event logger set successfully");
|
|
283824
283824
|
process.on("beforeExit", async () => {
|
|
@@ -283880,7 +283880,7 @@ Current timeout: ${timeoutMs}ms
|
|
|
283880
283880
|
}
|
|
283881
283881
|
};
|
|
283882
283882
|
registerCleanup(shutdownTelemetry);
|
|
283883
|
-
return meterProvider.getMeter("com.anthropic.claude_code", "2.
|
|
283883
|
+
return meterProvider.getMeter("com.anthropic.claude_code", "2.3.0");
|
|
283884
283884
|
}
|
|
283885
283885
|
async function flushTelemetry() {
|
|
283886
283886
|
const meterProvider = getMeterProvider();
|
|
@@ -285070,7 +285070,7 @@ function detectLinuxGlobPatternWarnings() {
|
|
|
285070
285070
|
}
|
|
285071
285071
|
async function getDoctorDiagnostic() {
|
|
285072
285072
|
const installationType = await getCurrentInstallationType();
|
|
285073
|
-
const version = typeof MACRO !== "undefined" ? "2.
|
|
285073
|
+
const version = typeof MACRO !== "undefined" ? "2.3.0" : "unknown";
|
|
285074
285074
|
const installationPath = await getInstallationPath();
|
|
285075
285075
|
const invokedBinary = getInvokedBinary();
|
|
285076
285076
|
const multipleInstallations = await detectMultipleInstallations();
|
|
@@ -286011,8 +286011,8 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
286011
286011
|
const maxVersion = await getMaxVersion();
|
|
286012
286012
|
if (maxVersion && gt(version, maxVersion)) {
|
|
286013
286013
|
logForDebugging(`Native installer: maxVersion ${maxVersion} is set, capping update from ${version} to ${maxVersion}`);
|
|
286014
|
-
if (gte("2.
|
|
286015
|
-
logForDebugging(`Native installer: current version ${"2.
|
|
286014
|
+
if (gte("2.3.0", maxVersion)) {
|
|
286015
|
+
logForDebugging(`Native installer: current version ${"2.3.0"} is already at or above maxVersion ${maxVersion}, skipping update`);
|
|
286016
286016
|
logEvent("tengu_native_update_skipped_max_version", {
|
|
286017
286017
|
latency_ms: Date.now() - startTime,
|
|
286018
286018
|
max_version: maxVersion,
|
|
@@ -286023,7 +286023,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
286023
286023
|
version = maxVersion;
|
|
286024
286024
|
}
|
|
286025
286025
|
}
|
|
286026
|
-
if (!forceReinstall && version === "2.
|
|
286026
|
+
if (!forceReinstall && version === "2.3.0" && await versionIsAvailable(version) && await isPossibleLocalClawdBinary(executablePath)) {
|
|
286027
286027
|
logForDebugging(`Found ${version} at ${executablePath}, skipping install`);
|
|
286028
286028
|
logEvent("tengu_native_update_complete", {
|
|
286029
286029
|
latency_ms: Date.now() - startTime,
|
|
@@ -332298,7 +332298,7 @@ function getAnthropicEnvMetadata() {
|
|
|
332298
332298
|
function getBuildAgeMinutes() {
|
|
332299
332299
|
if (false)
|
|
332300
332300
|
;
|
|
332301
|
-
const buildTime = new Date("2026-05-
|
|
332301
|
+
const buildTime = new Date("2026-05-10T17:25:06.612Z").getTime();
|
|
332302
332302
|
if (isNaN(buildTime))
|
|
332303
332303
|
return;
|
|
332304
332304
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -360327,7 +360327,7 @@ function Feedback({
|
|
|
360327
360327
|
platform: env3.platform,
|
|
360328
360328
|
gitRepo: envInfo.isGit,
|
|
360329
360329
|
terminal: env3.terminal,
|
|
360330
|
-
version: "2.
|
|
360330
|
+
version: "2.3.0",
|
|
360331
360331
|
transcript: normalizeMessagesForAPI(messages),
|
|
360332
360332
|
errors: sanitizedErrors,
|
|
360333
360333
|
lastApiRequest: getLastAPIRequest(),
|
|
@@ -360519,7 +360519,7 @@ function Feedback({
|
|
|
360519
360519
|
", ",
|
|
360520
360520
|
env3.terminal,
|
|
360521
360521
|
", v",
|
|
360522
|
-
"2.
|
|
360522
|
+
"2.3.0"
|
|
360523
360523
|
]
|
|
360524
360524
|
}, undefined, true, undefined, this)
|
|
360525
360525
|
]
|
|
@@ -360625,7 +360625,7 @@ ${sanitizedDescription}
|
|
|
360625
360625
|
` + `**Environment Info**
|
|
360626
360626
|
` + `- Platform: ${env3.platform}
|
|
360627
360627
|
` + `- Terminal: ${env3.terminal}
|
|
360628
|
-
` + `- Version: ${"2.
|
|
360628
|
+
` + `- Version: ${"2.3.0"}
|
|
360629
360629
|
` + `- Feedback ID: ${feedbackId}
|
|
360630
360630
|
` + `
|
|
360631
360631
|
**Errors**
|
|
@@ -363234,7 +363234,7 @@ function buildPrimarySection() {
|
|
|
363234
363234
|
}, undefined, false, undefined, this);
|
|
363235
363235
|
return [{
|
|
363236
363236
|
label: "Version",
|
|
363237
|
-
value: "2.
|
|
363237
|
+
value: "2.3.0"
|
|
363238
363238
|
}, {
|
|
363239
363239
|
label: "Session name",
|
|
363240
363240
|
value: nameValue
|
|
@@ -367915,7 +367915,7 @@ function Config({
|
|
|
367915
367915
|
}
|
|
367916
367916
|
}, undefined, false, undefined, this)
|
|
367917
367917
|
}, undefined, false, undefined, this) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsx_dev_runtime176.jsxDEV(ChannelDowngradeDialog, {
|
|
367918
|
-
currentVersion: "2.
|
|
367918
|
+
currentVersion: "2.3.0",
|
|
367919
367919
|
onChoice: (choice) => {
|
|
367920
367920
|
setShowSubmenu(null);
|
|
367921
367921
|
setTabsHidden(false);
|
|
@@ -367927,7 +367927,7 @@ function Config({
|
|
|
367927
367927
|
autoUpdatesChannel: "stable"
|
|
367928
367928
|
};
|
|
367929
367929
|
if (choice === "stay") {
|
|
367930
|
-
newSettings.minimumVersion = "2.
|
|
367930
|
+
newSettings.minimumVersion = "2.3.0";
|
|
367931
367931
|
}
|
|
367932
367932
|
updateSettingsForSource("userSettings", newSettings);
|
|
367933
367933
|
setSettingsData((prev_27) => ({
|
|
@@ -375163,6 +375163,172 @@ var init_telegramKill = __esm(() => {
|
|
|
375163
375163
|
init_debug();
|
|
375164
375164
|
});
|
|
375165
375165
|
|
|
375166
|
+
// src/services/telegram/telegramAgent.ts
|
|
375167
|
+
var exports_telegramAgent = {};
|
|
375168
|
+
__export(exports_telegramAgent, {
|
|
375169
|
+
respondToTelegramMessage: () => respondToTelegramMessage,
|
|
375170
|
+
recordMainAgentActivity: () => recordMainAgentActivity,
|
|
375171
|
+
clearTelegramHistory: () => clearTelegramHistory
|
|
375172
|
+
});
|
|
375173
|
+
import { mkdir as mkdir37, readFile as readFile44, writeFile as writeFile39 } from "fs/promises";
|
|
375174
|
+
import { homedir as homedir25 } from "os";
|
|
375175
|
+
import { join as join116, dirname as dirname48 } from "path";
|
|
375176
|
+
function recordMainAgentActivity(line) {
|
|
375177
|
+
if (!line.trim())
|
|
375178
|
+
return;
|
|
375179
|
+
_activityLog.push(line.trim().slice(0, 200));
|
|
375180
|
+
if (_activityLog.length > 8)
|
|
375181
|
+
_activityLog = _activityLog.slice(-8);
|
|
375182
|
+
}
|
|
375183
|
+
async function loadHistory() {
|
|
375184
|
+
if (_historyLoaded)
|
|
375185
|
+
return;
|
|
375186
|
+
_historyLoaded = true;
|
|
375187
|
+
try {
|
|
375188
|
+
const raw = await readFile44(HISTORY_FILE, "utf-8");
|
|
375189
|
+
const parsed = JSON.parse(raw);
|
|
375190
|
+
if (Array.isArray(parsed))
|
|
375191
|
+
_history = parsed.slice(-HISTORY_LIMIT);
|
|
375192
|
+
} catch {}
|
|
375193
|
+
}
|
|
375194
|
+
async function persistHistory() {
|
|
375195
|
+
try {
|
|
375196
|
+
await mkdir37(dirname48(HISTORY_FILE), { recursive: true });
|
|
375197
|
+
await writeFile39(HISTORY_FILE, JSON.stringify(_history.slice(-HISTORY_LIMIT)), "utf-8");
|
|
375198
|
+
} catch (e) {
|
|
375199
|
+
logForDebugging(`[telegram-agent] persist history failed: ${e}`, { level: "warn" });
|
|
375200
|
+
}
|
|
375201
|
+
}
|
|
375202
|
+
function buildSystemPrompt() {
|
|
375203
|
+
const queueLen = getCommandQueueLength();
|
|
375204
|
+
const queueSnap = getCommandQueueSnapshot();
|
|
375205
|
+
const queuePreview = queueSnap.slice(0, 3).map((q2) => `- ${(q2.value ?? "").slice(0, 80)}`).join(`
|
|
375206
|
+
`) || " (none)";
|
|
375207
|
+
const recent = _activityLog.length > 0 ? _activityLog.slice(-5).join(`
|
|
375208
|
+
`) : "(no recent updates)";
|
|
375209
|
+
return [
|
|
375210
|
+
"You are the Telegram assistant for localclawd, a local-first coding agent.",
|
|
375211
|
+
"",
|
|
375212
|
+
"You are a SEPARATE agent from the MAIN agent. The MAIN agent runs in the user's",
|
|
375213
|
+
"terminal and does the actual coding. Your job is to chat with the user over Telegram",
|
|
375214
|
+
"and, when appropriate, forward instructions to the MAIN agent.",
|
|
375215
|
+
"",
|
|
375216
|
+
"Capabilities — decide which to use for THIS message:",
|
|
375217
|
+
" • reply: always required; brief, conversational, helpful",
|
|
375218
|
+
" • action=prompt: enqueue a NEW task for the main agent (it picks it up after current work)",
|
|
375219
|
+
" • action=steer: INTERRUPT the main agent with urgent new instructions (use sparingly)",
|
|
375220
|
+
" • action=none: just chat — questions, status checks, acknowledgements",
|
|
375221
|
+
"",
|
|
375222
|
+
"Rules:",
|
|
375223
|
+
" • Always reply to the user, even if you also enqueue/steer.",
|
|
375224
|
+
' • If the user asks "what are you working on" or "status", answer from the snapshot below.',
|
|
375225
|
+
" • If the user gives a coding task, default to action=prompt.",
|
|
375226
|
+
' • If the user says "stop", "wait", "actually do X instead", use action=steer.',
|
|
375227
|
+
" • If the user is just chatting / clarifying, action=none.",
|
|
375228
|
+
"",
|
|
375229
|
+
"Strict output format (no extra text outside these tags):",
|
|
375230
|
+
"<reply>",
|
|
375231
|
+
"your reply to the user — short, no markdown headers",
|
|
375232
|
+
"</reply>",
|
|
375233
|
+
'<action type="prompt|steer|none">',
|
|
375234
|
+
"exact instruction text for the main agent (omit body when type=none)",
|
|
375235
|
+
"</action>",
|
|
375236
|
+
"",
|
|
375237
|
+
"────── MAIN AGENT SNAPSHOT ──────",
|
|
375238
|
+
`Queued tasks: ${queueLen}`,
|
|
375239
|
+
queuePreview,
|
|
375240
|
+
"",
|
|
375241
|
+
"Recent activity:",
|
|
375242
|
+
recent,
|
|
375243
|
+
"─────────────────────────────────"
|
|
375244
|
+
].join(`
|
|
375245
|
+
`);
|
|
375246
|
+
}
|
|
375247
|
+
async function callLLM(systemPrompt, history) {
|
|
375248
|
+
try {
|
|
375249
|
+
const baseUrl = getLocalLLMBaseUrl();
|
|
375250
|
+
const model = getLocalLLMModel();
|
|
375251
|
+
const apiKey = getLocalLLMApiKey();
|
|
375252
|
+
if (!baseUrl || !model)
|
|
375253
|
+
return null;
|
|
375254
|
+
const messages = [
|
|
375255
|
+
{ role: "system", content: systemPrompt },
|
|
375256
|
+
...history.slice(-HISTORY_LIMIT)
|
|
375257
|
+
];
|
|
375258
|
+
const res = await fetch(`${baseUrl.replace(/\/$/, "")}/chat/completions`, {
|
|
375259
|
+
method: "POST",
|
|
375260
|
+
headers: {
|
|
375261
|
+
"Content-Type": "application/json",
|
|
375262
|
+
...apiKey ? { Authorization: `Bearer ${apiKey}` } : {}
|
|
375263
|
+
},
|
|
375264
|
+
body: JSON.stringify({
|
|
375265
|
+
model,
|
|
375266
|
+
messages,
|
|
375267
|
+
max_tokens: 500,
|
|
375268
|
+
temperature: 0.3
|
|
375269
|
+
}),
|
|
375270
|
+
signal: AbortSignal.timeout(60000)
|
|
375271
|
+
});
|
|
375272
|
+
if (!res.ok) {
|
|
375273
|
+
logForDebugging(`[telegram-agent] LLM HTTP ${res.status}`, { level: "warn" });
|
|
375274
|
+
return null;
|
|
375275
|
+
}
|
|
375276
|
+
const data = await res.json();
|
|
375277
|
+
return data.choices?.[0]?.message?.content ?? null;
|
|
375278
|
+
} catch (e) {
|
|
375279
|
+
logForDebugging(`[telegram-agent] LLM call failed: ${e}`, { level: "warn" });
|
|
375280
|
+
return null;
|
|
375281
|
+
}
|
|
375282
|
+
}
|
|
375283
|
+
function parseResponse(raw) {
|
|
375284
|
+
const replyMatch = raw.match(/<reply>([\s\S]*?)<\/reply>/i);
|
|
375285
|
+
const actionMatch = raw.match(/<action\s+type="(prompt|steer|none)"\s*>([\s\S]*?)<\/action>/i);
|
|
375286
|
+
const reply = (replyMatch?.[1] ?? raw).trim();
|
|
375287
|
+
const actionType = actionMatch?.[1] ?? "none";
|
|
375288
|
+
const actionText = (actionMatch?.[2] ?? "").trim();
|
|
375289
|
+
return { reply, actionType, actionText };
|
|
375290
|
+
}
|
|
375291
|
+
async function respondToTelegramMessage(userText) {
|
|
375292
|
+
await loadHistory();
|
|
375293
|
+
_history.push({ role: "user", content: userText });
|
|
375294
|
+
const systemPrompt = buildSystemPrompt();
|
|
375295
|
+
const raw = await callLLM(systemPrompt, _history);
|
|
375296
|
+
if (!raw) {
|
|
375297
|
+
const fallback = "I couldn't reach the model. Forwarding your message to the main agent.";
|
|
375298
|
+
_history.push({ role: "assistant", content: fallback });
|
|
375299
|
+
await persistHistory();
|
|
375300
|
+
enqueue({ value: userText, mode: "prompt", priority: "next" });
|
|
375301
|
+
return { reply: fallback, action: { type: "prompt", text: userText } };
|
|
375302
|
+
}
|
|
375303
|
+
const parsed = parseResponse(raw);
|
|
375304
|
+
_history.push({ role: "assistant", content: raw });
|
|
375305
|
+
if (_history.length > HISTORY_LIMIT)
|
|
375306
|
+
_history = _history.slice(-HISTORY_LIMIT);
|
|
375307
|
+
await persistHistory();
|
|
375308
|
+
if (parsed.actionType === "prompt" && parsed.actionText) {
|
|
375309
|
+
enqueue({ value: parsed.actionText, mode: "prompt", priority: "next" });
|
|
375310
|
+
} else if (parsed.actionType === "steer" && parsed.actionText) {
|
|
375311
|
+
enqueue({ value: parsed.actionText, mode: "prompt", priority: "now" });
|
|
375312
|
+
}
|
|
375313
|
+
return {
|
|
375314
|
+
reply: parsed.reply || "Got it.",
|
|
375315
|
+
action: { type: parsed.actionType, text: parsed.actionText }
|
|
375316
|
+
};
|
|
375317
|
+
}
|
|
375318
|
+
function clearTelegramHistory() {
|
|
375319
|
+
_history = [];
|
|
375320
|
+
persistHistory();
|
|
375321
|
+
}
|
|
375322
|
+
var HISTORY_LIMIT = 24, HISTORY_FILE, _history, _historyLoaded = false, _activityLog;
|
|
375323
|
+
var init_telegramAgent = __esm(() => {
|
|
375324
|
+
init_debug();
|
|
375325
|
+
init_providers();
|
|
375326
|
+
init_messageQueueManager();
|
|
375327
|
+
HISTORY_FILE = join116(homedir25(), ".claude", "telegram", "history.json");
|
|
375328
|
+
_history = [];
|
|
375329
|
+
_activityLog = [];
|
|
375330
|
+
});
|
|
375331
|
+
|
|
375166
375332
|
// src/services/director/directorMemory.ts
|
|
375167
375333
|
function createEmptyState() {
|
|
375168
375334
|
return {
|
|
@@ -375175,14 +375341,14 @@ function createEmptyState() {
|
|
|
375175
375341
|
}
|
|
375176
375342
|
|
|
375177
375343
|
// src/services/director/directorMemoryOps.ts
|
|
375178
|
-
import { mkdir as
|
|
375179
|
-
import { basename as basename36, join as
|
|
375344
|
+
import { mkdir as mkdir38, readdir as readdir24, readFile as readFile45, stat as stat39, writeFile as writeFile40 } from "fs/promises";
|
|
375345
|
+
import { basename as basename36, join as join117, resolve as resolve37 } from "path";
|
|
375180
375346
|
function setDirectorProjectRoot(projectPath) {
|
|
375181
|
-
_projectStateDir =
|
|
375347
|
+
_projectStateDir = join117(projectPath, ".localclawd");
|
|
375182
375348
|
}
|
|
375183
375349
|
function getStatePath() {
|
|
375184
375350
|
if (_projectStateDir)
|
|
375185
|
-
return
|
|
375351
|
+
return join117(_projectStateDir, "director-memory.json");
|
|
375186
375352
|
return null;
|
|
375187
375353
|
}
|
|
375188
375354
|
async function loadDirectorState() {
|
|
@@ -375190,7 +375356,7 @@ async function loadDirectorState() {
|
|
|
375190
375356
|
if (!path12)
|
|
375191
375357
|
return createEmptyState();
|
|
375192
375358
|
try {
|
|
375193
|
-
const raw = await
|
|
375359
|
+
const raw = await readFile45(path12, "utf-8");
|
|
375194
375360
|
const parsed = JSON.parse(raw);
|
|
375195
375361
|
if (parsed.version !== 1)
|
|
375196
375362
|
return createEmptyState();
|
|
@@ -375202,16 +375368,16 @@ async function loadDirectorState() {
|
|
|
375202
375368
|
async function saveDirectorState(state) {
|
|
375203
375369
|
if (!_projectStateDir)
|
|
375204
375370
|
return;
|
|
375205
|
-
await
|
|
375206
|
-
await
|
|
375371
|
+
await mkdir38(_projectStateDir, { recursive: true });
|
|
375372
|
+
await writeFile40(join117(_projectStateDir, "director-memory.json"), JSON.stringify(state, null, 2), "utf-8");
|
|
375207
375373
|
}
|
|
375208
375374
|
function slugify4(path12) {
|
|
375209
375375
|
return basename36(resolve37(path12)).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
375210
375376
|
}
|
|
375211
375377
|
async function detectGitRemote(projectPath) {
|
|
375212
375378
|
try {
|
|
375213
|
-
const configPath =
|
|
375214
|
-
const config2 = await
|
|
375379
|
+
const configPath = join117(projectPath, ".git", "config");
|
|
375380
|
+
const config2 = await readFile45(configPath, "utf-8");
|
|
375215
375381
|
const match = config2.match(/\[remote "origin"\][^[]*url\s*=\s*(.+)/m);
|
|
375216
375382
|
return match?.[1]?.trim();
|
|
375217
375383
|
} catch {
|
|
@@ -375220,12 +375386,12 @@ async function detectGitRemote(projectPath) {
|
|
|
375220
375386
|
}
|
|
375221
375387
|
async function detectDescription(projectPath) {
|
|
375222
375388
|
try {
|
|
375223
|
-
const pkg = JSON.parse(await
|
|
375389
|
+
const pkg = JSON.parse(await readFile45(join117(projectPath, "package.json"), "utf-8"));
|
|
375224
375390
|
if (pkg.description)
|
|
375225
375391
|
return pkg.description;
|
|
375226
375392
|
} catch {}
|
|
375227
375393
|
try {
|
|
375228
|
-
const readme = await
|
|
375394
|
+
const readme = await readFile45(join117(projectPath, "README.md"), "utf-8");
|
|
375229
375395
|
const firstLine = readme.split(`
|
|
375230
375396
|
`).find((l) => l.trim() && !l.startsWith("#"));
|
|
375231
375397
|
if (firstLine)
|
|
@@ -375279,9 +375445,9 @@ async function indexProjectFiles(state, projectId, projectPath) {
|
|
|
375279
375445
|
const absPath = resolve37(projectPath);
|
|
375280
375446
|
for (const name of KEY_FILES) {
|
|
375281
375447
|
try {
|
|
375282
|
-
const filePath =
|
|
375448
|
+
const filePath = join117(absPath, name);
|
|
375283
375449
|
await stat39(filePath);
|
|
375284
|
-
const content = await
|
|
375450
|
+
const content = await readFile45(filePath, "utf-8");
|
|
375285
375451
|
const firstLine = content.split(`
|
|
375286
375452
|
`).find((l) => l.trim())?.trim() ?? name;
|
|
375287
375453
|
entries.push({
|
|
@@ -375294,7 +375460,7 @@ async function indexProjectFiles(state, projectId, projectPath) {
|
|
|
375294
375460
|
} catch {}
|
|
375295
375461
|
}
|
|
375296
375462
|
try {
|
|
375297
|
-
const srcDir =
|
|
375463
|
+
const srcDir = join117(absPath, "src");
|
|
375298
375464
|
const srcFiles = await readdir24(srcDir);
|
|
375299
375465
|
for (const file of srcFiles.slice(0, 30)) {
|
|
375300
375466
|
if (!file.endsWith(".ts") && !file.endsWith(".tsx") && !file.endsWith(".js") && !file.endsWith(".py") && !file.endsWith(".rs") && !file.endsWith(".go"))
|
|
@@ -375717,19 +375883,19 @@ async function initSlack() {
|
|
|
375717
375883
|
let userId = process.env.SLACK_USER_ID;
|
|
375718
375884
|
if (!token || !channelId) {
|
|
375719
375885
|
try {
|
|
375720
|
-
const { readFile:
|
|
375721
|
-
const { join:
|
|
375722
|
-
const { homedir:
|
|
375886
|
+
const { readFile: readFile46 } = await import("fs/promises");
|
|
375887
|
+
const { join: join118 } = await import("path");
|
|
375888
|
+
const { homedir: homedir26 } = await import("os");
|
|
375723
375889
|
const { getClaudeConfigHomeDir: getClaudeConfigHomeDir3 } = await Promise.resolve().then(() => (init_envUtils(), exports_envUtils));
|
|
375724
|
-
const newPath =
|
|
375725
|
-
const legacyPath =
|
|
375890
|
+
const newPath = join118(getClaudeConfigHomeDir3(), "slack.json");
|
|
375891
|
+
const legacyPath = join118(homedir26(), ".claude", "slack.json");
|
|
375726
375892
|
let configPath = newPath;
|
|
375727
375893
|
try {
|
|
375728
375894
|
await (await import("fs/promises")).stat(newPath);
|
|
375729
375895
|
} catch {
|
|
375730
375896
|
configPath = legacyPath;
|
|
375731
375897
|
}
|
|
375732
|
-
const raw = await
|
|
375898
|
+
const raw = await readFile46(configPath, "utf-8");
|
|
375733
375899
|
const config2 = JSON.parse(raw);
|
|
375734
375900
|
if (config2.token && config2.channelId) {
|
|
375735
375901
|
token = config2.token;
|
|
@@ -376037,19 +376203,19 @@ async function initDiscord() {
|
|
|
376037
376203
|
let userId = process.env.DISCORD_USER_ID;
|
|
376038
376204
|
if (!token || !channelId) {
|
|
376039
376205
|
try {
|
|
376040
|
-
const { readFile:
|
|
376041
|
-
const { join:
|
|
376042
|
-
const { homedir:
|
|
376206
|
+
const { readFile: readFile46 } = await import("fs/promises");
|
|
376207
|
+
const { join: join118 } = await import("path");
|
|
376208
|
+
const { homedir: homedir26 } = await import("os");
|
|
376043
376209
|
const { getClaudeConfigHomeDir: getClaudeConfigHomeDir3 } = await Promise.resolve().then(() => (init_envUtils(), exports_envUtils));
|
|
376044
|
-
const newPath =
|
|
376045
|
-
const legacyPath =
|
|
376210
|
+
const newPath = join118(getClaudeConfigHomeDir3(), "discord.json");
|
|
376211
|
+
const legacyPath = join118(homedir26(), ".claude", "discord.json");
|
|
376046
376212
|
let configPath = newPath;
|
|
376047
376213
|
try {
|
|
376048
376214
|
await (await import("fs/promises")).stat(newPath);
|
|
376049
376215
|
} catch {
|
|
376050
376216
|
configPath = legacyPath;
|
|
376051
376217
|
}
|
|
376052
|
-
const raw = await
|
|
376218
|
+
const raw = await readFile46(configPath, "utf-8");
|
|
376053
376219
|
const config2 = JSON.parse(raw);
|
|
376054
376220
|
if (config2.token && config2.channelId) {
|
|
376055
376221
|
token = config2.token;
|
|
@@ -376435,11 +376601,11 @@ __export(exports_scheduler, {
|
|
|
376435
376601
|
getSchedules: () => getSchedules,
|
|
376436
376602
|
addSchedule: () => addSchedule
|
|
376437
376603
|
});
|
|
376438
|
-
import { mkdir as
|
|
376439
|
-
import { join as
|
|
376604
|
+
import { mkdir as mkdir39, readFile as readFile46, writeFile as writeFile41 } from "fs/promises";
|
|
376605
|
+
import { join as join118 } from "path";
|
|
376440
376606
|
async function loadSchedules() {
|
|
376441
376607
|
try {
|
|
376442
|
-
const raw = await
|
|
376608
|
+
const raw = await readFile46(SCHEDULES_PATH, "utf-8");
|
|
376443
376609
|
const parsed = JSON.parse(raw);
|
|
376444
376610
|
if (parsed.version !== 1)
|
|
376445
376611
|
return { version: 1, schedules: [] };
|
|
@@ -376449,8 +376615,8 @@ async function loadSchedules() {
|
|
|
376449
376615
|
}
|
|
376450
376616
|
}
|
|
376451
376617
|
async function saveSchedules(file) {
|
|
376452
|
-
await
|
|
376453
|
-
await
|
|
376618
|
+
await mkdir39(getClaudeConfigHomeDir(), { recursive: true });
|
|
376619
|
+
await writeFile41(SCHEDULES_PATH, JSON.stringify(file, null, 2), "utf-8");
|
|
376454
376620
|
}
|
|
376455
376621
|
function nextRunTime(expr, from = Date.now()) {
|
|
376456
376622
|
const trimmed = expr.trim().toLowerCase();
|
|
@@ -376654,7 +376820,7 @@ var SCHEDULES_PATH, TICK_INTERVAL_MS = 30000, _tickTimer = null;
|
|
|
376654
376820
|
var init_scheduler = __esm(() => {
|
|
376655
376821
|
init_debug();
|
|
376656
376822
|
init_envUtils();
|
|
376657
|
-
SCHEDULES_PATH =
|
|
376823
|
+
SCHEDULES_PATH = join118(getClaudeConfigHomeDir(), "schedules.json");
|
|
376658
376824
|
});
|
|
376659
376825
|
|
|
376660
376826
|
// src/services/telegram/telegramBot.ts
|
|
@@ -376693,6 +376859,10 @@ function isTelegramActive() {
|
|
|
376693
376859
|
async function sendTelegramMessage(text) {
|
|
376694
376860
|
if (!_polling4 || !_chatId)
|
|
376695
376861
|
return;
|
|
376862
|
+
try {
|
|
376863
|
+
const { recordMainAgentActivity: recordMainAgentActivity2 } = await Promise.resolve().then(() => (init_telegramAgent(), exports_telegramAgent));
|
|
376864
|
+
recordMainAgentActivity2(text);
|
|
376865
|
+
} catch {}
|
|
376696
376866
|
const chunks = chunkText4(text, 4000);
|
|
376697
376867
|
for (const chunk of chunks) {
|
|
376698
376868
|
try {
|
|
@@ -376785,19 +376955,19 @@ async function initTelegram() {
|
|
|
376785
376955
|
let chatIdStr = process.env.TELEGRAM_CHAT_ID;
|
|
376786
376956
|
if (!token || !chatIdStr) {
|
|
376787
376957
|
try {
|
|
376788
|
-
const { readFile:
|
|
376789
|
-
const { join:
|
|
376790
|
-
const { homedir:
|
|
376958
|
+
const { readFile: readFile47, stat: stat40 } = await import("fs/promises");
|
|
376959
|
+
const { join: join119 } = await import("path");
|
|
376960
|
+
const { homedir: homedir26 } = await import("os");
|
|
376791
376961
|
const { getClaudeConfigHomeDir: getClaudeConfigHomeDir3 } = await Promise.resolve().then(() => (init_envUtils(), exports_envUtils));
|
|
376792
376962
|
const { getOriginalCwd: getOriginalCwd2 } = await Promise.resolve().then(() => (init_state(), exports_state));
|
|
376793
376963
|
const candidates = [];
|
|
376794
376964
|
try {
|
|
376795
376965
|
const cwd2 = getOriginalCwd2();
|
|
376796
376966
|
if (cwd2)
|
|
376797
|
-
candidates.push(
|
|
376967
|
+
candidates.push(join119(cwd2, ".localclawd", "telegram.json"));
|
|
376798
376968
|
} catch {}
|
|
376799
|
-
candidates.push(
|
|
376800
|
-
candidates.push(
|
|
376969
|
+
candidates.push(join119(getClaudeConfigHomeDir3(), "telegram.json"));
|
|
376970
|
+
candidates.push(join119(homedir26(), ".claude", "telegram.json"));
|
|
376801
376971
|
let configPath = null;
|
|
376802
376972
|
for (const p of candidates) {
|
|
376803
376973
|
try {
|
|
@@ -376808,7 +376978,7 @@ async function initTelegram() {
|
|
|
376808
376978
|
}
|
|
376809
376979
|
if (!configPath)
|
|
376810
376980
|
throw new Error("no telegram config found");
|
|
376811
|
-
const raw = await
|
|
376981
|
+
const raw = await readFile47(configPath, "utf-8");
|
|
376812
376982
|
const config2 = JSON.parse(raw);
|
|
376813
376983
|
logForDebugging(`[telegram] using config from ${configPath}`);
|
|
376814
376984
|
if (config2.token && config2.chatId) {
|
|
@@ -376913,12 +377083,18 @@ ${text}`;
|
|
|
376913
377083
|
}
|
|
376914
377084
|
if (text === "/start") {
|
|
376915
377085
|
sendTelegramMessage(`*localclawd ready*
|
|
376916
|
-
|
|
377086
|
+
I'm a separate Telegram agent — I chat with you and steer the main coding agent when needed.
|
|
376917
377087
|
|
|
376918
377088
|
Commands:
|
|
376919
377089
|
/stop — stop current task
|
|
376920
377090
|
/kill — kill all instances
|
|
376921
|
-
/status — show current status
|
|
377091
|
+
/status — show current status
|
|
377092
|
+
/reset — clear Telegram conversation history`);
|
|
377093
|
+
return;
|
|
377094
|
+
}
|
|
377095
|
+
if (text === "/reset") {
|
|
377096
|
+
clearTelegramHistory();
|
|
377097
|
+
sendTelegramMessage("Telegram conversation history cleared. (Main agent context is unchanged.)");
|
|
376922
377098
|
return;
|
|
376923
377099
|
}
|
|
376924
377100
|
if (text === "/status") {
|
|
@@ -376941,9 +377117,10 @@ ${text2}`);
|
|
|
376941
377117
|
` + `/kill — kill all instances
|
|
376942
377118
|
` + `/status — project status
|
|
376943
377119
|
` + `/schedules — list scheduled jobs
|
|
377120
|
+
` + `/reset — clear Telegram chat history
|
|
376944
377121
|
` + `/help — this message
|
|
376945
377122
|
|
|
376946
|
-
` + "Any other message is
|
|
377123
|
+
` + "Any other message is handled by a separate Telegram agent that talks to you and steers the main coding agent when needed.");
|
|
376947
377124
|
return;
|
|
376948
377125
|
}
|
|
376949
377126
|
sendTelegramMessage(`Unknown command: ${text}
|
|
@@ -376951,13 +377128,31 @@ ${text2}`);
|
|
|
376951
377128
|
Available: /stop /kill /status /schedules /help`);
|
|
376952
377129
|
return;
|
|
376953
377130
|
}
|
|
376954
|
-
|
|
377131
|
+
startTypingIndicator();
|
|
376955
377132
|
try {
|
|
376956
|
-
const {
|
|
376957
|
-
|
|
377133
|
+
const { reply, action: action2 } = await respondToTelegramMessage(text);
|
|
377134
|
+
let suffix = "";
|
|
377135
|
+
if (action2.type === "prompt")
|
|
377136
|
+
suffix = `
|
|
377137
|
+
|
|
377138
|
+
_(forwarded to main agent)_`;
|
|
377139
|
+
else if (action2.type === "steer")
|
|
377140
|
+
suffix = `
|
|
377141
|
+
|
|
377142
|
+
_(steering main agent)_`;
|
|
377143
|
+
await sendTelegramMessage(reply + suffix);
|
|
376958
377144
|
} catch (e) {
|
|
376959
|
-
|
|
376960
|
-
|
|
377145
|
+
logForDebugging(`[telegram] agent failed: ${e}`, { level: "warn" });
|
|
377146
|
+
try {
|
|
377147
|
+
const { enqueue: enqueue2 } = await Promise.resolve().then(() => (init_messageQueueManager(), exports_messageQueueManager));
|
|
377148
|
+
enqueue2({ value: text, mode: "prompt", priority: "next" });
|
|
377149
|
+
await sendTelegramMessage("I had trouble responding, but I forwarded your message to the main agent.");
|
|
377150
|
+
} catch (e2) {
|
|
377151
|
+
_queue4.push(text);
|
|
377152
|
+
logForDebugging(`[telegram] Failed to enqueue fallback: ${e2}`);
|
|
377153
|
+
}
|
|
377154
|
+
} finally {
|
|
377155
|
+
stopTypingIndicator();
|
|
376961
377156
|
}
|
|
376962
377157
|
for (const cb of _listeners2) {
|
|
376963
377158
|
try {
|
|
@@ -377005,6 +377200,7 @@ var init_telegramBot = __esm(() => {
|
|
|
377005
377200
|
init_debug();
|
|
377006
377201
|
init_telegramSignals();
|
|
377007
377202
|
init_telegramKill();
|
|
377203
|
+
init_telegramAgent();
|
|
377008
377204
|
_queue4 = [];
|
|
377009
377205
|
_listeners2 = [];
|
|
377010
377206
|
});
|
|
@@ -377248,11 +377444,11 @@ function logKgCrash(error5, context7) {
|
|
|
377248
377444
|
const msg = error5 instanceof Error ? error5.stack ?? error5.message : String(error5);
|
|
377249
377445
|
try {
|
|
377250
377446
|
const { appendFileSync: appendFileSync3, mkdirSync: mkdirSync6 } = __require("fs");
|
|
377251
|
-
const { homedir:
|
|
377252
|
-
const { join:
|
|
377253
|
-
const dir =
|
|
377447
|
+
const { homedir: homedir26 } = __require("os");
|
|
377448
|
+
const { join: join119 } = __require("path");
|
|
377449
|
+
const dir = join119(homedir26(), ".claude");
|
|
377254
377450
|
mkdirSync6(dir, { recursive: true });
|
|
377255
|
-
appendFileSync3(
|
|
377451
|
+
appendFileSync3(join119(dir, "crash.log"), `[${new Date().toISOString()}] keepgoing ${context7}: ${msg}
|
|
377256
377452
|
`);
|
|
377257
377453
|
} catch {}
|
|
377258
377454
|
}
|
|
@@ -377428,8 +377624,8 @@ var exports_telegram = {};
|
|
|
377428
377624
|
__export(exports_telegram, {
|
|
377429
377625
|
call: () => call23
|
|
377430
377626
|
});
|
|
377431
|
-
import { writeFile as
|
|
377432
|
-
import { join as
|
|
377627
|
+
import { writeFile as writeFile42, mkdir as mkdir40 } from "fs/promises";
|
|
377628
|
+
import { join as join119 } from "path";
|
|
377433
377629
|
function TelegramSetup({ onDone }) {
|
|
377434
377630
|
const [step, setStep] = React59.useState("instructions");
|
|
377435
377631
|
const [token, setToken] = React59.useState("");
|
|
@@ -377715,20 +377911,20 @@ async function saveTelegramConfig(token, chatId) {
|
|
|
377715
377911
|
const { getOriginalCwd: getOriginalCwd2 } = await Promise.resolve().then(() => (init_state(), exports_state));
|
|
377716
377912
|
const cwd2 = getOriginalCwd2();
|
|
377717
377913
|
if (cwd2) {
|
|
377718
|
-
const projDir =
|
|
377719
|
-
await
|
|
377720
|
-
configPath =
|
|
377914
|
+
const projDir = join119(cwd2, ".localclawd");
|
|
377915
|
+
await mkdir40(projDir, { recursive: true });
|
|
377916
|
+
configPath = join119(projDir, "telegram.json");
|
|
377721
377917
|
} else {
|
|
377722
377918
|
const dir = getClaudeConfigHomeDir();
|
|
377723
|
-
await
|
|
377724
|
-
configPath =
|
|
377919
|
+
await mkdir40(dir, { recursive: true });
|
|
377920
|
+
configPath = join119(dir, "telegram.json");
|
|
377725
377921
|
}
|
|
377726
377922
|
} catch {
|
|
377727
377923
|
const dir = getClaudeConfigHomeDir();
|
|
377728
|
-
await
|
|
377729
|
-
configPath =
|
|
377924
|
+
await mkdir40(dir, { recursive: true });
|
|
377925
|
+
configPath = join119(dir, "telegram.json");
|
|
377730
377926
|
}
|
|
377731
|
-
await
|
|
377927
|
+
await writeFile42(configPath, JSON.stringify({ token, chatId }, null, 2), "utf-8");
|
|
377732
377928
|
}
|
|
377733
377929
|
function TelegramStatus({
|
|
377734
377930
|
onDone
|
|
@@ -377938,8 +378134,8 @@ var exports_slack = {};
|
|
|
377938
378134
|
__export(exports_slack, {
|
|
377939
378135
|
call: () => call24
|
|
377940
378136
|
});
|
|
377941
|
-
import { writeFile as
|
|
377942
|
-
import { join as
|
|
378137
|
+
import { writeFile as writeFile43, mkdir as mkdir41 } from "fs/promises";
|
|
378138
|
+
import { join as join120 } from "path";
|
|
377943
378139
|
function SlackSetup({ onDone }) {
|
|
377944
378140
|
const [step, setStep] = React60.useState("instructions");
|
|
377945
378141
|
const [token, setToken] = React60.useState("");
|
|
@@ -378294,9 +378490,9 @@ function SlackSetupDone({
|
|
|
378294
378490
|
}
|
|
378295
378491
|
async function saveSlackConfig(token, channelId, userId) {
|
|
378296
378492
|
const configDir = getClaudeConfigHomeDir();
|
|
378297
|
-
await
|
|
378298
|
-
const configPath =
|
|
378299
|
-
await
|
|
378493
|
+
await mkdir41(configDir, { recursive: true });
|
|
378494
|
+
const configPath = join120(configDir, "slack.json");
|
|
378495
|
+
await writeFile43(configPath, JSON.stringify({ token, channelId, userId: userId ?? null }, null, 2), "utf-8");
|
|
378300
378496
|
}
|
|
378301
378497
|
function SlackStatus({
|
|
378302
378498
|
onDone
|
|
@@ -378521,8 +378717,8 @@ var exports_discord = {};
|
|
|
378521
378717
|
__export(exports_discord, {
|
|
378522
378718
|
call: () => call25
|
|
378523
378719
|
});
|
|
378524
|
-
import { writeFile as
|
|
378525
|
-
import { join as
|
|
378720
|
+
import { writeFile as writeFile44, mkdir as mkdir42 } from "fs/promises";
|
|
378721
|
+
import { join as join121 } from "path";
|
|
378526
378722
|
function DiscordSetup({ onDone }) {
|
|
378527
378723
|
const [step, setStep] = React62.useState("instructions");
|
|
378528
378724
|
const [token, setToken] = React62.useState("");
|
|
@@ -378816,8 +379012,8 @@ function DiscordSetupDone({
|
|
|
378816
379012
|
}
|
|
378817
379013
|
async function saveConfig3(token, channelId, userId) {
|
|
378818
379014
|
const configDir = getClaudeConfigHomeDir();
|
|
378819
|
-
await
|
|
378820
|
-
await
|
|
379015
|
+
await mkdir42(configDir, { recursive: true });
|
|
379016
|
+
await writeFile44(join121(configDir, "discord.json"), JSON.stringify({ token, channelId, userId: userId ?? null }, null, 2), "utf-8");
|
|
378821
379017
|
}
|
|
378822
379018
|
function DiscordStatus({
|
|
378823
379019
|
onDone
|
|
@@ -379188,9 +379384,9 @@ var init_schedule2 = __esm(() => {
|
|
|
379188
379384
|
});
|
|
379189
379385
|
|
|
379190
379386
|
// src/services/sessionSearch/sessionSummarize.ts
|
|
379191
|
-
import { readdir as readdir25, readFile as
|
|
379192
|
-
import { join as
|
|
379193
|
-
import { homedir as
|
|
379387
|
+
import { readdir as readdir25, readFile as readFile47, writeFile as writeFile45, mkdir as mkdir43, stat as stat40 } from "fs/promises";
|
|
379388
|
+
import { join as join122 } from "path";
|
|
379389
|
+
import { homedir as homedir26 } from "os";
|
|
379194
379390
|
function extractText(obj) {
|
|
379195
379391
|
if (typeof obj === "string")
|
|
379196
379392
|
return obj;
|
|
@@ -379218,7 +379414,7 @@ async function listUnsummarized() {
|
|
|
379218
379414
|
for (const f of files) {
|
|
379219
379415
|
if (!f.endsWith(".json"))
|
|
379220
379416
|
continue;
|
|
379221
|
-
const s = await stat40(
|
|
379417
|
+
const s = await stat40(join122(SUMMARIES_DIR2, f)).catch(() => null);
|
|
379222
379418
|
if (s)
|
|
379223
379419
|
existing.set(f.replace(/\.json$/, ""), s.mtimeMs);
|
|
379224
379420
|
}
|
|
@@ -379232,7 +379428,7 @@ async function listUnsummarized() {
|
|
|
379232
379428
|
continue;
|
|
379233
379429
|
}
|
|
379234
379430
|
for (const slug of slugs) {
|
|
379235
|
-
const slugDir =
|
|
379431
|
+
const slugDir = join122(projectsDir, slug);
|
|
379236
379432
|
try {
|
|
379237
379433
|
const entries = await readdir25(slugDir);
|
|
379238
379434
|
for (const entry of entries) {
|
|
@@ -379242,7 +379438,7 @@ async function listUnsummarized() {
|
|
|
379242
379438
|
if (seen.has(sessionId))
|
|
379243
379439
|
continue;
|
|
379244
379440
|
seen.add(sessionId);
|
|
379245
|
-
const full =
|
|
379441
|
+
const full = join122(slugDir, entry);
|
|
379246
379442
|
const s = await stat40(full).catch(() => null);
|
|
379247
379443
|
if (!s)
|
|
379248
379444
|
continue;
|
|
@@ -379284,7 +379480,7 @@ function buildTranscript(content) {
|
|
|
379284
379480
|
return { transcript: parts.join(`
|
|
379285
379481
|
`), messageCount: lines.length, firstUser };
|
|
379286
379482
|
}
|
|
379287
|
-
async function
|
|
379483
|
+
async function callLLM2(prompt) {
|
|
379288
379484
|
try {
|
|
379289
379485
|
const baseUrl = getLocalLLMBaseUrl();
|
|
379290
379486
|
const model = getLocalLLMModel();
|
|
@@ -379322,7 +379518,7 @@ function parseSummaryResponse(text) {
|
|
|
379322
379518
|
return { summary, tags };
|
|
379323
379519
|
}
|
|
379324
379520
|
async function summarizeSession(sessionId, slug, filePath, mtime) {
|
|
379325
|
-
const content = await
|
|
379521
|
+
const content = await readFile47(filePath, "utf-8").catch(() => "");
|
|
379326
379522
|
if (!content)
|
|
379327
379523
|
return null;
|
|
379328
379524
|
const { transcript, messageCount, firstUser } = buildTranscript(content);
|
|
@@ -379336,7 +379532,7 @@ TAGS: tag1, tag2, tag3
|
|
|
379336
379532
|
|
|
379337
379533
|
` + `Transcript:
|
|
379338
379534
|
${transcript}`;
|
|
379339
|
-
const response = await
|
|
379535
|
+
const response = await callLLM2(prompt);
|
|
379340
379536
|
if (!response)
|
|
379341
379537
|
return null;
|
|
379342
379538
|
const { summary, tags } = parseSummaryResponse(response);
|
|
@@ -379353,7 +379549,7 @@ ${transcript}`;
|
|
|
379353
379549
|
};
|
|
379354
379550
|
}
|
|
379355
379551
|
async function summarizeAllPending(limit = 20, onProgress) {
|
|
379356
|
-
await
|
|
379552
|
+
await mkdir43(SUMMARIES_DIR2, { recursive: true });
|
|
379357
379553
|
const pending = await listUnsummarized();
|
|
379358
379554
|
pending.sort((a, b3) => b3.mtime - a.mtime);
|
|
379359
379555
|
const slice = pending.slice(0, limit);
|
|
@@ -379368,7 +379564,7 @@ async function summarizeAllPending(limit = 20, onProgress) {
|
|
|
379368
379564
|
continue;
|
|
379369
379565
|
}
|
|
379370
379566
|
try {
|
|
379371
|
-
await
|
|
379567
|
+
await writeFile45(join122(SUMMARIES_DIR2, `${p.sessionId}.json`), JSON.stringify(summary, null, 2), "utf-8");
|
|
379372
379568
|
summarized++;
|
|
379373
379569
|
} catch (e) {
|
|
379374
379570
|
logForDebugging(`[session-summarize] write failed: ${e}`);
|
|
@@ -379385,7 +379581,7 @@ async function loadAllSummaries() {
|
|
|
379385
379581
|
if (!f.endsWith(".json"))
|
|
379386
379582
|
continue;
|
|
379387
379583
|
try {
|
|
379388
|
-
const raw = await
|
|
379584
|
+
const raw = await readFile47(join122(SUMMARIES_DIR2, f), "utf-8");
|
|
379389
379585
|
summaries.push(JSON.parse(raw));
|
|
379390
379586
|
} catch {}
|
|
379391
379587
|
}
|
|
@@ -379400,15 +379596,15 @@ var init_sessionSummarize = __esm(() => {
|
|
|
379400
379596
|
init_envUtils();
|
|
379401
379597
|
init_providers();
|
|
379402
379598
|
PROJECTS_DIRS = [
|
|
379403
|
-
|
|
379404
|
-
|
|
379599
|
+
join122(getClaudeConfigHomeDir(), "projects"),
|
|
379600
|
+
join122(homedir26(), ".claude", "projects")
|
|
379405
379601
|
];
|
|
379406
|
-
SUMMARIES_DIR2 =
|
|
379602
|
+
SUMMARIES_DIR2 = join122(getClaudeConfigHomeDir(), "session-summaries");
|
|
379407
379603
|
});
|
|
379408
379604
|
|
|
379409
379605
|
// src/services/sessionSearch/fts5Index.ts
|
|
379410
|
-
import { readdir as readdir26, readFile as
|
|
379411
|
-
import { join as
|
|
379606
|
+
import { readdir as readdir26, readFile as readFile48, stat as stat41 } from "fs/promises";
|
|
379607
|
+
import { join as join123 } from "path";
|
|
379412
379608
|
async function tryOpenDatabase() {
|
|
379413
379609
|
if (_db)
|
|
379414
379610
|
return _db;
|
|
@@ -379473,7 +379669,7 @@ async function rebuildIndex() {
|
|
|
379473
379669
|
continue;
|
|
379474
379670
|
const sessionId = entry.replace(/\.json$/, "");
|
|
379475
379671
|
seen.add(sessionId);
|
|
379476
|
-
const filePath =
|
|
379672
|
+
const filePath = join123(SUMMARIES_DIR3, entry);
|
|
379477
379673
|
let s;
|
|
379478
379674
|
try {
|
|
379479
379675
|
s = await stat41(filePath);
|
|
@@ -379485,7 +379681,7 @@ async function rebuildIndex() {
|
|
|
379485
379681
|
continue;
|
|
379486
379682
|
let raw;
|
|
379487
379683
|
try {
|
|
379488
|
-
raw = await
|
|
379684
|
+
raw = await readFile48(filePath, "utf-8");
|
|
379489
379685
|
} catch {
|
|
379490
379686
|
continue;
|
|
379491
379687
|
}
|
|
@@ -379544,14 +379740,14 @@ var DB_PATH, SUMMARIES_DIR3, _db = null, _available = null;
|
|
|
379544
379740
|
var init_fts5Index = __esm(() => {
|
|
379545
379741
|
init_debug();
|
|
379546
379742
|
init_envUtils();
|
|
379547
|
-
DB_PATH =
|
|
379548
|
-
SUMMARIES_DIR3 =
|
|
379743
|
+
DB_PATH = join123(getClaudeConfigHomeDir(), "sessions.db");
|
|
379744
|
+
SUMMARIES_DIR3 = join123(getClaudeConfigHomeDir(), "session-summaries");
|
|
379549
379745
|
});
|
|
379550
379746
|
|
|
379551
379747
|
// src/services/sessionSearch/sessionSearch.ts
|
|
379552
|
-
import { readdir as readdir27, readFile as
|
|
379553
|
-
import { join as
|
|
379554
|
-
import { homedir as
|
|
379748
|
+
import { readdir as readdir27, readFile as readFile49, stat as stat42 } from "fs/promises";
|
|
379749
|
+
import { join as join124 } from "path";
|
|
379750
|
+
import { homedir as homedir27 } from "os";
|
|
379555
379751
|
function tokenize6(text) {
|
|
379556
379752
|
return text.toLowerCase().split(/[^a-z0-9_]+/).filter((t) => t.length >= 2);
|
|
379557
379753
|
}
|
|
@@ -379585,13 +379781,13 @@ async function listSessionFiles() {
|
|
|
379585
379781
|
continue;
|
|
379586
379782
|
}
|
|
379587
379783
|
for (const slug of projects) {
|
|
379588
|
-
const slugDir =
|
|
379784
|
+
const slugDir = join124(projectsDir, slug);
|
|
379589
379785
|
try {
|
|
379590
379786
|
const entries = await readdir27(slugDir);
|
|
379591
379787
|
for (const entry of entries) {
|
|
379592
379788
|
if (!entry.endsWith(".jsonl"))
|
|
379593
379789
|
continue;
|
|
379594
|
-
const full =
|
|
379790
|
+
const full = join124(slugDir, entry);
|
|
379595
379791
|
if (seen.has(entry))
|
|
379596
379792
|
continue;
|
|
379597
379793
|
seen.add(entry);
|
|
@@ -379611,7 +379807,7 @@ async function listSessionFiles() {
|
|
|
379611
379807
|
async function scoreSession(terms, filePath) {
|
|
379612
379808
|
let content;
|
|
379613
379809
|
try {
|
|
379614
|
-
content = await
|
|
379810
|
+
content = await readFile49(filePath, "utf-8");
|
|
379615
379811
|
} catch {
|
|
379616
379812
|
return { score: 0, messageCount: 0, snippet: "", preview: "" };
|
|
379617
379813
|
}
|
|
@@ -379807,8 +380003,8 @@ var init_sessionSearch = __esm(() => {
|
|
|
379807
380003
|
init_sessionSummarize();
|
|
379808
380004
|
init_fts5Index();
|
|
379809
380005
|
PROJECTS_DIRS2 = [
|
|
379810
|
-
|
|
379811
|
-
|
|
380006
|
+
join124(getClaudeConfigHomeDir(), "projects"),
|
|
380007
|
+
join124(homedir27(), ".claude", "projects")
|
|
379812
380008
|
];
|
|
379813
380009
|
MAX_FILE_BYTES = 5 * 1024 * 1024;
|
|
379814
380010
|
});
|
|
@@ -379911,9 +380107,9 @@ var init_summarize_sessions2 = __esm(() => {
|
|
|
379911
380107
|
});
|
|
379912
380108
|
|
|
379913
380109
|
// src/services/sessionSearch/trajectoryCompress.ts
|
|
379914
|
-
import { readFile as
|
|
379915
|
-
import { join as
|
|
379916
|
-
import { homedir as
|
|
380110
|
+
import { readFile as readFile50, writeFile as writeFile46, readdir as readdir28, mkdir as mkdir44, stat as stat43 } from "fs/promises";
|
|
380111
|
+
import { join as join125 } from "path";
|
|
380112
|
+
import { homedir as homedir28 } from "os";
|
|
379917
380113
|
function flattenText(obj) {
|
|
379918
380114
|
if (typeof obj === "string")
|
|
379919
380115
|
return obj;
|
|
@@ -379996,9 +380192,9 @@ async function compressSession(sessionId, projectSlug) {
|
|
|
379996
380192
|
let source = null;
|
|
379997
380193
|
let sourceStat = null;
|
|
379998
380194
|
for (const projectsDir of PROJECTS_DIRS3) {
|
|
379999
|
-
const candidate =
|
|
380195
|
+
const candidate = join125(projectsDir, projectSlug, `${sessionId}.jsonl`);
|
|
380000
380196
|
try {
|
|
380001
|
-
const text = await
|
|
380197
|
+
const text = await readFile50(candidate, "utf-8");
|
|
380002
380198
|
const s = await stat43(candidate);
|
|
380003
380199
|
sourcePath = candidate;
|
|
380004
380200
|
source = text;
|
|
@@ -380030,8 +380226,8 @@ async function compressSession(sessionId, projectSlug) {
|
|
|
380030
380226
|
};
|
|
380031
380227
|
const serialized = JSON.stringify(trajectory, null, 0);
|
|
380032
380228
|
trajectory.compressedBytes = Buffer.byteLength(serialized, "utf-8");
|
|
380033
|
-
await
|
|
380034
|
-
await
|
|
380229
|
+
await mkdir44(TRAJECTORIES_DIR2, { recursive: true });
|
|
380230
|
+
await writeFile46(join125(TRAJECTORIES_DIR2, `${sessionId}.json`), JSON.stringify(trajectory), "utf-8");
|
|
380035
380231
|
return trajectory;
|
|
380036
380232
|
}
|
|
380037
380233
|
async function compressAllPending(limit = 20) {
|
|
@@ -380041,7 +380237,7 @@ async function compressAllPending(limit = 20) {
|
|
|
380041
380237
|
for (const f of files) {
|
|
380042
380238
|
if (!f.endsWith(".json"))
|
|
380043
380239
|
continue;
|
|
380044
|
-
const s = await stat43(
|
|
380240
|
+
const s = await stat43(join125(TRAJECTORIES_DIR2, f)).catch(() => null);
|
|
380045
380241
|
if (s)
|
|
380046
380242
|
existing.set(f.replace(/\.json$/, ""), s.mtimeMs);
|
|
380047
380243
|
}
|
|
@@ -380057,7 +380253,7 @@ async function compressAllPending(limit = 20) {
|
|
|
380057
380253
|
}
|
|
380058
380254
|
for (const slug of slugs) {
|
|
380059
380255
|
try {
|
|
380060
|
-
const entries = await readdir28(
|
|
380256
|
+
const entries = await readdir28(join125(projectsDir, slug));
|
|
380061
380257
|
for (const entry of entries) {
|
|
380062
380258
|
if (!entry.endsWith(".jsonl"))
|
|
380063
380259
|
continue;
|
|
@@ -380065,7 +380261,7 @@ async function compressAllPending(limit = 20) {
|
|
|
380065
380261
|
if (seen.has(sessionId))
|
|
380066
380262
|
continue;
|
|
380067
380263
|
seen.add(sessionId);
|
|
380068
|
-
const s = await stat43(
|
|
380264
|
+
const s = await stat43(join125(projectsDir, slug, entry)).catch(() => null);
|
|
380069
380265
|
if (!s)
|
|
380070
380266
|
continue;
|
|
380071
380267
|
const have = existing.get(sessionId);
|
|
@@ -380105,10 +380301,10 @@ var init_trajectoryCompress = __esm(() => {
|
|
|
380105
380301
|
init_debug();
|
|
380106
380302
|
init_envUtils();
|
|
380107
380303
|
PROJECTS_DIRS3 = [
|
|
380108
|
-
|
|
380109
|
-
|
|
380304
|
+
join125(getClaudeConfigHomeDir(), "projects"),
|
|
380305
|
+
join125(homedir28(), ".claude", "projects")
|
|
380110
380306
|
];
|
|
380111
|
-
TRAJECTORIES_DIR2 =
|
|
380307
|
+
TRAJECTORIES_DIR2 = join125(getClaudeConfigHomeDir(), "trajectories");
|
|
380112
380308
|
});
|
|
380113
380309
|
|
|
380114
380310
|
// src/commands/compress-sessions/compress-sessions.tsx
|
|
@@ -380157,9 +380353,9 @@ var init_compress_sessions2 = __esm(() => {
|
|
|
380157
380353
|
});
|
|
380158
380354
|
|
|
380159
380355
|
// src/services/skills/skillDistill.ts
|
|
380160
|
-
import { readFile as
|
|
380161
|
-
import { join as
|
|
380162
|
-
import { homedir as
|
|
380356
|
+
import { readFile as readFile51, readdir as readdir29, stat as stat44 } from "fs/promises";
|
|
380357
|
+
import { join as join126 } from "path";
|
|
380358
|
+
import { homedir as homedir29 } from "os";
|
|
380163
380359
|
function extractText3(obj) {
|
|
380164
380360
|
if (typeof obj === "string")
|
|
380165
380361
|
return obj;
|
|
@@ -380189,13 +380385,13 @@ async function findMostRecentSession() {
|
|
|
380189
380385
|
continue;
|
|
380190
380386
|
}
|
|
380191
380387
|
for (const slug of slugs) {
|
|
380192
|
-
const slugDir =
|
|
380388
|
+
const slugDir = join126(projectsDir, slug);
|
|
380193
380389
|
try {
|
|
380194
380390
|
const entries = await readdir29(slugDir);
|
|
380195
380391
|
for (const entry of entries) {
|
|
380196
380392
|
if (!entry.endsWith(".jsonl"))
|
|
380197
380393
|
continue;
|
|
380198
|
-
const full =
|
|
380394
|
+
const full = join126(slugDir, entry);
|
|
380199
380395
|
const s = await stat44(full).catch(() => null);
|
|
380200
380396
|
if (!s)
|
|
380201
380397
|
continue;
|
|
@@ -380209,7 +380405,7 @@ async function findMostRecentSession() {
|
|
|
380209
380405
|
return best?.path ?? null;
|
|
380210
380406
|
}
|
|
380211
380407
|
async function buildTranscript2(sessionPath) {
|
|
380212
|
-
const content = await
|
|
380408
|
+
const content = await readFile51(sessionPath, "utf-8");
|
|
380213
380409
|
const lines = content.split(`
|
|
380214
380410
|
`).filter(Boolean);
|
|
380215
380411
|
const parts = [];
|
|
@@ -380234,7 +380430,7 @@ async function buildTranscript2(sessionPath) {
|
|
|
380234
380430
|
return parts.join(`
|
|
380235
380431
|
`);
|
|
380236
380432
|
}
|
|
380237
|
-
async function
|
|
380433
|
+
async function callLLM3(prompt) {
|
|
380238
380434
|
try {
|
|
380239
380435
|
const baseUrl = getLocalLLMBaseUrl();
|
|
380240
380436
|
const model = getLocalLLMModel();
|
|
@@ -380306,7 +380502,7 @@ async function distillRecentSessionToSkill() {
|
|
|
380306
380502
|
|
|
380307
380503
|
` + `Transcript:
|
|
380308
380504
|
${transcript}`;
|
|
380309
|
-
const response = await
|
|
380505
|
+
const response = await callLLM3(prompt);
|
|
380310
380506
|
if (!response)
|
|
380311
380507
|
return null;
|
|
380312
380508
|
if (/NO_SKILL/i.test(response.trim().slice(0, 100)))
|
|
@@ -380319,8 +380515,8 @@ var init_skillDistill = __esm(() => {
|
|
|
380319
380515
|
init_envUtils();
|
|
380320
380516
|
init_providers();
|
|
380321
380517
|
PROJECTS_DIRS4 = [
|
|
380322
|
-
|
|
380323
|
-
|
|
380518
|
+
join126(getClaudeConfigHomeDir(), "projects"),
|
|
380519
|
+
join126(homedir29(), ".claude", "projects")
|
|
380324
380520
|
];
|
|
380325
380521
|
});
|
|
380326
380522
|
|
|
@@ -381035,8 +381231,8 @@ var init_daytona_run2 = __esm(() => {
|
|
|
381035
381231
|
});
|
|
381036
381232
|
|
|
381037
381233
|
// src/services/skills/skillPortable.ts
|
|
381038
|
-
import { readdir as readdir30, readFile as
|
|
381039
|
-
import { join as
|
|
381234
|
+
import { readdir as readdir30, readFile as readFile52, writeFile as writeFile47, mkdir as mkdir45, stat as stat45 } from "fs/promises";
|
|
381235
|
+
import { join as join127, basename as basename37, extname as extname13, resolve as resolve38 } from "path";
|
|
381040
381236
|
function parseFrontmatter2(raw) {
|
|
381041
381237
|
const m2 = raw.match(/^---\s*\n([\s\S]*?)\n---\s*\n?([\s\S]*)$/);
|
|
381042
381238
|
if (!m2)
|
|
@@ -381088,7 +381284,7 @@ async function listSkills() {
|
|
|
381088
381284
|
out.push(entry.replace(/\.md$/, ""));
|
|
381089
381285
|
} else {
|
|
381090
381286
|
try {
|
|
381091
|
-
const sub = await stat45(
|
|
381287
|
+
const sub = await stat45(join127(USER_SKILLS_DIR, entry, "SKILL.md"));
|
|
381092
381288
|
if (sub.isFile())
|
|
381093
381289
|
out.push(entry);
|
|
381094
381290
|
} catch {}
|
|
@@ -381100,14 +381296,14 @@ async function listSkills() {
|
|
|
381100
381296
|
}
|
|
381101
381297
|
}
|
|
381102
381298
|
async function readSkillFile(name) {
|
|
381103
|
-
const flatPath =
|
|
381299
|
+
const flatPath = join127(USER_SKILLS_DIR, `${name}.md`);
|
|
381104
381300
|
try {
|
|
381105
|
-
const raw = await
|
|
381301
|
+
const raw = await readFile52(flatPath, "utf-8");
|
|
381106
381302
|
return { raw, path: flatPath };
|
|
381107
381303
|
} catch {}
|
|
381108
|
-
const dirPath =
|
|
381304
|
+
const dirPath = join127(USER_SKILLS_DIR, name, "SKILL.md");
|
|
381109
381305
|
try {
|
|
381110
|
-
const raw = await
|
|
381306
|
+
const raw = await readFile52(dirPath, "utf-8");
|
|
381111
381307
|
return { raw, path: dirPath };
|
|
381112
381308
|
} catch {
|
|
381113
381309
|
return null;
|
|
@@ -381127,14 +381323,14 @@ async function exportSkill(name, destDir) {
|
|
|
381127
381323
|
body
|
|
381128
381324
|
};
|
|
381129
381325
|
const outPath = resolve38(destDir, `${skill.name}.md`);
|
|
381130
|
-
await
|
|
381131
|
-
await
|
|
381326
|
+
await mkdir45(destDir, { recursive: true });
|
|
381327
|
+
await writeFile47(outPath, buildFrontmatter(skill), "utf-8");
|
|
381132
381328
|
return { ok: true, path: outPath };
|
|
381133
381329
|
}
|
|
381134
381330
|
async function importSkill(filePath) {
|
|
381135
381331
|
let raw;
|
|
381136
381332
|
try {
|
|
381137
|
-
raw = await
|
|
381333
|
+
raw = await readFile52(filePath, "utf-8");
|
|
381138
381334
|
} catch (e) {
|
|
381139
381335
|
return { ok: false, error: `Could not read ${filePath}: ${e}` };
|
|
381140
381336
|
}
|
|
@@ -381149,10 +381345,10 @@ async function importSkill(filePath) {
|
|
|
381149
381345
|
const description = typeof meta.description === "string" ? meta.description : "";
|
|
381150
381346
|
const tags = Array.isArray(meta.tags) ? meta.tags : [];
|
|
381151
381347
|
const skill = { name, description, tags, body };
|
|
381152
|
-
const outPath =
|
|
381348
|
+
const outPath = join127(USER_SKILLS_DIR, `${name}.md`);
|
|
381153
381349
|
try {
|
|
381154
|
-
await
|
|
381155
|
-
await
|
|
381350
|
+
await mkdir45(USER_SKILLS_DIR, { recursive: true });
|
|
381351
|
+
await writeFile47(outPath, buildFrontmatter(skill), "utf-8");
|
|
381156
381352
|
logForDebugging(`[skills] imported ${name} → ${outPath}`);
|
|
381157
381353
|
return { ok: true, name, path: outPath };
|
|
381158
381354
|
} catch (e) {
|
|
@@ -381163,7 +381359,7 @@ var USER_SKILLS_DIR;
|
|
|
381163
381359
|
var init_skillPortable = __esm(() => {
|
|
381164
381360
|
init_debug();
|
|
381165
381361
|
init_envUtils();
|
|
381166
|
-
USER_SKILLS_DIR =
|
|
381362
|
+
USER_SKILLS_DIR = join127(getClaudeConfigHomeDir(), "skills");
|
|
381167
381363
|
});
|
|
381168
381364
|
|
|
381169
381365
|
// src/commands/skills-export/skills-export.tsx
|
|
@@ -381274,11 +381470,11 @@ var init_skills_import2 = __esm(() => {
|
|
|
381274
381470
|
});
|
|
381275
381471
|
|
|
381276
381472
|
// src/services/skills/skillUsage.ts
|
|
381277
|
-
import { mkdir as
|
|
381278
|
-
import { join as
|
|
381473
|
+
import { mkdir as mkdir46, readFile as readFile53, writeFile as writeFile48 } from "fs/promises";
|
|
381474
|
+
import { join as join128 } from "path";
|
|
381279
381475
|
async function loadFile() {
|
|
381280
381476
|
try {
|
|
381281
|
-
const raw = await
|
|
381477
|
+
const raw = await readFile53(USAGE_PATH, "utf-8");
|
|
381282
381478
|
const parsed = JSON.parse(raw);
|
|
381283
381479
|
if (parsed.version !== 1)
|
|
381284
381480
|
return { version: 1, records: [] };
|
|
@@ -381309,7 +381505,7 @@ async function shouldNudgeDistillation() {
|
|
|
381309
381505
|
var USAGE_PATH;
|
|
381310
381506
|
var init_skillUsage = __esm(() => {
|
|
381311
381507
|
init_envUtils();
|
|
381312
|
-
USAGE_PATH =
|
|
381508
|
+
USAGE_PATH = join128(getClaudeConfigHomeDir(), "skill-usage.json");
|
|
381313
381509
|
});
|
|
381314
381510
|
|
|
381315
381511
|
// src/commands/skill-stats/skill-stats.tsx
|
|
@@ -381377,21 +381573,21 @@ var init_skill_stats2 = __esm(() => {
|
|
|
381377
381573
|
});
|
|
381378
381574
|
|
|
381379
381575
|
// src/services/skills/skillNotes.ts
|
|
381380
|
-
import { mkdir as
|
|
381381
|
-
import { join as
|
|
381576
|
+
import { mkdir as mkdir47, readFile as readFile54, writeFile as writeFile49, appendFile as appendFile5, stat as stat46 } from "fs/promises";
|
|
381577
|
+
import { join as join129 } from "path";
|
|
381382
381578
|
async function findNotesPath(skillName) {
|
|
381383
|
-
const dirPath =
|
|
381579
|
+
const dirPath = join129(USER_SKILLS_DIR2, skillName, "NOTES.md");
|
|
381384
381580
|
try {
|
|
381385
|
-
const s = await stat46(
|
|
381581
|
+
const s = await stat46(join129(USER_SKILLS_DIR2, skillName));
|
|
381386
381582
|
if (s.isDirectory())
|
|
381387
381583
|
return dirPath;
|
|
381388
381584
|
} catch {}
|
|
381389
|
-
return
|
|
381585
|
+
return join129(USER_SKILLS_DIR2, `${skillName}.notes.md`);
|
|
381390
381586
|
}
|
|
381391
381587
|
async function loadSkillNotes(skillName) {
|
|
381392
381588
|
const path12 = await findNotesPath(skillName);
|
|
381393
381589
|
try {
|
|
381394
|
-
return await
|
|
381590
|
+
return await readFile54(path12, "utf-8");
|
|
381395
381591
|
} catch {
|
|
381396
381592
|
return "";
|
|
381397
381593
|
}
|
|
@@ -381401,10 +381597,10 @@ async function appendSkillNote(skillName, note) {
|
|
|
381401
381597
|
if (!trimmed)
|
|
381402
381598
|
return { ok: false, error: "note is empty" };
|
|
381403
381599
|
const path12 = await findNotesPath(skillName);
|
|
381404
|
-
await
|
|
381600
|
+
await mkdir47(USER_SKILLS_DIR2, { recursive: true });
|
|
381405
381601
|
let existing = "";
|
|
381406
381602
|
try {
|
|
381407
|
-
existing = await
|
|
381603
|
+
existing = await readFile54(path12, "utf-8");
|
|
381408
381604
|
} catch {}
|
|
381409
381605
|
if (existing.length === 0) {
|
|
381410
381606
|
existing = `# Notes for skill: ${skillName}
|
|
@@ -381426,7 +381622,7 @@ async function appendSkillNote(skillName, note) {
|
|
|
381426
381622
|
const compacted = lines.slice(0, headerEnd).concat(lines.slice(trimStart)).join(`
|
|
381427
381623
|
`);
|
|
381428
381624
|
try {
|
|
381429
|
-
await
|
|
381625
|
+
await writeFile49(path12, compacted + entry, "utf-8");
|
|
381430
381626
|
} catch (e) {
|
|
381431
381627
|
return { ok: false, error: String(e) };
|
|
381432
381628
|
}
|
|
@@ -381445,7 +381641,7 @@ var USER_SKILLS_DIR2, MAX_NOTES_BYTES, MAX_NOTE_LENGTH = 500;
|
|
|
381445
381641
|
var init_skillNotes = __esm(() => {
|
|
381446
381642
|
init_debug();
|
|
381447
381643
|
init_envUtils();
|
|
381448
|
-
USER_SKILLS_DIR2 =
|
|
381644
|
+
USER_SKILLS_DIR2 = join129(getClaudeConfigHomeDir(), "skills");
|
|
381449
381645
|
MAX_NOTES_BYTES = 32 * 1024;
|
|
381450
381646
|
});
|
|
381451
381647
|
|
|
@@ -381921,9 +382117,9 @@ __export(exports_webuiServer, {
|
|
|
381921
382117
|
broadcastNewWindow: () => broadcastNewWindow
|
|
381922
382118
|
});
|
|
381923
382119
|
import { createServer as createServer5 } from "http";
|
|
381924
|
-
import { mkdir as
|
|
382120
|
+
import { mkdir as mkdir48, readdir as readdir31, readFile as readFile55, writeFile as writeFile50 } from "fs/promises";
|
|
381925
382121
|
import { createHash as createHash23 } from "crypto";
|
|
381926
|
-
import { join as
|
|
382122
|
+
import { join as join130 } from "path";
|
|
381927
382123
|
function getWebuiPort() {
|
|
381928
382124
|
return _boundPort;
|
|
381929
382125
|
}
|
|
@@ -381948,7 +382144,7 @@ function broadcastNewWindow(label) {
|
|
|
381948
382144
|
}
|
|
381949
382145
|
}
|
|
381950
382146
|
async function listInstances() {
|
|
381951
|
-
const sessionsDir =
|
|
382147
|
+
const sessionsDir = join130(getClaudeConfigHomeDir(), "sessions");
|
|
381952
382148
|
const out = [];
|
|
381953
382149
|
let files;
|
|
381954
382150
|
try {
|
|
@@ -381965,7 +382161,7 @@ async function listInstances() {
|
|
|
381965
382161
|
let cwd2;
|
|
381966
382162
|
let port;
|
|
381967
382163
|
try {
|
|
381968
|
-
const raw = await
|
|
382164
|
+
const raw = await readFile55(join130(sessionsDir, f), "utf-8");
|
|
381969
382165
|
const parsed = JSON.parse(raw);
|
|
381970
382166
|
cwd2 = parsed.cwd;
|
|
381971
382167
|
port = parsed.webuiPort;
|
|
@@ -381976,8 +382172,8 @@ async function listInstances() {
|
|
|
381976
382172
|
}
|
|
381977
382173
|
async function ensureStaticHtml() {
|
|
381978
382174
|
try {
|
|
381979
|
-
await
|
|
381980
|
-
await
|
|
382175
|
+
await mkdir48(getClaudeConfigHomeDir(), { recursive: true });
|
|
382176
|
+
await writeFile50(WEBUI_HTML_PATH, STATIC_HTML, "utf-8");
|
|
381981
382177
|
} catch {}
|
|
381982
382178
|
}
|
|
381983
382179
|
function decodeFrame(buffer) {
|
|
@@ -382131,7 +382327,7 @@ async function startWebuiServer(port) {
|
|
|
382131
382327
|
_boundPort = addr.port;
|
|
382132
382328
|
_server = server;
|
|
382133
382329
|
logForDebugging(`[webui] listening on http://127.0.0.1:${_boundPort}`);
|
|
382134
|
-
|
|
382330
|
+
mkdir48(getClaudeConfigHomeDir(), { recursive: true }).then(() => writeFile50(PORT_FILE, String(_boundPort), "utf-8").catch(() => {}));
|
|
382135
382331
|
resolve40({ ok: true, port: _boundPort });
|
|
382136
382332
|
} else {
|
|
382137
382333
|
resolve40({ ok: false, error: "no address bound" });
|
|
@@ -382353,8 +382549,8 @@ var DEFAULT_PORT = 7150, PORT_FILE, WEBUI_HTML_PATH, _server = null, _boundPort
|
|
|
382353
382549
|
var init_webuiServer = __esm(() => {
|
|
382354
382550
|
init_debug();
|
|
382355
382551
|
init_envUtils();
|
|
382356
|
-
PORT_FILE =
|
|
382357
|
-
WEBUI_HTML_PATH =
|
|
382552
|
+
PORT_FILE = join130(getClaudeConfigHomeDir(), "webui-port");
|
|
382553
|
+
WEBUI_HTML_PATH = join130(getClaudeConfigHomeDir(), "webui-static.html");
|
|
382358
382554
|
_websockets = new Set;
|
|
382359
382555
|
_outputBuffer = [];
|
|
382360
382556
|
});
|
|
@@ -382717,12 +382913,12 @@ var init_windows_setup2 = __esm(() => {
|
|
|
382717
382913
|
|
|
382718
382914
|
// src/services/rpc/toolRpcServer.ts
|
|
382719
382915
|
import { createServer as createServer6 } from "http";
|
|
382720
|
-
import { readFile as
|
|
382916
|
+
import { readFile as readFile56, writeFile as writeFile51, mkdir as mkdir49, readdir as readdir32, stat as stat47 } from "fs/promises";
|
|
382721
382917
|
import { spawn as spawn12 } from "child_process";
|
|
382722
|
-
import { join as
|
|
382918
|
+
import { join as join131, resolve as resolvePath, relative as relative24 } from "path";
|
|
382723
382919
|
async function handleRead(p) {
|
|
382724
382920
|
try {
|
|
382725
|
-
const raw = await
|
|
382921
|
+
const raw = await readFile56(p.path, "utf-8");
|
|
382726
382922
|
const content = p.maxBytes && raw.length > p.maxBytes ? raw.slice(0, p.maxBytes) : raw;
|
|
382727
382923
|
return { ok: true, data: content };
|
|
382728
382924
|
} catch (e) {
|
|
@@ -382731,7 +382927,7 @@ async function handleRead(p) {
|
|
|
382731
382927
|
}
|
|
382732
382928
|
async function handleWrite(p) {
|
|
382733
382929
|
try {
|
|
382734
|
-
await
|
|
382930
|
+
await writeFile51(p.path, p.content, "utf-8");
|
|
382735
382931
|
return { ok: true, data: { bytes: Buffer.byteLength(p.content, "utf-8") } };
|
|
382736
382932
|
} catch (e) {
|
|
382737
382933
|
return { ok: false, error: String(e) };
|
|
@@ -382739,7 +382935,7 @@ async function handleWrite(p) {
|
|
|
382739
382935
|
}
|
|
382740
382936
|
async function handleEdit(p) {
|
|
382741
382937
|
try {
|
|
382742
|
-
const content = await
|
|
382938
|
+
const content = await readFile56(p.path, "utf-8");
|
|
382743
382939
|
let updated;
|
|
382744
382940
|
let replacements2 = 0;
|
|
382745
382941
|
if (p.replaceAll) {
|
|
@@ -382758,7 +382954,7 @@ async function handleEdit(p) {
|
|
|
382758
382954
|
updated = content.replace(p.oldString, p.newString);
|
|
382759
382955
|
replacements2 = 1;
|
|
382760
382956
|
}
|
|
382761
|
-
await
|
|
382957
|
+
await writeFile51(p.path, updated, "utf-8");
|
|
382762
382958
|
return { ok: true, data: { replacements: replacements2 } };
|
|
382763
382959
|
} catch (e) {
|
|
382764
382960
|
return { ok: false, error: String(e) };
|
|
@@ -382830,7 +383026,7 @@ async function walk(root2, out, maxEntries) {
|
|
|
382830
383026
|
for (const entry of entries) {
|
|
382831
383027
|
if (out.length >= maxEntries)
|
|
382832
383028
|
return;
|
|
382833
|
-
const full =
|
|
383029
|
+
const full = join131(root2, entry.name);
|
|
382834
383030
|
if (entry.name === "node_modules" || entry.name === ".git" || entry.name === ".next")
|
|
382835
383031
|
continue;
|
|
382836
383032
|
if (entry.isDirectory()) {
|
|
@@ -382871,7 +383067,7 @@ async function handleGrep(p) {
|
|
|
382871
383067
|
const s = await stat47(f);
|
|
382872
383068
|
if (s.size > 5 * 1024 * 1024)
|
|
382873
383069
|
continue;
|
|
382874
|
-
content = await
|
|
383070
|
+
content = await readFile56(f, "utf-8");
|
|
382875
383071
|
} catch {
|
|
382876
383072
|
continue;
|
|
382877
383073
|
}
|
|
@@ -382976,7 +383172,7 @@ async function startToolRpcServer() {
|
|
|
382976
383172
|
_boundPort2 = addr.port;
|
|
382977
383173
|
_server2 = server;
|
|
382978
383174
|
logForDebugging(`[rpc] listening on 127.0.0.1:${_boundPort2}`);
|
|
382979
|
-
|
|
383175
|
+
mkdir49(getClaudeConfigHomeDir(), { recursive: true }).then(() => writeFile51(PORT_FILE2, String(_boundPort2), "utf-8").catch(() => {}));
|
|
382980
383176
|
}
|
|
382981
383177
|
resolve40();
|
|
382982
383178
|
});
|
|
@@ -382989,7 +383185,7 @@ var DEFAULT_PORT2 = 7149, PORT_FILE2, _server2 = null, _boundPort2 = 0;
|
|
|
382989
383185
|
var init_toolRpcServer = __esm(() => {
|
|
382990
383186
|
init_debug();
|
|
382991
383187
|
init_envUtils();
|
|
382992
|
-
PORT_FILE2 =
|
|
383188
|
+
PORT_FILE2 = join131(getClaudeConfigHomeDir(), "rpc-port");
|
|
382993
383189
|
});
|
|
382994
383190
|
|
|
382995
383191
|
// src/commands/rpc/rpc.tsx
|
|
@@ -383601,11 +383797,22 @@ var call51 = async (onDone, context7, args) => {
|
|
|
383601
383797
|
});
|
|
383602
383798
|
setLocalProviderContextWindow(null);
|
|
383603
383799
|
resetContextWindowDetection();
|
|
383604
|
-
|
|
383605
|
-
|
|
383606
|
-
|
|
383607
|
-
|
|
383608
|
-
|
|
383800
|
+
const hadEnv = process.env.LOCALCLAWD_MAX_CONTEXT_TOKENS || process.env.CLAUDE_CODE_MAX_CONTEXT_TOKENS;
|
|
383801
|
+
delete process.env.LOCALCLAWD_MAX_CONTEXT_TOKENS;
|
|
383802
|
+
delete process.env.CLAUDE_CODE_MAX_CONTEXT_TOKENS;
|
|
383803
|
+
await autoDetectProviderContextWindow();
|
|
383804
|
+
const detected = getLocalProviderContextWindow();
|
|
383805
|
+
const effective = getContextWindowForModel(model);
|
|
383806
|
+
const lines2 = [
|
|
383807
|
+
"Context window reset.",
|
|
383808
|
+
detected ? `Detected ${fmtTokens(detected)} tokens from provider.` : `Detection did not return a value — using ${fmtTokens(effective)} tokens (default). Set with /ctx <size>.`,
|
|
383809
|
+
`Effective window: ${fmtTokens(getEffectiveContextWindowSize(model))} (minus output reservation).`,
|
|
383810
|
+
`Auto-compact threshold: ${fmtTokens(getAutoCompactThreshold(model))}.`
|
|
383811
|
+
];
|
|
383812
|
+
if (hadEnv) {
|
|
383813
|
+
lines2.push("", "Note: LOCALCLAWD_MAX_CONTEXT_TOKENS / CLAUDE_CODE_MAX_CONTEXT_TOKENS were set in this", "process and have been cleared for this session. Unset them in your shell to make it", "permanent.");
|
|
383814
|
+
}
|
|
383815
|
+
onDone(lines2.join(`
|
|
383609
383816
|
`), { display: "system" });
|
|
383610
383817
|
return null;
|
|
383611
383818
|
}
|
|
@@ -383888,13 +384095,13 @@ var init_versions2 = __esm(() => {
|
|
|
383888
384095
|
});
|
|
383889
384096
|
|
|
383890
384097
|
// src/components/memory/MemoryFileSelector.tsx
|
|
383891
|
-
import { join as
|
|
384098
|
+
import { join as join132 } from "path";
|
|
383892
384099
|
function MemoryFileSelector({
|
|
383893
384100
|
onSelect,
|
|
383894
384101
|
onCancel
|
|
383895
384102
|
}) {
|
|
383896
384103
|
const existingMemoryFiles = import_react112.use(getMemoryFiles());
|
|
383897
|
-
const projectMemoryPath =
|
|
384104
|
+
const projectMemoryPath = join132(getOriginalCwd(), "LOCALCLAWD.md");
|
|
383898
384105
|
const hasProjectMemory = existingMemoryFiles.some((f) => f.path === projectMemoryPath);
|
|
383899
384106
|
const allMemoryFiles = [
|
|
383900
384107
|
...existingMemoryFiles.filter((f) => f.type !== "AutoMem" && f.type !== "TeamMem" && f.type !== "User" && f.type !== "Managed").map((f) => ({ ...f, exists: true })),
|
|
@@ -383964,10 +384171,10 @@ var init_MemoryFileSelector = __esm(() => {
|
|
|
383964
384171
|
});
|
|
383965
384172
|
|
|
383966
384173
|
// src/components/memory/MemoryUpdateNotification.tsx
|
|
383967
|
-
import { homedir as
|
|
384174
|
+
import { homedir as homedir30 } from "os";
|
|
383968
384175
|
import { relative as relative25 } from "path";
|
|
383969
384176
|
function getRelativeMemoryPath(path12) {
|
|
383970
|
-
const homeDir =
|
|
384177
|
+
const homeDir = homedir30();
|
|
383971
384178
|
const cwd2 = getCwd();
|
|
383972
384179
|
const relativeToHome = path12.startsWith(homeDir) ? "~" + path12.slice(homeDir.length) : null;
|
|
383973
384180
|
const relativeToCwd = path12.startsWith(cwd2) ? "./" + relative25(cwd2, path12) : null;
|
|
@@ -384214,8 +384421,8 @@ var exports_memory = {};
|
|
|
384214
384421
|
__export(exports_memory, {
|
|
384215
384422
|
call: () => call53
|
|
384216
384423
|
});
|
|
384217
|
-
import { mkdir as
|
|
384218
|
-
import { dirname as
|
|
384424
|
+
import { mkdir as mkdir50, writeFile as writeFile52 } from "fs/promises";
|
|
384425
|
+
import { dirname as dirname49 } from "path";
|
|
384219
384426
|
function formatBytes(bytes) {
|
|
384220
384427
|
if (bytes < 1024)
|
|
384221
384428
|
return `${bytes} B`;
|
|
@@ -384262,9 +384469,9 @@ function MemoryCommand({
|
|
|
384262
384469
|
}) {
|
|
384263
384470
|
const handleSelectMemoryFile = async (memoryPath) => {
|
|
384264
384471
|
try {
|
|
384265
|
-
await
|
|
384472
|
+
await mkdir50(dirname49(memoryPath), { recursive: true });
|
|
384266
384473
|
try {
|
|
384267
|
-
await
|
|
384474
|
+
await writeFile52(memoryPath, "", {
|
|
384268
384475
|
encoding: "utf8",
|
|
384269
384476
|
flag: "wx"
|
|
384270
384477
|
});
|
|
@@ -384373,10 +384580,10 @@ var exports_includememory = {};
|
|
|
384373
384580
|
__export(exports_includememory, {
|
|
384374
384581
|
call: () => call54
|
|
384375
384582
|
});
|
|
384376
|
-
import { join as
|
|
384583
|
+
import { join as join133 } from "path";
|
|
384377
384584
|
var MEMORY_GITIGNORE_PATTERNS, call54 = async () => {
|
|
384378
384585
|
const gitignorePaths = [
|
|
384379
|
-
|
|
384586
|
+
join133(getOriginalCwd(), ".gitignore"),
|
|
384380
384587
|
getGlobalGitignorePath()
|
|
384381
384588
|
];
|
|
384382
384589
|
const results = await Promise.all(gitignorePaths.map((path12) => removeGitignoreRulesFromFile(path12, MEMORY_GITIGNORE_PATTERNS)));
|
|
@@ -385239,7 +385446,7 @@ function Help(t0) {
|
|
|
385239
385446
|
let t6;
|
|
385240
385447
|
if ($2[31] !== tabs) {
|
|
385241
385448
|
t6 = /* @__PURE__ */ jsx_dev_runtime218.jsxDEV(Tabs, {
|
|
385242
|
-
title: `localclawd v${"2.
|
|
385449
|
+
title: `localclawd v${"2.3.0"}`,
|
|
385243
385450
|
color: "professionalBlue",
|
|
385244
385451
|
defaultTab: "general",
|
|
385245
385452
|
children: tabs
|
|
@@ -386617,8 +386824,8 @@ var exports_keybindings = {};
|
|
|
386617
386824
|
__export(exports_keybindings, {
|
|
386618
386825
|
call: () => call57
|
|
386619
386826
|
});
|
|
386620
|
-
import { mkdir as
|
|
386621
|
-
import { dirname as
|
|
386827
|
+
import { mkdir as mkdir51, writeFile as writeFile53 } from "fs/promises";
|
|
386828
|
+
import { dirname as dirname50 } from "path";
|
|
386622
386829
|
async function call57() {
|
|
386623
386830
|
if (!isKeybindingCustomizationEnabled()) {
|
|
386624
386831
|
return {
|
|
@@ -386628,9 +386835,9 @@ async function call57() {
|
|
|
386628
386835
|
}
|
|
386629
386836
|
const keybindingsPath = getKeybindingsPath();
|
|
386630
386837
|
let fileExists = false;
|
|
386631
|
-
await
|
|
386838
|
+
await mkdir51(dirname50(keybindingsPath), { recursive: true });
|
|
386632
386839
|
try {
|
|
386633
|
-
await
|
|
386840
|
+
await writeFile53(keybindingsPath, generateKeybindingsTemplate(), {
|
|
386634
386841
|
encoding: "utf-8",
|
|
386635
386842
|
flag: "wx"
|
|
386636
386843
|
});
|
|
@@ -390940,7 +391147,7 @@ __export(exports_pluginStartupCheck, {
|
|
|
390940
391147
|
findMissingPlugins: () => findMissingPlugins,
|
|
390941
391148
|
checkEnabledPlugins: () => checkEnabledPlugins
|
|
390942
391149
|
});
|
|
390943
|
-
import { join as
|
|
391150
|
+
import { join as join134 } from "path";
|
|
390944
391151
|
async function checkEnabledPlugins() {
|
|
390945
391152
|
const settings = getInitialSettings();
|
|
390946
391153
|
const enabledPlugins = [];
|
|
@@ -391075,7 +391282,7 @@ async function installSelectedPlugins(pluginsToInstall, onProgress, scope = "use
|
|
|
391075
391282
|
} else {
|
|
391076
391283
|
registerPluginInstallation({
|
|
391077
391284
|
pluginId,
|
|
391078
|
-
installPath:
|
|
391285
|
+
installPath: join134(marketplaceInstallLocation, entry.source),
|
|
391079
391286
|
version: entry.version
|
|
391080
391287
|
}, scope, projectPath);
|
|
391081
391288
|
}
|
|
@@ -391107,7 +391314,7 @@ var init_pluginStartupCheck = __esm(() => {
|
|
|
391107
391314
|
});
|
|
391108
391315
|
|
|
391109
391316
|
// src/utils/plugins/parseMarketplaceInput.ts
|
|
391110
|
-
import { homedir as
|
|
391317
|
+
import { homedir as homedir31 } from "os";
|
|
391111
391318
|
import { resolve as resolve40 } from "path";
|
|
391112
391319
|
async function parseMarketplaceInput(input) {
|
|
391113
391320
|
const trimmed = input.trim();
|
|
@@ -391143,7 +391350,7 @@ async function parseMarketplaceInput(input) {
|
|
|
391143
391350
|
const isWindows3 = process.platform === "win32";
|
|
391144
391351
|
const isWindowsPath = isWindows3 && (trimmed.startsWith(".\\") || trimmed.startsWith("..\\") || /^[a-zA-Z]:[/\\]/.test(trimmed));
|
|
391145
391352
|
if (trimmed.startsWith("./") || trimmed.startsWith("../") || trimmed.startsWith("/") || trimmed.startsWith("~") || isWindowsPath) {
|
|
391146
|
-
const resolvedPath = resolve40(trimmed.startsWith("~") ? trimmed.replace(/^~/,
|
|
391353
|
+
const resolvedPath = resolve40(trimmed.startsWith("~") ? trimmed.replace(/^~/, homedir31()) : trimmed);
|
|
391147
391354
|
let stats;
|
|
391148
391355
|
try {
|
|
391149
391356
|
stats = await fs4.stat(resolvedPath);
|
|
@@ -391393,15 +391600,15 @@ var init_AddMarketplace = __esm(() => {
|
|
|
391393
391600
|
|
|
391394
391601
|
// src/utils/plugins/installCounts.ts
|
|
391395
391602
|
import { randomBytes as randomBytes17 } from "crypto";
|
|
391396
|
-
import { readFile as
|
|
391397
|
-
import { join as
|
|
391603
|
+
import { readFile as readFile57, rename as rename7, unlink as unlink17, writeFile as writeFile54 } from "fs/promises";
|
|
391604
|
+
import { join as join135 } from "path";
|
|
391398
391605
|
function getInstallCountsCachePath() {
|
|
391399
|
-
return
|
|
391606
|
+
return join135(getPluginsDirectory(), INSTALL_COUNTS_CACHE_FILENAME);
|
|
391400
391607
|
}
|
|
391401
391608
|
async function loadInstallCountsCache() {
|
|
391402
391609
|
const cachePath = getInstallCountsCachePath();
|
|
391403
391610
|
try {
|
|
391404
|
-
const content = await
|
|
391611
|
+
const content = await readFile57(cachePath, { encoding: "utf-8" });
|
|
391405
391612
|
const parsed = jsonParse(content);
|
|
391406
391613
|
if (typeof parsed !== "object" || parsed === null || !("version" in parsed) || !("fetchedAt" in parsed) || !("counts" in parsed)) {
|
|
391407
391614
|
logForDebugging("Install counts cache has invalid structure");
|
|
@@ -391451,7 +391658,7 @@ async function saveInstallCountsCache(cache3) {
|
|
|
391451
391658
|
const pluginsDir = getPluginsDirectory();
|
|
391452
391659
|
await getFsImplementation().mkdir(pluginsDir);
|
|
391453
391660
|
const content = jsonStringify(cache3, null, 2);
|
|
391454
|
-
await
|
|
391661
|
+
await writeFile54(tempPath, content, {
|
|
391455
391662
|
encoding: "utf-8",
|
|
391456
391663
|
mode: 384
|
|
391457
391664
|
});
|
|
@@ -394138,7 +394345,7 @@ var init_DiscoverPlugins = __esm(() => {
|
|
|
394138
394345
|
});
|
|
394139
394346
|
|
|
394140
394347
|
// src/services/plugins/pluginOperations.ts
|
|
394141
|
-
import { dirname as
|
|
394348
|
+
import { dirname as dirname51, join as join136 } from "path";
|
|
394142
394349
|
function assertInstallableScope(scope) {
|
|
394143
394350
|
if (!VALID_INSTALLABLE_SCOPES.includes(scope)) {
|
|
394144
394351
|
throw new Error(`Invalid scope "${scope}". Must be one of: ${VALID_INSTALLABLE_SCOPES.join(", ")}`);
|
|
@@ -394615,8 +394822,8 @@ async function performPluginUpdate({
|
|
|
394615
394822
|
}
|
|
394616
394823
|
throw e;
|
|
394617
394824
|
}
|
|
394618
|
-
const marketplaceDir = marketplaceStats.isDirectory() ? marketplaceInstallLocation :
|
|
394619
|
-
sourcePath =
|
|
394825
|
+
const marketplaceDir = marketplaceStats.isDirectory() ? marketplaceInstallLocation : dirname51(marketplaceInstallLocation);
|
|
394826
|
+
sourcePath = join136(marketplaceDir, entry.source);
|
|
394620
394827
|
try {
|
|
394621
394828
|
await fs4.stat(sourcePath);
|
|
394622
394829
|
} catch (e) {
|
|
@@ -394631,7 +394838,7 @@ async function performPluginUpdate({
|
|
|
394631
394838
|
throw e;
|
|
394632
394839
|
}
|
|
394633
394840
|
let pluginManifest;
|
|
394634
|
-
const manifestPath =
|
|
394841
|
+
const manifestPath = join136(sourcePath, ".claude-plugin", "plugin.json");
|
|
394635
394842
|
try {
|
|
394636
394843
|
pluginManifest = await loadPluginManifest(manifestPath, entry.name, entry.source);
|
|
394637
394844
|
} catch {}
|
|
@@ -395848,10 +396055,10 @@ var init_ManageMarketplaces = __esm(() => {
|
|
|
395848
396055
|
|
|
395849
396056
|
// src/utils/plugins/pluginFlagging.ts
|
|
395850
396057
|
import { randomBytes as randomBytes18 } from "crypto";
|
|
395851
|
-
import { readFile as
|
|
395852
|
-
import { join as
|
|
396058
|
+
import { readFile as readFile58, rename as rename8, unlink as unlink18, writeFile as writeFile55 } from "fs/promises";
|
|
396059
|
+
import { join as join137 } from "path";
|
|
395853
396060
|
function getFlaggedPluginsPath() {
|
|
395854
|
-
return
|
|
396061
|
+
return join137(getPluginsDirectory(), FLAGGED_PLUGINS_FILENAME);
|
|
395855
396062
|
}
|
|
395856
396063
|
function parsePluginsData(content) {
|
|
395857
396064
|
const parsed = jsonParse(content);
|
|
@@ -395875,7 +396082,7 @@ function parsePluginsData(content) {
|
|
|
395875
396082
|
}
|
|
395876
396083
|
async function readFromDisk() {
|
|
395877
396084
|
try {
|
|
395878
|
-
const content = await
|
|
396085
|
+
const content = await readFile58(getFlaggedPluginsPath(), {
|
|
395879
396086
|
encoding: "utf-8"
|
|
395880
396087
|
});
|
|
395881
396088
|
return parsePluginsData(content);
|
|
@@ -395889,7 +396096,7 @@ async function writeToDisk(plugins) {
|
|
|
395889
396096
|
try {
|
|
395890
396097
|
await getFsImplementation().mkdir(getPluginsDirectory());
|
|
395891
396098
|
const content = jsonStringify({ plugins }, null, 2);
|
|
395892
|
-
await
|
|
396099
|
+
await writeFile55(tempPath, content, {
|
|
395893
396100
|
encoding: "utf-8",
|
|
395894
396101
|
mode: 384
|
|
395895
396102
|
});
|
|
@@ -399143,7 +399350,7 @@ function parsePluginArgs(args) {
|
|
|
399143
399350
|
}
|
|
399144
399351
|
|
|
399145
399352
|
// src/utils/plugins/validatePlugin.ts
|
|
399146
|
-
import { readdir as readdir34, readFile as
|
|
399353
|
+
import { readdir as readdir34, readFile as readFile60, stat as stat49 } from "fs/promises";
|
|
399147
399354
|
import * as path14 from "path";
|
|
399148
399355
|
import { z as z77 } from "zod/v4";
|
|
399149
399356
|
function detectManifestType(filePath) {
|
|
@@ -399184,7 +399391,7 @@ async function validatePluginManifest(filePath) {
|
|
|
399184
399391
|
const absolutePath = path14.resolve(filePath);
|
|
399185
399392
|
let content;
|
|
399186
399393
|
try {
|
|
399187
|
-
content = await
|
|
399394
|
+
content = await readFile60(absolutePath, { encoding: "utf-8" });
|
|
399188
399395
|
} catch (error5) {
|
|
399189
399396
|
const code = getErrnoCode(error5);
|
|
399190
399397
|
let message;
|
|
@@ -399308,7 +399515,7 @@ async function validateMarketplaceManifest(filePath) {
|
|
|
399308
399515
|
const absolutePath = path14.resolve(filePath);
|
|
399309
399516
|
let content;
|
|
399310
399517
|
try {
|
|
399311
|
-
content = await
|
|
399518
|
+
content = await readFile60(absolutePath, { encoding: "utf-8" });
|
|
399312
399519
|
} catch (error5) {
|
|
399313
399520
|
const code = getErrnoCode(error5);
|
|
399314
399521
|
let message;
|
|
@@ -399394,7 +399601,7 @@ async function validateMarketplaceManifest(filePath) {
|
|
|
399394
399601
|
const pluginJsonPath = path14.join(marketplaceRoot, entry.source, ".claude-plugin", "plugin.json");
|
|
399395
399602
|
let manifestVersion;
|
|
399396
399603
|
try {
|
|
399397
|
-
const raw = await
|
|
399604
|
+
const raw = await readFile60(pluginJsonPath, { encoding: "utf-8" });
|
|
399398
399605
|
const parsed2 = jsonParse(raw);
|
|
399399
399606
|
if (typeof parsed2.version === "string") {
|
|
399400
399607
|
manifestVersion = parsed2.version;
|
|
@@ -399511,7 +399718,7 @@ function validateComponentFile(filePath, content, fileType) {
|
|
|
399511
399718
|
async function validateHooksJson(filePath) {
|
|
399512
399719
|
let content;
|
|
399513
399720
|
try {
|
|
399514
|
-
content = await
|
|
399721
|
+
content = await readFile60(filePath, { encoding: "utf-8" });
|
|
399515
399722
|
} catch (e) {
|
|
399516
399723
|
const code = getErrnoCode(e);
|
|
399517
399724
|
if (code === "ENOENT") {
|
|
@@ -399604,7 +399811,7 @@ async function validatePluginContents(pluginDir) {
|
|
|
399604
399811
|
for (const filePath of files) {
|
|
399605
399812
|
let content;
|
|
399606
399813
|
try {
|
|
399607
|
-
content = await
|
|
399814
|
+
content = await readFile60(filePath, { encoding: "utf-8" });
|
|
399608
399815
|
} catch (e) {
|
|
399609
399816
|
if (isENOENT(e))
|
|
399610
399817
|
continue;
|
|
@@ -399673,7 +399880,7 @@ async function validateManifest2(filePath) {
|
|
|
399673
399880
|
return validateMarketplaceManifest(filePath);
|
|
399674
399881
|
case "unknown": {
|
|
399675
399882
|
try {
|
|
399676
|
-
const content = await
|
|
399883
|
+
const content = await readFile60(absolutePath, { encoding: "utf-8" });
|
|
399677
399884
|
const parsed = jsonParse(content);
|
|
399678
399885
|
if (Array.isArray(parsed.plugins)) {
|
|
399679
399886
|
return validateMarketplaceManifest(filePath);
|
|
@@ -402398,10 +402605,10 @@ var init_transcriptSearch = __esm(() => {
|
|
|
402398
402605
|
});
|
|
402399
402606
|
|
|
402400
402607
|
// src/utils/releaseNotes.ts
|
|
402401
|
-
import { mkdir as
|
|
402402
|
-
import { dirname as
|
|
402608
|
+
import { mkdir as mkdir52, readFile as readFile61, writeFile as writeFile56 } from "fs/promises";
|
|
402609
|
+
import { dirname as dirname53, join as join140 } from "path";
|
|
402403
402610
|
function getChangelogCachePath() {
|
|
402404
|
-
return
|
|
402611
|
+
return join140(getClaudeConfigHomeDir(), "cache", "changelog.md");
|
|
402405
402612
|
}
|
|
402406
402613
|
async function migrateChangelogFromConfig() {
|
|
402407
402614
|
const config2 = getGlobalConfig();
|
|
@@ -402410,8 +402617,8 @@ async function migrateChangelogFromConfig() {
|
|
|
402410
402617
|
}
|
|
402411
402618
|
const cachePath = getChangelogCachePath();
|
|
402412
402619
|
try {
|
|
402413
|
-
await
|
|
402414
|
-
await
|
|
402620
|
+
await mkdir52(dirname53(cachePath), { recursive: true });
|
|
402621
|
+
await writeFile56(cachePath, config2.cachedChangelog, {
|
|
402415
402622
|
encoding: "utf-8",
|
|
402416
402623
|
flag: "wx"
|
|
402417
402624
|
});
|
|
@@ -402432,8 +402639,8 @@ async function fetchAndStoreChangelog() {
|
|
|
402432
402639
|
return;
|
|
402433
402640
|
}
|
|
402434
402641
|
const cachePath = getChangelogCachePath();
|
|
402435
|
-
await
|
|
402436
|
-
await
|
|
402642
|
+
await mkdir52(dirname53(cachePath), { recursive: true });
|
|
402643
|
+
await writeFile56(cachePath, changelogContent, { encoding: "utf-8" });
|
|
402437
402644
|
changelogMemoryCache = changelogContent;
|
|
402438
402645
|
const changelogLastFetched = Date.now();
|
|
402439
402646
|
saveGlobalConfig((current) => ({
|
|
@@ -402448,7 +402655,7 @@ async function getStoredChangelog() {
|
|
|
402448
402655
|
}
|
|
402449
402656
|
const cachePath = getChangelogCachePath();
|
|
402450
402657
|
try {
|
|
402451
|
-
const content = await
|
|
402658
|
+
const content = await readFile61(cachePath, "utf-8");
|
|
402452
402659
|
changelogMemoryCache = content;
|
|
402453
402660
|
return content;
|
|
402454
402661
|
} catch {
|
|
@@ -402501,7 +402708,7 @@ function getRecentReleaseNotes(currentVersion, previousVersion, changelogContent
|
|
|
402501
402708
|
}
|
|
402502
402709
|
return [];
|
|
402503
402710
|
}
|
|
402504
|
-
async function checkForReleaseNotes(lastSeenVersion, currentVersion = "2.
|
|
402711
|
+
async function checkForReleaseNotes(lastSeenVersion, currentVersion = "2.3.0") {
|
|
402505
402712
|
if (process.env.USER_TYPE === "ant") {
|
|
402506
402713
|
const changelog = MACRO.VERSION_CHANGELOG;
|
|
402507
402714
|
if (changelog) {
|
|
@@ -402528,7 +402735,7 @@ async function checkForReleaseNotes(lastSeenVersion, currentVersion = "2.2.5") {
|
|
|
402528
402735
|
releaseNotes
|
|
402529
402736
|
};
|
|
402530
402737
|
}
|
|
402531
|
-
function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "2.
|
|
402738
|
+
function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "2.3.0") {
|
|
402532
402739
|
if (process.env.USER_TYPE === "ant") {
|
|
402533
402740
|
const changelog = MACRO.VERSION_CHANGELOG;
|
|
402534
402741
|
if (changelog) {
|
|
@@ -402685,7 +402892,7 @@ function getRecentActivitySync() {
|
|
|
402685
402892
|
return cachedActivity;
|
|
402686
402893
|
}
|
|
402687
402894
|
function getLogoDisplayData() {
|
|
402688
|
-
const version = process.env.DEMO_VERSION ?? "2.
|
|
402895
|
+
const version = process.env.DEMO_VERSION ?? "2.3.0";
|
|
402689
402896
|
const serverUrl = getDirectConnectServerUrl();
|
|
402690
402897
|
const displayPath = process.env.DEMO_VERSION ? "/code/claude" : getDisplayPath(getCwd());
|
|
402691
402898
|
const cwd2 = serverUrl ? `${displayPath} in ${serverUrl.replace(/^https?:\/\//, "")}` : displayPath;
|
|
@@ -403191,7 +403398,7 @@ var init_referral = __esm(() => {
|
|
|
403191
403398
|
});
|
|
403192
403399
|
|
|
403193
403400
|
// src/components/Logo/feedConfigs.tsx
|
|
403194
|
-
import { homedir as
|
|
403401
|
+
import { homedir as homedir32 } from "os";
|
|
403195
403402
|
function createRecentActivityFeed(activities) {
|
|
403196
403403
|
const lines = activities.map((log2) => {
|
|
403197
403404
|
const time = formatRelativeTimeAgo(log2.modified);
|
|
@@ -403236,7 +403443,7 @@ function createProjectOnboardingFeed(steps) {
|
|
|
403236
403443
|
text: `${checkmark}${text}`
|
|
403237
403444
|
};
|
|
403238
403445
|
});
|
|
403239
|
-
const warningText = getCwd() ===
|
|
403446
|
+
const warningText = getCwd() === homedir32() ? "Note: You have launched claude in your home directory. For the best experience, launch it in a project directory instead." : undefined;
|
|
403240
403447
|
if (warningText) {
|
|
403241
403448
|
lines.push({
|
|
403242
403449
|
text: warningText
|
|
@@ -403785,7 +403992,7 @@ function Logo() {
|
|
|
403785
403992
|
if ($2[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
403786
403993
|
t2 = () => {
|
|
403787
403994
|
const currentConfig = getGlobalConfig();
|
|
403788
|
-
if (currentConfig.lastReleaseNotesSeen === "2.
|
|
403995
|
+
if (currentConfig.lastReleaseNotesSeen === "2.3.0") {
|
|
403789
403996
|
return;
|
|
403790
403997
|
}
|
|
403791
403998
|
saveGlobalConfig(_temp325);
|
|
@@ -404444,12 +404651,12 @@ function Logo() {
|
|
|
404444
404651
|
return t41;
|
|
404445
404652
|
}
|
|
404446
404653
|
function _temp325(current) {
|
|
404447
|
-
if (current.lastReleaseNotesSeen === "2.
|
|
404654
|
+
if (current.lastReleaseNotesSeen === "2.3.0") {
|
|
404448
404655
|
return current;
|
|
404449
404656
|
}
|
|
404450
404657
|
return {
|
|
404451
404658
|
...current,
|
|
404452
|
-
lastReleaseNotesSeen: "2.
|
|
404659
|
+
lastReleaseNotesSeen: "2.3.0"
|
|
404453
404660
|
};
|
|
404454
404661
|
}
|
|
404455
404662
|
function _temp240(s_0) {
|
|
@@ -421806,8 +422013,8 @@ __export(exports_thinkback, {
|
|
|
421806
422013
|
call: () => call70
|
|
421807
422014
|
});
|
|
421808
422015
|
import { execa as execa11 } from "execa";
|
|
421809
|
-
import { readFile as
|
|
421810
|
-
import { join as
|
|
422016
|
+
import { readFile as readFile62 } from "fs/promises";
|
|
422017
|
+
import { join as join141 } from "path";
|
|
421811
422018
|
function getMarketplaceName() {
|
|
421812
422019
|
return OFFICIAL_MARKETPLACE_NAME;
|
|
421813
422020
|
}
|
|
@@ -421825,17 +422032,17 @@ async function getThinkbackSkillDir() {
|
|
|
421825
422032
|
if (!thinkbackPlugin) {
|
|
421826
422033
|
return null;
|
|
421827
422034
|
}
|
|
421828
|
-
const skillDir =
|
|
422035
|
+
const skillDir = join141(thinkbackPlugin.path, "skills", SKILL_NAME);
|
|
421829
422036
|
if (await pathExists(skillDir)) {
|
|
421830
422037
|
return skillDir;
|
|
421831
422038
|
}
|
|
421832
422039
|
return null;
|
|
421833
422040
|
}
|
|
421834
422041
|
async function playAnimation(skillDir) {
|
|
421835
|
-
const dataPath =
|
|
421836
|
-
const playerPath =
|
|
422042
|
+
const dataPath = join141(skillDir, "year_in_review.js");
|
|
422043
|
+
const playerPath = join141(skillDir, "player.js");
|
|
421837
422044
|
try {
|
|
421838
|
-
await
|
|
422045
|
+
await readFile62(dataPath);
|
|
421839
422046
|
} catch (e) {
|
|
421840
422047
|
if (isENOENT(e)) {
|
|
421841
422048
|
return {
|
|
@@ -421850,7 +422057,7 @@ async function playAnimation(skillDir) {
|
|
|
421850
422057
|
};
|
|
421851
422058
|
}
|
|
421852
422059
|
try {
|
|
421853
|
-
await
|
|
422060
|
+
await readFile62(playerPath);
|
|
421854
422061
|
} catch (e) {
|
|
421855
422062
|
if (isENOENT(e)) {
|
|
421856
422063
|
return {
|
|
@@ -421881,7 +422088,7 @@ async function playAnimation(skillDir) {
|
|
|
421881
422088
|
} catch {} finally {
|
|
421882
422089
|
inkInstance.exitAlternateScreen();
|
|
421883
422090
|
}
|
|
421884
|
-
const htmlPath =
|
|
422091
|
+
const htmlPath = join141(skillDir, "year_in_review.html");
|
|
421885
422092
|
if (await pathExists(htmlPath)) {
|
|
421886
422093
|
const platform3 = getPlatform();
|
|
421887
422094
|
const openCmd = platform3 === "macos" ? "open" : platform3 === "windows" ? "start" : "xdg-open";
|
|
@@ -422217,7 +422424,7 @@ function ThinkbackFlow(t0) {
|
|
|
422217
422424
|
if (!skillDir) {
|
|
422218
422425
|
return;
|
|
422219
422426
|
}
|
|
422220
|
-
const dataPath =
|
|
422427
|
+
const dataPath = join141(skillDir, "year_in_review.js");
|
|
422221
422428
|
pathExists(dataPath).then((exists) => {
|
|
422222
422429
|
logForDebugging(`Checking for ${dataPath}: ${exists ? "found" : "not found"}`);
|
|
422223
422430
|
setHasGenerated(exists);
|
|
@@ -422388,7 +422595,7 @@ var exports_thinkback_play = {};
|
|
|
422388
422595
|
__export(exports_thinkback_play, {
|
|
422389
422596
|
call: () => call71
|
|
422390
422597
|
});
|
|
422391
|
-
import { join as
|
|
422598
|
+
import { join as join142 } from "path";
|
|
422392
422599
|
function getPluginId2() {
|
|
422393
422600
|
const marketplaceName = process.env.USER_TYPE === "ant" ? INTERNAL_MARKETPLACE_NAME : OFFICIAL_MARKETPLACE_NAME;
|
|
422394
422601
|
return `thinkback@${marketplaceName}`;
|
|
@@ -422410,7 +422617,7 @@ async function call71() {
|
|
|
422410
422617
|
value: "Thinkback plugin installation path not found."
|
|
422411
422618
|
};
|
|
422412
422619
|
}
|
|
422413
|
-
const skillDir =
|
|
422620
|
+
const skillDir = join142(firstInstall.installPath, "skills", SKILL_NAME2);
|
|
422414
422621
|
const result = await playAnimation(skillDir);
|
|
422415
422622
|
return { type: "text", value: result.message };
|
|
422416
422623
|
}
|
|
@@ -428445,7 +428652,7 @@ __export(exports_branch, {
|
|
|
428445
428652
|
call: () => call79
|
|
428446
428653
|
});
|
|
428447
428654
|
import { randomUUID as randomUUID28 } from "crypto";
|
|
428448
|
-
import { mkdir as
|
|
428655
|
+
import { mkdir as mkdir53, readFile as readFile63, writeFile as writeFile57 } from "fs/promises";
|
|
428449
428656
|
function deriveFirstPrompt(firstUserMessage) {
|
|
428450
428657
|
const content = firstUserMessage?.message?.content;
|
|
428451
428658
|
if (!content)
|
|
@@ -428461,10 +428668,10 @@ async function createFork(customTitle) {
|
|
|
428461
428668
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
428462
428669
|
const forkSessionPath = getTranscriptPathForSession(forkSessionId);
|
|
428463
428670
|
const currentTranscriptPath = getTranscriptPath();
|
|
428464
|
-
await
|
|
428671
|
+
await mkdir53(projectDir, { recursive: true, mode: 448 });
|
|
428465
428672
|
let transcriptContent;
|
|
428466
428673
|
try {
|
|
428467
|
-
transcriptContent = await
|
|
428674
|
+
transcriptContent = await readFile63(currentTranscriptPath);
|
|
428468
428675
|
} catch {
|
|
428469
428676
|
throw new Error("No conversation to branch");
|
|
428470
428677
|
}
|
|
@@ -428509,7 +428716,7 @@ async function createFork(customTitle) {
|
|
|
428509
428716
|
};
|
|
428510
428717
|
lines.push(jsonStringify(forkedReplacementEntry));
|
|
428511
428718
|
}
|
|
428512
|
-
await
|
|
428719
|
+
await writeFile57(forkSessionPath, lines.join(`
|
|
428513
428720
|
`) + `
|
|
428514
428721
|
`, {
|
|
428515
428722
|
encoding: "utf8",
|
|
@@ -428771,8 +428978,8 @@ var init_types11 = __esm(() => {
|
|
|
428771
428978
|
});
|
|
428772
428979
|
|
|
428773
428980
|
// src/components/agents/agentFileUtils.ts
|
|
428774
|
-
import { mkdir as
|
|
428775
|
-
import { join as
|
|
428981
|
+
import { mkdir as mkdir54, open as open12, unlink as unlink19 } from "fs/promises";
|
|
428982
|
+
import { join as join143 } from "path";
|
|
428776
428983
|
function formatAgentAsMarkdown(agentType, whenToUse, tools, systemPrompt, color3, model, memory2, effort) {
|
|
428777
428984
|
const escapedWhenToUse = whenToUse.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\\\n");
|
|
428778
428985
|
const isAllTools = tools === undefined || tools.length === 1 && tools[0] === "*";
|
|
@@ -428799,26 +429006,26 @@ function getAgentDirectoryPath(location) {
|
|
|
428799
429006
|
case "flagSettings":
|
|
428800
429007
|
throw new Error(`Cannot get directory path for ${location} agents`);
|
|
428801
429008
|
case "userSettings":
|
|
428802
|
-
return
|
|
429009
|
+
return join143(getClaudeConfigHomeDir(), AGENT_PATHS.AGENTS_DIR);
|
|
428803
429010
|
case "projectSettings":
|
|
428804
|
-
return
|
|
429011
|
+
return join143(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
428805
429012
|
case "policySettings":
|
|
428806
|
-
return
|
|
429013
|
+
return join143(getManagedFilePath(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
428807
429014
|
case "localSettings":
|
|
428808
|
-
return
|
|
429015
|
+
return join143(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
428809
429016
|
}
|
|
428810
429017
|
}
|
|
428811
429018
|
function getRelativeAgentDirectoryPath(location) {
|
|
428812
429019
|
switch (location) {
|
|
428813
429020
|
case "projectSettings":
|
|
428814
|
-
return
|
|
429021
|
+
return join143(".", AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
428815
429022
|
default:
|
|
428816
429023
|
return getAgentDirectoryPath(location);
|
|
428817
429024
|
}
|
|
428818
429025
|
}
|
|
428819
429026
|
function getNewAgentFilePath(agent) {
|
|
428820
429027
|
const dirPath = getAgentDirectoryPath(agent.source);
|
|
428821
|
-
return
|
|
429028
|
+
return join143(dirPath, `${agent.agentType}.md`);
|
|
428822
429029
|
}
|
|
428823
429030
|
function getActualAgentFilePath(agent) {
|
|
428824
429031
|
if (agent.source === "built-in") {
|
|
@@ -428829,14 +429036,14 @@ function getActualAgentFilePath(agent) {
|
|
|
428829
429036
|
}
|
|
428830
429037
|
const dirPath = getAgentDirectoryPath(agent.source);
|
|
428831
429038
|
const filename = agent.filename || agent.agentType;
|
|
428832
|
-
return
|
|
429039
|
+
return join143(dirPath, `${filename}.md`);
|
|
428833
429040
|
}
|
|
428834
429041
|
function getNewRelativeAgentFilePath(agent) {
|
|
428835
429042
|
if (agent.source === "built-in") {
|
|
428836
429043
|
return "Built-in";
|
|
428837
429044
|
}
|
|
428838
429045
|
const dirPath = getRelativeAgentDirectoryPath(agent.source);
|
|
428839
|
-
return
|
|
429046
|
+
return join143(dirPath, `${agent.agentType}.md`);
|
|
428840
429047
|
}
|
|
428841
429048
|
function getActualRelativeAgentFilePath(agent) {
|
|
428842
429049
|
if (isBuiltInAgent(agent)) {
|
|
@@ -428850,11 +429057,11 @@ function getActualRelativeAgentFilePath(agent) {
|
|
|
428850
429057
|
}
|
|
428851
429058
|
const dirPath = getRelativeAgentDirectoryPath(agent.source);
|
|
428852
429059
|
const filename = agent.filename || agent.agentType;
|
|
428853
|
-
return
|
|
429060
|
+
return join143(dirPath, `${filename}.md`);
|
|
428854
429061
|
}
|
|
428855
429062
|
async function ensureAgentDirectoryExists(source) {
|
|
428856
429063
|
const dirPath = getAgentDirectoryPath(source);
|
|
428857
|
-
await
|
|
429064
|
+
await mkdir54(dirPath, { recursive: true });
|
|
428858
429065
|
return dirPath;
|
|
428859
429066
|
}
|
|
428860
429067
|
async function saveAgentToFile(source, agentType, whenToUse, tools, systemPrompt, checkExists = true, color3, model, memory2, effort) {
|
|
@@ -434817,8 +435024,8 @@ var init_rewind = __esm(() => {
|
|
|
434817
435024
|
|
|
434818
435025
|
// src/utils/heapDumpService.ts
|
|
434819
435026
|
import { createWriteStream as createWriteStream2, writeFileSync as writeFileSync4 } from "fs";
|
|
434820
|
-
import { readdir as readdir35, readFile as
|
|
434821
|
-
import { join as
|
|
435027
|
+
import { readdir as readdir35, readFile as readFile64, writeFile as writeFile58 } from "fs/promises";
|
|
435028
|
+
import { join as join144 } from "path";
|
|
434822
435029
|
import { pipeline as pipeline2 } from "stream/promises";
|
|
434823
435030
|
import {
|
|
434824
435031
|
getHeapSnapshot,
|
|
@@ -434842,7 +435049,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
434842
435049
|
} catch {}
|
|
434843
435050
|
let smapsRollup;
|
|
434844
435051
|
try {
|
|
434845
|
-
smapsRollup = await
|
|
435052
|
+
smapsRollup = await readFile64("/proc/self/smaps_rollup", "utf8");
|
|
434846
435053
|
} catch {}
|
|
434847
435054
|
const nativeMemory = usage.rss - usage.heapUsed;
|
|
434848
435055
|
const bytesPerSecond = uptimeSeconds > 0 ? usage.rss / uptimeSeconds : 0;
|
|
@@ -434908,7 +435115,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
434908
435115
|
smapsRollup,
|
|
434909
435116
|
platform: process.platform,
|
|
434910
435117
|
nodeVersion: process.version,
|
|
434911
|
-
ccVersion: "2.
|
|
435118
|
+
ccVersion: "2.3.0"
|
|
434912
435119
|
};
|
|
434913
435120
|
}
|
|
434914
435121
|
async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
@@ -434926,9 +435133,9 @@ async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
|
434926
435133
|
const suffix = dumpNumber > 0 ? `-dump${dumpNumber}` : "";
|
|
434927
435134
|
const heapFilename = `${sessionId}${suffix}.heapsnapshot`;
|
|
434928
435135
|
const diagFilename = `${sessionId}${suffix}-diagnostics.json`;
|
|
434929
|
-
const heapPath =
|
|
434930
|
-
const diagPath =
|
|
434931
|
-
await
|
|
435136
|
+
const heapPath = join144(dumpDir, heapFilename);
|
|
435137
|
+
const diagPath = join144(dumpDir, diagFilename);
|
|
435138
|
+
await writeFile58(diagPath, jsonStringify(diagnostics, null, 2), {
|
|
434932
435139
|
mode: 384
|
|
434933
435140
|
});
|
|
434934
435141
|
logForDebugging(`[HeapDump] Diagnostics written to ${diagPath}`);
|
|
@@ -435493,7 +435700,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
435493
435700
|
var call86 = async () => {
|
|
435494
435701
|
return {
|
|
435495
435702
|
type: "text",
|
|
435496
|
-
value: `${"2.
|
|
435703
|
+
value: `${"2.3.0"} (built ${"2026-05-10T17:25:06.612Z"})`
|
|
435497
435704
|
};
|
|
435498
435705
|
}, version, version_default;
|
|
435499
435706
|
var init_version = __esm(() => {
|
|
@@ -436860,8 +437067,8 @@ var init_advisor2 = __esm(() => {
|
|
|
436860
437067
|
|
|
436861
437068
|
// src/skills/bundledSkills.ts
|
|
436862
437069
|
import { constants as fsConstants4 } from "fs";
|
|
436863
|
-
import { mkdir as
|
|
436864
|
-
import { dirname as
|
|
437070
|
+
import { mkdir as mkdir55, open as open13 } from "fs/promises";
|
|
437071
|
+
import { dirname as dirname54, isAbsolute as isAbsolute23, join as join145, normalize as normalize12, sep as pathSep2 } from "path";
|
|
436865
437072
|
function registerBundledSkill(definition) {
|
|
436866
437073
|
const { files: files2 } = definition;
|
|
436867
437074
|
let skillRoot;
|
|
@@ -436909,7 +437116,7 @@ function getBundledSkills() {
|
|
|
436909
437116
|
return [...bundledSkills];
|
|
436910
437117
|
}
|
|
436911
437118
|
function getBundledSkillExtractDir(skillName) {
|
|
436912
|
-
return
|
|
437119
|
+
return join145(getBundledSkillsRoot(), skillName);
|
|
436913
437120
|
}
|
|
436914
437121
|
async function extractBundledSkillFiles(skillName, files2) {
|
|
436915
437122
|
const dir = getBundledSkillExtractDir(skillName);
|
|
@@ -436925,7 +437132,7 @@ async function writeSkillFiles(dir, files2) {
|
|
|
436925
437132
|
const byParent = new Map;
|
|
436926
437133
|
for (const [relPath, content] of Object.entries(files2)) {
|
|
436927
437134
|
const target = resolveSkillFilePath(dir, relPath);
|
|
436928
|
-
const parent2 =
|
|
437135
|
+
const parent2 = dirname54(target);
|
|
436929
437136
|
const entry = [target, content];
|
|
436930
437137
|
const group = byParent.get(parent2);
|
|
436931
437138
|
if (group)
|
|
@@ -436934,7 +437141,7 @@ async function writeSkillFiles(dir, files2) {
|
|
|
436934
437141
|
byParent.set(parent2, [entry]);
|
|
436935
437142
|
}
|
|
436936
437143
|
await Promise.all([...byParent].map(async ([parent2, entries]) => {
|
|
436937
|
-
await
|
|
437144
|
+
await mkdir55(parent2, { recursive: true, mode: 448 });
|
|
436938
437145
|
await Promise.all(entries.map(([p, c5]) => safeWriteFile(p, c5)));
|
|
436939
437146
|
}));
|
|
436940
437147
|
}
|
|
@@ -436951,7 +437158,7 @@ function resolveSkillFilePath(baseDir, relPath) {
|
|
|
436951
437158
|
if (isAbsolute23(normalized) || normalized.split(pathSep2).includes("..") || normalized.split("/").includes("..")) {
|
|
436952
437159
|
throw new Error(`bundled skill file path escapes skill dir: ${relPath}`);
|
|
436953
437160
|
}
|
|
436954
|
-
return
|
|
437161
|
+
return join145(baseDir, normalized);
|
|
436955
437162
|
}
|
|
436956
437163
|
function prependBaseDir(blocks, baseDir) {
|
|
436957
437164
|
const prefix = `Base directory for this skill: ${baseDir}
|
|
@@ -437310,7 +437517,7 @@ var init_exit2 = __esm(() => {
|
|
|
437310
437517
|
});
|
|
437311
437518
|
|
|
437312
437519
|
// src/components/ExportDialog.tsx
|
|
437313
|
-
import { join as
|
|
437520
|
+
import { join as join146 } from "path";
|
|
437314
437521
|
function ExportDialog({
|
|
437315
437522
|
content,
|
|
437316
437523
|
defaultFilename,
|
|
@@ -437343,7 +437550,7 @@ function ExportDialog({
|
|
|
437343
437550
|
};
|
|
437344
437551
|
const handleFilenameSubmit = () => {
|
|
437345
437552
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
437346
|
-
const filepath =
|
|
437553
|
+
const filepath = join146(getCwd(), finalFilename);
|
|
437347
437554
|
try {
|
|
437348
437555
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
437349
437556
|
encoding: "utf-8",
|
|
@@ -437566,7 +437773,7 @@ __export(exports_export, {
|
|
|
437566
437773
|
extractFirstPrompt: () => extractFirstPrompt,
|
|
437567
437774
|
call: () => call90
|
|
437568
437775
|
});
|
|
437569
|
-
import { join as
|
|
437776
|
+
import { join as join147 } from "path";
|
|
437570
437777
|
function formatTimestamp(date2) {
|
|
437571
437778
|
const year = date2.getFullYear();
|
|
437572
437779
|
const month = String(date2.getMonth() + 1).padStart(2, "0");
|
|
@@ -437610,7 +437817,7 @@ async function call90(onDone, context7, args) {
|
|
|
437610
437817
|
const filename = args.trim();
|
|
437611
437818
|
if (filename) {
|
|
437612
437819
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
437613
|
-
const filepath =
|
|
437820
|
+
const filepath = join147(getCwd(), finalFilename);
|
|
437614
437821
|
try {
|
|
437615
437822
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
437616
437823
|
encoding: "utf-8",
|
|
@@ -439155,7 +439362,7 @@ var init_asciichart = __esm(() => {
|
|
|
439155
439362
|
// src/utils/statsCache.ts
|
|
439156
439363
|
import { randomBytes as randomBytes19 } from "crypto";
|
|
439157
439364
|
import { open as open14 } from "fs/promises";
|
|
439158
|
-
import { join as
|
|
439365
|
+
import { join as join148 } from "path";
|
|
439159
439366
|
async function withStatsCacheLock(fn) {
|
|
439160
439367
|
while (statsCacheLockPromise) {
|
|
439161
439368
|
await statsCacheLockPromise;
|
|
@@ -439172,7 +439379,7 @@ async function withStatsCacheLock(fn) {
|
|
|
439172
439379
|
}
|
|
439173
439380
|
}
|
|
439174
439381
|
function getStatsCachePath() {
|
|
439175
|
-
return
|
|
439382
|
+
return join148(getClaudeConfigHomeDir(), STATS_CACHE_FILENAME);
|
|
439176
439383
|
}
|
|
439177
439384
|
function getEmptyCache() {
|
|
439178
439385
|
return {
|
|
@@ -439838,16 +440045,16 @@ var init_ansiToPng = __esm(() => {
|
|
|
439838
440045
|
});
|
|
439839
440046
|
|
|
439840
440047
|
// src/utils/screenshotClipboard.ts
|
|
439841
|
-
import { mkdir as
|
|
440048
|
+
import { mkdir as mkdir56, unlink as unlink20, writeFile as writeFile59 } from "fs/promises";
|
|
439842
440049
|
import { tmpdir as tmpdir8 } from "os";
|
|
439843
|
-
import { join as
|
|
440050
|
+
import { join as join149 } from "path";
|
|
439844
440051
|
async function copyAnsiToClipboard(ansiText, options) {
|
|
439845
440052
|
try {
|
|
439846
|
-
const tempDir =
|
|
439847
|
-
await
|
|
439848
|
-
const pngPath =
|
|
440053
|
+
const tempDir = join149(tmpdir8(), "claude-code-screenshots");
|
|
440054
|
+
await mkdir56(tempDir, { recursive: true });
|
|
440055
|
+
const pngPath = join149(tempDir, `screenshot-${Date.now()}.png`);
|
|
439849
440056
|
const pngBuffer = ansiToPng(ansiText, options);
|
|
439850
|
-
await
|
|
440057
|
+
await writeFile59(pngPath, pngBuffer);
|
|
439851
440058
|
const result = await copyPngToClipboard(pngPath);
|
|
439852
440059
|
try {
|
|
439853
440060
|
await unlink20(pngPath);
|
|
@@ -439916,7 +440123,7 @@ var init_screenshotClipboard = __esm(() => {
|
|
|
439916
440123
|
|
|
439917
440124
|
// src/utils/stats.ts
|
|
439918
440125
|
import { open as open15 } from "fs/promises";
|
|
439919
|
-
import { basename as basename42, join as
|
|
440126
|
+
import { basename as basename42, join as join150, sep as sep30 } from "path";
|
|
439920
440127
|
async function processSessionFiles(sessionFiles, options = {}) {
|
|
439921
440128
|
const { fromDate, toDate } = options;
|
|
439922
440129
|
const fs5 = getFsImplementation();
|
|
@@ -440094,17 +440301,17 @@ async function getAllSessionFiles() {
|
|
|
440094
440301
|
return [];
|
|
440095
440302
|
throw e;
|
|
440096
440303
|
}
|
|
440097
|
-
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
440304
|
+
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) => join150(projectsDir, dirent.name));
|
|
440098
440305
|
const projectResults = await Promise.all(projectDirs.map(async (projectDir) => {
|
|
440099
440306
|
try {
|
|
440100
440307
|
const entries = await fs5.readdir(projectDir);
|
|
440101
|
-
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) =>
|
|
440308
|
+
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) => join150(projectDir, dirent.name));
|
|
440102
440309
|
const sessionDirs = entries.filter((dirent) => dirent.isDirectory());
|
|
440103
440310
|
const subagentResults = await Promise.all(sessionDirs.map(async (sessionDir) => {
|
|
440104
|
-
const subagentsDir =
|
|
440311
|
+
const subagentsDir = join150(projectDir, sessionDir.name, "subagents");
|
|
440105
440312
|
try {
|
|
440106
440313
|
const subagentEntries = await fs5.readdir(subagentsDir);
|
|
440107
|
-
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) =>
|
|
440314
|
+
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) => join150(subagentsDir, dirent.name));
|
|
440108
440315
|
} catch {
|
|
440109
440316
|
return [];
|
|
440110
440317
|
}
|
|
@@ -441974,16 +442181,16 @@ import { execFileSync as execFileSync3 } from "child_process";
|
|
|
441974
442181
|
import { constants as fsConstants5 } from "fs";
|
|
441975
442182
|
import {
|
|
441976
442183
|
copyFile as copyFile9,
|
|
441977
|
-
mkdir as
|
|
442184
|
+
mkdir as mkdir57,
|
|
441978
442185
|
mkdtemp,
|
|
441979
442186
|
readdir as readdir36,
|
|
441980
|
-
readFile as
|
|
442187
|
+
readFile as readFile65,
|
|
441981
442188
|
rm as rm11,
|
|
441982
442189
|
unlink as unlink21,
|
|
441983
|
-
writeFile as
|
|
442190
|
+
writeFile as writeFile60
|
|
441984
442191
|
} from "fs/promises";
|
|
441985
442192
|
import { tmpdir as tmpdir9 } from "os";
|
|
441986
|
-
import { extname as extname14, join as
|
|
442193
|
+
import { extname as extname14, join as join151 } from "path";
|
|
441987
442194
|
function getAnalysisModel() {
|
|
441988
442195
|
return getDefaultOpusModel();
|
|
441989
442196
|
}
|
|
@@ -441991,13 +442198,13 @@ function getInsightsModel() {
|
|
|
441991
442198
|
return getDefaultOpusModel();
|
|
441992
442199
|
}
|
|
441993
442200
|
function getDataDir() {
|
|
441994
|
-
return
|
|
442201
|
+
return join151(getClaudeConfigHomeDir(), "usage-data");
|
|
441995
442202
|
}
|
|
441996
442203
|
function getFacetsDir() {
|
|
441997
|
-
return
|
|
442204
|
+
return join151(getDataDir(), "facets");
|
|
441998
442205
|
}
|
|
441999
442206
|
function getSessionMetaDir() {
|
|
442000
|
-
return
|
|
442207
|
+
return join151(getDataDir(), "session-meta");
|
|
442001
442208
|
}
|
|
442002
442209
|
function getLanguageFromPath(filePath) {
|
|
442003
442210
|
const ext = extname14(filePath).toLowerCase();
|
|
@@ -442342,9 +442549,9 @@ async function formatTranscriptWithSummarization(log2) {
|
|
|
442342
442549
|
`);
|
|
442343
442550
|
}
|
|
442344
442551
|
async function loadCachedFacets(sessionId) {
|
|
442345
|
-
const facetPath =
|
|
442552
|
+
const facetPath = join151(getFacetsDir(), `${sessionId}.json`);
|
|
442346
442553
|
try {
|
|
442347
|
-
const content = await
|
|
442554
|
+
const content = await readFile65(facetPath, { encoding: "utf-8" });
|
|
442348
442555
|
const parsed = jsonParse(content);
|
|
442349
442556
|
if (!isValidSessionFacets(parsed)) {
|
|
442350
442557
|
try {
|
|
@@ -442359,18 +442566,18 @@ async function loadCachedFacets(sessionId) {
|
|
|
442359
442566
|
}
|
|
442360
442567
|
async function saveFacets(facets) {
|
|
442361
442568
|
try {
|
|
442362
|
-
await
|
|
442569
|
+
await mkdir57(getFacetsDir(), { recursive: true });
|
|
442363
442570
|
} catch {}
|
|
442364
|
-
const facetPath =
|
|
442365
|
-
await
|
|
442571
|
+
const facetPath = join151(getFacetsDir(), `${facets.session_id}.json`);
|
|
442572
|
+
await writeFile60(facetPath, jsonStringify(facets, null, 2), {
|
|
442366
442573
|
encoding: "utf-8",
|
|
442367
442574
|
mode: 384
|
|
442368
442575
|
});
|
|
442369
442576
|
}
|
|
442370
442577
|
async function loadCachedSessionMeta(sessionId) {
|
|
442371
|
-
const metaPath =
|
|
442578
|
+
const metaPath = join151(getSessionMetaDir(), `${sessionId}.json`);
|
|
442372
442579
|
try {
|
|
442373
|
-
const content = await
|
|
442580
|
+
const content = await readFile65(metaPath, { encoding: "utf-8" });
|
|
442374
442581
|
return jsonParse(content);
|
|
442375
442582
|
} catch {
|
|
442376
442583
|
return null;
|
|
@@ -442378,10 +442585,10 @@ async function loadCachedSessionMeta(sessionId) {
|
|
|
442378
442585
|
}
|
|
442379
442586
|
async function saveSessionMeta(meta) {
|
|
442380
442587
|
try {
|
|
442381
|
-
await
|
|
442588
|
+
await mkdir57(getSessionMetaDir(), { recursive: true });
|
|
442382
442589
|
} catch {}
|
|
442383
|
-
const metaPath =
|
|
442384
|
-
await
|
|
442590
|
+
const metaPath = join151(getSessionMetaDir(), `${meta.session_id}.json`);
|
|
442591
|
+
await writeFile60(metaPath, jsonStringify(meta, null, 2), {
|
|
442385
442592
|
encoding: "utf-8",
|
|
442386
442593
|
mode: 384
|
|
442387
442594
|
});
|
|
@@ -443437,7 +443644,7 @@ function generateHtmlReport(data, insights) {
|
|
|
443437
443644
|
</html>`;
|
|
443438
443645
|
}
|
|
443439
443646
|
function buildExportData(data, insights, facets, remoteStats) {
|
|
443440
|
-
const version2 = typeof MACRO !== "undefined" ? "2.
|
|
443647
|
+
const version2 = typeof MACRO !== "undefined" ? "2.3.0" : "unknown";
|
|
443441
443648
|
const remote_hosts_collected = remoteStats?.hosts.filter((h) => h.sessionCount > 0).map((h) => h.name);
|
|
443442
443649
|
const facets_summary = {
|
|
443443
443650
|
total: facets.size,
|
|
@@ -443488,7 +443695,7 @@ async function scanAllSessions() {
|
|
|
443488
443695
|
} catch {
|
|
443489
443696
|
return [];
|
|
443490
443697
|
}
|
|
443491
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
443698
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join151(projectsDir, dirent.name));
|
|
443492
443699
|
const allSessions = [];
|
|
443493
443700
|
for (let i2 = 0;i2 < projectDirs.length; i2++) {
|
|
443494
443701
|
const sessionFiles = await getSessionFilesWithMtime(projectDirs[i2]);
|
|
@@ -443510,7 +443717,7 @@ async function scanAllSessions() {
|
|
|
443510
443717
|
async function generateUsageReport(options) {
|
|
443511
443718
|
let remoteStats;
|
|
443512
443719
|
if (process.env.USER_TYPE === "ant" && options?.collectRemote) {
|
|
443513
|
-
const destDir =
|
|
443720
|
+
const destDir = join151(getClaudeConfigHomeDir(), "projects");
|
|
443514
443721
|
const { hosts, totalCopied } = await collectAllRemoteHostData(destDir);
|
|
443515
443722
|
remoteStats = { hosts, totalCopied };
|
|
443516
443723
|
}
|
|
@@ -443647,10 +443854,10 @@ async function generateUsageReport(options) {
|
|
|
443647
443854
|
const insights = await generateParallelInsights(aggregated, facets);
|
|
443648
443855
|
const htmlReport = generateHtmlReport(aggregated, insights);
|
|
443649
443856
|
try {
|
|
443650
|
-
await
|
|
443857
|
+
await mkdir57(getDataDir(), { recursive: true });
|
|
443651
443858
|
} catch {}
|
|
443652
|
-
const htmlPath =
|
|
443653
|
-
await
|
|
443859
|
+
const htmlPath = join151(getDataDir(), "report.html");
|
|
443860
|
+
await writeFile60(htmlPath, htmlReport, {
|
|
443654
443861
|
encoding: "utf-8",
|
|
443655
443862
|
mode: 384
|
|
443656
443863
|
});
|
|
@@ -443745,13 +443952,13 @@ var init_insights = __esm(() => {
|
|
|
443745
443952
|
} : async () => 0;
|
|
443746
443953
|
collectFromRemoteHost = process.env.USER_TYPE === "ant" ? async (homespace, destDir) => {
|
|
443747
443954
|
const result = { copied: 0, skipped: 0 };
|
|
443748
|
-
const tempDir = await mkdtemp(
|
|
443955
|
+
const tempDir = await mkdtemp(join151(tmpdir9(), "claude-hs-"));
|
|
443749
443956
|
try {
|
|
443750
443957
|
const scpResult = await execFileNoThrow("scp", ["-rq", `${homespace}.coder:/root/.claude/projects/`, tempDir], { timeout: 300000 });
|
|
443751
443958
|
if (scpResult.code !== 0) {
|
|
443752
443959
|
return result;
|
|
443753
443960
|
}
|
|
443754
|
-
const projectsDir =
|
|
443961
|
+
const projectsDir = join151(tempDir, "projects");
|
|
443755
443962
|
let projectDirents;
|
|
443756
443963
|
try {
|
|
443757
443964
|
projectDirents = await readdir36(projectsDir, { withFileTypes: true });
|
|
@@ -443760,13 +443967,13 @@ var init_insights = __esm(() => {
|
|
|
443760
443967
|
}
|
|
443761
443968
|
await Promise.all(projectDirents.map(async (dirent) => {
|
|
443762
443969
|
const projectName = dirent.name;
|
|
443763
|
-
const projectPath =
|
|
443970
|
+
const projectPath = join151(projectsDir, projectName);
|
|
443764
443971
|
if (!dirent.isDirectory())
|
|
443765
443972
|
return;
|
|
443766
443973
|
const destProjectName = `${projectName}__${homespace}`;
|
|
443767
|
-
const destProjectPath =
|
|
443974
|
+
const destProjectPath = join151(destDir, destProjectName);
|
|
443768
443975
|
try {
|
|
443769
|
-
await
|
|
443976
|
+
await mkdir57(destProjectPath, { recursive: true });
|
|
443770
443977
|
} catch {}
|
|
443771
443978
|
let files2;
|
|
443772
443979
|
try {
|
|
@@ -443778,8 +443985,8 @@ var init_insights = __esm(() => {
|
|
|
443778
443985
|
const fileName = fileDirent.name;
|
|
443779
443986
|
if (!fileName.endsWith(".jsonl"))
|
|
443780
443987
|
return;
|
|
443781
|
-
const srcFile =
|
|
443782
|
-
const destFile =
|
|
443988
|
+
const srcFile = join151(projectPath, fileName);
|
|
443989
|
+
const destFile = join151(destProjectPath, fileName);
|
|
443783
443990
|
try {
|
|
443784
443991
|
await copyFile9(srcFile, destFile, fsConstants5.COPYFILE_EXCL);
|
|
443785
443992
|
result.copied++;
|
|
@@ -444808,14 +445015,14 @@ import { closeSync as closeSync4, fstatSync, openSync as openSync5, readSync as
|
|
|
444808
445015
|
import {
|
|
444809
445016
|
appendFile as fsAppendFile,
|
|
444810
445017
|
open as fsOpen2,
|
|
444811
|
-
mkdir as
|
|
445018
|
+
mkdir as mkdir58,
|
|
444812
445019
|
readdir as readdir37,
|
|
444813
|
-
readFile as
|
|
445020
|
+
readFile as readFile66,
|
|
444814
445021
|
stat as stat50,
|
|
444815
445022
|
unlink as unlink22,
|
|
444816
|
-
writeFile as
|
|
445023
|
+
writeFile as writeFile61
|
|
444817
445024
|
} from "fs/promises";
|
|
444818
|
-
import { basename as basename43, dirname as
|
|
445025
|
+
import { basename as basename43, dirname as dirname56, join as join152 } from "path";
|
|
444819
445026
|
function isTranscriptMessage(entry) {
|
|
444820
445027
|
return entry.type === "user" || entry.type === "assistant" || entry.type === "attachment" || entry.type === "system";
|
|
444821
445028
|
}
|
|
@@ -444829,18 +445036,18 @@ function isEphemeralToolProgress(dataType) {
|
|
|
444829
445036
|
return typeof dataType === "string" && EPHEMERAL_PROGRESS_TYPES.has(dataType);
|
|
444830
445037
|
}
|
|
444831
445038
|
function getProjectsDir2() {
|
|
444832
|
-
return
|
|
445039
|
+
return join152(getClaudeConfigHomeDir(), "projects");
|
|
444833
445040
|
}
|
|
444834
445041
|
function getTranscriptPath() {
|
|
444835
445042
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
444836
|
-
return
|
|
445043
|
+
return join152(projectDir, `${getSessionId()}.jsonl`);
|
|
444837
445044
|
}
|
|
444838
445045
|
function getTranscriptPathForSession(sessionId) {
|
|
444839
445046
|
if (sessionId === getSessionId()) {
|
|
444840
445047
|
return getTranscriptPath();
|
|
444841
445048
|
}
|
|
444842
445049
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
444843
|
-
return
|
|
445050
|
+
return join152(projectDir, `${sessionId}.jsonl`);
|
|
444844
445051
|
}
|
|
444845
445052
|
function setAgentTranscriptSubdir(agentId, subdir) {
|
|
444846
445053
|
agentTranscriptSubdirs.set(agentId, subdir);
|
|
@@ -444852,21 +445059,21 @@ function getAgentTranscriptPath(agentId) {
|
|
|
444852
445059
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
444853
445060
|
const sessionId = getSessionId();
|
|
444854
445061
|
const subdir = agentTranscriptSubdirs.get(agentId);
|
|
444855
|
-
const base = subdir ?
|
|
444856
|
-
return
|
|
445062
|
+
const base = subdir ? join152(projectDir, sessionId, "subagents", subdir) : join152(projectDir, sessionId, "subagents");
|
|
445063
|
+
return join152(base, `agent-${agentId}.jsonl`);
|
|
444857
445064
|
}
|
|
444858
445065
|
function getAgentMetadataPath(agentId) {
|
|
444859
445066
|
return getAgentTranscriptPath(agentId).replace(/\.jsonl$/, ".meta.json");
|
|
444860
445067
|
}
|
|
444861
445068
|
async function writeAgentMetadata(agentId, metadata) {
|
|
444862
445069
|
const path15 = getAgentMetadataPath(agentId);
|
|
444863
|
-
await
|
|
444864
|
-
await
|
|
445070
|
+
await mkdir58(dirname56(path15), { recursive: true });
|
|
445071
|
+
await writeFile61(path15, JSON.stringify(metadata));
|
|
444865
445072
|
}
|
|
444866
445073
|
async function readAgentMetadata(agentId) {
|
|
444867
445074
|
const path15 = getAgentMetadataPath(agentId);
|
|
444868
445075
|
try {
|
|
444869
|
-
const raw = await
|
|
445076
|
+
const raw = await readFile66(path15, "utf-8");
|
|
444870
445077
|
return JSON.parse(raw);
|
|
444871
445078
|
} catch (e) {
|
|
444872
445079
|
if (isFsInaccessible(e))
|
|
@@ -444876,20 +445083,20 @@ async function readAgentMetadata(agentId) {
|
|
|
444876
445083
|
}
|
|
444877
445084
|
function getRemoteAgentsDir() {
|
|
444878
445085
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
444879
|
-
return
|
|
445086
|
+
return join152(projectDir, getSessionId(), "remote-agents");
|
|
444880
445087
|
}
|
|
444881
445088
|
function getRemoteAgentMetadataPath(taskId) {
|
|
444882
|
-
return
|
|
445089
|
+
return join152(getRemoteAgentsDir(), `remote-agent-${taskId}.meta.json`);
|
|
444883
445090
|
}
|
|
444884
445091
|
async function writeRemoteAgentMetadata(taskId, metadata) {
|
|
444885
445092
|
const path15 = getRemoteAgentMetadataPath(taskId);
|
|
444886
|
-
await
|
|
444887
|
-
await
|
|
445093
|
+
await mkdir58(dirname56(path15), { recursive: true });
|
|
445094
|
+
await writeFile61(path15, JSON.stringify(metadata));
|
|
444888
445095
|
}
|
|
444889
445096
|
async function readRemoteAgentMetadata(taskId) {
|
|
444890
445097
|
const path15 = getRemoteAgentMetadataPath(taskId);
|
|
444891
445098
|
try {
|
|
444892
|
-
const raw = await
|
|
445099
|
+
const raw = await readFile66(path15, "utf-8");
|
|
444893
445100
|
return JSON.parse(raw);
|
|
444894
445101
|
} catch (e) {
|
|
444895
445102
|
if (isFsInaccessible(e))
|
|
@@ -444922,7 +445129,7 @@ async function listRemoteAgentMetadata() {
|
|
|
444922
445129
|
if (!entry.isFile() || !entry.name.endsWith(".meta.json"))
|
|
444923
445130
|
continue;
|
|
444924
445131
|
try {
|
|
444925
|
-
const raw = await
|
|
445132
|
+
const raw = await readFile66(join152(dir, entry.name), "utf-8");
|
|
444926
445133
|
results.push(JSON.parse(raw));
|
|
444927
445134
|
} catch (e) {
|
|
444928
445135
|
logForDebugging(`listRemoteAgentMetadata: skipping ${entry.name}: ${String(e)}`);
|
|
@@ -444932,7 +445139,7 @@ async function listRemoteAgentMetadata() {
|
|
|
444932
445139
|
}
|
|
444933
445140
|
function sessionIdExists(sessionId) {
|
|
444934
445141
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
444935
|
-
const sessionFile =
|
|
445142
|
+
const sessionFile = join152(projectDir, `${sessionId}.jsonl`);
|
|
444936
445143
|
const fs5 = getFsImplementation();
|
|
444937
445144
|
try {
|
|
444938
445145
|
fs5.statSync(sessionFile);
|
|
@@ -445072,7 +445279,7 @@ class Project {
|
|
|
445072
445279
|
try {
|
|
445073
445280
|
await fsAppendFile(filePath, data, { mode: 384 });
|
|
445074
445281
|
} catch {
|
|
445075
|
-
await
|
|
445282
|
+
await mkdir58(dirname56(filePath), { recursive: true, mode: 448 });
|
|
445076
445283
|
await fsAppendFile(filePath, data, { mode: 384 });
|
|
445077
445284
|
}
|
|
445078
445285
|
}
|
|
@@ -445264,7 +445471,7 @@ class Project {
|
|
|
445264
445471
|
logForDebugging(`Skipping tombstone removal: session file too large (${formatFileSize(fileSize)})`, { level: "warn" });
|
|
445265
445472
|
return;
|
|
445266
445473
|
}
|
|
445267
|
-
const content = await
|
|
445474
|
+
const content = await readFile66(this.sessionFile, { encoding: "utf-8" });
|
|
445268
445475
|
const lines = content.split(`
|
|
445269
445476
|
`).filter((line) => {
|
|
445270
445477
|
if (!line.trim())
|
|
@@ -445276,7 +445483,7 @@ class Project {
|
|
|
445276
445483
|
return true;
|
|
445277
445484
|
}
|
|
445278
445485
|
});
|
|
445279
|
-
await
|
|
445486
|
+
await writeFile61(this.sessionFile, lines.join(`
|
|
445280
445487
|
`), {
|
|
445281
445488
|
encoding: "utf8"
|
|
445282
445489
|
});
|
|
@@ -445613,11 +445820,11 @@ async function hydrateRemoteSession(sessionId, ingressUrl) {
|
|
|
445613
445820
|
try {
|
|
445614
445821
|
const remoteLogs = await getSessionLogs(sessionId, ingressUrl) || [];
|
|
445615
445822
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
445616
|
-
await
|
|
445823
|
+
await mkdir58(projectDir, { recursive: true, mode: 448 });
|
|
445617
445824
|
const sessionFile = getTranscriptPathForSession(sessionId);
|
|
445618
445825
|
const content = remoteLogs.map((e) => jsonStringify(e) + `
|
|
445619
445826
|
`).join("");
|
|
445620
|
-
await
|
|
445827
|
+
await writeFile61(sessionFile, content, { encoding: "utf8", mode: 384 });
|
|
445621
445828
|
logForDebugging(`Hydrated ${remoteLogs.length} entries from remote`);
|
|
445622
445829
|
return remoteLogs.length > 0;
|
|
445623
445830
|
} catch (error5) {
|
|
@@ -445645,11 +445852,11 @@ async function hydrateFromCCRv2InternalEvents(sessionId) {
|
|
|
445645
445852
|
return false;
|
|
445646
445853
|
}
|
|
445647
445854
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
445648
|
-
await
|
|
445855
|
+
await mkdir58(projectDir, { recursive: true, mode: 448 });
|
|
445649
445856
|
const sessionFile = getTranscriptPathForSession(sessionId);
|
|
445650
445857
|
const fgContent = events2.map((e) => jsonStringify(e.payload) + `
|
|
445651
445858
|
`).join("");
|
|
445652
|
-
await
|
|
445859
|
+
await writeFile61(sessionFile, fgContent, { encoding: "utf8", mode: 384 });
|
|
445653
445860
|
logForDebugging(`Hydrated ${events2.length} foreground entries from CCR v2 internal events`);
|
|
445654
445861
|
let subagentEventCount = 0;
|
|
445655
445862
|
const subagentReader = project2.getInternalSubagentEventReader();
|
|
@@ -445671,10 +445878,10 @@ async function hydrateFromCCRv2InternalEvents(sessionId) {
|
|
|
445671
445878
|
}
|
|
445672
445879
|
for (const [agentId, entries] of byAgent) {
|
|
445673
445880
|
const agentFile = getAgentTranscriptPath(asAgentId(agentId));
|
|
445674
|
-
await
|
|
445881
|
+
await mkdir58(dirname56(agentFile), { recursive: true, mode: 448 });
|
|
445675
445882
|
const agentContent = entries.map((p) => jsonStringify(p) + `
|
|
445676
445883
|
`).join("");
|
|
445677
|
-
await
|
|
445884
|
+
await writeFile61(agentFile, agentContent, {
|
|
445678
445885
|
encoding: "utf8",
|
|
445679
445886
|
mode: 384
|
|
445680
445887
|
});
|
|
@@ -446074,7 +446281,7 @@ async function loadTranscriptFromFile(filePath) {
|
|
|
446074
446281
|
worktreeSession: worktreeStates.has(sessionId) ? worktreeStates.get(sessionId) : undefined
|
|
446075
446282
|
};
|
|
446076
446283
|
}
|
|
446077
|
-
const content = await
|
|
446284
|
+
const content = await readFile66(filePath, { encoding: "utf-8" });
|
|
446078
446285
|
let parsed;
|
|
446079
446286
|
try {
|
|
446080
446287
|
parsed = jsonParse(content);
|
|
@@ -446208,7 +446415,7 @@ function appendEntryToFile(fullPath, entry) {
|
|
|
446208
446415
|
try {
|
|
446209
446416
|
fs5.appendFileSync(fullPath, line, { mode: 384 });
|
|
446210
446417
|
} catch {
|
|
446211
|
-
fs5.mkdirSync(
|
|
446418
|
+
fs5.mkdirSync(dirname56(fullPath), { mode: 448 });
|
|
446212
446419
|
fs5.appendFileSync(fullPath, line, { mode: 384 });
|
|
446213
446420
|
}
|
|
446214
446421
|
}
|
|
@@ -446736,7 +446943,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
446736
446943
|
}
|
|
446737
446944
|
}
|
|
446738
446945
|
}
|
|
446739
|
-
buf ??= await
|
|
446946
|
+
buf ??= await readFile66(filePath);
|
|
446740
446947
|
if (!opts?.keepAllLeaves && !hasPreservedSegment && !isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_PRECOMPACT_SKIP) && buf.length > SKIP_PRECOMPACT_THRESHOLD) {
|
|
446741
446948
|
buf = walkChainBeforeParse(buf);
|
|
446742
446949
|
}
|
|
@@ -446901,7 +447108,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
446901
447108
|
};
|
|
446902
447109
|
}
|
|
446903
447110
|
async function loadSessionFile(sessionId) {
|
|
446904
|
-
const sessionFile =
|
|
447111
|
+
const sessionFile = join152(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), `${sessionId}.jsonl`);
|
|
446905
447112
|
return loadTranscriptFile(sessionFile);
|
|
446906
447113
|
}
|
|
446907
447114
|
function clearSessionMessagesCache() {
|
|
@@ -446969,7 +447176,7 @@ async function loadAllProjectsMessageLogsFull(limit) {
|
|
|
446969
447176
|
} catch {
|
|
446970
447177
|
return [];
|
|
446971
447178
|
}
|
|
446972
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
447179
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join152(projectsDir, dirent.name));
|
|
446973
447180
|
const logsPerProject = await Promise.all(projectDirs.map((projectDir) => getLogsWithoutIndex(projectDir, limit)));
|
|
446974
447181
|
const allLogs = logsPerProject.flat();
|
|
446975
447182
|
const deduped = new Map;
|
|
@@ -446994,7 +447201,7 @@ async function loadAllProjectsMessageLogsProgressive(limit, initialEnrichCount =
|
|
|
446994
447201
|
} catch {
|
|
446995
447202
|
return { logs: [], allStatLogs: [], nextIndex: 0 };
|
|
446996
447203
|
}
|
|
446997
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
447204
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join152(projectsDir, dirent.name));
|
|
446998
447205
|
const rawLogs = [];
|
|
446999
447206
|
for (const projectDir of projectDirs) {
|
|
447000
447207
|
rawLogs.push(...await getSessionFilesLite(projectDir, limit));
|
|
@@ -447055,7 +447262,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
|
|
|
447055
447262
|
for (const { path: wtPath, prefix } of indexed) {
|
|
447056
447263
|
if (dirName === prefix || dirName.startsWith(prefix + "-")) {
|
|
447057
447264
|
seenDirs.add(dirName);
|
|
447058
|
-
allLogs.push(...await getSessionFilesLite(
|
|
447265
|
+
allLogs.push(...await getSessionFilesLite(join152(projectsDir, dirent.name), undefined, wtPath));
|
|
447059
447266
|
break;
|
|
447060
447267
|
}
|
|
447061
447268
|
}
|
|
@@ -447124,7 +447331,7 @@ async function loadSubagentTranscripts(agentIds) {
|
|
|
447124
447331
|
return transcripts;
|
|
447125
447332
|
}
|
|
447126
447333
|
async function loadAllSubagentTranscriptsFromDisk() {
|
|
447127
|
-
const subagentsDir =
|
|
447334
|
+
const subagentsDir = join152(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), getSessionId(), "subagents");
|
|
447128
447335
|
let entries;
|
|
447129
447336
|
try {
|
|
447130
447337
|
entries = await readdir37(subagentsDir, { withFileTypes: true });
|
|
@@ -447252,7 +447459,7 @@ async function getSessionFilesWithMtime(projectDir) {
|
|
|
447252
447459
|
const sessionId = validateUuid2(basename43(dirent.name, ".jsonl"));
|
|
447253
447460
|
if (!sessionId)
|
|
447254
447461
|
continue;
|
|
447255
|
-
candidates.push({ sessionId, filePath:
|
|
447462
|
+
candidates.push({ sessionId, filePath: join152(projectDir, dirent.name) });
|
|
447256
447463
|
}
|
|
447257
447464
|
await Promise.all(candidates.map(async ({ sessionId, filePath }) => {
|
|
447258
447465
|
try {
|
|
@@ -447636,7 +447843,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
447636
447843
|
init_settings2();
|
|
447637
447844
|
init_slowOperations();
|
|
447638
447845
|
init_uuid();
|
|
447639
|
-
VERSION6 = typeof MACRO !== "undefined" ? "2.
|
|
447846
|
+
VERSION6 = typeof MACRO !== "undefined" ? "2.3.0" : "unknown";
|
|
447640
447847
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
447641
447848
|
SKIP_FIRST_PROMPT_PATTERN = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
|
|
447642
447849
|
EPHEMERAL_PROGRESS_TYPES = new Set([
|
|
@@ -447648,7 +447855,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
447648
447855
|
MAX_TRANSCRIPT_READ_BYTES = 50 * 1024 * 1024;
|
|
447649
447856
|
agentTranscriptSubdirs = new Map;
|
|
447650
447857
|
getProjectDir2 = memoize_default((projectDir) => {
|
|
447651
|
-
return
|
|
447858
|
+
return join152(getProjectsDir2(), sanitizePath2(projectDir));
|
|
447652
447859
|
});
|
|
447653
447860
|
METADATA_TYPE_MARKERS = [
|
|
447654
447861
|
'"type":"summary"',
|
|
@@ -447859,17 +448066,17 @@ var init_memdir = __esm(() => {
|
|
|
447859
448066
|
});
|
|
447860
448067
|
|
|
447861
448068
|
// src/tools/AgentTool/agentMemory.ts
|
|
447862
|
-
import { join as
|
|
448069
|
+
import { join as join153, normalize as normalize13, sep as sep31 } from "path";
|
|
447863
448070
|
function sanitizeAgentTypeForPath(agentType) {
|
|
447864
448071
|
return agentType.replace(/:/g, "-");
|
|
447865
448072
|
}
|
|
447866
448073
|
function getAgentMemoryDir(agentType, _scope) {
|
|
447867
448074
|
const dirName = sanitizeAgentTypeForPath(agentType);
|
|
447868
|
-
return
|
|
448075
|
+
return join153(getProjectMemoryBaseDir(), "agent-memory", dirName) + sep31;
|
|
447869
448076
|
}
|
|
447870
448077
|
function isAgentMemoryPath(absolutePath) {
|
|
447871
448078
|
const normalizedPath = normalize13(absolutePath);
|
|
447872
|
-
return normalizedPath.startsWith(
|
|
448079
|
+
return normalizedPath.startsWith(join153(getProjectMemoryBaseDir(), "agent-memory") + sep31);
|
|
447873
448080
|
}
|
|
447874
448081
|
function getMemoryScopeDisplay(memory2) {
|
|
447875
448082
|
switch (memory2) {
|
|
@@ -447897,8 +448104,8 @@ var init_agentMemory = __esm(() => {
|
|
|
447897
448104
|
|
|
447898
448105
|
// src/utils/permissions/filesystem.ts
|
|
447899
448106
|
import { randomBytes as randomBytes20 } from "crypto";
|
|
447900
|
-
import { homedir as
|
|
447901
|
-
import { join as
|
|
448107
|
+
import { homedir as homedir33, tmpdir as tmpdir10 } from "os";
|
|
448108
|
+
import { join as join154, normalize as normalize14, posix as posix8, sep as sep32 } from "path";
|
|
447902
448109
|
function normalizeCaseForComparison(path15) {
|
|
447903
448110
|
return path15.toLowerCase();
|
|
447904
448111
|
}
|
|
@@ -447907,11 +448114,11 @@ function getClaudeSkillScope(filePath) {
|
|
|
447907
448114
|
const absolutePathLower = normalizeCaseForComparison(absolutePath);
|
|
447908
448115
|
const bases = [
|
|
447909
448116
|
{
|
|
447910
|
-
dir: expandPath(
|
|
448117
|
+
dir: expandPath(join154(getOriginalCwd(), ".claude", "skills")),
|
|
447911
448118
|
prefix: "/.claude/skills/"
|
|
447912
448119
|
},
|
|
447913
448120
|
{
|
|
447914
|
-
dir: expandPath(
|
|
448121
|
+
dir: expandPath(join154(homedir33(), ".claude", "skills")),
|
|
447915
448122
|
prefix: "~/.claude/skills/"
|
|
447916
448123
|
}
|
|
447917
448124
|
];
|
|
@@ -447966,21 +448173,21 @@ function isClaudeConfigFilePath(filePath) {
|
|
|
447966
448173
|
if (isClaudeSettingsPath(filePath)) {
|
|
447967
448174
|
return true;
|
|
447968
448175
|
}
|
|
447969
|
-
const commandsDir =
|
|
447970
|
-
const agentsDir =
|
|
447971
|
-
const skillsDir =
|
|
448176
|
+
const commandsDir = join154(getOriginalCwd(), ".claude", "commands");
|
|
448177
|
+
const agentsDir = join154(getOriginalCwd(), ".claude", "agents");
|
|
448178
|
+
const skillsDir = join154(getOriginalCwd(), ".claude", "skills");
|
|
447972
448179
|
return pathInWorkingPath(filePath, commandsDir) || pathInWorkingPath(filePath, agentsDir) || pathInWorkingPath(filePath, skillsDir);
|
|
447973
448180
|
}
|
|
447974
448181
|
function isSessionPlanFile(absolutePath) {
|
|
447975
|
-
const expectedPrefix =
|
|
448182
|
+
const expectedPrefix = join154(getPlansDirectory(), getPlanSlug());
|
|
447976
448183
|
const normalizedPath = normalize14(absolutePath);
|
|
447977
448184
|
return normalizedPath.startsWith(expectedPrefix) && normalizedPath.endsWith(".md");
|
|
447978
448185
|
}
|
|
447979
448186
|
function getSessionMemoryDir() {
|
|
447980
|
-
return
|
|
448187
|
+
return join154(getProjectDir2(getCwd()), getSessionId(), "session-memory") + sep32;
|
|
447981
448188
|
}
|
|
447982
448189
|
function getSessionMemoryPath() {
|
|
447983
|
-
return
|
|
448190
|
+
return join154(getSessionMemoryDir(), "summary.md");
|
|
447984
448191
|
}
|
|
447985
448192
|
function isSessionMemoryPath(absolutePath) {
|
|
447986
448193
|
const normalizedPath = normalize14(absolutePath);
|
|
@@ -448002,10 +448209,10 @@ function getClaudeTempDirName() {
|
|
|
448002
448209
|
return `claude-${uid}`;
|
|
448003
448210
|
}
|
|
448004
448211
|
function getProjectTempDir() {
|
|
448005
|
-
return
|
|
448212
|
+
return join154(getClaudeTempDir(), sanitizePath2(getOriginalCwd())) + sep32;
|
|
448006
448213
|
}
|
|
448007
448214
|
function getScratchpadDir() {
|
|
448008
|
-
return
|
|
448215
|
+
return join154(getProjectTempDir(), getSessionId(), "scratchpad");
|
|
448009
448216
|
}
|
|
448010
448217
|
async function ensureScratchpadDir() {
|
|
448011
448218
|
if (!isScratchpadEnabled()) {
|
|
@@ -448225,7 +448432,7 @@ function patternWithRoot(pattern, source) {
|
|
|
448225
448432
|
} else if (pattern.startsWith(`~${DIR_SEP}`)) {
|
|
448226
448433
|
return {
|
|
448227
448434
|
relativePattern: pattern.slice(1),
|
|
448228
|
-
root:
|
|
448435
|
+
root: homedir33().normalize("NFC")
|
|
448229
448436
|
};
|
|
448230
448437
|
} else if (pattern.startsWith(DIR_SEP)) {
|
|
448231
448438
|
return {
|
|
@@ -448583,7 +448790,7 @@ function checkEditableInternalPath(absolutePath, input) {
|
|
|
448583
448790
|
}
|
|
448584
448791
|
};
|
|
448585
448792
|
}
|
|
448586
|
-
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(
|
|
448793
|
+
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(join154(getOriginalCwd(), ".claude", "launch.json"))) {
|
|
448587
448794
|
return {
|
|
448588
448795
|
behavior: "allow",
|
|
448589
448796
|
updatedInput: input,
|
|
@@ -448680,7 +448887,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
448680
448887
|
}
|
|
448681
448888
|
};
|
|
448682
448889
|
}
|
|
448683
|
-
const tasksDir =
|
|
448890
|
+
const tasksDir = join154(getClaudeConfigHomeDir(), "tasks") + sep32;
|
|
448684
448891
|
if (normalizedPath === tasksDir.slice(0, -1) || normalizedPath.startsWith(tasksDir)) {
|
|
448685
448892
|
return {
|
|
448686
448893
|
behavior: "allow",
|
|
@@ -448691,7 +448898,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
448691
448898
|
}
|
|
448692
448899
|
};
|
|
448693
448900
|
}
|
|
448694
|
-
const teamsReadDir =
|
|
448901
|
+
const teamsReadDir = join154(getClaudeConfigHomeDir(), "teams") + sep32;
|
|
448695
448902
|
if (normalizedPath === teamsReadDir.slice(0, -1) || normalizedPath.startsWith(teamsReadDir)) {
|
|
448696
448903
|
return {
|
|
448697
448904
|
behavior: "allow",
|
|
@@ -448763,11 +448970,11 @@ var init_filesystem = __esm(() => {
|
|
|
448763
448970
|
try {
|
|
448764
448971
|
resolvedBaseTmpDir = fs5.realpathSync(baseTmpDir);
|
|
448765
448972
|
} catch {}
|
|
448766
|
-
return
|
|
448973
|
+
return join154(resolvedBaseTmpDir, getClaudeTempDirName()) + sep32;
|
|
448767
448974
|
});
|
|
448768
448975
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
448769
448976
|
const nonce = randomBytes20(16).toString("hex");
|
|
448770
|
-
return
|
|
448977
|
+
return join154(getClaudeTempDir(), "bundled-skills", "2.3.0", nonce);
|
|
448771
448978
|
});
|
|
448772
448979
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
448773
448980
|
});
|
|
@@ -448775,24 +448982,24 @@ var init_filesystem = __esm(() => {
|
|
|
448775
448982
|
// src/utils/task/diskOutput.ts
|
|
448776
448983
|
import { constants as fsConstants6 } from "fs";
|
|
448777
448984
|
import {
|
|
448778
|
-
mkdir as
|
|
448985
|
+
mkdir as mkdir59,
|
|
448779
448986
|
open as open16,
|
|
448780
448987
|
stat as stat51,
|
|
448781
448988
|
symlink as symlink4,
|
|
448782
448989
|
unlink as unlink23
|
|
448783
448990
|
} from "fs/promises";
|
|
448784
|
-
import { join as
|
|
448991
|
+
import { join as join155 } from "path";
|
|
448785
448992
|
function getTaskOutputDir() {
|
|
448786
448993
|
if (_taskOutputDir === undefined) {
|
|
448787
|
-
_taskOutputDir =
|
|
448994
|
+
_taskOutputDir = join155(getProjectTempDir(), getSessionId(), "tasks");
|
|
448788
448995
|
}
|
|
448789
448996
|
return _taskOutputDir;
|
|
448790
448997
|
}
|
|
448791
448998
|
async function ensureOutputDir() {
|
|
448792
|
-
await
|
|
448999
|
+
await mkdir59(getTaskOutputDir(), { recursive: true });
|
|
448793
449000
|
}
|
|
448794
449001
|
function getTaskOutputPath(taskId) {
|
|
448795
|
-
return
|
|
449002
|
+
return join155(getTaskOutputDir(), `${taskId}.output`);
|
|
448796
449003
|
}
|
|
448797
449004
|
function track(p) {
|
|
448798
449005
|
_pendingOps.add(p);
|
|
@@ -453051,14 +453258,14 @@ __export(exports_worktree, {
|
|
|
453051
453258
|
import { spawnSync as spawnSync9 } from "child_process";
|
|
453052
453259
|
import {
|
|
453053
453260
|
copyFile as copyFile10,
|
|
453054
|
-
mkdir as
|
|
453261
|
+
mkdir as mkdir60,
|
|
453055
453262
|
readdir as readdir38,
|
|
453056
|
-
readFile as
|
|
453263
|
+
readFile as readFile67,
|
|
453057
453264
|
stat as stat53,
|
|
453058
453265
|
symlink as symlink5,
|
|
453059
453266
|
utimes as utimes2
|
|
453060
453267
|
} from "fs/promises";
|
|
453061
|
-
import { basename as basename45, dirname as
|
|
453268
|
+
import { basename as basename45, dirname as dirname57, join as join156 } from "path";
|
|
453062
453269
|
function validateWorktreeSlug(slug) {
|
|
453063
453270
|
if (slug.length > MAX_WORKTREE_SLUG_LENGTH) {
|
|
453064
453271
|
throw new Error(`Invalid worktree name: must be ${MAX_WORKTREE_SLUG_LENGTH} characters or fewer (got ${slug.length})`);
|
|
@@ -453073,7 +453280,7 @@ function validateWorktreeSlug(slug) {
|
|
|
453073
453280
|
}
|
|
453074
453281
|
}
|
|
453075
453282
|
async function mkdirRecursive(dirPath) {
|
|
453076
|
-
await
|
|
453283
|
+
await mkdir60(dirPath, { recursive: true });
|
|
453077
453284
|
}
|
|
453078
453285
|
async function symlinkDirectories(repoRootPath, worktreePath, dirsToSymlink) {
|
|
453079
453286
|
for (const dir of dirsToSymlink) {
|
|
@@ -453081,8 +453288,8 @@ async function symlinkDirectories(repoRootPath, worktreePath, dirsToSymlink) {
|
|
|
453081
453288
|
logForDebugging(`Skipping symlink for "${dir}": path traversal detected`, { level: "warn" });
|
|
453082
453289
|
continue;
|
|
453083
453290
|
}
|
|
453084
|
-
const sourcePath =
|
|
453085
|
-
const destPath =
|
|
453291
|
+
const sourcePath = join156(repoRootPath, dir);
|
|
453292
|
+
const destPath = join156(worktreePath, dir);
|
|
453086
453293
|
try {
|
|
453087
453294
|
await symlink5(sourcePath, destPath, "dir");
|
|
453088
453295
|
logForDebugging(`Symlinked ${dir} from main repository to worktree to avoid disk bloat`);
|
|
@@ -453106,7 +453313,7 @@ function generateTmuxSessionName(repoPath, branch2) {
|
|
|
453106
453313
|
return combined.replace(/[/.]/g, "_");
|
|
453107
453314
|
}
|
|
453108
453315
|
function worktreesDir(repoRoot) {
|
|
453109
|
-
return
|
|
453316
|
+
return join156(repoRoot, ".claude", "worktrees");
|
|
453110
453317
|
}
|
|
453111
453318
|
function flattenSlug(slug) {
|
|
453112
453319
|
return slug.replaceAll("/", "+");
|
|
@@ -453115,7 +453322,7 @@ function worktreeBranchName(slug) {
|
|
|
453115
453322
|
return `worktree-${flattenSlug(slug)}`;
|
|
453116
453323
|
}
|
|
453117
453324
|
function worktreePathFor(repoRoot, slug) {
|
|
453118
|
-
return
|
|
453325
|
+
return join156(worktreesDir(repoRoot), flattenSlug(slug));
|
|
453119
453326
|
}
|
|
453120
453327
|
async function getOrCreateWorktree(repoRoot, slug, options) {
|
|
453121
453328
|
const worktreePath = worktreePathFor(repoRoot, slug);
|
|
@@ -453129,7 +453336,7 @@ async function getOrCreateWorktree(repoRoot, slug, options) {
|
|
|
453129
453336
|
existed: true
|
|
453130
453337
|
};
|
|
453131
453338
|
}
|
|
453132
|
-
await
|
|
453339
|
+
await mkdir60(worktreesDir(repoRoot), { recursive: true });
|
|
453133
453340
|
const fetchEnv = { ...process.env, ...GIT_NO_PROMPT_ENV2 };
|
|
453134
453341
|
let baseBranch;
|
|
453135
453342
|
let baseSha = null;
|
|
@@ -453196,7 +453403,7 @@ async function getOrCreateWorktree(repoRoot, slug, options) {
|
|
|
453196
453403
|
async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
453197
453404
|
let includeContent;
|
|
453198
453405
|
try {
|
|
453199
|
-
includeContent = await
|
|
453406
|
+
includeContent = await readFile67(join156(repoRoot, ".worktreeinclude"), "utf-8");
|
|
453200
453407
|
} catch {
|
|
453201
453408
|
return [];
|
|
453202
453409
|
}
|
|
@@ -453251,10 +453458,10 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
|
453251
453458
|
}
|
|
453252
453459
|
const copied = [];
|
|
453253
453460
|
for (const relativePath2 of files2) {
|
|
453254
|
-
const srcPath =
|
|
453255
|
-
const destPath =
|
|
453461
|
+
const srcPath = join156(repoRoot, relativePath2);
|
|
453462
|
+
const destPath = join156(worktreePath, relativePath2);
|
|
453256
453463
|
try {
|
|
453257
|
-
await
|
|
453464
|
+
await mkdir60(dirname57(destPath), { recursive: true });
|
|
453258
453465
|
await copyFile10(srcPath, destPath);
|
|
453259
453466
|
copied.push(relativePath2);
|
|
453260
453467
|
} catch (e) {
|
|
@@ -453268,10 +453475,10 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
|
453268
453475
|
}
|
|
453269
453476
|
async function performPostCreationSetup(repoRoot, worktreePath) {
|
|
453270
453477
|
const localSettingsRelativePath = getRelativeSettingsFilePathForSource("localSettings");
|
|
453271
|
-
const sourceSettingsLocal =
|
|
453478
|
+
const sourceSettingsLocal = join156(repoRoot, localSettingsRelativePath);
|
|
453272
453479
|
try {
|
|
453273
|
-
const destSettingsLocal =
|
|
453274
|
-
await mkdirRecursive(
|
|
453480
|
+
const destSettingsLocal = join156(worktreePath, localSettingsRelativePath);
|
|
453481
|
+
await mkdirRecursive(dirname57(destSettingsLocal));
|
|
453275
453482
|
await copyFile10(sourceSettingsLocal, destSettingsLocal);
|
|
453276
453483
|
logForDebugging(`Copied settings.local.json to worktree: ${destSettingsLocal}`);
|
|
453277
453484
|
} catch (e) {
|
|
@@ -453280,8 +453487,8 @@ async function performPostCreationSetup(repoRoot, worktreePath) {
|
|
|
453280
453487
|
logForDebugging(`Failed to copy settings.local.json: ${e.message}`, { level: "warn" });
|
|
453281
453488
|
}
|
|
453282
453489
|
}
|
|
453283
|
-
const huskyPath =
|
|
453284
|
-
const gitHooksPath =
|
|
453490
|
+
const huskyPath = join156(repoRoot, ".husky");
|
|
453491
|
+
const gitHooksPath = join156(repoRoot, ".git", "hooks");
|
|
453285
453492
|
let hooksPath = null;
|
|
453286
453493
|
for (const candidatePath of [huskyPath, gitHooksPath]) {
|
|
453287
453494
|
try {
|
|
@@ -453556,7 +453763,7 @@ async function cleanupStaleAgentWorktrees(cutoffDate) {
|
|
|
453556
453763
|
if (!EPHEMERAL_WORKTREE_PATTERNS.some((p) => p.test(slug))) {
|
|
453557
453764
|
continue;
|
|
453558
453765
|
}
|
|
453559
|
-
const worktreePath =
|
|
453766
|
+
const worktreePath = join156(dir, slug);
|
|
453560
453767
|
if (currentPath === worktreePath) {
|
|
453561
453768
|
continue;
|
|
453562
453769
|
}
|
|
@@ -456433,9 +456640,9 @@ __export(exports_upstreamproxy, {
|
|
|
456433
456640
|
getUpstreamProxyEnv: () => getUpstreamProxyEnv,
|
|
456434
456641
|
SESSION_TOKEN_PATH: () => SESSION_TOKEN_PATH
|
|
456435
456642
|
});
|
|
456436
|
-
import { mkdir as
|
|
456437
|
-
import { homedir as
|
|
456438
|
-
import { join as
|
|
456643
|
+
import { mkdir as mkdir61, readFile as readFile68, unlink as unlink24, writeFile as writeFile62 } from "fs/promises";
|
|
456644
|
+
import { homedir as homedir34 } from "os";
|
|
456645
|
+
import { join as join157 } from "path";
|
|
456439
456646
|
async function initUpstreamProxy(opts) {
|
|
456440
456647
|
if (!isEnvTruthy(process.env.CLAUDE_CODE_REMOTE)) {
|
|
456441
456648
|
return state;
|
|
@@ -456456,7 +456663,7 @@ async function initUpstreamProxy(opts) {
|
|
|
456456
456663
|
}
|
|
456457
456664
|
setNonDumpable();
|
|
456458
456665
|
const baseUrl = opts?.ccrBaseUrl ?? process.env.ANTHROPIC_BASE_URL ?? "https://api.anthropic.com";
|
|
456459
|
-
const caBundlePath = opts?.caBundlePath ??
|
|
456666
|
+
const caBundlePath = opts?.caBundlePath ?? join157(homedir34(), ".ccr", "ca-bundle.crt");
|
|
456460
456667
|
const caOk = await downloadCaBundle(baseUrl, opts?.systemCaPath ?? SYSTEM_CA_BUNDLE, caBundlePath);
|
|
456461
456668
|
if (!caOk)
|
|
456462
456669
|
return state;
|
|
@@ -456514,7 +456721,7 @@ function resetUpstreamProxyForTests() {
|
|
|
456514
456721
|
}
|
|
456515
456722
|
async function readToken(path15) {
|
|
456516
456723
|
try {
|
|
456517
|
-
const raw = await
|
|
456724
|
+
const raw = await readFile68(path15, "utf8");
|
|
456518
456725
|
return raw.trim() || null;
|
|
456519
456726
|
} catch (err2) {
|
|
456520
456727
|
if (isENOENT(err2))
|
|
@@ -456555,9 +456762,9 @@ async function downloadCaBundle(baseUrl, systemCaPath, outPath) {
|
|
|
456555
456762
|
return false;
|
|
456556
456763
|
}
|
|
456557
456764
|
const ccrCa = await resp.text();
|
|
456558
|
-
const systemCa = await
|
|
456559
|
-
await
|
|
456560
|
-
await
|
|
456765
|
+
const systemCa = await readFile68(systemCaPath, "utf8").catch(() => "");
|
|
456766
|
+
await mkdir61(join157(outPath, ".."), { recursive: true });
|
|
456767
|
+
await writeFile62(outPath, systemCa + `
|
|
456561
456768
|
` + ccrCa, "utf8");
|
|
456562
456769
|
return true;
|
|
456563
456770
|
} catch (err2) {
|
|
@@ -458004,7 +458211,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
458004
458211
|
slash_commands: inputs.commands.filter((c5) => c5.userInvocable !== false).map((c5) => c5.name),
|
|
458005
458212
|
apiKeySource: getAnthropicApiKeyWithSource().source,
|
|
458006
458213
|
betas: getSdkBetas(),
|
|
458007
|
-
claude_code_version: "2.
|
|
458214
|
+
claude_code_version: "2.3.0",
|
|
458008
458215
|
output_style: outputStyle2,
|
|
458009
458216
|
agents: inputs.agents.map((agent) => agent.agentType),
|
|
458010
458217
|
skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
|
|
@@ -464362,8 +464569,8 @@ var init_ShowInIDEPrompt = __esm(() => {
|
|
|
464362
464569
|
});
|
|
464363
464570
|
|
|
464364
464571
|
// src/components/permissions/FilePermissionDialog/permissionOptions.tsx
|
|
464365
|
-
import { homedir as
|
|
464366
|
-
import { basename as basename49, join as
|
|
464572
|
+
import { homedir as homedir35 } from "os";
|
|
464573
|
+
import { basename as basename49, join as join158, sep as sep33 } from "path";
|
|
464367
464574
|
function isInClaudeFolder(filePath) {
|
|
464368
464575
|
const absolutePath = expandPath(filePath);
|
|
464369
464576
|
const claudeFolderPath = expandPath(`${getOriginalCwd()}/.claude`);
|
|
@@ -464373,7 +464580,7 @@ function isInClaudeFolder(filePath) {
|
|
|
464373
464580
|
}
|
|
464374
464581
|
function isInGlobalClaudeFolder(filePath) {
|
|
464375
464582
|
const absolutePath = expandPath(filePath);
|
|
464376
|
-
const globalClaudeFolderPath =
|
|
464583
|
+
const globalClaudeFolderPath = join158(homedir35(), ".claude");
|
|
464377
464584
|
const normalizedAbsolutePath = normalizeCaseForComparison(absolutePath);
|
|
464378
464585
|
const normalizedGlobalClaudeFolderPath = normalizeCaseForComparison(globalClaudeFolderPath);
|
|
464379
464586
|
return normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + sep33.toLowerCase()) || normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + "/");
|
|
@@ -472161,7 +472368,7 @@ var init_useVoiceEnabled = __esm(() => {
|
|
|
472161
472368
|
function getSemverPart(version2) {
|
|
472162
472369
|
return `${import_semver10.major(version2, { loose: true })}.${import_semver10.minor(version2, { loose: true })}.${import_semver10.patch(version2, { loose: true })}`;
|
|
472163
472370
|
}
|
|
472164
|
-
function useUpdateNotification(updatedVersion, initialVersion = "2.
|
|
472371
|
+
function useUpdateNotification(updatedVersion, initialVersion = "2.3.0") {
|
|
472165
472372
|
const [lastNotifiedSemver, setLastNotifiedSemver] = import_react214.useState(() => getSemverPart(initialVersion));
|
|
472166
472373
|
if (!updatedVersion) {
|
|
472167
472374
|
return null;
|
|
@@ -472201,7 +472408,7 @@ function AutoUpdater({
|
|
|
472201
472408
|
return;
|
|
472202
472409
|
}
|
|
472203
472410
|
if (false) {}
|
|
472204
|
-
const currentVersion = "2.
|
|
472411
|
+
const currentVersion = "2.3.0";
|
|
472205
472412
|
const channel = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
472206
472413
|
let latestVersion = await getLatestVersion(channel);
|
|
472207
472414
|
const isDisabled = isAutoUpdaterDisabled();
|
|
@@ -472412,12 +472619,12 @@ function NativeAutoUpdater({
|
|
|
472412
472619
|
logEvent("tengu_native_auto_updater_start", {});
|
|
472413
472620
|
try {
|
|
472414
472621
|
const maxVersion = await getMaxVersion();
|
|
472415
|
-
if (maxVersion && gt("2.
|
|
472622
|
+
if (maxVersion && gt("2.3.0", maxVersion)) {
|
|
472416
472623
|
const msg = await getMaxVersionMessage();
|
|
472417
472624
|
setMaxVersionIssue(msg ?? "affects your version");
|
|
472418
472625
|
}
|
|
472419
472626
|
const result = await installLatest(channel);
|
|
472420
|
-
const currentVersion = "2.
|
|
472627
|
+
const currentVersion = "2.3.0";
|
|
472421
472628
|
const latencyMs = Date.now() - startTime;
|
|
472422
472629
|
if (result.lockFailed) {
|
|
472423
472630
|
logEvent("tengu_native_auto_updater_lock_contention", {
|
|
@@ -472552,17 +472759,17 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
472552
472759
|
const maxVersion = await getMaxVersion();
|
|
472553
472760
|
if (maxVersion && latest && gt(latest, maxVersion)) {
|
|
472554
472761
|
logForDebugging(`PackageManagerAutoUpdater: maxVersion ${maxVersion} is set, capping update from ${latest} to ${maxVersion}`);
|
|
472555
|
-
if (gte("2.
|
|
472556
|
-
logForDebugging(`PackageManagerAutoUpdater: current version ${"2.
|
|
472762
|
+
if (gte("2.3.0", maxVersion)) {
|
|
472763
|
+
logForDebugging(`PackageManagerAutoUpdater: current version ${"2.3.0"} is already at or above maxVersion ${maxVersion}, skipping update`);
|
|
472557
472764
|
setUpdateAvailable(false);
|
|
472558
472765
|
return;
|
|
472559
472766
|
}
|
|
472560
472767
|
latest = maxVersion;
|
|
472561
472768
|
}
|
|
472562
|
-
const hasUpdate = latest && !gte("2.
|
|
472769
|
+
const hasUpdate = latest && !gte("2.3.0", latest) && !shouldSkipVersion(latest);
|
|
472563
472770
|
setUpdateAvailable(!!hasUpdate);
|
|
472564
472771
|
if (hasUpdate) {
|
|
472565
|
-
logForDebugging(`PackageManagerAutoUpdater: Update available ${"2.
|
|
472772
|
+
logForDebugging(`PackageManagerAutoUpdater: Update available ${"2.3.0"} -> ${latest}`);
|
|
472566
472773
|
}
|
|
472567
472774
|
};
|
|
472568
472775
|
$2[0] = t1;
|
|
@@ -472596,7 +472803,7 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
472596
472803
|
wrap: "truncate",
|
|
472597
472804
|
children: [
|
|
472598
472805
|
"currentVersion: ",
|
|
472599
|
-
"2.
|
|
472806
|
+
"2.3.0"
|
|
472600
472807
|
]
|
|
472601
472808
|
}, undefined, true, undefined, this);
|
|
472602
472809
|
$2[3] = verbose;
|
|
@@ -480156,7 +480363,7 @@ function buildStatusLineCommandInput(permissionMode, exceedsHalfContext, setting
|
|
|
480156
480363
|
project_dir: getOriginalCwd(),
|
|
480157
480364
|
added_dirs: addedDirs
|
|
480158
480365
|
},
|
|
480159
|
-
version: "2.
|
|
480366
|
+
version: "2.3.0",
|
|
480160
480367
|
output_style: {
|
|
480161
480368
|
name: outputStyleName
|
|
480162
480369
|
},
|
|
@@ -486240,9 +486447,9 @@ function initSkillImprovement() {
|
|
|
486240
486447
|
async function applySkillImprovement(skillName, updates) {
|
|
486241
486448
|
if (!skillName)
|
|
486242
486449
|
return;
|
|
486243
|
-
const { join:
|
|
486450
|
+
const { join: join159 } = await import("path");
|
|
486244
486451
|
const fs5 = await import("fs/promises");
|
|
486245
|
-
const filePath =
|
|
486452
|
+
const filePath = join159(getCwd(), ".claude", "skills", skillName, "SKILL.md");
|
|
486246
486453
|
let currentContent;
|
|
486247
486454
|
try {
|
|
486248
486455
|
currentContent = await fs5.readFile(filePath, "utf-8");
|
|
@@ -486500,8 +486707,8 @@ var init_cacache = __esm(() => {
|
|
|
486500
486707
|
|
|
486501
486708
|
// src/utils/cleanup.ts
|
|
486502
486709
|
import * as fs5 from "fs/promises";
|
|
486503
|
-
import { homedir as
|
|
486504
|
-
import { join as
|
|
486710
|
+
import { homedir as homedir36 } from "os";
|
|
486711
|
+
import { join as join159 } from "path";
|
|
486505
486712
|
function getCutoffDate() {
|
|
486506
486713
|
const settings = getSettings_DEPRECATED() || {};
|
|
486507
486714
|
const cleanupPeriodDays = settings.cleanupPeriodDays ?? DEFAULT_CLEANUP_PERIOD_DAYS;
|
|
@@ -486526,7 +486733,7 @@ async function cleanupOldFilesInDirectory(dirPath, cutoffDate, isMessagePath) {
|
|
|
486526
486733
|
try {
|
|
486527
486734
|
const timestamp3 = convertFileNameToDate(file.name);
|
|
486528
486735
|
if (timestamp3 < cutoffDate) {
|
|
486529
|
-
await getFsImplementation().unlink(
|
|
486736
|
+
await getFsImplementation().unlink(join159(dirPath, file.name));
|
|
486530
486737
|
if (isMessagePath) {
|
|
486531
486738
|
result.messages++;
|
|
486532
486739
|
} else {
|
|
@@ -486557,7 +486764,7 @@ async function cleanupOldMessageFiles() {
|
|
|
486557
486764
|
} catch {
|
|
486558
486765
|
return result;
|
|
486559
486766
|
}
|
|
486560
|
-
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) =>
|
|
486767
|
+
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) => join159(baseCachePath, dirent.name));
|
|
486561
486768
|
for (const mcpLogDir of mcpLogDirs) {
|
|
486562
486769
|
result = addCleanupResults(result, await cleanupOldFilesInDirectory(mcpLogDir, cutoffDate, true));
|
|
486563
486770
|
await tryRmdir(mcpLogDir, fsImpl);
|
|
@@ -486596,7 +486803,7 @@ async function cleanupOldSessionFiles() {
|
|
|
486596
486803
|
for (const projectDirent of projectDirents) {
|
|
486597
486804
|
if (!projectDirent.isDirectory())
|
|
486598
486805
|
continue;
|
|
486599
|
-
const projectDir =
|
|
486806
|
+
const projectDir = join159(projectsDir, projectDirent.name);
|
|
486600
486807
|
let entries;
|
|
486601
486808
|
try {
|
|
486602
486809
|
entries = await fsImpl.readdir(projectDir);
|
|
@@ -486610,15 +486817,15 @@ async function cleanupOldSessionFiles() {
|
|
|
486610
486817
|
continue;
|
|
486611
486818
|
}
|
|
486612
486819
|
try {
|
|
486613
|
-
if (await unlinkIfOld(
|
|
486820
|
+
if (await unlinkIfOld(join159(projectDir, entry.name), cutoffDate, fsImpl)) {
|
|
486614
486821
|
result.messages++;
|
|
486615
486822
|
}
|
|
486616
486823
|
} catch {
|
|
486617
486824
|
result.errors++;
|
|
486618
486825
|
}
|
|
486619
486826
|
} else if (entry.isDirectory()) {
|
|
486620
|
-
const sessionDir =
|
|
486621
|
-
const toolResultsDir =
|
|
486827
|
+
const sessionDir = join159(projectDir, entry.name);
|
|
486828
|
+
const toolResultsDir = join159(sessionDir, TOOL_RESULTS_SUBDIR);
|
|
486622
486829
|
let toolDirs;
|
|
486623
486830
|
try {
|
|
486624
486831
|
toolDirs = await fsImpl.readdir(toolResultsDir);
|
|
@@ -486629,14 +486836,14 @@ async function cleanupOldSessionFiles() {
|
|
|
486629
486836
|
for (const toolEntry of toolDirs) {
|
|
486630
486837
|
if (toolEntry.isFile()) {
|
|
486631
486838
|
try {
|
|
486632
|
-
if (await unlinkIfOld(
|
|
486839
|
+
if (await unlinkIfOld(join159(toolResultsDir, toolEntry.name), cutoffDate, fsImpl)) {
|
|
486633
486840
|
result.messages++;
|
|
486634
486841
|
}
|
|
486635
486842
|
} catch {
|
|
486636
486843
|
result.errors++;
|
|
486637
486844
|
}
|
|
486638
486845
|
} else if (toolEntry.isDirectory()) {
|
|
486639
|
-
const toolDirPath =
|
|
486846
|
+
const toolDirPath = join159(toolResultsDir, toolEntry.name);
|
|
486640
486847
|
let toolFiles;
|
|
486641
486848
|
try {
|
|
486642
486849
|
toolFiles = await fsImpl.readdir(toolDirPath);
|
|
@@ -486647,7 +486854,7 @@ async function cleanupOldSessionFiles() {
|
|
|
486647
486854
|
if (!tf.isFile())
|
|
486648
486855
|
continue;
|
|
486649
486856
|
try {
|
|
486650
|
-
if (await unlinkIfOld(
|
|
486857
|
+
if (await unlinkIfOld(join159(toolDirPath, tf.name), cutoffDate, fsImpl)) {
|
|
486651
486858
|
result.messages++;
|
|
486652
486859
|
}
|
|
486653
486860
|
} catch {
|
|
@@ -486679,7 +486886,7 @@ async function cleanupSingleDirectory(dirPath, extension2, removeEmptyDir = true
|
|
|
486679
486886
|
if (!dirent.isFile() || !dirent.name.endsWith(extension2))
|
|
486680
486887
|
continue;
|
|
486681
486888
|
try {
|
|
486682
|
-
if (await unlinkIfOld(
|
|
486889
|
+
if (await unlinkIfOld(join159(dirPath, dirent.name), cutoffDate, fsImpl)) {
|
|
486683
486890
|
result.messages++;
|
|
486684
486891
|
}
|
|
486685
486892
|
} catch {
|
|
@@ -486692,7 +486899,7 @@ async function cleanupSingleDirectory(dirPath, extension2, removeEmptyDir = true
|
|
|
486692
486899
|
return result;
|
|
486693
486900
|
}
|
|
486694
486901
|
function cleanupOldPlanFiles() {
|
|
486695
|
-
const plansDir =
|
|
486902
|
+
const plansDir = join159(getClaudeConfigHomeDir(), "plans");
|
|
486696
486903
|
return cleanupSingleDirectory(plansDir, ".md");
|
|
486697
486904
|
}
|
|
486698
486905
|
async function cleanupOldFileHistoryBackups() {
|
|
@@ -486701,14 +486908,14 @@ async function cleanupOldFileHistoryBackups() {
|
|
|
486701
486908
|
const fsImpl = getFsImplementation();
|
|
486702
486909
|
try {
|
|
486703
486910
|
const configDir = getClaudeConfigHomeDir();
|
|
486704
|
-
const fileHistoryStorageDir =
|
|
486911
|
+
const fileHistoryStorageDir = join159(configDir, "file-history");
|
|
486705
486912
|
let dirents;
|
|
486706
486913
|
try {
|
|
486707
486914
|
dirents = await fsImpl.readdir(fileHistoryStorageDir);
|
|
486708
486915
|
} catch {
|
|
486709
486916
|
return result;
|
|
486710
486917
|
}
|
|
486711
|
-
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
486918
|
+
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join159(fileHistoryStorageDir, dirent.name));
|
|
486712
486919
|
await Promise.all(fileHistorySessionsDirs.map(async (fileHistorySessionDir) => {
|
|
486713
486920
|
try {
|
|
486714
486921
|
const stats2 = await fsImpl.stat(fileHistorySessionDir);
|
|
@@ -486735,14 +486942,14 @@ async function cleanupOldSessionEnvDirs() {
|
|
|
486735
486942
|
const fsImpl = getFsImplementation();
|
|
486736
486943
|
try {
|
|
486737
486944
|
const configDir = getClaudeConfigHomeDir();
|
|
486738
|
-
const sessionEnvBaseDir =
|
|
486945
|
+
const sessionEnvBaseDir = join159(configDir, "session-env");
|
|
486739
486946
|
let dirents;
|
|
486740
486947
|
try {
|
|
486741
486948
|
dirents = await fsImpl.readdir(sessionEnvBaseDir);
|
|
486742
486949
|
} catch {
|
|
486743
486950
|
return result;
|
|
486744
486951
|
}
|
|
486745
|
-
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
486952
|
+
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join159(sessionEnvBaseDir, dirent.name));
|
|
486746
486953
|
for (const sessionEnvDir of sessionEnvDirs) {
|
|
486747
486954
|
try {
|
|
486748
486955
|
const stats2 = await fsImpl.stat(sessionEnvDir);
|
|
@@ -486764,7 +486971,7 @@ async function cleanupOldDebugLogs() {
|
|
|
486764
486971
|
const cutoffDate = getCutoffDate();
|
|
486765
486972
|
const result = { messages: 0, errors: 0 };
|
|
486766
486973
|
const fsImpl = getFsImplementation();
|
|
486767
|
-
const debugDir =
|
|
486974
|
+
const debugDir = join159(getClaudeConfigHomeDir(), "debug");
|
|
486768
486975
|
let dirents;
|
|
486769
486976
|
try {
|
|
486770
486977
|
dirents = await fsImpl.readdir(debugDir);
|
|
@@ -486776,7 +486983,7 @@ async function cleanupOldDebugLogs() {
|
|
|
486776
486983
|
continue;
|
|
486777
486984
|
}
|
|
486778
486985
|
try {
|
|
486779
|
-
if (await unlinkIfOld(
|
|
486986
|
+
if (await unlinkIfOld(join159(debugDir, dirent.name), cutoffDate, fsImpl)) {
|
|
486780
486987
|
result.messages++;
|
|
486781
486988
|
}
|
|
486782
486989
|
} catch {
|
|
@@ -486786,7 +486993,7 @@ async function cleanupOldDebugLogs() {
|
|
|
486786
486993
|
return result;
|
|
486787
486994
|
}
|
|
486788
486995
|
async function cleanupNpmCacheForAnthropicPackages() {
|
|
486789
|
-
const markerPath =
|
|
486996
|
+
const markerPath = join159(getClaudeConfigHomeDir(), ".npm-cache-cleanup");
|
|
486790
486997
|
try {
|
|
486791
486998
|
const stat55 = await fs5.stat(markerPath);
|
|
486792
486999
|
if (Date.now() - stat55.mtimeMs < ONE_DAY_MS) {
|
|
@@ -486801,7 +487008,7 @@ async function cleanupNpmCacheForAnthropicPackages() {
|
|
|
486801
487008
|
return;
|
|
486802
487009
|
}
|
|
486803
487010
|
logForDebugging("npm cache cleanup: starting");
|
|
486804
|
-
const npmCachePath =
|
|
487011
|
+
const npmCachePath = join159(homedir36(), ".npm", "_cacache");
|
|
486805
487012
|
const NPM_CACHE_RETENTION_COUNT = 5;
|
|
486806
487013
|
const startTime = Date.now();
|
|
486807
487014
|
try {
|
|
@@ -486856,7 +487063,7 @@ async function cleanupNpmCacheForAnthropicPackages() {
|
|
|
486856
487063
|
}
|
|
486857
487064
|
}
|
|
486858
487065
|
async function cleanupOldVersionsThrottled() {
|
|
486859
|
-
const markerPath =
|
|
487066
|
+
const markerPath = join159(getClaudeConfigHomeDir(), ".version-cleanup");
|
|
486860
487067
|
try {
|
|
486861
487068
|
const stat55 = await fs5.stat(markerPath);
|
|
486862
487069
|
if (Date.now() - stat55.mtimeMs < ONE_DAY_MS) {
|
|
@@ -490086,7 +490293,7 @@ __export(exports_asciicast, {
|
|
|
490086
490293
|
_resetRecordingStateForTesting: () => _resetRecordingStateForTesting
|
|
490087
490294
|
});
|
|
490088
490295
|
import { appendFile as appendFile6, rename as rename10 } from "fs/promises";
|
|
490089
|
-
import { basename as basename58, dirname as
|
|
490296
|
+
import { basename as basename58, dirname as dirname58, join as join161 } from "path";
|
|
490090
490297
|
function getRecordFilePath() {
|
|
490091
490298
|
if (recordingState.filePath !== null) {
|
|
490092
490299
|
return recordingState.filePath;
|
|
@@ -490097,10 +490304,10 @@ function getRecordFilePath() {
|
|
|
490097
490304
|
if (!isEnvTruthy(process.env.CLAUDE_CODE_TERMINAL_RECORDING)) {
|
|
490098
490305
|
return null;
|
|
490099
490306
|
}
|
|
490100
|
-
const projectsDir =
|
|
490101
|
-
const projectDir =
|
|
490307
|
+
const projectsDir = join161(getClaudeConfigHomeDir(), "projects");
|
|
490308
|
+
const projectDir = join161(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
490102
490309
|
recordingState.timestamp = Date.now();
|
|
490103
|
-
recordingState.filePath =
|
|
490310
|
+
recordingState.filePath = join161(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
490104
490311
|
return recordingState.filePath;
|
|
490105
490312
|
}
|
|
490106
490313
|
function _resetRecordingStateForTesting() {
|
|
@@ -490109,13 +490316,13 @@ function _resetRecordingStateForTesting() {
|
|
|
490109
490316
|
}
|
|
490110
490317
|
function getSessionRecordingPaths() {
|
|
490111
490318
|
const sessionId = getSessionId();
|
|
490112
|
-
const projectsDir =
|
|
490113
|
-
const projectDir =
|
|
490319
|
+
const projectsDir = join161(getClaudeConfigHomeDir(), "projects");
|
|
490320
|
+
const projectDir = join161(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
490114
490321
|
try {
|
|
490115
490322
|
const entries = getFsImplementation().readdirSync(projectDir);
|
|
490116
490323
|
const names = typeof entries[0] === "string" ? entries : entries.map((e) => e.name);
|
|
490117
490324
|
const files2 = names.filter((f) => f.startsWith(sessionId) && f.endsWith(".cast")).sort();
|
|
490118
|
-
return files2.map((f) =>
|
|
490325
|
+
return files2.map((f) => join161(projectDir, f));
|
|
490119
490326
|
} catch {
|
|
490120
490327
|
return [];
|
|
490121
490328
|
}
|
|
@@ -490125,9 +490332,9 @@ async function renameRecordingForSession() {
|
|
|
490125
490332
|
if (!oldPath || recordingState.timestamp === 0) {
|
|
490126
490333
|
return;
|
|
490127
490334
|
}
|
|
490128
|
-
const projectsDir =
|
|
490129
|
-
const projectDir =
|
|
490130
|
-
const newPath =
|
|
490335
|
+
const projectsDir = join161(getClaudeConfigHomeDir(), "projects");
|
|
490336
|
+
const projectDir = join161(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
490337
|
+
const newPath = join161(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
490131
490338
|
if (oldPath === newPath) {
|
|
490132
490339
|
return;
|
|
490133
490340
|
}
|
|
@@ -490168,7 +490375,7 @@ function installAsciicastRecorder() {
|
|
|
490168
490375
|
}
|
|
490169
490376
|
});
|
|
490170
490377
|
try {
|
|
490171
|
-
getFsImplementation().mkdirSync(
|
|
490378
|
+
getFsImplementation().mkdirSync(dirname58(filePath));
|
|
490172
490379
|
} catch {}
|
|
490173
490380
|
getFsImplementation().appendFileSync(filePath, header + `
|
|
490174
490381
|
`, { mode: 384 });
|
|
@@ -490237,7 +490444,7 @@ var init_asciicast = __esm(() => {
|
|
|
490237
490444
|
});
|
|
490238
490445
|
|
|
490239
490446
|
// src/utils/sessionRestore.ts
|
|
490240
|
-
import { dirname as
|
|
490447
|
+
import { dirname as dirname59 } from "path";
|
|
490241
490448
|
function extractTodosFromTranscript(messages) {
|
|
490242
490449
|
for (let i2 = messages.length - 1;i2 >= 0; i2--) {
|
|
490243
490450
|
const msg = messages[i2];
|
|
@@ -490362,7 +490569,7 @@ async function processResumedConversation(result, opts, context8) {
|
|
|
490362
490569
|
if (!opts.forkSession) {
|
|
490363
490570
|
const sid = opts.sessionIdOverride ?? result.sessionId;
|
|
490364
490571
|
if (sid) {
|
|
490365
|
-
switchSession(asSessionId(sid), opts.transcriptPath ?
|
|
490572
|
+
switchSession(asSessionId(sid), opts.transcriptPath ? dirname59(opts.transcriptPath) : null);
|
|
490366
490573
|
await renameRecordingForSession();
|
|
490367
490574
|
await resetSessionFilePointer();
|
|
490368
490575
|
restoreCostStateForSession(sid);
|
|
@@ -491709,7 +491916,7 @@ var init_useDynamicConfig = __esm(() => {
|
|
|
491709
491916
|
});
|
|
491710
491917
|
|
|
491711
491918
|
// src/components/FeedbackSurvey/submitTranscriptShare.ts
|
|
491712
|
-
import { readFile as
|
|
491919
|
+
import { readFile as readFile69, stat as stat55 } from "fs/promises";
|
|
491713
491920
|
async function submitTranscriptShare(messages, trigger, appearanceId) {
|
|
491714
491921
|
try {
|
|
491715
491922
|
logForDebugging("Collecting transcript for sharing", { level: "info" });
|
|
@@ -491721,14 +491928,14 @@ async function submitTranscriptShare(messages, trigger, appearanceId) {
|
|
|
491721
491928
|
const transcriptPath = getTranscriptPath();
|
|
491722
491929
|
const { size } = await stat55(transcriptPath);
|
|
491723
491930
|
if (size <= MAX_TRANSCRIPT_READ_BYTES) {
|
|
491724
|
-
rawTranscriptJsonl = await
|
|
491931
|
+
rawTranscriptJsonl = await readFile69(transcriptPath, "utf-8");
|
|
491725
491932
|
} else {
|
|
491726
491933
|
logForDebugging(`Skipping raw transcript read: file too large (${size} bytes)`, { level: "warn" });
|
|
491727
491934
|
}
|
|
491728
491935
|
} catch {}
|
|
491729
491936
|
const data = {
|
|
491730
491937
|
trigger,
|
|
491731
|
-
version: "2.
|
|
491938
|
+
version: "2.3.0",
|
|
491732
491939
|
platform: process.platform,
|
|
491733
491940
|
transcript,
|
|
491734
491941
|
subagentTranscripts: Object.keys(subagentTranscripts).length > 0 ? subagentTranscripts : undefined,
|
|
@@ -493004,7 +493211,7 @@ var init_useAwaySummary = __esm(() => {
|
|
|
493004
493211
|
});
|
|
493005
493212
|
|
|
493006
493213
|
// src/utils/plugins/officialMarketplaceStartupCheck.ts
|
|
493007
|
-
import { join as
|
|
493214
|
+
import { join as join162 } from "path";
|
|
493008
493215
|
function isOfficialMarketplaceAutoInstallDisabled() {
|
|
493009
493216
|
return isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL);
|
|
493010
493217
|
}
|
|
@@ -493087,7 +493294,7 @@ async function checkAndInstallOfficialMarketplace() {
|
|
|
493087
493294
|
return { installed: false, skipped: true, reason: "policy_blocked" };
|
|
493088
493295
|
}
|
|
493089
493296
|
const cacheDir = getMarketplacesCacheDir();
|
|
493090
|
-
const installLocation =
|
|
493297
|
+
const installLocation = join162(cacheDir, OFFICIAL_MARKETPLACE_NAME);
|
|
493091
493298
|
const gcsSha = await fetchOfficialMarketplaceFromGcs(installLocation, cacheDir);
|
|
493092
493299
|
if (gcsSha !== null) {
|
|
493093
493300
|
const known = await loadKnownMarketplacesConfig();
|
|
@@ -493343,7 +493550,7 @@ var init_tipHistory = __esm(() => {
|
|
|
493343
493550
|
|
|
493344
493551
|
// src/utils/desktopDeepLink.ts
|
|
493345
493552
|
import { readdir as readdir39 } from "fs/promises";
|
|
493346
|
-
import { join as
|
|
493553
|
+
import { join as join163 } from "path";
|
|
493347
493554
|
function isDevMode() {
|
|
493348
493555
|
if (true) {
|
|
493349
493556
|
return true;
|
|
@@ -493406,7 +493613,7 @@ async function getDesktopVersion() {
|
|
|
493406
493613
|
if (!localAppData) {
|
|
493407
493614
|
return null;
|
|
493408
493615
|
}
|
|
493409
|
-
const installDir =
|
|
493616
|
+
const installDir = join163(localAppData, "AnthropicClaude");
|
|
493410
493617
|
try {
|
|
493411
493618
|
const entries = await readdir39(installDir);
|
|
493412
493619
|
const versions = entries.filter((e) => e.startsWith("app-")).map((e) => e.slice(4)).filter((v2) => import_semver14.coerce(v2) !== null).sort((a, b3) => {
|
|
@@ -496438,7 +496645,7 @@ var init_usePluginRecommendationBase = __esm(() => {
|
|
|
496438
496645
|
});
|
|
496439
496646
|
|
|
496440
496647
|
// src/hooks/useLspPluginRecommendation.tsx
|
|
496441
|
-
import { extname as extname16, join as
|
|
496648
|
+
import { extname as extname16, join as join164 } from "path";
|
|
496442
496649
|
function useLspPluginRecommendation() {
|
|
496443
496650
|
const $2 = c3(12);
|
|
496444
496651
|
const trackedFiles = useAppState(_temp201);
|
|
@@ -496523,7 +496730,7 @@ function useLspPluginRecommendation() {
|
|
|
496523
496730
|
case "yes": {
|
|
496524
496731
|
installPluginAndNotify(pluginId, pluginName, "lsp-plugin", addNotification, async (pluginData) => {
|
|
496525
496732
|
logForDebugging(`[useLspPluginRecommendation] Installing plugin: ${pluginId}`);
|
|
496526
|
-
const localSourcePath = typeof pluginData.entry.source === "string" ?
|
|
496733
|
+
const localSourcePath = typeof pluginData.entry.source === "string" ? join164(pluginData.marketplaceInstallLocation, pluginData.entry.source) : undefined;
|
|
496527
496734
|
await cacheAndRegisterPlugin(pluginId, pluginData.entry, "user", undefined, localSourcePath);
|
|
496528
496735
|
const settings = getSettingsForSource("userSettings");
|
|
496529
496736
|
updateSettingsForSource("userSettings", {
|
|
@@ -499355,9 +499562,9 @@ var exports_REPL = {};
|
|
|
499355
499562
|
__export(exports_REPL, {
|
|
499356
499563
|
REPL: () => REPL
|
|
499357
499564
|
});
|
|
499358
|
-
import { dirname as
|
|
499565
|
+
import { dirname as dirname60, join as join165 } from "path";
|
|
499359
499566
|
import { tmpdir as tmpdir11 } from "os";
|
|
499360
|
-
import { writeFile as
|
|
499567
|
+
import { writeFile as writeFile64 } from "fs/promises";
|
|
499361
499568
|
import { randomUUID as randomUUID47 } from "crypto";
|
|
499362
499569
|
function TranscriptModeFooter(t0) {
|
|
499363
499570
|
const $2 = c3(9);
|
|
@@ -500293,7 +500500,7 @@ function REPL({
|
|
|
500293
500500
|
const targetSessionCosts = getStoredSessionCosts(sessionId);
|
|
500294
500501
|
saveCurrentSessionCosts();
|
|
500295
500502
|
resetCostState();
|
|
500296
|
-
switchSession(asSessionId(sessionId), log2.fullPath ?
|
|
500503
|
+
switchSession(asSessionId(sessionId), log2.fullPath ? dirname60(log2.fullPath) : null);
|
|
500297
500504
|
const {
|
|
500298
500505
|
renameRecordingForSession: renameRecordingForSession2
|
|
500299
500506
|
} = await Promise.resolve().then(() => (init_asciicast(), exports_asciicast));
|
|
@@ -501925,8 +502132,8 @@ Note: ctrl + z now suspends localclawd, ctrl + _ undoes input.
|
|
|
501925
502132
|
const w2 = Math.max(80, (process.stdout.columns ?? 80) - 6);
|
|
501926
502133
|
const raw = await renderMessagesToPlainText(deferredMessages, tools, w2);
|
|
501927
502134
|
const text = raw.replace(/[ \t]+$/gm, "");
|
|
501928
|
-
const path17 =
|
|
501929
|
-
await
|
|
502135
|
+
const path17 = join165(tmpdir11(), `cc-transcript-${Date.now()}.txt`);
|
|
502136
|
+
await writeFile64(path17, text);
|
|
501930
502137
|
const opened = openFileInExternalEditor(path17);
|
|
501931
502138
|
setStatus(opened ? `opening ${path17}` : `wrote ${path17} · no $VISUAL/$EDITOR set`);
|
|
501932
502139
|
} catch (e) {
|
|
@@ -503589,7 +503796,7 @@ var exports_TrustDialog = {};
|
|
|
503589
503796
|
__export(exports_TrustDialog, {
|
|
503590
503797
|
TrustDialog: () => TrustDialog
|
|
503591
503798
|
});
|
|
503592
|
-
import { homedir as
|
|
503799
|
+
import { homedir as homedir37 } from "os";
|
|
503593
503800
|
function TrustDialog({ onDone }) {
|
|
503594
503801
|
const [focusIdx, setFocusIdx] = import_react307.useState(0);
|
|
503595
503802
|
const doneRef = import_react307.useRef(false);
|
|
@@ -503607,7 +503814,7 @@ function TrustDialog({ onDone }) {
|
|
|
503607
503814
|
gracefulShutdownSync(1);
|
|
503608
503815
|
} else {
|
|
503609
503816
|
try {
|
|
503610
|
-
if (
|
|
503817
|
+
if (homedir37() !== getCwd()) {
|
|
503611
503818
|
try {
|
|
503612
503819
|
saveCurrentProjectConfig((c5) => ({ ...c5, hasTrustDialogAccepted: true }));
|
|
503613
503820
|
} catch {}
|
|
@@ -504936,7 +505143,7 @@ var exports_ResumeConversation = {};
|
|
|
504936
505143
|
__export(exports_ResumeConversation, {
|
|
504937
505144
|
ResumeConversation: () => ResumeConversation
|
|
504938
505145
|
});
|
|
504939
|
-
import { dirname as
|
|
505146
|
+
import { dirname as dirname61 } from "path";
|
|
504940
505147
|
function parsePrIdentifier(value) {
|
|
504941
505148
|
const directNumber = parseInt(value, 10);
|
|
504942
505149
|
if (!isNaN(directNumber) && directNumber > 0) {
|
|
@@ -505068,7 +505275,7 @@ function ResumeConversation({
|
|
|
505068
505275
|
}
|
|
505069
505276
|
if (false) {}
|
|
505070
505277
|
if (result_3.sessionId && !forkSession) {
|
|
505071
|
-
switchSession(asSessionId(result_3.sessionId), log_0.fullPath ?
|
|
505278
|
+
switchSession(asSessionId(result_3.sessionId), log_0.fullPath ? dirname61(log_0.fullPath) : null);
|
|
505072
505279
|
await renameRecordingForSession();
|
|
505073
505280
|
await resetSessionFilePointer();
|
|
505074
505281
|
restoreCostStateForSession(result_3.sessionId);
|
|
@@ -508652,12 +508859,12 @@ var init_createDirectConnectSession = __esm(() => {
|
|
|
508652
508859
|
});
|
|
508653
508860
|
|
|
508654
508861
|
// src/utils/errorLogSink.ts
|
|
508655
|
-
import { dirname as
|
|
508862
|
+
import { dirname as dirname62, join as join166 } from "path";
|
|
508656
508863
|
function getErrorsPath() {
|
|
508657
|
-
return
|
|
508864
|
+
return join166(CACHE_PATHS.errors(), DATE + ".jsonl");
|
|
508658
508865
|
}
|
|
508659
508866
|
function getMCPLogsPath(serverName) {
|
|
508660
|
-
return
|
|
508867
|
+
return join166(CACHE_PATHS.mcpLogs(serverName), DATE + ".jsonl");
|
|
508661
508868
|
}
|
|
508662
508869
|
function createJsonlWriter(options) {
|
|
508663
508870
|
const writer = createBufferedWriter(options);
|
|
@@ -508673,7 +508880,7 @@ function createJsonlWriter(options) {
|
|
|
508673
508880
|
function getLogWriter(path17) {
|
|
508674
508881
|
let writer = logWriters.get(path17);
|
|
508675
508882
|
if (!writer) {
|
|
508676
|
-
const dir =
|
|
508883
|
+
const dir = dirname62(path17);
|
|
508677
508884
|
writer = createJsonlWriter({
|
|
508678
508885
|
writeFn: (content) => {
|
|
508679
508886
|
try {
|
|
@@ -508701,7 +508908,7 @@ function appendToLog(path17, message) {
|
|
|
508701
508908
|
cwd: getFsImplementation().cwd(),
|
|
508702
508909
|
userType: process.env.USER_TYPE,
|
|
508703
508910
|
sessionId: getSessionId(),
|
|
508704
|
-
version: "2.
|
|
508911
|
+
version: "2.3.0"
|
|
508705
508912
|
};
|
|
508706
508913
|
getLogWriter(path17).write(messageWithTimestamp);
|
|
508707
508914
|
}
|
|
@@ -508801,8 +509008,8 @@ var init_sinks = __esm(() => {
|
|
|
508801
509008
|
|
|
508802
509009
|
// src/utils/iTermBackup.ts
|
|
508803
509010
|
import { copyFile as copyFile11, stat as stat57 } from "fs/promises";
|
|
508804
|
-
import { homedir as
|
|
508805
|
-
import { join as
|
|
509011
|
+
import { homedir as homedir38 } from "os";
|
|
509012
|
+
import { join as join167 } from "path";
|
|
508806
509013
|
function markITerm2SetupComplete() {
|
|
508807
509014
|
saveGlobalConfig((current) => ({
|
|
508808
509015
|
...current,
|
|
@@ -508817,7 +509024,7 @@ function getIterm2RecoveryInfo() {
|
|
|
508817
509024
|
};
|
|
508818
509025
|
}
|
|
508819
509026
|
function getITerm2PlistPath() {
|
|
508820
|
-
return
|
|
509027
|
+
return join167(homedir38(), "Library", "Preferences", "com.googlecode.iterm2.plist");
|
|
508821
509028
|
}
|
|
508822
509029
|
async function checkAndRestoreITerm2Backup() {
|
|
508823
509030
|
const { inProgress, backupPath } = getIterm2RecoveryInfo();
|
|
@@ -512193,8 +512400,8 @@ var init_idleTimeout = __esm(() => {
|
|
|
512193
512400
|
|
|
512194
512401
|
// src/bridge/inboundAttachments.ts
|
|
512195
512402
|
import { randomUUID as randomUUID50 } from "crypto";
|
|
512196
|
-
import { mkdir as
|
|
512197
|
-
import { basename as basename59, join as
|
|
512403
|
+
import { mkdir as mkdir62, writeFile as writeFile65 } from "fs/promises";
|
|
512404
|
+
import { basename as basename59, join as join168 } from "path";
|
|
512198
512405
|
import { z as z95 } from "zod/v4";
|
|
512199
512406
|
function debug3(msg) {
|
|
512200
512407
|
logForDebugging(`[bridge:inbound-attach] ${msg}`);
|
|
@@ -512211,7 +512418,7 @@ function sanitizeFileName(name) {
|
|
|
512211
512418
|
return base || "attachment";
|
|
512212
512419
|
}
|
|
512213
512420
|
function uploadsDir() {
|
|
512214
|
-
return
|
|
512421
|
+
return join168(getClaudeConfigHomeDir(), "uploads", getSessionId());
|
|
512215
512422
|
}
|
|
512216
512423
|
async function resolveOne(att) {
|
|
512217
512424
|
const token = getBridgeAccessToken();
|
|
@@ -512240,10 +512447,10 @@ async function resolveOne(att) {
|
|
|
512240
512447
|
const safeName = sanitizeFileName(att.file_name);
|
|
512241
512448
|
const prefix = (att.file_uuid.slice(0, 8) || randomUUID50().slice(0, 8)).replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
512242
512449
|
const dir = uploadsDir();
|
|
512243
|
-
const outPath =
|
|
512450
|
+
const outPath = join168(dir, `${prefix}-${safeName}`);
|
|
512244
512451
|
try {
|
|
512245
|
-
await
|
|
512246
|
-
await
|
|
512452
|
+
await mkdir62(dir, { recursive: true });
|
|
512453
|
+
await writeFile65(outPath, data);
|
|
512247
512454
|
} catch (e) {
|
|
512248
512455
|
debug3(`write ${outPath} failed: ${e}`);
|
|
512249
512456
|
return;
|
|
@@ -512338,11 +512545,11 @@ var init_sessionUrl = __esm(() => {
|
|
|
512338
512545
|
});
|
|
512339
512546
|
|
|
512340
512547
|
// src/utils/plugins/zipCacheAdapters.ts
|
|
512341
|
-
import { readFile as
|
|
512342
|
-
import { join as
|
|
512548
|
+
import { readFile as readFile70 } from "fs/promises";
|
|
512549
|
+
import { join as join169 } from "path";
|
|
512343
512550
|
async function readZipCacheKnownMarketplaces() {
|
|
512344
512551
|
try {
|
|
512345
|
-
const content = await
|
|
512552
|
+
const content = await readFile70(getZipCacheKnownMarketplacesPath(), "utf-8");
|
|
512346
512553
|
const parsed = KnownMarketplacesFileSchema().safeParse(jsonParse(content));
|
|
512347
512554
|
if (!parsed.success) {
|
|
512348
512555
|
logForDebugging(`Invalid known_marketplaces.json in zip cache: ${parsed.error.message}`, { level: "error" });
|
|
@@ -512364,18 +512571,18 @@ async function saveMarketplaceJsonToZipCache(marketplaceName, installLocation) {
|
|
|
512364
512571
|
const content = await readMarketplaceJsonContent(installLocation);
|
|
512365
512572
|
if (content !== null) {
|
|
512366
512573
|
const relPath = getMarketplaceJsonRelativePath(marketplaceName);
|
|
512367
|
-
await atomicWriteToZipCache(
|
|
512574
|
+
await atomicWriteToZipCache(join169(zipCachePath, relPath), content);
|
|
512368
512575
|
}
|
|
512369
512576
|
}
|
|
512370
512577
|
async function readMarketplaceJsonContent(dir) {
|
|
512371
512578
|
const candidates = [
|
|
512372
|
-
|
|
512373
|
-
|
|
512579
|
+
join169(dir, ".claude-plugin", "marketplace.json"),
|
|
512580
|
+
join169(dir, "marketplace.json"),
|
|
512374
512581
|
dir
|
|
512375
512582
|
];
|
|
512376
512583
|
for (const candidate of candidates) {
|
|
512377
512584
|
try {
|
|
512378
|
-
return await
|
|
512585
|
+
return await readFile70(candidate, "utf-8");
|
|
512379
512586
|
} catch {}
|
|
512380
512587
|
}
|
|
512381
512588
|
return null;
|
|
@@ -512500,8 +512707,8 @@ async function getEnvLessBridgeConfig() {
|
|
|
512500
512707
|
}
|
|
512501
512708
|
async function checkEnvLessBridgeMinVersion() {
|
|
512502
512709
|
const cfg = await getEnvLessBridgeConfig();
|
|
512503
|
-
if (cfg.min_version && lt("2.
|
|
512504
|
-
return `Your version of localclawd (${"2.
|
|
512710
|
+
if (cfg.min_version && lt("2.3.0", cfg.min_version)) {
|
|
512711
|
+
return `Your version of localclawd (${"2.3.0"}) is too old for Remote Control.
|
|
512505
512712
|
Version ${cfg.min_version} or higher is required. Run \`localclawd update\` to update.`;
|
|
512506
512713
|
}
|
|
512507
512714
|
return null;
|
|
@@ -512826,17 +513033,17 @@ __export(exports_bridgePointer, {
|
|
|
512826
513033
|
clearBridgePointer: () => clearBridgePointer,
|
|
512827
513034
|
BRIDGE_POINTER_TTL_MS: () => BRIDGE_POINTER_TTL_MS
|
|
512828
513035
|
});
|
|
512829
|
-
import { mkdir as
|
|
512830
|
-
import { dirname as
|
|
513036
|
+
import { mkdir as mkdir63, readFile as readFile71, stat as stat58, unlink as unlink25, writeFile as writeFile66 } from "fs/promises";
|
|
513037
|
+
import { dirname as dirname63, join as join170 } from "path";
|
|
512831
513038
|
import { z as z97 } from "zod/v4";
|
|
512832
513039
|
function getBridgePointerPath(dir) {
|
|
512833
|
-
return
|
|
513040
|
+
return join170(getProjectsDir(), sanitizePath2(dir), "bridge-pointer.json");
|
|
512834
513041
|
}
|
|
512835
513042
|
async function writeBridgePointer(dir, pointer) {
|
|
512836
513043
|
const path17 = getBridgePointerPath(dir);
|
|
512837
513044
|
try {
|
|
512838
|
-
await
|
|
512839
|
-
await
|
|
513045
|
+
await mkdir63(dirname63(path17), { recursive: true });
|
|
513046
|
+
await writeFile66(path17, jsonStringify(pointer), "utf8");
|
|
512840
513047
|
logForDebugging(`[bridge:pointer] wrote ${path17}`);
|
|
512841
513048
|
} catch (err2) {
|
|
512842
513049
|
logForDebugging(`[bridge:pointer] write failed: ${err2}`, { level: "warn" });
|
|
@@ -512848,7 +513055,7 @@ async function readBridgePointer(dir) {
|
|
|
512848
513055
|
let mtimeMs;
|
|
512849
513056
|
try {
|
|
512850
513057
|
mtimeMs = (await stat58(path17)).mtimeMs;
|
|
512851
|
-
raw = await
|
|
513058
|
+
raw = await readFile71(path17, "utf8");
|
|
512852
513059
|
} catch {
|
|
512853
513060
|
return null;
|
|
512854
513061
|
}
|
|
@@ -512973,7 +513180,7 @@ async function initBridgeCore(params) {
|
|
|
512973
513180
|
const rawApi = createBridgeApiClient({
|
|
512974
513181
|
baseUrl,
|
|
512975
513182
|
getAccessToken,
|
|
512976
|
-
runnerVersion: "2.
|
|
513183
|
+
runnerVersion: "2.3.0",
|
|
512977
513184
|
onDebug: logForDebugging,
|
|
512978
513185
|
onAuth401,
|
|
512979
513186
|
getTrustedDeviceToken
|
|
@@ -514834,8 +515041,8 @@ __export(exports_print, {
|
|
|
514834
515041
|
createCanUseToolWithPermissionPrompt: () => createCanUseToolWithPermissionPrompt,
|
|
514835
515042
|
canBatchWith: () => canBatchWith
|
|
514836
515043
|
});
|
|
514837
|
-
import { readFile as
|
|
514838
|
-
import { dirname as
|
|
515044
|
+
import { readFile as readFile72, stat as stat59 } from "fs/promises";
|
|
515045
|
+
import { dirname as dirname64 } from "path";
|
|
514839
515046
|
import { cwd as cwd2 } from "process";
|
|
514840
515047
|
import { randomUUID as randomUUID53 } from "crypto";
|
|
514841
515048
|
function trackReceivedMessageUuid(uuid2) {
|
|
@@ -516184,7 +516391,7 @@ ${m2.text}
|
|
|
516184
516391
|
const normalizedPath = expandPath(message.request.path);
|
|
516185
516392
|
const diskMtime = Math.floor((await stat59(normalizedPath)).mtimeMs);
|
|
516186
516393
|
if (diskMtime <= message.request.mtime) {
|
|
516187
|
-
const raw = await
|
|
516394
|
+
const raw = await readFile72(normalizedPath, "utf-8");
|
|
516188
516395
|
const content = (raw.charCodeAt(0) === 65279 ? raw.slice(1) : raw).replaceAll(`\r
|
|
516189
516396
|
`, `
|
|
516190
516397
|
`);
|
|
@@ -517270,7 +517477,7 @@ async function loadInitialMessages(setAppState, options) {
|
|
|
517270
517477
|
if (false) {}
|
|
517271
517478
|
if (!options.forkSession) {
|
|
517272
517479
|
if (result.sessionId) {
|
|
517273
|
-
switchSession(asSessionId(result.sessionId), result.fullPath ?
|
|
517480
|
+
switchSession(asSessionId(result.sessionId), result.fullPath ? dirname64(result.fullPath) : null);
|
|
517274
517481
|
if (persistSession) {
|
|
517275
517482
|
await resetSessionFilePointer();
|
|
517276
517483
|
}
|
|
@@ -517368,7 +517575,7 @@ async function loadInitialMessages(setAppState, options) {
|
|
|
517368
517575
|
}
|
|
517369
517576
|
if (false) {}
|
|
517370
517577
|
if (!options.forkSession && result.sessionId) {
|
|
517371
|
-
switchSession(asSessionId(result.sessionId), result.fullPath ?
|
|
517578
|
+
switchSession(asSessionId(result.sessionId), result.fullPath ? dirname64(result.fullPath) : null);
|
|
517372
517579
|
if (persistSession) {
|
|
517373
517580
|
await resetSessionFilePointer();
|
|
517374
517581
|
}
|
|
@@ -518692,7 +518899,7 @@ async function startMCPServer(cwd3, debug4, verbose) {
|
|
|
518692
518899
|
setCwd(cwd3);
|
|
518693
518900
|
const server = new Server({
|
|
518694
518901
|
name: "claude/tengu",
|
|
518695
|
-
version: "2.
|
|
518902
|
+
version: "2.3.0"
|
|
518696
518903
|
}, {
|
|
518697
518904
|
capabilities: {
|
|
518698
518905
|
tools: {}
|
|
@@ -518822,16 +519029,16 @@ __export(exports_appDesktop, {
|
|
|
518822
519029
|
readClaudeDesktopMcpServers: () => readClaudeDesktopMcpServers,
|
|
518823
519030
|
getClaudeDesktopConfigPath: () => getClaudeDesktopConfigPath
|
|
518824
519031
|
});
|
|
518825
|
-
import { readdir as readdir40, readFile as
|
|
518826
|
-
import { homedir as
|
|
518827
|
-
import { join as
|
|
519032
|
+
import { readdir as readdir40, readFile as readFile73, stat as stat60 } from "fs/promises";
|
|
519033
|
+
import { homedir as homedir39 } from "os";
|
|
519034
|
+
import { join as join171 } from "path";
|
|
518828
519035
|
async function getClaudeDesktopConfigPath() {
|
|
518829
519036
|
const platform3 = getPlatform();
|
|
518830
519037
|
if (!SUPPORTED_PLATFORMS.includes(platform3)) {
|
|
518831
519038
|
throw new Error(`Unsupported platform: ${platform3} - desktop app integration only works on macOS and WSL.`);
|
|
518832
519039
|
}
|
|
518833
519040
|
if (platform3 === "macos") {
|
|
518834
|
-
return
|
|
519041
|
+
return join171(homedir39(), "Library", "Application Support", "Claude", "claude_desktop_config.json");
|
|
518835
519042
|
}
|
|
518836
519043
|
const windowsHome = process.env.USERPROFILE ? process.env.USERPROFILE.replace(/\\/g, "/") : null;
|
|
518837
519044
|
if (windowsHome) {
|
|
@@ -518850,7 +519057,7 @@ async function getClaudeDesktopConfigPath() {
|
|
|
518850
519057
|
if (user.name === "Public" || user.name === "Default" || user.name === "Default User" || user.name === "All Users") {
|
|
518851
519058
|
continue;
|
|
518852
519059
|
}
|
|
518853
|
-
const potentialConfigPath =
|
|
519060
|
+
const potentialConfigPath = join171(usersDir, user.name, "AppData", "Roaming", "Claude", "claude_desktop_config.json");
|
|
518854
519061
|
try {
|
|
518855
519062
|
await stat60(potentialConfigPath);
|
|
518856
519063
|
return potentialConfigPath;
|
|
@@ -518870,7 +519077,7 @@ async function readClaudeDesktopMcpServers() {
|
|
|
518870
519077
|
const configPath = await getClaudeDesktopConfigPath();
|
|
518871
519078
|
let configContent;
|
|
518872
519079
|
try {
|
|
518873
|
-
configContent = await
|
|
519080
|
+
configContent = await readFile73(configPath, { encoding: "utf8" });
|
|
518874
519081
|
} catch (e) {
|
|
518875
519082
|
const code = getErrnoCode(e);
|
|
518876
519083
|
if (code === "ENOENT") {
|
|
@@ -519245,7 +519452,7 @@ __export(exports_plugins, {
|
|
|
519245
519452
|
VALID_UPDATE_SCOPES: () => VALID_UPDATE_SCOPES,
|
|
519246
519453
|
VALID_INSTALLABLE_SCOPES: () => VALID_INSTALLABLE_SCOPES
|
|
519247
519454
|
});
|
|
519248
|
-
import { basename as basename60, dirname as
|
|
519455
|
+
import { basename as basename60, dirname as dirname65 } from "path";
|
|
519249
519456
|
function handleMarketplaceError(error5, action2) {
|
|
519250
519457
|
logError(error5);
|
|
519251
519458
|
cliError(`${figures_default.cross} Failed to ${action2}: ${errorMessage(error5)}`);
|
|
@@ -519278,9 +519485,9 @@ async function pluginValidateHandler(manifestPath, options) {
|
|
|
519278
519485
|
printValidationResult(result);
|
|
519279
519486
|
let contentResults = [];
|
|
519280
519487
|
if (result.fileType === "plugin") {
|
|
519281
|
-
const manifestDir =
|
|
519488
|
+
const manifestDir = dirname65(result.filePath);
|
|
519282
519489
|
if (basename60(manifestDir) === ".claude-plugin") {
|
|
519283
|
-
contentResults = await validatePluginContents(
|
|
519490
|
+
contentResults = await validatePluginContents(dirname65(manifestDir));
|
|
519284
519491
|
for (const r of contentResults) {
|
|
519285
519492
|
console.log(`Validating ${r.fileType}: ${r.filePath}
|
|
519286
519493
|
`);
|
|
@@ -519773,7 +519980,7 @@ function WelcomeLogo() {
|
|
|
519773
519980
|
dimColor: true,
|
|
519774
519981
|
children: [
|
|
519775
519982
|
"v",
|
|
519776
|
-
"2.
|
|
519983
|
+
"2.3.0"
|
|
519777
519984
|
]
|
|
519778
519985
|
}, undefined, true, undefined, this)
|
|
519779
519986
|
]
|
|
@@ -519964,7 +520171,7 @@ __export(exports_update, {
|
|
|
519964
520171
|
});
|
|
519965
520172
|
async function update() {
|
|
519966
520173
|
logEvent("tengu_update_check", {});
|
|
519967
|
-
writeToStdout(`Current version: ${"2.
|
|
520174
|
+
writeToStdout(`Current version: ${"2.3.0"}
|
|
519968
520175
|
`);
|
|
519969
520176
|
const channel = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
519970
520177
|
writeToStdout(`Checking for updates to ${channel} version...
|
|
@@ -520039,8 +520246,8 @@ async function update() {
|
|
|
520039
520246
|
writeToStdout(`localclawd is managed by Homebrew.
|
|
520040
520247
|
`);
|
|
520041
520248
|
const latest = await getLatestVersion(channel);
|
|
520042
|
-
if (latest && !gte("2.
|
|
520043
|
-
writeToStdout(`Update available: ${"2.
|
|
520249
|
+
if (latest && !gte("2.3.0", latest)) {
|
|
520250
|
+
writeToStdout(`Update available: ${"2.3.0"} → ${latest}
|
|
520044
520251
|
`);
|
|
520045
520252
|
writeToStdout(`
|
|
520046
520253
|
`);
|
|
@@ -520056,8 +520263,8 @@ async function update() {
|
|
|
520056
520263
|
writeToStdout(`localclawd is managed by winget.
|
|
520057
520264
|
`);
|
|
520058
520265
|
const latest = await getLatestVersion(channel);
|
|
520059
|
-
if (latest && !gte("2.
|
|
520060
|
-
writeToStdout(`Update available: ${"2.
|
|
520266
|
+
if (latest && !gte("2.3.0", latest)) {
|
|
520267
|
+
writeToStdout(`Update available: ${"2.3.0"} → ${latest}
|
|
520061
520268
|
`);
|
|
520062
520269
|
writeToStdout(`
|
|
520063
520270
|
`);
|
|
@@ -520071,8 +520278,8 @@ async function update() {
|
|
|
520071
520278
|
writeToStdout(`localclawd is managed by apk.
|
|
520072
520279
|
`);
|
|
520073
520280
|
const latest = await getLatestVersion(channel);
|
|
520074
|
-
if (latest && !gte("2.
|
|
520075
|
-
writeToStdout(`Update available: ${"2.
|
|
520281
|
+
if (latest && !gte("2.3.0", latest)) {
|
|
520282
|
+
writeToStdout(`Update available: ${"2.3.0"} → ${latest}
|
|
520076
520283
|
`);
|
|
520077
520284
|
writeToStdout(`
|
|
520078
520285
|
`);
|
|
@@ -520137,11 +520344,11 @@ async function update() {
|
|
|
520137
520344
|
`);
|
|
520138
520345
|
await gracefulShutdown(1);
|
|
520139
520346
|
}
|
|
520140
|
-
if (result.latestVersion === "2.
|
|
520141
|
-
writeToStdout(source_default.green(`localclawd is up to date (${"2.
|
|
520347
|
+
if (result.latestVersion === "2.3.0") {
|
|
520348
|
+
writeToStdout(source_default.green(`localclawd is up to date (${"2.3.0"})`) + `
|
|
520142
520349
|
`);
|
|
520143
520350
|
} else {
|
|
520144
|
-
writeToStdout(source_default.green(`Successfully updated from ${"2.
|
|
520351
|
+
writeToStdout(source_default.green(`Successfully updated from ${"2.3.0"} to version ${result.latestVersion}`) + `
|
|
520145
520352
|
`);
|
|
520146
520353
|
await regenerateCompletionCache();
|
|
520147
520354
|
}
|
|
@@ -520201,12 +520408,12 @@ async function update() {
|
|
|
520201
520408
|
`);
|
|
520202
520409
|
await gracefulShutdown(1);
|
|
520203
520410
|
}
|
|
520204
|
-
if (latestVersion === "2.
|
|
520205
|
-
writeToStdout(source_default.green(`localclawd is up to date (${"2.
|
|
520411
|
+
if (latestVersion === "2.3.0") {
|
|
520412
|
+
writeToStdout(source_default.green(`localclawd is up to date (${"2.3.0"})`) + `
|
|
520206
520413
|
`);
|
|
520207
520414
|
await gracefulShutdown(0);
|
|
520208
520415
|
}
|
|
520209
|
-
writeToStdout(`New version available: ${latestVersion} (current: ${"2.
|
|
520416
|
+
writeToStdout(`New version available: ${latestVersion} (current: ${"2.3.0"})
|
|
520210
520417
|
`);
|
|
520211
520418
|
writeToStdout(`Installing update...
|
|
520212
520419
|
`);
|
|
@@ -520251,7 +520458,7 @@ async function update() {
|
|
|
520251
520458
|
logForDebugging(`update: Installation status: ${status2}`);
|
|
520252
520459
|
switch (status2) {
|
|
520253
520460
|
case "success":
|
|
520254
|
-
writeToStdout(source_default.green(`Successfully updated from ${"2.
|
|
520461
|
+
writeToStdout(source_default.green(`Successfully updated from ${"2.3.0"} to version ${latestVersion}`) + `
|
|
520255
520462
|
`);
|
|
520256
520463
|
await regenerateCompletionCache();
|
|
520257
520464
|
break;
|
|
@@ -521493,7 +521700,7 @@ Run with --debug for more details.
|
|
|
521493
521700
|
}
|
|
521494
521701
|
}
|
|
521495
521702
|
logForDiagnosticsNoPII("info", "started", {
|
|
521496
|
-
version: "2.
|
|
521703
|
+
version: "2.3.0",
|
|
521497
521704
|
is_native_binary: isInBundledMode()
|
|
521498
521705
|
});
|
|
521499
521706
|
registerCleanup(async () => {
|
|
@@ -522277,7 +522484,7 @@ Usage: localclawd --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
522277
522484
|
pendingHookMessages
|
|
522278
522485
|
}, renderAndRun);
|
|
522279
522486
|
}
|
|
522280
|
-
}).version("2.
|
|
522487
|
+
}).version("2.3.0 (localclawd)", "-v, --version", "Output the version number");
|
|
522281
522488
|
program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
522282
522489
|
program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
|
|
522283
522490
|
if (canUserConfigureAdvisor()) {
|
|
@@ -522791,7 +522998,7 @@ if (false) {}
|
|
|
522791
522998
|
async function main2() {
|
|
522792
522999
|
const args = process.argv.slice(2);
|
|
522793
523000
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
522794
|
-
console.log(`${"2.
|
|
523001
|
+
console.log(`${"2.3.0"} (localclawd)`);
|
|
522795
523002
|
return;
|
|
522796
523003
|
}
|
|
522797
523004
|
const {
|
|
@@ -522866,11 +523073,11 @@ localclawd: unhandled error (continuing) — ${msg}
|
|
|
522866
523073
|
`);
|
|
522867
523074
|
try {
|
|
522868
523075
|
const { appendFileSync: appendFileSync4, mkdirSync: mkdirSync6 } = __require("fs");
|
|
522869
|
-
const { homedir:
|
|
522870
|
-
const { join:
|
|
522871
|
-
const dir =
|
|
523076
|
+
const { homedir: homedir40 } = __require("os");
|
|
523077
|
+
const { join: join172 } = __require("path");
|
|
523078
|
+
const dir = join172(homedir40(), ".claude");
|
|
522872
523079
|
mkdirSync6(dir, { recursive: true });
|
|
522873
|
-
appendFileSync4(
|
|
523080
|
+
appendFileSync4(join172(dir, "crash.log"), `[${new Date().toISOString()}] unhandledRejection: ${msg}
|
|
522874
523081
|
`);
|
|
522875
523082
|
} catch {}
|
|
522876
523083
|
});
|
|
@@ -522882,4 +523089,4 @@ localclawd crashed: ${msg}
|
|
|
522882
523089
|
process.exit(1);
|
|
522883
523090
|
});
|
|
522884
523091
|
|
|
522885
|
-
//# debugId=
|
|
523092
|
+
//# debugId=9066A3790DFA1A3F64756E2164756E21
|