dsh-ssh-tui 0.3.3 → 0.3.4
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.en.md +13 -8
- package/README.md +9 -6
- package/lib/tui.js +474 -51
- package/lib/tui.js.map +1 -1
- package/lib/types/tui.d.ts +62 -1
- package/package.json +1 -1
package/lib/types/tui.d.ts
CHANGED
|
@@ -143,6 +143,17 @@ type Row = {
|
|
|
143
143
|
phase: 'active' | 'paused' | 'blocked' | 'complete' | 'cleared';
|
|
144
144
|
blockedReason?: string;
|
|
145
145
|
expanded: boolean;
|
|
146
|
+
} | {
|
|
147
|
+
kind: 'compaction';
|
|
148
|
+
compactionId: string;
|
|
149
|
+
status: 'running' | 'ok' | 'error';
|
|
150
|
+
startedAt: number;
|
|
151
|
+
endedAt?: number;
|
|
152
|
+
pruneCount: number;
|
|
153
|
+
prunedTokens: number;
|
|
154
|
+
summary?: string;
|
|
155
|
+
error?: string;
|
|
156
|
+
expanded: boolean;
|
|
146
157
|
} | {
|
|
147
158
|
kind: 'system';
|
|
148
159
|
text: string;
|
|
@@ -261,6 +272,35 @@ export interface OpenCodeSource {
|
|
|
261
272
|
* routes are recognized by their `opencode.ai` base URL.
|
|
262
273
|
*/
|
|
263
274
|
export declare function openCodeSourceFor(provider: string, llmPiAiSection: unknown): OpenCodeSource | null;
|
|
275
|
+
export type QuotaPeriod = 'hourly' | 'weekly' | 'monthly' | 'unknown';
|
|
276
|
+
export interface QuotaWindow {
|
|
277
|
+
label: string;
|
|
278
|
+
period: QuotaPeriod;
|
|
279
|
+
/** Remaining percent of the window (100 = unused). */
|
|
280
|
+
remainingPercent: number;
|
|
281
|
+
resetsAt?: string;
|
|
282
|
+
}
|
|
283
|
+
export interface QuotaSnapshot {
|
|
284
|
+
provider: string;
|
|
285
|
+
plan: string;
|
|
286
|
+
windows: QuotaWindow[];
|
|
287
|
+
}
|
|
288
|
+
export declare function remainingPercentFromUsed(usedPercent: number): number;
|
|
289
|
+
/** Cross a remaining-percent threshold from above (50 / 25 / 10 / 5). */
|
|
290
|
+
export declare function crossedQuotaThresholds(previousRemaining: number | undefined, remaining: number): number[];
|
|
291
|
+
export declare function quotaAlertText(snapshot: QuotaSnapshot, window: QuotaWindow): string;
|
|
292
|
+
/**
|
|
293
|
+
* How often to re-fetch quota, based on the tightest window.
|
|
294
|
+
* Hourly/5h: every 10 turns, every 4 when near a threshold.
|
|
295
|
+
* Weekly: every 50 turns, every 10 when near.
|
|
296
|
+
* Monthly: every 80 turns, every 20 when near.
|
|
297
|
+
*/
|
|
298
|
+
export declare function quotaRefreshEveryTurns(window: QuotaWindow | undefined): number;
|
|
299
|
+
export declare function parseSuperGrokBilling(payload: unknown): QuotaSnapshot;
|
|
300
|
+
export declare function parseOpenCodeGoQuota(payload: unknown, provider: string): QuotaSnapshot;
|
|
301
|
+
export declare function formatQuotaSnapshot(snapshot: QuotaSnapshot): string;
|
|
302
|
+
/** Tightest remaining window — used for threshold alerts. */
|
|
303
|
+
export declare function tightestQuotaWindow(snapshot: QuotaSnapshot): QuotaWindow | undefined;
|
|
264
304
|
/** Render the OpenCode Go quota payload as a transcript block. */
|
|
265
305
|
export declare function formatOpenCodeGoUsage(payload: unknown, source: OpenCodeSource): string;
|
|
266
306
|
/** Whether `text` could still grow into a recognized escape sequence. */
|
|
@@ -307,6 +347,12 @@ export declare function parseFindQuery(raw: string): {
|
|
|
307
347
|
category?: CardCategory;
|
|
308
348
|
query: string;
|
|
309
349
|
};
|
|
350
|
+
export declare function compactionHeaderText(row: {
|
|
351
|
+
status: 'running' | 'ok' | 'error';
|
|
352
|
+
pruneCount: number;
|
|
353
|
+
prunedTokens: number;
|
|
354
|
+
error?: string;
|
|
355
|
+
}): string;
|
|
310
356
|
/** Transcript rows matching a `/find` query, newest last. */
|
|
311
357
|
export declare function matchTranscriptRows(rows: readonly Row[], raw: string): Row[];
|
|
312
358
|
/** One-line note under an expanded plan strip. */
|
|
@@ -448,6 +494,12 @@ export declare class SshTui {
|
|
|
448
494
|
private paintIntervalMs;
|
|
449
495
|
private paintLink;
|
|
450
496
|
private paintProbed;
|
|
497
|
+
private sessionTitle;
|
|
498
|
+
private llmRetry;
|
|
499
|
+
private quotaSnapshot;
|
|
500
|
+
private quotaAlerted;
|
|
501
|
+
private quotaTurnsSinceRefresh;
|
|
502
|
+
private quotaRefreshInFlight;
|
|
451
503
|
private searchHits;
|
|
452
504
|
private searchIndex;
|
|
453
505
|
private searchQuery;
|
|
@@ -538,6 +590,10 @@ export declare class SshTui {
|
|
|
538
590
|
private readonly handleDisposed;
|
|
539
591
|
/** Plan-mode / command / team events that plugins merge into SessionEventMap. */
|
|
540
592
|
private handleExtensionEvent;
|
|
593
|
+
private findCompactionRow;
|
|
594
|
+
private handleCompactionEvent;
|
|
595
|
+
private handleCommandRun;
|
|
596
|
+
private handleCommandDone;
|
|
541
597
|
private handleGoalChange;
|
|
542
598
|
private handleSubagentExtensionEvent;
|
|
543
599
|
/** Fold a live subagent's own session events into that child's card. */
|
|
@@ -616,8 +672,13 @@ export declare class SshTui {
|
|
|
616
672
|
private fetchOpenCodeGoUsage;
|
|
617
673
|
/** Explain Zen metered billing instead of pretending it has a quota. */
|
|
618
674
|
private zenUsageText;
|
|
619
|
-
/** /usage and /quota:
|
|
675
|
+
/** /usage and /quota: remaining quota for the current subscription provider. */
|
|
620
676
|
private runUsageCommand;
|
|
677
|
+
private applyQuotaSnapshot;
|
|
678
|
+
private refreshQuota;
|
|
679
|
+
private fetchQuotaSnapshot;
|
|
680
|
+
private resolveSuperGrokToken;
|
|
681
|
+
private fetchJson;
|
|
621
682
|
private readonly handleData;
|
|
622
683
|
/** Handle one data chunk that may contain bracketed-paste markers. */
|
|
623
684
|
private processPasteChunk;
|