chivgent 1.1.1 → 1.1.2
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 +14 -4
- package/README.zh-CN.md +14 -4
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/repl.d.ts.map +1 -1
- package/dist/repl.js +92 -1
- package/dist/repl.js.map +1 -1
- package/dist/tui/editor-input.d.ts +10 -0
- package/dist/tui/editor-input.d.ts.map +1 -1
- package/dist/tui/editor-input.js +126 -33
- package/dist/tui/editor-input.js.map +1 -1
- package/dist/tui/editor.d.ts +1 -1
- package/dist/tui/editor.d.ts.map +1 -1
- package/dist/tui/editor.js +29 -4
- package/dist/tui/editor.js.map +1 -1
- package/dist/tui/provider-picker.d.ts +28 -0
- package/dist/tui/provider-picker.d.ts.map +1 -0
- package/dist/tui/provider-picker.js +131 -0
- package/dist/tui/provider-picker.js.map +1 -0
- package/dist/tui/welcome.d.ts +5 -4
- package/dist/tui/welcome.d.ts.map +1 -1
- package/dist/tui/welcome.js +8 -9
- package/dist/tui/welcome.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { fitLine, terminalText } from "./text.js";
|
|
2
|
+
import { EditorPainter } from "./editor.js";
|
|
3
|
+
/**
|
|
4
|
+
* Provider chooser for `/login`. It lists the same ids as `/provider` and is
|
|
5
|
+
* painted inline, so it works in the readline TUI and in the inline composer.
|
|
6
|
+
*/
|
|
7
|
+
export function providerPickerFrame(providerIds, selected, active, width, height) {
|
|
8
|
+
const cellWidth = Math.max(1, width - 1);
|
|
9
|
+
const limit = Math.max(1, Math.min(providerIds.length, height - 3));
|
|
10
|
+
const safeSelected = Math.max(0, Math.min(selected, providerIds.length - 1));
|
|
11
|
+
const start = Math.max(0, Math.min(safeSelected - limit + 1, Math.max(0, providerIds.length - limit)));
|
|
12
|
+
const visible = providerIds.slice(start, start + limit);
|
|
13
|
+
const lines = [fitLine("┌─ Select a Provider for /login", cellWidth)];
|
|
14
|
+
if (visible.length === 0) {
|
|
15
|
+
lines.push(fitLine("│ No Providers are available.", cellWidth));
|
|
16
|
+
}
|
|
17
|
+
visible.forEach((id, index) => {
|
|
18
|
+
const itemIndex = start + index;
|
|
19
|
+
const marker = itemIndex === safeSelected ? "❯" : " ";
|
|
20
|
+
const current = id === active ? "●" : "○";
|
|
21
|
+
lines.push(fitLine(`│ ${marker} ${current} ${terminalText(id)}`, cellWidth));
|
|
22
|
+
});
|
|
23
|
+
lines.push(fitLine("└─ ↑/↓ choose · Enter select · Esc cancel", cellWidth));
|
|
24
|
+
return {
|
|
25
|
+
lines,
|
|
26
|
+
cursorRow: 1 + Math.max(0, Math.min(safeSelected - start, visible.length - 1)),
|
|
27
|
+
cursorColumn: 2,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** Keyboard-only picker; Esc and Ctrl+C cancel without selecting. */
|
|
31
|
+
export class ProviderPickerController {
|
|
32
|
+
output;
|
|
33
|
+
providerIds;
|
|
34
|
+
active;
|
|
35
|
+
done;
|
|
36
|
+
selected;
|
|
37
|
+
completed = false;
|
|
38
|
+
pending = "";
|
|
39
|
+
escapeTimer;
|
|
40
|
+
painter;
|
|
41
|
+
constructor(output, providerIds, active, done) {
|
|
42
|
+
this.output = output;
|
|
43
|
+
this.providerIds = providerIds;
|
|
44
|
+
this.active = active;
|
|
45
|
+
this.done = done;
|
|
46
|
+
this.painter = new EditorPainter(output);
|
|
47
|
+
const current = providerIds.indexOf(active);
|
|
48
|
+
this.selected = current < 0 ? 0 : current;
|
|
49
|
+
}
|
|
50
|
+
get selection() { return this.providerIds[this.selected]; }
|
|
51
|
+
begin() {
|
|
52
|
+
if (this.providerIds.length === 0) {
|
|
53
|
+
this.finish(undefined);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
this.draw();
|
|
57
|
+
}
|
|
58
|
+
resized() { if (!this.completed)
|
|
59
|
+
this.draw(); }
|
|
60
|
+
receive(chunk) {
|
|
61
|
+
if (this.completed)
|
|
62
|
+
return;
|
|
63
|
+
if (this.escapeTimer !== undefined)
|
|
64
|
+
clearTimeout(this.escapeTimer);
|
|
65
|
+
this.escapeTimer = undefined;
|
|
66
|
+
this.pending += chunk.toString("utf8");
|
|
67
|
+
while (this.pending.length > 0 && !this.completed) {
|
|
68
|
+
if (this.pending.startsWith("\u001b[A") || this.pending.startsWith("\u001bOA")) {
|
|
69
|
+
this.move(-1);
|
|
70
|
+
this.pending = this.pending.slice(3);
|
|
71
|
+
}
|
|
72
|
+
else if (this.pending.startsWith("\u001b[B") || this.pending.startsWith("\u001bOB")) {
|
|
73
|
+
this.move(1);
|
|
74
|
+
this.pending = this.pending.slice(3);
|
|
75
|
+
}
|
|
76
|
+
else if (this.pending[0] === "\u001b") {
|
|
77
|
+
if (this.pending === "\u001b" || this.pending === "\u001b[" || this.pending === "\u001bO") {
|
|
78
|
+
this.escapeTimer = setTimeout(() => {
|
|
79
|
+
if (this.pending === "\u001b")
|
|
80
|
+
this.finish(undefined);
|
|
81
|
+
else {
|
|
82
|
+
this.pending = "";
|
|
83
|
+
this.draw();
|
|
84
|
+
}
|
|
85
|
+
}, 40);
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
this.pending = "";
|
|
89
|
+
this.finish(undefined);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
const key = this.pending[0] ?? "";
|
|
93
|
+
this.pending = this.pending.slice(1);
|
|
94
|
+
if (key === "\r" || key === "\n") {
|
|
95
|
+
this.finish(this.selection);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (key === "\u0003" || key === "q" || key === "Q") {
|
|
99
|
+
this.finish(undefined);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (key === "k")
|
|
103
|
+
this.move(-1);
|
|
104
|
+
if (key === "j")
|
|
105
|
+
this.move(1);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (!this.completed)
|
|
109
|
+
this.draw();
|
|
110
|
+
}
|
|
111
|
+
cancel() { this.finish(undefined); }
|
|
112
|
+
move(delta) {
|
|
113
|
+
if (this.providerIds.length === 0)
|
|
114
|
+
return;
|
|
115
|
+
this.selected = (this.selected + delta + this.providerIds.length) % this.providerIds.length;
|
|
116
|
+
}
|
|
117
|
+
draw() {
|
|
118
|
+
this.painter.render(providerPickerFrame(this.providerIds, this.selected, this.active, Math.max(8, this.output.columns ?? 80), Math.max(6, this.output.rows ?? 24)));
|
|
119
|
+
}
|
|
120
|
+
finish(provider) {
|
|
121
|
+
if (this.completed)
|
|
122
|
+
return;
|
|
123
|
+
this.completed = true;
|
|
124
|
+
if (this.escapeTimer !== undefined)
|
|
125
|
+
clearTimeout(this.escapeTimer);
|
|
126
|
+
this.escapeTimer = undefined;
|
|
127
|
+
this.painter.finish();
|
|
128
|
+
this.done(provider);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=provider-picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-picker.js","sourceRoot":"","sources":["../../src/tui/provider-picker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,aAAa,EAAuC,MAAM,aAAa,CAAC;AAEjF;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CACjC,WAA8B,EAC9B,QAAgB,EAChB,MAAc,EACd,KAAa,EACb,MAAc;IAEd,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IACzC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IACpE,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,C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AI,CAAC,WAAW,CAAC,MAAM,CAAC;IAC9F,CAAC;IAEO,IAAI;QACV,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,mBAAmB,CACrC,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,EACtC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CACpC,CAAC,CAAC;IACL,CAAC;IAEO,MAAM,CAAC,QAA4B;QACzC,IAAI,IAAI,CAAC,SAAS;YAAE,OAAO;QAC3B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS;YAAE,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACnE,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;QAC7B,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QACtB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtB,CAAC;CACF"}
|
package/dist/tui/welcome.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface WelcomeOptions {
|
|
2
2
|
readonly version: string;
|
|
3
3
|
readonly provider: string;
|
|
4
|
-
readonly model
|
|
4
|
+
readonly model?: string;
|
|
5
5
|
readonly cwd: string;
|
|
6
6
|
readonly resumed: boolean;
|
|
7
7
|
readonly signedOut: boolean;
|
|
@@ -10,9 +10,10 @@ export interface WelcomeOptions {
|
|
|
10
10
|
readonly color?: boolean;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Compact first frame:
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* Compact first frame: brand, workspace path, and one setup hint when the
|
|
14
|
+
* user must set a provider, model, or endpoint. The active provider and model
|
|
15
|
+
* are drawn under the composer. This frame never takes the alternate screen
|
|
16
|
+
* or steals scrollback.
|
|
16
17
|
*/
|
|
17
18
|
export declare function welcome(options: WelcomeOptions): string;
|
|
18
19
|
//# sourceMappingURL=welcome.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"welcome.d.ts","sourceRoot":"","sources":["../../src/tui/welcome.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"welcome.d.ts","sourceRoot":"","sources":["../../src/tui/welcome.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAKD;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,CAsBvD"}
|
package/dist/tui/welcome.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fitLine, fitLineTail } from "./text.js";
|
|
2
2
|
const COLOR = "\u001b[1;36m";
|
|
3
3
|
const RESET = "\u001b[0m";
|
|
4
4
|
/**
|
|
5
|
-
* Compact first frame:
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Compact first frame: brand, workspace path, and one setup hint when the
|
|
6
|
+
* user must set a provider, model, or endpoint. The active provider and model
|
|
7
|
+
* are drawn under the composer. This frame never takes the alternate screen
|
|
8
|
+
* or steals scrollback.
|
|
8
9
|
*/
|
|
9
10
|
export function welcome(options) {
|
|
10
11
|
const width = Math.max(1, options.width - 1);
|
|
@@ -15,13 +16,11 @@ export function welcome(options) {
|
|
|
15
16
|
: options.signedOut
|
|
16
17
|
? "Set up a Provider with /provider"
|
|
17
18
|
: undefined;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const availablePathWidth = detailsWidth - Math.min(displayWidth(details), detailsWidth - 1);
|
|
21
|
-
const pathWidth = Math.min(detailsWidth - 1, Math.max(9, availablePathWidth));
|
|
19
|
+
// The path uses the whole line: the full path when it fits, the tail when
|
|
20
|
+
// it does not. It is not shortened to ~.
|
|
22
21
|
const lines = [
|
|
23
22
|
`◆ chivgent v${options.version}${options.resumed ? " · resumed" : ""}`,
|
|
24
|
-
|
|
23
|
+
fitLineTail(options.cwd, width),
|
|
25
24
|
...(setup === undefined ? [] : [setup]),
|
|
26
25
|
];
|
|
27
26
|
return `\n${lines.map((line, index) => {
|
package/dist/tui/welcome.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"welcome.js","sourceRoot":"","sources":["../../src/tui/welcome.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"welcome.js","sourceRoot":"","sources":["../../src/tui/welcome.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAcjD,MAAM,KAAK,GAAG,cAAc,CAAC;AAC7B,MAAM,KAAK,GAAG,WAAW,CAAC;AAE1B;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,OAAuB;IAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,GA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