@yaks/visualize 0.0.0-stage → 0.2.36
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/ActivityView.tsx +370 -0
- package/AnatomyList.tsx +183 -0
- package/Atlas.tsx +490 -0
- package/Detail.tsx +464 -0
- package/LICENSE +202 -0
- package/README.md +180 -2
- package/SectionHead.tsx +18 -0
- package/Topology.tsx +596 -0
- package/_dist/activity.d.ts +15 -0
- package/_dist/activity.d.ts.map +1 -0
- package/_dist/capture.d.ts +19 -0
- package/_dist/capture.d.ts.map +1 -0
- package/_dist/cli.d.ts +6 -0
- package/_dist/cli.d.ts.map +1 -0
- package/_dist/front.d.ts +6 -0
- package/_dist/front.d.ts.map +1 -0
- package/_dist/http.d.ts +21 -0
- package/_dist/http.d.ts.map +1 -0
- package/_dist/main.d.ts +2 -0
- package/_dist/main.d.ts.map +1 -0
- package/_dist/mod.d.ts +6 -0
- package/_dist/mod.d.ts.map +1 -0
- package/_dist/model.d.ts +55 -0
- package/_dist/model.d.ts.map +1 -0
- package/_dist/parts.d.ts +19 -0
- package/_dist/parts.d.ts.map +1 -0
- package/_dist/routes.d.ts +7 -0
- package/_dist/routes.d.ts.map +1 -0
- package/_dist/snapshot.d.ts +38 -0
- package/_dist/snapshot.d.ts.map +1 -0
- package/_dist/stream.d.ts +3 -0
- package/_dist/stream.d.ts.map +1 -0
- package/_dist/tools.d.ts +10 -0
- package/_dist/tools.d.ts.map +1 -0
- package/_dist/vocab.d.ts +5 -0
- package/_dist/vocab.d.ts.map +1 -0
- package/activity.js +73 -0
- package/activity.js.map +1 -0
- package/activity.ts +104 -0
- package/capture.js +46 -0
- package/capture.js.map +1 -0
- package/capture.ts +68 -0
- package/cli.js +173 -0
- package/cli.js.map +1 -0
- package/cli.ts +200 -0
- package/deno.json +1 -0
- package/front.js +21 -0
- package/front.js.map +1 -0
- package/front.json +210 -0
- package/front.ts +22 -0
- package/http.js +290 -0
- package/http.js.map +1 -0
- package/http.ts +338 -0
- package/main.js +51 -0
- package/main.js.map +1 -0
- package/main.ts +50 -0
- package/mod.js +6 -0
- package/mod.js.map +1 -0
- package/mod.ts +15 -0
- package/model.js +551 -0
- package/model.js.map +1 -0
- package/model.ts +543 -0
- package/package.json +76 -4
- package/parts.js +70 -0
- package/parts.js.map +1 -0
- package/parts.ts +113 -0
- package/routes.js +53 -0
- package/routes.js.map +1 -0
- package/routes.ts +76 -0
- package/snapshot.js +117 -0
- package/snapshot.js.map +1 -0
- package/snapshot.ts +157 -0
- package/stream.js +73 -0
- package/stream.js.map +1 -0
- package/stream.ts +95 -0
- package/tools.js +64 -0
- package/tools.js.map +1 -0
- package/tools.ts +79 -0
- package/visualize.css +1787 -0
- package/vocab.js +13 -0
- package/vocab.js.map +1 -0
- package/vocab.json +97 -0
- package/vocab.ts +14 -0
package/README.md
CHANGED
|
@@ -1,3 +1,181 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @yaks/visualize
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A system MRI at **`/visualize`**: the serving platform's parts and their
|
|
4
|
+
relationships, with the real causal work passing through that process. This is a
|
|
5
|
+
standalone package, not an inspector extension. It does not read stored entity
|
|
6
|
+
contents to draw the picture.
|
|
7
|
+
|
|
8
|
+
## Compose it
|
|
9
|
+
|
|
10
|
+
Add `@yaks/visualize` to the serving config's plugins. In a checkout use
|
|
11
|
+
`packages/visualize`. Its facets are deliberately separate:
|
|
12
|
+
|
|
13
|
+
- The portable front door exports snapshots, selection, finite captures and
|
|
14
|
+
authenticated HTTP handlers. Importing it creates no observer or timer.
|
|
15
|
+
- `./routes` is the native asset adapter and `/visualize` page. It bundles a
|
|
16
|
+
local browser client; it has no `@yaks/inspect` dependency.
|
|
17
|
+
- `./cli`, `./tools` and `./vocab` advertise agent and terminal doors.
|
|
18
|
+
- `./front` is page-private vocabulary, **not** the host vocabulary facet.
|
|
19
|
+
`./model` is the graph-owned page model.
|
|
20
|
+
|
|
21
|
+
A host supplies its **actual composed** `anatomy()` and its **exact** `graph`
|
|
22
|
+
object. The mapper belongs to `@yaks/code/anatomy`; visualize never reruns a
|
|
23
|
+
package factory, forces a lazy tool, or composes a second graph to improve its
|
|
24
|
+
picture. A missing supplier means **unobserved**, not an empty platform. Native
|
|
25
|
+
composition and a Worker store have different observation seams; a category not
|
|
26
|
+
observed by that seam must not be advertised as globally absent.
|
|
27
|
+
|
|
28
|
+
Every page, asset, snapshot, capture and SSE request requires `host.who`. It can
|
|
29
|
+
be synchronous or asynchronous; returning `null` intentionally allows anonymous
|
|
30
|
+
access when the supplied policy permits that. Missing policy fails closed.
|
|
31
|
+
Authentication errors are sanitized, not a channel for arbitrary exception
|
|
32
|
+
fields or messages. Assets are built lazily after authorization.
|
|
33
|
+
|
|
34
|
+
## Anatomy contract
|
|
35
|
+
|
|
36
|
+
`GET /visualize/anatomy` returns a version-1 `Snapshot`:
|
|
37
|
+
|
|
38
|
+
- `anatomy`: the supplied contract, unchanged on an unfiltered request, with
|
|
39
|
+
host, parts and relationships. Groups are packages, roles, facets, comps,
|
|
40
|
+
tools, commands, effects, rules, hooks, routes, views, inspectViews, tui,
|
|
41
|
+
kits, themes, skills and secrets.
|
|
42
|
+
- `coverage`: scope, `activity: process-local`, per-group `observed` flags,
|
|
43
|
+
`recording: subscriber-only`, `clock: monotonic` and `capacity: 256`.
|
|
44
|
+
- `takenAt`: the metadata snapshot's wall-clock time, not a trace clock.
|
|
45
|
+
|
|
46
|
+
A part's declaration, loading and binding are independent facts. A lazy
|
|
47
|
+
unattempted facet is not an absent implementation; an imported browser view is
|
|
48
|
+
not a mounted renderer. A secret part reports a **name**, never its value or a
|
|
49
|
+
getter's result. Schema metadata is a contract, not returned row data.
|
|
50
|
+
|
|
51
|
+
Optional `group`, `search`, `id` and `limit` select parts:
|
|
52
|
+
|
|
53
|
+
- Group is one of the 17 names above. `search` is a case-insensitive plain-text
|
|
54
|
+
match over name, package, facet and description, **not graph query syntax**.
|
|
55
|
+
- `id` is an exact anatomy identity, not a stored entity eid.
|
|
56
|
+
- The global part cap defaults to 1000 and cannot exceed 5000. It applies in
|
|
57
|
+
group order. Edges do not consume the cap; both endpoints must be included.
|
|
58
|
+
- A selected response adds `selection: { total, matched, shown, truncated }`.
|
|
59
|
+
`matched` is counted before the cap. The source arrays are not mutated.
|
|
60
|
+
|
|
61
|
+
Unknown/repeated parameters, empty groups, invalid numeric bounds and malformed
|
|
62
|
+
cursors are refused. Plain unfiltered HTTP anatomy preserves the supplier DTO;
|
|
63
|
+
the anatomy tool always runs selection and reports its counts. The page projects
|
|
64
|
+
the same contract into its private graph. Its pipeline labels are explanatory
|
|
65
|
+
client nodes, not another server anatomy category or claims of bound handlers.
|
|
66
|
+
The spine includes normalize, admit, mint, prepare, precondition, rules, mutate,
|
|
67
|
+
cascade, stamp, journal, commit, effect and audit. **Audit is rollback
|
|
68
|
+
notification, not a successful apply's continuation.**
|
|
69
|
+
|
|
70
|
+
## Activity contract and lifecycle
|
|
71
|
+
|
|
72
|
+
`@yaks/trace` owns measurement. Producers record names, stages, causal span IDs,
|
|
73
|
+
monotonic times, finite counts and outcomes only while subscribers exist. No
|
|
74
|
+
query text, entity values, payloads, credentials or secret values cross this
|
|
75
|
+
stream. [`record(graph, run)`](../trace/README.md) captures one call’s span tree
|
|
76
|
+
for timing an apply. Performance observation does not repurpose persisted
|
|
77
|
+
effects/trace components.
|
|
78
|
+
|
|
79
|
+
`observe(graph)` leases that exact graph's shared stream. It adds one local
|
|
80
|
+
`epoch` and increasing `seq` to each shared record and retains at most 256.
|
|
81
|
+
Start and end share a span ID. Durations of **0 ms are valid**, including on a
|
|
82
|
+
clock that advances only during I/O. Counts provide useful evidence there.
|
|
83
|
+
Independent observers close independently; the last lease unsubscribes. No
|
|
84
|
+
recording timer or clock survives an idle stream. Multiple graphs or processes
|
|
85
|
+
sharing a database do not share this channel.
|
|
86
|
+
|
|
87
|
+
`GET /visualize/activity?limit=32&wait=250` takes a finite observation:
|
|
88
|
+
|
|
89
|
+
- `limit`: default/max 256; minimum 1.
|
|
90
|
+
- `wait`: integer milliseconds, default 0, maximum 2000. The lease stays open
|
|
91
|
+
during the wait. Abort releases it.
|
|
92
|
+
- The `Capture` is `{ epoch, events, gap, coverage: process-local }`. **`gap`
|
|
93
|
+
counts known omitted records**, including records removed by the limit or
|
|
94
|
+
overwritten during that capture. It cannot count unrecorded work.
|
|
95
|
+
|
|
96
|
+
`GET /visualize/events` is bounded SSE with `hello`, `activity` and `gap`
|
|
97
|
+
frames. Activity IDs are `epoch:seq`. A same-epoch `Last-Event-ID` replays only
|
|
98
|
+
available newer records and reports known overflow. A changed epoch signals that
|
|
99
|
+
continuity cannot be established. An invalid or future same-epoch cursor is
|
|
100
|
+
refused. Each reader has a 256-record queue; backpressure reports dropped
|
|
101
|
+
records, never grows without bound. Disconnect, cancellation and host closing
|
|
102
|
+
release the lease. Keepalives exist only while the reader is connected.
|
|
103
|
+
|
|
104
|
+
The page retains 256 raw records, oldest first, and displays one row per span. A
|
|
105
|
+
causal view follows retained parents and descendants, never inventing a missing
|
|
106
|
+
parent or a complete distributed trace. Epoch change clears prior records and
|
|
107
|
+
cause selection, so clocks and span identity are not compared across processes.
|
|
108
|
+
UI offsets use the latest retained record, not a timer.
|
|
109
|
+
|
|
110
|
+
**Pause closes EventSource**, not merely the drawing. Anatomy and retained
|
|
111
|
+
records stay available; metadata refresh while paused is allowed. Resume uses
|
|
112
|
+
`tail=1`, adds one observation-gap episode and does not reconstruct paused work.
|
|
113
|
+
The page's `gap` indicator counts **episodes**, not omitted records. A
|
|
114
|
+
disconnect alone does not prove that any records were lost. Other remaining
|
|
115
|
+
subscribers may still observe the host, but they do not backfill this page's
|
|
116
|
+
pause. Subscribers such as D-344 consume this same measured stream; they do not
|
|
117
|
+
introduce a competing timing system or persist these records by default.
|
|
118
|
+
|
|
119
|
+
## Humans and agents
|
|
120
|
+
|
|
121
|
+
The page has an anatomy map/list, explicit relationship and schema detail,
|
|
122
|
+
pipeline spine, timeline and bounded causal drill-down. The map draws at most
|
|
123
|
+
160 parts, 320 relationships and the latest 48 shared-record pulses; phases
|
|
124
|
+
belong to the spine. Filtering and pagination keep larger compositions
|
|
125
|
+
explorable. No activity animation or polling clock invents a busy platform.
|
|
126
|
+
|
|
127
|
+
Keyboard: `/` search, arrows select, Enter focus detail, Esc clear selection,
|
|
128
|
+
`+`/`-` zoom, `0` reset camera, `P` pause/resume, `L`/`M` list/map, `?` help.
|
|
129
|
+
Appearance is real shared Everforest or Rosé Pine with explicit dark/light.
|
|
130
|
+
Domain state, camera, selection, search drafts and observations belong to a
|
|
131
|
+
page-private local `@yaks/client` graph, with `signal`, no server URL and both
|
|
132
|
+
vaults disabled. Cleanup closes the stream, requests, desk, watches and client.
|
|
133
|
+
|
|
134
|
+
Agent tools are `visualize_anatomy` and `visualize_activity` on their tool host.
|
|
135
|
+
Both accept `url` to read another HTTP(S) serving origin through the same
|
|
136
|
+
snapshot routes as the CLI. Their replies are JSON; `json: true` is accepted
|
|
137
|
+
too. For example, `visualize_anatomy` with
|
|
138
|
+
`{ "url": "https://tasks.yak.sh", "search": "task", "group": "tools" }` selects
|
|
139
|
+
task tools on that origin. The CLI reads the selected serving process instead of
|
|
140
|
+
composing one to answer:
|
|
141
|
+
|
|
142
|
+
```sh
|
|
143
|
+
yak visualize anatomy --group tools --json
|
|
144
|
+
yak visualize activity --limit 32 --wait 250 --json
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Use `--url` for another HTTP(S) serving origin. JSON mode prints the exact DTO;
|
|
148
|
+
human mode summarizes it. The selected origin determines the saved token;
|
|
149
|
+
`YAKS_TOKEN` remains the explicit override. URL userinfo/non-HTTP schemes and
|
|
150
|
+
redirects are refused; an unrelated default host's credential is not forwarded.
|
|
151
|
+
`x-via` names provenance, not authentication.
|
|
152
|
+
|
|
153
|
+
## Verification
|
|
154
|
+
|
|
155
|
+
The package's fresh Deno tests cover snapshots, selection, leases, finite
|
|
156
|
+
captures, authentication, SSE replay/backpressure and the graph-owned model:
|
|
157
|
+
|
|
158
|
+
```sh
|
|
159
|
+
deno task test --tag=deno packages/visualize
|
|
160
|
+
deno task check:types packages/visualize/main.ts
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
The standalone page and both CLI examples were also exercised on an isolated
|
|
164
|
+
native host, not the live graph. A successful mutation produced a retained
|
|
165
|
+
request → apply → phase/rule/fan-out cause path without exposing its private
|
|
166
|
+
contents. Pause closed observation while a second mutation succeeded; resume
|
|
167
|
+
reported one gap episode. Restarting only the scratch host reconnected the page
|
|
168
|
+
and reset the observation epoch. A burst remained bounded to 256 records, 160
|
|
169
|
+
map nodes, 320 edges and 48 pulses. Themes, keyboard search/list navigation,
|
|
170
|
+
pointer pan/reset/zoom and a 390-pixel reduced-motion layout were checked.
|
|
171
|
+
|
|
172
|
+
Native and Worker suppliers have separate tests against their actual composition
|
|
173
|
+
seams. Worker runtime deployment and a live-box restart are not implied by those
|
|
174
|
+
checks. A host must include the plugin before serving the route; a running
|
|
175
|
+
process receives source changes on its next start.
|
|
176
|
+
|
|
177
|
+
Inactive observation is not zero-cost: repeated runtime benchmarks measured
|
|
178
|
+
roughly 128–214 ns/query (5.5–9.2%) for the inactive channel branch. Idle-path
|
|
179
|
+
interface tests observed no telemetry begin/instant calls, clock reads or UUID
|
|
180
|
+
creation during apply/read/get. This is not a heap-allocation profiling claim.
|
|
181
|
+
D-344 consumes the same stream, not another measurement system.
|
package/SectionHead.tsx
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** @jsxRuntime automatic *//** @jsxImportSource npm:react@19.3.0 *//** @jsxImportSourceTypes npm:react@19.3.0 *//* @ts-types="npm:@types/react@19.3.0" */ import type { ReactNode } from 'npm:react@19.3.0'
|
|
2
|
+
import { Card, Head } from 'jsr:@yaks/ui@0.2.36'
|
|
3
|
+
|
|
4
|
+
export let SectionHead = (
|
|
5
|
+
{ title, eyebrow, actions }: {
|
|
6
|
+
title: string
|
|
7
|
+
eyebrow?: string
|
|
8
|
+
actions?: ReactNode
|
|
9
|
+
},
|
|
10
|
+
) => (
|
|
11
|
+
<Card.Head className='Atlas_SectionHead'>
|
|
12
|
+
<div>
|
|
13
|
+
{eyebrow && <Head.Eyebrow>{eyebrow}</Head.Eyebrow>}
|
|
14
|
+
<Card.Title>{title}</Card.Title>
|
|
15
|
+
</div>
|
|
16
|
+
{actions && <Card.Actions>{actions}</Card.Actions>}
|
|
17
|
+
</Card.Head>
|
|
18
|
+
)
|