codex-slot 0.1.21 → 0.1.22
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/status-command.js +29 -2
- package/package.json +1 -1
package/dist/status-command.js
CHANGED
|
@@ -261,6 +261,8 @@ async function handleInteractiveToggle(initialStatuses) {
|
|
|
261
261
|
enterInteractiveScreen();
|
|
262
262
|
return await new Promise((resolve) => {
|
|
263
263
|
let closed = false;
|
|
264
|
+
let refreshing = false;
|
|
265
|
+
let refreshStatusText = null;
|
|
264
266
|
const render = () => {
|
|
265
267
|
const screenWidth = process.stdout.columns ?? 80;
|
|
266
268
|
const styled = shouldUseAnsiStyle();
|
|
@@ -304,9 +306,10 @@ async function handleInteractiveToggle(initialStatuses) {
|
|
|
304
306
|
renderSectionHeader("summary", rightWidth, styled),
|
|
305
307
|
renderSummaryLine(summary, rightWidth < 42, styled),
|
|
306
308
|
`selected=${latestSnapshot.selectedName ?? "none"}`,
|
|
309
|
+
...(refreshStatusText ? [`refresh=${refreshStatusText}`] : []),
|
|
307
310
|
"",
|
|
308
311
|
renderSectionHeader("help", rightWidth, styled),
|
|
309
|
-
|
|
312
|
+
"↑/↓ move Space toggle r refresh Enter/q exit"
|
|
310
313
|
];
|
|
311
314
|
if (wideLayout) {
|
|
312
315
|
renderInteractiveScreen(renderColumns(accountLines, sideLines, 3));
|
|
@@ -340,7 +343,7 @@ async function handleInteractiveToggle(initialStatuses) {
|
|
|
340
343
|
console.log((0, text_1.bi)("已退出账号启用状态编辑。", "Exited account toggle mode."));
|
|
341
344
|
resolve();
|
|
342
345
|
};
|
|
343
|
-
const onKeypress = (_input, key) => {
|
|
346
|
+
const onKeypress = async (_input, key) => {
|
|
344
347
|
if (key.name === "up") {
|
|
345
348
|
const nextCursor = Math.max(0, cursor - 1);
|
|
346
349
|
if (nextCursor !== cursor) {
|
|
@@ -364,6 +367,30 @@ async function handleInteractiveToggle(initialStatuses) {
|
|
|
364
367
|
render();
|
|
365
368
|
return;
|
|
366
369
|
}
|
|
370
|
+
if (key.name === "r") {
|
|
371
|
+
if (refreshing) {
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
refreshing = true;
|
|
375
|
+
applyChanges();
|
|
376
|
+
refreshStatusText = "refreshing";
|
|
377
|
+
render();
|
|
378
|
+
try {
|
|
379
|
+
const refreshed = await (0, status_service_1.refreshStatusSnapshot)();
|
|
380
|
+
initialStatuses = refreshed.statuses;
|
|
381
|
+
refreshStatusText = "done";
|
|
382
|
+
}
|
|
383
|
+
catch (error) {
|
|
384
|
+
refreshStatusText = error instanceof Error ? error.message : String(error);
|
|
385
|
+
}
|
|
386
|
+
finally {
|
|
387
|
+
refreshing = false;
|
|
388
|
+
}
|
|
389
|
+
if (!closed) {
|
|
390
|
+
render();
|
|
391
|
+
}
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
367
394
|
if (key.name === "return" || key.name === "enter") {
|
|
368
395
|
exitInteractive();
|
|
369
396
|
return;
|