@filsilva/helios-cli 0.10.0

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 (39) hide show
  1. package/README.md +171 -0
  2. package/bin/helios.js +34 -0
  3. package/dist/client/assets/HeliosSessionWorker.browser-BYYjDIKH.js +3 -0
  4. package/dist/client/assets/HeliosSessionWorker.browser-BYYjDIKH.js.map +1 -0
  5. package/dist/client/assets/d3force3dWorker-BKANL9of.js +2 -0
  6. package/dist/client/assets/d3force3dWorker-BKANL9of.js.map +1 -0
  7. package/dist/client/assets/index-CP7mSmLx.js +9530 -0
  8. package/dist/client/assets/index-CP7mSmLx.js.map +1 -0
  9. package/dist/client/assets/layoutWorker-Lc8iIdmf.js +2 -0
  10. package/dist/client/assets/layoutWorker-Lc8iIdmf.js.map +1 -0
  11. package/dist/client/index.html +27 -0
  12. package/package.json +40 -0
  13. package/skills/helios-cli/SKILL.md +118 -0
  14. package/skills/helios-cli/references/behaviors.md +47 -0
  15. package/skills/helios-cli/references/layouts.md +77 -0
  16. package/skills/helios-cli/references/mappers.md +119 -0
  17. package/skills/helios-cli/references/metrics.md +83 -0
  18. package/skills/helios-cli/references/networks.md +53 -0
  19. package/skills/helios-cli/references/persistence.md +136 -0
  20. package/skills/helios-cli/references/positions.md +63 -0
  21. package/skills/helios-cli/references/rendering-export.md +56 -0
  22. package/skills/helios-cli/references/rpc-methods.md +83 -0
  23. package/src/cli.js +488 -0
  24. package/src/client/index.html +27 -0
  25. package/src/client/main.js +2210 -0
  26. package/src/daemon/SessionDaemon.js +1065 -0
  27. package/src/daemon/entry.js +36 -0
  28. package/src/protocol/jsonl.js +88 -0
  29. package/src/shared/cliConfig.js +52 -0
  30. package/src/shared/fileSessionStore.js +202 -0
  31. package/src/shared/fs.js +59 -0
  32. package/src/shared/networkFormats.js +55 -0
  33. package/src/shared/networkInspect.js +81 -0
  34. package/src/shared/paths.js +43 -0
  35. package/src/shared/sessionClient.js +88 -0
  36. package/src/shared/sessionId.js +5 -0
  37. package/src/shared/sessionRegistry.js +53 -0
  38. package/src/shared/sessionSurfaces.js +199 -0
  39. package/vite.config.js +47 -0
