@getorrery/cells 0.0.0-stage → 0.2.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/dist/cells.d.ts +204 -0
- package/dist/el/agent.d.ts +153 -0
- package/dist/el/block.d.ts +66 -0
- package/dist/el/chrome.d.ts +240 -0
- package/dist/el/content.d.ts +299 -0
- package/dist/el/context.d.ts +99 -0
- package/dist/el/extensions.d.ts +90 -0
- package/dist/el/feedback.d.ts +98 -0
- package/dist/el/helpers.d.ts +18 -0
- package/dist/el/input.d.ts +136 -0
- package/dist/el/markdown.d.ts +10 -0
- package/dist/el/mod.d.ts +35 -0
- package/dist/el/sessions.d.ts +131 -0
- package/dist/from.d.ts +131 -0
- package/dist/golden.d.ts +31 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +4998 -0
- package/dist/open.d.ts +112 -0
- package/dist/pixel_frames.d.ts +55 -0
- package/dist/screen.d.ts +32 -0
- package/dist/session.d.ts +85 -0
- package/package.json +32 -3
- package/README.md +0 -3
package/dist/open.d.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The open UI (plan 41, decisions 0086, 0087, 0090): `chart`, `raster` and
|
|
3
|
+
* `image` drawn in cells, the text form every client shares, and placed
|
|
4
|
+
* surfaces as pane columns and band rows. Drawn from the boards
|
|
5
|
+
* (`design/harness/tui-sheet-next.js`: H1-Chrome-31/32, H1-Content-28…30).
|
|
6
|
+
*
|
|
7
|
+
* Colour never carries meaning alone (decision 0090 §5): bars and glyphs do,
|
|
8
|
+
* mono swaps colours for the patterns `░▒▓█`, and every value is printed,
|
|
9
|
+
* right-aligned in its own column.
|
|
10
|
+
*
|
|
11
|
+
* A raster's pixels are classes `fg#rrggbb` and `bg#rrggbb`: the painter
|
|
12
|
+
* reads them as truecolour, and mono never gets them.
|
|
13
|
+
*/
|
|
14
|
+
import type { Placed, Surface, SurfaceKind } from "@getorrery/protocol";
|
|
15
|
+
import { type Line } from "./cells";
|
|
16
|
+
type Chart = Extract<SurfaceKind, {
|
|
17
|
+
t: "chart";
|
|
18
|
+
}>;
|
|
19
|
+
type Raster = Extract<SurfaceKind, {
|
|
20
|
+
t: "raster";
|
|
21
|
+
}>;
|
|
22
|
+
type Image = Extract<SurfaceKind, {
|
|
23
|
+
t: "image";
|
|
24
|
+
}>;
|
|
25
|
+
/** A pane's share of the width (W0.2). */
|
|
26
|
+
export declare const PANE_SHARE = 0.25;
|
|
27
|
+
/** Under this many columns a pane folds into a band row (W0.2). */
|
|
28
|
+
export declare const PANE_MIN = 18;
|
|
29
|
+
/** A pane folds when it would leave the thread fewer columns than this (W0.2). */
|
|
30
|
+
export declare const THREAD_MIN = 40;
|
|
31
|
+
/** Band rows shown; the rest say `+N more` (W0.2). */
|
|
32
|
+
export declare const BAND_MAX = 3;
|
|
33
|
+
/** A raster's cap, in pixels (W0.2; the host refuses larger). */
|
|
34
|
+
export declare const RASTER_MAX_W = 64;
|
|
35
|
+
export declare const RASTER_MAX_H = 32;
|
|
36
|
+
/** A number as a value column prints it: whole, or to two places. */
|
|
37
|
+
export declare function num(v: number): string;
|
|
38
|
+
/** A payload's props as `[key, value]` pairs, keys sorted, strings unquoted: as `orrery_proto::surface::props_text`. */
|
|
39
|
+
export declare function propsEntries(payload: unknown): [string, string][];
|
|
40
|
+
/** {@link propsEntries} as text, one `key value` line each. */
|
|
41
|
+
export declare function propsText(payload: unknown): string;
|
|
42
|
+
/**
|
|
43
|
+
* The text form of a surface: line for line `orrery_proto::surface::text_form`,
|
|
44
|
+
* what every client shows where nothing else draws.
|
|
45
|
+
* shortcut: a non-string prop is `JSON.stringify`'d, so a float like `1.0` reads `1` where serde writes `1.0`; fine until a fixture carries one.
|
|
46
|
+
*/
|
|
47
|
+
export declare function textForm(s: Surface): string;
|
|
48
|
+
interface ChartOpts {
|
|
49
|
+
/** Dim: rewound, or its owner stopped. */
|
|
50
|
+
dim?: boolean;
|
|
51
|
+
/** No title row: a band row draws the body alone. */
|
|
52
|
+
bare?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/** A chart, in `w` cells. */
|
|
55
|
+
export declare function chart(k: Chart, w: number, m: boolean, o?: ChartOpts): Line[];
|
|
56
|
+
/**
|
|
57
|
+
* A raster: half-blocks, two pixels a cell (`▀`, top in front, bottom behind).
|
|
58
|
+
* With row labels, two rows share a cell row: the top one labelled left, the
|
|
59
|
+
* bottom one right. Mono: one pixel a cell, its legend step (or brightness)
|
|
60
|
+
* as `·░▒▓█`. Larger than 64 × 32 (refused by the host) is cut, never scaled.
|
|
61
|
+
*/
|
|
62
|
+
export declare function raster(k: Raster, w: number, m: boolean, o?: {
|
|
63
|
+
dim?: boolean;
|
|
64
|
+
}): Line[];
|
|
65
|
+
/**
|
|
66
|
+
* An image, as its `alt`: what this client shows on every terminal.
|
|
67
|
+
* shortcut: no picture, even where Kitty, iTerm2 or Sixel would show one — `@getorrery/anim` encodes RGBA but decodes no PNG or JPEG; draw it once a decoder is in.
|
|
68
|
+
*/
|
|
69
|
+
export declare function image(k: Image, w: number, m: boolean, o?: {
|
|
70
|
+
dim?: boolean;
|
|
71
|
+
}): Line[];
|
|
72
|
+
/** A placed surface as a client holds it: its node, what the host knows of it, and the surface (absent while it loads). */
|
|
73
|
+
export interface PlacedView {
|
|
74
|
+
node: string;
|
|
75
|
+
placed: Placed;
|
|
76
|
+
surface: Surface | null;
|
|
77
|
+
}
|
|
78
|
+
/** How a placed surface's body is drawn: `from.surfaceLines`, by the caller. */
|
|
79
|
+
export type Draw = (s: Surface, w: number) => Line[];
|
|
80
|
+
/** Who placed it, as drawn: an extension by its id. */
|
|
81
|
+
export declare function ownerName(owner: string): string;
|
|
82
|
+
/** Its title: the owner's, else the surface's own heading, else its id. */
|
|
83
|
+
export declare function titleOf(v: PlacedView): string;
|
|
84
|
+
/**
|
|
85
|
+
* The fallback order (decision 0086): a `custom` this client has no renderer
|
|
86
|
+
* for takes the fallback its sender stored with the placement when it carries
|
|
87
|
+
* none itself; with neither, `from` draws its text form. Every core kind is
|
|
88
|
+
* drawn natively.
|
|
89
|
+
*/
|
|
90
|
+
export declare function resolved(v: PlacedView): Surface | null;
|
|
91
|
+
/** The pane's width at `w` columns. */
|
|
92
|
+
export declare function paneWidth(w: number): number;
|
|
93
|
+
/** Whether panes fold into band rows at `w` columns, with `sides` of them open. */
|
|
94
|
+
export declare function panesFold(w: number, sides: number): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* A pane's rows, `iw` cells wide: each placed surface stacked in arrival
|
|
97
|
+
* order under its head (title and `✕`, then its owner), a stopped one dimmed
|
|
98
|
+
* with the fix.
|
|
99
|
+
*/
|
|
100
|
+
export declare function paneLines(vs: PlacedView[], iw: number, m: boolean, draw: Draw): Line[];
|
|
101
|
+
/** One row of the band: whose it is, and a one-row body `iw` cells wide. */
|
|
102
|
+
export interface BandRow {
|
|
103
|
+
owner: string;
|
|
104
|
+
body: (iw: number) => Line;
|
|
105
|
+
}
|
|
106
|
+
/** A placed surface as a band row: the first row of its body, or loading, or stopped with the fix. */
|
|
107
|
+
export declare function bandRow(v: PlacedView, m: boolean, draw: Draw): BandRow;
|
|
108
|
+
/** A pane folded into one band row (narrow): its first surface's owner, `▸`, its title, and how many more it holds. */
|
|
109
|
+
export declare function foldedRow(vs: PlacedView[], m?: boolean): BandRow;
|
|
110
|
+
/** The band: owner in a fixed column, one row each, at most {@link BAND_MAX}, then `+N more`. Empty draws nothing. */
|
|
111
|
+
export declare function bandLines(rows: BandRow[], w: number): Line[];
|
|
112
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The design's pixel mark, agent states and wordmark, as frames. **Generated**
|
|
3
|
+
* by `scripts/pixel-frames.mjs` from the ratatui client's `widgets/pixel_frames.rs`;
|
|
4
|
+
* do not edit by hand.
|
|
5
|
+
*/
|
|
6
|
+
/** One animation: its speed, its palette and its frames. */
|
|
7
|
+
export interface Anim {
|
|
8
|
+
name: string;
|
|
9
|
+
fps: number;
|
|
10
|
+
palette: readonly number[];
|
|
11
|
+
frames: readonly (readonly string[])[];
|
|
12
|
+
}
|
|
13
|
+
/** A still image: the wordmark. */
|
|
14
|
+
export interface Still {
|
|
15
|
+
palette: readonly number[];
|
|
16
|
+
rows: readonly string[];
|
|
17
|
+
}
|
|
18
|
+
export declare const SIZE = 13;
|
|
19
|
+
export declare const SMALL = 7;
|
|
20
|
+
export declare const IDLE: Anim;
|
|
21
|
+
export declare const LOADING: Anim;
|
|
22
|
+
export declare const THINKING: Anim;
|
|
23
|
+
export declare const EXECUTING: Anim;
|
|
24
|
+
export declare const WAITING: Anim;
|
|
25
|
+
export declare const DONE: Anim;
|
|
26
|
+
export declare const ERROR: Anim;
|
|
27
|
+
export declare const SMALL_IDLE: Anim;
|
|
28
|
+
export declare const SMALL_LOADING: Anim;
|
|
29
|
+
export declare const SMALL_THINKING: Anim;
|
|
30
|
+
export declare const SMALL_EXECUTING: Anim;
|
|
31
|
+
export declare const SMALL_WAITING: Anim;
|
|
32
|
+
export declare const SMALL_DONE: Anim;
|
|
33
|
+
export declare const SMALL_ERROR: Anim;
|
|
34
|
+
export declare const WORDMARK_SM: Still;
|
|
35
|
+
export declare const WORDMARK_LG: Still;
|
|
36
|
+
export declare const LIGHT_IDLE: Anim;
|
|
37
|
+
export declare const LIGHT_LOADING: Anim;
|
|
38
|
+
export declare const LIGHT_THINKING: Anim;
|
|
39
|
+
export declare const LIGHT_EXECUTING: Anim;
|
|
40
|
+
export declare const LIGHT_WAITING: Anim;
|
|
41
|
+
export declare const LIGHT_DONE: Anim;
|
|
42
|
+
export declare const LIGHT_ERROR: Anim;
|
|
43
|
+
export declare const LIGHT_SMALL_IDLE: Anim;
|
|
44
|
+
export declare const LIGHT_SMALL_LOADING: Anim;
|
|
45
|
+
export declare const LIGHT_SMALL_THINKING: Anim;
|
|
46
|
+
export declare const LIGHT_SMALL_EXECUTING: Anim;
|
|
47
|
+
export declare const LIGHT_SMALL_WAITING: Anim;
|
|
48
|
+
export declare const LIGHT_SMALL_DONE: Anim;
|
|
49
|
+
export declare const LIGHT_SMALL_ERROR: Anim;
|
|
50
|
+
export declare const LIGHT_WORDMARK_SM: Still;
|
|
51
|
+
export declare const LIGHT_WORDMARK_LG: Still;
|
|
52
|
+
export declare const STATES: readonly Anim[];
|
|
53
|
+
export declare const SMALL_STATES: readonly Anim[];
|
|
54
|
+
export declare const LIGHT_STATES: readonly Anim[];
|
|
55
|
+
export declare const LIGHT_SMALL_STATES: readonly Anim[];
|
package/dist/screen.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The fullscreen layout: `banner (as the thread's first item) → thread → dock
|
|
3
|
+
* → consent → input → footer` — port of `harness/clients/cells/src/screen.rs`.
|
|
4
|
+
*
|
|
5
|
+
* Everything under the thread keeps its rows; the thread gets the rest. The
|
|
6
|
+
* last column is the scroll track, reserved whether or not it shows. A block
|
|
7
|
+
* that starts above the view (the banner's logo) is cut to blank rows rather
|
|
8
|
+
* than drawn half.
|
|
9
|
+
*/
|
|
10
|
+
import { type Item } from "./cells";
|
|
11
|
+
import { type FooterView } from "./el/chrome";
|
|
12
|
+
/** One element in a region: its id and its props. */
|
|
13
|
+
export interface Part {
|
|
14
|
+
el: string;
|
|
15
|
+
props?: unknown;
|
|
16
|
+
}
|
|
17
|
+
/** A whole screen. */
|
|
18
|
+
export interface ScreenView {
|
|
19
|
+
thread?: Part[];
|
|
20
|
+
dock?: Part[];
|
|
21
|
+
consent?: Part[];
|
|
22
|
+
input?: Part[];
|
|
23
|
+
footer?: FooterView | null;
|
|
24
|
+
/** Scrolled up: the first row in view and how many items arrived below. */
|
|
25
|
+
scroll?: [number, number] | null;
|
|
26
|
+
}
|
|
27
|
+
/** Where the scroll thumb sits: first row and length, for a view of `th` rows starting at `top` over `total` rows. */
|
|
28
|
+
export declare function thumb(top: number, th: number, total: number): [number, number];
|
|
29
|
+
/** The thread's rows at `cw` columns, blocks expanded into the rows they cover. */
|
|
30
|
+
export declare function threadRows(ps: Part[], cw: number, m: boolean): Item[];
|
|
31
|
+
/** Fill `w × h` with the screen's regions. */
|
|
32
|
+
export declare function compose(s: ScreenView, w: number, h: number, m: boolean): Item[];
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A cloud session's live changes and its setup, as cells (platform plan 07,
|
|
3
|
+
* decision 0046) — port of `harness/clients/cells/src/session.rs`.
|
|
4
|
+
*
|
|
5
|
+
* Neither is a UI node the host declares: both come off the session's own
|
|
6
|
+
* events. `orrery.session.changes` is kept by the store (`changes`);
|
|
7
|
+
* `orrery.session.setup` is not, so a client folds each body into a
|
|
8
|
+
* {@link SetupView} as it arrives. Whether the work was pushed, and the PR it
|
|
9
|
+
* opened, is read off the git tool calls in the transcript ({@link gitOutcome}).
|
|
10
|
+
*/
|
|
11
|
+
import type { TurnView } from "@getorrery/client";
|
|
12
|
+
import type { FileChange, SessionChanges } from "@getorrery/protocol";
|
|
13
|
+
import { type Line, type ToolState } from "./cells";
|
|
14
|
+
/** The `Custom` name setup progress rides under (decision 0046 §3). */
|
|
15
|
+
export declare const SETUP_EVENT = "orrery.session.setup";
|
|
16
|
+
/** How many install lines the setup block keeps under its head. */
|
|
17
|
+
export declare const SETUP_TAIL = 3;
|
|
18
|
+
/** How many files the changes block lists before `… n more`. */
|
|
19
|
+
export declare const CHANGES_ROWS = 8;
|
|
20
|
+
/** One setup step the runner ran. */
|
|
21
|
+
export interface SetupStep {
|
|
22
|
+
cmd: string;
|
|
23
|
+
exitCode: number;
|
|
24
|
+
}
|
|
25
|
+
/** A container session's setup, folded from its `orrery.session.setup` events. */
|
|
26
|
+
export interface SetupView {
|
|
27
|
+
/** `resolving`, `starting`, `started`, `install`, `setup`, `self-heal`, `ready`, `hibernated`, `resumed`, `failed`; empty before the first event. */
|
|
28
|
+
phase: string;
|
|
29
|
+
image: string | null;
|
|
30
|
+
/** Started from the cache layer. */
|
|
31
|
+
fromCache: boolean;
|
|
32
|
+
/** The last install lines, oldest first, at most {@link SETUP_TAIL}. */
|
|
33
|
+
lines: string[];
|
|
34
|
+
/** The steps the setup ran, once it reported. */
|
|
35
|
+
steps: SetupStep[];
|
|
36
|
+
/** The setup's verdict, once it reported. */
|
|
37
|
+
ok: boolean | null;
|
|
38
|
+
/** The self-heal brief, when setup failed and the agent repairs it. */
|
|
39
|
+
brief: string | null;
|
|
40
|
+
/** Why it failed, in words; for `diagnosis`, the node's line (what it noticed, the limit, the key). */
|
|
41
|
+
error: string | null;
|
|
42
|
+
/** For `diagnosis`: the cause (`oom`, `disk`, `stall`, …) and whether it is an error (platform decision 0009 §5). */
|
|
43
|
+
diagnosis: {
|
|
44
|
+
cause: string;
|
|
45
|
+
error: boolean;
|
|
46
|
+
} | null;
|
|
47
|
+
/** Drawn: from the first event until the first turn starts after it (a failure stays). */
|
|
48
|
+
visible: boolean;
|
|
49
|
+
}
|
|
50
|
+
export declare function emptySetup(): SetupView;
|
|
51
|
+
/** Fold one event body in; a new view, or the same one when nothing changed. */
|
|
52
|
+
export declare function applySetup(v: SetupView, body: unknown): SetupView;
|
|
53
|
+
/** The first turn started: the block hides, unless setup failed. */
|
|
54
|
+
export declare function setupTurnStarted(v: SetupView): SetupView;
|
|
55
|
+
/** Still coming up: no turn can run yet. */
|
|
56
|
+
export declare function setupBusy(v: SetupView): boolean;
|
|
57
|
+
/** The head row's words and state. */
|
|
58
|
+
export declare function setupHead(v: SetupView): [string, ToolState];
|
|
59
|
+
/** The setup block: a tool row named `setup`, then what it ran under `⎿`. */
|
|
60
|
+
export declare function setupLines(v: SetupView, w: number, m: boolean): Line[];
|
|
61
|
+
/** What the git tools reported: pushed, and the PR it opened. */
|
|
62
|
+
export interface GitOutcome {
|
|
63
|
+
pushed: boolean;
|
|
64
|
+
pr: number | null;
|
|
65
|
+
url: string | null;
|
|
66
|
+
}
|
|
67
|
+
/** The PR number and URL in `gh pr create`'s output. */
|
|
68
|
+
export declare function prNumber(text: string): [number, string] | null;
|
|
69
|
+
/** Read the git tool calls of a transcript: the last finished `git.push` and `git.pr`. `null` when neither ran. */
|
|
70
|
+
export declare function gitOutcome(turns: readonly TurnView[]): GitOutcome | null;
|
|
71
|
+
/** What the changes block draws. */
|
|
72
|
+
export interface ChangesView {
|
|
73
|
+
/** The store's `changes` (absent before the first event). */
|
|
74
|
+
changes?: SessionChanges | null;
|
|
75
|
+
/** The machine the session runs on, for `streaming from …`. */
|
|
76
|
+
machine?: string | null;
|
|
77
|
+
/** What the git tools reported. */
|
|
78
|
+
git?: GitOutcome | null;
|
|
79
|
+
}
|
|
80
|
+
/** The files still differing from the index. */
|
|
81
|
+
export declare function changedFiles(c: SessionChanges | null | undefined): FileChange[];
|
|
82
|
+
/** The right side of the head: `pushed · PR #n`, `pushed`, or `streaming from <machine>`. */
|
|
83
|
+
export declare function changesNote(v: ChangesView): [string, string] | null;
|
|
84
|
+
/** The changes block: a head with the totals, then a row a file (at most {@link CHANGES_ROWS}). */
|
|
85
|
+
export declare function changesLines(v: ChangesView, w: number, m: boolean): Line[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getorrery/cells",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "The terminal design as cells: every harness element drawn as rows of styled cells, checked against the design's own goldens. A port of the orrery-cells crate.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/kouji-dev/orrery",
|
|
12
|
+
"directory": "harness/clients/cells-ts"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@getorrery/client": "0.2.1",
|
|
16
|
+
"@getorrery/protocol": "0.2.1"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"typescript": "^5.9.3",
|
|
20
|
+
"vitest": "^4.1.8",
|
|
21
|
+
"@types/node": "^22.10.0"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "node ../../../scripts/release/build-lib.mjs src/index.ts",
|
|
31
|
+
"typecheck": "tsc --noEmit",
|
|
32
|
+
"test": "vitest run",
|
|
33
|
+
"test:watch": "vitest"
|
|
34
|
+
}
|
|
6
35
|
}
|
package/README.md
DELETED