u-foo 2.3.15 → 2.3.16
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/package.json +1 -1
- package/src/chat/agentViewController.js +12 -26
package/package.json
CHANGED
|
@@ -87,20 +87,12 @@ function createAgentViewController(options = {}) {
|
|
|
87
87
|
return clean.slice(0, normalizedWidth - 1) + "…";
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
function
|
|
91
|
-
|
|
92
|
-
const label = title ? ` ${title} ` : "";
|
|
93
|
-
const safe = stripAnsi(label).slice(0, inner);
|
|
94
|
-
return `┌${safe}${"─".repeat(Math.max(0, inner - safe.length))}┐`;
|
|
90
|
+
function horizontalLine(width = 80) {
|
|
91
|
+
return "─".repeat(Math.max(1, width));
|
|
95
92
|
}
|
|
96
93
|
|
|
97
|
-
function
|
|
98
|
-
return
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function boxMiddle(text = "", width = 80) {
|
|
102
|
-
const inner = Math.max(1, width - 2);
|
|
103
|
-
return `│${fitText(text, inner)}│`;
|
|
94
|
+
function plainLine(text = "", width = 80) {
|
|
95
|
+
return fitText(text, Math.max(1, width));
|
|
104
96
|
}
|
|
105
97
|
|
|
106
98
|
function wrapTextLine(text = "", width = 80) {
|
|
@@ -118,7 +110,7 @@ function createAgentViewController(options = {}) {
|
|
|
118
110
|
}
|
|
119
111
|
|
|
120
112
|
function getWrappedBusLogLines(width = 80) {
|
|
121
|
-
const inner = Math.max(1, width
|
|
113
|
+
const inner = Math.max(1, width);
|
|
122
114
|
const wrapped = [];
|
|
123
115
|
for (const line of busLogLines) {
|
|
124
116
|
wrapped.push(...wrapTextLine(line, inner));
|
|
@@ -136,7 +128,6 @@ function createAgentViewController(options = {}) {
|
|
|
136
128
|
const label = getAgentLabel(agentId);
|
|
137
129
|
busLogLines = [
|
|
138
130
|
`ufoo internal · ${label}`,
|
|
139
|
-
"Enter 发送 · Esc 返回 · ↓ agent bar",
|
|
140
131
|
"",
|
|
141
132
|
];
|
|
142
133
|
}
|
|
@@ -175,28 +166,23 @@ function createAgentViewController(options = {}) {
|
|
|
175
166
|
const cols = getCols();
|
|
176
167
|
const width = Math.max(20, cols);
|
|
177
168
|
const inputTop = Math.max(4, rows - 3);
|
|
178
|
-
const
|
|
179
|
-
const
|
|
180
|
-
const logContentTop = logTop + 1;
|
|
181
|
-
const logContentBottom = logBottom - 1;
|
|
169
|
+
const logContentTop = 1;
|
|
170
|
+
const logContentBottom = Math.max(logContentTop, inputTop - 1);
|
|
182
171
|
const logContentHeight = Math.max(1, logContentBottom - logContentTop + 1);
|
|
183
|
-
const label = getAgentLabel(viewingAgent);
|
|
184
172
|
|
|
185
173
|
processStdout.write("\x1b[?25l");
|
|
186
|
-
writeAt(logTop, boxTop(`ufoo internal · ${label}`, width));
|
|
187
174
|
const visibleLines = getWrappedBusLogLines(width).slice(-logContentHeight);
|
|
188
175
|
for (let i = 0; i < logContentHeight; i += 1) {
|
|
189
|
-
writeAt(logContentTop + i,
|
|
176
|
+
writeAt(logContentTop + i, plainLine(visibleLines[i] || "", width));
|
|
190
177
|
}
|
|
191
|
-
writeAt(logBottom, boxBottom(width));
|
|
192
178
|
|
|
193
|
-
writeAt(inputTop,
|
|
179
|
+
writeAt(inputTop, horizontalLine(width));
|
|
194
180
|
const viewport = getBusInputViewport(width);
|
|
195
|
-
writeAt(inputTop + 1,
|
|
196
|
-
writeAt(inputTop + 2,
|
|
181
|
+
writeAt(inputTop + 1, plainLine(`> ${viewport.text}`, width));
|
|
182
|
+
writeAt(inputTop + 2, horizontalLine(width));
|
|
197
183
|
|
|
198
184
|
renderAgentDashboard();
|
|
199
|
-
const cursorCol = clamp(
|
|
185
|
+
const cursorCol = clamp(3 + viewport.cursorCol, 1, width);
|
|
200
186
|
processStdout.write(`\x1b[${inputTop + 1};${cursorCol}H\x1b[?25h`);
|
|
201
187
|
}
|
|
202
188
|
|