package/README.md ADDED
@@ -0,0 +1,171 @@
1
+ <p align="center">
2
+ <img src="./media/helios-web-logo.svg" alt="Helios" width="320">
3
+ </p>
4
+
5
+ # Helios CLI
6
+
7
+ Agent-friendly CLI for starting and controlling Helios Web sessions backed by the current `helios-web` and `helios-network` packages.
8
+
9
+ The CLI starts a small local session daemon, serves a Helios Web client, opens the OS/default browser for normal interactive sessions, launches Playwright-managed browsers only when explicitly requested, and exposes JSON-RPC methods for scene, network, camera, layout, mapper, filter, label, legend, density, picking, and export workflows.
10
+
11
+ ## Install
12
+
13
+ Install the published CLI:
14
+
15
+ ```sh
16
+ npm install -g @filsilva/helios-cli
17
+ helios browser install
18
+ helios version
19
+ ```
20
+
21
+ For source checkout development, clone the packages next to each other:
22
+
23
+ ```sh
24
+ mkdir -p helios-new
25
+ cd helios-new
26
+ git clone git@github.com:filipinascimento/helios-network.git helios-network-v2
27
+ git clone git@github.com:filipinascimento/helios-web.git helios-web
28
+ git clone git@github.com:filipinascimento/helios-cli.git
29
+ cd helios-cli
30
+ npm install
31
+ npm run build
32
+ npm link
33
+ ```
34
+
35
+ The published package depends on `helios-network` and `helios-web`. Source
36
+ checkout development can still alias the adjacent renderer source while building
37
+ the CLI client.
38
+
39
+ CLI browser sessions use the `helios-web` state machine and storage facade. CLI-origin changes should go through tracked state paths (`state.set` / `helios.states.set(..., { source: "cli" })`) so only explicit overrides are saved. Durable session storage is owned by the CLI daemon, not browser localStorage or IndexedDB: session JSON lives under `~/.helios/sessions`, network side records are saved as `.zxnet`/`.bxnet`/`.xnet`, position side records are saved as binary files, session thumbnails are stored as data URLs in the private session JSON payload, and runtime daemon metadata lives under `~/.helios/runtime`. Use global `--storage-dir <path>` or `HELIOS_CLI_STORAGE_DIR` to choose another root.
40
+
41
+ ## Basic Usage
42
+
43
+ ```sh
44
+ helios version
45
+ helios browser install
46
+ helios inspect ./graph.xnet --json
47
+ helios desktop open ./graph.xnet
48
+ helios session start
49
+ helios session start --mode headless --renderer webgpu
50
+ helios session list
51
+ helios session state <sessionId>
52
+ helios call <sessionId> scene.getState
53
+ helios state set <sessionId> scene.dimension '"3d"'
54
+ helios state reset <sessionId> scene.dimension
55
+ helios call <sessionId> camera.frame --json '{"animate":true,"durationMs":500}'
56
+ helios call <sessionId> persistence.changes
57
+ helios call <sessionId> persistence.checkpoint
58
+ helios call <sessionId> persistence.save --json '{"fullSession":true}'
59
+ helios call <sessionId> browser.reload
60
+ helios call <sessionId> export.figure --json '{"format":"png","preset":"window","outputPath":"./figure.png"}'
61
+ helios session stop <sessionId>
62
+ ```
63
+
64
+ Start with a network file:
65
+
66
+ ```sh
67
+ helios session start --network ./graph.bxnet
68
+ ```
69
+
70
+ Supported network extensions are `.bxnet`, `.zxnet`, `.xnet`, `.gml`, `.gt`, and `.gt.zst`.
71
+
72
+ By default, `helios session start` runs in `server` mode and opens the session URL with the platform browser opener (`open` on macOS, `start` on Windows, `xdg-open` on Linux). This avoids spawning Playwright's bundled "Chrome for Testing" as a visible app. Use `--mode server --no-open` to serve only, `--mode headless` for automated rendering/export, or explicit `--mode headed` only when a Playwright-managed visible browser is wanted for debugging. Managed headed/headless sessions use bundled Chromium by default so they stay independent from the user's Chrome profile; add `--browser-channel chrome` or another Playwright browser channel only when an explicit installed browser channel is needed. Downloads triggered from the managed browser UI are copied to `~/Downloads` with the browser's suggested filename, and RPC figure exports can still write directly to an `outputPath`.
73
+
74
+ Use `helios session start --surface desktop` to start a CLI-owned session and open it in Helios Desktop. The CLI will use a discovered Desktop app when possible. If it cannot locate the app, pass `--app-path <path-to-Helios-Desktop>` once or run `helios config set desktop.appPath <path-to-Helios-Desktop>`; the path is stored in the CLI config file and reused on later runs.
75
+
76
+ Initialize the bundled managed browser with:
77
+
78
+ ```sh
79
+ helios browser install
80
+ ```
81
+
82
+ This installs Playwright's bundled Chromium. Use `helios browser install --with-deps` on Linux when system browser dependencies are missing, or pass explicit targets such as `helios browser install chromium chrome`.
83
+
84
+ ## Commands
85
+
86
+ - `helios version` prints CLI, `helios-network`, and `helios-web` versions visible to the current install.
87
+ - `helios browser install [browser...] [--with-deps]` installs Playwright browser binaries for managed sessions. It defaults to `chromium`.
88
+ - `helios config get` prints the CLI config path and stored config.
89
+ - `helios config set desktop.appPath <path>` records the Helios Desktop app path for `--surface desktop`.
90
+ - `helios inspect <network-path> [--json] [--format bxnet|zxnet|xnet|gt]` reads `.xnet`, `.zxnet`, `.bxnet`, `.gt`, or `.gt.zst` metadata without launching the visualization renderer.
91
+ - `helios desktop open <network-path> [--app <app-name-or-path>]` asks the OS to open a network file with the registered Helios desktop app.
92
+ - `helios session start` starts a session and prints session metadata as JSON. Pass `--storage-dir <path>` to use a custom CLI storage root for that session, or pass global `--storage-dir` before the command for all CLI file lookups in that invocation.
93
+ - `helios session list` lists known live-session daemon metadata from `~/.helios/runtime/sessions`.
94
+ - `helios session info <sessionId>` prints one session's daemon metadata.
95
+ - `helios session state <sessionId>` prints the CLI-mirrored sparse session state from `~/.helios/runtime/session-state`.
96
+ - `helios session stop <sessionId>` stops a daemon and removes its metadata.
97
+ - `helios state get <sessionId> [path]` reads the Helios Web tracked state snapshot or one state path.
98
+ - `helios state set <sessionId> <path> <json-value> [--scope user|workspace|network|session]` writes through `helios.states` with `source: "cli"` and persists the sparse override.
99
+ - `helios state reset <sessionId> <path>` resets a tracked path/prefix to default and removes the override.
100
+ - `helios call <sessionId> <method> [--json <payload>]` calls a JSON-RPC method.
101
+ - `helios events <sessionId>` streams session events as newline-delimited JSON.
102
+ - `helios session attach <sessionId> --stdio` bridges JSON-RPC over stdio.
103
+
104
+ Full session saves capture a PNG thumbnail by default and store it in the session JSON payload used by the session list UI. Lightweight autosaves request thumbnail capture with the Helios Web `auto` policy, so thumbnail refreshes are throttled while the user is actively interacting. Pass `"captureThumbnail": false` to `persistence.save` or `persistence.flush` to keep an existing thumbnail, or pass a custom `"thumbnail"` object with a `dataUrl` when an external preview should be stored.
105
+
106
+ ## Common RPC Methods
107
+
108
+ - `scene.getState`
109
+ - `scene.requestRender`
110
+ - `scene.setMode`
111
+ - `persistence.get`
112
+ - `persistence.save`
113
+ - `persistence.restore`
114
+ - `persistence.clear`
115
+ - `persistence.changes`
116
+ - `persistence.checkpoint`
117
+ - `persistence.overrides`
118
+ - `persistence.reset`
119
+ - `persistence.flush`
120
+ - `persistence.status`
121
+ - `persistence.backendStatus`
122
+ - `state.get`
123
+ - `state.set`
124
+ - `state.reset`
125
+ - `browser.reload`
126
+ - `network.stats`
127
+ - `network.inspect`
128
+ - `network.load`
129
+ - `network.replace`
130
+ - `network.save`
131
+ - `network.attributeSet`
132
+ - `camera.getPose`
133
+ - `camera.setPose`
134
+ - `camera.transition`
135
+ - `camera.frame`
136
+ - `camera.controls`
137
+ - `layout.get`
138
+ - `layout.set`
139
+ - `layout.setParameters`
140
+ - `layout.applyPositionAttribute`
141
+ - `layout.start`
142
+ - `layout.stop`
143
+ - `mappers.get`
144
+ - `mappers.set`
145
+ - `mappers.reset`
146
+ - `behaviors.get`
147
+ - `behaviors.use`
148
+ - `behaviors.update`
149
+ - `behaviors.setEnabled`
150
+ - `behaviors.detach`
151
+ - `behaviors.restore`
152
+ - `behaviors.call`
153
+ - `positions.get`
154
+ - `positions.snapshot`
155
+ - `positions.set`
156
+ - `positions.fromAttribute`
157
+ - `filters.get`
158
+ - `filters.set`
159
+ - `filters.clear`
160
+ - `labels.get`
161
+ - `labels.set`
162
+ - `legends.get`
163
+ - `legends.set`
164
+ - `density.get`
165
+ - `density.set`
166
+ - `metrics.measure`
167
+ - `aesthetic.measure`
168
+ - `picking.pick`
169
+ - `export.figure`
170
+
171
+ More detail for agent usage lives in `skills/helios-cli/`.
package/bin/helios.js ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+
3
+ function extractStorageDir(argv) {
4
+ const index = argv.findIndex((entry) => entry === '--storage-dir' || entry.startsWith('--storage-dir='));
5
+ if (index === -1) return;
6
+ const current = argv[index];
7
+ let value = null;
8
+ if (current.includes('=')) {
9
+ value = current.slice(current.indexOf('=') + 1);
10
+ argv.splice(index, 1);
11
+ } else {
12
+ value = argv[index + 1];
13
+ argv.splice(index, 2);
14
+ }
15
+ if (!value) throw new Error('Missing value for --storage-dir');
16
+ process.env.HELIOS_CLI_STORAGE_DIR = value;
17
+ }
18
+
19
+ const argv = process.argv.slice(2);
20
+
21
+ try {
22
+ extractStorageDir(argv);
23
+ } catch (error) {
24
+ process.stderr.write(`${error?.message ?? String(error)}\n`);
25
+ process.exit(1);
26
+ }
27
+
28
+ const { runCli } = await import('../src/cli.js');
29
+
30
+ runCli(argv).catch((error) => {
31
+ const message = error?.stack ?? error?.message ?? String(error);
32
+ process.stderr.write(`${message}\n`);
33
+ process.exitCode = 1;
34
+ });