Pin only pushed commits, with no local overrides: Ziran v0.5.0 (f9f92b46), Kryon b45cc524 (one lock entry, ref master, shared with the Css and Plot master edges), Apps 352901e, Entity b30dd4a and practices 893e5b6f, whose sharpened banners and regenerated Lumi guide clips the narration check now matches. The Library opens each Tao Te Ching chapter on its own picture page: the chapter art and its title, centered together; the text pages follow. The reader keeps the picture page across reflow, and a chapter start or a Contents pick opens it. The 81 approved chapter pictures are included. Breeze now uses Kryon's namespaced widgets (Text.Draw/Text.Props, Button, Image, Modal.ActionModal, Layout, TabBar, LoadingScreen, LoadingIndicator, Shape.Circle) instead of the removed Kryon/Widgets facades. Hosted apps import std/text explicitly, since a short "text" import now names Kryon's widget. AGENTS.md and the Text/Button API checks describe the namespaced forms; two unused test doubles are removed. Build fixes for the new toolchain: the bundle runtime carries Ziran's instruction engine (no BOOTSTRAP=1) and takes the pinned host zi2c for cross builds; the Apps controller's lock context has the manifest's module roots; the app codec generator lists Kryon's raw modules only; the package scripts read ZX revision 28 bundle assets. The Apps controller digest matches the Apps 352901e build. Also included: the stopped lanes' work in this tree (Radio download, Photos install, Lists, Lumi, Habits shop rewards, astral exercise selection, appearance and download recovery) and the raylib-free desktop lane's host modules (app_trace, host_input, host_window, host_clock), inactive unless DESKTOP_HOST is defined. Not included: the crash-recovery lane's picture-window and storage crash-safety changes, which that lane commits itself. Local tests: zi-check (510 modules), native and Android source checks, hosted app checks, build-laws, clean-text-api-check, button-api-check, library-reader-test, library-ui-test, storage-crash-zi-test and native-image-decode-test pass. The bundled Arcade is still ZX revision 26 and waits for an Arcade build on these pins.
223 lines
10 KiB
Ziran
223 lines
10 KiB
Ziran
// Trusted-root baselines use the same digest, API, publisher and identity
|
|
// boundaries as the loader, while stale signed metadata keeps its own key.
|
|
#import, file "../src/apps/node_app_embedded.zi";
|
|
#import, file "../src/apps/node_app_open.zi";
|
|
#import, file "../src/apps/node_app_tree.zi";
|
|
#import, file "../src/apps/node_app_runner.zi";
|
|
#import, file "../src/apps/node_apps.zi";
|
|
#import, file "../src/apps/package_work.zi";
|
|
#import, file "../src/apps/package_manager.zi";
|
|
#import, file "../src/apps/package_release.zi";
|
|
#import, file "../src/apps/package_files.zi";
|
|
#import, file "../src/apps/package_history.zi";
|
|
#import, file "../src/app/assets.zi";
|
|
#import, file "../src/apps/catalog.zi";
|
|
#import, file "node_app_icons_behavior.zi";
|
|
#import "std/text_buffer"
|
|
#import "std/vec"
|
|
#import "std/c_string"
|
|
#import "std/file_linux"
|
|
#import "apps/tree"
|
|
#import "apps/host"
|
|
#import "apps/preparation"
|
|
#import, file "../src/apps/node_child_packages.zi";
|
|
|
|
embedded_c :: #system_library "c";
|
|
EmbeddedNow :: () -> float64 #foreign embedded_c "IconsNow";
|
|
EmbeddedYield :: () #foreign embedded_c "IconsYield";
|
|
EmbeddedWrite :: (fd: s32, data: *void, count: usize) -> s64 #foreign embedded_c "write";
|
|
|
|
embedded_test_bytes: string;
|
|
embedded_test_metadata: string;
|
|
embedded_test_publishers: string;
|
|
embedded_test_arcade: string;
|
|
embedded_test_art: string;
|
|
embedded_test_controller: string;
|
|
|
|
EmbeddedTestAsset :: (path: string) -> AssetView {
|
|
data := ""
|
|
if path == "assets/apps/bundled/fixture.zx" { data = embedded_test_bytes }
|
|
if path == "assets/apps/bundled/arcade.zx" { data = embedded_test_arcade }
|
|
if path == IconsEnvironmentPath("NODE_EMBEDDED_ART_PATH") {
|
|
data = embedded_test_art
|
|
}
|
|
if path == "apps.zx" { data = embedded_test_controller }
|
|
if path == "assets/apps/bundled/releases.json" { data = embedded_test_metadata }
|
|
if path == "apps/publishers.json" {
|
|
data = embedded_test_publishers
|
|
}
|
|
return AssetView.{.found = data.count > 0, .data = data}
|
|
}
|
|
|
|
EmbeddedTestMetadata :: (id: string, key: string, api: s32, size: s64, hash: string) {
|
|
PackageFree(embedded_test_metadata)
|
|
text: Vec(u8)
|
|
BuilderPrint(*text, "{\"fixture\":{\"id\":\"%\",\"key_id\":\"%\",\"host_api\":%,\"bytes\":%,\"sequence\":1,\"version\":\"1.0.0\",\"sha256\":\"%\",\"complete_bytes\":%}}",
|
|
id, key, api, size, hash, size)
|
|
embedded_test_metadata = BuilderFinish(text)
|
|
}
|
|
|
|
NodeAppEmbeddedCheck :: () -> s32 {
|
|
slot := cast(s32)(NodeAppSlots - 2)
|
|
arcade_marked := NodeAppMarked("arcade")
|
|
embedded_test_bytes = PackageRead(IconsEnvironmentPath("NODE_OPEN_LEAF_BUNDLE"), PackageMaximumBytes)
|
|
embedded_test_publishers = PackageRead(IconsEnvironmentPath("NODE_EMBEDDED_PUBLISHERS"), 16384)
|
|
hash := IconsEnvironmentPath("NODE_OPEN_LEAF_SHA256")
|
|
if embedded_test_bytes.count < 8 { return 160 }
|
|
AssetBindProvider(EmbeddedTestAsset)
|
|
defer {
|
|
AssetUnbindProvider()
|
|
PackageFree(embedded_test_bytes)
|
|
PackageFree(embedded_test_metadata)
|
|
PackageFree(embedded_test_publishers)
|
|
PackageFree(embedded_test_arcade)
|
|
PackageFree(embedded_test_art)
|
|
PackageFree(embedded_test_controller)
|
|
embedded_test_bytes = ""
|
|
embedded_test_metadata = ""
|
|
node_runners[slot].embedded_release = PackageRelease.{}
|
|
package_cached_releases[NodeAppIndex(slot)] = PackageRelease.{}
|
|
NodeAppAssign(slot, "")
|
|
NodeAppSetMark("arcade", arcade_marked)
|
|
}
|
|
NodeAppAssign(slot, "fixture")
|
|
EmbeddedTestMetadata("inbe.fixture", "baseline", 43, embedded_test_bytes.count, hash)
|
|
if !NodeAppEmbeddedRelease("fixture").valid || !NodeAppEmbedded("fixture").found ||
|
|
!NodeAppInstalled(slot) { return 161 }
|
|
keys: [2]string = .["unknown", "outside"]
|
|
for key: keys {
|
|
EmbeddedTestMetadata("inbe.fixture", key, 43, embedded_test_bytes.count, hash)
|
|
if NodeAppEmbeddedRelease("fixture").valid { return 162 }
|
|
}
|
|
apis: [2]s32 = .[42, 65535]
|
|
for api: apis {
|
|
EmbeddedTestMetadata("inbe.fixture", "baseline", api, embedded_test_bytes.count, hash)
|
|
if NodeAppEmbeddedRelease("fixture").valid { return 163 }
|
|
}
|
|
EmbeddedTestMetadata("inbe.someone-else", "baseline", 43, embedded_test_bytes.count, hash)
|
|
if NodeAppEmbeddedRelease("fixture").valid { return 164 }
|
|
EmbeddedTestMetadata("inbe.fixture", "baseline", 43, PackageMaximumBytes + 1, hash)
|
|
if NodeAppEmbeddedRelease("fixture").valid { return 165 }
|
|
EmbeddedTestMetadata("inbe.fixture", "baseline", 43, embedded_test_bytes.count,
|
|
"0000000000000000000000000000000000000000000000000000000000000000")
|
|
if !NodeOpenBegin(slot) || node_open_work.ok { return 166 }
|
|
if !NodeOpenDiscard() { return 167 }
|
|
|
|
// Invalid/missing current descriptors cannot make fallback bytes borrow
|
|
// a different cached publisher. Pending work cannot relabel a live app.
|
|
EmbeddedTestMetadata("inbe.fixture", "baseline", 43, embedded_test_bytes.count, hash)
|
|
previous: PackageRelease
|
|
previous.valid = true
|
|
unused CopyCString("other", previous.key_id[:])
|
|
package_cached_releases[NodeAppIndex(slot)] = previous
|
|
node_runners[slot].embedded_release = previous
|
|
if !NodeOpenBegin(slot) || !node_open_work.ok ||
|
|
TextUntilNul(node_open_work.release.key_id[:]) != "baseline" { return 168 }
|
|
bound := NodeTreeRelease(slot)
|
|
if TextUntilNul(bound.key_id[:]) != "other" { return 168 }
|
|
if !NodeOpenDiscard() { return 169 }
|
|
node_runners[slot].embedded_release = PackageRelease.{}
|
|
// Open the exact portable identity through production preparation and
|
|
// activation, then verify the publisher remains bound after job disposal.
|
|
if !NodeAppOpen(slot) { return 170 }
|
|
deadline := EmbeddedNow() + 10.0
|
|
while !NodeAppRunning(slot) && EmbeddedNow() < deadline {
|
|
unused NodeOpenPump(true)
|
|
EmbeddedYield()
|
|
}
|
|
bound = NodeTreeRelease(slot)
|
|
if !NodeAppRunning(slot) || TextUntilNul(bound.key_id[:]) != "baseline" {
|
|
return 171
|
|
}
|
|
if !NodeAppClose(slot) { return 172 }
|
|
|
|
// A genuine newer signed installation wins over the root baseline.
|
|
metadata := PackageRead(IconsEnvironmentPath("NODE_EMBEDDED_UPDATE"), 65536)
|
|
defer { PackageFree(metadata) }
|
|
release := PackageTrustedRelease(metadata, NodeAppIndex(slot))
|
|
if !release.valid || TextUntilNul(release.version[:]) != "2.0.0" { return 173 }
|
|
current := PackagePath(NodeAppIndex(slot), ".current.json")
|
|
payload := PackagePayloadPath(NodeAppIndex(slot), TextUntilNul(release.hash[:]))
|
|
updated := PackageRead(IconsEnvironmentPath("NODE_OPEN_ROOT_BUNDLE"), PackageMaximumBytes)
|
|
defer {
|
|
unused RemoveFile(current)
|
|
unused RemoveFile(payload)
|
|
PackageFree(current)
|
|
PackageFree(payload)
|
|
PackageFree(updated)
|
|
}
|
|
if !PackageWrite(current, metadata) || !PackageWrite(payload, updated) { return 174 }
|
|
if !NodeOpenBegin(slot) || node_open_embedded ||
|
|
TextUntilNul(node_open_work.release.version[:]) != "2.0.0" ||
|
|
TextUntilNul(node_open_work.release.key_id[:]) != "other" { return 175 }
|
|
deadline = EmbeddedNow() + 10.0
|
|
while !PackageWorkReady(node_open_work) && EmbeddedNow() < deadline { EmbeddedYield() }
|
|
if !node_open_work.ok { return 176 }
|
|
if !NodeOpenDiscard() { return 177 }
|
|
// The actual Arcade collection opens using this host's existing trusted
|
|
// controller. Its complete library art resolves offline; games stay absent.
|
|
PackageFree(embedded_test_metadata)
|
|
embedded_test_metadata = PackageRead(IconsEnvironmentPath("NODE_EMBEDDED_REAL_METADATA"), 16384)
|
|
embedded_test_arcade = PackageRead(IconsEnvironmentPath("NODE_EMBEDDED_ARCADE"), PackageMaximumBytes)
|
|
embedded_test_art = PackageRead(IconsEnvironmentPath("NODE_EMBEDDED_ART"), PackageMaximumBytes)
|
|
embedded_test_controller = PackageRead(IconsEnvironmentPath("NODE_EMBEDDED_CONTROLLER"), PackageMaximumBytes)
|
|
package_cached_releases[NodeAppIndex(slot)] = PackageRelease.{}
|
|
NodeAppAssign(slot, "")
|
|
arcade_slot := NodeAppInstall("arcade")
|
|
if arcade_slot < 0 { return 178 }
|
|
slot = arcade_slot
|
|
if !NodeAppMarked("arcade") || PackagePending(NodeAppIndex(slot)) { return 178 }
|
|
deadline = EmbeddedNow() + 10.0
|
|
previous_stage: s32 = -1
|
|
while !NodeAppRunning(slot) && EmbeddedNow() < deadline {
|
|
stage: s32 = 0
|
|
if node_open_work != null {
|
|
stage = 1
|
|
if PackageWorkReady(node_open_work) {
|
|
stage = ifx node_open_work.ok then 2 else 3
|
|
}
|
|
}
|
|
if node_open_preparation != null {
|
|
stage = 4
|
|
if AppPreparationReady(node_open_preparation) {
|
|
stage = ifx node_open_preparation.valid then 5 else 6
|
|
}
|
|
}
|
|
if node_open_failed[slot] {
|
|
stage = 7
|
|
}
|
|
if stage != previous_stage {
|
|
message: Vec(u8)
|
|
BuilderPrint(*message, "Arcade open stage %\n", stage)
|
|
diagnostic := BuilderFinish(message)
|
|
buffer: [128]u8
|
|
unused CopyCString(diagnostic, buffer[:])
|
|
unused EmbeddedWrite(2, cast(*void)*buffer[0], cast(usize)diagnostic.count)
|
|
PackageFree(diagnostic)
|
|
previous_stage = stage
|
|
}
|
|
unused NodeOpenPump(true)
|
|
EmbeddedYield()
|
|
}
|
|
host := node_runners[slot].nested
|
|
if host == null { return 179 }
|
|
root := AppTreeNode(*host.tree, AppHandle.{0, 1})
|
|
if root == null || root.catalog.count != 5 ||
|
|
NodeAppPackageSize(slot) != embedded_test_arcade.count + embedded_test_art.count { return 180 }
|
|
path := "assets/arcade/covers/shovey-portrait.webp"
|
|
deadline = EmbeddedNow() + 10.0
|
|
while !AppHostAsset(root, path).found && EmbeddedNow() < deadline {
|
|
NodeChildPump()
|
|
EmbeddedYield()
|
|
}
|
|
if !AppHostAsset(root, path).found || node_child_memory != embedded_test_art.count { return 181 }
|
|
child := root.catalog.children
|
|
while child != null {
|
|
if AppHostAsset(root, TextUntilNul(child.entry.bundle[:])).found { return 182 }
|
|
if !AppHostAsset(root, TextUntilNul(child.entry.cover.portrait[:])).found { return 183 }
|
|
child = child.next
|
|
}
|
|
if !NodeAppClose(slot) { return 184 }
|
|
return 0
|
|
}
|