@le-space/build-journey 0.0.0-stage → 0.12.11
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 +111 -2
- package/package.json +36 -4
- package/src/BuildJourney.svelte +1077 -0
- package/src/index.mjs +3 -0
- package/src/model.mjs +353 -0
package/README.md
CHANGED
|
@@ -1,3 +1,112 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @le-space/build-journey
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The build of a sealed image ([`@le-space/sealed-image`](../sealed-image)) as a
|
|
4
|
+
journey in stations, for the full-screen view an app shows while it runs: a
|
|
5
|
+
pure model and a Svelte 5 component. Paperless anywhere (its first start) and
|
|
6
|
+
the Belege bridge (its own image) show the same view with their own words.
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
1 Builder ── 2 Genuine ── 3 Seal ── 4 Fetch ── 5 Stored ( ── 6 an app's start)
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Model (`@le-space/build-journey`)
|
|
13
|
+
|
|
14
|
+
Plain ES modules, no DOM, no network; runs in a browser and in Node.
|
|
15
|
+
|
|
16
|
+
- `BUILD_STATIONS`, `buildStations({ fetch: 600, … })`: the five stations of
|
|
17
|
+
the build with their typical seconds (`BUILD_TYPICAL`).
|
|
18
|
+
- `startStation({ key, typical, restoreFrom })`: a station after the build, a
|
|
19
|
+
VM started from the sealed image, with its small steps (`START_STEPS`:
|
|
20
|
+
measure, instance, network, unlock, ready, from `facts.vmStep`) and flows.
|
|
21
|
+
- `stationOfBuildStep(step)`: `onProgress({ step })` → station.
|
|
22
|
+
- `withFacts(facts, step, data, now)`: what was reported so far; keeps only
|
|
23
|
+
values that look like what they claim (hashes, relay, host, counts).
|
|
24
|
+
- `journey({ stations, station, since, now, facts, fetchPct, done })`: index,
|
|
25
|
+
share done, seconds left (the fetch by its bytes and measured speed, the
|
|
26
|
+
rest by typical time, an overrun keeps a minute in hand), when it ends.
|
|
27
|
+
- `substeps({ stations, station, current, facts, done })`: the small steps,
|
|
28
|
+
each `done`, `active` or `next`.
|
|
29
|
+
- `flowNow({ stations, station, facts, fetchPct })`: the path through the
|
|
30
|
+
places and what it carries.
|
|
31
|
+
- `fetchPercent`, `fetchRate` (MiB/s).
|
|
32
|
+
- `evidence(facts, builder, links)`: the rows to check, with links: source
|
|
33
|
+
commit, plain image SHA-256 (its STORE), expected measurement (where the
|
|
34
|
+
app pins it), builder V-PROGRAM, node, relay, the measurement the AMD
|
|
35
|
+
processor reported (`ok`: it is one the app pins), content address, the
|
|
36
|
+
STORE, and after a start the INSTANCE and its measurement. `reported(rows)`
|
|
37
|
+
keeps what the build reported (not the pins).
|
|
38
|
+
- `HARDWARE`, `PLACES`, `LINKS`, `pathOf`, `onPath`, `short`, `minutes`.
|
|
39
|
+
|
|
40
|
+
`builder` is the app's pin as `@le-space/sealed-image` takes it:
|
|
41
|
+
`{ plain: { sha256, store, commit }, measurements, crn }`. `links` are bases:
|
|
42
|
+
`{ aleph: 'https://api2.aleph.im/api/v0/messages', repo: 'https://github.com/…', expected: '<url of the pin>' }`.
|
|
43
|
+
|
|
44
|
+
## View (`@le-space/build-journey/BuildJourney.svelte`)
|
|
45
|
+
|
|
46
|
+
```svelte
|
|
47
|
+
<script>
|
|
48
|
+
import BuildJourney from '@le-space/build-journey/BuildJourney.svelte';
|
|
49
|
+
import { stationOfBuildStep, withFacts } from '@le-space/build-journey';
|
|
50
|
+
|
|
51
|
+
let view = $state({ station: 'wake', since: Date.now(), done: false, failed: false, minimized: false, facts: {} });
|
|
52
|
+
const onProgress = ({ step, data }) => {
|
|
53
|
+
view.facts = withFacts(view.facts, step, data);
|
|
54
|
+
const station = stationOfBuildStep(step);
|
|
55
|
+
if (station && station !== view.station) Object.assign(view, { station, since: Date.now() });
|
|
56
|
+
};
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<BuildJourney {view} text={(key, vars) => t(`journey.${key}`, vars)} builder={BUILDER} links={LINKS}
|
|
60
|
+
onminimize={() => (view.minimized = true)} onexpand={() => (view.minimized = false)} onclose={close} />
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Stations with their LEDs, the small steps of the current one, the animated
|
|
64
|
+
picture of what flows where, the evidence with links and the hardware behind
|
|
65
|
+
it, the total bar with the time left and when it ends, a slim bar when
|
|
66
|
+
minimised, the finale, and when it stopped: where, and `reason`. While it
|
|
67
|
+
runs it holds a Wake Lock (`wakeLock={false}` when the app holds one), asks
|
|
68
|
+
before the page is left, notes how long the page was in the background, and
|
|
69
|
+
the tab's title carries the progress.
|
|
70
|
+
|
|
71
|
+
Props: `view` (`{ station, since, done, failed, minimized, facts, fetchPct? }`),
|
|
72
|
+
`text`, `stations`, `locale`, `builder`, `links`, `hardware` (null hides it),
|
|
73
|
+
`places` and `lines` (the picture), `reason`, `hint` (e.g. a phone's),
|
|
74
|
+
`uploadHosts` (tries of the upload), `simple` (no small steps, no evidence), `finaleEvidence` (the build's evidence in the finale, default on),
|
|
75
|
+
`wakeLock`, `miniAt` (`'bottom'` fixed, `'top'` sticky), `openHref` and
|
|
76
|
+
`oncertificate` (the finale's buttons), `cover` (a snippet shown in the
|
|
77
|
+
overlay instead, e.g. a certificate), `testid` (prefix, default
|
|
78
|
+
`build-journey`), `onminimize`, `onexpand`, `onclose`.
|
|
79
|
+
|
|
80
|
+
### Texts
|
|
81
|
+
|
|
82
|
+
Every word comes from `text(key, vars)`, so each app keeps its own catalogue.
|
|
83
|
+
Keys (`{var}` the values handed in):
|
|
84
|
+
|
|
85
|
+
- `kicker`, `title`, `minimize`, `expand`, `close`, `tab` `{pct}`, `leave`
|
|
86
|
+
- `step` `{n, of}`, `stoppedAt` `{n, station}`, `failedTitle`, `failedText`
|
|
87
|
+
- `stations.<key>.label|duration|title|text|mini` for each station
|
|
88
|
+
- `sub.<key>`: `ask boot answer` · `relay report match` · `send verify luks` ·
|
|
89
|
+
`lanes bytes` · `sign upload confirm` · a start: `measure instance network unlock ready`
|
|
90
|
+
- `attested` `{count}`, `mib` `{got, size}`, `rate` `{rate}`, `attempt` `{n, of}`,
|
|
91
|
+
`retryNote`, `fetched` `{pct}`
|
|
92
|
+
- `flowTitle`, `flow.program|report|passphrase|pieces|image` (a start:
|
|
93
|
+
`instance|vmReport|backup`), `places.<key>` (`browser relay node aleph`, and
|
|
94
|
+
any the app adds)
|
|
95
|
+
- `evidenceTitle`, `evidence.commit|plain|expected|vprogram|node|relay|measured|cid|store|instance|vmMeasured`,
|
|
96
|
+
`matches`, `evidenceNone`, `evidenceNoneStopped`, `hardwareTitle`, `hardware.sev|epyc`
|
|
97
|
+
- `share` `{pct}`, `left` `{minutes}`, `endsAt` `{time}`, `keepOpen`, `cameBack` `{seconds}`
|
|
98
|
+
- `doneTitle`, `doneText`, and with the finale's buttons `open`, `showCertificate`
|
|
99
|
+
|
|
100
|
+
An empty text for `evidenceNone`, `evidenceNoneStopped` or `cameBack` leaves that note out.
|
|
101
|
+
|
|
102
|
+
Nothing a third party sends is rendered as HTML: facts are text, and only
|
|
103
|
+
values that match their pattern become links, under the bases the app hands in.
|
|
104
|
+
|
|
105
|
+
## Tests
|
|
106
|
+
|
|
107
|
+
`pnpm --filter @le-space/build-journey test`: the model in Node, and the view
|
|
108
|
+
bundled for a browser (esbuild, the Svelte compiler, no Node built-ins) and
|
|
109
|
+
checked in Chromium through Playwright, in each state. Chromium once:
|
|
110
|
+
`pnpm exec playwright install chromium`; without it the view's test is
|
|
111
|
+
skipped, except in CI. `BUILD_JOURNEY_SHOTS=<dir>` leaves screenshots at
|
|
112
|
+
desktop and phone width.
|
package/package.json
CHANGED
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@le-space/build-journey",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.12.11",
|
|
4
|
+
"description": "The build of a sealed image (@le-space/sealed-image) as a journey in stations: a pure model (stations, facts, time left, small steps, flow, evidence) and a Svelte 5 view of it, with each app's words, stations and pins handed in.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"files": [
|
|
8
|
+
"src",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"main": "./src/index.mjs",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": "./src/index.mjs",
|
|
14
|
+
"./model": "./src/model.mjs",
|
|
15
|
+
"./BuildJourney.svelte": {
|
|
16
|
+
"svelte": "./src/BuildJourney.svelte",
|
|
17
|
+
"default": "./src/BuildJourney.svelte"
|
|
18
|
+
},
|
|
19
|
+
"./package.json": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://github.com/NiKrause/relay-button"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/NiKrause/relay-button",
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/NiKrause/relay-button/issues"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"svelte": "^5.0.0"
|
|
34
|
+
},
|
|
35
|
+
"sideEffects": [
|
|
36
|
+
"*.svelte"
|
|
37
|
+
]
|
|
38
|
+
}
|