@mnmal-ai/substrate-tui 1.0.0-alpha.9 → 1.0.0-beta.2
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 +23 -1
- package/dist/{app-D0y2D8WL.js → app-h4FA6Urt.js} +1078 -142
- package/dist/bin/substrate-tui.js +4 -4
- package/dist/{deps-WzqsHHiC.js → deps-CMPHUv70.js} +7 -3
- package/dist/{terminal-XfKFiD7r.js → terminal-4hKQ29CS.js} +8 -3
- package/dist/{terminal-CVX2CKWu.js → terminal-BAd8sH3d.js} +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@ Without an admin identity it is read-only.
|
|
|
9
9
|
- Free text is a natural-language question, answered by `substrate-nl` (streamed). Tab completes types, fields and values.
|
|
10
10
|
- `/ns <namespace>` switches the namespace that questions, completion and the status row use. The schema browser always lists every namespace.
|
|
11
11
|
- `/frame` shows the Substrate frame behind the last answer.
|
|
12
|
+
- `/asof <date-time>` reads relative phrases ("yesterday", "past 2 days") as of that moment, for the questions that follow. It must be ISO-8601 with an offset, e.g. `2026-10-24T23:59:59-05:00`. `/asof off` returns to the server clock, and `/asof` alone shows which is in use. `/frame` shows the clock the server read the last question against.
|
|
12
13
|
- `/schema [namespace] [type]` opens the schema browser: namespaces, then types, then fields.
|
|
13
14
|
- `/dash` shows service, traffic and engine metrics, live while open.
|
|
14
15
|
- `/doctor` runs live checks against this deployment.
|
|
@@ -16,11 +17,31 @@ Without an admin identity it is read-only.
|
|
|
16
17
|
- `/admin unlock|lock|status` unlocks or locks the admin identity. It relocks after `SUBSTRATE_TUI_ADMIN_IDLE_MINUTES` of idle time (default 15).
|
|
17
18
|
- With admin unlocked: `/drop-namespace` and `/drop-type` (preview first, then type the target to confirm), `/backfill` (write a field from a JSON file of row id → value), `/normalise` (migrate a field's aliases to canonical values), `/reindex` (re-embed the embedded types, page by page).
|
|
18
19
|
|
|
20
|
+
## Shaping answer rows (for plugin authors)
|
|
21
|
+
|
|
22
|
+
A namespace can say how its rows look in an answer, with no TUI code. Put a `tui` key in its `defineNamespace` annotations:
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
annotations: { tui: {
|
|
26
|
+
formats: { 'Item.price': 'money', 'Item.stock': 'int', 'Item.seenAt': 'date' },
|
|
27
|
+
rows: { Item: { title: 'name', tags: [{ field: 'grade', template: 'G{}' }], value: 'price',
|
|
28
|
+
details: [{ field: 'ask', label: 'ask' }, 'supplier'] } }
|
|
29
|
+
} }
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Each `Item` row then renders as a numbered line with the bold `title`, dim `tags` and the `value` right-aligned, followed by a dim `·`-joined `details` line (`ask $412.00 · Acme`). Empty values show as `—` or are left out. When the terminal is too narrow for the title to keep at least 20 columns (or 40% of the width) on that first line, the whole list stacks instead: the title alone, then `tags · value`, then the details.
|
|
33
|
+
|
|
34
|
+
- An entry is a field name or `{ field, template?, label? }`. `template` puts the formatted value where `{}` is. `label` comes before a detail, and a numeric detail is labelled with its field name by default.
|
|
35
|
+
- `formats` maps `'<Type>.<field>'` to `money` (in `currency`, default `USD`, with its usual decimal places), `int`, `number`, `pct` (the value is already a percent), `date` or `datetime` (local time). They apply wherever the value appears, including the generic `field=value` view and aggregates.
|
|
36
|
+
- Only the type's own fields can be used. An entry that follows a reference (`a.b`) is left out, as is one named `__proto__`, `constructor` or `prototype`. A long value is cut to a third of the line.
|
|
37
|
+
- A malformed block, or a malformed entry for a type, is ignored, and that type falls back to the generic view. `/frame` says what was ignored.
|
|
38
|
+
|
|
19
39
|
## Keys
|
|
20
40
|
|
|
21
41
|
- Tab completes the token under the cursor.
|
|
22
42
|
- `1`-`9` answer a clarify question.
|
|
23
43
|
- Esc cancels the newest in-flight question, or closes the open panel.
|
|
44
|
+
- PgUp / PgDn scroll the conversation; the input stays where it is. End jumps back to the bottom while scrolled up, and otherwise moves to the end of the line.
|
|
24
45
|
- ctrl+c twice exits.
|
|
25
46
|
|
|
26
47
|
## Status row
|
|
@@ -38,5 +59,6 @@ Without an admin identity it is read-only.
|
|
|
38
59
|
| `SUBSTRATE_ADMIN_KEY_PATH`, `SUBSTRATE_ADMIN_KEY_ID`, `SUBSTRATE_ADMIN_TOKEN` | Admin identity used by `/admin unlock`. |
|
|
39
60
|
| `SUBSTRATE_TUI_ADMIN_IDLE_MINUTES` | Minutes of idle before admin relocks (default 15). |
|
|
40
61
|
| `SUBSTRATE_TUI_BACKGROUND` | Background colour, `#rrggbb` or `none`. |
|
|
41
|
-
| `SUBSTRATE_TUI_CLEAR` | `0` keeps what was on screen at start. |
|
|
62
|
+
| `SUBSTRATE_TUI_CLEAR` | `0` keeps what was on screen at start (inline layout only). |
|
|
42
63
|
| `SUBSTRATE_TUI_COLOR` | `256` for terminals without 24-bit colour. |
|
|
64
|
+
| `SURFACE_FULLSCREEN` | `off` keeps the inline layout, with the conversation in the terminal's own scrollback. Default `on`. |
|