@tikoci/centrs 0.1.0 → 0.1.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/CHANGELOG.md +73 -2
- package/GLOSSARY.txt +16 -0
- package/README.md +1 -1
- package/commands/AGENTS.md +3 -2
- package/commands/api/AGENTS.md +212 -0
- package/commands/api/README.md +159 -0
- package/commands/api/examples.md +325 -0
- package/commands/btest/README.md +56 -31
- package/commands/btest/examples.md +35 -10
- package/commands/devices/README.md +26 -0
- package/commands/discover/README.md +17 -8
- package/commands/discover/examples.md +10 -5
- package/commands/execute/README.md +9 -3
- package/commands/retrieve/README.md +1 -1
- package/docs/CONSTITUTION.md +6 -6
- package/docs/MATRIX.md +46 -15
- package/docs/errors/routeros/btest-connection-count-single-stream.md +22 -0
- package/docs/errors/routeros/btest-udp-tx-size-ignored.md +15 -0
- package/docs/errors/usage/invalid-method.md +23 -0
- package/package.json +5 -5
- package/src/api.ts +1555 -0
- package/src/btest.ts +61 -1
- package/src/cli/api.ts +536 -0
- package/src/cli/btest.ts +45 -1
- package/src/cli/common.ts +64 -0
- package/src/cli/discover.ts +26 -0
- package/src/cli/execute.ts +30 -4
- package/src/cli/missing-target.ts +171 -0
- package/src/cli/retrieve.ts +32 -14
- package/src/cli/terminal.ts +18 -4
- package/src/cli/transfer.ts +37 -9
- package/src/cli.ts +22 -0
- package/src/core/error-catalog.ts +14 -0
- package/src/core/fanout.ts +160 -0
- package/src/core/inspect.ts +170 -0
- package/src/discover.ts +96 -23
- package/src/execute.ts +14 -47
- package/src/index.ts +61 -8
- package/src/protocols/adapter.ts +328 -0
- package/src/protocols/btest-session.ts +279 -46
- package/src/protocols/btest.ts +6 -2
- package/src/protocols/native-api.ts +223 -30
- package/src/retrieve-fanout.ts +13 -141
- package/src/retrieve.ts +30 -87
- package/commands/stream/README.md +0 -70
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# stream
|
|
2
|
-
|
|
3
|
-
Follow live RouterOS output — `print follow`, `monitor`-style commands, and
|
|
4
|
-
sniffer feeds — as a stream of envelopes.
|
|
5
|
-
|
|
6
|
-
Status: `designed`. This file describes intent and flags; no implementation yet.
|
|
7
|
-
See `docs/MATRIX.md` for the cell states. `stream` lands with a transport that
|
|
8
|
-
can hold an open read (native-api first, then ssh); it is **not** a REST cell.
|
|
9
|
-
|
|
10
|
-
## Why a separate verb
|
|
11
|
-
|
|
12
|
-
`stream` exists because open-ended follow is a different I/O contract than a
|
|
13
|
-
one-shot read, and conflating it into `retrieve` would force every retrieve
|
|
14
|
-
consumer to handle "maybe this is a stream." A caller that picks `stream` knows
|
|
15
|
-
it is getting a sequence of frames, not a single envelope. Bounded, finite
|
|
16
|
-
captures stay on `retrieve` (`--once`); interactive PTY stays on `terminal`
|
|
17
|
-
(constitution: protocol selection).
|
|
18
|
-
|
|
19
|
-
## Intent
|
|
20
|
-
|
|
21
|
-
- **Read-only**, validated like `retrieve` (path-shaped commands gate through
|
|
22
|
-
`/console/inspect`). `stream` never writes.
|
|
23
|
-
- Wraps RouterOS follow semantics: `once`, `follow`, `duration=`,
|
|
24
|
-
`freeze-frame-interval=`. Targets are the `monitor`/`print follow`/sniffer
|
|
25
|
-
family of menus.
|
|
26
|
-
- **Transport:** true follow cannot ride REST (RouterOS REST has a 60s hard
|
|
27
|
-
cap), so `stream` is **native-api / ssh-first**. `--via rest-api` is
|
|
28
|
-
bounded-or-rejected, never a silent open-ended poll.
|
|
29
|
-
- Not a fan-out surface in single-session mode: a single `stream` rejects N>1
|
|
30
|
-
targets with `usage/fanout-not-supported` (constitution: target selection).
|
|
31
|
-
|
|
32
|
-
## Output contract (NDJSON stream of envelopes)
|
|
33
|
-
|
|
34
|
-
- Each frame is **one envelope** (`{ ok, data?, warnings?, error?, meta }`),
|
|
35
|
-
emitted as one NDJSON line under `--format json`. Text mode renders
|
|
36
|
-
human-readable frames.
|
|
37
|
-
- The stream is terminated by a final **summary envelope**: frame count,
|
|
38
|
-
duration, and stop reason (`duration-elapsed`, `interrupted`, `eof`,
|
|
39
|
-
`transport-error`).
|
|
40
|
-
- A mid-stream RouterOS or transport error is itself a frame with `ok: false`;
|
|
41
|
-
the **process exit code** reflects whether the stream *started* cleanly, not
|
|
42
|
-
whether every frame was `ok`.
|
|
43
|
-
- `--duration` / `--count` bound an otherwise open-ended follow; Ctrl-C stops it
|
|
44
|
-
and still emits the summary envelope.
|
|
45
|
-
|
|
46
|
-
## Flags (planned)
|
|
47
|
-
|
|
48
|
-
| Flag | Behavior |
|
|
49
|
-
| ---- | -------- |
|
|
50
|
-
| `--via <protocol>` | Pin transport (`native-api` or `ssh`). REST is bounded-or-rejected. |
|
|
51
|
-
| `--duration <dur>` | Stop after this wall-clock window (maps to RouterOS `duration=`). |
|
|
52
|
-
| `--count <n>` | Stop after N frames. |
|
|
53
|
-
| `--freeze-frame-interval <dur>` | RouterOS `freeze-frame-interval=` passthrough. |
|
|
54
|
-
| `--format <text\|json>` | `json` is NDJSON (one envelope per line); `text` is human frames. |
|
|
55
|
-
|
|
56
|
-
`tail` is a log-scoped alias: `centrs tail <router> /log` ≈ `tail -f` over
|
|
57
|
-
`/log print follow`.
|
|
58
|
-
|
|
59
|
-
## Open questions
|
|
60
|
-
|
|
61
|
-
- Whether `stream` over ssh shells out to the RouterOS CLI follow or rides a
|
|
62
|
-
structured channel; settle during the SSH transport work.
|
|
63
|
-
- Backpressure / max-buffered-frames policy for a fast producer.
|
|
64
|
-
|
|
65
|
-
Sequencing (decided): do **not** start `stream` until (1) a native-api
|
|
66
|
-
*streaming* spike confirms the reader is solid as a long-lived follow channel
|
|
67
|
-
(not just request/response), and (2) `retrieve` is further along and re-reviewed
|
|
68
|
-
for UX — `stream` should inherit a settled retrieve shape, not race it. The
|
|
69
|
-
native-api streaming reader already exists (`src/protocols/native-api.ts`) and is
|
|
70
|
-
the first follow consumer.
|