opencode-courier 0.7.1 → 0.7.3
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 +31 -15
- package/dist/index.js +1 -0
- package/dist/platform/version.js +2 -2
- package/dist/tree/mascot.d.ts +50 -0
- package/dist/tree/mascot.js +171 -0
- package/dist/tree/panel.d.ts +3 -1
- package/dist/tree/panel.js +17 -3
- package/dist/tree/ports.d.ts +8 -0
- package/dist/tree/rpc-handlers.d.ts +3 -0
- package/dist/tree/rpc.d.ts +8 -0
- package/dist/tree/rpc.js +2 -0
- package/dist/tree/tui.d.ts +104 -5
- package/dist/tui.js +735 -111
- package/package.json +4 -4
package/dist/tree/tui.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { Plugin } from "@opencode/plugin/tui";
|
|
2
|
+
import { RGBA, type EasingFunctions } from "@opentui/core";
|
|
3
|
+
import { type Accessor } from "solid-js";
|
|
4
|
+
import { type MascotState, type Token } from "./mascot.js";
|
|
2
5
|
import { type Forgotten, type Row, type Stopped, type Summary, type Wait } from "./rpc.js";
|
|
3
6
|
type Context = Plugin.Context;
|
|
4
7
|
/** The events after which a summary may read differently: a turn started or ended, a request or form, a session made or removed. */
|
|
@@ -11,6 +14,62 @@ export declare const PANEL_SETTLE_MS = 1000;
|
|
|
11
14
|
export declare const PANEL = "courier-tree";
|
|
12
15
|
/** How often the panel redraws its running times and how long ago each last tool call was. */
|
|
13
16
|
export declare const TICK_MS = 1000;
|
|
17
|
+
/** The panel's animation frame: the spinner's step, and how often a flash or the bar's easing moves. */
|
|
18
|
+
export declare const FRAME_MS = 90;
|
|
19
|
+
/** How long a row's background takes to fade back from its flash after its report arrives: the report's hold. */
|
|
20
|
+
export declare const FLASH_MS = 1500;
|
|
21
|
+
/** How long the header's bar takes to grow, or shrink, to its new length. */
|
|
22
|
+
export declare const BAR_MS = 450;
|
|
23
|
+
/** Whether the panel animates: unless the TUI part's options say `"animations": false`, as the plugin API has no TUI setting for it. */
|
|
24
|
+
export declare function animationsOn(options: Readonly<Record<string, unknown>> | undefined): boolean;
|
|
25
|
+
/** A value eased over the panel's frames by OpenTUI's `Timeline`; reading it in a computation follows the frames. */
|
|
26
|
+
export type Tween = {
|
|
27
|
+
readonly value: () => number;
|
|
28
|
+
readonly done: () => boolean;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The panel's one timer: a frame every `FRAME_MS` while a tween moves or an `animates` predicate holds, every `every` while
|
|
32
|
+
* only slower ones do, none otherwise, with animations off or once the panel is gone. `frame` counts in `FRAME_MS`.
|
|
33
|
+
*/
|
|
34
|
+
export type Motion = {
|
|
35
|
+
readonly enabled: boolean;
|
|
36
|
+
readonly frame: Accessor<number>;
|
|
37
|
+
readonly animates: (when: Accessor<boolean>, every?: number) => void;
|
|
38
|
+
readonly tween: (from: number, to: number, duration: number, ease: EasingFunctions) => Tween;
|
|
39
|
+
};
|
|
40
|
+
/** The panel's `Motion`, owned by the computation it is made in. */
|
|
41
|
+
export declare function createMotion(enabled: boolean): Motion;
|
|
42
|
+
/**
|
|
43
|
+
* Each row's flash, by session, from a read of the rows to the next that finds its report turned to `reported`; not on
|
|
44
|
+
* the first read. `strength` is a row's, 1 when its report arrives down to 0; `reported` holds for `FLASH_MS` after one.
|
|
45
|
+
*/
|
|
46
|
+
export declare function createFlashes(motion: Motion, rows: Accessor<ReadonlyArray<Row>>): {
|
|
47
|
+
strength: (sessionID: string) => number;
|
|
48
|
+
reported: () => boolean;
|
|
49
|
+
};
|
|
50
|
+
/** The header bar's filled cells, eased over `BAR_MS` to its new length once it is shown, at once when it first is. */
|
|
51
|
+
export declare function createBarFill(motion: Motion, counts: Accessor<{
|
|
52
|
+
reported: number;
|
|
53
|
+
started: number;
|
|
54
|
+
}>): () => number;
|
|
55
|
+
/** True for `FLASH_MS` after a read of the tree finds a session the one before it did not have; not on the first read. */
|
|
56
|
+
export declare function createSpawns(motion: Motion, rows: Accessor<ReadonlyArray<Row> | undefined>): () => boolean;
|
|
57
|
+
/** Digby's state for the tree's rows, by `summaryLine`'s priority, unless a report or a spawn just arrived. */
|
|
58
|
+
export declare function mascotState(rows: ReadonlyArray<Row>, { reported, spawned }?: {
|
|
59
|
+
reported?: boolean | undefined;
|
|
60
|
+
spawned?: boolean | undefined;
|
|
61
|
+
}): MascotState;
|
|
62
|
+
/** What the tree's sessions do, as the header's second line says it: "1 waiting on you · 2 running"; empty with none live. */
|
|
63
|
+
export declare function countsLine(rows: ReadonlyArray<Row>): string;
|
|
64
|
+
/** The panel's size below which it shows no header glyph, so the header keeps to one line and its bar is not cut. */
|
|
65
|
+
export declare const GLYPH_ROWS = 12;
|
|
66
|
+
export declare const GLYPH_COLUMNS = 54;
|
|
67
|
+
/** The empty panel's height from which it shows the 16×16. */
|
|
68
|
+
export declare const ART_ROWS = 14;
|
|
69
|
+
/** The rows left free below the tree's last row from which the 16×16 shows there. */
|
|
70
|
+
export declare const BELOW_ROWS = 10;
|
|
71
|
+
/** `tint` over `rest` by `amount`, from 0 (all `rest`) to 1 (all `tint`). */
|
|
72
|
+
export declare function blend(tint: RGBA, rest: RGBA, amount: number): RGBA;
|
|
14
73
|
/**
|
|
15
74
|
* The status entry's text, such as "courier 1 waiting on you · 2 running · group pair 1/2"; empty when there is nothing to show.
|
|
16
75
|
* Within `maxWidth` it keeps whole parts, most important first, and counts the groups it drops: "· +2 groups".
|
|
@@ -23,17 +82,47 @@ export declare function parts(rows: ReadonlyArray<Row>, parentID: string): {
|
|
|
23
82
|
reported: number;
|
|
24
83
|
started: number;
|
|
25
84
|
};
|
|
26
|
-
/**
|
|
27
|
-
export declare function
|
|
85
|
+
/** How many of a bar's `width` cells are filled for the parts reported. */
|
|
86
|
+
export declare function filledCells({ reported, started }: {
|
|
28
87
|
reported: number;
|
|
29
88
|
started: number;
|
|
30
|
-
}, width?: number):
|
|
89
|
+
}, width?: number): number;
|
|
90
|
+
/** A bar of parts reported, `width` cells wide: "[████░░░░░░] 2/5 reported"; `filled` cells of it while it eases to its length. */
|
|
91
|
+
export declare function bar(counts: {
|
|
92
|
+
reported: number;
|
|
93
|
+
started: number;
|
|
94
|
+
}, width?: number, filled?: number): string;
|
|
31
95
|
/** What a paused session waits on, such as "asks permission: shell echo hi" or "shows a form: Web Search". */
|
|
32
96
|
export declare function waitLine(wait: Wait): string;
|
|
33
97
|
/** What a row's session is doing, its report and its group standing: "idle · reported done · group pair held". */
|
|
34
98
|
export declare function statusLine(row: Row): string;
|
|
35
|
-
/**
|
|
36
|
-
export declare function
|
|
99
|
+
/** The parts of `statusLine`, each with the row part the panel colours it as. */
|
|
100
|
+
export declare function statusParts(row: Row): {
|
|
101
|
+
text: string;
|
|
102
|
+
kind: "state" | "report" | "plain";
|
|
103
|
+
}[];
|
|
104
|
+
type Feedback<Color> = {
|
|
105
|
+
text: {
|
|
106
|
+
feedback: Record<"error" | "warning" | "success" | "info", {
|
|
107
|
+
base: Color;
|
|
108
|
+
}>;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
/** The running mark's frames, one every `FRAME_MS`. */
|
|
112
|
+
export declare const SPINNER: string[];
|
|
113
|
+
/**
|
|
114
|
+
* The one cell a row's state shows and its theme colour, the blank cell of one with no mark: this is the only place that
|
|
115
|
+
* chooses them. A running row spins through `SPINNER` at the panel's `frame`, and shows `•` with none (animations off).
|
|
116
|
+
*/
|
|
117
|
+
export declare function rowMark<Color>(row: Row, theme: Feedback<Color>, frame?: number): {
|
|
118
|
+
mark: string;
|
|
119
|
+
color: Color | undefined;
|
|
120
|
+
};
|
|
121
|
+
/** Past this fraction of its window, a session's context use is shown in the warning colour. */
|
|
122
|
+
export declare const CONTEXT_WARN = 0.8;
|
|
123
|
+
/** A leaf's activity: how long it has run, its last tool call and how long ago, its context use and its cost. */
|
|
124
|
+
export declare function activityParts(row: Row, now: number): string[];
|
|
125
|
+
export declare const activityLine: (row: Row, now: number) => string;
|
|
37
126
|
/** What a stalled session's row, or the panel of one, says of it: "a message waits in its inbox since 2m 05s, woken again in vain". */
|
|
38
127
|
export declare function stalledLine(since: number, now: number): string;
|
|
39
128
|
/** The lines a row shows under its title: an orchestrator's bar, a paused or stalled session's wait, or else a live leaf's activity. */
|
|
@@ -49,6 +138,16 @@ export declare function addTreeStatus(ctx: Context, onWaiting?: (sessionID: stri
|
|
|
49
138
|
export declare function stoppedLine({ stopped, cancelled }: Stopped): string;
|
|
50
139
|
/** The toast after a forget, as courier_cleanup reports it: forgotten, its worktree removed or already gone, or kept and why. */
|
|
51
140
|
export declare function forgottenLine(title: string, result: Forgotten): string;
|
|
141
|
+
/** The one place Digby's pixel tokens take a theme colour. */
|
|
142
|
+
export declare const digbyColours: (theme: Context["theme"]) => Record<Token, RGBA>;
|
|
143
|
+
/**
|
|
144
|
+
* A row's background at rest: the selection's while the panel has the keyboard, else one step quieter under the pointer,
|
|
145
|
+
* else none, the panel's.
|
|
146
|
+
*/
|
|
147
|
+
export declare function restBackground(theme: Context["theme"], { selected, hovered }: {
|
|
148
|
+
selected: boolean;
|
|
149
|
+
hovered: boolean;
|
|
150
|
+
}): RGBA | undefined;
|
|
52
151
|
/** The usage the `/courier` command shows for an input it does not know. */
|
|
53
152
|
export declare const USAGE = "/courier tree opens the session tree; /courier stop [session] stops a session and those under it";
|
|
54
153
|
/**
|