@cargo-ai/cli 1.0.126 → 1.0.128
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/build/commands/ai/prompt.d.ts.map +1 -1
- package/build/commands/ai/prompt.js +2 -2
- package/build/commands/ask/harness/bridgeOutput.d.ts +19 -0
- package/build/commands/ask/harness/bridgeOutput.d.ts.map +1 -0
- package/build/commands/ask/harness/bridgeOutput.js +42 -0
- package/build/commands/ask/harness/index.d.ts +3 -2
- package/build/commands/ask/harness/index.d.ts.map +1 -1
- package/build/commands/ask/harness/index.js +2 -1
- package/build/commands/ask/harness/turn.d.ts +17 -0
- package/build/commands/ask/harness/turn.d.ts.map +1 -1
- package/build/commands/ask/harness/turn.js +85 -3
- package/build/commands/ask/harness/usage.d.ts +19 -0
- package/build/commands/ask/harness/usage.d.ts.map +1 -1
- package/build/commands/ask/harness/usage.js +46 -0
- package/build/commands/ask/input/completer.d.ts +1 -1
- package/build/commands/ask/input/completer.d.ts.map +1 -1
- package/build/commands/ask/input/completer.js +2 -0
- package/build/commands/ask/input/prompt.d.ts.map +1 -1
- package/build/commands/ask/input/prompt.js +54 -8
- package/build/commands/ask/input/slash.d.ts +7 -1
- package/build/commands/ask/input/slash.d.ts.map +1 -1
- package/build/commands/ask/input/slash.js +10 -0
- package/build/commands/ask/session/index.d.ts +2 -1
- package/build/commands/ask/session/index.d.ts.map +1 -1
- package/build/commands/ask/session/index.js +2 -1
- package/build/commands/ask/session/markdown.d.ts +20 -0
- package/build/commands/ask/session/markdown.d.ts.map +1 -0
- package/build/commands/ask/session/markdown.js +451 -0
- package/build/commands/ask/session/run.d.ts.map +1 -1
- package/build/commands/ask/session/run.js +194 -12
- package/build/commands/ask/session/tree.d.ts +81 -0
- package/build/commands/ask/session/tree.d.ts.map +1 -1
- package/build/commands/ask/session/tree.js +322 -51
- package/build/commands/auth/index.js +1 -1
- package/build/commands/connection/connector.d.ts.map +1 -1
- package/build/commands/connection/connector.js +1 -1
- package/build/commands/hosting/envVar.d.ts.map +1 -1
- package/build/commands/hosting/envVar.js +15 -6
- package/build/commands/orchestration/span.js +2 -2
- package/build/commands/orchestration/trace.js +2 -2
- package/build/commands/runHandler.d.ts +1 -0
- package/build/commands/runHandler.d.ts.map +1 -1
- package/build/commands/runHandler.js +6 -3
- package/build/commands/segmentation/change.js +1 -1
- package/build/commands/workspaceManagement/user.d.ts.map +1 -1
- package/build/commands/workspaceManagement/user.js +8 -5
- package/build/utils/textWidth.d.ts +25 -0
- package/build/utils/textWidth.d.ts.map +1 -0
- package/build/utils/textWidth.js +147 -0
- package/package.json +2 -2
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How many terminal columns text takes. `length` counts UTF-16 units, which
|
|
3
|
+
* is wrong both ways: an emoji or a CJK character is one code point drawn two
|
|
4
|
+
* columns wide, and a combining mark or a variation selector is drawn in none.
|
|
5
|
+
* Every width the terminal UI lines up — wrapping, table columns, clipping a
|
|
6
|
+
* line to one row — has to use this, or a single emoji pushes the row past
|
|
7
|
+
* the edge and the next redraw starts from the wrong line.
|
|
8
|
+
*
|
|
9
|
+
* A range table rather than full Unicode East Asian Width data: it covers
|
|
10
|
+
* what a model writes (CJK, Hangul, fullwidth forms, emoji) and nothing else.
|
|
11
|
+
*/
|
|
12
|
+
export declare function textWidth(text: string): number;
|
|
13
|
+
/**
|
|
14
|
+
* Text split into what the terminal draws as one character: a code point
|
|
15
|
+
* with the zero-width marks after it (a combining accent, `U+FE0F` asking for
|
|
16
|
+
* the emoji form, a skin tone). Walk these, not code points, to lay text out.
|
|
17
|
+
*/
|
|
18
|
+
export declare function textCells(text: string): string[];
|
|
19
|
+
/** Columns one entry of `textCells` takes: 0, 1 or 2. */
|
|
20
|
+
export declare function cellWidth(cell: string): number;
|
|
21
|
+
/** The longest prefix of `text` that fits in `width` columns. */
|
|
22
|
+
export declare function sliceToWidth(text: string, width: number): string;
|
|
23
|
+
/** `text` cut to `width` columns, ending in `…` when anything was cut. */
|
|
24
|
+
export declare function clipToCells(text: string, width: number): string;
|
|
25
|
+
//# sourceMappingURL=textWidth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textWidth.d.ts","sourceRoot":"","sources":["../../src/utils/textWidth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAehD;AAED,yDAAyD;AACzD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAsB9C;AAED,iEAAiE;AACjE,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAehE;AAED,0EAA0E;AAC1E,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAM/D"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How many terminal columns text takes. `length` counts UTF-16 units, which
|
|
3
|
+
* is wrong both ways: an emoji or a CJK character is one code point drawn two
|
|
4
|
+
* columns wide, and a combining mark or a variation selector is drawn in none.
|
|
5
|
+
* Every width the terminal UI lines up — wrapping, table columns, clipping a
|
|
6
|
+
* line to one row — has to use this, or a single emoji pushes the row past
|
|
7
|
+
* the edge and the next redraw starts from the wrong line.
|
|
8
|
+
*
|
|
9
|
+
* A range table rather than full Unicode East Asian Width data: it covers
|
|
10
|
+
* what a model writes (CJK, Hangul, fullwidth forms, emoji) and nothing else.
|
|
11
|
+
*/
|
|
12
|
+
export function textWidth(text) {
|
|
13
|
+
return textCells(text).reduce((total, cell) => total + cellWidth(cell), 0);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Text split into what the terminal draws as one character: a code point
|
|
17
|
+
* with the zero-width marks after it (a combining accent, `U+FE0F` asking for
|
|
18
|
+
* the emoji form, a skin tone). Walk these, not code points, to lay text out.
|
|
19
|
+
*/
|
|
20
|
+
export function textCells(text) {
|
|
21
|
+
const cells = [];
|
|
22
|
+
for (const character of Array.from(text)) {
|
|
23
|
+
const last = cells[cells.length - 1];
|
|
24
|
+
if (last !== undefined && isZeroWidth(character) === true) {
|
|
25
|
+
cells[cells.length - 1] = `${last}${character}`;
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
cells.push(character);
|
|
29
|
+
}
|
|
30
|
+
return cells;
|
|
31
|
+
}
|
|
32
|
+
/** Columns one entry of `textCells` takes: 0, 1 or 2. */
|
|
33
|
+
export function cellWidth(cell) {
|
|
34
|
+
const base = cell.codePointAt(0);
|
|
35
|
+
if (base === undefined) {
|
|
36
|
+
return 0;
|
|
37
|
+
}
|
|
38
|
+
if (isZeroWidth(String.fromCodePoint(base)) === true) {
|
|
39
|
+
return 0;
|
|
40
|
+
}
|
|
41
|
+
// `⚠️`: a symbol that is narrow on its own is drawn as a wide emoji when
|
|
42
|
+
// `U+FE0F` follows it.
|
|
43
|
+
if (cell.includes(EMOJI_PRESENTATION) === true) {
|
|
44
|
+
return 2;
|
|
45
|
+
}
|
|
46
|
+
if (inRanges(base, DOUBLE_WIDTH) === true) {
|
|
47
|
+
return 2;
|
|
48
|
+
}
|
|
49
|
+
return 1;
|
|
50
|
+
}
|
|
51
|
+
/** The longest prefix of `text` that fits in `width` columns. */
|
|
52
|
+
export function sliceToWidth(text, width) {
|
|
53
|
+
const state = { used: 0, prefix: "" };
|
|
54
|
+
for (const cell of textCells(text)) {
|
|
55
|
+
const cells = cellWidth(cell);
|
|
56
|
+
if (state.used + cells > width) {
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
state.used += cells;
|
|
60
|
+
state.prefix += cell;
|
|
61
|
+
}
|
|
62
|
+
return state.prefix;
|
|
63
|
+
}
|
|
64
|
+
/** `text` cut to `width` columns, ending in `…` when anything was cut. */
|
|
65
|
+
export function clipToCells(text, width) {
|
|
66
|
+
if (textWidth(text) <= width) {
|
|
67
|
+
return text;
|
|
68
|
+
}
|
|
69
|
+
return `${sliceToWidth(text, Math.max(0, width - 1))}…`;
|
|
70
|
+
}
|
|
71
|
+
function isZeroWidth(character) {
|
|
72
|
+
const code = character.codePointAt(0);
|
|
73
|
+
return code !== undefined && inRanges(code, ZERO_WIDTH) === true;
|
|
74
|
+
}
|
|
75
|
+
function inRanges(code, ranges) {
|
|
76
|
+
return ranges.some(([from, to]) => code >= from && code <= to);
|
|
77
|
+
}
|
|
78
|
+
const EMOJI_PRESENTATION = "️";
|
|
79
|
+
const ZERO_WIDTH = [
|
|
80
|
+
[0x0300, 0x036f], // combining diacritical marks
|
|
81
|
+
[0x200b, 0x200f], // zero-width space, joiners, direction marks
|
|
82
|
+
[0x20d0, 0x20ff], // combining marks for symbols
|
|
83
|
+
[0xfe00, 0xfe0f], // variation selectors
|
|
84
|
+
[0x1f3fb, 0x1f3ff], // emoji skin tones, drawn into the emoji before them
|
|
85
|
+
];
|
|
86
|
+
/**
|
|
87
|
+
* East Asian Wide ranges, and the symbols Unicode draws as emoji by default
|
|
88
|
+
* (`Emoji_Presentation`) inside otherwise narrow blocks: ✅ ✨ ❌ ⭐ and the
|
|
89
|
+
* like, which terminals draw two columns wide.
|
|
90
|
+
*/
|
|
91
|
+
const DOUBLE_WIDTH = [
|
|
92
|
+
[0x1100, 0x115f], // Hangul Jamo
|
|
93
|
+
[0x231a, 0x231b], // ⌚ ⌛
|
|
94
|
+
[0x23e9, 0x23ec], // ⏩ … ⏬
|
|
95
|
+
[0x23f0, 0x23f0], // ⏰
|
|
96
|
+
[0x23f3, 0x23f3], // ⏳
|
|
97
|
+
[0x25fd, 0x25fe], // ◽ ◾
|
|
98
|
+
[0x2614, 0x2615], // ☔ ☕
|
|
99
|
+
[0x2648, 0x2653], // ♈ … ♓
|
|
100
|
+
[0x267f, 0x267f], // ♿
|
|
101
|
+
[0x2693, 0x2693], // ⚓
|
|
102
|
+
[0x26a1, 0x26a1], // ⚡
|
|
103
|
+
[0x26aa, 0x26ab], // ⚪ ⚫
|
|
104
|
+
[0x26bd, 0x26be], // ⚽ ⚾
|
|
105
|
+
[0x26c4, 0x26c5], // ⛄ ⛅
|
|
106
|
+
[0x26ce, 0x26ce], // ⛎
|
|
107
|
+
[0x26d4, 0x26d4], // ⛔
|
|
108
|
+
[0x26ea, 0x26ea], // ⛪
|
|
109
|
+
[0x26f2, 0x26f3], // ⛲ ⛳
|
|
110
|
+
[0x26f5, 0x26f5], // ⛵
|
|
111
|
+
[0x26fa, 0x26fa], // ⛺
|
|
112
|
+
[0x26fd, 0x26fd], // ⛽
|
|
113
|
+
[0x2705, 0x2705], // ✅
|
|
114
|
+
[0x270a, 0x270b], // ✊ ✋
|
|
115
|
+
[0x2728, 0x2728], // ✨
|
|
116
|
+
[0x274c, 0x274c], // ❌
|
|
117
|
+
[0x274e, 0x274e], // ❎
|
|
118
|
+
[0x2753, 0x2755], // ❓ ❔ ❕
|
|
119
|
+
[0x2757, 0x2757], // ❗
|
|
120
|
+
[0x2795, 0x2797], // ➕ ➖ ➗
|
|
121
|
+
[0x27b0, 0x27b0], // ➰
|
|
122
|
+
[0x27bf, 0x27bf], // ➿
|
|
123
|
+
[0x2b1b, 0x2b1c], // ⬛ ⬜
|
|
124
|
+
[0x2b50, 0x2b50], // ⭐
|
|
125
|
+
[0x2b55, 0x2b55], // ⭕
|
|
126
|
+
[0x2e80, 0x303e], // CJK radicals, punctuation
|
|
127
|
+
[0x3041, 0x33ff], // kana, CJK compatibility
|
|
128
|
+
[0x3400, 0x4dbf], // CJK extension A
|
|
129
|
+
[0x4e00, 0x9fff], // CJK unified ideographs
|
|
130
|
+
[0xa000, 0xa4cf], // Yi
|
|
131
|
+
[0xac00, 0xd7a3], // Hangul syllables
|
|
132
|
+
[0xf900, 0xfaff], // CJK compatibility ideographs
|
|
133
|
+
[0xfe30, 0xfe4f], // CJK compatibility forms
|
|
134
|
+
[0xff00, 0xff60], // fullwidth forms
|
|
135
|
+
[0xffe0, 0xffe6], // fullwidth signs
|
|
136
|
+
[0x1f004, 0x1f004], // 🀄
|
|
137
|
+
[0x1f0cf, 0x1f0cf], // 🃏
|
|
138
|
+
[0x1f18e, 0x1f18e], // 🆎
|
|
139
|
+
[0x1f191, 0x1f19a], // 🆑 … 🆚
|
|
140
|
+
[0x1f200, 0x1f2ff], // enclosed ideographic supplement
|
|
141
|
+
[0x1f300, 0x1f64f], // pictographs, emoticons
|
|
142
|
+
[0x1f680, 0x1f6ff], // transport and map symbols
|
|
143
|
+
[0x1f7e0, 0x1f7eb], // 🟠 … 🟫
|
|
144
|
+
[0x1f900, 0x1f9ff], // supplemental symbols and pictographs
|
|
145
|
+
[0x1fa70, 0x1faff], // symbols and pictographs extended-A
|
|
146
|
+
[0x20000, 0x3fffd], // CJK extensions B and on
|
|
147
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cargo-ai/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.128",
|
|
4
4
|
"mcpName": "io.github.getcargohq/cargo",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@ai-sdk/harness-claude-code": "1.0.148",
|
|
77
77
|
"@cargo-ai/api": "^1.0.101",
|
|
78
78
|
"@cargo-ai/app-sdk": "^1.0.11",
|
|
79
|
-
"@cargo-ai/cdk": "^1.0.
|
|
79
|
+
"@cargo-ai/cdk": "^1.0.121",
|
|
80
80
|
"@cargo-ai/types": "^1.0.103",
|
|
81
81
|
"@cargo-ai/utils": "^1.0.35",
|
|
82
82
|
"@cargo-ai/worker-sdk": "^1.0.21",
|