@telorun/debug-ui 0.1.0 → 0.2.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.
package/README.md CHANGED
@@ -1,10 +1,14 @@
1
1
  # @telorun/debug-ui
2
2
 
3
- Browser-safe building blocks for watching a running Telo app's event stream:
4
- the debug **wire format**, **filter logic**, an **SSE client**, and **React
5
- components** — plus a standalone single-page app, built both multi-file
3
+ Browser-safe building blocks for watching a running Telo app's debug stream:
4
+ **filter logic**, an **SSE client**, and **React components** (a **Logs / Events**
5
+ tab split) — plus a standalone single-page app, built both multi-file
6
6
  (`app-dist/`) and as one self-contained file (`app-single/index.html`).
7
7
 
8
+ The **wire format** itself lives in [`@telorun/debug-wire`](../debug-wire); this
9
+ package re-exports its types. A stream carries two frame kinds: `kind: "event"`
10
+ (kernel events) and `kind: "log"` (stdout/stderr lines).
11
+
8
12
  This package is a **consumer**: it parses events, it never produces them. It has
9
13
  no Node-only dependency (no `fs`/`http`, not `@telorun/runner-core`) so it runs
10
14
  in any browser and in the editor webview.
@@ -18,22 +22,28 @@ runtime and is reimplemented per language. What's shared across runtimes is the
18
22
  that contract; the Node producer lives in the CLI.
19
23
 
20
24
  ```
21
- wire format (this README + wire-schema.json) ← the cross-runtime contract
25
+ wire format (@telorun/debug-wire) ← the cross-runtime contract
22
26
  produced by → a kernel runtime's debug server (Node: the telo CLI)
23
27
  consumed by → the standalone app (served by the producer) + the editor panel
24
28
  ```
25
29
 
26
30
  ## Wire format
27
31
 
28
- Each event is one JSON object, delivered one-per-line over SSE and JSONL. Schema:
29
- [`wire-schema.json`](./wire-schema.json).
32
+ Each frame is one JSON object, delivered one-per-line over SSE and JSONL. Schema
33
+ and types: [`@telorun/debug-wire`](../debug-wire). An **event** frame:
30
34
 
31
35
  ```json
32
- { "timestamp": "2026-06-13T07:00:00.000Z", "event": "Server.Listening",
36
+ { "kind": "event", "timestamp": "2026-06-13T07:00:00.000Z", "event": "Server.Listening",
33
37
  "payload": { "port": 5599, "mounts": [{ "path": "/v1", "mount": { "kind": "Http.Api", "name": "Api" } }] } }
34
38
  ```
35
39
 
36
- Producers reduce `payload` values to wire-safe forms before sending:
40
+ A **log** frame (one stdout/stderr line):
41
+
42
+ ```json
43
+ { "kind": "log", "timestamp": "2026-06-13T07:00:00.000Z", "stream": "stdout", "line": "listening on :5599" }
44
+ ```
45
+
46
+ Producers reduce event `payload` values to wire-safe forms before sending:
37
47
 
38
48
  | Value | Encodes as |
39
49
  |---|---|
@@ -65,8 +75,10 @@ still see *what* it was.
65
75
  - `GET /events.jsonl` — the full event log, for download.
66
76
  - `GET /blobs/:id` — a binary payload offloaded from an event (see Blobs below).
67
77
  - `GET /json/version` — discovery handshake: `{ protocol, protocolVersion, url,
68
- events, eventsLog, blobs }`, so a consumer can confirm the wire format before
69
- connecting.
78
+ events, eventsLog, blobs, appEndpoints }`, so a consumer can confirm the wire
79
+ format before connecting. `appEndpoints` is the running app's exposed addresses
80
+ (`{ host, port, protocol, url? }[]`); a blank `host` means the producer couldn't
81
+ know which hostname the viewer used — the UI fills it from the page origin.
70
82
 
71
83
  The Telo CLI exposes this server with `telo run <manifest> --inspect[=[host:]port]`
72
84
  (loopback `127.0.0.1:9230` by default). It serves the UI **same-origin**, fetching
@@ -78,12 +90,19 @@ it only writes the `.telo.debug.jsonl` event log.
78
90
 
79
91
  ```ts
80
92
  // Logic — framework-agnostic, browser-safe
81
- import { connectDebugStream, matchesFilter, distinctSuffixes,
82
- isWireRef, eventSuffix, type DebugEvent, type EventFilter } from "@telorun/debug-ui";
93
+ import { connectDebugStream, matchesFilter, distinctSuffixes, isWireRef, eventSuffix,
94
+ isLogFrame, endpointHref, type DebugFrame, type EventFilter,
95
+ type AppEndpoint } from "@telorun/debug-ui";
83
96
 
84
97
  // React components — for the standalone app and the editor panel
85
- import { DebugWatcher } from "@telorun/debug-ui/components";
86
- // <DebugWatcher url="http://localhost:9230/events" />
98
+ import { DebugWatcher, DebugPanel } from "@telorun/debug-ui/components";
99
+ // Standalone (owns its SSE + buffer; fetches `appEndpoints` from the handshake);
100
+ // theme defaults to "system":
101
+ // <DebugWatcher url="http://localhost:9230/events" theme="system" />
102
+ // Controlled (editor feeds frames it sourced itself, injects its own terminal as
103
+ // the Logs tab, passes its own resolved theme + the app's run endpoints):
104
+ // <DebugPanel frames={frames} status={…} paused={…} onTogglePause={…} onClear={…}
105
+ // resolveBlobUrl={…} logsSlot={<Terminal/>} endpoints={…} theme="dark" />
87
106
  ```
88
107
 
89
108
  ## Scripts