@cnwenf/occ 2.1.332 → 2.1.333
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 +458 -134
- 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.333","BINARY_NAME":"occ","BUILD_TIME":"2026-09-12T22:14:51.247Z","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;
|
|
@@ -167193,11 +167193,32 @@ function inputToString(input) {
|
|
|
167193
167193
|
return input;
|
|
167194
167194
|
}
|
|
167195
167195
|
}
|
|
167196
|
+
function isPartialTerminalResponse(buffer) {
|
|
167197
|
+
if (MOUSE_PREFIX_RE.test(buffer))
|
|
167198
|
+
return buffer.length <= MOUSE_PREFIX_MAX;
|
|
167199
|
+
if (OSC_DCS_PARTIAL_RE.test(buffer)) {
|
|
167200
|
+
return buffer.length <= OSC_DCS_PARTIAL_MAX;
|
|
167201
|
+
}
|
|
167202
|
+
return buffer.length <= CSI_PARTIAL_MAX && CSI_PARTIAL_RE.test(buffer);
|
|
167203
|
+
}
|
|
167196
167204
|
function parseMultipleKeypresses(prevState, input = "") {
|
|
167197
167205
|
const isFlush = input === null;
|
|
167198
167206
|
const inputString = isFlush ? "" : inputToString(input);
|
|
167199
167207
|
const tokenizer = prevState._tokenizer ?? createTokenizer({ x10Mouse: true });
|
|
167200
|
-
|
|
167208
|
+
let tokens;
|
|
167209
|
+
if (isFlush && prevState.mode !== "IN_PASTE") {
|
|
167210
|
+
const buffered = tokenizer.buffer();
|
|
167211
|
+
if (isPartialTerminalResponse(buffered)) {
|
|
167212
|
+
tokens = [];
|
|
167213
|
+
} else if (MOUSE_PREFIX_RE.test(buffered)) {
|
|
167214
|
+
tokenizer.reset();
|
|
167215
|
+
tokens = [];
|
|
167216
|
+
} else {
|
|
167217
|
+
tokens = tokenizer.flush();
|
|
167218
|
+
}
|
|
167219
|
+
} else {
|
|
167220
|
+
tokens = isFlush ? tokenizer.flush() : tokenizer.feed(inputString);
|
|
167221
|
+
}
|
|
167201
167222
|
const keys2 = [];
|
|
167202
167223
|
let inPaste = prevState.mode === "IN_PASTE";
|
|
167203
167224
|
let pasteBuffer = prevState.pasteBuffer;
|
|
@@ -167487,7 +167508,7 @@ function createNavKey(s4, name3, ctrl) {
|
|
|
167487
167508
|
isPasted: false
|
|
167488
167509
|
};
|
|
167489
167510
|
}
|
|
167490
|
-
var META_KEY_CODE_RE, FN_KEY_RE, CSI_U_RE, MODIFY_OTHER_KEYS_RE, DECRPM_RE, DA1_RE, DA2_RE, KITTY_FLAGS_RE, CURSOR_POSITION_RE, OSC_RESPONSE_RE, XTVERSION_RE, SGR_MOUSE_RE, INITIAL_STATE, keyName, nonAlphanumericKeys, isShiftKey = (code) => {
|
|
167511
|
+
var META_KEY_CODE_RE, FN_KEY_RE, CSI_U_RE, MODIFY_OTHER_KEYS_RE, DECRPM_RE, DA1_RE, DA2_RE, KITTY_FLAGS_RE, CURSOR_POSITION_RE, OSC_RESPONSE_RE, XTVERSION_RE, SGR_MOUSE_RE, INITIAL_STATE, MOUSE_PREFIX_RE, MOUSE_PREFIX_MAX = 32, OSC_DCS_PARTIAL_RE, OSC_DCS_PARTIAL_MAX = 256, CSI_PARTIAL_RE, CSI_PARTIAL_MAX = 64, keyName, nonAlphanumericKeys, isShiftKey = (code) => {
|
|
167491
167512
|
return [
|
|
167492
167513
|
"[a",
|
|
167493
167514
|
"[b",
|
|
@@ -167537,6 +167558,9 @@ var init_parse_keypress = __esm(() => {
|
|
|
167537
167558
|
incomplete: "",
|
|
167538
167559
|
pasteBuffer: ""
|
|
167539
167560
|
};
|
|
167561
|
+
MOUSE_PREFIX_RE = /^\x1b\[<[\d;]*$/;
|
|
167562
|
+
OSC_DCS_PARTIAL_RE = /^\x1b(?:\][0-9]|P[0-9>|$+=!]|_G)[^\x07]*$/s;
|
|
167563
|
+
CSI_PARTIAL_RE = /^\x1b\[(?:[0-9:;]+|[<=>?][0-9:;]*[ -/]*)$/;
|
|
167540
167564
|
keyName = {
|
|
167541
167565
|
OP: "f1",
|
|
167542
167566
|
OQ: "f2",
|
|
@@ -184538,6 +184562,14 @@ class Ink {
|
|
|
184538
184562
|
get isAltScreenActive() {
|
|
184539
184563
|
return this.altScreenActive;
|
|
184540
184564
|
}
|
|
184565
|
+
get nativeCursorSeq() {
|
|
184566
|
+
if (this.accessibilityMode || this.isScreenReaderEnabled)
|
|
184567
|
+
return "";
|
|
184568
|
+
return this.nativeCursorVisible ? SHOW_CURSOR : HIDE_CURSOR;
|
|
184569
|
+
}
|
|
184570
|
+
get hasUnmounted() {
|
|
184571
|
+
return this.isUnmounted;
|
|
184572
|
+
}
|
|
184541
184573
|
reassertTerminalModes = (includeAltScreen = false) => {
|
|
184542
184574
|
if (!this.options.stdout.isTTY)
|
|
184543
184575
|
return;
|
|
@@ -372511,8 +372543,20 @@ function createLSPClient(serverName, onCrash) {
|
|
|
372511
372543
|
isStopping = true;
|
|
372512
372544
|
try {
|
|
372513
372545
|
if (connection3) {
|
|
372514
|
-
|
|
372515
|
-
|
|
372546
|
+
let shutdownRequestError;
|
|
372547
|
+
try {
|
|
372548
|
+
await connection3.sendRequest("shutdown", {});
|
|
372549
|
+
} catch (error52) {
|
|
372550
|
+
shutdownRequestError = error52;
|
|
372551
|
+
}
|
|
372552
|
+
try {
|
|
372553
|
+
await connection3.sendNotification("exit", {});
|
|
372554
|
+
} catch (error52) {
|
|
372555
|
+
throw shutdownRequestError ?? error52;
|
|
372556
|
+
}
|
|
372557
|
+
if (shutdownRequestError !== undefined) {
|
|
372558
|
+
throw shutdownRequestError;
|
|
372559
|
+
}
|
|
372516
372560
|
}
|
|
372517
372561
|
} catch (error52) {
|
|
372518
372562
|
const err2 = error52;
|
|
@@ -481024,6 +481068,16 @@ async function getAllCommands(context6) {
|
|
|
481024
481068
|
const localCommands = await getCommands(getProjectRoot());
|
|
481025
481069
|
return dropShadowedSkills(uniqBy_default([...localCommands, ...mcpSkills], "name"));
|
|
481026
481070
|
}
|
|
481071
|
+
function buildUnknownSkillMessage(name3, commands7) {
|
|
481072
|
+
const match = findPluginSkillFullNameMatch(name3, commands7);
|
|
481073
|
+
if (match.kind === "unique" && isSkillNameSafeToDisplay(match.command.name)) {
|
|
481074
|
+
return `Unknown skill: ${name3}. Did you mean ${match.command.name}? Invoke it by that full name.`;
|
|
481075
|
+
}
|
|
481076
|
+
if (match.kind === "ambiguous" && match.candidates.every((c9) => isSkillNameSafeToDisplay(c9.name))) {
|
|
481077
|
+
return `Unknown skill: ${name3}. Several skills match that name: ${match.candidates.map((c9) => c9.name).join(", ")} \u2014 invoke one by its full name.`;
|
|
481078
|
+
}
|
|
481079
|
+
return `Unknown skill: ${name3}`;
|
|
481080
|
+
}
|
|
481027
481081
|
async function executeForkedSkill(command4, commandName, args, context6, canUseTool, parentMessage, onProgress) {
|
|
481028
481082
|
const startTime2 = Date.now();
|
|
481029
481083
|
const agentId = createAgentId();
|
|
@@ -481338,9 +481392,15 @@ var init_SkillTool = __esm(() => {
|
|
|
481338
481392
|
const commands7 = await getAllCommands(context6);
|
|
481339
481393
|
const foundCommand = findCommand(normalizedCommandName, commands7);
|
|
481340
481394
|
if (!foundCommand) {
|
|
481395
|
+
const match = findPluginSkillFullNameMatch(normalizedCommandName, commands7);
|
|
481396
|
+
if (match.kind !== "none") {
|
|
481397
|
+
logEvent2("tengu_skill_tool_suffix_match", {
|
|
481398
|
+
candidate_count: match.kind === "ambiguous" ? match.candidates.length : 1
|
|
481399
|
+
});
|
|
481400
|
+
}
|
|
481341
481401
|
return {
|
|
481342
481402
|
result: false,
|
|
481343
|
-
message:
|
|
481403
|
+
message: buildUnknownSkillMessage(normalizedCommandName, commands7),
|
|
481344
481404
|
errorCode: 2
|
|
481345
481405
|
};
|
|
481346
481406
|
}
|
|
@@ -601621,7 +601681,7 @@ async function generateSuggestion(abortController, promptId, cacheSafeParams) {
|
|
|
601621
601681
|
const contentArr = Array.isArray(msg.message.content) ? msg.message.content : [];
|
|
601622
601682
|
const textBlock = contentArr.find((b6) => b6.type === "text");
|
|
601623
601683
|
if (textBlock?.type === "text" && typeof textBlock.text === "string") {
|
|
601624
|
-
const suggestion = textBlock.text
|
|
601684
|
+
const suggestion = stripSuggestionMeta(textBlock.text);
|
|
601625
601685
|
if (suggestion) {
|
|
601626
601686
|
return { suggestion, generationRequestId };
|
|
601627
601687
|
}
|
|
@@ -601629,22 +601689,60 @@ async function generateSuggestion(abortController, promptId, cacheSafeParams) {
|
|
|
601629
601689
|
}
|
|
601630
601690
|
return { suggestion: null, generationRequestId };
|
|
601631
601691
|
}
|
|
601692
|
+
function stripSuggestionMeta(text2) {
|
|
601693
|
+
return text2.trim().replace(/^<(suggestion|response|output|answer|result)>([\s\S]*)<\/\1>$/i, (match, tag, inner) => inner.includes(`</${tag.toLowerCase()}>`) || inner.includes(`</${tag.toUpperCase()}>`) ? match : inner).replace(/^\s*(suggested\s+(response|reply|input|prompt)|suggestion|response|reply|answer|output|result|\u63D0\u6848|\u56DE\u7B54|\u8FD4\u4FE1|\u5FDC\u7B54|\u51FA\u529B|\u7D50\u679C|\u5EFA\u8BAE|\u56DE\u590D|\u7B54\u6848|\u8F93\u51FA|\u7ED3\u679C|\uC81C\uC548|\uB2F5\uBCC0|\uC751\uB2F5|\uCD9C\uB825|\uACB0\uACFC)\s*[:\uFF1A]\s*/i, "").trim();
|
|
601694
|
+
}
|
|
601695
|
+
function classifyScripts(text2) {
|
|
601696
|
+
let han = 0;
|
|
601697
|
+
let phonetic = 0;
|
|
601698
|
+
let hangul = 0;
|
|
601699
|
+
let other = 0;
|
|
601700
|
+
for (const char of text2) {
|
|
601701
|
+
if (HAN_SCRIPT_RE.test(char))
|
|
601702
|
+
han++;
|
|
601703
|
+
else if (PHONETIC_SCRIPT_RE.test(char))
|
|
601704
|
+
phonetic++;
|
|
601705
|
+
else if (HANGUL_SCRIPT_RE.test(char))
|
|
601706
|
+
hangul++;
|
|
601707
|
+
else if (LETTER_NUMBER_RE.test(char))
|
|
601708
|
+
other++;
|
|
601709
|
+
}
|
|
601710
|
+
return { han, phonetic, hangul, other };
|
|
601711
|
+
}
|
|
601712
|
+
function countCjkCharacters(text2) {
|
|
601713
|
+
const { han, phonetic, hangul } = classifyScripts(text2);
|
|
601714
|
+
return han + phonetic + hangul;
|
|
601715
|
+
}
|
|
601716
|
+
function countSuggestionWords(text2) {
|
|
601717
|
+
const trimmed = text2.trim();
|
|
601718
|
+
if (trimmed === "")
|
|
601719
|
+
return 0;
|
|
601720
|
+
let total = 0;
|
|
601721
|
+
for (const token of trimmed.split(/\s+/)) {
|
|
601722
|
+
const { han, phonetic, hangul, other } = classifyScripts(token);
|
|
601723
|
+
total += han === 0 && phonetic === 0 ? 1 : (other + hangul > 0 ? 1 : 0) + han / 2 + phonetic / 4;
|
|
601724
|
+
}
|
|
601725
|
+
return Math.ceil(total);
|
|
601726
|
+
}
|
|
601632
601727
|
function shouldFilterSuggestion(suggestion, promptId, source2) {
|
|
601633
601728
|
if (!suggestion) {
|
|
601634
601729
|
logSuggestionSuppressed("empty", undefined, promptId, source2);
|
|
601635
601730
|
return true;
|
|
601636
601731
|
}
|
|
601637
601732
|
const lower = suggestion.toLowerCase();
|
|
601638
|
-
const wordCount = suggestion
|
|
601733
|
+
const wordCount = countSuggestionWords(suggestion);
|
|
601639
601734
|
const filters = [
|
|
601640
|
-
[
|
|
601735
|
+
[
|
|
601736
|
+
"done",
|
|
601737
|
+
() => lower === "done" || /^\P{L}*(\u5B8C\u4E86(\u3057\u307E\u3057\u305F)?|\u5B8C\u6210\u4E86?|\uC644\uB8CC\uB428?)\P{L}*$/u.test(suggestion)
|
|
601738
|
+
],
|
|
601641
601739
|
[
|
|
601642
601740
|
"meta_text",
|
|
601643
|
-
() => lower === "nothing found" || lower === "nothing found." || lower.startsWith("nothing to suggest") || lower.startsWith("no suggestion") || /\bsilence is\b|\bstay(s|ing)? silent\b/.test(lower) || /^\W*silence\W*$/.test(lower)
|
|
601741
|
+
() => lower === "nothing found" || lower === "nothing found." || lower.startsWith("nothing to suggest") || lower.startsWith("no suggestion") || /\bsilence is\b|\bstay(s|ing)? silent\b/.test(lower) || /^\W*silence\W*$/.test(lower) || /^\P{L}*(\u6C88\u9ED9|\u6C89\u9ED8|\u9759\u9ED8|\uCE68\uBB35|\u63D0\u6848(\u306A\u3057|\u306F\u3042\u308A\u307E\u305B\u3093)|\u7279\u306B(\u306A\u3057|\u3042\u308A\u307E\u305B\u3093)|[\u65E0\u6CA1\u6C92]\u6709?\u5EFA[\u8BAE\u8B70]|(\uC81C\uC548|\uD574\uB2F9)\s*\uC5C6\uC74C)\P{L}*$/u.test(suggestion)
|
|
601644
601742
|
],
|
|
601645
601743
|
[
|
|
601646
601744
|
"meta_wrapped",
|
|
601647
|
-
() =>
|
|
601745
|
+
() => /^(\(.*\)|\[.*\]|\uFF08.*\uFF09|\uFF3B.*\uFF3D|\u3010.*\u3011|\u3014.*\u3015)$/.test(suggestion)
|
|
601648
601746
|
],
|
|
601649
601747
|
[
|
|
601650
601748
|
"error_message",
|
|
@@ -601658,6 +601756,9 @@ function shouldFilterSuggestion(suggestion, promptId, source2) {
|
|
|
601658
601756
|
return false;
|
|
601659
601757
|
if (suggestion.startsWith("/"))
|
|
601660
601758
|
return false;
|
|
601759
|
+
const cjkCount = countCjkCharacters(suggestion);
|
|
601760
|
+
if (cjkCount > 0)
|
|
601761
|
+
return cjkCount < 2;
|
|
601661
601762
|
const ALLOWED_SINGLE_WORDS = new Set([
|
|
601662
601763
|
"yes",
|
|
601663
601764
|
"yeah",
|
|
@@ -601682,15 +601783,18 @@ function shouldFilterSuggestion(suggestion, promptId, source2) {
|
|
|
601682
601783
|
],
|
|
601683
601784
|
["too_many_words", () => wordCount > 12],
|
|
601684
601785
|
["too_long", () => suggestion.length >= 100],
|
|
601685
|
-
[
|
|
601786
|
+
[
|
|
601787
|
+
"multiple_sentences",
|
|
601788
|
+
() => /[.!?]\s+[A-Z]|[\u3002\uFF01\uFF1F]\s*[\p{L}\p{N}]/u.test(suggestion)
|
|
601789
|
+
],
|
|
601686
601790
|
["has_formatting", () => /[\n*]|\*\*/.test(suggestion)],
|
|
601687
601791
|
[
|
|
601688
601792
|
"evaluative",
|
|
601689
|
-
() => /thanks|thank you|looks good|sounds good|that works|that worked|that's all|nice|great|perfect|makes sense|awesome|excellent/.test(lower)
|
|
601793
|
+
() => /thanks|thank you|looks good|sounds good|that works|that worked|that's all|nice|great|perfect|makes sense|awesome|excellent/.test(lower) || /^\P{L}*(\u3042\u308A\u304C\u3068\u3046(\u3054\u3056\u3044\u307E\u3059|\u3054\u3056\u3044\u307E\u3057\u305F)?|\u52A9\u304B\u308A\u307E\u3057\u305F|[\u8C22\u8B1D][\u8C22\u8B1D][\u4F60\u60A8]?|\u611F\u8C22[\u4F60\u60A8]?|\u611F\u8B1D\u3057\u307E\u3059|\uAC10\uC0AC\uD569\uB2C8\uB2E4|\uACE0\uB9C8\uC6CC\uC694?)(\P{L}|\u7684|$)/u.test(suggestion) || /(\u826F\u3055\u305D\u3046|\u3088\u3055\u305D\u3046|\u3044\u3044\u3067\u3059\u306D|\u770B\u8D77\u6765\u4E0D\u9519|\u592A\u597D\u4E86|\u5B8C\u74A7|\u5B8C\u7F8E|\uC88B\uB124\uC694)(\u3067\u3059|\u3067\u3059\u306D|\u3060\u306D)?\P{L}*$/u.test(suggestion)
|
|
601690
601794
|
],
|
|
601691
601795
|
[
|
|
601692
601796
|
"claude_voice",
|
|
601693
|
-
() => /^(let me|i'll|i've|i'm|i can|i would|i think|i notice|here's|here is|here are|that's|this is|this will|you can|you should|you could|sure,|of course|certainly)/i.test(suggestion)
|
|
601797
|
+
() => /^(let me|i'll|i've|i'm|i can|i would|i think|i notice|here's|here is|here are|that's|this is|this will|you can|you should|you could|sure,|of course|certainly|\u8BA9\u6211(?!\u4EEC)|\u6211\u6765|\u6211\u4F1A|\u6211\u5C06)/i.test(suggestion)
|
|
601694
601798
|
]
|
|
601695
601799
|
];
|
|
601696
601800
|
for (const [reason, check3] of filters) {
|
|
@@ -601766,7 +601870,7 @@ Stay silent if the next step isn't obvious from what the user said.
|
|
|
601766
601870
|
|
|
601767
601871
|
Format: 2-12 words, match the user's style. Or nothing.
|
|
601768
601872
|
|
|
601769
|
-
Reply with ONLY the suggestion, no quotes or explanation.`, SUGGESTION_PROMPTS;
|
|
601873
|
+
Reply with ONLY the suggestion, no quotes or explanation.`, SUGGESTION_PROMPTS, HAN_SCRIPT_RE, PHONETIC_SCRIPT_RE, HANGUL_SCRIPT_RE, LETTER_NUMBER_RE;
|
|
601770
601874
|
var init_promptSuggestion = __esm(() => {
|
|
601771
601875
|
init_state();
|
|
601772
601876
|
init_agentSwarmsEnabled();
|
|
@@ -601785,6 +601889,10 @@ var init_promptSuggestion = __esm(() => {
|
|
|
601785
601889
|
user_intent: SUGGESTION_PROMPT,
|
|
601786
601890
|
stated_intent: SUGGESTION_PROMPT
|
|
601787
601891
|
};
|
|
601892
|
+
HAN_SCRIPT_RE = /\p{Script=Han}/u;
|
|
601893
|
+
PHONETIC_SCRIPT_RE = /[\p{Script=Hiragana}\p{Script=Katakana}\u30FC\uFF70\p{Script=Thai}\p{Script=Lao}\p{Script=Khmer}\p{Script=Myanmar}]/u;
|
|
601894
|
+
HANGUL_SCRIPT_RE = /\p{Script=Hangul}/u;
|
|
601895
|
+
LETTER_NUMBER_RE = /[\p{L}\p{N}]/u;
|
|
601788
601896
|
});
|
|
601789
601897
|
|
|
601790
601898
|
// src/state/AppStateStore.ts
|
|
@@ -610924,9 +611032,11 @@ var init_loadPluginCommands = __esm(() => {
|
|
|
610924
611032
|
|
|
610925
611033
|
// src/utils/plugins/zipCache.ts
|
|
610926
611034
|
import { randomBytes as randomBytes10 } from "crypto";
|
|
611035
|
+
import { constants as fsConstants8 } from "fs";
|
|
610927
611036
|
import {
|
|
610928
611037
|
chmod as chmod8,
|
|
610929
611038
|
lstat as lstat9,
|
|
611039
|
+
open as open13,
|
|
610930
611040
|
readdir as readdir24,
|
|
610931
611041
|
readFile as readFile44,
|
|
610932
611042
|
rename as rename4,
|
|
@@ -611084,22 +611194,91 @@ async function collectFilesForZip(baseDir, relativePath, files2, visited) {
|
|
|
611084
611194
|
}
|
|
611085
611195
|
}
|
|
611086
611196
|
}
|
|
611087
|
-
|
|
611088
|
-
|
|
611089
|
-
|
|
611090
|
-
|
|
611091
|
-
|
|
611197
|
+
function errnoCode(error52) {
|
|
611198
|
+
return typeof error52 === "object" && error52 !== null && "code" in error52 ? String(error52.code) : undefined;
|
|
611199
|
+
}
|
|
611200
|
+
function isInPlaceFallbackError(error52) {
|
|
611201
|
+
const code = errnoCode(error52);
|
|
611202
|
+
return code !== undefined && IN_PLACE_FALLBACK_ERRNOS.has(code);
|
|
611203
|
+
}
|
|
611204
|
+
function errorText(error52) {
|
|
611205
|
+
return error52 instanceof Error ? error52.message : String(error52);
|
|
611206
|
+
}
|
|
611207
|
+
async function isExistingDirectory(path35) {
|
|
611208
|
+
try {
|
|
611209
|
+
return (await stat36(path35)).isDirectory();
|
|
611210
|
+
} catch {
|
|
611211
|
+
return false;
|
|
611212
|
+
}
|
|
611213
|
+
}
|
|
611214
|
+
async function removeExtractionTree(path35) {
|
|
611215
|
+
await rm8(path35, { recursive: true, force: true }).catch((error52) => {
|
|
611216
|
+
logForDebugging(`Failed to remove the extraction tree ${path35}: ${errorText(error52)}`, { level: "warn" });
|
|
611217
|
+
});
|
|
611218
|
+
}
|
|
611219
|
+
async function hardenExtractedFileMode(filePath, diskMode) {
|
|
611220
|
+
if ((diskMode & GROUP_OTHER_WRITE_BITS) === 0)
|
|
611221
|
+
return;
|
|
611222
|
+
let handle2;
|
|
611223
|
+
try {
|
|
611224
|
+
handle2 = await open13(filePath, fsConstants8.O_RDONLY | fsConstants8.O_NOFOLLOW | fsConstants8.O_NONBLOCK);
|
|
611225
|
+
const fdStat = await handle2.stat();
|
|
611226
|
+
if (!fdStat.isFile() || fdStat.nlink !== 1)
|
|
611227
|
+
return;
|
|
611228
|
+
if ((fdStat.mode & GROUP_OTHER_WRITE_BITS) !== 0) {
|
|
611229
|
+
await handle2.chmod(fdStat.mode & EXTRACTED_MODE_MASK);
|
|
611230
|
+
}
|
|
611231
|
+
} catch {} finally {
|
|
611232
|
+
await handle2?.close().catch(() => {});
|
|
611233
|
+
}
|
|
611234
|
+
}
|
|
611235
|
+
async function extractZipEntriesToDir(files2, modes, destDir) {
|
|
611236
|
+
await getFsImplementation().mkdir(destDir);
|
|
611092
611237
|
for (const [relPath, data] of Object.entries(files2)) {
|
|
611093
611238
|
if (relPath.endsWith("/")) {
|
|
611094
|
-
await getFsImplementation().mkdir(join119(
|
|
611239
|
+
await getFsImplementation().mkdir(join119(destDir, relPath));
|
|
611095
611240
|
continue;
|
|
611096
611241
|
}
|
|
611097
|
-
const fullPath = join119(
|
|
611242
|
+
const fullPath = join119(destDir, relPath);
|
|
611098
611243
|
await getFsImplementation().mkdir(dirname52(fullPath));
|
|
611099
611244
|
await writeFile36(fullPath, data);
|
|
611100
611245
|
const mode = modes[relPath];
|
|
611101
|
-
if (mode && mode &
|
|
611102
|
-
await chmod8(fullPath, mode &
|
|
611246
|
+
if (mode && mode & EXEC_MODE_BITS) {
|
|
611247
|
+
await chmod8(fullPath, mode & EXTRACTED_MODE_MASK).catch(() => {});
|
|
611248
|
+
}
|
|
611249
|
+
const diskStat = await lstat9(fullPath).catch(() => {
|
|
611250
|
+
return;
|
|
611251
|
+
});
|
|
611252
|
+
if (diskStat)
|
|
611253
|
+
await hardenExtractedFileMode(fullPath, diskStat.mode);
|
|
611254
|
+
}
|
|
611255
|
+
}
|
|
611256
|
+
async function extractZipToDirectory(zipPath, targetDir) {
|
|
611257
|
+
const zipBuf = await getFsImplementation().readFileBytes(zipPath);
|
|
611258
|
+
const files2 = await unzipFile(zipBuf);
|
|
611259
|
+
const modes = parseZipModes(zipBuf);
|
|
611260
|
+
const swapHex = randomBytes10(4).toString("hex");
|
|
611261
|
+
const stagingDir = `${targetDir}.staging-${swapHex}`;
|
|
611262
|
+
const previousDir = `${targetDir}.previous-${swapHex}`;
|
|
611263
|
+
await extractZipEntriesToDir(files2, modes, stagingDir);
|
|
611264
|
+
let movedAside = false;
|
|
611265
|
+
try {
|
|
611266
|
+
if (await isExistingDirectory(targetDir)) {
|
|
611267
|
+
await rename4(targetDir, previousDir);
|
|
611268
|
+
movedAside = true;
|
|
611269
|
+
}
|
|
611270
|
+
await rename4(stagingDir, targetDir);
|
|
611271
|
+
if (movedAside)
|
|
611272
|
+
await removeExtractionTree(previousDir);
|
|
611273
|
+
} catch (error52) {
|
|
611274
|
+
if (movedAside)
|
|
611275
|
+
await rename4(previousDir, targetDir).catch(() => {});
|
|
611276
|
+
await removeExtractionTree(stagingDir);
|
|
611277
|
+
if (isInPlaceFallbackError(error52)) {
|
|
611278
|
+
logForDebugging(`Plugin extraction directory ${targetDir} or its staged copy is held open; extracting the archive in place, so files dropped from it are not cleared this time`, { level: "warn" });
|
|
611279
|
+
await extractZipEntriesToDir(files2, modes, targetDir);
|
|
611280
|
+
} else {
|
|
611281
|
+
throw error52;
|
|
611103
611282
|
}
|
|
611104
611283
|
}
|
|
611105
611284
|
logForDebugging(`Extracted ZIP to ${targetDir}: ${Object.keys(files2).length} entries`);
|
|
@@ -611116,13 +611295,14 @@ function getMarketplaceJsonRelativePath(marketplaceName) {
|
|
|
611116
611295
|
function isMarketplaceSourceSupportedByZipCache(source2) {
|
|
611117
611296
|
return ["github", "git", "url", "settings"].includes(source2.source);
|
|
611118
611297
|
}
|
|
611119
|
-
var sessionPluginCachePath = null, sessionPluginCachePromise = null;
|
|
611298
|
+
var sessionPluginCachePath = null, sessionPluginCachePromise = null, EXTRACTED_MODE_MASK = 493, EXEC_MODE_BITS = 73, GROUP_OTHER_WRITE_BITS = 18, IN_PLACE_FALLBACK_ERRNOS;
|
|
611120
611299
|
var init_zipCache = __esm(() => {
|
|
611121
611300
|
init_debug();
|
|
611122
611301
|
init_zip();
|
|
611123
611302
|
init_envUtils();
|
|
611124
611303
|
init_fsOperations();
|
|
611125
611304
|
init_pathValidation();
|
|
611305
|
+
IN_PLACE_FALLBACK_ERRNOS = new Set(["EBUSY", "EPERM", "ENOTEMPTY", "EEXIST"]);
|
|
611126
611306
|
});
|
|
611127
611307
|
|
|
611128
611308
|
// src/utils/plugins/cacheUtils.ts
|
|
@@ -616709,11 +616889,11 @@ function normalizeMessagesForAPI(messages, tools = []) {
|
|
|
616709
616889
|
if (!isSyntheticApiErrorMessage(msg)) {
|
|
616710
616890
|
continue;
|
|
616711
616891
|
}
|
|
616712
|
-
const
|
|
616713
|
-
if (!
|
|
616892
|
+
const errorText2 = Array.isArray(msg.message.content) && msg.message.content[0]?.type === "text" ? msg.message.content[0].text : undefined;
|
|
616893
|
+
if (!errorText2) {
|
|
616714
616894
|
continue;
|
|
616715
616895
|
}
|
|
616716
|
-
const blockTypesToStrip = errorToBlockTypes[
|
|
616896
|
+
const blockTypesToStrip = errorToBlockTypes[errorText2];
|
|
616717
616897
|
if (!blockTypesToStrip) {
|
|
616718
616898
|
continue;
|
|
616719
616899
|
}
|
|
@@ -621870,11 +622050,11 @@ var init_dist11 = __esm(() => {
|
|
|
621870
622050
|
return;
|
|
621871
622051
|
}
|
|
621872
622052
|
const decoder = new TextDecoder, reader = body.getReader();
|
|
621873
|
-
let
|
|
622053
|
+
let open14 = true;
|
|
621874
622054
|
do {
|
|
621875
622055
|
const { done, value } = await reader.read();
|
|
621876
|
-
value && __privateGet(this, _parser).feed(decoder.decode(value, { stream: !done })), done && (
|
|
621877
|
-
} while (
|
|
622056
|
+
value && __privateGet(this, _parser).feed(decoder.decode(value, { stream: !done })), done && (open14 = false, __privateGet(this, _parser).reset(), __privateMethod(this, _EventSource_instances, scheduleReconnect_fn).call(this));
|
|
622057
|
+
} while (open14);
|
|
621878
622058
|
}), __privateAdd(this, _onFetchError, (err2) => {
|
|
621879
622059
|
__privateSet(this, _controller, undefined), !(err2.name === "AbortError" || err2.type === "aborted") && __privateMethod(this, _EventSource_instances, scheduleReconnect_fn).call(this, flattenError2(err2));
|
|
621880
622060
|
}), __privateAdd(this, _onEvent, (event) => {
|
|
@@ -636674,6 +636854,27 @@ function getRuleByContentsForToolName(context7, toolName, behavior) {
|
|
|
636674
636854
|
}
|
|
636675
636855
|
return ruleByContents;
|
|
636676
636856
|
}
|
|
636857
|
+
function getRuleListForToolName(context7, toolName, behavior) {
|
|
636858
|
+
let rules2 = [];
|
|
636859
|
+
switch (behavior) {
|
|
636860
|
+
case "allow":
|
|
636861
|
+
rules2 = getAllowRules(context7);
|
|
636862
|
+
break;
|
|
636863
|
+
case "deny":
|
|
636864
|
+
rules2 = getDenyRules(context7);
|
|
636865
|
+
break;
|
|
636866
|
+
case "ask":
|
|
636867
|
+
rules2 = getAskRules(context7);
|
|
636868
|
+
break;
|
|
636869
|
+
}
|
|
636870
|
+
const matched = [];
|
|
636871
|
+
for (const rule of rules2) {
|
|
636872
|
+
if (rule.ruleValue.toolName === toolName && rule.ruleValue.ruleContent !== undefined && rule.ruleBehavior === behavior) {
|
|
636873
|
+
matched.push(rule);
|
|
636874
|
+
}
|
|
636875
|
+
}
|
|
636876
|
+
return matched;
|
|
636877
|
+
}
|
|
636677
636878
|
async function runPermissionRequestHooksForHeadlessAgent(tool, input2, toolUseID, context7, permissionMode, suggestions) {
|
|
636678
636879
|
try {
|
|
636679
636880
|
for await (const hookResult of executePermissionRequestHooks(tool.name, toolUseID, input2, context7, permissionMode, suggestions, context7.abortController.signal)) {
|
|
@@ -643207,7 +643408,7 @@ async function ensureZombieKill(pid, graceMs = 3000) {
|
|
|
643207
643408
|
var init_process2 = () => {};
|
|
643208
643409
|
|
|
643209
643410
|
// src/daemon/lockfile.ts
|
|
643210
|
-
import { open as
|
|
643411
|
+
import { open as open14, readFile as readFile50, unlink as unlink22, writeFile as writeFile43 } from "fs/promises";
|
|
643211
643412
|
import { existsSync as existsSync18, statSync as statSync16 } from "fs";
|
|
643212
643413
|
import { join as join135 } from "path";
|
|
643213
643414
|
function getDaemonLockfilePath() {
|
|
@@ -643241,7 +643442,7 @@ async function acquireLockfile(identity9) {
|
|
|
643241
643442
|
await mkdir41(getClaudeConfigHomeDir(), { recursive: true }).catch(() => {});
|
|
643242
643443
|
if (!existsSync18(path35)) {
|
|
643243
643444
|
try {
|
|
643244
|
-
const fh = await
|
|
643445
|
+
const fh = await open14(path35, "ax");
|
|
643245
643446
|
const contents = {
|
|
643246
643447
|
supervisorPid: identity9.supervisorPid,
|
|
643247
643448
|
supervisorProcStart: identity9.supervisorProcStart,
|
|
@@ -643277,7 +643478,7 @@ async function acquireLockfile(identity9) {
|
|
|
643277
643478
|
await unlink22(path35);
|
|
643278
643479
|
} catch {}
|
|
643279
643480
|
try {
|
|
643280
|
-
const fh = await
|
|
643481
|
+
const fh = await open14(path35, "ax");
|
|
643281
643482
|
const contents = {
|
|
643282
643483
|
supervisorPid: identity9.supervisorPid,
|
|
643283
643484
|
supervisorProcStart: identity9.supervisorProcStart,
|
|
@@ -683408,11 +683609,11 @@ var require_dijkstra = __commonJS((exports, module) => {
|
|
|
683408
683609
|
var predecessors = {};
|
|
683409
683610
|
var costs = {};
|
|
683410
683611
|
costs[s4] = 0;
|
|
683411
|
-
var
|
|
683412
|
-
|
|
683612
|
+
var open15 = dijkstra.PriorityQueue.make();
|
|
683613
|
+
open15.push(s4, 0);
|
|
683413
683614
|
var closest, u7, v6, cost_of_s_to_u, adjacent_nodes, cost_of_e, cost_of_s_to_u_plus_cost_of_e, cost_of_s_to_v, first_visit;
|
|
683414
|
-
while (!
|
|
683415
|
-
closest =
|
|
683615
|
+
while (!open15.empty()) {
|
|
683616
|
+
closest = open15.pop();
|
|
683416
683617
|
u7 = closest.value;
|
|
683417
683618
|
cost_of_s_to_u = closest.cost;
|
|
683418
683619
|
adjacent_nodes = graph[u7] || {};
|
|
@@ -683424,7 +683625,7 @@ var require_dijkstra = __commonJS((exports, module) => {
|
|
|
683424
683625
|
first_visit = typeof costs[v6] === "undefined";
|
|
683425
683626
|
if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) {
|
|
683426
683627
|
costs[v6] = cost_of_s_to_u_plus_cost_of_e;
|
|
683427
|
-
|
|
683628
|
+
open15.push(v6, cost_of_s_to_u_plus_cost_of_e);
|
|
683428
683629
|
predecessors[v6] = u7;
|
|
683429
683630
|
}
|
|
683430
683631
|
}
|
|
@@ -687998,13 +688199,13 @@ function computeSearchText(msg) {
|
|
|
687998
688199
|
break;
|
|
687999
688200
|
}
|
|
688000
688201
|
let t4 = raw;
|
|
688001
|
-
let
|
|
688002
|
-
while (
|
|
688003
|
-
const close = t4.indexOf(SYSTEM_REMINDER_CLOSE,
|
|
688202
|
+
let open15 = t4.indexOf("<system-reminder>");
|
|
688203
|
+
while (open15 >= 0) {
|
|
688204
|
+
const close = t4.indexOf(SYSTEM_REMINDER_CLOSE, open15);
|
|
688004
688205
|
if (close < 0)
|
|
688005
688206
|
break;
|
|
688006
|
-
t4 = t4.slice(0,
|
|
688007
|
-
|
|
688207
|
+
t4 = t4.slice(0, open15) + t4.slice(close + SYSTEM_REMINDER_CLOSE.length);
|
|
688208
|
+
open15 = t4.indexOf("<system-reminder>");
|
|
688008
688209
|
}
|
|
688009
688210
|
return t4;
|
|
688010
688211
|
}
|
|
@@ -715455,8 +715656,8 @@ var init_advisor2 = __esm(() => {
|
|
|
715455
715656
|
});
|
|
715456
715657
|
|
|
715457
715658
|
// src/skills/bundledSkills.ts
|
|
715458
|
-
import { constants as
|
|
715459
|
-
import { mkdir as mkdir49, open as
|
|
715659
|
+
import { constants as fsConstants9 } from "fs";
|
|
715660
|
+
import { mkdir as mkdir49, open as open15 } from "fs/promises";
|
|
715460
715661
|
import { dirname as dirname68, isAbsolute as isAbsolute33, join as join158, normalize as normalize16, sep as pathSep2 } from "path";
|
|
715461
715662
|
function registerBundledSkill(definition) {
|
|
715462
715663
|
const { files: files3 } = definition;
|
|
@@ -715537,7 +715738,7 @@ async function writeSkillFiles(dir, files3) {
|
|
|
715537
715738
|
}));
|
|
715538
715739
|
}
|
|
715539
715740
|
async function safeWriteFile(p4, content) {
|
|
715540
|
-
const fh = await
|
|
715741
|
+
const fh = await open15(p4, SAFE_WRITE_FLAGS, 384);
|
|
715541
715742
|
try {
|
|
715542
715743
|
await fh.writeFile(content, "utf8");
|
|
715543
715744
|
} finally {
|
|
@@ -715568,8 +715769,8 @@ var init_bundledSkills = __esm(() => {
|
|
|
715568
715769
|
init_debug();
|
|
715569
715770
|
init_filesystem();
|
|
715570
715771
|
bundledSkills = [];
|
|
715571
|
-
O_NOFOLLOW =
|
|
715572
|
-
SAFE_WRITE_FLAGS = process.platform === "win32" ? "wx" :
|
|
715772
|
+
O_NOFOLLOW = fsConstants9.O_NOFOLLOW ?? 0;
|
|
715773
|
+
SAFE_WRITE_FLAGS = process.platform === "win32" ? "wx" : fsConstants9.O_WRONLY | fsConstants9.O_CREAT | fsConstants9.O_EXCL | O_NOFOLLOW;
|
|
715573
715774
|
});
|
|
715574
715775
|
|
|
715575
715776
|
// src/commands/env/index.js
|
|
@@ -721156,7 +721357,7 @@ __export(exports_insights, {
|
|
|
721156
721357
|
buildExportData: () => buildExportData
|
|
721157
721358
|
});
|
|
721158
721359
|
import { execFileSync as execFileSync7 } from "child_process";
|
|
721159
|
-
import { constants as
|
|
721360
|
+
import { constants as fsConstants10 } from "fs";
|
|
721160
721361
|
import {
|
|
721161
721362
|
copyFile as copyFile10,
|
|
721162
721363
|
mkdir as mkdir51,
|
|
@@ -722966,7 +723167,7 @@ var init_insights = __esm(() => {
|
|
|
722966
723167
|
const srcFile = join160(projectPath, fileName);
|
|
722967
723168
|
const destFile = join160(destProjectPath, fileName);
|
|
722968
723169
|
try {
|
|
722969
|
-
await copyFile10(srcFile, destFile,
|
|
723170
|
+
await copyFile10(srcFile, destFile, fsConstants10.COPYFILE_EXCL);
|
|
722970
723171
|
result.copied++;
|
|
722971
723172
|
} catch {
|
|
722972
723173
|
result.skipped++;
|
|
@@ -723372,6 +723573,21 @@ async function getWorkflowCommands(_cwd) {
|
|
|
723372
723573
|
function getBuiltInCommandByName(name3) {
|
|
723373
723574
|
return COMMANDS().find((_4) => _4.name === name3 || _4.aliases?.includes(name3));
|
|
723374
723575
|
}
|
|
723576
|
+
function isSkillNameSafeToDisplay(name3) {
|
|
723577
|
+
return name3.length > 0 && name3.length <= MAX_SAFE_SKILL_NAME_LENGTH && !UNSAFE_SKILL_NAME_CHARS_RE.test(name3);
|
|
723578
|
+
}
|
|
723579
|
+
function findPluginSkillFullNameMatch(query2, commands7) {
|
|
723580
|
+
if (query2 === "" || query2.includes(":"))
|
|
723581
|
+
return { kind: "none" };
|
|
723582
|
+
const suffix2 = `:${query2}`;
|
|
723583
|
+
const matches = commands7.filter((cmd) => cmd.type === "prompt" && cmd.name.endsWith(suffix2));
|
|
723584
|
+
if (matches.length > 1)
|
|
723585
|
+
return { kind: "ambiguous", candidates: matches };
|
|
723586
|
+
const unique = matches[0];
|
|
723587
|
+
if (unique === undefined || unique.source !== "plugin")
|
|
723588
|
+
return { kind: "none" };
|
|
723589
|
+
return { kind: "unique", command: unique };
|
|
723590
|
+
}
|
|
723375
723591
|
async function getSkills(cwd2) {
|
|
723376
723592
|
try {
|
|
723377
723593
|
const [skillDirCommands, pluginSkills] = await Promise.all([
|
|
@@ -723516,7 +723732,7 @@ function formatDescriptionWithSource(cmd) {
|
|
|
723516
723732
|
}
|
|
723517
723733
|
return `${cmd.description} (${getSettingSourceName(cmd.source)})`;
|
|
723518
723734
|
}
|
|
723519
|
-
var agentsPlatform, proactive, briefCommand, assistantCommand, bridge2, remoteControlServerCommand, voiceCommand, forceSnip, workflowsCmd, webCmd, clearSkillIndexCache3, subscribePr, ultraplan, torch, peersCmd, forkCmd, buddy, usageReport2, INTERNAL_ONLY_COMMANDS2, COMMANDS, builtInCommandNames, getWorkflowCommands2, loadAllCommands, getSkillToolCommands, getSlashCommandToolSkills, REMOTE_SAFE_COMMANDS, BRIDGE_SAFE_COMMANDS;
|
|
723735
|
+
var agentsPlatform, proactive, briefCommand, assistantCommand, bridge2, remoteControlServerCommand, voiceCommand, forceSnip, workflowsCmd, webCmd, clearSkillIndexCache3, subscribePr, ultraplan, torch, peersCmd, forkCmd, buddy, usageReport2, INTERNAL_ONLY_COMMANDS2, COMMANDS, builtInCommandNames, UNSAFE_SKILL_NAME_CHARS_RE, MAX_SAFE_SKILL_NAME_LENGTH = 256, getWorkflowCommands2, loadAllCommands, getSkillToolCommands, getSlashCommandToolSkills, REMOTE_SAFE_COMMANDS, BRIDGE_SAFE_COMMANDS;
|
|
723520
723736
|
var init_commands5 = __esm(() => {
|
|
723521
723737
|
init_envUtils();
|
|
723522
723738
|
init_add_dir2();
|
|
@@ -723810,6 +724026,7 @@ var init_commands5 = __esm(() => {
|
|
|
723810
724026
|
...process.env.USER_TYPE === "ant" && !process.env.IS_DEMO ? INTERNAL_ONLY_COMMANDS2 : []
|
|
723811
724027
|
]);
|
|
723812
724028
|
builtInCommandNames = memoize_default(() => new Set(COMMANDS().flatMap((_4) => [_4.name, ..._4.aliases ?? []])));
|
|
724029
|
+
UNSAFE_SKILL_NAME_CHARS_RE = /[\x00-\x1f\x7f-\x9f\u2028\u2029<>]/;
|
|
723813
724030
|
getWorkflowCommands2 = feature("WORKFLOW_SCRIPTS") ? __toCommonJS(exports_createWorkflowCommand).getWorkflowCommands : null;
|
|
723814
724031
|
loadAllCommands = memoize_default(async (cwd2) => {
|
|
723815
724032
|
const [
|
|
@@ -727533,9 +727750,12 @@ import { posix as posix8 } from "path";
|
|
|
727533
727750
|
function unescapePatternSegment(segment2) {
|
|
727534
727751
|
return segment2.replace(/\\([\s\S])/g, (match, char) => ESCAPABLE_PATTERN_CHAR.test(char) ? char : match);
|
|
727535
727752
|
}
|
|
727536
|
-
function escapePatternPath(path39) {
|
|
727753
|
+
function escapePatternPath(path39, opts) {
|
|
727754
|
+
const escapeGlobs = opts?.escapeGlobs ?? true;
|
|
727537
727755
|
let escaped = path39.replaceAll("\\", "\\\\").replace(/[[\]()|+^$]/g, (char) => `\\${char}`);
|
|
727538
|
-
|
|
727756
|
+
if (escapeGlobs) {
|
|
727757
|
+
escaped = escaped.replaceAll("*", "\\*");
|
|
727758
|
+
}
|
|
727539
727759
|
if (escaped.startsWith("!") || escaped.startsWith("#")) {
|
|
727540
727760
|
escaped = `\\${escaped}`;
|
|
727541
727761
|
}
|
|
@@ -727932,7 +728152,7 @@ function getFileReadIgnorePatterns(toolPermissionContext) {
|
|
|
727932
728152
|
const matchersByRoot = getCachedPatternMatchers(toolPermissionContext, "read", "deny");
|
|
727933
728153
|
const result = new Map;
|
|
727934
728154
|
for (const [patternRoot, { patternMap }] of matchersByRoot.entries()) {
|
|
727935
|
-
result.set(patternRoot, Array.from(patternMap.keys()));
|
|
728155
|
+
result.set(patternRoot, Array.from(patternMap.keys()).filter((pattern) => !pattern.startsWith("!")));
|
|
727936
728156
|
}
|
|
727937
728157
|
return result;
|
|
727938
728158
|
}
|
|
@@ -727980,6 +728200,30 @@ function normalizeIgnorePattern(pattern) {
|
|
|
727980
728200
|
}
|
|
727981
728201
|
return pattern;
|
|
727982
728202
|
}
|
|
728203
|
+
function warnUnusablePermissionRule(tag, pattern, reason, action2 = "treating it as matching nothing") {
|
|
728204
|
+
const dedupKey = `${tag}\x00${pattern}`;
|
|
728205
|
+
if (warnedUnusablePatterns.has(dedupKey)) {
|
|
728206
|
+
return;
|
|
728207
|
+
}
|
|
728208
|
+
warnedUnusablePatterns.add(dedupKey);
|
|
728209
|
+
logForDebugging(`[${tag}] gitignore-style pattern is unusable (${reason}); ${action2}: ${pattern}`, { level: "warn" });
|
|
728210
|
+
}
|
|
728211
|
+
function normalizePermissionRulePattern(pattern, isAllow) {
|
|
728212
|
+
const normalized = normalizeTrailingGlobstar(pattern, isAllow);
|
|
728213
|
+
const reason = !isAllow && BARE_NEGATION_PATTERN.test(normalized) ? "a negation of every path" : unusablePatternReason(normalized);
|
|
728214
|
+
if (reason === null) {
|
|
728215
|
+
return pattern;
|
|
728216
|
+
}
|
|
728217
|
+
const bangPrefix = pattern.startsWith("!") ? "!" : "";
|
|
728218
|
+
const shouldDrop = bangPrefix ? !isAllow : isAllow;
|
|
728219
|
+
warnUnusablePermissionRule("permission_rules", pattern, reason, shouldDrop ? "dropping it" : "matching the literal path it spells");
|
|
728220
|
+
if (shouldDrop) {
|
|
728221
|
+
return null;
|
|
728222
|
+
}
|
|
728223
|
+
const globstarSuffix = pattern.endsWith("/**") ? "/**" : "";
|
|
728224
|
+
const middle = pattern.slice(bangPrefix.length, pattern.length - globstarSuffix.length);
|
|
728225
|
+
return bangPrefix + escapePatternPath(unescapePatternSegment(middle), { escapeGlobs: false }) + globstarSuffix;
|
|
728226
|
+
}
|
|
727983
728227
|
function getCachedPatternMatchers(toolPermissionContext, toolType, behavior) {
|
|
727984
728228
|
const rulesObject = behavior === "deny" ? toolPermissionContext.alwaysDenyRules : behavior === "ask" ? toolPermissionContext.alwaysAskRules : null;
|
|
727985
728229
|
const additionalDirs = JSON.stringify([...toolPermissionContext.additionalWorkingDirectories.keys()].sort());
|
|
@@ -728003,23 +728247,7 @@ function getCachedPatternMatchers(toolPermissionContext, toolType, behavior) {
|
|
|
728003
728247
|
}
|
|
728004
728248
|
}
|
|
728005
728249
|
}
|
|
728006
|
-
const
|
|
728007
|
-
const result = new Map;
|
|
728008
|
-
for (const [root3, patternMap] of patternsByRoot.entries()) {
|
|
728009
|
-
let ig;
|
|
728010
|
-
let useCount = 0;
|
|
728011
|
-
result.set(root3, {
|
|
728012
|
-
patternMap,
|
|
728013
|
-
getIg: () => {
|
|
728014
|
-
if (ig === undefined || ++useCount > MATCHER_RECOMPILE_THRESHOLD) {
|
|
728015
|
-
useCount = 1;
|
|
728016
|
-
const patternsToAdd = behavior === "allow" ? Array.from(patternMap.keys()) : Array.from(patternMap.keys(), normalizeIgnorePattern);
|
|
728017
|
-
ig = import_ignore6.default().add(patternsToAdd);
|
|
728018
|
-
}
|
|
728019
|
-
return ig;
|
|
728020
|
-
}
|
|
728021
|
-
});
|
|
728022
|
-
}
|
|
728250
|
+
const result = buildPatternBuckets(toolPermissionContext, toolType, behavior);
|
|
728023
728251
|
if (rulesObject !== null) {
|
|
728024
728252
|
let innerMap = matcherCache.get(rulesObject);
|
|
728025
728253
|
if (innerMap === undefined) {
|
|
@@ -728036,7 +728264,7 @@ function getCachedPatternMatchers(toolPermissionContext, toolType, behavior) {
|
|
|
728036
728264
|
}
|
|
728037
728265
|
return result;
|
|
728038
728266
|
}
|
|
728039
|
-
function
|
|
728267
|
+
function buildPatternBuckets(toolPermissionContext, toolType, behavior) {
|
|
728040
728268
|
const toolName = (() => {
|
|
728041
728269
|
switch (toolType) {
|
|
728042
728270
|
case "edit":
|
|
@@ -728045,36 +728273,73 @@ function getPatternsByRoot(toolPermissionContext, toolType, behavior) {
|
|
|
728045
728273
|
return FILE_READ_TOOL_NAME;
|
|
728046
728274
|
}
|
|
728047
728275
|
})();
|
|
728048
|
-
const
|
|
728049
|
-
const
|
|
728050
|
-
|
|
728051
|
-
|
|
728052
|
-
|
|
728053
|
-
|
|
728054
|
-
|
|
728055
|
-
|
|
728056
|
-
|
|
728057
|
-
|
|
728058
|
-
|
|
728276
|
+
const isAllow = behavior === "allow";
|
|
728277
|
+
const rulesList = getRuleListForToolName(toolPermissionContext, toolName, behavior);
|
|
728278
|
+
const rules2 = isAllow ? Array.from(new Map(rulesList.map((rule) => [rule.ruleValue.ruleContent, rule])).values()) : rulesList;
|
|
728279
|
+
const bucketsByRoot = new Map;
|
|
728280
|
+
const getMatcher = (root3, source2) => {
|
|
728281
|
+
let bucket = bucketsByRoot.get(root3);
|
|
728282
|
+
if (bucket === undefined) {
|
|
728283
|
+
bucket = { patternMap: new Map, matchers: [] };
|
|
728284
|
+
bucketsByRoot.set(root3, bucket);
|
|
728285
|
+
}
|
|
728286
|
+
let matcher = bucket.matchers.find((candidate) => candidate.source === source2);
|
|
728287
|
+
if (matcher === undefined) {
|
|
728288
|
+
const patternMap = new Map;
|
|
728289
|
+
let ig;
|
|
728290
|
+
let useCount = 0;
|
|
728291
|
+
matcher = {
|
|
728292
|
+
source: source2,
|
|
728293
|
+
patternMap,
|
|
728294
|
+
getIg: () => {
|
|
728295
|
+
if (ig === undefined || ++useCount > MATCHER_RECOMPILE_THRESHOLD) {
|
|
728296
|
+
useCount = 1;
|
|
728297
|
+
const patternsToAdd = isAllow ? Array.from(patternMap.keys()) : Array.from(patternMap.keys(), normalizeIgnorePattern);
|
|
728298
|
+
ig = import_ignore6.default().add(patternsToAdd);
|
|
728299
|
+
}
|
|
728300
|
+
return ig;
|
|
728301
|
+
}
|
|
728302
|
+
};
|
|
728303
|
+
bucket.matchers.push(matcher);
|
|
728304
|
+
}
|
|
728305
|
+
return { bucket, matcher };
|
|
728306
|
+
};
|
|
728307
|
+
for (const rule of rules2) {
|
|
728308
|
+
const ruleContent = rule.ruleValue.ruleContent;
|
|
728309
|
+
if (ruleContent === undefined) {
|
|
728310
|
+
continue;
|
|
728311
|
+
}
|
|
728312
|
+
const { relativePattern, root: root3 } = patternWithRoot(ruleContent, rule.source);
|
|
728313
|
+
const pattern = normalizePermissionRulePattern(collapsePatternSlashes(relativePattern), isAllow);
|
|
728314
|
+
if (pattern === null) {
|
|
728059
728315
|
continue;
|
|
728060
728316
|
}
|
|
728061
|
-
const
|
|
728062
|
-
const
|
|
728317
|
+
const matcherSource = isAllow ? null : rule.source;
|
|
728318
|
+
const { bucket, matcher } = getMatcher(root3, matcherSource);
|
|
728319
|
+
if (!isAllow) {
|
|
728320
|
+
matcher.patternMap.delete(pattern);
|
|
728321
|
+
}
|
|
728322
|
+
matcher.patternMap.set(pattern, rule);
|
|
728323
|
+
bucket.patternMap.set(pattern, rule);
|
|
728324
|
+
if (isAllow || root3 === null) {
|
|
728325
|
+
continue;
|
|
728326
|
+
}
|
|
728327
|
+
const twins = getOrInitPhysicalTwins(makePhysicalTwinsKey(root3, pattern));
|
|
728328
|
+
const twin = resolvePhysicalTwinPattern(root3, pattern);
|
|
728063
728329
|
if (twin !== null) {
|
|
728064
728330
|
twins.add(twin);
|
|
728065
728331
|
}
|
|
728066
728332
|
for (const twinPattern of twins) {
|
|
728067
|
-
|
|
728068
|
-
if (
|
|
728069
|
-
|
|
728070
|
-
patternsByRoot.set(DIR_SEP2, rootSlashPatterns);
|
|
728333
|
+
const { bucket: twinBucket, matcher: twinMatcher } = getMatcher(DIR_SEP2, matcherSource);
|
|
728334
|
+
if (!twinMatcher.patternMap.has(twinPattern)) {
|
|
728335
|
+
twinMatcher.patternMap.set(twinPattern, rule);
|
|
728071
728336
|
}
|
|
728072
|
-
if (!
|
|
728073
|
-
|
|
728337
|
+
if (!twinBucket.patternMap.has(twinPattern)) {
|
|
728338
|
+
twinBucket.patternMap.set(twinPattern, rule);
|
|
728074
728339
|
}
|
|
728075
728340
|
}
|
|
728076
728341
|
}
|
|
728077
|
-
return
|
|
728342
|
+
return bucketsByRoot;
|
|
728078
728343
|
}
|
|
728079
728344
|
function matchingRuleForInput(path39, toolPermissionContext, toolType, behavior) {
|
|
728080
728345
|
let fileAbsolutePath = expandPath(path39);
|
|
@@ -728082,8 +728347,7 @@ function matchingRuleForInput(path39, toolPermissionContext, toolType, behavior)
|
|
|
728082
728347
|
fileAbsolutePath = windowsPathToPosixPath(fileAbsolutePath);
|
|
728083
728348
|
}
|
|
728084
728349
|
const matchersByRoot = getCachedPatternMatchers(toolPermissionContext, toolType, behavior);
|
|
728085
|
-
for (const [root3, {
|
|
728086
|
-
const ig = getIg();
|
|
728350
|
+
for (const [root3, { matchers }] of matchersByRoot.entries()) {
|
|
728087
728351
|
const relativePathStr = relativePath(root3 ?? getCwd(), fileAbsolutePath ?? getCwd());
|
|
728088
728352
|
if (relativePathStr.startsWith(`..${DIR_SEP2}`)) {
|
|
728089
728353
|
continue;
|
|
@@ -728091,14 +728355,31 @@ function matchingRuleForInput(path39, toolPermissionContext, toolType, behavior)
|
|
|
728091
728355
|
if (!relativePathStr) {
|
|
728092
728356
|
continue;
|
|
728093
728357
|
}
|
|
728094
|
-
|
|
728095
|
-
|
|
728358
|
+
for (let i6 = matchers.length - 1;i6 >= 0; i6--) {
|
|
728359
|
+
const matcher = matchers[i6];
|
|
728360
|
+
if (matcher === undefined) {
|
|
728361
|
+
continue;
|
|
728362
|
+
}
|
|
728363
|
+
const { patternMap, getIg } = matcher;
|
|
728364
|
+
const igResult = getIg().test(relativePathStr);
|
|
728365
|
+
if (!igResult.ignored || !igResult.rule) {
|
|
728366
|
+
continue;
|
|
728367
|
+
}
|
|
728096
728368
|
const originalPattern = igResult.rule.pattern;
|
|
728097
728369
|
const withWildcard = originalPattern + "/**";
|
|
728098
|
-
if (patternMap.has(withWildcard)) {
|
|
728370
|
+
if (patternMap.has(withWildcard) && (originalPattern.includes("/") || behavior !== "allow")) {
|
|
728099
728371
|
return patternMap.get(withWildcard) ?? null;
|
|
728100
728372
|
}
|
|
728101
|
-
|
|
728373
|
+
if (originalPattern.startsWith("/")) {
|
|
728374
|
+
const withoutLeadingSlash = originalPattern.slice(1) + "/**";
|
|
728375
|
+
if (patternMap.has(withoutLeadingSlash)) {
|
|
728376
|
+
return patternMap.get(withoutLeadingSlash) ?? null;
|
|
728377
|
+
}
|
|
728378
|
+
}
|
|
728379
|
+
const rule = patternMap.get(originalPattern);
|
|
728380
|
+
if (rule !== undefined || behavior === "allow") {
|
|
728381
|
+
return rule ?? null;
|
|
728382
|
+
}
|
|
728102
728383
|
}
|
|
728103
728384
|
}
|
|
728104
728385
|
return null;
|
|
@@ -728546,7 +728827,7 @@ function checkReadableInternalPath(absolutePath, input2) {
|
|
|
728546
728827
|
}
|
|
728547
728828
|
return { behavior: "passthrough", message: "" };
|
|
728548
728829
|
}
|
|
728549
|
-
var import_ignore6, DANGEROUS_FILES2, DANGEROUS_DIRECTORIES2, DIR_SEP2, getClaudeTempDir, getBundledSkillsRoot, getResolvedWorkingDirPaths, MATCHER_RECOMPILE_THRESHOLD = 1e4, MATCHER_CACHE_MAX_ENTRIES = 16, matcherCache;
|
|
728830
|
+
var import_ignore6, DANGEROUS_FILES2, DANGEROUS_DIRECTORIES2, DIR_SEP2, getClaudeTempDir, getBundledSkillsRoot, getResolvedWorkingDirPaths, MATCHER_RECOMPILE_THRESHOLD = 1e4, MATCHER_CACHE_MAX_ENTRIES = 16, matcherCache, BARE_NEGATION_PATTERN, warnedUnusablePatterns;
|
|
728550
728831
|
var init_filesystem = __esm(() => {
|
|
728551
728832
|
init_featureFlags();
|
|
728552
728833
|
init_memoize();
|
|
@@ -728556,6 +728837,7 @@ var init_filesystem = __esm(() => {
|
|
|
728556
728837
|
init_growthbook();
|
|
728557
728838
|
init_prompt3();
|
|
728558
728839
|
init_cwd2();
|
|
728840
|
+
init_debug();
|
|
728559
728841
|
init_envUtils();
|
|
728560
728842
|
init_fsOperations();
|
|
728561
728843
|
init_path2();
|
|
@@ -728606,6 +728888,8 @@ var init_filesystem = __esm(() => {
|
|
|
728606
728888
|
});
|
|
728607
728889
|
getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
|
|
728608
728890
|
matcherCache = new WeakMap;
|
|
728891
|
+
BARE_NEGATION_PATTERN = /^!\s*$/;
|
|
728892
|
+
warnedUnusablePatterns = new Set;
|
|
728609
728893
|
});
|
|
728610
728894
|
|
|
728611
728895
|
// src/utils/task/diskOutput.ts
|
|
@@ -728629,10 +728913,10 @@ __export(exports_diskOutput, {
|
|
|
728629
728913
|
MAX_TASK_OUTPUT_BYTES: () => MAX_TASK_OUTPUT_BYTES,
|
|
728630
728914
|
DiskTaskOutput: () => DiskTaskOutput
|
|
728631
728915
|
});
|
|
728632
|
-
import { constants as
|
|
728916
|
+
import { constants as fsConstants11 } from "fs";
|
|
728633
728917
|
import {
|
|
728634
728918
|
mkdir as mkdir53,
|
|
728635
|
-
open as
|
|
728919
|
+
open as open16,
|
|
728636
728920
|
stat as stat45,
|
|
728637
728921
|
symlink as symlink4,
|
|
728638
728922
|
unlink as unlink27
|
|
@@ -728720,7 +729004,7 @@ class DiskTaskOutput {
|
|
|
728720
729004
|
try {
|
|
728721
729005
|
if (!this.#fileHandle) {
|
|
728722
729006
|
await ensureOutputDir();
|
|
728723
|
-
this.#fileHandle = await
|
|
729007
|
+
this.#fileHandle = await open16(this.#path, process.platform === "win32" ? "a" : fsConstants11.O_WRONLY | fsConstants11.O_APPEND | fsConstants11.O_CREAT | O_NOFOLLOW2);
|
|
728724
729008
|
}
|
|
728725
729009
|
while (true) {
|
|
728726
729010
|
const cancelCount = this.#cancelCount;
|
|
@@ -728931,7 +729215,7 @@ function initTaskOutput(taskId) {
|
|
|
728931
729215
|
return track((async () => {
|
|
728932
729216
|
await ensureOutputDir();
|
|
728933
729217
|
const outputPath = getTaskOutputPath(taskId);
|
|
728934
|
-
const fh = await
|
|
729218
|
+
const fh = await open16(outputPath, process.platform === "win32" ? "wx" : fsConstants11.O_WRONLY | fsConstants11.O_CREAT | fsConstants11.O_EXCL | O_NOFOLLOW2);
|
|
728935
729219
|
await fh.close();
|
|
728936
729220
|
return outputPath;
|
|
728937
729221
|
})());
|
|
@@ -728963,7 +729247,7 @@ var init_diskOutput = __esm(() => {
|
|
|
728963
729247
|
init_fsOperations();
|
|
728964
729248
|
init_log3();
|
|
728965
729249
|
init_filesystem();
|
|
728966
|
-
O_NOFOLLOW2 =
|
|
729250
|
+
O_NOFOLLOW2 = fsConstants11.O_NOFOLLOW ?? 0;
|
|
728967
729251
|
DEFAULT_MAX_READ_BYTES = 8 * 1024 * 1024;
|
|
728968
729252
|
MAX_TASK_OUTPUT_BYTES = 5 * 1024 * 1024 * 1024;
|
|
728969
729253
|
MAX_UNWRITTEN_CHARS_BEFORE_DROP = 16 * 1024 * 1024;
|
|
@@ -772137,8 +772421,8 @@ function findTextObject(text2, offset, objectType2, isInner) {
|
|
|
772137
772421
|
return findWordObject(text2, offset, isInner, (ch2) => !isVimWhitespace(ch2));
|
|
772138
772422
|
const pair = PAIRS[objectType2];
|
|
772139
772423
|
if (pair) {
|
|
772140
|
-
const [
|
|
772141
|
-
return
|
|
772424
|
+
const [open17, close] = pair;
|
|
772425
|
+
return open17 === close ? findQuoteObject(text2, offset, open17, isInner) : findBracketObject(text2, offset, open17, close, isInner);
|
|
772142
772426
|
}
|
|
772143
772427
|
return null;
|
|
772144
772428
|
}
|
|
@@ -772213,13 +772497,13 @@ function findQuoteObject(text2, offset, quote2, isInner) {
|
|
|
772213
772497
|
}
|
|
772214
772498
|
return null;
|
|
772215
772499
|
}
|
|
772216
|
-
function findBracketObject(text2, offset,
|
|
772500
|
+
function findBracketObject(text2, offset, open17, close, isInner) {
|
|
772217
772501
|
let depth = 0;
|
|
772218
772502
|
let start = -1;
|
|
772219
772503
|
for (let i6 = offset;i6 >= 0; i6--) {
|
|
772220
772504
|
if (text2[i6] === close && i6 !== offset)
|
|
772221
772505
|
depth++;
|
|
772222
|
-
else if (text2[i6] ===
|
|
772506
|
+
else if (text2[i6] === open17) {
|
|
772223
772507
|
if (depth === 0) {
|
|
772224
772508
|
start = i6;
|
|
772225
772509
|
break;
|
|
@@ -772232,7 +772516,7 @@ function findBracketObject(text2, offset, open16, close, isInner) {
|
|
|
772232
772516
|
depth = 0;
|
|
772233
772517
|
let end = -1;
|
|
772234
772518
|
for (let i6 = start + 1;i6 < text2.length; i6++) {
|
|
772235
|
-
if (text2[i6] ===
|
|
772519
|
+
if (text2[i6] === open17)
|
|
772236
772520
|
depth++;
|
|
772237
772521
|
else if (text2[i6] === close) {
|
|
772238
772522
|
if (depth === 0) {
|
|
@@ -776445,6 +776729,43 @@ var init_PromptInputStashNotice = __esm(() => {
|
|
|
776445
776729
|
jsx_runtime436 = __toESM(require_jsx_runtime(), 1);
|
|
776446
776730
|
});
|
|
776447
776731
|
|
|
776732
|
+
// src/components/PromptInput/sanitizeBannerText.ts
|
|
776733
|
+
function stripLoneSurrogates(text2) {
|
|
776734
|
+
if (isWellFormed && isWellFormed(text2))
|
|
776735
|
+
return text2;
|
|
776736
|
+
return text2.replace(LONE_SURROGATE_RE, "");
|
|
776737
|
+
}
|
|
776738
|
+
function stripAnsiSequences(text2) {
|
|
776739
|
+
let result = text2;
|
|
776740
|
+
for (let pass2 = 0;pass2 < ANSI_STRIP_PASSES; pass2++) {
|
|
776741
|
+
const next2 = result.replace(ANSI_SEQUENCE_RE, "");
|
|
776742
|
+
if (next2 === result)
|
|
776743
|
+
break;
|
|
776744
|
+
result = next2;
|
|
776745
|
+
}
|
|
776746
|
+
return result;
|
|
776747
|
+
}
|
|
776748
|
+
function replaceControlsWithSpace(text2) {
|
|
776749
|
+
return text2.replace(CONTROL_FORMAT_RE, " ");
|
|
776750
|
+
}
|
|
776751
|
+
function sanitizeBannerText(text2) {
|
|
776752
|
+
return replaceControlsWithSpace(stripAnsiSequences(stripLoneSurrogates(text2))).replace(/ {2,}/g, " ").trim();
|
|
776753
|
+
}
|
|
776754
|
+
function clampBannerTextWidth(maxWidth) {
|
|
776755
|
+
return Math.max(1, Math.min(BANNER_TEXT_MAX_WIDTH, maxWidth - 1));
|
|
776756
|
+
}
|
|
776757
|
+
function sanitizeAndClampBannerText(text2, maxWidth) {
|
|
776758
|
+
return truncateToWidth(sanitizeBannerText(text2), clampBannerTextWidth(maxWidth));
|
|
776759
|
+
}
|
|
776760
|
+
var BANNER_TEXT_MAX_WIDTH = 24, ANSI_STRIP_PASSES = 4, ANSI_SEQUENCE_RE, LONE_SURROGATE_RE, CONTROL_FORMAT_RE, isWellFormed;
|
|
776761
|
+
var init_sanitizeBannerText = __esm(() => {
|
|
776762
|
+
init_truncate();
|
|
776763
|
+
ANSI_SEQUENCE_RE = /\x1b\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]|\x1b[\]PX^_][^\x1b\x07]*(?:\x07|\x1b\\)/g;
|
|
776764
|
+
LONE_SURROGATE_RE = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g;
|
|
776765
|
+
CONTROL_FORMAT_RE = /[\p{Cc}\p{Cf}\u2028\u2029]+/gu;
|
|
776766
|
+
isWellFormed = typeof String.prototype.isWellFormed === "function" ? Function.prototype.call.bind(String.prototype.isWellFormed) : undefined;
|
|
776767
|
+
});
|
|
776768
|
+
|
|
776448
776769
|
// src/components/PromptInput/inputPaste.ts
|
|
776449
776770
|
function maybeTruncateMessageForInput(text2, nextPasteId) {
|
|
776450
776771
|
if (text2.length <= TRUNCATION_THRESHOLD) {
|
|
@@ -778564,6 +778885,7 @@ function PromptInput({
|
|
|
778564
778885
|
})
|
|
778565
778886
|
});
|
|
778566
778887
|
}
|
|
778888
|
+
const bannerText = swarmBanner ? sanitizeAndClampBannerText(swarmBanner.text, columns) : "";
|
|
778567
778889
|
const textInputElement = isVimModeEnabled() ? /* @__PURE__ */ jsx_runtime437.jsx(VimTextInput, {
|
|
778568
778890
|
...baseProps,
|
|
778569
778891
|
initialMode: vimMode,
|
|
@@ -778593,15 +778915,15 @@ function PromptInput({
|
|
|
778593
778915
|
children: [
|
|
778594
778916
|
/* @__PURE__ */ jsx_runtime437.jsx(ThemedText, {
|
|
778595
778917
|
color: swarmBanner.bgColor,
|
|
778596
|
-
children:
|
|
778918
|
+
children: bannerText ? /* @__PURE__ */ jsx_runtime437.jsxs(jsx_runtime437.Fragment, {
|
|
778597
778919
|
children: [
|
|
778598
|
-
"\u2500".repeat(Math.max(0, columns - stringWidth(
|
|
778920
|
+
"\u2500".repeat(Math.max(0, columns - stringWidth(bannerText) - 4)),
|
|
778599
778921
|
/* @__PURE__ */ jsx_runtime437.jsxs(ThemedText, {
|
|
778600
778922
|
backgroundColor: swarmBanner.bgColor,
|
|
778601
778923
|
color: "inverseText",
|
|
778602
778924
|
children: [
|
|
778603
778925
|
" ",
|
|
778604
|
-
|
|
778926
|
+
bannerText,
|
|
778605
778927
|
" "
|
|
778606
778928
|
]
|
|
778607
778929
|
}),
|
|
@@ -778878,6 +779200,7 @@ var init_PromptInput = __esm(() => {
|
|
|
778878
779200
|
init_PromptInputModeIndicator();
|
|
778879
779201
|
init_PromptInputQueuedCommands();
|
|
778880
779202
|
init_PromptInputStashNotice();
|
|
779203
|
+
init_sanitizeBannerText();
|
|
778881
779204
|
init_useMaybeTruncateInput();
|
|
778882
779205
|
init_usePromptInputPlaceholder();
|
|
778883
779206
|
init_useShowFastIconHint();
|
|
@@ -795149,7 +795472,7 @@ function useSurveyState({
|
|
|
795149
795472
|
setState("submitted");
|
|
795150
795473
|
setTimeout(setState, hideThanksAfterMs, "closed");
|
|
795151
795474
|
}, [hideThanksAfterMs]);
|
|
795152
|
-
const
|
|
795475
|
+
const open17 = import_react293.useCallback(() => {
|
|
795153
795476
|
if (state4 !== "closed") {
|
|
795154
795477
|
return;
|
|
795155
795478
|
}
|
|
@@ -795200,7 +795523,7 @@ function useSurveyState({
|
|
|
795200
795523
|
return {
|
|
795201
795524
|
state: state4,
|
|
795202
795525
|
lastResponse,
|
|
795203
|
-
open:
|
|
795526
|
+
open: open17,
|
|
795204
795527
|
handleSelect,
|
|
795205
795528
|
handleTranscriptSelect
|
|
795206
795529
|
};
|
|
@@ -795336,7 +795659,7 @@ function useFeedbackSurvey(messages, isLoading, submitCount, surveyType = "sessi
|
|
|
795336
795659
|
const {
|
|
795337
795660
|
state: state4,
|
|
795338
795661
|
lastResponse,
|
|
795339
|
-
open:
|
|
795662
|
+
open: open17,
|
|
795340
795663
|
handleSelect,
|
|
795341
795664
|
handleTranscriptSelect
|
|
795342
795665
|
} = useSurveyState({
|
|
@@ -795417,9 +795740,9 @@ function useFeedbackSurvey(messages, isLoading, submitCount, surveyType = "sessi
|
|
|
795417
795740
|
}, [state4, isLoading, hasActivePrompt, isModelAllowed2, feedbackSurvey.timeLastShown, feedbackSurvey.submitCountAtLastAppearance, submitCount, config8.minTimeBetweenFeedbackMs, config8.minTimeBetweenGlobalFeedbackMs, config8.minUserTurnsBetweenFeedback, config8.minTimeBeforeFeedbackMs, config8.minUserTurnsBeforeFeedback, config8.probability, settingsRate]);
|
|
795418
795741
|
import_react294.useEffect(() => {
|
|
795419
795742
|
if (shouldOpen) {
|
|
795420
|
-
|
|
795743
|
+
open17();
|
|
795421
795744
|
}
|
|
795422
|
-
}, [shouldOpen,
|
|
795745
|
+
}, [shouldOpen, open17]);
|
|
795423
795746
|
return {
|
|
795424
795747
|
state: state4,
|
|
795425
795748
|
lastResponse,
|
|
@@ -795563,7 +795886,7 @@ function useMemorySurvey(messages, isLoading, hasActivePrompt = false, {
|
|
|
795563
795886
|
const {
|
|
795564
795887
|
state: state4,
|
|
795565
795888
|
lastResponse,
|
|
795566
|
-
open:
|
|
795889
|
+
open: open17,
|
|
795567
795890
|
handleSelect,
|
|
795568
795891
|
handleTranscriptSelect
|
|
795569
795892
|
} = useSurveyState({
|
|
@@ -795616,9 +795939,9 @@ function useMemorySurvey(messages, isLoading, hasActivePrompt = false, {
|
|
|
795616
795939
|
return;
|
|
795617
795940
|
}
|
|
795618
795941
|
if (Math.random() < SURVEY_PROBABILITY) {
|
|
795619
|
-
|
|
795942
|
+
open17();
|
|
795620
795943
|
}
|
|
795621
|
-
}, [enabled2, state4, isLoading, hasActivePrompt, lastAssistant, messages,
|
|
795944
|
+
}, [enabled2, state4, isLoading, hasActivePrompt, lastAssistant, messages, open17]);
|
|
795622
795945
|
return {
|
|
795623
795946
|
state: state4,
|
|
795624
795947
|
lastResponse,
|
|
@@ -795700,7 +796023,7 @@ function usePostCompactSurvey(messages, isLoading, t0, t1) {
|
|
|
795700
796023
|
const {
|
|
795701
796024
|
state: state4,
|
|
795702
796025
|
lastResponse,
|
|
795703
|
-
open:
|
|
796026
|
+
open: open17,
|
|
795704
796027
|
handleSelect
|
|
795705
796028
|
} = useSurveyState(t5);
|
|
795706
796029
|
let t6;
|
|
@@ -795732,7 +796055,7 @@ function usePostCompactSurvey(messages, isLoading, t0, t1) {
|
|
|
795732
796055
|
const currentCompactBoundaries = t8;
|
|
795733
796056
|
let t10;
|
|
795734
796057
|
let t9;
|
|
795735
|
-
if ($4[9] !== currentCompactBoundaries || $4[10] !== enabled2 || $4[11] !== gateEnabled || $4[12] !== hasActivePrompt || $4[13] !== isLoading || $4[14] !== messages || $4[15] !==
|
|
796058
|
+
if ($4[9] !== currentCompactBoundaries || $4[10] !== enabled2 || $4[11] !== gateEnabled || $4[12] !== hasActivePrompt || $4[13] !== isLoading || $4[14] !== messages || $4[15] !== open17 || $4[16] !== state4) {
|
|
795736
796059
|
t9 = () => {
|
|
795737
796060
|
if (!enabled2) {
|
|
795738
796061
|
return;
|
|
@@ -795756,7 +796079,7 @@ function usePostCompactSurvey(messages, isLoading, t0, t1) {
|
|
|
795756
796079
|
if (hasMessageAfterBoundary(messages, pendingCompactBoundaryUuid.current)) {
|
|
795757
796080
|
pendingCompactBoundaryUuid.current = null;
|
|
795758
796081
|
if (Math.random() < SURVEY_PROBABILITY2) {
|
|
795759
|
-
|
|
796082
|
+
open17();
|
|
795760
796083
|
}
|
|
795761
796084
|
return;
|
|
795762
796085
|
}
|
|
@@ -795767,14 +796090,14 @@ function usePostCompactSurvey(messages, isLoading, t0, t1) {
|
|
|
795767
796090
|
pendingCompactBoundaryUuid.current = newBoundaries[newBoundaries.length - 1];
|
|
795768
796091
|
}
|
|
795769
796092
|
};
|
|
795770
|
-
t10 = [enabled2, currentCompactBoundaries, state4, isLoading, hasActivePrompt, gateEnabled, messages,
|
|
796093
|
+
t10 = [enabled2, currentCompactBoundaries, state4, isLoading, hasActivePrompt, gateEnabled, messages, open17];
|
|
795771
796094
|
$4[9] = currentCompactBoundaries;
|
|
795772
796095
|
$4[10] = enabled2;
|
|
795773
796096
|
$4[11] = gateEnabled;
|
|
795774
796097
|
$4[12] = hasActivePrompt;
|
|
795775
796098
|
$4[13] = isLoading;
|
|
795776
796099
|
$4[14] = messages;
|
|
795777
|
-
$4[15] =
|
|
796100
|
+
$4[15] = open17;
|
|
795778
796101
|
$4[16] = state4;
|
|
795779
796102
|
$4[17] = t10;
|
|
795780
796103
|
$4[18] = t9;
|
|
@@ -801933,12 +802256,13 @@ function AlternateScreen(t0) {
|
|
|
801933
802256
|
if (!writeRaw) {
|
|
801934
802257
|
return;
|
|
801935
802258
|
}
|
|
801936
|
-
writeRaw(ENTER_ALT_SCREEN + "\x1B[2J\x1B[H" + (mouseTracking ? ENABLE_MOUSE_TRACKING : ""));
|
|
802259
|
+
writeRaw(ENTER_ALT_SCREEN + "\x1B[2J\x1B[H" + (mouseTracking ? ENABLE_MOUSE_TRACKING : "") + (ink?.nativeCursorSeq ?? ""));
|
|
801937
802260
|
ink?.setAltScreenActive(true, mouseTracking);
|
|
801938
802261
|
return () => {
|
|
801939
802262
|
ink?.setAltScreenActive(false);
|
|
801940
802263
|
ink?.clearTextSelection();
|
|
801941
|
-
|
|
802264
|
+
const cursorSeq = !ink?.hasUnmounted ? ink?.nativeCursorSeq ?? "" : "";
|
|
802265
|
+
writeRaw((mouseTracking ? DISABLE_MOUSE_TRACKING : "") + EXIT_ALT_SCREEN + cursorSeq);
|
|
801942
802266
|
};
|
|
801943
802267
|
};
|
|
801944
802268
|
t32 = [writeRaw, mouseTracking];
|
|
@@ -813815,7 +814139,7 @@ var init_claudeInChrome = __esm(() => {
|
|
|
813815
814139
|
});
|
|
813816
814140
|
|
|
813817
814141
|
// src/skills/bundled/debug.ts
|
|
813818
|
-
import { open as
|
|
814142
|
+
import { open as open17, stat as stat52 } from "fs/promises";
|
|
813819
814143
|
function registerDebugSkill() {
|
|
813820
814144
|
registerBundledSkill({
|
|
813821
814145
|
name: "debug",
|
|
@@ -813832,7 +814156,7 @@ function registerDebugSkill() {
|
|
|
813832
814156
|
const stats = await stat52(debugLogPath);
|
|
813833
814157
|
const readSize = Math.min(stats.size, TAIL_READ_BYTES);
|
|
813834
814158
|
const startOffset = stats.size - readSize;
|
|
813835
|
-
const fd2 = await
|
|
814159
|
+
const fd2 = await open17(debugLogPath, "r");
|
|
813836
814160
|
try {
|
|
813837
814161
|
const { buffer, bytesRead } = await fd2.read({
|
|
813838
814162
|
buffer: Buffer.alloc(readSize),
|
|
@@ -818337,7 +818661,7 @@ __export(exports_fetchPluginZip, {
|
|
|
818337
818661
|
DEFAULT_PLUGIN_ZIP_TIMEOUT_MS: () => DEFAULT_PLUGIN_ZIP_TIMEOUT_MS
|
|
818338
818662
|
});
|
|
818339
818663
|
import { randomUUID as randomUUID64 } from "crypto";
|
|
818340
|
-
import { mkdir as mkdir60, open as
|
|
818664
|
+
import { mkdir as mkdir60, open as open18, rm as rm14 } from "fs/promises";
|
|
818341
818665
|
import { tmpdir as tmpdir19 } from "os";
|
|
818342
818666
|
import { join as join186 } from "path";
|
|
818343
818667
|
function validatePluginZipUrl(raw) {
|
|
@@ -818353,7 +818677,7 @@ function validatePluginZipUrl(raw) {
|
|
|
818353
818677
|
return parsed;
|
|
818354
818678
|
}
|
|
818355
818679
|
async function openForWrite(path43) {
|
|
818356
|
-
const handle2 = await
|
|
818680
|
+
const handle2 = await open18(path43, "w");
|
|
818357
818681
|
return {
|
|
818358
818682
|
write: async (chunk) => {
|
|
818359
818683
|
await handle2.writeFile(chunk);
|
|
@@ -824802,14 +825126,14 @@ async function startMCPServer(cwd3, debug10, verbose) {
|
|
|
824802
825126
|
} catch (error52) {
|
|
824803
825127
|
logError2(error52);
|
|
824804
825128
|
const parts = error52 instanceof Error ? getErrorParts(error52) : [String(error52)];
|
|
824805
|
-
const
|
|
825129
|
+
const errorText2 = parts.filter(Boolean).join(`
|
|
824806
825130
|
`).trim() || "Error";
|
|
824807
825131
|
return {
|
|
824808
825132
|
isError: true,
|
|
824809
825133
|
content: [
|
|
824810
825134
|
{
|
|
824811
825135
|
type: "text",
|
|
824812
|
-
text:
|
|
825136
|
+
text: errorText2
|
|
824813
825137
|
}
|
|
824814
825138
|
]
|
|
824815
825139
|
};
|