@rayu-dev/rayu-cli 1.3.443 → 1.3.445
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/rayu.js +1013 -750
- package/package.json +1 -1
package/dist/rayu.js
CHANGED
|
@@ -19134,7 +19134,7 @@ var init_contextPrepCache = __esm(() => {
|
|
|
19134
19134
|
});
|
|
19135
19135
|
|
|
19136
19136
|
// src/utils/curatedProviderModels.ts
|
|
19137
|
-
var DOUBLEWORD_MODELS, FUGU_MODELS, CURATED_PROVIDER_MODELS;
|
|
19137
|
+
var DOUBLEWORD_MODELS, FUGU_MODELS, GLM_MODELS, MINIMAX_MODELS, CURATED_PROVIDER_MODELS;
|
|
19138
19138
|
var init_curatedProviderModels = __esm(() => {
|
|
19139
19139
|
DOUBLEWORD_MODELS = [
|
|
19140
19140
|
"Qwen/Qwen3-14B-FP8",
|
|
@@ -19156,9 +19156,42 @@ var init_curatedProviderModels = __esm(() => {
|
|
|
19156
19156
|
"zai-org/GLM-5.1-FP8"
|
|
19157
19157
|
];
|
|
19158
19158
|
FUGU_MODELS = ["fugu", "fugu-ultra"];
|
|
19159
|
+
GLM_MODELS = [
|
|
19160
|
+
"glm-5.2",
|
|
19161
|
+
"glm-5.1",
|
|
19162
|
+
"glm-5",
|
|
19163
|
+
"glm-5-turbo",
|
|
19164
|
+
"glm-4.7",
|
|
19165
|
+
"glm-4.7-flash",
|
|
19166
|
+
"glm-4.7-flashx",
|
|
19167
|
+
"glm-4.6",
|
|
19168
|
+
"glm-4.5",
|
|
19169
|
+
"glm-4.5-air",
|
|
19170
|
+
"glm-4.5-x",
|
|
19171
|
+
"glm-4.5-airx",
|
|
19172
|
+
"glm-4.5-flash",
|
|
19173
|
+
"glm-4-32b-0414-128k",
|
|
19174
|
+
"glm-5v-turbo",
|
|
19175
|
+
"glm-4.6v",
|
|
19176
|
+
"glm-4.6v-flashx",
|
|
19177
|
+
"glm-4.6v-flash",
|
|
19178
|
+
"glm-4.5v"
|
|
19179
|
+
];
|
|
19180
|
+
MINIMAX_MODELS = [
|
|
19181
|
+
"MiniMax-M3",
|
|
19182
|
+
"MiniMax-M2.7",
|
|
19183
|
+
"MiniMax-M2.7-highspeed",
|
|
19184
|
+
"MiniMax-M2.5",
|
|
19185
|
+
"MiniMax-M2.5-highspeed",
|
|
19186
|
+
"MiniMax-M2.1",
|
|
19187
|
+
"MiniMax-M2.1-highspeed",
|
|
19188
|
+
"MiniMax-M2"
|
|
19189
|
+
];
|
|
19159
19190
|
CURATED_PROVIDER_MODELS = {
|
|
19160
19191
|
doubleword: DOUBLEWORD_MODELS,
|
|
19161
|
-
fugu: FUGU_MODELS
|
|
19192
|
+
fugu: FUGU_MODELS,
|
|
19193
|
+
glm: GLM_MODELS,
|
|
19194
|
+
minimax: MINIMAX_MODELS
|
|
19162
19195
|
};
|
|
19163
19196
|
});
|
|
19164
19197
|
|
|
@@ -35783,6 +35816,14 @@ var init_rayuProviders = __esm(() => {
|
|
|
35783
35816
|
{ id: "asia-southeast1", label: "Asia Southeast (Singapore) · asia-southeast1" }
|
|
35784
35817
|
];
|
|
35785
35818
|
PROVIDER_PRESETS = [
|
|
35819
|
+
{
|
|
35820
|
+
id: "anthropic",
|
|
35821
|
+
label: "Anthropic — Claude (console.anthropic.com API key) · native thinking + context",
|
|
35822
|
+
kind: "anthropic",
|
|
35823
|
+
defaultModel: "claude-sonnet-4-6",
|
|
35824
|
+
smallFastModel: "claude-haiku-4-5-20251001",
|
|
35825
|
+
envKeys: ["ANTHROPIC_API_KEY"]
|
|
35826
|
+
},
|
|
35786
35827
|
{
|
|
35787
35828
|
id: "nvidia",
|
|
35788
35829
|
label: "NVIDIA NIM (integrate.api.nvidia.com)",
|
|
@@ -35810,6 +35851,24 @@ var init_rayuProviders = __esm(() => {
|
|
|
35810
35851
|
smallFastModel: "deepseek-v4-flash",
|
|
35811
35852
|
envKeys: ["DEEPSEEK_API_KEY"]
|
|
35812
35853
|
},
|
|
35854
|
+
{
|
|
35855
|
+
id: "glm",
|
|
35856
|
+
label: "GLM — Z.ai (api.z.ai) · GLM-5.2 1M ctx / GLM-4.6 200K · native thinking",
|
|
35857
|
+
kind: "openai-compatible",
|
|
35858
|
+
baseURL: "https://api.z.ai/api/paas/v4",
|
|
35859
|
+
defaultModel: "glm-5.2",
|
|
35860
|
+
smallFastModel: "glm-4.5-air",
|
|
35861
|
+
envKeys: ["ZAI_API_KEY", "ZHIPUAI_API_KEY", "GLM_API_KEY"]
|
|
35862
|
+
},
|
|
35863
|
+
{
|
|
35864
|
+
id: "minimax",
|
|
35865
|
+
label: "MiniMax (api.minimax.io) · M3 1M ctx / M2 reasoning · native thinking",
|
|
35866
|
+
kind: "openai-compatible",
|
|
35867
|
+
baseURL: "https://api.minimax.io/v1",
|
|
35868
|
+
defaultModel: "MiniMax-M2",
|
|
35869
|
+
smallFastModel: "MiniMax-M2",
|
|
35870
|
+
envKeys: ["MINIMAX_API_KEY"]
|
|
35871
|
+
},
|
|
35813
35872
|
{
|
|
35814
35873
|
id: "kimi-moonshot",
|
|
35815
35874
|
label: "Kimi / Moonshot (api.moonshot.ai)",
|
|
@@ -35990,6 +36049,8 @@ var init_rayuProviders = __esm(() => {
|
|
|
35990
36049
|
nvidia: "NVIDIA",
|
|
35991
36050
|
doubleword: "Doubleword",
|
|
35992
36051
|
deepseek: "DeepSeek",
|
|
36052
|
+
glm: "GLM",
|
|
36053
|
+
minimax: "MiniMax",
|
|
35993
36054
|
"kimi-moonshot": "Kimi",
|
|
35994
36055
|
"kimi-for-code": "Kimi for Code",
|
|
35995
36056
|
fugu: "Fugu",
|
|
@@ -36799,7 +36860,8 @@ var init_rayuConfig = __esm(() => {
|
|
|
36799
36860
|
[/gemini[-.]?(1\.5|2|2\.5|3)/i, 1048576],
|
|
36800
36861
|
[/gemini/i, 1048576],
|
|
36801
36862
|
[/deepseek[-/]?v4[-/]?(flash|pro)/i, 1e6],
|
|
36802
|
-
[/minimax/i, 1e6],
|
|
36863
|
+
[/minimax[-_.]?m3/i, 1e6],
|
|
36864
|
+
[/glm-5\.2/i, 1e6],
|
|
36803
36865
|
[/fugu/i, 1e6],
|
|
36804
36866
|
[/kimi-k1|kimi.*long/i, 200000],
|
|
36805
36867
|
[/kimi[-_.]?k2[-_.]?(thinking|\d{4}|[5-9])/i, 256000],
|
|
@@ -36808,13 +36870,16 @@ var init_rayuConfig = __esm(() => {
|
|
|
36808
36870
|
[/jamba/i, 256000],
|
|
36809
36871
|
[/step[-_.]?3\.7/i, 256000],
|
|
36810
36872
|
[/claude/i, 200000],
|
|
36873
|
+
[/minimax/i, 204800],
|
|
36811
36874
|
[/deepseek-(chat|reasoner|v3|coder)/i, 131072],
|
|
36812
36875
|
[/deepseek-r1/i, 131072],
|
|
36813
36876
|
[/llama-3\.[1-3]|llama-3-70b|llama-4|nemotron/i, 131072],
|
|
36814
36877
|
[/qwen[-_.]?[23]|qwq/i, 131072],
|
|
36815
36878
|
[/gemma-[234]/i, 131072],
|
|
36816
36879
|
[/mixtral|mistral|ministral|codestral|devstral/i, 131072],
|
|
36817
|
-
[/glm-[
|
|
36880
|
+
[/glm-(4\.[56]v|5v)/i, 65536],
|
|
36881
|
+
[/glm-4\.[67]|glm-5/i, 200000],
|
|
36882
|
+
[/glm-4/i, 131072],
|
|
36818
36883
|
[/gpt-oss/i, 131072],
|
|
36819
36884
|
[/phi-[34]/i, 131072],
|
|
36820
36885
|
[/command-r|c4ai/i, 131072],
|
|
@@ -148302,7 +148367,7 @@ var init_auth = __esm(() => {
|
|
|
148302
148367
|
|
|
148303
148368
|
// src/utils/userAgent.ts
|
|
148304
148369
|
function getRayuUserAgent() {
|
|
148305
|
-
return `rayu/${"1.3.
|
|
148370
|
+
return `rayu/${"1.3.445"}`;
|
|
148306
148371
|
}
|
|
148307
148372
|
var getClaudeCodeUserAgent;
|
|
148308
148373
|
var init_userAgent = __esm(() => {
|
|
@@ -148328,7 +148393,7 @@ function getUserAgent() {
|
|
|
148328
148393
|
const clientApp = process.env.RAYU_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.RAYU_AGENT_SDK_CLIENT_APP}` : "";
|
|
148329
148394
|
const workload = getWorkload();
|
|
148330
148395
|
const workloadSuffix = workload ? `, workload/${workload}` : "";
|
|
148331
|
-
return `rayu/${"1.3.
|
|
148396
|
+
return `rayu/${"1.3.445"} (${"external"}, ${process.env.RAYU_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
|
|
148332
148397
|
}
|
|
148333
148398
|
function getMCPUserAgent() {
|
|
148334
148399
|
const parts = [];
|
|
@@ -148342,7 +148407,7 @@ function getMCPUserAgent() {
|
|
|
148342
148407
|
parts.push(`client-app/${process.env.RAYU_AGENT_SDK_CLIENT_APP}`);
|
|
148343
148408
|
}
|
|
148344
148409
|
const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
148345
|
-
return `rayu/${"1.3.
|
|
148410
|
+
return `rayu/${"1.3.445"}${suffix}`;
|
|
148346
148411
|
}
|
|
148347
148412
|
function getWebFetchUserAgent() {
|
|
148348
148413
|
return `Rayu-User (${getRayuUserAgent()})`;
|
|
@@ -148465,7 +148530,7 @@ var init_user = __esm(() => {
|
|
|
148465
148530
|
deviceId,
|
|
148466
148531
|
sessionId: getSessionId(),
|
|
148467
148532
|
email: getEmail(),
|
|
148468
|
-
appVersion: "1.3.
|
|
148533
|
+
appVersion: "1.3.445",
|
|
148469
148534
|
platform: getHostPlatformForAnalytics(),
|
|
148470
148535
|
organizationUuid,
|
|
148471
148536
|
accountUuid,
|
|
@@ -165435,18 +165500,18 @@ function isUseRayuOAuthEnabled() {
|
|
|
165435
165500
|
const env6 = process.env.USE_RAYU_OAUTH;
|
|
165436
165501
|
if (env6 !== undefined && env6 !== "")
|
|
165437
165502
|
return isEnvTruthy(env6);
|
|
165438
|
-
return isEnvTruthy("
|
|
165503
|
+
return isEnvTruthy("true");
|
|
165439
165504
|
}
|
|
165440
165505
|
function getRayuApiBaseUrl() {
|
|
165441
|
-
const base2 = process.env.RAYU_API_URL || "
|
|
165506
|
+
const base2 = process.env.RAYU_API_URL || "https://yv1a421c60jt40wplrsy6tsu.159.223.65.23.sslip.io/api";
|
|
165442
165507
|
return base2.replace(/\/$/, "");
|
|
165443
165508
|
}
|
|
165444
165509
|
function getRayuWebBaseUrl() {
|
|
165445
|
-
const base2 = process.env.RAYU_WEB_URL || "
|
|
165510
|
+
const base2 = process.env.RAYU_WEB_URL || "https://k10i9pvfj8xxnocpcotds9zu.159.223.65.23.sslip.io";
|
|
165446
165511
|
return base2.replace(/\/$/, "");
|
|
165447
165512
|
}
|
|
165448
165513
|
function getRayuGatewayBaseUrl() {
|
|
165449
|
-
const base2 = process.env.RAYU_GATEWAY_URL || "
|
|
165514
|
+
const base2 = process.env.RAYU_GATEWAY_URL || "https://rgiaetulv4f5kov17vmo5gkn.159.223.65.23.sslip.io";
|
|
165450
165515
|
return base2.replace(/\/$/, "");
|
|
165451
165516
|
}
|
|
165452
165517
|
function sessionPath() {
|
|
@@ -165574,6 +165639,12 @@ function isGatewayRoutingEnabled() {
|
|
|
165574
165639
|
return isEnvTruthy(v);
|
|
165575
165640
|
return true;
|
|
165576
165641
|
}
|
|
165642
|
+
function isGatewayCallbackEnabled() {
|
|
165643
|
+
const v = process.env.RAYU_GATEWAY_CALLBACK;
|
|
165644
|
+
if (v !== undefined && v !== "")
|
|
165645
|
+
return isEnvTruthy(v);
|
|
165646
|
+
return true;
|
|
165647
|
+
}
|
|
165577
165648
|
function isRoutableKind(provider) {
|
|
165578
165649
|
switch (provider.kind) {
|
|
165579
165650
|
case "openai-compatible":
|
|
@@ -165645,17 +165716,20 @@ function makeGatewayRoutingFetch(provider, inner = globalThis.fetch) {
|
|
|
165645
165716
|
headers.set("X-Rayu-Token", token);
|
|
165646
165717
|
headers.set("X-Rayu-Upstream-URL", originalUrl);
|
|
165647
165718
|
headers.set("X-Rayu-Provider", provider.id);
|
|
165719
|
+
const callbackToDirect = isGatewayCallbackEnabled();
|
|
165648
165720
|
try {
|
|
165649
165721
|
const res = await inner(gatewayUrl, { ...init, headers });
|
|
165650
165722
|
if (res.headers.get(LIMIT_HEADER)) {
|
|
165651
165723
|
return res;
|
|
165652
165724
|
}
|
|
165653
165725
|
if (!res.headers.get(PROXIED_HEADER)) {
|
|
165654
|
-
return inner(input, init);
|
|
165726
|
+
return callbackToDirect ? inner(input, init) : res;
|
|
165655
165727
|
}
|
|
165656
165728
|
return res;
|
|
165657
|
-
} catch {
|
|
165658
|
-
|
|
165729
|
+
} catch (err) {
|
|
165730
|
+
if (callbackToDirect)
|
|
165731
|
+
return inner(input, init);
|
|
165732
|
+
throw err;
|
|
165659
165733
|
}
|
|
165660
165734
|
};
|
|
165661
165735
|
return wrapped;
|
|
@@ -182832,6 +182906,186 @@ var init_copilotClient = __esm(() => {
|
|
|
182832
182906
|
init_copilotAuth();
|
|
182833
182907
|
});
|
|
182834
182908
|
|
|
182909
|
+
// src/services/rayuAuth/rayuHostedProvider.ts
|
|
182910
|
+
function syncRayuHostedProvider(ent, opts) {
|
|
182911
|
+
try {
|
|
182912
|
+
const cfg = loadRayuConfig();
|
|
182913
|
+
const catalog = ent?.hostedModels ?? ent?.allowedModels ?? [];
|
|
182914
|
+
const entitled = ent?.allowedModels ?? [];
|
|
182915
|
+
const models = catalog.map((m2) => m2.code);
|
|
182916
|
+
const idx = cfg.providers.findIndex((p) => p.id === RAYU_HOSTED_PROVIDER_ID);
|
|
182917
|
+
if (models.length > 0) {
|
|
182918
|
+
const existing = idx >= 0 ? cfg.providers[idx] : undefined;
|
|
182919
|
+
const preferredCode = entitled[0]?.code ?? catalog[0]?.code;
|
|
182920
|
+
const provider = {
|
|
182921
|
+
...existing,
|
|
182922
|
+
id: RAYU_HOSTED_PROVIDER_ID,
|
|
182923
|
+
kind: "rayu-hosted",
|
|
182924
|
+
baseURL: rayuHostedBaseURL(),
|
|
182925
|
+
models,
|
|
182926
|
+
fetchedModels: models,
|
|
182927
|
+
defaultModel: existing?.defaultModel ?? preferredCode,
|
|
182928
|
+
smallFastModel: existing?.smallFastModel ?? preferredCode
|
|
182929
|
+
};
|
|
182930
|
+
if (idx >= 0)
|
|
182931
|
+
cfg.providers[idx] = provider;
|
|
182932
|
+
else
|
|
182933
|
+
cfg.providers.push(provider);
|
|
182934
|
+
if (opts?.activate && entitled.length > 0) {
|
|
182935
|
+
cfg.activeProvider = RAYU_HOSTED_PROVIDER_ID;
|
|
182936
|
+
}
|
|
182937
|
+
saveRayuConfig(cfg);
|
|
182938
|
+
return;
|
|
182939
|
+
}
|
|
182940
|
+
if (idx >= 0) {
|
|
182941
|
+
cfg.providers.splice(idx, 1);
|
|
182942
|
+
if (cfg.activeProvider === RAYU_HOSTED_PROVIDER_ID) {
|
|
182943
|
+
cfg.activeProvider = cfg.providers[0]?.id;
|
|
182944
|
+
}
|
|
182945
|
+
saveRayuConfig(cfg);
|
|
182946
|
+
}
|
|
182947
|
+
} catch {}
|
|
182948
|
+
}
|
|
182949
|
+
var init_rayuHostedProvider = __esm(() => {
|
|
182950
|
+
init_rayuConfig();
|
|
182951
|
+
init_rayuProviders();
|
|
182952
|
+
init_rayuHostedAuth();
|
|
182953
|
+
});
|
|
182954
|
+
|
|
182955
|
+
// src/services/rayuAuth/rayuEntitlements.ts
|
|
182956
|
+
var exports_rayuEntitlements = {};
|
|
182957
|
+
__export(exports_rayuEntitlements, {
|
|
182958
|
+
refreshRayuEntitlements: () => refreshRayuEntitlements,
|
|
182959
|
+
rayuFeatureAllowed: () => rayuFeatureAllowed,
|
|
182960
|
+
isHostedModelEntitled: () => isHostedModelEntitled,
|
|
182961
|
+
hostedModelUpgradeMessage: () => hostedModelUpgradeMessage,
|
|
182962
|
+
getCachedEntitlements: () => getCachedEntitlements,
|
|
182963
|
+
clearRayuEntitlements: () => clearRayuEntitlements,
|
|
182964
|
+
_setRayuEntitlementsForTesting: () => _setRayuEntitlementsForTesting,
|
|
182965
|
+
_resetRayuEntitlementsForTesting: () => _resetRayuEntitlementsForTesting
|
|
182966
|
+
});
|
|
182967
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync7, readFileSync as readFileSync12, rmSync as rmSync4, writeFileSync as writeFileSync5 } from "fs";
|
|
182968
|
+
import { join as join30 } from "path";
|
|
182969
|
+
function entitlementsPath() {
|
|
182970
|
+
return join30(getRayuConfigHomeDir(), FILE);
|
|
182971
|
+
}
|
|
182972
|
+
function currentUserId() {
|
|
182973
|
+
return readRayuSession()?.user?.id ?? null;
|
|
182974
|
+
}
|
|
182975
|
+
function loadFromDiskOnce() {
|
|
182976
|
+
if (loadedFromDisk)
|
|
182977
|
+
return;
|
|
182978
|
+
loadedFromDisk = true;
|
|
182979
|
+
try {
|
|
182980
|
+
const p = entitlementsPath();
|
|
182981
|
+
if (existsSync11(p)) {
|
|
182982
|
+
cache3 = JSON.parse(readFileSync12(p, "utf8"));
|
|
182983
|
+
}
|
|
182984
|
+
} catch {
|
|
182985
|
+
cache3 = null;
|
|
182986
|
+
}
|
|
182987
|
+
}
|
|
182988
|
+
function persist(ent) {
|
|
182989
|
+
try {
|
|
182990
|
+
const dir = getRayuConfigHomeDir();
|
|
182991
|
+
if (!existsSync11(dir))
|
|
182992
|
+
mkdirSync7(dir, { recursive: true });
|
|
182993
|
+
const p = entitlementsPath();
|
|
182994
|
+
if (ent)
|
|
182995
|
+
writeFileSync5(p, JSON.stringify(ent, null, 2), { mode: 384 });
|
|
182996
|
+
else
|
|
182997
|
+
rmSync4(p, { force: true });
|
|
182998
|
+
} catch {}
|
|
182999
|
+
}
|
|
183000
|
+
function getCachedEntitlements() {
|
|
183001
|
+
loadFromDiskOnce();
|
|
183002
|
+
if (cache3 && cache3.userId != null) {
|
|
183003
|
+
const uid = currentUserId();
|
|
183004
|
+
if (uid != null && uid !== cache3.userId) {
|
|
183005
|
+
cache3 = null;
|
|
183006
|
+
}
|
|
183007
|
+
}
|
|
183008
|
+
if (isUseRayuOAuthEnabled() && hasRayuSession() && !fetching && Date.now() - lastAttempt > REFRESH_COOLDOWN_MS) {
|
|
183009
|
+
refreshRayuEntitlements();
|
|
183010
|
+
}
|
|
183011
|
+
return cache3;
|
|
183012
|
+
}
|
|
183013
|
+
async function refreshRayuEntitlements() {
|
|
183014
|
+
if (!isUseRayuOAuthEnabled() || !hasRayuSession())
|
|
183015
|
+
return null;
|
|
183016
|
+
if (fetching)
|
|
183017
|
+
return cache3;
|
|
183018
|
+
fetching = true;
|
|
183019
|
+
lastAttempt = Date.now();
|
|
183020
|
+
try {
|
|
183021
|
+
const token = await getValidRayuAccessToken();
|
|
183022
|
+
if (!token)
|
|
183023
|
+
return cache3;
|
|
183024
|
+
const res = await globalThis.fetch(`${getRayuApiBaseUrl()}/me/entitlements`, { headers: { Authorization: `Bearer ${token}` } });
|
|
183025
|
+
if (!res.ok)
|
|
183026
|
+
return cache3;
|
|
183027
|
+
const data = await res.json();
|
|
183028
|
+
data.userId = currentUserId();
|
|
183029
|
+
cache3 = data;
|
|
183030
|
+
loadedFromDisk = true;
|
|
183031
|
+
persist(data);
|
|
183032
|
+
syncRayuHostedProvider(data);
|
|
183033
|
+
return data;
|
|
183034
|
+
} catch {
|
|
183035
|
+
return cache3;
|
|
183036
|
+
} finally {
|
|
183037
|
+
fetching = false;
|
|
183038
|
+
}
|
|
183039
|
+
}
|
|
183040
|
+
function clearRayuEntitlements() {
|
|
183041
|
+
cache3 = null;
|
|
183042
|
+
loadedFromDisk = true;
|
|
183043
|
+
lastAttempt = 0;
|
|
183044
|
+
persist(null);
|
|
183045
|
+
syncRayuHostedProvider(null);
|
|
183046
|
+
}
|
|
183047
|
+
function rayuFeatureAllowed(featureKey) {
|
|
183048
|
+
if (!isUseRayuOAuthEnabled())
|
|
183049
|
+
return true;
|
|
183050
|
+
const ent = getCachedEntitlements();
|
|
183051
|
+
if (ent && ent.features) {
|
|
183052
|
+
const f3 = ent.features[featureKey];
|
|
183053
|
+
if (!f3)
|
|
183054
|
+
return true;
|
|
183055
|
+
return f3.enabled !== false;
|
|
183056
|
+
}
|
|
183057
|
+
return !hasRayuSession();
|
|
183058
|
+
}
|
|
183059
|
+
function isHostedModelEntitled(modelCode) {
|
|
183060
|
+
if (!isUseRayuOAuthEnabled())
|
|
183061
|
+
return true;
|
|
183062
|
+
const ent = getCachedEntitlements();
|
|
183063
|
+
if (!ent)
|
|
183064
|
+
return true;
|
|
183065
|
+
const allowed = ent.allowedModels ?? [];
|
|
183066
|
+
return allowed.some((m2) => m2.code === modelCode);
|
|
183067
|
+
}
|
|
183068
|
+
function hostedModelUpgradeMessage() {
|
|
183069
|
+
const url3 = `${getRayuWebBaseUrl()}/plans`;
|
|
183070
|
+
return `\uD83D\uDD12 Rayu-hosted models are a paid feature. Please upgrade your plan to use them: ${url3}`;
|
|
183071
|
+
}
|
|
183072
|
+
function _setRayuEntitlementsForTesting(ent) {
|
|
183073
|
+
cache3 = ent;
|
|
183074
|
+
loadedFromDisk = true;
|
|
183075
|
+
}
|
|
183076
|
+
function _resetRayuEntitlementsForTesting() {
|
|
183077
|
+
cache3 = null;
|
|
183078
|
+
loadedFromDisk = false;
|
|
183079
|
+
fetching = false;
|
|
183080
|
+
lastAttempt = 0;
|
|
183081
|
+
}
|
|
183082
|
+
var FILE = "rayu-entitlements.json", REFRESH_COOLDOWN_MS = 30000, cache3 = null, loadedFromDisk = false, fetching = false, lastAttempt = 0;
|
|
183083
|
+
var init_rayuEntitlements = __esm(() => {
|
|
183084
|
+
init_envUtils();
|
|
183085
|
+
init_rayuHostedProvider();
|
|
183086
|
+
init_rayuSession();
|
|
183087
|
+
});
|
|
183088
|
+
|
|
182835
183089
|
// src/services/api/rayuHosted/rayuHostedAuth.ts
|
|
182836
183090
|
function rayuHostedBaseURL() {
|
|
182837
183091
|
return `${getRayuGatewayBaseUrl()}/v1`;
|
|
@@ -182839,6 +183093,25 @@ function rayuHostedBaseURL() {
|
|
|
182839
183093
|
function makeRayuHostedFetch() {
|
|
182840
183094
|
const inner = globalThis.fetch;
|
|
182841
183095
|
const wrapped = async (input, init = {}) => {
|
|
183096
|
+
const url3 = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
|
|
183097
|
+
if ((init?.method ?? "GET").toUpperCase() === "POST" && url3.includes("/chat/completions") && typeof init?.body === "string") {
|
|
183098
|
+
const model = (() => {
|
|
183099
|
+
try {
|
|
183100
|
+
return JSON.parse(init.body).model;
|
|
183101
|
+
} catch {
|
|
183102
|
+
return;
|
|
183103
|
+
}
|
|
183104
|
+
})();
|
|
183105
|
+
if (model) {
|
|
183106
|
+
const { isHostedModelEntitled: isHostedModelEntitled2, hostedModelUpgradeMessage: hostedModelUpgradeMessage2 } = await Promise.resolve().then(() => (init_rayuEntitlements(), exports_rayuEntitlements));
|
|
183107
|
+
if (!isHostedModelEntitled2(model)) {
|
|
183108
|
+
const message = hostedModelUpgradeMessage2();
|
|
183109
|
+
return new Response(JSON.stringify({
|
|
183110
|
+
error: { message, type: "upgrade_required", code: "plan_upgrade_required" }
|
|
183111
|
+
}), { status: 403, headers: { "content-type": "application/json" } });
|
|
183112
|
+
}
|
|
183113
|
+
}
|
|
183114
|
+
}
|
|
182842
183115
|
const token = await getValidRayuAccessToken();
|
|
182843
183116
|
if (!token) {
|
|
182844
183117
|
throw new Error("Not signed in to Rayu. Run /login to use Rayu-hosted models.");
|
|
@@ -183214,14 +183487,14 @@ var init_client4 = __esm(() => {
|
|
|
183214
183487
|
});
|
|
183215
183488
|
|
|
183216
183489
|
// src/utils/model/modelCapabilities.ts
|
|
183217
|
-
import { readFileSync as
|
|
183490
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
183218
183491
|
import { mkdir as mkdir5, writeFile as writeFile2 } from "fs/promises";
|
|
183219
|
-
import { join as
|
|
183492
|
+
import { join as join31 } from "path";
|
|
183220
183493
|
function getCacheDir() {
|
|
183221
|
-
return
|
|
183494
|
+
return join31(getRayuConfigHomeDir(), "cache");
|
|
183222
183495
|
}
|
|
183223
183496
|
function getCachePath() {
|
|
183224
|
-
return
|
|
183497
|
+
return join31(getCacheDir(), "model-capabilities.json");
|
|
183225
183498
|
}
|
|
183226
183499
|
function isModelCapabilitiesEligible() {
|
|
183227
183500
|
if (true)
|
|
@@ -183304,7 +183577,7 @@ var init_modelCapabilities = __esm(() => {
|
|
|
183304
183577
|
}));
|
|
183305
183578
|
loadCache = memoize_default((path14) => {
|
|
183306
183579
|
try {
|
|
183307
|
-
const raw =
|
|
183580
|
+
const raw = readFileSync13(path14, "utf-8");
|
|
183308
183581
|
const parsed = CacheFileSchema().safeParse(safeParseJSON(raw, false));
|
|
183309
183582
|
return parsed.success ? parsed.data.models : null;
|
|
183310
183583
|
} catch {
|
|
@@ -184352,7 +184625,7 @@ var init_metadata = __esm(() => {
|
|
|
184352
184625
|
COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
|
|
184353
184626
|
WHITESPACE_REGEX = /\s+/;
|
|
184354
184627
|
getVersionBase = memoize_default(() => {
|
|
184355
|
-
const match = "1.3.
|
|
184628
|
+
const match = "1.3.445".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
|
|
184356
184629
|
return match ? match[0] : undefined;
|
|
184357
184630
|
});
|
|
184358
184631
|
buildEnvContext = memoize_default(async () => {
|
|
@@ -184391,7 +184664,7 @@ var init_metadata = __esm(() => {
|
|
|
184391
184664
|
},
|
|
184392
184665
|
isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
|
|
184393
184666
|
isRayuAction: isEnvTruthy(process.env.RAYU_ACTION),
|
|
184394
|
-
version: "1.3.
|
|
184667
|
+
version: "1.3.445",
|
|
184395
184668
|
versionBase: getVersionBase(),
|
|
184396
184669
|
buildTime: "",
|
|
184397
184670
|
deploymentEnvironment: env4.detectDeploymentEnvironment(),
|
|
@@ -185003,7 +185276,7 @@ function initialize1PEventLogging() {
|
|
|
185003
185276
|
const platform2 = getPlatform();
|
|
185004
185277
|
const attributes = {
|
|
185005
185278
|
[import_semantic_conventions.ATTR_SERVICE_NAME]: "rayu",
|
|
185006
|
-
[import_semantic_conventions.ATTR_SERVICE_VERSION]: "1.3.
|
|
185279
|
+
[import_semantic_conventions.ATTR_SERVICE_VERSION]: "1.3.445"
|
|
185007
185280
|
};
|
|
185008
185281
|
if (platform2 === "wsl") {
|
|
185009
185282
|
const wslVersion = getWslVersion();
|
|
@@ -185030,7 +185303,7 @@ function initialize1PEventLogging() {
|
|
|
185030
185303
|
})
|
|
185031
185304
|
]
|
|
185032
185305
|
});
|
|
185033
|
-
firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("io.rayu.events", "1.3.
|
|
185306
|
+
firstPartyEventLogger = firstPartyEventLoggerProvider.getLogger("io.rayu.events", "1.3.445");
|
|
185034
185307
|
}
|
|
185035
185308
|
async function reinitialize1PEventLoggingIfConfigChanged() {
|
|
185036
185309
|
if (!is1PEventLoggingEnabled() || !firstPartyEventLoggerProvider) {
|
|
@@ -185649,7 +185922,7 @@ var init_growthbook = __esm(() => {
|
|
|
185649
185922
|
|
|
185650
185923
|
// src/memdir/paths.ts
|
|
185651
185924
|
import { homedir as homedir10 } from "os";
|
|
185652
|
-
import { isAbsolute as isAbsolute7, join as
|
|
185925
|
+
import { isAbsolute as isAbsolute7, join as join33, normalize as normalize5, sep as sep7 } from "path";
|
|
185653
185926
|
function isAutoMemoryEnabled() {
|
|
185654
185927
|
const envVal = process.env.CLAUDE_CODE_DISABLE_AUTO_MEMORY;
|
|
185655
185928
|
if (isEnvTruthy(envVal)) {
|
|
@@ -185687,7 +185960,7 @@ function validateMemoryPath(raw, expandTilde) {
|
|
|
185687
185960
|
if (restNorm === "." || restNorm === "..") {
|
|
185688
185961
|
return;
|
|
185689
185962
|
}
|
|
185690
|
-
candidate =
|
|
185963
|
+
candidate = join33(homedir10(), rest);
|
|
185691
185964
|
}
|
|
185692
185965
|
const normalized = normalize5(candidate).replace(/[/\\]+$/, "");
|
|
185693
185966
|
if (!isAbsolute7(normalized) || normalized.length < 3 || /^[A-Za-z]:$/.test(normalized) || normalized.startsWith("\\\\") || normalized.startsWith("//") || normalized.includes("\x00")) {
|
|
@@ -185709,7 +185982,7 @@ function getAutoMemBase() {
|
|
|
185709
185982
|
return findCanonicalGitRoot(getProjectRoot()) ?? getProjectRoot();
|
|
185710
185983
|
}
|
|
185711
185984
|
function getAutoMemEntrypoint() {
|
|
185712
|
-
return
|
|
185985
|
+
return join33(getAutoMemPath(), AUTO_MEM_ENTRYPOINT_NAME);
|
|
185713
185986
|
}
|
|
185714
185987
|
function isAutoMemPath(absolutePath) {
|
|
185715
185988
|
const normalizedPath = normalize5(absolutePath);
|
|
@@ -185729,8 +186002,8 @@ var init_paths = __esm(() => {
|
|
|
185729
186002
|
if (override) {
|
|
185730
186003
|
return override;
|
|
185731
186004
|
}
|
|
185732
|
-
const projectsDir =
|
|
185733
|
-
return (
|
|
186005
|
+
const projectsDir = join33(getMemoryBaseDir(), "projects");
|
|
186006
|
+
return (join33(projectsDir, sanitizePath2(getAutoMemBase()), AUTO_MEM_DIRNAME) + sep7).normalize("NFC");
|
|
185734
186007
|
}, () => getProjectRoot());
|
|
185735
186008
|
});
|
|
185736
186009
|
|
|
@@ -187326,7 +187599,7 @@ __export(exports_config, {
|
|
|
187326
187599
|
});
|
|
187327
187600
|
import { randomBytes } from "crypto";
|
|
187328
187601
|
import { unwatchFile as unwatchFile2, watchFile as watchFile2 } from "fs";
|
|
187329
|
-
import { basename as basename8, dirname as dirname15, join as
|
|
187602
|
+
import { basename as basename8, dirname as dirname15, join as join34, resolve as resolve11 } from "path";
|
|
187330
187603
|
function createDefaultGlobalConfig() {
|
|
187331
187604
|
return {
|
|
187332
187605
|
numStartups: 0,
|
|
@@ -187681,14 +187954,14 @@ function saveConfigWithLock(file2, createDefault, mergeFn) {
|
|
|
187681
187954
|
const mostRecentTimestamp = mostRecentBackup ? Number(mostRecentBackup.split(".backup.").pop()) : 0;
|
|
187682
187955
|
const shouldCreateBackup = Number.isNaN(mostRecentTimestamp) || Date.now() - mostRecentTimestamp >= MIN_BACKUP_INTERVAL_MS;
|
|
187683
187956
|
if (shouldCreateBackup) {
|
|
187684
|
-
const backupPath =
|
|
187957
|
+
const backupPath = join34(backupDir, `${fileBase}.backup.${Date.now()}`);
|
|
187685
187958
|
fs6.copyFileSync(file2, backupPath);
|
|
187686
187959
|
}
|
|
187687
187960
|
const MAX_BACKUPS = 5;
|
|
187688
187961
|
const backupsForCleanup = shouldCreateBackup ? fs6.readdirStringSync(backupDir).filter((f3) => f3.startsWith(`${fileBase}.backup.`)).sort().reverse() : existingBackups;
|
|
187689
187962
|
for (const oldBackup of backupsForCleanup.slice(MAX_BACKUPS)) {
|
|
187690
187963
|
try {
|
|
187691
|
-
fs6.unlinkSync(
|
|
187964
|
+
fs6.unlinkSync(join34(backupDir, oldBackup));
|
|
187692
187965
|
} catch {}
|
|
187693
187966
|
}
|
|
187694
187967
|
} catch (e2) {
|
|
@@ -187726,7 +187999,7 @@ function enableConfigs() {
|
|
|
187726
187999
|
});
|
|
187727
188000
|
}
|
|
187728
188001
|
function getConfigBackupDir() {
|
|
187729
|
-
return
|
|
188002
|
+
return join34(getRayuConfigHomeDir(), "backups");
|
|
187730
188003
|
}
|
|
187731
188004
|
function findMostRecentBackup(file2) {
|
|
187732
188005
|
const fs6 = getFsImplementation();
|
|
@@ -187736,7 +188009,7 @@ function findMostRecentBackup(file2) {
|
|
|
187736
188009
|
const backups = fs6.readdirStringSync(backupDir).filter((f3) => f3.startsWith(`${fileBase}.backup.`)).sort();
|
|
187737
188010
|
const mostRecent = backups.at(-1);
|
|
187738
188011
|
if (mostRecent) {
|
|
187739
|
-
return
|
|
188012
|
+
return join34(backupDir, mostRecent);
|
|
187740
188013
|
}
|
|
187741
188014
|
} catch {}
|
|
187742
188015
|
const fileDir = dirname15(file2);
|
|
@@ -187744,7 +188017,7 @@ function findMostRecentBackup(file2) {
|
|
|
187744
188017
|
const backups = fs6.readdirStringSync(fileDir).filter((f3) => f3.startsWith(`${fileBase}.backup.`)).sort();
|
|
187745
188018
|
const mostRecent = backups.at(-1);
|
|
187746
188019
|
if (mostRecent) {
|
|
187747
|
-
return
|
|
188020
|
+
return join34(fileDir, mostRecent);
|
|
187748
188021
|
}
|
|
187749
188022
|
const legacyBackup = `${file2}.backup`;
|
|
187750
188023
|
try {
|
|
@@ -187827,7 +188100,7 @@ Claude configuration file at ${file2} is corrupted: ${error54.message}
|
|
|
187827
188100
|
const currentContent = fs6.readFileSync(file2, { encoding: "utf-8" });
|
|
187828
188101
|
for (const backup of existingCorruptedBackups) {
|
|
187829
188102
|
try {
|
|
187830
|
-
const backupContent = fs6.readFileSync(
|
|
188103
|
+
const backupContent = fs6.readFileSync(join34(corruptedBackupDir, backup), { encoding: "utf-8" });
|
|
187831
188104
|
if (currentContent === backupContent) {
|
|
187832
188105
|
alreadyBackedUp = true;
|
|
187833
188106
|
break;
|
|
@@ -187835,7 +188108,7 @@ Claude configuration file at ${file2} is corrupted: ${error54.message}
|
|
|
187835
188108
|
} catch {}
|
|
187836
188109
|
}
|
|
187837
188110
|
if (!alreadyBackedUp) {
|
|
187838
|
-
corruptedBackupPath =
|
|
188111
|
+
corruptedBackupPath = join34(corruptedBackupDir, `${fileBase}.corrupted.${Date.now()}`);
|
|
187839
188112
|
try {
|
|
187840
188113
|
fs6.copyFileSync(file2, corruptedBackupPath);
|
|
187841
188114
|
logForDebugging(`Corrupted config backed up to: ${corruptedBackupPath}`, {
|
|
@@ -187980,13 +188253,13 @@ function getMemoryPath(memoryType) {
|
|
|
187980
188253
|
const cwd2 = getOriginalCwd();
|
|
187981
188254
|
switch (memoryType) {
|
|
187982
188255
|
case "User":
|
|
187983
|
-
return
|
|
188256
|
+
return join34(getRayuConfigHomeDir(), "RAYU.md");
|
|
187984
188257
|
case "Local":
|
|
187985
|
-
return
|
|
188258
|
+
return join34(cwd2, "RAYU.local.md");
|
|
187986
188259
|
case "Project":
|
|
187987
|
-
return
|
|
188260
|
+
return join34(cwd2, "RAYU.md");
|
|
187988
188261
|
case "Managed":
|
|
187989
|
-
return
|
|
188262
|
+
return join34(getManagedFilePath(), "RAYU.md");
|
|
187990
188263
|
case "AutoMem":
|
|
187991
188264
|
return getAutoMemEntrypoint();
|
|
187992
188265
|
}
|
|
@@ -187994,10 +188267,10 @@ function getMemoryPath(memoryType) {
|
|
|
187994
188267
|
return "";
|
|
187995
188268
|
}
|
|
187996
188269
|
function getManagedClaudeRulesDir() {
|
|
187997
|
-
return
|
|
188270
|
+
return join34(getManagedFilePath(), ".rayu", "rules");
|
|
187998
188271
|
}
|
|
187999
188272
|
function getUserClaudeRulesDir() {
|
|
188000
|
-
return
|
|
188273
|
+
return join34(getRayuConfigHomeDir(), "rules");
|
|
188001
188274
|
}
|
|
188002
188275
|
function _setGlobalConfigCacheForTesting(config2) {
|
|
188003
188276
|
globalConfigCache.config = config2;
|
|
@@ -188382,10 +188655,10 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
188382
188655
|
addPattern(pattern) {
|
|
188383
188656
|
return this.add(pattern);
|
|
188384
188657
|
}
|
|
188385
|
-
_test(originalPath,
|
|
188658
|
+
_test(originalPath, cache4, checkUnignored, slices) {
|
|
188386
188659
|
const path15 = originalPath && checkPath.convert(originalPath);
|
|
188387
188660
|
checkPath(path15, originalPath, this._strictPathCheck ? throwError : RETURN_FALSE);
|
|
188388
|
-
return this._t(path15,
|
|
188661
|
+
return this._t(path15, cache4, checkUnignored, slices);
|
|
188389
188662
|
}
|
|
188390
188663
|
checkIgnore(path15) {
|
|
188391
188664
|
if (!REGEX_TEST_TRAILING_SLASH.test(path15)) {
|
|
@@ -188401,19 +188674,19 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
188401
188674
|
}
|
|
188402
188675
|
return this._rules.test(path15, false, MODE_CHECK_IGNORE);
|
|
188403
188676
|
}
|
|
188404
|
-
_t(path15,
|
|
188405
|
-
if (path15 in
|
|
188406
|
-
return
|
|
188677
|
+
_t(path15, cache4, checkUnignored, slices) {
|
|
188678
|
+
if (path15 in cache4) {
|
|
188679
|
+
return cache4[path15];
|
|
188407
188680
|
}
|
|
188408
188681
|
if (!slices) {
|
|
188409
188682
|
slices = path15.split(SLASH).filter(Boolean);
|
|
188410
188683
|
}
|
|
188411
188684
|
slices.pop();
|
|
188412
188685
|
if (!slices.length) {
|
|
188413
|
-
return
|
|
188686
|
+
return cache4[path15] = this._rules.test(path15, checkUnignored, MODE_IGNORE);
|
|
188414
188687
|
}
|
|
188415
|
-
const parent = this._t(slices.join(SLASH) + SLASH,
|
|
188416
|
-
return
|
|
188688
|
+
const parent = this._t(slices.join(SLASH) + SLASH, cache4, checkUnignored, slices);
|
|
188689
|
+
return cache4[path15] = parent.ignored ? parent : this._rules.test(path15, checkUnignored, MODE_IGNORE);
|
|
188417
188690
|
}
|
|
188418
188691
|
ignores(path15) {
|
|
188419
188692
|
return this._test(path15, this._ignoreCache, false).ignored;
|
|
@@ -193815,10 +194088,10 @@ Error generating stack: ` + x2.message + `
|
|
|
193815
194088
|
refCount: 0
|
|
193816
194089
|
};
|
|
193817
194090
|
}
|
|
193818
|
-
function releaseCache(
|
|
193819
|
-
|
|
193820
|
-
|
|
193821
|
-
|
|
194091
|
+
function releaseCache(cache4) {
|
|
194092
|
+
cache4.refCount--;
|
|
194093
|
+
cache4.refCount === 0 && scheduleCallback$2(NormalPriority, function() {
|
|
194094
|
+
cache4.controller.abort();
|
|
193822
194095
|
});
|
|
193823
194096
|
}
|
|
193824
194097
|
function noop$1() {}
|
|
@@ -197940,23 +198213,23 @@ Error generating stack: ` + x2.message + `
|
|
|
197940
198213
|
case 23:
|
|
197941
198214
|
case 22:
|
|
197942
198215
|
if (fiber.memoizedState !== null && fiber.memoizedState.cachePool !== null) {
|
|
197943
|
-
var
|
|
197944
|
-
|
|
198216
|
+
var cache4 = fiber.memoizedState.cachePool.pool;
|
|
198217
|
+
cache4 != null && cache4.refCount++;
|
|
197945
198218
|
}
|
|
197946
198219
|
break;
|
|
197947
198220
|
case 24:
|
|
197948
198221
|
releaseCache(fiber.memoizedState.cache);
|
|
197949
198222
|
}
|
|
197950
|
-
|
|
197951
|
-
if (
|
|
197952
|
-
|
|
198223
|
+
cache4 = fiber.child;
|
|
198224
|
+
if (cache4 !== null)
|
|
198225
|
+
cache4.return = fiber, nextEffect = cache4;
|
|
197953
198226
|
else
|
|
197954
198227
|
a:
|
|
197955
198228
|
for (fiber = deletedSubtreeRoot;nextEffect !== null; ) {
|
|
197956
|
-
|
|
197957
|
-
var { sibling, return: returnFiber } =
|
|
197958
|
-
detachFiberAfterEffects(
|
|
197959
|
-
if (
|
|
198229
|
+
cache4 = nextEffect;
|
|
198230
|
+
var { sibling, return: returnFiber } = cache4;
|
|
198231
|
+
detachFiberAfterEffects(cache4);
|
|
198232
|
+
if (cache4 === fiber) {
|
|
197960
198233
|
nextEffect = null;
|
|
197961
198234
|
break a;
|
|
197962
198235
|
}
|
|
@@ -199418,8 +199691,8 @@ Error generating stack: ` + x2.message + `
|
|
|
199418
199691
|
hydrationErrors: null
|
|
199419
199692
|
}, offscreenSubtreeIsHidden = false, offscreenSubtreeWasHidden = false, needsFormReset = false, PossiblyWeakSet = typeof WeakSet === "function" ? WeakSet : Set, nextEffect = null, hostParent = null, hostParentIsContainer = false, currentHoistableRoot = null, suspenseyCommitFlag = 8192, DefaultAsyncDispatcher = {
|
|
199420
199693
|
getCacheForType: function(resourceType) {
|
|
199421
|
-
var
|
|
199422
|
-
cacheForType === undefined && (cacheForType = resourceType(),
|
|
199694
|
+
var cache4 = readContext(CacheContext), cacheForType = cache4.data.get(resourceType);
|
|
199695
|
+
cacheForType === undefined && (cacheForType = resourceType(), cache4.data.set(resourceType, cacheForType));
|
|
199423
199696
|
return cacheForType;
|
|
199424
199697
|
},
|
|
199425
199698
|
cacheSignal: function() {
|
|
@@ -200024,20 +200297,20 @@ var init_engine = __esm(() => {
|
|
|
200024
200297
|
|
|
200025
200298
|
// src/ink/line-width-cache.ts
|
|
200026
200299
|
function lineWidth(line) {
|
|
200027
|
-
const cached2 =
|
|
200300
|
+
const cached2 = cache4.get(line);
|
|
200028
200301
|
if (cached2 !== undefined)
|
|
200029
200302
|
return cached2;
|
|
200030
200303
|
const width = stringWidth(line);
|
|
200031
|
-
if (
|
|
200032
|
-
|
|
200304
|
+
if (cache4.size >= MAX_CACHE_SIZE2) {
|
|
200305
|
+
cache4.clear();
|
|
200033
200306
|
}
|
|
200034
|
-
|
|
200307
|
+
cache4.set(line, width);
|
|
200035
200308
|
return width;
|
|
200036
200309
|
}
|
|
200037
|
-
var
|
|
200310
|
+
var cache4, MAX_CACHE_SIZE2 = 4096;
|
|
200038
200311
|
var init_line_width_cache = __esm(() => {
|
|
200039
200312
|
init_stringWidth();
|
|
200040
|
-
|
|
200313
|
+
cache4 = new Map;
|
|
200041
200314
|
});
|
|
200042
200315
|
|
|
200043
200316
|
// src/ink/measure-text.ts
|
|
@@ -204545,7 +204818,7 @@ var require_range2 = __commonJS((exports, module) => {
|
|
|
204545
204818
|
range = range.replace(BUILDSTRIPRE, "");
|
|
204546
204819
|
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
|
204547
204820
|
const memoKey = memoOpts + ":" + range;
|
|
204548
|
-
const cached2 =
|
|
204821
|
+
const cached2 = cache5.get(memoKey);
|
|
204549
204822
|
if (cached2) {
|
|
204550
204823
|
return cached2;
|
|
204551
204824
|
}
|
|
@@ -204579,7 +204852,7 @@ var require_range2 = __commonJS((exports, module) => {
|
|
|
204579
204852
|
rangeMap.delete("");
|
|
204580
204853
|
}
|
|
204581
204854
|
const result = [...rangeMap.values()];
|
|
204582
|
-
|
|
204855
|
+
cache5.set(memoKey, result);
|
|
204583
204856
|
return result;
|
|
204584
204857
|
}
|
|
204585
204858
|
intersects(range, options) {
|
|
@@ -204617,7 +204890,7 @@ var require_range2 = __commonJS((exports, module) => {
|
|
|
204617
204890
|
}
|
|
204618
204891
|
module.exports = Range;
|
|
204619
204892
|
var LRU = require_lrucache();
|
|
204620
|
-
var
|
|
204893
|
+
var cache5 = new LRU;
|
|
204621
204894
|
var parseOptions = require_parse_options();
|
|
204622
204895
|
var Comparator = require_comparator();
|
|
204623
204896
|
var debug3 = require_debug2();
|
|
@@ -206964,7 +207237,7 @@ var init_Text = __esm(() => {
|
|
|
206964
207237
|
});
|
|
206965
207238
|
|
|
206966
207239
|
// src/ink/components/ErrorOverview.tsx
|
|
206967
|
-
import { readFileSync as
|
|
207240
|
+
import { readFileSync as readFileSync14 } from "fs";
|
|
206968
207241
|
function getStackUtils() {
|
|
206969
207242
|
return stackUtils ??= new import_stack_utils.default({
|
|
206970
207243
|
cwd: process.cwd(),
|
|
@@ -206982,7 +207255,7 @@ function ErrorOverview({
|
|
|
206982
207255
|
let lineWidth2 = 0;
|
|
206983
207256
|
if (filePath && origin2?.line) {
|
|
206984
207257
|
try {
|
|
206985
|
-
const sourceCode =
|
|
207258
|
+
const sourceCode = readFileSync14(filePath, "utf8");
|
|
206986
207259
|
excerpt = dist_default3(sourceCode, origin2.line);
|
|
206987
207260
|
if (excerpt) {
|
|
206988
207261
|
for (const {
|
|
@@ -207798,6 +208071,34 @@ class LogUpdate {
|
|
|
207798
208071
|
const viewportY = growing ? Math.max(0, prev.screen.height - prev.viewport.height + cursorRestoreScroll) : Math.max(prev.screen.height, next.screen.height) - next.viewport.height + cursorRestoreScroll;
|
|
207799
208072
|
let currentStyleId = stylePool.none;
|
|
207800
208073
|
let currentHyperlink = undefined;
|
|
208074
|
+
if (!altScreen && next.screen.damage && prev.screen.height > 0) {
|
|
208075
|
+
const w = next.screen.width;
|
|
208076
|
+
const lastExistingRow = Math.min(prev.screen.height, next.screen.height);
|
|
208077
|
+
for (let y = Math.max(0, viewportY);y < lastExistingRow; y++) {
|
|
208078
|
+
let nextStart = 0;
|
|
208079
|
+
while (nextStart < w && isEmptyCellAt(next.screen, nextStart, y)) {
|
|
208080
|
+
nextStart++;
|
|
208081
|
+
}
|
|
208082
|
+
if (nextStart === 0 || nextStart >= w) {
|
|
208083
|
+
continue;
|
|
208084
|
+
}
|
|
208085
|
+
let prevHasLeading = false;
|
|
208086
|
+
for (let x2 = 0;x2 < nextStart; x2++) {
|
|
208087
|
+
if (!isEmptyCellAt(prev.screen, x2, y)) {
|
|
208088
|
+
prevHasLeading = true;
|
|
208089
|
+
break;
|
|
208090
|
+
}
|
|
208091
|
+
}
|
|
208092
|
+
if (prevHasLeading) {
|
|
208093
|
+
next.screen.damage = unionRect(next.screen.damage, {
|
|
208094
|
+
x: 0,
|
|
208095
|
+
y,
|
|
208096
|
+
width: nextStart,
|
|
208097
|
+
height: 1
|
|
208098
|
+
});
|
|
208099
|
+
}
|
|
208100
|
+
}
|
|
208101
|
+
}
|
|
207801
208102
|
let needsFullReset = false;
|
|
207802
208103
|
let resetTriggerY = -1;
|
|
207803
208104
|
const modifiedRows = new Set;
|
|
@@ -207851,6 +208152,15 @@ class LogUpdate {
|
|
|
207851
208152
|
}
|
|
207852
208153
|
currentStyleId = transitionStyle(screen.diff, stylePool, currentStyleId, stylePool.none);
|
|
207853
208154
|
currentHyperlink = transitionHyperlink(screen.diff, currentHyperlink, undefined);
|
|
208155
|
+
if (!altScreen && prev.screen.height > 0) {
|
|
208156
|
+
const w = next.screen.width;
|
|
208157
|
+
const lastExistingRow = Math.min(prev.screen.height, next.screen.height);
|
|
208158
|
+
for (let y = Math.max(0, viewportY);y < lastExistingRow; y++) {
|
|
208159
|
+
if (!modifiedRows.has(y) && rowContentEnd(prev.screen, y, w) > rowContentEnd(next.screen, y, w)) {
|
|
208160
|
+
modifiedRows.add(y);
|
|
208161
|
+
}
|
|
208162
|
+
}
|
|
208163
|
+
}
|
|
207854
208164
|
if (!altScreen && modifiedRows.size > 0) {
|
|
207855
208165
|
const w = next.screen.width;
|
|
207856
208166
|
for (const y of modifiedRows) {
|
|
@@ -207925,6 +208235,14 @@ function readLine(screen, y) {
|
|
|
207925
208235
|
}
|
|
207926
208236
|
return line.trimEnd();
|
|
207927
208237
|
}
|
|
208238
|
+
function rowContentEnd(screen, y, width) {
|
|
208239
|
+
for (let x2 = width - 1;x2 >= 0; x2--) {
|
|
208240
|
+
if (!isEmptyCellAt(screen, x2, y)) {
|
|
208241
|
+
return x2;
|
|
208242
|
+
}
|
|
208243
|
+
}
|
|
208244
|
+
return -1;
|
|
208245
|
+
}
|
|
207928
208246
|
function fullResetSequence_CAUSES_FLICKER(frame, reason, stylePool, debug3) {
|
|
207929
208247
|
const screen = new VirtualScreen({ x: 0, y: 0 }, frame.viewport.width);
|
|
207930
208248
|
renderFrame(screen, frame, stylePool);
|
|
@@ -208063,6 +208381,7 @@ var CARRIAGE_RETURN, NEWLINE, ERASE_TO_LINE_END = "\x1B[0K";
|
|
|
208063
208381
|
var init_log_update = __esm(() => {
|
|
208064
208382
|
init_build();
|
|
208065
208383
|
init_debug();
|
|
208384
|
+
init_geometry();
|
|
208066
208385
|
init_screen();
|
|
208067
208386
|
init_csi();
|
|
208068
208387
|
init_osc();
|
|
@@ -211699,6 +212018,7 @@ var init_theme = __esm(() => {
|
|
|
211699
212018
|
remember: "rgb(0,0,255)",
|
|
211700
212019
|
background: "rgb(0,153,153)",
|
|
211701
212020
|
success: "rgb(44,122,57)",
|
|
212021
|
+
promptChar: "rgb(44,122,57)",
|
|
211702
212022
|
error: "rgb(171,43,63)",
|
|
211703
212023
|
warning: "rgb(150,108,30)",
|
|
211704
212024
|
merged: "rgb(135,0,255)",
|
|
@@ -211770,6 +212090,7 @@ var init_theme = __esm(() => {
|
|
|
211770
212090
|
remember: "ansi:blue",
|
|
211771
212091
|
background: "ansi:cyan",
|
|
211772
212092
|
success: "ansi:green",
|
|
212093
|
+
promptChar: "ansi:green",
|
|
211773
212094
|
error: "ansi:red",
|
|
211774
212095
|
warning: "ansi:yellow",
|
|
211775
212096
|
merged: "ansi:magenta",
|
|
@@ -211841,6 +212162,7 @@ var init_theme = __esm(() => {
|
|
|
211841
212162
|
remember: "ansi:blueBright",
|
|
211842
212163
|
background: "ansi:cyanBright",
|
|
211843
212164
|
success: "ansi:greenBright",
|
|
212165
|
+
promptChar: "ansi:greenBright",
|
|
211844
212166
|
error: "ansi:redBright",
|
|
211845
212167
|
warning: "ansi:yellowBright",
|
|
211846
212168
|
merged: "ansi:magentaBright",
|
|
@@ -211912,6 +212234,7 @@ var init_theme = __esm(() => {
|
|
|
211912
212234
|
remember: "rgb(51,102,255)",
|
|
211913
212235
|
background: "rgb(0,153,153)",
|
|
211914
212236
|
success: "rgb(0,102,153)",
|
|
212237
|
+
promptChar: "rgb(0,102,153)",
|
|
211915
212238
|
error: "rgb(204,0,0)",
|
|
211916
212239
|
warning: "rgb(255,153,0)",
|
|
211917
212240
|
merged: "rgb(135,0,255)",
|
|
@@ -211983,6 +212306,7 @@ var init_theme = __esm(() => {
|
|
|
211983
212306
|
remember: "rgb(177,185,249)",
|
|
211984
212307
|
background: "rgb(0,204,204)",
|
|
211985
212308
|
success: "rgb(78,186,101)",
|
|
212309
|
+
promptChar: "rgb(0,255,136)",
|
|
211986
212310
|
error: "rgb(255,107,128)",
|
|
211987
212311
|
warning: "rgb(255,193,7)",
|
|
211988
212312
|
merged: "rgb(175,135,255)",
|
|
@@ -212054,6 +212378,7 @@ var init_theme = __esm(() => {
|
|
|
212054
212378
|
remember: "rgb(153,204,255)",
|
|
212055
212379
|
background: "rgb(0,204,204)",
|
|
212056
212380
|
success: "rgb(51,153,255)",
|
|
212381
|
+
promptChar: "rgb(51,153,255)",
|
|
212057
212382
|
error: "rgb(255,102,102)",
|
|
212058
212383
|
warning: "rgb(255,204,0)",
|
|
212059
212384
|
merged: "rgb(175,135,255)",
|
|
@@ -216649,7 +216974,7 @@ function getAttributionHeader(fingerprint) {
|
|
|
216649
216974
|
if (!isAttributionHeaderEnabled()) {
|
|
216650
216975
|
return "";
|
|
216651
216976
|
}
|
|
216652
|
-
const version2 = `${"1.3.
|
|
216977
|
+
const version2 = `${"1.3.445"}.${fingerprint}`;
|
|
216653
216978
|
const entrypoint = process.env.CLAUDE_CODE_ENTRYPOINT ?? "unknown";
|
|
216654
216979
|
const cch = "";
|
|
216655
216980
|
const workload = getWorkload();
|
|
@@ -223918,7 +224243,7 @@ var init_frontmatterParser = __esm(() => {
|
|
|
223918
224243
|
|
|
223919
224244
|
// src/utils/ripgrep.ts
|
|
223920
224245
|
import { execFile as execFile4, spawn as spawn3 } from "child_process";
|
|
223921
|
-
import { existsSync as
|
|
224246
|
+
import { existsSync as existsSync12 } from "fs";
|
|
223922
224247
|
import { homedir as homedir11 } from "os";
|
|
223923
224248
|
import * as path15 from "path";
|
|
223924
224249
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
@@ -224197,7 +224522,7 @@ var init_ripgrep = __esm(() => {
|
|
|
224197
224522
|
}
|
|
224198
224523
|
const rgRoot = path15.resolve(__dirname2, "vendor", "ripgrep");
|
|
224199
224524
|
const command = process.platform === "win32" ? path15.resolve(rgRoot, `${process.arch}-win32`, "rg.exe") : path15.resolve(rgRoot, `${process.arch}-${process.platform}`, "rg");
|
|
224200
|
-
if (!
|
|
224525
|
+
if (!existsSync12(command)) {
|
|
224201
224526
|
const { cmd: systemPath } = findExecutable2("rg", []);
|
|
224202
224527
|
if (systemPath !== "rg") {
|
|
224203
224528
|
return { mode: "system", command: "rg", args: [] };
|
|
@@ -224309,7 +224634,7 @@ var init_pluginOnlyPolicy = __esm(() => {
|
|
|
224309
224634
|
import { statSync as statSync6 } from "fs";
|
|
224310
224635
|
import { lstat as lstat4, readdir as readdir9, readFile as readFile8, realpath as realpath6, stat as stat14 } from "fs/promises";
|
|
224311
224636
|
import { homedir as homedir12 } from "os";
|
|
224312
|
-
import { dirname as dirname20, join as
|
|
224637
|
+
import { dirname as dirname20, join as join38, resolve as resolve16, sep as sep9 } from "path";
|
|
224313
224638
|
function extractDescriptionFromMarkdown(content, defaultDescription = "Custom item") {
|
|
224314
224639
|
const lines = content.split(`
|
|
224315
224640
|
`);
|
|
@@ -224400,7 +224725,7 @@ function getProjectDirsUpToHome(subdir, cwd2) {
|
|
|
224400
224725
|
break;
|
|
224401
224726
|
}
|
|
224402
224727
|
for (const cfgDir of ALL_CONFIG_DIRS) {
|
|
224403
|
-
const configSubdir =
|
|
224728
|
+
const configSubdir = join38(current, cfgDir, subdir);
|
|
224404
224729
|
try {
|
|
224405
224730
|
statSync6(configSubdir);
|
|
224406
224731
|
dirs.push(configSubdir);
|
|
@@ -224448,7 +224773,7 @@ async function findMarkdownFilesNative(dir, signal) {
|
|
|
224448
224773
|
if (signal.aborted) {
|
|
224449
224774
|
break;
|
|
224450
224775
|
}
|
|
224451
|
-
const fullPath =
|
|
224776
|
+
const fullPath = join38(currentDir, entry.name);
|
|
224452
224777
|
try {
|
|
224453
224778
|
if (entry.isSymbolicLink()) {
|
|
224454
224779
|
try {
|
|
@@ -224535,16 +224860,16 @@ var init_markdownConfigLoader = __esm(() => {
|
|
|
224535
224860
|
ALL_CONFIG_DIRS = [".rayu", ".agents"];
|
|
224536
224861
|
loadMarkdownFilesForSubdir = memoize_default(async function(subdir, cwd2) {
|
|
224537
224862
|
const searchStartTime = Date.now();
|
|
224538
|
-
const userDir =
|
|
224539
|
-
const managedDir =
|
|
224863
|
+
const userDir = join38(getRayuConfigHomeDir(), subdir);
|
|
224864
|
+
const managedDir = join38(getManagedFilePath(), ".rayu", subdir);
|
|
224540
224865
|
const projectDirs = getProjectDirsUpToHome(subdir, cwd2);
|
|
224541
224866
|
const gitRoot = findGitRoot(cwd2);
|
|
224542
224867
|
const canonicalRoot = findCanonicalGitRoot(cwd2);
|
|
224543
224868
|
if (gitRoot && canonicalRoot && canonicalRoot !== gitRoot) {
|
|
224544
|
-
const worktreeSubdir = normalizePathForComparison(
|
|
224869
|
+
const worktreeSubdir = normalizePathForComparison(join38(gitRoot, ".rayu", subdir));
|
|
224545
224870
|
const worktreeHasSubdir = projectDirs.some((dir) => normalizePathForComparison(dir) === worktreeSubdir);
|
|
224546
224871
|
if (!worktreeHasSubdir) {
|
|
224547
|
-
const mainRayuSubdir =
|
|
224872
|
+
const mainRayuSubdir = join38(canonicalRoot, ".rayu", subdir);
|
|
224548
224873
|
if (!projectDirs.includes(mainRayuSubdir)) {
|
|
224549
224874
|
projectDirs.push(mainRayuSubdir);
|
|
224550
224875
|
}
|
|
@@ -224753,12 +225078,12 @@ var init_builtinPlugins = __esm(() => {
|
|
|
224753
225078
|
});
|
|
224754
225079
|
|
|
224755
225080
|
// src/utils/plugins/addDirPluginSettings.ts
|
|
224756
|
-
import { join as
|
|
225081
|
+
import { join as join39 } from "path";
|
|
224757
225082
|
function getAddDirEnabledPlugins() {
|
|
224758
225083
|
const result = {};
|
|
224759
225084
|
for (const dir of getAdditionalDirectoriesForClaudeMd()) {
|
|
224760
225085
|
for (const file2 of SETTINGS_FILES) {
|
|
224761
|
-
const { settings } = parseSettingsFile(
|
|
225086
|
+
const { settings } = parseSettingsFile(join39(dir, CONFIG_DIR, file2));
|
|
224762
225087
|
if (!settings?.enabledPlugins) {
|
|
224763
225088
|
continue;
|
|
224764
225089
|
}
|
|
@@ -224771,7 +225096,7 @@ function getAddDirExtraMarketplaces() {
|
|
|
224771
225096
|
const result = {};
|
|
224772
225097
|
for (const dir of getAdditionalDirectoriesForClaudeMd()) {
|
|
224773
225098
|
for (const file2 of SETTINGS_FILES) {
|
|
224774
|
-
const { settings } = parseSettingsFile(
|
|
225099
|
+
const { settings } = parseSettingsFile(join39(dir, CONFIG_DIR, file2));
|
|
224775
225100
|
if (!settings?.extraKnownMarketplaces) {
|
|
224776
225101
|
continue;
|
|
224777
225102
|
}
|
|
@@ -238506,20 +238831,20 @@ var require_tls = __commonJS((exports, module) => {
|
|
|
238506
238831
|
}
|
|
238507
238832
|
return !c3.fail;
|
|
238508
238833
|
};
|
|
238509
|
-
tls2.createSessionCache = function(
|
|
238834
|
+
tls2.createSessionCache = function(cache5, capacity) {
|
|
238510
238835
|
var rval = null;
|
|
238511
|
-
if (
|
|
238512
|
-
rval =
|
|
238836
|
+
if (cache5 && cache5.getSession && cache5.setSession && cache5.order) {
|
|
238837
|
+
rval = cache5;
|
|
238513
238838
|
} else {
|
|
238514
238839
|
rval = {};
|
|
238515
|
-
rval.cache =
|
|
238840
|
+
rval.cache = cache5 || {};
|
|
238516
238841
|
rval.capacity = Math.max(capacity || 100, 1);
|
|
238517
238842
|
rval.order = [];
|
|
238518
|
-
for (var key2 in
|
|
238843
|
+
for (var key2 in cache5) {
|
|
238519
238844
|
if (rval.order.length <= capacity) {
|
|
238520
238845
|
rval.order.push(key2);
|
|
238521
238846
|
} else {
|
|
238522
|
-
delete
|
|
238847
|
+
delete cache5[key2];
|
|
238523
238848
|
}
|
|
238524
238849
|
}
|
|
238525
238850
|
rval.getSession = function(sessionId) {
|
|
@@ -241969,7 +242294,7 @@ import { createServer as createHttpsServer, request as httpsRequest } from "node
|
|
|
241969
242294
|
import { connect as connect3, isIP as isIP5 } from "node:net";
|
|
241970
242295
|
import { unlink as unlink4 } from "node:fs";
|
|
241971
242296
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
241972
|
-
import { join as
|
|
242297
|
+
import { join as join40 } from "node:path";
|
|
241973
242298
|
function looksLikeClientHello(buf) {
|
|
241974
242299
|
return buf.length >= 3 && buf[0] === 22 && buf[1] === 3 && buf[2] <= 3;
|
|
241975
242300
|
}
|
|
@@ -242095,7 +242420,7 @@ async function forwardUpstream(filterRequest, req, res, target) {
|
|
|
242095
242420
|
body.pipe(upstream);
|
|
242096
242421
|
}
|
|
242097
242422
|
function innerSocketPath() {
|
|
242098
|
-
return
|
|
242423
|
+
return join40(tmpdir2(), `srt-tt-${process.pid}-${(sockSeq++).toString(36)}.sock`);
|
|
242099
242424
|
}
|
|
242100
242425
|
var sockSeq = 0;
|
|
242101
242426
|
var init_tls_terminate_proxy = __esm(() => {
|
|
@@ -242801,10 +243126,10 @@ var init_socks_proxy = __esm(() => {
|
|
|
242801
243126
|
});
|
|
242802
243127
|
|
|
242803
243128
|
// node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-ca.js
|
|
242804
|
-
import { mkdtempSync, readFileSync as
|
|
243129
|
+
import { mkdtempSync, readFileSync as readFileSync15, writeFileSync as writeFileSync6 } from "node:fs";
|
|
242805
243130
|
import { rm as rm2 } from "node:fs/promises";
|
|
242806
243131
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
242807
|
-
import { join as
|
|
243132
|
+
import { join as join41, dirname as dirname21 } from "node:path";
|
|
242808
243133
|
function createMitmCA(opts) {
|
|
242809
243134
|
if (opts.caCertPath && opts.caKeyPath) {
|
|
242810
243135
|
return loadCA(opts.caCertPath, opts.caKeyPath);
|
|
@@ -242879,11 +243204,11 @@ function generateEphemeralCA() {
|
|
|
242879
243204
|
cert.sign(keys2.privateKey, md2.sha256.create());
|
|
242880
243205
|
const certPem = pki2.certificateToPem(cert);
|
|
242881
243206
|
const keyPem = pki2.privateKeyToPem(keys2.privateKey);
|
|
242882
|
-
const dir = mkdtempSync(
|
|
242883
|
-
const certPath =
|
|
242884
|
-
const keyPath =
|
|
242885
|
-
|
|
242886
|
-
|
|
243207
|
+
const dir = mkdtempSync(join41(tmpdir3(), "srt-ca-"));
|
|
243208
|
+
const certPath = join41(dir, "ca.crt");
|
|
243209
|
+
const keyPath = join41(dir, "ca.key");
|
|
243210
|
+
writeFileSync6(certPath, certPem, { mode: 420 });
|
|
243211
|
+
writeFileSync6(keyPath, keyPem, { mode: 384 });
|
|
242887
243212
|
logForDebugging5(`[mitm-ca] generated ephemeral CA at ${certPath}`);
|
|
242888
243213
|
return {
|
|
242889
243214
|
certPath,
|
|
@@ -242900,7 +243225,7 @@ function generateEphemeralCA() {
|
|
|
242900
243225
|
function readPem(path16, label, field) {
|
|
242901
243226
|
let pem;
|
|
242902
243227
|
try {
|
|
242903
|
-
pem =
|
|
243228
|
+
pem = readFileSync15(path16, "utf8");
|
|
242904
243229
|
} catch (err) {
|
|
242905
243230
|
const code = err.code ?? String(err);
|
|
242906
243231
|
throw new Error(`${field}: cannot read ${path16} (${code})`);
|
|
@@ -243513,7 +243838,7 @@ var init_sandbox_utils = __esm(() => {
|
|
|
243513
243838
|
});
|
|
243514
243839
|
|
|
243515
243840
|
// node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/generate-seccomp-filter.js
|
|
243516
|
-
import { join as
|
|
243841
|
+
import { join as join43, dirname as dirname23 } from "node:path";
|
|
243517
243842
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
243518
243843
|
import * as fs8 from "node:fs";
|
|
243519
243844
|
import { execSync } from "node:child_process";
|
|
@@ -243529,11 +243854,11 @@ function getGlobalNpmPaths() {
|
|
|
243529
243854
|
stdio: ["pipe", "pipe", "ignore"]
|
|
243530
243855
|
}).trim();
|
|
243531
243856
|
if (npmRoot) {
|
|
243532
|
-
paths2.push(
|
|
243857
|
+
paths2.push(join43(npmRoot, "@anthropic-ai", "sandbox-runtime"));
|
|
243533
243858
|
}
|
|
243534
243859
|
} catch {}
|
|
243535
243860
|
const home = homedir14();
|
|
243536
|
-
paths2.push(
|
|
243861
|
+
paths2.push(join43("/usr", "lib", "node_modules", "@anthropic-ai", "sandbox-runtime"), join43("/usr", "local", "lib", "node_modules", "@anthropic-ai", "sandbox-runtime"), join43("/opt", "homebrew", "lib", "node_modules", "@anthropic-ai", "sandbox-runtime"), join43(home, ".npm", "lib", "node_modules", "@anthropic-ai", "sandbox-runtime"), join43(home, ".npm-global", "lib", "node_modules", "@anthropic-ai", "sandbox-runtime"));
|
|
243537
243862
|
cachedGlobalNpmPaths = paths2;
|
|
243538
243863
|
return paths2;
|
|
243539
243864
|
}
|
|
@@ -243560,11 +243885,11 @@ function getLocalSeccompPaths(filename) {
|
|
|
243560
243885
|
if (!arch)
|
|
243561
243886
|
return [];
|
|
243562
243887
|
const baseDir = dirname23(fileURLToPath4(import.meta.url));
|
|
243563
|
-
const relativePath =
|
|
243888
|
+
const relativePath = join43("vendor", "seccomp", arch, filename);
|
|
243564
243889
|
return [
|
|
243565
|
-
|
|
243566
|
-
|
|
243567
|
-
|
|
243890
|
+
join43(baseDir, relativePath),
|
|
243891
|
+
join43(baseDir, "..", "..", relativePath),
|
|
243892
|
+
join43(baseDir, "..", relativePath)
|
|
243568
243893
|
];
|
|
243569
243894
|
}
|
|
243570
243895
|
function getApplySeccompBinaryPath(seccompBinaryPath) {
|
|
@@ -243597,7 +243922,7 @@ function findApplySeccompPath(seccompBinaryPath) {
|
|
|
243597
243922
|
}
|
|
243598
243923
|
}
|
|
243599
243924
|
for (const globalBase of getGlobalNpmPaths()) {
|
|
243600
|
-
const binaryPath =
|
|
243925
|
+
const binaryPath = join43(globalBase, "vendor", "seccomp", arch, "apply-seccomp");
|
|
243601
243926
|
if (fs8.existsSync(binaryPath)) {
|
|
243602
243927
|
logForDebugging5(`[SeccompFilter] Found apply-seccomp binary in global install: ${binaryPath} (${arch})`);
|
|
243603
243928
|
return binaryPath;
|
|
@@ -243616,7 +243941,7 @@ import { randomBytes as randomBytes2 } from "node:crypto";
|
|
|
243616
243941
|
import * as fs9 from "fs";
|
|
243617
243942
|
import { spawn as spawn5 } from "node:child_process";
|
|
243618
243943
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
243619
|
-
import path17, { join as
|
|
243944
|
+
import path17, { join as join44 } from "node:path";
|
|
243620
243945
|
function findSymlinkInPath(targetPath, allowedWritePaths) {
|
|
243621
243946
|
const parts = targetPath.split(path17.sep);
|
|
243622
243947
|
let currentPath = "";
|
|
@@ -243815,8 +244140,8 @@ function checkLinuxDependencies(opts) {
|
|
|
243815
244140
|
async function initializeLinuxNetworkBridge(httpProxyPort, socksProxyPort, socatPath) {
|
|
243816
244141
|
const socat = socatPath ?? "socat";
|
|
243817
244142
|
const socketId = randomBytes2(8).toString("hex");
|
|
243818
|
-
const httpSocketPath =
|
|
243819
|
-
const socksSocketPath =
|
|
244143
|
+
const httpSocketPath = join44(tmpdir4(), `claude-http-${socketId}.sock`);
|
|
244144
|
+
const socksSocketPath = join44(tmpdir4(), `claude-socks-${socketId}.sock`);
|
|
243820
244145
|
const httpSocatArgs = [
|
|
243821
244146
|
`UNIX-LISTEN:${httpSocketPath},fork,reuseaddr`,
|
|
243822
244147
|
`TCP:localhost:${httpProxyPort},keepalive,keepidle=10,keepintvl=5,keepcnt=3`
|
|
@@ -249491,9 +249816,9 @@ __export(exports_sandbox_adapter, {
|
|
|
249491
249816
|
SandboxRuntimeConfigSchema: () => SandboxRuntimeConfigSchema,
|
|
249492
249817
|
SandboxManager: () => SandboxManager2
|
|
249493
249818
|
});
|
|
249494
|
-
import { rmSync as
|
|
249819
|
+
import { rmSync as rmSync6, statSync as statSync8 } from "fs";
|
|
249495
249820
|
import { readFile as readFile9 } from "fs/promises";
|
|
249496
|
-
import { join as
|
|
249821
|
+
import { join as join45, resolve as resolve19, sep as sep10 } from "path";
|
|
249497
249822
|
function permissionRuleValueFromString2(ruleString) {
|
|
249498
249823
|
const matches = ruleString.match(/^([^(]+)\(([^)]+)\)$/);
|
|
249499
249824
|
if (!matches) {
|
|
@@ -249669,13 +249994,13 @@ function convertToSandboxRuntimeConfig(settings) {
|
|
|
249669
249994
|
function scrubBareGitRepoFiles() {
|
|
249670
249995
|
for (const p of bareGitRepoScrubPaths) {
|
|
249671
249996
|
try {
|
|
249672
|
-
|
|
249997
|
+
rmSync6(p, { recursive: true });
|
|
249673
249998
|
logForDebugging(`[Sandbox] scrubbed planted bare-repo file: ${p}`);
|
|
249674
249999
|
} catch {}
|
|
249675
250000
|
}
|
|
249676
250001
|
}
|
|
249677
250002
|
async function detectWorktreeMainRepoPath(cwd2) {
|
|
249678
|
-
const gitPath =
|
|
250003
|
+
const gitPath = join45(cwd2, ".git");
|
|
249679
250004
|
try {
|
|
249680
250005
|
const gitContent = await readFile9(gitPath, { encoding: "utf8" });
|
|
249681
250006
|
const gitdirMatch = gitContent.match(/^gitdir:\s*(.+)$/m);
|
|
@@ -251553,9 +251878,9 @@ var init_pathValidation = __esm(() => {
|
|
|
251553
251878
|
});
|
|
251554
251879
|
|
|
251555
251880
|
// src/utils/plugins/pluginDirectories.ts
|
|
251556
|
-
import { mkdirSync as
|
|
251881
|
+
import { mkdirSync as mkdirSync8 } from "fs";
|
|
251557
251882
|
import { readdir as readdir10, rm as rm3, stat as stat15 } from "fs/promises";
|
|
251558
|
-
import { delimiter as delimiter2, join as
|
|
251883
|
+
import { delimiter as delimiter2, join as join46 } from "path";
|
|
251559
251884
|
function getPluginsDirectoryName() {
|
|
251560
251885
|
if (getUseCoworkPlugins()) {
|
|
251561
251886
|
return COWORK_PLUGINS_DIR;
|
|
@@ -251570,7 +251895,7 @@ function getPluginsDirectory() {
|
|
|
251570
251895
|
if (envOverride) {
|
|
251571
251896
|
return expandTilde(envOverride);
|
|
251572
251897
|
}
|
|
251573
|
-
return
|
|
251898
|
+
return join46(getRayuConfigHomeDir(), getPluginsDirectoryName());
|
|
251574
251899
|
}
|
|
251575
251900
|
function getPluginSeedDirs() {
|
|
251576
251901
|
const raw = process.env.CLAUDE_CODE_PLUGIN_SEED_DIR;
|
|
@@ -251582,11 +251907,11 @@ function sanitizePluginId(pluginId) {
|
|
|
251582
251907
|
return pluginId.replace(/[^a-zA-Z0-9\-_]/g, "-");
|
|
251583
251908
|
}
|
|
251584
251909
|
function pluginDataDirPath(pluginId) {
|
|
251585
|
-
return
|
|
251910
|
+
return join46(getPluginsDirectory(), "data", sanitizePluginId(pluginId));
|
|
251586
251911
|
}
|
|
251587
251912
|
function getPluginDataDir(pluginId) {
|
|
251588
251913
|
const dir = pluginDataDirPath(pluginId);
|
|
251589
|
-
|
|
251914
|
+
mkdirSync8(dir, { recursive: true });
|
|
251590
251915
|
return dir;
|
|
251591
251916
|
}
|
|
251592
251917
|
async function getPluginDataDirSize(pluginId) {
|
|
@@ -251594,7 +251919,7 @@ async function getPluginDataDirSize(pluginId) {
|
|
|
251594
251919
|
let bytes = 0;
|
|
251595
251920
|
const walk2 = async (p) => {
|
|
251596
251921
|
for (const entry of await readdir10(p, { withFileTypes: true })) {
|
|
251597
|
-
const full =
|
|
251922
|
+
const full = join46(p, entry.name);
|
|
251598
251923
|
if (entry.isDirectory()) {
|
|
251599
251924
|
await walk2(full);
|
|
251600
251925
|
} else {
|
|
@@ -252098,11 +252423,11 @@ var init_macOsKeychainStorage = __esm(() => {
|
|
|
252098
252423
|
|
|
252099
252424
|
// src/utils/secureStorage/plainTextStorage.ts
|
|
252100
252425
|
import { chmodSync as chmodSync4 } from "fs";
|
|
252101
|
-
import { join as
|
|
252426
|
+
import { join as join47 } from "path";
|
|
252102
252427
|
function getStoragePath() {
|
|
252103
252428
|
const storageDir = getRayuConfigHomeDir();
|
|
252104
252429
|
const storageFileName = ".credentials.json";
|
|
252105
|
-
return { storageDir, storagePath:
|
|
252430
|
+
return { storageDir, storagePath: join47(storageDir, storageFileName) };
|
|
252106
252431
|
}
|
|
252107
252432
|
var plainTextStorage;
|
|
252108
252433
|
var init_plainTextStorage = __esm(() => {
|
|
@@ -259929,13 +260254,13 @@ var init_constants6 = __esm(() => {
|
|
|
259929
260254
|
});
|
|
259930
260255
|
|
|
259931
260256
|
// node_modules/@anthropic-ai/mcpb/dist/cli/init.js
|
|
259932
|
-
import { existsSync as
|
|
259933
|
-
import { basename as basename11, join as
|
|
260257
|
+
import { existsSync as existsSync16, readFileSync as readFileSync17, writeFileSync as writeFileSync7 } from "fs";
|
|
260258
|
+
import { basename as basename11, join as join48, resolve as resolve21 } from "path";
|
|
259934
260259
|
function readPackageJson(dirPath) {
|
|
259935
|
-
const packageJsonPath =
|
|
259936
|
-
if (
|
|
260260
|
+
const packageJsonPath = join48(dirPath, "package.json");
|
|
260261
|
+
if (existsSync16(packageJsonPath)) {
|
|
259937
260262
|
try {
|
|
259938
|
-
return JSON.parse(
|
|
260263
|
+
return JSON.parse(readFileSync17(packageJsonPath, "utf-8"));
|
|
259939
260264
|
} catch (e2) {}
|
|
259940
260265
|
}
|
|
259941
260266
|
return {};
|
|
@@ -260622,8 +260947,8 @@ Next steps:`);
|
|
|
260622
260947
|
}
|
|
260623
260948
|
async function initExtension(targetPath = process.cwd(), nonInteractive = false) {
|
|
260624
260949
|
const resolvedPath = resolve21(targetPath);
|
|
260625
|
-
const manifestPath =
|
|
260626
|
-
if (
|
|
260950
|
+
const manifestPath = join48(resolvedPath, "manifest.json");
|
|
260951
|
+
if (existsSync16(manifestPath)) {
|
|
260627
260952
|
if (nonInteractive) {
|
|
260628
260953
|
console.log("manifest.json already exists. Use --force to overwrite in non-interactive mode.");
|
|
260629
260954
|
return false;
|
|
@@ -260658,7 +260983,7 @@ async function initExtension(targetPath = process.cwd(), nonInteractive = false)
|
|
|
260658
260983
|
const userConfig = nonInteractive ? {} : await promptUserConfig();
|
|
260659
260984
|
const optionalFields = nonInteractive ? getDefaultOptionalFields(packageData) : await promptOptionalFields(packageData);
|
|
260660
260985
|
const manifest = buildManifest(basicInfo, longDescription, authorInfo, urls, visualAssets, serverConfig, toolsData.tools, toolsData.toolsGenerated, promptsData.prompts, promptsData.promptsGenerated, compatibility, userConfig, optionalFields);
|
|
260661
|
-
|
|
260986
|
+
writeFileSync7(manifestPath, JSON.stringify(manifest, null, 2) + `
|
|
260662
260987
|
`);
|
|
260663
260988
|
console.log(`
|
|
260664
260989
|
Created manifest.json at ${manifestPath}`);
|
|
@@ -262903,15 +263228,15 @@ var init_esm8 = __esm(() => {
|
|
|
262903
263228
|
});
|
|
262904
263229
|
|
|
262905
263230
|
// node_modules/@anthropic-ai/mcpb/dist/node/files.js
|
|
262906
|
-
import { existsSync as
|
|
262907
|
-
import { join as
|
|
263231
|
+
import { existsSync as existsSync17, readdirSync as readdirSync4, readFileSync as readFileSync18, statSync as statSync9 } from "fs";
|
|
263232
|
+
import { join as join49, relative as relative6, sep as sep11 } from "path";
|
|
262908
263233
|
function readMcpbIgnorePatterns(baseDir) {
|
|
262909
|
-
const mcpbIgnorePath =
|
|
262910
|
-
if (!
|
|
263234
|
+
const mcpbIgnorePath = join49(baseDir, ".mcpbignore");
|
|
263235
|
+
if (!existsSync17(mcpbIgnorePath)) {
|
|
262911
263236
|
return [];
|
|
262912
263237
|
}
|
|
262913
263238
|
try {
|
|
262914
|
-
const content =
|
|
263239
|
+
const content = readFileSync18(mcpbIgnorePath, "utf-8");
|
|
262915
263240
|
return content.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
262916
263241
|
} catch (error54) {
|
|
262917
263242
|
console.warn(`Warning: Could not read .mcpbignore file: ${error54 instanceof Error ? error54.message : "Unknown error"}`);
|
|
@@ -262928,7 +263253,7 @@ function getAllFiles(dirPath, baseDir = dirPath, fileList = {}, additionalPatter
|
|
|
262928
263253
|
const files = readdirSync4(dirPath);
|
|
262929
263254
|
const ignoreChecker = buildIgnoreChecker(additionalPatterns);
|
|
262930
263255
|
for (const file2 of files) {
|
|
262931
|
-
const filePath =
|
|
263256
|
+
const filePath = join49(dirPath, file2);
|
|
262932
263257
|
const relativePath = relative6(baseDir, filePath);
|
|
262933
263258
|
if (ignoreChecker.ignores(relativePath)) {
|
|
262934
263259
|
continue;
|
|
@@ -262938,7 +263263,7 @@ function getAllFiles(dirPath, baseDir = dirPath, fileList = {}, additionalPatter
|
|
|
262938
263263
|
getAllFiles(filePath, baseDir, fileList, additionalPatterns);
|
|
262939
263264
|
} else {
|
|
262940
263265
|
const zipPath = relativePath.split(sep11).join("/");
|
|
262941
|
-
fileList[zipPath] =
|
|
263266
|
+
fileList[zipPath] = readFileSync18(filePath);
|
|
262942
263267
|
}
|
|
262943
263268
|
}
|
|
262944
263269
|
return fileList;
|
|
@@ -262947,7 +263272,7 @@ function getAllFilesWithCount(dirPath, baseDir = dirPath, fileList = {}, additio
|
|
|
262947
263272
|
const files = readdirSync4(dirPath);
|
|
262948
263273
|
const ignoreChecker = buildIgnoreChecker(additionalPatterns);
|
|
262949
263274
|
for (const file2 of files) {
|
|
262950
|
-
const filePath =
|
|
263275
|
+
const filePath = join49(dirPath, file2);
|
|
262951
263276
|
const relativePath = relative6(baseDir, filePath);
|
|
262952
263277
|
if (ignoreChecker.ignores(relativePath)) {
|
|
262953
263278
|
ignoredCount++;
|
|
@@ -262960,7 +263285,7 @@ function getAllFilesWithCount(dirPath, baseDir = dirPath, fileList = {}, additio
|
|
|
262960
263285
|
} else {
|
|
262961
263286
|
const zipPath = relativePath.split(sep11).join("/");
|
|
262962
263287
|
fileList[zipPath] = {
|
|
262963
|
-
data:
|
|
263288
|
+
data: readFileSync18(filePath),
|
|
262964
263289
|
mode: stat16.mode
|
|
262965
263290
|
};
|
|
262966
263291
|
}
|
|
@@ -264426,7 +264751,7 @@ var require_jsonfile = __commonJS((exports, module) => {
|
|
|
264426
264751
|
return obj;
|
|
264427
264752
|
}
|
|
264428
264753
|
var readFile10 = universalify.fromPromise(_readFile);
|
|
264429
|
-
function
|
|
264754
|
+
function readFileSync19(file2, options = {}) {
|
|
264430
264755
|
if (typeof options === "string") {
|
|
264431
264756
|
options = { encoding: options };
|
|
264432
264757
|
}
|
|
@@ -264451,16 +264776,16 @@ var require_jsonfile = __commonJS((exports, module) => {
|
|
|
264451
264776
|
await universalify.fromCallback(fs11.writeFile)(file2, str2, options);
|
|
264452
264777
|
}
|
|
264453
264778
|
var writeFile4 = universalify.fromPromise(_writeFile);
|
|
264454
|
-
function
|
|
264779
|
+
function writeFileSync8(file2, obj, options = {}) {
|
|
264455
264780
|
const fs11 = options.fs || _fs;
|
|
264456
264781
|
const str2 = stringify3(obj, options);
|
|
264457
264782
|
return fs11.writeFileSync(file2, str2, options);
|
|
264458
264783
|
}
|
|
264459
264784
|
module.exports = {
|
|
264460
264785
|
readFile: readFile10,
|
|
264461
|
-
readFileSync:
|
|
264786
|
+
readFileSync: readFileSync19,
|
|
264462
264787
|
writeFile: writeFile4,
|
|
264463
|
-
writeFileSync:
|
|
264788
|
+
writeFileSync: writeFileSync8
|
|
264464
264789
|
};
|
|
264465
264790
|
});
|
|
264466
264791
|
|
|
@@ -265168,16 +265493,16 @@ var require_pretty_bytes = __commonJS((exports, module) => {
|
|
|
265168
265493
|
|
|
265169
265494
|
// node_modules/@anthropic-ai/mcpb/dist/node/sign.js
|
|
265170
265495
|
import { execFile as execFile5 } from "child_process";
|
|
265171
|
-
import { readFileSync as
|
|
265496
|
+
import { readFileSync as readFileSync19, writeFileSync as writeFileSync8 } from "fs";
|
|
265172
265497
|
import { mkdtemp, rm as rm4, writeFile as writeFile4 } from "fs/promises";
|
|
265173
265498
|
import { tmpdir as tmpdir5 } from "os";
|
|
265174
|
-
import { join as
|
|
265499
|
+
import { join as join50 } from "path";
|
|
265175
265500
|
import { promisify as promisify6 } from "util";
|
|
265176
265501
|
function signMcpbFile(mcpbPath, certPath, keyPath, intermediates) {
|
|
265177
|
-
const mcpbContent =
|
|
265178
|
-
const certificatePem =
|
|
265179
|
-
const privateKeyPem =
|
|
265180
|
-
const intermediatePems = intermediates?.map((path19) =>
|
|
265502
|
+
const mcpbContent = readFileSync19(mcpbPath);
|
|
265503
|
+
const certificatePem = readFileSync19(certPath, "utf-8");
|
|
265504
|
+
const privateKeyPem = readFileSync19(keyPath, "utf-8");
|
|
265505
|
+
const intermediatePems = intermediates?.map((path19) => readFileSync19(path19, "utf-8"));
|
|
265181
265506
|
const p7 = import_node_forge3.default.pkcs7.createSignedData();
|
|
265182
265507
|
p7.content = import_node_forge3.default.util.createBuffer(mcpbContent);
|
|
265183
265508
|
const signingCert = import_node_forge3.default.pki.certificateFromPem(certificatePem);
|
|
@@ -265210,11 +265535,11 @@ function signMcpbFile(mcpbPath, certPath, keyPath, intermediates) {
|
|
|
265210
265535
|
const pkcs7Signature = Buffer.from(asn1.getBytes(), "binary");
|
|
265211
265536
|
const signatureBlock = createSignatureBlock(pkcs7Signature);
|
|
265212
265537
|
const signedContent = Buffer.concat([mcpbContent, signatureBlock]);
|
|
265213
|
-
|
|
265538
|
+
writeFileSync8(mcpbPath, signedContent);
|
|
265214
265539
|
}
|
|
265215
265540
|
async function verifyMcpbFile(mcpbPath) {
|
|
265216
265541
|
try {
|
|
265217
|
-
const fileContent =
|
|
265542
|
+
const fileContent = readFileSync19(mcpbPath);
|
|
265218
265543
|
const { originalContent, pkcs7Signature } = extractSignatureBlock(fileContent);
|
|
265219
265544
|
if (!pkcs7Signature) {
|
|
265220
265545
|
return { status: "unsigned" };
|
|
@@ -265316,8 +265641,8 @@ function extractSignatureBlock(fileContent) {
|
|
|
265316
265641
|
async function verifyCertificateChain(certificate, intermediates) {
|
|
265317
265642
|
let tempDir = null;
|
|
265318
265643
|
try {
|
|
265319
|
-
tempDir = await mkdtemp(
|
|
265320
|
-
const certChainPath =
|
|
265644
|
+
tempDir = await mkdtemp(join50(tmpdir5(), "mcpb-verify-"));
|
|
265645
|
+
const certChainPath = join50(tempDir, "chain.pem");
|
|
265321
265646
|
const certChain = [certificate, ...intermediates || []].join(`
|
|
265322
265647
|
`);
|
|
265323
265648
|
await writeFile4(certChainPath, certChain);
|
|
@@ -265407,9 +265732,9 @@ async function verifyCertificateChain(certificate, intermediates) {
|
|
|
265407
265732
|
}
|
|
265408
265733
|
}
|
|
265409
265734
|
function unsignMcpbFile(mcpbPath) {
|
|
265410
|
-
const fileContent =
|
|
265735
|
+
const fileContent = readFileSync19(mcpbPath);
|
|
265411
265736
|
const { originalContent } = extractSignatureBlock(fileContent);
|
|
265412
|
-
|
|
265737
|
+
writeFileSync8(mcpbPath, originalContent);
|
|
265413
265738
|
}
|
|
265414
265739
|
var import_node_forge3, SIGNATURE_HEADER2 = "MCPB_SIG_V1", SIGNATURE_FOOTER = "MCPB_SIG_END", execFileAsync3;
|
|
265415
265740
|
var init_sign = __esm(() => {
|
|
@@ -265449,21 +265774,21 @@ function getLogger({ silent = false } = {}) {
|
|
|
265449
265774
|
}
|
|
265450
265775
|
|
|
265451
265776
|
// node_modules/@anthropic-ai/mcpb/dist/cli/unpack.js
|
|
265452
|
-
import { chmodSync as chmodSync5, existsSync as
|
|
265453
|
-
import { join as
|
|
265777
|
+
import { chmodSync as chmodSync5, existsSync as existsSync18, mkdirSync as mkdirSync9, readFileSync as readFileSync20, writeFileSync as writeFileSync9 } from "fs";
|
|
265778
|
+
import { join as join51, resolve as resolve22, sep as sep12 } from "path";
|
|
265454
265779
|
async function unpackExtension({ mcpbPath, outputDir, silent }) {
|
|
265455
265780
|
const logger = getLogger({ silent });
|
|
265456
265781
|
const resolvedMcpbPath = resolve22(mcpbPath);
|
|
265457
|
-
if (!
|
|
265782
|
+
if (!existsSync18(resolvedMcpbPath)) {
|
|
265458
265783
|
logger.error(`ERROR: MCPB file not found: ${mcpbPath}`);
|
|
265459
265784
|
return false;
|
|
265460
265785
|
}
|
|
265461
265786
|
const finalOutputDir = outputDir ? resolve22(outputDir) : process.cwd();
|
|
265462
|
-
if (!
|
|
265463
|
-
|
|
265787
|
+
if (!existsSync18(finalOutputDir)) {
|
|
265788
|
+
mkdirSync9(finalOutputDir, { recursive: true });
|
|
265464
265789
|
}
|
|
265465
265790
|
try {
|
|
265466
|
-
const fileContent =
|
|
265791
|
+
const fileContent = readFileSync20(resolvedMcpbPath);
|
|
265467
265792
|
const { originalContent } = extractSignatureBlock(fileContent);
|
|
265468
265793
|
const fileAttributes = new Map;
|
|
265469
265794
|
const isUnix = process.platform !== "win32";
|
|
@@ -265502,17 +265827,17 @@ async function unpackExtension({ mcpbPath, outputDir, silent }) {
|
|
|
265502
265827
|
for (const relativePath in decompressed) {
|
|
265503
265828
|
if (Object.prototype.hasOwnProperty.call(decompressed, relativePath)) {
|
|
265504
265829
|
const data = decompressed[relativePath];
|
|
265505
|
-
const fullPath =
|
|
265830
|
+
const fullPath = join51(finalOutputDir, relativePath);
|
|
265506
265831
|
const normalizedPath = resolve22(fullPath);
|
|
265507
265832
|
const normalizedOutputDir = resolve22(finalOutputDir);
|
|
265508
265833
|
if (!normalizedPath.startsWith(normalizedOutputDir + sep12) && normalizedPath !== normalizedOutputDir) {
|
|
265509
265834
|
throw new Error(`Path traversal attempt detected: ${relativePath}`);
|
|
265510
265835
|
}
|
|
265511
|
-
const dir =
|
|
265512
|
-
if (!
|
|
265513
|
-
|
|
265836
|
+
const dir = join51(fullPath, "..");
|
|
265837
|
+
if (!existsSync18(dir)) {
|
|
265838
|
+
mkdirSync9(dir, { recursive: true });
|
|
265514
265839
|
}
|
|
265515
|
-
|
|
265840
|
+
writeFileSync9(fullPath, data);
|
|
265516
265841
|
if (isUnix && fileAttributes.has(relativePath)) {
|
|
265517
265842
|
try {
|
|
265518
265843
|
const mode = fileAttributes.get(relativePath);
|
|
@@ -265554,10 +265879,10 @@ var init_manifestVersionResolve = __esm(() => {
|
|
|
265554
265879
|
});
|
|
265555
265880
|
|
|
265556
265881
|
// node_modules/@anthropic-ai/mcpb/dist/node/validate.js
|
|
265557
|
-
import { existsSync as
|
|
265882
|
+
import { existsSync as existsSync19, readFileSync as readFileSync21, statSync as statSync10 } from "fs";
|
|
265558
265883
|
import * as fs11 from "fs/promises";
|
|
265559
265884
|
import * as os4 from "os";
|
|
265560
|
-
import { dirname as dirname26, isAbsolute as isAbsolute12, join as
|
|
265885
|
+
import { dirname as dirname26, isAbsolute as isAbsolute12, join as join52, resolve as resolve23 } from "path";
|
|
265561
265886
|
function isPNG(buffer) {
|
|
265562
265887
|
return buffer.length >= 8 && buffer[0] === 137 && buffer[1] === 80 && buffer[2] === 78 && buffer[3] === 71 && buffer[4] === 13 && buffer[5] === 10 && buffer[6] === 26 && buffer[7] === 10;
|
|
265563
265888
|
}
|
|
@@ -265577,12 +265902,12 @@ function validateIcon(iconPath, baseDir) {
|
|
|
265577
265902
|
errors6.push("Icon path must be relative to the bundle root, not an absolute path. " + `Found: "${iconPath}"`);
|
|
265578
265903
|
}
|
|
265579
265904
|
if (!isRemoteUrl && !isAbsolutePath && !hasVariableSubstitution) {
|
|
265580
|
-
const fullIconPath =
|
|
265581
|
-
if (!
|
|
265905
|
+
const fullIconPath = join52(baseDir, iconPath);
|
|
265906
|
+
if (!existsSync19(fullIconPath)) {
|
|
265582
265907
|
errors6.push(`Icon file not found at path: ${iconPath}`);
|
|
265583
265908
|
} else {
|
|
265584
265909
|
try {
|
|
265585
|
-
const buffer =
|
|
265910
|
+
const buffer = readFileSync21(fullIconPath);
|
|
265586
265911
|
if (!isPNG(buffer)) {
|
|
265587
265912
|
errors6.push(`Icon file must be PNG format. The file at "${iconPath}" does not appear to be a valid PNG file.`);
|
|
265588
265913
|
} else {
|
|
@@ -265603,10 +265928,10 @@ function validateManifest(inputPath) {
|
|
|
265603
265928
|
try {
|
|
265604
265929
|
const resolvedPath = resolve23(inputPath);
|
|
265605
265930
|
let manifestPath = resolvedPath;
|
|
265606
|
-
if (
|
|
265607
|
-
manifestPath =
|
|
265931
|
+
if (existsSync19(resolvedPath) && statSync10(resolvedPath).isDirectory()) {
|
|
265932
|
+
manifestPath = join52(resolvedPath, "manifest.json");
|
|
265608
265933
|
}
|
|
265609
|
-
const manifestContent =
|
|
265934
|
+
const manifestContent = readFileSync21(manifestPath, "utf-8");
|
|
265610
265935
|
const manifestData = JSON.parse(manifestContent);
|
|
265611
265936
|
const manifestVersion = getManifestVersionFromRawData(manifestData);
|
|
265612
265937
|
if (!manifestVersion) {
|
|
@@ -265651,7 +265976,7 @@ Icon validation warnings:
|
|
|
265651
265976
|
if (error54 instanceof Error) {
|
|
265652
265977
|
if (error54.message.includes("ENOENT")) {
|
|
265653
265978
|
console.error(`ERROR: File not found: ${inputPath}`);
|
|
265654
|
-
if (
|
|
265979
|
+
if (existsSync19(resolve23(inputPath)) && statSync10(resolve23(inputPath)).isDirectory()) {
|
|
265655
265980
|
console.error(` (No manifest.json found in directory)`);
|
|
265656
265981
|
}
|
|
265657
265982
|
} else if (error54.message.includes("JSON")) {
|
|
@@ -265692,7 +266017,7 @@ async function cleanMcpb(inputPath) {
|
|
|
265692
266017
|
console.log(" -- Manifest already valid per MCPB schema");
|
|
265693
266018
|
}
|
|
265694
266019
|
const nodeModulesPath = resolve23(unpackPath, "node_modules");
|
|
265695
|
-
if (
|
|
266020
|
+
if (existsSync19(nodeModulesPath)) {
|
|
265696
266021
|
console.log(" -- node_modules found, deleting development dependencies");
|
|
265697
266022
|
const destroyer = new import_galactus.DestroyerOfModules({
|
|
265698
266023
|
rootDirectory: unpackPath
|
|
@@ -265744,8 +266069,8 @@ __export(exports_pack, {
|
|
|
265744
266069
|
packExtension: () => packExtension
|
|
265745
266070
|
});
|
|
265746
266071
|
import { createHash as createHash5 } from "crypto";
|
|
265747
|
-
import { existsSync as
|
|
265748
|
-
import { basename as basename12, join as
|
|
266072
|
+
import { existsSync as existsSync20, mkdirSync as mkdirSync10, readFileSync as readFileSync22, statSync as statSync11, writeFileSync as writeFileSync10 } from "fs";
|
|
266073
|
+
import { basename as basename12, join as join53, relative as relative7, resolve as resolve24, sep as sep13 } from "path";
|
|
265749
266074
|
function formatFileSize2(bytes) {
|
|
265750
266075
|
if (bytes < 1024) {
|
|
265751
266076
|
return `${bytes}B`;
|
|
@@ -265761,12 +266086,12 @@ function sanitizeNameForFilename(name) {
|
|
|
265761
266086
|
async function packExtension({ extensionPath, outputPath, silent }) {
|
|
265762
266087
|
const resolvedPath = resolve24(extensionPath);
|
|
265763
266088
|
const logger = getLogger({ silent });
|
|
265764
|
-
if (!
|
|
266089
|
+
if (!existsSync20(resolvedPath) || !statSync11(resolvedPath).isDirectory()) {
|
|
265765
266090
|
logger.error(`ERROR: Directory not found: ${extensionPath}`);
|
|
265766
266091
|
return false;
|
|
265767
266092
|
}
|
|
265768
|
-
const manifestPath =
|
|
265769
|
-
if (!
|
|
266093
|
+
const manifestPath = join53(resolvedPath, "manifest.json");
|
|
266094
|
+
if (!existsSync20(manifestPath)) {
|
|
265770
266095
|
logger.log(`No manifest.json found in ${extensionPath}`);
|
|
265771
266096
|
const shouldInit = await esm_default2({
|
|
265772
266097
|
message: "Would you like to create a manifest.json file?",
|
|
@@ -265790,7 +266115,7 @@ async function packExtension({ extensionPath, outputPath, silent }) {
|
|
|
265790
266115
|
}
|
|
265791
266116
|
let manifest;
|
|
265792
266117
|
try {
|
|
265793
|
-
const manifestContent =
|
|
266118
|
+
const manifestContent = readFileSync22(manifestPath, "utf-8");
|
|
265794
266119
|
const manifestData = JSON.parse(manifestContent);
|
|
265795
266120
|
const manifestVersion = getManifestVersionFromRawData(manifestData);
|
|
265796
266121
|
if (!manifestVersion) {
|
|
@@ -265808,8 +266133,8 @@ async function packExtension({ extensionPath, outputPath, silent }) {
|
|
|
265808
266133
|
}
|
|
265809
266134
|
const extensionName = basename12(resolvedPath);
|
|
265810
266135
|
const finalOutputPath = outputPath ? resolve24(outputPath) : resolve24(`${extensionName}.mcpb`);
|
|
265811
|
-
const outputDir =
|
|
265812
|
-
|
|
266136
|
+
const outputDir = join53(finalOutputPath, "..");
|
|
266137
|
+
mkdirSync10(outputDir, { recursive: true });
|
|
265813
266138
|
try {
|
|
265814
266139
|
const mcpbIgnorePatterns = readMcpbIgnorePatterns(resolvedPath);
|
|
265815
266140
|
const { files, ignoredCount } = getAllFilesWithCount(resolvedPath, resolvedPath, {}, mcpbIgnorePatterns);
|
|
@@ -265867,7 +266192,7 @@ async function packExtension({ extensionPath, outputPath, silent }) {
|
|
|
265867
266192
|
level: 9,
|
|
265868
266193
|
mtime: new Date
|
|
265869
266194
|
});
|
|
265870
|
-
|
|
266195
|
+
writeFileSync10(finalOutputPath, zipData);
|
|
265871
266196
|
const shasum = createHash5("sha1").update(zipData).digest("hex");
|
|
265872
266197
|
const sanitizedName = sanitizeNameForFilename(manifest.name);
|
|
265873
266198
|
const archiveName = `${sanitizedName}-${manifest.version}.mcpb`;
|
|
@@ -266285,25 +266610,25 @@ var init_zip = __esm(() => {
|
|
|
266285
266610
|
|
|
266286
266611
|
// src/utils/systemDirectories.ts
|
|
266287
266612
|
import { homedir as homedir16 } from "os";
|
|
266288
|
-
import { join as
|
|
266613
|
+
import { join as join54 } from "path";
|
|
266289
266614
|
function getSystemDirectories(options) {
|
|
266290
266615
|
const platform2 = options?.platform ?? getPlatform();
|
|
266291
266616
|
const homeDir = options?.homedir ?? homedir16();
|
|
266292
266617
|
const env7 = options?.env ?? process.env;
|
|
266293
266618
|
const defaults4 = {
|
|
266294
266619
|
HOME: homeDir,
|
|
266295
|
-
DESKTOP:
|
|
266296
|
-
DOCUMENTS:
|
|
266297
|
-
DOWNLOADS:
|
|
266620
|
+
DESKTOP: join54(homeDir, "Desktop"),
|
|
266621
|
+
DOCUMENTS: join54(homeDir, "Documents"),
|
|
266622
|
+
DOWNLOADS: join54(homeDir, "Downloads")
|
|
266298
266623
|
};
|
|
266299
266624
|
switch (platform2) {
|
|
266300
266625
|
case "windows": {
|
|
266301
266626
|
const userProfile = env7.USERPROFILE || homeDir;
|
|
266302
266627
|
return {
|
|
266303
266628
|
HOME: homeDir,
|
|
266304
|
-
DESKTOP:
|
|
266305
|
-
DOCUMENTS:
|
|
266306
|
-
DOWNLOADS:
|
|
266629
|
+
DESKTOP: join54(userProfile, "Desktop"),
|
|
266630
|
+
DOCUMENTS: join54(userProfile, "Documents"),
|
|
266631
|
+
DOWNLOADS: join54(userProfile, "Downloads")
|
|
266307
266632
|
};
|
|
266308
266633
|
}
|
|
266309
266634
|
case "linux":
|
|
@@ -266332,7 +266657,7 @@ var init_systemDirectories = __esm(() => {
|
|
|
266332
266657
|
// src/utils/plugins/mcpbHandler.ts
|
|
266333
266658
|
import { createHash as createHash6 } from "crypto";
|
|
266334
266659
|
import { chmod, writeFile as writeFile6 } from "fs/promises";
|
|
266335
|
-
import { dirname as dirname27, join as
|
|
266660
|
+
import { dirname as dirname27, join as join55 } from "path";
|
|
266336
266661
|
function isMcpbSource(source) {
|
|
266337
266662
|
return source.endsWith(".mcpb") || source.endsWith(".dxt");
|
|
266338
266663
|
}
|
|
@@ -266343,11 +266668,11 @@ function generateContentHash(data) {
|
|
|
266343
266668
|
return createHash6("sha256").update(data).digest("hex").substring(0, 16);
|
|
266344
266669
|
}
|
|
266345
266670
|
function getMcpbCacheDir(pluginPath) {
|
|
266346
|
-
return
|
|
266671
|
+
return join55(pluginPath, ".mcpb-cache");
|
|
266347
266672
|
}
|
|
266348
266673
|
function getMetadataPath(cacheDir, source) {
|
|
266349
266674
|
const sourceHash = createHash6("md5").update(source).digest("hex").substring(0, 8);
|
|
266350
|
-
return
|
|
266675
|
+
return join55(cacheDir, `${sourceHash}.metadata.json`);
|
|
266351
266676
|
}
|
|
266352
266677
|
function serverSecretsKey(pluginId, serverName) {
|
|
266353
266678
|
return `${pluginId}/${serverName}`;
|
|
@@ -266567,7 +266892,7 @@ async function extractMcpbContents(unzipped, extractPath, modes, onProgress) {
|
|
|
266567
266892
|
const entries = Object.entries(unzipped).filter(([k2]) => !k2.endsWith("/"));
|
|
266568
266893
|
const totalFiles = entries.length;
|
|
266569
266894
|
for (const [filePath, fileData] of entries) {
|
|
266570
|
-
const fullPath =
|
|
266895
|
+
const fullPath = join55(extractPath, filePath);
|
|
266571
266896
|
const dir = dirname27(fullPath);
|
|
266572
266897
|
if (dir !== extractPath) {
|
|
266573
266898
|
await getFsImplementation().mkdir(dir);
|
|
@@ -266612,7 +266937,7 @@ async function checkMcpbChanged(source, pluginPath) {
|
|
|
266612
266937
|
return true;
|
|
266613
266938
|
}
|
|
266614
266939
|
if (!isUrl2(source)) {
|
|
266615
|
-
const localPath =
|
|
266940
|
+
const localPath = join55(pluginPath, source);
|
|
266616
266941
|
let stats2;
|
|
266617
266942
|
try {
|
|
266618
266943
|
stats2 = await fs12.stat(localPath);
|
|
@@ -266642,7 +266967,7 @@ async function loadMcpbFile(source, pluginPath, pluginId, onProgress, providedUs
|
|
|
266642
266967
|
const metadata = await loadCacheMetadata(cacheDir, source);
|
|
266643
266968
|
if (metadata && !await checkMcpbChanged(source, pluginPath)) {
|
|
266644
266969
|
logForDebugging(`Using cached MCPB from ${metadata.extractedPath} (hash: ${metadata.contentHash})`);
|
|
266645
|
-
const manifestPath =
|
|
266970
|
+
const manifestPath = join55(metadata.extractedPath, "manifest.json");
|
|
266646
266971
|
let manifestContent;
|
|
266647
266972
|
try {
|
|
266648
266973
|
manifestContent = await fs12.readFile(manifestPath, { encoding: "utf-8" });
|
|
@@ -266695,10 +267020,10 @@ async function loadMcpbFile(source, pluginPath, pluginId, onProgress, providedUs
|
|
|
266695
267020
|
let mcpbFilePath;
|
|
266696
267021
|
if (isUrl2(source)) {
|
|
266697
267022
|
const sourceHash = createHash6("md5").update(source).digest("hex").substring(0, 8);
|
|
266698
|
-
mcpbFilePath =
|
|
267023
|
+
mcpbFilePath = join55(cacheDir, `${sourceHash}.mcpb`);
|
|
266699
267024
|
mcpbData = await downloadMcpb(source, mcpbFilePath, onProgress);
|
|
266700
267025
|
} else {
|
|
266701
|
-
const localPath =
|
|
267026
|
+
const localPath = join55(pluginPath, source);
|
|
266702
267027
|
if (onProgress) {
|
|
266703
267028
|
onProgress(`Loading ${source}...`);
|
|
266704
267029
|
}
|
|
@@ -266734,7 +267059,7 @@ async function loadMcpbFile(source, pluginPath, pluginId, onProgress, providedUs
|
|
|
266734
267059
|
logError2(error54);
|
|
266735
267060
|
throw error54;
|
|
266736
267061
|
}
|
|
266737
|
-
const extractPath =
|
|
267062
|
+
const extractPath = join55(cacheDir, contentHash);
|
|
266738
267063
|
await extractMcpbContents(unzipped, extractPath, modes, onProgress);
|
|
266739
267064
|
if (manifest.user_config && Object.keys(manifest.user_config).length > 0) {
|
|
266740
267065
|
const serverName = manifest.name;
|
|
@@ -266980,7 +267305,7 @@ var init_pluginOptionsStorage = __esm(() => {
|
|
|
266980
267305
|
});
|
|
266981
267306
|
|
|
266982
267307
|
// src/utils/plugins/walkPluginMarkdown.ts
|
|
266983
|
-
import { join as
|
|
267308
|
+
import { join as join56 } from "path";
|
|
266984
267309
|
async function walkPluginMarkdown(rootDir, onFile, opts = {}) {
|
|
266985
267310
|
const fs12 = getFsImplementation();
|
|
266986
267311
|
const label = opts.logLabel ?? "plugin";
|
|
@@ -266988,11 +267313,11 @@ async function walkPluginMarkdown(rootDir, onFile, opts = {}) {
|
|
|
266988
267313
|
try {
|
|
266989
267314
|
const entries = await fs12.readdir(dirPath);
|
|
266990
267315
|
if (opts.stopAtSkillDir && entries.some((e2) => e2.isFile() && SKILL_MD_RE.test(e2.name))) {
|
|
266991
|
-
await Promise.all(entries.map((entry) => entry.isFile() && entry.name.toLowerCase().endsWith(".md") ? onFile(
|
|
267316
|
+
await Promise.all(entries.map((entry) => entry.isFile() && entry.name.toLowerCase().endsWith(".md") ? onFile(join56(dirPath, entry.name), namespace) : undefined));
|
|
266992
267317
|
return;
|
|
266993
267318
|
}
|
|
266994
267319
|
await Promise.all(entries.map((entry) => {
|
|
266995
|
-
const fullPath =
|
|
267320
|
+
const fullPath = join56(dirPath, entry.name);
|
|
266996
267321
|
if (entry.isDirectory()) {
|
|
266997
267322
|
return scan(fullPath, [...namespace, entry.name]);
|
|
266998
267323
|
}
|
|
@@ -267645,8 +267970,8 @@ var init_backend_design = __esm(() => {
|
|
|
267645
267970
|
});
|
|
267646
267971
|
|
|
267647
267972
|
// src/tools/AgentTool/swarmContext.ts
|
|
267648
|
-
import { existsSync as
|
|
267649
|
-
import { dirname as dirname28, join as
|
|
267973
|
+
import { existsSync as existsSync21, mkdirSync as mkdirSync11, readFileSync as readFileSync23, writeFileSync as writeFileSync11 } from "fs";
|
|
267974
|
+
import { dirname as dirname28, join as join57 } from "path";
|
|
267650
267975
|
function truncateToTokens(text2, maxTokens) {
|
|
267651
267976
|
const maxChars = Math.max(0, maxTokens) * CHARS_PER_TOKEN;
|
|
267652
267977
|
if (text2.length <= maxChars)
|
|
@@ -267657,13 +267982,13 @@ function truncateToTokens(text2, maxTokens) {
|
|
|
267657
267982
|
…[truncated]`;
|
|
267658
267983
|
}
|
|
267659
267984
|
function getSwarmDir() {
|
|
267660
|
-
return
|
|
267985
|
+
return join57(getCwd(), ".rayu", "swarm");
|
|
267661
267986
|
}
|
|
267662
267987
|
function getSharedPath() {
|
|
267663
|
-
return
|
|
267988
|
+
return join57(getSwarmDir(), "shared.json");
|
|
267664
267989
|
}
|
|
267665
267990
|
function getDomainPath(domain2) {
|
|
267666
|
-
return
|
|
267991
|
+
return join57(getSwarmDir(), `${normalizeDomain(domain2)}.md`);
|
|
267667
267992
|
}
|
|
267668
267993
|
function normalizeDomain(domain2) {
|
|
267669
267994
|
return domain2.trim().toUpperCase().replace(/-AGENT$/, "");
|
|
@@ -267710,10 +268035,10 @@ function parseSlices(raw) {
|
|
|
267710
268035
|
}
|
|
267711
268036
|
function readShared() {
|
|
267712
268037
|
const p = getSharedPath();
|
|
267713
|
-
if (!
|
|
268038
|
+
if (!existsSync21(p))
|
|
267714
268039
|
return;
|
|
267715
268040
|
try {
|
|
267716
|
-
const parsed = JSON.parse(
|
|
268041
|
+
const parsed = JSON.parse(readFileSync23(p, "utf8"));
|
|
267717
268042
|
if (!parsed || typeof parsed !== "object")
|
|
267718
268043
|
return;
|
|
267719
268044
|
const slices = parseSlices(parsed.slices);
|
|
@@ -267734,10 +268059,10 @@ function readShared() {
|
|
|
267734
268059
|
}
|
|
267735
268060
|
function readDomainSection(domain2) {
|
|
267736
268061
|
const p = getDomainPath(domain2);
|
|
267737
|
-
if (!
|
|
268062
|
+
if (!existsSync21(p))
|
|
267738
268063
|
return;
|
|
267739
268064
|
try {
|
|
267740
|
-
const text2 =
|
|
268065
|
+
const text2 = readFileSync23(p, "utf8").trim();
|
|
267741
268066
|
return text2.length > 0 ? text2 : undefined;
|
|
267742
268067
|
} catch {
|
|
267743
268068
|
return;
|
|
@@ -267746,8 +268071,8 @@ function readDomainSection(domain2) {
|
|
|
267746
268071
|
function writeDomainSection(domain2, content) {
|
|
267747
268072
|
const p = getDomainPath(domain2);
|
|
267748
268073
|
try {
|
|
267749
|
-
|
|
267750
|
-
|
|
268074
|
+
mkdirSync11(dirname28(p), { recursive: true });
|
|
268075
|
+
writeFileSync11(p, content.endsWith(`
|
|
267751
268076
|
`) ? content : content + `
|
|
267752
268077
|
`, "utf8");
|
|
267753
268078
|
} catch {}
|
|
@@ -268007,11 +268332,11 @@ var init_linter = __esm(() => {
|
|
|
268007
268332
|
});
|
|
268008
268333
|
|
|
268009
268334
|
// src/utils/stackDetector.ts
|
|
268010
|
-
import { existsSync as
|
|
268011
|
-
import { join as
|
|
268335
|
+
import { existsSync as existsSync22, readFileSync as readFileSync24 } from "fs";
|
|
268336
|
+
import { join as join58 } from "path";
|
|
268012
268337
|
function readFileSafe2(path19) {
|
|
268013
268338
|
try {
|
|
268014
|
-
return
|
|
268339
|
+
return readFileSync24(path19, "utf8");
|
|
268015
268340
|
} catch {
|
|
268016
268341
|
return null;
|
|
268017
268342
|
}
|
|
@@ -268026,27 +268351,27 @@ function parseJsonSafe(text2) {
|
|
|
268026
268351
|
}
|
|
268027
268352
|
}
|
|
268028
268353
|
function detectPackageManager(cwd2) {
|
|
268029
|
-
if (
|
|
268354
|
+
if (existsSync22(join58(cwd2, "bun.lockb")) || existsSync22(join58(cwd2, "bun.lock")))
|
|
268030
268355
|
return "bun";
|
|
268031
|
-
if (
|
|
268356
|
+
if (existsSync22(join58(cwd2, "pnpm-lock.yaml")))
|
|
268032
268357
|
return "pnpm";
|
|
268033
|
-
if (
|
|
268358
|
+
if (existsSync22(join58(cwd2, "yarn.lock")))
|
|
268034
268359
|
return "yarn";
|
|
268035
|
-
if (
|
|
268360
|
+
if (existsSync22(join58(cwd2, "package-lock.json")))
|
|
268036
268361
|
return "npm";
|
|
268037
|
-
if (
|
|
268362
|
+
if (existsSync22(join58(cwd2, "Cargo.lock")))
|
|
268038
268363
|
return "cargo";
|
|
268039
|
-
if (
|
|
268364
|
+
if (existsSync22(join58(cwd2, "poetry.lock")))
|
|
268040
268365
|
return "poetry";
|
|
268041
|
-
if (
|
|
268366
|
+
if (existsSync22(join58(cwd2, "Pipfile.lock")))
|
|
268042
268367
|
return "pipenv";
|
|
268043
|
-
if (
|
|
268368
|
+
if (existsSync22(join58(cwd2, "go.sum")))
|
|
268044
268369
|
return "go";
|
|
268045
268370
|
return;
|
|
268046
268371
|
}
|
|
268047
268372
|
function detectDatabaseFromInfra(cwd2) {
|
|
268048
268373
|
for (const f3 of ["docker-compose.yml", "docker-compose.yaml", "compose.yml"]) {
|
|
268049
|
-
const text2 = readFileSafe2(
|
|
268374
|
+
const text2 = readFileSafe2(join58(cwd2, f3));
|
|
268050
268375
|
if (!text2)
|
|
268051
268376
|
continue;
|
|
268052
268377
|
if (/postgres|pgvector/i.test(text2))
|
|
@@ -268058,7 +268383,7 @@ function detectDatabaseFromInfra(cwd2) {
|
|
|
268058
268383
|
if (/redis/i.test(text2))
|
|
268059
268384
|
return "redis";
|
|
268060
268385
|
}
|
|
268061
|
-
const prisma = readFileSafe2(
|
|
268386
|
+
const prisma = readFileSafe2(join58(cwd2, "prisma", "schema.prisma"));
|
|
268062
268387
|
if (prisma) {
|
|
268063
268388
|
const m2 = prisma.match(/provider\s*=\s*"(\w+)"/);
|
|
268064
268389
|
if (m2) {
|
|
@@ -268079,7 +268404,7 @@ function detectStack(cwd2) {
|
|
|
268079
268404
|
const frameworks = [];
|
|
268080
268405
|
const manifests = [];
|
|
268081
268406
|
let database;
|
|
268082
|
-
const pkgText = readFileSafe2(
|
|
268407
|
+
const pkgText = readFileSafe2(join58(cwd2, "package.json"));
|
|
268083
268408
|
if (pkgText !== null) {
|
|
268084
268409
|
manifests.push("package.json");
|
|
268085
268410
|
const pkg = parseJsonSafe(pkgText);
|
|
@@ -268088,7 +268413,7 @@ function detectStack(cwd2) {
|
|
|
268088
268413
|
...pkg?.devDependencies ?? {}
|
|
268089
268414
|
};
|
|
268090
268415
|
const depNames = Object.keys(deps);
|
|
268091
|
-
const isTs =
|
|
268416
|
+
const isTs = existsSync22(join58(cwd2, "tsconfig.json")) || depNames.includes("typescript");
|
|
268092
268417
|
languages.push(isTs ? "typescript" : "javascript");
|
|
268093
268418
|
for (const name of depNames) {
|
|
268094
268419
|
for (const [re, label] of JS_FRAMEWORKS) {
|
|
@@ -268102,11 +268427,11 @@ function detectStack(cwd2) {
|
|
|
268102
268427
|
}
|
|
268103
268428
|
if (depNames.includes("drizzle-orm") && !database)
|
|
268104
268429
|
database = "sql (drizzle)";
|
|
268105
|
-
} else if (
|
|
268430
|
+
} else if (existsSync22(join58(cwd2, "tsconfig.json"))) {
|
|
268106
268431
|
manifests.push("tsconfig.json");
|
|
268107
268432
|
languages.push("typescript");
|
|
268108
268433
|
}
|
|
268109
|
-
const goMod = readFileSafe2(
|
|
268434
|
+
const goMod = readFileSafe2(join58(cwd2, "go.mod"));
|
|
268110
268435
|
if (goMod !== null) {
|
|
268111
268436
|
manifests.push("go.mod");
|
|
268112
268437
|
languages.push("go");
|
|
@@ -268119,7 +268444,7 @@ function detectStack(cwd2) {
|
|
|
268119
268444
|
if (/go-chi\/chi/.test(goMod))
|
|
268120
268445
|
frameworks.push("chi");
|
|
268121
268446
|
}
|
|
268122
|
-
const cargo = readFileSafe2(
|
|
268447
|
+
const cargo = readFileSafe2(join58(cwd2, "Cargo.toml"));
|
|
268123
268448
|
if (cargo !== null) {
|
|
268124
268449
|
manifests.push("Cargo.toml");
|
|
268125
268450
|
languages.push("rust");
|
|
@@ -268132,8 +268457,8 @@ function detectStack(cwd2) {
|
|
|
268132
268457
|
if (/\bwarp\b/.test(cargo))
|
|
268133
268458
|
frameworks.push("warp");
|
|
268134
268459
|
}
|
|
268135
|
-
const pyproject = readFileSafe2(
|
|
268136
|
-
const requirements = readFileSafe2(
|
|
268460
|
+
const pyproject = readFileSafe2(join58(cwd2, "pyproject.toml"));
|
|
268461
|
+
const requirements = readFileSafe2(join58(cwd2, "requirements.txt"));
|
|
268137
268462
|
if (pyproject !== null || requirements !== null) {
|
|
268138
268463
|
manifests.push(pyproject !== null ? "pyproject.toml" : "requirements.txt");
|
|
268139
268464
|
languages.push("python");
|
|
@@ -268146,23 +268471,23 @@ ${requirements ?? ""}`;
|
|
|
268146
268471
|
if (/\bfastapi\b/i.test(pyText))
|
|
268147
268472
|
frameworks.push("fastapi");
|
|
268148
268473
|
}
|
|
268149
|
-
if (
|
|
268474
|
+
if (existsSync22(join58(cwd2, "pom.xml"))) {
|
|
268150
268475
|
manifests.push("pom.xml");
|
|
268151
268476
|
languages.push("java");
|
|
268152
|
-
const pom = readFileSafe2(
|
|
268477
|
+
const pom = readFileSafe2(join58(cwd2, "pom.xml"));
|
|
268153
268478
|
if (pom && /spring-boot|springframework/.test(pom))
|
|
268154
268479
|
frameworks.push("spring");
|
|
268155
268480
|
}
|
|
268156
268481
|
for (const g of ["build.gradle", "build.gradle.kts"]) {
|
|
268157
|
-
if (
|
|
268482
|
+
if (existsSync22(join58(cwd2, g))) {
|
|
268158
268483
|
manifests.push(g);
|
|
268159
268484
|
languages.push(g.endsWith(".kts") ? "kotlin" : "java");
|
|
268160
|
-
const gradle = readFileSafe2(
|
|
268485
|
+
const gradle = readFileSafe2(join58(cwd2, g));
|
|
268161
268486
|
if (gradle && /spring-boot|springframework/.test(gradle))
|
|
268162
268487
|
frameworks.push("spring");
|
|
268163
268488
|
}
|
|
268164
268489
|
}
|
|
268165
|
-
const composer = readFileSafe2(
|
|
268490
|
+
const composer = readFileSafe2(join58(cwd2, "composer.json"));
|
|
268166
268491
|
if (composer !== null) {
|
|
268167
268492
|
manifests.push("composer.json");
|
|
268168
268493
|
languages.push("php");
|
|
@@ -268171,7 +268496,7 @@ ${requirements ?? ""}`;
|
|
|
268171
268496
|
if (/symfony\//.test(composer))
|
|
268172
268497
|
frameworks.push("symfony");
|
|
268173
268498
|
}
|
|
268174
|
-
const gemfile = readFileSafe2(
|
|
268499
|
+
const gemfile = readFileSafe2(join58(cwd2, "Gemfile"));
|
|
268175
268500
|
if (gemfile !== null) {
|
|
268176
268501
|
manifests.push("Gemfile");
|
|
268177
268502
|
languages.push("ruby");
|
|
@@ -271394,6 +271719,24 @@ function getAssistantMessageFromError(error54, model, options) {
|
|
|
271394
271719
|
content: getOauthOrgNotAllowedErrorMessage()
|
|
271395
271720
|
});
|
|
271396
271721
|
}
|
|
271722
|
+
if (error54 instanceof import_sdk9.APIError && error54.status === 403) {
|
|
271723
|
+
const onHosted = (() => {
|
|
271724
|
+
try {
|
|
271725
|
+
return getActiveProvider()?.kind === "rayu-hosted";
|
|
271726
|
+
} catch {
|
|
271727
|
+
return false;
|
|
271728
|
+
}
|
|
271729
|
+
})();
|
|
271730
|
+
const planGated = error54.message.includes("model not available on your plan") || error54.message.toLowerCase().includes("paid feature") || error54.message.includes("plan_upgrade_required");
|
|
271731
|
+
if (onHosted || planGated) {
|
|
271732
|
+
const plansUrl = `${getRayuWebBaseUrl()}/plans`;
|
|
271733
|
+
const switchCmd = getIsNonInteractiveSession() ? "--model" : "/model";
|
|
271734
|
+
return createAssistantAPIErrorMessage({
|
|
271735
|
+
error: "invalid_request",
|
|
271736
|
+
content: `\uD83D\uDD12 "${model}" is a Rayu-hosted model, available on paid plans (Pro and up). Please upgrade your plan to use it: ${plansUrl} — or run ${switchCmd} to switch to a model included in your current plan.`
|
|
271737
|
+
});
|
|
271738
|
+
}
|
|
271739
|
+
}
|
|
271397
271740
|
if (error54 instanceof import_sdk9.APIError && (error54.status === 401 || error54.status === 403)) {
|
|
271398
271741
|
if (isCCRMode()) {
|
|
271399
271742
|
return createAssistantAPIErrorMessage({
|
|
@@ -271576,6 +271919,8 @@ var init_errors7 = __esm(() => {
|
|
|
271576
271919
|
init_model();
|
|
271577
271920
|
init_modelStrings();
|
|
271578
271921
|
init_providers();
|
|
271922
|
+
init_rayuConfig();
|
|
271923
|
+
init_rayuSession();
|
|
271579
271924
|
init_state();
|
|
271580
271925
|
init_apiLimits();
|
|
271581
271926
|
init_envUtils();
|
|
@@ -276797,15 +277142,15 @@ class FileStateCache {
|
|
|
276797
277142
|
function createFileStateCacheWithSizeLimit(maxEntries, maxSizeBytes = DEFAULT_MAX_CACHE_SIZE_BYTES) {
|
|
276798
277143
|
return new FileStateCache(maxEntries, maxSizeBytes);
|
|
276799
277144
|
}
|
|
276800
|
-
function cacheToObject(
|
|
276801
|
-
return Object.fromEntries(
|
|
277145
|
+
function cacheToObject(cache5) {
|
|
277146
|
+
return Object.fromEntries(cache5.entries());
|
|
276802
277147
|
}
|
|
276803
|
-
function cacheKeys(
|
|
276804
|
-
return Array.from(
|
|
277148
|
+
function cacheKeys(cache5) {
|
|
277149
|
+
return Array.from(cache5.keys());
|
|
276805
277150
|
}
|
|
276806
|
-
function cloneFileStateCache(
|
|
276807
|
-
const cloned = createFileStateCacheWithSizeLimit(
|
|
276808
|
-
cloned.load(
|
|
277151
|
+
function cloneFileStateCache(cache5) {
|
|
277152
|
+
const cloned = createFileStateCacheWithSizeLimit(cache5.max, cache5.maxSize);
|
|
277153
|
+
cloned.load(cache5.dump());
|
|
276809
277154
|
return cloned;
|
|
276810
277155
|
}
|
|
276811
277156
|
function mergeFileStateCaches(first, second) {
|
|
@@ -276830,7 +277175,7 @@ import {
|
|
|
276830
277175
|
dirname as dirname29,
|
|
276831
277176
|
extname as extname4,
|
|
276832
277177
|
isAbsolute as isAbsolute14,
|
|
276833
|
-
join as
|
|
277178
|
+
join as join59,
|
|
276834
277179
|
parse as parse8,
|
|
276835
277180
|
relative as relative8,
|
|
276836
277181
|
sep as sep14
|
|
@@ -277075,7 +277420,7 @@ async function processMdRules({
|
|
|
277075
277420
|
throw e2;
|
|
277076
277421
|
}
|
|
277077
277422
|
for (const entry of entries) {
|
|
277078
|
-
const entryPath =
|
|
277423
|
+
const entryPath = join59(rulesDir, entry.name);
|
|
277079
277424
|
const { resolvedPath: resolvedEntryPath, isSymlink: isSymlink2 } = safeResolvePath(fs12, entryPath);
|
|
277080
277425
|
const stats2 = isSymlink2 ? await fs12.stat(resolvedEntryPath) : null;
|
|
277081
277426
|
const isDirectory = stats2 ? stats2.isDirectory() : entry.isDirectory();
|
|
@@ -277147,22 +277492,22 @@ async function getMemoryFilesForNestedDirectory(dir, targetPath, processedPaths)
|
|
|
277147
277492
|
const result = [];
|
|
277148
277493
|
if (isSettingSourceEnabled("projectSettings")) {
|
|
277149
277494
|
for (const memName of PROJECT_MEMORY_FILENAMES) {
|
|
277150
|
-
result.push(...await processMemoryFile(
|
|
277495
|
+
result.push(...await processMemoryFile(join59(dir, memName), "Project", processedPaths, false));
|
|
277151
277496
|
}
|
|
277152
277497
|
for (const cfgDir of PROJECT_CONFIG_DIRS) {
|
|
277153
277498
|
for (const memName of PROJECT_MEMORY_FILENAMES) {
|
|
277154
|
-
result.push(...await processMemoryFile(
|
|
277499
|
+
result.push(...await processMemoryFile(join59(dir, cfgDir, memName), "Project", processedPaths, false));
|
|
277155
277500
|
}
|
|
277156
277501
|
}
|
|
277157
277502
|
}
|
|
277158
277503
|
if (isSettingSourceEnabled("localSettings")) {
|
|
277159
|
-
const localPath =
|
|
277504
|
+
const localPath = join59(dir, "RAYU.local.md");
|
|
277160
277505
|
result.push(...await processMemoryFile(localPath, "Local", processedPaths, false));
|
|
277161
277506
|
}
|
|
277162
277507
|
const unconditionalProcessedPaths = new Set(processedPaths);
|
|
277163
277508
|
for (const cfgDir of PROJECT_CONFIG_DIRS) {
|
|
277164
277509
|
result.push(...await processMdRules({
|
|
277165
|
-
rulesDir:
|
|
277510
|
+
rulesDir: join59(dir, cfgDir, "rules"),
|
|
277166
277511
|
type: "Project",
|
|
277167
277512
|
processedPaths: unconditionalProcessedPaths,
|
|
277168
277513
|
includeExternal: false,
|
|
@@ -277170,7 +277515,7 @@ async function getMemoryFilesForNestedDirectory(dir, targetPath, processedPaths)
|
|
|
277170
277515
|
}));
|
|
277171
277516
|
}
|
|
277172
277517
|
for (const cfgDir of PROJECT_CONFIG_DIRS) {
|
|
277173
|
-
result.push(...await processConditionedMdRules(targetPath,
|
|
277518
|
+
result.push(...await processConditionedMdRules(targetPath, join59(dir, cfgDir, "rules"), "Project", processedPaths, false));
|
|
277174
277519
|
}
|
|
277175
277520
|
for (const path19 of unconditionalProcessedPaths) {
|
|
277176
277521
|
processedPaths.add(path19);
|
|
@@ -277180,7 +277525,7 @@ async function getMemoryFilesForNestedDirectory(dir, targetPath, processedPaths)
|
|
|
277180
277525
|
async function getConditionalRulesForCwdLevelDirectory(dir, targetPath, processedPaths) {
|
|
277181
277526
|
const result = [];
|
|
277182
277527
|
for (const cfgDir of PROJECT_CONFIG_DIRS) {
|
|
277183
|
-
result.push(...await processConditionedMdRules(targetPath,
|
|
277528
|
+
result.push(...await processConditionedMdRules(targetPath, join59(dir, cfgDir, "rules"), "Project", processedPaths, false));
|
|
277184
277529
|
}
|
|
277185
277530
|
return result;
|
|
277186
277531
|
}
|
|
@@ -277411,7 +277756,7 @@ var init_claudemd = __esm(() => {
|
|
|
277411
277756
|
}));
|
|
277412
277757
|
if (isSettingSourceEnabled("userSettings")) {
|
|
277413
277758
|
for (const memName of PROJECT_MEMORY_FILENAMES) {
|
|
277414
|
-
result.push(...await processMemoryFile(
|
|
277759
|
+
result.push(...await processMemoryFile(join59(getRayuConfigHomeDir(), memName), "User", processedPaths, true));
|
|
277415
277760
|
}
|
|
277416
277761
|
const userClaudeRulesDir = getUserClaudeRulesDir();
|
|
277417
277762
|
result.push(...await processMdRules({
|
|
@@ -277436,14 +277781,14 @@ var init_claudemd = __esm(() => {
|
|
|
277436
277781
|
const skipProject = isNestedWorktree && pathInWorkingPath(dir, canonicalRoot) && !pathInWorkingPath(dir, gitRoot);
|
|
277437
277782
|
if (isSettingSourceEnabled("projectSettings") && !skipProject) {
|
|
277438
277783
|
for (const memName of PROJECT_MEMORY_FILENAMES) {
|
|
277439
|
-
result.push(...await processMemoryFile(
|
|
277784
|
+
result.push(...await processMemoryFile(join59(dir, memName), "Project", processedPaths, includeExternal));
|
|
277440
277785
|
}
|
|
277441
277786
|
for (const cfgDir of PROJECT_CONFIG_DIRS) {
|
|
277442
277787
|
for (const memName of PROJECT_MEMORY_FILENAMES) {
|
|
277443
|
-
result.push(...await processMemoryFile(
|
|
277788
|
+
result.push(...await processMemoryFile(join59(dir, cfgDir, memName), "Project", processedPaths, includeExternal));
|
|
277444
277789
|
}
|
|
277445
277790
|
result.push(...await processMdRules({
|
|
277446
|
-
rulesDir:
|
|
277791
|
+
rulesDir: join59(dir, cfgDir, "rules"),
|
|
277447
277792
|
type: "Project",
|
|
277448
277793
|
processedPaths,
|
|
277449
277794
|
includeExternal,
|
|
@@ -277452,7 +277797,7 @@ var init_claudemd = __esm(() => {
|
|
|
277452
277797
|
}
|
|
277453
277798
|
}
|
|
277454
277799
|
if (isSettingSourceEnabled("localSettings")) {
|
|
277455
|
-
const localPath =
|
|
277800
|
+
const localPath = join59(dir, "RAYU.local.md");
|
|
277456
277801
|
result.push(...await processMemoryFile(localPath, "Local", processedPaths, includeExternal));
|
|
277457
277802
|
}
|
|
277458
277803
|
}
|
|
@@ -277460,14 +277805,14 @@ var init_claudemd = __esm(() => {
|
|
|
277460
277805
|
const additionalDirs = getAdditionalDirectoriesForClaudeMd();
|
|
277461
277806
|
for (const dir of additionalDirs) {
|
|
277462
277807
|
for (const memName of PROJECT_MEMORY_FILENAMES) {
|
|
277463
|
-
result.push(...await processMemoryFile(
|
|
277808
|
+
result.push(...await processMemoryFile(join59(dir, memName), "Project", processedPaths, includeExternal));
|
|
277464
277809
|
}
|
|
277465
277810
|
for (const cfgDir of PROJECT_CONFIG_DIRS) {
|
|
277466
277811
|
for (const memName of PROJECT_MEMORY_FILENAMES) {
|
|
277467
|
-
result.push(...await processMemoryFile(
|
|
277812
|
+
result.push(...await processMemoryFile(join59(dir, cfgDir, memName), "Project", processedPaths, includeExternal));
|
|
277468
277813
|
}
|
|
277469
277814
|
result.push(...await processMdRules({
|
|
277470
|
-
rulesDir:
|
|
277815
|
+
rulesDir: join59(dir, cfgDir, "rules"),
|
|
277471
277816
|
type: "Project",
|
|
277472
277817
|
processedPaths,
|
|
277473
277818
|
includeExternal,
|
|
@@ -277657,7 +278002,7 @@ ${log3}`
|
|
|
277657
278002
|
|
|
277658
278003
|
// src/utils/externalSkillDiscovery.ts
|
|
277659
278004
|
import { homedir as homedir17 } from "os";
|
|
277660
|
-
import { join as
|
|
278005
|
+
import { join as join60, resolve as resolve25 } from "path";
|
|
277661
278006
|
function dirExists(p) {
|
|
277662
278007
|
const fs12 = getFsImplementation();
|
|
277663
278008
|
try {
|
|
@@ -277671,7 +278016,7 @@ function existingDir(p) {
|
|
|
277671
278016
|
return dirExists(p) ? p : undefined;
|
|
277672
278017
|
}
|
|
277673
278018
|
function getAgentFrameworkSkillsDir() {
|
|
277674
|
-
return existingDir(
|
|
278019
|
+
return existingDir(join60(homedir17(), ".agents", "skills"));
|
|
277675
278020
|
}
|
|
277676
278021
|
function getAgentSkillsDirIfEnabled() {
|
|
277677
278022
|
const settings = getInitialSettings();
|
|
@@ -277681,7 +278026,7 @@ function getAgentSkillsDirIfEnabled() {
|
|
|
277681
278026
|
return getAgentFrameworkSkillsDir();
|
|
277682
278027
|
}
|
|
277683
278028
|
function getClaudeCodeSkillsDir() {
|
|
277684
|
-
return existingDir(
|
|
278029
|
+
return existingDir(join60(homedir17(), ".claude", "skills"));
|
|
277685
278030
|
}
|
|
277686
278031
|
function getClaudeCodeSkillsDirIfEnabled() {
|
|
277687
278032
|
const settings = getInitialSettings();
|
|
@@ -277695,7 +278040,7 @@ function getProjectClaudeSkillsDirIfEnabled() {
|
|
|
277695
278040
|
const enabled2 = settings.claudeSkillsEnabled !== false;
|
|
277696
278041
|
if (!enabled2)
|
|
277697
278042
|
return;
|
|
277698
|
-
return existingDir(
|
|
278043
|
+
return existingDir(join60(getCwd(), ".claude", "skills"));
|
|
277699
278044
|
}
|
|
277700
278045
|
function getExtraSkillDirsFromSettings() {
|
|
277701
278046
|
const settings = getInitialSettings();
|
|
@@ -277808,7 +278153,7 @@ var init_argumentSubstitution = __esm(() => {
|
|
|
277808
278153
|
|
|
277809
278154
|
// src/utils/toolResultStorage.ts
|
|
277810
278155
|
import { mkdir as mkdir7, writeFile as writeFile7 } from "fs/promises";
|
|
277811
|
-
import { join as
|
|
278156
|
+
import { join as join61 } from "path";
|
|
277812
278157
|
function getPersistenceThreshold(toolName2, declaredMaxResultSizeChars) {
|
|
277813
278158
|
if (!Number.isFinite(declaredMaxResultSizeChars)) {
|
|
277814
278159
|
return declaredMaxResultSizeChars;
|
|
@@ -277821,14 +278166,14 @@ function getPersistenceThreshold(toolName2, declaredMaxResultSizeChars) {
|
|
|
277821
278166
|
return Math.min(declaredMaxResultSizeChars, DEFAULT_MAX_RESULT_SIZE_CHARS);
|
|
277822
278167
|
}
|
|
277823
278168
|
function getSessionDir() {
|
|
277824
|
-
return
|
|
278169
|
+
return join61(getProjectDir2(getOriginalCwd()), getSessionId());
|
|
277825
278170
|
}
|
|
277826
278171
|
function getToolResultsDir() {
|
|
277827
|
-
return
|
|
278172
|
+
return join61(getSessionDir(), TOOL_RESULTS_SUBDIR);
|
|
277828
278173
|
}
|
|
277829
278174
|
function getToolResultPath(id, isJson) {
|
|
277830
278175
|
const ext = isJson ? "json" : "txt";
|
|
277831
|
-
return
|
|
278176
|
+
return join61(getToolResultsDir(), `${id}.${ext}`);
|
|
277832
278177
|
}
|
|
277833
278178
|
async function ensureToolResultsDir() {
|
|
277834
278179
|
try {
|
|
@@ -278758,21 +279103,21 @@ Output truncated (${sizeKB}KB total). Full output saved to: ${this.path}`;
|
|
|
278758
279103
|
|
|
278759
279104
|
// src/utils/sessionEnvironment.ts
|
|
278760
279105
|
import { mkdir as mkdir8, readdir as readdir11, readFile as readFile11, writeFile as writeFile8 } from "fs/promises";
|
|
278761
|
-
import { join as
|
|
279106
|
+
import { join as join62 } from "path";
|
|
278762
279107
|
async function getSessionEnvDirPath() {
|
|
278763
|
-
const sessionEnvDir =
|
|
279108
|
+
const sessionEnvDir = join62(getRayuConfigHomeDir(), "session-env", getSessionId());
|
|
278764
279109
|
await mkdir8(sessionEnvDir, { recursive: true });
|
|
278765
279110
|
return sessionEnvDir;
|
|
278766
279111
|
}
|
|
278767
279112
|
async function getHookEnvFilePath(hookEvent, hookIndex) {
|
|
278768
279113
|
const prefix = hookEvent.toLowerCase();
|
|
278769
|
-
return
|
|
279114
|
+
return join62(await getSessionEnvDirPath(), `${prefix}-hook-${hookIndex}.sh`);
|
|
278770
279115
|
}
|
|
278771
279116
|
async function clearCwdEnvFiles() {
|
|
278772
279117
|
try {
|
|
278773
279118
|
const dir = await getSessionEnvDirPath();
|
|
278774
279119
|
const files2 = await readdir11(dir);
|
|
278775
|
-
await Promise.all(files2.filter((f3) => (f3.startsWith("filechanged-hook-") || f3.startsWith("cwdchanged-hook-")) && HOOK_ENV_REGEX.test(f3)).map((f3) => writeFile8(
|
|
279120
|
+
await Promise.all(files2.filter((f3) => (f3.startsWith("filechanged-hook-") || f3.startsWith("cwdchanged-hook-")) && HOOK_ENV_REGEX.test(f3)).map((f3) => writeFile8(join62(dir, f3), "")));
|
|
278776
279121
|
} catch (e2) {
|
|
278777
279122
|
const code = getErrnoCode(e2);
|
|
278778
279123
|
if (code !== "ENOENT") {
|
|
@@ -278813,7 +279158,7 @@ async function getSessionEnvironmentScript() {
|
|
|
278813
279158
|
const files2 = await readdir11(sessionEnvDir);
|
|
278814
279159
|
const hookFiles = files2.filter((f3) => HOOK_ENV_REGEX.test(f3)).sort(sortHookEnvFiles);
|
|
278815
279160
|
for (const file2 of hookFiles) {
|
|
278816
|
-
const filePath =
|
|
279161
|
+
const filePath = join62(sessionEnvDir, file2);
|
|
278817
279162
|
try {
|
|
278818
279163
|
const content = (await readFile11(filePath, "utf8")).trim();
|
|
278819
279164
|
if (content) {
|
|
@@ -278926,7 +279271,7 @@ var init_hooksConfigSnapshot = __esm(() => {
|
|
|
278926
279271
|
});
|
|
278927
279272
|
|
|
278928
279273
|
// src/utils/hooks/fileChangedWatcher.ts
|
|
278929
|
-
import { isAbsolute as isAbsolute15, join as
|
|
279274
|
+
import { isAbsolute as isAbsolute15, join as join63 } from "path";
|
|
278930
279275
|
function setEnvHookNotifier(cb) {
|
|
278931
279276
|
notifyCallback = cb;
|
|
278932
279277
|
}
|
|
@@ -278954,7 +279299,7 @@ function resolveWatchPaths(config4) {
|
|
|
278954
279299
|
for (const name of m3.matcher.split("|").map((s2) => s2.trim())) {
|
|
278955
279300
|
if (!name)
|
|
278956
279301
|
continue;
|
|
278957
|
-
staticPaths.push(isAbsolute15(name) ? name :
|
|
279302
|
+
staticPaths.push(isAbsolute15(name) ? name : join63(currentCwd, name));
|
|
278958
279303
|
}
|
|
278959
279304
|
}
|
|
278960
279305
|
return [...new Set([...staticPaths, ...dynamicWatchPaths])];
|
|
@@ -279265,7 +279610,7 @@ var init_subprocessEnv = __esm(() => {
|
|
|
279265
279610
|
import { execFile as execFile6 } from "child_process";
|
|
279266
279611
|
import { mkdir as mkdir9, stat as stat17 } from "fs/promises";
|
|
279267
279612
|
import * as os5 from "os";
|
|
279268
|
-
import { join as
|
|
279613
|
+
import { join as join64 } from "path";
|
|
279269
279614
|
function createArgv0ShellFunction(funcName, argv0, binaryPath, prependArgs = []) {
|
|
279270
279615
|
const quotedPath = quote([binaryPath]);
|
|
279271
279616
|
const argSuffix = prependArgs.length > 0 ? `${prependArgs.join(" ")} "$@"` : '"$@"';
|
|
@@ -279321,7 +279666,7 @@ function createFindGrepShellIntegration() {
|
|
|
279321
279666
|
}
|
|
279322
279667
|
function getConfigFile(shellPath) {
|
|
279323
279668
|
const fileName = shellPath.includes("zsh") ? ".zshrc" : shellPath.includes("bash") ? ".bashrc" : ".profile";
|
|
279324
|
-
const configPath2 =
|
|
279669
|
+
const configPath2 = join64(os5.homedir(), fileName);
|
|
279325
279670
|
return configPath2;
|
|
279326
279671
|
}
|
|
279327
279672
|
function getUserSnapshotContent(configFile) {
|
|
@@ -279475,9 +279820,9 @@ var LITERAL_BACKSLASH = "\\", SNAPSHOT_CREATION_TIMEOUT = 1e4, VCS_DIRECTORIES_T
|
|
|
279475
279820
|
}
|
|
279476
279821
|
const timestamp = Date.now();
|
|
279477
279822
|
const randomId = Math.random().toString(36).substring(2, 8);
|
|
279478
|
-
const snapshotsDir =
|
|
279823
|
+
const snapshotsDir = join64(getRayuConfigHomeDir(), "shell-snapshots");
|
|
279479
279824
|
logForDebugging(`Snapshots directory: ${snapshotsDir}`);
|
|
279480
|
-
const shellSnapshotPath =
|
|
279825
|
+
const shellSnapshotPath = join64(snapshotsDir, `snapshot-${shellType}-${timestamp}-${randomId}.sh`);
|
|
279481
279826
|
await mkdir9(snapshotsDir, { recursive: true });
|
|
279482
279827
|
const snapshotScript = await getSnapshotScript(binShell, shellSnapshotPath, configFileExists);
|
|
279483
279828
|
logForDebugging(`Creating snapshot at: ${shellSnapshotPath}`);
|
|
@@ -279855,7 +280200,7 @@ var init_powershellDetection = __esm(() => {
|
|
|
279855
280200
|
|
|
279856
280201
|
// src/utils/shell/powershellProvider.ts
|
|
279857
280202
|
import { tmpdir as tmpdir7 } from "os";
|
|
279858
|
-
import { join as
|
|
280203
|
+
import { join as join65 } from "path";
|
|
279859
280204
|
import { join as posixJoin2 } from "path/posix";
|
|
279860
280205
|
function buildPowerShellArgs(cmd) {
|
|
279861
280206
|
return ["-NoProfile", "-NonInteractive", "-Command", cmd];
|
|
@@ -279871,7 +280216,7 @@ function createPowerShellProvider(shellPath) {
|
|
|
279871
280216
|
detached: false,
|
|
279872
280217
|
async buildExecCommand(command, opts) {
|
|
279873
280218
|
currentSandboxTmpDir = opts.useSandbox ? opts.sandboxTmpDir : undefined;
|
|
279874
|
-
const cwdFilePath = opts.useSandbox && opts.sandboxTmpDir ? posixJoin2(opts.sandboxTmpDir, `claude-pwd-ps-${opts.id}`) :
|
|
280219
|
+
const cwdFilePath = opts.useSandbox && opts.sandboxTmpDir ? posixJoin2(opts.sandboxTmpDir, `claude-pwd-ps-${opts.id}`) : join65(tmpdir7(), `claude-pwd-ps-${opts.id}`);
|
|
279875
280220
|
const escapedCwdFilePath = cwdFilePath.replace(/'/g, "''");
|
|
279876
280221
|
const cwdTracking = `
|
|
279877
280222
|
; $_ec = if ($null -ne $LASTEXITCODE) { $LASTEXITCODE } elseif ($?) { 0 } else { 1 }
|
|
@@ -279909,7 +280254,7 @@ var init_powershellProvider = __esm(() => {
|
|
|
279909
280254
|
|
|
279910
280255
|
// src/utils/Shell.ts
|
|
279911
280256
|
import { execFileSync, spawn as spawn7 } from "child_process";
|
|
279912
|
-
import { constants as fsConstants2, readFileSync as
|
|
280257
|
+
import { constants as fsConstants2, readFileSync as readFileSync25, unlinkSync as unlinkSync3 } from "fs";
|
|
279913
280258
|
import { mkdir as mkdir10, open as open7, realpath as realpath8 } from "fs/promises";
|
|
279914
280259
|
import { isAbsolute as isAbsolute16, resolve as resolve26 } from "path";
|
|
279915
280260
|
import { join as posixJoin3 } from "path/posix";
|
|
@@ -280068,7 +280413,7 @@ async function exec3(command, abortSignal, shellType, options) {
|
|
|
280068
280413
|
}
|
|
280069
280414
|
if (result && !preventCwdChanges && !result.backgroundTaskId) {
|
|
280070
280415
|
try {
|
|
280071
|
-
let newCwd =
|
|
280416
|
+
let newCwd = readFileSync25(nativeCwdFilePath, {
|
|
280072
280417
|
encoding: "utf8"
|
|
280073
280418
|
}).trim();
|
|
280074
280419
|
if (getPlatform() === "windows") {
|
|
@@ -280921,9 +281266,9 @@ var init_validate3 = __esm(() => {
|
|
|
280921
281266
|
});
|
|
280922
281267
|
|
|
280923
281268
|
// src/keybindings/loadUserBindings.ts
|
|
280924
|
-
import { readFileSync as
|
|
281269
|
+
import { readFileSync as readFileSync26 } from "fs";
|
|
280925
281270
|
import { readFile as readFile12, stat as stat19 } from "fs/promises";
|
|
280926
|
-
import { dirname as dirname30, join as
|
|
281271
|
+
import { dirname as dirname30, join as join66 } from "path";
|
|
280927
281272
|
function isKeybindingCustomizationEnabled() {
|
|
280928
281273
|
return getFeatureValue_CACHED_MAY_BE_STALE("tengu_keybinding_customization_release", false);
|
|
280929
281274
|
}
|
|
@@ -280946,7 +281291,7 @@ function isKeybindingBlockArray2(arr) {
|
|
|
280946
281291
|
return Array.isArray(arr) && arr.every(isKeybindingBlock2);
|
|
280947
281292
|
}
|
|
280948
281293
|
function getKeybindingsPath() {
|
|
280949
|
-
return
|
|
281294
|
+
return join66(getRayuConfigHomeDir(), "keybindings.json");
|
|
280950
281295
|
}
|
|
280951
281296
|
function getDefaultParsedBindings() {
|
|
280952
281297
|
return parseBindings(DEFAULT_BINDINGS);
|
|
@@ -281044,7 +281389,7 @@ function loadKeybindingsSyncWithWarnings() {
|
|
|
281044
281389
|
}
|
|
281045
281390
|
const userPath = getKeybindingsPath();
|
|
281046
281391
|
try {
|
|
281047
|
-
const content =
|
|
281392
|
+
const content = readFileSync26(userPath, "utf-8");
|
|
281048
281393
|
const parsed = jsonParse(content);
|
|
281049
281394
|
let userBlocks;
|
|
281050
281395
|
if (typeof parsed === "object" && parsed !== null && "bindings" in parsed) {
|
|
@@ -290537,16 +290882,16 @@ import {
|
|
|
290537
290882
|
basename as basename17,
|
|
290538
290883
|
dirname as dirname31,
|
|
290539
290884
|
isAbsolute as isAbsolute18,
|
|
290540
|
-
join as
|
|
290885
|
+
join as join67,
|
|
290541
290886
|
sep as pathSep,
|
|
290542
290887
|
relative as relative9
|
|
290543
290888
|
} from "path";
|
|
290544
290889
|
function getSkillsPath(source, dir) {
|
|
290545
290890
|
switch (source) {
|
|
290546
290891
|
case "policySettings":
|
|
290547
|
-
return
|
|
290892
|
+
return join67(getManagedFilePath(), ".rayu", dir);
|
|
290548
290893
|
case "userSettings":
|
|
290549
|
-
return
|
|
290894
|
+
return join67(getRayuConfigHomeDir(), dir);
|
|
290550
290895
|
case "projectSettings":
|
|
290551
290896
|
return `.rayu/${dir}`;
|
|
290552
290897
|
case "plugin":
|
|
@@ -290718,8 +291063,8 @@ async function loadSkillsFromSkillsDir(basePath, source) {
|
|
|
290718
291063
|
if (!entry.isDirectory() && !entry.isSymbolicLink()) {
|
|
290719
291064
|
return null;
|
|
290720
291065
|
}
|
|
290721
|
-
const skillDirPath =
|
|
290722
|
-
const skillFilePath =
|
|
291066
|
+
const skillDirPath = join67(basePath, entry.name);
|
|
291067
|
+
const skillFilePath = join67(skillDirPath, "SKILL.md");
|
|
290723
291068
|
let content;
|
|
290724
291069
|
try {
|
|
290725
291070
|
content = await fs12.readFile(skillFilePath, { encoding: "utf-8" });
|
|
@@ -290874,7 +291219,7 @@ async function discoverSkillDirsForPaths(filePaths, cwd2) {
|
|
|
290874
291219
|
for (const filePath of filePaths) {
|
|
290875
291220
|
let currentDir = dirname31(filePath);
|
|
290876
291221
|
while (currentDir.startsWith(resolvedCwd + pathSep)) {
|
|
290877
|
-
const skillDir =
|
|
291222
|
+
const skillDir = join67(currentDir, ".rayu", "skills");
|
|
290878
291223
|
if (!dynamicSkillDirs.has(skillDir)) {
|
|
290879
291224
|
dynamicSkillDirs.add(skillDir);
|
|
290880
291225
|
try {
|
|
@@ -290998,8 +291343,8 @@ var init_loadSkillsDir = __esm(() => {
|
|
|
290998
291343
|
init_types2();
|
|
290999
291344
|
import_ignore3 = __toESM(require_ignore(), 1);
|
|
291000
291345
|
getSkillDirCommands = memoize_default(async (cwd2) => {
|
|
291001
|
-
const userSkillsDir =
|
|
291002
|
-
const managedSkillsDir =
|
|
291346
|
+
const userSkillsDir = join67(getRayuConfigHomeDir(), "skills");
|
|
291347
|
+
const managedSkillsDir = join67(getManagedFilePath(), ".rayu", "skills");
|
|
291003
291348
|
const projectSkillsDirs = getProjectDirsUpToHome("skills", cwd2);
|
|
291004
291349
|
logForDebugging(`Loading skills from: managed=${managedSkillsDir}, user=${userSkillsDir}, project=[${projectSkillsDirs.join(", ")}]`);
|
|
291005
291350
|
const additionalDirs = getAdditionalDirectoriesForClaudeMd();
|
|
@@ -291010,7 +291355,7 @@ var init_loadSkillsDir = __esm(() => {
|
|
|
291010
291355
|
logForDebugging(`[bare] Skipping skill dir discovery (${additionalDirs.length === 0 ? "no --add-dir" : "projectSettings disabled or skillsLocked"})`);
|
|
291011
291356
|
return [];
|
|
291012
291357
|
}
|
|
291013
|
-
const additionalSkillsNested2 = await Promise.all(additionalDirs.map((dir) => loadSkillsFromSkillsDir(
|
|
291358
|
+
const additionalSkillsNested2 = await Promise.all(additionalDirs.map((dir) => loadSkillsFromSkillsDir(join67(dir, ".rayu", "skills"), "projectSettings")));
|
|
291014
291359
|
return additionalSkillsNested2.flat().map((s2) => s2.skill);
|
|
291015
291360
|
}
|
|
291016
291361
|
const externalSkillDirs = isSettingSourceEnabled("userSettings") && !skillsLocked ? getExternalSkillDirs() : [];
|
|
@@ -291026,7 +291371,7 @@ var init_loadSkillsDir = __esm(() => {
|
|
|
291026
291371
|
isEnvTruthy(process.env.RAYU_DISABLE_POLICY_SKILLS) ? Promise.resolve([]) : loadSkillsFromSkillsDir(managedSkillsDir, "policySettings"),
|
|
291027
291372
|
isSettingSourceEnabled("userSettings") && !skillsLocked ? loadSkillsFromSkillsDir(userSkillsDir, "userSettings") : Promise.resolve([]),
|
|
291028
291373
|
projectSettingsEnabled ? Promise.all(projectSkillsDirs.map((dir) => loadSkillsFromSkillsDir(dir, "projectSettings"))) : Promise.resolve([]),
|
|
291029
|
-
projectSettingsEnabled ? Promise.all(additionalDirs.map((dir) => loadSkillsFromSkillsDir(
|
|
291374
|
+
projectSettingsEnabled ? Promise.all(additionalDirs.map((dir) => loadSkillsFromSkillsDir(join67(dir, ".rayu", "skills"), "projectSettings"))) : Promise.resolve([]),
|
|
291030
291375
|
isSettingSourceEnabled("userSettings") && !skillsLocked && externalSkillDirs.length > 0 ? Promise.all(externalSkillDirs.map((dir) => loadSkillsFromSkillsDir(dir, "userSettings"))) : Promise.resolve([]),
|
|
291031
291376
|
skillsLocked ? Promise.resolve([]) : loadSkillsFromCommandsDir(cwd2)
|
|
291032
291377
|
]);
|
|
@@ -291142,6 +291487,12 @@ function reconcileContextUsage(opts) {
|
|
|
291142
291487
|
const freeTokens = Math.max(0, opts.contextWindow - used - opts.reservedTokens);
|
|
291143
291488
|
return { usedForGrid: used, freeTokens, finalTotalTokens: used };
|
|
291144
291489
|
}
|
|
291490
|
+
function deriveMessagesBucketTokens(opts) {
|
|
291491
|
+
if (opts.totalFromAPI != null && opts.totalFromAPI > 0) {
|
|
291492
|
+
return Math.max(0, opts.totalFromAPI - opts.otherCategoriesTokens);
|
|
291493
|
+
}
|
|
291494
|
+
return opts.estimatedMessageTokens;
|
|
291495
|
+
}
|
|
291145
291496
|
async function countTokensWithFallback(messages, tools) {
|
|
291146
291497
|
try {
|
|
291147
291498
|
const result = await countMessagesTokensWithAPI(messages, tools);
|
|
@@ -291518,6 +291869,98 @@ async function approximateMessageTokens(messages) {
|
|
|
291518
291869
|
breakdown.totalTokens = approximateMessageTokens2 ?? roughMessageSum;
|
|
291519
291870
|
return breakdown;
|
|
291520
291871
|
}
|
|
291872
|
+
function buildContextGridRows(opts) {
|
|
291873
|
+
const {
|
|
291874
|
+
categories,
|
|
291875
|
+
contextWindow,
|
|
291876
|
+
reservedTokens,
|
|
291877
|
+
freeTokens,
|
|
291878
|
+
terminalWidth
|
|
291879
|
+
} = opts;
|
|
291880
|
+
const isNarrowScreen = terminalWidth !== undefined && terminalWidth < 80;
|
|
291881
|
+
const GRID_WIDTH = contextWindow >= 1e6 ? isNarrowScreen ? 5 : 20 : isNarrowScreen ? 5 : 10;
|
|
291882
|
+
const GRID_HEIGHT = contextWindow >= 1e6 ? 10 : isNarrowScreen ? 5 : 10;
|
|
291883
|
+
const TOTAL_SQUARES = GRID_WIDTH * GRID_HEIGHT;
|
|
291884
|
+
const squaresFor = (tokens) => Math.round(tokens / contextWindow * TOTAL_SQUARES);
|
|
291885
|
+
const nonDeferred = categories.filter((cat2) => !cat2.isDeferred);
|
|
291886
|
+
const reservedCategory = nonDeferred.find((cat2) => cat2.name === RESERVED_CATEGORY_NAME || cat2.name === MANUAL_COMPACT_BUFFER_NAME);
|
|
291887
|
+
const freeSpaceCat = nonDeferred.find((cat2) => cat2.name === "Free space");
|
|
291888
|
+
const usageCats = nonDeferred.filter((cat2) => cat2.name !== RESERVED_CATEGORY_NAME && cat2.name !== MANUAL_COMPACT_BUFFER_NAME && cat2.name !== "Free space");
|
|
291889
|
+
const reservedSquares = reservedCategory && reservedTokens > 0 ? Math.min(TOTAL_SQUARES, Math.max(1, squaresFor(reservedTokens))) : 0;
|
|
291890
|
+
const freeSquares = Math.max(0, Math.min(TOTAL_SQUARES - reservedSquares, squaresFor(freeTokens)));
|
|
291891
|
+
const usageBudget = Math.max(0, TOTAL_SQUARES - reservedSquares - freeSquares);
|
|
291892
|
+
const desired = usageCats.map((cat2) => ({
|
|
291893
|
+
cat: cat2,
|
|
291894
|
+
squares: Math.max(1, squaresFor(cat2.tokens))
|
|
291895
|
+
}));
|
|
291896
|
+
const desiredTotal = desired.reduce((sum, d2) => sum + d2.squares, 0);
|
|
291897
|
+
const scale = desiredTotal > usageBudget && desiredTotal > 0 ? usageBudget / desiredTotal : 1;
|
|
291898
|
+
const makeSquares = (cat2, count3) => {
|
|
291899
|
+
const exactSquares = cat2.tokens / contextWindow * TOTAL_SQUARES;
|
|
291900
|
+
const wholeSquares = Math.floor(exactSquares);
|
|
291901
|
+
const fractionalPart = exactSquares - wholeSquares;
|
|
291902
|
+
const percentageOfTotal = Math.round(cat2.tokens / contextWindow * 100);
|
|
291903
|
+
const out = [];
|
|
291904
|
+
for (let i4 = 0;i4 < count3; i4++) {
|
|
291905
|
+
let squareFullness = 1;
|
|
291906
|
+
if (i4 === wholeSquares && fractionalPart > 0) {
|
|
291907
|
+
squareFullness = fractionalPart;
|
|
291908
|
+
}
|
|
291909
|
+
out.push({
|
|
291910
|
+
color: cat2.color,
|
|
291911
|
+
isFilled: true,
|
|
291912
|
+
categoryName: cat2.name,
|
|
291913
|
+
tokens: cat2.tokens,
|
|
291914
|
+
percentage: percentageOfTotal,
|
|
291915
|
+
squareFullness
|
|
291916
|
+
});
|
|
291917
|
+
}
|
|
291918
|
+
return out;
|
|
291919
|
+
};
|
|
291920
|
+
const gridSquares = [];
|
|
291921
|
+
for (const d2 of desired) {
|
|
291922
|
+
const count3 = scale < 1 ? Math.floor(d2.squares * scale) : d2.squares;
|
|
291923
|
+
for (const square of makeSquares(d2.cat, count3)) {
|
|
291924
|
+
if (gridSquares.length < usageBudget) {
|
|
291925
|
+
gridSquares.push(square);
|
|
291926
|
+
}
|
|
291927
|
+
}
|
|
291928
|
+
}
|
|
291929
|
+
const freeTokensForSquare = freeSpaceCat?.tokens ?? freeTokens;
|
|
291930
|
+
const freeTarget = TOTAL_SQUARES - reservedSquares;
|
|
291931
|
+
while (gridSquares.length < freeTarget) {
|
|
291932
|
+
gridSquares.push({
|
|
291933
|
+
color: "promptBorder",
|
|
291934
|
+
isFilled: true,
|
|
291935
|
+
categoryName: "Free space",
|
|
291936
|
+
tokens: freeTokensForSquare,
|
|
291937
|
+
percentage: Math.round(freeTokensForSquare / contextWindow * 100),
|
|
291938
|
+
squareFullness: 1
|
|
291939
|
+
});
|
|
291940
|
+
}
|
|
291941
|
+
if (reservedCategory && reservedSquares > 0) {
|
|
291942
|
+
for (const square of makeSquares(reservedCategory, reservedSquares)) {
|
|
291943
|
+
if (gridSquares.length < TOTAL_SQUARES) {
|
|
291944
|
+
gridSquares.push(square);
|
|
291945
|
+
}
|
|
291946
|
+
}
|
|
291947
|
+
}
|
|
291948
|
+
while (gridSquares.length < TOTAL_SQUARES) {
|
|
291949
|
+
gridSquares.push({
|
|
291950
|
+
color: "promptBorder",
|
|
291951
|
+
isFilled: true,
|
|
291952
|
+
categoryName: "Free space",
|
|
291953
|
+
tokens: freeTokensForSquare,
|
|
291954
|
+
percentage: Math.round(freeTokensForSquare / contextWindow * 100),
|
|
291955
|
+
squareFullness: 1
|
|
291956
|
+
});
|
|
291957
|
+
}
|
|
291958
|
+
const gridRows = [];
|
|
291959
|
+
for (let i4 = 0;i4 < GRID_HEIGHT; i4++) {
|
|
291960
|
+
gridRows.push(gridSquares.slice(i4 * GRID_WIDTH, (i4 + 1) * GRID_WIDTH));
|
|
291961
|
+
}
|
|
291962
|
+
return gridRows;
|
|
291963
|
+
}
|
|
291521
291964
|
async function analyzeContextUsage(messages, model, getToolPermissionContext, tools, agentDefinitions, terminalWidth, toolUseContext, mainThreadAgentDefinition, originalMessages) {
|
|
291522
291965
|
const runtimeModel = getRuntimeMainLoopModel({
|
|
291523
291966
|
permissionMode: (await getToolPermissionContext()).mode,
|
|
@@ -291622,10 +292065,19 @@ async function analyzeContextUsage(messages, model, getToolPermissionContext, to
|
|
|
291622
292065
|
color: "warning"
|
|
291623
292066
|
});
|
|
291624
292067
|
}
|
|
291625
|
-
|
|
292068
|
+
const apiUsage = getCurrentUsage(originalMessages ?? messages);
|
|
292069
|
+
const apiInputTotal = apiUsage ? apiUsage.input_tokens + apiUsage.cache_creation_input_tokens + apiUsage.cache_read_input_tokens : 0;
|
|
292070
|
+
const totalFromAPI = apiInputTotal > 0 ? apiInputTotal : null;
|
|
292071
|
+
const otherCategoriesTokens = cats.reduce((sum, cat2) => sum + (cat2.isDeferred ? 0 : cat2.tokens), 0);
|
|
292072
|
+
const messagesBucketTokens = deriveMessagesBucketTokens({
|
|
292073
|
+
totalFromAPI,
|
|
292074
|
+
otherCategoriesTokens,
|
|
292075
|
+
estimatedMessageTokens: messageTokens
|
|
292076
|
+
});
|
|
292077
|
+
if (messagesBucketTokens > 0) {
|
|
291626
292078
|
cats.push({
|
|
291627
292079
|
name: "Messages",
|
|
291628
|
-
tokens:
|
|
292080
|
+
tokens: messagesBucketTokens,
|
|
291629
292081
|
color: "purple_FOR_SUBAGENTS_ONLY"
|
|
291630
292082
|
});
|
|
291631
292083
|
}
|
|
@@ -291649,9 +292101,6 @@ async function analyzeContextUsage(messages, model, getToolPermissionContext, to
|
|
|
291649
292101
|
color: "inactive"
|
|
291650
292102
|
});
|
|
291651
292103
|
}
|
|
291652
|
-
const apiUsage = getCurrentUsage(originalMessages ?? messages);
|
|
291653
|
-
const apiInputTotal = apiUsage ? apiUsage.input_tokens + apiUsage.cache_creation_input_tokens + apiUsage.cache_read_input_tokens : 0;
|
|
291654
|
-
const totalFromAPI = apiInputTotal > 0 ? apiInputTotal : null;
|
|
291655
292104
|
const { freeTokens, finalTotalTokens } = reconcileContextUsage({
|
|
291656
292105
|
contextWindow,
|
|
291657
292106
|
actualUsage,
|
|
@@ -291663,73 +292112,13 @@ async function analyzeContextUsage(messages, model, getToolPermissionContext, to
|
|
|
291663
292112
|
tokens: freeTokens,
|
|
291664
292113
|
color: "promptBorder"
|
|
291665
292114
|
});
|
|
291666
|
-
const
|
|
291667
|
-
|
|
291668
|
-
|
|
291669
|
-
|
|
291670
|
-
|
|
291671
|
-
|
|
291672
|
-
|
|
291673
|
-
squares: cat2.name === "Free space" ? Math.round(cat2.tokens / contextWindow * TOTAL_SQUARES) : Math.max(1, Math.round(cat2.tokens / contextWindow * TOTAL_SQUARES)),
|
|
291674
|
-
percentageOfTotal: Math.round(cat2.tokens / contextWindow * 100)
|
|
291675
|
-
}));
|
|
291676
|
-
function createCategorySquares(category) {
|
|
291677
|
-
const squares = [];
|
|
291678
|
-
const exactSquares = category.tokens / contextWindow * TOTAL_SQUARES;
|
|
291679
|
-
const wholeSquares = Math.floor(exactSquares);
|
|
291680
|
-
const fractionalPart = exactSquares - wholeSquares;
|
|
291681
|
-
for (let i4 = 0;i4 < category.squares; i4++) {
|
|
291682
|
-
let squareFullness = 1;
|
|
291683
|
-
if (i4 === wholeSquares && fractionalPart > 0) {
|
|
291684
|
-
squareFullness = fractionalPart;
|
|
291685
|
-
}
|
|
291686
|
-
squares.push({
|
|
291687
|
-
color: category.color,
|
|
291688
|
-
isFilled: true,
|
|
291689
|
-
categoryName: category.name,
|
|
291690
|
-
tokens: category.tokens,
|
|
291691
|
-
percentage: category.percentageOfTotal,
|
|
291692
|
-
squareFullness
|
|
291693
|
-
});
|
|
291694
|
-
}
|
|
291695
|
-
return squares;
|
|
291696
|
-
}
|
|
291697
|
-
const gridSquares = [];
|
|
291698
|
-
const reservedCategory = categorySquares.find((cat2) => cat2.name === RESERVED_CATEGORY_NAME || cat2.name === MANUAL_COMPACT_BUFFER_NAME);
|
|
291699
|
-
const nonReservedCategories = categorySquares.filter((cat2) => cat2.name !== RESERVED_CATEGORY_NAME && cat2.name !== MANUAL_COMPACT_BUFFER_NAME && cat2.name !== "Free space");
|
|
291700
|
-
for (const cat2 of nonReservedCategories) {
|
|
291701
|
-
const squares = createCategorySquares(cat2);
|
|
291702
|
-
for (const square of squares) {
|
|
291703
|
-
if (gridSquares.length < TOTAL_SQUARES) {
|
|
291704
|
-
gridSquares.push(square);
|
|
291705
|
-
}
|
|
291706
|
-
}
|
|
291707
|
-
}
|
|
291708
|
-
const reservedSquareCount = reservedCategory ? reservedCategory.squares : 0;
|
|
291709
|
-
const freeSpaceCat = cats.find((c4) => c4.name === "Free space");
|
|
291710
|
-
const freeSpaceTarget = TOTAL_SQUARES - reservedSquareCount;
|
|
291711
|
-
while (gridSquares.length < freeSpaceTarget) {
|
|
291712
|
-
gridSquares.push({
|
|
291713
|
-
color: "promptBorder",
|
|
291714
|
-
isFilled: true,
|
|
291715
|
-
categoryName: "Free space",
|
|
291716
|
-
tokens: freeSpaceCat?.tokens || 0,
|
|
291717
|
-
percentage: freeSpaceCat ? Math.round(freeSpaceCat.tokens / contextWindow * 100) : 0,
|
|
291718
|
-
squareFullness: 1
|
|
291719
|
-
});
|
|
291720
|
-
}
|
|
291721
|
-
if (reservedCategory) {
|
|
291722
|
-
const squares = createCategorySquares(reservedCategory);
|
|
291723
|
-
for (const square of squares) {
|
|
291724
|
-
if (gridSquares.length < TOTAL_SQUARES) {
|
|
291725
|
-
gridSquares.push(square);
|
|
291726
|
-
}
|
|
291727
|
-
}
|
|
291728
|
-
}
|
|
291729
|
-
const gridRows = [];
|
|
291730
|
-
for (let i4 = 0;i4 < GRID_HEIGHT; i4++) {
|
|
291731
|
-
gridRows.push(gridSquares.slice(i4 * GRID_WIDTH, (i4 + 1) * GRID_WIDTH));
|
|
291732
|
-
}
|
|
292115
|
+
const gridRows = buildContextGridRows({
|
|
292116
|
+
categories: cats,
|
|
292117
|
+
contextWindow,
|
|
292118
|
+
reservedTokens,
|
|
292119
|
+
freeTokens,
|
|
292120
|
+
terminalWidth
|
|
292121
|
+
});
|
|
291733
292122
|
const toolsMap = new Map;
|
|
291734
292123
|
for (const [name, tokens] of messageBreakdown.toolCallsByType.entries()) {
|
|
291735
292124
|
const existing = toolsMap.get(name) || { callTokens: 0, resultTokens: 0 };
|
|
@@ -291815,17 +292204,17 @@ var init_analyzeContext = __esm(() => {
|
|
|
291815
292204
|
|
|
291816
292205
|
// src/utils/zodToJsonSchema.ts
|
|
291817
292206
|
function zodToJsonSchema(schema) {
|
|
291818
|
-
const hit =
|
|
292207
|
+
const hit = cache5.get(schema);
|
|
291819
292208
|
if (hit)
|
|
291820
292209
|
return hit;
|
|
291821
292210
|
const result = toJSONSchema(schema);
|
|
291822
|
-
|
|
292211
|
+
cache5.set(schema, result);
|
|
291823
292212
|
return result;
|
|
291824
292213
|
}
|
|
291825
|
-
var
|
|
292214
|
+
var cache5;
|
|
291826
292215
|
var init_zodToJsonSchema = __esm(() => {
|
|
291827
292216
|
init_v4();
|
|
291828
|
-
|
|
292217
|
+
cache5 = new WeakMap;
|
|
291829
292218
|
});
|
|
291830
292219
|
|
|
291831
292220
|
// src/utils/toolSearch.ts
|
|
@@ -293365,21 +293754,21 @@ var init_words = __esm(() => {
|
|
|
293365
293754
|
// src/utils/plans.ts
|
|
293366
293755
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
293367
293756
|
import { copyFile as copyFile3, writeFile as writeFile9 } from "fs/promises";
|
|
293368
|
-
import { join as
|
|
293757
|
+
import { join as join68, resolve as resolve30, sep as sep16 } from "path";
|
|
293369
293758
|
function getPlanSlug(sessionId) {
|
|
293370
293759
|
const id = sessionId ?? getSessionId();
|
|
293371
|
-
const
|
|
293372
|
-
let slug =
|
|
293760
|
+
const cache6 = getPlanSlugCache();
|
|
293761
|
+
let slug = cache6.get(id);
|
|
293373
293762
|
if (!slug) {
|
|
293374
293763
|
const plansDir = getPlansDirectory();
|
|
293375
293764
|
for (let i4 = 0;i4 < MAX_SLUG_RETRIES; i4++) {
|
|
293376
293765
|
slug = generateWordSlug();
|
|
293377
|
-
const filePath =
|
|
293766
|
+
const filePath = join68(plansDir, `${slug}.md`);
|
|
293378
293767
|
if (!getFsImplementation().existsSync(filePath)) {
|
|
293379
293768
|
break;
|
|
293380
293769
|
}
|
|
293381
293770
|
}
|
|
293382
|
-
|
|
293771
|
+
cache6.set(id, slug);
|
|
293383
293772
|
}
|
|
293384
293773
|
return slug;
|
|
293385
293774
|
}
|
|
@@ -293392,9 +293781,9 @@ function clearAllPlanSlugs() {
|
|
|
293392
293781
|
function getPlanFilePath(agentId) {
|
|
293393
293782
|
const planSlug = getPlanSlug(getSessionId());
|
|
293394
293783
|
if (!agentId) {
|
|
293395
|
-
return
|
|
293784
|
+
return join68(getPlansDirectory(), `${planSlug}.md`);
|
|
293396
293785
|
}
|
|
293397
|
-
return
|
|
293786
|
+
return join68(getPlansDirectory(), `${planSlug}-agent-${agentId}.md`);
|
|
293398
293787
|
}
|
|
293399
293788
|
function getPlan(agentId) {
|
|
293400
293789
|
const filePath = getPlanFilePath(agentId);
|
|
@@ -293417,7 +293806,7 @@ async function copyPlanForResume(log3, targetSessionId) {
|
|
|
293417
293806
|
}
|
|
293418
293807
|
const sessionId = targetSessionId ?? getSessionId();
|
|
293419
293808
|
setPlanSlug(sessionId, slug);
|
|
293420
|
-
const planPath =
|
|
293809
|
+
const planPath = join68(getPlansDirectory(), `${slug}.md`);
|
|
293421
293810
|
try {
|
|
293422
293811
|
await getFsImplementation().readFile(planPath, { encoding: "utf-8" });
|
|
293423
293812
|
return true;
|
|
@@ -293460,9 +293849,9 @@ async function copyPlanForFork(log3, targetSessionId) {
|
|
|
293460
293849
|
return false;
|
|
293461
293850
|
}
|
|
293462
293851
|
const plansDir = getPlansDirectory();
|
|
293463
|
-
const originalPlanPath =
|
|
293852
|
+
const originalPlanPath = join68(plansDir, `${originalSlug}.md`);
|
|
293464
293853
|
const newSlug = getPlanSlug(targetSessionId);
|
|
293465
|
-
const newPlanPath =
|
|
293854
|
+
const newPlanPath = join68(plansDir, `${newSlug}.md`);
|
|
293466
293855
|
try {
|
|
293467
293856
|
await copyFile3(originalPlanPath, newPlanPath);
|
|
293468
293857
|
return true;
|
|
@@ -293577,12 +293966,12 @@ var init_plans = __esm(() => {
|
|
|
293577
293966
|
const resolved = resolve30(cwd2, settingsDir);
|
|
293578
293967
|
if (!resolved.startsWith(cwd2 + sep16) && resolved !== cwd2) {
|
|
293579
293968
|
logError2(new Error(`plansDirectory must be within project root: ${settingsDir}`));
|
|
293580
|
-
plansPath =
|
|
293969
|
+
plansPath = join68(getRayuConfigHomeDir(), "plans");
|
|
293581
293970
|
} else {
|
|
293582
293971
|
plansPath = resolved;
|
|
293583
293972
|
}
|
|
293584
293973
|
} else {
|
|
293585
|
-
plansPath =
|
|
293974
|
+
plansPath = join68(getRayuConfigHomeDir(), "plans");
|
|
293586
293975
|
}
|
|
293587
293976
|
try {
|
|
293588
293977
|
getFsImplementation().mkdirSync(plansPath);
|
|
@@ -295265,10 +295654,10 @@ function DANGEROUS_uncachedSystemPromptSection(name, compute, _reason) {
|
|
|
295265
295654
|
return { name, compute, cacheBreak: true };
|
|
295266
295655
|
}
|
|
295267
295656
|
async function resolveSystemPromptSections(sections) {
|
|
295268
|
-
const
|
|
295657
|
+
const cache6 = getSystemPromptSectionCache();
|
|
295269
295658
|
return Promise.all(sections.map(async (s2) => {
|
|
295270
|
-
if (!s2.cacheBreak &&
|
|
295271
|
-
return
|
|
295659
|
+
if (!s2.cacheBreak && cache6.has(s2.name)) {
|
|
295660
|
+
return cache6.get(s2.name) ?? null;
|
|
295272
295661
|
}
|
|
295273
295662
|
const value = await s2.compute();
|
|
295274
295663
|
setSystemPromptSectionCacheEntry(s2.name, value);
|
|
@@ -301569,7 +301958,7 @@ function getTelemetryAttributes() {
|
|
|
301569
301958
|
attributes["session.id"] = sessionId;
|
|
301570
301959
|
}
|
|
301571
301960
|
if (shouldIncludeAttribute("OTEL_METRICS_INCLUDE_VERSION")) {
|
|
301572
|
-
attributes["app.version"] = "1.3.
|
|
301961
|
+
attributes["app.version"] = "1.3.445";
|
|
301573
301962
|
}
|
|
301574
301963
|
const oauthAccount = getOauthAccountInfo();
|
|
301575
301964
|
if (oauthAccount) {
|
|
@@ -301935,7 +302324,7 @@ var init_postCompactCleanup = __esm(() => {
|
|
|
301935
302324
|
|
|
301936
302325
|
// src/services/SessionMemory/prompts.ts
|
|
301937
302326
|
import { readFile as readFile15 } from "fs/promises";
|
|
301938
|
-
import { join as
|
|
302327
|
+
import { join as join69 } from "path";
|
|
301939
302328
|
function getDefaultUpdatePrompt() {
|
|
301940
302329
|
return `IMPORTANT: This message and these instructions are NOT part of the actual user conversation. Do NOT include any references to "note-taking", "session notes extraction", or these update instructions in the notes content.
|
|
301941
302330
|
|
|
@@ -301976,7 +302365,7 @@ You ONLY update the actual content that comes AFTER these two preserved lines. T
|
|
|
301976
302365
|
REMEMBER: Use the Edit tool in parallel and stop. Do not continue after the edits. Only include insights from the actual user conversation, never from these note-taking instructions. Do not delete or change section headers or italic _section descriptions_.`;
|
|
301977
302366
|
}
|
|
301978
302367
|
async function loadSessionMemoryTemplate() {
|
|
301979
|
-
const templatePath =
|
|
302368
|
+
const templatePath = join69(getRayuConfigHomeDir(), "session-memory", "config", "template.md");
|
|
301980
302369
|
try {
|
|
301981
302370
|
return await readFile15(templatePath, { encoding: "utf-8" });
|
|
301982
302371
|
} catch (e2) {
|
|
@@ -301989,7 +302378,7 @@ async function loadSessionMemoryTemplate() {
|
|
|
301989
302378
|
}
|
|
301990
302379
|
}
|
|
301991
302380
|
async function loadSessionMemoryPrompt() {
|
|
301992
|
-
const promptPath =
|
|
302381
|
+
const promptPath = join69(getRayuConfigHomeDir(), "session-memory", "config", "prompt.md");
|
|
301993
302382
|
try {
|
|
301994
302383
|
return await readFile15(promptPath, { encoding: "utf-8" });
|
|
301995
302384
|
} catch (e2) {
|
|
@@ -302591,6 +302980,14 @@ var init_autoCompact = __esm(() => {
|
|
|
302591
302980
|
init_sessionMemoryCompact();
|
|
302592
302981
|
});
|
|
302593
302982
|
|
|
302983
|
+
// src/query/interruptMessage.ts
|
|
302984
|
+
function isUserAbortRenderedMessage(msg) {
|
|
302985
|
+
return msg?.isApiErrorMessage === true && Array.isArray(msg.message?.content) && msg.message.content.some((block) => block.type === "text" && block.text === ERROR_MESSAGE_USER_ABORT);
|
|
302986
|
+
}
|
|
302987
|
+
var init_interruptMessage = __esm(() => {
|
|
302988
|
+
init_compact();
|
|
302989
|
+
});
|
|
302990
|
+
|
|
302594
302991
|
// src/constants/errorIds.ts
|
|
302595
302992
|
var E_TOOL_USE_SUMMARY_GENERATION_FAILED = 344;
|
|
302596
302993
|
|
|
@@ -303074,7 +303471,7 @@ var init_postSamplingHooks = __esm(() => {
|
|
|
303074
303471
|
// src/services/api/dumpPrompts.ts
|
|
303075
303472
|
import { createHash as createHash8 } from "crypto";
|
|
303076
303473
|
import { promises as fs12 } from "fs";
|
|
303077
|
-
import { dirname as dirname32, join as
|
|
303474
|
+
import { dirname as dirname32, join as join70 } from "path";
|
|
303078
303475
|
function hashString3(str3) {
|
|
303079
303476
|
return createHash8("sha256").update(str3).digest("hex");
|
|
303080
303477
|
}
|
|
@@ -303096,7 +303493,7 @@ function addApiRequestToCache(requestData) {
|
|
|
303096
303493
|
}
|
|
303097
303494
|
}
|
|
303098
303495
|
function getDumpPromptsPath(agentIdOrSessionId) {
|
|
303099
|
-
return
|
|
303496
|
+
return join70(getRayuConfigHomeDir(), "dump-prompts", `${agentIdOrSessionId ?? getSessionId()}.jsonl`);
|
|
303100
303497
|
}
|
|
303101
303498
|
function appendToFile(filePath, entries) {
|
|
303102
303499
|
if (entries.length === 0)
|
|
@@ -303379,7 +303776,7 @@ var require_core = __commonJS((exports, module) => {
|
|
|
303379
303776
|
return match && match.index === 0;
|
|
303380
303777
|
}
|
|
303381
303778
|
var BACKREF_RE = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;
|
|
303382
|
-
function
|
|
303779
|
+
function join71(regexps, separator = "|") {
|
|
303383
303780
|
let numCaptures = 0;
|
|
303384
303781
|
return regexps.map((regex2) => {
|
|
303385
303782
|
numCaptures += 1;
|
|
@@ -303662,7 +304059,7 @@ var require_core = __commonJS((exports, module) => {
|
|
|
303662
304059
|
this.exec = () => null;
|
|
303663
304060
|
}
|
|
303664
304061
|
const terminators = this.regexes.map((el) => el[1]);
|
|
303665
|
-
this.matcherRe = langRe(
|
|
304062
|
+
this.matcherRe = langRe(join71(terminators), true);
|
|
303666
304063
|
this.lastIndex = 0;
|
|
303667
304064
|
}
|
|
303668
304065
|
exec(s2) {
|
|
@@ -399209,7 +399606,7 @@ var EXIT_WORKTREE_TOOL_NAME = "ExitWorktree";
|
|
|
399209
399606
|
var init_cron = () => {};
|
|
399210
399607
|
|
|
399211
399608
|
// src/utils/cronTasks.ts
|
|
399212
|
-
import { dirname as dirname33, join as
|
|
399609
|
+
import { dirname as dirname33, join as join71 } from "path";
|
|
399213
399610
|
var CRON_FILE_REL, DEFAULT_CRON_JITTER_CONFIG;
|
|
399214
399611
|
var init_cronTasks = __esm(() => {
|
|
399215
399612
|
init_state();
|
|
@@ -399220,7 +399617,7 @@ var init_cronTasks = __esm(() => {
|
|
|
399220
399617
|
init_json();
|
|
399221
399618
|
init_log2();
|
|
399222
399619
|
init_slowOperations();
|
|
399223
|
-
CRON_FILE_REL =
|
|
399620
|
+
CRON_FILE_REL = join71(".rayu", "scheduled_tasks.json");
|
|
399224
399621
|
DEFAULT_CRON_JITTER_CONFIG = {
|
|
399225
399622
|
recurringFrac: 0.1,
|
|
399226
399623
|
recurringCapMs: 15 * 60 * 1000,
|
|
@@ -406501,7 +406898,7 @@ function expandEnvVarsInString(value) {
|
|
|
406501
406898
|
}
|
|
406502
406899
|
|
|
406503
406900
|
// src/utils/plugins/mcpPluginIntegration.ts
|
|
406504
|
-
import { join as
|
|
406901
|
+
import { join as join72 } from "path";
|
|
406505
406902
|
async function loadMcpServersFromMcpb(plugin, mcpbPath, errors6) {
|
|
406506
406903
|
try {
|
|
406507
406904
|
logForDebugging(`Loading MCP servers from MCPB: ${mcpbPath}`);
|
|
@@ -406600,7 +406997,7 @@ async function loadPluginMcpServers(plugin, errors6 = []) {
|
|
|
406600
406997
|
}
|
|
406601
406998
|
async function loadMcpServersFromFile(pluginPath, relativePath) {
|
|
406602
406999
|
const fs13 = getFsImplementation();
|
|
406603
|
-
const filePath =
|
|
407000
|
+
const filePath = join72(pluginPath, relativePath);
|
|
406604
407001
|
let content;
|
|
406605
407002
|
try {
|
|
406606
407003
|
content = await fs13.readFile(filePath, { encoding: "utf-8" });
|
|
@@ -406796,9 +407193,9 @@ var init_mcpPluginIntegration = __esm(() => {
|
|
|
406796
407193
|
// src/services/mcp/config.ts
|
|
406797
407194
|
import { chmod as chmod2, open as open8, rename as rename3, stat as stat21, unlink as unlink6 } from "fs/promises";
|
|
406798
407195
|
import { homedir as homedir21 } from "os";
|
|
406799
|
-
import { dirname as dirname34, join as
|
|
407196
|
+
import { dirname as dirname34, join as join73, parse as parse10 } from "path";
|
|
406800
407197
|
function getEnterpriseMcpFilePath() {
|
|
406801
|
-
return
|
|
407198
|
+
return join73(getManagedFilePath(), "managed-mcp.json");
|
|
406802
407199
|
}
|
|
406803
407200
|
function addScopeToServers(servers, scope) {
|
|
406804
407201
|
if (!servers) {
|
|
@@ -406811,7 +407208,7 @@ function addScopeToServers(servers, scope) {
|
|
|
406811
407208
|
return scopedServers;
|
|
406812
407209
|
}
|
|
406813
407210
|
async function writeMcpjsonFile(config4) {
|
|
406814
|
-
const mcpJsonPath =
|
|
407211
|
+
const mcpJsonPath = join73(getCwd(), ".mcp.json");
|
|
406815
407212
|
let existingMode;
|
|
406816
407213
|
try {
|
|
406817
407214
|
const stats2 = await stat21(mcpJsonPath);
|
|
@@ -407233,7 +407630,7 @@ function getProjectMcpConfigsFromCwd() {
|
|
|
407233
407630
|
if (!isSettingSourceEnabled("projectSettings")) {
|
|
407234
407631
|
return { servers: {}, errors: [] };
|
|
407235
407632
|
}
|
|
407236
|
-
const mcpJsonPath =
|
|
407633
|
+
const mcpJsonPath = join73(getCwd(), ".mcp.json");
|
|
407237
407634
|
const { config: config4, errors: errors6 } = parseMcpConfigFromFilePath({
|
|
407238
407635
|
filePath: mcpJsonPath,
|
|
407239
407636
|
expandVars: true,
|
|
@@ -407272,7 +407669,7 @@ function getMcpConfigsByScope(scope) {
|
|
|
407272
407669
|
currentDir = dirname34(currentDir);
|
|
407273
407670
|
}
|
|
407274
407671
|
for (const dir of dirs.reverse()) {
|
|
407275
|
-
const mcpJsonPath =
|
|
407672
|
+
const mcpJsonPath = join73(dir, ".mcp.json");
|
|
407276
407673
|
const { config: config4, errors: errors6 } = parseMcpConfigFromFilePath({
|
|
407277
407674
|
filePath: mcpJsonPath,
|
|
407278
407675
|
expandVars: true,
|
|
@@ -407388,15 +407785,15 @@ function getClaudeFallbackMcpServers() {
|
|
|
407388
407785
|
}
|
|
407389
407786
|
};
|
|
407390
407787
|
const rawSources = [];
|
|
407391
|
-
const claudeJson = readJson(
|
|
407788
|
+
const claudeJson = readJson(join73(home, ".claude.json"));
|
|
407392
407789
|
if (claudeJson) {
|
|
407393
407790
|
rawSources.push(claudeJson.mcpServers);
|
|
407394
407791
|
const projects = claudeJson.projects;
|
|
407395
407792
|
rawSources.push(projects?.[cwd2]?.mcpServers);
|
|
407396
407793
|
}
|
|
407397
407794
|
for (const p of [
|
|
407398
|
-
|
|
407399
|
-
|
|
407795
|
+
join73(cwd2, ".claude", "settings.json"),
|
|
407796
|
+
join73(home, ".claude", "settings.json")
|
|
407400
407797
|
]) {
|
|
407401
407798
|
const s2 = readJson(p);
|
|
407402
407799
|
if (s2)
|
|
@@ -407726,7 +408123,7 @@ var init_config3 = __esm(() => {
|
|
|
407726
408123
|
|
|
407727
408124
|
// src/services/mcp/utils.ts
|
|
407728
408125
|
import { createHash as createHash9 } from "crypto";
|
|
407729
|
-
import { join as
|
|
408126
|
+
import { join as join74 } from "path";
|
|
407730
408127
|
function filterToolsByServer(tools, serverName) {
|
|
407731
408128
|
const prefix = `mcp__${normalizeNameForMCP(serverName)}__`;
|
|
407732
408129
|
return tools.filter((tool) => tool.name?.startsWith(prefix));
|
|
@@ -407800,7 +408197,7 @@ function describeMcpConfigFilePath(scope) {
|
|
|
407800
408197
|
case "user":
|
|
407801
408198
|
return getGlobalRayuFile();
|
|
407802
408199
|
case "project":
|
|
407803
|
-
return
|
|
408200
|
+
return join74(getCwd(), ".mcp.json");
|
|
407804
408201
|
case "local":
|
|
407805
408202
|
return `${getGlobalRayuFile()} [project: ${getCwd()}]`;
|
|
407806
408203
|
case "dynamic":
|
|
@@ -408479,7 +408876,7 @@ var init_xaaIdpLogin = __esm(() => {
|
|
|
408479
408876
|
import { createHash as createHash10, randomBytes as randomBytes7, randomUUID as randomUUID10 } from "crypto";
|
|
408480
408877
|
import { mkdir as mkdir11 } from "fs/promises";
|
|
408481
408878
|
import { createServer as createServer6 } from "http";
|
|
408482
|
-
import { join as
|
|
408879
|
+
import { join as join75 } from "path";
|
|
408483
408880
|
import { parse as parse12 } from "url";
|
|
408484
408881
|
function redactSensitiveUrlParams(url3) {
|
|
408485
408882
|
try {
|
|
@@ -409591,7 +409988,7 @@ class RayuMcpOAuthProvider {
|
|
|
409591
409988
|
const rayuDir = getRayuConfigHomeDir();
|
|
409592
409989
|
await mkdir11(rayuDir, { recursive: true });
|
|
409593
409990
|
const sanitizedKey = serverKey.replace(/[^a-zA-Z0-9]/g, "_");
|
|
409594
|
-
const lockfilePath =
|
|
409991
|
+
const lockfilePath = join75(rayuDir, `mcp-refresh-${sanitizedKey}.lock`);
|
|
409595
409992
|
let release;
|
|
409596
409993
|
for (let retry = 0;retry < MAX_LOCK_RETRIES; retry++) {
|
|
409597
409994
|
try {
|
|
@@ -410002,7 +410399,7 @@ var init_McpAuthTool = __esm(() => {
|
|
|
410002
410399
|
|
|
410003
410400
|
// src/utils/mcpOutputStorage.ts
|
|
410004
410401
|
import { writeFile as writeFile10 } from "fs/promises";
|
|
410005
|
-
import { join as
|
|
410402
|
+
import { join as join76 } from "path";
|
|
410006
410403
|
function getFormatDescription(type, schema) {
|
|
410007
410404
|
switch (type) {
|
|
410008
410405
|
case "toolResult":
|
|
@@ -410099,7 +410496,7 @@ function isBinaryContentType(contentType) {
|
|
|
410099
410496
|
async function persistBinaryContent(bytes, mimeType, persistId) {
|
|
410100
410497
|
await ensureToolResultsDir();
|
|
410101
410498
|
const ext = extensionForMimeType(mimeType);
|
|
410102
|
-
const filepath =
|
|
410499
|
+
const filepath = join76(getToolResultsDir(), `${persistId}.${ext}`);
|
|
410103
410500
|
try {
|
|
410104
410501
|
await writeFile10(filepath, bytes);
|
|
410105
410502
|
} catch (error54) {
|
|
@@ -410498,7 +410895,7 @@ var init_capitalize = __esm(() => {
|
|
|
410498
410895
|
|
|
410499
410896
|
// src/utils/jetbrains.ts
|
|
410500
410897
|
import { homedir as homedir22, platform as platform2 } from "os";
|
|
410501
|
-
import { join as
|
|
410898
|
+
import { join as join77 } from "path";
|
|
410502
410899
|
function buildCommonPluginDirectoryPaths(ideName) {
|
|
410503
410900
|
const homeDir = homedir22();
|
|
410504
410901
|
const directories = [];
|
|
@@ -410506,28 +410903,28 @@ function buildCommonPluginDirectoryPaths(ideName) {
|
|
|
410506
410903
|
if (!idePatterns) {
|
|
410507
410904
|
return directories;
|
|
410508
410905
|
}
|
|
410509
|
-
const appData = process.env.APPDATA ||
|
|
410510
|
-
const localAppData = process.env.LOCALAPPDATA ||
|
|
410906
|
+
const appData = process.env.APPDATA || join77(homeDir, "AppData", "Roaming");
|
|
410907
|
+
const localAppData = process.env.LOCALAPPDATA || join77(homeDir, "AppData", "Local");
|
|
410511
410908
|
switch (platform2()) {
|
|
410512
410909
|
case "darwin":
|
|
410513
|
-
directories.push(
|
|
410910
|
+
directories.push(join77(homeDir, "Library", "Application Support", "JetBrains"), join77(homeDir, "Library", "Application Support"));
|
|
410514
410911
|
if (ideName.toLowerCase() === "androidstudio") {
|
|
410515
|
-
directories.push(
|
|
410912
|
+
directories.push(join77(homeDir, "Library", "Application Support", "Google"));
|
|
410516
410913
|
}
|
|
410517
410914
|
break;
|
|
410518
410915
|
case "win32":
|
|
410519
|
-
directories.push(
|
|
410916
|
+
directories.push(join77(appData, "JetBrains"), join77(localAppData, "JetBrains"), join77(appData));
|
|
410520
410917
|
if (ideName.toLowerCase() === "androidstudio") {
|
|
410521
|
-
directories.push(
|
|
410918
|
+
directories.push(join77(localAppData, "Google"));
|
|
410522
410919
|
}
|
|
410523
410920
|
break;
|
|
410524
410921
|
case "linux":
|
|
410525
|
-
directories.push(
|
|
410922
|
+
directories.push(join77(homeDir, ".config", "JetBrains"), join77(homeDir, ".local", "share", "JetBrains"));
|
|
410526
410923
|
for (const pattern of idePatterns) {
|
|
410527
|
-
directories.push(
|
|
410924
|
+
directories.push(join77(homeDir, "." + pattern));
|
|
410528
410925
|
}
|
|
410529
410926
|
if (ideName.toLowerCase() === "androidstudio") {
|
|
410530
|
-
directories.push(
|
|
410927
|
+
directories.push(join77(homeDir, ".config", "Google"));
|
|
410531
410928
|
}
|
|
410532
410929
|
break;
|
|
410533
410930
|
default:
|
|
@@ -410553,12 +410950,12 @@ async function detectPluginDirectories(ideName) {
|
|
|
410553
410950
|
continue;
|
|
410554
410951
|
if (!entry.isDirectory() && !entry.isSymbolicLink())
|
|
410555
410952
|
continue;
|
|
410556
|
-
const dir =
|
|
410953
|
+
const dir = join77(baseDir, entry.name);
|
|
410557
410954
|
if (platform2() === "linux") {
|
|
410558
410955
|
foundDirectories.push(dir);
|
|
410559
410956
|
continue;
|
|
410560
410957
|
}
|
|
410561
|
-
const pluginDir =
|
|
410958
|
+
const pluginDir = join77(dir, "plugins");
|
|
410562
410959
|
try {
|
|
410563
410960
|
await fs13.stat(pluginDir);
|
|
410564
410961
|
foundDirectories.push(pluginDir);
|
|
@@ -410574,7 +410971,7 @@ async function detectPluginDirectories(ideName) {
|
|
|
410574
410971
|
async function isJetBrainsPluginInstalled(ideType) {
|
|
410575
410972
|
const pluginDirs = await detectPluginDirectories(ideType);
|
|
410576
410973
|
for (const dir of pluginDirs) {
|
|
410577
|
-
const pluginPath =
|
|
410974
|
+
const pluginPath = join77(dir, PLUGIN_PREFIX);
|
|
410578
410975
|
try {
|
|
410579
410976
|
await getFsImplementation().stat(pluginPath);
|
|
410580
410977
|
return true;
|
|
@@ -411511,7 +411908,7 @@ var init_IdeOnboardingDialog = __esm(() => {
|
|
|
411511
411908
|
// src/utils/ide.ts
|
|
411512
411909
|
import { createConnection } from "net";
|
|
411513
411910
|
import * as os6 from "os";
|
|
411514
|
-
import { basename as basename18, join as
|
|
411911
|
+
import { basename as basename18, join as join78, sep as pathSeparator, resolve as resolve32 } from "path";
|
|
411515
411912
|
function isProcessRunning2(pid) {
|
|
411516
411913
|
try {
|
|
411517
411914
|
process.kill(pid, 0);
|
|
@@ -411555,7 +411952,7 @@ async function getSortedIdeLockfiles() {
|
|
|
411555
411952
|
const entries = await getFsImplementation().readdir(ideLockFilePath);
|
|
411556
411953
|
const lockEntries = entries.filter((file2) => file2.name.endsWith(".lock"));
|
|
411557
411954
|
const stats2 = await Promise.all(lockEntries.map(async (file2) => {
|
|
411558
|
-
const fullPath =
|
|
411955
|
+
const fullPath = join78(ideLockFilePath, file2.name);
|
|
411559
411956
|
try {
|
|
411560
411957
|
const fileStat = await getFsImplementation().stat(fullPath);
|
|
411561
411958
|
return { path: fullPath, mtime: fileStat.mtime };
|
|
@@ -411646,8 +412043,8 @@ async function checkIdeConnection(host, port2, timeout = 500) {
|
|
|
411646
412043
|
}
|
|
411647
412044
|
async function getIdeLockfilesPaths() {
|
|
411648
412045
|
const paths2 = [
|
|
411649
|
-
|
|
411650
|
-
|
|
412046
|
+
join78(getRayuConfigHomeDir(), "ide"),
|
|
412047
|
+
join78(os6.homedir(), ".claude", "ide")
|
|
411651
412048
|
];
|
|
411652
412049
|
if (getPlatform() !== "wsl") {
|
|
411653
412050
|
return paths2;
|
|
@@ -411669,8 +412066,8 @@ async function getIdeLockfilesPaths() {
|
|
|
411669
412066
|
if (user.name === "Public" || user.name === "Default" || user.name === "Default User" || user.name === "All Users") {
|
|
411670
412067
|
continue;
|
|
411671
412068
|
}
|
|
411672
|
-
paths2.push(
|
|
411673
|
-
paths2.push(
|
|
412069
|
+
paths2.push(join78(usersDir, user.name, ".rayu", "ide"));
|
|
412070
|
+
paths2.push(join78(usersDir, user.name, ".claude", "ide"));
|
|
411674
412071
|
}
|
|
411675
412072
|
} catch (error54) {
|
|
411676
412073
|
if (isFsInaccessible(error54)) {
|
|
@@ -411924,7 +412321,7 @@ function getInstallationEnv() {
|
|
|
411924
412321
|
return;
|
|
411925
412322
|
}
|
|
411926
412323
|
function getClaudeCodeVersion() {
|
|
411927
|
-
return "1.3.
|
|
412324
|
+
return "1.3.445";
|
|
411928
412325
|
}
|
|
411929
412326
|
async function getInstalledVSCodeExtensionVersion(command) {
|
|
411930
412327
|
const { stdout } = await execFileNoThrow(command, ["--list-extensions", "--show-versions"], {
|
|
@@ -412553,14 +412950,14 @@ function recursivelySanitizeUnicode(value) {
|
|
|
412553
412950
|
}
|
|
412554
412951
|
|
|
412555
412952
|
// src/utils/authFileDescriptor.ts
|
|
412556
|
-
import { mkdirSync as
|
|
412953
|
+
import { mkdirSync as mkdirSync12, writeFileSync as writeFileSync12 } from "fs";
|
|
412557
412954
|
function maybePersistTokenForSubprocesses(path19, token, tokenName) {
|
|
412558
412955
|
if (!isEnvTruthy(process.env.CLAUDE_CODE_REMOTE)) {
|
|
412559
412956
|
return;
|
|
412560
412957
|
}
|
|
412561
412958
|
try {
|
|
412562
|
-
|
|
412563
|
-
|
|
412959
|
+
mkdirSync12(CCR_TOKEN_DIR, { recursive: true, mode: 448 });
|
|
412960
|
+
writeFileSync12(path19, token, { encoding: "utf8", mode: 384 });
|
|
412564
412961
|
logForDebugging(`Persisted ${tokenName} to ${path19} for subprocess access`);
|
|
412565
412962
|
} catch (error54) {
|
|
412566
412963
|
logForDebugging(`Failed to persist ${tokenName} to disk (non-fatal): ${errorMessage(error54)}`, { level: "error" });
|
|
@@ -416360,7 +416757,7 @@ var init_wrapper = __esm(() => {
|
|
|
416360
416757
|
|
|
416361
416758
|
// src/services/mcp/client.ts
|
|
416362
416759
|
import { mkdir as mkdir12, readFile as readFile16, unlink as unlink7, writeFile as writeFile11 } from "fs/promises";
|
|
416363
|
-
import { dirname as dirname35, join as
|
|
416760
|
+
import { dirname as dirname35, join as join79 } from "path";
|
|
416364
416761
|
function isMcpSessionExpiredError(error54) {
|
|
416365
416762
|
const httpStatus = "code" in error54 ? error54.code : undefined;
|
|
416366
416763
|
if (httpStatus !== 404) {
|
|
@@ -416372,7 +416769,7 @@ function getMcpToolTimeoutMs() {
|
|
|
416372
416769
|
return parseInt(process.env.MCP_TOOL_TIMEOUT || "", 10) || DEFAULT_MCP_TOOL_TIMEOUT_MS;
|
|
416373
416770
|
}
|
|
416374
416771
|
function getMcpAuthCachePath() {
|
|
416375
|
-
return
|
|
416772
|
+
return join79(getRayuConfigHomeDir(), "mcp-needs-auth-cache.json");
|
|
416376
416773
|
}
|
|
416377
416774
|
function getMcpAuthCache() {
|
|
416378
416775
|
if (!authCachePromise) {
|
|
@@ -416381,8 +416778,8 @@ function getMcpAuthCache() {
|
|
|
416381
416778
|
return authCachePromise;
|
|
416382
416779
|
}
|
|
416383
416780
|
async function isMcpAuthCached(serverId) {
|
|
416384
|
-
const
|
|
416385
|
-
const entry =
|
|
416781
|
+
const cache6 = await getMcpAuthCache();
|
|
416782
|
+
const entry = cache6[serverId];
|
|
416386
416783
|
if (!entry) {
|
|
416387
416784
|
return false;
|
|
416388
416785
|
}
|
|
@@ -416390,11 +416787,11 @@ async function isMcpAuthCached(serverId) {
|
|
|
416390
416787
|
}
|
|
416391
416788
|
function setMcpAuthCacheEntry(serverId) {
|
|
416392
416789
|
writeChain = writeChain.then(async () => {
|
|
416393
|
-
const
|
|
416394
|
-
|
|
416790
|
+
const cache6 = await getMcpAuthCache();
|
|
416791
|
+
cache6[serverId] = { timestamp: Date.now() };
|
|
416395
416792
|
const cachePath = getMcpAuthCachePath();
|
|
416396
416793
|
await mkdir12(dirname35(cachePath), { recursive: true });
|
|
416397
|
-
await writeFile11(cachePath, jsonStringify(
|
|
416794
|
+
await writeFile11(cachePath, jsonStringify(cache6));
|
|
416398
416795
|
authCachePromise = null;
|
|
416399
416796
|
}).catch(() => {});
|
|
416400
416797
|
}
|
|
@@ -417162,7 +417559,7 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
|
|
|
417162
417559
|
const client4 = new Client({
|
|
417163
417560
|
name: "claude-code",
|
|
417164
417561
|
title: "RAYU",
|
|
417165
|
-
version: "1.3.
|
|
417562
|
+
version: "1.3.445",
|
|
417166
417563
|
description: "Anthropic's agentic coding tool",
|
|
417167
417564
|
websiteUrl: PRODUCT_URL
|
|
417168
417565
|
}, {
|
|
@@ -417479,7 +417876,7 @@ var init_client7 = __esm(() => {
|
|
|
417479
417876
|
const client4 = new Client({
|
|
417480
417877
|
name: "claude-code",
|
|
417481
417878
|
title: "RAYU",
|
|
417482
|
-
version: "1.3.
|
|
417879
|
+
version: "1.3.445",
|
|
417483
417880
|
description: "Anthropic's agentic coding tool",
|
|
417484
417881
|
websiteUrl: PRODUCT_URL
|
|
417485
417882
|
}, {
|
|
@@ -418481,7 +418878,7 @@ var init_LSPDiagnosticRegistry = __esm(() => {
|
|
|
418481
418878
|
|
|
418482
418879
|
// src/utils/plugins/lspPluginIntegration.ts
|
|
418483
418880
|
import { readFile as readFile17 } from "fs/promises";
|
|
418484
|
-
import { join as
|
|
418881
|
+
import { join as join80, relative as relative10, resolve as resolve33 } from "path";
|
|
418485
418882
|
function validatePathWithinPlugin(pluginPath, relativePath) {
|
|
418486
418883
|
const resolvedPluginPath = resolve33(pluginPath);
|
|
418487
418884
|
const resolvedFilePath = resolve33(pluginPath, relativePath);
|
|
@@ -418493,7 +418890,7 @@ function validatePathWithinPlugin(pluginPath, relativePath) {
|
|
|
418493
418890
|
}
|
|
418494
418891
|
async function loadPluginLspServers(plugin, errors6 = []) {
|
|
418495
418892
|
const servers = {};
|
|
418496
|
-
const lspJsonPath =
|
|
418893
|
+
const lspJsonPath = join80(plugin.path, ".lsp.json");
|
|
418497
418894
|
try {
|
|
418498
418895
|
const content = await readFile17(lspJsonPath, "utf-8");
|
|
418499
418896
|
const parsed = jsonParse(content);
|
|
@@ -423260,7 +423657,7 @@ import {
|
|
|
423260
423657
|
stat as stat22,
|
|
423261
423658
|
unlink as unlink8
|
|
423262
423659
|
} from "fs/promises";
|
|
423263
|
-
import { dirname as dirname36, isAbsolute as isAbsolute20, join as
|
|
423660
|
+
import { dirname as dirname36, isAbsolute as isAbsolute20, join as join81, relative as relative11 } from "path";
|
|
423264
423661
|
import { inspect as inspect3 } from "util";
|
|
423265
423662
|
function fileHistoryEnabled() {
|
|
423266
423663
|
if (getIsNonInteractiveSession()) {
|
|
@@ -423679,7 +424076,7 @@ function getBackupFileName(filePath, version2) {
|
|
|
423679
424076
|
}
|
|
423680
424077
|
function resolveBackupPath(backupFileName, sessionId) {
|
|
423681
424078
|
const configDir = getRayuConfigHomeDir();
|
|
423682
|
-
return
|
|
424079
|
+
return join81(configDir, "file-history", sessionId || getSessionId(), backupFileName);
|
|
423683
424080
|
}
|
|
423684
424081
|
async function createBackup(filePath, version2) {
|
|
423685
424082
|
if (filePath === null) {
|
|
@@ -423761,7 +424158,7 @@ function maybeExpandFilePath(filePath) {
|
|
|
423761
424158
|
if (isAbsolute20(filePath)) {
|
|
423762
424159
|
return filePath;
|
|
423763
424160
|
}
|
|
423764
|
-
return
|
|
424161
|
+
return join81(getOriginalCwd(), filePath);
|
|
423765
424162
|
}
|
|
423766
424163
|
function fileHistoryRestoreStateFromLog(fileHistorySnapshots, onUpdateState) {
|
|
423767
424164
|
if (!fileHistoryEnabled()) {
|
|
@@ -423807,14 +424204,14 @@ async function copyFileHistoryForResume(log3) {
|
|
|
423807
424204
|
return;
|
|
423808
424205
|
}
|
|
423809
424206
|
try {
|
|
423810
|
-
const newBackupDir =
|
|
424207
|
+
const newBackupDir = join81(getRayuConfigHomeDir(), "file-history", sessionId);
|
|
423811
424208
|
await mkdir13(newBackupDir, { recursive: true });
|
|
423812
424209
|
let failedSnapshots = 0;
|
|
423813
424210
|
await Promise.allSettled(fileHistorySnapshots.map(async (snapshot2) => {
|
|
423814
424211
|
const backupEntries = Object.values(snapshot2.trackedFileBackups).filter((backup) => backup.backupFileName !== null);
|
|
423815
424212
|
const results = await Promise.allSettled(backupEntries.map(async ({ backupFileName }) => {
|
|
423816
424213
|
const oldBackupPath = resolveBackupPath(backupFileName, previousSessionId);
|
|
423817
|
-
const newBackupPath =
|
|
424214
|
+
const newBackupPath = join81(newBackupDir, backupFileName);
|
|
423818
424215
|
try {
|
|
423819
424216
|
await link3(oldBackupPath, newBackupPath);
|
|
423820
424217
|
} catch (e2) {
|
|
@@ -423940,7 +424337,7 @@ var init_fileOperationAnalytics = __esm(() => {
|
|
|
423940
424337
|
|
|
423941
424338
|
// src/utils/gitDiff.ts
|
|
423942
424339
|
import { access as access3, readFile as readFile19 } from "fs/promises";
|
|
423943
|
-
import { dirname as dirname37, join as
|
|
424340
|
+
import { dirname as dirname37, join as join82, relative as relative12, sep as sep17 } from "path";
|
|
423944
424341
|
async function fetchGitDiff() {
|
|
423945
424342
|
const isGit = await getIsGit();
|
|
423946
424343
|
if (!isGit)
|
|
@@ -424091,7 +424488,7 @@ async function isInTransientGitState() {
|
|
|
424091
424488
|
"CHERRY_PICK_HEAD",
|
|
424092
424489
|
"REVERT_HEAD"
|
|
424093
424490
|
];
|
|
424094
|
-
const results = await Promise.all(transientFiles.map((file2) => access3(
|
|
424491
|
+
const results = await Promise.all(transientFiles.map((file2) => access3(join82(gitDir, file2)).then(() => true).catch(() => false)));
|
|
424095
424492
|
return results.some(Boolean);
|
|
424096
424493
|
}
|
|
424097
424494
|
async function fetchUntrackedFiles(maxFiles) {
|
|
@@ -428102,9 +428499,9 @@ var init_FileWriteTool = __esm(() => {
|
|
|
428102
428499
|
});
|
|
428103
428500
|
|
|
428104
428501
|
// src/utils/plugins/orphanedPluginFilter.ts
|
|
428105
|
-
import { dirname as dirname40, isAbsolute as isAbsolute23, join as
|
|
428502
|
+
import { dirname as dirname40, isAbsolute as isAbsolute23, join as join83, normalize as normalize13, relative as relative16, sep as sep20 } from "path";
|
|
428106
428503
|
async function getGlobExclusionsForPluginCache(searchPath) {
|
|
428107
|
-
const cachePath = normalize13(
|
|
428504
|
+
const cachePath = normalize13(join83(getPluginsDirectory(), "cache"));
|
|
428108
428505
|
if (searchPath && !pathsOverlap(searchPath, cachePath)) {
|
|
428109
428506
|
return [];
|
|
428110
428507
|
}
|
|
@@ -428152,7 +428549,7 @@ var init_orphanedPluginFilter = __esm(() => {
|
|
|
428152
428549
|
});
|
|
428153
428550
|
|
|
428154
428551
|
// src/utils/glob.ts
|
|
428155
|
-
import { basename as basename21, dirname as dirname41, isAbsolute as isAbsolute24, join as
|
|
428552
|
+
import { basename as basename21, dirname as dirname41, isAbsolute as isAbsolute24, join as join84, sep as sep21 } from "path";
|
|
428156
428553
|
function extractGlobBaseDirectory(pattern) {
|
|
428157
428554
|
const globChars = /[*?[{]/;
|
|
428158
428555
|
const match = pattern.match(globChars);
|
|
@@ -428204,7 +428601,7 @@ async function glob2(filePattern, cwd2, { limit: limit3, offset }, abortSignal,
|
|
|
428204
428601
|
args.push("--glob", exclusion);
|
|
428205
428602
|
}
|
|
428206
428603
|
const allPaths = await ripGrep(args, searchDir, abortSignal);
|
|
428207
|
-
const absolutePaths = allPaths.map((p) => isAbsolute24(p) ? p :
|
|
428604
|
+
const absolutePaths = allPaths.map((p) => isAbsolute24(p) ? p : join84(searchDir, p));
|
|
428208
428605
|
const truncated = absolutePaths.length > offset + limit3;
|
|
428209
428606
|
const files2 = absolutePaths.slice(offset, offset + limit3);
|
|
428210
428607
|
return { files: files2, truncated };
|
|
@@ -432284,7 +432681,7 @@ function computeFingerprint(messageText, version2) {
|
|
|
432284
432681
|
}
|
|
432285
432682
|
function computeFingerprintFromMessages(messages) {
|
|
432286
432683
|
const firstMessageText = extractFirstMessageText(messages);
|
|
432287
|
-
return computeFingerprint(firstMessageText, "1.3.
|
|
432684
|
+
return computeFingerprint(firstMessageText, "1.3.445");
|
|
432288
432685
|
}
|
|
432289
432686
|
var FINGERPRINT_SALT = "59cf53e54c78";
|
|
432290
432687
|
var init_fingerprint = () => {};
|
|
@@ -432326,7 +432723,7 @@ async function sideQuery(opts) {
|
|
|
432326
432723
|
betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
|
|
432327
432724
|
}
|
|
432328
432725
|
const messageText = extractFirstUserMessageText(messages);
|
|
432329
|
-
const fingerprint = computeFingerprint(messageText, "1.3.
|
|
432726
|
+
const fingerprint = computeFingerprint(messageText, "1.3.445");
|
|
432330
432727
|
const attributionHeader = getAttributionHeader(fingerprint);
|
|
432331
432728
|
const systemBlocks = [
|
|
432332
432729
|
attributionHeader ? { type: "text", text: attributionHeader } : null,
|
|
@@ -434757,7 +435154,7 @@ function AssistantTextMessage(t0) {
|
|
|
434757
435154
|
fromLeftEdge: true,
|
|
434758
435155
|
minWidth: 2,
|
|
434759
435156
|
children: /* @__PURE__ */ jsx_runtime70.jsx(ThemedText, {
|
|
434760
|
-
color: isSelected ? "suggestion" : "
|
|
435157
|
+
color: isSelected ? "suggestion" : "claude",
|
|
434761
435158
|
children: BLACK_CIRCLE
|
|
434762
435159
|
})
|
|
434763
435160
|
});
|
|
@@ -436551,7 +436948,7 @@ function HighlightedThinkingText(t0) {
|
|
|
436551
436948
|
} = t0;
|
|
436552
436949
|
const isQueued = useQueuedMessage()?.isQueued ?? false;
|
|
436553
436950
|
const isSelected = import_react52.useContext(MessageActionsSelectedContext);
|
|
436554
|
-
const pointerColor = isSelected ? "suggestion" : "
|
|
436951
|
+
const pointerColor = isSelected ? "suggestion" : "promptChar";
|
|
436555
436952
|
if (useBriefLayout) {
|
|
436556
436953
|
let t12;
|
|
436557
436954
|
if ($3[0] !== timestamp) {
|
|
@@ -436658,7 +437055,7 @@ function HighlightedThinkingText(t0) {
|
|
|
436658
437055
|
let t32;
|
|
436659
437056
|
if ($3[21] !== text2) {
|
|
436660
437057
|
t32 = /* @__PURE__ */ jsx_runtime82.jsx(ThemedText, {
|
|
436661
|
-
color: "
|
|
437058
|
+
color: "promptChar",
|
|
436662
437059
|
children: text2
|
|
436663
437060
|
});
|
|
436664
437061
|
$3[21] = text2;
|
|
@@ -438011,8 +438408,8 @@ var TEAM_LEAD_NAME = "team-lead", SWARM_SESSION_NAME = "claude-swarm", SWARM_VIE
|
|
|
438011
438408
|
|
|
438012
438409
|
// src/utils/tasks.ts
|
|
438013
438410
|
import { mkdir as mkdir14, readdir as readdir12, readFile as readFile20, unlink as unlink9, writeFile as writeFile12 } from "fs/promises";
|
|
438014
|
-
import { existsSync as
|
|
438015
|
-
import { join as
|
|
438411
|
+
import { existsSync as existsSync23, readdirSync as readdirSync5 } from "fs";
|
|
438412
|
+
import { join as join85 } from "path";
|
|
438016
438413
|
function setLeaderTeamName(teamName) {
|
|
438017
438414
|
if (leaderTeamName === teamName)
|
|
438018
438415
|
return;
|
|
@@ -438031,7 +438428,7 @@ function notifyTasksUpdated() {
|
|
|
438031
438428
|
} catch {}
|
|
438032
438429
|
}
|
|
438033
438430
|
function getHighWaterMarkPath(taskListId) {
|
|
438034
|
-
return
|
|
438431
|
+
return join85(getTasksDir(taskListId), HIGH_WATER_MARK_FILE);
|
|
438035
438432
|
}
|
|
438036
438433
|
async function readHighWaterMark(taskListId) {
|
|
438037
438434
|
const path21 = getHighWaterMarkPath(taskListId);
|
|
@@ -438074,7 +438471,7 @@ async function resetTaskList(taskListId) {
|
|
|
438074
438471
|
}
|
|
438075
438472
|
for (const file2 of files2) {
|
|
438076
438473
|
if (file2.endsWith(".json") && !file2.startsWith(".")) {
|
|
438077
|
-
const filePath =
|
|
438474
|
+
const filePath = join85(dir, file2);
|
|
438078
438475
|
try {
|
|
438079
438476
|
await unlink9(filePath);
|
|
438080
438477
|
} catch {}
|
|
@@ -438101,15 +438498,15 @@ function sanitizePathComponent(input) {
|
|
|
438101
438498
|
return input.replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
438102
438499
|
}
|
|
438103
438500
|
function getTasksDir(taskListId) {
|
|
438104
|
-
return
|
|
438501
|
+
return join85(getRayuConfigHomeDir(), "tasks", sanitizePathComponent(taskListId));
|
|
438105
438502
|
}
|
|
438106
438503
|
function getTaskPath(taskListId, taskId) {
|
|
438107
|
-
return
|
|
438504
|
+
return join85(getTasksDir(taskListId), `${sanitizePathComponent(taskId)}.json`);
|
|
438108
438505
|
}
|
|
438109
438506
|
function resolveTaskListId(preferred, taskId) {
|
|
438110
|
-
if (
|
|
438507
|
+
if (existsSync23(getTaskPath(preferred, taskId)))
|
|
438111
438508
|
return preferred;
|
|
438112
|
-
const base2 =
|
|
438509
|
+
const base2 = join85(getRayuConfigHomeDir(), "tasks");
|
|
438113
438510
|
const fileName = `${sanitizePathComponent(taskId)}.json`;
|
|
438114
438511
|
const preferredDir = sanitizePathComponent(preferred);
|
|
438115
438512
|
let entries;
|
|
@@ -438121,7 +438518,7 @@ function resolveTaskListId(preferred, taskId) {
|
|
|
438121
438518
|
for (const entry of entries) {
|
|
438122
438519
|
if (entry === preferredDir)
|
|
438123
438520
|
continue;
|
|
438124
|
-
if (
|
|
438521
|
+
if (existsSync23(join85(base2, entry, fileName)))
|
|
438125
438522
|
return entry;
|
|
438126
438523
|
}
|
|
438127
438524
|
return preferred;
|
|
@@ -438295,7 +438692,7 @@ async function blockTask(taskListId, fromTaskId, toTaskId) {
|
|
|
438295
438692
|
return true;
|
|
438296
438693
|
}
|
|
438297
438694
|
function getTaskListLockPath(taskListId) {
|
|
438298
|
-
return
|
|
438695
|
+
return join85(getTasksDir(taskListId), ".lock");
|
|
438299
438696
|
}
|
|
438300
438697
|
async function ensureTaskListLockFile(taskListId) {
|
|
438301
438698
|
await ensureTasksDir(taskListId);
|
|
@@ -438493,20 +438890,20 @@ __export(exports_teammateMailbox, {
|
|
|
438493
438890
|
ModeSetRequestMessageSchema: () => ModeSetRequestMessageSchema
|
|
438494
438891
|
});
|
|
438495
438892
|
import { mkdir as mkdir15, readFile as readFile21, writeFile as writeFile13 } from "fs/promises";
|
|
438496
|
-
import { join as
|
|
438893
|
+
import { join as join86 } from "path";
|
|
438497
438894
|
function getInboxPath(agentName, teamName) {
|
|
438498
438895
|
const team = teamName || getTeamName() || "default";
|
|
438499
438896
|
const safeTeam = sanitizePathComponent(team);
|
|
438500
438897
|
const safeAgentName = sanitizePathComponent(agentName);
|
|
438501
|
-
const inboxDir =
|
|
438502
|
-
const fullPath =
|
|
438898
|
+
const inboxDir = join86(getTeamsDir(), safeTeam, "inboxes");
|
|
438899
|
+
const fullPath = join86(inboxDir, `${safeAgentName}.json`);
|
|
438503
438900
|
logForDebugging(`[TeammateMailbox] getInboxPath: agent=${agentName}, team=${team}, fullPath=${fullPath}`);
|
|
438504
438901
|
return fullPath;
|
|
438505
438902
|
}
|
|
438506
438903
|
async function ensureInboxDir(teamName) {
|
|
438507
438904
|
const team = teamName || getTeamName() || "default";
|
|
438508
438905
|
const safeTeam = sanitizePathComponent(team);
|
|
438509
|
-
const inboxDir =
|
|
438906
|
+
const inboxDir = join86(getTeamsDir(), safeTeam, "inboxes");
|
|
438510
438907
|
await mkdir15(inboxDir, { recursive: true });
|
|
438511
438908
|
logForDebugging(`[TeammateMailbox] Ensured inbox directory: ${inboxDir}`);
|
|
438512
438909
|
}
|
|
@@ -440209,9 +440606,9 @@ var init_DiagnosticsDisplay = __esm(() => {
|
|
|
440209
440606
|
|
|
440210
440607
|
// src/utils/imageStore.ts
|
|
440211
440608
|
import { mkdir as mkdir16, open as open10 } from "fs/promises";
|
|
440212
|
-
import { join as
|
|
440609
|
+
import { join as join87 } from "path";
|
|
440213
440610
|
function getImageStoreDir() {
|
|
440214
|
-
return
|
|
440611
|
+
return join87(getRayuConfigHomeDir(), IMAGE_STORE_DIR, getSessionId());
|
|
440215
440612
|
}
|
|
440216
440613
|
async function ensureImageStoreDir() {
|
|
440217
440614
|
const dir = getImageStoreDir();
|
|
@@ -440219,7 +440616,7 @@ async function ensureImageStoreDir() {
|
|
|
440219
440616
|
}
|
|
440220
440617
|
function getImagePath(imageId, mediaType) {
|
|
440221
440618
|
const extension2 = mediaType.split("/")[1] || "png";
|
|
440222
|
-
return
|
|
440619
|
+
return join87(getImageStoreDir(), `${imageId}.${extension2}`);
|
|
440223
440620
|
}
|
|
440224
440621
|
function cacheImagePath(content) {
|
|
440225
440622
|
if (content.type !== "image") {
|
|
@@ -440283,7 +440680,7 @@ function evictOldestIfAtCap() {
|
|
|
440283
440680
|
}
|
|
440284
440681
|
async function cleanupOldImageCaches() {
|
|
440285
440682
|
const fsImpl = getFsImplementation();
|
|
440286
|
-
const baseDir =
|
|
440683
|
+
const baseDir = join87(getRayuConfigHomeDir(), IMAGE_STORE_DIR);
|
|
440287
440684
|
const currentSessionId = getSessionId();
|
|
440288
440685
|
try {
|
|
440289
440686
|
let sessionDirs;
|
|
@@ -440296,7 +440693,7 @@ async function cleanupOldImageCaches() {
|
|
|
440296
440693
|
if (sessionDir.name === currentSessionId) {
|
|
440297
440694
|
continue;
|
|
440298
440695
|
}
|
|
440299
|
-
const sessionPath2 =
|
|
440696
|
+
const sessionPath2 = join87(baseDir, sessionDir.name);
|
|
440300
440697
|
try {
|
|
440301
440698
|
await fsImpl.rm(sessionPath2, { recursive: true, force: true });
|
|
440302
440699
|
logForDebugging(`Cleaned up old image cache: ${sessionPath2}`);
|
|
@@ -447483,7 +447880,7 @@ var init_types12 = __esm(() => {
|
|
|
447483
447880
|
import { createHash as createHash15 } from "crypto";
|
|
447484
447881
|
import { readFileSync as fsReadFileSync } from "fs";
|
|
447485
447882
|
import { unlink as unlink10, writeFile as writeFile14 } from "fs/promises";
|
|
447486
|
-
import { join as
|
|
447883
|
+
import { join as join88 } from "path";
|
|
447487
447884
|
function isNodeError(e2) {
|
|
447488
447885
|
return e2 instanceof Error;
|
|
447489
447886
|
}
|
|
@@ -447505,7 +447902,7 @@ function initializePolicyLimitsLoadingPromise() {
|
|
|
447505
447902
|
}
|
|
447506
447903
|
}
|
|
447507
447904
|
function getCachePath2() {
|
|
447508
|
-
return
|
|
447905
|
+
return join88(getRayuConfigHomeDir(), CACHE_FILENAME);
|
|
447509
447906
|
}
|
|
447510
447907
|
function getPolicyLimitsEndpoint() {
|
|
447511
447908
|
return `${getOauthConfig().BASE_API_URL}/api/claude_code/policy_limits`;
|
|
@@ -449037,15 +449434,15 @@ var init_gracefulShutdown = __esm(() => {
|
|
|
449037
449434
|
|
|
449038
449435
|
// src/utils/imagePaste.ts
|
|
449039
449436
|
import { randomBytes as randomBytes9 } from "crypto";
|
|
449040
|
-
import { basename as basename25, extname as extname9, isAbsolute as isAbsolute26, join as
|
|
449437
|
+
import { basename as basename25, extname as extname9, isAbsolute as isAbsolute26, join as join89 } from "path";
|
|
449041
449438
|
function getClipboardCommands() {
|
|
449042
449439
|
const platform3 = process.platform;
|
|
449043
449440
|
const baseTmpDir = process.env.CLAUDE_CODE_TMPDIR || (platform3 === "win32" ? process.env.TEMP || "C:\\Temp" : "/tmp");
|
|
449044
449441
|
const screenshotFilename = "claude_cli_latest_screenshot.png";
|
|
449045
449442
|
const tempPaths = {
|
|
449046
|
-
darwin:
|
|
449047
|
-
linux:
|
|
449048
|
-
win32:
|
|
449443
|
+
darwin: join89(baseTmpDir, screenshotFilename),
|
|
449444
|
+
linux: join89(baseTmpDir, screenshotFilename),
|
|
449445
|
+
win32: join89(baseTmpDir, screenshotFilename)
|
|
449049
449446
|
};
|
|
449050
449447
|
const screenshotPath = tempPaths[platform3] || tempPaths.linux;
|
|
449051
449448
|
const commands = {
|
|
@@ -456586,9 +456983,9 @@ __export(exports_teamHelpers, {
|
|
|
456586
456983
|
cleanupSessionTeams: () => cleanupSessionTeams,
|
|
456587
456984
|
addHiddenPaneId: () => addHiddenPaneId
|
|
456588
456985
|
});
|
|
456589
|
-
import { mkdirSync as
|
|
456986
|
+
import { mkdirSync as mkdirSync13, readFileSync as readFileSync27, writeFileSync as writeFileSync13 } from "fs";
|
|
456590
456987
|
import { mkdir as mkdir17, readFile as readFile22, rm as rm6, writeFile as writeFile15 } from "fs/promises";
|
|
456591
|
-
import { join as
|
|
456988
|
+
import { join as join90 } from "path";
|
|
456592
456989
|
function sanitizeName(name) {
|
|
456593
456990
|
return name.replace(/[^a-zA-Z0-9]/g, "-").toLowerCase();
|
|
456594
456991
|
}
|
|
@@ -456596,14 +456993,14 @@ function sanitizeAgentName(name) {
|
|
|
456596
456993
|
return name.replace(/@/g, "-");
|
|
456597
456994
|
}
|
|
456598
456995
|
function getTeamDir(teamName) {
|
|
456599
|
-
return
|
|
456996
|
+
return join90(getTeamsDir(), sanitizeName(teamName));
|
|
456600
456997
|
}
|
|
456601
456998
|
function getTeamFilePath(teamName) {
|
|
456602
|
-
return
|
|
456999
|
+
return join90(getTeamDir(teamName), "config.json");
|
|
456603
457000
|
}
|
|
456604
457001
|
function readTeamFile(teamName) {
|
|
456605
457002
|
try {
|
|
456606
|
-
const content =
|
|
457003
|
+
const content = readFileSync27(getTeamFilePath(teamName), "utf-8");
|
|
456607
457004
|
return jsonParse(content);
|
|
456608
457005
|
} catch (e2) {
|
|
456609
457006
|
if (getErrnoCode(e2) === "ENOENT")
|
|
@@ -456625,8 +457022,8 @@ async function readTeamFileAsync(teamName) {
|
|
|
456625
457022
|
}
|
|
456626
457023
|
function writeTeamFile(teamName, teamFile) {
|
|
456627
457024
|
const teamDir = getTeamDir(teamName);
|
|
456628
|
-
|
|
456629
|
-
|
|
457025
|
+
mkdirSync13(teamDir, { recursive: true });
|
|
457026
|
+
writeFileSync13(getTeamFilePath(teamName), jsonStringify(teamFile, null, 2));
|
|
456630
457027
|
}
|
|
456631
457028
|
async function writeTeamFileAsync(teamName, teamFile) {
|
|
456632
457029
|
const teamDir = getTeamDir(teamName);
|
|
@@ -456790,15 +457187,15 @@ async function setMemberActive(teamName, memberName, isActive) {
|
|
|
456790
457187
|
logForDebugging(`[TeammateTool] Set member ${memberName} in team ${teamName} to ${isActive ? "active" : "idle"}`);
|
|
456791
457188
|
}
|
|
456792
457189
|
async function destroyWorktree(worktreePath) {
|
|
456793
|
-
const gitFilePath =
|
|
457190
|
+
const gitFilePath = join90(worktreePath, ".git");
|
|
456794
457191
|
let mainRepoPath = null;
|
|
456795
457192
|
try {
|
|
456796
457193
|
const gitFileContent = (await readFile22(gitFilePath, "utf-8")).trim();
|
|
456797
457194
|
const match = gitFileContent.match(/^gitdir:\s*(.+)$/);
|
|
456798
457195
|
if (match && match[1]) {
|
|
456799
457196
|
const worktreeGitDir = match[1];
|
|
456800
|
-
const mainGitDir =
|
|
456801
|
-
mainRepoPath =
|
|
457197
|
+
const mainGitDir = join90(worktreeGitDir, "..", "..");
|
|
457198
|
+
mainRepoPath = join90(mainGitDir, "..");
|
|
456802
457199
|
}
|
|
456803
457200
|
} catch {}
|
|
456804
457201
|
if (mainRepoPath) {
|
|
@@ -459540,10 +459937,10 @@ var init_filesApi = __esm(() => {
|
|
|
459540
459937
|
// src/utils/tempfile.ts
|
|
459541
459938
|
import { createHash as createHash17, randomUUID as randomUUID18 } from "crypto";
|
|
459542
459939
|
import { tmpdir as tmpdir9 } from "os";
|
|
459543
|
-
import { join as
|
|
459940
|
+
import { join as join92 } from "path";
|
|
459544
459941
|
function generateTempFilePath(prefix = "claude-prompt", extension2 = ".md", options) {
|
|
459545
459942
|
const id = options?.contentHash ? createHash17("sha256").update(options.contentHash).digest("hex").slice(0, 16) : randomUUID18();
|
|
459546
|
-
return
|
|
459943
|
+
return join92(tmpdir9(), `${prefix}-${id}${extension2}`);
|
|
459547
459944
|
}
|
|
459548
459945
|
var init_tempfile = () => {};
|
|
459549
459946
|
|
|
@@ -464131,7 +464528,7 @@ ${result.result}`
|
|
|
464131
464528
|
import { randomUUID as randomUUID21 } from "crypto";
|
|
464132
464529
|
import { cp as cp2, mkdir as mkdir19, mkdtemp as mkdtemp3, readFile as readFile24, readdir as readdir13, rename as rename4, rm as rm7, stat as stat24, writeFile as writeFile17 } from "fs/promises";
|
|
464133
464530
|
import { homedir as homedir25, tmpdir as tmpdir10 } from "os";
|
|
464134
|
-
import { basename as basename27, isAbsolute as isAbsolute27, join as
|
|
464531
|
+
import { basename as basename27, isAbsolute as isAbsolute27, join as join93, resolve as resolve38, sep as sep25 } from "path";
|
|
464135
464532
|
function sanitizeSkillName(raw) {
|
|
464136
464533
|
const name = raw.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^[-.]+|[-.]+$/g, "");
|
|
464137
464534
|
if (!name || name === "." || name === ".." || name.includes("/")) {
|
|
@@ -464140,7 +464537,7 @@ function sanitizeSkillName(raw) {
|
|
|
464140
464537
|
return name;
|
|
464141
464538
|
}
|
|
464142
464539
|
function getUserSkillsDir() {
|
|
464143
|
-
return
|
|
464540
|
+
return join93(getRayuConfigHomeDir(), "skills");
|
|
464144
464541
|
}
|
|
464145
464542
|
function classifySource(rawSource, localExists) {
|
|
464146
464543
|
const source = rawSource.trim();
|
|
@@ -464184,9 +464581,9 @@ function classifySource(rawSource, localExists) {
|
|
|
464184
464581
|
return { type: "local", path: source };
|
|
464185
464582
|
}
|
|
464186
464583
|
async function locateSkillDirs(root2) {
|
|
464187
|
-
if (await fileExists(
|
|
464584
|
+
if (await fileExists(join93(root2, "SKILL.md")))
|
|
464188
464585
|
return [root2];
|
|
464189
|
-
const skillsContainer =
|
|
464586
|
+
const skillsContainer = join93(root2, "skills");
|
|
464190
464587
|
if (await fileExists(skillsContainer)) {
|
|
464191
464588
|
const collected = await collectSkillDirs(skillsContainer, 0, 4, []);
|
|
464192
464589
|
if (collected.length > 0)
|
|
@@ -464200,7 +464597,7 @@ async function locateSkillDirs(root2) {
|
|
|
464200
464597
|
async function collectSkillDirs(dir, depth, maxDepth, out) {
|
|
464201
464598
|
if (depth > maxDepth)
|
|
464202
464599
|
return out;
|
|
464203
|
-
if (await fileExists(
|
|
464600
|
+
if (await fileExists(join93(dir, "SKILL.md"))) {
|
|
464204
464601
|
out.push(dir);
|
|
464205
464602
|
return out;
|
|
464206
464603
|
}
|
|
@@ -464215,7 +464612,7 @@ async function collectSkillDirs(dir, depth, maxDepth, out) {
|
|
|
464215
464612
|
continue;
|
|
464216
464613
|
if (e2.name.startsWith(".") || e2.name === "node_modules")
|
|
464217
464614
|
continue;
|
|
464218
|
-
await collectSkillDirs(
|
|
464615
|
+
await collectSkillDirs(join93(dir, e2.name), depth + 1, maxDepth, out);
|
|
464219
464616
|
}
|
|
464220
464617
|
return out;
|
|
464221
464618
|
}
|
|
@@ -464248,24 +464645,24 @@ async function installSkillFromSource(rawSource, options = {}) {
|
|
|
464248
464645
|
throw new InstallSkillError("No skill source provided.");
|
|
464249
464646
|
const localExists = await fileExists(expandHome(source));
|
|
464250
464647
|
const kind = classifySource(source, localExists);
|
|
464251
|
-
const staging = await mkdtemp3(
|
|
464648
|
+
const staging = await mkdtemp3(join93(tmpdir10(), "rayu-skill-"));
|
|
464252
464649
|
try {
|
|
464253
464650
|
let scanRoot;
|
|
464254
464651
|
if (kind.type === "local") {
|
|
464255
464652
|
scanRoot = expandHome(kind.path);
|
|
464256
464653
|
} else if (kind.type === "github") {
|
|
464257
|
-
const cloneDir =
|
|
464654
|
+
const cloneDir = join93(staging, "repo");
|
|
464258
464655
|
await cloneGitHub(kind.owner, kind.repo, cloneDir);
|
|
464259
|
-
const root2 = kind.subdir ?
|
|
464656
|
+
const root2 = kind.subdir ? join93(cloneDir, kind.subdir) : cloneDir;
|
|
464260
464657
|
if (!resolve38(root2).startsWith(resolve38(cloneDir))) {
|
|
464261
464658
|
throw new InstallSkillError("Invalid subdir in GitHub source.");
|
|
464262
464659
|
}
|
|
464263
464660
|
scanRoot = root2;
|
|
464264
464661
|
} else {
|
|
464265
|
-
const dlDir =
|
|
464662
|
+
const dlDir = join93(staging, "dl");
|
|
464266
464663
|
await mkdir19(dlDir, { recursive: true });
|
|
464267
464664
|
const md3 = await downloadText(kind.url);
|
|
464268
|
-
await writeFile17(
|
|
464665
|
+
await writeFile17(join93(dlDir, "SKILL.md"), md3, "utf-8");
|
|
464269
464666
|
scanRoot = dlDir;
|
|
464270
464667
|
}
|
|
464271
464668
|
const skillDirs = await locateSkillDirs(scanRoot);
|
|
@@ -464273,7 +464670,7 @@ async function installSkillFromSource(rawSource, options = {}) {
|
|
|
464273
464670
|
const planned = [];
|
|
464274
464671
|
const seenNames = new Set;
|
|
464275
464672
|
for (const skillDir of skillDirs) {
|
|
464276
|
-
const skillFile =
|
|
464673
|
+
const skillFile = join93(skillDir, "SKILL.md");
|
|
464277
464674
|
let content;
|
|
464278
464675
|
try {
|
|
464279
464676
|
content = await readFile24(skillFile, { encoding: "utf-8" });
|
|
@@ -464287,7 +464684,7 @@ async function installSkillFromSource(rawSource, options = {}) {
|
|
|
464287
464684
|
continue;
|
|
464288
464685
|
seenNames.add(name);
|
|
464289
464686
|
const description = (frontmatter.description != null ? String(frontmatter.description) : "") || firstLine(markdown) || "Installed skill";
|
|
464290
|
-
const dest =
|
|
464687
|
+
const dest = join93(skillsRoot, name);
|
|
464291
464688
|
if (!resolve38(dest).startsWith(resolve38(skillsRoot) + sep25)) {
|
|
464292
464689
|
throw new InstallSkillError(`Refusing to install outside ${skillsRoot}.`);
|
|
464293
464690
|
}
|
|
@@ -464297,7 +464694,7 @@ async function installSkillFromSource(rawSource, options = {}) {
|
|
|
464297
464694
|
const installed = [];
|
|
464298
464695
|
for (const p of planned) {
|
|
464299
464696
|
const replaced = await fileExists(p.dest);
|
|
464300
|
-
const tmpDest =
|
|
464697
|
+
const tmpDest = join93(skillsRoot, `.${p.name}.installing-${randomUUID21()}`);
|
|
464301
464698
|
await cp2(p.skillDir, tmpDest, { recursive: true });
|
|
464302
464699
|
await rm7(p.dest, { recursive: true, force: true });
|
|
464303
464700
|
await rename4(tmpDest, p.dest);
|
|
@@ -464319,7 +464716,7 @@ function expandHome(p) {
|
|
|
464319
464716
|
if (p === "~")
|
|
464320
464717
|
return homedir25();
|
|
464321
464718
|
if (p.startsWith("~/"))
|
|
464322
|
-
return
|
|
464719
|
+
return join93(homedir25(), p.slice(2));
|
|
464323
464720
|
return p;
|
|
464324
464721
|
}
|
|
464325
464722
|
function firstLine(markdown) {
|
|
@@ -481158,14 +481555,14 @@ var require_turndown_cjs = __commonJS((exports, module) => {
|
|
|
481158
481555
|
} else if (node.nodeType === 1) {
|
|
481159
481556
|
replacement = replacementForNode.call(self2, node);
|
|
481160
481557
|
}
|
|
481161
|
-
return
|
|
481558
|
+
return join94(output, replacement);
|
|
481162
481559
|
}, "");
|
|
481163
481560
|
}
|
|
481164
481561
|
function postProcess(output) {
|
|
481165
481562
|
var self2 = this;
|
|
481166
481563
|
this.rules.forEach(function(rule) {
|
|
481167
481564
|
if (typeof rule.append === "function") {
|
|
481168
|
-
output =
|
|
481565
|
+
output = join94(output, rule.append(self2.options));
|
|
481169
481566
|
}
|
|
481170
481567
|
});
|
|
481171
481568
|
return output.replace(/^[\t\r\n]+/, "").replace(/[\t\r\n\s]+$/, "");
|
|
@@ -481178,7 +481575,7 @@ var require_turndown_cjs = __commonJS((exports, module) => {
|
|
|
481178
481575
|
content = content.trim();
|
|
481179
481576
|
return whitespace.leading + rule.replacement(content, node, this.options) + whitespace.trailing;
|
|
481180
481577
|
}
|
|
481181
|
-
function
|
|
481578
|
+
function join94(output, replacement) {
|
|
481182
481579
|
var s1 = trimTrailingNewlines(output);
|
|
481183
481580
|
var s2 = trimLeadingNewlines(replacement);
|
|
481184
481581
|
var nls = Math.max(output.length - s1.length, replacement.length - s2.length);
|
|
@@ -481721,7 +482118,7 @@ To complete your request, I need to fetch content from the redirected URL. Pleas
|
|
|
481721
482118
|
|
|
481722
482119
|
// src/utils/listSessionsImpl.ts
|
|
481723
482120
|
import { readdir as readdir14, stat as stat25 } from "fs/promises";
|
|
481724
|
-
import { basename as basename28, join as
|
|
482121
|
+
import { basename as basename28, join as join94 } from "path";
|
|
481725
482122
|
async function listCandidates(projectDir, doStat, projectPath) {
|
|
481726
482123
|
let names;
|
|
481727
482124
|
try {
|
|
@@ -481735,7 +482132,7 @@ async function listCandidates(projectDir, doStat, projectPath) {
|
|
|
481735
482132
|
const sessionId = validateUuid(name.slice(0, -6));
|
|
481736
482133
|
if (!sessionId)
|
|
481737
482134
|
return null;
|
|
481738
|
-
const filePath =
|
|
482135
|
+
const filePath = join94(projectDir, name);
|
|
481739
482136
|
if (!doStat)
|
|
481740
482137
|
return { sessionId, filePath, mtime: 0, projectPath };
|
|
481741
482138
|
try {
|
|
@@ -481754,9 +482151,9 @@ var init_listSessionsImpl = __esm(() => {
|
|
|
481754
482151
|
|
|
481755
482152
|
// src/services/autoDream/consolidationLock.ts
|
|
481756
482153
|
import { mkdir as mkdir20, readFile as readFile25, stat as stat26, unlink as unlink12, utimes, writeFile as writeFile18 } from "fs/promises";
|
|
481757
|
-
import { join as
|
|
482154
|
+
import { join as join95 } from "path";
|
|
481758
482155
|
function lockPath() {
|
|
481759
|
-
return
|
|
482156
|
+
return join95(getAutoMemPath(), LOCK_FILE);
|
|
481760
482157
|
}
|
|
481761
482158
|
async function readLastConsolidatedAt() {
|
|
481762
482159
|
try {
|
|
@@ -486876,150 +487273,6 @@ var init_UI16 = __esm(() => {
|
|
|
486876
487273
|
jsx_runtime134 = __toESM(require_jsx_runtime(), 1);
|
|
486877
487274
|
});
|
|
486878
487275
|
|
|
486879
|
-
// src/services/rayuAuth/rayuHostedProvider.ts
|
|
486880
|
-
function syncRayuHostedProvider(ent, opts) {
|
|
486881
|
-
try {
|
|
486882
|
-
const cfg = loadRayuConfig();
|
|
486883
|
-
const allowed = ent?.allowedModels ?? [];
|
|
486884
|
-
const models = allowed.map((m3) => m3.code);
|
|
486885
|
-
const idx = cfg.providers.findIndex((p) => p.id === RAYU_HOSTED_PROVIDER_ID);
|
|
486886
|
-
if (models.length > 0) {
|
|
486887
|
-
const existing = idx >= 0 ? cfg.providers[idx] : undefined;
|
|
486888
|
-
const firstCode = allowed[0]?.code;
|
|
486889
|
-
const provider = {
|
|
486890
|
-
...existing,
|
|
486891
|
-
id: RAYU_HOSTED_PROVIDER_ID,
|
|
486892
|
-
kind: "rayu-hosted",
|
|
486893
|
-
baseURL: rayuHostedBaseURL(),
|
|
486894
|
-
models,
|
|
486895
|
-
fetchedModels: models,
|
|
486896
|
-
defaultModel: existing?.defaultModel ?? firstCode,
|
|
486897
|
-
smallFastModel: existing?.smallFastModel ?? firstCode
|
|
486898
|
-
};
|
|
486899
|
-
if (idx >= 0)
|
|
486900
|
-
cfg.providers[idx] = provider;
|
|
486901
|
-
else
|
|
486902
|
-
cfg.providers.push(provider);
|
|
486903
|
-
if (opts?.activate)
|
|
486904
|
-
cfg.activeProvider = RAYU_HOSTED_PROVIDER_ID;
|
|
486905
|
-
saveRayuConfig(cfg);
|
|
486906
|
-
return;
|
|
486907
|
-
}
|
|
486908
|
-
if (idx >= 0) {
|
|
486909
|
-
cfg.providers.splice(idx, 1);
|
|
486910
|
-
if (cfg.activeProvider === RAYU_HOSTED_PROVIDER_ID) {
|
|
486911
|
-
cfg.activeProvider = cfg.providers[0]?.id;
|
|
486912
|
-
}
|
|
486913
|
-
saveRayuConfig(cfg);
|
|
486914
|
-
}
|
|
486915
|
-
} catch {}
|
|
486916
|
-
}
|
|
486917
|
-
var init_rayuHostedProvider = __esm(() => {
|
|
486918
|
-
init_rayuConfig();
|
|
486919
|
-
init_rayuProviders();
|
|
486920
|
-
init_rayuHostedAuth();
|
|
486921
|
-
});
|
|
486922
|
-
|
|
486923
|
-
// src/services/rayuAuth/rayuEntitlements.ts
|
|
486924
|
-
import { existsSync as existsSync23, mkdirSync as mkdirSync13, readFileSync as readFileSync27, rmSync as rmSync6, writeFileSync as writeFileSync13 } from "fs";
|
|
486925
|
-
import { join as join95 } from "path";
|
|
486926
|
-
function entitlementsPath() {
|
|
486927
|
-
return join95(getRayuConfigHomeDir(), FILE);
|
|
486928
|
-
}
|
|
486929
|
-
function currentUserId() {
|
|
486930
|
-
return readRayuSession()?.user?.id ?? null;
|
|
486931
|
-
}
|
|
486932
|
-
function loadFromDiskOnce() {
|
|
486933
|
-
if (loadedFromDisk)
|
|
486934
|
-
return;
|
|
486935
|
-
loadedFromDisk = true;
|
|
486936
|
-
try {
|
|
486937
|
-
const p = entitlementsPath();
|
|
486938
|
-
if (existsSync23(p)) {
|
|
486939
|
-
cache5 = JSON.parse(readFileSync27(p, "utf8"));
|
|
486940
|
-
}
|
|
486941
|
-
} catch {
|
|
486942
|
-
cache5 = null;
|
|
486943
|
-
}
|
|
486944
|
-
}
|
|
486945
|
-
function persist(ent) {
|
|
486946
|
-
try {
|
|
486947
|
-
const dir = getRayuConfigHomeDir();
|
|
486948
|
-
if (!existsSync23(dir))
|
|
486949
|
-
mkdirSync13(dir, { recursive: true });
|
|
486950
|
-
const p = entitlementsPath();
|
|
486951
|
-
if (ent)
|
|
486952
|
-
writeFileSync13(p, JSON.stringify(ent, null, 2), { mode: 384 });
|
|
486953
|
-
else
|
|
486954
|
-
rmSync6(p, { force: true });
|
|
486955
|
-
} catch {}
|
|
486956
|
-
}
|
|
486957
|
-
function getCachedEntitlements() {
|
|
486958
|
-
loadFromDiskOnce();
|
|
486959
|
-
if (cache5 && cache5.userId != null) {
|
|
486960
|
-
const uid = currentUserId();
|
|
486961
|
-
if (uid != null && uid !== cache5.userId) {
|
|
486962
|
-
cache5 = null;
|
|
486963
|
-
}
|
|
486964
|
-
}
|
|
486965
|
-
if (isUseRayuOAuthEnabled() && hasRayuSession() && !fetching && Date.now() - lastAttempt > REFRESH_COOLDOWN_MS) {
|
|
486966
|
-
refreshRayuEntitlements();
|
|
486967
|
-
}
|
|
486968
|
-
return cache5;
|
|
486969
|
-
}
|
|
486970
|
-
async function refreshRayuEntitlements() {
|
|
486971
|
-
if (!isUseRayuOAuthEnabled() || !hasRayuSession())
|
|
486972
|
-
return null;
|
|
486973
|
-
if (fetching)
|
|
486974
|
-
return cache5;
|
|
486975
|
-
fetching = true;
|
|
486976
|
-
lastAttempt = Date.now();
|
|
486977
|
-
try {
|
|
486978
|
-
const token = await getValidRayuAccessToken();
|
|
486979
|
-
if (!token)
|
|
486980
|
-
return cache5;
|
|
486981
|
-
const res = await globalThis.fetch(`${getRayuApiBaseUrl()}/me/entitlements`, { headers: { Authorization: `Bearer ${token}` } });
|
|
486982
|
-
if (!res.ok)
|
|
486983
|
-
return cache5;
|
|
486984
|
-
const data = await res.json();
|
|
486985
|
-
data.userId = currentUserId();
|
|
486986
|
-
cache5 = data;
|
|
486987
|
-
loadedFromDisk = true;
|
|
486988
|
-
persist(data);
|
|
486989
|
-
syncRayuHostedProvider(data);
|
|
486990
|
-
return data;
|
|
486991
|
-
} catch {
|
|
486992
|
-
return cache5;
|
|
486993
|
-
} finally {
|
|
486994
|
-
fetching = false;
|
|
486995
|
-
}
|
|
486996
|
-
}
|
|
486997
|
-
function clearRayuEntitlements() {
|
|
486998
|
-
cache5 = null;
|
|
486999
|
-
loadedFromDisk = true;
|
|
487000
|
-
lastAttempt = 0;
|
|
487001
|
-
persist(null);
|
|
487002
|
-
syncRayuHostedProvider(null);
|
|
487003
|
-
}
|
|
487004
|
-
function rayuFeatureAllowed(featureKey) {
|
|
487005
|
-
if (!isUseRayuOAuthEnabled())
|
|
487006
|
-
return true;
|
|
487007
|
-
const ent = getCachedEntitlements();
|
|
487008
|
-
if (ent && ent.features) {
|
|
487009
|
-
const f3 = ent.features[featureKey];
|
|
487010
|
-
if (!f3)
|
|
487011
|
-
return true;
|
|
487012
|
-
return f3.enabled !== false;
|
|
487013
|
-
}
|
|
487014
|
-
return !hasRayuSession();
|
|
487015
|
-
}
|
|
487016
|
-
var FILE = "rayu-entitlements.json", REFRESH_COOLDOWN_MS = 30000, cache5 = null, loadedFromDisk = false, fetching = false, lastAttempt = 0;
|
|
487017
|
-
var init_rayuEntitlements = __esm(() => {
|
|
487018
|
-
init_envUtils();
|
|
487019
|
-
init_rayuHostedProvider();
|
|
487020
|
-
init_rayuSession();
|
|
487021
|
-
});
|
|
487022
|
-
|
|
487023
487276
|
// src/services/rayuAuth/rayuFeatureUsage.ts
|
|
487024
487277
|
function getFeatureUsage(featureKey) {
|
|
487025
487278
|
maybeRefreshFeatureUsage();
|
|
@@ -499762,7 +500015,9 @@ async function* queryLoop(params, consumedCommandUuids) {
|
|
|
499762
500015
|
yield* yieldMissingToolResultBlocks(assistantMessages, userInitiated ? "Interrupted by user" : "Tool execution was cancelled (a parallel tool failed or timed out)");
|
|
499763
500016
|
}
|
|
499764
500017
|
if (false) {}
|
|
499765
|
-
|
|
500018
|
+
const lastAssistant = assistantMessages.at(-1);
|
|
500019
|
+
const abortAlreadyRendered = isUserAbortRenderedMessage(lastAssistant);
|
|
500020
|
+
if (abortReason !== "interrupt" && userInitiated && !abortAlreadyRendered) {
|
|
499766
500021
|
yield createUserInterruptionMessage({
|
|
499767
500022
|
toolUse: false
|
|
499768
500023
|
});
|
|
@@ -500146,6 +500401,7 @@ var init_query3 = __esm(() => {
|
|
|
500146
500401
|
init_withRetry();
|
|
500147
500402
|
init_autoCompact();
|
|
500148
500403
|
init_compact();
|
|
500404
|
+
init_interruptMessage();
|
|
500149
500405
|
init_analytics();
|
|
500150
500406
|
init_imageValidation();
|
|
500151
500407
|
init_imageResizer();
|
|
@@ -527799,7 +528055,7 @@ function Feedback({
|
|
|
527799
528055
|
platform: env4.platform,
|
|
527800
528056
|
gitRepo: envInfo.isGit,
|
|
527801
528057
|
terminal: env4.terminal,
|
|
527802
|
-
version: "1.3.
|
|
528058
|
+
version: "1.3.445",
|
|
527803
528059
|
transcript: normalizeMessagesForAPI(messages),
|
|
527804
528060
|
errors: sanitizedErrors,
|
|
527805
528061
|
lastApiRequest: getLastAPIRequest(),
|
|
@@ -527991,7 +528247,7 @@ function Feedback({
|
|
|
527991
528247
|
", ",
|
|
527992
528248
|
env4.terminal,
|
|
527993
528249
|
", v",
|
|
527994
|
-
"1.3.
|
|
528250
|
+
"1.3.445"
|
|
527995
528251
|
]
|
|
527996
528252
|
})
|
|
527997
528253
|
]
|
|
@@ -528097,7 +528353,7 @@ ${sanitizedDescription}
|
|
|
528097
528353
|
` + `**Environment Info**
|
|
528098
528354
|
` + `- Platform: ${env4.platform}
|
|
528099
528355
|
` + `- Terminal: ${env4.terminal}
|
|
528100
|
-
` + `- Version: ${"1.3.
|
|
528356
|
+
` + `- Version: ${"1.3.445"}
|
|
528101
528357
|
` + `- Feedback ID: ${feedbackId}
|
|
528102
528358
|
` + `
|
|
528103
528359
|
**Errors**
|
|
@@ -530937,9 +531193,9 @@ async function assertMinVersion() {
|
|
|
530937
531193
|
if (false) {}
|
|
530938
531194
|
try {
|
|
530939
531195
|
const versionConfig = await getDynamicConfig_BLOCKS_ON_INIT("tengu_version_config", { minVersion: "0.0.0" });
|
|
530940
|
-
if (versionConfig.minVersion && lt("1.3.
|
|
531196
|
+
if (versionConfig.minVersion && lt("1.3.445", versionConfig.minVersion)) {
|
|
530941
531197
|
console.error(`
|
|
530942
|
-
It looks like your version of RAYU (${"1.3.
|
|
531198
|
+
It looks like your version of RAYU (${"1.3.445"}) needs an update.
|
|
530943
531199
|
A newer version (${versionConfig.minVersion} or higher) is required to continue.
|
|
530944
531200
|
|
|
530945
531201
|
To update, please run:
|
|
@@ -531165,7 +531421,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
531165
531421
|
logError2(new AutoUpdaterError("Another process is currently installing an update"));
|
|
531166
531422
|
logEvent("tengu_auto_updater_lock_contention", {
|
|
531167
531423
|
pid: process.pid,
|
|
531168
|
-
currentVersion: "1.3.
|
|
531424
|
+
currentVersion: "1.3.445"
|
|
531169
531425
|
});
|
|
531170
531426
|
return "in_progress";
|
|
531171
531427
|
}
|
|
@@ -531174,7 +531430,7 @@ async function installGlobalPackage(specificVersion) {
|
|
|
531174
531430
|
if (!env4.isRunningWithBun() && env4.isNpmFromWindowsPath()) {
|
|
531175
531431
|
logError2(new Error("Windows NPM detected in WSL environment"));
|
|
531176
531432
|
logEvent("tengu_auto_updater_windows_npm_in_wsl", {
|
|
531177
|
-
currentVersion: "1.3.
|
|
531433
|
+
currentVersion: "1.3.445"
|
|
531178
531434
|
});
|
|
531179
531435
|
console.error(`
|
|
531180
531436
|
Error: Windows NPM detected in WSL
|
|
@@ -531706,7 +531962,7 @@ function detectLinuxGlobPatternWarnings() {
|
|
|
531706
531962
|
}
|
|
531707
531963
|
async function getDoctorDiagnostic() {
|
|
531708
531964
|
const installationType = await getCurrentInstallationType();
|
|
531709
|
-
const version2 = typeof MACRO !== "undefined" ? "1.3.
|
|
531965
|
+
const version2 = typeof MACRO !== "undefined" ? "1.3.445" : "unknown";
|
|
531710
531966
|
const installationPath = await getInstallationPath();
|
|
531711
531967
|
const invokedBinary = getInvokedBinary();
|
|
531712
531968
|
const multipleInstallations = await detectMultipleInstallations();
|
|
@@ -532501,8 +532757,8 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
532501
532757
|
const maxVersion = await getMaxVersion();
|
|
532502
532758
|
if (maxVersion && gt(version2, maxVersion)) {
|
|
532503
532759
|
logForDebugging(`Native installer: maxVersion ${maxVersion} is set, capping update from ${version2} to ${maxVersion}`);
|
|
532504
|
-
if (gte("1.3.
|
|
532505
|
-
logForDebugging(`Native installer: current version ${"1.3.
|
|
532760
|
+
if (gte("1.3.445", maxVersion)) {
|
|
532761
|
+
logForDebugging(`Native installer: current version ${"1.3.445"} is already at or above maxVersion ${maxVersion}, skipping update`);
|
|
532506
532762
|
logEvent("tengu_native_update_skipped_max_version", {
|
|
532507
532763
|
latency_ms: Date.now() - startTime2,
|
|
532508
532764
|
max_version: maxVersion,
|
|
@@ -532513,7 +532769,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
|
|
|
532513
532769
|
version2 = maxVersion;
|
|
532514
532770
|
}
|
|
532515
532771
|
}
|
|
532516
|
-
if (!forceReinstall && version2 === "1.3.
|
|
532772
|
+
if (!forceReinstall && version2 === "1.3.445" && await versionIsAvailable(version2) && await isPossibleClaudeBinary(executablePath)) {
|
|
532517
532773
|
logForDebugging(`Found ${version2} at ${executablePath}, skipping install`);
|
|
532518
532774
|
logEvent("tengu_native_update_complete", {
|
|
532519
532775
|
latency_ms: Date.now() - startTime2,
|
|
@@ -533709,7 +533965,7 @@ function buildPrimarySection() {
|
|
|
533709
533965
|
});
|
|
533710
533966
|
return [{
|
|
533711
533967
|
label: "Version",
|
|
533712
|
-
value: "1.3.
|
|
533968
|
+
value: "1.3.445"
|
|
533713
533969
|
}, {
|
|
533714
533970
|
label: "Session name",
|
|
533715
533971
|
value: nameValue
|
|
@@ -537400,7 +537656,7 @@ function Config({
|
|
|
537400
537656
|
}
|
|
537401
537657
|
})
|
|
537402
537658
|
}) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsx_runtime170.jsx(ChannelDowngradeDialog, {
|
|
537403
|
-
currentVersion: "1.3.
|
|
537659
|
+
currentVersion: "1.3.445",
|
|
537404
537660
|
onChoice: (choice) => {
|
|
537405
537661
|
setShowSubmenu(null);
|
|
537406
537662
|
setTabsHidden(false);
|
|
@@ -537412,7 +537668,7 @@ function Config({
|
|
|
537412
537668
|
autoUpdatesChannel: "stable"
|
|
537413
537669
|
};
|
|
537414
537670
|
if (choice === "stay") {
|
|
537415
|
-
newSettings.minimumVersion = "1.3.
|
|
537671
|
+
newSettings.minimumVersion = "1.3.445";
|
|
537416
537672
|
}
|
|
537417
537673
|
updateSettingsForSource("userSettings", newSettings);
|
|
537418
537674
|
setSettingsData((prev_27) => ({
|
|
@@ -545474,7 +545730,7 @@ function HelpV2(t0) {
|
|
|
545474
545730
|
let t6;
|
|
545475
545731
|
if ($3[31] !== tabs) {
|
|
545476
545732
|
t6 = /* @__PURE__ */ jsx_runtime197.jsx(Tabs, {
|
|
545477
|
-
title: `Rayu-CLI v${"1.3.
|
|
545733
|
+
title: `Rayu-CLI v${"1.3.445"}`,
|
|
545478
545734
|
color: "professionalBlue",
|
|
545479
545735
|
defaultTab: "general",
|
|
545480
545736
|
children: tabs
|
|
@@ -565561,7 +565817,7 @@ function getRecentReleaseNotes(currentVersion, previousVersion, changelogContent
|
|
|
565561
565817
|
}
|
|
565562
565818
|
return [];
|
|
565563
565819
|
}
|
|
565564
|
-
async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.3.
|
|
565820
|
+
async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.3.445") {
|
|
565565
565821
|
if (false) {}
|
|
565566
565822
|
const cachedChangelog = await getStoredChangelog();
|
|
565567
565823
|
if (lastSeenVersion !== currentVersion || !cachedChangelog) {
|
|
@@ -565574,7 +565830,7 @@ async function checkForReleaseNotes(lastSeenVersion, currentVersion = "1.3.443")
|
|
|
565574
565830
|
releaseNotes
|
|
565575
565831
|
};
|
|
565576
565832
|
}
|
|
565577
|
-
function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "1.3.
|
|
565833
|
+
function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "1.3.445") {
|
|
565578
565834
|
if (false) {}
|
|
565579
565835
|
const releaseNotes = getRecentReleaseNotes(currentVersion, lastSeenVersion);
|
|
565580
565836
|
return {
|
|
@@ -565702,7 +565958,7 @@ function getRecentActivitySync() {
|
|
|
565702
565958
|
return cachedActivity;
|
|
565703
565959
|
}
|
|
565704
565960
|
function getLogoDisplayData() {
|
|
565705
|
-
const version2 = process.env.DEMO_VERSION ?? "1.3.
|
|
565961
|
+
const version2 = process.env.DEMO_VERSION ?? "1.3.445";
|
|
565706
565962
|
const serverUrl = getDirectConnectServerUrl();
|
|
565707
565963
|
const displayPath = process.env.DEMO_VERSION ? "/code/claude" : getDisplayPath(getCwd());
|
|
565708
565964
|
const cwd2 = serverUrl ? `${displayPath} in ${serverUrl.replace(/^https?:\/\//, "")}` : displayPath;
|
|
@@ -566949,7 +567205,7 @@ function LogoV2() {
|
|
|
566949
567205
|
if ($3[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
566950
567206
|
t2 = () => {
|
|
566951
567207
|
const currentConfig = getGlobalConfig();
|
|
566952
|
-
if (currentConfig.lastReleaseNotesSeen === "1.3.
|
|
567208
|
+
if (currentConfig.lastReleaseNotesSeen === "1.3.445") {
|
|
566953
567209
|
return;
|
|
566954
567210
|
}
|
|
566955
567211
|
saveGlobalConfig(_temp327);
|
|
@@ -567427,7 +567683,7 @@ function LogoV2() {
|
|
|
567427
567683
|
t24 = $3[61];
|
|
567428
567684
|
}
|
|
567429
567685
|
const _latestNpm = getCachedLatestNpmVersionSync();
|
|
567430
|
-
const _updateFeeds = _latestNpm && gt(_latestNpm, "1.3.
|
|
567686
|
+
const _updateFeeds = _latestNpm && gt(_latestNpm, "1.3.445") ? [createUpdateAvailableFeed("1.3.445", _latestNpm)] : [];
|
|
567431
567687
|
const t25 = layoutMode === "horizontal" && /* @__PURE__ */ jsx_runtime239.jsx(FeedColumn, {
|
|
567432
567688
|
feeds: showOnboarding ? [createProjectOnboardingFeed(getSteps()), createRecentActivityFeed(activities)] : showGuestPassesUpsell ? [createRecentActivityFeed(activities), createGuestPassesFeed()] : showOverageCreditUpsell ? [createRecentActivityFeed(activities), createOverageCreditFeed()] : [createRecentActivityFeed(activities), ..._updateFeeds, createWhatsNewFeed(changelog)],
|
|
567433
567689
|
maxWidth: rightWidth
|
|
@@ -567627,12 +567883,12 @@ function LogoV2() {
|
|
|
567627
567883
|
return t41;
|
|
567628
567884
|
}
|
|
567629
567885
|
function _temp327(current) {
|
|
567630
|
-
if (current.lastReleaseNotesSeen === "1.3.
|
|
567886
|
+
if (current.lastReleaseNotesSeen === "1.3.445") {
|
|
567631
567887
|
return current;
|
|
567632
567888
|
}
|
|
567633
567889
|
return {
|
|
567634
567890
|
...current,
|
|
567635
|
-
lastReleaseNotesSeen: "1.3.
|
|
567891
|
+
lastReleaseNotesSeen: "1.3.445"
|
|
567636
567892
|
};
|
|
567637
567893
|
}
|
|
567638
567894
|
function _temp241(s_0) {
|
|
@@ -592541,7 +592797,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
|
|
|
592541
592797
|
smapsRollup,
|
|
592542
592798
|
platform: process.platform,
|
|
592543
592799
|
nodeVersion: process.version,
|
|
592544
|
-
ccVersion: "1.3.
|
|
592800
|
+
ccVersion: "1.3.445"
|
|
592545
592801
|
};
|
|
592546
592802
|
}
|
|
592547
592803
|
async function performHeapDump(trigger = "manual", dumpNumber = 0) {
|
|
@@ -593063,7 +593319,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
593063
593319
|
var call49 = async () => {
|
|
593064
593320
|
return {
|
|
593065
593321
|
type: "text",
|
|
593066
|
-
value: "1.3.
|
|
593322
|
+
value: "1.3.445"
|
|
593067
593323
|
};
|
|
593068
593324
|
}, version2, version_default;
|
|
593069
593325
|
var init_version = __esm(() => {
|
|
@@ -594459,7 +594715,7 @@ var init_rayuLogin = __esm(() => {
|
|
|
594459
594715
|
init_rayuEntitlements();
|
|
594460
594716
|
init_rayuHostedProvider();
|
|
594461
594717
|
init_rayuSession();
|
|
594462
|
-
RAYU_SUCCESS_HTML = '<html><body style="font-family:sans-serif"><h3>Signed in to Rayu.</h3>' + "<p>You can close this tab and return to your terminal.</p></body></html>";
|
|
594718
|
+
RAYU_SUCCESS_HTML = '<html><body style="font-family:sans-serif"><h3>Signed in to Rayu.</h3>' + "<p>You can close this tab and return to your terminal.</p></body></html>" + '<p>View Your dashboard: <a href="' + getRayuWebBaseUrl() + '/dashboard" target="_blank">here</a></p></body></html>';
|
|
594463
594719
|
LOGIN_TIMEOUT_MS2 = 5 * 60 * 1000;
|
|
594464
594720
|
});
|
|
594465
594721
|
|
|
@@ -603016,7 +603272,7 @@ function generateHtmlReport(data, insights) {
|
|
|
603016
603272
|
</html>`;
|
|
603017
603273
|
}
|
|
603018
603274
|
function buildExportData(data, insights, facets, remoteStats) {
|
|
603019
|
-
const version3 = typeof MACRO !== "undefined" ? "1.3.
|
|
603275
|
+
const version3 = typeof MACRO !== "undefined" ? "1.3.445" : "unknown";
|
|
603020
603276
|
const remote_hosts_collected = remoteStats?.hosts.filter((h3) => h3.sessionCount > 0).map((h3) => h3.name);
|
|
603021
603277
|
const facets_summary = {
|
|
603022
603278
|
total: facets.size,
|
|
@@ -606926,7 +607182,7 @@ var init_sessionStorage = __esm(() => {
|
|
|
606926
607182
|
init_settings2();
|
|
606927
607183
|
init_slowOperations();
|
|
606928
607184
|
init_uuid();
|
|
606929
|
-
VERSION6 = typeof MACRO !== "undefined" ? "1.3.
|
|
607185
|
+
VERSION6 = typeof MACRO !== "undefined" ? "1.3.445" : "unknown";
|
|
606930
607186
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
606931
607187
|
SKIP_FIRST_PROMPT_PATTERN = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
|
|
606932
607188
|
EPHEMERAL_PROGRESS_TYPES = new Set([
|
|
@@ -608146,7 +608402,7 @@ var init_filesystem = __esm(() => {
|
|
|
608146
608402
|
});
|
|
608147
608403
|
getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
|
|
608148
608404
|
const nonce = randomBytes19(16).toString("hex");
|
|
608149
|
-
return join154(getClaudeTempDir(), "bundled-skills", "1.3.
|
|
608405
|
+
return join154(getClaudeTempDir(), "bundled-skills", "1.3.445", nonce);
|
|
608150
608406
|
});
|
|
608151
608407
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
608152
608408
|
});
|
|
@@ -613261,7 +613517,7 @@ __export(exports_update, {
|
|
|
613261
613517
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
613262
613518
|
import { homedir as homedir35 } from "os";
|
|
613263
613519
|
async function update() {
|
|
613264
|
-
writeToStdout(`Current version: ${"1.3.
|
|
613520
|
+
writeToStdout(`Current version: ${"1.3.445"}
|
|
613265
613521
|
`);
|
|
613266
613522
|
const isBundled = isInBundledMode();
|
|
613267
613523
|
if (isBundled) {
|
|
@@ -613287,13 +613543,13 @@ Manual check: npm view ${"@rayu-dev/rayu-cli"} version
|
|
|
613287
613543
|
process.exit(1);
|
|
613288
613544
|
return;
|
|
613289
613545
|
}
|
|
613290
|
-
if (latestVersion === "1.3.
|
|
613546
|
+
if (latestVersion === "1.3.445") {
|
|
613291
613547
|
writeToStdout(source_default.green(`
|
|
613292
|
-
Rayu CLI is up to date (${"1.3.
|
|
613548
|
+
Rayu CLI is up to date (${"1.3.445"})
|
|
613293
613549
|
`));
|
|
613294
613550
|
process.exit(0);
|
|
613295
613551
|
}
|
|
613296
|
-
writeToStdout(`New version available: ${latestVersion} (current: ${"1.3.
|
|
613552
|
+
writeToStdout(`New version available: ${latestVersion} (current: ${"1.3.445"})
|
|
613297
613553
|
`);
|
|
613298
613554
|
writeToStdout(`Installing update...
|
|
613299
613555
|
|
|
@@ -613317,7 +613573,7 @@ Try manually:
|
|
|
613317
613573
|
return;
|
|
613318
613574
|
}
|
|
613319
613575
|
writeToStdout(source_default.green(`
|
|
613320
|
-
Successfully updated from ${"1.3.
|
|
613576
|
+
Successfully updated from ${"1.3.445"} to ${latestVersion}
|
|
613321
613577
|
`));
|
|
613322
613578
|
process.exit(0);
|
|
613323
613579
|
}
|
|
@@ -613331,14 +613587,14 @@ async function updateNativeBinary() {
|
|
|
613331
613587
|
} catch {
|
|
613332
613588
|
latestVersion = "";
|
|
613333
613589
|
}
|
|
613334
|
-
if (latestVersion && latestVersion === "1.3.
|
|
613590
|
+
if (latestVersion && latestVersion === "1.3.445") {
|
|
613335
613591
|
writeToStdout(source_default.green(`
|
|
613336
|
-
Rayu CLI is up to date (1.3.
|
|
613592
|
+
Rayu CLI is up to date (1.3.445)
|
|
613337
613593
|
`));
|
|
613338
613594
|
process.exit(0);
|
|
613339
613595
|
}
|
|
613340
613596
|
if (latestVersion) {
|
|
613341
|
-
writeToStdout(`New version available: ${latestVersion} (current: 1.3.
|
|
613597
|
+
writeToStdout(`New version available: ${latestVersion} (current: 1.3.445)
|
|
613342
613598
|
`);
|
|
613343
613599
|
}
|
|
613344
613600
|
writeToStdout(`Downloading and installing update...
|
|
@@ -613353,13 +613609,13 @@ Rayu CLI is up to date (1.3.443)
|
|
|
613353
613609
|
return;
|
|
613354
613610
|
}
|
|
613355
613611
|
writeToStdout(source_default.green(`
|
|
613356
|
-
Rayu CLI is up to date (1.3.
|
|
613612
|
+
Rayu CLI is up to date (1.3.445)
|
|
613357
613613
|
`));
|
|
613358
613614
|
process.exit(0);
|
|
613359
613615
|
}
|
|
613360
613616
|
const updatedTo = result.latestVersion ?? latestVersion ?? "latest";
|
|
613361
613617
|
writeToStdout(source_default.green(`
|
|
613362
|
-
Successfully updated from 1.3.
|
|
613618
|
+
Successfully updated from 1.3.445 to ${updatedTo}
|
|
613363
613619
|
`));
|
|
613364
613620
|
writeToStdout(`Restart your terminal to use the new version.
|
|
613365
613621
|
`);
|
|
@@ -613390,7 +613646,7 @@ __export(exports_uninstall, {
|
|
|
613390
613646
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
613391
613647
|
import { homedir as homedir36 } from "os";
|
|
613392
613648
|
async function uninstall() {
|
|
613393
|
-
writeToStdout(`Uninstalling Rayu CLI (${"1.3.
|
|
613649
|
+
writeToStdout(`Uninstalling Rayu CLI (${"1.3.445"})...
|
|
613394
613650
|
`);
|
|
613395
613651
|
writeToStdout(`Running: npm uninstall -g ${"@rayu-dev/rayu-cli"}
|
|
613396
613652
|
|
|
@@ -613413,7 +613669,7 @@ Try running manually:
|
|
|
613413
613669
|
process.exit(1);
|
|
613414
613670
|
}
|
|
613415
613671
|
writeToStdout(source_default.green(`
|
|
613416
|
-
Successfully uninstalled ${"@rayu-dev/rayu-cli"} ${"1.3.
|
|
613672
|
+
Successfully uninstalled ${"@rayu-dev/rayu-cli"} ${"1.3.445"}
|
|
613417
613673
|
`));
|
|
613418
613674
|
writeToStdout(`Thanks for using Rayu CLI!
|
|
613419
613675
|
`);
|
|
@@ -613465,7 +613721,7 @@ function showFirstRunWelcome() {
|
|
|
613465
613721
|
`);
|
|
613466
613722
|
try {
|
|
613467
613723
|
mkdirSync16(getRayuConfigHomeDir(), { recursive: true });
|
|
613468
|
-
writeFileSync18(markerPath(), "1.3.
|
|
613724
|
+
writeFileSync18(markerPath(), "1.3.445", "utf8");
|
|
613469
613725
|
} catch {}
|
|
613470
613726
|
}
|
|
613471
613727
|
var init_firstRun = __esm(() => {
|
|
@@ -625308,7 +625564,7 @@ async function initializeBetaTracing(resource) {
|
|
|
625308
625564
|
});
|
|
625309
625565
|
import_api_logs.logs.setGlobalLoggerProvider(loggerProvider);
|
|
625310
625566
|
setLoggerProvider(loggerProvider);
|
|
625311
|
-
const eventLogger = import_api_logs.logs.getLogger("com.anthropic.claude_code.events", "1.3.
|
|
625567
|
+
const eventLogger = import_api_logs.logs.getLogger("com.anthropic.claude_code.events", "1.3.445");
|
|
625312
625568
|
setEventLogger(eventLogger);
|
|
625313
625569
|
process.on("beforeExit", async () => {
|
|
625314
625570
|
await loggerProvider?.forceFlush();
|
|
@@ -625348,7 +625604,7 @@ async function initializeTelemetry() {
|
|
|
625348
625604
|
const platform4 = getPlatform();
|
|
625349
625605
|
const baseAttributes = {
|
|
625350
625606
|
[import_semantic_conventions2.ATTR_SERVICE_NAME]: "claude-code",
|
|
625351
|
-
[import_semantic_conventions2.ATTR_SERVICE_VERSION]: "1.3.
|
|
625607
|
+
[import_semantic_conventions2.ATTR_SERVICE_VERSION]: "1.3.445"
|
|
625352
625608
|
};
|
|
625353
625609
|
if (platform4 === "wsl") {
|
|
625354
625610
|
const wslVersion = getWslVersion();
|
|
@@ -625393,7 +625649,7 @@ async function initializeTelemetry() {
|
|
|
625393
625649
|
} catch {}
|
|
625394
625650
|
};
|
|
625395
625651
|
registerCleanup(shutdownTelemetry2);
|
|
625396
|
-
return meterProvider2.getMeter("com.anthropic.claude_code", "1.3.
|
|
625652
|
+
return meterProvider2.getMeter("com.anthropic.claude_code", "1.3.445");
|
|
625397
625653
|
}
|
|
625398
625654
|
const meterProvider = new import_sdk_metrics2.MeterProvider({
|
|
625399
625655
|
resource,
|
|
@@ -625413,7 +625669,7 @@ async function initializeTelemetry() {
|
|
|
625413
625669
|
});
|
|
625414
625670
|
import_api_logs.logs.setGlobalLoggerProvider(loggerProvider);
|
|
625415
625671
|
setLoggerProvider(loggerProvider);
|
|
625416
|
-
const eventLogger = import_api_logs.logs.getLogger("com.anthropic.claude_code.events", "1.3.
|
|
625672
|
+
const eventLogger = import_api_logs.logs.getLogger("com.anthropic.claude_code.events", "1.3.445");
|
|
625417
625673
|
setEventLogger(eventLogger);
|
|
625418
625674
|
logForDebugging("[3P telemetry] Event logger set successfully");
|
|
625419
625675
|
process.on("beforeExit", async () => {
|
|
@@ -625475,7 +625731,7 @@ Current timeout: ${timeoutMs}ms
|
|
|
625475
625731
|
}
|
|
625476
625732
|
};
|
|
625477
625733
|
registerCleanup(shutdownTelemetry);
|
|
625478
|
-
return meterProvider.getMeter("com.anthropic.claude_code", "1.3.
|
|
625734
|
+
return meterProvider.getMeter("com.anthropic.claude_code", "1.3.445");
|
|
625479
625735
|
}
|
|
625480
625736
|
async function flushTelemetry() {
|
|
625481
625737
|
const meterProvider = getMeterProvider();
|
|
@@ -626988,7 +627244,7 @@ function buildSystemInitMessage(inputs) {
|
|
|
626988
627244
|
slash_commands: inputs.commands.filter((c4) => c4.userInvocable !== false).map((c4) => c4.name),
|
|
626989
627245
|
apiKeySource: getAnthropicApiKeyWithSource().source,
|
|
626990
627246
|
betas: getSdkBetas(),
|
|
626991
|
-
claude_code_version: "1.3.
|
|
627247
|
+
claude_code_version: "1.3.445",
|
|
626992
627248
|
output_style: outputStyle2,
|
|
626993
627249
|
agents: inputs.agents.map((agent) => agent.agentType),
|
|
626994
627250
|
skills: inputs.skills.filter((s2) => s2.userInvocable !== false).map((skill) => skill.name),
|
|
@@ -643322,7 +643578,7 @@ var init_useVoiceEnabled = __esm(() => {
|
|
|
643322
643578
|
function getSemverPart(version3) {
|
|
643323
643579
|
return `${import_semver12.major(version3, { loose: true })}.${import_semver12.minor(version3, { loose: true })}.${import_semver12.patch(version3, { loose: true })}`;
|
|
643324
643580
|
}
|
|
643325
|
-
function useUpdateNotification(updatedVersion, initialVersion = "1.3.
|
|
643581
|
+
function useUpdateNotification(updatedVersion, initialVersion = "1.3.445") {
|
|
643326
643582
|
const [lastNotifiedSemver, setLastNotifiedSemver] = import_react217.useState(() => getSemverPart(initialVersion));
|
|
643327
643583
|
if (!updatedVersion) {
|
|
643328
643584
|
return null;
|
|
@@ -643362,7 +643618,7 @@ function AutoUpdater({
|
|
|
643362
643618
|
return;
|
|
643363
643619
|
}
|
|
643364
643620
|
if (false) {}
|
|
643365
|
-
const currentVersion = "1.3.
|
|
643621
|
+
const currentVersion = "1.3.445";
|
|
643366
643622
|
const channel2 = getInitialSettings()?.autoUpdatesChannel ?? "latest";
|
|
643367
643623
|
let latestVersion = await getLatestVersion(channel2);
|
|
643368
643624
|
const isDisabled = isAutoUpdaterDisabled();
|
|
@@ -643575,12 +643831,12 @@ function NativeAutoUpdater({
|
|
|
643575
643831
|
logEvent("tengu_native_auto_updater_start", {});
|
|
643576
643832
|
try {
|
|
643577
643833
|
const maxVersion = await getMaxVersion();
|
|
643578
|
-
if (maxVersion && gt("1.3.
|
|
643834
|
+
if (maxVersion && gt("1.3.445", maxVersion)) {
|
|
643579
643835
|
const msg = await getMaxVersionMessage();
|
|
643580
643836
|
setMaxVersionIssue(msg ?? "affects your version");
|
|
643581
643837
|
}
|
|
643582
643838
|
const result = await installLatest(channel2);
|
|
643583
|
-
const currentVersion = "1.3.
|
|
643839
|
+
const currentVersion = "1.3.445";
|
|
643584
643840
|
const latencyMs = Date.now() - startTime2;
|
|
643585
643841
|
if (result.lockFailed) {
|
|
643586
643842
|
logEvent("tengu_native_auto_updater_lock_contention", {
|
|
@@ -643717,17 +643973,17 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
643717
643973
|
const maxVersion = await getMaxVersion();
|
|
643718
643974
|
if (maxVersion && latest && gt(latest, maxVersion)) {
|
|
643719
643975
|
logForDebugging(`PackageManagerAutoUpdater: maxVersion ${maxVersion} is set, capping update from ${latest} to ${maxVersion}`);
|
|
643720
|
-
if (gte("1.3.
|
|
643721
|
-
logForDebugging(`PackageManagerAutoUpdater: current version ${"1.3.
|
|
643976
|
+
if (gte("1.3.445", maxVersion)) {
|
|
643977
|
+
logForDebugging(`PackageManagerAutoUpdater: current version ${"1.3.445"} is already at or above maxVersion ${maxVersion}, skipping update`);
|
|
643722
643978
|
setUpdateAvailable(false);
|
|
643723
643979
|
return;
|
|
643724
643980
|
}
|
|
643725
643981
|
latest = maxVersion;
|
|
643726
643982
|
}
|
|
643727
|
-
const hasUpdate = latest && !gte("1.3.
|
|
643983
|
+
const hasUpdate = latest && !gte("1.3.445", latest) && !shouldSkipVersion(latest);
|
|
643728
643984
|
setUpdateAvailable(!!hasUpdate);
|
|
643729
643985
|
if (hasUpdate) {
|
|
643730
|
-
logForDebugging(`PackageManagerAutoUpdater: Update available ${"1.3.
|
|
643986
|
+
logForDebugging(`PackageManagerAutoUpdater: Update available ${"1.3.445"} -> ${latest}`);
|
|
643731
643987
|
}
|
|
643732
643988
|
};
|
|
643733
643989
|
$3[0] = t1;
|
|
@@ -643761,7 +644017,7 @@ function PackageManagerAutoUpdater(t0) {
|
|
|
643761
644017
|
wrap: "truncate",
|
|
643762
644018
|
children: [
|
|
643763
644019
|
"currentVersion: ",
|
|
643764
|
-
"1.3.
|
|
644020
|
+
"1.3.445"
|
|
643765
644021
|
]
|
|
643766
644022
|
});
|
|
643767
644023
|
$3[3] = verbose;
|
|
@@ -651926,7 +652182,7 @@ function buildStatusLineCommandInput(permissionMode, exceeds200kTokens, settings
|
|
|
651926
652182
|
project_dir: getOriginalCwd(),
|
|
651927
652183
|
added_dirs: addedDirs
|
|
651928
652184
|
},
|
|
651929
|
-
version: "1.3.
|
|
652185
|
+
version: "1.3.445",
|
|
651930
652186
|
output_style: {
|
|
651931
652187
|
name: outputStyleName
|
|
651932
652188
|
},
|
|
@@ -653732,7 +653988,7 @@ function PromptChar(t0) {
|
|
|
653732
653988
|
themeColor
|
|
653733
653989
|
} = t0;
|
|
653734
653990
|
const teammateColor = themeColor;
|
|
653735
|
-
const color3 = teammateColor ??
|
|
653991
|
+
const color3 = teammateColor ?? "promptChar";
|
|
653736
653992
|
let t1;
|
|
653737
653993
|
if ($3[0] !== color3 || $3[1] !== isLoading) {
|
|
653738
653994
|
t1 = /* @__PURE__ */ jsx_runtime418.jsxs(ThemedText, {
|
|
@@ -663424,7 +663680,7 @@ async function submitTranscriptShare(messages, trigger, appearanceId) {
|
|
|
663424
663680
|
} catch {}
|
|
663425
663681
|
const data = {
|
|
663426
663682
|
trigger,
|
|
663427
|
-
version: "1.3.
|
|
663683
|
+
version: "1.3.445",
|
|
663428
663684
|
platform: process.platform,
|
|
663429
663685
|
transcript,
|
|
663430
663686
|
subagentTranscripts: Object.keys(subagentTranscripts).length > 0 ? subagentTranscripts : undefined,
|
|
@@ -671459,6 +671715,8 @@ function REPL({
|
|
|
671459
671715
|
const haikuTitleAttemptedRef = import_react309.useRef((initialMessages?.length ?? 0) > 0);
|
|
671460
671716
|
const agentTitle = mainThreadAgentDefinition?.agentType;
|
|
671461
671717
|
const terminalTitle = sessionTitle ?? agentTitle ?? haikuTitle ?? "Rayu-CLI";
|
|
671718
|
+
const terminalTabDetail = sessionTitle ?? agentTitle ?? haikuTitle;
|
|
671719
|
+
const terminalTabTitle = terminalTabDetail ? `rayu — ${terminalTabDetail}` : "rayu";
|
|
671462
671720
|
const isWaitingForApproval = toolUseConfirmQueue.length > 0 || promptQueue.length > 0 || pendingWorkerRequest || pendingSandboxRequest;
|
|
671463
671721
|
const isShowingLocalJSXCommand = toolJSX?.isLocalJSXCommand === true && toolJSX?.jsx != null;
|
|
671464
671722
|
const titleIsAnimating = isLoading && !isWaitingForApproval && !isShowingLocalJSXCommand;
|
|
@@ -673589,7 +673847,7 @@ Note: ctrl + z now suspends RAYU, ctrl + _ undoes input.
|
|
|
673589
673847
|
children: [
|
|
673590
673848
|
/* @__PURE__ */ jsx_runtime451.jsx(AnimatedTerminalTitle, {
|
|
673591
673849
|
isAnimating: titleIsAnimating,
|
|
673592
|
-
title:
|
|
673850
|
+
title: terminalTabTitle,
|
|
673593
673851
|
disabled: titleDisabled,
|
|
673594
673852
|
noPrefix: showStatusInTerminalTab
|
|
673595
673853
|
}),
|
|
@@ -673695,7 +673953,7 @@ Note: ctrl + z now suspends RAYU, ctrl + _ undoes input.
|
|
|
673695
673953
|
children: [
|
|
673696
673954
|
/* @__PURE__ */ jsx_runtime451.jsx(AnimatedTerminalTitle, {
|
|
673697
673955
|
isAnimating: titleIsAnimating,
|
|
673698
|
-
title:
|
|
673956
|
+
title: terminalTabTitle,
|
|
673699
673957
|
disabled: titleDisabled,
|
|
673700
673958
|
noPrefix: showStatusInTerminalTab
|
|
673701
673959
|
}),
|
|
@@ -675609,7 +675867,7 @@ function WelcomeV2() {
|
|
|
675609
675867
|
dimColor: true,
|
|
675610
675868
|
children: [
|
|
675611
675869
|
"v",
|
|
675612
|
-
"1.3.
|
|
675870
|
+
"1.3.445"
|
|
675613
675871
|
]
|
|
675614
675872
|
})
|
|
675615
675873
|
]
|
|
@@ -677343,7 +677601,7 @@ function completeOnboarding() {
|
|
|
677343
677601
|
saveGlobalConfig((current) => ({
|
|
677344
677602
|
...current,
|
|
677345
677603
|
hasCompletedOnboarding: true,
|
|
677346
|
-
lastOnboardingVersion: "1.3.
|
|
677604
|
+
lastOnboardingVersion: "1.3.445"
|
|
677347
677605
|
}));
|
|
677348
677606
|
}
|
|
677349
677607
|
function showDialog(root2, renderer) {
|
|
@@ -682293,7 +682551,7 @@ function appendToLog(path30, message) {
|
|
|
682293
682551
|
cwd: getFsImplementation().cwd(),
|
|
682294
682552
|
userType: "external",
|
|
682295
682553
|
sessionId: getSessionId(),
|
|
682296
|
-
version: "1.3.
|
|
682554
|
+
version: "1.3.445"
|
|
682297
682555
|
};
|
|
682298
682556
|
getLogWriter(path30).write(messageWithTimestamp);
|
|
682299
682557
|
}
|
|
@@ -686401,8 +686659,8 @@ async function getEnvLessBridgeConfig() {
|
|
|
686401
686659
|
}
|
|
686402
686660
|
async function checkEnvLessBridgeMinVersion() {
|
|
686403
686661
|
const cfg = await getEnvLessBridgeConfig();
|
|
686404
|
-
if (cfg.min_version && lt("1.3.
|
|
686405
|
-
return `Your version of RAYU (${"1.3.
|
|
686662
|
+
if (cfg.min_version && lt("1.3.445", cfg.min_version)) {
|
|
686663
|
+
return `Your version of RAYU (${"1.3.445"}) is too old for Remote Control.
|
|
686406
686664
|
Version ${cfg.min_version} or higher is required. Run \`claude update\` to update.`;
|
|
686407
686665
|
}
|
|
686408
686666
|
return null;
|
|
@@ -686876,7 +687134,7 @@ async function initBridgeCore(params) {
|
|
|
686876
687134
|
const rawApi = createBridgeApiClient({
|
|
686877
687135
|
baseUrl,
|
|
686878
687136
|
getAccessToken,
|
|
686879
|
-
runnerVersion: "1.3.
|
|
687137
|
+
runnerVersion: "1.3.445",
|
|
686880
687138
|
onDebug: logForDebugging,
|
|
686881
687139
|
onAuth401,
|
|
686882
687140
|
getTrustedDeviceToken
|
|
@@ -692238,7 +692496,7 @@ async function startMCPServer(cwd3, debug4, verbose) {
|
|
|
692238
692496
|
setCwd(cwd3);
|
|
692239
692497
|
const server = new Server({
|
|
692240
692498
|
name: "claude/tengu",
|
|
692241
|
-
version: "1.3.
|
|
692499
|
+
version: "1.3.445"
|
|
692242
692500
|
}, {
|
|
692243
692501
|
capabilities: {
|
|
692244
692502
|
tools: {}
|
|
@@ -694764,7 +695022,7 @@ ${customInstructions}` : customInstructions;
|
|
|
694764
695022
|
}
|
|
694765
695023
|
}
|
|
694766
695024
|
logForDiagnosticsNoPII("info", "started", {
|
|
694767
|
-
version: "1.3.
|
|
695025
|
+
version: "1.3.445",
|
|
694768
695026
|
is_native_binary: isInBundledMode()
|
|
694769
695027
|
});
|
|
694770
695028
|
registerCleanup(async () => {
|
|
@@ -695483,7 +695741,7 @@ Usage: rayu --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
695483
695741
|
pendingHookMessages
|
|
695484
695742
|
}, renderAndRun);
|
|
695485
695743
|
}
|
|
695486
|
-
}).version("1.3.
|
|
695744
|
+
}).version("1.3.445 (Rayu-CLI)", "-v, --version", "Output the version number");
|
|
695487
695745
|
program.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
695488
695746
|
program.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
|
|
695489
695747
|
if (canUserConfigureAdvisor()) {
|
|
@@ -695945,9 +696203,14 @@ if (false) {}
|
|
|
695945
696203
|
async function main2() {
|
|
695946
696204
|
const args = process.argv.slice(2);
|
|
695947
696205
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
695948
|
-
console.log(`${"1.3.
|
|
696206
|
+
console.log(`${"1.3.445"} (Rayu-CLI)`);
|
|
695949
696207
|
return;
|
|
695950
696208
|
}
|
|
696209
|
+
if (!isEnvTruthy(process.env.CLAUDE_CODE_DISABLE_TERMINAL_TITLE)) {
|
|
696210
|
+
try {
|
|
696211
|
+
process.title = "rayu";
|
|
696212
|
+
} catch {}
|
|
696213
|
+
}
|
|
695951
696214
|
const { maybeReexecForHeapLimit: maybeReexecForHeapLimit2 } = await Promise.resolve().then(() => (init_heapLimitReexec(), exports_heapLimitReexec));
|
|
695952
696215
|
maybeReexecForHeapLimit2();
|
|
695953
696216
|
const {
|