@operad-io/tui 0.0.0-stage → 0.0.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.
Files changed (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +68 -2
  3. package/package.json +27 -4
  4. package/src/actions.ts +997 -0
  5. package/src/app.ts +1665 -0
  6. package/src/args.ts +198 -0
  7. package/src/autostart.ts +302 -0
  8. package/src/client.ts +478 -0
  9. package/src/discover.ts +90 -0
  10. package/src/events.ts +345 -0
  11. package/src/index.ts +11 -0
  12. package/src/layout.ts +260 -0
  13. package/src/live.ts +113 -0
  14. package/src/markdown.ts +85 -0
  15. package/src/recent.ts +40 -0
  16. package/src/sanitize.ts +18 -0
  17. package/src/state.ts +3200 -0
  18. package/src/theme.ts +525 -0
  19. package/src/themes.ts +60 -0
  20. package/src/view/index.ts +1204 -0
  21. package/src/wrap.ts +156 -0
  22. package/theme.schema.json +197 -0
  23. package/themes/LICENSE-catppuccin +21 -0
  24. package/themes/LICENSE-dracula +21 -0
  25. package/themes/LICENSE-github +21 -0
  26. package/themes/LICENSE-kanagawa +21 -0
  27. package/themes/LICENSE-nord +21 -0
  28. package/themes/LICENSE-one +20 -0
  29. package/themes/LICENSE-rose-pine +21 -0
  30. package/themes/LICENSE-solarized +20 -0
  31. package/themes/LICENSE-tokyo-night +22 -0
  32. package/themes/README.md +81 -0
  33. package/themes/catppuccin-frappe.json +19 -0
  34. package/themes/catppuccin-latte.json +19 -0
  35. package/themes/catppuccin-macchiato.json +19 -0
  36. package/themes/catppuccin-mocha.json +19 -0
  37. package/themes/dracula.json +19 -0
  38. package/themes/github-dark.json +19 -0
  39. package/themes/github-light.json +19 -0
  40. package/themes/kanagawa-dragon.json +19 -0
  41. package/themes/kanagawa-lotus.json +19 -0
  42. package/themes/kanagawa-wave.json +19 -0
  43. package/themes/nord.json +19 -0
  44. package/themes/one-dark.json +19 -0
  45. package/themes/one-light.json +19 -0
  46. package/themes/rose-pine-dawn.json +19 -0
  47. package/themes/rose-pine-main.json +19 -0
  48. package/themes/solarized-dark.json +19 -0
  49. package/themes/solarized-light.json +19 -0
  50. package/themes/tokyo-night-day.json +19 -0
  51. package/themes/tokyo-night-night.json +19 -0
  52. package/tui.schema.json +24 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yinghai Zhao
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,69 @@
1
- # Temporary Holding Version
1
+ # @operad-io/tui
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The terminal client for operad's `/v1` interface. It never opens the store and
4
+ never loads a plugin. The manual's `operad tui` section is the reference for
5
+ keys, flags and states.
6
+
7
+ ## Themes
8
+
9
+ Colours are tokens of a `TuiPalette` (`src/theme.ts`, the only file that names a
10
+ colour value): `text`, `weak`, `rule`, `accent`, `run`, `ok`, `error`,
11
+ `cancelled`, `add`, `remove`, `tint`, `code`, `background`. The built-in themes are `auto` (the default; `light` or
12
+ `dark` by the terminal's theme mode, live), `light`, `dark` (the operad app's
13
+ tokens) and `terminal` (the terminal's own 16 ANSI colours).
14
+
15
+ Popular palettes (Catppuccin, Dracula, Nord, Solarized, Tokyo Night, One,
16
+ Rosé Pine, GitHub, Kanagawa) ship as theme files in `themes/`; `themes/README.md`
17
+ has their sources, licences and contrast adjustments, and `src/themes.ts` declares
18
+ the families (`catppuccin`, `kanagawa`, ...) that follow the terminal's mode.
19
+
20
+ Choose one in `~/.operad/tui.json` (schema: `tui.schema.json`):
21
+
22
+ ```json
23
+ { "theme": "dark", "layout": "tree" }
24
+ ```
25
+ `layout` is `tree` (children nested under the first sibling in their `after`) or
26
+ `list` (one flat list); `t` switches it on an object page and saves the choice.
27
+
28
+ `operad tui --theme <name>` overrides the file for one session. An unknown name,
29
+ or a `tui.json` that cannot be read, is an error and the TUI does not start.
30
+
31
+ The `:` palette has a `theme` command. It lists the installed themes (the built-in and
32
+ shipped ones, then the files in `~/.operad/themes`); moving the selection shows each
33
+ one live, Enter keeps the one under the cursor and writes it to `tui.json` (other keys
34
+ in the file stay), and Esc puts back the theme that was in use. A choice made there
35
+ beats `--theme` for the rest of the session.
36
+
37
+ ## Hand tests (the lead runs these after a merge)
38
+
39
+ Use a scratch `OPERAD_HOME` with the `dev` plugin and some objects in it.
40
+
41
+ 1. **Live row.** Run `operad tui`. In another terminal change an object (an
42
+ action, or a new object). Its row updates within about a second; the list
43
+ keeps its cursor.
44
+ 2. **Live section.** Open an object with a live section (dot on its tab) and
45
+ leave it at the bottom. Cause new output: the section grows and follows.
46
+ Scroll up: it stops following.
47
+ 3. **Pending and Running.** Start a flow that waits for you: it appears in
48
+ Pending with no key press, and leaves it once answered.
49
+ 4. **Server lost.** Stop the `serve` (`operad serve stop`). Within a few seconds
50
+ the footer shows `no server at <url>: is `operad serve` running?`, the lists
51
+ stay, dimmed. Start `operad serve` again: the footer clears and the lists
52
+ come back without a key press.
53
+ 5. **Rotated token.** Run `operad http token rotate` while the TUI is open. After
54
+ the next change or `r` the footer says `the token was rotated: run the TUI
55
+ again or pass --token`, and nothing is retried.
56
+ 6. **Empty states.** With no waiting items Pending says `nothing waits for you`;
57
+ an object type with no objects says `no <type> yet`.
58
+ 7. **Failed section.** Open an object whose section fails (stop its source or
59
+ use the `hang` fixture section). The section shows its message and `r
60
+ retries`; `r` asks again.
61
+ 8. **Leaving.** Quit with `q`, then with Ctrl-C, then `kill -TERM <tui pid>`
62
+ (from another terminal), then `kill -INT <tui pid>`: each time the shell
63
+ prompt is back with the normal screen, a visible cursor and working echo, and
64
+ the exit code is 0.
65
+ 9. **Live tail.** Open an object whose live section has a tail (the chat
66
+ plugin's answer while it is written). The finished content stays put and the
67
+ changing part is drawn under it in the dim colour. Leave it at the bottom:
68
+ both grow and follow. Scroll up: the section stays where it is while the tail
69
+ changes. When the tail goes away, no line of it stays on screen.
package/package.json CHANGED
@@ -1,6 +1,29 @@
1
1
  {
2
2
  "name": "@operad-io/tui",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": "./src/index.ts",
7
+ "./app": "./src/app.ts",
8
+ "./view": "./src/view/index.ts"
9
+ },
10
+ "dependencies": {
11
+ "@opentui/core": "0.6.8",
12
+ "@operad-io/engine": "0.0.1"
13
+ },
14
+ "description": "operad: the terminal client (in development)",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/operad-io/operad.git",
18
+ "directory": "packages/tui"
19
+ },
20
+ "license": "MIT",
21
+ "files": [
22
+ "src",
23
+ "themes",
24
+ "theme.schema.json",
25
+ "tui.schema.json",
26
+ "README.md",
27
+ "LICENSE"
28
+ ]
29
+ }