flavor-code 1.3.19 → 1.3.21
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/README.md +434 -434
- package/README.zh-CN.md +431 -431
- package/dist/{app-EVMUBQRE.js → app-Q4M7GLFX.js} +69 -65
- package/dist/{chunk-HJOCNKPN.js → chunk-RPFWB45Y.js} +2 -1
- package/dist/{chunk-3HWWQV2A.js → chunk-SUSLIHXO.js} +4 -0
- package/dist/{chunk-6LDYDQ3P.js → chunk-VEUSROUQ.js} +1 -1
- package/dist/{chunk-PF457XCH.js → chunk-Z62P4LL7.js} +533 -259
- package/dist/{claude-ink-3K3NG7BF.js → claude-ink-6CEG2XZZ.js} +1 -1
- package/dist/cli-main.js +26 -81
- package/dist/config/schema.d.ts +1 -1
- package/dist/desktop/main.js +640 -425
- package/dist/desktop-renderer/assets/{index-CxOMqdQf.js → index-D75ozXnZ.js} +2 -2
- package/dist/desktop-renderer/assets/{interactive-terminal-BK8GS4b3.js → interactive-terminal-CTFo4fK9.js} +1 -1
- package/dist/desktop-renderer/index.html +1 -1
- package/dist/{load-DELQW42K.js → load-4FWNXE6F.js} +1 -1
- package/dist/sdk/index.js +3 -3
- package/dist/session/store.d.ts +6 -0
- package/dist/utils/crash-guard.d.ts +9 -0
- package/dist/utils/spawn-executable.d.ts +16 -0
- package/package.json +1 -1
|
@@ -19,9 +19,9 @@ import {
|
|
|
19
19
|
thinkingWindow,
|
|
20
20
|
transcriptReducer,
|
|
21
21
|
withTimeout
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-Z62P4LL7.js";
|
|
23
23
|
import "./chunk-CIVPKHF4.js";
|
|
24
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-RPFWB45Y.js";
|
|
25
25
|
import {
|
|
26
26
|
Box_default,
|
|
27
27
|
ClockContext,
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
useStdout,
|
|
39
39
|
use_app_default,
|
|
40
40
|
use_input_default
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-SUSLIHXO.js";
|
|
42
42
|
import "./chunk-OTYFL4AG.js";
|
|
43
43
|
import {
|
|
44
44
|
execFileNoThrow
|
|
@@ -612,6 +612,16 @@ function highlightCode(source, language = void 0) {
|
|
|
612
612
|
|
|
613
613
|
// src/ui/markdown.tsx
|
|
614
614
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
615
|
+
var CODE_BLOCK_BORDER = {
|
|
616
|
+
top: "\u2500",
|
|
617
|
+
bottom: "\u2500",
|
|
618
|
+
left: " ",
|
|
619
|
+
right: " ",
|
|
620
|
+
topLeft: "\u256D",
|
|
621
|
+
topRight: "\u256E",
|
|
622
|
+
bottomLeft: "\u2570",
|
|
623
|
+
bottomRight: "\u256F"
|
|
624
|
+
};
|
|
615
625
|
function MarkdownViewInner({ text }) {
|
|
616
626
|
const stablePrefixRef = useRef2("");
|
|
617
627
|
if (!text.startsWith(stablePrefixRef.current)) stablePrefixRef.current = "";
|
|
@@ -690,35 +700,29 @@ function HeadingView({ token }) {
|
|
|
690
700
|
return /* @__PURE__ */ jsx(Text, { children: styled });
|
|
691
701
|
}
|
|
692
702
|
function CodeBlock({ token }) {
|
|
693
|
-
const { stdout } = useStdout();
|
|
694
|
-
const columns = stdout?.columns ?? 80;
|
|
695
|
-
const innerWidth = Math.max(20, columns - 6);
|
|
696
703
|
const styledSource = useMemo2(() => highlightCode(token.text, token.lang), [token.text, token.lang]);
|
|
697
704
|
const lines = useMemo2(() => styledSource.split("\n"), [styledSource]);
|
|
698
|
-
const truncated = useMemo2(() => lines.map((line) => truncateToWidth(line, innerWidth - 2)), [lines, innerWidth]);
|
|
699
705
|
const langLabel = token.lang?.trim();
|
|
700
706
|
const label = langLabel && langLabel.length > 0 ? langLabel : "code";
|
|
701
|
-
const topBarWidth = Math.max(0, columns - 4 - label.length - 4);
|
|
702
707
|
return (
|
|
703
|
-
//
|
|
704
|
-
//
|
|
705
|
-
//
|
|
706
|
-
//
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
"
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
"
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
] })
|
|
708
|
+
// Let Yoga derive the border and text width from the actual parent box.
|
|
709
|
+
// A fenced block may be nested under list indentation, and terminal
|
|
710
|
+
// resizes can change that width without changing this memoized token.
|
|
711
|
+
// Building a line from process.stdout.columns overflows those narrower
|
|
712
|
+
// parents and desynchronizes the terminal's physical auto-wrap cursor.
|
|
713
|
+
/* @__PURE__ */ jsx(
|
|
714
|
+
Box_default,
|
|
715
|
+
{
|
|
716
|
+
flexDirection: "column",
|
|
717
|
+
width: "100%",
|
|
718
|
+
paddingX: 1,
|
|
719
|
+
borderStyle: CODE_BLOCK_BORDER,
|
|
720
|
+
borderColor: "gray",
|
|
721
|
+
borderText: { content: ` ${label} `, position: "top", align: "start", offset: 1 },
|
|
722
|
+
opaque: true,
|
|
723
|
+
children: /* @__PURE__ */ jsx(Box_default, { flexDirection: "column", paddingX: 1, children: lines.map((line, i) => /* @__PURE__ */ jsx(Text, { color: "gray", wrap: "truncate-end", children: line.length > 0 ? line : " " }, i)) })
|
|
724
|
+
}
|
|
725
|
+
)
|
|
722
726
|
);
|
|
723
727
|
}
|
|
724
728
|
function BlockquoteView({ token }) {
|
|
@@ -864,29 +868,6 @@ var ANSI_RE = /\x1B\[[0-?]*[ -/]*[@-~]/g;
|
|
|
864
868
|
function stripAnsi2(value) {
|
|
865
869
|
return value.replace(ANSI_RE, "");
|
|
866
870
|
}
|
|
867
|
-
function visibleWidth(value) {
|
|
868
|
-
let width = 0;
|
|
869
|
-
for (const ch of stripAnsi2(value)) {
|
|
870
|
-
width += charWidth(ch.codePointAt(0) ?? 0);
|
|
871
|
-
}
|
|
872
|
-
return width;
|
|
873
|
-
}
|
|
874
|
-
function truncateToWidth(value, width) {
|
|
875
|
-
if (width <= 0) return "";
|
|
876
|
-
const stripped = stripAnsi2(value);
|
|
877
|
-
if (visibleWidth(stripped) <= width) return value;
|
|
878
|
-
const prefix = value.match(/^\x1B\[[0-?]*[ -/]*[@-~]*/)?.[0] ?? "";
|
|
879
|
-
const suffix = "\x1B[0m";
|
|
880
|
-
let out = "";
|
|
881
|
-
let visual = 0;
|
|
882
|
-
for (const ch of stripped) {
|
|
883
|
-
const cw = charWidth(ch.codePointAt(0) ?? 0);
|
|
884
|
-
if (visual + cw > width - 1) break;
|
|
885
|
-
out += ch;
|
|
886
|
-
visual += cw;
|
|
887
|
-
}
|
|
888
|
-
return prefix + out + "\u2026" + suffix;
|
|
889
|
-
}
|
|
890
871
|
function renderInlineText(tokens) {
|
|
891
872
|
let out = "";
|
|
892
873
|
for (const tok of tokens) {
|
|
@@ -1537,25 +1518,48 @@ ObjC.import("AppKit");
|
|
|
1537
1518
|
ObjC.import("Foundation");
|
|
1538
1519
|
ObjC.import("stdlib");
|
|
1539
1520
|
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1521
|
+
function isBridgeMethod(value, method) {
|
|
1522
|
+
return value !== null && value !== undefined
|
|
1523
|
+
&& typeof value[method] === "function";
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
try {
|
|
1527
|
+
const pasteboard = $.NSPasteboard.generalPasteboard;
|
|
1528
|
+
let data = null;
|
|
1529
|
+
if (isBridgeMethod(pasteboard, "dataForType")) {
|
|
1530
|
+
const png = pasteboard.dataForType($.NSPasteboardTypePNG);
|
|
1531
|
+
if (isBridgeMethod(png, "base64EncodedStringWithOptions")) {
|
|
1532
|
+
data = png;
|
|
1533
|
+
} else {
|
|
1534
|
+
const tiff = pasteboard.dataForType($.NSPasteboardTypeTIFF);
|
|
1535
|
+
// NSData.length is exposed by JXA as a property value, not a
|
|
1536
|
+
// callable bridge method. Probe a real NSData method so a valid
|
|
1537
|
+
// TIFF-only pasteboard item is not mistaken for ObjC nil.
|
|
1538
|
+
if (isBridgeMethod(tiff, "base64EncodedStringWithOptions")) {
|
|
1539
|
+
const representation = $.NSBitmapImageRep.imageRepWithData(tiff);
|
|
1540
|
+
if (isBridgeMethod(representation, "representationUsingTypeProperties")) {
|
|
1541
|
+
const converted = representation.representationUsingTypeProperties(
|
|
1542
|
+
$.NSBitmapImageFileTypePNG,
|
|
1543
|
+
$({})
|
|
1544
|
+
);
|
|
1545
|
+
if (isBridgeMethod(converted, "base64EncodedStringWithOptions")) {
|
|
1546
|
+
data = converted;
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1551
1550
|
}
|
|
1552
1551
|
}
|
|
1553
|
-
|
|
1554
|
-
|
|
1552
|
+
if (!data) {
|
|
1553
|
+
$.exit(3);
|
|
1554
|
+
}
|
|
1555
|
+
const encoded = data.base64EncodedStringWithOptions(0);
|
|
1556
|
+
if (!encoded) {
|
|
1557
|
+
$.exit(3);
|
|
1558
|
+
}
|
|
1559
|
+
console.log(ObjC.unwrap(encoded));
|
|
1560
|
+
} catch (error) {
|
|
1555
1561
|
$.exit(3);
|
|
1556
1562
|
}
|
|
1557
|
-
const encoded = data.base64EncodedStringWithOptions(0);
|
|
1558
|
-
console.log(ObjC.unwrap(encoded));
|
|
1559
1563
|
`.trim();
|
|
1560
1564
|
function shouldReadClipboardImage(input, key, isPasted) {
|
|
1561
1565
|
return (key.ctrl || key.meta === true) && input.toLowerCase() === "v" || isPasted && input.length === 0;
|
|
@@ -96,7 +96,8 @@ var FlavorConfigSchema = z.object({
|
|
|
96
96
|
autoStoreThreshold: z.number().int().min(0).max(12).default(11),
|
|
97
97
|
ignoreStreakLimit: z.number().int().min(2).max(100).default(5),
|
|
98
98
|
reviewAutoDismissSeconds: z.number().int().min(0).max(300).default(5),
|
|
99
|
-
|
|
99
|
+
// One candidate per task is a deliberate memory-quality boundary, not a tunable range.
|
|
100
|
+
maxCandidatesPerTask: z.literal(1).default(1),
|
|
100
101
|
retrievalTopK: z.number().int().min(1).max(20).default(5),
|
|
101
102
|
maxEntries: z.number().int().min(1).max(1e4).default(200),
|
|
102
103
|
maxEntryChars: z.number().int().min(32).max(2e4).default(1e3),
|
|
@@ -34407,6 +34407,10 @@ var Ink = class {
|
|
|
34407
34407
|
}
|
|
34408
34408
|
if (this.currentNode !== null) {
|
|
34409
34409
|
this.render(this.currentNode);
|
|
34410
|
+
if (this.rootNode.yogaNode?.getComputedWidth() !== this.terminalColumns) {
|
|
34411
|
+
this.rootNode.onComputeLayout?.();
|
|
34412
|
+
this.onRender();
|
|
34413
|
+
}
|
|
34410
34414
|
}
|
|
34411
34415
|
};
|
|
34412
34416
|
resolveExitPromise = () => {
|