@cnwenf/occ 2.1.326 → 2.1.328
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +337 -80
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
globalThis.MACRO={"VERSION":"2.1.
|
|
2
|
+
globalThis.MACRO={"VERSION":"2.1.328","BINARY_NAME":"occ","BUILD_TIME":"2026-09-10T19:48:17.557Z","FEEDBACK_CHANNEL":"","ISSUES_EXPLAINER":"","NATIVE_PACKAGE_URL":"","PACKAGE_URL":"@cnwenf/occ","VERSION_CHANGELOG":""};
|
|
3
3
|
// @bun
|
|
4
4
|
var __create = Object.create;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
@@ -60319,6 +60319,102 @@ var init_settings = __esm(() => {
|
|
|
60319
60319
|
EMPTY_RESULT = Object.freeze({ settings: {}, errors: [] });
|
|
60320
60320
|
});
|
|
60321
60321
|
|
|
60322
|
+
// src/utils/settings/sanitizeAllowlists.ts
|
|
60323
|
+
function issueDetail(error49) {
|
|
60324
|
+
const issue2 = error49.issues[0];
|
|
60325
|
+
if (issue2 === undefined)
|
|
60326
|
+
return "failed validation";
|
|
60327
|
+
return issue2.path.length > 0 ? `${issue2.path.join(".")}: ${issue2.message}` : issue2.message;
|
|
60328
|
+
}
|
|
60329
|
+
function validateAllowlistEntry(key, entry) {
|
|
60330
|
+
if (key === "allowedChannelPlugins") {
|
|
60331
|
+
if (typeof entry === "string") {
|
|
60332
|
+
const at = entry.indexOf("@");
|
|
60333
|
+
const plugin = entry.slice(0, at);
|
|
60334
|
+
const marketplace = entry.slice(at + 1);
|
|
60335
|
+
if (at > 0 && marketplace.length > 0) {
|
|
60336
|
+
return {
|
|
60337
|
+
ok: true,
|
|
60338
|
+
value: { marketplace, plugin },
|
|
60339
|
+
notice: `"allowedChannelPlugins" entry "${entry}" was accepted; prefer the documented object form {"plugin": "${plugin}", "marketplace": "${marketplace}"}.`
|
|
60340
|
+
};
|
|
60341
|
+
}
|
|
60342
|
+
}
|
|
60343
|
+
const parsed2 = CHANNEL_PLUGIN_ENTRY.safeParse(entry);
|
|
60344
|
+
return parsed2.success ? { ok: true, value: parsed2.data } : { ok: false, detail: issueDetail(parsed2.error) };
|
|
60345
|
+
}
|
|
60346
|
+
const parsed = STRING_ENTRY.safeParse(entry);
|
|
60347
|
+
return parsed.success ? { ok: true, value: parsed.data } : { ok: false, detail: issueDetail(parsed.error) };
|
|
60348
|
+
}
|
|
60349
|
+
function sanitizeSecurityAllowlists(data, filePath) {
|
|
60350
|
+
if (!data || typeof data !== "object")
|
|
60351
|
+
return [];
|
|
60352
|
+
const obj = data;
|
|
60353
|
+
const warnings = [];
|
|
60354
|
+
for (const { key, emptyReason } of ALLOWLIST_SPECS) {
|
|
60355
|
+
if (!(key in obj))
|
|
60356
|
+
continue;
|
|
60357
|
+
const raw = obj[key];
|
|
60358
|
+
if (!Array.isArray(raw)) {
|
|
60359
|
+
obj[key] = [];
|
|
60360
|
+
warnings.push({
|
|
60361
|
+
file: filePath,
|
|
60362
|
+
path: key,
|
|
60363
|
+
message: `"${key}" was present but invalid; enforcing an empty allowlist (${emptyReason}) until it is fixed.`,
|
|
60364
|
+
invalidValue: raw
|
|
60365
|
+
});
|
|
60366
|
+
continue;
|
|
60367
|
+
}
|
|
60368
|
+
const valid = [];
|
|
60369
|
+
for (const [index2, entry] of raw.entries()) {
|
|
60370
|
+
const result = validateAllowlistEntry(key, entry);
|
|
60371
|
+
if (result.ok) {
|
|
60372
|
+
valid.push(result.value);
|
|
60373
|
+
if (result.notice !== undefined) {
|
|
60374
|
+
warnings.push({
|
|
60375
|
+
file: filePath,
|
|
60376
|
+
path: `${key}[${index2}]`,
|
|
60377
|
+
message: result.notice
|
|
60378
|
+
});
|
|
60379
|
+
}
|
|
60380
|
+
} else {
|
|
60381
|
+
warnings.push({
|
|
60382
|
+
file: filePath,
|
|
60383
|
+
path: `${key}[${index2}]`,
|
|
60384
|
+
message: `Invalid entry was ignored: ${result.detail}`,
|
|
60385
|
+
invalidValue: entry
|
|
60386
|
+
});
|
|
60387
|
+
}
|
|
60388
|
+
}
|
|
60389
|
+
if (raw.length > 0 && valid.length === 0) {
|
|
60390
|
+
warnings.push({
|
|
60391
|
+
file: filePath,
|
|
60392
|
+
path: key,
|
|
60393
|
+
message: `Every entry of "${key}" was invalid; enforcing an empty allowlist (${emptyReason}) until it is fixed.`
|
|
60394
|
+
});
|
|
60395
|
+
}
|
|
60396
|
+
obj[key] = valid;
|
|
60397
|
+
}
|
|
60398
|
+
return warnings;
|
|
60399
|
+
}
|
|
60400
|
+
var STRING_ENTRY, CHANNEL_PLUGIN_ENTRY, ALLOWLIST_SPECS;
|
|
60401
|
+
var init_sanitizeAllowlists = __esm(() => {
|
|
60402
|
+
init_v4();
|
|
60403
|
+
STRING_ENTRY = exports_external.string();
|
|
60404
|
+
CHANNEL_PLUGIN_ENTRY = exports_external.object({
|
|
60405
|
+
marketplace: exports_external.string(),
|
|
60406
|
+
plugin: exports_external.string()
|
|
60407
|
+
});
|
|
60408
|
+
ALLOWLIST_SPECS = [
|
|
60409
|
+
{ key: "allowedHttpHookUrls", emptyReason: "no HTTP hooks may run" },
|
|
60410
|
+
{
|
|
60411
|
+
key: "httpHookAllowedEnvVars",
|
|
60412
|
+
emptyReason: "no environment variables may be interpolated into HTTP hook headers"
|
|
60413
|
+
},
|
|
60414
|
+
{ key: "allowedChannelPlugins", emptyReason: "no channel plugins admitted" }
|
|
60415
|
+
];
|
|
60416
|
+
});
|
|
60417
|
+
|
|
60322
60418
|
// src/utils/settings/settings.ts
|
|
60323
60419
|
var exports_settings = {};
|
|
60324
60420
|
__export(exports_settings, {
|
|
@@ -60455,12 +60551,19 @@ function parseSettingsFileUncached(path9) {
|
|
|
60455
60551
|
}
|
|
60456
60552
|
const data = safeParseJSON(content, false);
|
|
60457
60553
|
const ruleWarnings = filterInvalidPermissionRules(data, path9);
|
|
60554
|
+
const allowlistWarnings = sanitizeSecurityAllowlists(data, path9);
|
|
60458
60555
|
const result = SettingsSchema().safeParse(data);
|
|
60459
60556
|
if (!result.success) {
|
|
60460
60557
|
const errors3 = formatZodError(result.error, path9);
|
|
60461
|
-
return {
|
|
60558
|
+
return {
|
|
60559
|
+
settings: null,
|
|
60560
|
+
errors: [...ruleWarnings, ...allowlistWarnings, ...errors3]
|
|
60561
|
+
};
|
|
60462
60562
|
}
|
|
60463
|
-
return {
|
|
60563
|
+
return {
|
|
60564
|
+
settings: result.data,
|
|
60565
|
+
errors: [...ruleWarnings, ...allowlistWarnings]
|
|
60566
|
+
};
|
|
60464
60567
|
} catch (error49) {
|
|
60465
60568
|
handleFileSystemError(error49, path9);
|
|
60466
60569
|
return { settings: null, errors: [] };
|
|
@@ -61086,6 +61189,7 @@ var init_settings2 = __esm(() => {
|
|
|
61086
61189
|
init_managedPath();
|
|
61087
61190
|
init_settings();
|
|
61088
61191
|
init_settingsCache();
|
|
61192
|
+
init_sanitizeAllowlists();
|
|
61089
61193
|
init_types2();
|
|
61090
61194
|
init_validation2();
|
|
61091
61195
|
MAX_SETTINGS_FILE_BYTES = 2 * 1024 * 1024;
|
|
@@ -101087,7 +101191,8 @@ var init_aliases = __esm(() => {
|
|
|
101087
101191
|
"fable",
|
|
101088
101192
|
"sonnet[1m]",
|
|
101089
101193
|
"opus[1m]",
|
|
101090
|
-
"opusplan"
|
|
101194
|
+
"opusplan",
|
|
101195
|
+
"opusplan[1m]"
|
|
101091
101196
|
];
|
|
101092
101197
|
MODEL_FAMILY_ALIASES = ["sonnet", "opus", "haiku", "fable"];
|
|
101093
101198
|
});
|
|
@@ -101501,6 +101606,9 @@ function renderModelSetting(setting) {
|
|
|
101501
101606
|
if (setting === "opusplan") {
|
|
101502
101607
|
return "Opus Plan";
|
|
101503
101608
|
}
|
|
101609
|
+
if (setting === "opusplan[1m]") {
|
|
101610
|
+
return renderModelName(parseUserSpecifiedModel(setting));
|
|
101611
|
+
}
|
|
101504
101612
|
if (isModelAlias(setting)) {
|
|
101505
101613
|
return capitalize(setting);
|
|
101506
101614
|
}
|
|
@@ -266180,6 +266288,9 @@ async function* withRetry(getClient2, operation, options) {
|
|
|
266180
266288
|
let persistentAttempt = 0;
|
|
266181
266289
|
let apiKeyHelperAuthRetries = 0;
|
|
266182
266290
|
const API_KEY_HELPER_AUTH_RETRY_CAP = 2;
|
|
266291
|
+
let awsAuthRetries = 0;
|
|
266292
|
+
let gcpAuthRetries = 0;
|
|
266293
|
+
const CLOUD_AUTH_RETRY_CAP = 2;
|
|
266183
266294
|
let mediaStrips = 0;
|
|
266184
266295
|
const MAX_MEDIA_STRIPS = 20;
|
|
266185
266296
|
for (let attempt = 1;attempt <= maxRetries + 1; attempt++) {
|
|
@@ -266308,6 +266419,25 @@ async function* withRetry(getClient2, operation, options) {
|
|
|
266308
266419
|
}
|
|
266309
266420
|
apiKeyHelperAuthRetries++;
|
|
266310
266421
|
}
|
|
266422
|
+
const cloudCredentialKind = classifyCloudCredentialError(error52);
|
|
266423
|
+
if (cloudCredentialKind === "AWS" || getAPIProvider() !== "firstParty" && isBedrockAuthError(error52)) {
|
|
266424
|
+
if (awsAuthRetries >= CLOUD_AUTH_RETRY_CAP) {
|
|
266425
|
+
logEvent2("api_request", {
|
|
266426
|
+
reason: "api_request_aws_auth_exhausted"
|
|
266427
|
+
});
|
|
266428
|
+
throw new CannotRetryError(error52, retryContext);
|
|
266429
|
+
}
|
|
266430
|
+
awsAuthRetries++;
|
|
266431
|
+
}
|
|
266432
|
+
if (cloudCredentialKind === "Google Cloud" || getAPIProvider() !== "firstParty" && isVertexAuthError(error52)) {
|
|
266433
|
+
if (gcpAuthRetries >= CLOUD_AUTH_RETRY_CAP) {
|
|
266434
|
+
logEvent2("api_request", {
|
|
266435
|
+
reason: "api_request_gcp_auth_exhausted"
|
|
266436
|
+
});
|
|
266437
|
+
throw new CannotRetryError(error52, retryContext);
|
|
266438
|
+
}
|
|
266439
|
+
gcpAuthRetries++;
|
|
266440
|
+
}
|
|
266311
266441
|
const handledCloudAuthError = handleAwsCredentialError(error52) || handleGcpCredentialError(error52);
|
|
266312
266442
|
if (!handledCloudAuthError && (!(error52 instanceof APIError) || !shouldRetry(error52))) {
|
|
266313
266443
|
throw new CannotRetryError(error52, retryContext);
|
|
@@ -266470,6 +266600,34 @@ function getFallbackTriggerReason(error52) {
|
|
|
266470
266600
|
function isOAuthTokenRevokedError(error52) {
|
|
266471
266601
|
return error52 instanceof APIError && error52.status === 403 && (error52.message?.includes("OAuth token has been revoked") ?? false);
|
|
266472
266602
|
}
|
|
266603
|
+
function findInErrorCauseChain(error52, predicate, maxDepth = 5) {
|
|
266604
|
+
let current = error52;
|
|
266605
|
+
for (let depth = 0;depth < maxDepth; depth++) {
|
|
266606
|
+
if (!(current instanceof Error))
|
|
266607
|
+
return;
|
|
266608
|
+
if (predicate(current))
|
|
266609
|
+
return current;
|
|
266610
|
+
current = current.cause;
|
|
266611
|
+
}
|
|
266612
|
+
return;
|
|
266613
|
+
}
|
|
266614
|
+
function errorChainMessageIncludes(error52, needles) {
|
|
266615
|
+
return findInErrorCauseChain(error52, (e4) => needles.some((needle) => e4.message.includes(needle))) !== undefined;
|
|
266616
|
+
}
|
|
266617
|
+
function isGoogleCloudEnv() {
|
|
266618
|
+
return !!(process.env.CLAUDE_CODE_USE_VERTEX || process.env.CLAUDE_CODE_USE_ANTHROPIC_GOOGLE_CLOUD);
|
|
266619
|
+
}
|
|
266620
|
+
function classifyCloudCredentialError(error52) {
|
|
266621
|
+
if (error52 instanceof APIError && error52.status !== undefined)
|
|
266622
|
+
return null;
|
|
266623
|
+
if (findInErrorCauseChain(error52, (e4) => e4.name === "CredentialsProviderError") !== undefined) {
|
|
266624
|
+
return "AWS";
|
|
266625
|
+
}
|
|
266626
|
+
if (isGoogleCloudEnv() && errorChainMessageIncludes(error52, GOOGLE_CREDENTIAL_CLASSIFIER_MESSAGES)) {
|
|
266627
|
+
return "Google Cloud";
|
|
266628
|
+
}
|
|
266629
|
+
return null;
|
|
266630
|
+
}
|
|
266473
266631
|
function isBedrockAuthError(error52) {
|
|
266474
266632
|
if (isEnvTruthy(process.env.CLAUDE_CODE_USE_BEDROCK)) {
|
|
266475
266633
|
if (isAwsCredentialsProviderError(error52) || error52 instanceof APIError && error52.status === 403) {
|
|
@@ -266486,10 +266644,11 @@ function handleAwsCredentialError(error52) {
|
|
|
266486
266644
|
return false;
|
|
266487
266645
|
}
|
|
266488
266646
|
function isGoogleAuthLibraryCredentialError(error52) {
|
|
266489
|
-
|
|
266490
|
-
|
|
266491
|
-
|
|
266492
|
-
|
|
266647
|
+
return errorChainMessageIncludes(error52, [
|
|
266648
|
+
...GOOGLE_CREDENTIAL_CLASSIFIER_MESSAGES,
|
|
266649
|
+
GOOGLE_OAUTH_FAILURE_MESSAGE,
|
|
266650
|
+
GOOGLE_TOKEN_REFRESH_FAILURE_MESSAGE
|
|
266651
|
+
]);
|
|
266493
266652
|
}
|
|
266494
266653
|
function isVertexAuthError(error52) {
|
|
266495
266654
|
if (isEnvTruthy(process.env.CLAUDE_CODE_USE_VERTEX)) {
|
|
@@ -266589,7 +266748,7 @@ function getRateLimitResetDelayMs(error52) {
|
|
|
266589
266748
|
return null;
|
|
266590
266749
|
return Math.min(delayMs, PERSISTENT_RESET_CAP_MS);
|
|
266591
266750
|
}
|
|
266592
|
-
var abortError = () => new APIUserAbortError, DEFAULT_MAX_RETRIES2 = 10, FLOOR_OUTPUT_TOKENS = 3000, MAX_529_RETRIES = 3, BASE_DELAY_MS = 500, MAX_RETRIES_CLAMP = 15, WATCHDOG_DEFAULT_MAX_RETRIES = 300, maxRetriesClampWarned = false, FOREGROUND_529_RETRY_SOURCES, PERSISTENT_MAX_BACKOFF_MS, PERSISTENT_RESET_CAP_MS, HEARTBEAT_INTERVAL_MS = 30000, CannotRetryError, FallbackTriggeredError, DEFAULT_FAST_MODE_FALLBACK_HOLD_MS, SHORT_RETRY_THRESHOLD_MS, MIN_COOLDOWN_MS;
|
|
266751
|
+
var abortError = () => new APIUserAbortError, DEFAULT_MAX_RETRIES2 = 10, FLOOR_OUTPUT_TOKENS = 3000, MAX_529_RETRIES = 3, BASE_DELAY_MS = 500, MAX_RETRIES_CLAMP = 15, WATCHDOG_DEFAULT_MAX_RETRIES = 300, maxRetriesClampWarned = false, FOREGROUND_529_RETRY_SOURCES, PERSISTENT_MAX_BACKOFF_MS, PERSISTENT_RESET_CAP_MS, HEARTBEAT_INTERVAL_MS = 30000, CannotRetryError, FallbackTriggeredError, GOOGLE_CREDENTIAL_CLASSIFIER_MESSAGES, GOOGLE_OAUTH_FAILURE_MESSAGE = "Failed to acquire Google OAuth credentials.", GOOGLE_TOKEN_REFRESH_FAILURE_MESSAGE = "Could not refresh access token", DEFAULT_FAST_MODE_FALLBACK_HOLD_MS, SHORT_RETRY_THRESHOLD_MS, MIN_COOLDOWN_MS;
|
|
266593
266752
|
var init_withRetry = __esm(() => {
|
|
266594
266753
|
init_featureFlags();
|
|
266595
266754
|
init_sdk();
|
|
@@ -266655,6 +266814,12 @@ var init_withRetry = __esm(() => {
|
|
|
266655
266814
|
this.name = "FallbackTriggeredError";
|
|
266656
266815
|
}
|
|
266657
266816
|
};
|
|
266817
|
+
GOOGLE_CREDENTIAL_CLASSIFIER_MESSAGES = [
|
|
266818
|
+
"Could not load the default credentials",
|
|
266819
|
+
"invalid_grant",
|
|
266820
|
+
"invalid_client",
|
|
266821
|
+
"unauthorized_client"
|
|
266822
|
+
];
|
|
266658
266823
|
DEFAULT_FAST_MODE_FALLBACK_HOLD_MS = 30 * 60 * 1000;
|
|
266659
266824
|
SHORT_RETRY_THRESHOLD_MS = 20 * 1000;
|
|
266660
266825
|
MIN_COOLDOWN_MS = 10 * 60 * 1000;
|
|
@@ -377711,7 +377876,8 @@ function getSimpleSandboxSection() {
|
|
|
377711
377876
|
];
|
|
377712
377877
|
const items = [
|
|
377713
377878
|
...sandboxOverrideItems,
|
|
377714
|
-
"For temporary files, always use the `$TMPDIR` environment variable. TMPDIR is automatically set to the correct sandbox-writable directory in sandbox mode. Do NOT use `/tmp` directly - use `$TMPDIR` instead."
|
|
377879
|
+
"For temporary files, always use the `$TMPDIR` environment variable. TMPDIR is automatically set to the correct sandbox-writable directory in sandbox mode. Do NOT use `/tmp` directly - use `$TMPDIR` instead.",
|
|
377880
|
+
"If a clipboard utility such as `pbcopy`, `xclip`, or `wl-copy` fails inside the sandbox and the user wants the text on their clipboard, put the text in a fenced code block in your response and tell them to run `/copy` (it copies from outside the sandbox; when the picker appears they can select just that block), rather than writing a file for them to copy manually."
|
|
377715
377881
|
];
|
|
377716
377882
|
return [
|
|
377717
377883
|
"",
|
|
@@ -383971,6 +384137,8 @@ var init_BashTool = __esm(() => {
|
|
|
383971
384137
|
timeout: semanticNumber(exports_external.number().optional()).describe(`Optional timeout in milliseconds (max ${getMaxTimeoutMs()})`),
|
|
383972
384138
|
description: exports_external.string().optional().describe(`Clear, concise description of what this command does in active voice. Never use words like "complex" or "risk" in the description - just describe what it does.
|
|
383973
384139
|
|
|
384140
|
+
Say what the command does in plain words: do not echo the command's text, its flags, or file paths - the user reads this description, often without seeing the command.
|
|
384141
|
+
|
|
383974
384142
|
For simple commands (git, npm, standard CLI tools), keep it brief (5-10 words):
|
|
383975
384143
|
- ls \u2192 "List files in current directory"
|
|
383976
384144
|
- git status \u2192 "Show working tree status"
|
|
@@ -474592,6 +474760,9 @@ function KeybindingSetup({
|
|
|
474592
474760
|
});
|
|
474593
474761
|
const [isReload, setIsReload] = import_react83.useState(false);
|
|
474594
474762
|
useKeybindingWarnings(warnings, isReload);
|
|
474763
|
+
const {
|
|
474764
|
+
addNotification
|
|
474765
|
+
} = useNotifications();
|
|
474595
474766
|
const pendingChordRef = import_react83.useRef(null);
|
|
474596
474767
|
const [pendingChord, setPendingChordState] = import_react83.useState(null);
|
|
474597
474768
|
const chordTimeoutRef = import_react83.useRef(null);
|
|
@@ -474612,15 +474783,24 @@ function KeybindingSetup({
|
|
|
474612
474783
|
const setPendingChord = import_react83.useCallback((pending) => {
|
|
474613
474784
|
clearChordTimeout();
|
|
474614
474785
|
if (pending !== null) {
|
|
474615
|
-
chordTimeoutRef.current = setTimeout((pendingChordRef_0, setPendingChordState_0) => {
|
|
474786
|
+
chordTimeoutRef.current = setTimeout((pendingChordRef_0, setPendingChordState_0, addNotification_0) => {
|
|
474616
474787
|
logForDebugging("[keybindings] Chord timeout - cancelling");
|
|
474788
|
+
const timedOutChord = pendingChordRef_0.current;
|
|
474789
|
+
if (timedOutChord !== null) {
|
|
474790
|
+
addNotification_0({
|
|
474791
|
+
key: "chord-timeout",
|
|
474792
|
+
text: `${chordToDisplayString(timedOutChord, getPlatform())} cancelled \u2014 no next key within ${CHORD_TIMEOUT_MS / 1000}s`,
|
|
474793
|
+
priority: "immediate",
|
|
474794
|
+
timeoutMs: 3000
|
|
474795
|
+
});
|
|
474796
|
+
}
|
|
474617
474797
|
pendingChordRef_0.current = null;
|
|
474618
474798
|
setPendingChordState_0(null);
|
|
474619
|
-
}, CHORD_TIMEOUT_MS, pendingChordRef, setPendingChordState);
|
|
474799
|
+
}, CHORD_TIMEOUT_MS, pendingChordRef, setPendingChordState, addNotification);
|
|
474620
474800
|
}
|
|
474621
474801
|
pendingChordRef.current = pending;
|
|
474622
474802
|
setPendingChordState(pending);
|
|
474623
|
-
}, [clearChordTimeout]);
|
|
474803
|
+
}, [clearChordTimeout, addNotification]);
|
|
474624
474804
|
import_react83.useEffect(() => {
|
|
474625
474805
|
initializeKeybindingWatcher();
|
|
474626
474806
|
const unsubscribe2 = subscribeToKeybindingChanges((result_0) => {
|
|
@@ -474681,44 +474861,43 @@ function ChordInterceptor(t0) {
|
|
|
474681
474861
|
const contexts = [...handlerContexts, ...activeContexts, "Global"];
|
|
474682
474862
|
const wasInChord = pendingChordRef.current !== null;
|
|
474683
474863
|
const result = resolveKeyWithChordState(input, key3, contexts, bindings, pendingChordRef.current);
|
|
474684
|
-
|
|
474685
|
-
|
|
474686
|
-
|
|
474687
|
-
|
|
474688
|
-
|
|
474689
|
-
|
|
474690
|
-
|
|
474691
|
-
|
|
474692
|
-
|
|
474693
|
-
|
|
474694
|
-
|
|
474695
|
-
|
|
474696
|
-
|
|
474697
|
-
|
|
474698
|
-
|
|
474699
|
-
|
|
474700
|
-
|
|
474701
|
-
|
|
474702
|
-
break;
|
|
474703
|
-
}
|
|
474864
|
+
switch (result.type) {
|
|
474865
|
+
case "chord_started": {
|
|
474866
|
+
setPendingChord(result.pending);
|
|
474867
|
+
event.stopImmediatePropagation();
|
|
474868
|
+
break;
|
|
474869
|
+
}
|
|
474870
|
+
case "match": {
|
|
474871
|
+
setPendingChord(null);
|
|
474872
|
+
if (wasInChord) {
|
|
474873
|
+
const contextsSet = new Set(contexts);
|
|
474874
|
+
if (registry2) {
|
|
474875
|
+
const handlers_0 = registry2.get(result.action);
|
|
474876
|
+
if (handlers_0 && handlers_0.size > 0) {
|
|
474877
|
+
for (const registration_0 of handlers_0) {
|
|
474878
|
+
if (contextsSet.has(registration_0.context)) {
|
|
474879
|
+
registration_0.handler();
|
|
474880
|
+
event.stopImmediatePropagation();
|
|
474881
|
+
break;
|
|
474704
474882
|
}
|
|
474705
474883
|
}
|
|
474706
474884
|
}
|
|
474707
474885
|
}
|
|
474708
|
-
break bb23;
|
|
474709
474886
|
}
|
|
474710
|
-
|
|
474711
|
-
|
|
474712
|
-
|
|
474713
|
-
|
|
474714
|
-
|
|
474715
|
-
|
|
474716
|
-
|
|
474717
|
-
|
|
474718
|
-
|
|
474719
|
-
|
|
474720
|
-
|
|
474887
|
+
break;
|
|
474888
|
+
}
|
|
474889
|
+
case "chord_cancelled": {
|
|
474890
|
+
setPendingChord(null);
|
|
474891
|
+
event.stopImmediatePropagation();
|
|
474892
|
+
break;
|
|
474893
|
+
}
|
|
474894
|
+
case "unbound": {
|
|
474895
|
+
setPendingChord(null);
|
|
474896
|
+
event.stopImmediatePropagation();
|
|
474897
|
+
break;
|
|
474721
474898
|
}
|
|
474899
|
+
case "none":
|
|
474900
|
+
}
|
|
474722
474901
|
};
|
|
474723
474902
|
$3[0] = activeContexts;
|
|
474724
474903
|
$3[1] = bindings;
|
|
@@ -474733,11 +474912,12 @@ function ChordInterceptor(t0) {
|
|
|
474733
474912
|
use_input_default(handleInput);
|
|
474734
474913
|
return null;
|
|
474735
474914
|
}
|
|
474736
|
-
var import_compiler_runtime112, import_react83, jsx_runtime132, CHORD_TIMEOUT_MS =
|
|
474915
|
+
var import_compiler_runtime112, import_react83, jsx_runtime132, CHORD_TIMEOUT_MS = 3000;
|
|
474737
474916
|
var init_KeybindingProviderSetup = __esm(() => {
|
|
474738
474917
|
init_notifications();
|
|
474739
474918
|
init_ink2();
|
|
474740
474919
|
init_debug();
|
|
474920
|
+
init_platform2();
|
|
474741
474921
|
init_stringUtils();
|
|
474742
474922
|
init_KeybindingContext();
|
|
474743
474923
|
init_loadUserBindings();
|
|
@@ -475475,7 +475655,7 @@ function deserializeMessagesWithInterruptDetection(serializedMessages) {
|
|
|
475475
475655
|
turnInterruptionState = internalState;
|
|
475476
475656
|
}
|
|
475477
475657
|
const lastRelevantIdx = filteredMessages.findLastIndex((m5) => m5.type !== "system" && m5.type !== "progress");
|
|
475478
|
-
if (lastRelevantIdx !== -1 && filteredMessages[lastRelevantIdx].type === "user") {
|
|
475658
|
+
if (lastRelevantIdx !== -1 && filteredMessages[lastRelevantIdx].type === "user" && !isCompleteLocalCommandTail(filteredMessages, lastRelevantIdx)) {
|
|
475479
475659
|
filteredMessages.splice(lastRelevantIdx + 1, 0, createAssistantMessage({
|
|
475480
475660
|
content: NO_RESPONSE_REQUESTED
|
|
475481
475661
|
}));
|
|
@@ -475499,6 +475679,9 @@ function detectTurnInterruption(messages) {
|
|
|
475499
475679
|
return { kind: "none" };
|
|
475500
475680
|
}
|
|
475501
475681
|
if (lastMessage.type === "user") {
|
|
475682
|
+
if (isCompleteLocalCommandTail(messages, lastMessageIdx)) {
|
|
475683
|
+
return { kind: "none" };
|
|
475684
|
+
}
|
|
475502
475685
|
if (lastMessage.isMeta || lastMessage.isCompactSummary) {
|
|
475503
475686
|
return { kind: "none" };
|
|
475504
475687
|
}
|
|
@@ -475538,6 +475721,43 @@ function isTerminalToolResult(result, messages, resultIdx) {
|
|
|
475538
475721
|
}
|
|
475539
475722
|
return false;
|
|
475540
475723
|
}
|
|
475724
|
+
function classifyLocalCommandKind(message) {
|
|
475725
|
+
const content = message.message?.content;
|
|
475726
|
+
const text2 = Array.isArray(content) ? content.findLast((block) => block?.type === "text")?.text : typeof content === "string" ? content : undefined;
|
|
475727
|
+
if (typeof text2 !== "string")
|
|
475728
|
+
return;
|
|
475729
|
+
return LOCAL_COMMAND_TAG_KINDS.find(([prefix]) => text2.startsWith(prefix))?.[1];
|
|
475730
|
+
}
|
|
475731
|
+
function localCommandBreadcrumbKind(message) {
|
|
475732
|
+
if (message.type !== "user")
|
|
475733
|
+
return;
|
|
475734
|
+
if (message.promptSource !== undefined)
|
|
475735
|
+
return;
|
|
475736
|
+
const kind = classifyLocalCommandKind(message);
|
|
475737
|
+
if (kind === "caveat" && message.isMeta !== true)
|
|
475738
|
+
return;
|
|
475739
|
+
return kind;
|
|
475740
|
+
}
|
|
475741
|
+
function isCompleteLocalCommandTail(messages, idx) {
|
|
475742
|
+
if (localCommandBreadcrumbKind(messages[idx]) === undefined)
|
|
475743
|
+
return false;
|
|
475744
|
+
let seenRecord = false;
|
|
475745
|
+
let allMetaUsers = true;
|
|
475746
|
+
for (let i6 = idx;i6 >= 0; i6--) {
|
|
475747
|
+
const msg = messages[i6];
|
|
475748
|
+
if (msg.type === "system" || msg.type === "progress" || msg.type === "attachment") {
|
|
475749
|
+
continue;
|
|
475750
|
+
}
|
|
475751
|
+
const kind = localCommandBreadcrumbKind(msg);
|
|
475752
|
+
if (kind === "caveat")
|
|
475753
|
+
return true;
|
|
475754
|
+
if (kind === undefined || seenRecord)
|
|
475755
|
+
break;
|
|
475756
|
+
seenRecord = kind === "record";
|
|
475757
|
+
allMetaUsers = allMetaUsers && msg.type === "user" && msg.isMeta === true;
|
|
475758
|
+
}
|
|
475759
|
+
return allMetaUsers;
|
|
475760
|
+
}
|
|
475541
475761
|
function restoreSkillStateFromMessages(messages) {
|
|
475542
475762
|
for (const message of messages) {
|
|
475543
475763
|
if (message.type !== "attachment") {
|
|
@@ -475655,11 +475875,12 @@ async function loadConversationForResume(source, sourceJsonlFile) {
|
|
|
475655
475875
|
throw error52;
|
|
475656
475876
|
}
|
|
475657
475877
|
}
|
|
475658
|
-
var BRIEF_TOOL_NAME4, LEGACY_BRIEF_TOOL_NAME2, SEND_USER_FILE_TOOL_NAME3;
|
|
475878
|
+
var BRIEF_TOOL_NAME4, LEGACY_BRIEF_TOOL_NAME2, SEND_USER_FILE_TOOL_NAME3, LOCAL_COMMAND_TAG_KINDS;
|
|
475659
475879
|
var init_conversationRecovery = __esm(() => {
|
|
475660
475880
|
init_featureFlags();
|
|
475661
475881
|
init_cwd2();
|
|
475662
475882
|
init_state();
|
|
475883
|
+
init_xml();
|
|
475663
475884
|
init_ids();
|
|
475664
475885
|
init_permissions();
|
|
475665
475886
|
init_attachments2();
|
|
@@ -475672,6 +475893,12 @@ var init_conversationRecovery = __esm(() => {
|
|
|
475672
475893
|
BRIEF_TOOL_NAME4 = feature("KAIROS") || feature("KAIROS_BRIEF") ? (init_prompt(), __toCommonJS(exports_prompt)).BRIEF_TOOL_NAME : null;
|
|
475673
475894
|
LEGACY_BRIEF_TOOL_NAME2 = feature("KAIROS") || feature("KAIROS_BRIEF") ? (init_prompt(), __toCommonJS(exports_prompt)).LEGACY_BRIEF_TOOL_NAME : null;
|
|
475674
475895
|
SEND_USER_FILE_TOOL_NAME3 = feature("KAIROS") ? (init_prompt8(), __toCommonJS(exports_prompt2)).SEND_USER_FILE_TOOL_NAME : null;
|
|
475896
|
+
LOCAL_COMMAND_TAG_KINDS = [
|
|
475897
|
+
[`<${COMMAND_NAME_TAG}>`, "record"],
|
|
475898
|
+
[`<${LOCAL_COMMAND_STDOUT_TAG}>`, "output"],
|
|
475899
|
+
[`<${LOCAL_COMMAND_STDERR_TAG}>`, "output"],
|
|
475900
|
+
[`<${LOCAL_COMMAND_CAVEAT_TAG}>`, "caveat"]
|
|
475901
|
+
];
|
|
475675
475902
|
});
|
|
475676
475903
|
|
|
475677
475904
|
// src/services/api/filesApi.ts
|
|
@@ -612319,6 +612546,9 @@ function getCurrentTimestamp() {
|
|
|
612319
612546
|
return new Date().toISOString();
|
|
612320
612547
|
}
|
|
612321
612548
|
function validatePathWithinBase(basePath, relativePath) {
|
|
612549
|
+
if (process.platform !== "win32" && relativePath.includes("\\")) {
|
|
612550
|
+
throw new Error(`Path traversal detected: "${relativePath}" would escape the base directory`);
|
|
612551
|
+
}
|
|
612322
612552
|
const resolvedPath = resolve51(basePath, relativePath);
|
|
612323
612553
|
const normalizedBase = resolve51(basePath) + sep38;
|
|
612324
612554
|
if (!resolvedPath.startsWith(normalizedBase) && resolvedPath !== resolve51(basePath)) {
|
|
@@ -714975,8 +715205,33 @@ var init_export2 = __esm(() => {
|
|
|
714975
715205
|
// src/commands/model/model.tsx
|
|
714976
715206
|
var exports_model2 = {};
|
|
714977
715207
|
__export(exports_model2, {
|
|
715208
|
+
saveModelAsDefault: () => saveModelAsDefault,
|
|
715209
|
+
renderModelSaveFailureSuffix: () => renderModelSaveFailureSuffix,
|
|
714978
715210
|
call: () => call78
|
|
714979
715211
|
});
|
|
715212
|
+
import { homedir as homedir42 } from "os";
|
|
715213
|
+
function saveModelAsDefault(model) {
|
|
715214
|
+
const {
|
|
715215
|
+
error: error52
|
|
715216
|
+
} = updateSettingsForSource("userSettings", {
|
|
715217
|
+
model
|
|
715218
|
+
});
|
|
715219
|
+
return error52 ? {
|
|
715220
|
+
kind: "failed",
|
|
715221
|
+
error: error52
|
|
715222
|
+
} : {
|
|
715223
|
+
kind: "saved"
|
|
715224
|
+
};
|
|
715225
|
+
}
|
|
715226
|
+
function renderModelSaveFailureSuffix(result) {
|
|
715227
|
+
if (result.kind === "saved") {
|
|
715228
|
+
return "";
|
|
715229
|
+
}
|
|
715230
|
+
const settingsPath = getSettingsFilePathForSource("userSettings") ?? "settings.json";
|
|
715231
|
+
const displayPath = settingsPath.replace(homedir42(), "~");
|
|
715232
|
+
const reason = result.error.message.startsWith("Invalid JSON syntax") ? "isn't valid JSON" : `can't be written (${result.error.message})`;
|
|
715233
|
+
return ` \xB7 couldn't save it as your default: ${displayPath} ${reason}`;
|
|
715234
|
+
}
|
|
714980
715235
|
function ModelPickerWrapper({ onDone }) {
|
|
714981
715236
|
const mainLoopModel = useAppState((s4) => s4.mainLoopModel);
|
|
714982
715237
|
const mainLoopModelForSession = useAppState((s4) => s4.mainLoopModelForSession);
|
|
@@ -715006,8 +715261,9 @@ function ModelPickerWrapper({ onDone }) {
|
|
|
715006
715261
|
onDone("Model reset to default for this session");
|
|
715007
715262
|
return;
|
|
715008
715263
|
}
|
|
715009
|
-
|
|
715010
|
-
|
|
715264
|
+
const saveResult = saveModelAsDefault(model);
|
|
715265
|
+
const isSaved = saveResult.kind === "saved";
|
|
715266
|
+
let message = `Set model to ${source_default.bold(renderModelLabel(model))}${isSaved ? " and saved as your default for new sessions" : " for this session only"}`;
|
|
715011
715267
|
if (effort !== undefined) {
|
|
715012
715268
|
message = message + ` with ${source_default.bold(effort)} effort`;
|
|
715013
715269
|
}
|
|
@@ -715027,6 +715283,7 @@ function ModelPickerWrapper({ onDone }) {
|
|
|
715027
715283
|
}
|
|
715028
715284
|
}
|
|
715029
715285
|
}
|
|
715286
|
+
message = message + renderModelSaveFailureSuffix(saveResult);
|
|
715030
715287
|
if (isBilledAsExtraUsage(model, wasFastModeToggledOn === true, isOpus1mMergeEnabled())) {
|
|
715031
715288
|
message = message + " \xB7 Billed as extra usage";
|
|
715032
715289
|
}
|
|
@@ -715106,13 +715363,13 @@ function SetModelAndClose({
|
|
|
715106
715363
|
return;
|
|
715107
715364
|
}
|
|
715108
715365
|
if (model && isOpus1mUnavailable(model)) {
|
|
715109
|
-
onDone(`Opus
|
|
715366
|
+
onDone(`Opus with 1M context is not available for your account. Learn more: https://code.claude.com/docs/en/model-config#extended-context-with-1m`, {
|
|
715110
715367
|
display: "system"
|
|
715111
715368
|
});
|
|
715112
715369
|
return;
|
|
715113
715370
|
}
|
|
715114
715371
|
if (model && isSonnet1mUnavailable(model)) {
|
|
715115
|
-
onDone(`Sonnet
|
|
715372
|
+
onDone(`Sonnet with 1M context is not available for your account. Learn more: https://code.claude.com/docs/en/model-config#extended-context-with-1m`, {
|
|
715116
715373
|
display: "system"
|
|
715117
715374
|
});
|
|
715118
715375
|
return;
|
|
@@ -715177,7 +715434,7 @@ function isOpus1mUnavailable(model) {
|
|
|
715177
715434
|
}
|
|
715178
715435
|
function isSonnet1mUnavailable(model) {
|
|
715179
715436
|
const m5 = model.toLowerCase();
|
|
715180
|
-
return !checkSonnet1mAccess() && (m5.includes("sonnet[1m]") || m5.includes("sonnet-4-6[1m]"));
|
|
715437
|
+
return !checkSonnet1mAccess() && (m5.includes("sonnet[1m]") || m5.includes("sonnet-4-6[1m]") || m5.includes("sonnet-5[1m]") || m5.trim() === "opusplan[1m]");
|
|
715181
715438
|
}
|
|
715182
715439
|
function ShowModelAndClose(t0) {
|
|
715183
715440
|
const {
|
|
@@ -718607,7 +718864,7 @@ var init_force_snip = __esm(() => {
|
|
|
718607
718864
|
});
|
|
718608
718865
|
|
|
718609
718866
|
// src/utils/effort/workflowSavePath.ts
|
|
718610
|
-
import { homedir as
|
|
718867
|
+
import { homedir as homedir43 } from "os";
|
|
718611
718868
|
import { join as join159, sep as sep45 } from "path";
|
|
718612
718869
|
function userWorkflowsDir2() {
|
|
718613
718870
|
return join159(getClaudeConfigHomeDir(), "workflows");
|
|
@@ -718619,7 +718876,7 @@ function resolveWorkflowsDir(scope, cwd2) {
|
|
|
718619
718876
|
return join159(cwd2, ".claude", "workflows");
|
|
718620
718877
|
}
|
|
718621
718878
|
function tildeShortenPath(absPath) {
|
|
718622
|
-
const home =
|
|
718879
|
+
const home = homedir43();
|
|
718623
718880
|
if (absPath === home)
|
|
718624
718881
|
return "~";
|
|
718625
718882
|
if (absPath.startsWith(home + sep45))
|
|
@@ -726138,7 +726395,7 @@ var init_agentMemory = __esm(() => {
|
|
|
726138
726395
|
|
|
726139
726396
|
// src/utils/permissions/filesystem.ts
|
|
726140
726397
|
import { randomBytes as randomBytes19 } from "crypto";
|
|
726141
|
-
import { homedir as
|
|
726398
|
+
import { homedir as homedir44, tmpdir as tmpdir15 } from "os";
|
|
726142
726399
|
import { join as join164, normalize as normalize18, posix as posix8, sep as sep47 } from "path";
|
|
726143
726400
|
function normalizeCaseForComparison2(path39) {
|
|
726144
726401
|
return path39.toLowerCase();
|
|
@@ -726152,7 +726409,7 @@ function getClaudeSkillScope(filePath) {
|
|
|
726152
726409
|
prefix: "/.claude/skills/"
|
|
726153
726410
|
},
|
|
726154
726411
|
{
|
|
726155
|
-
dir: expandPath(join164(
|
|
726412
|
+
dir: expandPath(join164(homedir44(), ".claude", "skills")),
|
|
726156
726413
|
prefix: "~/.claude/skills/"
|
|
726157
726414
|
}
|
|
726158
726415
|
];
|
|
@@ -726466,7 +726723,7 @@ function patternWithRoot(pattern, source2) {
|
|
|
726466
726723
|
} else if (pattern.startsWith(`~${DIR_SEP}`)) {
|
|
726467
726724
|
return {
|
|
726468
726725
|
relativePattern: pattern.slice(1),
|
|
726469
|
-
root:
|
|
726726
|
+
root: homedir44().normalize("NFC")
|
|
726470
726727
|
};
|
|
726471
726728
|
} else if (pattern.startsWith(DIR_SEP)) {
|
|
726472
726729
|
return {
|
|
@@ -726497,7 +726754,7 @@ function getCachedPatternMatchers(toolPermissionContext, toolType, behavior) {
|
|
|
726497
726754
|
toolType,
|
|
726498
726755
|
behavior,
|
|
726499
726756
|
getPlatform(),
|
|
726500
|
-
|
|
726757
|
+
homedir44(),
|
|
726501
726758
|
getCwd(),
|
|
726502
726759
|
getOriginalCwd(),
|
|
726503
726760
|
additionalDirs
|
|
@@ -733712,7 +733969,7 @@ import {
|
|
|
733712
733969
|
unlink as unlink28
|
|
733713
733970
|
} from "fs/promises";
|
|
733714
733971
|
import { createServer as createServer8 } from "net";
|
|
733715
|
-
import { homedir as
|
|
733972
|
+
import { homedir as homedir45, platform as platform6 } from "os";
|
|
733716
733973
|
import { join as join167 } from "path";
|
|
733717
733974
|
function log3(message, ...args) {
|
|
733718
733975
|
if (LOG_FILE) {
|
|
@@ -734051,7 +734308,7 @@ var init_chromeNativeHost = __esm(() => {
|
|
|
734051
734308
|
init_slowOperations();
|
|
734052
734309
|
init_common4();
|
|
734053
734310
|
MAX_MESSAGE_SIZE = 1024 * 1024;
|
|
734054
|
-
LOG_FILE = process.env.USER_TYPE === "ant" ? join167(
|
|
734311
|
+
LOG_FILE = process.env.USER_TYPE === "ant" ? join167(homedir45(), ".claude", "debug", "chrome-native-host.txt") : undefined;
|
|
734055
734312
|
messageSchema = lazySchema(() => exports_external.object({
|
|
734056
734313
|
type: exports_external.string()
|
|
734057
734314
|
}).passthrough());
|
|
@@ -740292,7 +740549,7 @@ __export(exports_upstreamproxy, {
|
|
|
740292
740549
|
SESSION_TOKEN_PATH: () => SESSION_TOKEN_PATH
|
|
740293
740550
|
});
|
|
740294
740551
|
import { mkdir as mkdir57, readFile as readFile65, unlink as unlink30, writeFile as writeFile57 } from "fs/promises";
|
|
740295
|
-
import { homedir as
|
|
740552
|
+
import { homedir as homedir46 } from "os";
|
|
740296
740553
|
import { join as join173 } from "path";
|
|
740297
740554
|
async function initUpstreamProxy(opts) {
|
|
740298
740555
|
if (!isEnvTruthy(process.env.CLAUDE_CODE_REMOTE)) {
|
|
@@ -740314,7 +740571,7 @@ async function initUpstreamProxy(opts) {
|
|
|
740314
740571
|
}
|
|
740315
740572
|
setNonDumpable();
|
|
740316
740573
|
const baseUrl = opts?.ccrBaseUrl ?? process.env.ANTHROPIC_BASE_URL ?? "https://api.anthropic.com";
|
|
740317
|
-
const caBundlePath = opts?.caBundlePath ?? join173(
|
|
740574
|
+
const caBundlePath = opts?.caBundlePath ?? join173(homedir46(), ".ccr", "ca-bundle.crt");
|
|
740318
740575
|
const caOk = await downloadCaBundle(baseUrl, opts?.systemCaPath ?? SYSTEM_CA_BUNDLE, caBundlePath);
|
|
740319
740576
|
if (!caOk)
|
|
740320
740577
|
return state3;
|
|
@@ -752826,7 +753083,7 @@ var init_ShowInIDEPrompt = __esm(() => {
|
|
|
752826
753083
|
});
|
|
752827
753084
|
|
|
752828
753085
|
// src/components/permissions/FilePermissionDialog/permissionOptions.tsx
|
|
752829
|
-
import { homedir as
|
|
753086
|
+
import { homedir as homedir47 } from "os";
|
|
752830
753087
|
import { basename as basename58, join as join175, sep as sep48 } from "path";
|
|
752831
753088
|
function isInClaudeFolder(filePath) {
|
|
752832
753089
|
const absolutePath = expandPath(filePath);
|
|
@@ -752837,7 +753094,7 @@ function isInClaudeFolder(filePath) {
|
|
|
752837
753094
|
}
|
|
752838
753095
|
function isInGlobalClaudeFolder(filePath) {
|
|
752839
753096
|
const absolutePath = expandPath(filePath);
|
|
752840
|
-
const globalClaudeFolderPath = join175(
|
|
753097
|
+
const globalClaudeFolderPath = join175(homedir47(), ".claude");
|
|
752841
753098
|
const normalizedAbsolutePath = normalizeCaseForComparison2(absolutePath);
|
|
752842
753099
|
const normalizedGlobalClaudeFolderPath = normalizeCaseForComparison2(globalClaudeFolderPath);
|
|
752843
753100
|
return normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + sep48.toLowerCase()) || normalizedAbsolutePath.startsWith(normalizedGlobalClaudeFolderPath + "/");
|
|
@@ -787478,7 +787735,7 @@ var require_lib20 = __commonJS((exports, module) => {
|
|
|
787478
787735
|
|
|
787479
787736
|
// src/utils/cleanup.ts
|
|
787480
787737
|
import * as fs26 from "fs/promises";
|
|
787481
|
-
import { homedir as
|
|
787738
|
+
import { homedir as homedir48 } from "os";
|
|
787482
787739
|
import { join as join176 } from "path";
|
|
787483
787740
|
function getCutoffDate() {
|
|
787484
787741
|
const settings = getSettings_DEPRECATED() || {};
|
|
@@ -787792,7 +788049,7 @@ async function cleanupNpmCacheForAnthropicPackages() {
|
|
|
787792
788049
|
return;
|
|
787793
788050
|
}
|
|
787794
788051
|
logForDebugging("npm cache cleanup: starting");
|
|
787795
|
-
const npmCachePath = join176(
|
|
788052
|
+
const npmCachePath = join176(homedir48(), ".npm", "_cacache");
|
|
787796
788053
|
const NPM_CACHE_RETENTION_COUNT = 5;
|
|
787797
788054
|
const startTime2 = Date.now();
|
|
787798
788055
|
try {
|
|
@@ -809397,7 +809654,7 @@ var exports_TrustDialog = {};
|
|
|
809397
809654
|
__export(exports_TrustDialog, {
|
|
809398
809655
|
TrustDialog: () => TrustDialog
|
|
809399
809656
|
});
|
|
809400
|
-
import { homedir as
|
|
809657
|
+
import { homedir as homedir50 } from "os";
|
|
809401
809658
|
function TrustDialog(t0) {
|
|
809402
809659
|
const $4 = import_compiler_runtime351.c(33);
|
|
809403
809660
|
const {
|
|
@@ -809508,7 +809765,7 @@ function TrustDialog(t0) {
|
|
|
809508
809765
|
let t13;
|
|
809509
809766
|
if ($4[13] !== hasAnyBashExecution) {
|
|
809510
809767
|
t12 = () => {
|
|
809511
|
-
const isHomeDir =
|
|
809768
|
+
const isHomeDir = homedir50() === getCwd();
|
|
809512
809769
|
logEvent2("tengu_trust_dialog_shown", {
|
|
809513
809770
|
isHomeDir,
|
|
809514
809771
|
hasMcpServers,
|
|
@@ -809537,7 +809794,7 @@ function TrustDialog(t0) {
|
|
|
809537
809794
|
gracefulShutdownSync(1);
|
|
809538
809795
|
return;
|
|
809539
809796
|
}
|
|
809540
|
-
const isHomeDir_0 =
|
|
809797
|
+
const isHomeDir_0 = homedir50() === getCwd();
|
|
809541
809798
|
logEvent2("tengu_trust_dialog_accept", {
|
|
809542
809799
|
isHomeDir: isHomeDir_0,
|
|
809543
809800
|
hasMcpServers,
|
|
@@ -815384,7 +815641,7 @@ var init_bundled3 = __esm(() => {
|
|
|
815384
815641
|
|
|
815385
815642
|
// src/utils/deepLink/banner.ts
|
|
815386
815643
|
import { stat as stat53 } from "fs/promises";
|
|
815387
|
-
import { homedir as
|
|
815644
|
+
import { homedir as homedir51 } from "os";
|
|
815388
815645
|
import { join as join184, sep as sep52 } from "path";
|
|
815389
815646
|
function buildDeepLinkBanner(info) {
|
|
815390
815647
|
const lines2 = [
|
|
@@ -815423,7 +815680,7 @@ async function mtimeOrUndefined(p4) {
|
|
|
815423
815680
|
}
|
|
815424
815681
|
}
|
|
815425
815682
|
function tildify(p4) {
|
|
815426
|
-
const home =
|
|
815683
|
+
const home = homedir51();
|
|
815427
815684
|
if (p4 === home)
|
|
815428
815685
|
return "~";
|
|
815429
815686
|
if (p4.startsWith(home + sep52))
|
|
@@ -816736,7 +816993,7 @@ __export(exports_protocolHandler, {
|
|
|
816736
816993
|
handleUrlSchemeLaunch: () => handleUrlSchemeLaunch,
|
|
816737
816994
|
handleDeepLinkUri: () => handleDeepLinkUri
|
|
816738
816995
|
});
|
|
816739
|
-
import { homedir as
|
|
816996
|
+
import { homedir as homedir52 } from "os";
|
|
816740
816997
|
async function handleDeepLinkUri(uri3) {
|
|
816741
816998
|
logForDebugging(`Handling deep link URI: ${uri3}`);
|
|
816742
816999
|
let action2;
|
|
@@ -816790,7 +817047,7 @@ async function resolveCwd(action2) {
|
|
|
816790
817047
|
}
|
|
816791
817048
|
logForDebugging(`No local clone found for repo ${action2.repo}, falling back to home`);
|
|
816792
817049
|
}
|
|
816793
|
-
return { cwd:
|
|
817050
|
+
return { cwd: homedir52() };
|
|
816794
817051
|
}
|
|
816795
817052
|
var init_protocolHandler = __esm(() => {
|
|
816796
817053
|
init_debug();
|
|
@@ -817130,7 +817387,7 @@ var init_sessionMemory = __esm(() => {
|
|
|
817130
817387
|
|
|
817131
817388
|
// src/utils/iTermBackup.ts
|
|
817132
817389
|
import { copyFile as copyFile12, stat as stat54 } from "fs/promises";
|
|
817133
|
-
import { homedir as
|
|
817390
|
+
import { homedir as homedir53 } from "os";
|
|
817134
817391
|
import { join as join188 } from "path";
|
|
817135
817392
|
function markITerm2SetupComplete() {
|
|
817136
817393
|
saveGlobalConfig((current) => ({
|
|
@@ -817146,7 +817403,7 @@ function getIterm2RecoveryInfo() {
|
|
|
817146
817403
|
};
|
|
817147
817404
|
}
|
|
817148
817405
|
function getITerm2PlistPath() {
|
|
817149
|
-
return join188(
|
|
817406
|
+
return join188(homedir53(), "Library", "Preferences", "com.googlecode.iterm2.plist");
|
|
817150
817407
|
}
|
|
817151
817408
|
async function checkAndRestoreITerm2Backup() {
|
|
817152
817409
|
const { inProgress, backupPath } = getIterm2RecoveryInfo();
|
|
@@ -823316,7 +823573,7 @@ __export(exports_claudeDesktop, {
|
|
|
823316
823573
|
getClaudeDesktopConfigPath: () => getClaudeDesktopConfigPath
|
|
823317
823574
|
});
|
|
823318
823575
|
import { readdir as readdir38, readFile as readFile70, stat as stat56 } from "fs/promises";
|
|
823319
|
-
import { homedir as
|
|
823576
|
+
import { homedir as homedir54 } from "os";
|
|
823320
823577
|
import { join as join191 } from "path";
|
|
823321
823578
|
async function getClaudeDesktopConfigPath() {
|
|
823322
823579
|
const platform7 = getPlatform();
|
|
@@ -823324,7 +823581,7 @@ async function getClaudeDesktopConfigPath() {
|
|
|
823324
823581
|
throw new Error(`Unsupported platform: ${platform7} - Claude Desktop integration only works on macOS and WSL.`);
|
|
823325
823582
|
}
|
|
823326
823583
|
if (platform7 === "macos") {
|
|
823327
|
-
return join191(
|
|
823584
|
+
return join191(homedir54(), "Library", "Application Support", "Claude", "claude_desktop_config.json");
|
|
823328
823585
|
}
|
|
823329
823586
|
const windowsHome = process.env.USERPROFILE ? process.env.USERPROFILE.replace(/\\/g, "/") : null;
|
|
823330
823587
|
if (windowsHome) {
|
|
@@ -824388,11 +824645,11 @@ var exports_install = {};
|
|
|
824388
824645
|
__export(exports_install, {
|
|
824389
824646
|
install: () => install2
|
|
824390
824647
|
});
|
|
824391
|
-
import { homedir as
|
|
824648
|
+
import { homedir as homedir55 } from "os";
|
|
824392
824649
|
import { join as join192 } from "path";
|
|
824393
824650
|
function getInstallationPath2() {
|
|
824394
824651
|
const isWindows3 = env4.platform === "win32";
|
|
824395
|
-
const homeDir =
|
|
824652
|
+
const homeDir = homedir55();
|
|
824396
824653
|
if (isWindows3) {
|
|
824397
824654
|
const windowsPath = join192(homeDir, ".local", "bin", "claude.exe");
|
|
824398
824655
|
return windowsPath.replace(/\//g, "\\");
|