localclawd 2.2.6 → 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 +768 -572
- 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
|
|
@@ -383899,13 +384095,13 @@ var init_versions2 = __esm(() => {
|
|
|
383899
384095
|
});
|
|
383900
384096
|
|
|
383901
384097
|
// src/components/memory/MemoryFileSelector.tsx
|
|
383902
|
-
import { join as
|
|
384098
|
+
import { join as join132 } from "path";
|
|
383903
384099
|
function MemoryFileSelector({
|
|
383904
384100
|
onSelect,
|
|
383905
384101
|
onCancel
|
|
383906
384102
|
}) {
|
|
383907
384103
|
const existingMemoryFiles = import_react112.use(getMemoryFiles());
|
|
383908
|
-
const projectMemoryPath =
|
|
384104
|
+
const projectMemoryPath = join132(getOriginalCwd(), "LOCALCLAWD.md");
|
|
383909
384105
|
const hasProjectMemory = existingMemoryFiles.some((f) => f.path === projectMemoryPath);
|
|
383910
384106
|
const allMemoryFiles = [
|
|
383911
384107
|
...existingMemoryFiles.filter((f) => f.type !== "AutoMem" && f.type !== "TeamMem" && f.type !== "User" && f.type !== "Managed").map((f) => ({ ...f, exists: true })),
|
|
@@ -383975,10 +384171,10 @@ var init_MemoryFileSelector = __esm(() => {
|
|
|
383975
384171
|
});
|
|
383976
384172
|
|
|
383977
384173
|
// src/components/memory/MemoryUpdateNotification.tsx
|
|
383978
|
-
import { homedir as
|
|
384174
|
+
import { homedir as homedir30 } from "os";
|
|
383979
384175
|
import { relative as relative25 } from "path";
|
|
383980
384176
|
function getRelativeMemoryPath(path12) {
|
|
383981
|
-
const homeDir =
|
|
384177
|
+
const homeDir = homedir30();
|
|
383982
384178
|
const cwd2 = getCwd();
|
|
383983
384179
|
const relativeToHome = path12.startsWith(homeDir) ? "~" + path12.slice(homeDir.length) : null;
|
|
383984
384180
|
const relativeToCwd = path12.startsWith(cwd2) ? "./" + relative25(cwd2, path12) : null;
|
|
@@ -384225,8 +384421,8 @@ var exports_memory = {};
|
|
|
384225
384421
|
__export(exports_memory, {
|
|
384226
384422
|
call: () => call53
|
|
384227
384423
|
});
|
|
384228
|
-
import { mkdir as
|
|
384229
|
-
import { dirname as
|
|
384424
|
+
import { mkdir as mkdir50, writeFile as writeFile52 } from "fs/promises";
|
|
384425
|
+
import { dirname as dirname49 } from "path";
|
|
384230
384426
|
function formatBytes(bytes) {
|
|
384231
384427
|
if (bytes < 1024)
|
|
384232
384428
|
return `${bytes} B`;
|
|
@@ -384273,9 +384469,9 @@ function MemoryCommand({
|
|
|
384273
384469
|
}) {
|
|
384274
384470
|
const handleSelectMemoryFile = async (memoryPath) => {
|
|
384275
384471
|
try {
|
|
384276
|
-
await
|
|
384472
|
+
await mkdir50(dirname49(memoryPath), { recursive: true });
|
|
384277
384473
|
try {
|
|
384278
|
-
await
|
|
384474
|
+
await writeFile52(memoryPath, "", {
|
|
384279
384475
|
encoding: "utf8",
|
|
384280
384476
|
flag: "wx"
|
|
384281
384477
|
});
|
|
@@ -384384,10 +384580,10 @@ var exports_includememory = {};
|
|
|
384384
384580
|
__export(exports_includememory, {
|
|
384385
384581
|
call: () => call54
|
|
384386
384582
|
});
|
|
384387
|
-
import { join as
|
|
384583
|
+
import { join as join133 } from "path";
|
|
384388
384584
|
var MEMORY_GITIGNORE_PATTERNS, call54 = async () => {
|
|
384389
384585
|
const gitignorePaths = [
|
|
384390
|
-
|
|
384586
|
+
join133(getOriginalCwd(), ".gitignore"),
|
|
384391
384587
|
getGlobalGitignorePath()
|
|
384392
384588
|
];
|
|
384393
384589
|
const results = await Promise.all(gitignorePaths.map((path12) => removeGitignoreRulesFromFile(path12, MEMORY_GITIGNORE_PATTERNS)));
|
|
@@ -385250,7 +385446,7 @@ function Help(t0) {
|
|
|
385250
385446
|
let t6;
|
|
385251
385447
|
if ($2[31] !== tabs) {
|
|
385252
385448
|
t6 = /* @__PURE__ */ jsx_dev_runtime218.jsxDEV(Tabs, {
|
|
385253
|
-
title: `localclawd v${"2.
|
|
385449
|
+
title: `localclawd v${"2.3.0"}`,
|
|
385254
385450
|
color: "professionalBlue",
|
|
385255
385451
|
defaultTab: "general",
|
|
385256
385452
|
children: tabs
|
|
@@ -386628,8 +386824,8 @@ var exports_keybindings = {};
|
|
|
386628
386824
|
__export(exports_keybindings, {
|
|
386629
386825
|
call: () => call57
|
|
386630
386826
|
});
|
|
386631
|
-
import { mkdir as
|
|
386632
|
-
import { dirname as
|
|
386827
|
+
import { mkdir as mkdir51, writeFile as writeFile53 } from "fs/promises";
|
|
386828
|
+
import { dirname as dirname50 } from "path";
|
|
386633
386829
|
async function call57() {
|
|
386634
386830
|
if (!isKeybindingCustomizationEnabled()) {
|
|
386635
386831
|
return {
|
|
@@ -386639,9 +386835,9 @@ async function call57() {
|
|
|
386639
386835
|
}
|
|
386640
386836
|
const keybindingsPath = getKeybindingsPath();
|
|
386641
386837
|
let fileExists = false;
|
|
386642
|
-
await
|
|
386838
|
+
await mkdir51(dirname50(keybindingsPath), { recursive: true });
|
|
386643
386839
|
try {
|
|
386644
|
-
await
|
|
386840
|
+
await writeFile53(keybindingsPath, generateKeybindingsTemplate(), {
|
|
386645
386841
|
encoding: "utf-8",
|
|
386646
386842
|
flag: "wx"
|
|
386647
386843
|
});
|
|
@@ -390951,7 +391147,7 @@ __export(exports_pluginStartupCheck, {
|
|
|
390951
391147
|
findMissingPlugins: () => findMissingPlugins,
|
|
390952
391148
|
checkEnabledPlugins: () => checkEnabledPlugins
|
|
390953
391149
|
});
|
|
390954
|
-
import { join as
|
|
391150
|
+
import { join as join134 } from "path";
|
|
390955
391151
|
async function checkEnabledPlugins() {
|
|
390956
391152
|
const settings = getInitialSettings();
|
|
390957
391153
|
const enabledPlugins = [];
|
|
@@ -391086,7 +391282,7 @@ async function installSelectedPlugins(pluginsToInstall, onProgress, scope = "use
|
|
|
391086
391282
|
} else {
|
|
391087
391283
|
registerPluginInstallation({
|
|
391088
391284
|
pluginId,
|
|
391089
|
-
installPath:
|
|
391285
|
+
installPath: join134(marketplaceInstallLocation, entry.source),
|
|
391090
391286
|
version: entry.version
|
|
391091
391287
|
}, scope, projectPath);
|
|
391092
391288
|
}
|
|
@@ -391118,7 +391314,7 @@ var init_pluginStartupCheck = __esm(() => {
|
|
|
391118
391314
|
});
|
|
391119
391315
|
|
|
391120
391316
|
// src/utils/plugins/parseMarketplaceInput.ts
|
|
391121
|
-
import { homedir as
|
|
391317
|
+
import { homedir as homedir31 } from "os";
|
|
391122
391318
|
import { resolve as resolve40 } from "path";
|
|
391123
391319
|
async function parseMarketplaceInput(input) {
|
|
391124
391320
|
const trimmed = input.trim();
|
|
@@ -391154,7 +391350,7 @@ async function parseMarketplaceInput(input) {
|
|
|
391154
391350
|
const isWindows3 = process.platform === "win32";
|
|
391155
391351
|
const isWindowsPath = isWindows3 && (trimmed.startsWith(".\\") || trimmed.startsWith("..\\") || /^[a-zA-Z]:[/\\]/.test(trimmed));
|
|
391156
391352
|
if (trimmed.startsWith("./") || trimmed.startsWith("../") || trimmed.startsWith("/") || trimmed.startsWith("~") || isWindowsPath) {
|
|
391157
|
-
const resolvedPath = resolve40(trimmed.startsWith("~") ? trimmed.replace(/^~/,
|
|
391353
|
+
const resolvedPath = resolve40(trimmed.startsWith("~") ? trimmed.replace(/^~/, homedir31()) : trimmed);
|
|
391158
391354
|
let stats;
|
|
391159
391355
|
try {
|
|
391160
391356
|
stats = await fs4.stat(resolvedPath);
|
|
@@ -391404,15 +391600,15 @@ var init_AddMarketplace = __esm(() => {
|
|
|
391404
391600
|
|
|
391405
391601
|
// src/utils/plugins/installCounts.ts
|
|
391406
391602
|
import { randomBytes as randomBytes17 } from "crypto";
|
|
391407
|
-
import { readFile as
|
|
391408
|
-
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";
|
|
391409
391605
|
function getInstallCountsCachePath() {
|
|
391410
|
-
return
|
|
391606
|
+
return join135(getPluginsDirectory(), INSTALL_COUNTS_CACHE_FILENAME);
|
|
391411
391607
|
}
|
|
391412
391608
|
async function loadInstallCountsCache() {
|
|
391413
391609
|
const cachePath = getInstallCountsCachePath();
|
|
391414
391610
|
try {
|
|
391415
|
-
const content = await
|
|
391611
|
+
const content = await readFile57(cachePath, { encoding: "utf-8" });
|
|
391416
391612
|
const parsed = jsonParse(content);
|
|
391417
391613
|
if (typeof parsed !== "object" || parsed === null || !("version" in parsed) || !("fetchedAt" in parsed) || !("counts" in parsed)) {
|
|
391418
391614
|
logForDebugging("Install counts cache has invalid structure");
|
|
@@ -391462,7 +391658,7 @@ async function saveInstallCountsCache(cache3) {
|
|
|
391462
391658
|
const pluginsDir = getPluginsDirectory();
|
|
391463
391659
|
await getFsImplementation().mkdir(pluginsDir);
|
|
391464
391660
|
const content = jsonStringify(cache3, null, 2);
|
|
391465
|
-
await
|
|
391661
|
+
await writeFile54(tempPath, content, {
|
|
391466
391662
|
encoding: "utf-8",
|
|
391467
391663
|
mode: 384
|
|
391468
391664
|
});
|
|
@@ -394149,7 +394345,7 @@ var init_DiscoverPlugins = __esm(() => {
|
|
|
394149
394345
|
});
|
|
394150
394346
|
|
|
394151
394347
|
// src/services/plugins/pluginOperations.ts
|
|
394152
|
-
import { dirname as
|
|
394348
|
+
import { dirname as dirname51, join as join136 } from "path";
|
|
394153
394349
|
function assertInstallableScope(scope) {
|
|
394154
394350
|
if (!VALID_INSTALLABLE_SCOPES.includes(scope)) {
|
|
394155
394351
|
throw new Error(`Invalid scope "${scope}". Must be one of: ${VALID_INSTALLABLE_SCOPES.join(", ")}`);
|
|
@@ -394626,8 +394822,8 @@ async function performPluginUpdate({
|
|
|
394626
394822
|
}
|
|
394627
394823
|
throw e;
|
|
394628
394824
|
}
|
|
394629
|
-
const marketplaceDir = marketplaceStats.isDirectory() ? marketplaceInstallLocation :
|
|
394630
|
-
sourcePath =
|
|
394825
|
+
const marketplaceDir = marketplaceStats.isDirectory() ? marketplaceInstallLocation : dirname51(marketplaceInstallLocation);
|
|
394826
|
+
sourcePath = join136(marketplaceDir, entry.source);
|
|
394631
394827
|
try {
|
|
394632
394828
|
await fs4.stat(sourcePath);
|
|
394633
394829
|
} catch (e) {
|
|
@@ -394642,7 +394838,7 @@ async function performPluginUpdate({
|
|
|
394642
394838
|
throw e;
|
|
394643
394839
|
}
|
|
394644
394840
|
let pluginManifest;
|
|
394645
|
-
const manifestPath =
|
|
394841
|
+
const manifestPath = join136(sourcePath, ".claude-plugin", "plugin.json");
|
|
394646
394842
|
try {
|
|
394647
394843
|
pluginManifest = await loadPluginManifest(manifestPath, entry.name, entry.source);
|
|
394648
394844
|
} catch {}
|
|
@@ -395859,10 +396055,10 @@ var init_ManageMarketplaces = __esm(() => {
|
|
|
395859
396055
|
|
|
395860
396056
|
// src/utils/plugins/pluginFlagging.ts
|
|
395861
396057
|
import { randomBytes as randomBytes18 } from "crypto";
|
|
395862
|
-
import { readFile as
|
|
395863
|
-
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";
|
|
395864
396060
|
function getFlaggedPluginsPath() {
|
|
395865
|
-
return
|
|
396061
|
+
return join137(getPluginsDirectory(), FLAGGED_PLUGINS_FILENAME);
|
|
395866
396062
|
}
|
|
395867
396063
|
function parsePluginsData(content) {
|
|
395868
396064
|
const parsed = jsonParse(content);
|
|
@@ -395886,7 +396082,7 @@ function parsePluginsData(content) {
|
|
|
395886
396082
|
}
|
|
395887
396083
|
async function readFromDisk() {
|
|
395888
396084
|
try {
|
|
395889
|
-
const content = await
|
|
396085
|
+
const content = await readFile58(getFlaggedPluginsPath(), {
|
|
395890
396086
|
encoding: "utf-8"
|
|
395891
396087
|
});
|
|
395892
396088
|
return parsePluginsData(content);
|
|
@@ -395900,7 +396096,7 @@ async function writeToDisk(plugins) {
|
|
|
395900
396096
|
try {
|
|
395901
396097
|
await getFsImplementation().mkdir(getPluginsDirectory());
|
|
395902
396098
|
const content = jsonStringify({ plugins }, null, 2);
|
|
395903
|
-
await
|
|
396099
|
+
await writeFile55(tempPath, content, {
|
|
395904
396100
|
encoding: "utf-8",
|
|
395905
396101
|
mode: 384
|
|
395906
396102
|
});
|
|
@@ -399154,7 +399350,7 @@ function parsePluginArgs(args) {
|
|
|
399154
399350
|
}
|
|
399155
399351
|
|
|
399156
399352
|
// src/utils/plugins/validatePlugin.ts
|
|
399157
|
-
import { readdir as readdir34, readFile as
|
|
399353
|
+
import { readdir as readdir34, readFile as readFile60, stat as stat49 } from "fs/promises";
|
|
399158
399354
|
import * as path14 from "path";
|
|
399159
399355
|
import { z as z77 } from "zod/v4";
|
|
399160
399356
|
function detectManifestType(filePath) {
|
|
@@ -399195,7 +399391,7 @@ async function validatePluginManifest(filePath) {
|
|
|
399195
399391
|
const absolutePath = path14.resolve(filePath);
|
|
399196
399392
|
let content;
|
|
399197
399393
|
try {
|
|
399198
|
-
content = await
|
|
399394
|
+
content = await readFile60(absolutePath, { encoding: "utf-8" });
|
|
399199
399395
|
} catch (error5) {
|
|
399200
399396
|
const code = getErrnoCode(error5);
|
|
399201
399397
|
let message;
|
|
@@ -399319,7 +399515,7 @@ async function validateMarketplaceManifest(filePath) {
|
|
|
399319
399515
|
const absolutePath = path14.resolve(filePath);
|
|
399320
399516
|
let content;
|
|
399321
399517
|
try {
|
|
399322
|
-
content = await
|
|
399518
|
+
content = await readFile60(absolutePath, { encoding: "utf-8" });
|
|
399323
399519
|
} catch (error5) {
|
|
399324
399520
|
const code = getErrnoCode(error5);
|
|
399325
399521
|
let message;
|
|
@@ -399405,7 +399601,7 @@ async function validateMarketplaceManifest(filePath) {
|
|
|
399405
399601
|
const pluginJsonPath = path14.join(marketplaceRoot, entry.source, ".claude-plugin", "plugin.json");
|
|
399406
399602
|
let manifestVersion;
|
|
399407
399603
|
try {
|
|
399408
|
-
const raw = await
|
|
399604
|
+
const raw = await readFile60(pluginJsonPath, { encoding: "utf-8" });
|
|
399409
399605
|
const parsed2 = jsonParse(raw);
|
|
399410
399606
|
if (typeof parsed2.version === "string") {
|
|
399411
399607
|
manifestVersion = parsed2.version;
|
|
@@ -399522,7 +399718,7 @@ function validateComponentFile(filePath, content, fileType) {
|
|
|
399522
399718
|
async function validateHooksJson(filePath) {
|
|
399523
399719
|
let content;
|
|
399524
399720
|
try {
|
|
399525
|
-
content = await
|
|
399721
|
+
content = await readFile60(filePath, { encoding: "utf-8" });
|
|
399526
399722
|
} catch (e) {
|
|
399527
399723
|
const code = getErrnoCode(e);
|
|
399528
399724
|
if (code === "ENOENT") {
|
|
@@ -399615,7 +399811,7 @@ async function validatePluginContents(pluginDir) {
|
|
|
399615
399811
|
for (const filePath of files) {
|
|
399616
399812
|
let content;
|
|
399617
399813
|
try {
|
|
399618
|
-
content = await
|
|
399814
|
+
content = await readFile60(filePath, { encoding: "utf-8" });
|
|
399619
399815
|
} catch (e) {
|
|
399620
399816
|
if (isENOENT(e))
|
|
399621
399817
|
continue;
|
|
@@ -399684,7 +399880,7 @@ async function validateManifest2(filePath) {
|
|
|
399684
399880
|
return validateMarketplaceManifest(filePath);
|
|
399685
399881
|
case "unknown": {
|
|
399686
399882
|
try {
|
|
399687
|
-
const content = await
|
|
399883
|
+
const content = await readFile60(absolutePath, { encoding: "utf-8" });
|
|
399688
399884
|
const parsed = jsonParse(content);
|
|
399689
399885
|
if (Array.isArray(parsed.plugins)) {
|
|
399690
399886
|
return validateMarketplaceManifest(filePath);
|
|
@@ -402409,10 +402605,10 @@ var init_transcriptSearch = __esm(() => {
|
|
|
402409
402605
|
});
|
|
402410
402606
|
|
|
402411
402607
|
// src/utils/releaseNotes.ts
|
|
402412
|
-
import { mkdir as
|
|
402413
|
-
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";
|
|
402414
402610
|
function getChangelogCachePath() {
|
|
402415
|
-
return
|
|
402611
|
+
return join140(getClaudeConfigHomeDir(), "cache", "changelog.md");
|
|
402416
402612
|
}
|
|
402417
402613
|
async function migrateChangelogFromConfig() {
|
|
402418
402614
|
const config2 = getGlobalConfig();
|
|
@@ -402421,8 +402617,8 @@ async function migrateChangelogFromConfig() {
|
|
|
402421
402617
|
}
|
|
402422
402618
|
const cachePath = getChangelogCachePath();
|
|
402423
402619
|
try {
|
|
402424
|
-
await
|
|
402425
|
-
await
|
|
402620
|
+
await mkdir52(dirname53(cachePath), { recursive: true });
|
|
402621
|
+
await writeFile56(cachePath, config2.cachedChangelog, {
|
|
402426
402622
|
encoding: "utf-8",
|
|
402427
402623
|
flag: "wx"
|
|
402428
402624
|
});
|
|
@@ -402443,8 +402639,8 @@ async function fetchAndStoreChangelog() {
|
|
|
402443
402639
|
return;
|
|
402444
402640
|
}
|
|
402445
402641
|
const cachePath = getChangelogCachePath();
|
|
402446
|
-
await
|
|
402447
|
-
await
|
|
402642
|
+
await mkdir52(dirname53(cachePath), { recursive: true });
|
|
402643
|
+
await writeFile56(cachePath, changelogContent, { encoding: "utf-8" });
|
|
402448
402644
|
changelogMemoryCache = changelogContent;
|
|
402449
402645
|
const changelogLastFetched = Date.now();
|
|
402450
402646
|
saveGlobalConfig((current) => ({
|
|
@@ -402459,7 +402655,7 @@ async function getStoredChangelog() {
|
|
|
402459
402655
|
}
|
|
402460
402656
|
const cachePath = getChangelogCachePath();
|
|
402461
402657
|
try {
|
|
402462
|
-
const content = await
|
|
402658
|
+
const content = await readFile61(cachePath, "utf-8");
|
|
402463
402659
|
changelogMemoryCache = content;
|
|
402464
402660
|
return content;
|
|
402465
402661
|
} catch {
|
|
@@ -402512,7 +402708,7 @@ function getRecentReleaseNotes(currentVersion, previousVersion, changelogContent
|
|
|
402512
402708
|
}
|
|
402513
402709
|
return [];
|
|
402514
402710
|
}
|
|
402515
|
-
async function checkForReleaseNotes(lastSeenVersion, currentVersion = "2.
|
|
402711
|
+
async function checkForReleaseNotes(lastSeenVersion, currentVersion = "2.3.0") {
|
|
402516
402712
|
if (process.env.USER_TYPE === "ant") {
|
|
402517
402713
|
const changelog = MACRO.VERSION_CHANGELOG;
|
|
402518
402714
|
if (changelog) {
|
|
@@ -402539,7 +402735,7 @@ async function checkForReleaseNotes(lastSeenVersion, currentVersion = "2.2.6") {
|
|
|
402539
402735
|
releaseNotes
|
|
402540
402736
|
};
|
|
402541
402737
|
}
|
|
402542
|
-
function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "2.
|
|
402738
|
+
function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "2.3.0") {
|
|
402543
402739
|
if (process.env.USER_TYPE === "ant") {
|
|
402544
402740
|
const changelog = MACRO.VERSION_CHANGELOG;
|
|
402545
402741
|
if (changelog) {
|
|
@@ -402696,7 +402892,7 @@ function getRecentActivitySync() {
|
|
|
402696
402892
|
return cachedActivity;
|
|
402697
402893
|
}
|
|
402698
402894
|
function getLogoDisplayData() {
|
|
402699
|
-
const version = process.env.DEMO_VERSION ?? "2.
|
|
402895
|
+
const version = process.env.DEMO_VERSION ?? "2.3.0";
|
|
402700
402896
|
const serverUrl = getDirectConnectServerUrl();
|
|
402701
402897
|
const displayPath = process.env.DEMO_VERSION ? "/code/claude" : getDisplayPath(getCwd());
|
|
402702
402898
|
const cwd2 = serverUrl ? `${displayPath} in ${serverUrl.replace(/^https?:\/\//, "")}` : displayPath;
|
|
@@ -403202,7 +403398,7 @@ var init_referral = __esm(() => {
|
|
|
403202
403398
|
});
|
|
403203
403399
|
|
|
403204
403400
|
// src/components/Logo/feedConfigs.tsx
|
|
403205
|
-
import { homedir as
|
|
403401
|
+
import { homedir as homedir32 } from "os";
|
|
403206
403402
|
function createRecentActivityFeed(activities) {
|
|
403207
403403
|
const lines = activities.map((log2) => {
|
|
403208
403404
|
const time = formatRelativeTimeAgo(log2.modified);
|
|
@@ -403247,7 +403443,7 @@ function createProjectOnboardingFeed(steps) {
|
|
|
403247
403443
|
text: `${checkmark}${text}`
|
|
403248
403444
|
};
|
|
403249
403445
|
});
|
|
403250
|
-
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;
|
|
403251
403447
|
if (warningText) {
|
|
403252
403448
|
lines.push({
|
|
403253
403449
|
text: warningText
|
|
@@ -403796,7 +403992,7 @@ function Logo() {
|
|
|
403796
403992
|
if ($2[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
403797
403993
|
t2 = () => {
|
|
403798
403994
|
const currentConfig = getGlobalConfig();
|
|
403799
|
-
if (currentConfig.lastReleaseNotesSeen === "2.
|
|
403995
|
+
if (currentConfig.lastReleaseNotesSeen === "2.3.0") {
|
|
403800
403996
|
return;
|
|
403801
403997
|
}
|
|
403802
403998
|
saveGlobalConfig(_temp325);
|
|
@@ -404455,12 +404651,12 @@ function Logo() {
|
|
|
404455
404651
|
return t41;
|
|
404456
404652
|
}
|
|
404457
404653
|
function _temp325(current) {
|
|
404458
|
-
if (current.lastReleaseNotesSeen === "2.
|
|
404654
|
+
if (current.lastReleaseNotesSeen === "2.3.0") {
|
|
404459
404655
|
return current;
|
|
404460
404656
|
}
|
|
404461
404657
|
return {
|
|
404462
404658
|
...current,
|
|
404463
|
-
lastReleaseNotesSeen: "2.
|
|
404659
|
+
lastReleaseNotesSeen: "2.3.0"
|
|
404464
404660
|
};
|
|
404465
404661
|
}
|
|
404466
404662
|
function _temp240(s_0) {
|
|
@@ -421817,8 +422013,8 @@ __export(exports_thinkback, {
|
|
|
421817
422013
|
call: () => call70
|
|
421818
422014
|
});
|
|
421819
422015
|
import { execa as execa11 } from "execa";
|
|
421820
|
-
import { readFile as
|
|
421821
|
-
import { join as
|
|
422016
|
+
import { readFile as readFile62 } from "fs/promises";
|
|
422017
|
+
import { join as join141 } from "path";
|
|
421822
422018
|
function getMarketplaceName() {
|
|
421823
422019
|
return OFFICIAL_MARKETPLACE_NAME;
|
|
421824
422020
|
}
|
|
@@ -421836,17 +422032,17 @@ async function getThinkbackSkillDir() {
|
|
|
421836
422032
|
if (!thinkbackPlugin) {
|
|
421837
422033
|
return null;
|
|
421838
422034
|
}
|
|
421839
|
-
const skillDir =
|
|
422035
|
+
const skillDir = join141(thinkbackPlugin.path, "skills", SKILL_NAME);
|
|
421840
422036
|
if (await pathExists(skillDir)) {
|
|
421841
422037
|
return skillDir;
|
|
421842
422038
|
}
|
|
421843
422039
|
return null;
|
|
421844
422040
|
}
|
|
421845
422041
|
async function playAnimation(skillDir) {
|
|
421846
|
-
const dataPath =
|
|
421847
|
-
const playerPath =
|
|
422042
|
+
const dataPath = join141(skillDir, "year_in_review.js");
|
|
422043
|
+
const playerPath = join141(skillDir, "player.js");
|
|
421848
422044
|
try {
|
|
421849
|
-
await
|
|
422045
|
+
await readFile62(dataPath);
|
|
421850
422046
|
} catch (e) {
|
|
421851
422047
|
if (isENOENT(e)) {
|
|
421852
422048
|
return {
|
|
@@ -421861,7 +422057,7 @@ async function playAnimation(skillDir) {
|
|
|
421861
422057
|
};
|
|
421862
422058
|
}
|
|
421863
422059
|
try {
|
|
421864
|
-
await
|
|
422060
|
+
await readFile62(playerPath);
|
|
421865
422061
|
} catch (e) {
|
|
421866
422062
|
if (isENOENT(e)) {
|
|
421867
422063
|
return {
|
|
@@ -421892,7 +422088,7 @@ async function playAnimation(skillDir) {
|
|
|
421892
422088
|
} catch {} finally {
|
|
421893
422089
|
inkInstance.exitAlternateScreen();
|
|
421894
422090
|
}
|
|
421895
|
-
const htmlPath =
|
|
422091
|
+
const htmlPath = join141(skillDir, "year_in_review.html");
|
|
421896
422092
|
if (await pathExists(htmlPath)) {
|
|
421897
422093
|
const platform3 = getPlatform();
|
|
421898
422094
|
const openCmd = platform3 === "macos" ? "open" : platform3 === "windows" ? "start" : "xdg-open";
|
|
@@ -422228,7 +422424,7 @@ function ThinkbackFlow(t0) {
|
|
|
422228
422424
|
if (!skillDir) {
|
|
422229
422425
|
return;
|
|
422230
422426
|
}
|
|
422231
|
-
const dataPath =
|
|
422427
|
+
const dataPath = join141(skillDir, "year_in_review.js");
|
|
422232
422428
|
pathExists(dataPath).then((exists) => {
|
|
422233
422429
|
logForDebugging(`Checking for ${dataPath}: ${exists ? "found" : "not found"}`);
|
|
422234
422430
|
setHasGenerated(exists);
|
|
@@ -422399,7 +422595,7 @@ var exports_thinkback_play = {};
|
|
|
422399
422595
|
__export(exports_thinkback_play, {
|
|
422400
422596
|
call: () => call71
|
|
422401
422597
|
});
|
|
422402
|
-
import { join as
|
|
422598
|
+
import { join as join142 } from "path";
|
|
422403
422599
|
function getPluginId2() {
|
|
422404
422600
|
const marketplaceName = process.env.USER_TYPE === "ant" ? INTERNAL_MARKETPLACE_NAME : OFFICIAL_MARKETPLACE_NAME;
|
|
422405
422601
|
return `thinkback@${marketplaceName}`;
|
|
@@ -422421,7 +422617,7 @@ async function call71() {
|
|
|
422421
422617
|
value: "Thinkback plugin installation path not found."
|
|
422422
422618
|
};
|
|
422423
422619
|
}
|
|
422424
|
-
const skillDir =
|
|
422620
|
+
const skillDir = join142(firstInstall.installPath, "skills", SKILL_NAME2);
|
|
422425
422621
|
const result = await playAnimation(skillDir);
|
|
422426
422622
|
return { type: "text", value: result.message };
|
|
422427
422623
|
}
|
|
@@ -428456,7 +428652,7 @@ __export(exports_branch, {
|
|
|
428456
428652
|
call: () => call79
|
|
428457
428653
|
});
|
|
428458
428654
|
import { randomUUID as randomUUID28 } from "crypto";
|
|
428459
|
-
import { mkdir as
|
|
428655
|
+
import { mkdir as mkdir53, readFile as readFile63, writeFile as writeFile57 } from "fs/promises";
|
|
428460
428656
|
function deriveFirstPrompt(firstUserMessage) {
|
|
428461
428657
|
const content = firstUserMessage?.message?.content;
|
|
428462
428658
|
if (!content)
|
|
@@ -428472,10 +428668,10 @@ async function createFork(customTitle) {
|
|
|
428472
428668
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
428473
428669
|
const forkSessionPath = getTranscriptPathForSession(forkSessionId);
|
|
428474
428670
|
const currentTranscriptPath = getTranscriptPath();
|
|
428475
|
-
await
|
|
428671
|
+
await mkdir53(projectDir, { recursive: true, mode: 448 });
|
|
428476
428672
|
let transcriptContent;
|
|
428477
428673
|
try {
|
|
428478
|
-
transcriptContent = await
|
|
428674
|
+
transcriptContent = await readFile63(currentTranscriptPath);
|
|
428479
428675
|
} catch {
|
|
428480
428676
|
throw new Error("No conversation to branch");
|
|
428481
428677
|
}
|
|
@@ -428520,7 +428716,7 @@ async function createFork(customTitle) {
|
|
|
428520
428716
|
};
|
|
428521
428717
|
lines.push(jsonStringify(forkedReplacementEntry));
|
|
428522
428718
|
}
|
|
428523
|
-
await
|
|
428719
|
+
await writeFile57(forkSessionPath, lines.join(`
|
|
428524
428720
|
`) + `
|
|
428525
428721
|
`, {
|
|
428526
428722
|
encoding: "utf8",
|
|
@@ -428782,8 +428978,8 @@ var init_types11 = __esm(() => {
|
|
|
428782
428978
|
});
|
|
428783
428979
|
|
|
428784
428980
|
// src/components/agents/agentFileUtils.ts
|
|
428785
|
-
import { mkdir as
|
|
428786
|
-
import { join as
|
|
428981
|
+
import { mkdir as mkdir54, open as open12, unlink as unlink19 } from "fs/promises";
|
|
428982
|
+
import { join as join143 } from "path";
|
|
428787
428983
|
function formatAgentAsMarkdown(agentType, whenToUse, tools, systemPrompt, color3, model, memory2, effort) {
|
|
428788
428984
|
const escapedWhenToUse = whenToUse.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\\\n");
|
|
428789
428985
|
const isAllTools = tools === undefined || tools.length === 1 && tools[0] === "*";
|
|
@@ -428810,26 +429006,26 @@ function getAgentDirectoryPath(location) {
|
|
|
428810
429006
|
case "flagSettings":
|
|
428811
429007
|
throw new Error(`Cannot get directory path for ${location} agents`);
|
|
428812
429008
|
case "userSettings":
|
|
428813
|
-
return
|
|
429009
|
+
return join143(getClaudeConfigHomeDir(), AGENT_PATHS.AGENTS_DIR);
|
|
428814
429010
|
case "projectSettings":
|
|
428815
|
-
return
|
|
429011
|
+
return join143(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
428816
429012
|
case "policySettings":
|
|
428817
|
-
return
|
|
429013
|
+
return join143(getManagedFilePath(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
428818
429014
|
case "localSettings":
|
|
428819
|
-
return
|
|
429015
|
+
return join143(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
428820
429016
|
}
|
|
428821
429017
|
}
|
|
428822
429018
|
function getRelativeAgentDirectoryPath(location) {
|
|
428823
429019
|
switch (location) {
|
|
428824
429020
|
case "projectSettings":
|
|
428825
|
-
return
|
|
429021
|
+
return join143(".", AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
428826
429022
|
default:
|
|
428827
429023
|
return getAgentDirectoryPath(location);
|
|
428828
429024
|
}
|
|
428829
429025
|
}
|
|
428830
429026
|
function getNewAgentFilePath(agent) {
|
|
428831
429027
|
const dirPath = getAgentDirectoryPath(agent.source);
|
|
428832
|
-
return
|
|
429028
|
+
return join143(dirPath, `${agent.agentType}.md`);
|
|
428833
429029
|
}
|
|
428834
429030
|
function getActualAgentFilePath(agent) {
|
|
428835
429031
|
if (agent.source === "built-in") {
|
|
@@ -428840,14 +429036,14 @@ function getActualAgentFilePath(agent) {
|
|
|
428840
429036
|
}
|
|
428841
429037
|
const dirPath = getAgentDirectoryPath(agent.source);
|
|
428842
429038
|
const filename = agent.filename || agent.agentType;
|
|
428843
|
-
return
|
|
429039
|
+
return join143(dirPath, `${filename}.md`);
|
|
428844
429040
|
}
|
|
428845
429041
|
function getNewRelativeAgentFilePath(agent) {
|
|
428846
429042
|
if (agent.source === "built-in") {
|
|
428847
429043
|
return "Built-in";
|
|
428848
429044
|
}
|
|
428849
429045
|
const dirPath = getRelativeAgentDirectoryPath(agent.source);
|
|
428850
|
-
return
|
|
429046
|
+
return join143(dirPath, `${agent.agentType}.md`);
|
|
428851
429047
|
}
|
|
428852
429048
|
function getActualRelativeAgentFilePath(agent) {
|
|
428853
429049
|
if (isBuiltInAgent(agent)) {
|
|
@@ -428861,11 +429057,11 @@ function getActualRelativeAgentFilePath(agent) {
|
|
|
428861
429057
|
}
|
|
428862
429058
|
const dirPath = getRelativeAgentDirectoryPath(agent.source);
|
|
428863
429059
|
const filename = agent.filename || agent.agentType;
|
|
428864
|
-
return
|
|
429060
|
+
return join143(dirPath, `${filename}.md`);
|
|
428865
429061
|
}
|
|
428866
429062
|
async function ensureAgentDirectoryExists(source) {
|
|
428867
429063
|
const dirPath = getAgentDirectoryPath(source);
|
|
428868
|
-
await
|
|
429064
|
+
await mkdir54(dirPath, { recursive: true });
|
|
428869
429065
|
return dirPath;
|
|
428870
429066
|
}
|
|
428871
429067
|
async function saveAgentToFile(source, agentType, whenToUse, tools, systemPrompt, checkExists = true, color3, model, memory2, effort) {
|
|
@@ -434828,8 +435024,8 @@ var init_rewind = __esm(() => {
|
|
|
434828
435024
|
|
|
434829
435025
|
// src/utils/heapDumpService.ts
|
|
434830
435026
|
import { createWriteStream as createWriteStream2, writeFileSync as writeFileSync4 } from "fs";
|
|
434831
|
-
import { readdir as readdir35, readFile as
|
|
434832
|
-
import { join as
|
|
435027
|
+
import { readdir as readdir35, readFile as readFile64, writeFile as writeFile58 } from "fs/promises";
|
|
435028
|
+
import { join as join144 } from "path";
|
|
434833
435029
|
import { pipeline as pipeline2 } from "stream/promises";
|
|
434834
435030
|
import {
|
|
434835
435031
|
getHeapSnapshot,
|
|
@@ -434853,7 +435049,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
434853
435049
|
} catch {}
|
|
434854
435050
|
let smapsRollup;
|
|
434855
435051
|
try {
|
|
434856
|
-
smapsRollup = await
|
|
435052
|
+
smapsRollup = await readFile64("/proc/self/smaps_rollup", "utf8");
|
|
434857
435053
|
} catch {}
|
|
434858
435054
|
const nativeMemory = usage.rss - usage.heapUsed;
|
|
434859
435055
|
const bytesPerSecond = uptimeSeconds > 0 ? usage.rss / uptimeSeconds : 0;
|
|
@@ -434919,7 +435115,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
434919
435115
|
smapsRollup,
|
|
434920
435116
|
platform: process.platform,
|
|
434921
435117
|
nodeVersion: process.version,
|
|
434922
|
-
ccVersion: "2.
|
|
435118
|
+
ccVersion: "2.3.0"
|
|
434923
435119
|
};
|
|
434924
435120
|
}
|
|
434925
435121
|
async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
@@ -434937,9 +435133,9 @@ async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
|
434937
435133
|
const suffix = dumpNumber > 0 ? `-dump${dumpNumber}` : "";
|
|
434938
435134
|
const heapFilename = `${sessionId}${suffix}.heapsnapshot`;
|
|
434939
435135
|
const diagFilename = `${sessionId}${suffix}-diagnostics.json`;
|
|
434940
|
-
const heapPath =
|
|
434941
|
-
const diagPath =
|
|
434942
|
-
await
|
|
435136
|
+
const heapPath = join144(dumpDir, heapFilename);
|
|
435137
|
+
const diagPath = join144(dumpDir, diagFilename);
|
|
435138
|
+
await writeFile58(diagPath, jsonStringify(diagnostics, null, 2), {
|
|
434943
435139
|
mode: 384
|
|
434944
435140
|
});
|
|
434945
435141
|
logForDebugging(`[HeapDump] Diagnostics written to ${diagPath}`);
|
|
@@ -435504,7 +435700,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
435504
435700
|
var call86 = async () => {
|
|
435505
435701
|
return {
|
|
435506
435702
|
type: "text",
|
|
435507
|
-
value: `${"2.
|
|
435703
|
+
value: `${"2.3.0"} (built ${"2026-05-10T17:25:06.612Z"})`
|
|
435508
435704
|
};
|
|
435509
435705
|
}, version, version_default;
|
|
435510
435706
|
var init_version = __esm(() => {
|
|
@@ -436871,8 +437067,8 @@ var init_advisor2 = __esm(() => {
|
|
|
436871
437067
|
|
|
436872
437068
|
// src/skills/bundledSkills.ts
|
|
436873
437069
|
import { constants as fsConstants4 } from "fs";
|
|
436874
|
-
import { mkdir as
|
|
436875
|
-
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";
|
|
436876
437072
|
function registerBundledSkill(definition) {
|
|
436877
437073
|
const { files: files2 } = definition;
|
|
436878
437074
|
let skillRoot;
|
|
@@ -436920,7 +437116,7 @@ function getBundledSkills() {
|
|
|
436920
437116
|
return [...bundledSkills];
|
|
436921
437117
|
}
|
|
436922
437118
|
function getBundledSkillExtractDir(skillName) {
|
|
436923
|
-
return
|
|
437119
|
+
return join145(getBundledSkillsRoot(), skillName);
|
|
436924
437120
|
}
|
|
436925
437121
|
async function extractBundledSkillFiles(skillName, files2) {
|
|
436926
437122
|
const dir = getBundledSkillExtractDir(skillName);
|
|
@@ -436936,7 +437132,7 @@ async function writeSkillFiles(dir, files2) {
|
|
|
436936
437132
|
const byParent = new Map;
|
|
436937
437133
|
for (const [relPath, content] of Object.entries(files2)) {
|
|
436938
437134
|
const target = resolveSkillFilePath(dir, relPath);
|
|
436939
|
-
const parent2 =
|
|
437135
|
+
const parent2 = dirname54(target);
|
|
436940
437136
|
const entry = [target, content];
|
|
436941
437137
|
const group = byParent.get(parent2);
|
|
436942
437138
|
if (group)
|
|
@@ -436945,7 +437141,7 @@ async function writeSkillFiles(dir, files2) {
|
|
|
436945
437141
|
byParent.set(parent2, [entry]);
|
|
436946
437142
|
}
|
|
436947
437143
|
await Promise.all([...byParent].map(async ([parent2, entries]) => {
|
|
436948
|
-
await
|
|
437144
|
+
await mkdir55(parent2, { recursive: true, mode: 448 });
|
|
436949
437145
|
await Promise.all(entries.map(([p, c5]) => safeWriteFile(p, c5)));
|
|
436950
437146
|
}));
|
|
436951
437147
|
}
|
|
@@ -436962,7 +437158,7 @@ function resolveSkillFilePath(baseDir, relPath) {
|
|
|
436962
437158
|
if (isAbsolute23(normalized) || normalized.split(pathSep2).includes("..") || normalized.split("/").includes("..")) {
|
|
436963
437159
|
throw new Error(`bundled skill file path escapes skill dir: ${relPath}`);
|
|
436964
437160
|
}
|
|
436965
|
-
return
|
|
437161
|
+
return join145(baseDir, normalized);
|
|
436966
437162
|
}
|
|
436967
437163
|
function prependBaseDir(blocks, baseDir) {
|
|
436968
437164
|
const prefix = `Base directory for this skill: ${baseDir}
|
|
@@ -437321,7 +437517,7 @@ var init_exit2 = __esm(() => {
|
|
|
437321
437517
|
});
|
|
437322
437518
|
|
|
437323
437519
|
// src/components/ExportDialog.tsx
|
|
437324
|
-
import { join as
|
|
437520
|
+
import { join as join146 } from "path";
|
|
437325
437521
|
function ExportDialog({
|
|
437326
437522
|
content,
|
|
437327
437523
|
defaultFilename,
|
|
@@ -437354,7 +437550,7 @@ function ExportDialog({
|
|
|
437354
437550
|
};
|
|
437355
437551
|
const handleFilenameSubmit = () => {
|
|
437356
437552
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
437357
|
-
const filepath =
|
|
437553
|
+
const filepath = join146(getCwd(), finalFilename);
|
|
437358
437554
|
try {
|
|
437359
437555
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
437360
437556
|
encoding: "utf-8",
|
|
@@ -437577,7 +437773,7 @@ __export(exports_export, {
|
|
|
437577
437773
|
extractFirstPrompt: () => extractFirstPrompt,
|
|
437578
437774
|
call: () => call90
|
|
437579
437775
|
});
|
|
437580
|
-
import { join as
|
|
437776
|
+
import { join as join147 } from "path";
|
|
437581
437777
|
function formatTimestamp(date2) {
|
|
437582
437778
|
const year = date2.getFullYear();
|
|
437583
437779
|
const month = String(date2.getMonth() + 1).padStart(2, "0");
|
|
@@ -437621,7 +437817,7 @@ async function call90(onDone, context7, args) {
|
|
|
437621
437817
|
const filename = args.trim();
|
|
437622
437818
|
if (filename) {
|
|
437623
437819
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/, "") + ".txt";
|
|
437624
|
-
const filepath =
|
|
437820
|
+
const filepath = join147(getCwd(), finalFilename);
|
|
437625
437821
|
try {
|
|
437626
437822
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
437627
437823
|
encoding: "utf-8",
|
|
@@ -439166,7 +439362,7 @@ var init_asciichart = __esm(() => {
|
|
|
439166
439362
|
// src/utils/statsCache.ts
|
|
439167
439363
|
import { randomBytes as randomBytes19 } from "crypto";
|
|
439168
439364
|
import { open as open14 } from "fs/promises";
|
|
439169
|
-
import { join as
|
|
439365
|
+
import { join as join148 } from "path";
|
|
439170
439366
|
async function withStatsCacheLock(fn) {
|
|
439171
439367
|
while (statsCacheLockPromise) {
|
|
439172
439368
|
await statsCacheLockPromise;
|
|
@@ -439183,7 +439379,7 @@ async function withStatsCacheLock(fn) {
|
|
|
439183
439379
|
}
|
|
439184
439380
|
}
|
|
439185
439381
|
function getStatsCachePath() {
|
|
439186
|
-
return
|
|
439382
|
+
return join148(getClaudeConfigHomeDir(), STATS_CACHE_FILENAME);
|
|
439187
439383
|
}
|
|
439188
439384
|
function getEmptyCache() {
|
|
439189
439385
|
return {
|
|
@@ -439849,16 +440045,16 @@ var init_ansiToPng = __esm(() => {
|
|
|
439849
440045
|
});
|
|
439850
440046
|
|
|
439851
440047
|
// src/utils/screenshotClipboard.ts
|
|
439852
|
-
import { mkdir as
|
|
440048
|
+
import { mkdir as mkdir56, unlink as unlink20, writeFile as writeFile59 } from "fs/promises";
|
|
439853
440049
|
import { tmpdir as tmpdir8 } from "os";
|
|
439854
|
-
import { join as
|
|
440050
|
+
import { join as join149 } from "path";
|
|
439855
440051
|
async function copyAnsiToClipboard(ansiText, options) {
|
|
439856
440052
|
try {
|
|
439857
|
-
const tempDir =
|
|
439858
|
-
await
|
|
439859
|
-
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`);
|
|
439860
440056
|
const pngBuffer = ansiToPng(ansiText, options);
|
|
439861
|
-
await
|
|
440057
|
+
await writeFile59(pngPath, pngBuffer);
|
|
439862
440058
|
const result = await copyPngToClipboard(pngPath);
|
|
439863
440059
|
try {
|
|
439864
440060
|
await unlink20(pngPath);
|
|
@@ -439927,7 +440123,7 @@ var init_screenshotClipboard = __esm(() => {
|
|
|
439927
440123
|
|
|
439928
440124
|
// src/utils/stats.ts
|
|
439929
440125
|
import { open as open15 } from "fs/promises";
|
|
439930
|
-
import { basename as basename42, join as
|
|
440126
|
+
import { basename as basename42, join as join150, sep as sep30 } from "path";
|
|
439931
440127
|
async function processSessionFiles(sessionFiles, options = {}) {
|
|
439932
440128
|
const { fromDate, toDate } = options;
|
|
439933
440129
|
const fs5 = getFsImplementation();
|
|
@@ -440105,17 +440301,17 @@ async function getAllSessionFiles() {
|
|
|
440105
440301
|
return [];
|
|
440106
440302
|
throw e;
|
|
440107
440303
|
}
|
|
440108
|
-
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
440304
|
+
const projectDirs = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) => join150(projectsDir, dirent.name));
|
|
440109
440305
|
const projectResults = await Promise.all(projectDirs.map(async (projectDir) => {
|
|
440110
440306
|
try {
|
|
440111
440307
|
const entries = await fs5.readdir(projectDir);
|
|
440112
|
-
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));
|
|
440113
440309
|
const sessionDirs = entries.filter((dirent) => dirent.isDirectory());
|
|
440114
440310
|
const subagentResults = await Promise.all(sessionDirs.map(async (sessionDir) => {
|
|
440115
|
-
const subagentsDir =
|
|
440311
|
+
const subagentsDir = join150(projectDir, sessionDir.name, "subagents");
|
|
440116
440312
|
try {
|
|
440117
440313
|
const subagentEntries = await fs5.readdir(subagentsDir);
|
|
440118
|
-
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));
|
|
440119
440315
|
} catch {
|
|
440120
440316
|
return [];
|
|
440121
440317
|
}
|
|
@@ -441985,16 +442181,16 @@ import { execFileSync as execFileSync3 } from "child_process";
|
|
|
441985
442181
|
import { constants as fsConstants5 } from "fs";
|
|
441986
442182
|
import {
|
|
441987
442183
|
copyFile as copyFile9,
|
|
441988
|
-
mkdir as
|
|
442184
|
+
mkdir as mkdir57,
|
|
441989
442185
|
mkdtemp,
|
|
441990
442186
|
readdir as readdir36,
|
|
441991
|
-
readFile as
|
|
442187
|
+
readFile as readFile65,
|
|
441992
442188
|
rm as rm11,
|
|
441993
442189
|
unlink as unlink21,
|
|
441994
|
-
writeFile as
|
|
442190
|
+
writeFile as writeFile60
|
|
441995
442191
|
} from "fs/promises";
|
|
441996
442192
|
import { tmpdir as tmpdir9 } from "os";
|
|
441997
|
-
import { extname as extname14, join as
|
|
442193
|
+
import { extname as extname14, join as join151 } from "path";
|
|
441998
442194
|
function getAnalysisModel() {
|
|
441999
442195
|
return getDefaultOpusModel();
|
|
442000
442196
|
}
|
|
@@ -442002,13 +442198,13 @@ function getInsightsModel() {
|
|
|
442002
442198
|
return getDefaultOpusModel();
|
|
442003
442199
|
}
|
|
442004
442200
|
function getDataDir() {
|
|
442005
|
-
return
|
|
442201
|
+
return join151(getClaudeConfigHomeDir(), "usage-data");
|
|
442006
442202
|
}
|
|
442007
442203
|
function getFacetsDir() {
|
|
442008
|
-
return
|
|
442204
|
+
return join151(getDataDir(), "facets");
|
|
442009
442205
|
}
|
|
442010
442206
|
function getSessionMetaDir() {
|
|
442011
|
-
return
|
|
442207
|
+
return join151(getDataDir(), "session-meta");
|
|
442012
442208
|
}
|
|
442013
442209
|
function getLanguageFromPath(filePath) {
|
|
442014
442210
|
const ext = extname14(filePath).toLowerCase();
|
|
@@ -442353,9 +442549,9 @@ async function formatTranscriptWithSummarization(log2) {
|
|
|
442353
442549
|
`);
|
|
442354
442550
|
}
|
|
442355
442551
|
async function loadCachedFacets(sessionId) {
|
|
442356
|
-
const facetPath =
|
|
442552
|
+
const facetPath = join151(getFacetsDir(), `${sessionId}.json`);
|
|
442357
442553
|
try {
|
|
442358
|
-
const content = await
|
|
442554
|
+
const content = await readFile65(facetPath, { encoding: "utf-8" });
|
|
442359
442555
|
const parsed = jsonParse(content);
|
|
442360
442556
|
if (!isValidSessionFacets(parsed)) {
|
|
442361
442557
|
try {
|
|
@@ -442370,18 +442566,18 @@ async function loadCachedFacets(sessionId) {
|
|
|
442370
442566
|
}
|
|
442371
442567
|
async function saveFacets(facets) {
|
|
442372
442568
|
try {
|
|
442373
|
-
await
|
|
442569
|
+
await mkdir57(getFacetsDir(), { recursive: true });
|
|
442374
442570
|
} catch {}
|
|
442375
|
-
const facetPath =
|
|
442376
|
-
await
|
|
442571
|
+
const facetPath = join151(getFacetsDir(), `${facets.session_id}.json`);
|
|
442572
|
+
await writeFile60(facetPath, jsonStringify(facets, null, 2), {
|
|
442377
442573
|
encoding: "utf-8",
|
|
442378
442574
|
mode: 384
|
|
442379
442575
|
});
|
|
442380
442576
|
}
|
|
442381
442577
|
async function loadCachedSessionMeta(sessionId) {
|
|
442382
|
-
const metaPath =
|
|
442578
|
+
const metaPath = join151(getSessionMetaDir(), `${sessionId}.json`);
|
|
442383
442579
|
try {
|
|
442384
|
-
const content = await
|
|
442580
|
+
const content = await readFile65(metaPath, { encoding: "utf-8" });
|
|
442385
442581
|
return jsonParse(content);
|
|
442386
442582
|
} catch {
|
|
442387
442583
|
return null;
|
|
@@ -442389,10 +442585,10 @@ async function loadCachedSessionMeta(sessionId) {
|
|
|
442389
442585
|
}
|
|
442390
442586
|
async function saveSessionMeta(meta) {
|
|
442391
442587
|
try {
|
|
442392
|
-
await
|
|
442588
|
+
await mkdir57(getSessionMetaDir(), { recursive: true });
|
|
442393
442589
|
} catch {}
|
|
442394
|
-
const metaPath =
|
|
442395
|
-
await
|
|
442590
|
+
const metaPath = join151(getSessionMetaDir(), `${meta.session_id}.json`);
|
|
442591
|
+
await writeFile60(metaPath, jsonStringify(meta, null, 2), {
|
|
442396
442592
|
encoding: "utf-8",
|
|
442397
442593
|
mode: 384
|
|
442398
442594
|
});
|
|
@@ -443448,7 +443644,7 @@ function generateHtmlReport(data, insights) {
|
|
|
443448
443644
|
</html>`;
|
|
443449
443645
|
}
|
|
443450
443646
|
function buildExportData(data, insights, facets, remoteStats) {
|
|
443451
|
-
const version2 = typeof MACRO !== "undefined" ? "2.
|
|
443647
|
+
const version2 = typeof MACRO !== "undefined" ? "2.3.0" : "unknown";
|
|
443452
443648
|
const remote_hosts_collected = remoteStats?.hosts.filter((h) => h.sessionCount > 0).map((h) => h.name);
|
|
443453
443649
|
const facets_summary = {
|
|
443454
443650
|
total: facets.size,
|
|
@@ -443499,7 +443695,7 @@ async function scanAllSessions() {
|
|
|
443499
443695
|
} catch {
|
|
443500
443696
|
return [];
|
|
443501
443697
|
}
|
|
443502
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
443698
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join151(projectsDir, dirent.name));
|
|
443503
443699
|
const allSessions = [];
|
|
443504
443700
|
for (let i2 = 0;i2 < projectDirs.length; i2++) {
|
|
443505
443701
|
const sessionFiles = await getSessionFilesWithMtime(projectDirs[i2]);
|
|
@@ -443521,7 +443717,7 @@ async function scanAllSessions() {
|
|
|
443521
443717
|
async function generateUsageReport(options) {
|
|
443522
443718
|
let remoteStats;
|
|
443523
443719
|
if (process.env.USER_TYPE === "ant" && options?.collectRemote) {
|
|
443524
|
-
const destDir =
|
|
443720
|
+
const destDir = join151(getClaudeConfigHomeDir(), "projects");
|
|
443525
443721
|
const { hosts, totalCopied } = await collectAllRemoteHostData(destDir);
|
|
443526
443722
|
remoteStats = { hosts, totalCopied };
|
|
443527
443723
|
}
|
|
@@ -443658,10 +443854,10 @@ async function generateUsageReport(options) {
|
|
|
443658
443854
|
const insights = await generateParallelInsights(aggregated, facets);
|
|
443659
443855
|
const htmlReport = generateHtmlReport(aggregated, insights);
|
|
443660
443856
|
try {
|
|
443661
|
-
await
|
|
443857
|
+
await mkdir57(getDataDir(), { recursive: true });
|
|
443662
443858
|
} catch {}
|
|
443663
|
-
const htmlPath =
|
|
443664
|
-
await
|
|
443859
|
+
const htmlPath = join151(getDataDir(), "report.html");
|
|
443860
|
+
await writeFile60(htmlPath, htmlReport, {
|
|
443665
443861
|
encoding: "utf-8",
|
|
443666
443862
|
mode: 384
|
|
443667
443863
|
});
|
|
@@ -443756,13 +443952,13 @@ var init_insights = __esm(() => {
|
|
|
443756
443952
|
} : async () => 0;
|
|
443757
443953
|
collectFromRemoteHost = process.env.USER_TYPE === "ant" ? async (homespace, destDir) => {
|
|
443758
443954
|
const result = { copied: 0, skipped: 0 };
|
|
443759
|
-
const tempDir = await mkdtemp(
|
|
443955
|
+
const tempDir = await mkdtemp(join151(tmpdir9(), "claude-hs-"));
|
|
443760
443956
|
try {
|
|
443761
443957
|
const scpResult = await execFileNoThrow("scp", ["-rq", `${homespace}.coder:/root/.claude/projects/`, tempDir], { timeout: 300000 });
|
|
443762
443958
|
if (scpResult.code !== 0) {
|
|
443763
443959
|
return result;
|
|
443764
443960
|
}
|
|
443765
|
-
const projectsDir =
|
|
443961
|
+
const projectsDir = join151(tempDir, "projects");
|
|
443766
443962
|
let projectDirents;
|
|
443767
443963
|
try {
|
|
443768
443964
|
projectDirents = await readdir36(projectsDir, { withFileTypes: true });
|
|
@@ -443771,13 +443967,13 @@ var init_insights = __esm(() => {
|
|
|
443771
443967
|
}
|
|
443772
443968
|
await Promise.all(projectDirents.map(async (dirent) => {
|
|
443773
443969
|
const projectName = dirent.name;
|
|
443774
|
-
const projectPath =
|
|
443970
|
+
const projectPath = join151(projectsDir, projectName);
|
|
443775
443971
|
if (!dirent.isDirectory())
|
|
443776
443972
|
return;
|
|
443777
443973
|
const destProjectName = `${projectName}__${homespace}`;
|
|
443778
|
-
const destProjectPath =
|
|
443974
|
+
const destProjectPath = join151(destDir, destProjectName);
|
|
443779
443975
|
try {
|
|
443780
|
-
await
|
|
443976
|
+
await mkdir57(destProjectPath, { recursive: true });
|
|
443781
443977
|
} catch {}
|
|
443782
443978
|
let files2;
|
|
443783
443979
|
try {
|
|
@@ -443789,8 +443985,8 @@ var init_insights = __esm(() => {
|
|
|
443789
443985
|
const fileName = fileDirent.name;
|
|
443790
443986
|
if (!fileName.endsWith(".jsonl"))
|
|
443791
443987
|
return;
|
|
443792
|
-
const srcFile =
|
|
443793
|
-
const destFile =
|
|
443988
|
+
const srcFile = join151(projectPath, fileName);
|
|
443989
|
+
const destFile = join151(destProjectPath, fileName);
|
|
443794
443990
|
try {
|
|
443795
443991
|
await copyFile9(srcFile, destFile, fsConstants5.COPYFILE_EXCL);
|
|
443796
443992
|
result.copied++;
|
|
@@ -444819,14 +445015,14 @@ import { closeSync as closeSync4, fstatSync, openSync as openSync5, readSync as
|
|
|
444819
445015
|
import {
|
|
444820
445016
|
appendFile as fsAppendFile,
|
|
444821
445017
|
open as fsOpen2,
|
|
444822
|
-
mkdir as
|
|
445018
|
+
mkdir as mkdir58,
|
|
444823
445019
|
readdir as readdir37,
|
|
444824
|
-
readFile as
|
|
445020
|
+
readFile as readFile66,
|
|
444825
445021
|
stat as stat50,
|
|
444826
445022
|
unlink as unlink22,
|
|
444827
|
-
writeFile as
|
|
445023
|
+
writeFile as writeFile61
|
|
444828
445024
|
} from "fs/promises";
|
|
444829
|
-
import { basename as basename43, dirname as
|
|
445025
|
+
import { basename as basename43, dirname as dirname56, join as join152 } from "path";
|
|
444830
445026
|
function isTranscriptMessage(entry) {
|
|
444831
445027
|
return entry.type === "user" || entry.type === "assistant" || entry.type === "attachment" || entry.type === "system";
|
|
444832
445028
|
}
|
|
@@ -444840,18 +445036,18 @@ function isEphemeralToolProgress(dataType) {
|
|
|
444840
445036
|
return typeof dataType === "string" && EPHEMERAL_PROGRESS_TYPES.has(dataType);
|
|
444841
445037
|
}
|
|
444842
445038
|
function getProjectsDir2() {
|
|
444843
|
-
return
|
|
445039
|
+
return join152(getClaudeConfigHomeDir(), "projects");
|
|
444844
445040
|
}
|
|
444845
445041
|
function getTranscriptPath() {
|
|
444846
445042
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
444847
|
-
return
|
|
445043
|
+
return join152(projectDir, `${getSessionId()}.jsonl`);
|
|
444848
445044
|
}
|
|
444849
445045
|
function getTranscriptPathForSession(sessionId) {
|
|
444850
445046
|
if (sessionId === getSessionId()) {
|
|
444851
445047
|
return getTranscriptPath();
|
|
444852
445048
|
}
|
|
444853
445049
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
444854
|
-
return
|
|
445050
|
+
return join152(projectDir, `${sessionId}.jsonl`);
|
|
444855
445051
|
}
|
|
444856
445052
|
function setAgentTranscriptSubdir(agentId, subdir) {
|
|
444857
445053
|
agentTranscriptSubdirs.set(agentId, subdir);
|
|
@@ -444863,21 +445059,21 @@ function getAgentTranscriptPath(agentId) {
|
|
|
444863
445059
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
444864
445060
|
const sessionId = getSessionId();
|
|
444865
445061
|
const subdir = agentTranscriptSubdirs.get(agentId);
|
|
444866
|
-
const base = subdir ?
|
|
444867
|
-
return
|
|
445062
|
+
const base = subdir ? join152(projectDir, sessionId, "subagents", subdir) : join152(projectDir, sessionId, "subagents");
|
|
445063
|
+
return join152(base, `agent-${agentId}.jsonl`);
|
|
444868
445064
|
}
|
|
444869
445065
|
function getAgentMetadataPath(agentId) {
|
|
444870
445066
|
return getAgentTranscriptPath(agentId).replace(/\.jsonl$/, ".meta.json");
|
|
444871
445067
|
}
|
|
444872
445068
|
async function writeAgentMetadata(agentId, metadata) {
|
|
444873
445069
|
const path15 = getAgentMetadataPath(agentId);
|
|
444874
|
-
await
|
|
444875
|
-
await
|
|
445070
|
+
await mkdir58(dirname56(path15), { recursive: true });
|
|
445071
|
+
await writeFile61(path15, JSON.stringify(metadata));
|
|
444876
445072
|
}
|
|
444877
445073
|
async function readAgentMetadata(agentId) {
|
|
444878
445074
|
const path15 = getAgentMetadataPath(agentId);
|
|
444879
445075
|
try {
|
|
444880
|
-
const raw = await
|
|
445076
|
+
const raw = await readFile66(path15, "utf-8");
|
|
444881
445077
|
return JSON.parse(raw);
|
|
444882
445078
|
} catch (e) {
|
|
444883
445079
|
if (isFsInaccessible(e))
|
|
@@ -444887,20 +445083,20 @@ async function readAgentMetadata(agentId) {
|
|
|
444887
445083
|
}
|
|
444888
445084
|
function getRemoteAgentsDir() {
|
|
444889
445085
|
const projectDir = getSessionProjectDir() ?? getProjectDir2(getOriginalCwd());
|
|
444890
|
-
return
|
|
445086
|
+
return join152(projectDir, getSessionId(), "remote-agents");
|
|
444891
445087
|
}
|
|
444892
445088
|
function getRemoteAgentMetadataPath(taskId) {
|
|
444893
|
-
return
|
|
445089
|
+
return join152(getRemoteAgentsDir(), `remote-agent-${taskId}.meta.json`);
|
|
444894
445090
|
}
|
|
444895
445091
|
async function writeRemoteAgentMetadata(taskId, metadata) {
|
|
444896
445092
|
const path15 = getRemoteAgentMetadataPath(taskId);
|
|
444897
|
-
await
|
|
444898
|
-
await
|
|
445093
|
+
await mkdir58(dirname56(path15), { recursive: true });
|
|
445094
|
+
await writeFile61(path15, JSON.stringify(metadata));
|
|
444899
445095
|
}
|
|
444900
445096
|
async function readRemoteAgentMetadata(taskId) {
|
|
444901
445097
|
const path15 = getRemoteAgentMetadataPath(taskId);
|
|
444902
445098
|
try {
|
|
444903
|
-
const raw = await
|
|
445099
|
+
const raw = await readFile66(path15, "utf-8");
|
|
444904
445100
|
return JSON.parse(raw);
|
|
444905
445101
|
} catch (e) {
|
|
444906
445102
|
if (isFsInaccessible(e))
|
|
@@ -444933,7 +445129,7 @@ async function listRemoteAgentMetadata() {
|
|
|
444933
445129
|
if (!entry.isFile() || !entry.name.endsWith(".meta.json"))
|
|
444934
445130
|
continue;
|
|
444935
445131
|
try {
|
|
444936
|
-
const raw = await
|
|
445132
|
+
const raw = await readFile66(join152(dir, entry.name), "utf-8");
|
|
444937
445133
|
results.push(JSON.parse(raw));
|
|
444938
445134
|
} catch (e) {
|
|
444939
445135
|
logForDebugging(`listRemoteAgentMetadata: skipping ${entry.name}: ${String(e)}`);
|
|
@@ -444943,7 +445139,7 @@ async function listRemoteAgentMetadata() {
|
|
|
444943
445139
|
}
|
|
444944
445140
|
function sessionIdExists(sessionId) {
|
|
444945
445141
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
444946
|
-
const sessionFile =
|
|
445142
|
+
const sessionFile = join152(projectDir, `${sessionId}.jsonl`);
|
|
444947
445143
|
const fs5 = getFsImplementation();
|
|
444948
445144
|
try {
|
|
444949
445145
|
fs5.statSync(sessionFile);
|
|
@@ -445083,7 +445279,7 @@ class Project {
|
|
|
445083
445279
|
try {
|
|
445084
445280
|
await fsAppendFile(filePath, data, { mode: 384 });
|
|
445085
445281
|
} catch {
|
|
445086
|
-
await
|
|
445282
|
+
await mkdir58(dirname56(filePath), { recursive: true, mode: 448 });
|
|
445087
445283
|
await fsAppendFile(filePath, data, { mode: 384 });
|
|
445088
445284
|
}
|
|
445089
445285
|
}
|
|
@@ -445275,7 +445471,7 @@ class Project {
|
|
|
445275
445471
|
logForDebugging(`Skipping tombstone removal: session file too large (${formatFileSize(fileSize)})`, { level: "warn" });
|
|
445276
445472
|
return;
|
|
445277
445473
|
}
|
|
445278
|
-
const content = await
|
|
445474
|
+
const content = await readFile66(this.sessionFile, { encoding: "utf-8" });
|
|
445279
445475
|
const lines = content.split(`
|
|
445280
445476
|
`).filter((line) => {
|
|
445281
445477
|
if (!line.trim())
|
|
@@ -445287,7 +445483,7 @@ class Project {
|
|
|
445287
445483
|
return true;
|
|
445288
445484
|
}
|
|
445289
445485
|
});
|
|
445290
|
-
await
|
|
445486
|
+
await writeFile61(this.sessionFile, lines.join(`
|
|
445291
445487
|
`), {
|
|
445292
445488
|
encoding: "utf8"
|
|
445293
445489
|
});
|
|
@@ -445624,11 +445820,11 @@ async function hydrateRemoteSession(sessionId, ingressUrl) {
|
|
|
445624
445820
|
try {
|
|
445625
445821
|
const remoteLogs = await getSessionLogs(sessionId, ingressUrl) || [];
|
|
445626
445822
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
445627
|
-
await
|
|
445823
|
+
await mkdir58(projectDir, { recursive: true, mode: 448 });
|
|
445628
445824
|
const sessionFile = getTranscriptPathForSession(sessionId);
|
|
445629
445825
|
const content = remoteLogs.map((e) => jsonStringify(e) + `
|
|
445630
445826
|
`).join("");
|
|
445631
|
-
await
|
|
445827
|
+
await writeFile61(sessionFile, content, { encoding: "utf8", mode: 384 });
|
|
445632
445828
|
logForDebugging(`Hydrated ${remoteLogs.length} entries from remote`);
|
|
445633
445829
|
return remoteLogs.length > 0;
|
|
445634
445830
|
} catch (error5) {
|
|
@@ -445656,11 +445852,11 @@ async function hydrateFromCCRv2InternalEvents(sessionId) {
|
|
|
445656
445852
|
return false;
|
|
445657
445853
|
}
|
|
445658
445854
|
const projectDir = getProjectDir2(getOriginalCwd());
|
|
445659
|
-
await
|
|
445855
|
+
await mkdir58(projectDir, { recursive: true, mode: 448 });
|
|
445660
445856
|
const sessionFile = getTranscriptPathForSession(sessionId);
|
|
445661
445857
|
const fgContent = events2.map((e) => jsonStringify(e.payload) + `
|
|
445662
445858
|
`).join("");
|
|
445663
|
-
await
|
|
445859
|
+
await writeFile61(sessionFile, fgContent, { encoding: "utf8", mode: 384 });
|
|
445664
445860
|
logForDebugging(`Hydrated ${events2.length} foreground entries from CCR v2 internal events`);
|
|
445665
445861
|
let subagentEventCount = 0;
|
|
445666
445862
|
const subagentReader = project2.getInternalSubagentEventReader();
|
|
@@ -445682,10 +445878,10 @@ async function hydrateFromCCRv2InternalEvents(sessionId) {
|
|
|
445682
445878
|
}
|
|
445683
445879
|
for (const [agentId, entries] of byAgent) {
|
|
445684
445880
|
const agentFile = getAgentTranscriptPath(asAgentId(agentId));
|
|
445685
|
-
await
|
|
445881
|
+
await mkdir58(dirname56(agentFile), { recursive: true, mode: 448 });
|
|
445686
445882
|
const agentContent = entries.map((p) => jsonStringify(p) + `
|
|
445687
445883
|
`).join("");
|
|
445688
|
-
await
|
|
445884
|
+
await writeFile61(agentFile, agentContent, {
|
|
445689
445885
|
encoding: "utf8",
|
|
445690
445886
|
mode: 384
|
|
445691
445887
|
});
|
|
@@ -446085,7 +446281,7 @@ async function loadTranscriptFromFile(filePath) {
|
|
|
446085
446281
|
worktreeSession: worktreeStates.has(sessionId) ? worktreeStates.get(sessionId) : undefined
|
|
446086
446282
|
};
|
|
446087
446283
|
}
|
|
446088
|
-
const content = await
|
|
446284
|
+
const content = await readFile66(filePath, { encoding: "utf-8" });
|
|
446089
446285
|
let parsed;
|
|
446090
446286
|
try {
|
|
446091
446287
|
parsed = jsonParse(content);
|
|
@@ -446219,7 +446415,7 @@ function appendEntryToFile(fullPath, entry) {
|
|
|
446219
446415
|
try {
|
|
446220
446416
|
fs5.appendFileSync(fullPath, line, { mode: 384 });
|
|
446221
446417
|
} catch {
|
|
446222
|
-
fs5.mkdirSync(
|
|
446418
|
+
fs5.mkdirSync(dirname56(fullPath), { mode: 448 });
|
|
446223
446419
|
fs5.appendFileSync(fullPath, line, { mode: 384 });
|
|
446224
446420
|
}
|
|
446225
446421
|
}
|
|
@@ -446747,7 +446943,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
446747
446943
|
}
|
|
446748
446944
|
}
|
|
446749
446945
|
}
|
|
446750
|
-
buf ??= await
|
|
446946
|
+
buf ??= await readFile66(filePath);
|
|
446751
446947
|
if (!opts?.keepAllLeaves && !hasPreservedSegment && !isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_PRECOMPACT_SKIP) && buf.length > SKIP_PRECOMPACT_THRESHOLD) {
|
|
446752
446948
|
buf = walkChainBeforeParse(buf);
|
|
446753
446949
|
}
|
|
@@ -446912,7 +447108,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
446912
447108
|
};
|
|
446913
447109
|
}
|
|
446914
447110
|
async function loadSessionFile(sessionId) {
|
|
446915
|
-
const sessionFile =
|
|
447111
|
+
const sessionFile = join152(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), `${sessionId}.jsonl`);
|
|
446916
447112
|
return loadTranscriptFile(sessionFile);
|
|
446917
447113
|
}
|
|
446918
447114
|
function clearSessionMessagesCache() {
|
|
@@ -446980,7 +447176,7 @@ async function loadAllProjectsMessageLogsFull(limit) {
|
|
|
446980
447176
|
} catch {
|
|
446981
447177
|
return [];
|
|
446982
447178
|
}
|
|
446983
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
447179
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join152(projectsDir, dirent.name));
|
|
446984
447180
|
const logsPerProject = await Promise.all(projectDirs.map((projectDir) => getLogsWithoutIndex(projectDir, limit)));
|
|
446985
447181
|
const allLogs = logsPerProject.flat();
|
|
446986
447182
|
const deduped = new Map;
|
|
@@ -447005,7 +447201,7 @@ async function loadAllProjectsMessageLogsProgressive(limit, initialEnrichCount =
|
|
|
447005
447201
|
} catch {
|
|
447006
447202
|
return { logs: [], allStatLogs: [], nextIndex: 0 };
|
|
447007
447203
|
}
|
|
447008
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
447204
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join152(projectsDir, dirent.name));
|
|
447009
447205
|
const rawLogs = [];
|
|
447010
447206
|
for (const projectDir of projectDirs) {
|
|
447011
447207
|
rawLogs.push(...await getSessionFilesLite(projectDir, limit));
|
|
@@ -447066,7 +447262,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit) {
|
|
|
447066
447262
|
for (const { path: wtPath, prefix } of indexed) {
|
|
447067
447263
|
if (dirName === prefix || dirName.startsWith(prefix + "-")) {
|
|
447068
447264
|
seenDirs.add(dirName);
|
|
447069
|
-
allLogs.push(...await getSessionFilesLite(
|
|
447265
|
+
allLogs.push(...await getSessionFilesLite(join152(projectsDir, dirent.name), undefined, wtPath));
|
|
447070
447266
|
break;
|
|
447071
447267
|
}
|
|
447072
447268
|
}
|
|
@@ -447135,7 +447331,7 @@ async function loadSubagentTranscripts(agentIds) {
|
|
|
447135
447331
|
return transcripts;
|
|
447136
447332
|
}
|
|
447137
447333
|
async function loadAllSubagentTranscriptsFromDisk() {
|
|
447138
|
-
const subagentsDir =
|
|
447334
|
+
const subagentsDir = join152(getSessionProjectDir() ?? getProjectDir2(getOriginalCwd()), getSessionId(), "subagents");
|
|
447139
447335
|
let entries;
|
|
447140
447336
|
try {
|
|
447141
447337
|
entries = await readdir37(subagentsDir, { withFileTypes: true });
|
|
@@ -447263,7 +447459,7 @@ async function getSessionFilesWithMtime(projectDir) {
|
|
|
447263
447459
|
const sessionId = validateUuid2(basename43(dirent.name, ".jsonl"));
|
|
447264
447460
|
if (!sessionId)
|
|
447265
447461
|
continue;
|
|
447266
|
-
candidates.push({ sessionId, filePath:
|
|
447462
|
+
candidates.push({ sessionId, filePath: join152(projectDir, dirent.name) });
|
|
447267
447463
|
}
|
|
447268
447464
|
await Promise.all(candidates.map(async ({ sessionId, filePath }) => {
|
|
447269
447465
|
try {
|
|
@@ -447647,7 +447843,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
447647
447843
|
init_settings2();
|
|
447648
447844
|
init_slowOperations();
|
|
447649
447845
|
init_uuid();
|
|
447650
|
-
VERSION6 = typeof MACRO !== "undefined" ? "2.
|
|
447846
|
+
VERSION6 = typeof MACRO !== "undefined" ? "2.3.0" : "unknown";
|
|
447651
447847
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
447652
447848
|
SKIP_FIRST_PROMPT_PATTERN = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
|
|
447653
447849
|
EPHEMERAL_PROGRESS_TYPES = new Set([
|
|
@@ -447659,7 +447855,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
447659
447855
|
MAX_TRANSCRIPT_READ_BYTES = 50 * 1024 * 1024;
|
|
447660
447856
|
agentTranscriptSubdirs = new Map;
|
|
447661
447857
|
getProjectDir2 = memoize_default((projectDir) => {
|
|
447662
|
-
return
|
|
447858
|
+
return join152(getProjectsDir2(), sanitizePath2(projectDir));
|
|
447663
447859
|
});
|
|
447664
447860
|
METADATA_TYPE_MARKERS = [
|
|
447665
447861
|
'"type":"summary"',
|
|
@@ -447870,17 +448066,17 @@ var init_memdir = __esm(() => {
|
|
|
447870
448066
|
});
|
|
447871
448067
|
|
|
447872
448068
|
// src/tools/AgentTool/agentMemory.ts
|
|
447873
|
-
import { join as
|
|
448069
|
+
import { join as join153, normalize as normalize13, sep as sep31 } from "path";
|
|
447874
448070
|
function sanitizeAgentTypeForPath(agentType) {
|
|
447875
448071
|
return agentType.replace(/:/g, "-");
|
|
447876
448072
|
}
|
|
447877
448073
|
function getAgentMemoryDir(agentType, _scope) {
|
|
447878
448074
|
const dirName = sanitizeAgentTypeForPath(agentType);
|
|
447879
|
-
return
|
|
448075
|
+
return join153(getProjectMemoryBaseDir(), "agent-memory", dirName) + sep31;
|
|
447880
448076
|
}
|
|
447881
448077
|
function isAgentMemoryPath(absolutePath) {
|
|
447882
448078
|
const normalizedPath = normalize13(absolutePath);
|
|
447883
|
-
return normalizedPath.startsWith(
|
|
448079
|
+
return normalizedPath.startsWith(join153(getProjectMemoryBaseDir(), "agent-memory") + sep31);
|
|
447884
448080
|
}
|
|
447885
448081
|
function getMemoryScopeDisplay(memory2) {
|
|
447886
448082
|
switch (memory2) {
|
|
@@ -447908,8 +448104,8 @@ var init_agentMemory = __esm(() => {
|
|
|
447908
448104
|
|
|
447909
448105
|
// src/utils/permissions/filesystem.ts
|
|
447910
448106
|
import { randomBytes as randomBytes20 } from "crypto";
|
|
447911
|
-
import { homedir as
|
|
447912
|
-
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";
|
|
447913
448109
|
function normalizeCaseForComparison(path15) {
|
|
447914
448110
|
return path15.toLowerCase();
|
|
447915
448111
|
}
|
|
@@ -447918,11 +448114,11 @@ function getClaudeSkillScope(filePath) {
|
|
|
447918
448114
|
const absolutePathLower = normalizeCaseForComparison(absolutePath);
|
|
447919
448115
|
const bases = [
|
|
447920
448116
|
{
|
|
447921
|
-
dir: expandPath(
|
|
448117
|
+
dir: expandPath(join154(getOriginalCwd(), ".claude", "skills")),
|
|
447922
448118
|
prefix: "/.claude/skills/"
|
|
447923
448119
|
},
|
|
447924
448120
|
{
|
|
447925
|
-
dir: expandPath(
|
|
448121
|
+
dir: expandPath(join154(homedir33(), ".claude", "skills")),
|
|
447926
448122
|
prefix: "~/.claude/skills/"
|
|
447927
448123
|
}
|
|
447928
448124
|
];
|
|
@@ -447977,21 +448173,21 @@ function isClaudeConfigFilePath(filePath) {
|
|
|
447977
448173
|
if (isClaudeSettingsPath(filePath)) {
|
|
447978
448174
|
return true;
|
|
447979
448175
|
}
|
|
447980
|
-
const commandsDir =
|
|
447981
|
-
const agentsDir =
|
|
447982
|
-
const skillsDir =
|
|
448176
|
+
const commandsDir = join154(getOriginalCwd(), ".claude", "commands");
|
|
448177
|
+
const agentsDir = join154(getOriginalCwd(), ".claude", "agents");
|
|
448178
|
+
const skillsDir = join154(getOriginalCwd(), ".claude", "skills");
|
|
447983
448179
|
return pathInWorkingPath(filePath, commandsDir) || pathInWorkingPath(filePath, agentsDir) || pathInWorkingPath(filePath, skillsDir);
|
|
447984
448180
|
}
|
|
447985
448181
|
function isSessionPlanFile(absolutePath) {
|
|
447986
|
-
const expectedPrefix =
|
|
448182
|
+
const expectedPrefix = join154(getPlansDirectory(), getPlanSlug());
|
|
447987
448183
|
const normalizedPath = normalize14(absolutePath);
|
|
447988
448184
|
return normalizedPath.startsWith(expectedPrefix) && normalizedPath.endsWith(".md");
|
|
447989
448185
|
}
|
|
447990
448186
|
function getSessionMemoryDir() {
|
|
447991
|
-
return
|
|
448187
|
+
return join154(getProjectDir2(getCwd()), getSessionId(), "session-memory") + sep32;
|
|
447992
448188
|
}
|
|
447993
448189
|
function getSessionMemoryPath() {
|
|
447994
|
-
return
|
|
448190
|
+
return join154(getSessionMemoryDir(), "summary.md");
|
|
447995
448191
|
}
|
|
447996
448192
|
function isSessionMemoryPath(absolutePath) {
|
|
447997
448193
|
const normalizedPath = normalize14(absolutePath);
|
|
@@ -448013,10 +448209,10 @@ function getClaudeTempDirName() {
|
|
|
448013
448209
|
return `claude-${uid}`;
|
|
448014
448210
|
}
|
|
448015
448211
|
function getProjectTempDir() {
|
|
448016
|
-
return
|
|
448212
|
+
return join154(getClaudeTempDir(), sanitizePath2(getOriginalCwd())) + sep32;
|
|
448017
448213
|
}
|
|
448018
448214
|
function getScratchpadDir() {
|
|
448019
|
-
return
|
|
448215
|
+
return join154(getProjectTempDir(), getSessionId(), "scratchpad");
|
|
448020
448216
|
}
|
|
448021
448217
|
async function ensureScratchpadDir() {
|
|
448022
448218
|
if (!isScratchpadEnabled()) {
|
|
@@ -448236,7 +448432,7 @@ function patternWithRoot(pattern, source) {
|
|
|
448236
448432
|
} else if (pattern.startsWith(`~${DIR_SEP}`)) {
|
|
448237
448433
|
return {
|
|
448238
448434
|
relativePattern: pattern.slice(1),
|
|
448239
|
-
root:
|
|
448435
|
+
root: homedir33().normalize("NFC")
|
|
448240
448436
|
};
|
|
448241
448437
|
} else if (pattern.startsWith(DIR_SEP)) {
|
|
448242
448438
|
return {
|
|
@@ -448594,7 +448790,7 @@ function checkEditableInternalPath(absolutePath, input) {
|
|
|
448594
448790
|
}
|
|
448595
448791
|
};
|
|
448596
448792
|
}
|
|
448597
|
-
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(
|
|
448793
|
+
if (normalizeCaseForComparison(normalizedPath) === normalizeCaseForComparison(join154(getOriginalCwd(), ".claude", "launch.json"))) {
|
|
448598
448794
|
return {
|
|
448599
448795
|
behavior: "allow",
|
|
448600
448796
|
updatedInput: input,
|
|
@@ -448691,7 +448887,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
448691
448887
|
}
|
|
448692
448888
|
};
|
|
448693
448889
|
}
|
|
448694
|
-
const tasksDir =
|
|
448890
|
+
const tasksDir = join154(getClaudeConfigHomeDir(), "tasks") + sep32;
|
|
448695
448891
|
if (normalizedPath === tasksDir.slice(0, -1) || normalizedPath.startsWith(tasksDir)) {
|
|
448696
448892
|
return {
|
|
448697
448893
|
behavior: "allow",
|
|
@@ -448702,7 +448898,7 @@ function checkReadableInternalPath(absolutePath, input) {
|
|
|
448702
448898
|
}
|
|
448703
448899
|
};
|
|
448704
448900
|
}
|
|
448705
|
-
const teamsReadDir =
|
|
448901
|
+
const teamsReadDir = join154(getClaudeConfigHomeDir(), "teams") + sep32;
|
|
448706
448902
|
if (normalizedPath === teamsReadDir.slice(0, -1) || normalizedPath.startsWith(teamsReadDir)) {
|
|
448707
448903
|
return {
|
|
448708
448904
|
behavior: "allow",
|
|
@@ -448774,11 +448970,11 @@ var init_filesystem = __esm(() => {
|
|
|
448774
448970
|
try {
|
|
448775
448971
|
resolvedBaseTmpDir = fs5.realpathSync(baseTmpDir);
|
|
448776
448972
|
} catch {}
|
|
448777
|
-
return
|
|
448973
|
+
return join154(resolvedBaseTmpDir, getClaudeTempDirName()) + sep32;
|
|
448778
448974
|
});
|
|
448779
448975
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
448780
448976
|
const nonce = randomBytes20(16).toString("hex");
|
|
448781
|
-
return
|
|
448977
|
+
return join154(getClaudeTempDir(), "bundled-skills", "2.3.0", nonce);
|
|
448782
448978
|
});
|
|
448783
448979
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
448784
448980
|
});
|
|
@@ -448786,24 +448982,24 @@ var init_filesystem = __esm(() => {
|
|
|
448786
448982
|
// src/utils/task/diskOutput.ts
|
|
448787
448983
|
import { constants as fsConstants6 } from "fs";
|
|
448788
448984
|
import {
|
|
448789
|
-
mkdir as
|
|
448985
|
+
mkdir as mkdir59,
|
|
448790
448986
|
open as open16,
|
|
448791
448987
|
stat as stat51,
|
|
448792
448988
|
symlink as symlink4,
|
|
448793
448989
|
unlink as unlink23
|
|
448794
448990
|
} from "fs/promises";
|
|
448795
|
-
import { join as
|
|
448991
|
+
import { join as join155 } from "path";
|
|
448796
448992
|
function getTaskOutputDir() {
|
|
448797
448993
|
if (_taskOutputDir === undefined) {
|
|
448798
|
-
_taskOutputDir =
|
|
448994
|
+
_taskOutputDir = join155(getProjectTempDir(), getSessionId(), "tasks");
|
|
448799
448995
|
}
|
|
448800
448996
|
return _taskOutputDir;
|
|
448801
448997
|
}
|
|
448802
448998
|
async function ensureOutputDir() {
|
|
448803
|
-
await
|
|
448999
|
+
await mkdir59(getTaskOutputDir(), { recursive: true });
|
|
448804
449000
|
}
|
|
448805
449001
|
function getTaskOutputPath(taskId) {
|
|
448806
|
-
return
|
|
449002
|
+
return join155(getTaskOutputDir(), `${taskId}.output`);
|
|
448807
449003
|
}
|
|
448808
449004
|
function track(p) {
|
|
448809
449005
|
_pendingOps.add(p);
|
|
@@ -453062,14 +453258,14 @@ __export(exports_worktree, {
|
|
|
453062
453258
|
import { spawnSync as spawnSync9 } from "child_process";
|
|
453063
453259
|
import {
|
|
453064
453260
|
copyFile as copyFile10,
|
|
453065
|
-
mkdir as
|
|
453261
|
+
mkdir as mkdir60,
|
|
453066
453262
|
readdir as readdir38,
|
|
453067
|
-
readFile as
|
|
453263
|
+
readFile as readFile67,
|
|
453068
453264
|
stat as stat53,
|
|
453069
453265
|
symlink as symlink5,
|
|
453070
453266
|
utimes as utimes2
|
|
453071
453267
|
} from "fs/promises";
|
|
453072
|
-
import { basename as basename45, dirname as
|
|
453268
|
+
import { basename as basename45, dirname as dirname57, join as join156 } from "path";
|
|
453073
453269
|
function validateWorktreeSlug(slug) {
|
|
453074
453270
|
if (slug.length > MAX_WORKTREE_SLUG_LENGTH) {
|
|
453075
453271
|
throw new Error(`Invalid worktree name: must be ${MAX_WORKTREE_SLUG_LENGTH} characters or fewer (got ${slug.length})`);
|
|
@@ -453084,7 +453280,7 @@ function validateWorktreeSlug(slug) {
|
|
|
453084
453280
|
}
|
|
453085
453281
|
}
|
|
453086
453282
|
async function mkdirRecursive(dirPath) {
|
|
453087
|
-
await
|
|
453283
|
+
await mkdir60(dirPath, { recursive: true });
|
|
453088
453284
|
}
|
|
453089
453285
|
async function symlinkDirectories(repoRootPath, worktreePath, dirsToSymlink) {
|
|
453090
453286
|
for (const dir of dirsToSymlink) {
|
|
@@ -453092,8 +453288,8 @@ async function symlinkDirectories(repoRootPath, worktreePath, dirsToSymlink) {
|
|
|
453092
453288
|
logForDebugging(`Skipping symlink for "${dir}": path traversal detected`, { level: "warn" });
|
|
453093
453289
|
continue;
|
|
453094
453290
|
}
|
|
453095
|
-
const sourcePath =
|
|
453096
|
-
const destPath =
|
|
453291
|
+
const sourcePath = join156(repoRootPath, dir);
|
|
453292
|
+
const destPath = join156(worktreePath, dir);
|
|
453097
453293
|
try {
|
|
453098
453294
|
await symlink5(sourcePath, destPath, "dir");
|
|
453099
453295
|
logForDebugging(`Symlinked ${dir} from main repository to worktree to avoid disk bloat`);
|
|
@@ -453117,7 +453313,7 @@ function generateTmuxSessionName(repoPath, branch2) {
|
|
|
453117
453313
|
return combined.replace(/[/.]/g, "_");
|
|
453118
453314
|
}
|
|
453119
453315
|
function worktreesDir(repoRoot) {
|
|
453120
|
-
return
|
|
453316
|
+
return join156(repoRoot, ".claude", "worktrees");
|
|
453121
453317
|
}
|
|
453122
453318
|
function flattenSlug(slug) {
|
|
453123
453319
|
return slug.replaceAll("/", "+");
|
|
@@ -453126,7 +453322,7 @@ function worktreeBranchName(slug) {
|
|
|
453126
453322
|
return `worktree-${flattenSlug(slug)}`;
|
|
453127
453323
|
}
|
|
453128
453324
|
function worktreePathFor(repoRoot, slug) {
|
|
453129
|
-
return
|
|
453325
|
+
return join156(worktreesDir(repoRoot), flattenSlug(slug));
|
|
453130
453326
|
}
|
|
453131
453327
|
async function getOrCreateWorktree(repoRoot, slug, options) {
|
|
453132
453328
|
const worktreePath = worktreePathFor(repoRoot, slug);
|
|
@@ -453140,7 +453336,7 @@ async function getOrCreateWorktree(repoRoot, slug, options) {
|
|
|
453140
453336
|
existed: true
|
|
453141
453337
|
};
|
|
453142
453338
|
}
|
|
453143
|
-
await
|
|
453339
|
+
await mkdir60(worktreesDir(repoRoot), { recursive: true });
|
|
453144
453340
|
const fetchEnv = { ...process.env, ...GIT_NO_PROMPT_ENV2 };
|
|
453145
453341
|
let baseBranch;
|
|
453146
453342
|
let baseSha = null;
|
|
@@ -453207,7 +453403,7 @@ async function getOrCreateWorktree(repoRoot, slug, options) {
|
|
|
453207
453403
|
async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
453208
453404
|
let includeContent;
|
|
453209
453405
|
try {
|
|
453210
|
-
includeContent = await
|
|
453406
|
+
includeContent = await readFile67(join156(repoRoot, ".worktreeinclude"), "utf-8");
|
|
453211
453407
|
} catch {
|
|
453212
453408
|
return [];
|
|
453213
453409
|
}
|
|
@@ -453262,10 +453458,10 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
|
453262
453458
|
}
|
|
453263
453459
|
const copied = [];
|
|
453264
453460
|
for (const relativePath2 of files2) {
|
|
453265
|
-
const srcPath =
|
|
453266
|
-
const destPath =
|
|
453461
|
+
const srcPath = join156(repoRoot, relativePath2);
|
|
453462
|
+
const destPath = join156(worktreePath, relativePath2);
|
|
453267
453463
|
try {
|
|
453268
|
-
await
|
|
453464
|
+
await mkdir60(dirname57(destPath), { recursive: true });
|
|
453269
453465
|
await copyFile10(srcPath, destPath);
|
|
453270
453466
|
copied.push(relativePath2);
|
|
453271
453467
|
} catch (e) {
|
|
@@ -453279,10 +453475,10 @@ async function copyWorktreeIncludeFiles(repoRoot, worktreePath) {
|
|
|
453279
453475
|
}
|
|
453280
453476
|
async function performPostCreationSetup(repoRoot, worktreePath) {
|
|
453281
453477
|
const localSettingsRelativePath = getRelativeSettingsFilePathForSource("localSettings");
|
|
453282
|
-
const sourceSettingsLocal =
|
|
453478
|
+
const sourceSettingsLocal = join156(repoRoot, localSettingsRelativePath);
|
|
453283
453479
|
try {
|
|
453284
|
-
const destSettingsLocal =
|
|
453285
|
-
await mkdirRecursive(
|
|
453480
|
+
const destSettingsLocal = join156(worktreePath, localSettingsRelativePath);
|
|
453481
|
+
await mkdirRecursive(dirname57(destSettingsLocal));
|
|
453286
453482
|
await copyFile10(sourceSettingsLocal, destSettingsLocal);
|
|
453287
453483
|
logForDebugging(`Copied settings.local.json to worktree: ${destSettingsLocal}`);
|
|
453288
453484
|
} catch (e) {
|
|
@@ -453291,8 +453487,8 @@ async function performPostCreationSetup(repoRoot, worktreePath) {
|
|
|
453291
453487
|
logForDebugging(`Failed to copy settings.local.json: ${e.message}`, { level: "warn" });
|
|
453292
453488
|
}
|
|
453293
453489
|
}
|
|
453294
|
-
const huskyPath =
|
|
453295
|
-
const gitHooksPath =
|
|
453490
|
+
const huskyPath = join156(repoRoot, ".husky");
|
|
453491
|
+
const gitHooksPath = join156(repoRoot, ".git", "hooks");
|
|
453296
453492
|
let hooksPath = null;
|
|
453297
453493
|
for (const candidatePath of [huskyPath, gitHooksPath]) {
|
|
453298
453494
|
try {
|
|
@@ -453567,7 +453763,7 @@ async function cleanupStaleAgentWorktrees(cutoffDate) {
|
|
|
453567
453763
|
if (!EPHEMERAL_WORKTREE_PATTERNS.some((p) => p.test(slug))) {
|
|
453568
453764
|
continue;
|
|
453569
453765
|
}
|
|
453570
|
-
const worktreePath =
|
|
453766
|
+
const worktreePath = join156(dir, slug);
|
|
453571
453767
|
if (currentPath === worktreePath) {
|
|
453572
453768
|
continue;
|
|
453573
453769
|
}
|
|
@@ -456444,9 +456640,9 @@ __export(exports_upstreamproxy, {
|
|
|
456444
456640
|
getUpstreamProxyEnv: () => getUpstreamProxyEnv,
|
|
456445
456641
|
SESSION_TOKEN_PATH: () => SESSION_TOKEN_PATH
|
|
456446
456642
|
});
|
|
456447
|
-
import { mkdir as
|
|
456448
|
-
import { homedir as
|
|
456449
|
-
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";
|
|
456450
456646
|
async function initUpstreamProxy(opts) {
|
|
456451
456647
|
if (!isEnvTruthy(process.env.CLAUDE_CODE_REMOTE)) {
|
|
456452
456648
|
return state;
|
|
@@ -456467,7 +456663,7 @@ async function initUpstreamProxy(opts) {
|
|
|
456467
456663
|
}
|
|
456468
456664
|
setNonDumpable();
|
|
456469
456665
|
const baseUrl = opts?.ccrBaseUrl ?? process.env.ANTHROPIC_BASE_URL ?? "https://api.anthropic.com";
|
|
456470
|
-
const caBundlePath = opts?.caBundlePath ??
|
|
456666
|
+
const caBundlePath = opts?.caBundlePath ?? join157(homedir34(), ".ccr", "ca-bundle.crt");
|
|
456471
456667
|
const caOk = await downloadCaBundle(baseUrl, opts?.systemCaPath ?? SYSTEM_CA_BUNDLE, caBundlePath);
|
|
456472
456668
|
if (!caOk)
|
|
456473
456669
|
return state;
|
|
@@ -456525,7 +456721,7 @@ function resetUpstreamProxyForTests() {
|
|
|
456525
456721
|
}
|
|
456526
456722
|
async function readToken(path15) {
|
|
456527
456723
|
try {
|
|
456528
|
-
const raw = await
|
|
456724
|
+
const raw = await readFile68(path15, "utf8");
|
|
456529
456725
|
return raw.trim() || null;
|
|
456530
456726
|
} catch (err2) {
|
|
456531
456727
|
if (isENOENT(err2))
|
|
@@ -456566,9 +456762,9 @@ async function downloadCaBundle(baseUrl, systemCaPath, outPath) {
|
|
|
456566
456762
|
return false;
|
|
456567
456763
|
}
|
|
456568
456764
|
const ccrCa = await resp.text();
|
|
456569
|
-
const systemCa = await
|
|
456570
|
-
await
|
|
456571
|
-
await
|
|
456765
|
+
const systemCa = await readFile68(systemCaPath, "utf8").catch(() => "");
|
|
456766
|
+
await mkdir61(join157(outPath, ".."), { recursive: true });
|
|
456767
|
+
await writeFile62(outPath, systemCa + `
|
|
456572
456768
|
` + ccrCa, "utf8");
|
|
456573
456769
|
return true;
|
|
456574
456770
|
} catch (err2) {
|
|
@@ -458015,7 +458211,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
458015
458211
|
slash_commands: inputs.commands.filter((c5) => c5.userInvocable !== false).map((c5) => c5.name),
|
|
458016
458212
|
apiKeySource: getAnthropicApiKeyWithSource().source,
|
|
458017
458213
|
betas: getSdkBetas(),
|
|
458018
|
-
claude_code_version: "2.
|
|
458214
|
+
claude_code_version: "2.3.0",
|
|
458019
458215
|
output_style: outputStyle2,
|
|
458020
458216
|
agents: inputs.agents.map((agent) => agent.agentType),
|
|
458021
458217
|
skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
|
|
@@ -464373,8 +464569,8 @@ var init_ShowInIDEPrompt = __esm(() => {
|
|
|
464373
464569
|
});
|
|
464374
464570
|
|
|
464375
464571
|
// src/components/permissions/FilePermissionDialog/permissionOptions.tsx
|
|
464376
|
-
import { homedir as
|
|
464377
|
-
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";
|
|
464378
464574
|
function isInClaudeFolder(filePath) {
|
|
464379
464575
|
const absolutePath = expandPath(filePath);
|
|
464380
464576
|
const claudeFolderPath = expandPath(`${getOriginalCwd()}/.claude`);
|
|
@@ -464384,7 +464580,7 @@ function isInClaudeFolder(filePath) {
|
|
|
464384
464580
|
}
|
|
464385
464581
|
function isInGlobalClaudeFolder(filePath) {
|
|
464386
464582
|
const absolutePath = expandPath(filePath);
|
|
464387
|
-
const globalClaudeFolderPath =
|
|
464583
|
+
const globalClaudeFolderPath = join158(homedir35(), ".claude");
|
|
464388
464584
|
const normalizedAbsolutePath = normalizeCaseForComparison(absolutePath);
|
|
464389
464585
|
const normalizedGlobalClaudeFolderPath = normalizeCaseForComparison(globalClaudeFolderPath);
|
|
464390
464586
|
return normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + sep33.toLowerCase()) || normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + "/");
|
|
@@ -472172,7 +472368,7 @@ var init_useVoiceEnabled = __esm(() => {
|
|
|
472172
472368
|
function getSemverPart(version2) {
|
|
472173
472369
|
return `${import_semver10.major(version2, { loose: true })}.${import_semver10.minor(version2, { loose: true })}.${import_semver10.patch(version2, { loose: true })}`;
|
|
472174
472370
|
}
|
|
472175
|
-
function useUpdateNotification(updatedVersion, initialVersion = "2.
|
|
472371
|
+
function useUpdateNotification(updatedVersion, initialVersion = "2.3.0") {
|
|
472176
472372
|
const [lastNotifiedSemver, setLastNotifiedSemver] = import_react214.useState(() => getSemverPart(initialVersion));
|
|
472177
472373
|
if (!updatedVersion) {
|
|
472178
472374
|
return null;
|
|
@@ -472212,7 +472408,7 @@ function AutoUpdater({
|
|
|
472212
472408
|
return;
|
|
472213
472409
|
}
|
|
472214
472410
|
if (false) {}
|
|
472215
|
-
const currentVersion = "2.
|
|
472411
|
+
const currentVersion = "2.3.0";
|
|
472216
472412
|
const channel = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
472217
472413
|
let latestVersion = await getLatestVersion(channel);
|
|
472218
472414
|
const isDisabled = isAutoUpdaterDisabled();
|
|
@@ -472423,12 +472619,12 @@ function NativeAutoUpdater({
|
|
|
472423
472619
|
logEvent("tengu_native_auto_updater_start", {});
|
|
472424
472620
|
try {
|
|
472425
472621
|
const maxVersion = await getMaxVersion();
|
|
472426
|
-
if (maxVersion && gt("2.
|
|
472622
|
+
if (maxVersion && gt("2.3.0", maxVersion)) {
|
|
472427
472623
|
const msg = await getMaxVersionMessage();
|
|
472428
472624
|
setMaxVersionIssue(msg ?? "affects your version");
|
|
472429
472625
|
}
|
|
472430
472626
|
const result = await installLatest(channel);
|
|
472431
|
-
const currentVersion = "2.
|
|
472627
|
+
const currentVersion = "2.3.0";
|
|
472432
472628
|
const latencyMs = Date.now() - startTime;
|
|
472433
472629
|
if (result.lockFailed) {
|
|
472434
472630
|
logEvent("tengu_native_auto_updater_lock_contention", {
|
|
@@ -472563,17 +472759,17 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
472563
472759
|
const maxVersion = await getMaxVersion();
|
|
472564
472760
|
if (maxVersion && latest && gt(latest, maxVersion)) {
|
|
472565
472761
|
logForDebugging(`PackageManagerAutoUpdater: maxVersion ${maxVersion} is set, capping update from ${latest} to ${maxVersion}`);
|
|
472566
|
-
if (gte("2.
|
|
472567
|
-
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`);
|
|
472568
472764
|
setUpdateAvailable(false);
|
|
472569
472765
|
return;
|
|
472570
472766
|
}
|
|
472571
472767
|
latest = maxVersion;
|
|
472572
472768
|
}
|
|
472573
|
-
const hasUpdate = latest && !gte("2.
|
|
472769
|
+
const hasUpdate = latest && !gte("2.3.0", latest) && !shouldSkipVersion(latest);
|
|
472574
472770
|
setUpdateAvailable(!!hasUpdate);
|
|
472575
472771
|
if (hasUpdate) {
|
|
472576
|
-
logForDebugging(`PackageManagerAutoUpdater: Update available ${"2.
|
|
472772
|
+
logForDebugging(`PackageManagerAutoUpdater: Update available ${"2.3.0"} -> ${latest}`);
|
|
472577
472773
|
}
|
|
472578
472774
|
};
|
|
472579
472775
|
$2[0] = t1;
|
|
@@ -472607,7 +472803,7 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
472607
472803
|
wrap: "truncate",
|
|
472608
472804
|
children: [
|
|
472609
472805
|
"currentVersion: ",
|
|
472610
|
-
"2.
|
|
472806
|
+
"2.3.0"
|
|
472611
472807
|
]
|
|
472612
472808
|
}, undefined, true, undefined, this);
|
|
472613
472809
|
$2[3] = verbose;
|
|
@@ -480167,7 +480363,7 @@ function buildStatusLineCommandInput(permissionMode, exceedsHalfContext, setting
|
|
|
480167
480363
|
project_dir: getOriginalCwd(),
|
|
480168
480364
|
added_dirs: addedDirs
|
|
480169
480365
|
},
|
|
480170
|
-
version: "2.
|
|
480366
|
+
version: "2.3.0",
|
|
480171
480367
|
output_style: {
|
|
480172
480368
|
name: outputStyleName
|
|
480173
480369
|
},
|
|
@@ -486251,9 +486447,9 @@ function initSkillImprovement() {
|
|
|
486251
486447
|
async function applySkillImprovement(skillName, updates) {
|
|
486252
486448
|
if (!skillName)
|
|
486253
486449
|
return;
|
|
486254
|
-
const { join:
|
|
486450
|
+
const { join: join159 } = await import("path");
|
|
486255
486451
|
const fs5 = await import("fs/promises");
|
|
486256
|
-
const filePath =
|
|
486452
|
+
const filePath = join159(getCwd(), ".claude", "skills", skillName, "SKILL.md");
|
|
486257
486453
|
let currentContent;
|
|
486258
486454
|
try {
|
|
486259
486455
|
currentContent = await fs5.readFile(filePath, "utf-8");
|
|
@@ -486511,8 +486707,8 @@ var init_cacache = __esm(() => {
|
|
|
486511
486707
|
|
|
486512
486708
|
// src/utils/cleanup.ts
|
|
486513
486709
|
import * as fs5 from "fs/promises";
|
|
486514
|
-
import { homedir as
|
|
486515
|
-
import { join as
|
|
486710
|
+
import { homedir as homedir36 } from "os";
|
|
486711
|
+
import { join as join159 } from "path";
|
|
486516
486712
|
function getCutoffDate() {
|
|
486517
486713
|
const settings = getSettings_DEPRECATED() || {};
|
|
486518
486714
|
const cleanupPeriodDays = settings.cleanupPeriodDays ?? DEFAULT_CLEANUP_PERIOD_DAYS;
|
|
@@ -486537,7 +486733,7 @@ async function cleanupOldFilesInDirectory(dirPath, cutoffDate, isMessagePath) {
|
|
|
486537
486733
|
try {
|
|
486538
486734
|
const timestamp3 = convertFileNameToDate(file.name);
|
|
486539
486735
|
if (timestamp3 < cutoffDate) {
|
|
486540
|
-
await getFsImplementation().unlink(
|
|
486736
|
+
await getFsImplementation().unlink(join159(dirPath, file.name));
|
|
486541
486737
|
if (isMessagePath) {
|
|
486542
486738
|
result.messages++;
|
|
486543
486739
|
} else {
|
|
@@ -486568,7 +486764,7 @@ async function cleanupOldMessageFiles() {
|
|
|
486568
486764
|
} catch {
|
|
486569
486765
|
return result;
|
|
486570
486766
|
}
|
|
486571
|
-
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));
|
|
486572
486768
|
for (const mcpLogDir of mcpLogDirs) {
|
|
486573
486769
|
result = addCleanupResults(result, await cleanupOldFilesInDirectory(mcpLogDir, cutoffDate, true));
|
|
486574
486770
|
await tryRmdir(mcpLogDir, fsImpl);
|
|
@@ -486607,7 +486803,7 @@ async function cleanupOldSessionFiles() {
|
|
|
486607
486803
|
for (const projectDirent of projectDirents) {
|
|
486608
486804
|
if (!projectDirent.isDirectory())
|
|
486609
486805
|
continue;
|
|
486610
|
-
const projectDir =
|
|
486806
|
+
const projectDir = join159(projectsDir, projectDirent.name);
|
|
486611
486807
|
let entries;
|
|
486612
486808
|
try {
|
|
486613
486809
|
entries = await fsImpl.readdir(projectDir);
|
|
@@ -486621,15 +486817,15 @@ async function cleanupOldSessionFiles() {
|
|
|
486621
486817
|
continue;
|
|
486622
486818
|
}
|
|
486623
486819
|
try {
|
|
486624
|
-
if (await unlinkIfOld(
|
|
486820
|
+
if (await unlinkIfOld(join159(projectDir, entry.name), cutoffDate, fsImpl)) {
|
|
486625
486821
|
result.messages++;
|
|
486626
486822
|
}
|
|
486627
486823
|
} catch {
|
|
486628
486824
|
result.errors++;
|
|
486629
486825
|
}
|
|
486630
486826
|
} else if (entry.isDirectory()) {
|
|
486631
|
-
const sessionDir =
|
|
486632
|
-
const toolResultsDir =
|
|
486827
|
+
const sessionDir = join159(projectDir, entry.name);
|
|
486828
|
+
const toolResultsDir = join159(sessionDir, TOOL_RESULTS_SUBDIR);
|
|
486633
486829
|
let toolDirs;
|
|
486634
486830
|
try {
|
|
486635
486831
|
toolDirs = await fsImpl.readdir(toolResultsDir);
|
|
@@ -486640,14 +486836,14 @@ async function cleanupOldSessionFiles() {
|
|
|
486640
486836
|
for (const toolEntry of toolDirs) {
|
|
486641
486837
|
if (toolEntry.isFile()) {
|
|
486642
486838
|
try {
|
|
486643
|
-
if (await unlinkIfOld(
|
|
486839
|
+
if (await unlinkIfOld(join159(toolResultsDir, toolEntry.name), cutoffDate, fsImpl)) {
|
|
486644
486840
|
result.messages++;
|
|
486645
486841
|
}
|
|
486646
486842
|
} catch {
|
|
486647
486843
|
result.errors++;
|
|
486648
486844
|
}
|
|
486649
486845
|
} else if (toolEntry.isDirectory()) {
|
|
486650
|
-
const toolDirPath =
|
|
486846
|
+
const toolDirPath = join159(toolResultsDir, toolEntry.name);
|
|
486651
486847
|
let toolFiles;
|
|
486652
486848
|
try {
|
|
486653
486849
|
toolFiles = await fsImpl.readdir(toolDirPath);
|
|
@@ -486658,7 +486854,7 @@ async function cleanupOldSessionFiles() {
|
|
|
486658
486854
|
if (!tf.isFile())
|
|
486659
486855
|
continue;
|
|
486660
486856
|
try {
|
|
486661
|
-
if (await unlinkIfOld(
|
|
486857
|
+
if (await unlinkIfOld(join159(toolDirPath, tf.name), cutoffDate, fsImpl)) {
|
|
486662
486858
|
result.messages++;
|
|
486663
486859
|
}
|
|
486664
486860
|
} catch {
|
|
@@ -486690,7 +486886,7 @@ async function cleanupSingleDirectory(dirPath, extension2, removeEmptyDir = true
|
|
|
486690
486886
|
if (!dirent.isFile() || !dirent.name.endsWith(extension2))
|
|
486691
486887
|
continue;
|
|
486692
486888
|
try {
|
|
486693
|
-
if (await unlinkIfOld(
|
|
486889
|
+
if (await unlinkIfOld(join159(dirPath, dirent.name), cutoffDate, fsImpl)) {
|
|
486694
486890
|
result.messages++;
|
|
486695
486891
|
}
|
|
486696
486892
|
} catch {
|
|
@@ -486703,7 +486899,7 @@ async function cleanupSingleDirectory(dirPath, extension2, removeEmptyDir = true
|
|
|
486703
486899
|
return result;
|
|
486704
486900
|
}
|
|
486705
486901
|
function cleanupOldPlanFiles() {
|
|
486706
|
-
const plansDir =
|
|
486902
|
+
const plansDir = join159(getClaudeConfigHomeDir(), "plans");
|
|
486707
486903
|
return cleanupSingleDirectory(plansDir, ".md");
|
|
486708
486904
|
}
|
|
486709
486905
|
async function cleanupOldFileHistoryBackups() {
|
|
@@ -486712,14 +486908,14 @@ async function cleanupOldFileHistoryBackups() {
|
|
|
486712
486908
|
const fsImpl = getFsImplementation();
|
|
486713
486909
|
try {
|
|
486714
486910
|
const configDir = getClaudeConfigHomeDir();
|
|
486715
|
-
const fileHistoryStorageDir =
|
|
486911
|
+
const fileHistoryStorageDir = join159(configDir, "file-history");
|
|
486716
486912
|
let dirents;
|
|
486717
486913
|
try {
|
|
486718
486914
|
dirents = await fsImpl.readdir(fileHistoryStorageDir);
|
|
486719
486915
|
} catch {
|
|
486720
486916
|
return result;
|
|
486721
486917
|
}
|
|
486722
|
-
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
486918
|
+
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join159(fileHistoryStorageDir, dirent.name));
|
|
486723
486919
|
await Promise.all(fileHistorySessionsDirs.map(async (fileHistorySessionDir) => {
|
|
486724
486920
|
try {
|
|
486725
486921
|
const stats2 = await fsImpl.stat(fileHistorySessionDir);
|
|
@@ -486746,14 +486942,14 @@ async function cleanupOldSessionEnvDirs() {
|
|
|
486746
486942
|
const fsImpl = getFsImplementation();
|
|
486747
486943
|
try {
|
|
486748
486944
|
const configDir = getClaudeConfigHomeDir();
|
|
486749
|
-
const sessionEnvBaseDir =
|
|
486945
|
+
const sessionEnvBaseDir = join159(configDir, "session-env");
|
|
486750
486946
|
let dirents;
|
|
486751
486947
|
try {
|
|
486752
486948
|
dirents = await fsImpl.readdir(sessionEnvBaseDir);
|
|
486753
486949
|
} catch {
|
|
486754
486950
|
return result;
|
|
486755
486951
|
}
|
|
486756
|
-
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
486952
|
+
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join159(sessionEnvBaseDir, dirent.name));
|
|
486757
486953
|
for (const sessionEnvDir of sessionEnvDirs) {
|
|
486758
486954
|
try {
|
|
486759
486955
|
const stats2 = await fsImpl.stat(sessionEnvDir);
|
|
@@ -486775,7 +486971,7 @@ async function cleanupOldDebugLogs() {
|
|
|
486775
486971
|
const cutoffDate = getCutoffDate();
|
|
486776
486972
|
const result = { messages: 0, errors: 0 };
|
|
486777
486973
|
const fsImpl = getFsImplementation();
|
|
486778
|
-
const debugDir =
|
|
486974
|
+
const debugDir = join159(getClaudeConfigHomeDir(), "debug");
|
|
486779
486975
|
let dirents;
|
|
486780
486976
|
try {
|
|
486781
486977
|
dirents = await fsImpl.readdir(debugDir);
|
|
@@ -486787,7 +486983,7 @@ async function cleanupOldDebugLogs() {
|
|
|
486787
486983
|
continue;
|
|
486788
486984
|
}
|
|
486789
486985
|
try {
|
|
486790
|
-
if (await unlinkIfOld(
|
|
486986
|
+
if (await unlinkIfOld(join159(debugDir, dirent.name), cutoffDate, fsImpl)) {
|
|
486791
486987
|
result.messages++;
|
|
486792
486988
|
}
|
|
486793
486989
|
} catch {
|
|
@@ -486797,7 +486993,7 @@ async function cleanupOldDebugLogs() {
|
|
|
486797
486993
|
return result;
|
|
486798
486994
|
}
|
|
486799
486995
|
async function cleanupNpmCacheForAnthropicPackages() {
|
|
486800
|
-
const markerPath =
|
|
486996
|
+
const markerPath = join159(getClaudeConfigHomeDir(), ".npm-cache-cleanup");
|
|
486801
486997
|
try {
|
|
486802
486998
|
const stat55 = await fs5.stat(markerPath);
|
|
486803
486999
|
if (Date.now() - stat55.mtimeMs < ONE_DAY_MS) {
|
|
@@ -486812,7 +487008,7 @@ async function cleanupNpmCacheForAnthropicPackages() {
|
|
|
486812
487008
|
return;
|
|
486813
487009
|
}
|
|
486814
487010
|
logForDebugging("npm cache cleanup: starting");
|
|
486815
|
-
const npmCachePath =
|
|
487011
|
+
const npmCachePath = join159(homedir36(), ".npm", "_cacache");
|
|
486816
487012
|
const NPM_CACHE_RETENTION_COUNT = 5;
|
|
486817
487013
|
const startTime = Date.now();
|
|
486818
487014
|
try {
|
|
@@ -486867,7 +487063,7 @@ async function cleanupNpmCacheForAnthropicPackages() {
|
|
|
486867
487063
|
}
|
|
486868
487064
|
}
|
|
486869
487065
|
async function cleanupOldVersionsThrottled() {
|
|
486870
|
-
const markerPath =
|
|
487066
|
+
const markerPath = join159(getClaudeConfigHomeDir(), ".version-cleanup");
|
|
486871
487067
|
try {
|
|
486872
487068
|
const stat55 = await fs5.stat(markerPath);
|
|
486873
487069
|
if (Date.now() - stat55.mtimeMs < ONE_DAY_MS) {
|
|
@@ -490097,7 +490293,7 @@ __export(exports_asciicast, {
|
|
|
490097
490293
|
_resetRecordingStateForTesting: () => _resetRecordingStateForTesting
|
|
490098
490294
|
});
|
|
490099
490295
|
import { appendFile as appendFile6, rename as rename10 } from "fs/promises";
|
|
490100
|
-
import { basename as basename58, dirname as
|
|
490296
|
+
import { basename as basename58, dirname as dirname58, join as join161 } from "path";
|
|
490101
490297
|
function getRecordFilePath() {
|
|
490102
490298
|
if (recordingState.filePath !== null) {
|
|
490103
490299
|
return recordingState.filePath;
|
|
@@ -490108,10 +490304,10 @@ function getRecordFilePath() {
|
|
|
490108
490304
|
if (!isEnvTruthy(process.env.CLAUDE_CODE_TERMINAL_RECORDING)) {
|
|
490109
490305
|
return null;
|
|
490110
490306
|
}
|
|
490111
|
-
const projectsDir =
|
|
490112
|
-
const projectDir =
|
|
490307
|
+
const projectsDir = join161(getClaudeConfigHomeDir(), "projects");
|
|
490308
|
+
const projectDir = join161(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
490113
490309
|
recordingState.timestamp = Date.now();
|
|
490114
|
-
recordingState.filePath =
|
|
490310
|
+
recordingState.filePath = join161(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
490115
490311
|
return recordingState.filePath;
|
|
490116
490312
|
}
|
|
490117
490313
|
function _resetRecordingStateForTesting() {
|
|
@@ -490120,13 +490316,13 @@ function _resetRecordingStateForTesting() {
|
|
|
490120
490316
|
}
|
|
490121
490317
|
function getSessionRecordingPaths() {
|
|
490122
490318
|
const sessionId = getSessionId();
|
|
490123
|
-
const projectsDir =
|
|
490124
|
-
const projectDir =
|
|
490319
|
+
const projectsDir = join161(getClaudeConfigHomeDir(), "projects");
|
|
490320
|
+
const projectDir = join161(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
490125
490321
|
try {
|
|
490126
490322
|
const entries = getFsImplementation().readdirSync(projectDir);
|
|
490127
490323
|
const names = typeof entries[0] === "string" ? entries : entries.map((e) => e.name);
|
|
490128
490324
|
const files2 = names.filter((f) => f.startsWith(sessionId) && f.endsWith(".cast")).sort();
|
|
490129
|
-
return files2.map((f) =>
|
|
490325
|
+
return files2.map((f) => join161(projectDir, f));
|
|
490130
490326
|
} catch {
|
|
490131
490327
|
return [];
|
|
490132
490328
|
}
|
|
@@ -490136,9 +490332,9 @@ async function renameRecordingForSession() {
|
|
|
490136
490332
|
if (!oldPath || recordingState.timestamp === 0) {
|
|
490137
490333
|
return;
|
|
490138
490334
|
}
|
|
490139
|
-
const projectsDir =
|
|
490140
|
-
const projectDir =
|
|
490141
|
-
const newPath =
|
|
490335
|
+
const projectsDir = join161(getClaudeConfigHomeDir(), "projects");
|
|
490336
|
+
const projectDir = join161(projectsDir, sanitizePath2(getOriginalCwd()));
|
|
490337
|
+
const newPath = join161(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
490142
490338
|
if (oldPath === newPath) {
|
|
490143
490339
|
return;
|
|
490144
490340
|
}
|
|
@@ -490179,7 +490375,7 @@ function installAsciicastRecorder() {
|
|
|
490179
490375
|
}
|
|
490180
490376
|
});
|
|
490181
490377
|
try {
|
|
490182
|
-
getFsImplementation().mkdirSync(
|
|
490378
|
+
getFsImplementation().mkdirSync(dirname58(filePath));
|
|
490183
490379
|
} catch {}
|
|
490184
490380
|
getFsImplementation().appendFileSync(filePath, header + `
|
|
490185
490381
|
`, { mode: 384 });
|
|
@@ -490248,7 +490444,7 @@ var init_asciicast = __esm(() => {
|
|
|
490248
490444
|
});
|
|
490249
490445
|
|
|
490250
490446
|
// src/utils/sessionRestore.ts
|
|
490251
|
-
import { dirname as
|
|
490447
|
+
import { dirname as dirname59 } from "path";
|
|
490252
490448
|
function extractTodosFromTranscript(messages) {
|
|
490253
490449
|
for (let i2 = messages.length - 1;i2 >= 0; i2--) {
|
|
490254
490450
|
const msg = messages[i2];
|
|
@@ -490373,7 +490569,7 @@ async function processResumedConversation(result, opts, context8) {
|
|
|
490373
490569
|
if (!opts.forkSession) {
|
|
490374
490570
|
const sid = opts.sessionIdOverride ?? result.sessionId;
|
|
490375
490571
|
if (sid) {
|
|
490376
|
-
switchSession(asSessionId(sid), opts.transcriptPath ?
|
|
490572
|
+
switchSession(asSessionId(sid), opts.transcriptPath ? dirname59(opts.transcriptPath) : null);
|
|
490377
490573
|
await renameRecordingForSession();
|
|
490378
490574
|
await resetSessionFilePointer();
|
|
490379
490575
|
restoreCostStateForSession(sid);
|
|
@@ -491720,7 +491916,7 @@ var init_useDynamicConfig = __esm(() => {
|
|
|
491720
491916
|
});
|
|
491721
491917
|
|
|
491722
491918
|
// src/components/FeedbackSurvey/submitTranscriptShare.ts
|
|
491723
|
-
import { readFile as
|
|
491919
|
+
import { readFile as readFile69, stat as stat55 } from "fs/promises";
|
|
491724
491920
|
async function submitTranscriptShare(messages, trigger, appearanceId) {
|
|
491725
491921
|
try {
|
|
491726
491922
|
logForDebugging("Collecting transcript for sharing", { level: "info" });
|
|
@@ -491732,14 +491928,14 @@ async function submitTranscriptShare(messages, trigger, appearanceId) {
|
|
|
491732
491928
|
const transcriptPath = getTranscriptPath();
|
|
491733
491929
|
const { size } = await stat55(transcriptPath);
|
|
491734
491930
|
if (size <= MAX_TRANSCRIPT_READ_BYTES) {
|
|
491735
|
-
rawTranscriptJsonl = await
|
|
491931
|
+
rawTranscriptJsonl = await readFile69(transcriptPath, "utf-8");
|
|
491736
491932
|
} else {
|
|
491737
491933
|
logForDebugging(`Skipping raw transcript read: file too large (${size} bytes)`, { level: "warn" });
|
|
491738
491934
|
}
|
|
491739
491935
|
} catch {}
|
|
491740
491936
|
const data = {
|
|
491741
491937
|
trigger,
|
|
491742
|
-
version: "2.
|
|
491938
|
+
version: "2.3.0",
|
|
491743
491939
|
platform: process.platform,
|
|
491744
491940
|
transcript,
|
|
491745
491941
|
subagentTranscripts: Object.keys(subagentTranscripts).length > 0 ? subagentTranscripts : undefined,
|
|
@@ -493015,7 +493211,7 @@ var init_useAwaySummary = __esm(() => {
|
|
|
493015
493211
|
});
|
|
493016
493212
|
|
|
493017
493213
|
// src/utils/plugins/officialMarketplaceStartupCheck.ts
|
|
493018
|
-
import { join as
|
|
493214
|
+
import { join as join162 } from "path";
|
|
493019
493215
|
function isOfficialMarketplaceAutoInstallDisabled() {
|
|
493020
493216
|
return isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL);
|
|
493021
493217
|
}
|
|
@@ -493098,7 +493294,7 @@ async function checkAndInstallOfficialMarketplace() {
|
|
|
493098
493294
|
return { installed: false, skipped: true, reason: "policy_blocked" };
|
|
493099
493295
|
}
|
|
493100
493296
|
const cacheDir = getMarketplacesCacheDir();
|
|
493101
|
-
const installLocation =
|
|
493297
|
+
const installLocation = join162(cacheDir, OFFICIAL_MARKETPLACE_NAME);
|
|
493102
493298
|
const gcsSha = await fetchOfficialMarketplaceFromGcs(installLocation, cacheDir);
|
|
493103
493299
|
if (gcsSha !== null) {
|
|
493104
493300
|
const known = await loadKnownMarketplacesConfig();
|
|
@@ -493354,7 +493550,7 @@ var init_tipHistory = __esm(() => {
|
|
|
493354
493550
|
|
|
493355
493551
|
// src/utils/desktopDeepLink.ts
|
|
493356
493552
|
import { readdir as readdir39 } from "fs/promises";
|
|
493357
|
-
import { join as
|
|
493553
|
+
import { join as join163 } from "path";
|
|
493358
493554
|
function isDevMode() {
|
|
493359
493555
|
if (true) {
|
|
493360
493556
|
return true;
|
|
@@ -493417,7 +493613,7 @@ async function getDesktopVersion() {
|
|
|
493417
493613
|
if (!localAppData) {
|
|
493418
493614
|
return null;
|
|
493419
493615
|
}
|
|
493420
|
-
const installDir =
|
|
493616
|
+
const installDir = join163(localAppData, "AnthropicClaude");
|
|
493421
493617
|
try {
|
|
493422
493618
|
const entries = await readdir39(installDir);
|
|
493423
493619
|
const versions = entries.filter((e) => e.startsWith("app-")).map((e) => e.slice(4)).filter((v2) => import_semver14.coerce(v2) !== null).sort((a, b3) => {
|
|
@@ -496449,7 +496645,7 @@ var init_usePluginRecommendationBase = __esm(() => {
|
|
|
496449
496645
|
});
|
|
496450
496646
|
|
|
496451
496647
|
// src/hooks/useLspPluginRecommendation.tsx
|
|
496452
|
-
import { extname as extname16, join as
|
|
496648
|
+
import { extname as extname16, join as join164 } from "path";
|
|
496453
496649
|
function useLspPluginRecommendation() {
|
|
496454
496650
|
const $2 = c3(12);
|
|
496455
496651
|
const trackedFiles = useAppState(_temp201);
|
|
@@ -496534,7 +496730,7 @@ function useLspPluginRecommendation() {
|
|
|
496534
496730
|
case "yes": {
|
|
496535
496731
|
installPluginAndNotify(pluginId, pluginName, "lsp-plugin", addNotification, async (pluginData) => {
|
|
496536
496732
|
logForDebugging(`[useLspPluginRecommendation] Installing plugin: ${pluginId}`);
|
|
496537
|
-
const localSourcePath = typeof pluginData.entry.source === "string" ?
|
|
496733
|
+
const localSourcePath = typeof pluginData.entry.source === "string" ? join164(pluginData.marketplaceInstallLocation, pluginData.entry.source) : undefined;
|
|
496538
496734
|
await cacheAndRegisterPlugin(pluginId, pluginData.entry, "user", undefined, localSourcePath);
|
|
496539
496735
|
const settings = getSettingsForSource("userSettings");
|
|
496540
496736
|
updateSettingsForSource("userSettings", {
|
|
@@ -499366,9 +499562,9 @@ var exports_REPL = {};
|
|
|
499366
499562
|
__export(exports_REPL, {
|
|
499367
499563
|
REPL: () => REPL
|
|
499368
499564
|
});
|
|
499369
|
-
import { dirname as
|
|
499565
|
+
import { dirname as dirname60, join as join165 } from "path";
|
|
499370
499566
|
import { tmpdir as tmpdir11 } from "os";
|
|
499371
|
-
import { writeFile as
|
|
499567
|
+
import { writeFile as writeFile64 } from "fs/promises";
|
|
499372
499568
|
import { randomUUID as randomUUID47 } from "crypto";
|
|
499373
499569
|
function TranscriptModeFooter(t0) {
|
|
499374
499570
|
const $2 = c3(9);
|
|
@@ -500304,7 +500500,7 @@ function REPL({
|
|
|
500304
500500
|
const targetSessionCosts = getStoredSessionCosts(sessionId);
|
|
500305
500501
|
saveCurrentSessionCosts();
|
|
500306
500502
|
resetCostState();
|
|
500307
|
-
switchSession(asSessionId(sessionId), log2.fullPath ?
|
|
500503
|
+
switchSession(asSessionId(sessionId), log2.fullPath ? dirname60(log2.fullPath) : null);
|
|
500308
500504
|
const {
|
|
500309
500505
|
renameRecordingForSession: renameRecordingForSession2
|
|
500310
500506
|
} = await Promise.resolve().then(() => (init_asciicast(), exports_asciicast));
|
|
@@ -501936,8 +502132,8 @@ Note: ctrl + z now suspends localclawd, ctrl + _ undoes input.
|
|
|
501936
502132
|
const w2 = Math.max(80, (process.stdout.columns ?? 80) - 6);
|
|
501937
502133
|
const raw = await renderMessagesToPlainText(deferredMessages, tools, w2);
|
|
501938
502134
|
const text = raw.replace(/[ \t]+$/gm, "");
|
|
501939
|
-
const path17 =
|
|
501940
|
-
await
|
|
502135
|
+
const path17 = join165(tmpdir11(), `cc-transcript-${Date.now()}.txt`);
|
|
502136
|
+
await writeFile64(path17, text);
|
|
501941
502137
|
const opened = openFileInExternalEditor(path17);
|
|
501942
502138
|
setStatus(opened ? `opening ${path17}` : `wrote ${path17} · no $VISUAL/$EDITOR set`);
|
|
501943
502139
|
} catch (e) {
|
|
@@ -503600,7 +503796,7 @@ var exports_TrustDialog = {};
|
|
|
503600
503796
|
__export(exports_TrustDialog, {
|
|
503601
503797
|
TrustDialog: () => TrustDialog
|
|
503602
503798
|
});
|
|
503603
|
-
import { homedir as
|
|
503799
|
+
import { homedir as homedir37 } from "os";
|
|
503604
503800
|
function TrustDialog({ onDone }) {
|
|
503605
503801
|
const [focusIdx, setFocusIdx] = import_react307.useState(0);
|
|
503606
503802
|
const doneRef = import_react307.useRef(false);
|
|
@@ -503618,7 +503814,7 @@ function TrustDialog({ onDone }) {
|
|
|
503618
503814
|
gracefulShutdownSync(1);
|
|
503619
503815
|
} else {
|
|
503620
503816
|
try {
|
|
503621
|
-
if (
|
|
503817
|
+
if (homedir37() !== getCwd()) {
|
|
503622
503818
|
try {
|
|
503623
503819
|
saveCurrentProjectConfig((c5) => ({ ...c5, hasTrustDialogAccepted: true }));
|
|
503624
503820
|
} catch {}
|
|
@@ -504947,7 +505143,7 @@ var exports_ResumeConversation = {};
|
|
|
504947
505143
|
__export(exports_ResumeConversation, {
|
|
504948
505144
|
ResumeConversation: () => ResumeConversation
|
|
504949
505145
|
});
|
|
504950
|
-
import { dirname as
|
|
505146
|
+
import { dirname as dirname61 } from "path";
|
|
504951
505147
|
function parsePrIdentifier(value) {
|
|
504952
505148
|
const directNumber = parseInt(value, 10);
|
|
504953
505149
|
if (!isNaN(directNumber) && directNumber > 0) {
|
|
@@ -505079,7 +505275,7 @@ function ResumeConversation({
|
|
|
505079
505275
|
}
|
|
505080
505276
|
if (false) {}
|
|
505081
505277
|
if (result_3.sessionId && !forkSession) {
|
|
505082
|
-
switchSession(asSessionId(result_3.sessionId), log_0.fullPath ?
|
|
505278
|
+
switchSession(asSessionId(result_3.sessionId), log_0.fullPath ? dirname61(log_0.fullPath) : null);
|
|
505083
505279
|
await renameRecordingForSession();
|
|
505084
505280
|
await resetSessionFilePointer();
|
|
505085
505281
|
restoreCostStateForSession(result_3.sessionId);
|
|
@@ -508663,12 +508859,12 @@ var init_createDirectConnectSession = __esm(() => {
|
|
|
508663
508859
|
});
|
|
508664
508860
|
|
|
508665
508861
|
// src/utils/errorLogSink.ts
|
|
508666
|
-
import { dirname as
|
|
508862
|
+
import { dirname as dirname62, join as join166 } from "path";
|
|
508667
508863
|
function getErrorsPath() {
|
|
508668
|
-
return
|
|
508864
|
+
return join166(CACHE_PATHS.errors(), DATE + ".jsonl");
|
|
508669
508865
|
}
|
|
508670
508866
|
function getMCPLogsPath(serverName) {
|
|
508671
|
-
return
|
|
508867
|
+
return join166(CACHE_PATHS.mcpLogs(serverName), DATE + ".jsonl");
|
|
508672
508868
|
}
|
|
508673
508869
|
function createJsonlWriter(options) {
|
|
508674
508870
|
const writer = createBufferedWriter(options);
|
|
@@ -508684,7 +508880,7 @@ function createJsonlWriter(options) {
|
|
|
508684
508880
|
function getLogWriter(path17) {
|
|
508685
508881
|
let writer = logWriters.get(path17);
|
|
508686
508882
|
if (!writer) {
|
|
508687
|
-
const dir =
|
|
508883
|
+
const dir = dirname62(path17);
|
|
508688
508884
|
writer = createJsonlWriter({
|
|
508689
508885
|
writeFn: (content) => {
|
|
508690
508886
|
try {
|
|
@@ -508712,7 +508908,7 @@ function appendToLog(path17, message) {
|
|
|
508712
508908
|
cwd: getFsImplementation().cwd(),
|
|
508713
508909
|
userType: process.env.USER_TYPE,
|
|
508714
508910
|
sessionId: getSessionId(),
|
|
508715
|
-
version: "2.
|
|
508911
|
+
version: "2.3.0"
|
|
508716
508912
|
};
|
|
508717
508913
|
getLogWriter(path17).write(messageWithTimestamp);
|
|
508718
508914
|
}
|
|
@@ -508812,8 +509008,8 @@ var init_sinks = __esm(() => {
|
|
|
508812
509008
|
|
|
508813
509009
|
// src/utils/iTermBackup.ts
|
|
508814
509010
|
import { copyFile as copyFile11, stat as stat57 } from "fs/promises";
|
|
508815
|
-
import { homedir as
|
|
508816
|
-
import { join as
|
|
509011
|
+
import { homedir as homedir38 } from "os";
|
|
509012
|
+
import { join as join167 } from "path";
|
|
508817
509013
|
function markITerm2SetupComplete() {
|
|
508818
509014
|
saveGlobalConfig((current) => ({
|
|
508819
509015
|
...current,
|
|
@@ -508828,7 +509024,7 @@ function getIterm2RecoveryInfo() {
|
|
|
508828
509024
|
};
|
|
508829
509025
|
}
|
|
508830
509026
|
function getITerm2PlistPath() {
|
|
508831
|
-
return
|
|
509027
|
+
return join167(homedir38(), "Library", "Preferences", "com.googlecode.iterm2.plist");
|
|
508832
509028
|
}
|
|
508833
509029
|
async function checkAndRestoreITerm2Backup() {
|
|
508834
509030
|
const { inProgress, backupPath } = getIterm2RecoveryInfo();
|
|
@@ -512204,8 +512400,8 @@ var init_idleTimeout = __esm(() => {
|
|
|
512204
512400
|
|
|
512205
512401
|
// src/bridge/inboundAttachments.ts
|
|
512206
512402
|
import { randomUUID as randomUUID50 } from "crypto";
|
|
512207
|
-
import { mkdir as
|
|
512208
|
-
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";
|
|
512209
512405
|
import { z as z95 } from "zod/v4";
|
|
512210
512406
|
function debug3(msg) {
|
|
512211
512407
|
logForDebugging(`[bridge:inbound-attach] ${msg}`);
|
|
@@ -512222,7 +512418,7 @@ function sanitizeFileName(name) {
|
|
|
512222
512418
|
return base || "attachment";
|
|
512223
512419
|
}
|
|
512224
512420
|
function uploadsDir() {
|
|
512225
|
-
return
|
|
512421
|
+
return join168(getClaudeConfigHomeDir(), "uploads", getSessionId());
|
|
512226
512422
|
}
|
|
512227
512423
|
async function resolveOne(att) {
|
|
512228
512424
|
const token = getBridgeAccessToken();
|
|
@@ -512251,10 +512447,10 @@ async function resolveOne(att) {
|
|
|
512251
512447
|
const safeName = sanitizeFileName(att.file_name);
|
|
512252
512448
|
const prefix = (att.file_uuid.slice(0, 8) || randomUUID50().slice(0, 8)).replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
512253
512449
|
const dir = uploadsDir();
|
|
512254
|
-
const outPath =
|
|
512450
|
+
const outPath = join168(dir, `${prefix}-${safeName}`);
|
|
512255
512451
|
try {
|
|
512256
|
-
await
|
|
512257
|
-
await
|
|
512452
|
+
await mkdir62(dir, { recursive: true });
|
|
512453
|
+
await writeFile65(outPath, data);
|
|
512258
512454
|
} catch (e) {
|
|
512259
512455
|
debug3(`write ${outPath} failed: ${e}`);
|
|
512260
512456
|
return;
|
|
@@ -512349,11 +512545,11 @@ var init_sessionUrl = __esm(() => {
|
|
|
512349
512545
|
});
|
|
512350
512546
|
|
|
512351
512547
|
// src/utils/plugins/zipCacheAdapters.ts
|
|
512352
|
-
import { readFile as
|
|
512353
|
-
import { join as
|
|
512548
|
+
import { readFile as readFile70 } from "fs/promises";
|
|
512549
|
+
import { join as join169 } from "path";
|
|
512354
512550
|
async function readZipCacheKnownMarketplaces() {
|
|
512355
512551
|
try {
|
|
512356
|
-
const content = await
|
|
512552
|
+
const content = await readFile70(getZipCacheKnownMarketplacesPath(), "utf-8");
|
|
512357
512553
|
const parsed = KnownMarketplacesFileSchema().safeParse(jsonParse(content));
|
|
512358
512554
|
if (!parsed.success) {
|
|
512359
512555
|
logForDebugging(`Invalid known_marketplaces.json in zip cache: ${parsed.error.message}`, { level: "error" });
|
|
@@ -512375,18 +512571,18 @@ async function saveMarketplaceJsonToZipCache(marketplaceName, installLocation) {
|
|
|
512375
512571
|
const content = await readMarketplaceJsonContent(installLocation);
|
|
512376
512572
|
if (content !== null) {
|
|
512377
512573
|
const relPath = getMarketplaceJsonRelativePath(marketplaceName);
|
|
512378
|
-
await atomicWriteToZipCache(
|
|
512574
|
+
await atomicWriteToZipCache(join169(zipCachePath, relPath), content);
|
|
512379
512575
|
}
|
|
512380
512576
|
}
|
|
512381
512577
|
async function readMarketplaceJsonContent(dir) {
|
|
512382
512578
|
const candidates = [
|
|
512383
|
-
|
|
512384
|
-
|
|
512579
|
+
join169(dir, ".claude-plugin", "marketplace.json"),
|
|
512580
|
+
join169(dir, "marketplace.json"),
|
|
512385
512581
|
dir
|
|
512386
512582
|
];
|
|
512387
512583
|
for (const candidate of candidates) {
|
|
512388
512584
|
try {
|
|
512389
|
-
return await
|
|
512585
|
+
return await readFile70(candidate, "utf-8");
|
|
512390
512586
|
} catch {}
|
|
512391
512587
|
}
|
|
512392
512588
|
return null;
|
|
@@ -512511,8 +512707,8 @@ async function getEnvLessBridgeConfig() {
|
|
|
512511
512707
|
}
|
|
512512
512708
|
async function checkEnvLessBridgeMinVersion() {
|
|
512513
512709
|
const cfg = await getEnvLessBridgeConfig();
|
|
512514
|
-
if (cfg.min_version && lt("2.
|
|
512515
|
-
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.
|
|
512516
512712
|
Version ${cfg.min_version} or higher is required. Run \`localclawd update\` to update.`;
|
|
512517
512713
|
}
|
|
512518
512714
|
return null;
|
|
@@ -512837,17 +513033,17 @@ __export(exports_bridgePointer, {
|
|
|
512837
513033
|
clearBridgePointer: () => clearBridgePointer,
|
|
512838
513034
|
BRIDGE_POINTER_TTL_MS: () => BRIDGE_POINTER_TTL_MS
|
|
512839
513035
|
});
|
|
512840
|
-
import { mkdir as
|
|
512841
|
-
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";
|
|
512842
513038
|
import { z as z97 } from "zod/v4";
|
|
512843
513039
|
function getBridgePointerPath(dir) {
|
|
512844
|
-
return
|
|
513040
|
+
return join170(getProjectsDir(), sanitizePath2(dir), "bridge-pointer.json");
|
|
512845
513041
|
}
|
|
512846
513042
|
async function writeBridgePointer(dir, pointer) {
|
|
512847
513043
|
const path17 = getBridgePointerPath(dir);
|
|
512848
513044
|
try {
|
|
512849
|
-
await
|
|
512850
|
-
await
|
|
513045
|
+
await mkdir63(dirname63(path17), { recursive: true });
|
|
513046
|
+
await writeFile66(path17, jsonStringify(pointer), "utf8");
|
|
512851
513047
|
logForDebugging(`[bridge:pointer] wrote ${path17}`);
|
|
512852
513048
|
} catch (err2) {
|
|
512853
513049
|
logForDebugging(`[bridge:pointer] write failed: ${err2}`, { level: "warn" });
|
|
@@ -512859,7 +513055,7 @@ async function readBridgePointer(dir) {
|
|
|
512859
513055
|
let mtimeMs;
|
|
512860
513056
|
try {
|
|
512861
513057
|
mtimeMs = (await stat58(path17)).mtimeMs;
|
|
512862
|
-
raw = await
|
|
513058
|
+
raw = await readFile71(path17, "utf8");
|
|
512863
513059
|
} catch {
|
|
512864
513060
|
return null;
|
|
512865
513061
|
}
|
|
@@ -512984,7 +513180,7 @@ async function initBridgeCore(params) {
|
|
|
512984
513180
|
const rawApi = createBridgeApiClient({
|
|
512985
513181
|
baseUrl,
|
|
512986
513182
|
getAccessToken,
|
|
512987
|
-
runnerVersion: "2.
|
|
513183
|
+
runnerVersion: "2.3.0",
|
|
512988
513184
|
onDebug: logForDebugging,
|
|
512989
513185
|
onAuth401,
|
|
512990
513186
|
getTrustedDeviceToken
|
|
@@ -514845,8 +515041,8 @@ __export(exports_print, {
|
|
|
514845
515041
|
createCanUseToolWithPermissionPrompt: () => createCanUseToolWithPermissionPrompt,
|
|
514846
515042
|
canBatchWith: () => canBatchWith
|
|
514847
515043
|
});
|
|
514848
|
-
import { readFile as
|
|
514849
|
-
import { dirname as
|
|
515044
|
+
import { readFile as readFile72, stat as stat59 } from "fs/promises";
|
|
515045
|
+
import { dirname as dirname64 } from "path";
|
|
514850
515046
|
import { cwd as cwd2 } from "process";
|
|
514851
515047
|
import { randomUUID as randomUUID53 } from "crypto";
|
|
514852
515048
|
function trackReceivedMessageUuid(uuid2) {
|
|
@@ -516195,7 +516391,7 @@ ${m2.text}
|
|
|
516195
516391
|
const normalizedPath = expandPath(message.request.path);
|
|
516196
516392
|
const diskMtime = Math.floor((await stat59(normalizedPath)).mtimeMs);
|
|
516197
516393
|
if (diskMtime <= message.request.mtime) {
|
|
516198
|
-
const raw = await
|
|
516394
|
+
const raw = await readFile72(normalizedPath, "utf-8");
|
|
516199
516395
|
const content = (raw.charCodeAt(0) === 65279 ? raw.slice(1) : raw).replaceAll(`\r
|
|
516200
516396
|
`, `
|
|
516201
516397
|
`);
|
|
@@ -517281,7 +517477,7 @@ async function loadInitialMessages(setAppState, options) {
|
|
|
517281
517477
|
if (false) {}
|
|
517282
517478
|
if (!options.forkSession) {
|
|
517283
517479
|
if (result.sessionId) {
|
|
517284
|
-
switchSession(asSessionId(result.sessionId), result.fullPath ?
|
|
517480
|
+
switchSession(asSessionId(result.sessionId), result.fullPath ? dirname64(result.fullPath) : null);
|
|
517285
517481
|
if (persistSession) {
|
|
517286
517482
|
await resetSessionFilePointer();
|
|
517287
517483
|
}
|
|
@@ -517379,7 +517575,7 @@ async function loadInitialMessages(setAppState, options) {
|
|
|
517379
517575
|
}
|
|
517380
517576
|
if (false) {}
|
|
517381
517577
|
if (!options.forkSession && result.sessionId) {
|
|
517382
|
-
switchSession(asSessionId(result.sessionId), result.fullPath ?
|
|
517578
|
+
switchSession(asSessionId(result.sessionId), result.fullPath ? dirname64(result.fullPath) : null);
|
|
517383
517579
|
if (persistSession) {
|
|
517384
517580
|
await resetSessionFilePointer();
|
|
517385
517581
|
}
|
|
@@ -518703,7 +518899,7 @@ async function startMCPServer(cwd3, debug4, verbose) {
|
|
|
518703
518899
|
setCwd(cwd3);
|
|
518704
518900
|
const server = new Server({
|
|
518705
518901
|
name: "claude/tengu",
|
|
518706
|
-
version: "2.
|
|
518902
|
+
version: "2.3.0"
|
|
518707
518903
|
}, {
|
|
518708
518904
|
capabilities: {
|
|
518709
518905
|
tools: {}
|
|
@@ -518833,16 +519029,16 @@ __export(exports_appDesktop, {
|
|
|
518833
519029
|
readClaudeDesktopMcpServers: () => readClaudeDesktopMcpServers,
|
|
518834
519030
|
getClaudeDesktopConfigPath: () => getClaudeDesktopConfigPath
|
|
518835
519031
|
});
|
|
518836
|
-
import { readdir as readdir40, readFile as
|
|
518837
|
-
import { homedir as
|
|
518838
|
-
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";
|
|
518839
519035
|
async function getClaudeDesktopConfigPath() {
|
|
518840
519036
|
const platform3 = getPlatform();
|
|
518841
519037
|
if (!SUPPORTED_PLATFORMS.includes(platform3)) {
|
|
518842
519038
|
throw new Error(`Unsupported platform: ${platform3} - desktop app integration only works on macOS and WSL.`);
|
|
518843
519039
|
}
|
|
518844
519040
|
if (platform3 === "macos") {
|
|
518845
|
-
return
|
|
519041
|
+
return join171(homedir39(), "Library", "Application Support", "Claude", "claude_desktop_config.json");
|
|
518846
519042
|
}
|
|
518847
519043
|
const windowsHome = process.env.USERPROFILE ? process.env.USERPROFILE.replace(/\\/g, "/") : null;
|
|
518848
519044
|
if (windowsHome) {
|
|
@@ -518861,7 +519057,7 @@ async function getClaudeDesktopConfigPath() {
|
|
|
518861
519057
|
if (user.name === "Public" || user.name === "Default" || user.name === "Default User" || user.name === "All Users") {
|
|
518862
519058
|
continue;
|
|
518863
519059
|
}
|
|
518864
|
-
const potentialConfigPath =
|
|
519060
|
+
const potentialConfigPath = join171(usersDir, user.name, "AppData", "Roaming", "Claude", "claude_desktop_config.json");
|
|
518865
519061
|
try {
|
|
518866
519062
|
await stat60(potentialConfigPath);
|
|
518867
519063
|
return potentialConfigPath;
|
|
@@ -518881,7 +519077,7 @@ async function readClaudeDesktopMcpServers() {
|
|
|
518881
519077
|
const configPath = await getClaudeDesktopConfigPath();
|
|
518882
519078
|
let configContent;
|
|
518883
519079
|
try {
|
|
518884
|
-
configContent = await
|
|
519080
|
+
configContent = await readFile73(configPath, { encoding: "utf8" });
|
|
518885
519081
|
} catch (e) {
|
|
518886
519082
|
const code = getErrnoCode(e);
|
|
518887
519083
|
if (code === "ENOENT") {
|
|
@@ -519256,7 +519452,7 @@ __export(exports_plugins, {
|
|
|
519256
519452
|
VALID_UPDATE_SCOPES: () => VALID_UPDATE_SCOPES,
|
|
519257
519453
|
VALID_INSTALLABLE_SCOPES: () => VALID_INSTALLABLE_SCOPES
|
|
519258
519454
|
});
|
|
519259
|
-
import { basename as basename60, dirname as
|
|
519455
|
+
import { basename as basename60, dirname as dirname65 } from "path";
|
|
519260
519456
|
function handleMarketplaceError(error5, action2) {
|
|
519261
519457
|
logError(error5);
|
|
519262
519458
|
cliError(`${figures_default.cross} Failed to ${action2}: ${errorMessage(error5)}`);
|
|
@@ -519289,9 +519485,9 @@ async function pluginValidateHandler(manifestPath, options) {
|
|
|
519289
519485
|
printValidationResult(result);
|
|
519290
519486
|
let contentResults = [];
|
|
519291
519487
|
if (result.fileType === "plugin") {
|
|
519292
|
-
const manifestDir =
|
|
519488
|
+
const manifestDir = dirname65(result.filePath);
|
|
519293
519489
|
if (basename60(manifestDir) === ".claude-plugin") {
|
|
519294
|
-
contentResults = await validatePluginContents(
|
|
519490
|
+
contentResults = await validatePluginContents(dirname65(manifestDir));
|
|
519295
519491
|
for (const r of contentResults) {
|
|
519296
519492
|
console.log(`Validating ${r.fileType}: ${r.filePath}
|
|
519297
519493
|
`);
|
|
@@ -519784,7 +519980,7 @@ function WelcomeLogo() {
|
|
|
519784
519980
|
dimColor: true,
|
|
519785
519981
|
children: [
|
|
519786
519982
|
"v",
|
|
519787
|
-
"2.
|
|
519983
|
+
"2.3.0"
|
|
519788
519984
|
]
|
|
519789
519985
|
}, undefined, true, undefined, this)
|
|
519790
519986
|
]
|
|
@@ -519975,7 +520171,7 @@ __export(exports_update, {
|
|
|
519975
520171
|
});
|
|
519976
520172
|
async function update() {
|
|
519977
520173
|
logEvent("tengu_update_check", {});
|
|
519978
|
-
writeToStdout(`Current version: ${"2.
|
|
520174
|
+
writeToStdout(`Current version: ${"2.3.0"}
|
|
519979
520175
|
`);
|
|
519980
520176
|
const channel = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
519981
520177
|
writeToStdout(`Checking for updates to ${channel} version...
|
|
@@ -520050,8 +520246,8 @@ async function update() {
|
|
|
520050
520246
|
writeToStdout(`localclawd is managed by Homebrew.
|
|
520051
520247
|
`);
|
|
520052
520248
|
const latest = await getLatestVersion(channel);
|
|
520053
|
-
if (latest && !gte("2.
|
|
520054
|
-
writeToStdout(`Update available: ${"2.
|
|
520249
|
+
if (latest && !gte("2.3.0", latest)) {
|
|
520250
|
+
writeToStdout(`Update available: ${"2.3.0"} → ${latest}
|
|
520055
520251
|
`);
|
|
520056
520252
|
writeToStdout(`
|
|
520057
520253
|
`);
|
|
@@ -520067,8 +520263,8 @@ async function update() {
|
|
|
520067
520263
|
writeToStdout(`localclawd is managed by winget.
|
|
520068
520264
|
`);
|
|
520069
520265
|
const latest = await getLatestVersion(channel);
|
|
520070
|
-
if (latest && !gte("2.
|
|
520071
|
-
writeToStdout(`Update available: ${"2.
|
|
520266
|
+
if (latest && !gte("2.3.0", latest)) {
|
|
520267
|
+
writeToStdout(`Update available: ${"2.3.0"} → ${latest}
|
|
520072
520268
|
`);
|
|
520073
520269
|
writeToStdout(`
|
|
520074
520270
|
`);
|
|
@@ -520082,8 +520278,8 @@ async function update() {
|
|
|
520082
520278
|
writeToStdout(`localclawd is managed by apk.
|
|
520083
520279
|
`);
|
|
520084
520280
|
const latest = await getLatestVersion(channel);
|
|
520085
|
-
if (latest && !gte("2.
|
|
520086
|
-
writeToStdout(`Update available: ${"2.
|
|
520281
|
+
if (latest && !gte("2.3.0", latest)) {
|
|
520282
|
+
writeToStdout(`Update available: ${"2.3.0"} → ${latest}
|
|
520087
520283
|
`);
|
|
520088
520284
|
writeToStdout(`
|
|
520089
520285
|
`);
|
|
@@ -520148,11 +520344,11 @@ async function update() {
|
|
|
520148
520344
|
`);
|
|
520149
520345
|
await gracefulShutdown(1);
|
|
520150
520346
|
}
|
|
520151
|
-
if (result.latestVersion === "2.
|
|
520152
|
-
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"})`) + `
|
|
520153
520349
|
`);
|
|
520154
520350
|
} else {
|
|
520155
|
-
writeToStdout(source_default.green(`Successfully updated from ${"2.
|
|
520351
|
+
writeToStdout(source_default.green(`Successfully updated from ${"2.3.0"} to version ${result.latestVersion}`) + `
|
|
520156
520352
|
`);
|
|
520157
520353
|
await regenerateCompletionCache();
|
|
520158
520354
|
}
|
|
@@ -520212,12 +520408,12 @@ async function update() {
|
|
|
520212
520408
|
`);
|
|
520213
520409
|
await gracefulShutdown(1);
|
|
520214
520410
|
}
|
|
520215
|
-
if (latestVersion === "2.
|
|
520216
|
-
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"})`) + `
|
|
520217
520413
|
`);
|
|
520218
520414
|
await gracefulShutdown(0);
|
|
520219
520415
|
}
|
|
520220
|
-
writeToStdout(`New version available: ${latestVersion} (current: ${"2.
|
|
520416
|
+
writeToStdout(`New version available: ${latestVersion} (current: ${"2.3.0"})
|
|
520221
520417
|
`);
|
|
520222
520418
|
writeToStdout(`Installing update...
|
|
520223
520419
|
`);
|
|
@@ -520262,7 +520458,7 @@ async function update() {
|
|
|
520262
520458
|
logForDebugging(`update: Installation status: ${status2}`);
|
|
520263
520459
|
switch (status2) {
|
|
520264
520460
|
case "success":
|
|
520265
|
-
writeToStdout(source_default.green(`Successfully updated from ${"2.
|
|
520461
|
+
writeToStdout(source_default.green(`Successfully updated from ${"2.3.0"} to version ${latestVersion}`) + `
|
|
520266
520462
|
`);
|
|
520267
520463
|
await regenerateCompletionCache();
|
|
520268
520464
|
break;
|
|
@@ -521504,7 +521700,7 @@ Run with --debug for more details.
|
|
|
521504
521700
|
}
|
|
521505
521701
|
}
|
|
521506
521702
|
logForDiagnosticsNoPII("info", "started", {
|
|
521507
|
-
version: "2.
|
|
521703
|
+
version: "2.3.0",
|
|
521508
521704
|
is_native_binary: isInBundledMode()
|
|
521509
521705
|
});
|
|
521510
521706
|
registerCleanup(async () => {
|
|
@@ -522288,7 +522484,7 @@ Usage: localclawd --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
522288
522484
|
pendingHookMessages
|
|
522289
522485
|
}, renderAndRun);
|
|
522290
522486
|
}
|
|
522291
|
-
}).version("2.
|
|
522487
|
+
}).version("2.3.0 (localclawd)", "-v, --version", "Output the version number");
|
|
522292
522488
|
program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
522293
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.");
|
|
522294
522490
|
if (canUserConfigureAdvisor()) {
|
|
@@ -522802,7 +522998,7 @@ if (false) {}
|
|
|
522802
522998
|
async function main2() {
|
|
522803
522999
|
const args = process.argv.slice(2);
|
|
522804
523000
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
522805
|
-
console.log(`${"2.
|
|
523001
|
+
console.log(`${"2.3.0"} (localclawd)`);
|
|
522806
523002
|
return;
|
|
522807
523003
|
}
|
|
522808
523004
|
const {
|
|
@@ -522877,11 +523073,11 @@ localclawd: unhandled error (continuing) — ${msg}
|
|
|
522877
523073
|
`);
|
|
522878
523074
|
try {
|
|
522879
523075
|
const { appendFileSync: appendFileSync4, mkdirSync: mkdirSync6 } = __require("fs");
|
|
522880
|
-
const { homedir:
|
|
522881
|
-
const { join:
|
|
522882
|
-
const dir =
|
|
523076
|
+
const { homedir: homedir40 } = __require("os");
|
|
523077
|
+
const { join: join172 } = __require("path");
|
|
523078
|
+
const dir = join172(homedir40(), ".claude");
|
|
522883
523079
|
mkdirSync6(dir, { recursive: true });
|
|
522884
|
-
appendFileSync4(
|
|
523080
|
+
appendFileSync4(join172(dir, "crash.log"), `[${new Date().toISOString()}] unhandledRejection: ${msg}
|
|
522885
523081
|
`);
|
|
522886
523082
|
} catch {}
|
|
522887
523083
|
});
|
|
@@ -522893,4 +523089,4 @@ localclawd crashed: ${msg}
|
|
|
522893
523089
|
process.exit(1);
|
|
522894
523090
|
});
|
|
522895
523091
|
|
|
522896
|
-
//# debugId=
|
|
523092
|
+
//# debugId=9066A3790DFA1A3F64756E2164756E21
|