@getorrery/cells 0.3.2 → 0.3.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/dist/cells.d.ts +1 -1
- package/dist/el/sessions.d.ts +20 -2
- package/dist/index.js +56 -4
- package/package.json +3 -3
package/dist/cells.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export type Seg =
|
|
|
43
43
|
export type Line = Seg[];
|
|
44
44
|
/** What fills a {@link Blk}. */
|
|
45
45
|
export type Fill =
|
|
46
|
-
/** The mark, large (
|
|
46
|
+
/** The mark, large (16 × 8 cells): an animation and a state. */
|
|
47
47
|
{
|
|
48
48
|
k: "pixel";
|
|
49
49
|
anim: string;
|
package/dist/el/sessions.d.ts
CHANGED
|
@@ -45,11 +45,27 @@ export declare function sessionTree(p: SessionTreeView, w: number, m: boolean):
|
|
|
45
45
|
export interface OAuthView {
|
|
46
46
|
title: string;
|
|
47
47
|
step?: string | null;
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
/** Unused with `command`. */
|
|
49
|
+
url?: string;
|
|
50
|
+
/** Unused with `command`. */
|
|
51
|
+
code?: string;
|
|
50
52
|
/** `waiting`, `approved`, `error`, `expired`; `waiting` when absent. */
|
|
51
53
|
state?: string;
|
|
52
54
|
note?: string;
|
|
55
|
+
/** A command the person runs themselves, instead of a URL and a code. */
|
|
56
|
+
command?: string | null;
|
|
57
|
+
/** The title below 64 columns. */
|
|
58
|
+
short_title?: string | null;
|
|
59
|
+
/** The note below 64 columns. */
|
|
60
|
+
short_note?: string | null;
|
|
61
|
+
/** With `command`: what stands first, one paragraph each. */
|
|
62
|
+
lead?: string[];
|
|
63
|
+
/** With `command`: what the person must know before going on. */
|
|
64
|
+
warn?: string | null;
|
|
65
|
+
/** With `command`: the dim line above the keys. */
|
|
66
|
+
foot?: string | null;
|
|
67
|
+
/** With `command`: the key row, when a host binds other keys than the screen's own. */
|
|
68
|
+
keys?: string | null;
|
|
53
69
|
}
|
|
54
70
|
/** The URL, the code large in a heavy box, a spinner with the expiry. */
|
|
55
71
|
export declare function oauth(p: OAuthView, w: number, m: boolean): Item[];
|
|
@@ -111,6 +127,8 @@ export interface WelcomeView {
|
|
|
111
127
|
state?: string;
|
|
112
128
|
selected?: number | null;
|
|
113
129
|
warn?: string | null;
|
|
130
|
+
/** One static line under the warning, as runs of text and class. */
|
|
131
|
+
hint?: Runs;
|
|
114
132
|
}
|
|
115
133
|
/** Three suggestions, tips, and what is missing. */
|
|
116
134
|
export declare function welcome(p: WelcomeView, w: number, m: boolean): Item[];
|
package/dist/index.js
CHANGED
|
@@ -1477,6 +1477,7 @@ function banner(p, w, m) {
|
|
|
1477
1477
|
const state = p.state ?? "idle";
|
|
1478
1478
|
const tl = flag(p.trusted) ? [g(m, "\u2713", "trusted", "ok"), t(" trusted workspace", "d")] : [g(m, "\u25B2", "untrusted", "at"), t(" untrusted \xB7 tools off \xB7 /trust", "at")];
|
|
1479
1479
|
const ml = state === "loading" ? [spin("lv"), t(" resolving model\u2026", "d")] : p.model != null ? [t("model ", "d"), t(p.model, "i"), t(` \xB7 ${p.provider ?? ""}`, "d")] : [g(m, "\u25B2", "no model", "at"), t(" none \xB7 /model to pick one", "at")];
|
|
1480
|
+
const mark2 = state === "idle" ? "static" : state;
|
|
1480
1481
|
const br = p.branch ?? null;
|
|
1481
1482
|
if (w >= 64 && !m) {
|
|
1482
1483
|
const rw = w - 17;
|
|
@@ -1485,7 +1486,7 @@ function banner(p, w, m) {
|
|
|
1485
1486
|
if (br != null) where.push(t(` \u2387 ${br}`, "d"));
|
|
1486
1487
|
const last = p.error != null ? [t(`\u2717 ${p.error}`, "er")] : [t("/help \xB7 /model \xB7 /providers \xB7 ? keys", "d")];
|
|
1487
1488
|
const ls = [[], [t("orrery", "b"), t(` ${p.harness}`, "i")], [t(`harness ${versionLabel(p)}`, "d")], [], where, tl, ml, last];
|
|
1488
|
-
return [{ k: "blk", blk: { w: 17, h: 8, fill: { k: "pixel", anim: "orrery", state }, lines: ls.map((l) => fit(l, rw)) } }];
|
|
1489
|
+
return [{ k: "blk", blk: { w: 17, h: 8, fill: { k: "pixel", anim: "orrery", state: mark2 }, lines: ls.map((l) => fit(l, rw)) } }];
|
|
1489
1490
|
}
|
|
1490
1491
|
const iw = w - 4;
|
|
1491
1492
|
const body2 = [[t(p.harness, "i")], [t(trL(p.path, iw), "d2")]];
|
|
@@ -1493,7 +1494,7 @@ function banner(p, w, m) {
|
|
|
1493
1494
|
body2.push(tl);
|
|
1494
1495
|
body2.push(ml);
|
|
1495
1496
|
if (p.error != null) for (const x of wrap(`\u2717 ${p.error}`, iw)) body2.push([t(x, "er")]);
|
|
1496
|
-
const title = m ? [t("orrery", "b")] : [px(
|
|
1497
|
+
const title = m ? [t("orrery", "b")] : [px(mark2), t(" orrery", "b")];
|
|
1497
1498
|
return out(boxed(body2, w, { t: title, r: [t(versionLabel(p), "d")], c: p.error != null ? "er" : "dd" }));
|
|
1498
1499
|
}
|
|
1499
1500
|
function newPill(n, w) {
|
|
@@ -4336,14 +4337,50 @@ function sessionTree(p, w, m) {
|
|
|
4336
4337
|
else if (p.busy != null) o.push([spin("lv"), t(` ${p.busy}`, "d")]);
|
|
4337
4338
|
return out(o);
|
|
4338
4339
|
}
|
|
4340
|
+
function oauthCommand(p, command2, w, m) {
|
|
4341
|
+
const wide = w >= 64;
|
|
4342
|
+
const iw = w - 4;
|
|
4343
|
+
const state = p.state ?? "waiting";
|
|
4344
|
+
const title = !wide && p.short_title || p.title;
|
|
4345
|
+
const note = !wide && p.short_note || (p.note ?? "");
|
|
4346
|
+
const rows2 = [];
|
|
4347
|
+
const lead = () => {
|
|
4348
|
+
for (const l of p.lead ?? []) rows2.push(...para([], l, iw, "i", null));
|
|
4349
|
+
};
|
|
4350
|
+
if (state === "approved") {
|
|
4351
|
+
rows2.push([g(m, "\u2713", "done", "ok"), t(` ${note}`, "i")], []);
|
|
4352
|
+
lead();
|
|
4353
|
+
if (p.warn != null) rows2.push([], ...warnLines(p.warn, iw, m, "warn"));
|
|
4354
|
+
if (p.foot != null) rows2.push([], ...para([], p.foot, iw, "d", null));
|
|
4355
|
+
rows2.push(keys(p.keys ?? "enter continue|esc cancel", iw, 0));
|
|
4356
|
+
} else if (state === "error") {
|
|
4357
|
+
rows2.push([g(m, "\u2715", "missing", "er"), t(` ${note}`, "i")], []);
|
|
4358
|
+
lead();
|
|
4359
|
+
rows2.push(keys(p.keys ?? "r check now|esc cancel", iw, 0));
|
|
4360
|
+
} else {
|
|
4361
|
+
lead();
|
|
4362
|
+
rows2.push([]);
|
|
4363
|
+
rows2.push(...para([], wide ? "Run this in any terminal, then come back:" : "Run in any terminal, then come back:", iw, "i", null));
|
|
4364
|
+
if (wide) {
|
|
4365
|
+
const c = m ? "i" : "ac";
|
|
4366
|
+
const rule2 = "\u2501".repeat(chars(command2));
|
|
4367
|
+
rows2.push([t(`\u250F\u2501 ${rule2} \u2501\u2513`, c)], [t("\u2503 ", c), t(command2, "b"), t(" \u2503", c)], [t(`\u2517\u2501 ${rule2} \u2501\u251B`, c)]);
|
|
4368
|
+
} else rows2.push([t(command2, "b")]);
|
|
4369
|
+
rows2.push([], [spin("lv"), t(` ${note}`, "d")]);
|
|
4370
|
+
rows2.push(keys(p.keys ?? (wide ? "c copy command|r check now|esc cancel" : "c copy|r check|esc cancel"), iw, 0));
|
|
4371
|
+
}
|
|
4372
|
+
return out(ov(rows2, w, m, title, p.step ?? null));
|
|
4373
|
+
}
|
|
4339
4374
|
function oauth(p, w, m) {
|
|
4375
|
+
if (p.command != null) return oauthCommand(p, p.command, w, m);
|
|
4340
4376
|
const state = p.state ?? "waiting";
|
|
4341
4377
|
const note = p.note ?? "";
|
|
4342
|
-
const
|
|
4378
|
+
const codeText = p.code ?? "";
|
|
4379
|
+
const code = w >= 64 ? Array.from(codeText).join(" ") : codeText;
|
|
4343
4380
|
const expired = state === "expired";
|
|
4344
4381
|
const cw = chars(code) + 4;
|
|
4345
4382
|
const cb = boxed([[t(code, "b")]], cw, { k: "heavy", c: expired ? "dd" : m ? "i" : "ac" });
|
|
4346
|
-
const rows2 = [[t("Open this URL on any device:", "i")], [t(p.url, "u ac")], []];
|
|
4383
|
+
const rows2 = [[t("Open this URL on any device:", "i")], [t(p.url ?? "", "u ac")], []];
|
|
4347
4384
|
rows2.push(...cb.map((l) => center(l, w - 4)));
|
|
4348
4385
|
rows2.push([]);
|
|
4349
4386
|
if (state === "approved") rows2.push([g(m, "\u2713", "done", "ok"), t(` ${note}`, "i")]);
|
|
@@ -4457,6 +4494,20 @@ function trust(p, w, m) {
|
|
|
4457
4494
|
o.push(keys(`1-${opts.length} pick|enter confirm|esc exit`, w, 4));
|
|
4458
4495
|
return out(o);
|
|
4459
4496
|
}
|
|
4497
|
+
function hintLines(hint, w) {
|
|
4498
|
+
const rows2 = [];
|
|
4499
|
+
let row3 = [sp(2)];
|
|
4500
|
+
for (const [text2, cls2] of hint) {
|
|
4501
|
+
if (row3.length > 1 && len(row3) + chars(text2) > w) {
|
|
4502
|
+
rows2.push(row3);
|
|
4503
|
+
row3 = [sp(2), t(text2.trimStart(), cls2)];
|
|
4504
|
+
} else {
|
|
4505
|
+
row3.push(t(text2, cls2));
|
|
4506
|
+
}
|
|
4507
|
+
}
|
|
4508
|
+
rows2.push(row3);
|
|
4509
|
+
return rows2;
|
|
4510
|
+
}
|
|
4460
4511
|
function welcome(p, w, m) {
|
|
4461
4512
|
const state = p.state ?? "ready";
|
|
4462
4513
|
const o = [fit([t("Try", "b")], w)];
|
|
@@ -4478,6 +4529,7 @@ function welcome(p, w, m) {
|
|
|
4478
4529
|
o.push([]);
|
|
4479
4530
|
o.push(...warnLines(p.warn, w, m, "warn"));
|
|
4480
4531
|
}
|
|
4532
|
+
if ((p.hint ?? []).length > 0) o.push(...hintLines(p.hint ?? [], w));
|
|
4481
4533
|
return out(o);
|
|
4482
4534
|
}
|
|
4483
4535
|
function themeSample(w, m) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getorrery/cells",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
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
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"directory": "harness/clients/cells-ts"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@getorrery/
|
|
16
|
-
"@getorrery/
|
|
15
|
+
"@getorrery/protocol": "0.3.3",
|
|
16
|
+
"@getorrery/client": "0.3.3"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"typescript": "^5.9.3",
|