@cesarus777/opencode-cgp 0.4.0 → 0.4.1
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/CHANGELOG.md +29 -0
- package/README.md +14 -6
- package/dist/cli.js +506 -72
- package/dist/tui.js +1415 -702
- package/dist/types/dashboard/controller.d.ts +1 -0
- package/dist/types/dashboard/terminal.d.ts +2 -0
- package/dist/types/dashboard/terminalview.d.ts +7 -2
- package/dist/types/dashboard/view.d.ts +3 -0
- package/dist/types/historyclient.d.ts +15 -0
- package/dist/types/tui/charts.d.ts +2 -3
- package/dist/types/tui/compactformat.d.ts +12 -3
- package/dist/types/tui/historystate.d.ts +49 -0
- package/dist/types/tui/inventory.d.ts +12 -0
- package/dist/types/tui/panelcontrols.d.ts +8 -0
- package/dist/types/tui/panelformat.d.ts +12 -0
- package/dist/types/tui/panelview.d.ts +22 -0
- package/dist/types/tui/quantity.d.ts +1 -0
- package/dist/types/tui/sidebar.d.ts +0 -5
- package/dist/types/tui/state.d.ts +3 -1
- package/dist/types/tui/statusformat.d.ts +19 -0
- package/package.json +1 -1
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { DashboardRow, DashboardView } from "./view.js";
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function diagnosticRow(row: DashboardRow): string;
|
|
3
|
+
export declare function overviewHeading(width: number): string[];
|
|
4
|
+
/** Stable ID suffixes when unique; position is the bounded fallback. */
|
|
5
|
+
export declare function overviewLabels(rows: readonly DashboardRow[]): string[];
|
|
6
|
+
/** Each row is already cell-bounded; overview cards never wrap diagnostics. */
|
|
7
|
+
export declare function overviewRowLines(row: DashboardRow, width: number, selected: boolean, label: string, position: number, maxLines?: number): string[];
|
|
3
8
|
export declare const snapshotFields: readonly ["sessionId", "parentId", "agent", "model", "revision", "observedAt", "measurement.tokens", "measurement.at", "measurement.model", "measurement.provenance", "measurement.scope", "measurement.confidence", "measurement.requestId", "limits.input", "limits.context", "limits.output", "capacityTokens", "outputReserveTokens", "peakTokens", "policy.id", "policy.configured.type", "policy.configured.value", "policy.triggerTokens", "policy.comparison", "policy.reason", "policy.crossed", "compaction.phase", "compaction.count", "compaction.armed", "compaction.blockedReason", "compaction.lastAttempt", "compaction.lastCompleted", "compaction.cooldownUntil", "cumulativeScope", "cumulative.input", "cumulative.output", "cumulative.reasoning", "cumulative.cache.read", "cumulative.cache.write", "lastObservedActive", "performance.sessionCreatedAt", "performance.sessionOutputTokens", "performance.observedSince", "performance.at", "performance.status", "performance.partial", "performance.liveTps", "performance.averageModelTps", "performance.averageSessionTps", "performance.ttftMs", "performance.latestRequestTps", "performance.requestId", "performance.requestAgent", "performance.requestModel", "performance.requestOutputTokens", "performance.requestStartedAt", "performance.firstOutputAt", "performance.streamEndedAt", "performance.estimatedOutputTokens", "performance.modelOutputTokens", "performance.modelDurationMs", "performance.completedRequests", "performance.tokenSource"];
|
|
4
9
|
export declare function terminalDetail(row: DashboardRow | undefined): string[];
|
|
5
10
|
interface Observation {
|
|
@@ -11,5 +16,5 @@ export declare function historyObservations(view: DashboardView, metricIndex: nu
|
|
|
11
16
|
export declare function terminalHistory(view: DashboardView, width: number, metricIndex: number, sample: number): string[];
|
|
12
17
|
export declare const terminalHelp: string[];
|
|
13
18
|
export declare function wrapped(lines: readonly string[], width: number): string[];
|
|
14
|
-
export declare function headerLines(view: DashboardView, width: number): string[];
|
|
19
|
+
export declare function headerLines(view: DashboardView, width: number, height?: number): string[];
|
|
15
20
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { HistoryFailureReason } from "../historyclient.js";
|
|
1
2
|
import type { GuardRow } from "../family.js";
|
|
2
3
|
import type { MonitorHealth } from "../snapshot.js";
|
|
3
4
|
import type { HistoryChartResult } from "../historycharts.js";
|
|
@@ -32,6 +33,8 @@ export interface HistorySummary {
|
|
|
32
33
|
readonly averageModelTps?: number;
|
|
33
34
|
}
|
|
34
35
|
export interface DashboardHistory {
|
|
36
|
+
readonly reason?: HistoryFailureReason;
|
|
37
|
+
readonly loadedAt?: number;
|
|
35
38
|
readonly status: "idle" | "loading" | "ready" | "disabled" | "unavailable";
|
|
36
39
|
readonly windowMs: HistoryWindow;
|
|
37
40
|
readonly maxWindowMs: 604800000;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HistoryChartResult } from "./historycharts.js";
|
|
2
|
+
export type HistoryFailureReason = "unsupported" | "timeout" | "incompatible" | "rejected" | "unavailable";
|
|
3
|
+
/** Only approved codes cross the presentation boundary, never server messages. */
|
|
4
|
+
export declare class HistoryFailure extends Error {
|
|
5
|
+
readonly reason: HistoryFailureReason;
|
|
6
|
+
constructor(reason: HistoryFailureReason);
|
|
7
|
+
}
|
|
8
|
+
export declare function historyFailure(error: unknown, signal?: AbortSignal): HistoryFailure;
|
|
9
|
+
export declare function checkedHistory(value: unknown, sessionId: string): HistoryChartResult;
|
|
10
|
+
export declare function historyStatusLines(input: {
|
|
11
|
+
status: "idle" | "loading" | "ready" | "disabled" | "unavailable";
|
|
12
|
+
reason?: HistoryFailureReason;
|
|
13
|
+
stale?: boolean;
|
|
14
|
+
loadedAt?: number;
|
|
15
|
+
}): string[];
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { Plugin } from "@opencode/plugin/tui";
|
|
2
|
-
import type {
|
|
2
|
+
import type { HistoryView } from "./historystate.js";
|
|
3
3
|
export declare function HistoryCharts(props: {
|
|
4
4
|
sessionId: string;
|
|
5
5
|
windowMs: number;
|
|
6
6
|
metricIndex: number;
|
|
7
|
-
refresh: number;
|
|
8
7
|
width: number;
|
|
9
|
-
|
|
8
|
+
view: HistoryView;
|
|
10
9
|
context: Plugin.Context;
|
|
11
10
|
}): import("solid-js").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ContextSample, type ContextChartSegment } from "./contextchart.js";
|
|
2
2
|
import type { GuardRow } from "../family.js";
|
|
3
|
-
export
|
|
3
|
+
export { tokens } from "./quantity.js";
|
|
4
4
|
export declare function columns(left: string, right: string, width: number): string[];
|
|
5
5
|
export declare function progress(ratio: number | undefined, width: number): string;
|
|
6
6
|
export interface MainSection {
|
|
@@ -8,7 +8,8 @@ export interface MainSection {
|
|
|
8
8
|
readonly lines: readonly string[];
|
|
9
9
|
readonly segments?: readonly ContextChartSegment[];
|
|
10
10
|
}
|
|
11
|
-
export declare function mainSections(row: GuardRow | undefined, width: number, age: number
|
|
11
|
+
export declare function mainSections(row: GuardRow | undefined, width: number, age: number): MainSection[];
|
|
12
|
+
export declare function historySections(row: GuardRow | undefined, width: number, age: number, samples: readonly ContextSample[], chartCapacity?: number): MainSection[];
|
|
12
13
|
export declare function mainLines(row: GuardRow | undefined, width: number, age: number): string[];
|
|
13
14
|
export declare const statusSymbol: {
|
|
14
15
|
readonly running: "●";
|
|
@@ -19,12 +20,20 @@ export declare const statusSymbol: {
|
|
|
19
20
|
};
|
|
20
21
|
export declare function agentHeading(row: GuardRow, width: number): string;
|
|
21
22
|
export declare function agentLines(row: GuardRow, width: number): string[];
|
|
22
|
-
export declare function subagentTree(rows: readonly GuardRow[], sessionID: string, collapsed: ReadonlySet<string>, hideCompleted: boolean, byPressure: boolean): {
|
|
23
|
+
export declare function subagentTree(rows: readonly GuardRow[], sessionID: string, collapsed: ReadonlySet<string>, hideCompleted: boolean, byPressure: boolean, trustworthy?: boolean): {
|
|
23
24
|
all: GuardRow[];
|
|
24
25
|
visible: {
|
|
25
26
|
row: GuardRow;
|
|
26
27
|
depth: number;
|
|
27
28
|
hasChildren: boolean;
|
|
29
|
+
hidden: number;
|
|
30
|
+
attention: boolean;
|
|
28
31
|
}[];
|
|
32
|
+
grouped: number;
|
|
33
|
+
complete: boolean;
|
|
34
|
+
};
|
|
35
|
+
export declare function routeFamily(rows: readonly GuardRow[], sessionID: string): {
|
|
36
|
+
rows: GuardRow[];
|
|
37
|
+
complete: boolean;
|
|
29
38
|
};
|
|
30
39
|
export declare function statistics(rows: readonly GuardRow[], sessionID: string, complete: boolean, width: number): string[];
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { HistoryChartResult } from "../historycharts.js";
|
|
2
|
+
import { type HistoryFailureReason } from "../historyclient.js";
|
|
3
|
+
interface Query {
|
|
4
|
+
readonly location: string;
|
|
5
|
+
readonly sessionId: string;
|
|
6
|
+
readonly windowMs: number;
|
|
7
|
+
}
|
|
8
|
+
export interface HistoryView {
|
|
9
|
+
readonly status: "idle" | "loading" | "ready" | "disabled" | "unavailable";
|
|
10
|
+
readonly reason?: HistoryFailureReason;
|
|
11
|
+
readonly result?: HistoryChartResult;
|
|
12
|
+
readonly from?: number;
|
|
13
|
+
readonly to?: number;
|
|
14
|
+
readonly loadedAt?: number;
|
|
15
|
+
readonly stale: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface Options {
|
|
18
|
+
read(id: string, from: number, to: number, signal: AbortSignal): Promise<HistoryChartResult>;
|
|
19
|
+
changed(view: HistoryView): void;
|
|
20
|
+
now?: () => number;
|
|
21
|
+
schedule?: (callback: () => void, ms: number) => ReturnType<typeof setTimeout>;
|
|
22
|
+
cancel?: (timer: ReturnType<typeof setTimeout>) => void;
|
|
23
|
+
deadline?: () => AbortSignal;
|
|
24
|
+
}
|
|
25
|
+
/** One mounted chart, one retained query, one in-flight read and one queued retry. */
|
|
26
|
+
export declare class HistoryState {
|
|
27
|
+
private readonly options;
|
|
28
|
+
private query;
|
|
29
|
+
private generation;
|
|
30
|
+
private active;
|
|
31
|
+
private pending;
|
|
32
|
+
private stopped;
|
|
33
|
+
private paused;
|
|
34
|
+
private timer;
|
|
35
|
+
private view;
|
|
36
|
+
private readonly now;
|
|
37
|
+
private readonly schedule;
|
|
38
|
+
private readonly cancel;
|
|
39
|
+
constructor(options: Options);
|
|
40
|
+
setQuery(query: Query): void;
|
|
41
|
+
pause(): void;
|
|
42
|
+
resume(): void;
|
|
43
|
+
refresh(): void;
|
|
44
|
+
dispose(): void;
|
|
45
|
+
private clearTimer;
|
|
46
|
+
private publish;
|
|
47
|
+
private pump;
|
|
48
|
+
}
|
|
49
|
+
export {};
|
|
@@ -14,5 +14,17 @@ export interface Inventory {
|
|
|
14
14
|
readonly scanned: ReadonlySet<string>;
|
|
15
15
|
readonly damaged: boolean;
|
|
16
16
|
}
|
|
17
|
+
export interface InventoryStatus {
|
|
18
|
+
readonly discovered: number;
|
|
19
|
+
readonly limit: number;
|
|
20
|
+
readonly scanning: boolean;
|
|
21
|
+
readonly failed: boolean;
|
|
22
|
+
readonly damaged: boolean;
|
|
23
|
+
readonly pending: number;
|
|
24
|
+
readonly pages: number;
|
|
25
|
+
readonly complete: boolean;
|
|
26
|
+
readonly canLoadMore: boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare function inventoryStatus(inventory: Inventory | undefined, limit: number, scanning: boolean, failed: boolean): InventoryStatus;
|
|
17
29
|
export declare function discoverFamily(client: Pick<OpenCodeClient, "session">, currentId: string, signal: AbortSignal, cached: (id: string) => SessionInfo | undefined, maxNodes?: number, previous?: Inventory): Promise<Inventory>;
|
|
18
30
|
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { InventoryStatus } from "./inventory.js";
|
|
2
|
+
export declare function inventoryMessages(status: InventoryStatus): string[];
|
|
3
|
+
export interface PanelAction {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly run: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function footerActions(essential: readonly PanelAction[], optional: readonly PanelAction[], width: number): PanelAction[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GuardRow } from "../family.js";
|
|
2
|
+
export { compactionLabel, thresholdDistance, panelStatus, } from "./statusformat.js";
|
|
3
|
+
export declare const panelStatuses: {
|
|
4
|
+
readonly running: "RUNNING";
|
|
5
|
+
readonly idle: "IDLE";
|
|
6
|
+
readonly completed: "DONE";
|
|
7
|
+
readonly failed: "FAILED";
|
|
8
|
+
readonly unknown: "UNKNOWN";
|
|
9
|
+
};
|
|
10
|
+
export declare function panelSummary(row: GuardRow | undefined, width: number, age: number, compact?: boolean): string[];
|
|
11
|
+
export declare function panelRowHeading(label: string, width: number): string;
|
|
12
|
+
export declare function panelRowLines(row: GuardRow, width: number, selected: boolean): string[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Plugin } from "@opencode/plugin/tui";
|
|
2
|
+
import type { GuardRow } from "../family.js";
|
|
3
|
+
import type { ContextTrace } from "./contextchart.js";
|
|
4
|
+
export declare function PanelOverview(props: {
|
|
5
|
+
rows: readonly GuardRow[];
|
|
6
|
+
selectedId: string | undefined;
|
|
7
|
+
width: number;
|
|
8
|
+
context: Plugin.Context;
|
|
9
|
+
open: (row: GuardRow) => void;
|
|
10
|
+
}): import("solid-js").JSX.Element;
|
|
11
|
+
export declare function PanelDetails(props: {
|
|
12
|
+
row: GuardRow | undefined;
|
|
13
|
+
rows: readonly GuardRow[];
|
|
14
|
+
routeID: string;
|
|
15
|
+
familyRows: readonly GuardRow[];
|
|
16
|
+
familyComplete: boolean;
|
|
17
|
+
trace: ContextTrace;
|
|
18
|
+
width: number;
|
|
19
|
+
age: number;
|
|
20
|
+
context: Plugin.Context;
|
|
21
|
+
reasons: readonly string[];
|
|
22
|
+
}): import("solid-js").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function tokens(value: number | undefined): string;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import type { Plugin } from "@opencode/plugin/tui";
|
|
2
2
|
import type { GuardState } from "./state.js";
|
|
3
|
-
import type { GuardRow } from "../family.js";
|
|
4
3
|
export declare function GuardView(props: {
|
|
5
4
|
sessionID: string;
|
|
6
5
|
state: GuardState;
|
|
7
6
|
context: Plugin.Context;
|
|
8
7
|
width: number;
|
|
9
|
-
expanded?: boolean;
|
|
10
|
-
family?: readonly GuardRow[];
|
|
11
|
-
selectedId?: string;
|
|
12
|
-
inspectId?: string | undefined;
|
|
13
8
|
}): import("solid-js").JSX.Element;
|
|
@@ -6,14 +6,16 @@ export declare function createGuardState(context: Plugin.Context): {
|
|
|
6
6
|
update(next: string): void;
|
|
7
7
|
release(): void;
|
|
8
8
|
};
|
|
9
|
+
historyLocation(id: string): string;
|
|
9
10
|
history(id: string, from: number, to: number, signal: AbortSignal): Promise<import("../historycharts.js").HistoryChartResult>;
|
|
10
11
|
rows: (stableOrder?: readonly string[], allDescendants?: boolean) => GuardRow[];
|
|
11
12
|
contextTrace: (row: GuardRow | undefined) => import("./contextchart.js").ContextTrace;
|
|
12
13
|
dispose(): void;
|
|
13
14
|
age(id: string): number;
|
|
14
15
|
health(): import("../snapshot.js").MonitorHealth | undefined;
|
|
15
|
-
connection(): "unavailable" | "
|
|
16
|
+
connection(): "unavailable" | "incompatible" | "loading" | "live" | "reconnecting";
|
|
16
17
|
complete(): boolean;
|
|
18
|
+
inventoryStatus(): import("./inventory.js").InventoryStatus;
|
|
17
19
|
refresh(): void;
|
|
18
20
|
loadMore(): void;
|
|
19
21
|
expand(id: string): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { GuardRow } from "../family.js";
|
|
2
|
+
import type { MonitorHealth } from "../snapshot.js";
|
|
3
|
+
import type { Connection } from "./transport.js";
|
|
4
|
+
/** A stored reading's confidence is independent of its freshness and scope. */
|
|
5
|
+
export declare function freshnessLabel(row: GuardRow | undefined): string | undefined;
|
|
6
|
+
export declare function measurementLabel(row: GuardRow | undefined, ageMs?: number): string;
|
|
7
|
+
export declare function measurementExplanation(row: GuardRow): readonly string[];
|
|
8
|
+
export declare function compactionLabel(row: GuardRow | undefined, compact?: boolean): string | undefined;
|
|
9
|
+
/** Only translate reasons with established semantics; unknown codes stay in diagnostics. */
|
|
10
|
+
export declare function reasonExplanation(reason: string): string;
|
|
11
|
+
export declare const contextHistoryLegend: readonly ["Recent samples → now · ┄ threshold", "Dim = last known context"];
|
|
12
|
+
export declare function pressureLabel(row: GuardRow | undefined): string;
|
|
13
|
+
export declare function thresholdDistance(row: GuardRow | undefined, compact?: boolean): string;
|
|
14
|
+
export declare function guardStatusLines(health: MonitorHealth | undefined, compact?: boolean): readonly string[];
|
|
15
|
+
export declare function panelStatus(health: MonitorHealth | undefined): string;
|
|
16
|
+
export declare function connectionLabel(connection: Connection, compact?: boolean): string;
|
|
17
|
+
/** A client connection loss is not evidence that server enforcement stopped. */
|
|
18
|
+
export declare function connectionNotice(connection: Connection, retainedMeasurements: boolean, compact?: boolean): string | undefined;
|
|
19
|
+
export declare function monitorStatusLines(connection: Connection, health: MonitorHealth | undefined, retainedMeasurements: boolean, compact?: boolean): readonly string[];
|