@costrict/csc 4.2.15 → 4.2.16
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.js +602 -823
- package/dist/services/rawDump/batchWorker.js +7 -11
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -41000,8 +41000,6 @@ var init_ui_plugins = __esm(() => {
|
|
|
41000
41000
|
"plugins.installed.partial": "Installed {success}/{total} plugins",
|
|
41001
41001
|
"plugins.installed.plugins": "Installed plugins (",
|
|
41002
41002
|
"plugins.installing": "Installing\u2026",
|
|
41003
|
-
"plugins.installs": "installs",
|
|
41004
|
-
"plugins.installs_2": "installs",
|
|
41005
41003
|
"plugins.is.enabled.in.costrictsettingsjson.shared.with.your.team": "is enabled in .costrict/settings.json (shared with your team)",
|
|
41006
41004
|
"plugins.loading": "Loading\u2026",
|
|
41007
41005
|
"plugins.loading_2": "Loading\u2026",
|
|
@@ -45537,8 +45535,6 @@ var init_ui_plugins2 = __esm(() => {
|
|
|
45537
45535
|
"plugins.installed.partial": "\u5DF2\u5B89\u88C5 {success}/{total} \u4E2A\u63D2\u4EF6",
|
|
45538
45536
|
"plugins.installed.plugins": "\u5DF2\u5B89\u88C5\u63D2\u4EF6\uFF08",
|
|
45539
45537
|
"plugins.installing": "\u6B63\u5728\u5B89\u88C5\u2026",
|
|
45540
|
-
"plugins.installs": "\u5B89\u88C5\u91CF",
|
|
45541
|
-
"plugins.installs_2": "\u5B89\u88C5\u91CF",
|
|
45542
45538
|
"plugins.is.enabled.in.costrictsettingsjson.shared.with.your.team": "\u5DF2\u5728 .costrict/settings.json \u4E2D\u542F\u7528\uFF08\u4E0E\u4F60\u7684\u56E2\u961F\u5171\u4EAB\uFF09",
|
|
45543
45539
|
"plugins.loading": "\u52A0\u8F7D\u4E2D\u2026",
|
|
45544
45540
|
"plugins.loading_2": "\u52A0\u8F7D\u4E2D\u2026",
|
|
@@ -66533,8 +66529,8 @@ function getClientVersion() {
|
|
|
66533
66529
|
if (cached)
|
|
66534
66530
|
return cached;
|
|
66535
66531
|
try {
|
|
66536
|
-
if ("4.2.
|
|
66537
|
-
cached = "4.2.
|
|
66532
|
+
if ("4.2.16") {
|
|
66533
|
+
cached = "4.2.16";
|
|
66538
66534
|
return cached;
|
|
66539
66535
|
}
|
|
66540
66536
|
} catch {}
|
|
@@ -220207,7 +220203,7 @@ async function fetchCoStrictModels(baseUrl, accessToken) {
|
|
|
220207
220203
|
headers: {
|
|
220208
220204
|
Authorization: `Bearer ${accessToken}`,
|
|
220209
220205
|
Accept: "application/json",
|
|
220210
|
-
"User-Agent": `csc/${"4.2.
|
|
220206
|
+
"User-Agent": `csc/${"4.2.16"}`
|
|
220211
220207
|
},
|
|
220212
220208
|
signal: controller.signal
|
|
220213
220209
|
});
|
|
@@ -222244,7 +222240,7 @@ var init_auth7 = __esm(() => {
|
|
|
222244
222240
|
|
|
222245
222241
|
// src/utils/userAgent.ts
|
|
222246
222242
|
function getClaudeCodeUserAgent() {
|
|
222247
|
-
return `costrict/${"4.2.
|
|
222243
|
+
return `costrict/${"4.2.16"}`;
|
|
222248
222244
|
}
|
|
222249
222245
|
|
|
222250
222246
|
// src/utils/workloadContext.ts
|
|
@@ -222266,7 +222262,7 @@ function getUserAgent() {
|
|
|
222266
222262
|
const clientApp = process.env.CLAUDE_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}` : "";
|
|
222267
222263
|
const workload = getWorkload();
|
|
222268
222264
|
const workloadSuffix = workload ? `, workload/${workload}` : "";
|
|
222269
|
-
return `csc/${"4.2.
|
|
222265
|
+
return `csc/${"4.2.16"}`;
|
|
222270
222266
|
}
|
|
222271
222267
|
function getMCPUserAgent() {
|
|
222272
222268
|
const parts = [];
|
|
@@ -222280,7 +222276,7 @@ function getMCPUserAgent() {
|
|
|
222280
222276
|
parts.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`);
|
|
222281
222277
|
}
|
|
222282
222278
|
const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
222283
|
-
return `csc/${"4.2.
|
|
222279
|
+
return `csc/${"4.2.16"}${suffix}`;
|
|
222284
222280
|
}
|
|
222285
222281
|
function getWebFetchUserAgent() {
|
|
222286
222282
|
return `Claude-User (${getClaudeCodeUserAgent()}; +https://support.anthropic.com/)`;
|
|
@@ -222400,7 +222396,7 @@ var init_user = __esm(() => {
|
|
|
222400
222396
|
deviceId,
|
|
222401
222397
|
sessionId: getSessionId(),
|
|
222402
222398
|
email: getEmail(),
|
|
222403
|
-
appVersion: "4.2.
|
|
222399
|
+
appVersion: "4.2.16",
|
|
222404
222400
|
platform: getHostPlatformForAnalytics(),
|
|
222405
222401
|
organizationUuid,
|
|
222406
222402
|
accountUuid,
|
|
@@ -233448,7 +233444,7 @@ var init_metadata = __esm(() => {
|
|
|
233448
233444
|
COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
|
|
233449
233445
|
WHITESPACE_REGEX = /\s+/;
|
|
233450
233446
|
getVersionBase = memoize_default(() => {
|
|
233451
|
-
const match = "4.2.
|
|
233447
|
+
const match = "4.2.16".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
|
|
233452
233448
|
return match ? match[0] : undefined;
|
|
233453
233449
|
});
|
|
233454
233450
|
buildEnvContext = memoize_default(async () => {
|
|
@@ -233488,9 +233484,9 @@ var init_metadata = __esm(() => {
|
|
|
233488
233484
|
isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
|
|
233489
233485
|
isClaudeCodeAction: isEnvTruthy(process.env.CLAUDE_CODE_ACTION),
|
|
233490
233486
|
isClaudeAiAuth: isClaudeAISubscriber(),
|
|
233491
|
-
version: "4.2.
|
|
233487
|
+
version: "4.2.16",
|
|
233492
233488
|
versionBase: getVersionBase(),
|
|
233493
|
-
buildTime: "2026-07-17T11:
|
|
233489
|
+
buildTime: "2026-07-17T11:45:23.878Z",
|
|
233494
233490
|
deploymentEnvironment: env4.detectDeploymentEnvironment(),
|
|
233495
233491
|
...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
|
|
233496
233492
|
githubEventName: process.env.GITHUB_EVENT_NAME,
|
|
@@ -234161,7 +234157,7 @@ function initialize1PEventLogging() {
|
|
|
234161
234157
|
const platform3 = getPlatform();
|
|
234162
234158
|
const attributes = {
|
|
234163
234159
|
[import_semantic_conventions2.ATTR_SERVICE_NAME]: "claude-code",
|
|
234164
|
-
[import_semantic_conventions2.ATTR_SERVICE_VERSION]: "4.2.
|
|
234160
|
+
[import_semantic_conventions2.ATTR_SERVICE_VERSION]: "4.2.16"
|
|
234165
234161
|
};
|
|
234166
234162
|
if (platform3 === "wsl") {
|
|
234167
234163
|
const wslVersion = getWslVersion();
|
|
@@ -234188,7 +234184,7 @@ function initialize1PEventLogging() {
|
|
|
234188
234184
|
})
|
|
234189
234185
|
]
|
|
234190
234186
|
});
|
|
234191
|
-
firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.anthropic.claude_code.events", "4.2.
|
|
234187
|
+
firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("com.anthropic.claude_code.events", "4.2.16");
|
|
234192
234188
|
}
|
|
234193
234189
|
async function reinitialize1PEventLoggingIfConfigChanged() {
|
|
234194
234190
|
if (!is1PEventLoggingEnabled() || !firstPartyEventLoggerProvider) {
|
|
@@ -265980,7 +265976,7 @@ function classifyFetchError(error58) {
|
|
|
265980
265976
|
return "not_found";
|
|
265981
265977
|
if (/certificate|SSL|TLS|unable to get local issuer/i.test(msg))
|
|
265982
265978
|
return "tls";
|
|
265983
|
-
if (/Invalid
|
|
265979
|
+
if (/Invalid marketplace schema/i.test(msg)) {
|
|
265984
265980
|
return "invalid_schema";
|
|
265985
265981
|
}
|
|
265986
265982
|
return "other";
|
|
@@ -434089,7 +434085,7 @@ function getTelemetryAttributes() {
|
|
|
434089
434085
|
attributes["session.id"] = sessionId;
|
|
434090
434086
|
}
|
|
434091
434087
|
if (shouldIncludeAttribute("OTEL_METRICS_INCLUDE_VERSION")) {
|
|
434092
|
-
attributes["app.version"] = "4.2.
|
|
434088
|
+
attributes["app.version"] = "4.2.16";
|
|
434093
434089
|
}
|
|
434094
434090
|
const oauthAccount = getOauthAccountInfo();
|
|
434095
434091
|
if (oauthAccount) {
|
|
@@ -467609,7 +467605,7 @@ function initLangfuse() {
|
|
|
467609
467605
|
flushInterval: parseInt(process.env.LANGFUSE_FLUSH_INTERVAL ?? "10", 10),
|
|
467610
467606
|
mask: maskFn,
|
|
467611
467607
|
environment: process.env.LANGFUSE_TRACING_ENVIRONMENT ?? "development",
|
|
467612
|
-
release: "4.2.
|
|
467608
|
+
release: "4.2.16",
|
|
467613
467609
|
exportMode: process.env.LANGFUSE_EXPORT_MODE ?? "batched",
|
|
467614
467610
|
timeout: parseInt(process.env.LANGFUSE_TIMEOUT ?? "5", 10)
|
|
467615
467611
|
});
|
|
@@ -499509,7 +499505,7 @@ function initSentry() {
|
|
|
499509
499505
|
}
|
|
499510
499506
|
init3({
|
|
499511
499507
|
dsn,
|
|
499512
|
-
release: typeof MACRO !== "undefined" ? "4.2.
|
|
499508
|
+
release: typeof MACRO !== "undefined" ? "4.2.16" : undefined,
|
|
499513
499509
|
environment: typeof BUILD_ENV !== "undefined" ? BUILD_ENV : "production",
|
|
499514
499510
|
maxBreadcrumbs: 20,
|
|
499515
499511
|
sampleRate: 1,
|
|
@@ -527400,7 +527396,7 @@ async function initializeBetaTracing(resource) {
|
|
|
527400
527396
|
});
|
|
527401
527397
|
logs.setGlobalLoggerProvider(loggerProvider);
|
|
527402
527398
|
setLoggerProvider(loggerProvider);
|
|
527403
|
-
const eventLogger = logs.getLogger("com.anthropic.claude_code.events", "4.2.
|
|
527399
|
+
const eventLogger = logs.getLogger("com.anthropic.claude_code.events", "4.2.16");
|
|
527404
527400
|
setEventLogger(eventLogger);
|
|
527405
527401
|
process.on("beforeExit", async () => {
|
|
527406
527402
|
await loggerProvider?.forceFlush();
|
|
@@ -527440,7 +527436,7 @@ async function initializeTelemetry() {
|
|
|
527440
527436
|
const platform5 = getPlatform();
|
|
527441
527437
|
const baseAttributes = {
|
|
527442
527438
|
[import_semantic_conventions29.ATTR_SERVICE_NAME]: "claude-code",
|
|
527443
|
-
[import_semantic_conventions29.ATTR_SERVICE_VERSION]: "4.2.
|
|
527439
|
+
[import_semantic_conventions29.ATTR_SERVICE_VERSION]: "4.2.16"
|
|
527444
527440
|
};
|
|
527445
527441
|
if (platform5 === "wsl") {
|
|
527446
527442
|
const wslVersion = getWslVersion();
|
|
@@ -527485,7 +527481,7 @@ async function initializeTelemetry() {
|
|
|
527485
527481
|
} catch {}
|
|
527486
527482
|
};
|
|
527487
527483
|
registerCleanup(shutdownTelemetry2);
|
|
527488
|
-
return meterProvider2.getMeter("com.anthropic.claude_code", "4.2.
|
|
527484
|
+
return meterProvider2.getMeter("com.anthropic.claude_code", "4.2.16");
|
|
527489
527485
|
}
|
|
527490
527486
|
const meterProvider = new import_sdk_metrics2.MeterProvider({
|
|
527491
527487
|
resource,
|
|
@@ -527505,7 +527501,7 @@ async function initializeTelemetry() {
|
|
|
527505
527501
|
});
|
|
527506
527502
|
logs.setGlobalLoggerProvider(loggerProvider);
|
|
527507
527503
|
setLoggerProvider(loggerProvider);
|
|
527508
|
-
const eventLogger = logs.getLogger("com.anthropic.claude_code.events", "4.2.
|
|
527504
|
+
const eventLogger = logs.getLogger("com.anthropic.claude_code.events", "4.2.16");
|
|
527509
527505
|
setEventLogger(eventLogger);
|
|
527510
527506
|
logForDebugging("[3P telemetry] Event logger set successfully");
|
|
527511
527507
|
process.on("beforeExit", async () => {
|
|
@@ -527567,7 +527563,7 @@ Current timeout: ${timeoutMs}ms
|
|
|
527567
527563
|
}
|
|
527568
527564
|
};
|
|
527569
527565
|
registerCleanup(shutdownTelemetry);
|
|
527570
|
-
return meterProvider.getMeter("com.anthropic.claude_code", "4.2.
|
|
527566
|
+
return meterProvider.getMeter("com.anthropic.claude_code", "4.2.16");
|
|
527571
527567
|
}
|
|
527572
527568
|
async function flushTelemetry() {
|
|
527573
527569
|
const meterProvider = getMeterProvider();
|
|
@@ -528626,7 +528622,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
528626
528622
|
logError3(new AutoUpdaterError("Another process is currently installing an update"));
|
|
528627
528623
|
logEvent("tengu_auto_updater_lock_contention", {
|
|
528628
528624
|
pid: process.pid,
|
|
528629
|
-
currentVersion: "4.2.
|
|
528625
|
+
currentVersion: "4.2.16"
|
|
528630
528626
|
});
|
|
528631
528627
|
return { status: "in_progress" };
|
|
528632
528628
|
}
|
|
@@ -528635,7 +528631,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
528635
528631
|
if (!env4.isRunningWithBun() && env4.isNpmFromWindowsPath()) {
|
|
528636
528632
|
logError3(new Error("Windows NPM detected in WSL environment"));
|
|
528637
528633
|
logEvent("tengu_auto_updater_windows_npm_in_wsl", {
|
|
528638
|
-
currentVersion: "4.2.
|
|
528634
|
+
currentVersion: "4.2.16"
|
|
528639
528635
|
});
|
|
528640
528636
|
return {
|
|
528641
528637
|
status: "install_failed",
|
|
@@ -529181,7 +529177,7 @@ function detectLinuxGlobPatternWarnings() {
|
|
|
529181
529177
|
}
|
|
529182
529178
|
async function getDoctorDiagnostic() {
|
|
529183
529179
|
const installationType = await getCurrentInstallationType();
|
|
529184
|
-
const version9 = typeof MACRO !== "undefined" ? "4.2.
|
|
529180
|
+
const version9 = typeof MACRO !== "undefined" ? "4.2.16" : "unknown";
|
|
529185
529181
|
const installationPath = await getInstallationPath();
|
|
529186
529182
|
const invokedBinary = getInvokedBinary();
|
|
529187
529183
|
const multipleInstallations = await detectMultipleInstallations();
|
|
@@ -567337,7 +567333,7 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
|
|
|
567337
567333
|
const client10 = new Client3({
|
|
567338
567334
|
name: "claude-code",
|
|
567339
567335
|
title: "CoStrict",
|
|
567340
|
-
version: "4.2.
|
|
567336
|
+
version: "4.2.16",
|
|
567341
567337
|
description: "CoStrict agentic coding tool",
|
|
567342
567338
|
websiteUrl: PRODUCT_URL
|
|
567343
567339
|
}, {
|
|
@@ -567708,7 +567704,7 @@ var init_client18 = __esm(() => {
|
|
|
567708
567704
|
const client10 = new Client3({
|
|
567709
567705
|
name: "claude-code",
|
|
567710
567706
|
title: "CoStrict",
|
|
567711
|
-
version: "4.2.
|
|
567707
|
+
version: "4.2.16",
|
|
567712
567708
|
description: "CoStrict agentic coding tool",
|
|
567713
567709
|
websiteUrl: PRODUCT_URL
|
|
567714
567710
|
}, {
|
|
@@ -569086,7 +569082,7 @@ function getInstallationEnv() {
|
|
|
569086
569082
|
return;
|
|
569087
569083
|
}
|
|
569088
569084
|
function getClaudeCodeVersion() {
|
|
569089
|
-
return "4.2.
|
|
569085
|
+
return "4.2.16";
|
|
569090
569086
|
}
|
|
569091
569087
|
async function getInstalledVSCodeExtensionVersion(command4) {
|
|
569092
569088
|
const { stdout } = await execFileNoThrow2(command4, ["--list-extensions", "--show-versions"], {
|
|
@@ -570450,8 +570446,8 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
570450
570446
|
const maxVersion = await getMaxVersion();
|
|
570451
570447
|
if (maxVersion && gt(version10, maxVersion)) {
|
|
570452
570448
|
logForDebugging(`Native installer: maxVersion ${maxVersion} is set, capping update from ${version10} to ${maxVersion}`);
|
|
570453
|
-
if (gte2("4.2.
|
|
570454
|
-
logForDebugging(`Native installer: current version ${"4.2.
|
|
570449
|
+
if (gte2("4.2.16", maxVersion)) {
|
|
570450
|
+
logForDebugging(`Native installer: current version ${"4.2.16"} is already at or above maxVersion ${maxVersion}, skipping update`);
|
|
570455
570451
|
logEvent("tengu_native_update_skipped_max_version", {
|
|
570456
570452
|
latency_ms: Date.now() - startTime2,
|
|
570457
570453
|
max_version: maxVersion,
|
|
@@ -570462,7 +570458,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
570462
570458
|
version10 = maxVersion;
|
|
570463
570459
|
}
|
|
570464
570460
|
}
|
|
570465
|
-
if (!forceReinstall && version10 === "4.2.
|
|
570461
|
+
if (!forceReinstall && version10 === "4.2.16" && await versionIsAvailable(version10) && await isPossibleClaudeBinary(executablePath)) {
|
|
570466
570462
|
logForDebugging(`Found ${version10} at ${executablePath}, skipping install`);
|
|
570467
570463
|
logEvent("tengu_native_update_complete", {
|
|
570468
570464
|
latency_ms: Date.now() - startTime2,
|
|
@@ -707382,7 +707378,7 @@ function Feedback({
|
|
|
707382
707378
|
platform: env4.platform,
|
|
707383
707379
|
gitRepo: envInfo.isGit,
|
|
707384
707380
|
terminal: env4.terminal,
|
|
707385
|
-
version: "4.2.
|
|
707381
|
+
version: "4.2.16",
|
|
707386
707382
|
transcript: normalizeMessagesForAPI(messages),
|
|
707387
707383
|
errors: sanitizedErrors,
|
|
707388
707384
|
lastApiRequest: getLastAPIRequest(),
|
|
@@ -707565,7 +707561,7 @@ function Feedback({
|
|
|
707565
707561
|
", ",
|
|
707566
707562
|
env4.terminal,
|
|
707567
707563
|
", v",
|
|
707568
|
-
"4.2.
|
|
707564
|
+
"4.2.16"
|
|
707569
707565
|
]
|
|
707570
707566
|
})
|
|
707571
707567
|
]
|
|
@@ -707662,7 +707658,7 @@ ${sanitizedDescription}
|
|
|
707662
707658
|
` + `**Environment Info**
|
|
707663
707659
|
` + `- Platform: ${env4.platform}
|
|
707664
707660
|
` + `- Terminal: ${env4.terminal}
|
|
707665
|
-
` + `- Version: ${"4.2.
|
|
707661
|
+
` + `- Version: ${"4.2.16"}
|
|
707666
707662
|
` + `- Feedback ID: ${feedbackId}
|
|
707667
707663
|
` + `
|
|
707668
707664
|
**Errors**
|
|
@@ -709898,7 +709894,7 @@ function buildPrimarySection() {
|
|
|
709898
709894
|
children: t("settings.status.renameHint")
|
|
709899
709895
|
});
|
|
709900
709896
|
return [
|
|
709901
|
-
{ label: t("settings.status.version"), value: "4.2.
|
|
709897
|
+
{ label: t("settings.status.version"), value: "4.2.16" },
|
|
709902
709898
|
{ label: t("settings.status.sessionName"), value: nameValue },
|
|
709903
709899
|
{ label: t("settings.status.sessionId"), value: sessionId },
|
|
709904
709900
|
{ label: t("settings.status.cwd"), value: getCwd() },
|
|
@@ -712756,7 +712752,7 @@ function Config({
|
|
|
712756
712752
|
}
|
|
712757
712753
|
})
|
|
712758
712754
|
}) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsx_runtime190.jsx(ChannelDowngradeDialog, {
|
|
712759
|
-
currentVersion: "4.2.
|
|
712755
|
+
currentVersion: "4.2.16",
|
|
712760
712756
|
onChoice: (choice) => {
|
|
712761
712757
|
setShowSubmenu(null);
|
|
712762
712758
|
setTabsHidden(false);
|
|
@@ -712768,7 +712764,7 @@ function Config({
|
|
|
712768
712764
|
autoUpdatesChannel: "stable"
|
|
712769
712765
|
};
|
|
712770
712766
|
if (choice === "stay") {
|
|
712771
|
-
newSettings.minimumVersion = "4.2.
|
|
712767
|
+
newSettings.minimumVersion = "4.2.16";
|
|
712772
712768
|
}
|
|
712773
712769
|
updateSettingsForSource("userSettings", newSettings);
|
|
712774
712770
|
setSettingsData((prev) => ({
|
|
@@ -718237,7 +718233,7 @@ function HelpV2({ onClose, commands: commands11 }) {
|
|
|
718237
718233
|
color: "professionalBlue",
|
|
718238
718234
|
children: [
|
|
718239
718235
|
/* @__PURE__ */ jsx_runtime217.jsx(Tabs, {
|
|
718240
|
-
title: process.env.USER_TYPE === "sf" ? "/help" : `CoStrict v${"4.2.
|
|
718236
|
+
title: process.env.USER_TYPE === "sf" ? "/help" : `CoStrict v${"4.2.16"}`,
|
|
718241
718237
|
color: "professionalBlue",
|
|
718242
718238
|
defaultTab: "general",
|
|
718243
718239
|
children: tabs
|
|
@@ -732825,152 +732821,6 @@ var init_AddMarketplace = __esm(() => {
|
|
|
732825
732821
|
jsx_runtime232 = __toESM(require_jsx_runtime(), 1);
|
|
732826
732822
|
});
|
|
732827
732823
|
|
|
732828
|
-
// src/utils/plugins/installCounts.ts
|
|
732829
|
-
import { randomBytes as randomBytes22 } from "crypto";
|
|
732830
|
-
import { readFile as readFile63, rename as rename13, unlink as unlink21, writeFile as writeFile58 } from "fs/promises";
|
|
732831
|
-
import { join as join169 } from "path";
|
|
732832
|
-
function getInstallCountsCachePath() {
|
|
732833
|
-
return join169(getPluginsDirectory(), INSTALL_COUNTS_CACHE_FILENAME);
|
|
732834
|
-
}
|
|
732835
|
-
async function loadInstallCountsCache() {
|
|
732836
|
-
const cachePath = getInstallCountsCachePath();
|
|
732837
|
-
try {
|
|
732838
|
-
const content = await readFile63(cachePath, { encoding: "utf-8" });
|
|
732839
|
-
const parsed = jsonParse(content);
|
|
732840
|
-
if (typeof parsed !== "object" || parsed === null || !("version" in parsed) || !("fetchedAt" in parsed) || !("counts" in parsed)) {
|
|
732841
|
-
logForDebugging("Install counts cache has invalid structure");
|
|
732842
|
-
return null;
|
|
732843
|
-
}
|
|
732844
|
-
const cache12 = parsed;
|
|
732845
|
-
if (cache12.version !== INSTALL_COUNTS_CACHE_VERSION) {
|
|
732846
|
-
logForDebugging(`Install counts cache version mismatch (got ${cache12.version}, expected ${INSTALL_COUNTS_CACHE_VERSION})`);
|
|
732847
|
-
return null;
|
|
732848
|
-
}
|
|
732849
|
-
if (typeof cache12.fetchedAt !== "string" || !Array.isArray(cache12.counts)) {
|
|
732850
|
-
logForDebugging("Install counts cache has invalid structure");
|
|
732851
|
-
return null;
|
|
732852
|
-
}
|
|
732853
|
-
const fetchedAt = new Date(cache12.fetchedAt).getTime();
|
|
732854
|
-
if (Number.isNaN(fetchedAt)) {
|
|
732855
|
-
logForDebugging("Install counts cache has invalid fetchedAt timestamp");
|
|
732856
|
-
return null;
|
|
732857
|
-
}
|
|
732858
|
-
const validCounts = cache12.counts.every((entry) => typeof entry === "object" && entry !== null && typeof entry.plugin === "string" && typeof entry.unique_installs === "number");
|
|
732859
|
-
if (!validCounts) {
|
|
732860
|
-
logForDebugging("Install counts cache has malformed entries");
|
|
732861
|
-
return null;
|
|
732862
|
-
}
|
|
732863
|
-
const now2 = Date.now();
|
|
732864
|
-
if (now2 - fetchedAt > CACHE_TTL_MS4) {
|
|
732865
|
-
logForDebugging("Install counts cache is stale (>24h old)");
|
|
732866
|
-
return null;
|
|
732867
|
-
}
|
|
732868
|
-
return {
|
|
732869
|
-
version: cache12.version,
|
|
732870
|
-
fetchedAt: cache12.fetchedAt,
|
|
732871
|
-
counts: cache12.counts
|
|
732872
|
-
};
|
|
732873
|
-
} catch (error100) {
|
|
732874
|
-
const code = getErrnoCode(error100);
|
|
732875
|
-
if (code !== "ENOENT") {
|
|
732876
|
-
logForDebugging(`Failed to load install counts cache: ${errorMessage(error100)}`);
|
|
732877
|
-
}
|
|
732878
|
-
return null;
|
|
732879
|
-
}
|
|
732880
|
-
}
|
|
732881
|
-
async function saveInstallCountsCache(cache12) {
|
|
732882
|
-
const cachePath = getInstallCountsCachePath();
|
|
732883
|
-
const tempPath = `${cachePath}.${randomBytes22(8).toString("hex")}.tmp`;
|
|
732884
|
-
try {
|
|
732885
|
-
const pluginsDir = getPluginsDirectory();
|
|
732886
|
-
await getFsImplementation().mkdir(pluginsDir);
|
|
732887
|
-
const content = jsonStringify(cache12, null, 2);
|
|
732888
|
-
await writeFile58(tempPath, content, {
|
|
732889
|
-
encoding: "utf-8",
|
|
732890
|
-
mode: 384
|
|
732891
|
-
});
|
|
732892
|
-
await rename13(tempPath, cachePath);
|
|
732893
|
-
logForDebugging("Install counts cache saved successfully");
|
|
732894
|
-
} catch (error100) {
|
|
732895
|
-
logError3(error100);
|
|
732896
|
-
try {
|
|
732897
|
-
await unlink21(tempPath);
|
|
732898
|
-
} catch {}
|
|
732899
|
-
}
|
|
732900
|
-
}
|
|
732901
|
-
async function fetchInstallCountsFromGitHub() {
|
|
732902
|
-
logForDebugging(`Fetching install counts from ${INSTALL_COUNTS_URL}`);
|
|
732903
|
-
const started = performance.now();
|
|
732904
|
-
try {
|
|
732905
|
-
const response3 = await axios_default.get(INSTALL_COUNTS_URL, {
|
|
732906
|
-
timeout: 1e4
|
|
732907
|
-
});
|
|
732908
|
-
if (!response3.data?.plugins || !Array.isArray(response3.data.plugins)) {
|
|
732909
|
-
throw new Error("Invalid response format from install counts API");
|
|
732910
|
-
}
|
|
732911
|
-
logPluginFetch("install_counts", INSTALL_COUNTS_URL, "success", performance.now() - started);
|
|
732912
|
-
return response3.data.plugins;
|
|
732913
|
-
} catch (error100) {
|
|
732914
|
-
logPluginFetch("install_counts", INSTALL_COUNTS_URL, "failure", performance.now() - started, classifyFetchError(error100));
|
|
732915
|
-
throw error100;
|
|
732916
|
-
}
|
|
732917
|
-
}
|
|
732918
|
-
async function getInstallCounts() {
|
|
732919
|
-
const cache12 = await loadInstallCountsCache();
|
|
732920
|
-
if (cache12) {
|
|
732921
|
-
logForDebugging("Using cached install counts");
|
|
732922
|
-
logPluginFetch("install_counts", INSTALL_COUNTS_URL, "cache_hit", 0);
|
|
732923
|
-
const map5 = new Map;
|
|
732924
|
-
for (const entry of cache12.counts) {
|
|
732925
|
-
map5.set(entry.plugin, entry.unique_installs);
|
|
732926
|
-
}
|
|
732927
|
-
return map5;
|
|
732928
|
-
}
|
|
732929
|
-
try {
|
|
732930
|
-
const counts = await fetchInstallCountsFromGitHub();
|
|
732931
|
-
const newCache = {
|
|
732932
|
-
version: INSTALL_COUNTS_CACHE_VERSION,
|
|
732933
|
-
fetchedAt: new Date().toISOString(),
|
|
732934
|
-
counts
|
|
732935
|
-
};
|
|
732936
|
-
await saveInstallCountsCache(newCache);
|
|
732937
|
-
const map5 = new Map;
|
|
732938
|
-
for (const entry of counts) {
|
|
732939
|
-
map5.set(entry.plugin, entry.unique_installs);
|
|
732940
|
-
}
|
|
732941
|
-
return map5;
|
|
732942
|
-
} catch (error100) {
|
|
732943
|
-
logError3(error100);
|
|
732944
|
-
logForDebugging(`Failed to fetch install counts: ${errorMessage(error100)}`);
|
|
732945
|
-
return null;
|
|
732946
|
-
}
|
|
732947
|
-
}
|
|
732948
|
-
function formatInstallCount(count3) {
|
|
732949
|
-
if (count3 < 1000) {
|
|
732950
|
-
return String(count3);
|
|
732951
|
-
}
|
|
732952
|
-
if (count3 < 1e6) {
|
|
732953
|
-
const k9 = count3 / 1000;
|
|
732954
|
-
const formatted2 = k9.toFixed(1);
|
|
732955
|
-
return formatted2.endsWith(".0") ? `${formatted2.slice(0, -2)}K` : `${formatted2}K`;
|
|
732956
|
-
}
|
|
732957
|
-
const m4 = count3 / 1e6;
|
|
732958
|
-
const formatted = m4.toFixed(1);
|
|
732959
|
-
return formatted.endsWith(".0") ? `${formatted.slice(0, -2)}M` : `${formatted}M`;
|
|
732960
|
-
}
|
|
732961
|
-
var INSTALL_COUNTS_CACHE_VERSION = 1, INSTALL_COUNTS_CACHE_FILENAME = "install-counts-cache.json", INSTALL_COUNTS_URL = "https://raw.githubusercontent.com/anthropics/claude-plugins-official/refs/heads/stats/stats/plugin-installs.json", CACHE_TTL_MS4;
|
|
732962
|
-
var init_installCounts = __esm(() => {
|
|
732963
|
-
init_axios2();
|
|
732964
|
-
init_debug();
|
|
732965
|
-
init_errors();
|
|
732966
|
-
init_fsOperations();
|
|
732967
|
-
init_log3();
|
|
732968
|
-
init_slowOperations();
|
|
732969
|
-
init_fetchTelemetry();
|
|
732970
|
-
init_pluginDirectories();
|
|
732971
|
-
CACHE_TTL_MS4 = 24 * 60 * 60 * 1000;
|
|
732972
|
-
});
|
|
732973
|
-
|
|
732974
732824
|
// src/commands/plugin/PluginOptionsDialog.tsx
|
|
732975
732825
|
function buildFinalValues(fields, collected, configSchema, initialValues) {
|
|
732976
732826
|
const finalValues = {};
|
|
@@ -733415,7 +733265,6 @@ function BrowseMarketplace({
|
|
|
733415
733265
|
const [marketplaces, setMarketplaces] = import_react152.useState([]);
|
|
733416
733266
|
const [availablePlugins, setAvailablePlugins] = import_react152.useState([]);
|
|
733417
733267
|
const [loading, setLoading] = import_react152.useState(true);
|
|
733418
|
-
const [installCounts, setInstallCounts] = import_react152.useState(null);
|
|
733419
733268
|
const [selectedIndex, setSelectedIndex] = import_react152.useState(0);
|
|
733420
733269
|
const [selectedForInstall, setSelectedForInstall] = import_react152.useState(new Set);
|
|
733421
733270
|
const [installingPlugins, setInstallingPlugins] = import_react152.useState(new Set);
|
|
@@ -733565,28 +733414,7 @@ function BrowseMarketplace({
|
|
|
733565
733414
|
isInstalled: isPluginGloballyInstalled(pluginId)
|
|
733566
733415
|
});
|
|
733567
733416
|
}
|
|
733568
|
-
|
|
733569
|
-
const counts = await getInstallCounts();
|
|
733570
|
-
if (cancelled)
|
|
733571
|
-
return;
|
|
733572
|
-
setInstallCounts(counts);
|
|
733573
|
-
if (counts) {
|
|
733574
|
-
installablePlugins.sort((a8, b9) => {
|
|
733575
|
-
const countA = counts.get(a8.pluginId) ?? 0;
|
|
733576
|
-
const countB = counts.get(b9.pluginId) ?? 0;
|
|
733577
|
-
if (countA !== countB)
|
|
733578
|
-
return countB - countA;
|
|
733579
|
-
return a8.entry.name.localeCompare(b9.entry.name, "en");
|
|
733580
|
-
});
|
|
733581
|
-
} else {
|
|
733582
|
-
installablePlugins.sort((a8, b9) => a8.entry.name.localeCompare(b9.entry.name, "en"));
|
|
733583
|
-
}
|
|
733584
|
-
} catch (error101) {
|
|
733585
|
-
if (cancelled)
|
|
733586
|
-
return;
|
|
733587
|
-
logForDebugging(`Failed to fetch install counts: ${errorMessage(error101)}`);
|
|
733588
|
-
installablePlugins.sort((a8, b9) => a8.entry.name.localeCompare(b9.entry.name, "en"));
|
|
733589
|
-
}
|
|
733417
|
+
installablePlugins.sort((a8, b9) => a8.entry.name.localeCompare(b9.entry.name, "en"));
|
|
733590
733418
|
setAvailablePlugins(installablePlugins);
|
|
733591
733419
|
setSelectedIndex(0);
|
|
733592
733420
|
setSelectedForInstall(new Set);
|
|
@@ -734213,15 +734041,6 @@ function BrowseMarketplace({
|
|
|
734213
734041
|
" ",
|
|
734214
734042
|
t("plugins.installed")
|
|
734215
734043
|
]
|
|
734216
|
-
}),
|
|
734217
|
-
installCounts && selectedMarketplace === OFFICIAL_MARKETPLACE_NAME && /* @__PURE__ */ jsx_runtime237.jsxs(ThemedText, {
|
|
734218
|
-
dimColor: true,
|
|
734219
|
-
children: [
|
|
734220
|
-
" \xB7 ",
|
|
734221
|
-
formatInstallCount(installCounts.get(plugin.pluginId) ?? 0),
|
|
734222
|
-
" ",
|
|
734223
|
-
t("plugins.installs")
|
|
734224
|
-
]
|
|
734225
734044
|
})
|
|
734226
734045
|
]
|
|
734227
734046
|
})
|
|
@@ -734282,14 +734101,10 @@ var init_BrowseMarketplace = __esm(() => {
|
|
|
734282
734101
|
init_src();
|
|
734283
734102
|
init_useKeybinding2();
|
|
734284
734103
|
init_browser();
|
|
734285
|
-
init_debug();
|
|
734286
|
-
init_errors();
|
|
734287
734104
|
init_cacheUtils();
|
|
734288
|
-
init_installCounts();
|
|
734289
734105
|
init_installedPluginsManager();
|
|
734290
734106
|
init_marketplaceHelpers();
|
|
734291
734107
|
init_marketplaceManager();
|
|
734292
|
-
init_officialMarketplace();
|
|
734293
734108
|
init_pluginInstallationHelpers();
|
|
734294
734109
|
init_pluginPolicy();
|
|
734295
734110
|
init_stringUtils();
|
|
@@ -734318,7 +734133,6 @@ function DiscoverPlugins({
|
|
|
734318
734133
|
const [selectedPlugin, setSelectedPlugin] = import_react153.useState(null);
|
|
734319
734134
|
const [availablePlugins, setAvailablePlugins] = import_react153.useState([]);
|
|
734320
734135
|
const [loading, setLoading] = import_react153.useState(true);
|
|
734321
|
-
const [installCounts, setInstallCounts] = import_react153.useState(null);
|
|
734322
734136
|
const [isSearchMode, setIsSearchModeRaw] = import_react153.useState(false);
|
|
734323
734137
|
const setIsSearchMode = import_react153.useCallback((active3) => {
|
|
734324
734138
|
setIsSearchModeRaw(active3);
|
|
@@ -734377,24 +734191,7 @@ function DiscoverPlugins({
|
|
|
734377
734191
|
}
|
|
734378
734192
|
}
|
|
734379
734193
|
const uninstalledPlugins = allPlugins.filter((p2) => !p2.isInstalled && !isPluginBlockedByPolicy(p2.pluginId));
|
|
734380
|
-
|
|
734381
|
-
const counts = await getInstallCounts();
|
|
734382
|
-
setInstallCounts(counts);
|
|
734383
|
-
if (counts) {
|
|
734384
|
-
uninstalledPlugins.sort((a8, b9) => {
|
|
734385
|
-
const countA = counts.get(a8.pluginId) ?? 0;
|
|
734386
|
-
const countB = counts.get(b9.pluginId) ?? 0;
|
|
734387
|
-
if (countA !== countB)
|
|
734388
|
-
return countB - countA;
|
|
734389
|
-
return a8.entry.name.localeCompare(b9.entry.name, "en");
|
|
734390
|
-
});
|
|
734391
|
-
} else {
|
|
734392
|
-
uninstalledPlugins.sort((a8, b9) => a8.entry.name.localeCompare(b9.entry.name, "en"));
|
|
734393
|
-
}
|
|
734394
|
-
} catch (error101) {
|
|
734395
|
-
logForDebugging(`Failed to fetch install counts: ${errorMessage(error101)}`);
|
|
734396
|
-
uninstalledPlugins.sort((a8, b9) => a8.entry.name.localeCompare(b9.entry.name, "en"));
|
|
734397
|
-
}
|
|
734194
|
+
uninstalledPlugins.sort((a8, b9) => a8.entry.name.localeCompare(b9.entry.name, "en"));
|
|
734398
734195
|
setAvailablePlugins(uninstalledPlugins);
|
|
734399
734196
|
const configuredCount = Object.keys(config13).length;
|
|
734400
734197
|
if (uninstalledPlugins.length === 0) {
|
|
@@ -734918,15 +734715,6 @@ function DiscoverPlugins({
|
|
|
734918
734715
|
" ",
|
|
734919
734716
|
t("plugins.community.managed_2")
|
|
734920
734717
|
]
|
|
734921
|
-
}),
|
|
734922
|
-
installCounts && plugin.marketplaceName === OFFICIAL_MARKETPLACE_NAME && /* @__PURE__ */ jsx_runtime238.jsxs(ThemedText, {
|
|
734923
|
-
dimColor: true,
|
|
734924
|
-
children: [
|
|
734925
|
-
" \xB7 ",
|
|
734926
|
-
formatInstallCount(installCounts.get(plugin.pluginId) ?? 0),
|
|
734927
|
-
" ",
|
|
734928
|
-
t("plugins.installs_2")
|
|
734929
|
-
]
|
|
734930
734718
|
})
|
|
734931
734719
|
]
|
|
734932
734720
|
})
|
|
@@ -735110,14 +734898,10 @@ var init_DiscoverPlugins = __esm(() => {
|
|
|
735110
734898
|
init_src();
|
|
735111
734899
|
init_useKeybinding2();
|
|
735112
734900
|
init_browser();
|
|
735113
|
-
init_debug();
|
|
735114
|
-
init_errors();
|
|
735115
734901
|
init_cacheUtils();
|
|
735116
|
-
init_installCounts();
|
|
735117
734902
|
init_installedPluginsManager();
|
|
735118
734903
|
init_marketplaceHelpers();
|
|
735119
734904
|
init_marketplaceManager();
|
|
735120
|
-
init_officialMarketplace();
|
|
735121
734905
|
init_pluginInstallationHelpers();
|
|
735122
734906
|
init_pluginPolicy();
|
|
735123
734907
|
init_stringUtils();
|
|
@@ -735132,7 +734916,7 @@ var init_DiscoverPlugins = __esm(() => {
|
|
|
735132
734916
|
});
|
|
735133
734917
|
|
|
735134
734918
|
// src/services/plugins/pluginOperations.ts
|
|
735135
|
-
import { dirname as dirname73, join as
|
|
734919
|
+
import { dirname as dirname73, join as join169 } from "path";
|
|
735136
734920
|
function assertInstallableScope(scope) {
|
|
735137
734921
|
if (!VALID_INSTALLABLE_SCOPES.includes(scope)) {
|
|
735138
734922
|
throw new Error(t("errors.plugins.invalidScope", { scope, validScopes: VALID_INSTALLABLE_SCOPES.join(", ") }));
|
|
@@ -735610,7 +735394,7 @@ async function performPluginUpdate({
|
|
|
735610
735394
|
throw e7;
|
|
735611
735395
|
}
|
|
735612
735396
|
const marketplaceDir = marketplaceStats.isDirectory() ? marketplaceInstallLocation : dirname73(marketplaceInstallLocation);
|
|
735613
|
-
sourcePath =
|
|
735397
|
+
sourcePath = join169(marketplaceDir, entry.source);
|
|
735614
735398
|
try {
|
|
735615
735399
|
await fs32.stat(sourcePath);
|
|
735616
735400
|
} catch (e7) {
|
|
@@ -735625,7 +735409,7 @@ async function performPluginUpdate({
|
|
|
735625
735409
|
throw e7;
|
|
735626
735410
|
}
|
|
735627
735411
|
let pluginManifest;
|
|
735628
|
-
const manifestPath =
|
|
735412
|
+
const manifestPath = join169(sourcePath, ".claude-plugin", "plugin.json");
|
|
735629
735413
|
try {
|
|
735630
735414
|
pluginManifest = await loadPluginManifest(manifestPath, entry.name, entry.source);
|
|
735631
735415
|
} catch {}
|
|
@@ -736729,11 +736513,11 @@ var init_ManageMarketplaces = __esm(() => {
|
|
|
736729
736513
|
});
|
|
736730
736514
|
|
|
736731
736515
|
// src/utils/plugins/pluginFlagging.ts
|
|
736732
|
-
import { randomBytes as
|
|
736733
|
-
import { readFile as
|
|
736734
|
-
import { join as
|
|
736516
|
+
import { randomBytes as randomBytes22 } from "crypto";
|
|
736517
|
+
import { readFile as readFile63, rename as rename13, unlink as unlink21, writeFile as writeFile58 } from "fs/promises";
|
|
736518
|
+
import { join as join170 } from "path";
|
|
736735
736519
|
function getFlaggedPluginsPath() {
|
|
736736
|
-
return
|
|
736520
|
+
return join170(getPluginsDirectory(), FLAGGED_PLUGINS_FILENAME);
|
|
736737
736521
|
}
|
|
736738
736522
|
function parsePluginsData(content) {
|
|
736739
736523
|
const parsed = jsonParse(content);
|
|
@@ -736757,7 +736541,7 @@ function parsePluginsData(content) {
|
|
|
736757
736541
|
}
|
|
736758
736542
|
async function readFromDisk() {
|
|
736759
736543
|
try {
|
|
736760
|
-
const content = await
|
|
736544
|
+
const content = await readFile63(getFlaggedPluginsPath(), {
|
|
736761
736545
|
encoding: "utf-8"
|
|
736762
736546
|
});
|
|
736763
736547
|
return parsePluginsData(content);
|
|
@@ -736767,20 +736551,20 @@ async function readFromDisk() {
|
|
|
736767
736551
|
}
|
|
736768
736552
|
async function writeToDisk(plugins) {
|
|
736769
736553
|
const filePath = getFlaggedPluginsPath();
|
|
736770
|
-
const tempPath = `${filePath}.${
|
|
736554
|
+
const tempPath = `${filePath}.${randomBytes22(8).toString("hex")}.tmp`;
|
|
736771
736555
|
try {
|
|
736772
736556
|
await getFsImplementation().mkdir(getPluginsDirectory());
|
|
736773
736557
|
const content = jsonStringify({ plugins }, null, 2);
|
|
736774
|
-
await
|
|
736558
|
+
await writeFile58(tempPath, content, {
|
|
736775
736559
|
encoding: "utf-8",
|
|
736776
736560
|
mode: 384
|
|
736777
736561
|
});
|
|
736778
|
-
await
|
|
736562
|
+
await rename13(tempPath, filePath);
|
|
736779
736563
|
cache12 = plugins;
|
|
736780
736564
|
} catch (error100) {
|
|
736781
736565
|
logError3(error100);
|
|
736782
736566
|
try {
|
|
736783
|
-
await
|
|
736567
|
+
await unlink21(tempPath);
|
|
736784
736568
|
} catch {}
|
|
736785
736569
|
}
|
|
736786
736570
|
}
|
|
@@ -739477,7 +739261,7 @@ function parsePluginArgs(args) {
|
|
|
739477
739261
|
}
|
|
739478
739262
|
|
|
739479
739263
|
// src/utils/plugins/validatePlugin.ts
|
|
739480
|
-
import { readdir as readdir30, readFile as
|
|
739264
|
+
import { readdir as readdir30, readFile as readFile65, stat as stat45 } from "fs/promises";
|
|
739481
739265
|
import * as path49 from "path";
|
|
739482
739266
|
function detectManifestType(filePath) {
|
|
739483
739267
|
const fileName = path49.basename(filePath);
|
|
@@ -739517,7 +739301,7 @@ async function validatePluginManifest(filePath) {
|
|
|
739517
739301
|
const absolutePath = path49.resolve(filePath);
|
|
739518
739302
|
let content;
|
|
739519
739303
|
try {
|
|
739520
|
-
content = await
|
|
739304
|
+
content = await readFile65(absolutePath, { encoding: "utf-8" });
|
|
739521
739305
|
} catch (error100) {
|
|
739522
739306
|
const code = getErrnoCode(error100);
|
|
739523
739307
|
let message2;
|
|
@@ -739641,7 +739425,7 @@ async function validateMarketplaceManifest(filePath) {
|
|
|
739641
739425
|
const absolutePath = path49.resolve(filePath);
|
|
739642
739426
|
let content;
|
|
739643
739427
|
try {
|
|
739644
|
-
content = await
|
|
739428
|
+
content = await readFile65(absolutePath, { encoding: "utf-8" });
|
|
739645
739429
|
} catch (error100) {
|
|
739646
739430
|
const code = getErrnoCode(error100);
|
|
739647
739431
|
let message2;
|
|
@@ -739727,7 +739511,7 @@ async function validateMarketplaceManifest(filePath) {
|
|
|
739727
739511
|
const pluginJsonPath = path49.join(marketplaceRoot, entry.source, ".claude-plugin", "plugin.json");
|
|
739728
739512
|
let manifestVersion;
|
|
739729
739513
|
try {
|
|
739730
|
-
const raw = await
|
|
739514
|
+
const raw = await readFile65(pluginJsonPath, { encoding: "utf-8" });
|
|
739731
739515
|
const parsed2 = jsonParse(raw);
|
|
739732
739516
|
if (typeof parsed2.version === "string") {
|
|
739733
739517
|
manifestVersion = parsed2.version;
|
|
@@ -739844,7 +739628,7 @@ function validateComponentFile(filePath, content, fileType) {
|
|
|
739844
739628
|
async function validateHooksJson(filePath) {
|
|
739845
739629
|
let content;
|
|
739846
739630
|
try {
|
|
739847
|
-
content = await
|
|
739631
|
+
content = await readFile65(filePath, { encoding: "utf-8" });
|
|
739848
739632
|
} catch (e7) {
|
|
739849
739633
|
const code = getErrnoCode(e7);
|
|
739850
739634
|
if (code === "ENOENT") {
|
|
@@ -739937,7 +739721,7 @@ async function validatePluginContents(pluginDir) {
|
|
|
739937
739721
|
for (const filePath of files2) {
|
|
739938
739722
|
let content;
|
|
739939
739723
|
try {
|
|
739940
|
-
content = await
|
|
739724
|
+
content = await readFile65(filePath, { encoding: "utf-8" });
|
|
739941
739725
|
} catch (e7) {
|
|
739942
739726
|
if (isENOENT(e7))
|
|
739943
739727
|
continue;
|
|
@@ -740006,7 +739790,7 @@ async function validateManifest3(filePath) {
|
|
|
740006
739790
|
return validateMarketplaceManifest(filePath);
|
|
740007
739791
|
case "unknown": {
|
|
740008
739792
|
try {
|
|
740009
|
-
const content = await
|
|
739793
|
+
const content = await readFile65(absolutePath, { encoding: "utf-8" });
|
|
740010
739794
|
const parsed = jsonParse(content);
|
|
740011
739795
|
if (Array.isArray(parsed.plugins)) {
|
|
740012
739796
|
return validateMarketplaceManifest(filePath);
|
|
@@ -741329,10 +741113,10 @@ ${args ? "Additional user input: " + args : ""}
|
|
|
741329
741113
|
});
|
|
741330
741114
|
|
|
741331
741115
|
// src/utils/releaseNotes.ts
|
|
741332
|
-
import { mkdir as mkdir53, readFile as
|
|
741333
|
-
import { dirname as dirname75, join as
|
|
741116
|
+
import { mkdir as mkdir53, readFile as readFile66, writeFile as writeFile59 } from "fs/promises";
|
|
741117
|
+
import { dirname as dirname75, join as join173 } from "path";
|
|
741334
741118
|
function getChangelogCachePath() {
|
|
741335
|
-
return
|
|
741119
|
+
return join173(getClaudeConfigHomeDir(), "cache", "changelog.md");
|
|
741336
741120
|
}
|
|
741337
741121
|
async function migrateChangelogFromConfig() {
|
|
741338
741122
|
const config13 = getGlobalConfig();
|
|
@@ -741342,7 +741126,7 @@ async function migrateChangelogFromConfig() {
|
|
|
741342
741126
|
const cachePath = getChangelogCachePath();
|
|
741343
741127
|
try {
|
|
741344
741128
|
await mkdir53(dirname75(cachePath), { recursive: true });
|
|
741345
|
-
await
|
|
741129
|
+
await writeFile59(cachePath, config13.cachedChangelog, {
|
|
741346
741130
|
encoding: "utf-8",
|
|
741347
741131
|
flag: "wx"
|
|
741348
741132
|
});
|
|
@@ -741364,7 +741148,7 @@ async function fetchAndStoreChangelog() {
|
|
|
741364
741148
|
}
|
|
741365
741149
|
const cachePath = getChangelogCachePath();
|
|
741366
741150
|
await mkdir53(dirname75(cachePath), { recursive: true });
|
|
741367
|
-
await
|
|
741151
|
+
await writeFile59(cachePath, changelogContent, { encoding: "utf-8" });
|
|
741368
741152
|
changelogMemoryCache = changelogContent;
|
|
741369
741153
|
const changelogLastFetched = Date.now();
|
|
741370
741154
|
saveGlobalConfig((current2) => ({
|
|
@@ -741379,7 +741163,7 @@ async function getStoredChangelog() {
|
|
|
741379
741163
|
}
|
|
741380
741164
|
const cachePath = getChangelogCachePath();
|
|
741381
741165
|
try {
|
|
741382
|
-
const content = await
|
|
741166
|
+
const content = await readFile66(cachePath, "utf-8");
|
|
741383
741167
|
changelogMemoryCache = content;
|
|
741384
741168
|
return content;
|
|
741385
741169
|
} catch {
|
|
@@ -741450,7 +741234,7 @@ function getAllReleaseNotes(changelogContent = getStoredChangelogFromMemory()) {
|
|
|
741450
741234
|
return [];
|
|
741451
741235
|
}
|
|
741452
741236
|
}
|
|
741453
|
-
async function checkForReleaseNotes(lastSeenVersion, currentVersion = "4.2.
|
|
741237
|
+
async function checkForReleaseNotes(lastSeenVersion, currentVersion = "4.2.16") {
|
|
741454
741238
|
if (process.env.USER_TYPE === "sf") {
|
|
741455
741239
|
const changelog = "";
|
|
741456
741240
|
if (changelog) {
|
|
@@ -741477,7 +741261,7 @@ async function checkForReleaseNotes(lastSeenVersion, currentVersion = "4.2.15")
|
|
|
741477
741261
|
releaseNotes
|
|
741478
741262
|
};
|
|
741479
741263
|
}
|
|
741480
|
-
function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "4.2.
|
|
741264
|
+
function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "4.2.16") {
|
|
741481
741265
|
if (process.env.USER_TYPE === "sf") {
|
|
741482
741266
|
const changelog = "";
|
|
741483
741267
|
if (changelog) {
|
|
@@ -741757,9 +741541,9 @@ var init_rename = __esm(() => {
|
|
|
741757
741541
|
});
|
|
741758
741542
|
|
|
741759
741543
|
// src/commands/rename/index.ts
|
|
741760
|
-
var
|
|
741544
|
+
var rename14, rename_default;
|
|
741761
741545
|
var init_rename2 = __esm(() => {
|
|
741762
|
-
|
|
741546
|
+
rename14 = {
|
|
741763
741547
|
type: "local-jsx",
|
|
741764
741548
|
name: "rename",
|
|
741765
741549
|
description: "Rename the current conversation",
|
|
@@ -741768,7 +741552,7 @@ var init_rename2 = __esm(() => {
|
|
|
741768
741552
|
argumentHint: "[name]",
|
|
741769
741553
|
load: () => Promise.resolve().then(() => (init_rename(), exports_rename))
|
|
741770
741554
|
};
|
|
741771
|
-
rename_default =
|
|
741555
|
+
rename_default = rename14;
|
|
741772
741556
|
});
|
|
741773
741557
|
|
|
741774
741558
|
// node_modules/.bun/fuse.js@7.4.2/node_modules/fuse.js/dist/fuse.mjs
|
|
@@ -743990,7 +743774,7 @@ function isNotLoggedIn() {
|
|
|
743990
743774
|
return true;
|
|
743991
743775
|
}
|
|
743992
743776
|
function getLogoDisplayData() {
|
|
743993
|
-
const version10 = process.env.DEMO_VERSION ?? "4.2.
|
|
743777
|
+
const version10 = process.env.DEMO_VERSION ?? "4.2.16";
|
|
743994
743778
|
const serverUrl = getDirectConnectServerUrl();
|
|
743995
743779
|
const displayPath = process.env.DEMO_VERSION ? "/code/claude" : getDisplayPath(getCwd());
|
|
743996
743780
|
const cwd2 = serverUrl ? `${displayPath} in ${serverUrl.replace(/^https?:\/\//, "")}` : displayPath;
|
|
@@ -744568,7 +744352,7 @@ var init_MatrixMessageLine = __esm(() => {
|
|
|
744568
744352
|
// src/components/matrix-tactical/MatrixWelcome.tsx
|
|
744569
744353
|
import { basename as basename47 } from "path";
|
|
744570
744354
|
function MatrixWelcome({
|
|
744571
|
-
version: version10 = "4.2.
|
|
744355
|
+
version: version10 = "4.2.16",
|
|
744572
744356
|
projectName,
|
|
744573
744357
|
cwd: cwd2,
|
|
744574
744358
|
modelDisplayName,
|
|
@@ -745203,13 +744987,13 @@ function LogoV2() {
|
|
|
745203
744987
|
const { hasReleaseNotes } = checkForReleaseNotesSync(config13.lastReleaseNotesSeen);
|
|
745204
744988
|
import_react167.useEffect(() => {
|
|
745205
744989
|
const currentConfig = getGlobalConfig();
|
|
745206
|
-
if (currentConfig.lastReleaseNotesSeen === "4.2.
|
|
744990
|
+
if (currentConfig.lastReleaseNotesSeen === "4.2.16") {
|
|
745207
744991
|
return;
|
|
745208
744992
|
}
|
|
745209
744993
|
saveGlobalConfig((current2) => {
|
|
745210
|
-
if (current2.lastReleaseNotesSeen === "4.2.
|
|
744994
|
+
if (current2.lastReleaseNotesSeen === "4.2.16")
|
|
745211
744995
|
return current2;
|
|
745212
|
-
return { ...current2, lastReleaseNotesSeen: "4.2.
|
|
744996
|
+
return { ...current2, lastReleaseNotesSeen: "4.2.16" };
|
|
745213
744997
|
});
|
|
745214
744998
|
if (showOnboarding) {
|
|
745215
744999
|
incrementProjectOnboardingSeenCount();
|
|
@@ -754769,7 +754553,7 @@ import {
|
|
|
754769
754553
|
writeFileSync as writeFileSync19
|
|
754770
754554
|
} from "fs";
|
|
754771
754555
|
import { homedir as homedir41, tmpdir as tmpdir17 } from "os";
|
|
754772
|
-
import { join as
|
|
754556
|
+
import { join as join174 } from "path";
|
|
754773
754557
|
import * as childProcess4 from "child_process";
|
|
754774
754558
|
import { promisify as promisify16 } from "util";
|
|
754775
754559
|
function sanitizeErrorMessage(msg) {
|
|
@@ -754823,10 +754607,10 @@ function getTranscriptPath2() {
|
|
|
754823
754607
|
const sessionId = getSessionId();
|
|
754824
754608
|
const projectDir = getSessionProjectDir();
|
|
754825
754609
|
if (projectDir) {
|
|
754826
|
-
return
|
|
754610
|
+
return join174(projectDir, `${sessionId}.jsonl`);
|
|
754827
754611
|
}
|
|
754828
754612
|
const encoded = sanitizePath(getOriginalCwd());
|
|
754829
|
-
return
|
|
754613
|
+
return join174(getClaudeConfigHomeDir(), "projects", encoded, `${sessionId}.jsonl`);
|
|
754830
754614
|
}
|
|
754831
754615
|
async function ghAvailable() {
|
|
754832
754616
|
try {
|
|
@@ -755007,8 +754791,8 @@ var init_share = __esm(() => {
|
|
|
755007
754791
|
if (opts.maskSecrets) {
|
|
755008
754792
|
uploadContent = maskSecrets(uploadContent);
|
|
755009
754793
|
}
|
|
755010
|
-
const tmpDir = mkdtempSync3(
|
|
755011
|
-
const tmpFile =
|
|
754794
|
+
const tmpDir = mkdtempSync3(join174(tmpdir17(), "cc-share-"));
|
|
754795
|
+
const tmpFile = join174(tmpDir, "claude-session.jsonl");
|
|
755012
754796
|
try {
|
|
755013
754797
|
writeFileSync19(tmpFile, uploadContent, "utf8");
|
|
755014
754798
|
} catch (writeErr) {
|
|
@@ -759826,8 +759610,8 @@ __export(exports_thinkback, {
|
|
|
759826
759610
|
playAnimation: () => playAnimation,
|
|
759827
759611
|
call: () => call38
|
|
759828
759612
|
});
|
|
759829
|
-
import { readFile as
|
|
759830
|
-
import { join as
|
|
759613
|
+
import { readFile as readFile67 } from "fs/promises";
|
|
759614
|
+
import { join as join175 } from "path";
|
|
759831
759615
|
function getMarketplaceName() {
|
|
759832
759616
|
return process.env.USER_TYPE === "sf" ? INTERNAL_MARKETPLACE_NAME : OFFICIAL_MARKETPLACE_NAME;
|
|
759833
759617
|
}
|
|
@@ -759843,17 +759627,17 @@ async function getThinkbackSkillDir() {
|
|
|
759843
759627
|
if (!thinkbackPlugin) {
|
|
759844
759628
|
return null;
|
|
759845
759629
|
}
|
|
759846
|
-
const skillDir =
|
|
759630
|
+
const skillDir = join175(thinkbackPlugin.path, "skills", SKILL_NAME);
|
|
759847
759631
|
if (await pathExists(skillDir)) {
|
|
759848
759632
|
return skillDir;
|
|
759849
759633
|
}
|
|
759850
759634
|
return null;
|
|
759851
759635
|
}
|
|
759852
759636
|
async function playAnimation(skillDir) {
|
|
759853
|
-
const dataPath =
|
|
759854
|
-
const playerPath =
|
|
759637
|
+
const dataPath = join175(skillDir, "year_in_review.js");
|
|
759638
|
+
const playerPath = join175(skillDir, "player.js");
|
|
759855
759639
|
try {
|
|
759856
|
-
await
|
|
759640
|
+
await readFile67(dataPath);
|
|
759857
759641
|
} catch (e7) {
|
|
759858
759642
|
if (isENOENT(e7)) {
|
|
759859
759643
|
return {
|
|
@@ -759868,7 +759652,7 @@ async function playAnimation(skillDir) {
|
|
|
759868
759652
|
};
|
|
759869
759653
|
}
|
|
759870
759654
|
try {
|
|
759871
|
-
await
|
|
759655
|
+
await readFile67(playerPath);
|
|
759872
759656
|
} catch (e7) {
|
|
759873
759657
|
if (isENOENT(e7)) {
|
|
759874
759658
|
return {
|
|
@@ -759896,7 +759680,7 @@ async function playAnimation(skillDir) {
|
|
|
759896
759680
|
} catch {} finally {
|
|
759897
759681
|
inkInstance.exitAlternateScreen();
|
|
759898
759682
|
}
|
|
759899
|
-
const htmlPath =
|
|
759683
|
+
const htmlPath = join175(skillDir, "year_in_review.html");
|
|
759900
759684
|
if (await pathExists(htmlPath)) {
|
|
759901
759685
|
const platform12 = getPlatform();
|
|
759902
759686
|
const openCmd = platform12 === "macos" ? "open" : platform12 === "windows" ? "start" : "xdg-open";
|
|
@@ -760112,7 +759896,7 @@ function ThinkbackFlow({
|
|
|
760112
759896
|
if (!skillDir) {
|
|
760113
759897
|
return;
|
|
760114
759898
|
}
|
|
760115
|
-
const dataPath =
|
|
759899
|
+
const dataPath = join175(skillDir, "year_in_review.js");
|
|
760116
759900
|
pathExists(dataPath).then((exists) => {
|
|
760117
759901
|
logForDebugging(`Checking for ${dataPath}: ${exists ? "found" : "not found"}`);
|
|
760118
759902
|
setHasGenerated(exists);
|
|
@@ -760217,7 +760001,7 @@ var exports_thinkback_play = {};
|
|
|
760217
760001
|
__export(exports_thinkback_play, {
|
|
760218
760002
|
call: () => call39
|
|
760219
760003
|
});
|
|
760220
|
-
import { join as
|
|
760004
|
+
import { join as join176 } from "path";
|
|
760221
760005
|
function getPluginId2() {
|
|
760222
760006
|
const marketplaceName = process.env.USER_TYPE === "sf" ? INTERNAL_MARKETPLACE_NAME2 : OFFICIAL_MARKETPLACE_NAME;
|
|
760223
760007
|
return `thinkback@${marketplaceName}`;
|
|
@@ -760239,7 +760023,7 @@ async function call39() {
|
|
|
760239
760023
|
value: "Thinkback plugin installation path not found."
|
|
760240
760024
|
};
|
|
760241
760025
|
}
|
|
760242
|
-
const skillDir =
|
|
760026
|
+
const skillDir = join176(firstInstall.installPath, "skills", SKILL_NAME2);
|
|
760243
760027
|
const result = await playAnimation(skillDir);
|
|
760244
760028
|
return { type: "text", value: result.message };
|
|
760245
760029
|
}
|
|
@@ -763543,7 +763327,7 @@ __export(exports_branch, {
|
|
|
763543
763327
|
call: () => call48
|
|
763544
763328
|
});
|
|
763545
763329
|
import { randomUUID as randomUUID45 } from "crypto";
|
|
763546
|
-
import { mkdir as mkdir54, readFile as
|
|
763330
|
+
import { mkdir as mkdir54, readFile as readFile68, writeFile as writeFile60 } from "fs/promises";
|
|
763547
763331
|
function deriveFirstPrompt(firstUserMessage) {
|
|
763548
763332
|
const content = firstUserMessage?.message?.content;
|
|
763549
763333
|
if (!content)
|
|
@@ -763562,7 +763346,7 @@ async function createFork(customTitle) {
|
|
|
763562
763346
|
await mkdir54(projectDir, { recursive: true, mode: 448 });
|
|
763563
763347
|
let transcriptContent;
|
|
763564
763348
|
try {
|
|
763565
|
-
transcriptContent = await
|
|
763349
|
+
transcriptContent = await readFile68(currentTranscriptPath2);
|
|
763566
763350
|
} catch {
|
|
763567
763351
|
throw new Error(t("commands.branch.noConversation"));
|
|
763568
763352
|
}
|
|
@@ -763607,7 +763391,7 @@ async function createFork(customTitle) {
|
|
|
763607
763391
|
};
|
|
763608
763392
|
lines2.push(jsonStringify(forkedReplacementEntry));
|
|
763609
763393
|
}
|
|
763610
|
-
await
|
|
763394
|
+
await writeFile60(forkSessionPath, lines2.join(`
|
|
763611
763395
|
`) + `
|
|
763612
763396
|
`, {
|
|
763613
763397
|
encoding: "utf8",
|
|
@@ -763874,8 +763658,8 @@ var init_types27 = __esm(() => {
|
|
|
763874
763658
|
});
|
|
763875
763659
|
|
|
763876
763660
|
// src/components/agents/agentFileUtils.ts
|
|
763877
|
-
import { mkdir as mkdir55, open as open13, unlink as
|
|
763878
|
-
import { join as
|
|
763661
|
+
import { mkdir as mkdir55, open as open13, unlink as unlink22 } from "fs/promises";
|
|
763662
|
+
import { join as join177 } from "path";
|
|
763879
763663
|
function formatAgentAsMarkdown(agentType, whenToUse, tools, systemPrompt2, color3, model, memory2, effort) {
|
|
763880
763664
|
const escapedWhenToUse = whenToUse.replace(/\\/gu, "\\\\").replace(/"/gu, "\\\"").replace(/\n/gu, "\\\\n");
|
|
763881
763665
|
const isAllTools = tools === undefined || tools.length === 1 && tools[0] === "*";
|
|
@@ -763902,26 +763686,26 @@ function getAgentDirectoryPath(location) {
|
|
|
763902
763686
|
case "flagSettings":
|
|
763903
763687
|
throw new Error(`Cannot get directory path for ${location} agents`);
|
|
763904
763688
|
case "userSettings":
|
|
763905
|
-
return
|
|
763689
|
+
return join177(getClaudeConfigHomeDir(), AGENT_PATHS.AGENTS_DIR);
|
|
763906
763690
|
case "projectSettings":
|
|
763907
|
-
return
|
|
763691
|
+
return join177(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
763908
763692
|
case "policySettings":
|
|
763909
|
-
return
|
|
763693
|
+
return join177(getManagedFilePath(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
763910
763694
|
case "localSettings":
|
|
763911
|
-
return
|
|
763695
|
+
return join177(getCwd(), AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
763912
763696
|
}
|
|
763913
763697
|
}
|
|
763914
763698
|
function getRelativeAgentDirectoryPath(location) {
|
|
763915
763699
|
switch (location) {
|
|
763916
763700
|
case "projectSettings":
|
|
763917
|
-
return
|
|
763701
|
+
return join177(".", AGENT_PATHS.FOLDER_NAME, AGENT_PATHS.AGENTS_DIR);
|
|
763918
763702
|
default:
|
|
763919
763703
|
return getAgentDirectoryPath(location);
|
|
763920
763704
|
}
|
|
763921
763705
|
}
|
|
763922
763706
|
function getNewAgentFilePath(agent) {
|
|
763923
763707
|
const dirPath = getAgentDirectoryPath(agent.source);
|
|
763924
|
-
return
|
|
763708
|
+
return join177(dirPath, `${agent.agentType}.md`);
|
|
763925
763709
|
}
|
|
763926
763710
|
function getActualAgentFilePath(agent) {
|
|
763927
763711
|
if (agent.source === "built-in") {
|
|
@@ -763932,14 +763716,14 @@ function getActualAgentFilePath(agent) {
|
|
|
763932
763716
|
}
|
|
763933
763717
|
const dirPath = getAgentDirectoryPath(agent.source);
|
|
763934
763718
|
const filename = agent.filename || agent.agentType;
|
|
763935
|
-
return
|
|
763719
|
+
return join177(dirPath, `${filename}.md`);
|
|
763936
763720
|
}
|
|
763937
763721
|
function getNewRelativeAgentFilePath(agent) {
|
|
763938
763722
|
if (agent.source === "built-in") {
|
|
763939
763723
|
return "Built-in";
|
|
763940
763724
|
}
|
|
763941
763725
|
const dirPath = getRelativeAgentDirectoryPath(agent.source);
|
|
763942
|
-
return
|
|
763726
|
+
return join177(dirPath, `${agent.agentType}.md`);
|
|
763943
763727
|
}
|
|
763944
763728
|
function getActualRelativeAgentFilePath(agent) {
|
|
763945
763729
|
if (isBuiltInAgent(agent)) {
|
|
@@ -763953,7 +763737,7 @@ function getActualRelativeAgentFilePath(agent) {
|
|
|
763953
763737
|
}
|
|
763954
763738
|
const dirPath = getRelativeAgentDirectoryPath(agent.source);
|
|
763955
763739
|
const filename = agent.filename || agent.agentType;
|
|
763956
|
-
return
|
|
763740
|
+
return join177(dirPath, `${filename}.md`);
|
|
763957
763741
|
}
|
|
763958
763742
|
async function ensureAgentDirectoryExists(source) {
|
|
763959
763743
|
const dirPath = getAgentDirectoryPath(source);
|
|
@@ -763990,7 +763774,7 @@ async function deleteAgentFromFile(agent) {
|
|
|
763990
763774
|
}
|
|
763991
763775
|
const filePath = getActualAgentFilePath(agent);
|
|
763992
763776
|
try {
|
|
763993
|
-
await
|
|
763777
|
+
await unlink22(filePath);
|
|
763994
763778
|
} catch (e7) {
|
|
763995
763779
|
const code = getErrnoCode(e7);
|
|
763996
763780
|
if (code !== "ENOENT") {
|
|
@@ -767463,8 +767247,8 @@ var init_rewind = __esm(() => {
|
|
|
767463
767247
|
|
|
767464
767248
|
// src/utils/heapDumpService.ts
|
|
767465
767249
|
import { createWriteStream as createWriteStream3, writeFileSync as writeFileSync20 } from "fs";
|
|
767466
|
-
import { readdir as readdir31, readFile as
|
|
767467
|
-
import { join as
|
|
767250
|
+
import { readdir as readdir31, readFile as readFile69, writeFile as writeFile61 } from "fs/promises";
|
|
767251
|
+
import { join as join178 } from "path";
|
|
767468
767252
|
import { pipeline as pipeline4 } from "stream/promises";
|
|
767469
767253
|
import {
|
|
767470
767254
|
getHeapSnapshot,
|
|
@@ -767488,7 +767272,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
767488
767272
|
} catch {}
|
|
767489
767273
|
let smapsRollup;
|
|
767490
767274
|
try {
|
|
767491
|
-
smapsRollup = await
|
|
767275
|
+
smapsRollup = await readFile69("/proc/self/smaps_rollup", "utf8");
|
|
767492
767276
|
} catch {}
|
|
767493
767277
|
const nativeMemory = usage2.rss - usage2.heapUsed;
|
|
767494
767278
|
const bytesPerSecond = uptimeSeconds > 0 ? usage2.rss / uptimeSeconds : 0;
|
|
@@ -767554,7 +767338,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
767554
767338
|
smapsRollup,
|
|
767555
767339
|
platform: process.platform,
|
|
767556
767340
|
nodeVersion: process.version,
|
|
767557
|
-
ccVersion: "4.2.
|
|
767341
|
+
ccVersion: "4.2.16"
|
|
767558
767342
|
};
|
|
767559
767343
|
}
|
|
767560
767344
|
async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
@@ -767572,9 +767356,9 @@ async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
|
767572
767356
|
const suffix = dumpNumber > 0 ? `-dump${dumpNumber}` : "";
|
|
767573
767357
|
const heapFilename = `${sessionId}${suffix}.heapsnapshot`;
|
|
767574
767358
|
const diagFilename = `${sessionId}${suffix}-diagnostics.json`;
|
|
767575
|
-
const heapPath =
|
|
767576
|
-
const diagPath =
|
|
767577
|
-
await
|
|
767359
|
+
const heapPath = join178(dumpDir, heapFilename);
|
|
767360
|
+
const diagPath = join178(dumpDir, diagFilename);
|
|
767361
|
+
await writeFile61(diagPath, jsonStringify(diagnostics, null, 2), {
|
|
767578
767362
|
mode: 384
|
|
767579
767363
|
});
|
|
767580
767364
|
logForDebugging(`[HeapDump] Diagnostics written to ${diagPath}`);
|
|
@@ -767670,7 +767454,7 @@ var init_mock_limits = __esm(() => {
|
|
|
767670
767454
|
var call54 = async () => {
|
|
767671
767455
|
return {
|
|
767672
767456
|
type: "text",
|
|
767673
|
-
value: `${"4.2.
|
|
767457
|
+
value: `${"4.2.16"} (built ${"2026-07-17T11:45:23.878Z"})`
|
|
767674
767458
|
};
|
|
767675
767459
|
}, version10, version_default;
|
|
767676
767460
|
var init_version2 = __esm(() => {
|
|
@@ -767694,7 +767478,7 @@ __export(exports_sessionMemory, {
|
|
|
767694
767478
|
initSessionMemory: () => initSessionMemory,
|
|
767695
767479
|
createMemoryFileCanUseTool: () => createMemoryFileCanUseTool
|
|
767696
767480
|
});
|
|
767697
|
-
import { writeFile as
|
|
767481
|
+
import { writeFile as writeFile62 } from "fs/promises";
|
|
767698
767482
|
function isSessionMemoryGateEnabled() {
|
|
767699
767483
|
return getFeatureValue_CACHED_MAY_BE_STALE("tengu_session_memory", false);
|
|
767700
767484
|
}
|
|
@@ -767751,13 +767535,13 @@ async function setupSessionMemoryFile(toolUseContext) {
|
|
|
767751
767535
|
await fs33.mkdir(sessionMemoryDir, { mode: 448 });
|
|
767752
767536
|
const memoryPath = getSessionMemoryPath();
|
|
767753
767537
|
try {
|
|
767754
|
-
await
|
|
767538
|
+
await writeFile62(memoryPath, "", {
|
|
767755
767539
|
encoding: "utf-8",
|
|
767756
767540
|
mode: 384,
|
|
767757
767541
|
flag: "wx"
|
|
767758
767542
|
});
|
|
767759
767543
|
const template = await loadSessionMemoryTemplate();
|
|
767760
|
-
await
|
|
767544
|
+
await writeFile62(memoryPath, template, {
|
|
767761
767545
|
encoding: "utf-8",
|
|
767762
767546
|
mode: 384
|
|
767763
767547
|
});
|
|
@@ -768133,7 +767917,7 @@ var exports_skill_learning = {};
|
|
|
768133
767917
|
__export(exports_skill_learning, {
|
|
768134
767918
|
call: () => call56
|
|
768135
767919
|
});
|
|
768136
|
-
import { join as
|
|
767920
|
+
import { join as join179 } from "path";
|
|
768137
767921
|
function parseFlagString(parts, flag) {
|
|
768138
767922
|
const eqForm = parts.find((p2) => p2.startsWith(`${flag}=`));
|
|
768139
767923
|
if (eqForm)
|
|
@@ -768207,8 +767991,8 @@ var call56 = async (args) => {
|
|
|
768207
767991
|
if (generate4) {
|
|
768208
767992
|
for (const draft of drafts) {
|
|
768209
767993
|
const roots = [
|
|
768210
|
-
|
|
768211
|
-
|
|
767994
|
+
join179(process.cwd(), ".claude", "skills"),
|
|
767995
|
+
join179(getClaudeConfigHomeDir(), "skills")
|
|
768212
767996
|
];
|
|
768213
767997
|
const existing = await compareExistingSkills(draft, roots);
|
|
768214
767998
|
const decision = decideSkillLifecycle(draft, existing);
|
|
@@ -768241,8 +768025,8 @@ ${written.join(`
|
|
|
768241
768025
|
const filtered = filter2(all4);
|
|
768242
768026
|
if (filtered.length !== all4.length) {
|
|
768243
768027
|
await exportInstincts(output, options);
|
|
768244
|
-
const { writeFile:
|
|
768245
|
-
await
|
|
768028
|
+
const { writeFile: writeFile63 } = await import("fs/promises");
|
|
768029
|
+
await writeFile63(output, `${JSON.stringify(filtered, null, 2)}
|
|
768246
768030
|
`);
|
|
768247
768031
|
} else {
|
|
768248
768032
|
await exportInstincts(output, options);
|
|
@@ -768802,7 +768586,7 @@ var init_reset_limits = __esm(() => {
|
|
|
768802
768586
|
|
|
768803
768587
|
// src/commands/perf-issue/index.ts
|
|
768804
768588
|
import { existsSync as existsSync32, mkdirSync as mkdirSync13, readFileSync as readFileSync38, writeFileSync as writeFileSync21 } from "fs";
|
|
768805
|
-
import { join as
|
|
768589
|
+
import { join as join180 } from "path";
|
|
768806
768590
|
import { homedir as homedir42 } from "os";
|
|
768807
768591
|
function lookupCostRates(model) {
|
|
768808
768592
|
if (!model)
|
|
@@ -768821,14 +768605,14 @@ function sanitizeErrorMessage2(msg) {
|
|
|
768821
768605
|
return sanitized;
|
|
768822
768606
|
}
|
|
768823
768607
|
function getPerfReportDir() {
|
|
768824
|
-
return
|
|
768608
|
+
return join180(homedir42(), ".claude", "perf-reports");
|
|
768825
768609
|
}
|
|
768826
768610
|
function getTranscriptPath3() {
|
|
768827
768611
|
const sessionId = getSessionId();
|
|
768828
768612
|
const projectDir = getSessionProjectDir();
|
|
768829
768613
|
if (projectDir)
|
|
768830
|
-
return
|
|
768831
|
-
return
|
|
768614
|
+
return join180(projectDir, `${sessionId}.jsonl`);
|
|
768615
|
+
return join180(getClaudeConfigHomeDir(), "projects", sanitizePath(getOriginalCwd()), `${sessionId}.jsonl`);
|
|
768832
768616
|
}
|
|
768833
768617
|
function parseTimestampMs(tsRaw) {
|
|
768834
768618
|
if (tsRaw === undefined)
|
|
@@ -769121,7 +768905,7 @@ var init_perf_issue = __esm(() => {
|
|
|
769121
768905
|
const stamp = new Date().toISOString().replace(/[:.]/gu, "-");
|
|
769122
768906
|
const sessionId = getSessionId();
|
|
769123
768907
|
const ext = format6 === "json" ? "json" : format6 === "csv" ? "csv" : "md";
|
|
769124
|
-
const reportPath =
|
|
768908
|
+
const reportPath = join180(dir, `perf-${stamp}-${sessionId.slice(0, 8)}.${ext}`);
|
|
769125
768909
|
const logPath = getTranscriptPath3();
|
|
769126
768910
|
const hasLog = existsSync32(logPath);
|
|
769127
768911
|
let analyzed = null;
|
|
@@ -769983,7 +769767,7 @@ var init_sandbox_toggle2 = __esm(() => {
|
|
|
769983
769767
|
|
|
769984
769768
|
// src/utils/claudeInChrome/setupPortable.ts
|
|
769985
769769
|
import { readdir as readdir32 } from "fs/promises";
|
|
769986
|
-
import { join as
|
|
769770
|
+
import { join as join181 } from "path";
|
|
769987
769771
|
function getExtensionIds() {
|
|
769988
769772
|
return process.env.USER_TYPE === "sf" ? [PROD_EXTENSION_ID, DEV_EXTENSION_ID, ANT_EXTENSION_ID] : [PROD_EXTENSION_ID];
|
|
769989
769773
|
}
|
|
@@ -770010,7 +769794,7 @@ async function detectExtensionInstallationPortable(browserPaths, log15) {
|
|
|
770010
769794
|
}
|
|
770011
769795
|
for (const profile3 of profileDirs) {
|
|
770012
769796
|
for (const extensionId of extensionIds) {
|
|
770013
|
-
const extensionPath =
|
|
769797
|
+
const extensionPath = join181(browserBasePath, profile3, "Extensions", extensionId);
|
|
770014
769798
|
try {
|
|
770015
769799
|
await readdir32(extensionPath);
|
|
770016
769800
|
log15?.(`[Chrome MCP] Extension ${extensionId} found in ${browser} ${profile3}`);
|
|
@@ -770033,9 +769817,9 @@ var init_setupPortable = __esm(() => {
|
|
|
770033
769817
|
});
|
|
770034
769818
|
|
|
770035
769819
|
// src/utils/claudeInChrome/setup.ts
|
|
770036
|
-
import { chmod as chmod11, mkdir as mkdir56, readFile as
|
|
769820
|
+
import { chmod as chmod11, mkdir as mkdir56, readFile as readFile70, writeFile as writeFile63 } from "fs/promises";
|
|
770037
769821
|
import { homedir as homedir43 } from "os";
|
|
770038
|
-
import { join as
|
|
769822
|
+
import { join as join182 } from "path";
|
|
770039
769823
|
import { fileURLToPath as fileURLToPath12 } from "url";
|
|
770040
769824
|
function shouldEnableClaudeInChrome(chromeFlag) {
|
|
770041
769825
|
if (getIsNonInteractiveSession() && chromeFlag !== true) {
|
|
@@ -770092,8 +769876,8 @@ function setupClaudeInChrome() {
|
|
|
770092
769876
|
};
|
|
770093
769877
|
} else {
|
|
770094
769878
|
const __filename3 = fileURLToPath12(import.meta.url);
|
|
770095
|
-
const __dirname4 =
|
|
770096
|
-
const cliPath =
|
|
769879
|
+
const __dirname4 = join182(__filename3, "..");
|
|
769880
|
+
const cliPath = join182(__dirname4, "cli.js");
|
|
770097
769881
|
createWrapperScript(`"${process.execPath}" "${cliPath}" --chrome-native-host`).then((manifestBinaryPath) => installChromeNativeHostManifest(manifestBinaryPath)).catch((e7) => logForDebugging(`[CoStrict in Chrome] Failed to install native host: ${e7}`, { level: "error" }));
|
|
770098
769882
|
const mcpConfig = {
|
|
770099
769883
|
[CLAUDE_IN_CHROME_MCP_SERVER_NAME]: {
|
|
@@ -770115,8 +769899,8 @@ function getNativeMessagingHostsDirs() {
|
|
|
770115
769899
|
const platform12 = getPlatform();
|
|
770116
769900
|
if (platform12 === "windows") {
|
|
770117
769901
|
const home = homedir43();
|
|
770118
|
-
const appData = process.env.APPDATA ||
|
|
770119
|
-
return [
|
|
769902
|
+
const appData = process.env.APPDATA || join182(home, "AppData", "Local");
|
|
769903
|
+
return [join182(appData, "CoStrict", "ChromeNativeHost")];
|
|
770120
769904
|
}
|
|
770121
769905
|
return getAllNativeMessagingHostsDirs().map(({ path: path50 }) => path50);
|
|
770122
769906
|
}
|
|
@@ -770141,14 +769925,14 @@ async function installChromeNativeHostManifest(manifestBinaryPath) {
|
|
|
770141
769925
|
const manifestContent = jsonStringify(manifest, null, 2);
|
|
770142
769926
|
let anyManifestUpdated = false;
|
|
770143
769927
|
for (const manifestDir of manifestDirs) {
|
|
770144
|
-
const manifestPath =
|
|
770145
|
-
const existingContent = await
|
|
769928
|
+
const manifestPath = join182(manifestDir, NATIVE_HOST_MANIFEST_NAME);
|
|
769929
|
+
const existingContent = await readFile70(manifestPath, "utf-8").catch(() => null);
|
|
770146
769930
|
if (existingContent === manifestContent) {
|
|
770147
769931
|
continue;
|
|
770148
769932
|
}
|
|
770149
769933
|
try {
|
|
770150
769934
|
await mkdir56(manifestDir, { recursive: true });
|
|
770151
|
-
await
|
|
769935
|
+
await writeFile63(manifestPath, manifestContent);
|
|
770152
769936
|
logForDebugging(`[CoStrict in Chrome] Installed native host manifest at: ${manifestPath}`);
|
|
770153
769937
|
anyManifestUpdated = true;
|
|
770154
769938
|
} catch (error100) {
|
|
@@ -770156,7 +769940,7 @@ async function installChromeNativeHostManifest(manifestBinaryPath) {
|
|
|
770156
769940
|
}
|
|
770157
769941
|
}
|
|
770158
769942
|
if (getPlatform() === "windows") {
|
|
770159
|
-
const manifestPath =
|
|
769943
|
+
const manifestPath = join182(manifestDirs[0], NATIVE_HOST_MANIFEST_NAME);
|
|
770160
769944
|
registerWindowsNativeHosts(manifestPath);
|
|
770161
769945
|
}
|
|
770162
769946
|
if (anyManifestUpdated) {
|
|
@@ -770194,8 +769978,8 @@ function registerWindowsNativeHosts(manifestPath) {
|
|
|
770194
769978
|
}
|
|
770195
769979
|
async function createWrapperScript(command10) {
|
|
770196
769980
|
const platform12 = getPlatform();
|
|
770197
|
-
const chromeDir =
|
|
770198
|
-
const wrapperPath = platform12 === "windows" ?
|
|
769981
|
+
const chromeDir = join182(getClaudeConfigHomeDir(), "chrome");
|
|
769982
|
+
const wrapperPath = platform12 === "windows" ? join182(chromeDir, "chrome-native-host.bat") : join182(chromeDir, "chrome-native-host");
|
|
770199
769983
|
const scriptContent = platform12 === "windows" ? `@echo off
|
|
770200
769984
|
REM Chrome native host wrapper script
|
|
770201
769985
|
REM Generated by CoStrict - do not edit manually
|
|
@@ -770205,12 +769989,12 @@ ${command10}
|
|
|
770205
769989
|
# Generated by CoStrict - do not edit manually
|
|
770206
769990
|
exec ${command10}
|
|
770207
769991
|
`;
|
|
770208
|
-
const existingContent = await
|
|
769992
|
+
const existingContent = await readFile70(wrapperPath, "utf-8").catch(() => null);
|
|
770209
769993
|
if (existingContent === scriptContent) {
|
|
770210
769994
|
return wrapperPath;
|
|
770211
769995
|
}
|
|
770212
769996
|
await mkdir56(chromeDir, { recursive: true });
|
|
770213
|
-
await
|
|
769997
|
+
await writeFile63(wrapperPath, scriptContent);
|
|
770214
769998
|
if (platform12 !== "windows") {
|
|
770215
769999
|
await chmod11(wrapperPath, 493);
|
|
770216
770000
|
}
|
|
@@ -770645,9 +770429,9 @@ var init_advisor2 = __esm(() => {
|
|
|
770645
770429
|
|
|
770646
770430
|
// src/daemon/state.ts
|
|
770647
770431
|
import { readFileSync as readFileSync39, writeFileSync as writeFileSync22, mkdirSync as mkdirSync14, unlinkSync as unlinkSync9 } from "fs";
|
|
770648
|
-
import { join as
|
|
770432
|
+
import { join as join183, dirname as dirname76 } from "path";
|
|
770649
770433
|
function getDaemonStateFilePath(name3 = "remote-control") {
|
|
770650
|
-
return
|
|
770434
|
+
return join183(getClaudeConfigHomeDir(), "daemon", `${name3}.json`);
|
|
770651
770435
|
}
|
|
770652
770436
|
function writeDaemonState(state3, name3 = "remote-control") {
|
|
770653
770437
|
const filePath = getDaemonStateFilePath(name3);
|
|
@@ -770989,18 +770773,18 @@ __export(exports_bg, {
|
|
|
770989
770773
|
findSession: () => findSession,
|
|
770990
770774
|
attachHandler: () => attachHandler
|
|
770991
770775
|
});
|
|
770992
|
-
import { readdir as readdir33, readFile as
|
|
770993
|
-
import { join as
|
|
770776
|
+
import { readdir as readdir33, readFile as readFile71, unlink as unlink23 } from "fs/promises";
|
|
770777
|
+
import { join as join184 } from "path";
|
|
770994
770778
|
import { randomUUID as randomUUID46 } from "crypto";
|
|
770995
770779
|
function getSessionsDir3() {
|
|
770996
|
-
return
|
|
770780
|
+
return join184(getClaudeConfigHomeDir(), "sessions");
|
|
770997
770781
|
}
|
|
770998
770782
|
function getAllSessionsDirs3() {
|
|
770999
770783
|
const primary = getSessionsDir3();
|
|
771000
770784
|
const legacyHome = getLegacyConfigHomeDir();
|
|
771001
770785
|
if (!legacyHome)
|
|
771002
770786
|
return [primary];
|
|
771003
|
-
const legacy =
|
|
770787
|
+
const legacy = join184(legacyHome, "sessions");
|
|
771004
770788
|
if (primary === legacy)
|
|
771005
770789
|
return [primary];
|
|
771006
770790
|
return [primary, legacy];
|
|
@@ -771020,11 +770804,11 @@ async function listLiveSessions() {
|
|
|
771020
770804
|
continue;
|
|
771021
770805
|
const pid = parseInt(file3.slice(0, -5), 10);
|
|
771022
770806
|
if (!isProcessRunning(pid)) {
|
|
771023
|
-
|
|
770807
|
+
unlink23(join184(dir, file3)).catch(() => {});
|
|
771024
770808
|
continue;
|
|
771025
770809
|
}
|
|
771026
770810
|
try {
|
|
771027
|
-
const raw = await
|
|
770811
|
+
const raw = await readFile71(join184(dir, file3), "utf-8");
|
|
771028
770812
|
const entry = jsonParse(raw);
|
|
771029
770813
|
sessions.push(entry);
|
|
771030
770814
|
} catch {}
|
|
@@ -771109,7 +770893,7 @@ async function logsHandler(target) {
|
|
|
771109
770893
|
return;
|
|
771110
770894
|
}
|
|
771111
770895
|
try {
|
|
771112
|
-
const content = await
|
|
770896
|
+
const content = await readFile71(session2.logPath, "utf-8");
|
|
771113
770897
|
process.stdout.write(content);
|
|
771114
770898
|
} catch (e7) {
|
|
771115
770899
|
console.error(t("cli.bg.failedToReadLog", `Failed to read log file: ${session2.logPath}`));
|
|
@@ -771202,8 +770986,8 @@ async function killHandler(target) {
|
|
|
771202
770986
|
} else {
|
|
771203
770987
|
console.log(t("cli.bg.sessionStopped", "Session stopped."));
|
|
771204
770988
|
}
|
|
771205
|
-
const pidFile =
|
|
771206
|
-
|
|
770989
|
+
const pidFile = join184(getSessionsDir3(), `${session2.pid}.json`);
|
|
770990
|
+
unlink23(pidFile).catch(() => {});
|
|
771207
770991
|
}
|
|
771208
770992
|
async function handleBgStart(args) {
|
|
771209
770993
|
const engine = await selectEngine();
|
|
@@ -771224,7 +771008,7 @@ Alternatively, install tmux for interactive background sessions:
|
|
|
771224
771008
|
return;
|
|
771225
771009
|
}
|
|
771226
771010
|
const sessionName = `claude-bg-${randomUUID46().slice(0, 8)}`;
|
|
771227
|
-
const logPath =
|
|
771011
|
+
const logPath = join184(getClaudeConfigHomeDir(), "sessions", "logs", `${sessionName}.log`);
|
|
771228
771012
|
try {
|
|
771229
771013
|
const result = await engine.start({
|
|
771230
771014
|
sessionName,
|
|
@@ -771291,8 +771075,8 @@ var init_teamDiscovery = __esm(() => {
|
|
|
771291
771075
|
});
|
|
771292
771076
|
|
|
771293
771077
|
// src/utils/workflowRuns.ts
|
|
771294
|
-
import { readdir as readdir34, readFile as
|
|
771295
|
-
import { join as
|
|
771078
|
+
import { readdir as readdir34, readFile as readFile72 } from "fs/promises";
|
|
771079
|
+
import { join as join185 } from "path";
|
|
771296
771080
|
function isRecord4(value) {
|
|
771297
771081
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
771298
771082
|
}
|
|
@@ -771350,7 +771134,7 @@ function normalizeWorkflowRun(value) {
|
|
|
771350
771134
|
}
|
|
771351
771135
|
async function readWorkflowRun2(rootDir, runId) {
|
|
771352
771136
|
try {
|
|
771353
|
-
const parsed = safeParseJSON(await
|
|
771137
|
+
const parsed = safeParseJSON(await readFile72(join185(rootDir, WORKFLOW_RUNS_REL, `${runId}.json`), "utf-8"), false);
|
|
771354
771138
|
return normalizeWorkflowRun(parsed);
|
|
771355
771139
|
} catch {
|
|
771356
771140
|
return null;
|
|
@@ -771359,7 +771143,7 @@ async function readWorkflowRun2(rootDir, runId) {
|
|
|
771359
771143
|
async function listWorkflowRuns2(rootDir = getProjectRoot()) {
|
|
771360
771144
|
let files3;
|
|
771361
771145
|
try {
|
|
771362
|
-
files3 = await readdir34(
|
|
771146
|
+
files3 = await readdir34(join185(rootDir, WORKFLOW_RUNS_REL));
|
|
771363
771147
|
} catch {
|
|
771364
771148
|
return [];
|
|
771365
771149
|
}
|
|
@@ -771395,7 +771179,7 @@ var WORKFLOW_RUNS_REL, MAX_WORKFLOW_RUNS = 200, WORKFLOW_RUN_STATUSES, WORKFLOW_
|
|
|
771395
771179
|
var init_workflowRuns = __esm(() => {
|
|
771396
771180
|
init_state();
|
|
771397
771181
|
init_json();
|
|
771398
|
-
WORKFLOW_RUNS_REL =
|
|
771182
|
+
WORKFLOW_RUNS_REL = join185(".claude", "workflow-runs");
|
|
771399
771183
|
WORKFLOW_RUN_STATUSES = ["running", "completed", "cancelled"];
|
|
771400
771184
|
WORKFLOW_STEP_STATUSES = [
|
|
771401
771185
|
"pending",
|
|
@@ -771407,18 +771191,18 @@ var init_workflowRuns = __esm(() => {
|
|
|
771407
771191
|
|
|
771408
771192
|
// src/utils/pipeTransport.ts
|
|
771409
771193
|
import { createServer as createServer8, createConnection as createConnection4 } from "net";
|
|
771410
|
-
import { mkdir as mkdir57, unlink as
|
|
771411
|
-
import { join as
|
|
771194
|
+
import { mkdir as mkdir57, unlink as unlink24, readdir as readdir35, writeFile as writeFile64 } from "fs/promises";
|
|
771195
|
+
import { join as join186 } from "path";
|
|
771412
771196
|
import { EventEmitter as EventEmitter7 } from "events";
|
|
771413
771197
|
function getPipesDir() {
|
|
771414
|
-
return
|
|
771198
|
+
return join186(getClaudeConfigHomeDir(), "pipes");
|
|
771415
771199
|
}
|
|
771416
771200
|
function getPipePath(name3) {
|
|
771417
771201
|
const safeName = name3.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
771418
771202
|
if (process.platform === "win32") {
|
|
771419
771203
|
return `\\\\.\\pipe\\claude-code-${safeName}`;
|
|
771420
771204
|
}
|
|
771421
|
-
return
|
|
771205
|
+
return join186(getPipesDir(), `${safeName}.sock`);
|
|
771422
771206
|
}
|
|
771423
771207
|
async function ensurePipesDir() {
|
|
771424
771208
|
await mkdir57(getPipesDir(), { recursive: true });
|
|
@@ -771503,7 +771287,7 @@ var init_pipeTransport = __esm(() => {
|
|
|
771503
771287
|
await ensurePipesDir();
|
|
771504
771288
|
if (process.platform !== "win32") {
|
|
771505
771289
|
try {
|
|
771506
|
-
await
|
|
771290
|
+
await unlink24(this.socketPath);
|
|
771507
771291
|
} catch {}
|
|
771508
771292
|
}
|
|
771509
771293
|
await new Promise((resolve53, reject2) => {
|
|
@@ -771511,9 +771295,9 @@ var init_pipeTransport = __esm(() => {
|
|
|
771511
771295
|
this.server.on("error", reject2);
|
|
771512
771296
|
this.server.listen(this.socketPath, () => {
|
|
771513
771297
|
if (process.platform === "win32") {
|
|
771514
|
-
const regFile =
|
|
771298
|
+
const regFile = join186(getPipesDir(), `${this.name}.pipe`);
|
|
771515
771299
|
const { hostname: hostname5 } = __require("os");
|
|
771516
|
-
|
|
771300
|
+
writeFile64(regFile, JSON.stringify({
|
|
771517
771301
|
pid: process.pid,
|
|
771518
771302
|
ts: Date.now(),
|
|
771519
771303
|
ip: getLocalIp(),
|
|
@@ -771587,10 +771371,10 @@ var init_pipeTransport = __esm(() => {
|
|
|
771587
771371
|
this.server.close(() => {
|
|
771588
771372
|
this.server = null;
|
|
771589
771373
|
if (process.platform === "win32") {
|
|
771590
|
-
const regFile =
|
|
771591
|
-
|
|
771374
|
+
const regFile = join186(getPipesDir(), `${this.name}.pipe`);
|
|
771375
|
+
unlink24(regFile).catch(() => {});
|
|
771592
771376
|
} else {
|
|
771593
|
-
|
|
771377
|
+
unlink24(this.socketPath).catch(() => {});
|
|
771594
771378
|
}
|
|
771595
771379
|
resolve53();
|
|
771596
771380
|
});
|
|
@@ -771617,14 +771401,14 @@ var init_pipeTransport = __esm(() => {
|
|
|
771617
771401
|
});
|
|
771618
771402
|
|
|
771619
771403
|
// src/utils/pipeRegistry.ts
|
|
771620
|
-
import { readFile as
|
|
771621
|
-
import { join as
|
|
771404
|
+
import { readFile as readFile73, writeFile as writeFile65, unlink as unlink25, mkdir as mkdir58 } from "fs/promises";
|
|
771405
|
+
import { join as join187 } from "path";
|
|
771622
771406
|
function getRegistryPath() {
|
|
771623
|
-
return
|
|
771407
|
+
return join187(getPipesDir(), "registry.json");
|
|
771624
771408
|
}
|
|
771625
771409
|
async function readRegistry() {
|
|
771626
771410
|
try {
|
|
771627
|
-
const content = await
|
|
771411
|
+
const content = await readFile73(getRegistryPath(), "utf8");
|
|
771628
771412
|
const parsed = JSON.parse(content);
|
|
771629
771413
|
if (parsed.version !== 1)
|
|
771630
771414
|
return { ...EMPTY_REGISTRY };
|
|
@@ -772723,7 +772507,7 @@ var init_provider3 = __esm(() => {
|
|
|
772723
772507
|
// src/skills/bundledSkills.ts
|
|
772724
772508
|
import { constants as fsConstants7 } from "fs";
|
|
772725
772509
|
import { mkdir as mkdir59, open as open14 } from "fs/promises";
|
|
772726
|
-
import { dirname as dirname78, isAbsolute as isAbsolute30, join as
|
|
772510
|
+
import { dirname as dirname78, isAbsolute as isAbsolute30, join as join188, normalize as normalize18, sep as pathSep2 } from "path";
|
|
772727
772511
|
function registerBundledSkill(definition) {
|
|
772728
772512
|
const { files: files3 } = definition;
|
|
772729
772513
|
let skillRoot;
|
|
@@ -772771,7 +772555,7 @@ function getBundledSkills() {
|
|
|
772771
772555
|
return [...bundledSkills];
|
|
772772
772556
|
}
|
|
772773
772557
|
function getBundledSkillExtractDir(skillName) {
|
|
772774
|
-
return
|
|
772558
|
+
return join188(getBundledSkillsRoot(), skillName);
|
|
772775
772559
|
}
|
|
772776
772560
|
async function extractBundledSkillFiles(skillName, files3) {
|
|
772777
772561
|
const dir = getBundledSkillExtractDir(skillName);
|
|
@@ -772813,7 +772597,7 @@ function resolveSkillFilePath(baseDir, relPath) {
|
|
|
772813
772597
|
if (isAbsolute30(normalized) || normalized.split(pathSep2).includes("..") || normalized.split("/").includes("..")) {
|
|
772814
772598
|
throw new Error(`bundled skill file path escapes skill dir: ${relPath}`);
|
|
772815
772599
|
}
|
|
772816
|
-
return
|
|
772600
|
+
return join188(baseDir, normalized);
|
|
772817
772601
|
}
|
|
772818
772602
|
function prependBaseDir(blocks, baseDir) {
|
|
772819
772603
|
const prefix = `Base directory for this skill: ${baseDir}
|
|
@@ -773283,7 +773067,7 @@ var init_exit2 = __esm(() => {
|
|
|
773283
773067
|
});
|
|
773284
773068
|
|
|
773285
773069
|
// src/components/ExportDialog.tsx
|
|
773286
|
-
import { join as
|
|
773070
|
+
import { join as join189 } from "path";
|
|
773287
773071
|
function ExportDialog({ content, defaultFilename, onDone }) {
|
|
773288
773072
|
const { t: useT } = useTranslation();
|
|
773289
773073
|
const [, setSelectedOption] = import_react215.useState(null);
|
|
@@ -773308,7 +773092,7 @@ function ExportDialog({ content, defaultFilename, onDone }) {
|
|
|
773308
773092
|
};
|
|
773309
773093
|
const handleFilenameSubmit = () => {
|
|
773310
773094
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/u, "") + ".txt";
|
|
773311
|
-
const filepath =
|
|
773095
|
+
const filepath = join189(getCwd(), finalFilename);
|
|
773312
773096
|
try {
|
|
773313
773097
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
773314
773098
|
encoding: "utf-8",
|
|
@@ -773520,7 +773304,7 @@ __export(exports_export, {
|
|
|
773520
773304
|
extractFirstPrompt: () => extractFirstPrompt,
|
|
773521
773305
|
call: () => call66
|
|
773522
773306
|
});
|
|
773523
|
-
import { join as
|
|
773307
|
+
import { join as join190 } from "path";
|
|
773524
773308
|
function formatTimestamp(date13) {
|
|
773525
773309
|
const year = date13.getFullYear();
|
|
773526
773310
|
const month = String(date13.getMonth() + 1).padStart(2, "0");
|
|
@@ -773564,7 +773348,7 @@ async function call66(onDone, context41, args) {
|
|
|
773564
773348
|
const filename = args.trim();
|
|
773565
773349
|
if (filename) {
|
|
773566
773350
|
const finalFilename = filename.endsWith(".txt") ? filename : filename.replace(/\.[^.]+$/u, "") + ".txt";
|
|
773567
|
-
const filepath =
|
|
773351
|
+
const filepath = join190(getCwd(), finalFilename);
|
|
773568
773352
|
try {
|
|
773569
773353
|
writeFileSync_DEPRECATED(filepath, content, {
|
|
773570
773354
|
encoding: "utf-8",
|
|
@@ -774399,10 +774183,10 @@ var init_skillChangeDetector = __esm(() => {
|
|
|
774399
774183
|
import path50 from "path";
|
|
774400
774184
|
import {
|
|
774401
774185
|
mkdir as mkdir60,
|
|
774402
|
-
readFile as
|
|
774186
|
+
readFile as readFile74,
|
|
774403
774187
|
readdir as readdir37,
|
|
774404
774188
|
rm as rm15,
|
|
774405
|
-
writeFile as
|
|
774189
|
+
writeFile as writeFile66,
|
|
774406
774190
|
copyFile as copyFile10
|
|
774407
774191
|
} from "fs/promises";
|
|
774408
774192
|
function favoriteRoot() {
|
|
@@ -774434,7 +774218,7 @@ function commandsDir() {
|
|
|
774434
774218
|
}
|
|
774435
774219
|
async function readState() {
|
|
774436
774220
|
try {
|
|
774437
|
-
const text2 = await
|
|
774221
|
+
const text2 = await readFile74(favoriteStatePath(), "utf-8");
|
|
774438
774222
|
return JSON.parse(text2);
|
|
774439
774223
|
} catch {
|
|
774440
774224
|
return { items: {} };
|
|
@@ -774442,7 +774226,7 @@ async function readState() {
|
|
|
774442
774226
|
}
|
|
774443
774227
|
async function writeState(state3) {
|
|
774444
774228
|
await mkdir60(favoriteRoot(), { recursive: true });
|
|
774445
|
-
await
|
|
774229
|
+
await writeFile66(favoriteStatePath(), JSON.stringify(state3, null, 2) + `
|
|
774446
774230
|
`);
|
|
774447
774231
|
}
|
|
774448
774232
|
async function mutateState(fn) {
|
|
@@ -774601,27 +774385,27 @@ async function persistInstalledItem(item) {
|
|
|
774601
774385
|
await mkdir60(dir, { recursive: true });
|
|
774602
774386
|
switch (item.itemType) {
|
|
774603
774387
|
case "skill":
|
|
774604
|
-
await
|
|
774388
|
+
await writeFile66(path50.join(dir, "SKILL.md"), item.content);
|
|
774605
774389
|
break;
|
|
774606
774390
|
case "agent":
|
|
774607
|
-
await
|
|
774391
|
+
await writeFile66(path50.join(dir, `${item.slug}.md`), item.content);
|
|
774608
774392
|
break;
|
|
774609
774393
|
case "command":
|
|
774610
|
-
await
|
|
774394
|
+
await writeFile66(path50.join(dir, `${item.slug}.md`), item.content);
|
|
774611
774395
|
break;
|
|
774612
774396
|
case "mcp": {
|
|
774613
774397
|
const mcpDestPath = path50.join(dir, "mcp.json");
|
|
774614
774398
|
try {
|
|
774615
774399
|
const mcpConfig = JSON.parse(item.content);
|
|
774616
|
-
await
|
|
774400
|
+
await writeFile66(mcpDestPath, JSON.stringify(mcpConfig, null, 2) + `
|
|
774617
774401
|
`);
|
|
774618
774402
|
} catch {
|
|
774619
|
-
await
|
|
774403
|
+
await writeFile66(mcpDestPath, item.content);
|
|
774620
774404
|
}
|
|
774621
774405
|
break;
|
|
774622
774406
|
}
|
|
774623
774407
|
}
|
|
774624
|
-
await
|
|
774408
|
+
await writeFile66(path50.join(dir, "item.json"), JSON.stringify({
|
|
774625
774409
|
id: item.id,
|
|
774626
774410
|
slug: item.slug,
|
|
774627
774411
|
name: item.name,
|
|
@@ -774770,7 +774554,7 @@ async function addItemToConfig(item, localPath) {
|
|
|
774770
774554
|
}
|
|
774771
774555
|
case "agent": {
|
|
774772
774556
|
const mdPath = path50.join(localPath, `${item.slug}.md`);
|
|
774773
|
-
const content = await
|
|
774557
|
+
const content = await readFile74(mdPath, "utf-8");
|
|
774774
774558
|
const { frontmatter, content: markdownContent } = parseFrontmatter(content, mdPath);
|
|
774775
774559
|
saveGlobalConfig((cfg) => ({
|
|
774776
774560
|
...cfg,
|
|
@@ -774790,7 +774574,7 @@ async function addItemToConfig(item, localPath) {
|
|
|
774790
774574
|
}
|
|
774791
774575
|
case "command": {
|
|
774792
774576
|
const mdPath = path50.join(localPath, `${item.slug}.md`);
|
|
774793
|
-
const content = await
|
|
774577
|
+
const content = await readFile74(mdPath, "utf-8");
|
|
774794
774578
|
const { frontmatter, content: markdownContent } = parseFrontmatter(content, mdPath);
|
|
774795
774579
|
saveGlobalConfig((cfg) => ({
|
|
774796
774580
|
...cfg,
|
|
@@ -774811,7 +774595,7 @@ async function addItemToConfig(item, localPath) {
|
|
|
774811
774595
|
}
|
|
774812
774596
|
case "mcp": {
|
|
774813
774597
|
const mcpJsonPath = path50.join(localPath, "mcp.json");
|
|
774814
|
-
const configJson = JSON.parse(await
|
|
774598
|
+
const configJson = JSON.parse(await readFile74(mcpJsonPath, "utf-8"));
|
|
774815
774599
|
const converted = convertMcpConfig(configJson);
|
|
774816
774600
|
if (!converted) {
|
|
774817
774601
|
throw new Error(`Unable to recognize MCP configuration format: ${item.slug}
|
|
@@ -774874,7 +774658,7 @@ async function readItemForConfig(installed) {
|
|
|
774874
774658
|
const itemMetaPath = path50.join(installed.localPath, "item.json");
|
|
774875
774659
|
let itemMeta = {};
|
|
774876
774660
|
try {
|
|
774877
|
-
const text2 = await
|
|
774661
|
+
const text2 = await readFile74(itemMetaPath, "utf-8");
|
|
774878
774662
|
itemMeta = JSON.parse(text2);
|
|
774879
774663
|
} catch {}
|
|
774880
774664
|
return {
|
|
@@ -774938,7 +774722,7 @@ async function listFavoriteItems(type, opts) {
|
|
|
774938
774722
|
let localVersion;
|
|
774939
774723
|
if (local?.localPath) {
|
|
774940
774724
|
try {
|
|
774941
|
-
const itemJsonText = await
|
|
774725
|
+
const itemJsonText = await readFile74(path50.join(local.localPath, "item.json"), "utf-8");
|
|
774942
774726
|
const itemJson = JSON.parse(itemJsonText);
|
|
774943
774727
|
localVersion = typeof itemJson.version === "string" ? itemJson.version : undefined;
|
|
774944
774728
|
} catch {}
|
|
@@ -776563,9 +776347,9 @@ var require_asciichart = __commonJS((exports) => {
|
|
|
776563
776347
|
});
|
|
776564
776348
|
|
|
776565
776349
|
// src/utils/statsCache.ts
|
|
776566
|
-
import { randomBytes as
|
|
776350
|
+
import { randomBytes as randomBytes23 } from "crypto";
|
|
776567
776351
|
import { open as open15 } from "fs/promises";
|
|
776568
|
-
import { join as
|
|
776352
|
+
import { join as join192 } from "path";
|
|
776569
776353
|
async function withStatsCacheLock(fn) {
|
|
776570
776354
|
while (statsCacheLockPromise) {
|
|
776571
776355
|
await statsCacheLockPromise;
|
|
@@ -776582,14 +776366,14 @@ async function withStatsCacheLock(fn) {
|
|
|
776582
776366
|
}
|
|
776583
776367
|
}
|
|
776584
776368
|
function getStatsCachePath() {
|
|
776585
|
-
return
|
|
776369
|
+
return join192(getClaudeConfigHomeDir(), STATS_CACHE_FILENAME);
|
|
776586
776370
|
}
|
|
776587
776371
|
function getStatsCachePaths() {
|
|
776588
776372
|
const primary = getStatsCachePath();
|
|
776589
776373
|
const legacyHome = getLegacyConfigHomeDir();
|
|
776590
776374
|
if (!legacyHome)
|
|
776591
776375
|
return [primary];
|
|
776592
|
-
const legacy =
|
|
776376
|
+
const legacy = join192(legacyHome, STATS_CACHE_FILENAME);
|
|
776593
776377
|
if (primary === legacy)
|
|
776594
776378
|
return [primary];
|
|
776595
776379
|
return [primary, legacy];
|
|
@@ -776675,7 +776459,7 @@ async function loadStatsCache() {
|
|
|
776675
776459
|
async function saveStatsCache(cache13) {
|
|
776676
776460
|
const fs33 = getFsImplementation();
|
|
776677
776461
|
const cachePath = getStatsCachePath();
|
|
776678
|
-
const tempPath = `${cachePath}.${
|
|
776462
|
+
const tempPath = `${cachePath}.${randomBytes23(8).toString("hex")}.tmp`;
|
|
776679
776463
|
try {
|
|
776680
776464
|
const configDir = getClaudeConfigHomeDir();
|
|
776681
776465
|
try {
|
|
@@ -777280,19 +777064,19 @@ var init_ansiToPng = __esm(() => {
|
|
|
777280
777064
|
});
|
|
777281
777065
|
|
|
777282
777066
|
// src/utils/screenshotClipboard.ts
|
|
777283
|
-
import { mkdir as mkdir61, unlink as
|
|
777067
|
+
import { mkdir as mkdir61, unlink as unlink26, writeFile as writeFile67 } from "fs/promises";
|
|
777284
777068
|
import { tmpdir as tmpdir18 } from "os";
|
|
777285
|
-
import { join as
|
|
777069
|
+
import { join as join193 } from "path";
|
|
777286
777070
|
async function copyAnsiToClipboard(ansiText, options) {
|
|
777287
777071
|
try {
|
|
777288
|
-
const tempDir =
|
|
777072
|
+
const tempDir = join193(tmpdir18(), "costrict-screenshots");
|
|
777289
777073
|
await mkdir61(tempDir, { recursive: true });
|
|
777290
|
-
const pngPath =
|
|
777074
|
+
const pngPath = join193(tempDir, `screenshot-${Date.now()}.png`);
|
|
777291
777075
|
const pngBuffer = ansiToPng(ansiText, options);
|
|
777292
|
-
await
|
|
777076
|
+
await writeFile67(pngPath, pngBuffer);
|
|
777293
777077
|
const result = await copyPngToClipboard(pngPath);
|
|
777294
777078
|
try {
|
|
777295
|
-
await
|
|
777079
|
+
await unlink26(pngPath);
|
|
777296
777080
|
} catch {}
|
|
777297
777081
|
return result;
|
|
777298
777082
|
} catch (error100) {
|
|
@@ -777358,7 +777142,7 @@ var init_screenshotClipboard = __esm(() => {
|
|
|
777358
777142
|
|
|
777359
777143
|
// src/utils/stats.ts
|
|
777360
777144
|
import { open as open16 } from "fs/promises";
|
|
777361
|
-
import { basename as basename48, dirname as dirname79, join as
|
|
777145
|
+
import { basename as basename48, dirname as dirname79, join as join194, sep as sep37 } from "path";
|
|
777362
777146
|
async function processSessionFiles(sessionFiles, options = {}) {
|
|
777363
777147
|
const { fromDate, toDate: toDate2 } = options;
|
|
777364
777148
|
const fs33 = getFsImplementation();
|
|
@@ -777550,16 +777334,16 @@ async function getAllSessionFiles() {
|
|
|
777550
777334
|
}
|
|
777551
777335
|
const projectNames = allEntries.filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name);
|
|
777552
777336
|
const projectResults = await Promise.all(projectNames.map(async (projectName) => {
|
|
777553
|
-
const projectDir =
|
|
777337
|
+
const projectDir = join194(projectsDir, projectName);
|
|
777554
777338
|
try {
|
|
777555
777339
|
const entries = await fs33.readdir(projectDir);
|
|
777556
|
-
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) =>
|
|
777340
|
+
const mainFiles = entries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl")).map((dirent) => join194(projectDir, dirent.name));
|
|
777557
777341
|
const sessionDirs = entries.filter((dirent) => dirent.isDirectory());
|
|
777558
777342
|
const subagentResults = await Promise.all(sessionDirs.map(async (sessionDir) => {
|
|
777559
|
-
const subagentsDir =
|
|
777343
|
+
const subagentsDir = join194(projectDir, sessionDir.name, "subagents");
|
|
777560
777344
|
try {
|
|
777561
777345
|
const subagentEntries = await fs33.readdir(subagentsDir);
|
|
777562
|
-
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) =>
|
|
777346
|
+
return subagentEntries.filter((dirent) => dirent.isFile() && dirent.name.endsWith(".jsonl") && dirent.name.startsWith("agent-")).map((dirent) => join194(subagentsDir, dirent.name));
|
|
777563
777347
|
} catch {
|
|
777564
777348
|
return [];
|
|
777565
777349
|
}
|
|
@@ -779068,13 +778852,13 @@ var init_oauth_refresh = __esm(() => {
|
|
|
779068
778852
|
|
|
779069
778853
|
// src/commands/debug-tool-call/index.ts
|
|
779070
778854
|
import { existsSync as existsSync33, readFileSync as readFileSync40 } from "fs";
|
|
779071
|
-
import { join as
|
|
778855
|
+
import { join as join195 } from "path";
|
|
779072
778856
|
function getTranscriptPath4() {
|
|
779073
778857
|
const sessionId = getSessionId();
|
|
779074
778858
|
const projectDir = getSessionProjectDir();
|
|
779075
778859
|
if (projectDir)
|
|
779076
|
-
return
|
|
779077
|
-
return
|
|
778860
|
+
return join195(projectDir, `${sessionId}.jsonl`);
|
|
778861
|
+
return join195(getClaudeConfigHomeDir(), "projects", sanitizePath(getOriginalCwd()), `${sessionId}.jsonl`);
|
|
779078
778862
|
}
|
|
779079
778863
|
function truncate7(s, maxLen) {
|
|
779080
778864
|
return s.length > maxLen ? `${s.slice(0, maxLen)}\u2026` : s;
|
|
@@ -781328,9 +781112,9 @@ __export(exports_createWorkflowCommand, {
|
|
|
781328
781112
|
getWorkflowCommands: () => getWorkflowCommands
|
|
781329
781113
|
});
|
|
781330
781114
|
import { readdir as readdir38 } from "fs/promises";
|
|
781331
|
-
import { join as
|
|
781115
|
+
import { join as join196, parse as parse27 } from "path";
|
|
781332
781116
|
async function getWorkflowCommands(cwd2) {
|
|
781333
|
-
const workflowDir =
|
|
781117
|
+
const workflowDir = join196(cwd2, WORKFLOW_DIR_NAME);
|
|
781334
781118
|
let files3;
|
|
781335
781119
|
try {
|
|
781336
781120
|
files3 = await readdir38(workflowDir);
|
|
@@ -781352,8 +781136,8 @@ async function getWorkflowCommands(cwd2) {
|
|
|
781352
781136
|
progressMessage: `Running workflow ${name3}...`,
|
|
781353
781137
|
contentLength: 0,
|
|
781354
781138
|
async getPromptForCommand(args, _context) {
|
|
781355
|
-
const { readFile:
|
|
781356
|
-
const content = await
|
|
781139
|
+
const { readFile: readFile75 } = await import("fs/promises");
|
|
781140
|
+
const content = await readFile75(join196(workflowDir, file3), "utf-8");
|
|
781357
781141
|
return [
|
|
781358
781142
|
{
|
|
781359
781143
|
type: "text",
|
|
@@ -782518,10 +782302,10 @@ var init_daemon2 = __esm(() => {
|
|
|
782518
782302
|
|
|
782519
782303
|
// src/jobs/templates.ts
|
|
782520
782304
|
import { readdirSync as readdirSync8, readFileSync as readFileSync41 } from "fs";
|
|
782521
|
-
import { join as
|
|
782305
|
+
import { join as join197, basename as basename50 } from "path";
|
|
782522
782306
|
function getTemplatesDirs() {
|
|
782523
782307
|
const projectDirs = getProjectDirsUpToHome("templates", process.cwd());
|
|
782524
|
-
const userDir =
|
|
782308
|
+
const userDir = join197(getClaudeConfigHomeDir(), "templates");
|
|
782525
782309
|
try {
|
|
782526
782310
|
readdirSync8(userDir);
|
|
782527
782311
|
return [...projectDirs, userDir];
|
|
@@ -782546,7 +782330,7 @@ function listTemplates() {
|
|
|
782546
782330
|
if (seenNames.has(name3))
|
|
782547
782331
|
continue;
|
|
782548
782332
|
seenNames.add(name3);
|
|
782549
|
-
const filePath =
|
|
782333
|
+
const filePath = join197(dir, file3);
|
|
782550
782334
|
try {
|
|
782551
782335
|
const raw = readFileSync41(filePath, "utf-8");
|
|
782552
782336
|
const { frontmatter, content } = parseFrontmatter(raw, filePath);
|
|
@@ -782569,12 +782353,12 @@ var init_templates = __esm(() => {
|
|
|
782569
782353
|
|
|
782570
782354
|
// src/jobs/state.ts
|
|
782571
782355
|
import { appendFileSync as appendFileSync5, mkdirSync as mkdirSync16, readFileSync as readFileSync42, writeFileSync as writeFileSync23 } from "fs";
|
|
782572
|
-
import { join as
|
|
782356
|
+
import { join as join198 } from "path";
|
|
782573
782357
|
function getJobsDir() {
|
|
782574
|
-
return
|
|
782358
|
+
return join198(getClaudeConfigHomeDir(), "jobs");
|
|
782575
782359
|
}
|
|
782576
782360
|
function getJobDir(jobId) {
|
|
782577
|
-
return
|
|
782361
|
+
return join198(getJobsDir(), jobId);
|
|
782578
782362
|
}
|
|
782579
782363
|
function createJob(jobId, templateName, templateContent, inputText, args) {
|
|
782580
782364
|
const dir = getJobDir(jobId);
|
|
@@ -782588,14 +782372,14 @@ function createJob(jobId, templateName, templateContent, inputText, args) {
|
|
|
782588
782372
|
status: "created",
|
|
782589
782373
|
args
|
|
782590
782374
|
};
|
|
782591
|
-
writeFileSync23(
|
|
782592
|
-
writeFileSync23(
|
|
782593
|
-
writeFileSync23(
|
|
782375
|
+
writeFileSync23(join198(dir, "state.json"), JSON.stringify(state3, null, 2), "utf-8");
|
|
782376
|
+
writeFileSync23(join198(dir, "template.md"), templateContent, "utf-8");
|
|
782377
|
+
writeFileSync23(join198(dir, "input.txt"), inputText, "utf-8");
|
|
782594
782378
|
return dir;
|
|
782595
782379
|
}
|
|
782596
782380
|
function readJobState(jobId) {
|
|
782597
782381
|
try {
|
|
782598
|
-
const raw = readFileSync42(
|
|
782382
|
+
const raw = readFileSync42(join198(getJobDir(jobId), "state.json"), "utf-8");
|
|
782599
782383
|
const parsed = JSON.parse(raw);
|
|
782600
782384
|
if (typeof parsed !== "object" || parsed === null)
|
|
782601
782385
|
return null;
|
|
@@ -782613,7 +782397,7 @@ function appendJobReply(jobId, text2) {
|
|
|
782613
782397
|
const state3 = readJobState(jobId);
|
|
782614
782398
|
if (!state3)
|
|
782615
782399
|
return false;
|
|
782616
|
-
const repliesPath =
|
|
782400
|
+
const repliesPath = join198(dir, "replies.jsonl");
|
|
782617
782401
|
const entry = JSON.stringify({
|
|
782618
782402
|
text: text2,
|
|
782619
782403
|
timestamp: new Date().toISOString()
|
|
@@ -782626,7 +782410,7 @@ function appendJobReply(jobId, text2) {
|
|
|
782626
782410
|
`, "utf-8");
|
|
782627
782411
|
}
|
|
782628
782412
|
const updated = { ...state3, updatedAt: new Date().toISOString() };
|
|
782629
|
-
writeFileSync23(
|
|
782413
|
+
writeFileSync23(join198(dir, "state.json"), JSON.stringify(updated, null, 2), "utf-8");
|
|
782630
782414
|
return true;
|
|
782631
782415
|
}
|
|
782632
782416
|
var init_state6 = __esm(() => {
|
|
@@ -783785,13 +783569,13 @@ import {
|
|
|
783785
783569
|
mkdir as mkdir62,
|
|
783786
783570
|
mkdtemp as mkdtemp3,
|
|
783787
783571
|
readdir as readdir39,
|
|
783788
|
-
readFile as
|
|
783572
|
+
readFile as readFile75,
|
|
783789
783573
|
rm as rm16,
|
|
783790
|
-
unlink as
|
|
783791
|
-
writeFile as
|
|
783574
|
+
unlink as unlink27,
|
|
783575
|
+
writeFile as writeFile68
|
|
783792
783576
|
} from "fs/promises";
|
|
783793
783577
|
import { tmpdir as tmpdir19 } from "os";
|
|
783794
|
-
import { extname as extname15, join as
|
|
783578
|
+
import { extname as extname15, join as join199 } from "path";
|
|
783795
783579
|
function getAnalysisModel() {
|
|
783796
783580
|
return getDefaultOpusModel();
|
|
783797
783581
|
}
|
|
@@ -783799,13 +783583,13 @@ function getInsightsModel() {
|
|
|
783799
783583
|
return getDefaultOpusModel();
|
|
783800
783584
|
}
|
|
783801
783585
|
function getDataDir() {
|
|
783802
|
-
return
|
|
783586
|
+
return join199(getClaudeConfigHomeDir(), "usage-data");
|
|
783803
783587
|
}
|
|
783804
783588
|
function getFacetsDir() {
|
|
783805
|
-
return
|
|
783589
|
+
return join199(getDataDir(), "facets");
|
|
783806
783590
|
}
|
|
783807
783591
|
function getSessionMetaDir() {
|
|
783808
|
-
return
|
|
783592
|
+
return join199(getDataDir(), "session-meta");
|
|
783809
783593
|
}
|
|
783810
783594
|
function getLanguageFromPath(filePath) {
|
|
783811
783595
|
const ext = extname15(filePath).toLowerCase();
|
|
@@ -784150,13 +783934,13 @@ async function formatTranscriptWithSummarization(log15) {
|
|
|
784150
783934
|
`);
|
|
784151
783935
|
}
|
|
784152
783936
|
async function loadCachedFacets(sessionId) {
|
|
784153
|
-
const facetPath =
|
|
783937
|
+
const facetPath = join199(getFacetsDir(), `${sessionId}.json`);
|
|
784154
783938
|
try {
|
|
784155
|
-
const content = await
|
|
783939
|
+
const content = await readFile75(facetPath, { encoding: "utf-8" });
|
|
784156
783940
|
const parsed = jsonParse(content);
|
|
784157
783941
|
if (!isValidSessionFacets(parsed)) {
|
|
784158
783942
|
try {
|
|
784159
|
-
await
|
|
783943
|
+
await unlink27(facetPath);
|
|
784160
783944
|
} catch {}
|
|
784161
783945
|
return null;
|
|
784162
783946
|
}
|
|
@@ -784169,16 +783953,16 @@ async function saveFacets(facets) {
|
|
|
784169
783953
|
try {
|
|
784170
783954
|
await mkdir62(getFacetsDir(), { recursive: true });
|
|
784171
783955
|
} catch {}
|
|
784172
|
-
const facetPath =
|
|
784173
|
-
await
|
|
783956
|
+
const facetPath = join199(getFacetsDir(), `${facets.session_id}.json`);
|
|
783957
|
+
await writeFile68(facetPath, jsonStringify(facets, null, 2), {
|
|
784174
783958
|
encoding: "utf-8",
|
|
784175
783959
|
mode: 384
|
|
784176
783960
|
});
|
|
784177
783961
|
}
|
|
784178
783962
|
async function loadCachedSessionMeta(sessionId) {
|
|
784179
|
-
const metaPath =
|
|
783963
|
+
const metaPath = join199(getSessionMetaDir(), `${sessionId}.json`);
|
|
784180
783964
|
try {
|
|
784181
|
-
const content = await
|
|
783965
|
+
const content = await readFile75(metaPath, { encoding: "utf-8" });
|
|
784182
783966
|
return jsonParse(content);
|
|
784183
783967
|
} catch {
|
|
784184
783968
|
return null;
|
|
@@ -784188,8 +783972,8 @@ async function saveSessionMeta(meta6) {
|
|
|
784188
783972
|
try {
|
|
784189
783973
|
await mkdir62(getSessionMetaDir(), { recursive: true });
|
|
784190
783974
|
} catch {}
|
|
784191
|
-
const metaPath =
|
|
784192
|
-
await
|
|
783975
|
+
const metaPath = join199(getSessionMetaDir(), `${meta6.session_id}.json`);
|
|
783976
|
+
await writeFile68(metaPath, jsonStringify(meta6, null, 2), {
|
|
784193
783977
|
encoding: "utf-8",
|
|
784194
783978
|
mode: 384
|
|
784195
783979
|
});
|
|
@@ -785245,7 +785029,7 @@ function generateHtmlReport(data, insights) {
|
|
|
785245
785029
|
</html>`;
|
|
785246
785030
|
}
|
|
785247
785031
|
function buildExportData(data, insights, facets, remoteStats) {
|
|
785248
|
-
const version11 = typeof MACRO !== "undefined" ? "4.2.
|
|
785032
|
+
const version11 = typeof MACRO !== "undefined" ? "4.2.16" : "unknown";
|
|
785249
785033
|
const remote_hosts_collected = remoteStats?.hosts.filter((h8) => h8.sessionCount > 0).map((h8) => h8.name);
|
|
785250
785034
|
const facets_summary = {
|
|
785251
785035
|
total: facets.size,
|
|
@@ -785299,7 +785083,7 @@ async function scanAllSessions() {
|
|
|
785299
785083
|
} catch {
|
|
785300
785084
|
continue;
|
|
785301
785085
|
}
|
|
785302
|
-
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
785086
|
+
const projectDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join199(projectsDir, dirent.name));
|
|
785303
785087
|
for (let i10 = 0;i10 < projectDirs.length; i10++) {
|
|
785304
785088
|
const sessionFiles = await getSessionFilesWithMtime(projectDirs[i10]);
|
|
785305
785089
|
for (const [sessionId, fileInfo] of sessionFiles) {
|
|
@@ -785324,7 +785108,7 @@ async function scanAllSessions() {
|
|
|
785324
785108
|
async function generateUsageReport(options) {
|
|
785325
785109
|
let remoteStats;
|
|
785326
785110
|
if (process.env.USER_TYPE === "sf" && options?.collectRemote) {
|
|
785327
|
-
const destDir =
|
|
785111
|
+
const destDir = join199(getClaudeConfigHomeDir(), "projects");
|
|
785328
785112
|
const { hosts, totalCopied } = await collectAllRemoteHostData(destDir);
|
|
785329
785113
|
remoteStats = { hosts, totalCopied };
|
|
785330
785114
|
}
|
|
@@ -785463,8 +785247,8 @@ async function generateUsageReport(options) {
|
|
|
785463
785247
|
try {
|
|
785464
785248
|
await mkdir62(getDataDir(), { recursive: true });
|
|
785465
785249
|
} catch {}
|
|
785466
|
-
const htmlPath =
|
|
785467
|
-
await
|
|
785250
|
+
const htmlPath = join199(getDataDir(), "report.html");
|
|
785251
|
+
await writeFile68(htmlPath, htmlReport, {
|
|
785468
785252
|
encoding: "utf-8",
|
|
785469
785253
|
mode: 384
|
|
785470
785254
|
});
|
|
@@ -785563,13 +785347,13 @@ var init_insights = __esm(() => {
|
|
|
785563
785347
|
} : async () => 0;
|
|
785564
785348
|
collectFromRemoteHost = process.env.USER_TYPE === "sf" ? async (homespace, destDir) => {
|
|
785565
785349
|
const result = { copied: 0, skipped: 0 };
|
|
785566
|
-
const tempDir = await mkdtemp3(
|
|
785350
|
+
const tempDir = await mkdtemp3(join199(tmpdir19(), "costrict-hs-"));
|
|
785567
785351
|
try {
|
|
785568
785352
|
const scpResult = await execFileNoThrow2("scp", ["-rq", `${homespace}.coder:/root/.claude/projects/`, tempDir], { timeout: 300000 });
|
|
785569
785353
|
if (scpResult.code !== 0) {
|
|
785570
785354
|
return result;
|
|
785571
785355
|
}
|
|
785572
|
-
const projectsDir =
|
|
785356
|
+
const projectsDir = join199(tempDir, "projects");
|
|
785573
785357
|
let projectDirents;
|
|
785574
785358
|
try {
|
|
785575
785359
|
projectDirents = await readdir39(projectsDir, { withFileTypes: true });
|
|
@@ -785578,11 +785362,11 @@ var init_insights = __esm(() => {
|
|
|
785578
785362
|
}
|
|
785579
785363
|
await Promise.all(projectDirents.map(async (dirent) => {
|
|
785580
785364
|
const projectName = dirent.name;
|
|
785581
|
-
const projectPath =
|
|
785365
|
+
const projectPath = join199(projectsDir, projectName);
|
|
785582
785366
|
if (!dirent.isDirectory())
|
|
785583
785367
|
return;
|
|
785584
785368
|
const destProjectName = `${projectName}__${homespace}`;
|
|
785585
|
-
const destProjectPath =
|
|
785369
|
+
const destProjectPath = join199(destDir, destProjectName);
|
|
785586
785370
|
try {
|
|
785587
785371
|
await mkdir62(destProjectPath, { recursive: true });
|
|
785588
785372
|
} catch {}
|
|
@@ -785596,8 +785380,8 @@ var init_insights = __esm(() => {
|
|
|
785596
785380
|
const fileName = fileDirent.name;
|
|
785597
785381
|
if (!fileName.endsWith(".jsonl"))
|
|
785598
785382
|
return;
|
|
785599
|
-
const srcFile =
|
|
785600
|
-
const destFile =
|
|
785383
|
+
const srcFile = join199(projectPath, fileName);
|
|
785384
|
+
const destFile = join199(destProjectPath, fileName);
|
|
785601
785385
|
try {
|
|
785602
785386
|
await copyFile11(srcFile, destFile, fsConstants8.COPYFILE_EXCL);
|
|
785603
785387
|
result.copied++;
|
|
@@ -786001,13 +785785,13 @@ __export(exports_createDynamicWorkflowCommand, {
|
|
|
786001
785785
|
});
|
|
786002
785786
|
import { readdir as readdir40, stat as stat46 } from "fs/promises";
|
|
786003
785787
|
import { homedir as homedir46 } from "os";
|
|
786004
|
-
import { basename as basename51, join as
|
|
785788
|
+
import { basename as basename51, join as join200 } from "path";
|
|
786005
785789
|
function savedWorkflowDirs(cwd2) {
|
|
786006
785790
|
return [
|
|
786007
|
-
|
|
786008
|
-
|
|
786009
|
-
|
|
786010
|
-
|
|
785791
|
+
join200(cwd2, DYNAMIC_WORKFLOW_PROJECT_DIR),
|
|
785792
|
+
join200(cwd2, DYNAMIC_WORKFLOW_LEGACY_PROJECT_DIR),
|
|
785793
|
+
join200(homedir46(), DYNAMIC_WORKFLOW_PROJECT_DIR),
|
|
785794
|
+
join200(homedir46(), DYNAMIC_WORKFLOW_LEGACY_PROJECT_DIR)
|
|
786011
785795
|
];
|
|
786012
785796
|
}
|
|
786013
785797
|
async function listWorkflowFiles(dir) {
|
|
@@ -786021,7 +785805,7 @@ async function listWorkflowFiles(dir) {
|
|
|
786021
785805
|
for (const entry of entries) {
|
|
786022
785806
|
if (!WORKFLOW_FILE_PATTERN.test(entry))
|
|
786023
785807
|
continue;
|
|
786024
|
-
const filePath =
|
|
785808
|
+
const filePath = join200(dir, entry);
|
|
786025
785809
|
try {
|
|
786026
785810
|
const info2 = await stat46(filePath);
|
|
786027
785811
|
if (!info2.isFile())
|
|
@@ -786718,12 +786502,12 @@ import {
|
|
|
786718
786502
|
open as fsOpen2,
|
|
786719
786503
|
mkdir as mkdir63,
|
|
786720
786504
|
readdir as readdir41,
|
|
786721
|
-
readFile as
|
|
786505
|
+
readFile as readFile76,
|
|
786722
786506
|
stat as stat47,
|
|
786723
|
-
unlink as
|
|
786724
|
-
writeFile as
|
|
786507
|
+
unlink as unlink28,
|
|
786508
|
+
writeFile as writeFile69
|
|
786725
786509
|
} from "fs/promises";
|
|
786726
|
-
import { basename as basename52, dirname as dirname80, join as
|
|
786510
|
+
import { basename as basename52, dirname as dirname80, join as join201 } from "path";
|
|
786727
786511
|
function isTranscriptMessage(entry) {
|
|
786728
786512
|
return entry.type === "user" || entry.type === "assistant" || entry.type === "attachment" || entry.type === "system";
|
|
786729
786513
|
}
|
|
@@ -786737,11 +786521,11 @@ function isEphemeralToolProgress(dataType) {
|
|
|
786737
786521
|
return typeof dataType === "string" && EPHEMERAL_PROGRESS_TYPES.has(dataType);
|
|
786738
786522
|
}
|
|
786739
786523
|
function getProjectsDir2() {
|
|
786740
|
-
return
|
|
786524
|
+
return join201(getClaudeConfigHomeDir(), "projects");
|
|
786741
786525
|
}
|
|
786742
786526
|
function getTranscriptPath() {
|
|
786743
786527
|
const projectDir = getSessionProjectDir() ?? getProjectDir3(getOriginalCwd());
|
|
786744
|
-
return
|
|
786528
|
+
return join201(projectDir, `${getSessionId()}.jsonl`);
|
|
786745
786529
|
}
|
|
786746
786530
|
function getTranscriptPathForSession(sessionId) {
|
|
786747
786531
|
if (sessionId === getSessionId()) {
|
|
@@ -786750,8 +786534,8 @@ function getTranscriptPathForSession(sessionId) {
|
|
|
786750
786534
|
const cwd2 = getOriginalCwd();
|
|
786751
786535
|
const allProjectsDirs = getAllProjectsDirs();
|
|
786752
786536
|
for (const projectsDir of allProjectsDirs) {
|
|
786753
|
-
const dir =
|
|
786754
|
-
const file3 =
|
|
786537
|
+
const dir = join201(projectsDir, sanitizePath(cwd2));
|
|
786538
|
+
const file3 = join201(dir, `${sessionId}.jsonl`);
|
|
786755
786539
|
try {
|
|
786756
786540
|
const fs33 = getFsImplementation();
|
|
786757
786541
|
fs33.statSync(file3);
|
|
@@ -786759,7 +786543,7 @@ function getTranscriptPathForSession(sessionId) {
|
|
|
786759
786543
|
} catch {}
|
|
786760
786544
|
}
|
|
786761
786545
|
const projectDir = getProjectDir3(getOriginalCwd());
|
|
786762
|
-
return
|
|
786546
|
+
return join201(projectDir, `${sessionId}.jsonl`);
|
|
786763
786547
|
}
|
|
786764
786548
|
function setAgentTranscriptSubdir(agentId, subdir) {
|
|
786765
786549
|
agentTranscriptSubdirs.set(agentId, subdir);
|
|
@@ -786771,8 +786555,8 @@ function getAgentTranscriptPath(agentId) {
|
|
|
786771
786555
|
const projectDir = getSessionProjectDir() ?? getProjectDir3(getOriginalCwd());
|
|
786772
786556
|
const sessionId = getSessionId();
|
|
786773
786557
|
const subdir = agentTranscriptSubdirs.get(agentId);
|
|
786774
|
-
const base2 = subdir ?
|
|
786775
|
-
return
|
|
786558
|
+
const base2 = subdir ? join201(projectDir, sessionId, "subagents", subdir) : join201(projectDir, sessionId, "subagents");
|
|
786559
|
+
return join201(base2, `agent-${agentId}.jsonl`);
|
|
786776
786560
|
}
|
|
786777
786561
|
function getAgentMetadataPath(agentId) {
|
|
786778
786562
|
return getAgentTranscriptPath(agentId).replace(/\.jsonl$/, ".meta.json");
|
|
@@ -786780,12 +786564,12 @@ function getAgentMetadataPath(agentId) {
|
|
|
786780
786564
|
async function writeAgentMetadata(agentId, metadata) {
|
|
786781
786565
|
const path51 = getAgentMetadataPath(agentId);
|
|
786782
786566
|
await mkdir63(dirname80(path51), { recursive: true });
|
|
786783
|
-
await
|
|
786567
|
+
await writeFile69(path51, JSON.stringify(metadata));
|
|
786784
786568
|
}
|
|
786785
786569
|
async function readAgentMetadata(agentId) {
|
|
786786
786570
|
const path51 = getAgentMetadataPath(agentId);
|
|
786787
786571
|
try {
|
|
786788
|
-
const raw = await
|
|
786572
|
+
const raw = await readFile76(path51, "utf-8");
|
|
786789
786573
|
return JSON.parse(raw);
|
|
786790
786574
|
} catch (e7) {
|
|
786791
786575
|
if (isFsInaccessible(e7))
|
|
@@ -786795,20 +786579,20 @@ async function readAgentMetadata(agentId) {
|
|
|
786795
786579
|
}
|
|
786796
786580
|
function getRemoteAgentsDir() {
|
|
786797
786581
|
const projectDir = getSessionProjectDir() ?? getProjectDir3(getOriginalCwd());
|
|
786798
|
-
return
|
|
786582
|
+
return join201(projectDir, getSessionId(), "remote-agents");
|
|
786799
786583
|
}
|
|
786800
786584
|
function getRemoteAgentMetadataPath(taskId) {
|
|
786801
|
-
return
|
|
786585
|
+
return join201(getRemoteAgentsDir(), `remote-agent-${taskId}.meta.json`);
|
|
786802
786586
|
}
|
|
786803
786587
|
async function writeRemoteAgentMetadata(taskId, metadata) {
|
|
786804
786588
|
const path51 = getRemoteAgentMetadataPath(taskId);
|
|
786805
786589
|
await mkdir63(dirname80(path51), { recursive: true });
|
|
786806
|
-
await
|
|
786590
|
+
await writeFile69(path51, JSON.stringify(metadata));
|
|
786807
786591
|
}
|
|
786808
786592
|
async function readRemoteAgentMetadata(taskId) {
|
|
786809
786593
|
const path51 = getRemoteAgentMetadataPath(taskId);
|
|
786810
786594
|
try {
|
|
786811
|
-
const raw = await
|
|
786595
|
+
const raw = await readFile76(path51, "utf-8");
|
|
786812
786596
|
return JSON.parse(raw);
|
|
786813
786597
|
} catch (e7) {
|
|
786814
786598
|
if (isFsInaccessible(e7))
|
|
@@ -786819,7 +786603,7 @@ async function readRemoteAgentMetadata(taskId) {
|
|
|
786819
786603
|
async function deleteRemoteAgentMetadata(taskId) {
|
|
786820
786604
|
const path51 = getRemoteAgentMetadataPath(taskId);
|
|
786821
786605
|
try {
|
|
786822
|
-
await
|
|
786606
|
+
await unlink28(path51);
|
|
786823
786607
|
} catch (e7) {
|
|
786824
786608
|
if (isFsInaccessible(e7))
|
|
786825
786609
|
return;
|
|
@@ -786841,7 +786625,7 @@ async function listRemoteAgentMetadata() {
|
|
|
786841
786625
|
if (!entry.isFile() || !entry.name.endsWith(".meta.json"))
|
|
786842
786626
|
continue;
|
|
786843
786627
|
try {
|
|
786844
|
-
const raw = await
|
|
786628
|
+
const raw = await readFile76(join201(dir, entry.name), "utf-8");
|
|
786845
786629
|
results.push(JSON.parse(raw));
|
|
786846
786630
|
} catch (e7) {
|
|
786847
786631
|
logForDebugging(`listRemoteAgentMetadata: skipping ${entry.name}: ${String(e7)}`);
|
|
@@ -786854,8 +786638,8 @@ function sessionIdExists(sessionId) {
|
|
|
786854
786638
|
const fs33 = getFsImplementation();
|
|
786855
786639
|
const allProjectsDirs = getAllProjectsDirs();
|
|
786856
786640
|
for (const projectsDir of allProjectsDirs) {
|
|
786857
|
-
const projectDir =
|
|
786858
|
-
const sessionFile =
|
|
786641
|
+
const projectDir = join201(projectsDir, sanitizePath(cwd2));
|
|
786642
|
+
const sessionFile = join201(projectDir, `${sessionId}.jsonl`);
|
|
786859
786643
|
try {
|
|
786860
786644
|
fs33.statSync(sessionFile);
|
|
786861
786645
|
return true;
|
|
@@ -787212,7 +786996,7 @@ class Project {
|
|
|
787212
786996
|
logForDebugging(`Skipping tombstone removal: session file too large (${formatFileSize(fileSize)})`, { level: "warn" });
|
|
787213
786997
|
return;
|
|
787214
786998
|
}
|
|
787215
|
-
const content = await
|
|
786999
|
+
const content = await readFile76(this.sessionFile, { encoding: "utf-8" });
|
|
787216
787000
|
const lines2 = content.split(`
|
|
787217
787001
|
`).filter((line) => {
|
|
787218
787002
|
if (!line.trim())
|
|
@@ -787224,7 +787008,7 @@ class Project {
|
|
|
787224
787008
|
return true;
|
|
787225
787009
|
}
|
|
787226
787010
|
});
|
|
787227
|
-
await
|
|
787011
|
+
await writeFile69(this.sessionFile, lines2.join(`
|
|
787228
787012
|
`), {
|
|
787229
787013
|
encoding: "utf8"
|
|
787230
787014
|
});
|
|
@@ -787568,7 +787352,7 @@ async function hydrateRemoteSession(sessionId, ingressUrl) {
|
|
|
787568
787352
|
const sessionFile = getTranscriptPathForSession(sessionId);
|
|
787569
787353
|
const content = remoteLogs.map((e7) => jsonStringify(e7) + `
|
|
787570
787354
|
`).join("");
|
|
787571
|
-
await
|
|
787355
|
+
await writeFile69(sessionFile, content, { encoding: "utf8", mode: 384 });
|
|
787572
787356
|
logForDebugging(`Hydrated ${remoteLogs.length} entries from remote`);
|
|
787573
787357
|
return remoteLogs.length > 0;
|
|
787574
787358
|
} catch (error100) {
|
|
@@ -787600,7 +787384,7 @@ async function hydrateFromCCRv2InternalEvents(sessionId) {
|
|
|
787600
787384
|
const sessionFile = getTranscriptPathForSession(sessionId);
|
|
787601
787385
|
const fgContent = events2.map((e7) => jsonStringify(e7.payload) + `
|
|
787602
787386
|
`).join("");
|
|
787603
|
-
await
|
|
787387
|
+
await writeFile69(sessionFile, fgContent, { encoding: "utf8", mode: 384 });
|
|
787604
787388
|
logForDebugging(`Hydrated ${events2.length} foreground entries from CCR v2 internal events`);
|
|
787605
787389
|
let subagentEventCount = 0;
|
|
787606
787390
|
const subagentReader = project2.getInternalSubagentEventReader();
|
|
@@ -787625,7 +787409,7 @@ async function hydrateFromCCRv2InternalEvents(sessionId) {
|
|
|
787625
787409
|
await mkdir63(dirname80(agentFile), { recursive: true, mode: 448 });
|
|
787626
787410
|
const agentContent = entries.map((p2) => jsonStringify(p2) + `
|
|
787627
787411
|
`).join("");
|
|
787628
|
-
await
|
|
787412
|
+
await writeFile69(agentFile, agentContent, {
|
|
787629
787413
|
encoding: "utf8",
|
|
787630
787414
|
mode: 384
|
|
787631
787415
|
});
|
|
@@ -788029,7 +787813,7 @@ async function loadTranscriptFromFile(filePath) {
|
|
|
788029
787813
|
goalState: goalStates.get(sessionId)
|
|
788030
787814
|
};
|
|
788031
787815
|
}
|
|
788032
|
-
const content = await
|
|
787816
|
+
const content = await readFile76(filePath, { encoding: "utf-8" });
|
|
788033
787817
|
let parsed;
|
|
788034
787818
|
try {
|
|
788035
787819
|
parsed = jsonParse(content);
|
|
@@ -788155,7 +787939,7 @@ async function fetchLogs(limit2) {
|
|
|
788155
787939
|
const allProjectsDirs = getAllProjectsDirs();
|
|
788156
787940
|
const allLogs = [];
|
|
788157
787941
|
for (const projectsDir of allProjectsDirs) {
|
|
788158
|
-
allLogs.push(...await getSessionFilesLite(
|
|
787942
|
+
allLogs.push(...await getSessionFilesLite(join201(projectsDir, sanitizePath(cwd2)), limit2, cwd2));
|
|
788159
787943
|
}
|
|
788160
787944
|
const logs2 = deduplicateLogsBySessionId(allLogs);
|
|
788161
787945
|
await trackSessionBranchingAnalytics(logs2);
|
|
@@ -788705,7 +788489,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
788705
788489
|
}
|
|
788706
788490
|
}
|
|
788707
788491
|
}
|
|
788708
|
-
buf ??= await
|
|
788492
|
+
buf ??= await readFile76(filePath);
|
|
788709
788493
|
if (!opts?.keepAllLeaves && !hasPreservedSegment && !isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_PRECOMPACT_SKIP) && buf.length > SKIP_PRECOMPACT_THRESHOLD) {
|
|
788710
788494
|
buf = walkChainBeforeParse(buf);
|
|
788711
788495
|
}
|
|
@@ -788891,7 +788675,7 @@ async function loadTranscriptFile(filePath, opts) {
|
|
|
788891
788675
|
async function loadSessionFile(sessionId) {
|
|
788892
788676
|
const sessionProjectDir = getSessionProjectDir();
|
|
788893
788677
|
if (sessionProjectDir) {
|
|
788894
|
-
const file3 =
|
|
788678
|
+
const file3 = join201(sessionProjectDir, `${sessionId}.jsonl`);
|
|
788895
788679
|
try {
|
|
788896
788680
|
const result = await loadTranscriptFile(file3);
|
|
788897
788681
|
if (result.messages.size > 0)
|
|
@@ -788901,8 +788685,8 @@ async function loadSessionFile(sessionId) {
|
|
|
788901
788685
|
const cwd2 = getOriginalCwd();
|
|
788902
788686
|
const allProjectsDirs = getAllProjectsDirs();
|
|
788903
788687
|
for (const projectsDir of allProjectsDirs) {
|
|
788904
|
-
const projectDir =
|
|
788905
|
-
const file3 =
|
|
788688
|
+
const projectDir = join201(projectsDir, sanitizePath(cwd2));
|
|
788689
|
+
const file3 = join201(projectDir, `${sessionId}.jsonl`);
|
|
788906
788690
|
try {
|
|
788907
788691
|
const result = await loadTranscriptFile(file3);
|
|
788908
788692
|
if (result.messages.size > 0)
|
|
@@ -788913,7 +788697,7 @@ async function loadSessionFile(sessionId) {
|
|
|
788913
788697
|
const sanitizedCwd = sanitizePath(cwd2);
|
|
788914
788698
|
const matchingDir = dirs.find((d7) => d7.toLowerCase() === sanitizedCwd.toLowerCase());
|
|
788915
788699
|
if (matchingDir) {
|
|
788916
|
-
const caseInsensitiveFile =
|
|
788700
|
+
const caseInsensitiveFile = join201(projectsDir, matchingDir, `${sessionId}.jsonl`);
|
|
788917
788701
|
const result = await loadTranscriptFile(caseInsensitiveFile);
|
|
788918
788702
|
if (result.messages.size > 0)
|
|
788919
788703
|
return result;
|
|
@@ -788921,7 +788705,7 @@ async function loadSessionFile(sessionId) {
|
|
|
788921
788705
|
} catch {}
|
|
788922
788706
|
}
|
|
788923
788707
|
}
|
|
788924
|
-
const sessionFile =
|
|
788708
|
+
const sessionFile = join201(getProjectDir3(getOriginalCwd()), `${sessionId}.jsonl`);
|
|
788925
788709
|
return loadTranscriptFile(sessionFile);
|
|
788926
788710
|
}
|
|
788927
788711
|
function clearSessionMessagesCache() {
|
|
@@ -789000,7 +788784,7 @@ async function loadAllProjectsMessageLogsFull(limit2) {
|
|
|
789000
788784
|
if (seenDirs.has(key6))
|
|
789001
788785
|
continue;
|
|
789002
788786
|
seenDirs.add(key6);
|
|
789003
|
-
uniqueProjectDirs.push(
|
|
788787
|
+
uniqueProjectDirs.push(join201(projectsDir, dirent.name));
|
|
789004
788788
|
}
|
|
789005
788789
|
}
|
|
789006
788790
|
const logsPerProject = await Promise.all(uniqueProjectDirs.map((projectDir) => getLogsWithoutIndex(projectDir, limit2)));
|
|
@@ -789038,7 +788822,7 @@ async function loadAllProjectsMessageLogsProgressive(limit2, initialEnrichCount
|
|
|
789038
788822
|
if (seenDirs.has(key6))
|
|
789039
788823
|
continue;
|
|
789040
788824
|
seenDirs.add(key6);
|
|
789041
|
-
rawLogs.push(...await getSessionFilesLite(
|
|
788825
|
+
rawLogs.push(...await getSessionFilesLite(join201(projectsDir, dirent.name), limit2));
|
|
789042
788826
|
}
|
|
789043
788827
|
}
|
|
789044
788828
|
const sorted = deduplicateLogsBySessionId(rawLogs);
|
|
@@ -789068,7 +788852,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit2) {
|
|
|
789068
788852
|
const allProjectsDirs2 = getAllProjectsDirs();
|
|
789069
788853
|
const allLogs2 = [];
|
|
789070
788854
|
for (const projectsDir of allProjectsDirs2) {
|
|
789071
|
-
allLogs2.push(...await getSessionFilesLite(
|
|
788855
|
+
allLogs2.push(...await getSessionFilesLite(join201(projectsDir, sanitizePath(cwd2)), undefined, cwd2));
|
|
789072
788856
|
}
|
|
789073
788857
|
return deduplicateLogsBySessionId(allLogs2);
|
|
789074
788858
|
}
|
|
@@ -789102,7 +788886,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit2) {
|
|
|
789102
788886
|
for (const { path: wtPath, prefix } of indexed) {
|
|
789103
788887
|
if (dirName === prefix || dirName.startsWith(prefix + "-")) {
|
|
789104
788888
|
seenDirs.add(dirName);
|
|
789105
|
-
allLogs.push(...await getSessionFilesLite(
|
|
788889
|
+
allLogs.push(...await getSessionFilesLite(join201(projectsDir, dirent.name), undefined, wtPath));
|
|
789106
788890
|
break;
|
|
789107
788891
|
}
|
|
789108
788892
|
}
|
|
@@ -789113,7 +788897,7 @@ async function getStatOnlyLogsForWorktrees(worktreePaths, limit2) {
|
|
|
789113
788897
|
const allProjectsDirs2 = getAllProjectsDirs();
|
|
789114
788898
|
const allLogs2 = [];
|
|
789115
788899
|
for (const projectsDir of allProjectsDirs2) {
|
|
789116
|
-
allLogs2.push(...await getSessionFilesLite(
|
|
788900
|
+
allLogs2.push(...await getSessionFilesLite(join201(projectsDir, sanitizePath(cwd2)), limit2, cwd2));
|
|
789117
788901
|
}
|
|
789118
788902
|
return deduplicateLogsBySessionId(allLogs2);
|
|
789119
788903
|
}
|
|
@@ -789181,7 +788965,7 @@ async function loadSubagentTranscripts(agentIds) {
|
|
|
789181
788965
|
return transcripts;
|
|
789182
788966
|
}
|
|
789183
788967
|
async function loadAllSubagentTranscriptsFromDisk() {
|
|
789184
|
-
const subagentsDir =
|
|
788968
|
+
const subagentsDir = join201(getSessionProjectDir() ?? getProjectDir3(getOriginalCwd()), getSessionId(), "subagents");
|
|
789185
788969
|
let entries;
|
|
789186
788970
|
try {
|
|
789187
788971
|
entries = await readdir41(subagentsDir, { withFileTypes: true });
|
|
@@ -789309,7 +789093,7 @@ async function getSessionFilesWithMtime(projectDir) {
|
|
|
789309
789093
|
const sessionId = validateUuid2(basename52(dirent.name, ".jsonl"));
|
|
789310
789094
|
if (!sessionId)
|
|
789311
789095
|
continue;
|
|
789312
|
-
candidates.push({ sessionId, filePath:
|
|
789096
|
+
candidates.push({ sessionId, filePath: join201(projectDir, dirent.name) });
|
|
789313
789097
|
}
|
|
789314
789098
|
await Promise.all(candidates.map(async ({ sessionId, filePath }) => {
|
|
789315
789099
|
try {
|
|
@@ -789693,7 +789477,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
789693
789477
|
init_settings2();
|
|
789694
789478
|
init_slowOperations();
|
|
789695
789479
|
init_uuid();
|
|
789696
|
-
VERSION11 = typeof MACRO !== "undefined" ? "4.2.
|
|
789480
|
+
VERSION11 = typeof MACRO !== "undefined" ? "4.2.16" : "unknown";
|
|
789697
789481
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
789698
789482
|
SKIP_FIRST_PROMPT_PATTERN2 = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
|
|
789699
789483
|
EPHEMERAL_PROGRESS_TYPES = new Set([
|
|
@@ -789705,7 +789489,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
789705
789489
|
MAX_TRANSCRIPT_READ_BYTES = 50 * 1024 * 1024;
|
|
789706
789490
|
agentTranscriptSubdirs = new Map;
|
|
789707
789491
|
getProjectDir3 = memoize_default((projectDir) => {
|
|
789708
|
-
return
|
|
789492
|
+
return join201(getProjectsDir2(), sanitizePath(projectDir));
|
|
789709
789493
|
});
|
|
789710
789494
|
METADATA_TYPE_MARKERS = [
|
|
789711
789495
|
'"type":"summary"',
|
|
@@ -789726,7 +789510,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
789726
789510
|
});
|
|
789727
789511
|
|
|
789728
789512
|
// src/memdir/memdir.ts
|
|
789729
|
-
import { join as
|
|
789513
|
+
import { join as join202 } from "path";
|
|
789730
789514
|
function truncateEntrypointContent(raw) {
|
|
789731
789515
|
const trimmed = raw.trim();
|
|
789732
789516
|
const contentLines = trimmed.split(`
|
|
@@ -789878,7 +789662,7 @@ function buildMemoryPrompt(params) {
|
|
|
789878
789662
|
}
|
|
789879
789663
|
function buildAssistantDailyLogPrompt(skipIndex = false) {
|
|
789880
789664
|
const memoryDir = getAutoMemPath();
|
|
789881
|
-
const logPathPattern =
|
|
789665
|
+
const logPathPattern = join202(memoryDir, "logs", "YYYY", "MM", "YYYY-MM-DD.md");
|
|
789882
789666
|
const lines2 = [
|
|
789883
789667
|
"# auto memory",
|
|
789884
789668
|
"",
|
|
@@ -789990,43 +789774,43 @@ var init_memdir = __esm(() => {
|
|
|
789990
789774
|
});
|
|
789991
789775
|
|
|
789992
789776
|
// packages/builtin-tools/src/tools/AgentTool/agentMemory.ts
|
|
789993
|
-
import { join as
|
|
789777
|
+
import { join as join203, normalize as normalize19, sep as sep38 } from "path";
|
|
789994
789778
|
function sanitizeAgentTypeForPath(agentType) {
|
|
789995
789779
|
return agentType.replace(/:/g, "-");
|
|
789996
789780
|
}
|
|
789997
789781
|
function getLocalAgentMemoryDir(dirName) {
|
|
789998
789782
|
const remoteMemoryDir = getCostrictEnv("REMOTE_MEMORY_DIR");
|
|
789999
789783
|
if (remoteMemoryDir) {
|
|
790000
|
-
return
|
|
789784
|
+
return join203(remoteMemoryDir, "projects", sanitizePath(findCanonicalGitRoot(getProjectRoot()) ?? getProjectRoot()), "agent-memory-local", dirName) + sep38;
|
|
790001
789785
|
}
|
|
790002
|
-
return
|
|
789786
|
+
return join203(getCwd(), ".claude", "agent-memory-local", dirName) + sep38;
|
|
790003
789787
|
}
|
|
790004
789788
|
function getAgentMemoryDir(agentType, scope) {
|
|
790005
789789
|
const dirName = sanitizeAgentTypeForPath(agentType);
|
|
790006
789790
|
switch (scope) {
|
|
790007
789791
|
case "project":
|
|
790008
|
-
return
|
|
789792
|
+
return join203(getCwd(), ".claude", "agent-memory", dirName) + sep38;
|
|
790009
789793
|
case "local":
|
|
790010
789794
|
return getLocalAgentMemoryDir(dirName);
|
|
790011
789795
|
case "user":
|
|
790012
|
-
return
|
|
789796
|
+
return join203(getMemoryBaseDir(), "agent-memory", dirName) + sep38;
|
|
790013
789797
|
}
|
|
790014
789798
|
}
|
|
790015
789799
|
function isAgentMemoryPath(absolutePath) {
|
|
790016
789800
|
const normalizedPath = normalize19(absolutePath);
|
|
790017
789801
|
const memoryBase = getMemoryBaseDir();
|
|
790018
|
-
if (normalizedPath.startsWith(
|
|
789802
|
+
if (normalizedPath.startsWith(join203(memoryBase, "agent-memory") + sep38)) {
|
|
790019
789803
|
return true;
|
|
790020
789804
|
}
|
|
790021
|
-
if (normalizedPath.startsWith(
|
|
789805
|
+
if (normalizedPath.startsWith(join203(getCwd(), ".claude", "agent-memory") + sep38)) {
|
|
790022
789806
|
return true;
|
|
790023
789807
|
}
|
|
790024
789808
|
const remoteMemoryDir = getCostrictEnv("REMOTE_MEMORY_DIR");
|
|
790025
789809
|
if (remoteMemoryDir) {
|
|
790026
|
-
if (normalizedPath.includes(sep38 + "agent-memory-local" + sep38) && normalizedPath.startsWith(
|
|
789810
|
+
if (normalizedPath.includes(sep38 + "agent-memory-local" + sep38) && normalizedPath.startsWith(join203(remoteMemoryDir, "projects") + sep38)) {
|
|
790027
789811
|
return true;
|
|
790028
789812
|
}
|
|
790029
|
-
} else if (normalizedPath.startsWith(
|
|
789813
|
+
} else if (normalizedPath.startsWith(join203(getCwd(), ".claude", "agent-memory-local") + sep38)) {
|
|
790030
789814
|
return true;
|
|
790031
789815
|
}
|
|
790032
789816
|
return false;
|
|
@@ -790034,7 +789818,7 @@ function isAgentMemoryPath(absolutePath) {
|
|
|
790034
789818
|
function getMemoryScopeDisplay(memory2) {
|
|
790035
789819
|
switch (memory2) {
|
|
790036
789820
|
case "user":
|
|
790037
|
-
return `User (${
|
|
789821
|
+
return `User (${join203(getMemoryBaseDir(), "agent-memory")}/)`;
|
|
790038
789822
|
case "project":
|
|
790039
789823
|
return "Project (.claude/agent-memory/)";
|
|
790040
789824
|
case "local":
|
|
@@ -790109,9 +789893,9 @@ __export(exports_filesystem, {
|
|
|
790109
789893
|
DANGEROUS_FILES: () => DANGEROUS_FILES2,
|
|
790110
789894
|
DANGEROUS_DIRECTORIES: () => DANGEROUS_DIRECTORIES2
|
|
790111
789895
|
});
|
|
790112
|
-
import { randomBytes as
|
|
789896
|
+
import { randomBytes as randomBytes24 } from "crypto";
|
|
790113
789897
|
import { homedir as homedir47, tmpdir as tmpdir20 } from "os";
|
|
790114
|
-
import { join as
|
|
789898
|
+
import { join as join204, normalize as normalize20, posix as posix11, sep as sep39 } from "path";
|
|
790115
789899
|
function normalizeCaseForComparison2(path51) {
|
|
790116
789900
|
return path51.toLowerCase();
|
|
790117
789901
|
}
|
|
@@ -790120,19 +789904,19 @@ function getClaudeSkillScope(filePath) {
|
|
|
790120
789904
|
const absolutePathLower = normalizeCaseForComparison2(absolutePath);
|
|
790121
789905
|
const bases = [
|
|
790122
789906
|
{
|
|
790123
|
-
dir: expandPath(
|
|
789907
|
+
dir: expandPath(join204(getOriginalCwd(), ".costrict", "skills")),
|
|
790124
789908
|
prefix: "/.costrict/skills/"
|
|
790125
789909
|
},
|
|
790126
789910
|
{
|
|
790127
|
-
dir: expandPath(
|
|
789911
|
+
dir: expandPath(join204(homedir47(), ".costrict", "skills")),
|
|
790128
789912
|
prefix: "~/.costrict/skills/"
|
|
790129
789913
|
},
|
|
790130
789914
|
{
|
|
790131
|
-
dir: expandPath(
|
|
789915
|
+
dir: expandPath(join204(getOriginalCwd(), ".claude", "skills")),
|
|
790132
789916
|
prefix: "/.claude/skills/"
|
|
790133
789917
|
},
|
|
790134
789918
|
{
|
|
790135
|
-
dir: expandPath(
|
|
789919
|
+
dir: expandPath(join204(homedir47(), ".claude", "skills")),
|
|
790136
789920
|
prefix: "~/.claude/skills/"
|
|
790137
789921
|
}
|
|
790138
789922
|
];
|
|
@@ -790187,24 +789971,24 @@ function isClaudeConfigFilePath(filePath) {
|
|
|
790187
789971
|
if (isClaudeSettingsPath(filePath)) {
|
|
790188
789972
|
return true;
|
|
790189
789973
|
}
|
|
790190
|
-
const commandsDir2 =
|
|
790191
|
-
const agentsDir2 =
|
|
790192
|
-
const skillsDir2 =
|
|
790193
|
-
const costrictCommandsDir =
|
|
790194
|
-
const costrictAgentsDir =
|
|
790195
|
-
const costrictSkillsDir =
|
|
789974
|
+
const commandsDir2 = join204(getOriginalCwd(), ".claude", "commands");
|
|
789975
|
+
const agentsDir2 = join204(getOriginalCwd(), ".claude", "agents");
|
|
789976
|
+
const skillsDir2 = join204(getOriginalCwd(), ".claude", "skills");
|
|
789977
|
+
const costrictCommandsDir = join204(getOriginalCwd(), ".costrict", "commands");
|
|
789978
|
+
const costrictAgentsDir = join204(getOriginalCwd(), ".costrict", "agents");
|
|
789979
|
+
const costrictSkillsDir = join204(getOriginalCwd(), ".costrict", "skills");
|
|
790196
789980
|
return pathInWorkingPath(filePath, commandsDir2) || pathInWorkingPath(filePath, agentsDir2) || pathInWorkingPath(filePath, skillsDir2) || pathInWorkingPath(filePath, costrictCommandsDir) || pathInWorkingPath(filePath, costrictAgentsDir) || pathInWorkingPath(filePath, costrictSkillsDir);
|
|
790197
789981
|
}
|
|
790198
789982
|
function isSessionPlanFile(absolutePath) {
|
|
790199
|
-
const expectedPrefix =
|
|
789983
|
+
const expectedPrefix = join204(getPlansDirectory(), getPlanSlug());
|
|
790200
789984
|
const normalizedPath = normalize20(absolutePath);
|
|
790201
789985
|
return normalizedPath.startsWith(expectedPrefix) && normalizedPath.endsWith(".md");
|
|
790202
789986
|
}
|
|
790203
789987
|
function getSessionMemoryDir() {
|
|
790204
|
-
return
|
|
789988
|
+
return join204(getProjectDir3(getCwd()), getSessionId(), "session-memory") + sep39;
|
|
790205
789989
|
}
|
|
790206
789990
|
function getSessionMemoryPath() {
|
|
790207
|
-
return
|
|
789991
|
+
return join204(getSessionMemoryDir(), "summary.md");
|
|
790208
789992
|
}
|
|
790209
789993
|
function isSessionMemoryPath(absolutePath) {
|
|
790210
789994
|
const normalizedPath = normalize20(absolutePath);
|
|
@@ -790226,10 +790010,10 @@ function getCostrictTempDirName() {
|
|
|
790226
790010
|
return `costrict-${uid}`;
|
|
790227
790011
|
}
|
|
790228
790012
|
function getProjectTempDir() {
|
|
790229
|
-
return
|
|
790013
|
+
return join204(getCostrictTempDir(), sanitizePath(getOriginalCwd())) + sep39;
|
|
790230
790014
|
}
|
|
790231
790015
|
function getScratchpadDir() {
|
|
790232
|
-
return
|
|
790016
|
+
return join204(getProjectTempDir(), getSessionId(), "scratchpad");
|
|
790233
790017
|
}
|
|
790234
790018
|
async function ensureScratchpadDir() {
|
|
790235
790019
|
if (!isScratchpadEnabled()) {
|
|
@@ -790804,7 +790588,7 @@ function checkEditableInternalPath(absolutePath, input4) {
|
|
|
790804
790588
|
if (true) {
|
|
790805
790589
|
const jobDir = process.env.CLAUDE_JOB_DIR;
|
|
790806
790590
|
if (jobDir) {
|
|
790807
|
-
const jobsRoot =
|
|
790591
|
+
const jobsRoot = join204(getClaudeConfigHomeDir(), "jobs");
|
|
790808
790592
|
const jobDirForms = getPathsForPermissionCheck(jobDir).map(normalize20);
|
|
790809
790593
|
const jobsRootForms = getPathsForPermissionCheck(jobsRoot).map(normalize20);
|
|
790810
790594
|
const isUnderJobsRoot = jobDirForms.every((jd) => jobsRootForms.some((jr) => jd.startsWith(jr + sep39)));
|
|
@@ -790847,7 +790631,7 @@ function checkEditableInternalPath(absolutePath, input4) {
|
|
|
790847
790631
|
}
|
|
790848
790632
|
};
|
|
790849
790633
|
}
|
|
790850
|
-
if (normalizeCaseForComparison2(normalizedPath) === normalizeCaseForComparison2(
|
|
790634
|
+
if (normalizeCaseForComparison2(normalizedPath) === normalizeCaseForComparison2(join204(getOriginalCwd(), ".claude", "launch.json")) || normalizeCaseForComparison2(normalizedPath) === normalizeCaseForComparison2(join204(getOriginalCwd(), ".costrict", "launch.json"))) {
|
|
790851
790635
|
return {
|
|
790852
790636
|
behavior: "allow",
|
|
790853
790637
|
updatedInput: input4,
|
|
@@ -790944,7 +790728,7 @@ function checkReadableInternalPath(absolutePath, input4) {
|
|
|
790944
790728
|
}
|
|
790945
790729
|
};
|
|
790946
790730
|
}
|
|
790947
|
-
const tasksDir =
|
|
790731
|
+
const tasksDir = join204(getClaudeConfigHomeDir(), "tasks") + sep39;
|
|
790948
790732
|
if (normalizedPath === tasksDir.slice(0, -1) || normalizedPath.startsWith(tasksDir)) {
|
|
790949
790733
|
return {
|
|
790950
790734
|
behavior: "allow",
|
|
@@ -790955,7 +790739,7 @@ function checkReadableInternalPath(absolutePath, input4) {
|
|
|
790955
790739
|
}
|
|
790956
790740
|
};
|
|
790957
790741
|
}
|
|
790958
|
-
const teamsReadDir =
|
|
790742
|
+
const teamsReadDir = join204(getClaudeConfigHomeDir(), "teams") + sep39;
|
|
790959
790743
|
if (normalizedPath === teamsReadDir.slice(0, -1) || normalizedPath.startsWith(teamsReadDir)) {
|
|
790960
790744
|
return {
|
|
790961
790745
|
behavior: "allow",
|
|
@@ -791030,11 +790814,11 @@ var init_filesystem = __esm(() => {
|
|
|
791030
790814
|
try {
|
|
791031
790815
|
resolvedBaseTmpDir = fs33.realpathSync(baseTmpDir);
|
|
791032
790816
|
} catch {}
|
|
791033
|
-
return
|
|
790817
|
+
return join204(resolvedBaseTmpDir, getCostrictTempDirName()) + sep39;
|
|
791034
790818
|
});
|
|
791035
790819
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
791036
|
-
const nonce =
|
|
791037
|
-
return
|
|
790820
|
+
const nonce = randomBytes24(16).toString("hex");
|
|
790821
|
+
return join204(getCostrictTempDir(), "bundled-skills", "4.2.16", nonce);
|
|
791038
790822
|
});
|
|
791039
790823
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
791040
790824
|
});
|
|
@@ -791065,12 +790849,12 @@ import {
|
|
|
791065
790849
|
open as open17,
|
|
791066
790850
|
stat as stat48,
|
|
791067
790851
|
symlink as symlink4,
|
|
791068
|
-
unlink as
|
|
790852
|
+
unlink as unlink29
|
|
791069
790853
|
} from "fs/promises";
|
|
791070
|
-
import { join as
|
|
790854
|
+
import { join as join205 } from "path";
|
|
791071
790855
|
function getTaskOutputDir() {
|
|
791072
790856
|
if (_taskOutputDir === undefined) {
|
|
791073
|
-
_taskOutputDir =
|
|
790857
|
+
_taskOutputDir = join205(getProjectTempDir(), getSessionId(), "tasks");
|
|
791074
790858
|
}
|
|
791075
790859
|
return _taskOutputDir;
|
|
791076
790860
|
}
|
|
@@ -791081,7 +790865,7 @@ async function ensureOutputDir() {
|
|
|
791081
790865
|
await mkdir64(getTaskOutputDir(), { recursive: true });
|
|
791082
790866
|
}
|
|
791083
790867
|
function getTaskOutputPath(taskId) {
|
|
791084
|
-
return
|
|
790868
|
+
return join205(getTaskOutputDir(), `${taskId}.output`);
|
|
791085
790869
|
}
|
|
791086
790870
|
function track(p2) {
|
|
791087
790871
|
_pendingOps.add(p2);
|
|
@@ -791278,7 +791062,7 @@ async function cleanupTaskOutput(taskId) {
|
|
|
791278
791062
|
outputs.delete(taskId);
|
|
791279
791063
|
}
|
|
791280
791064
|
try {
|
|
791281
|
-
await
|
|
791065
|
+
await unlink29(getTaskOutputPath(taskId));
|
|
791282
791066
|
} catch (e7) {
|
|
791283
791067
|
const code = getErrnoCode(e7);
|
|
791284
791068
|
if (code === "ENOENT") {
|
|
@@ -791304,7 +791088,7 @@ function initTaskOutputAsSymlink(taskId, targetPath) {
|
|
|
791304
791088
|
try {
|
|
791305
791089
|
await symlink4(targetPath, outputPath);
|
|
791306
791090
|
} catch {
|
|
791307
|
-
await
|
|
791091
|
+
await unlink29(outputPath);
|
|
791308
791092
|
await symlink4(targetPath, outputPath);
|
|
791309
791093
|
}
|
|
791310
791094
|
return outputPath;
|
|
@@ -791329,7 +791113,7 @@ var init_diskOutput = __esm(() => {
|
|
|
791329
791113
|
});
|
|
791330
791114
|
|
|
791331
791115
|
// src/Task.ts
|
|
791332
|
-
import { randomBytes as
|
|
791116
|
+
import { randomBytes as randomBytes25 } from "crypto";
|
|
791333
791117
|
function isTerminalTaskStatus(status2) {
|
|
791334
791118
|
return status2 === "completed" || status2 === "failed" || status2 === "killed";
|
|
791335
791119
|
}
|
|
@@ -791338,7 +791122,7 @@ function getTaskIdPrefix(type) {
|
|
|
791338
791122
|
}
|
|
791339
791123
|
function generateTaskId(type) {
|
|
791340
791124
|
const prefix = getTaskIdPrefix(type);
|
|
791341
|
-
const bytes =
|
|
791125
|
+
const bytes = randomBytes25(8);
|
|
791342
791126
|
let id = prefix;
|
|
791343
791127
|
for (let i10 = 0;i10 < 8; i10++) {
|
|
791344
791128
|
id += TASK_ID_ALPHABET2[bytes[i10] % TASK_ID_ALPHABET2.length];
|
|
@@ -795491,12 +795275,12 @@ import {
|
|
|
795491
795275
|
copyFile as copyFile12,
|
|
795492
795276
|
mkdir as mkdir65,
|
|
795493
795277
|
readdir as readdir42,
|
|
795494
|
-
readFile as
|
|
795278
|
+
readFile as readFile77,
|
|
795495
795279
|
stat as stat50,
|
|
795496
795280
|
symlink as symlink5,
|
|
795497
795281
|
utimes as utimes2
|
|
795498
795282
|
} from "fs/promises";
|
|
795499
|
-
import { basename as basename54, dirname as dirname81, join as
|
|
795283
|
+
import { basename as basename54, dirname as dirname81, join as join206 } from "path";
|
|
795500
795284
|
function validateWorktreeSlug(slug) {
|
|
795501
795285
|
if (slug.length > MAX_WORKTREE_SLUG_LENGTH) {
|
|
795502
795286
|
throw new Error(`Invalid worktree name: must be ${MAX_WORKTREE_SLUG_LENGTH} characters or fewer (got ${slug.length})`);
|
|
@@ -795519,8 +795303,8 @@ async function symlinkDirectories(repoRootPath, worktreePath, dirsToSymlink) {
|
|
|
795519
795303
|
logForDebugging(`Skipping symlink for "${dir}": path traversal detected`, { level: "warn" });
|
|
795520
795304
|
continue;
|
|
795521
795305
|
}
|
|
795522
|
-
const sourcePath =
|
|
795523
|
-
const destPath =
|
|
795306
|
+
const sourcePath = join206(repoRootPath, dir);
|
|
795307
|
+
const destPath = join206(worktreePath, dir);
|
|
795524
795308
|
try {
|
|
795525
795309
|
await symlink5(sourcePath, destPath, "dir");
|
|
795526
795310
|
logForDebugging(`Symlinked ${dir} from main repository to worktree to avoid disk bloat`);
|
|
@@ -795544,7 +795328,7 @@ function generateTmuxSessionName(repoPath, branch2) {
|
|
|
795544
795328
|
return combined.replace(/[/.]/g, "_");
|
|
795545
795329
|
}
|
|
795546
795330
|
function worktreesDir(repoRoot2) {
|
|
795547
|
-
return
|
|
795331
|
+
return join206(repoRoot2, ".claude", "worktrees");
|
|
795548
795332
|
}
|
|
795549
795333
|
function flattenSlug(slug) {
|
|
795550
795334
|
return slug.replaceAll("/", "+");
|
|
@@ -795553,7 +795337,7 @@ function worktreeBranchName(slug) {
|
|
|
795553
795337
|
return `worktree-${flattenSlug(slug)}`;
|
|
795554
795338
|
}
|
|
795555
795339
|
function worktreePathFor(repoRoot2, slug) {
|
|
795556
|
-
return
|
|
795340
|
+
return join206(worktreesDir(repoRoot2), flattenSlug(slug));
|
|
795557
795341
|
}
|
|
795558
795342
|
async function getOrCreateWorktree(repoRoot2, slug, options) {
|
|
795559
795343
|
const worktreePath = worktreePathFor(repoRoot2, slug);
|
|
@@ -795637,7 +795421,7 @@ async function getOrCreateWorktree(repoRoot2, slug, options) {
|
|
|
795637
795421
|
async function copyWorktreeIncludeFiles(repoRoot2, worktreePath) {
|
|
795638
795422
|
let includeContent;
|
|
795639
795423
|
try {
|
|
795640
|
-
includeContent = await
|
|
795424
|
+
includeContent = await readFile77(join206(repoRoot2, ".worktreeinclude"), "utf-8");
|
|
795641
795425
|
} catch {
|
|
795642
795426
|
return [];
|
|
795643
795427
|
}
|
|
@@ -795692,8 +795476,8 @@ async function copyWorktreeIncludeFiles(repoRoot2, worktreePath) {
|
|
|
795692
795476
|
}
|
|
795693
795477
|
const copied = [];
|
|
795694
795478
|
for (const relativePath2 of files3) {
|
|
795695
|
-
const srcPath =
|
|
795696
|
-
const destPath =
|
|
795479
|
+
const srcPath = join206(repoRoot2, relativePath2);
|
|
795480
|
+
const destPath = join206(worktreePath, relativePath2);
|
|
795697
795481
|
try {
|
|
795698
795482
|
await mkdir65(dirname81(destPath), { recursive: true });
|
|
795699
795483
|
await copyFile12(srcPath, destPath);
|
|
@@ -795709,9 +795493,9 @@ async function copyWorktreeIncludeFiles(repoRoot2, worktreePath) {
|
|
|
795709
795493
|
}
|
|
795710
795494
|
async function performPostCreationSetup(repoRoot2, worktreePath) {
|
|
795711
795495
|
const localSettingsRelativePath = getRelativeSettingsFilePathForSource("localSettings");
|
|
795712
|
-
const sourceSettingsLocal =
|
|
795496
|
+
const sourceSettingsLocal = join206(repoRoot2, localSettingsRelativePath);
|
|
795713
795497
|
try {
|
|
795714
|
-
const destSettingsLocal =
|
|
795498
|
+
const destSettingsLocal = join206(worktreePath, localSettingsRelativePath);
|
|
795715
795499
|
await mkdirRecursive(dirname81(destSettingsLocal));
|
|
795716
795500
|
await copyFile12(sourceSettingsLocal, destSettingsLocal);
|
|
795717
795501
|
logForDebugging(`Copied settings.local.json to worktree: ${destSettingsLocal}`);
|
|
@@ -795721,8 +795505,8 @@ async function performPostCreationSetup(repoRoot2, worktreePath) {
|
|
|
795721
795505
|
logForDebugging(`Failed to copy settings.local.json: ${e7.message}`, { level: "warn" });
|
|
795722
795506
|
}
|
|
795723
795507
|
}
|
|
795724
|
-
const huskyPath =
|
|
795725
|
-
const gitHooksPath =
|
|
795508
|
+
const huskyPath = join206(repoRoot2, ".husky");
|
|
795509
|
+
const gitHooksPath = join206(repoRoot2, ".git", "hooks");
|
|
795726
795510
|
let hooksPath = null;
|
|
795727
795511
|
for (const candidatePath of [huskyPath, gitHooksPath]) {
|
|
795728
795512
|
try {
|
|
@@ -795755,7 +795539,7 @@ async function performPostCreationSetup(repoRoot2, worktreePath) {
|
|
|
795755
795539
|
}
|
|
795756
795540
|
await copyWorktreeIncludeFiles(repoRoot2, worktreePath);
|
|
795757
795541
|
if (true) {
|
|
795758
|
-
const worktreeHooksDir = hooksPath === huskyPath ?
|
|
795542
|
+
const worktreeHooksDir = hooksPath === huskyPath ? join206(worktreePath, ".husky") : undefined;
|
|
795759
795543
|
Promise.resolve().then(() => (init_postCommitAttribution(), exports_postCommitAttribution)).then((m4) => m4.installPrepareCommitMsgHook(worktreePath, worktreeHooksDir).catch((error100) => {
|
|
795760
795544
|
logForDebugging(`Failed to install attribution hook in worktree: ${error100}`);
|
|
795761
795545
|
})).catch((error100) => {
|
|
@@ -796004,7 +795788,7 @@ async function cleanupStaleAgentWorktrees(cutoffDate) {
|
|
|
796004
795788
|
if (!EPHEMERAL_WORKTREE_PATTERNS.some((p2) => p2.test(slug))) {
|
|
796005
795789
|
continue;
|
|
796006
795790
|
}
|
|
796007
|
-
const worktreePath =
|
|
795791
|
+
const worktreePath = join206(dir, slug);
|
|
796008
795792
|
if (currentPath === worktreePath) {
|
|
796009
795793
|
continue;
|
|
796010
795794
|
}
|
|
@@ -797304,7 +797088,7 @@ function computeFingerprint(messageText, version11) {
|
|
|
797304
797088
|
}
|
|
797305
797089
|
function computeFingerprintFromMessages(messages) {
|
|
797306
797090
|
const firstMessageText = extractFirstMessageText(messages);
|
|
797307
|
-
return computeFingerprint(firstMessageText, "4.2.
|
|
797091
|
+
return computeFingerprint(firstMessageText, "4.2.16");
|
|
797308
797092
|
}
|
|
797309
797093
|
var FINGERPRINT_SALT = "59cf53e54c78";
|
|
797310
797094
|
var init_fingerprint = () => {};
|
|
@@ -797714,7 +797498,7 @@ function getAnthropicEnvMetadata() {
|
|
|
797714
797498
|
function getBuildAgeMinutes() {
|
|
797715
797499
|
if (false)
|
|
797716
797500
|
;
|
|
797717
|
-
const buildTime = new Date("2026-07-17T11:
|
|
797501
|
+
const buildTime = new Date("2026-07-17T11:45:23.878Z").getTime();
|
|
797718
797502
|
if (isNaN(buildTime))
|
|
797719
797503
|
return;
|
|
797720
797504
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -798436,17 +798220,17 @@ function toNonStreamingOpenAIRequestBody(requestBody) {
|
|
|
798436
798220
|
var init_nonStreamingFallback = () => {};
|
|
798437
798221
|
|
|
798438
798222
|
// src/services/api/openai/chatgptAuth.ts
|
|
798439
|
-
import { chmod as chmod12, mkdir as mkdir66, readFile as
|
|
798223
|
+
import { chmod as chmod12, mkdir as mkdir66, readFile as readFile78, unlink as unlink30, writeFile as writeFile70 } from "fs/promises";
|
|
798440
798224
|
import { homedir as homedir48 } from "os";
|
|
798441
|
-
import { join as
|
|
798225
|
+
import { join as join207 } from "path";
|
|
798442
798226
|
function authFilePath() {
|
|
798443
|
-
return
|
|
798227
|
+
return join207(getClaudeConfigHomeDirLocal(), AUTH_FILE);
|
|
798444
798228
|
}
|
|
798445
798229
|
function getClaudeConfigHomeDirLocal() {
|
|
798446
|
-
return (process.env.CLAUDE_CONFIG_DIR ??
|
|
798230
|
+
return (process.env.CLAUDE_CONFIG_DIR ?? join207(homedir48(), ".claude")).normalize("NFC");
|
|
798447
798231
|
}
|
|
798448
798232
|
function codexAuthFilePath() {
|
|
798449
|
-
return
|
|
798233
|
+
return join207(process.env.CODEX_HOME ?? join207(process.env.HOME ?? "", ".codex"), "auth.json");
|
|
798450
798234
|
}
|
|
798451
798235
|
function asString2(value) {
|
|
798452
798236
|
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
@@ -798500,7 +798284,7 @@ function extractAccountId(tokens) {
|
|
|
798500
798284
|
}
|
|
798501
798285
|
async function readStoredAuth(path51) {
|
|
798502
798286
|
try {
|
|
798503
|
-
const raw = await
|
|
798287
|
+
const raw = await readFile78(path51, "utf8");
|
|
798504
798288
|
const parsed = JSON.parse(raw);
|
|
798505
798289
|
const tokens = parsed.tokens;
|
|
798506
798290
|
const idToken = tokens?.id_token;
|
|
@@ -798536,7 +798320,7 @@ async function saveStoredAuth(tokens) {
|
|
|
798536
798320
|
},
|
|
798537
798321
|
last_refresh: new Date().toISOString()
|
|
798538
798322
|
};
|
|
798539
|
-
await
|
|
798323
|
+
await writeFile70(path51, `${JSON.stringify(body, null, 2)}
|
|
798540
798324
|
`, {
|
|
798541
798325
|
mode: 384
|
|
798542
798326
|
});
|
|
@@ -803111,7 +802895,7 @@ async function sideQuery(opts) {
|
|
|
803111
802895
|
betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
|
|
803112
802896
|
}
|
|
803113
802897
|
const messageText = extractFirstUserMessageText(messages);
|
|
803114
|
-
const fingerprint = computeFingerprint(messageText, "4.2.
|
|
802898
|
+
const fingerprint = computeFingerprint(messageText, "4.2.16");
|
|
803115
802899
|
const attributionHeader = getAttributionHeader(fingerprint);
|
|
803116
802900
|
const systemBlocks = [
|
|
803117
802901
|
attributionHeader ? { type: "text", text: attributionHeader } : null,
|
|
@@ -803469,11 +803253,11 @@ import {
|
|
|
803469
803253
|
readdir as readdir43,
|
|
803470
803254
|
rmdir as rmdir3,
|
|
803471
803255
|
stat as stat51,
|
|
803472
|
-
unlink as
|
|
803256
|
+
unlink as unlink31
|
|
803473
803257
|
} from "fs/promises";
|
|
803474
803258
|
import { createServer as createServer9 } from "net";
|
|
803475
803259
|
import { homedir as homedir49, platform as platform12 } from "os";
|
|
803476
|
-
import { join as
|
|
803260
|
+
import { join as join208 } from "path";
|
|
803477
803261
|
function log15(message2, ...args) {
|
|
803478
803262
|
if (LOG_FILE2) {
|
|
803479
803263
|
const timestamp2 = new Date().toISOString();
|
|
@@ -803522,7 +803306,7 @@ class ChromeNativeHost {
|
|
|
803522
803306
|
try {
|
|
803523
803307
|
const dirStats = await stat51(socketDir);
|
|
803524
803308
|
if (!dirStats.isDirectory()) {
|
|
803525
|
-
await
|
|
803309
|
+
await unlink31(socketDir);
|
|
803526
803310
|
}
|
|
803527
803311
|
} catch {}
|
|
803528
803312
|
await mkdir67(socketDir, { recursive: true, mode: 448 });
|
|
@@ -803540,7 +803324,7 @@ class ChromeNativeHost {
|
|
|
803540
803324
|
try {
|
|
803541
803325
|
process.kill(pid, 0);
|
|
803542
803326
|
} catch {
|
|
803543
|
-
await
|
|
803327
|
+
await unlink31(join208(socketDir, file3)).catch(() => {});
|
|
803544
803328
|
log15(`Removed stale socket for PID ${pid}`);
|
|
803545
803329
|
}
|
|
803546
803330
|
}
|
|
@@ -803584,7 +803368,7 @@ class ChromeNativeHost {
|
|
|
803584
803368
|
}
|
|
803585
803369
|
if (platform12() !== "win32" && this.socketPath) {
|
|
803586
803370
|
try {
|
|
803587
|
-
await
|
|
803371
|
+
await unlink31(this.socketPath);
|
|
803588
803372
|
log15("Cleaned up socket file");
|
|
803589
803373
|
} catch {}
|
|
803590
803374
|
try {
|
|
@@ -803811,7 +803595,7 @@ var init_chromeNativeHost = __esm(() => {
|
|
|
803811
803595
|
init_slowOperations();
|
|
803812
803596
|
init_common5();
|
|
803813
803597
|
MAX_MESSAGE_SIZE = 1024 * 1024;
|
|
803814
|
-
LOG_FILE2 = process.env.USER_TYPE === "sf" ?
|
|
803598
|
+
LOG_FILE2 = process.env.USER_TYPE === "sf" ? join208(homedir49(), ".claude", "debug", "chrome-native-host.txt") : undefined;
|
|
803815
803599
|
messageSchema = lazySchema(() => exports_external.object({
|
|
803816
803600
|
type: exports_external.string()
|
|
803817
803601
|
}).passthrough());
|
|
@@ -806486,7 +806270,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
806486
806270
|
slash_commands: inputs.commands.filter((c10) => c10.userInvocable !== false).map((c10) => c10.name),
|
|
806487
806271
|
apiKeySource: getAnthropicApiKeyWithSource().source,
|
|
806488
806272
|
betas: getSdkBetas(),
|
|
806489
|
-
claude_code_version: "4.2.
|
|
806273
|
+
claude_code_version: "4.2.16",
|
|
806490
806274
|
output_style: outputStyle2,
|
|
806491
806275
|
agents: inputs.agents.map((agent) => agent.agentType),
|
|
806492
806276
|
skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
|
|
@@ -809980,12 +809764,12 @@ var EXIT_CODE_PERMANENT2 = 78;
|
|
|
809980
809764
|
var init_workerRegistry = () => {};
|
|
809981
809765
|
|
|
809982
809766
|
// src/utils/errorLogSink.ts
|
|
809983
|
-
import { dirname as dirname82, join as
|
|
809767
|
+
import { dirname as dirname82, join as join209 } from "path";
|
|
809984
809768
|
function getErrorsPath() {
|
|
809985
|
-
return
|
|
809769
|
+
return join209(CACHE_PATHS.errors(), DATE + ".jsonl");
|
|
809986
809770
|
}
|
|
809987
809771
|
function getMCPLogsPath(serverName) {
|
|
809988
|
-
return
|
|
809772
|
+
return join209(CACHE_PATHS.mcpLogs(serverName), DATE + ".jsonl");
|
|
809989
809773
|
}
|
|
809990
809774
|
function createJsonlWriter(options) {
|
|
809991
809775
|
const writer = createBufferedWriter(options);
|
|
@@ -810029,7 +809813,7 @@ function appendToLog(path53, message2) {
|
|
|
810029
809813
|
cwd: getFsImplementation().cwd(),
|
|
810030
809814
|
userType: process.env.USER_TYPE,
|
|
810031
809815
|
sessionId: getSessionId(),
|
|
810032
|
-
version: "4.2.
|
|
809816
|
+
version: "4.2.16"
|
|
810033
809817
|
};
|
|
810034
809818
|
getLogWriter(path53).write(messageWithTimestamp);
|
|
810035
809819
|
}
|
|
@@ -813188,9 +812972,9 @@ __export(exports_upstreamproxy, {
|
|
|
813188
812972
|
getUpstreamProxyEnv: () => getUpstreamProxyEnv,
|
|
813189
812973
|
SESSION_TOKEN_PATH: () => SESSION_TOKEN_PATH
|
|
813190
812974
|
});
|
|
813191
|
-
import { mkdir as mkdir68, readFile as
|
|
812975
|
+
import { mkdir as mkdir68, readFile as readFile79, unlink as unlink32, writeFile as writeFile71 } from "fs/promises";
|
|
813192
812976
|
import { homedir as homedir50 } from "os";
|
|
813193
|
-
import { join as
|
|
812977
|
+
import { join as join210 } from "path";
|
|
813194
812978
|
async function initUpstreamProxy(opts) {
|
|
813195
812979
|
if (!isEnvTruthy(process.env.CLAUDE_CODE_REMOTE)) {
|
|
813196
812980
|
return state3;
|
|
@@ -813215,7 +812999,7 @@ async function initUpstreamProxy(opts) {
|
|
|
813215
812999
|
logForDebugging("[upstreamproxy] ANTHROPIC_BASE_URL not set; proxy disabled", { level: "warn" });
|
|
813216
813000
|
return state3;
|
|
813217
813001
|
}
|
|
813218
|
-
const caBundlePath = opts?.caBundlePath ??
|
|
813002
|
+
const caBundlePath = opts?.caBundlePath ?? join210(homedir50(), ".ccr", "ca-bundle.crt");
|
|
813219
813003
|
const caOk = await downloadCaBundle(baseUrl, opts?.systemCaPath ?? SYSTEM_CA_BUNDLE, caBundlePath);
|
|
813220
813004
|
if (!caOk)
|
|
813221
813005
|
return state3;
|
|
@@ -813225,7 +813009,7 @@ async function initUpstreamProxy(opts) {
|
|
|
813225
813009
|
registerCleanup(async () => relay.stop());
|
|
813226
813010
|
state3 = { enabled: true, port: relay.port, caBundlePath };
|
|
813227
813011
|
logForDebugging(`[upstreamproxy] enabled on 127.0.0.1:${relay.port}`);
|
|
813228
|
-
await
|
|
813012
|
+
await unlink32(tokenPath).catch(() => {
|
|
813229
813013
|
logForDebugging("[upstreamproxy] token file unlink failed", {
|
|
813230
813014
|
level: "warn"
|
|
813231
813015
|
});
|
|
@@ -813273,7 +813057,7 @@ function resetUpstreamProxyForTests() {
|
|
|
813273
813057
|
}
|
|
813274
813058
|
async function readToken(path54) {
|
|
813275
813059
|
try {
|
|
813276
|
-
const raw = await
|
|
813060
|
+
const raw = await readFile79(path54, "utf8");
|
|
813277
813061
|
return raw.trim() || null;
|
|
813278
813062
|
} catch (err3) {
|
|
813279
813063
|
if (isENOENT(err3))
|
|
@@ -813314,9 +813098,9 @@ async function downloadCaBundle(baseUrl, systemCaPath, outPath) {
|
|
|
813314
813098
|
return false;
|
|
813315
813099
|
}
|
|
813316
813100
|
const ccrCa = await resp.text();
|
|
813317
|
-
const systemCa = await
|
|
813318
|
-
await mkdir68(
|
|
813319
|
-
await
|
|
813101
|
+
const systemCa = await readFile79(systemCaPath, "utf8").catch(() => "");
|
|
813102
|
+
await mkdir68(join210(outPath, ".."), { recursive: true });
|
|
813103
|
+
await writeFile71(outPath, systemCa + `
|
|
813320
813104
|
` + ccrCa, "utf8");
|
|
813321
813105
|
return true;
|
|
813322
813106
|
} catch (err3) {
|
|
@@ -818435,7 +818219,7 @@ var init_ShowInIDEPrompt = __esm(() => {
|
|
|
818435
818219
|
|
|
818436
818220
|
// src/components/permissions/FilePermissionDialog/permissionOptions.tsx
|
|
818437
818221
|
import { homedir as homedir51 } from "os";
|
|
818438
|
-
import { basename as basename58, join as
|
|
818222
|
+
import { basename as basename58, join as join211, sep as sep41 } from "path";
|
|
818439
818223
|
function isInClaudeFolder(filePath) {
|
|
818440
818224
|
const absolutePath = expandPath(filePath);
|
|
818441
818225
|
const claudeFolderPath = expandPath(`${getOriginalCwd()}/${CONFIG_DIR_NAME}`);
|
|
@@ -818445,7 +818229,7 @@ function isInClaudeFolder(filePath) {
|
|
|
818445
818229
|
}
|
|
818446
818230
|
function isInGlobalClaudeFolder(filePath) {
|
|
818447
818231
|
const absolutePath = expandPath(filePath);
|
|
818448
|
-
const globalClaudeFolderPath =
|
|
818232
|
+
const globalClaudeFolderPath = join211(homedir51(), CONFIG_DIR_NAME);
|
|
818449
818233
|
const normalizedAbsolutePath = normalizeCaseForComparison2(absolutePath);
|
|
818450
818234
|
const normalizedGlobalClaudeFolderPath = normalizeCaseForComparison2(globalClaudeFolderPath);
|
|
818451
818235
|
return normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + sep41.toLowerCase()) || normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + "/");
|
|
@@ -826727,7 +826511,7 @@ var init_commandSuggestions = __esm(() => {
|
|
|
826727
826511
|
// src/utils/suggestions/shellHistoryCompletion.ts
|
|
826728
826512
|
async function getShellHistoryCommands() {
|
|
826729
826513
|
const now2 = Date.now();
|
|
826730
|
-
if (shellHistoryCache && now2 - shellHistoryCacheTimestamp <
|
|
826514
|
+
if (shellHistoryCache && now2 - shellHistoryCacheTimestamp < CACHE_TTL_MS4) {
|
|
826731
826515
|
return shellHistoryCache;
|
|
826732
826516
|
}
|
|
826733
826517
|
const commands11 = [];
|
|
@@ -826781,7 +826565,7 @@ async function getShellHistoryCompletion(input4) {
|
|
|
826781
826565
|
}
|
|
826782
826566
|
return null;
|
|
826783
826567
|
}
|
|
826784
|
-
var shellHistoryCache = null, shellHistoryCacheTimestamp = 0,
|
|
826568
|
+
var shellHistoryCache = null, shellHistoryCacheTimestamp = 0, CACHE_TTL_MS4 = 60000;
|
|
826785
826569
|
var init_shellHistoryCompletion = __esm(() => {
|
|
826786
826570
|
init_history2();
|
|
826787
826571
|
init_debug();
|
|
@@ -830318,8 +830102,8 @@ var init_usePrStatus = __esm(() => {
|
|
|
830318
830102
|
|
|
830319
830103
|
// src/utils/cacheStats.ts
|
|
830320
830104
|
import { createHash as createHash36 } from "crypto";
|
|
830321
|
-
import { mkdir as mkdir69, readFile as
|
|
830322
|
-
import { dirname as dirname83, join as
|
|
830105
|
+
import { mkdir as mkdir69, readFile as readFile80, rename as rename15, writeFile as writeFile72 } from "fs/promises";
|
|
830106
|
+
import { dirname as dirname83, join as join212 } from "path";
|
|
830323
830107
|
function computeHitRate(u6) {
|
|
830324
830108
|
if (!u6)
|
|
830325
830109
|
return null;
|
|
@@ -830333,7 +830117,7 @@ function tokenSignature(u6) {
|
|
|
830333
830117
|
}
|
|
830334
830118
|
function getStateFilePath(sessionId) {
|
|
830335
830119
|
const hash4 = createHash36("sha256").update(sessionId).digest("hex").slice(0, 16);
|
|
830336
|
-
return
|
|
830120
|
+
return join212(getClaudeConfigHomeDir(), "cache-stats", `${hash4}.json`);
|
|
830337
830121
|
}
|
|
830338
830122
|
function isValidState(obj) {
|
|
830339
830123
|
if (typeof obj !== "object" || obj === null)
|
|
@@ -830343,7 +830127,7 @@ function isValidState(obj) {
|
|
|
830343
830127
|
}
|
|
830344
830128
|
async function readState2(filePath) {
|
|
830345
830129
|
try {
|
|
830346
|
-
const raw = await
|
|
830130
|
+
const raw = await readFile80(filePath, "utf8");
|
|
830347
830131
|
const parsed = JSON.parse(raw);
|
|
830348
830132
|
if (isValidState(parsed))
|
|
830349
830133
|
return parsed;
|
|
@@ -830357,8 +830141,8 @@ async function writeStateAtomic(filePath, state4) {
|
|
|
830357
830141
|
await mkdir69(dir, { recursive: true });
|
|
830358
830142
|
const tmp = `${filePath}.${process.pid}.tmp`;
|
|
830359
830143
|
try {
|
|
830360
|
-
await
|
|
830361
|
-
await
|
|
830144
|
+
await writeFile72(tmp, JSON.stringify(state4), "utf8");
|
|
830145
|
+
await rename15(tmp, filePath);
|
|
830362
830146
|
} catch {}
|
|
830363
830147
|
}
|
|
830364
830148
|
var INIT_STATE;
|
|
@@ -831005,7 +830789,7 @@ function buildStatusLineCommandInput(permissionMode, exceeds200kTokens, settings
|
|
|
831005
830789
|
project_dir: getOriginalCwd(),
|
|
831006
830790
|
added_dirs: addedDirs
|
|
831007
830791
|
},
|
|
831008
|
-
version: "4.2.
|
|
830792
|
+
version: "4.2.16",
|
|
831009
830793
|
output_style: {
|
|
831010
830794
|
name: outputStyleName
|
|
831011
830795
|
},
|
|
@@ -836222,9 +836006,9 @@ function initSkillImprovement() {
|
|
|
836222
836006
|
async function applySkillImprovement(skillName, updates) {
|
|
836223
836007
|
if (!skillName)
|
|
836224
836008
|
return;
|
|
836225
|
-
const { join:
|
|
836009
|
+
const { join: join213 } = await import("path");
|
|
836226
836010
|
const fs34 = await import("fs/promises");
|
|
836227
|
-
const filePath =
|
|
836011
|
+
const filePath = join213(getCwd(), ".claude", "skills", skillName, "SKILL.md");
|
|
836228
836012
|
let currentContent;
|
|
836229
836013
|
try {
|
|
836230
836014
|
currentContent = await fs34.readFile(filePath, "utf-8");
|
|
@@ -838367,13 +838151,13 @@ var require_polyfill = __commonJS((exports, module) => {
|
|
|
838367
838151
|
readlink: readlink3,
|
|
838368
838152
|
stat: stat52,
|
|
838369
838153
|
symlink: symlink6,
|
|
838370
|
-
unlink:
|
|
838154
|
+
unlink: unlink33,
|
|
838371
838155
|
utimes: utimes3
|
|
838372
838156
|
} = __require("fs/promises");
|
|
838373
838157
|
var {
|
|
838374
838158
|
dirname: dirname84,
|
|
838375
838159
|
isAbsolute: isAbsolute31,
|
|
838376
|
-
join:
|
|
838160
|
+
join: join213,
|
|
838377
838161
|
parse: parse28,
|
|
838378
838162
|
resolve: resolve58,
|
|
838379
838163
|
sep: sep43,
|
|
@@ -838565,7 +838349,7 @@ var require_polyfill = __commonJS((exports, module) => {
|
|
|
838565
838349
|
}
|
|
838566
838350
|
async function mayCopyFile(srcStat, src, dest, opts) {
|
|
838567
838351
|
if (opts.force) {
|
|
838568
|
-
await
|
|
838352
|
+
await unlink33(dest);
|
|
838569
838353
|
return _copyFile(srcStat, src, dest, opts);
|
|
838570
838354
|
} else if (opts.errorOnExist) {
|
|
838571
838355
|
throw new ERR_FS_CP_EEXIST({
|
|
@@ -838622,8 +838406,8 @@ var require_polyfill = __commonJS((exports, module) => {
|
|
|
838622
838406
|
const dir = await readdir44(src);
|
|
838623
838407
|
for (let i10 = 0;i10 < dir.length; i10++) {
|
|
838624
838408
|
const item = dir[i10];
|
|
838625
|
-
const srcItem =
|
|
838626
|
-
const destItem =
|
|
838409
|
+
const srcItem = join213(src, item);
|
|
838410
|
+
const destItem = join213(dest, item);
|
|
838627
838411
|
const { destStat } = await checkPaths(srcItem, destItem, opts);
|
|
838628
838412
|
await startCopy(destStat, srcItem, destItem, opts);
|
|
838629
838413
|
}
|
|
@@ -838668,7 +838452,7 @@ var require_polyfill = __commonJS((exports, module) => {
|
|
|
838668
838452
|
return copyLink(resolvedSrc, dest);
|
|
838669
838453
|
}
|
|
838670
838454
|
async function copyLink(resolvedSrc, dest) {
|
|
838671
|
-
await
|
|
838455
|
+
await unlink33(dest);
|
|
838672
838456
|
return symlink6(resolvedSrc, dest);
|
|
838673
838457
|
}
|
|
838674
838458
|
module.exports = cp;
|
|
@@ -838692,7 +838476,7 @@ var require_cp = __commonJS((exports, module) => {
|
|
|
838692
838476
|
|
|
838693
838477
|
// node_modules/.bun/@npmcli+fs@5.0.0/node_modules/@npmcli/fs/lib/with-temp-dir.js
|
|
838694
838478
|
var require_with_temp_dir = __commonJS((exports, module) => {
|
|
838695
|
-
var { join:
|
|
838479
|
+
var { join: join213, sep: sep43 } = __require("path");
|
|
838696
838480
|
var getOptions2 = require_get_options();
|
|
838697
838481
|
var { mkdir: mkdir70, mkdtemp: mkdtemp4, rm: rm17 } = __require("fs/promises");
|
|
838698
838482
|
var withTempDir = async (root9, fn, opts) => {
|
|
@@ -838700,7 +838484,7 @@ var require_with_temp_dir = __commonJS((exports, module) => {
|
|
|
838700
838484
|
copy: ["tmpPrefix"]
|
|
838701
838485
|
});
|
|
838702
838486
|
await mkdir70(root9, { recursive: true });
|
|
838703
|
-
const target = await mkdtemp4(
|
|
838487
|
+
const target = await mkdtemp4(join213(`${root9}${sep43}`, options.tmpPrefix || ""));
|
|
838704
838488
|
let err3;
|
|
838705
838489
|
let result;
|
|
838706
838490
|
try {
|
|
@@ -838722,13 +838506,13 @@ var require_with_temp_dir = __commonJS((exports, module) => {
|
|
|
838722
838506
|
// node_modules/.bun/@npmcli+fs@5.0.0/node_modules/@npmcli/fs/lib/readdir-scoped.js
|
|
838723
838507
|
var require_readdir_scoped = __commonJS((exports, module) => {
|
|
838724
838508
|
var { readdir: readdir44 } = __require("fs/promises");
|
|
838725
|
-
var { join:
|
|
838509
|
+
var { join: join213 } = __require("path");
|
|
838726
838510
|
var readdirScoped = async (dir) => {
|
|
838727
838511
|
const results = [];
|
|
838728
838512
|
for (const item of await readdir44(dir)) {
|
|
838729
838513
|
if (item.startsWith("@")) {
|
|
838730
|
-
for (const scopedItem of await readdir44(
|
|
838731
|
-
results.push(
|
|
838514
|
+
for (const scopedItem of await readdir44(join213(dir, item))) {
|
|
838515
|
+
results.push(join213(item, scopedItem));
|
|
838732
838516
|
}
|
|
838733
838517
|
} else {
|
|
838734
838518
|
results.push(item);
|
|
@@ -838741,7 +838525,7 @@ var require_readdir_scoped = __commonJS((exports, module) => {
|
|
|
838741
838525
|
|
|
838742
838526
|
// node_modules/.bun/@npmcli+fs@5.0.0/node_modules/@npmcli/fs/lib/move-file.js
|
|
838743
838527
|
var require_move_file = __commonJS((exports, module) => {
|
|
838744
|
-
var { dirname: dirname84, join:
|
|
838528
|
+
var { dirname: dirname84, join: join213, resolve: resolve58, relative: relative39, isAbsolute: isAbsolute31 } = __require("path");
|
|
838745
838529
|
var fs34 = __require("fs/promises");
|
|
838746
838530
|
var pathExists2 = async (path55) => {
|
|
838747
838531
|
try {
|
|
@@ -838770,7 +838554,7 @@ var require_move_file = __commonJS((exports, module) => {
|
|
|
838770
838554
|
const sourceStat = await fs34.lstat(source);
|
|
838771
838555
|
if (sourceStat.isDirectory()) {
|
|
838772
838556
|
const files3 = await fs34.readdir(source);
|
|
838773
|
-
await Promise.all(files3.map((file3) => moveFile(
|
|
838557
|
+
await Promise.all(files3.map((file3) => moveFile(join213(source, file3), join213(destination, file3), options, false, symlinks)));
|
|
838774
838558
|
} else if (sourceStat.isSymbolicLink()) {
|
|
838775
838559
|
symlinks.push({ source, destination });
|
|
838776
838560
|
} else {
|
|
@@ -838959,10 +838743,10 @@ var require_entry_index = __commonJS((exports, module) => {
|
|
|
838959
838743
|
var {
|
|
838960
838744
|
appendFile: appendFile9,
|
|
838961
838745
|
mkdir: mkdir70,
|
|
838962
|
-
readFile:
|
|
838746
|
+
readFile: readFile81,
|
|
838963
838747
|
readdir: readdir44,
|
|
838964
838748
|
rm: rm17,
|
|
838965
|
-
writeFile:
|
|
838749
|
+
writeFile: writeFile73
|
|
838966
838750
|
} = __require("fs/promises");
|
|
838967
838751
|
var { Minipass } = require_commonjs();
|
|
838968
838752
|
var path55 = __require("path");
|
|
@@ -839016,7 +838800,7 @@ var require_entry_index = __commonJS((exports, module) => {
|
|
|
839016
838800
|
}
|
|
839017
838801
|
};
|
|
839018
838802
|
const write = async (tmp2) => {
|
|
839019
|
-
await
|
|
838803
|
+
await writeFile73(tmp2.target, newIndex, { flag: "wx" });
|
|
839020
838804
|
await mkdir70(path55.dirname(bucket), { recursive: true });
|
|
839021
838805
|
await moveFile(tmp2.target, bucket);
|
|
839022
838806
|
tmp2.moved = true;
|
|
@@ -839132,7 +838916,7 @@ ${hashEntry(stringified)} ${stringified}`);
|
|
|
839132
838916
|
}
|
|
839133
838917
|
exports.bucketEntries = bucketEntries;
|
|
839134
838918
|
async function bucketEntries(bucket, filter2) {
|
|
839135
|
-
const data = await
|
|
838919
|
+
const data = await readFile81(bucket, "utf8");
|
|
839136
838920
|
return _bucketEntries(data, filter2);
|
|
839137
838921
|
}
|
|
839138
838922
|
function _bucketEntries(data) {
|
|
@@ -844170,11 +843954,11 @@ var require_rm2 = __commonJS((exports, module) => {
|
|
|
844170
843954
|
var require_verify2 = __commonJS((exports, module) => {
|
|
844171
843955
|
var {
|
|
844172
843956
|
mkdir: mkdir70,
|
|
844173
|
-
readFile:
|
|
843957
|
+
readFile: readFile81,
|
|
844174
843958
|
rm: rm17,
|
|
844175
843959
|
stat: stat52,
|
|
844176
843960
|
truncate: truncate8,
|
|
844177
|
-
writeFile:
|
|
843961
|
+
writeFile: writeFile73
|
|
844178
843962
|
} = __require("fs/promises");
|
|
844179
843963
|
var contentPath = require_path2();
|
|
844180
843964
|
var fsm = require_lib19();
|
|
@@ -844367,11 +844151,11 @@ var require_verify2 = __commonJS((exports, module) => {
|
|
|
844367
844151
|
async function writeVerifile(cache14, opts) {
|
|
844368
844152
|
const verifile = path55.join(cache14, "_lastverified");
|
|
844369
844153
|
opts.log.silly("verify", "writing verifile to " + verifile);
|
|
844370
|
-
return
|
|
844154
|
+
return writeFile73(verifile, `${Date.now()}`);
|
|
844371
844155
|
}
|
|
844372
844156
|
module.exports.lastRun = lastRun;
|
|
844373
844157
|
async function lastRun(cache14) {
|
|
844374
|
-
const data = await
|
|
844158
|
+
const data = await readFile81(path55.join(cache14, "_lastverified"), { encoding: "utf8" });
|
|
844375
844159
|
return new Date(+data);
|
|
844376
844160
|
}
|
|
844377
844161
|
});
|
|
@@ -844415,7 +844199,7 @@ var require_lib20 = __commonJS((exports, module) => {
|
|
|
844415
844199
|
// src/utils/cleanup.ts
|
|
844416
844200
|
import * as fs34 from "fs/promises";
|
|
844417
844201
|
import { homedir as homedir52 } from "os";
|
|
844418
|
-
import { join as
|
|
844202
|
+
import { join as join213 } from "path";
|
|
844419
844203
|
function getCutoffDate() {
|
|
844420
844204
|
const settings = getSettings_DEPRECATED() || {};
|
|
844421
844205
|
const cleanupPeriodDays = settings.cleanupPeriodDays ?? DEFAULT_CLEANUP_PERIOD_DAYS;
|
|
@@ -844440,7 +844224,7 @@ async function cleanupOldFilesInDirectory(dirPath, cutoffDate, isMessagePath) {
|
|
|
844440
844224
|
try {
|
|
844441
844225
|
const timestamp2 = convertFileNameToDate(file3.name);
|
|
844442
844226
|
if (timestamp2 < cutoffDate) {
|
|
844443
|
-
await getFsImplementation().unlink(
|
|
844227
|
+
await getFsImplementation().unlink(join213(dirPath, file3.name));
|
|
844444
844228
|
if (isMessagePath) {
|
|
844445
844229
|
result.messages++;
|
|
844446
844230
|
} else {
|
|
@@ -844471,7 +844255,7 @@ async function cleanupOldMessageFiles() {
|
|
|
844471
844255
|
} catch {
|
|
844472
844256
|
return result;
|
|
844473
844257
|
}
|
|
844474
|
-
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) =>
|
|
844258
|
+
const mcpLogDirs = dirents.filter((dirent) => dirent.isDirectory() && dirent.name.startsWith("mcp-logs-")).map((dirent) => join213(baseCachePath, dirent.name));
|
|
844475
844259
|
for (const mcpLogDir of mcpLogDirs) {
|
|
844476
844260
|
result = addCleanupResults(result, await cleanupOldFilesInDirectory(mcpLogDir, cutoffDate, true));
|
|
844477
844261
|
await tryRmdir(mcpLogDir, fsImpl);
|
|
@@ -844515,7 +844299,7 @@ async function cleanupOldSessionFiles() {
|
|
|
844515
844299
|
if (seenProjectNames.has(projectDirent.name))
|
|
844516
844300
|
continue;
|
|
844517
844301
|
seenProjectNames.add(projectDirent.name);
|
|
844518
|
-
const projectDir =
|
|
844302
|
+
const projectDir = join213(projectsDir, projectDirent.name);
|
|
844519
844303
|
let entries;
|
|
844520
844304
|
try {
|
|
844521
844305
|
entries = await fsImpl.readdir(projectDir);
|
|
@@ -844529,15 +844313,15 @@ async function cleanupOldSessionFiles() {
|
|
|
844529
844313
|
continue;
|
|
844530
844314
|
}
|
|
844531
844315
|
try {
|
|
844532
|
-
if (await unlinkIfOld(
|
|
844316
|
+
if (await unlinkIfOld(join213(projectDir, entry.name), cutoffDate, fsImpl)) {
|
|
844533
844317
|
result.messages++;
|
|
844534
844318
|
}
|
|
844535
844319
|
} catch {
|
|
844536
844320
|
result.errors++;
|
|
844537
844321
|
}
|
|
844538
844322
|
} else if (entry.isDirectory()) {
|
|
844539
|
-
const sessionDir =
|
|
844540
|
-
const toolResultsDir =
|
|
844323
|
+
const sessionDir = join213(projectDir, entry.name);
|
|
844324
|
+
const toolResultsDir = join213(sessionDir, TOOL_RESULTS_SUBDIR);
|
|
844541
844325
|
let toolDirs;
|
|
844542
844326
|
try {
|
|
844543
844327
|
toolDirs = await fsImpl.readdir(toolResultsDir);
|
|
@@ -844548,14 +844332,14 @@ async function cleanupOldSessionFiles() {
|
|
|
844548
844332
|
for (const toolEntry of toolDirs) {
|
|
844549
844333
|
if (toolEntry.isFile()) {
|
|
844550
844334
|
try {
|
|
844551
|
-
if (await unlinkIfOld(
|
|
844335
|
+
if (await unlinkIfOld(join213(toolResultsDir, toolEntry.name), cutoffDate, fsImpl)) {
|
|
844552
844336
|
result.messages++;
|
|
844553
844337
|
}
|
|
844554
844338
|
} catch {
|
|
844555
844339
|
result.errors++;
|
|
844556
844340
|
}
|
|
844557
844341
|
} else if (toolEntry.isDirectory()) {
|
|
844558
|
-
const toolDirPath =
|
|
844342
|
+
const toolDirPath = join213(toolResultsDir, toolEntry.name);
|
|
844559
844343
|
let toolFiles;
|
|
844560
844344
|
try {
|
|
844561
844345
|
toolFiles = await fsImpl.readdir(toolDirPath);
|
|
@@ -844566,7 +844350,7 @@ async function cleanupOldSessionFiles() {
|
|
|
844566
844350
|
if (!tf.isFile())
|
|
844567
844351
|
continue;
|
|
844568
844352
|
try {
|
|
844569
|
-
if (await unlinkIfOld(
|
|
844353
|
+
if (await unlinkIfOld(join213(toolDirPath, tf.name), cutoffDate, fsImpl)) {
|
|
844570
844354
|
result.messages++;
|
|
844571
844355
|
}
|
|
844572
844356
|
} catch {
|
|
@@ -844599,7 +844383,7 @@ async function cleanupSingleDirectory(dirPath, extension, removeEmptyDir = true)
|
|
|
844599
844383
|
if (!dirent.isFile() || !dirent.name.endsWith(extension))
|
|
844600
844384
|
continue;
|
|
844601
844385
|
try {
|
|
844602
|
-
if (await unlinkIfOld(
|
|
844386
|
+
if (await unlinkIfOld(join213(dirPath, dirent.name), cutoffDate, fsImpl)) {
|
|
844603
844387
|
result.messages++;
|
|
844604
844388
|
}
|
|
844605
844389
|
} catch {
|
|
@@ -844612,7 +844396,7 @@ async function cleanupSingleDirectory(dirPath, extension, removeEmptyDir = true)
|
|
|
844612
844396
|
return result;
|
|
844613
844397
|
}
|
|
844614
844398
|
function cleanupOldPlanFiles() {
|
|
844615
|
-
const plansDir =
|
|
844399
|
+
const plansDir = join213(getClaudeConfigHomeDir(), "plans");
|
|
844616
844400
|
return cleanupSingleDirectory(plansDir, ".md");
|
|
844617
844401
|
}
|
|
844618
844402
|
async function cleanupOldFileHistoryBackups() {
|
|
@@ -844621,14 +844405,14 @@ async function cleanupOldFileHistoryBackups() {
|
|
|
844621
844405
|
const fsImpl = getFsImplementation();
|
|
844622
844406
|
try {
|
|
844623
844407
|
const configDir = getClaudeConfigHomeDir();
|
|
844624
|
-
const fileHistoryStorageDir =
|
|
844408
|
+
const fileHistoryStorageDir = join213(configDir, "file-history");
|
|
844625
844409
|
let dirents;
|
|
844626
844410
|
try {
|
|
844627
844411
|
dirents = await fsImpl.readdir(fileHistoryStorageDir);
|
|
844628
844412
|
} catch {
|
|
844629
844413
|
return result;
|
|
844630
844414
|
}
|
|
844631
|
-
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
844415
|
+
const fileHistorySessionsDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join213(fileHistoryStorageDir, dirent.name));
|
|
844632
844416
|
await Promise.all(fileHistorySessionsDirs.map(async (fileHistorySessionDir) => {
|
|
844633
844417
|
try {
|
|
844634
844418
|
const stats2 = await fsImpl.stat(fileHistorySessionDir);
|
|
@@ -844655,14 +844439,14 @@ async function cleanupOldSessionEnvDirs() {
|
|
|
844655
844439
|
const fsImpl = getFsImplementation();
|
|
844656
844440
|
try {
|
|
844657
844441
|
const configDir = getClaudeConfigHomeDir();
|
|
844658
|
-
const sessionEnvBaseDir =
|
|
844442
|
+
const sessionEnvBaseDir = join213(configDir, "session-env");
|
|
844659
844443
|
let dirents;
|
|
844660
844444
|
try {
|
|
844661
844445
|
dirents = await fsImpl.readdir(sessionEnvBaseDir);
|
|
844662
844446
|
} catch {
|
|
844663
844447
|
return result;
|
|
844664
844448
|
}
|
|
844665
|
-
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) =>
|
|
844449
|
+
const sessionEnvDirs = dirents.filter((dirent) => dirent.isDirectory()).map((dirent) => join213(sessionEnvBaseDir, dirent.name));
|
|
844666
844450
|
for (const sessionEnvDir of sessionEnvDirs) {
|
|
844667
844451
|
try {
|
|
844668
844452
|
const stats2 = await fsImpl.stat(sessionEnvDir);
|
|
@@ -844684,7 +844468,7 @@ async function cleanupOldDebugLogs() {
|
|
|
844684
844468
|
const cutoffDate = getCutoffDate();
|
|
844685
844469
|
const result = { messages: 0, errors: 0 };
|
|
844686
844470
|
const fsImpl = getFsImplementation();
|
|
844687
|
-
const debugDir =
|
|
844471
|
+
const debugDir = join213(getClaudeConfigHomeDir(), "debug");
|
|
844688
844472
|
let dirents;
|
|
844689
844473
|
try {
|
|
844690
844474
|
dirents = await fsImpl.readdir(debugDir);
|
|
@@ -844696,7 +844480,7 @@ async function cleanupOldDebugLogs() {
|
|
|
844696
844480
|
continue;
|
|
844697
844481
|
}
|
|
844698
844482
|
try {
|
|
844699
|
-
if (await unlinkIfOld(
|
|
844483
|
+
if (await unlinkIfOld(join213(debugDir, dirent.name), cutoffDate, fsImpl)) {
|
|
844700
844484
|
result.messages++;
|
|
844701
844485
|
}
|
|
844702
844486
|
} catch {
|
|
@@ -844706,7 +844490,7 @@ async function cleanupOldDebugLogs() {
|
|
|
844706
844490
|
return result;
|
|
844707
844491
|
}
|
|
844708
844492
|
async function cleanupNpmCacheForAnthropicPackages() {
|
|
844709
|
-
const markerPath =
|
|
844493
|
+
const markerPath = join213(getClaudeConfigHomeDir(), ".npm-cache-cleanup");
|
|
844710
844494
|
try {
|
|
844711
844495
|
const stat53 = await fs34.stat(markerPath);
|
|
844712
844496
|
if (Date.now() - stat53.mtimeMs < ONE_DAY_MS) {
|
|
@@ -844721,7 +844505,7 @@ async function cleanupNpmCacheForAnthropicPackages() {
|
|
|
844721
844505
|
return;
|
|
844722
844506
|
}
|
|
844723
844507
|
logForDebugging("npm cache cleanup: starting");
|
|
844724
|
-
const npmCachePath =
|
|
844508
|
+
const npmCachePath = join213(homedir52(), ".npm", "_cacache");
|
|
844725
844509
|
const NPM_CACHE_RETENTION_COUNT = 5;
|
|
844726
844510
|
const startTime2 = Date.now();
|
|
844727
844511
|
try {
|
|
@@ -844776,7 +844560,7 @@ async function cleanupNpmCacheForAnthropicPackages() {
|
|
|
844776
844560
|
}
|
|
844777
844561
|
}
|
|
844778
844562
|
async function cleanupOldVersionsThrottled() {
|
|
844779
|
-
const markerPath =
|
|
844563
|
+
const markerPath = join213(getClaudeConfigHomeDir(), ".version-cleanup");
|
|
844780
844564
|
try {
|
|
844781
844565
|
const stat53 = await fs34.stat(markerPath);
|
|
844782
844566
|
if (Date.now() - stat53.mtimeMs < ONE_DAY_MS) {
|
|
@@ -847747,8 +847531,8 @@ __export(exports_asciicast, {
|
|
|
847747
847531
|
getRecordFilePath: () => getRecordFilePath,
|
|
847748
847532
|
_resetRecordingStateForTesting: () => _resetRecordingStateForTesting
|
|
847749
847533
|
});
|
|
847750
|
-
import { appendFile as appendFile9, rename as
|
|
847751
|
-
import { basename as basename66, dirname as dirname85, join as
|
|
847534
|
+
import { appendFile as appendFile9, rename as rename16 } from "fs/promises";
|
|
847535
|
+
import { basename as basename66, dirname as dirname85, join as join215 } from "path";
|
|
847752
847536
|
function getRecordFilePath() {
|
|
847753
847537
|
if (recordingState.filePath !== null) {
|
|
847754
847538
|
return recordingState.filePath;
|
|
@@ -847759,10 +847543,10 @@ function getRecordFilePath() {
|
|
|
847759
847543
|
if (!isEnvTruthy(process.env.CLAUDE_CODE_TERMINAL_RECORDING)) {
|
|
847760
847544
|
return null;
|
|
847761
847545
|
}
|
|
847762
|
-
const projectsDir =
|
|
847763
|
-
const projectDir =
|
|
847546
|
+
const projectsDir = join215(getClaudeConfigHomeDir(), "projects");
|
|
847547
|
+
const projectDir = join215(projectsDir, sanitizePath(getOriginalCwd()));
|
|
847764
847548
|
recordingState.timestamp = Date.now();
|
|
847765
|
-
recordingState.filePath =
|
|
847549
|
+
recordingState.filePath = join215(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
847766
847550
|
return recordingState.filePath;
|
|
847767
847551
|
}
|
|
847768
847552
|
function _resetRecordingStateForTesting() {
|
|
@@ -847774,9 +847558,9 @@ async function renameRecordingForSession() {
|
|
|
847774
847558
|
if (!oldPath || recordingState.timestamp === 0) {
|
|
847775
847559
|
return;
|
|
847776
847560
|
}
|
|
847777
|
-
const projectsDir =
|
|
847778
|
-
const projectDir =
|
|
847779
|
-
const newPath =
|
|
847561
|
+
const projectsDir = join215(getClaudeConfigHomeDir(), "projects");
|
|
847562
|
+
const projectDir = join215(projectsDir, sanitizePath(getOriginalCwd()));
|
|
847563
|
+
const newPath = join215(projectDir, `${getSessionId()}-${recordingState.timestamp}.cast`);
|
|
847780
847564
|
if (oldPath === newPath) {
|
|
847781
847565
|
return;
|
|
847782
847566
|
}
|
|
@@ -847784,7 +847568,7 @@ async function renameRecordingForSession() {
|
|
|
847784
847568
|
const oldName = basename66(oldPath);
|
|
847785
847569
|
const newName = basename66(newPath);
|
|
847786
847570
|
try {
|
|
847787
|
-
await
|
|
847571
|
+
await rename16(oldPath, newPath);
|
|
847788
847572
|
recordingState.filePath = newPath;
|
|
847789
847573
|
logForDebugging(`[asciicast] Renamed recording: ${oldName} \u2192 ${newName}`);
|
|
847790
847574
|
} catch {
|
|
@@ -849541,7 +849325,7 @@ var init_useDynamicConfig = __esm(() => {
|
|
|
849541
849325
|
});
|
|
849542
849326
|
|
|
849543
849327
|
// src/components/FeedbackSurvey/submitTranscriptShare.ts
|
|
849544
|
-
import { readFile as
|
|
849328
|
+
import { readFile as readFile81, stat as stat53 } from "fs/promises";
|
|
849545
849329
|
async function submitTranscriptShare(messages, trigger, appearanceId) {
|
|
849546
849330
|
try {
|
|
849547
849331
|
logForDebugging("Collecting transcript for sharing", { level: "info" });
|
|
@@ -849553,14 +849337,14 @@ async function submitTranscriptShare(messages, trigger, appearanceId) {
|
|
|
849553
849337
|
const transcriptPath = getTranscriptPath();
|
|
849554
849338
|
const { size } = await stat53(transcriptPath);
|
|
849555
849339
|
if (size <= MAX_TRANSCRIPT_READ_BYTES) {
|
|
849556
|
-
rawTranscriptJsonl = await
|
|
849340
|
+
rawTranscriptJsonl = await readFile81(transcriptPath, "utf-8");
|
|
849557
849341
|
} else {
|
|
849558
849342
|
logForDebugging(`Skipping raw transcript read: file too large (${size} bytes)`, { level: "warn" });
|
|
849559
849343
|
}
|
|
849560
849344
|
} catch {}
|
|
849561
849345
|
const data = {
|
|
849562
849346
|
trigger,
|
|
849563
|
-
version: "4.2.
|
|
849347
|
+
version: "4.2.16",
|
|
849564
849348
|
platform: process.platform,
|
|
849565
849349
|
transcript,
|
|
849566
849350
|
subagentTranscripts: Object.keys(subagentTranscripts).length > 0 ? subagentTranscripts : undefined,
|
|
@@ -850815,7 +850599,7 @@ function getReleaseType(current2, latest) {
|
|
|
850815
850599
|
return "patch";
|
|
850816
850600
|
}
|
|
850817
850601
|
async function checkNewAutoUpdate(callbacks) {
|
|
850818
|
-
const currentVersion = "4.2.
|
|
850602
|
+
const currentVersion = "4.2.16";
|
|
850819
850603
|
logForDebugging(`[newAutoUpdater] checking, current: ${currentVersion}`);
|
|
850820
850604
|
if (isNewAutoUpdaterDisabled()) {
|
|
850821
850605
|
return { action: "skip", currentVersion, latestVersion: null };
|
|
@@ -850931,7 +850715,7 @@ var init_useNewAutoUpdateCheck = __esm(() => {
|
|
|
850931
850715
|
});
|
|
850932
850716
|
|
|
850933
850717
|
// src/utils/plugins/officialMarketplaceStartupCheck.ts
|
|
850934
|
-
import { join as
|
|
850718
|
+
import { join as join216 } from "path";
|
|
850935
850719
|
function isOfficialMarketplaceAutoInstallDisabled() {
|
|
850936
850720
|
return isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL);
|
|
850937
850721
|
}
|
|
@@ -851014,7 +850798,7 @@ async function checkAndInstallOfficialMarketplace() {
|
|
|
851014
850798
|
return { installed: false, skipped: true, reason: "policy_blocked" };
|
|
851015
850799
|
}
|
|
851016
850800
|
const cacheDir = getMarketplacesCacheDir();
|
|
851017
|
-
const installLocation =
|
|
850801
|
+
const installLocation = join216(cacheDir, OFFICIAL_MARKETPLACE_NAME);
|
|
851018
850802
|
const gcsSha = await fetchOfficialMarketplaceFromGcs(installLocation, cacheDir);
|
|
851019
850803
|
if (gcsSha !== null) {
|
|
851020
850804
|
const known = await loadKnownMarketplacesConfig();
|
|
@@ -852611,7 +852395,7 @@ var init_usePluginRecommendationBase = __esm(() => {
|
|
|
852611
852395
|
});
|
|
852612
852396
|
|
|
852613
852397
|
// src/hooks/useLspPluginRecommendation.tsx
|
|
852614
|
-
import { extname as extname17, join as
|
|
852398
|
+
import { extname as extname17, join as join217 } from "path";
|
|
852615
852399
|
function useLspPluginRecommendation() {
|
|
852616
852400
|
const trackedFiles = useAppState((s) => s.fileHistory.trackedFiles);
|
|
852617
852401
|
const { addNotification } = useNotifications();
|
|
@@ -852659,7 +852443,7 @@ function useLspPluginRecommendation() {
|
|
|
852659
852443
|
case "yes":
|
|
852660
852444
|
installPluginAndNotify(pluginId, pluginName, "lsp-plugin", addNotification, async (pluginData) => {
|
|
852661
852445
|
logForDebugging(`[useLspPluginRecommendation] Installing plugin: ${pluginId}`);
|
|
852662
|
-
const localSourcePath = typeof pluginData.entry.source === "string" ?
|
|
852446
|
+
const localSourcePath = typeof pluginData.entry.source === "string" ? join217(pluginData.marketplaceInstallLocation, pluginData.entry.source) : undefined;
|
|
852663
852447
|
await cacheAndRegisterPlugin(pluginId, pluginData.entry, "user", undefined, localSourcePath);
|
|
852664
852448
|
const settings = getSettingsForSource("userSettings");
|
|
852665
852449
|
updateSettingsForSource("userSettings", {
|
|
@@ -853118,7 +852902,7 @@ var init_useSearchExtraToolsHint = __esm(() => {
|
|
|
853118
852902
|
|
|
853119
852903
|
// src/utils/desktopDeepLink.ts
|
|
853120
852904
|
import { readdir as readdir44 } from "fs/promises";
|
|
853121
|
-
import { join as
|
|
852905
|
+
import { join as join218 } from "path";
|
|
853122
852906
|
function isDevMode() {
|
|
853123
852907
|
if (false) {}
|
|
853124
852908
|
const pathsToCheck = [process.argv[1] || "", process.execPath || ""];
|
|
@@ -853179,7 +852963,7 @@ async function getDesktopVersion() {
|
|
|
853179
852963
|
if (!localAppData) {
|
|
853180
852964
|
return null;
|
|
853181
852965
|
}
|
|
853182
|
-
const installDir =
|
|
852966
|
+
const installDir = join218(localAppData, "AnthropicClaude");
|
|
853183
852967
|
try {
|
|
853184
852968
|
const entries = await readdir44(installDir);
|
|
853185
852969
|
const versions4 = entries.filter((e7) => e7.startsWith("app-")).map((e7) => e7.slice(4)).filter((v2) => import_semver11.coerce(v2) !== null).sort((a8, b9) => {
|
|
@@ -853662,7 +853446,7 @@ __export(exports_reconcileCloudPlugins, {
|
|
|
853662
853446
|
reconcileCloudPlugins: () => reconcileCloudPlugins
|
|
853663
853447
|
});
|
|
853664
853448
|
import path56 from "path";
|
|
853665
|
-
import { mkdir as mkdir70, readFile as
|
|
853449
|
+
import { mkdir as mkdir70, readFile as readFile82, rename as rename17, writeFile as writeFile74 } from "fs/promises";
|
|
853666
853450
|
function emptyReconcileResult() {
|
|
853667
853451
|
return {
|
|
853668
853452
|
runtimeChanged: false,
|
|
@@ -853677,7 +853461,7 @@ function pluginLedgerPath() {
|
|
|
853677
853461
|
}
|
|
853678
853462
|
async function readLedger() {
|
|
853679
853463
|
try {
|
|
853680
|
-
const text2 = await
|
|
853464
|
+
const text2 = await readFile82(pluginLedgerPath(), "utf-8");
|
|
853681
853465
|
const parsed = JSON.parse(text2);
|
|
853682
853466
|
return { plugins: parsed.plugins ?? {} };
|
|
853683
853467
|
} catch {
|
|
@@ -853688,9 +853472,9 @@ async function writeLedger(ledger) {
|
|
|
853688
853472
|
const target = pluginLedgerPath();
|
|
853689
853473
|
await mkdir70(path56.dirname(target), { recursive: true });
|
|
853690
853474
|
const tmp = `${target}.${process.pid}.tmp`;
|
|
853691
|
-
await
|
|
853475
|
+
await writeFile74(tmp, JSON.stringify(ledger, null, 2) + `
|
|
853692
853476
|
`);
|
|
853693
|
-
await
|
|
853477
|
+
await rename17(tmp, target);
|
|
853694
853478
|
}
|
|
853695
853479
|
function now2() {
|
|
853696
853480
|
return new Date().toISOString();
|
|
@@ -855217,8 +855001,8 @@ var init_DevBar = __esm(() => {
|
|
|
855217
855001
|
});
|
|
855218
855002
|
|
|
855219
855003
|
// src/components/ultraplan/UltraplanChoiceDialog.tsx
|
|
855220
|
-
import { join as
|
|
855221
|
-
import { stat as stat54, writeFile as
|
|
855004
|
+
import { join as join219 } from "path";
|
|
855005
|
+
import { stat as stat54, writeFile as writeFile75 } from "fs/promises";
|
|
855222
855006
|
function getDateStamp() {
|
|
855223
855007
|
return new Date().toISOString().split("T")[0];
|
|
855224
855008
|
}
|
|
@@ -855304,8 +855088,8 @@ Implement this plan.`,
|
|
|
855304
855088
|
});
|
|
855305
855089
|
break;
|
|
855306
855090
|
case "cancel": {
|
|
855307
|
-
const savePath =
|
|
855308
|
-
await
|
|
855091
|
+
const savePath = join219(getCwd(), `${getDateStamp()}-ultraplan.md`);
|
|
855092
|
+
await writeFile75(savePath, plan2, { encoding: "utf-8" });
|
|
855309
855093
|
setMessages((prev) => [
|
|
855310
855094
|
...prev,
|
|
855311
855095
|
createSystemMessage(`Ultraplan rejected \xB7 Plan saved to ${toRelativePath(savePath)}`, "suggestion")
|
|
@@ -856631,15 +856415,15 @@ var init_cronJitterConfig = __esm(() => {
|
|
|
856631
856415
|
});
|
|
856632
856416
|
|
|
856633
856417
|
// src/utils/cronTasksLock.ts
|
|
856634
|
-
import { mkdir as mkdir71, readFile as
|
|
856635
|
-
import { dirname as dirname87, join as
|
|
856418
|
+
import { mkdir as mkdir71, readFile as readFile83, unlink as unlink33, writeFile as writeFile76 } from "fs/promises";
|
|
856419
|
+
import { dirname as dirname87, join as join220 } from "path";
|
|
856636
856420
|
function getLockPath2(dir) {
|
|
856637
|
-
return
|
|
856421
|
+
return join220(dir ?? getProjectRoot(), LOCK_FILE_REL);
|
|
856638
856422
|
}
|
|
856639
856423
|
async function readLock2(dir) {
|
|
856640
856424
|
let raw;
|
|
856641
856425
|
try {
|
|
856642
|
-
raw = await
|
|
856426
|
+
raw = await readFile83(getLockPath2(dir), "utf8");
|
|
856643
856427
|
} catch {
|
|
856644
856428
|
return;
|
|
856645
856429
|
}
|
|
@@ -856650,7 +856434,7 @@ async function tryCreateExclusive2(lock2, dir) {
|
|
|
856650
856434
|
const path57 = getLockPath2(dir);
|
|
856651
856435
|
const body = jsonStringify(lock2);
|
|
856652
856436
|
try {
|
|
856653
|
-
await
|
|
856437
|
+
await writeFile76(path57, body, { flag: "wx" });
|
|
856654
856438
|
return true;
|
|
856655
856439
|
} catch (e7) {
|
|
856656
856440
|
const code = getErrnoCode(e7);
|
|
@@ -856659,7 +856443,7 @@ async function tryCreateExclusive2(lock2, dir) {
|
|
|
856659
856443
|
if (code === "ENOENT") {
|
|
856660
856444
|
await mkdir71(dirname87(path57), { recursive: true });
|
|
856661
856445
|
try {
|
|
856662
|
-
await
|
|
856446
|
+
await writeFile76(path57, body, { flag: "wx" });
|
|
856663
856447
|
return true;
|
|
856664
856448
|
} catch (retryErr) {
|
|
856665
856449
|
if (getErrnoCode(retryErr) === "EEXIST")
|
|
@@ -856693,7 +856477,7 @@ async function tryAcquireSchedulerLock(opts) {
|
|
|
856693
856477
|
const existing = await readLock2(dir);
|
|
856694
856478
|
if (existing?.sessionId === sessionId2) {
|
|
856695
856479
|
if (existing.pid !== process.pid) {
|
|
856696
|
-
await
|
|
856480
|
+
await writeFile76(getLockPath2(dir), jsonStringify(lock2));
|
|
856697
856481
|
registerLockCleanup2(opts);
|
|
856698
856482
|
}
|
|
856699
856483
|
return true;
|
|
@@ -856708,7 +856492,7 @@ async function tryAcquireSchedulerLock(opts) {
|
|
|
856708
856492
|
if (existing) {
|
|
856709
856493
|
logForDebugging(`[ScheduledTasks] recovering stale scheduler lock from PID ${existing.pid}`);
|
|
856710
856494
|
}
|
|
856711
|
-
await
|
|
856495
|
+
await unlink33(getLockPath2(dir)).catch(() => {});
|
|
856712
856496
|
if (await tryCreateExclusive2(lock2, dir)) {
|
|
856713
856497
|
lastBlockedBy = undefined;
|
|
856714
856498
|
registerLockCleanup2(opts);
|
|
@@ -856726,7 +856510,7 @@ async function releaseSchedulerLock(opts) {
|
|
|
856726
856510
|
if (!existing || existing.sessionId !== sessionId2)
|
|
856727
856511
|
return;
|
|
856728
856512
|
try {
|
|
856729
|
-
await
|
|
856513
|
+
await unlink33(getLockPath2(dir));
|
|
856730
856514
|
logForDebugging("[ScheduledTasks] released scheduler lock");
|
|
856731
856515
|
} catch {}
|
|
856732
856516
|
}
|
|
@@ -856740,7 +856524,7 @@ var init_cronTasksLock = __esm(() => {
|
|
|
856740
856524
|
init_genericProcessUtils();
|
|
856741
856525
|
init_json();
|
|
856742
856526
|
init_slowOperations();
|
|
856743
|
-
LOCK_FILE_REL =
|
|
856527
|
+
LOCK_FILE_REL = join220(".claude", "scheduled_tasks.lock");
|
|
856744
856528
|
schedulerLockSchema = lazySchema(() => exports_external.object({
|
|
856745
856529
|
sessionId: exports_external.string(),
|
|
856746
856530
|
pid: exports_external.number(),
|
|
@@ -857204,9 +856988,9 @@ __export(exports_REPL, {
|
|
|
857204
856988
|
REPL: () => REPL
|
|
857205
856989
|
});
|
|
857206
856990
|
import { spawnSync as spawnSync10 } from "child_process";
|
|
857207
|
-
import { dirname as dirname88, join as
|
|
856991
|
+
import { dirname as dirname88, join as join221 } from "path";
|
|
857208
856992
|
import { tmpdir as tmpdir21 } from "os";
|
|
857209
|
-
import { writeFile as
|
|
856993
|
+
import { writeFile as writeFile77 } from "fs/promises";
|
|
857210
856994
|
import { randomUUID as randomUUID75 } from "crypto";
|
|
857211
856995
|
function median(values5) {
|
|
857212
856996
|
const sorted = [...values5].sort((a8, b9) => a8 - b9);
|
|
@@ -859980,8 +859764,8 @@ ${t("repl.suspended")}
|
|
|
859980
859764
|
const w2 = Math.max(80, (process.stdout.columns ?? 80) - 6);
|
|
859981
859765
|
const raw = await renderMessagesToPlainText(deferredMessages, tools, w2);
|
|
859982
859766
|
const text2 = raw.replace(/[ \t]+$/gmu, "");
|
|
859983
|
-
const path57 =
|
|
859984
|
-
await
|
|
859767
|
+
const path57 = join221(tmpdir21(), `cc-transcript-${Date.now()}.txt`);
|
|
859768
|
+
await writeFile77(path57, text2);
|
|
859985
859769
|
const opened = openFileInExternalEditor(path57);
|
|
859986
859770
|
setStatus(opened ? t("repl.openingTranscript", { path: path57 }) : t("repl.wroteTranscript", { path: path57 }));
|
|
859987
859771
|
} catch (e7) {
|
|
@@ -861194,8 +860978,8 @@ function cliOk(msg) {
|
|
|
861194
860978
|
}
|
|
861195
860979
|
|
|
861196
860980
|
// src/cli/handlers/skill.ts
|
|
861197
|
-
import { access as access6, mkdir as mkdir72, writeFile as
|
|
861198
|
-
import { join as
|
|
860981
|
+
import { access as access6, mkdir as mkdir72, writeFile as writeFile78 } from "fs/promises";
|
|
860982
|
+
import { join as join222, resolve as resolve59 } from "path";
|
|
861199
860983
|
function isUuid(value) {
|
|
861200
860984
|
return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu.test(value);
|
|
861201
860985
|
}
|
|
@@ -861228,7 +861012,7 @@ function createDefaultSkillInstallDeps() {
|
|
|
861228
861012
|
cwd: process.cwd(),
|
|
861229
861013
|
fs: {
|
|
861230
861014
|
mkdir: (path57, options) => mkdir72(path57, options),
|
|
861231
|
-
writeFile: (path57, data, encoding) =>
|
|
861015
|
+
writeFile: (path57, data, encoding) => writeFile78(path57, data, encoding),
|
|
861232
861016
|
access: (path57) => access6(path57)
|
|
861233
861017
|
},
|
|
861234
861018
|
clearCommandsCache,
|
|
@@ -861331,8 +861115,8 @@ async function installSkillFromCloud(spec, options, deps) {
|
|
|
861331
861115
|
const remoteSkill = await resolveRemoteSkill(spec, deps);
|
|
861332
861116
|
const targetName = sanitizeSkillInstallName(options.name ?? remoteSkill.slug);
|
|
861333
861117
|
const { root: root9, scope } = resolveInstallRoot(options, deps.cwd, deps.configHome);
|
|
861334
|
-
const skillDir =
|
|
861335
|
-
const skillPath =
|
|
861118
|
+
const skillDir = join222(root9, targetName);
|
|
861119
|
+
const skillPath = join222(skillDir, "SKILL.md");
|
|
861336
861120
|
await assertCanWriteSkill(skillPath, options.force, deps);
|
|
861337
861121
|
try {
|
|
861338
861122
|
await deps.fs.mkdir(skillDir, { recursive: true });
|
|
@@ -861927,7 +861711,7 @@ function WelcomeV2() {
|
|
|
861927
861711
|
dimColor: true,
|
|
861928
861712
|
children: [
|
|
861929
861713
|
"v",
|
|
861930
|
-
"4.2.
|
|
861714
|
+
"4.2.16",
|
|
861931
861715
|
" "
|
|
861932
861716
|
]
|
|
861933
861717
|
})
|
|
@@ -861993,7 +861777,7 @@ function WelcomeV2() {
|
|
|
861993
861777
|
dimColor: true,
|
|
861994
861778
|
children: [
|
|
861995
861779
|
"v",
|
|
861996
|
-
"4.2.
|
|
861780
|
+
"4.2.16",
|
|
861997
861781
|
" "
|
|
861998
861782
|
]
|
|
861999
861783
|
})
|
|
@@ -862095,7 +861879,7 @@ function AppleTerminalWelcomeV2({ theme: theme2, welcomeMessage }) {
|
|
|
862095
861879
|
dimColor: true,
|
|
862096
861880
|
children: [
|
|
862097
861881
|
"v",
|
|
862098
|
-
"4.2.
|
|
861882
|
+
"4.2.16",
|
|
862099
861883
|
" "
|
|
862100
861884
|
]
|
|
862101
861885
|
})
|
|
@@ -862161,7 +861945,7 @@ function AppleTerminalWelcomeV2({ theme: theme2, welcomeMessage }) {
|
|
|
862161
861945
|
dimColor: true,
|
|
862162
861946
|
children: [
|
|
862163
861947
|
"v",
|
|
862164
|
-
"4.2.
|
|
861948
|
+
"4.2.16",
|
|
862165
861949
|
" "
|
|
862166
861950
|
]
|
|
862167
861951
|
})
|
|
@@ -863101,7 +862885,7 @@ function completeOnboarding() {
|
|
|
863101
862885
|
saveGlobalConfig((current2) => ({
|
|
863102
862886
|
...current2,
|
|
863103
862887
|
hasCompletedOnboarding: true,
|
|
863104
|
-
lastOnboardingVersion: "4.2.
|
|
862888
|
+
lastOnboardingVersion: "4.2.16"
|
|
863105
862889
|
}));
|
|
863106
862890
|
}
|
|
863107
862891
|
function showDialog(root9, renderer) {
|
|
@@ -868476,7 +868260,7 @@ var init_bundled2 = __esm(() => {
|
|
|
868476
868260
|
// src/utils/deepLink/banner.ts
|
|
868477
868261
|
import { stat as stat56 } from "fs/promises";
|
|
868478
868262
|
import { homedir as homedir55 } from "os";
|
|
868479
|
-
import { join as
|
|
868263
|
+
import { join as join223, sep as sep43 } from "path";
|
|
868480
868264
|
function buildDeepLinkBanner(info2) {
|
|
868481
868265
|
const lines2 = [
|
|
868482
868266
|
`This session was opened by an external deep link in ${tildify(info2.cwd)}`
|
|
@@ -868498,8 +868282,8 @@ async function readLastFetchTime(cwd2) {
|
|
|
868498
868282
|
return;
|
|
868499
868283
|
const commonDir = await getCommonDir(gitDir);
|
|
868500
868284
|
const [local, common4] = await Promise.all([
|
|
868501
|
-
mtimeOrUndefined(
|
|
868502
|
-
commonDir ? mtimeOrUndefined(
|
|
868285
|
+
mtimeOrUndefined(join223(gitDir, "FETCH_HEAD")),
|
|
868286
|
+
commonDir ? mtimeOrUndefined(join223(commonDir, "FETCH_HEAD")) : Promise.resolve(undefined)
|
|
868503
868287
|
]);
|
|
868504
868288
|
if (local && common4)
|
|
868505
868289
|
return local > common4 ? local : common4;
|
|
@@ -869670,7 +869454,7 @@ __export(exports_assistant3, {
|
|
|
869670
869454
|
getAssistantActivationPath: () => getAssistantActivationPath
|
|
869671
869455
|
});
|
|
869672
869456
|
import { readFileSync as readFileSync43 } from "fs";
|
|
869673
|
-
import { join as
|
|
869457
|
+
import { join as join224 } from "path";
|
|
869674
869458
|
function isAssistantMode() {
|
|
869675
869459
|
return getKairosActive();
|
|
869676
869460
|
}
|
|
@@ -869736,13 +869520,13 @@ async function initializeAssistantTeam() {
|
|
|
869736
869520
|
}
|
|
869737
869521
|
function getAssistantSystemPromptAddendum() {
|
|
869738
869522
|
try {
|
|
869739
|
-
return readFileSync43(
|
|
869523
|
+
return readFileSync43(join224(getClaudeConfigHomeDir(), "agents", "assistant.md"), "utf-8");
|
|
869740
869524
|
} catch {
|
|
869741
869525
|
const legacyDir = getLegacyConfigHomeDir();
|
|
869742
869526
|
if (!legacyDir)
|
|
869743
869527
|
return "";
|
|
869744
869528
|
try {
|
|
869745
|
-
return readFileSync43(
|
|
869529
|
+
return readFileSync43(join224(legacyDir, "agents", "assistant.md"), "utf-8");
|
|
869746
869530
|
} catch {
|
|
869747
869531
|
return "";
|
|
869748
869532
|
}
|
|
@@ -870225,12 +870009,12 @@ var exports_setup = {};
|
|
|
870225
870009
|
__export(exports_setup, {
|
|
870226
870010
|
setupComputerUseMCP: () => setupComputerUseMCP
|
|
870227
870011
|
});
|
|
870228
|
-
import { join as
|
|
870012
|
+
import { join as join225 } from "path";
|
|
870229
870013
|
import { fileURLToPath as fileURLToPath13 } from "url";
|
|
870230
870014
|
function setupComputerUseMCP() {
|
|
870231
870015
|
const allowedTools = buildComputerUseTools(CLI_CU_CAPABILITIES, getChicagoCoordinateMode()).map((t2) => buildMcpToolName(COMPUTER_USE_MCP_SERVER_NAME, t2.name));
|
|
870232
870016
|
const args = isInBundledMode() ? ["--computer-use-mcp"] : [
|
|
870233
|
-
|
|
870017
|
+
join225(fileURLToPath13(import.meta.url), "..", "cli.js"),
|
|
870234
870018
|
"--computer-use-mcp"
|
|
870235
870019
|
];
|
|
870236
870020
|
return {
|
|
@@ -870367,7 +870151,7 @@ var init_sync = __esm(() => {
|
|
|
870367
870151
|
// src/utils/iTermBackup.ts
|
|
870368
870152
|
import { copyFile as copyFile13, stat as stat57 } from "fs/promises";
|
|
870369
870153
|
import { homedir as homedir57 } from "os";
|
|
870370
|
-
import { join as
|
|
870154
|
+
import { join as join226 } from "path";
|
|
870371
870155
|
function markITerm2SetupComplete() {
|
|
870372
870156
|
saveGlobalConfig((current2) => ({
|
|
870373
870157
|
...current2,
|
|
@@ -870382,7 +870166,7 @@ function getIterm2RecoveryInfo() {
|
|
|
870382
870166
|
};
|
|
870383
870167
|
}
|
|
870384
870168
|
function getITerm2PlistPath() {
|
|
870385
|
-
return
|
|
870169
|
+
return join226(homedir57(), "Library", "Preferences", "com.googlecode.iterm2.plist");
|
|
870386
870170
|
}
|
|
870387
870171
|
async function checkAndRestoreITerm2Backup() {
|
|
870388
870172
|
const { inProgress, backupPath } = getIterm2RecoveryInfo();
|
|
@@ -870416,8 +870200,8 @@ var init_iTermBackup = __esm(() => {
|
|
|
870416
870200
|
|
|
870417
870201
|
// src/costrict/services/memoryCloudSync/index.ts
|
|
870418
870202
|
import { createHash as createHash37 } from "crypto";
|
|
870419
|
-
import { readdir as readdir45, readFile as
|
|
870420
|
-
import { basename as basename68, join as
|
|
870203
|
+
import { readdir as readdir45, readFile as readFile84, writeFile as writeFile79 } from "fs/promises";
|
|
870204
|
+
import { basename as basename68, join as join227 } from "path";
|
|
870421
870205
|
function getMemoryAPIEndpoint(path57) {
|
|
870422
870206
|
const baseUrl = getCoStrictBaseURL();
|
|
870423
870207
|
return `${baseUrl}/cloud-api/api/memories${path57}`;
|
|
@@ -870440,11 +870224,11 @@ async function getAuthHeaders4() {
|
|
|
870440
870224
|
return { error: "No CoStrict credentials available" };
|
|
870441
870225
|
}
|
|
870442
870226
|
function getStateFilePath2() {
|
|
870443
|
-
return
|
|
870227
|
+
return join227(getAutoMemPath(), STATE_FILENAME);
|
|
870444
870228
|
}
|
|
870445
870229
|
async function loadSyncState() {
|
|
870446
870230
|
try {
|
|
870447
|
-
const raw = await
|
|
870231
|
+
const raw = await readFile84(getStateFilePath2(), "utf-8");
|
|
870448
870232
|
const parsed = JSON.parse(raw);
|
|
870449
870233
|
return { items: parsed.items ?? {} };
|
|
870450
870234
|
} catch {
|
|
@@ -870452,7 +870236,7 @@ async function loadSyncState() {
|
|
|
870452
870236
|
}
|
|
870453
870237
|
}
|
|
870454
870238
|
async function saveSyncState(state4) {
|
|
870455
|
-
await
|
|
870239
|
+
await writeFile79(getStateFilePath2(), JSON.stringify(state4, null, 2) + `
|
|
870456
870240
|
`, "utf-8");
|
|
870457
870241
|
}
|
|
870458
870242
|
function computeMD5(content) {
|
|
@@ -870562,9 +870346,9 @@ async function scanAndSync(existingState) {
|
|
|
870562
870346
|
const mdFiles = entries.filter((f7) => f7.endsWith(".md") && basename68(f7) !== "MEMORY.md" && !f7.startsWith("logs/") && !f7.startsWith("logs\\"));
|
|
870563
870347
|
for (const relativePath2 of mdFiles) {
|
|
870564
870348
|
const slug = basename68(relativePath2, ".md");
|
|
870565
|
-
const filePath =
|
|
870349
|
+
const filePath = join227(memoryDir, relativePath2);
|
|
870566
870350
|
try {
|
|
870567
|
-
const raw = await
|
|
870351
|
+
const raw = await readFile84(filePath, "utf-8");
|
|
870568
870352
|
const md5 = computeMD5(raw);
|
|
870569
870353
|
const existing = newState.items[slug];
|
|
870570
870354
|
if (existing && existing.contentMD5 === md5) {
|
|
@@ -870607,15 +870391,15 @@ __export(exports_watcher, {
|
|
|
870607
870391
|
_resetWatcherStateForTesting: () => _resetWatcherStateForTesting
|
|
870608
870392
|
});
|
|
870609
870393
|
import { watch as watch4 } from "fs";
|
|
870610
|
-
import { mkdir as mkdir73, readFile as
|
|
870611
|
-
import { join as
|
|
870394
|
+
import { mkdir as mkdir73, readFile as readFile85, unlink as unlink34, writeFile as writeFile80 } from "fs/promises";
|
|
870395
|
+
import { join as join228 } from "path";
|
|
870612
870396
|
function lockPath2() {
|
|
870613
|
-
return
|
|
870397
|
+
return join228(getAutoMemPath(), LOCK_FILE2);
|
|
870614
870398
|
}
|
|
870615
870399
|
async function tryAcquireLock2() {
|
|
870616
870400
|
const path57 = lockPath2();
|
|
870617
870401
|
try {
|
|
870618
|
-
const raw = await
|
|
870402
|
+
const raw = await readFile85(path57, "utf8");
|
|
870619
870403
|
const holderPid = parseInt(raw.trim(), 10);
|
|
870620
870404
|
if (Number.isFinite(holderPid) && isProcessRunning(holderPid)) {
|
|
870621
870405
|
const stat58 = await import("fs/promises").then((m4) => m4.stat(path57));
|
|
@@ -870627,8 +870411,8 @@ async function tryAcquireLock2() {
|
|
|
870627
870411
|
}
|
|
870628
870412
|
} catch {}
|
|
870629
870413
|
await mkdir73(getAutoMemPath(), { recursive: true });
|
|
870630
|
-
await
|
|
870631
|
-
const verify = await
|
|
870414
|
+
await writeFile80(path57, String(process.pid));
|
|
870415
|
+
const verify = await readFile85(path57, "utf8");
|
|
870632
870416
|
if (parseInt(verify.trim(), 10) !== process.pid) {
|
|
870633
870417
|
logForDebugging("memory-cloud-sync: lost lock race, skipping", {
|
|
870634
870418
|
level: "debug"
|
|
@@ -870642,9 +870426,9 @@ async function releaseLock3() {
|
|
|
870642
870426
|
return;
|
|
870643
870427
|
try {
|
|
870644
870428
|
const path57 = lockPath2();
|
|
870645
|
-
const raw = await
|
|
870429
|
+
const raw = await readFile85(path57, "utf8");
|
|
870646
870430
|
if (parseInt(raw.trim(), 10) === process.pid) {
|
|
870647
|
-
await
|
|
870431
|
+
await unlink34(path57);
|
|
870648
870432
|
}
|
|
870649
870433
|
} catch {}
|
|
870650
870434
|
lockAcquired = false;
|
|
@@ -873727,11 +873511,11 @@ var init_sessionUrl = __esm(() => {
|
|
|
873727
873511
|
});
|
|
873728
873512
|
|
|
873729
873513
|
// src/utils/plugins/zipCacheAdapters.ts
|
|
873730
|
-
import { readFile as
|
|
873731
|
-
import { join as
|
|
873514
|
+
import { readFile as readFile86 } from "fs/promises";
|
|
873515
|
+
import { join as join229 } from "path";
|
|
873732
873516
|
async function readZipCacheKnownMarketplaces() {
|
|
873733
873517
|
try {
|
|
873734
|
-
const content = await
|
|
873518
|
+
const content = await readFile86(getZipCacheKnownMarketplacesPath(), "utf-8");
|
|
873735
873519
|
const parsed = KnownMarketplacesFileSchema().safeParse(jsonParse(content));
|
|
873736
873520
|
if (!parsed.success) {
|
|
873737
873521
|
logForDebugging(`Invalid known_marketplaces.json in zip cache: ${parsed.error.message}`, { level: "error" });
|
|
@@ -873753,18 +873537,18 @@ async function saveMarketplaceJsonToZipCache(marketplaceName, installLocation) {
|
|
|
873753
873537
|
const content = await readMarketplaceJsonContent(installLocation);
|
|
873754
873538
|
if (content !== null) {
|
|
873755
873539
|
const relPath = getMarketplaceJsonRelativePath(marketplaceName);
|
|
873756
|
-
await atomicWriteToZipCache(
|
|
873540
|
+
await atomicWriteToZipCache(join229(zipCachePath, relPath), content);
|
|
873757
873541
|
}
|
|
873758
873542
|
}
|
|
873759
873543
|
async function readMarketplaceJsonContent(dir) {
|
|
873760
873544
|
const candidates = [
|
|
873761
|
-
|
|
873762
|
-
|
|
873545
|
+
join229(dir, ".claude-plugin", "marketplace.json"),
|
|
873546
|
+
join229(dir, "marketplace.json"),
|
|
873763
873547
|
dir
|
|
873764
873548
|
];
|
|
873765
873549
|
for (const candidate of candidates) {
|
|
873766
873550
|
try {
|
|
873767
|
-
return await
|
|
873551
|
+
return await readFile86(candidate, "utf-8");
|
|
873768
873552
|
} catch {}
|
|
873769
873553
|
}
|
|
873770
873554
|
return null;
|
|
@@ -873894,7 +873678,7 @@ __export(exports_print, {
|
|
|
873894
873678
|
createCanUseToolWithPermissionPrompt: () => createCanUseToolWithPermissionPrompt,
|
|
873895
873679
|
canBatchWith: () => canBatchWith
|
|
873896
873680
|
});
|
|
873897
|
-
import { readFile as
|
|
873681
|
+
import { readFile as readFile87, stat as stat58 } from "fs/promises";
|
|
873898
873682
|
import { dirname as dirname90 } from "path";
|
|
873899
873683
|
import { cwd as cwd2 } from "process";
|
|
873900
873684
|
import { randomUUID as randomUUID80 } from "crypto";
|
|
@@ -875456,7 +875240,7 @@ ${m4.text}
|
|
|
875456
875240
|
const normalizedPath = expandPath(msg.request.path);
|
|
875457
875241
|
const diskMtime = Math.floor((await stat58(normalizedPath)).mtimeMs);
|
|
875458
875242
|
if (diskMtime <= msg.request.mtime) {
|
|
875459
|
-
const raw = await
|
|
875243
|
+
const raw = await readFile87(normalizedPath, "utf-8");
|
|
875460
875244
|
const content = (raw.charCodeAt(0) === 65279 ? raw.slice(1) : raw).replaceAll(`\r
|
|
875461
875245
|
`, `
|
|
875462
875246
|
`);
|
|
@@ -878085,7 +877869,7 @@ async function startMCPServer(cwd3, debug5, verbose) {
|
|
|
878085
877869
|
setCwd(cwd3);
|
|
878086
877870
|
const server2 = new Server({
|
|
878087
877871
|
name: "claude/tengu",
|
|
878088
|
-
version: "4.2.
|
|
877872
|
+
version: "4.2.16"
|
|
878089
877873
|
}, {
|
|
878090
877874
|
capabilities: {
|
|
878091
877875
|
tools: {}
|
|
@@ -878215,16 +877999,16 @@ __export(exports_claudeDesktop, {
|
|
|
878215
877999
|
readClaudeDesktopMcpServers: () => readClaudeDesktopMcpServers,
|
|
878216
878000
|
getClaudeDesktopConfigPath: () => getClaudeDesktopConfigPath
|
|
878217
878001
|
});
|
|
878218
|
-
import { readdir as readdir46, readFile as
|
|
878002
|
+
import { readdir as readdir46, readFile as readFile88, stat as stat59 } from "fs/promises";
|
|
878219
878003
|
import { homedir as homedir58 } from "os";
|
|
878220
|
-
import { join as
|
|
878004
|
+
import { join as join230 } from "path";
|
|
878221
878005
|
async function getClaudeDesktopConfigPath() {
|
|
878222
878006
|
const platform13 = getPlatform();
|
|
878223
878007
|
if (!SUPPORTED_PLATFORMS.includes(platform13)) {
|
|
878224
878008
|
throw new Error(`Unsupported platform: ${platform13} - Claude Desktop integration only works on macOS and WSL.`);
|
|
878225
878009
|
}
|
|
878226
878010
|
if (platform13 === "macos") {
|
|
878227
|
-
return
|
|
878011
|
+
return join230(homedir58(), "Library", "Application Support", "Claude", "claude_desktop_config.json");
|
|
878228
878012
|
}
|
|
878229
878013
|
const windowsHome = process.env.USERPROFILE ? process.env.USERPROFILE.replace(/\\/g, "/") : null;
|
|
878230
878014
|
if (windowsHome) {
|
|
@@ -878243,7 +878027,7 @@ async function getClaudeDesktopConfigPath() {
|
|
|
878243
878027
|
if (user.name === "Public" || user.name === "Default" || user.name === "Default User" || user.name === "All Users") {
|
|
878244
878028
|
continue;
|
|
878245
878029
|
}
|
|
878246
|
-
const potentialConfigPath =
|
|
878030
|
+
const potentialConfigPath = join230(usersDir, user.name, "AppData", "Roaming", "Claude", "claude_desktop_config.json");
|
|
878247
878031
|
try {
|
|
878248
878032
|
await stat59(potentialConfigPath);
|
|
878249
878033
|
return potentialConfigPath;
|
|
@@ -878263,7 +878047,7 @@ async function readClaudeDesktopMcpServers() {
|
|
|
878263
878047
|
const configPath = await getClaudeDesktopConfigPath();
|
|
878264
878048
|
let configContent;
|
|
878265
878049
|
try {
|
|
878266
|
-
configContent = await
|
|
878050
|
+
configContent = await readFile88(configPath, { encoding: "utf8" });
|
|
878267
878051
|
} catch (e7) {
|
|
878268
878052
|
const code = getErrnoCode(e7);
|
|
878269
878053
|
if (code === "ENOENT") {
|
|
@@ -880370,7 +880154,7 @@ function createHealthRoutes(sessionManager) {
|
|
|
880370
880154
|
const uptime2 = process.uptime() * 1000;
|
|
880371
880155
|
return c10.json({
|
|
880372
880156
|
status: "ok",
|
|
880373
|
-
version: "4.2.
|
|
880157
|
+
version: "4.2.16",
|
|
880374
880158
|
uptime_ms: Math.round(uptime2),
|
|
880375
880159
|
active_sessions: sessionManager.getActiveCount()
|
|
880376
880160
|
});
|
|
@@ -880642,7 +880426,7 @@ function getMacroDefines() {
|
|
|
880642
880426
|
commit = execSync3("git rev-parse --short HEAD", { encoding: "utf-8", cwd: __dirname }).trim();
|
|
880643
880427
|
} catch {}
|
|
880644
880428
|
return {
|
|
880645
|
-
"MACRO.VERSION": JSON.stringify("4.2.
|
|
880429
|
+
"MACRO.VERSION": JSON.stringify("4.2.16"),
|
|
880646
880430
|
"MACRO.BUILD_TIME": JSON.stringify(new Date().toISOString()),
|
|
880647
880431
|
"MACRO.COMMIT": JSON.stringify(commit),
|
|
880648
880432
|
"MACRO.FEEDBACK_CHANNEL": JSON.stringify(""),
|
|
@@ -881669,9 +881453,9 @@ var init_question = __esm(() => {
|
|
|
881669
881453
|
});
|
|
881670
881454
|
|
|
881671
881455
|
// src/server/transcriptReader.ts
|
|
881672
|
-
import { readFile as
|
|
881456
|
+
import { readFile as readFile89, readdir as readdir47, stat as stat61 } from "fs/promises";
|
|
881673
881457
|
import { existsSync as existsSync36 } from "fs";
|
|
881674
|
-
import { join as
|
|
881458
|
+
import { join as join231 } from "path";
|
|
881675
881459
|
function normalizeToolName(name3) {
|
|
881676
881460
|
return TOOL_NAME_MAP[name3] ?? name3.toLowerCase();
|
|
881677
881461
|
}
|
|
@@ -881782,7 +881566,7 @@ function mergeToolResults(messages) {
|
|
|
881782
881566
|
}
|
|
881783
881567
|
async function readAgentMeta(metaPath) {
|
|
881784
881568
|
try {
|
|
881785
|
-
const raw2 = await
|
|
881569
|
+
const raw2 = await readFile89(metaPath, "utf-8");
|
|
881786
881570
|
return JSON.parse(raw2);
|
|
881787
881571
|
} catch {
|
|
881788
881572
|
return null;
|
|
@@ -881802,13 +881586,13 @@ async function resolveTranscriptPath2(sessionId2, cwd4) {
|
|
|
881802
881586
|
async function resolveTranscriptPathUncached(sessionId2, cwd4) {
|
|
881803
881587
|
if (cwd4) {
|
|
881804
881588
|
const projectDir = getProjectDir(cwd4);
|
|
881805
|
-
const direct =
|
|
881589
|
+
const direct = join231(projectDir, `${sessionId2}.jsonl`);
|
|
881806
881590
|
if (existsSync36(direct))
|
|
881807
881591
|
return direct;
|
|
881808
881592
|
}
|
|
881809
881593
|
const found = await findProjectDir(cwd4 ?? process.cwd());
|
|
881810
881594
|
if (found) {
|
|
881811
|
-
const direct =
|
|
881595
|
+
const direct = join231(found, `${sessionId2}.jsonl`);
|
|
881812
881596
|
if (existsSync36(direct))
|
|
881813
881597
|
return direct;
|
|
881814
881598
|
}
|
|
@@ -881818,7 +881602,7 @@ async function resolveTranscriptPathUncached(sessionId2, cwd4) {
|
|
|
881818
881602
|
try {
|
|
881819
881603
|
const dirs = await readdir47(projectsDir);
|
|
881820
881604
|
for (const dir of dirs) {
|
|
881821
|
-
const candidate =
|
|
881605
|
+
const candidate = join231(projectsDir, dir, target);
|
|
881822
881606
|
if (existsSync36(candidate))
|
|
881823
881607
|
return candidate;
|
|
881824
881608
|
}
|
|
@@ -881906,10 +881690,10 @@ async function findSubagentTranscriptPathUncached(agentId, cwd4) {
|
|
|
881906
881690
|
const fileName = `agent-${agentId}.jsonl`;
|
|
881907
881691
|
const metaFileName = `agent-${agentId}.meta.json`;
|
|
881908
881692
|
const tryDirect = async (projectDir) => {
|
|
881909
|
-
const metaPath =
|
|
881693
|
+
const metaPath = join231(projectDir, metaFileName);
|
|
881910
881694
|
const meta6 = await readAgentMeta(metaPath);
|
|
881911
881695
|
if (meta6?.parent_session_id) {
|
|
881912
|
-
const direct =
|
|
881696
|
+
const direct = join231(projectDir, meta6.parent_session_id, "subagents", fileName);
|
|
881913
881697
|
if (existsSync36(direct)) {
|
|
881914
881698
|
const s = await stat61(direct);
|
|
881915
881699
|
if (s.isFile() && s.size > 0)
|
|
@@ -881929,13 +881713,13 @@ async function findSubagentTranscriptPathUncached(agentId, cwd4) {
|
|
|
881929
881713
|
return null;
|
|
881930
881714
|
}
|
|
881931
881715
|
for (const sessionDir of sessionDirs) {
|
|
881932
|
-
const direct =
|
|
881716
|
+
const direct = join231(projectDir, sessionDir, "subagents", fileName);
|
|
881933
881717
|
try {
|
|
881934
881718
|
const s = await stat61(direct);
|
|
881935
881719
|
if (s.isFile() && s.size > 0)
|
|
881936
881720
|
return direct;
|
|
881937
881721
|
} catch {}
|
|
881938
|
-
const nestedSubagentsDir =
|
|
881722
|
+
const nestedSubagentsDir = join231(projectDir, sessionDir, "subagents");
|
|
881939
881723
|
let subdirs;
|
|
881940
881724
|
try {
|
|
881941
881725
|
subdirs = await readdir47(nestedSubagentsDir);
|
|
@@ -881943,7 +881727,7 @@ async function findSubagentTranscriptPathUncached(agentId, cwd4) {
|
|
|
881943
881727
|
continue;
|
|
881944
881728
|
}
|
|
881945
881729
|
for (const sub of subdirs) {
|
|
881946
|
-
const candidate =
|
|
881730
|
+
const candidate = join231(nestedSubagentsDir, sub, fileName);
|
|
881947
881731
|
try {
|
|
881948
881732
|
const s = await stat61(candidate);
|
|
881949
881733
|
if (s.isFile() && s.size > 0)
|
|
@@ -881974,7 +881758,7 @@ async function findSubagentTranscriptPathUncached(agentId, cwd4) {
|
|
|
881974
881758
|
continue;
|
|
881975
881759
|
}
|
|
881976
881760
|
for (const dir of dirs) {
|
|
881977
|
-
const hit = await searchProject(
|
|
881761
|
+
const hit = await searchProject(join231(projectsDir, dir));
|
|
881978
881762
|
if (hit)
|
|
881979
881763
|
return hit;
|
|
881980
881764
|
}
|
|
@@ -881986,7 +881770,7 @@ async function readSubagentMessages(agentId, cwd4, includeSystem) {
|
|
|
881986
881770
|
if (!path57)
|
|
881987
881771
|
return [];
|
|
881988
881772
|
try {
|
|
881989
|
-
const raw2 = await
|
|
881773
|
+
const raw2 = await readFile89(path57, "utf-8");
|
|
881990
881774
|
const lines2 = raw2.split(`
|
|
881991
881775
|
`);
|
|
881992
881776
|
return readMessagesFromLines(lines2, includeSystem);
|
|
@@ -881999,7 +881783,7 @@ async function readSessionMessages(opts) {
|
|
|
881999
881783
|
const path57 = await resolveTranscriptPath2(opts.sessionId, opts.cwd);
|
|
882000
881784
|
let mainMessages = [];
|
|
882001
881785
|
if (path57 && existsSync36(path57)) {
|
|
882002
|
-
const raw2 = await
|
|
881786
|
+
const raw2 = await readFile89(path57, "utf-8");
|
|
882003
881787
|
const lines2 = raw2.split(`
|
|
882004
881788
|
`).filter(Boolean);
|
|
882005
881789
|
let lastCompactBoundaryIndex = -1;
|
|
@@ -882112,7 +881896,7 @@ async function readSessionTodos(opts) {
|
|
|
882112
881896
|
const path57 = await resolveTranscriptPath2(opts.sessionId, opts.cwd);
|
|
882113
881897
|
if (!path57 || !existsSync36(path57))
|
|
882114
881898
|
return [];
|
|
882115
|
-
const raw2 = await
|
|
881899
|
+
const raw2 = await readFile89(path57, "utf-8");
|
|
882116
881900
|
const lines2 = raw2.split(`
|
|
882117
881901
|
`).filter(Boolean);
|
|
882118
881902
|
let latestTodos = [];
|
|
@@ -882248,7 +882032,7 @@ async function readSessionTasks(opts) {
|
|
|
882248
882032
|
const path57 = await resolveTranscriptPath2(opts.sessionId, opts.cwd);
|
|
882249
882033
|
if (!path57 || !existsSync36(path57))
|
|
882250
882034
|
return [];
|
|
882251
|
-
const raw2 = await
|
|
882035
|
+
const raw2 = await readFile89(path57, "utf-8");
|
|
882252
882036
|
const lines2 = raw2.split(`
|
|
882253
882037
|
`).filter(Boolean);
|
|
882254
882038
|
const tasks2 = new Map;
|
|
@@ -884586,7 +884370,7 @@ var init_providerConfig2 = __esm(() => {
|
|
|
884586
884370
|
|
|
884587
884371
|
// src/server/routes/find.ts
|
|
884588
884372
|
import { stat as stat62 } from "fs/promises";
|
|
884589
|
-
import { join as
|
|
884373
|
+
import { join as join232 } from "path";
|
|
884590
884374
|
function createFindRoutes() {
|
|
884591
884375
|
return new Hono2().get("/find/file", async (c10) => {
|
|
884592
884376
|
const query5 = c10.req.query("query");
|
|
@@ -884601,7 +884385,7 @@ function createFindRoutes() {
|
|
|
884601
884385
|
for await (const path57 of glob2.scan({ cwd: cwd4, dot: false, absolute: false })) {
|
|
884602
884386
|
if (dirs) {
|
|
884603
884387
|
try {
|
|
884604
|
-
const s = await stat62(
|
|
884388
|
+
const s = await stat62(join232(cwd4, path57));
|
|
884605
884389
|
if (!s.isDirectory())
|
|
884606
884390
|
continue;
|
|
884607
884391
|
} catch {
|
|
@@ -885334,9 +885118,9 @@ __export(exports_sessionHandle, {
|
|
|
885334
885118
|
});
|
|
885335
885119
|
import { spawn as spawn17 } from "child_process";
|
|
885336
885120
|
import { createInterface as createInterface4 } from "readline";
|
|
885337
|
-
import { readdir as readdir48, readFile as
|
|
885121
|
+
import { readdir as readdir48, readFile as readFile90 } from "fs/promises";
|
|
885338
885122
|
import { existsSync as existsSync38 } from "fs";
|
|
885339
|
-
import { join as
|
|
885123
|
+
import { join as join233 } from "path";
|
|
885340
885124
|
function extractStdoutError(msg) {
|
|
885341
885125
|
const errors14 = msg.errors;
|
|
885342
885126
|
if (Array.isArray(errors14) && errors14.length > 0) {
|
|
@@ -885551,7 +885335,7 @@ var init_sessionHandle = __esm(() => {
|
|
|
885551
885335
|
}
|
|
885552
885336
|
async buildSubagentIndex() {
|
|
885553
885337
|
const projectDir = getProjectDir(this.cwd);
|
|
885554
|
-
const sessionDir =
|
|
885338
|
+
const sessionDir = join233(projectDir, this.sessionId, "subagents");
|
|
885555
885339
|
if (!existsSync38(sessionDir))
|
|
885556
885340
|
return;
|
|
885557
885341
|
try {
|
|
@@ -885560,11 +885344,11 @@ var init_sessionHandle = __esm(() => {
|
|
|
885560
885344
|
if (!entry.startsWith("agent-") || !entry.endsWith(".jsonl"))
|
|
885561
885345
|
continue;
|
|
885562
885346
|
const agentId = entry.slice("agent-".length, -".jsonl".length);
|
|
885563
|
-
const transcriptPath =
|
|
885347
|
+
const transcriptPath = join233(sessionDir, entry);
|
|
885564
885348
|
const metaPath = transcriptPath.replace(/\.jsonl$/u, ".meta.json");
|
|
885565
885349
|
let meta6 = {};
|
|
885566
885350
|
try {
|
|
885567
|
-
const raw2 = await
|
|
885351
|
+
const raw2 = await readFile90(metaPath, "utf-8");
|
|
885568
885352
|
meta6 = JSON.parse(raw2);
|
|
885569
885353
|
} catch {}
|
|
885570
885354
|
this._subagentIndex.set(agentId, { transcriptPath, meta: meta6 });
|
|
@@ -886136,9 +885920,9 @@ var exports_sessionManager = {};
|
|
|
886136
885920
|
__export(exports_sessionManager, {
|
|
886137
885921
|
SessionManager: () => SessionManager
|
|
886138
885922
|
});
|
|
886139
|
-
import { readFile as
|
|
885923
|
+
import { readFile as readFile91, writeFile as writeFile81, mkdir as mkdir74, rm as rm17 } from "fs/promises";
|
|
886140
885924
|
import { existsSync as existsSync39, statSync as statSync14 } from "fs";
|
|
886141
|
-
import { join as
|
|
885925
|
+
import { join as join234, resolve as resolve61, isAbsolute as isAbsolute32 } from "path";
|
|
886142
885926
|
|
|
886143
885927
|
class SessionManager {
|
|
886144
885928
|
sessions = new Map;
|
|
@@ -886176,14 +885960,14 @@ class SessionManager {
|
|
|
886176
885960
|
this.startIdleCheck();
|
|
886177
885961
|
}
|
|
886178
885962
|
getIndexPath() {
|
|
886179
|
-
return
|
|
885963
|
+
return join234(getClaudeConfigHomeDir(), INDEX_FILE);
|
|
886180
885964
|
}
|
|
886181
885965
|
async loadIndex() {
|
|
886182
885966
|
const path57 = this.getIndexPath();
|
|
886183
885967
|
if (!existsSync39(path57))
|
|
886184
885968
|
return;
|
|
886185
885969
|
try {
|
|
886186
|
-
const raw2 = await
|
|
885970
|
+
const raw2 = await readFile91(path57, "utf-8");
|
|
886187
885971
|
const index2 = JSON.parse(raw2);
|
|
886188
885972
|
for (const [key6, entry] of Object.entries(index2)) {
|
|
886189
885973
|
this.loadedIndex.set(key6, entry);
|
|
@@ -886210,7 +885994,7 @@ class SessionManager {
|
|
|
886210
885994
|
await mkdir74(dir, { recursive: true });
|
|
886211
885995
|
}
|
|
886212
885996
|
try {
|
|
886213
|
-
await
|
|
885997
|
+
await writeFile81(this.getIndexPath(), JSON.stringify(index2, null, 2));
|
|
886214
885998
|
} catch (err3) {
|
|
886215
885999
|
logError3(err3);
|
|
886216
886000
|
}
|
|
@@ -886540,8 +886324,8 @@ class SessionManager {
|
|
|
886540
886324
|
}
|
|
886541
886325
|
async deleteSessionFilesFromDisk(sessionId2, cwd4) {
|
|
886542
886326
|
const projectDir = getProjectDir(cwd4);
|
|
886543
|
-
const jsonlPath =
|
|
886544
|
-
const sessionDir =
|
|
886327
|
+
const jsonlPath = join234(projectDir, sessionId2 + ".jsonl");
|
|
886328
|
+
const sessionDir = join234(projectDir, sessionId2);
|
|
886545
886329
|
try {
|
|
886546
886330
|
if (existsSync39(jsonlPath)) {
|
|
886547
886331
|
await rm17(jsonlPath, { force: true });
|
|
@@ -886806,10 +886590,7 @@ async function pluginListHandler(options) {
|
|
|
886806
886590
|
if (options.available) {
|
|
886807
886591
|
const available = [];
|
|
886808
886592
|
try {
|
|
886809
|
-
const
|
|
886810
|
-
loadKnownMarketplacesConfig(),
|
|
886811
|
-
getInstallCounts()
|
|
886812
|
-
]);
|
|
886593
|
+
const config13 = await loadKnownMarketplacesConfig();
|
|
886813
886594
|
const { marketplaces } = await loadMarketplacesWithGracefulDegradation(config13);
|
|
886814
886595
|
for (const {
|
|
886815
886596
|
name: marketplaceName,
|
|
@@ -886825,8 +886606,7 @@ async function pluginListHandler(options) {
|
|
|
886825
886606
|
description: entry.description,
|
|
886826
886607
|
marketplaceName,
|
|
886827
886608
|
version: entry.version,
|
|
886828
|
-
source: entry.source
|
|
886829
|
-
installCount: installCounts?.get(pluginId)
|
|
886609
|
+
source: entry.source
|
|
886830
886610
|
});
|
|
886831
886611
|
}
|
|
886832
886612
|
}
|
|
@@ -887170,7 +886950,6 @@ var init_plugins = __esm(() => {
|
|
|
887170
886950
|
init_errors();
|
|
887171
886951
|
init_log3();
|
|
887172
886952
|
init_cacheUtils();
|
|
887173
|
-
init_installCounts();
|
|
887174
886953
|
init_installedPluginsManager();
|
|
887175
886954
|
init_marketplaceHelpers();
|
|
887176
886955
|
init_marketplaceManager();
|
|
@@ -887358,7 +887137,7 @@ __export(exports_update, {
|
|
|
887358
887137
|
});
|
|
887359
887138
|
async function update() {
|
|
887360
887139
|
logEvent("tengu_update_check", {});
|
|
887361
|
-
writeToStdout(`${t("cli.update.currentVersion", "Current version")}: ${"4.2.
|
|
887140
|
+
writeToStdout(`${t("cli.update.currentVersion", "Current version")}: ${"4.2.16"}
|
|
887362
887141
|
`);
|
|
887363
887142
|
const channel5 = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
887364
887143
|
writeToStdout(`${t("cli.update.checkingUpdates", { channel: channel5 }, "Checking for updates to {channel} version...")}
|
|
@@ -887433,8 +887212,8 @@ async function update() {
|
|
|
887433
887212
|
writeToStdout(`${t("cli.update.managedByHomebrew", "CoStrict is managed by Homebrew.")}
|
|
887434
887213
|
`);
|
|
887435
887214
|
const latest = await getLatestVersion(channel5);
|
|
887436
|
-
if (latest && !gte2("4.2.
|
|
887437
|
-
writeToStdout(`${t("cli.update.updateAvailable", { current: "4.2.
|
|
887215
|
+
if (latest && !gte2("4.2.16", latest)) {
|
|
887216
|
+
writeToStdout(`${t("cli.update.updateAvailable", { current: "4.2.16", latest }, "Update available: {current} \u2192 {latest}")}
|
|
887438
887217
|
`);
|
|
887439
887218
|
writeToStdout(`
|
|
887440
887219
|
`);
|
|
@@ -887450,8 +887229,8 @@ async function update() {
|
|
|
887450
887229
|
writeToStdout(`${t("cli.update.managedByWinget", "CoStrict is managed by winget.")}
|
|
887451
887230
|
`);
|
|
887452
887231
|
const latest = await getLatestVersion(channel5);
|
|
887453
|
-
if (latest && !gte2("4.2.
|
|
887454
|
-
writeToStdout(`${t("cli.update.updateAvailable", { current: "4.2.
|
|
887232
|
+
if (latest && !gte2("4.2.16", latest)) {
|
|
887233
|
+
writeToStdout(`${t("cli.update.updateAvailable", { current: "4.2.16", latest }, "Update available: {current} \u2192 {latest}")}
|
|
887455
887234
|
`);
|
|
887456
887235
|
writeToStdout(`
|
|
887457
887236
|
`);
|
|
@@ -887467,8 +887246,8 @@ async function update() {
|
|
|
887467
887246
|
writeToStdout(`${t("cli.update.managedByApk", "CoStrict is managed by apk.")}
|
|
887468
887247
|
`);
|
|
887469
887248
|
const latest = await getLatestVersion(channel5);
|
|
887470
|
-
if (latest && !gte2("4.2.
|
|
887471
|
-
writeToStdout(`${t("cli.update.updateAvailable", { current: "4.2.
|
|
887249
|
+
if (latest && !gte2("4.2.16", latest)) {
|
|
887250
|
+
writeToStdout(`${t("cli.update.updateAvailable", { current: "4.2.16", latest }, "Update available: {current} \u2192 {latest}")}
|
|
887472
887251
|
`);
|
|
887473
887252
|
writeToStdout(`
|
|
887474
887253
|
`);
|
|
@@ -887533,11 +887312,11 @@ async function update() {
|
|
|
887533
887312
|
`);
|
|
887534
887313
|
await gracefulShutdown(1);
|
|
887535
887314
|
}
|
|
887536
|
-
if (result2.latestVersion === "4.2.
|
|
887537
|
-
writeToStdout(source_default.green(t("cli.update.upToDateVersion", { version: "4.2.
|
|
887315
|
+
if (result2.latestVersion === "4.2.16") {
|
|
887316
|
+
writeToStdout(source_default.green(t("cli.update.upToDateVersion", { version: "4.2.16" }, "CoStrict is up to date ({version})")) + `
|
|
887538
887317
|
`);
|
|
887539
887318
|
} else {
|
|
887540
|
-
writeToStdout(source_default.green(t("cli.update.successfullyUpdated", { from: "4.2.
|
|
887319
|
+
writeToStdout(source_default.green(t("cli.update.successfullyUpdated", { from: "4.2.16", to: String(result2.latestVersion) }, "Successfully updated from {from} to version {to}")) + `
|
|
887541
887320
|
`);
|
|
887542
887321
|
regenerateCompletionCache();
|
|
887543
887322
|
}
|
|
@@ -887597,12 +887376,12 @@ async function update() {
|
|
|
887597
887376
|
`);
|
|
887598
887377
|
await gracefulShutdown(1);
|
|
887599
887378
|
}
|
|
887600
|
-
if (latestVersion === "4.2.
|
|
887601
|
-
writeToStdout(source_default.green(t("cli.update.upToDateVersion", { version: "4.2.
|
|
887379
|
+
if (latestVersion === "4.2.16") {
|
|
887380
|
+
writeToStdout(source_default.green(t("cli.update.upToDateVersion", { version: "4.2.16" }, "CoStrict is up to date ({version})")) + `
|
|
887602
887381
|
`);
|
|
887603
887382
|
await gracefulShutdown(0);
|
|
887604
887383
|
}
|
|
887605
|
-
writeToStdout(`${t("cli.update.newVersionAvailable", { latest: String(latestVersion), current: "4.2.
|
|
887384
|
+
writeToStdout(`${t("cli.update.newVersionAvailable", { latest: String(latestVersion), current: "4.2.16" }, "New version available: {latest} (current: {current})")}
|
|
887606
887385
|
`);
|
|
887607
887386
|
writeToStdout(`${t("cli.update.installing", "Installing update...")}
|
|
887608
887387
|
`);
|
|
@@ -887647,7 +887426,7 @@ async function update() {
|
|
|
887647
887426
|
logForDebugging(`update: Installation status: ${result.status}`);
|
|
887648
887427
|
switch (result.status) {
|
|
887649
887428
|
case "success":
|
|
887650
|
-
writeToStdout(source_default.green(t("cli.update.successfullyUpdated", { from: "4.2.
|
|
887429
|
+
writeToStdout(source_default.green(t("cli.update.successfullyUpdated", { from: "4.2.16", to: String(latestVersion) }, "Successfully updated from {from} to version {to}")) + `
|
|
887651
887430
|
`);
|
|
887652
887431
|
regenerateCompletionCache();
|
|
887653
887432
|
break;
|
|
@@ -887741,12 +887520,12 @@ __export(exports_install, {
|
|
|
887741
887520
|
install: () => install
|
|
887742
887521
|
});
|
|
887743
887522
|
import { homedir as homedir60 } from "os";
|
|
887744
|
-
import { join as
|
|
887523
|
+
import { join as join235 } from "path";
|
|
887745
887524
|
function getInstallationPath2() {
|
|
887746
887525
|
const isWindows4 = env4.platform === "win32";
|
|
887747
887526
|
const homeDir = homedir60();
|
|
887748
887527
|
if (isWindows4) {
|
|
887749
|
-
const windowsPath =
|
|
887528
|
+
const windowsPath = join235(homeDir, ".local", "bin", "claude.exe");
|
|
887750
887529
|
return windowsPath.replace(/\//gu, "\\");
|
|
887751
887530
|
}
|
|
887752
887531
|
return "~/.local/bin/claude";
|
|
@@ -888176,7 +887955,7 @@ __export(exports_up, {
|
|
|
888176
887955
|
up: () => up
|
|
888177
887956
|
});
|
|
888178
887957
|
import { readFileSync as readFileSync44 } from "fs";
|
|
888179
|
-
import { join as
|
|
887958
|
+
import { join as join236 } from "path";
|
|
888180
887959
|
import { spawnSync as spawnSync11 } from "child_process";
|
|
888181
887960
|
async function up() {
|
|
888182
887961
|
const cwd5 = process.cwd();
|
|
@@ -888184,7 +887963,7 @@ async function up() {
|
|
|
888184
887963
|
const searchDirs = gitRoot ? [gitRoot, cwd5] : [cwd5];
|
|
888185
887964
|
let upSection = null;
|
|
888186
887965
|
for (const dir of searchDirs) {
|
|
888187
|
-
const claudeMdPath =
|
|
887966
|
+
const claudeMdPath = join236(dir, "CLAUDE.md");
|
|
888188
887967
|
try {
|
|
888189
887968
|
const content = readFileSync44(claudeMdPath, "utf-8");
|
|
888190
887969
|
upSection = extractUpSection(content);
|
|
@@ -888402,7 +888181,7 @@ async function errorHandler3(num) {
|
|
|
888402
888181
|
}
|
|
888403
888182
|
}
|
|
888404
888183
|
async function exportHandler(source, outputFile) {
|
|
888405
|
-
const { writeFile:
|
|
888184
|
+
const { writeFile: writeFile82, readFile: readFile92 } = await import("fs/promises");
|
|
888406
888185
|
const logs2 = await getRecentActivity();
|
|
888407
888186
|
const idx = parseInt(source, 10);
|
|
888408
888187
|
let log16;
|
|
@@ -888413,8 +888192,8 @@ async function exportHandler(source, outputFile) {
|
|
|
888413
888192
|
}
|
|
888414
888193
|
if (!log16) {
|
|
888415
888194
|
try {
|
|
888416
|
-
const content = await
|
|
888417
|
-
await
|
|
888195
|
+
const content = await readFile92(source, "utf-8");
|
|
888196
|
+
await writeFile82(outputFile, content, "utf-8");
|
|
888418
888197
|
console.log(t("cli.ant.exportSuccess", `Exported ${source} \u2192 ${outputFile}`));
|
|
888419
888198
|
return;
|
|
888420
888199
|
} catch {
|
|
@@ -888423,7 +888202,7 @@ async function exportHandler(source, outputFile) {
|
|
|
888423
888202
|
return;
|
|
888424
888203
|
}
|
|
888425
888204
|
}
|
|
888426
|
-
await
|
|
888205
|
+
await writeFile82(outputFile, JSON.stringify(log16, null, 2), "utf-8");
|
|
888427
888206
|
console.log(t("cli.ant.exportSuccess", `Exported session ${log16.sessionId} \u2192 ${outputFile}`));
|
|
888428
888207
|
}
|
|
888429
888208
|
async function completionHandler(shell, opts, _program) {
|
|
@@ -889867,7 +889646,7 @@ ${assistantAddendum}` : assistantAddendum;
|
|
|
889867
889646
|
}
|
|
889868
889647
|
}
|
|
889869
889648
|
logForDiagnosticsNoPII("info", "started", {
|
|
889870
|
-
version: "4.2.
|
|
889649
|
+
version: "4.2.16",
|
|
889871
889650
|
is_native_binary: isInBundledMode()
|
|
889872
889651
|
});
|
|
889873
889652
|
registerCleanup(async () => {
|
|
@@ -890348,7 +890127,7 @@ Session: ${directConnectConfig.sessionId}`, "info");
|
|
|
890348
890127
|
sshSession = await createSSHSession2({
|
|
890349
890128
|
host: _pendingSSH.host,
|
|
890350
890129
|
cwd: _pendingSSH.cwd,
|
|
890351
|
-
localVersion: "4.2.
|
|
890130
|
+
localVersion: "4.2.16",
|
|
890352
890131
|
permissionMode: _pendingSSH.permissionMode,
|
|
890353
890132
|
dangerouslySkipPermissions: _pendingSSH.dangerouslySkipPermissions,
|
|
890354
890133
|
extraCliArgs: _pendingSSH.extraCliArgs,
|
|
@@ -890820,7 +890599,7 @@ Usage: csc --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
890820
890599
|
pendingHookMessages
|
|
890821
890600
|
}, renderAndRun);
|
|
890822
890601
|
}
|
|
890823
|
-
}).version("4.2.
|
|
890602
|
+
}).version("4.2.16 (CoStrict)", "-v, --version", cliDesc("cli.option.version", "Output the version number"));
|
|
890824
890603
|
program2.addOption(new Option("-w, --worktree [name]", cliDesc("cli.option.worktree", "Create a new git worktree for this session (optionally specify a name)")).hideHelp());
|
|
890825
890604
|
program2.addOption(new Option("--tmux", cliDesc("cli.option.tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.")).hideHelp());
|
|
890826
890605
|
if (canUserConfigureAdvisor()) {
|
|
@@ -891540,10 +891319,10 @@ if (process.env.CLAUDE_CODE_REMOTE === "true") {
|
|
|
891540
891319
|
async function main2() {
|
|
891541
891320
|
const args = process.argv.slice(2);
|
|
891542
891321
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
891543
|
-
const d7 = new Date("2026-07-17T11:
|
|
891322
|
+
const d7 = new Date("2026-07-17T11:45:23.878Z");
|
|
891544
891323
|
const p2 = (n3) => String(n3).padStart(2, "0");
|
|
891545
891324
|
const buildTime = `${d7.getFullYear()}/${p2(d7.getMonth() + 1)}/${p2(d7.getDate())} ${p2(d7.getHours())}:${p2(d7.getMinutes())}:${p2(d7.getSeconds())}`;
|
|
891546
|
-
console.log(`${"4.2.
|
|
891325
|
+
console.log(`${"4.2.16"} (commit: ${"689e7a052"}, built: ${buildTime})`);
|
|
891547
891326
|
return;
|
|
891548
891327
|
}
|
|
891549
891328
|
const { terminateBatchWorker: terminateBatchWorker2 } = await Promise.resolve().then(() => (init_spawn(), exports_spawn));
|
|
@@ -891694,5 +891473,5 @@ async function main2() {
|
|
|
891694
891473
|
}
|
|
891695
891474
|
main2();
|
|
891696
891475
|
|
|
891697
|
-
//# debugId=
|
|
891476
|
+
//# debugId=A6479366BCF1D72964756E2164756E21
|
|
891698
891477
|
|