Merge the Idunn extraction: Odin no longer owns deployment authority
Idunn lived as a crate inside the repository of a service it manages, which inverted the authority it exists to hold. It is now GameCult/Idunn with its full 136-commit history; this merge removes the old body from Odin. Cut: crates/idunn-daemon and vendor/cultmesh-rs. Odin keeps its own Idunn projection (crates/odin-core/src/idunn.rs), its RUDP client, and its recipe under deployment/idunn -- those are Odin's view of a managed relationship, not Idunn's authority. Conflicts resolved: - crates/idunn-daemon/src/main.rs, scripts/linux/idunn-yggdrasil: deleted, per the extraction. Both live in GameCult/Idunn. - docs/architecture.md: took the branch. Main still described Gjallar as Nightwing-resident under E:\Projects\Gjallar; it runs on Yggdrasil from /srv/gjallar/current, confirmed against the host. - src/odin/documents.cjs: union. All three hunks were pure branch-side additions of the ghostlight.schema_catalog type; markers stripped rather than taking --theirs, to preserve auto-merged HEAD changes elsewhere in the file. node --check passes. Verified: odin-core 22/22 on Windows; odin-daemon type-checks clean for x86_64-unknown-linux-gnu, which is its real target -- it is unconditionally Unix (systemd socket activation via File::from_raw_fd) and does not build on Windows by design. main is tagged pre-idunn-extraction-main: the last tree containing the swarm keepalive supervision and the July Bifrost Persona feedback target, neither of which exists on the branch or in GameCult/Idunn. See the merge notes for why that matters. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
commit
df10b554a9
127 changed files with 6392 additions and 21657 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -7,3 +7,6 @@ target/
|
|||
*.pid
|
||||
artifacts/
|
||||
**/artifacts/
|
||||
|
||||
# Agent scratch. Reached 50MB of tarballs and lockfile snapshots once.
|
||||
.codex-tmp/
|
||||
|
|
|
|||
172
Cargo.lock
generated
172
Cargo.lock
generated
|
|
@ -64,6 +64,12 @@ version = "0.22.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
||||
|
||||
[[package]]
|
||||
name = "base64ct"
|
||||
version = "1.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.12.1"
|
||||
|
|
@ -125,6 +131,12 @@ dependencies = [
|
|||
"inout",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "const-oid"
|
||||
version = "0.9.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.8.7"
|
||||
|
|
@ -163,21 +175,25 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cultcache-rs"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/GameCult/CultLib.git?rev=c13b6ba07e99f2535b455da74d07d88c308731f5#c13b6ba07e99f2535b455da74d07d88c308731f5"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
"cultcache-rs-derive",
|
||||
"fs2",
|
||||
"redb",
|
||||
"rmp-serde",
|
||||
"serde",
|
||||
"serde_bytes",
|
||||
"serde_json",
|
||||
"uuid",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cultcache-rs-derive"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/GameCult/CultLib.git?rev=c13b6ba07e99f2535b455da74d07d88c308731f5#c13b6ba07e99f2535b455da74d07d88c308731f5"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
@ -187,6 +203,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cultmesh-rs"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/GameCult/CultLib.git?rev=c13b6ba07e99f2535b455da74d07d88c308731f5#c13b6ba07e99f2535b455da74d07d88c308731f5"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cultcache-rs",
|
||||
|
|
@ -197,12 +214,14 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cultnet-rs"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/GameCult/CultLib.git?rev=c13b6ba07e99f2535b455da74d07d88c308731f5#c13b6ba07e99f2535b455da74d07d88c308731f5"
|
||||
dependencies = [
|
||||
"aes-gcm",
|
||||
"anyhow",
|
||||
"base64",
|
||||
"chrono",
|
||||
"cultcache-rs",
|
||||
"ed25519-dalek",
|
||||
"hmac",
|
||||
"rand",
|
||||
"rmp-serde",
|
||||
|
|
@ -213,6 +232,45 @@ dependencies = [
|
|||
"sha2",
|
||||
"socket2",
|
||||
"uuid",
|
||||
"windows-sys 0.61.2",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "curve25519-dalek"
|
||||
version = "4.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
"curve25519-dalek-derive",
|
||||
"digest",
|
||||
"fiat-crypto",
|
||||
"rustc_version",
|
||||
"subtle",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "curve25519-dalek-derive"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "der"
|
||||
version = "0.7.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb"
|
||||
dependencies = [
|
||||
"const-oid",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -232,6 +290,30 @@ dependencies = [
|
|||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ed25519"
|
||||
version = "2.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53"
|
||||
dependencies = [
|
||||
"pkcs8",
|
||||
"signature",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ed25519-dalek"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9"
|
||||
dependencies = [
|
||||
"curve25519-dalek",
|
||||
"ed25519",
|
||||
"serde",
|
||||
"sha2",
|
||||
"subtle",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.2"
|
||||
|
|
@ -254,6 +336,12 @@ version = "2.4.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6"
|
||||
|
||||
[[package]]
|
||||
name = "fiat-crypto"
|
||||
version = "0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d"
|
||||
|
||||
[[package]]
|
||||
name = "find-msvc-tools"
|
||||
version = "0.1.9"
|
||||
|
|
@ -416,21 +504,6 @@ version = "2.3.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
|
||||
|
||||
[[package]]
|
||||
name = "idunn-daemon"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
"cultcache-rs",
|
||||
"cultmesh-rs",
|
||||
"cultnet-rs",
|
||||
"odin-core",
|
||||
"rmp-serde",
|
||||
"serde",
|
||||
"sha2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.14.0"
|
||||
|
|
@ -545,11 +618,27 @@ dependencies = [
|
|||
"cultmesh-rs",
|
||||
"cultnet-rs",
|
||||
"pretty_assertions",
|
||||
"rmp-serde",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "odin-daemon"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
"cultcache-rs",
|
||||
"cultmesh-rs",
|
||||
"cultnet-rs",
|
||||
"fs2",
|
||||
"rmp-serde",
|
||||
"serde",
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.21.4"
|
||||
|
|
@ -568,6 +657,16 @@ version = "0.2.17"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
|
||||
|
||||
[[package]]
|
||||
name = "pkcs8"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"
|
||||
dependencies = [
|
||||
"der",
|
||||
"spki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "polyval"
|
||||
version = "0.6.2"
|
||||
|
|
@ -677,6 +776,15 @@ dependencies = [
|
|||
"getrandom 0.3.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redb"
|
||||
version = "4.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de6c3b63e007e90ce536ec2ae4690826136a20ec8dbbbb400daef1bb999d2e36"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rmp"
|
||||
version = "0.8.15"
|
||||
|
|
@ -707,6 +815,15 @@ dependencies = [
|
|||
"serde_bytes",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
|
||||
dependencies = [
|
||||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "1.1.4"
|
||||
|
|
@ -802,6 +919,15 @@ version = "2.0.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
|
||||
|
||||
[[package]]
|
||||
name = "signature"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"
|
||||
dependencies = [
|
||||
"rand_core 0.6.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.12"
|
||||
|
|
@ -832,6 +958,16 @@ dependencies = [
|
|||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spki"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d"
|
||||
dependencies = [
|
||||
"base64ct",
|
||||
"der",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "subtle"
|
||||
version = "2.6.1"
|
||||
|
|
@ -1311,6 +1447,12 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zeroize"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e"
|
||||
|
||||
[[package]]
|
||||
name = "zmij"
|
||||
version = "1.0.21"
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
[workspace]
|
||||
members = [
|
||||
"crates/sleipnir-daemon",
|
||||
"crates/idunn-daemon",
|
||||
"crates/muninn-daemon",
|
||||
"crates/muninn-move-tracker",
|
||||
"crates/muninn-psmoveapi-tracker",
|
||||
"crates/odin-core",
|
||||
"crates/odin-daemon",
|
||||
]
|
||||
resolver = "3"
|
||||
exclude = [
|
||||
"vendor/cultcache-rs",
|
||||
"vendor/cultmesh-rs",
|
||||
"vendor/cultnet-rs",
|
||||
]
|
||||
|
||||
|
|
|
|||
59
README.md
59
README.md
|
|
@ -20,9 +20,27 @@ The first Rust core lives in `crates/odin-core` and already separates typed
|
|||
documents, ingest ports, normalization, and repository persistence so unit tests
|
||||
can use mocked inputs and pipeline smokes can prove typed handoff without
|
||||
booting the whole daemon. Gjallar is not part of that Rust record spine: it is
|
||||
the Nightwing-resident terminal compositor in `E:\Projects\Gjallar` that
|
||||
consumes Odin's accepted `gamecult.eve.surface_state` snapshot over CultNet/RUDP
|
||||
and renders the live display.
|
||||
the Yggdrasil-resident C# composition daemon in `F:\Projects\Gjallar`. It
|
||||
consumes Odin's accepted provider snapshot and publishes one tiled
|
||||
`gjallar.overview` Eve surface for GUI, TUI, and agent lowerers.
|
||||
|
||||
## Typed access discovery
|
||||
|
||||
Odin persists only document schemas it has registered. That is a deliberate
|
||||
typed-store boundary, not a license to accept anonymous blobs and hope later
|
||||
code understands them. The live Yggdrasil body at
|
||||
`ba76a7239a7bb40aa1774df7d93b9388dc27b222`, using CultLib
|
||||
`75c180782aeba7cfd22d6412877397708a4ed28f`, registers Heimdall's provider,
|
||||
command-boundary, Eve-plugin, and transport-profile documents plus
|
||||
Ghostlight's public catalog envelope. Provider daemons own those documents;
|
||||
Odin owns typed catalog acceptance, ordered durable persistence, and exact
|
||||
retrieval. Sensitive auth commands and claims travel directly between the
|
||||
consuming app and Heimdall, never through Odin.
|
||||
|
||||
Ghostlight publishes a `ghostlight.schema_catalog.v1` envelope containing only
|
||||
the state contracts named by its public provider surface. Odin registers that
|
||||
envelope so it can persist and return the provider-owned catalog; it does not
|
||||
register every private Ghostlight receipt, transition, or simulation schema.
|
||||
|
||||
## Typed access discovery
|
||||
|
||||
|
|
@ -37,18 +55,16 @@ Heimdall, never through Odin.
|
|||
|
||||
## Gjallar
|
||||
|
||||
Gjallar is the herald display daemon that runs on Nightwing. Odin sees the
|
||||
Verses, accepts provider surfaces, and publishes the `odin.providers` catalog.
|
||||
Gjallar consumes Odin's accepted surface snapshot over CultNet/RUDP, composes
|
||||
the multi-scale tiled dashboard from that typed state, lowers Odin's canonical
|
||||
marquee tape into continuous gutter text, owns dense character-level update
|
||||
behavior, and writes the visible framebuffer.
|
||||
Gjallar is the herald composition daemon that runs beside Odin and Idunn on
|
||||
Yggdrasil. Odin sees the Verses and accepts provider surfaces. Gjallar consumes
|
||||
that accepted snapshot and publishes one multi-scale tiled Eve surface. Eve
|
||||
clients—including EveCanvas—own graphical and TUI lowering.
|
||||
|
||||
Local package surfaces:
|
||||
|
||||
- Organ contract: `docs/gjallar.md`
|
||||
- Branding Persona state: `personas/gjallar.persona_state.cc`
|
||||
- Runtime source: `E:\Projects\Gjallar`
|
||||
- Runtime source: `F:\Projects\Gjallar`
|
||||
- Avatar asset: `assets/personas/gjallar-avatar.png`
|
||||
- Pixel avatar: `assets/personas/gjallar-avatar-pixel-256.png`
|
||||
|
||||
|
|
@ -65,6 +81,22 @@ Agents do not deploy daemons directly. They configure Idunn's target catalog,
|
|||
release targets, migration commands, and command boundaries so Idunn can run
|
||||
the shared rollout primitive and leave typed witnesses behind.
|
||||
|
||||
Deployment consequence has one final owner: immediately before every migration,
|
||||
deploy, or restart process spawn, Idunn re-opens the root-owned deployment-brake
|
||||
CultCache and the dedicated operator public anchor. A released record must bind
|
||||
the canonical runtime (`yggdrasil` for `yggdrasil-local`), exact source revision
|
||||
(or `restart:<daemon>`), exact request id, operator, signature, and short expiry.
|
||||
Missing, corrupt, engaged, expired, foreign, wrong-scope, substituted, or
|
||||
badly-signed state fails closed. Planning and lifecycle-command publication do
|
||||
not bypass or cache this decision. The store and its sibling `.lock` live in
|
||||
`/var/lib/gamecult/idunn-authority`, a root-owned `root:idunn` `0750` directory;
|
||||
both files are `root:idunn` `0640`, and the daemon's systemd sandbox exposes the
|
||||
directory read-only. Idunn holds the lock shared from its final snapshot read
|
||||
through process spawn, so an engage cannot be defeated by previously captured
|
||||
released bytes. A release is not one-shot: its exact request/revision grant
|
||||
covers each migration and deploy spawn in that rollout until its short expiry;
|
||||
every spawn independently reopens and validates the same grant.
|
||||
|
||||
Local package surfaces:
|
||||
|
||||
- Organ contract: `docs/idunn.md`
|
||||
|
|
@ -75,6 +107,11 @@ Local package surfaces:
|
|||
- Hosted VoidBot release: upstream `main` -> Yggdrasil-local Idunn -> the
|
||||
root-owned `/srv/odin/deploy-manifests/voidbot` actuator. Local checkouts are
|
||||
development and diagnostics only; do not create a local deployment.
|
||||
- Hosted Odin release: branch `codex/ygg-idunn-independent-bootstrap` plus the
|
||||
exact CultLib commit in `deploy/cultlib.commit` -> one immutable
|
||||
`/srv/odin/releases/<commit>` body -> `/srv/odin/current`. Odin signs its own
|
||||
liveness to Idunn, while Idunn starts independently and owns later restart or
|
||||
deployment actuation.
|
||||
- Operator escalation: Bifrost-owned CultMesh crossing; current compatibility
|
||||
delivery calls `scripts\notify-idunn-operator-alarm.ps1`, which asks Bifrost
|
||||
to publish a typed `gamecult.operator_dm_request.v1` CultMesh command document
|
||||
|
|
@ -89,7 +126,7 @@ Local package surfaces:
|
|||
- Outputs: CultCache-backed Odin state, CultMesh documents, and CultNet
|
||||
schema/catalog messages. Browser, GUI, TUI, and framebuffer renderers lower
|
||||
those documents outside Odin instead of asking Odin to host web surfaces.
|
||||
- Derived state: Gjallar's attached Nightwing display, browser dashboards, and future Eve clients are projections of Odin state and provider-owned Eve/CultUI surfaces.
|
||||
- Derived state: Gjallar's aggregate surface is derived from Odin/provider state; Eve clients derive pixels from that aggregate.
|
||||
- Forbidden writers: renderers do not probe the network or decide Verse truth; individual projects do not maintain private incompatible discovery ledgers once Odin can see them.
|
||||
- Shared paths: human dashboards, worker schedulers, Verse bootstrap code, and compact TUI views consume the same registry and schema catalog.
|
||||
- Deletion line: old per-host coordinator scripts should be deleted or reduced to deployment wrappers that start Odin.
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
[package]
|
||||
name = "idunn-daemon"
|
||||
version = "0.1.0"
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
publish.workspace = true
|
||||
|
||||
[[bin]]
|
||||
name = "idunn"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
cultmesh-rs = { path = "../../vendor/cultmesh-rs" }
|
||||
cultcache-rs = { path = "../../vendor/cultcache-rs" }
|
||||
cultnet-rs = { path = "../../vendor/cultnet-rs" }
|
||||
odin-core = { path = "../odin-core" }
|
||||
rmp-serde = "1.3"
|
||||
sha2 = "0.10"
|
||||
chrono = "0.4"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
File diff suppressed because it is too large
Load diff
12
crates/idunn-daemon/tests/fixtures/README.md
vendored
12
crates/idunn-daemon/tests/fixtures/README.md
vendored
|
|
@ -1,12 +0,0 @@
|
|||
# Bifrost release-authority wire fixture
|
||||
|
||||
`bifrost-release-authority-v1.payload.hex` is the exact MessagePack payload
|
||||
emitted on 2026-07-16 by Bifrost's TypeScript CultCache writer
|
||||
`tools/bifrost-repository-release-authority.mjs` for `GameCult/Epiphany`,
|
||||
`refs/heads/main`, commit
|
||||
`0123456789abcdef0123456789abcdef01234567`.
|
||||
|
||||
It is checked in because the TypeScript runtime emits a camelCase MessagePack
|
||||
map while Rust `DatabaseEntry` derives tuple payloads. Idunn must prove it can
|
||||
decode the producer's real wire shape rather than round-tripping a fixture it
|
||||
serialized itself.
|
||||
|
|
@ -1 +0,0 @@
|
|||
de0018aa736368656d614e616d65d924626966726f73742e7265706f7369746f72795f72656c656173655f617574686f72697479ad736368656d6156657273696f6ed927626966726f73742e7265706f7369746f72795f72656c656173655f617574686f726974792e7631ab617574686f726974794964d95272656c656173653a47616d6543756c742f4570697068616e793a726566732f68656164732f6d61696e3a30313233343536373839616263646566303132333435363738396162636465663031323334353637a9636f6d6d616e644964d92163756c746d6573682d636f6d6d616e642d6570697068616e792d72656c65617365b163726f7373696e67526563656970744964b963726f7373696e675f6570697068616e795f72656c65617365b27265706f7369746f727946756c6c4e616d65b147616d6543756c742f4570697068616e79ab757073747265616d526566af726566732f68656164732f6d61696ea9636f6d6d6974536861d92830313233343536373839616263646566303132333435363738396162636465663031323334353637a86465636973696f6ea9617574686f72697a65a6737461747573aa617574686f72697a6564b0706f6c6963794465636973696f6e4964b7706f6c6963792d6570697068616e792d72656c65617365b2617574686f726974795265666572656e6365b8626966726f73743a72656c656173653a6570697068616e79ad6163746f724964656e74697479a86d65746163726174aa736f757263654b696e64b8626966726f73742e676f7665726e616e63652e746f706963a8736f757263654964b6746f7069632d6570697068616e792d72656c65617365ad6570697068616e7952756e4964b472756e2d6570697068616e792d72656c65617365ae6570697068616e794c616e654964b168616e64732d7075626c69636174696f6eb56570697068616e794167656e744964656e74697479a86570697068616e79b265787465726e616c5265636569707455726cd95468747470733a2f2f6769746875622e636f6d2f47616d6543756c742f4570697068616e792f636f6d6d69742f30313233343536373839616263646566303132333435363738396162636465663031323334353637b165787465726e616c526563656970744964d92830313233343536373839616263646566303132333435363738396162636465663031323334353637ac617574686f72697a65644174b4323032362d30372d31365430303a30303a30305aa9657870697265734174a0a97265766f6b65644174a0b07265766f636174696f6e526561736f6ea0
|
||||
|
|
@ -15,8 +15,8 @@ path = "src/main.rs"
|
|||
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
cultmesh-rs = { path = "../../vendor/cultmesh-rs" }
|
||||
cultnet-rs = { path = "../../vendor/cultnet-rs" }
|
||||
cultmesh-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "c13b6ba07e99f2535b455da74d07d88c308731f5", package = "cultmesh-rs" }
|
||||
cultnet-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "c13b6ba07e99f2535b455da74d07d88c308731f5", package = "cultnet-rs" }
|
||||
libc = "0.2"
|
||||
muninn-move-tracker = { path = "../muninn-move-tracker" }
|
||||
muninn-psmoveapi-tracker = { path = "../muninn-psmoveapi-tracker", optional = true }
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -166,19 +166,29 @@ mod linux {
|
|||
}
|
||||
let serial = unsafe { text(psmove_get_serial(handle)) };
|
||||
let move_id = format!("move-{}", serial.replace(':', "").to_ascii_lowercase());
|
||||
if self.controllers.iter().any(|controller| controller.move_id == move_id) {
|
||||
if self
|
||||
.controllers
|
||||
.iter()
|
||||
.any(|controller| controller.move_id == move_id)
|
||||
{
|
||||
unsafe { psmove_disconnect(handle) };
|
||||
continue;
|
||||
}
|
||||
let Some((_, color)) = self.colors.iter().find(|(identity, _)| {
|
||||
identity.eq_ignore_ascii_case(&move_id)
|
||||
}) else {
|
||||
let Some((_, color)) = self
|
||||
.colors
|
||||
.iter()
|
||||
.find(|(identity, _)| identity.eq_ignore_ascii_case(&move_id))
|
||||
else {
|
||||
unsafe { psmove_disconnect(handle) };
|
||||
continue;
|
||||
};
|
||||
let status = unsafe {
|
||||
psmove_tracker_enable_color_observer(
|
||||
self.tracker, handle, color[0], color[1], color[2]
|
||||
self.tracker,
|
||||
handle,
|
||||
color[0],
|
||||
color[1],
|
||||
color[2],
|
||||
)
|
||||
};
|
||||
if status == TRACKER_CALIBRATED {
|
||||
|
|
@ -192,9 +202,11 @@ mod linux {
|
|||
}
|
||||
|
||||
pub fn set_expected_color(&mut self, move_id: &str, color: [u8; 3]) -> bool {
|
||||
let Some(controller) = self.controllers.iter().find(|controller| {
|
||||
controller.move_id.eq_ignore_ascii_case(move_id)
|
||||
}) else {
|
||||
let Some(controller) = self
|
||||
.controllers
|
||||
.iter()
|
||||
.find(|controller| controller.move_id.eq_ignore_ascii_case(move_id))
|
||||
else {
|
||||
return false;
|
||||
};
|
||||
unsafe {
|
||||
|
|
@ -275,7 +287,9 @@ mod linux {
|
|||
if value.is_null() {
|
||||
return String::new();
|
||||
}
|
||||
unsafe { CStr::from_ptr(value) }.to_string_lossy().into_owned()
|
||||
unsafe { CStr::from_ptr(value) }
|
||||
.to_string_lossy()
|
||||
.into_owned()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -301,20 +315,29 @@ impl PsmoveApiTracker {
|
|||
unreachable!()
|
||||
}
|
||||
|
||||
pub fn calibrate_connected(&mut self) -> usize { 0 }
|
||||
pub fn calibrate_connected(&mut self) -> usize {
|
||||
0
|
||||
}
|
||||
|
||||
pub fn observe_connected(&mut self) -> usize { 0 }
|
||||
pub fn observe_connected(&mut self) -> usize {
|
||||
0
|
||||
}
|
||||
|
||||
pub fn set_expected_color(&mut self, _move_id: &str, _color: [u8; 3]) -> bool { false }
|
||||
pub fn set_expected_color(&mut self, _move_id: &str, _color: [u8; 3]) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn tracked_controller_count(&self) -> usize { 0 }
|
||||
pub fn tracked_controller_count(&self) -> usize {
|
||||
0
|
||||
}
|
||||
|
||||
pub fn update(&mut self) -> Vec<PsmoveApiObservation> {
|
||||
Vec::new()
|
||||
}
|
||||
|
||||
|
||||
pub fn rgb_image(&self) -> Option<(u32, u32, Vec<u8>)> { None }
|
||||
pub fn rgb_image(&self) -> Option<(u32, u32, Vec<u8>)> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
|||
|
|
@ -11,12 +11,13 @@ path = "src/lib.rs"
|
|||
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
cultcache-rs = { path = "../../vendor/cultcache-rs" }
|
||||
cultmesh-rs = { path = "../../vendor/cultmesh-rs" }
|
||||
cultcache-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "c13b6ba07e99f2535b455da74d07d88c308731f5", package = "cultcache-rs" }
|
||||
cultmesh-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "c13b6ba07e99f2535b455da74d07d88c308731f5", package = "cultmesh-rs" }
|
||||
serde_json = "1"
|
||||
cultnet-rs = { path = "../../vendor/cultnet-rs" }
|
||||
cultnet-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "c13b6ba07e99f2535b455da74d07d88c308731f5", package = "cultnet-rs" }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
|
||||
[dev-dependencies]
|
||||
rmp-serde = "1.3"
|
||||
pretty_assertions = "1.4"
|
||||
tempfile = "3"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
use anyhow::{Context, Result};
|
||||
use cultmesh_rs::{CultMesh, CultMeshNodeOptions};
|
||||
use odin_core::{MuninnMoveEvidenceTransportHealthRecord, MuninnMoveTrackerHealthRecord, OdinDocuments};
|
||||
use odin_core::{
|
||||
MuninnMoveEvidenceTransportHealthRecord, MuninnMoveTrackerHealthRecord, OdinDocuments,
|
||||
};
|
||||
use std::{env, path::PathBuf};
|
||||
|
||||
fn main() -> Result<()> {
|
||||
|
|
@ -42,16 +44,29 @@ fn main() -> Result<()> {
|
|||
record.last_observation_at,
|
||||
record.image_mean_rgb,
|
||||
record.image_peak_rgb,
|
||||
record.color_evidence_move_ids.iter().cloned().zip(record.color_evidence_pixel_counts.iter().copied()).collect::<Vec<_>>(),
|
||||
record
|
||||
.color_evidence_move_ids
|
||||
.iter()
|
||||
.cloned()
|
||||
.zip(record.color_evidence_pixel_counts.iter().copied())
|
||||
.collect::<Vec<_>>(),
|
||||
record.updated_at,
|
||||
record.detail,
|
||||
);
|
||||
}
|
||||
for record in node.cache().get_all::<MuninnMoveEvidenceTransportHealthRecord>().unwrap_or_default() {
|
||||
for record in node
|
||||
.cache()
|
||||
.get_all::<MuninnMoveEvidenceTransportHealthRecord>()
|
||||
.unwrap_or_default()
|
||||
{
|
||||
println!(
|
||||
"stream={} produced={} local_admitted={} remote_handoffs={} remote_sends={} updated={}",
|
||||
record.stream_id, record.produced_frames, record.local_ring_admissions,
|
||||
record.remote_handoffs, record.remote_sends, record.updated_at,
|
||||
record.stream_id,
|
||||
record.produced_frames,
|
||||
record.local_ring_admissions,
|
||||
record.remote_handoffs,
|
||||
record.remote_sends,
|
||||
record.updated_at,
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -1,6 +1,20 @@
|
|||
use cultcache_rs::DatabaseEntry;
|
||||
pub use cultnet_rs::{
|
||||
GAMECULT_SERVICE_TRUST_ANCHOR_SCHEMA, GameCultServiceTrustAnchorRecord,
|
||||
IDUNN_AUTHENTICATED_PROVIDER_HEALTH_PROJECTION_SCHEMA,
|
||||
IDUNN_AUTHENTICATED_PROVIDER_HEALTH_PROJECTION_SIGNING_PURPOSE,
|
||||
IDUNN_DAEMON_HEALTH_TRUST_BINDING_SCHEMA, IDUNN_PROVIDER_ACTIVE_REASON,
|
||||
IDUNN_PROVIDER_DEGRADED_REASON, IDUNN_PROVIDER_FAILED_REASON, IDUNN_PROVIDER_WARMING_REASON,
|
||||
IDUNN_SIGNED_DAEMON_HEALTH_SCHEMA, IdunnAuthenticatedProviderHealthProjectionRecord,
|
||||
IdunnDaemonHealthTrustBindingRecord, IdunnSignedDaemonHealthRecord,
|
||||
authenticated_provider_health_reason_code,
|
||||
};
|
||||
#[cfg(test)]
|
||||
use cultnet_rs::{GameCultProviderHealthIdentity, derive_service_identity_id};
|
||||
use serde_json::Value;
|
||||
|
||||
use anyhow::{Result, bail};
|
||||
|
||||
pub const ODIN_SNAPSHOT_SCHEMA: &str = "odin.snapshot.v1";
|
||||
pub const ODIN_VERSE_SCHEMA: &str = "odin.verse.v1";
|
||||
pub const ODIN_SERVICE_SCHEMA: &str = "odin.service.v1";
|
||||
|
|
@ -13,13 +27,15 @@ pub const EVE_PROVIDER_ADVERTISEMENT_SCHEMA: &str = "gamecult.eve.provider_adver
|
|||
pub const VOIDBOT_SWARM_STATE_SNAPSHOT_SCHEMA: &str = "voidbot.swarm_state_snapshot.v1";
|
||||
pub const IDUNN_DESIRED_DAEMON_SCHEMA: &str = "idunn.desired_daemon.v1";
|
||||
pub const IDUNN_DAEMON_HEALTH_SCHEMA: &str = "idunn.daemon_health.v1";
|
||||
pub const IDUNN_SIGNED_HEALTH_ADMISSION_SCHEMA: &str = "idunn.signed_health_admission.v1";
|
||||
pub const IDUNN_KEEPALIVE_DECISION_SCHEMA: &str = "idunn.keepalive_decision.v1";
|
||||
pub const IDUNN_RESTART_REQUEST_SCHEMA: &str = "idunn.restart_request.v1";
|
||||
pub const IDUNN_RESTART_RESULT_SCHEMA: &str = "idunn.restart_result.v1";
|
||||
pub const IDUNN_DEPLOYMENT_REQUEST_SCHEMA: &str = "idunn.deployment_request.v2";
|
||||
pub const IDUNN_CURRENT_DEPLOYMENT_REQUEST_SCHEMA: &str = "idunn.current_deployment_request.v1";
|
||||
pub const IDUNN_DEPLOYMENT_RESULT_SCHEMA: &str = "idunn.deployment_result.v1";
|
||||
pub const IDUNN_LIFECYCLE_COMMAND_SCHEMA: &str = "idunn.lifecycle_command.v1";
|
||||
pub const IDUNN_RELEASE_TARGET_SCHEMA: &str = "idunn.release_target.v2";
|
||||
pub const IDUNN_RELEASE_TARGET_SCHEMA: &str = "idunn.release_target.v3";
|
||||
pub const IDUNN_DEPLOYMENT_ARTIFACT_SCHEMA: &str = "idunn.deployment_artifact.v2";
|
||||
pub const BIFROST_REPOSITORY_RELEASE_AUTHORITY_SCHEMA: &str =
|
||||
"bifrost.repository_release_authority.v1";
|
||||
|
|
@ -34,6 +50,14 @@ pub const IDUNN_DAEMON_TRANSPORT_PROFILE_SCHEMA: &str = "idunn.daemon_transport_
|
|||
pub const IDUNN_COMMAND_BOUNDARY_SCHEMA: &str = "idunn.command_boundary.v1";
|
||||
pub const IDUNN_RUNTIME_TRANSPORT_CHECK_SCHEMA: &str = "idunn.runtime_transport_check.v1";
|
||||
pub const IDUNN_RUDP_HEALTH_INGRESS_SCHEMA: &str = "idunn.rudp_health_ingress.v1";
|
||||
pub const IDUNN_AUTHENTICATED_DAEMON_HEALTH_ADMISSION_SCHEMA: &str =
|
||||
"idunn.authenticated_daemon_health_admission.v1";
|
||||
pub const IDUNN_RUNTIME_TRAFFIC_ADMISSION_SCHEMA: &str = "idunn.runtime_traffic_admission.v2";
|
||||
pub const IDUNN_CODEX_CONNECTOR_RUNTIME_TRAFFIC_ADMISSION_RECORD_KEY: &str =
|
||||
"yggdrasil-codex-connector";
|
||||
pub const IDUNN_GHOSTLIGHT_RUNTIME_TRAFFIC_ADMISSION_RECORD_KEY: &str = "yggdrasil-ghostlight";
|
||||
pub const IDUNN_UNSIGNED_DAEMON_HEALTH_DIAGNOSTIC_SCHEMA: &str =
|
||||
"idunn.unsigned_daemon_health_diagnostic.v1";
|
||||
pub const MUNINN_TELEMETRY_SURFACE_SCHEMA: &str = "muninn.telemetry_surface.v1";
|
||||
pub const MUNINN_CAPTURE_STREAM_SCHEMA: &str = "muninn.capture_stream.v1";
|
||||
pub const MUNINN_CAPTURE_STREAM_COMMAND_SCHEMA: &str = "muninn.capture_stream_command.v1";
|
||||
|
|
@ -49,7 +73,8 @@ pub const MUNINN_MOVE_IDENTITY_SCHEMA: &str = "muninn.move_identity.v1";
|
|||
pub const MUNINN_MOVE_LIGHT_COMMAND_SCHEMA: &str = "muninn.move_light_command.v1";
|
||||
pub const MUNINN_MOVE_HUE_PROGRAM_SCHEMA: &str = "muninn.move_hue_program.v1";
|
||||
pub const MUNINN_MOVE_TRACKER_HEALTH_SCHEMA: &str = "muninn.move_tracker_health.v1";
|
||||
pub const MUNINN_MOVE_EVIDENCE_TRANSPORT_HEALTH_SCHEMA: &str = "muninn.move_evidence_transport_health.v1";
|
||||
pub const MUNINN_MOVE_EVIDENCE_TRANSPORT_HEALTH_SCHEMA: &str =
|
||||
"muninn.move_evidence_transport_health.v1";
|
||||
pub const MUNINN_QUEST_ACCESS_SCHEMA: &str = "muninn.quest_access.v1";
|
||||
pub const MUNINN_COMMAND_BOUNDARY_SCHEMA: &str = "muninn.command_boundary.v1";
|
||||
pub const MUNINN_TRANSPORT_PROFILE_SCHEMA: &str = "muninn.transport_profile.v1";
|
||||
|
|
@ -270,6 +295,305 @@ pub struct IdunnDaemonHealthRecord {
|
|||
pub transport: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
|
||||
#[cultcache(
|
||||
type = "idunn.signed_health_admission",
|
||||
schema = "idunn.signed_health_admission.v1"
|
||||
)]
|
||||
pub struct IdunnSignedHealthAdmissionRecord {
|
||||
#[cultcache(key = 0)]
|
||||
pub daemon_id: String,
|
||||
#[cultcache(key = 1)]
|
||||
pub state: String,
|
||||
#[cultcache(key = 2)]
|
||||
pub observed_at: String,
|
||||
#[cultcache(key = 3)]
|
||||
pub admitted_at: String,
|
||||
#[cultcache(key = 4)]
|
||||
pub health_contract: String,
|
||||
#[cultcache(key = 5)]
|
||||
pub deployment_request_id: String,
|
||||
#[cultcache(key = 6)]
|
||||
pub release_id: String,
|
||||
#[cultcache(key = 7)]
|
||||
pub release_witness_sha256: String,
|
||||
#[cultcache(key = 8)]
|
||||
pub source_commit: String,
|
||||
#[cultcache(key = 9)]
|
||||
pub publisher_incarnation_id: String,
|
||||
#[cultcache(key = 10)]
|
||||
pub publisher_sequence: u64,
|
||||
#[cultcache(key = 11)]
|
||||
pub publisher_process_created_at: String,
|
||||
#[cultcache(key = 12)]
|
||||
pub signer_identity_id: String,
|
||||
#[cultcache(key = 13)]
|
||||
pub signed_health_sha256: String,
|
||||
}
|
||||
|
||||
/// Idunn-owned judgment joining one verified provider statement to the exact
|
||||
/// root trust binding used to admit it. Managed-health reads must rejoin this
|
||||
/// record with both current objects; a health row by itself is not authority.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
|
||||
#[cultcache(
|
||||
type = "idunn.authenticated_daemon_health_admission",
|
||||
schema = "idunn.authenticated_daemon_health_admission.v1"
|
||||
)]
|
||||
pub struct IdunnAuthenticatedDaemonHealthAdmissionRecord {
|
||||
#[cultcache(key = 0)]
|
||||
pub schema_version: String,
|
||||
#[cultcache(key = 1)]
|
||||
pub daemon_id: String,
|
||||
#[cultcache(key = 2)]
|
||||
pub health_contract: String,
|
||||
#[cultcache(key = 3)]
|
||||
pub source_runtime_id: String,
|
||||
#[cultcache(key = 4)]
|
||||
pub state: String,
|
||||
#[cultcache(key = 5)]
|
||||
pub observed_at_unix_millis: u64,
|
||||
#[cultcache(key = 6)]
|
||||
pub admitted_at_unix_millis: u64,
|
||||
#[cultcache(key = 7)]
|
||||
pub trust_binding_id: String,
|
||||
#[cultcache(key = 8)]
|
||||
pub trust_binding_sha256: String,
|
||||
#[cultcache(key = 9)]
|
||||
pub signer_identity_id: String,
|
||||
#[cultcache(key = 10)]
|
||||
pub publisher_incarnation_id: String,
|
||||
#[cultcache(key = 11)]
|
||||
pub publisher_sequence: u64,
|
||||
#[cultcache(key = 12)]
|
||||
pub signed_health_sha256: String,
|
||||
#[cultcache(key = 13)]
|
||||
pub release_id: Option<String>,
|
||||
#[cultcache(key = 14)]
|
||||
pub release_witness_sha256: Option<String>,
|
||||
#[cultcache(key = 15)]
|
||||
pub source_commit: Option<String>,
|
||||
#[cultcache(key = 16)]
|
||||
pub deployment_id: Option<String>,
|
||||
#[cultcache(key = 17)]
|
||||
pub private_state_exposed: bool,
|
||||
#[cultcache(key = 18, default)]
|
||||
pub activation_witness_sha256: Option<String>,
|
||||
}
|
||||
|
||||
impl IdunnAuthenticatedDaemonHealthAdmissionRecord {
|
||||
pub fn validate(&self) -> Result<()> {
|
||||
if self.schema_version != IDUNN_AUTHENTICATED_DAEMON_HEALTH_ADMISSION_SCHEMA {
|
||||
bail!("authenticated daemon health admission schema is unsupported");
|
||||
}
|
||||
validate_identifier(&self.daemon_id, "daemon id")?;
|
||||
validate_identifier(&self.health_contract, "health contract")?;
|
||||
validate_identifier(&self.source_runtime_id, "source runtime id")?;
|
||||
validate_identifier(&self.trust_binding_id, "trust binding id")?;
|
||||
validate_identifier(&self.signer_identity_id, "signer identity id")?;
|
||||
validate_identifier(&self.publisher_incarnation_id, "publisher incarnation id")?;
|
||||
if !matches!(
|
||||
self.state.as_str(),
|
||||
"active" | "warming" | "degraded" | "failed"
|
||||
) || self.observed_at_unix_millis == 0
|
||||
|| self.admitted_at_unix_millis < self.observed_at_unix_millis
|
||||
|| self.publisher_sequence == 0
|
||||
|| !is_sha256(&self.trust_binding_sha256)
|
||||
|| !is_sha256(&self.signed_health_sha256)
|
||||
{
|
||||
bail!("authenticated daemon health admission shape is invalid");
|
||||
}
|
||||
validate_optional_release_binding(
|
||||
&self.release_id,
|
||||
&self.release_witness_sha256,
|
||||
&self.source_commit,
|
||||
)?;
|
||||
validate_optional_identifier(&self.deployment_id, "deployment id")?;
|
||||
if self
|
||||
.activation_witness_sha256
|
||||
.as_deref()
|
||||
.is_some_and(|value| !is_sha256(value))
|
||||
{
|
||||
bail!("authenticated daemon health activation witness is malformed");
|
||||
}
|
||||
if self.private_state_exposed {
|
||||
bail!("authenticated daemon health admission exposes private state");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Idunn-issued traffic authority for a release that has proved its exact
|
||||
/// deployment, activation, and authenticated provider-health lineage.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
|
||||
#[cultcache(
|
||||
type = "idunn.runtime_traffic_admission",
|
||||
schema = "idunn.runtime_traffic_admission.v2"
|
||||
)]
|
||||
pub struct IdunnRuntimeTrafficAdmissionRecord {
|
||||
#[cultcache(key = 0)]
|
||||
pub schema_version: String,
|
||||
#[cultcache(key = 1)]
|
||||
pub daemon_id: String,
|
||||
#[cultcache(key = 2)]
|
||||
pub release_id: String,
|
||||
#[cultcache(key = 3)]
|
||||
pub release_witness_sha256: String,
|
||||
#[cultcache(key = 4)]
|
||||
pub source_commit: String,
|
||||
#[cultcache(key = 5)]
|
||||
pub deployment_id: String,
|
||||
#[cultcache(key = 6)]
|
||||
pub activation_witness_sha256: String,
|
||||
#[cultcache(key = 7)]
|
||||
pub signed_health_sha256: String,
|
||||
#[cultcache(key = 8)]
|
||||
pub publisher_incarnation_id: String,
|
||||
#[cultcache(key = 9)]
|
||||
pub publisher_sequence: u64,
|
||||
#[cultcache(key = 10)]
|
||||
pub signer_identity_id: String,
|
||||
#[cultcache(key = 11)]
|
||||
pub runtime_process_id: u32,
|
||||
#[cultcache(key = 12)]
|
||||
pub runtime_process_starttime_ticks: u64,
|
||||
}
|
||||
|
||||
impl IdunnRuntimeTrafficAdmissionRecord {
|
||||
pub fn validate(&self) -> Result<()> {
|
||||
if self.schema_version != IDUNN_RUNTIME_TRAFFIC_ADMISSION_SCHEMA {
|
||||
bail!("runtime traffic admission schema is unsupported");
|
||||
}
|
||||
if self.daemon_id != IDUNN_CODEX_CONNECTOR_RUNTIME_TRAFFIC_ADMISSION_RECORD_KEY
|
||||
&& self.daemon_id != IDUNN_GHOSTLIGHT_RUNTIME_TRAFFIC_ADMISSION_RECORD_KEY
|
||||
{
|
||||
bail!("runtime traffic admission daemon is unsupported");
|
||||
}
|
||||
validate_identifier(&self.daemon_id, "daemon id")?;
|
||||
validate_identifier(&self.release_id, "release id")?;
|
||||
validate_identifier(&self.deployment_id, "deployment id")?;
|
||||
validate_identifier(&self.publisher_incarnation_id, "publisher incarnation id")?;
|
||||
validate_identifier(&self.signer_identity_id, "signer identity id")?;
|
||||
if !is_sha256(&self.release_witness_sha256)
|
||||
|| !is_lower_hex(&self.source_commit, 40)
|
||||
|| !is_sha256(&self.activation_witness_sha256)
|
||||
|| !is_sha256(&self.signed_health_sha256)
|
||||
|| self.publisher_sequence == 0
|
||||
|| self.runtime_process_id == 0
|
||||
|| self.runtime_process_starttime_ticks == 0
|
||||
{
|
||||
bail!("runtime traffic admission lineage is malformed");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Quarantined observation of the retired unsigned wire contract. This may
|
||||
/// explain missing authenticated health but can never satisfy managed health.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
|
||||
#[cultcache(
|
||||
type = "idunn.unsigned_daemon_health_diagnostic",
|
||||
schema = "idunn.unsigned_daemon_health_diagnostic.v1"
|
||||
)]
|
||||
pub struct IdunnUnsignedDaemonHealthDiagnosticRecord {
|
||||
#[cultcache(key = 0)]
|
||||
pub schema_version: String,
|
||||
#[cultcache(key = 1)]
|
||||
pub diagnostic_id: String,
|
||||
#[cultcache(key = 2)]
|
||||
pub daemon_id: String,
|
||||
#[cultcache(key = 3)]
|
||||
pub claimed_state: String,
|
||||
#[cultcache(key = 4)]
|
||||
pub claimed_detail: String,
|
||||
#[cultcache(key = 5)]
|
||||
pub claimed_observed_at: String,
|
||||
#[cultcache(key = 6)]
|
||||
pub claimed_health_contract: String,
|
||||
#[cultcache(key = 7)]
|
||||
pub transport_source_runtime_id: Option<String>,
|
||||
#[cultcache(key = 8)]
|
||||
pub transport_source_role: Option<String>,
|
||||
#[cultcache(key = 9)]
|
||||
pub received_at_unix_millis: u64,
|
||||
#[cultcache(key = 10)]
|
||||
pub authority: String,
|
||||
#[cultcache(key = 11)]
|
||||
pub private_state_exposed: bool,
|
||||
}
|
||||
|
||||
impl IdunnUnsignedDaemonHealthDiagnosticRecord {
|
||||
pub fn validate(&self) -> Result<()> {
|
||||
if self.schema_version != IDUNN_UNSIGNED_DAEMON_HEALTH_DIAGNOSTIC_SCHEMA {
|
||||
bail!("unsigned daemon health diagnostic schema is unsupported");
|
||||
}
|
||||
validate_identifier(&self.diagnostic_id, "diagnostic id")?;
|
||||
validate_identifier(&self.daemon_id, "daemon id")?;
|
||||
validate_identifier(&self.claimed_state, "claimed state")?;
|
||||
validate_identifier(&self.claimed_health_contract, "claimed health contract")?;
|
||||
validate_optional_identifier(
|
||||
&self.transport_source_runtime_id,
|
||||
"transport source runtime id",
|
||||
)?;
|
||||
validate_optional_identifier(&self.transport_source_role, "transport source role")?;
|
||||
if self.claimed_detail.len() > 512
|
||||
|| self.claimed_observed_at.trim().is_empty()
|
||||
|| self.received_at_unix_millis == 0
|
||||
|| self.authority != "diagnostic-only"
|
||||
|| self.private_state_exposed
|
||||
{
|
||||
bail!("unsigned daemon health diagnostic shape is invalid");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn validate_identifier(value: &str, label: &str) -> Result<()> {
|
||||
if value.trim().is_empty() || value.len() > 256 || value.chars().any(char::is_control) {
|
||||
bail!("{label} is empty, oversized, or contains control characters");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn validate_optional_identifier(value: &Option<String>, label: &str) -> Result<()> {
|
||||
if let Some(value) = value {
|
||||
validate_identifier(value, label)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn validate_optional_release_binding(
|
||||
release_id: &Option<String>,
|
||||
witness: &Option<String>,
|
||||
source_commit: &Option<String>,
|
||||
) -> Result<()> {
|
||||
if release_id.is_some() || witness.is_some() || source_commit.is_some() {
|
||||
validate_optional_identifier(release_id, "release id")?;
|
||||
let witness = witness
|
||||
.as_deref()
|
||||
.ok_or_else(|| anyhow::anyhow!("release witness is absent"))?;
|
||||
let commit = source_commit
|
||||
.as_deref()
|
||||
.ok_or_else(|| anyhow::anyhow!("source commit is absent"))?;
|
||||
if release_id.is_none() || !is_sha256(witness) || !is_lower_hex(commit, 40) {
|
||||
bail!("release binding is incomplete or malformed");
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn is_sha256(value: &str) -> bool {
|
||||
value
|
||||
.strip_prefix("sha256-")
|
||||
.is_some_and(|digest| is_lower_hex(digest, 64))
|
||||
}
|
||||
|
||||
fn is_lower_hex(value: &str, length: usize) -> bool {
|
||||
value.len() == length
|
||||
&& value
|
||||
.bytes()
|
||||
.all(|byte| byte.is_ascii_hexdigit() && !byte.is_ascii_uppercase())
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
|
||||
#[cultcache(
|
||||
type = "idunn.keepalive_decision",
|
||||
|
|
@ -352,6 +676,22 @@ pub struct IdunnDeploymentRequestRecord {
|
|||
pub requires_bifrost_authority: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
|
||||
#[cultcache(
|
||||
type = "idunn.current_deployment_request",
|
||||
schema = "idunn.current_deployment_request.v1"
|
||||
)]
|
||||
pub struct IdunnCurrentDeploymentRequestRecord {
|
||||
#[cultcache(key = 0)]
|
||||
pub daemon_id: String,
|
||||
#[cultcache(key = 1)]
|
||||
pub request_id: String,
|
||||
#[cultcache(key = 2)]
|
||||
pub sequence: u64,
|
||||
#[cultcache(key = 3)]
|
||||
pub updated_at: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
|
||||
#[cultcache(
|
||||
type = "idunn.deployment_result",
|
||||
|
|
@ -399,7 +739,7 @@ pub struct IdunnLifecycleCommandRecord {
|
|||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
|
||||
#[cultcache(type = "idunn.release_target", schema = "idunn.release_target.v2")]
|
||||
#[cultcache(type = "idunn.release_target", schema = "idunn.release_target.v3")]
|
||||
pub struct IdunnReleaseTargetRecord {
|
||||
#[cultcache(key = 0)]
|
||||
pub target_id: String,
|
||||
|
|
@ -443,6 +783,8 @@ pub struct IdunnReleaseTargetRecord {
|
|||
pub requires_bifrost_authority: bool,
|
||||
#[cultcache(key = 20, default)]
|
||||
pub observed_upstream_revision: String,
|
||||
#[cultcache(key = 21)]
|
||||
pub minimum_source_revision: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
|
||||
|
|
@ -1286,46 +1628,85 @@ pub struct MuninnMoveHueProgramRecord {
|
|||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DatabaseEntry)]
|
||||
#[cultcache(type = "muninn.move_tracker_health", schema = "muninn.move_tracker_health.v1")]
|
||||
#[cultcache(
|
||||
type = "muninn.move_tracker_health",
|
||||
schema = "muninn.move_tracker_health.v1"
|
||||
)]
|
||||
pub struct MuninnMoveTrackerHealthRecord {
|
||||
#[cultcache(key = 0)] pub health_id: String,
|
||||
#[cultcache(key = 1)] pub host_id: String,
|
||||
#[cultcache(key = 2)] pub camera_id: String,
|
||||
#[cultcache(key = 3)] pub camera_index: i32,
|
||||
#[cultcache(key = 4)] pub state: String,
|
||||
#[cultcache(key = 5)] pub camera_name: String,
|
||||
#[cultcache(key = 6)] pub camera_api: String,
|
||||
#[cultcache(key = 7)] pub width: u32,
|
||||
#[cultcache(key = 8)] pub height: u32,
|
||||
#[cultcache(key = 9)] pub exposure: f32,
|
||||
#[cultcache(key = 10)] pub calibrated_controller_count: u32,
|
||||
#[cultcache(key = 11)] pub update_count: u64,
|
||||
#[cultcache(key = 12)] pub observation_count: u64,
|
||||
#[cultcache(key = 13)] pub latest_observation_count: u32,
|
||||
#[cultcache(key = 14)] pub last_observation_at: String,
|
||||
#[cultcache(key = 15)] pub detail: String,
|
||||
#[cultcache(key = 16)] pub updated_at: String,
|
||||
#[cultcache(key = 17, default)] pub image_mean_rgb: Vec<u32>,
|
||||
#[cultcache(key = 18, default)] pub image_peak_rgb: Vec<u32>,
|
||||
#[cultcache(key = 19, default)] pub color_evidence_move_ids: Vec<String>,
|
||||
#[cultcache(key = 20, default)] pub color_evidence_pixel_counts: Vec<u32>,
|
||||
#[cultcache(key = 21, default)] pub rejected_stale_count: u64,
|
||||
#[cultcache(key = 22, default)] pub rejected_radius_count: u64,
|
||||
#[cultcache(key = 23, default)] pub rejected_bounds_count: u64,
|
||||
#[cultcache(key = 24, default)] pub rejected_continuity_count: u64,
|
||||
#[cultcache(key = 0)]
|
||||
pub health_id: String,
|
||||
#[cultcache(key = 1)]
|
||||
pub host_id: String,
|
||||
#[cultcache(key = 2)]
|
||||
pub camera_id: String,
|
||||
#[cultcache(key = 3)]
|
||||
pub camera_index: i32,
|
||||
#[cultcache(key = 4)]
|
||||
pub state: String,
|
||||
#[cultcache(key = 5)]
|
||||
pub camera_name: String,
|
||||
#[cultcache(key = 6)]
|
||||
pub camera_api: String,
|
||||
#[cultcache(key = 7)]
|
||||
pub width: u32,
|
||||
#[cultcache(key = 8)]
|
||||
pub height: u32,
|
||||
#[cultcache(key = 9)]
|
||||
pub exposure: f32,
|
||||
#[cultcache(key = 10)]
|
||||
pub calibrated_controller_count: u32,
|
||||
#[cultcache(key = 11)]
|
||||
pub update_count: u64,
|
||||
#[cultcache(key = 12)]
|
||||
pub observation_count: u64,
|
||||
#[cultcache(key = 13)]
|
||||
pub latest_observation_count: u32,
|
||||
#[cultcache(key = 14)]
|
||||
pub last_observation_at: String,
|
||||
#[cultcache(key = 15)]
|
||||
pub detail: String,
|
||||
#[cultcache(key = 16)]
|
||||
pub updated_at: String,
|
||||
#[cultcache(key = 17, default)]
|
||||
pub image_mean_rgb: Vec<u32>,
|
||||
#[cultcache(key = 18, default)]
|
||||
pub image_peak_rgb: Vec<u32>,
|
||||
#[cultcache(key = 19, default)]
|
||||
pub color_evidence_move_ids: Vec<String>,
|
||||
#[cultcache(key = 20, default)]
|
||||
pub color_evidence_pixel_counts: Vec<u32>,
|
||||
#[cultcache(key = 21, default)]
|
||||
pub rejected_stale_count: u64,
|
||||
#[cultcache(key = 22, default)]
|
||||
pub rejected_radius_count: u64,
|
||||
#[cultcache(key = 23, default)]
|
||||
pub rejected_bounds_count: u64,
|
||||
#[cultcache(key = 24, default)]
|
||||
pub rejected_continuity_count: u64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
|
||||
#[cultcache(type = "muninn.move_evidence_transport_health", schema = "muninn.move_evidence_transport_health.v1")]
|
||||
#[cultcache(
|
||||
type = "muninn.move_evidence_transport_health",
|
||||
schema = "muninn.move_evidence_transport_health.v1"
|
||||
)]
|
||||
pub struct MuninnMoveEvidenceTransportHealthRecord {
|
||||
#[cultcache(key = 0)] pub health_id: String,
|
||||
#[cultcache(key = 1)] pub host_id: String,
|
||||
#[cultcache(key = 2)] pub stream_id: String,
|
||||
#[cultcache(key = 3)] pub produced_frames: u64,
|
||||
#[cultcache(key = 4)] pub local_ring_admissions: u64,
|
||||
#[cultcache(key = 5)] pub remote_handoffs: u64,
|
||||
#[cultcache(key = 6)] pub remote_sends: u64,
|
||||
#[cultcache(key = 7)] pub updated_at: String,
|
||||
#[cultcache(key = 0)]
|
||||
pub health_id: String,
|
||||
#[cultcache(key = 1)]
|
||||
pub host_id: String,
|
||||
#[cultcache(key = 2)]
|
||||
pub stream_id: String,
|
||||
#[cultcache(key = 3)]
|
||||
pub produced_frames: u64,
|
||||
#[cultcache(key = 4)]
|
||||
pub local_ring_admissions: u64,
|
||||
#[cultcache(key = 5)]
|
||||
pub remote_handoffs: u64,
|
||||
#[cultcache(key = 6)]
|
||||
pub remote_sends: u64,
|
||||
#[cultcache(key = 7)]
|
||||
pub updated_at: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
|
||||
|
|
@ -1421,10 +1802,19 @@ cultmesh_rs::cultmesh_documents!(OdinDocuments {
|
|||
VoidBotSwarmStateSnapshotCompatRecord => VOIDBOT_SWARM_STATE_SNAPSHOT_SCHEMA,
|
||||
IdunnDesiredDaemonRecord => IDUNN_DESIRED_DAEMON_SCHEMA,
|
||||
IdunnDaemonHealthRecord => IDUNN_DAEMON_HEALTH_SCHEMA,
|
||||
IdunnSignedHealthAdmissionRecord => IDUNN_SIGNED_HEALTH_ADMISSION_SCHEMA,
|
||||
IdunnSignedDaemonHealthRecord => IDUNN_SIGNED_DAEMON_HEALTH_SCHEMA,
|
||||
IdunnDaemonHealthTrustBindingRecord => IDUNN_DAEMON_HEALTH_TRUST_BINDING_SCHEMA,
|
||||
IdunnAuthenticatedDaemonHealthAdmissionRecord => IDUNN_AUTHENTICATED_DAEMON_HEALTH_ADMISSION_SCHEMA,
|
||||
IdunnRuntimeTrafficAdmissionRecord => IDUNN_RUNTIME_TRAFFIC_ADMISSION_SCHEMA,
|
||||
IdunnUnsignedDaemonHealthDiagnosticRecord => IDUNN_UNSIGNED_DAEMON_HEALTH_DIAGNOSTIC_SCHEMA,
|
||||
GameCultServiceTrustAnchorRecord => GAMECULT_SERVICE_TRUST_ANCHOR_SCHEMA,
|
||||
IdunnAuthenticatedProviderHealthProjectionRecord => IDUNN_AUTHENTICATED_PROVIDER_HEALTH_PROJECTION_SCHEMA,
|
||||
IdunnKeepaliveDecisionRecord => IDUNN_KEEPALIVE_DECISION_SCHEMA,
|
||||
IdunnRestartRequestRecord => IDUNN_RESTART_REQUEST_SCHEMA,
|
||||
IdunnRestartResultRecord => IDUNN_RESTART_RESULT_SCHEMA,
|
||||
IdunnDeploymentRequestRecord => IDUNN_DEPLOYMENT_REQUEST_SCHEMA,
|
||||
IdunnCurrentDeploymentRequestRecord => IDUNN_CURRENT_DEPLOYMENT_REQUEST_SCHEMA,
|
||||
IdunnDeploymentResultRecord => IDUNN_DEPLOYMENT_RESULT_SCHEMA,
|
||||
IdunnLifecycleCommandRecord => IDUNN_LIFECYCLE_COMMAND_SCHEMA,
|
||||
IdunnReleaseTargetRecord => IDUNN_RELEASE_TARGET_SCHEMA,
|
||||
|
|
@ -1479,6 +1869,421 @@ mod tests {
|
|||
use anyhow::Result;
|
||||
use cultmesh_rs::{CultMesh, CultMeshNodeOptions};
|
||||
|
||||
fn signed_health_fixture() -> IdunnSignedDaemonHealthRecord {
|
||||
IdunnSignedDaemonHealthRecord {
|
||||
schema_version: IDUNN_SIGNED_DAEMON_HEALTH_SCHEMA.into(),
|
||||
daemon_id: "yggdrasil-epiphany".into(),
|
||||
health_contract: "epiphany.cultnet-rudp-runtime-health".into(),
|
||||
source_runtime_id: "epiphany-yggdrasil".into(),
|
||||
state: "active".into(),
|
||||
detail: "provider-authenticated resident readiness".into(),
|
||||
signer_identity_id: "epiphany-host-identity".into(),
|
||||
publisher_incarnation_id: "epiphany-yggdrasil/boot-7/process-11".into(),
|
||||
publisher_sequence: 42,
|
||||
observed_at_unix_millis: 1_784_483_200_000,
|
||||
release_id: Some("release-42".into()),
|
||||
release_witness_sha256: Some(format!("sha256-{}", "a".repeat(64))),
|
||||
source_commit: Some("b".repeat(40)),
|
||||
deployment_id: Some("deploy:yggdrasil-epiphany:42".into()),
|
||||
signature_algorithm: "ed25519".into(),
|
||||
signature: vec![9; 64],
|
||||
private_state_exposed: false,
|
||||
activation_witness_sha256: Some(format!("sha256-{}", "f".repeat(64))),
|
||||
}
|
||||
}
|
||||
|
||||
fn trust_binding_fixture() -> IdunnDaemonHealthTrustBindingRecord {
|
||||
let health = signed_health_fixture();
|
||||
let signer_public_key = vec![7; 32];
|
||||
IdunnDaemonHealthTrustBindingRecord {
|
||||
schema_version: IDUNN_DAEMON_HEALTH_TRUST_BINDING_SCHEMA.into(),
|
||||
binding_id: "root/yggdrasil-epiphany/health".into(),
|
||||
daemon_id: health.daemon_id,
|
||||
health_contract: health.health_contract,
|
||||
source_runtime_id: health.source_runtime_id,
|
||||
signer_identity_id: derive_service_identity_id::<GameCultProviderHealthIdentity>(
|
||||
&signer_public_key,
|
||||
)
|
||||
.unwrap(),
|
||||
signer_public_key,
|
||||
binding_authority: "root".into(),
|
||||
bound_at_unix_millis: 1_784_483_100_000,
|
||||
release_binding_required: true,
|
||||
private_state_exposed: false,
|
||||
}
|
||||
}
|
||||
|
||||
fn authenticated_admission_fixture() -> IdunnAuthenticatedDaemonHealthAdmissionRecord {
|
||||
let health = signed_health_fixture();
|
||||
let binding = trust_binding_fixture();
|
||||
IdunnAuthenticatedDaemonHealthAdmissionRecord {
|
||||
schema_version: IDUNN_AUTHENTICATED_DAEMON_HEALTH_ADMISSION_SCHEMA.into(),
|
||||
daemon_id: health.daemon_id,
|
||||
health_contract: health.health_contract,
|
||||
source_runtime_id: health.source_runtime_id,
|
||||
state: health.state,
|
||||
observed_at_unix_millis: health.observed_at_unix_millis,
|
||||
admitted_at_unix_millis: health.observed_at_unix_millis + 1,
|
||||
trust_binding_id: binding.binding_id,
|
||||
trust_binding_sha256: format!("sha256-{}", "c".repeat(64)),
|
||||
signer_identity_id: health.signer_identity_id,
|
||||
publisher_incarnation_id: health.publisher_incarnation_id,
|
||||
publisher_sequence: health.publisher_sequence,
|
||||
signed_health_sha256: format!("sha256-{}", "d".repeat(64)),
|
||||
release_id: health.release_id,
|
||||
release_witness_sha256: health.release_witness_sha256,
|
||||
source_commit: health.source_commit,
|
||||
deployment_id: health.deployment_id,
|
||||
private_state_exposed: false,
|
||||
activation_witness_sha256: health.activation_witness_sha256,
|
||||
}
|
||||
}
|
||||
|
||||
fn runtime_traffic_admission_fixture() -> IdunnRuntimeTrafficAdmissionRecord {
|
||||
let admission = authenticated_admission_fixture();
|
||||
IdunnRuntimeTrafficAdmissionRecord {
|
||||
schema_version: IDUNN_RUNTIME_TRAFFIC_ADMISSION_SCHEMA.into(),
|
||||
daemon_id: IDUNN_CODEX_CONNECTOR_RUNTIME_TRAFFIC_ADMISSION_RECORD_KEY.into(),
|
||||
release_id: admission.release_id.unwrap(),
|
||||
release_witness_sha256: admission.release_witness_sha256.unwrap(),
|
||||
source_commit: admission.source_commit.unwrap(),
|
||||
deployment_id: admission.deployment_id.unwrap(),
|
||||
activation_witness_sha256: admission.activation_witness_sha256.unwrap(),
|
||||
signed_health_sha256: admission.signed_health_sha256,
|
||||
publisher_incarnation_id: admission.publisher_incarnation_id,
|
||||
publisher_sequence: admission.publisher_sequence,
|
||||
signer_identity_id: admission.signer_identity_id,
|
||||
runtime_process_id: 41,
|
||||
runtime_process_starttime_ticks: 987_654,
|
||||
}
|
||||
}
|
||||
|
||||
fn service_trust_anchor_fixture() -> GameCultServiceTrustAnchorRecord {
|
||||
let signer_public_key = vec![5; 32];
|
||||
GameCultServiceTrustAnchorRecord {
|
||||
schema_version: GAMECULT_SERVICE_TRUST_ANCHOR_SCHEMA.into(),
|
||||
trust_anchor_id: "root/idunn/authenticated-provider-health-projection".into(),
|
||||
service_id: "idunn".into(),
|
||||
runtime_id: "idunn-yggdrasil".into(),
|
||||
signer_identity_id: derive_service_identity_id::<cultnet_rs::IdunnServiceIdentity>(
|
||||
&signer_public_key,
|
||||
)
|
||||
.unwrap(),
|
||||
signer_public_key,
|
||||
signature_algorithm: "ed25519".into(),
|
||||
signing_purpose: IDUNN_AUTHENTICATED_PROVIDER_HEALTH_PROJECTION_SIGNING_PURPOSE.into(),
|
||||
signed_schema: IDUNN_AUTHENTICATED_PROVIDER_HEALTH_PROJECTION_SCHEMA.into(),
|
||||
binding_authority: "root".into(),
|
||||
bound_at_unix_millis: 1_784_483_100_000,
|
||||
expires_at_unix_millis: Some(1_815_000_000_000),
|
||||
private_state_exposed: false,
|
||||
}
|
||||
}
|
||||
|
||||
fn authenticated_provider_health_projection_fixture()
|
||||
-> IdunnAuthenticatedProviderHealthProjectionRecord {
|
||||
let health = signed_health_fixture();
|
||||
let binding = trust_binding_fixture();
|
||||
IdunnAuthenticatedProviderHealthProjectionRecord {
|
||||
schema_version: IDUNN_AUTHENTICATED_PROVIDER_HEALTH_PROJECTION_SCHEMA.into(),
|
||||
projection_id: format!("authenticated-provider-health:{}", health.daemon_id),
|
||||
daemon_id: health.daemon_id,
|
||||
health_contract: health.health_contract,
|
||||
provider_state: health.state,
|
||||
reason_code: IDUNN_PROVIDER_ACTIVE_REASON.into(),
|
||||
provider_observed_at_unix_millis: health.observed_at_unix_millis,
|
||||
admitted_at_unix_millis: health.observed_at_unix_millis + 1,
|
||||
evaluated_at_unix_millis: health.observed_at_unix_millis + 2,
|
||||
trust_binding_id: binding.binding_id,
|
||||
trust_binding_sha256: format!("sha256-{}", "c".repeat(64)),
|
||||
signed_health_sha256: format!("sha256-{}", "d".repeat(64)),
|
||||
authenticated_admission_sha256: format!("sha256-{}", "e".repeat(64)),
|
||||
provider_signer_identity_id: health.signer_identity_id,
|
||||
provider_incarnation_id: health.publisher_incarnation_id,
|
||||
provider_sequence: health.publisher_sequence,
|
||||
release_id: health.release_id,
|
||||
release_witness_sha256: health.release_witness_sha256,
|
||||
source_commit: health.source_commit,
|
||||
deployment_id: health.deployment_id,
|
||||
idunn_runtime_id: "idunn-yggdrasil".into(),
|
||||
idunn_signer_identity_id: "idunn-yggdrasil-service-identity".into(),
|
||||
projection_incarnation_id: "idunn-yggdrasil/boot-3/process-8".into(),
|
||||
projection_sequence: 7,
|
||||
signature_algorithm: "ed25519".into(),
|
||||
signature: vec![6; 64],
|
||||
private_state_exposed: false,
|
||||
expires_at_unix_millis: health.observed_at_unix_millis + 60_002,
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn outward_authenticated_provider_health_contracts_validate_and_round_trip() -> Result<()> {
|
||||
let anchor = service_trust_anchor_fixture();
|
||||
let projection = authenticated_provider_health_projection_fixture();
|
||||
anchor.validate()?;
|
||||
projection.validate()?;
|
||||
|
||||
let temp = tempfile::tempdir()?;
|
||||
let store_path = temp
|
||||
.path()
|
||||
.join("authenticated-provider-health-projection.cc");
|
||||
let mut node = CultMesh::create_node(
|
||||
&store_path,
|
||||
OdinDocuments,
|
||||
CultMeshNodeOptions {
|
||||
runtime_id: "authenticated-provider-health-contract-test".into(),
|
||||
pull_on_start: true,
|
||||
},
|
||||
)?;
|
||||
node.put(&anchor.trust_anchor_id, &anchor)?;
|
||||
node.put(&projection.projection_id, &projection)?;
|
||||
assert_eq!(
|
||||
node.get_required::<GameCultServiceTrustAnchorRecord>(&anchor.trust_anchor_id)?,
|
||||
anchor
|
||||
);
|
||||
assert_eq!(
|
||||
node.get_required::<IdunnAuthenticatedProviderHealthProjectionRecord>(
|
||||
&projection.projection_id
|
||||
)?,
|
||||
projection
|
||||
);
|
||||
assert_eq!(
|
||||
authenticated_provider_health_reason_code("warming"),
|
||||
Some(IDUNN_PROVIDER_WARMING_REASON)
|
||||
);
|
||||
assert_eq!(
|
||||
authenticated_provider_health_reason_code("degraded"),
|
||||
Some(IDUNN_PROVIDER_DEGRADED_REASON)
|
||||
);
|
||||
assert_eq!(
|
||||
authenticated_provider_health_reason_code("failed"),
|
||||
Some(IDUNN_PROVIDER_FAILED_REASON)
|
||||
);
|
||||
assert_eq!(authenticated_provider_health_reason_code("missing"), None);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn outward_authenticated_provider_health_contracts_refuse_substitution_and_weak_lineage() {
|
||||
let mut anchor = service_trust_anchor_fixture();
|
||||
anchor.binding_authority = "idunn".into();
|
||||
assert!(anchor.validate().is_err());
|
||||
anchor = service_trust_anchor_fixture();
|
||||
anchor.signer_public_key = vec![5; 31];
|
||||
assert!(anchor.validate().is_err());
|
||||
anchor = service_trust_anchor_fixture();
|
||||
anchor.expires_at_unix_millis = Some(anchor.bound_at_unix_millis);
|
||||
assert!(anchor.validate().is_err());
|
||||
anchor = service_trust_anchor_fixture();
|
||||
anchor.private_state_exposed = true;
|
||||
assert!(anchor.validate().is_err());
|
||||
anchor = service_trust_anchor_fixture();
|
||||
anchor.signing_purpose = "caller.chosen-purpose".into();
|
||||
assert!(anchor.validate().is_err());
|
||||
anchor = service_trust_anchor_fixture();
|
||||
anchor.signer_identity_id = "caller-chosen-identity".into();
|
||||
assert!(anchor.validate().is_err());
|
||||
|
||||
let mut projection = authenticated_provider_health_projection_fixture();
|
||||
projection.evaluated_at_unix_millis = projection.admitted_at_unix_millis - 1;
|
||||
assert!(projection.validate().is_err());
|
||||
projection = authenticated_provider_health_projection_fixture();
|
||||
projection.expires_at_unix_millis = projection.evaluated_at_unix_millis;
|
||||
assert!(projection.validate().is_err());
|
||||
projection = authenticated_provider_health_projection_fixture();
|
||||
projection.authenticated_admission_sha256 = "admitted".into();
|
||||
assert!(projection.validate().is_err());
|
||||
projection = authenticated_provider_health_projection_fixture();
|
||||
projection.projection_sequence = 0;
|
||||
assert!(projection.validate().is_err());
|
||||
projection = authenticated_provider_health_projection_fixture();
|
||||
projection.signature.clear();
|
||||
assert!(projection.validate().is_err());
|
||||
projection = authenticated_provider_health_projection_fixture();
|
||||
projection.release_witness_sha256 = None;
|
||||
assert!(projection.validate().is_err());
|
||||
projection = authenticated_provider_health_projection_fixture();
|
||||
projection.deployment_id = None;
|
||||
assert!(projection.validate().is_err());
|
||||
projection = authenticated_provider_health_projection_fixture();
|
||||
projection.private_state_exposed = true;
|
||||
assert!(projection.validate().is_err());
|
||||
projection = authenticated_provider_health_projection_fixture();
|
||||
projection.reason_code = "release_drift".into();
|
||||
assert!(projection.validate().is_err());
|
||||
projection = authenticated_provider_health_projection_fixture();
|
||||
projection.provider_state = "missing".into();
|
||||
projection.reason_code = "authenticated_provider_failed".into();
|
||||
assert!(projection.validate().is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn generic_signed_health_contracts_validate_and_round_trip() -> Result<()> {
|
||||
let health = signed_health_fixture();
|
||||
let binding = trust_binding_fixture();
|
||||
let admission = authenticated_admission_fixture();
|
||||
health.validate()?;
|
||||
binding.validate()?;
|
||||
admission.validate()?;
|
||||
|
||||
let temp = tempfile::tempdir()?;
|
||||
let store_path = temp.path().join("signed-health.cc");
|
||||
let mut node = CultMesh::create_node(
|
||||
&store_path,
|
||||
OdinDocuments,
|
||||
CultMeshNodeOptions {
|
||||
runtime_id: "idunn-test".into(),
|
||||
pull_on_start: true,
|
||||
},
|
||||
)?;
|
||||
node.put(&health.daemon_id, &health)?;
|
||||
node.put(&binding.binding_id, &binding)?;
|
||||
node.put(&admission.daemon_id, &admission)?;
|
||||
assert_eq!(
|
||||
node.get_required::<IdunnSignedDaemonHealthRecord>(&health.daemon_id)?,
|
||||
health
|
||||
);
|
||||
assert_eq!(
|
||||
node.get_required::<IdunnDaemonHealthTrustBindingRecord>(&binding.binding_id)?,
|
||||
binding
|
||||
);
|
||||
assert_eq!(
|
||||
node.get_required::<IdunnAuthenticatedDaemonHealthAdmissionRecord>(
|
||||
&admission.daemon_id
|
||||
)?,
|
||||
admission
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn runtime_traffic_admission_is_a_closed_positional_document() -> Result<()> {
|
||||
let admission = runtime_traffic_admission_fixture();
|
||||
admission.validate()?;
|
||||
assert_eq!(
|
||||
IdunnRuntimeTrafficAdmissionRecord::TYPE,
|
||||
"idunn.runtime_traffic_admission"
|
||||
);
|
||||
assert_eq!(
|
||||
IdunnRuntimeTrafficAdmissionRecord::SCHEMA_NAME,
|
||||
IDUNN_RUNTIME_TRAFFIC_ADMISSION_SCHEMA
|
||||
);
|
||||
let payload = rmp_serde::to_vec(&admission)?;
|
||||
assert_eq!(payload.first(), Some(&0x9d));
|
||||
assert_eq!(
|
||||
rmp_serde::from_slice::<IdunnRuntimeTrafficAdmissionRecord>(&payload)?,
|
||||
admission
|
||||
);
|
||||
let pre_process_binding = rmp_serde::to_vec(&(
|
||||
admission.schema_version.clone(),
|
||||
admission.daemon_id.clone(),
|
||||
admission.release_id.clone(),
|
||||
admission.release_witness_sha256.clone(),
|
||||
admission.source_commit.clone(),
|
||||
admission.deployment_id.clone(),
|
||||
admission.activation_witness_sha256.clone(),
|
||||
admission.signed_health_sha256.clone(),
|
||||
admission.publisher_incarnation_id.clone(),
|
||||
admission.publisher_sequence,
|
||||
admission.signer_identity_id.clone(),
|
||||
))?;
|
||||
assert_eq!(pre_process_binding.first(), Some(&0x9b));
|
||||
assert!(
|
||||
rmp_serde::from_slice::<IdunnRuntimeTrafficAdmissionRecord>(&pre_process_binding)
|
||||
.is_err(),
|
||||
"runtime admission v2 must not decode a pre-process-binding body"
|
||||
);
|
||||
let mut ghostlight = admission.clone();
|
||||
ghostlight.daemon_id = IDUNN_GHOSTLIGHT_RUNTIME_TRAFFIC_ADMISSION_RECORD_KEY.into();
|
||||
ghostlight.validate()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn runtime_traffic_admission_refuses_weak_or_partial_lineage() {
|
||||
let mut admission = runtime_traffic_admission_fixture();
|
||||
admission.publisher_sequence = 0;
|
||||
assert!(admission.validate().is_err());
|
||||
|
||||
admission = runtime_traffic_admission_fixture();
|
||||
admission.source_commit = "F".repeat(40);
|
||||
assert!(admission.validate().is_err());
|
||||
|
||||
admission = runtime_traffic_admission_fixture();
|
||||
admission.activation_witness_sha256 = "missing".into();
|
||||
assert!(admission.validate().is_err());
|
||||
|
||||
admission = runtime_traffic_admission_fixture();
|
||||
admission.schema_version = "idunn.runtime_traffic_admission.v0".into();
|
||||
assert!(admission.validate().is_err());
|
||||
|
||||
admission = runtime_traffic_admission_fixture();
|
||||
admission.daemon_id = "caller-selected-daemon".into();
|
||||
assert!(admission.validate().is_err());
|
||||
|
||||
admission = runtime_traffic_admission_fixture();
|
||||
admission.runtime_process_id = 0;
|
||||
assert!(admission.validate().is_err());
|
||||
|
||||
admission = runtime_traffic_admission_fixture();
|
||||
admission.runtime_process_starttime_ticks = 0;
|
||||
assert!(admission.validate().is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn activation_binding_is_additive_for_existing_authenticated_admissions() -> Result<()> {
|
||||
let mut admission = authenticated_admission_fixture();
|
||||
admission.activation_witness_sha256 = None;
|
||||
let mut legacy = rmp_serde::to_vec(&admission)?;
|
||||
assert_eq!(&legacy[..3], &[0xdc, 0, 19]);
|
||||
assert_eq!(legacy.pop(), Some(0xc0));
|
||||
legacy[2] = 18;
|
||||
let decoded: IdunnAuthenticatedDaemonHealthAdmissionRecord =
|
||||
rmp_serde::from_slice(&legacy)?;
|
||||
assert_eq!(decoded.activation_witness_sha256, None);
|
||||
decoded.validate()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn generic_signed_health_contracts_refuse_weak_or_partial_authority() {
|
||||
let mut health = signed_health_fixture();
|
||||
health.private_state_exposed = true;
|
||||
assert!(health.validate().is_err());
|
||||
health = signed_health_fixture();
|
||||
health.signature.clear();
|
||||
assert!(health.validate().is_err());
|
||||
health = signed_health_fixture();
|
||||
health.release_witness_sha256 = None;
|
||||
assert!(health.validate().is_err());
|
||||
health = signed_health_fixture();
|
||||
health.publisher_sequence = 0;
|
||||
assert!(health.validate().is_err());
|
||||
health = signed_health_fixture();
|
||||
health.activation_witness_sha256 = Some(format!("sha256-{}", "F".repeat(64)));
|
||||
assert!(health.validate().is_err());
|
||||
|
||||
let mut binding = trust_binding_fixture();
|
||||
binding.binding_authority = "daemon".into();
|
||||
assert!(binding.validate().is_err());
|
||||
binding = trust_binding_fixture();
|
||||
binding.signer_public_key = vec![1; 31];
|
||||
assert!(binding.validate().is_err());
|
||||
binding = trust_binding_fixture();
|
||||
binding.private_state_exposed = true;
|
||||
assert!(binding.validate().is_err());
|
||||
|
||||
let mut admission = authenticated_admission_fixture();
|
||||
admission.trust_binding_sha256 = "ready".into();
|
||||
assert!(admission.validate().is_err());
|
||||
admission = authenticated_admission_fixture();
|
||||
admission.admitted_at_unix_millis = admission.observed_at_unix_millis - 1;
|
||||
assert!(admission.validate().is_err());
|
||||
admission = authenticated_admission_fixture();
|
||||
admission.activation_witness_sha256 = Some("caller-selected".into());
|
||||
assert!(admission.validate().is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn muninn_media_documents_round_trip_through_cultmesh() -> Result<()> {
|
||||
let temp = tempfile::tempdir()?;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,21 @@ pub fn plan_keepalive(
|
|||
};
|
||||
}
|
||||
|
||||
if health.state == "warming" {
|
||||
return IdunnPlan {
|
||||
decision: decision(
|
||||
&decision_id,
|
||||
desired,
|
||||
"observe",
|
||||
"daemon is warming under provider-owned progress authority",
|
||||
&now,
|
||||
),
|
||||
deployment_request: None,
|
||||
restart_request: None,
|
||||
operator_alarm: None,
|
||||
};
|
||||
}
|
||||
|
||||
if health.state == "degraded" || health.state == "dependency-unavailable" {
|
||||
let alarm_id = format!("alarm:{}:{}", desired.daemon_id, now);
|
||||
let reason = format!(
|
||||
|
|
@ -238,6 +253,19 @@ mod tests {
|
|||
assert!(plan.operator_alarm.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn warming_daemon_is_observed_without_actuation_or_promotion() {
|
||||
let mut desired = desired(Some("systemctl restart epiphany"));
|
||||
desired.deploy_command = Some("deploy epiphany".to_string());
|
||||
let plan = plan_keepalive(&desired, &health("warming"), "2026-07-17T00:00:02Z");
|
||||
|
||||
assert_eq!(plan.decision.action, "observe");
|
||||
assert!(plan.decision.reason.contains("provider-owned progress"));
|
||||
assert!(plan.deployment_request.is_none());
|
||||
assert!(plan.restart_request.is_none());
|
||||
assert!(plan.operator_alarm.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unhealthy_daemon_with_restart_authority_requests_restart() {
|
||||
let plan = plan_keepalive(
|
||||
|
|
@ -429,6 +457,7 @@ mod tests {
|
|||
release_authority_status: "authorized".to_string(),
|
||||
requires_bifrost_authority: true,
|
||||
observed_upstream_revision: "abc123".to_string(),
|
||||
minimum_source_revision: None,
|
||||
};
|
||||
let artifact = IdunnDeploymentArtifactRecord {
|
||||
artifact_id: "artifact:voidbot:main".to_string(),
|
||||
|
|
@ -473,6 +502,15 @@ mod tests {
|
|||
status: "planned".to_string(),
|
||||
planned_at: "2026-06-04T00:00:02Z".to_string(),
|
||||
};
|
||||
let release_payload = rmp_serde::to_vec(&release_target)?;
|
||||
assert_eq!(&release_payload[..3], &[0xdc, 0, 22]);
|
||||
let mut pre_floor_payload = release_payload.clone();
|
||||
assert_eq!(pre_floor_payload.pop(), Some(0xc0));
|
||||
pre_floor_payload[2] = 21;
|
||||
assert!(
|
||||
rmp_serde::from_slice::<IdunnReleaseTargetRecord>(&pre_floor_payload).is_err(),
|
||||
"release-target v3 must not decode a pre-floor positional body"
|
||||
);
|
||||
node.put(&release_target.target_id, &release_target)?;
|
||||
node.put(&artifact.artifact_id, &artifact)?;
|
||||
node.put(&migration_plan.plan_id, &migration_plan)?;
|
||||
|
|
|
|||
23
crates/odin-daemon/Cargo.toml
Normal file
23
crates/odin-daemon/Cargo.toml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
[package]
|
||||
name = "odin-daemon"
|
||||
version = "0.1.0"
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
publish.workspace = true
|
||||
|
||||
[lib]
|
||||
name = "odin_daemon"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
chrono = "0.4"
|
||||
cultcache-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "c13b6ba07e99f2535b455da74d07d88c308731f5", package = "cultcache-rs" }
|
||||
cultmesh-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "c13b6ba07e99f2535b455da74d07d88c308731f5", package = "cultmesh-rs" }
|
||||
cultnet-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "c13b6ba07e99f2535b455da74d07d88c308731f5", package = "cultnet-rs" }
|
||||
fs2 = "0.4"
|
||||
rmp-serde = "1.3"
|
||||
serde = "1"
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3"
|
||||
1832
crates/odin-daemon/src/lib.rs
Normal file
1832
crates/odin-daemon/src/lib.rs
Normal file
File diff suppressed because it is too large
Load diff
1248
crates/odin-daemon/src/main.rs
Normal file
1248
crates/odin-daemon/src/main.rs
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -11,9 +11,9 @@ path = "src/main.rs"
|
|||
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
cultmesh-rs = { path = "../../vendor/cultmesh-rs" }
|
||||
cultnet-rs = { path = "../../vendor/cultnet-rs" }
|
||||
cultcache-rs = { path = "../../vendor/cultcache-rs" }
|
||||
cultmesh-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "c13b6ba07e99f2535b455da74d07d88c308731f5", package = "cultmesh-rs" }
|
||||
cultnet-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "c13b6ba07e99f2535b455da74d07d88c308731f5", package = "cultnet-rs" }
|
||||
cultcache-rs = { git = "https://github.com/GameCult/CultLib.git", rev = "c13b6ba07e99f2535b455da74d07d88c308731f5", package = "cultcache-rs" }
|
||||
odin-core = { path = "../odin-core" }
|
||||
rmp-serde = "1.3"
|
||||
serde_json = "1"
|
||||
|
|
|
|||
|
|
@ -2227,6 +2227,7 @@ fn create_rudp_stream(
|
|||
max_fragment_bytes: Some(HID_RUDP_MAX_FRAGMENT_BYTES),
|
||||
max_pending_reliable_packets: Some(256),
|
||||
media_reliable_expire_after_ms: Some(25),
|
||||
reconnect_policy: None,
|
||||
})?;
|
||||
transport.connect(Vec::new())?;
|
||||
return Ok(Some(ActiveRudpStream {
|
||||
|
|
@ -2267,6 +2268,7 @@ fn create_rudp_stream(
|
|||
max_fragment_bytes: Some(HID_RUDP_MAX_FRAGMENT_BYTES),
|
||||
max_pending_reliable_packets: Some(256),
|
||||
media_reliable_expire_after_ms: Some(25),
|
||||
reconnect_policy: None,
|
||||
})?,
|
||||
target: None,
|
||||
last_connect_attempt_at: None,
|
||||
|
|
|
|||
1
deploy/cultlib.commit
Normal file
1
deploy/cultlib.commit
Normal file
|
|
@ -0,0 +1 @@
|
|||
75c180782aeba7cfd22d6412877397708a4ed28f
|
||||
72
deployment/idunn/recipe.toml
Normal file
72
deployment/idunn/recipe.toml
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
schema = "gamecult.idunn.target_declaration.v1"
|
||||
target = "odin"
|
||||
source_stamp_environment = "ODIN_BUILD_COMMIT"
|
||||
required_gitlinks = []
|
||||
|
||||
[[steps]]
|
||||
id = "test-odin-daemon"
|
||||
phase = "test"
|
||||
runner = "rust-build"
|
||||
argv = ["cargo", "test", "--locked", "-p", "odin-daemon"]
|
||||
|
||||
[[steps]]
|
||||
id = "build-odin-daemon"
|
||||
phase = "build"
|
||||
runner = "rust-build"
|
||||
argv = [
|
||||
"cargo",
|
||||
"build",
|
||||
"--locked",
|
||||
"--release",
|
||||
"-p",
|
||||
"odin-daemon",
|
||||
"--bin",
|
||||
"odin-daemon",
|
||||
]
|
||||
|
||||
[[artifacts]]
|
||||
id = "odin-daemon"
|
||||
source_kind = "runner-output"
|
||||
runner = "rust-build"
|
||||
source = "target/release/odin-daemon"
|
||||
destination = "odin-daemon"
|
||||
executable = true
|
||||
|
||||
[service]
|
||||
executable_artifact = "odin-daemon"
|
||||
arguments = [
|
||||
{ kind = "literal", value = "--store" },
|
||||
{ kind = "binding", name = "store_path" },
|
||||
{ kind = "literal", value = "--idunn-projection" },
|
||||
{ kind = "binding", name = "idunn_projection_path" },
|
||||
{ kind = "literal", value = "--idunn-anchor" },
|
||||
{ kind = "binding", name = "idunn_anchor_path" },
|
||||
]
|
||||
transport = "rudp"
|
||||
route_required = true
|
||||
required_environment = [
|
||||
"GAMECULT_IDUNN_CANDIDATE_BIND",
|
||||
"GAMECULT_IDUNN_PROCESS_WRITE_LEASE",
|
||||
"GAMECULT_IDUNN_RUNTIME_BUNDLE",
|
||||
"ODIN_TOPOLOGY_IDENTITY",
|
||||
]
|
||||
|
||||
[service.health]
|
||||
contract = "odin.runtime-health.v1"
|
||||
|
||||
[state]
|
||||
schema_generation = "odin-v2"
|
||||
|
||||
[[state.slots]]
|
||||
id = "topology"
|
||||
relative_path = "topology.cc"
|
||||
kind = "cultcache-file"
|
||||
schema = "odin.runtime_topology_correlation.v2"
|
||||
writer = "process-bound-single-writer"
|
||||
recovery = "preserve"
|
||||
startup = "create-or-open-after-write-lease"
|
||||
|
||||
[[provides]]
|
||||
capability = "odin.verse-rendezvous"
|
||||
schema = "odin.verse-topology.v1"
|
||||
compatibility = "v1"
|
||||
|
|
@ -33,7 +33,7 @@ Verse / host / device / provider inputs
|
|||
-> CultCache .cc persistence
|
||||
-> CultNet/CultMesh document registry
|
||||
-> Odin Eve/CultUI deck projection
|
||||
-> Gjallar Nightwing composition and framebuffer lowering
|
||||
-> Gjallar Yggdrasil aggregate Eve composition
|
||||
-> compact display feeds
|
||||
```
|
||||
|
||||
|
|
@ -87,14 +87,12 @@ schema from overwriting another in the shared catalog. Odin returns the
|
|||
redacted route metadata; it does not proxy private auth operations or own any
|
||||
claim, completion, token, or app secret.
|
||||
|
||||
Gjallar is the Nightwing-resident terminal compositor for what Odin can show.
|
||||
Its runtime lives in `E:\Projects\Gjallar` and consumes Odin's accepted
|
||||
provider-state snapshot over CultNet/RUDP.
|
||||
Odin owns canonical marquee content; Gjallar owns provider enumeration for
|
||||
display, panel packing, marquee lowering, glyph/color/framebuffer lowering,
|
||||
frame stats, and the multi-scale terminal product. It must not own the
|
||||
underlying registry, probe, provider truth, canonical marquee content, or
|
||||
translation decisions.
|
||||
Gjallar is the Yggdrasil-resident aggregate compositor for what Odin can show.
|
||||
Its runtime lives in `/srv/gjallar/current` and consumes Odin's accepted
|
||||
provider-state snapshot. Gjallar owns enumeration, tiling, and publication of
|
||||
the typed `gjallar.overview` Eve surface. Eve clients own graphical, terminal,
|
||||
and framebuffer lowering. Gjallar must not own the underlying registry, probe,
|
||||
provider truth, client pixels, or translation decisions.
|
||||
|
||||
Idunn is the named keepalive organ for daemon continuity. Its current Rust
|
||||
body lives in `crates/idunn-daemon` and `crates/odin-core/src/idunn.rs`. Idunn may read
|
||||
|
|
@ -229,11 +227,11 @@ Odin currently publishes service squares for:
|
|||
StreamPixels, Heimdall, Repixelizer, and Bifrost systemd state until those
|
||||
daemon surfaces publish health and command boundaries over CultNet RUDP.
|
||||
|
||||
Gjallar consumes Odin's accepted CultMesh/Eve state and composes these surfaces
|
||||
into the Nightwing display. Nightwing is the host/body; Gjallar is the terminal product running
|
||||
there. If Odin starts deciding framebuffer composition, the renderer owner has
|
||||
leaked upward. If individual providers start tuning themselves for Nightwing
|
||||
instead of emitting clean Eve/CultUI surfaces, provider truth has leaked
|
||||
Gjallar consumes Odin's accepted CultMesh/Eve state and composes every visible
|
||||
provider surface into one typed aggregate on Yggdrasil. EveCanvas, browser, and
|
||||
TUI clients lower that aggregate. If Odin starts deciding tile composition, the
|
||||
composition owner has leaked upward. If providers tune themselves for one
|
||||
client instead of emitting clean Eve/CultUI surfaces, provider truth has leaked
|
||||
downward.
|
||||
|
||||
## Current Interface Surface
|
||||
|
|
|
|||
115
docs/gjallar.md
115
docs/gjallar.md
|
|
@ -1,85 +1,64 @@
|
|||
# Gjallar
|
||||
|
||||
Gjallar is the Nightwing-resident terminal compositor for Odin's domain.
|
||||
Gjallar is the Yggdrasil-resident aggregate compositor for Odin's domain.
|
||||
|
||||
Odin is the all-seer: it accepts Verse discovery, schema catalogs, translation
|
||||
routes, provider surfaces, and observation projections. Gjallar talks to Odin,
|
||||
enumerates the active provider surfaces Odin can show, and composes those
|
||||
surfaces into the live multi-scale dashboard running on Nightwing.
|
||||
|
||||
Gjallar exists so Odin does not need to care how a pile of provider-owned TUIs
|
||||
fits on one fast display, and provider daemons do not need to know the terminal
|
||||
body they are being lowered into.
|
||||
Odin accepts Verse discovery and provider-owned Eve surfaces. Gjallar consumes
|
||||
that accepted snapshot and publishes one typed `gjallar.overview` composition
|
||||
containing every currently visible provider surface. EveCanvas, browsers, TUI
|
||||
clients, and agent readers lower the same aggregate without becoming its owner.
|
||||
|
||||
## Authority Map
|
||||
|
||||
- Owner: Gjallar owns Nightwing dashboard composition, tiling, marquee lowering,
|
||||
visual density, framebuffer presentation, and character-level refresh
|
||||
behavior.
|
||||
- Inputs: Odin's accepted CultMesh/CultNet snapshot, provider ids,
|
||||
provider-owned surface graphs, Odin's canonical marquee tape, display
|
||||
constraints, font choices, and operator runtime flags.
|
||||
- Outputs: the visible Nightwing framebuffer and compact Gjallar frame/status
|
||||
telemetry.
|
||||
- Derived state: panel packing, visual weight, tile position, gutter cells,
|
||||
marquee glyph positions, glyph size, and frame timing are derived from
|
||||
Odin/provider surfaces plus display constraints.
|
||||
- Forbidden writers: Gjallar does not probe hosts, accept Verse truth, mutate
|
||||
provider-owned dashboards, invent schema translation routes, or replace Odin's
|
||||
provider registry.
|
||||
- Shared paths: Nightwing's physical display, local frame dumps, future compact
|
||||
overlays, and agent-facing TUI captures should all lower the same Gjallar
|
||||
composition behavior when they want the "everything Odin can show" view.
|
||||
- Deletion line: the old Rust `gjallar.overview` feed is not a runtime
|
||||
authority. Any path that wants Nightwing composition belongs in
|
||||
`E:\Projects\Gjallar`; any path that decides discovery truth belongs in Odin.
|
||||
- Owner: Gjallar owns aggregate membership, tiling, marquee placement, layout
|
||||
intent, visibility, and composition versioning.
|
||||
- Inputs: Odin's accepted CultMesh/CultNet snapshot, provider-owned surface
|
||||
graphs, Odin's canonical marquee tape, and display-independent layout hints.
|
||||
- Outputs: `gjallar.overview`, its CultCache/CultMesh/CultNet publication, and
|
||||
compact composition/freshness telemetry.
|
||||
- Derived state: panel weights, ordering, tile layout, unavailable presentation,
|
||||
and aggregate version are derived from Odin/provider state.
|
||||
- Forbidden writers: Gjallar does not probe hosts, accept discovery truth,
|
||||
mutate provider state, open `/dev/fb0` in daemon mode, capture client input,
|
||||
or decide client pixels. Eve clients do not decide aggregate membership.
|
||||
- Shared paths: iOS/UIKit, browser, optional TUI/framebuffer, and agent capture
|
||||
lower the same published overview.
|
||||
- Deletion line: Nightwing's `gjallar.service`, framebuffer lifecycle target,
|
||||
and `nightwing-gjallar` Idunn actuator are obsolete authorities and must not
|
||||
survive Yggdrasil admission.
|
||||
|
||||
## Body
|
||||
|
||||
- `E:\Projects\Gjallar` is Gjallar's executable C# runtime repo.
|
||||
- `Gjallar.csproj` builds the Nightwing framebuffer compositor.
|
||||
- Gjallar consumes Odin's accepted provider/interface state through the CultNet
|
||||
RUDP snapshot input. Browser-deck routes are not Gjallar input truth.
|
||||
- The old Rust `crates/gjallar-daemon` and `gjallar.overview` records were cut
|
||||
because they created an intermediate composition owner that did nothing Odin
|
||||
and Gjallar's live renderer could not explain directly.
|
||||
- `assets/personas/gjallar-avatar.png` and
|
||||
`assets/personas/gjallar-avatar-pixel-256.png` remain branding assets for the
|
||||
view/persona surface.
|
||||
|
||||
Build from the repo root:
|
||||
|
||||
```powershell
|
||||
dotnet build E:\Projects\Gjallar\src\Gjallar\Gjallar.csproj
|
||||
```
|
||||
|
||||
Publish for Nightwing:
|
||||
|
||||
```powershell
|
||||
dotnet publish E:\Projects\Gjallar\src\Gjallar\Gjallar.csproj -c Release -r linux-x64 --self-contained true -o E:\Projects\Gjallar\scratch\publish\gjallar
|
||||
```
|
||||
- Runtime source: `F:\Projects\Gjallar` / `GameCult/Gjallar`.
|
||||
- Daemon host: Yggdrasil beside `odin.service` and
|
||||
`idunn-yggdrasil.service`.
|
||||
- Unit: `gjallar-yggdrasil.service`.
|
||||
- Runtime mode: `--headless`; no framebuffer, font atlas, or mouse device is
|
||||
opened.
|
||||
- Input: Yggdrasil-local Odin accepted snapshot over CultNet/RUDP.
|
||||
- State: `/var/lib/gamecult/gjallar/gjallar.service.cc`.
|
||||
- Deployment: immutable source/dependency pins, a digest-pinned .NET SDK image,
|
||||
and Idunn's root-owned `gjallar` actuator manifest.
|
||||
- Continuity: systemd restarts the admitted release. Until Gjallar publishes
|
||||
authenticated C# health, Idunn observes its diagnostic health but does not
|
||||
restart merely because authenticated publication is missing.
|
||||
|
||||
## Runtime Contract
|
||||
|
||||
```text
|
||||
provider-owned Eve/CultUI surfaces
|
||||
-> Odin discovery and provider catalog/proxy surfaces
|
||||
-> Odin canonical Stonks/poetry marquee tape
|
||||
-> Gjallar provider enumeration, packing, marquee lowering, and framebuffer lowering
|
||||
-> Nightwing visible display
|
||||
provider-owned Eve surfaces
|
||||
-> Odin accepted discovery/provider snapshot
|
||||
-> Gjallar aggregation and tiling
|
||||
-> typed gjallar.overview Eve surface
|
||||
-> EveCanvas / browser / TUI / agent lowerers
|
||||
```
|
||||
|
||||
Nightwing is the host/body. Gjallar is the product that runs there. Odin owns
|
||||
the accepted discovery/provider view. Each daemon owns its own surface truth.
|
||||
|
||||
## Invariants
|
||||
|
||||
- Odin remains the accepted owner of all-seer discovery and provider indexing.
|
||||
- Gjallar owns display composition, not discovery truth.
|
||||
- Provider surfaces are lowered, not rewritten into status summaries.
|
||||
- Marquee content is not provider-boundary status noise. Odin publishes the
|
||||
canonical tape; Gjallar renders it as one continuous stream across gutter
|
||||
rows.
|
||||
- Missing or invalid provider surfaces disappear or render as unavailable; they
|
||||
do not become invented truth.
|
||||
- Frame/status telemetry observes Gjallar's rendering behavior only.
|
||||
- Odin owns discovery and provider acceptance.
|
||||
- Providers own their surface truth and command consequences.
|
||||
- Gjallar owns composition, not discovery or pixel rendering.
|
||||
- Eve clients own rendering and local input capture.
|
||||
- Missing or invalid provider surfaces become explicit unavailable state or are
|
||||
omitted; Gjallar never invents replacement truth.
|
||||
- Daemon health follows accepted-snapshot and aggregate-publication freshness,
|
||||
not rendered frames.
|
||||
|
|
|
|||
431
docs/idunn.md
431
docs/idunn.md
|
|
@ -1,431 +0,0 @@
|
|||
# Idunn
|
||||
|
||||
Idunn is Odin's keepalive organ.
|
||||
|
||||
Odin is the all-seer: it accepts Verse discovery, schema catalogs, translation
|
||||
routes, provider surfaces, and observation projections. Idunn keeps the daemon
|
||||
swarm alive from that accepted map. It is not a second Odin, not a dashboard,
|
||||
and not a heroic supervisor with secret service truth in its pockets.
|
||||
|
||||
Idunn keeps the apples: desired daemon presence, deployment freshness, boot
|
||||
recovery, crash recovery, health freshness, deploy/restart intent, operator
|
||||
escalation, and continuity witness state.
|
||||
|
||||
## Authority Map
|
||||
|
||||
- Owner: Idunn owns daemon lifecycle management after Odin has accepted where a
|
||||
daemon lives: bring-up after host reboot, deployment freshness, crash
|
||||
recovery, health watching, deploy/restart policy, and operator escalation.
|
||||
- Inputs: Odin's accepted service records, provider advertisements, `.cc`
|
||||
witnesses, advertised command boundaries, CultNet/RUDP health contracts,
|
||||
freshness windows, operator policy, local service manager state, and explicit
|
||||
deployment/debug witnesses that cannot satisfy daemon health.
|
||||
- Outputs: typed keepalive observations, deployment requests/results, restart
|
||||
requests/results, release targets, deployment artifacts, state migration
|
||||
plans/results, rollout plans/results, denied-action records, operator alarms,
|
||||
Bifrost operator-notification requests, and an Eve/CultUI keepalive surface.
|
||||
- Derived state: dashboard cells, Bifrost receipts, Discord or owner-DM
|
||||
lowerings, agent summaries, and Odin service projections are
|
||||
notification-only views of Idunn-owned keepalive records.
|
||||
- Forbidden writers: Idunn does not decide which Verses exist, invent provider
|
||||
schemas, mutate provider dashboards, own identity/session grants, or hide
|
||||
restarts behind Odin refresh logic. Individual daemons should not carry
|
||||
independent crash-recovery loops once Idunn owns their lifecycle path; they
|
||||
publish health, surfaces, state witnesses, and command boundaries instead.
|
||||
Agents are also forbidden deploy writers: they configure Idunn release
|
||||
targets, command boundaries, migration commands, and rollout policy, then let
|
||||
Idunn actuate and witness deployment. They do not run deploy scripts by hand.
|
||||
- Shared paths: manual operator deploy/restart, scheduled deploy/restart,
|
||||
degraded-health repair, boot rehydration, and future remote worker recovery
|
||||
must pass through the same Idunn command primitive.
|
||||
- Deletion line: any keepalive loop inside Odin, Gjallar, Eve lowerers, or
|
||||
renderer code must be cut or demoted to a probe that names Idunn as the
|
||||
restart owner.
|
||||
|
||||
## Body
|
||||
|
||||
Idunn now shares Odin's Rust body:
|
||||
|
||||
- `crates/odin-core/src/idunn.rs` owns the keepalive decision engine.
|
||||
- `crates/odin-core/src/documents.rs` publishes typed Idunn CultMesh records
|
||||
beside Odin and Gjallar records.
|
||||
- `crates/idunn-daemon` is the local keepalive actuator crate and now owns the
|
||||
resident Starfire-local swarm scheduler.
|
||||
- `src/Idunn/README.md` is the user-facing introduction for developers,
|
||||
operators, and daemon authors.
|
||||
- `scripts/start-idunn-local.ps1` is now a narrow bootstrap wrapper: it ensures
|
||||
one `idunn.exe` process is alive, checks the shared keepalive store for
|
||||
staleness, and lets Rust own the target catalog and per-target scheduling.
|
||||
- `scripts/deploy-yggdrasil-source-app.ps1` and
|
||||
`scripts/health-yggdrasil-source-app.ps1` are the generic Yggdrasil source
|
||||
artifact lane. They fetch the declared upstream branch, package
|
||||
`origin/main` with `git archive`, run any declared daemon-owned migration
|
||||
script before the deploy script, run the existing ops-owned deploy/check
|
||||
scripts on Yggdrasil, and stamp a remote
|
||||
`gamecult.idunn.deployment_manifest.v1` only after the remote check passes.
|
||||
- `scripts/idunn-deployment-targets.ps1` is the current swarm deployment target
|
||||
catalog. Every known deployable target is either `enforced`, `blocked`,
|
||||
`external-owned`, or `not-runtime` with an explicit reason.
|
||||
- `scripts/health-idunn-swarm-deployment-coverage.ps1` is the coverage probe
|
||||
that fails when the target catalog becomes incoherent. The local Idunn
|
||||
launcher runs it as `idunn-swarm-deployment-coverage` so missing deploy
|
||||
ownership becomes a watched operational fault.
|
||||
- `scripts/notify-idunn-operator-alarm.ps1` is the local operator crossing:
|
||||
Idunn invokes it only after raising an operator alarm, and it asks Bifrost to
|
||||
publish a typed `gamecult.operator_dm_request.v1` CultMesh command document
|
||||
instead of learning Discord delivery itself.
|
||||
- `npm run idunn:build` builds the Rust daemon.
|
||||
- `npm run idunn:start -- ...` still supports the narrow one-daemon path for
|
||||
manual use; RUDP health ingress stays disabled unless `--rudp-health-bind` is
|
||||
supplied.
|
||||
- `npm run idunn:start -- --swarm-profile starfire-local --repo-root E:\Projects\Odin --execute`
|
||||
runs the singular local swarm supervisor.
|
||||
- `--swarm-profile yggdrasil-local` is the Linux host-local supervisor for
|
||||
Epiphany, Heimdall, Repixelizer, StreamPixels, and VoidBot. Its only command boundary is the
|
||||
root-owned `/usr/local/libexec/idunn-yggdrasil` actuator. Restart commands
|
||||
target the local Compose stack; deployment fails closed unless a root-owned
|
||||
executable manifest exists for that service under
|
||||
`/srv/odin/deploy-manifests`. It does not inherit Starfire paths, SSH keys,
|
||||
ADB authority, or Windows process ownership.
|
||||
- Release authorization is adopted per target. Epiphany requires an exact
|
||||
`bifrost.repository_release_authority.v1` receipt from the explicitly
|
||||
configured Bifrost store before migration or deployment; its request,
|
||||
artifact, and remote manifest lineage freeze that authorized commit. The
|
||||
older Yggdrasil targets remain marked `legacy-unmigrated` until Bifrost
|
||||
authorities are issued for them, so installing the Epiphany gate does not
|
||||
silently disable their existing lifecycle paths. Git branch position alone
|
||||
never satisfies the Epiphany gate.
|
||||
- For Epiphany, Bifrost's one current authorized record for
|
||||
`GameCult/Epiphany` and `refs/heads/main` selects the release commit. The
|
||||
current remote branch head is observed separately and may advance without
|
||||
changing an already authorized deployment. Zero or multiple current
|
||||
authorities fail closed. Idunn freezes the selected SHA and receipt digest
|
||||
into the deployment request, then the root Yggdrasil actuator invokes
|
||||
Idunn's narrow `validate-release-authority` posture against the live Bifrost
|
||||
store immediately before the service manifest executes. Environment values
|
||||
carry lineage across sudo; they do not grant it.
|
||||
|
||||
The current typed records are:
|
||||
|
||||
```text
|
||||
idunn.desired_daemon.v1
|
||||
idunn.daemon_health.v1
|
||||
idunn.keepalive_decision.v1
|
||||
idunn.deployment_request.v1
|
||||
idunn.deployment_result.v1
|
||||
idunn.release_target.v1
|
||||
idunn.deployment_artifact.v1
|
||||
idunn.state_migration_plan.v1
|
||||
idunn.state_migration_result.v1
|
||||
idunn.rollout_plan.v1
|
||||
idunn.rollout_result.v1
|
||||
idunn.restart_request.v1
|
||||
idunn.restart_result.v1
|
||||
idunn.operator_alarm.v1
|
||||
idunn.swarm_surgery_plan.v1
|
||||
idunn.daemon_surgery_plan.v1
|
||||
idunn.daemon_transport_profile.v1
|
||||
idunn.command_boundary.v1
|
||||
idunn.runtime_transport_check.v1
|
||||
idunn.rudp_health_ingress.v1
|
||||
```
|
||||
|
||||
## Invariants
|
||||
|
||||
- Odin remains the accepted owner of Verse and service discovery.
|
||||
- Idunn owns continuity decisions after a daemon is known.
|
||||
- Individual daemons own their work and their health publication, not their
|
||||
surrounding lifecycle. They must be simple to kill and simple for Idunn to
|
||||
bring back.
|
||||
- Providers own their own command boundaries. Idunn requests deployment or
|
||||
restart through advertised authority or a named local service manager adapter.
|
||||
- Host reboot recovery, crash recovery, stale deployment recovery,
|
||||
stale-health recovery, and manual operator deploy/restart must share the same
|
||||
Idunn command primitive.
|
||||
- A repair loop is not an owner. If a daemon becomes healthy only after a later
|
||||
Odin refresh or manual click, Idunn's ownership path is still incomplete.
|
||||
- Restart attempts must be witnessed: requested by whom, against which service,
|
||||
through which command boundary, with what result and timestamp.
|
||||
- Health command exit status is not daemon awareness. Every Idunn
|
||||
target must declare a daemon-owned CultNet/RUDP health contract naming what
|
||||
health publication should prove and what unmarked failure means.
|
||||
`idunn.desired_daemon.v1` and
|
||||
`idunn.daemon_health.v1` both record that contract so later readers can
|
||||
distinguish process liveness, source deployment freshness, framebuffer
|
||||
composition, telemetry capture, and catalog coherence without mistaking a
|
||||
temporary product/deployment probe for the real protocol surface.
|
||||
`idunn.daemon_health.v1` also records `publication_source` and `transport` so
|
||||
daemon-published RUDP health can be verified as daemon-owned transport
|
||||
evidence.
|
||||
- `idunn.desired_daemon.v1` links to
|
||||
`idunn.daemon_transport_profile.v1` and `idunn.command_boundary.v1` records.
|
||||
The transport profile names the target transport
|
||||
`cultnet.transport.rudp.v0`, the daemon-owned witness substrate, and the cut
|
||||
line that keeps old probes demoted. The command boundary names restart,
|
||||
deploy, health, and alarm authority separately so Idunn can actuate only the
|
||||
commands it actually owns.
|
||||
- The Starfire-local shell probes are deployment/debug witnesses, not daemon
|
||||
truth. A daemon is Idunn-aware when it publishes its health, command boundary,
|
||||
and transport profile as typed CultNet/CultMesh documents over
|
||||
`cultnet.transport.rudp.v0`. Product/debug probes are xenos-boundary
|
||||
diagnostics or deployment checks only.
|
||||
- Rust now shares the canonical cross-runtime `cultnet.transport.rudp.v0`
|
||||
substrate in `vendor/cultnet-rs`: CNR0 packets, sessions, channels, reliable
|
||||
schema frames, and timeout/retry semantics matching the TypeScript/Python
|
||||
CultLib implementations. This removes "Rust cannot speak RUDP" as a substrate
|
||||
excuse. It does not make any daemon fully migrated until that daemon publishes
|
||||
its health and command boundary through the RUDP path and Idunn consumes that
|
||||
daemon-owned publication.
|
||||
- Idunn publishes `idunn.runtime_transport_check.v1` at startup. The current
|
||||
check sends a CultNet hello over loopback `cultnet.transport.rudp.v0` and
|
||||
records whether the acknowledgement path works in Idunn's own Rust runtime.
|
||||
This proves Idunn's local substrate, not fleet migration.
|
||||
- Idunn opens a RUDP health ingress only when `--rudp-health-bind` is supplied
|
||||
and then publishes `idunn.rudp_health_ingress.v1`. The Starfire local
|
||||
supervisor binds `0.0.0.0:17870` explicitly so host-local and WireGuard
|
||||
publishers can use the configured Idunn health endpoint. That ingress
|
||||
accepts only raw `idunn.daemon_health` CultNet document puts on the `schema`
|
||||
channel, decodes the typed MessagePack payload, and writes it into the
|
||||
keepalive store. Each one-shot publisher gets its own RUDP session from its
|
||||
UDP source address and the session is discarded after a delivered health
|
||||
frame. Windows UDP `ConnectionReset`/`ConnectionAborted` reports from closed
|
||||
one-shot clients are nonfatal ingress noise, not a reason to kill the worker.
|
||||
The ingress does not grant deploy/restart authority; it is the daemon-owned
|
||||
health publication path Idunn consumes.
|
||||
- During each target cycle, fresh daemon-published RUDP health is the health
|
||||
owner. Idunn accepts it only when the daemon id, health contract,
|
||||
`publication_source=daemon-published`, transport `cultnet.transport.rudp.v0`,
|
||||
and `max_silence_seconds` freshness window all match. If any of those fail,
|
||||
Idunn publishes a missing-publication observation on the daemon key and plans
|
||||
from that typed absence instead of running a local health command.
|
||||
- Idunn publishes the active swarm transport migration plan as
|
||||
`idunn.swarm_surgery_plan.v1`. That record names the active profile, owner,
|
||||
objective, current mechanism, invariants, ordered phases, current phase, next
|
||||
target, cut line, and verification layer. It is the state-surface answer to
|
||||
"what surgery is Idunn doing next?" and must be lowered by Nightwing/Gjallar
|
||||
before any chat summary or dashboard prose claims ownership of the plan.
|
||||
- Idunn publishes per-target transport migration plans as
|
||||
`idunn.daemon_surgery_plan.v1` records in the keepalive store. Each daemon
|
||||
plan names severity, status, owner, objective, current mechanism, intended
|
||||
CultNet/RUDP authority, cut line, ordered steps, blockers, and update time.
|
||||
These records are operational state, not documentation garnish: Nightwing,
|
||||
Gjallar, Odin, and future Eve lowerings should inspect them when projecting
|
||||
the daemon surgery queue.
|
||||
- A stale deployment is not restartable liveness. If a target reports
|
||||
`stale-deployment` without deploy authority, Idunn must alarm instead of
|
||||
restarting the stale artifact. If a target reports `dependency-unavailable`
|
||||
or `degraded`, Idunn must alarm instead of treating local deploy/restart as
|
||||
the owner.
|
||||
- Idunn should fail closed when authority is unclear. Unknown ownership,
|
||||
repeated restart failure, missing command authority, or degraded health that
|
||||
needs a human becomes an operator alarm.
|
||||
- Operator alarms use CultMesh to request Bifrost-owned operator notification.
|
||||
Bifrost is the bridge for the crossing and records the receipt. VoidBot's
|
||||
`voidbot.operator-dm` command `owner.dm.send` with payload schema
|
||||
`gamecult.operator_dm_request.v1` is a demoted compatibility delivery
|
||||
actuator, not the owner. The owner-DM command lives in Bifrost's Verse; any
|
||||
still-VoidBot delivery path must be invoked by Bifrost or documented as
|
||||
migration debt. Idunn must not learn Discord token handling, DM delivery
|
||||
internals, or VoidBot-specific transport.
|
||||
- In the current local bridge, `--operator-alarm-command` invokes
|
||||
`notify-idunn-operator-alarm.cmd`, which forwards `IDUNN_ALARM_*`
|
||||
environment variables to `E:\Projects\Bifrost\tools\operator-notification.mjs
|
||||
publish-idunn-alarm`. Bifrost publishes the typed CultMesh command document;
|
||||
Idunn only decides that an alarm exists.
|
||||
- Muninn continuity on Raven is a remote keepalive path. The long-running Raven
|
||||
`muninn.exe serve` process now carries its own Idunn RUDP identity and
|
||||
publishes `muninn.cultnet-rudp-remote-telemetry-health` directly; the
|
||||
`muninn.exe --health` command is an explicit diagnostic publisher, not a
|
||||
health owner. Idunn still restarts Muninn's idle `serve` posture
|
||||
when needed. Raven is the host/body; Muninn is the local telemetry Verse
|
||||
assembler. Idunn must not activate screen/audio streams as part of keepalive.
|
||||
Raven media activation is a typed Muninn capture command whose target is a
|
||||
`cultmesh://` URI resolved through Odin. Idunn does not install or run
|
||||
standalone Raven A/V activation scripts.
|
||||
- Raven is an operator-consented shared machine. Idunn restart and health
|
||||
actuators for Raven must be background-only and must not open visible
|
||||
terminals or interactive windows on that host. The Raven Muninn restart path
|
||||
uses a hidden WScript/PowerShell trampoline; replacing it with an interactive
|
||||
console launch violates the ops contract.
|
||||
- Nightwing Gjallar deployment freshness and visible composition health are now
|
||||
part of Idunn's ops role. `health-nightwing-gjallar.ps1` verifies
|
||||
`gjallar.service` liveness, the remote deployment manifest at
|
||||
`/opt/gamecult/gjallar/gamecult-gjallar-deploy-manifest.txt`. A missing or
|
||||
stale manifest emits `idunn.health.state=stale-deployment`; Idunn then runs
|
||||
`deploy-nightwing-gjallar.ps1`, which publishes the committed local Gjallar
|
||||
revision, writes `gamecult.gjallar.deployment_manifest.v1`, restarts
|
||||
`gjallar.service`, and leaves deployment request/result records in its
|
||||
keepalive `.cc`. The same health probe also reads `/var/log/gjallar.status`;
|
||||
an empty catalog, failed receive loop, stale status witness, or zero composed
|
||||
provider panels is unhealthy even when the process is alive. Upstream deck
|
||||
failure emits `idunn.health.state=dependency-unavailable` so Idunn does not
|
||||
redeploy Gjallar for an Odin/provider input outage.
|
||||
- Swarm-wide deployment ownership means Idunn owns the target catalog and the
|
||||
freshness contract for the repo swarm. For enforced deploy targets, the
|
||||
catalog must name upstream remote/branch, rollout strategy, state migration
|
||||
authority, and whether zero downtime is actually available. Idunn deploys the
|
||||
desired upstream revision, not arbitrary local developer `HEAD`. It does not
|
||||
mean Idunn invents deploy authority for every repo immediately. A target
|
||||
without a safe noninteractive deploy command must remain `blocked` or
|
||||
`external-owned` with the missing authority named until a wrapper can produce
|
||||
a deployment manifest and route through Idunn's typed deployment
|
||||
request/result path.
|
||||
- State migration is daemon-owned. Idunn may run and witness a declared
|
||||
migration command before deployment, but the daemon/repo owns schema meaning,
|
||||
backups, and the migrator. If migration fails, Idunn records
|
||||
`idunn.state_migration_result.v1`, stops the deployment, records a failed
|
||||
rollout/deployment result, and alarms instead of trying to repair state
|
||||
behind the daemon's back.
|
||||
- Deploy and restart scripts are Idunn actuators, not agent tools. They refuse
|
||||
to run unless Idunn invokes them with `IDUNN_ACTUATOR=1` and
|
||||
`IDUNN_COMMAND_AUTHORITY=idunn-daemon`. Agent work is to update the target
|
||||
catalog, release target, command boundary, migration plan, and daemon
|
||||
publication surfaces so Idunn can run the shared command primitive.
|
||||
- Manual lifecycle requests are typed Idunn command records, not direct script
|
||||
execution. Operators publish `idunn.lifecycle_command.v1` with `idunn restart
|
||||
--daemon <id>` or `idunn redeploy --daemon <id>`. The running supervisor
|
||||
claims pending records for its target catalog, writes the corresponding
|
||||
`idunn.restart_request.v1` or `idunn.deployment_request.v1`, executes through
|
||||
the same guarded actuator path used by health-driven decisions, and records
|
||||
the matching result document. If a target lacks restart or deploy authority,
|
||||
Idunn marks the lifecycle command rejected instead of inventing authority.
|
||||
- Zero downtime is a declared rollout capability, not a slogan. If a daemon
|
||||
lacks hot reload, blue/green routing, rolling instances, or another named
|
||||
in-place swap mechanism, Idunn records `restart-required` and verifies the
|
||||
restart path honestly.
|
||||
- Yggdrasil Heimdall, repixelizer, and StreamPixels are enforced through the
|
||||
generic source artifact lane and their existing `gamecult-ops` runbooks.
|
||||
Bifrost is explicitly blocked as of 2026-06-09: committed Bifrost `HEAD`
|
||||
expects `UserAccounts.HeimdallAccountId`, while Yggdrasil's production
|
||||
database lacks that column and EF reports no pending migration. Idunn must
|
||||
not claim Bifrost deployment freshness until Bifrost owns that schema
|
||||
migration path.
|
||||
|
||||
## Runtime Direction
|
||||
|
||||
Idunn's current Rust runtime now has two postures:
|
||||
|
||||
1. One-daemon manual mode for focused probes and explicit local testing.
|
||||
2. One-process swarm mode for the Starfire-local continuity graph.
|
||||
|
||||
The local swarm mode owns:
|
||||
|
||||
1. the built-in Starfire-local target catalog;
|
||||
2. a mandatory health contract per target;
|
||||
3. a typed `idunn.swarm_surgery_plan.v1` record, so Idunn's active migration
|
||||
order, next target, cut line, and verification layer are explicit state;
|
||||
4. a typed `idunn.daemon_surgery_plan.v1` record per target, so transport debt
|
||||
is visible in the same state surface as daemon health;
|
||||
5. a typed `idunn.daemon_transport_profile.v1` and
|
||||
`idunn.command_boundary.v1` record per target, so debug probes and local
|
||||
commands cannot pretend to be daemon-owned CultNet/RUDP truth;
|
||||
6. a startup `idunn.runtime_transport_check.v1` witness proving Idunn's own
|
||||
Rust RUDP loopback path;
|
||||
7. a local `idunn.rudp_health_ingress.v1` listener for daemon-owned RUDP
|
||||
health publication;
|
||||
8. one in-process schedule per target instead of one watchdog process per target;
|
||||
9. shared typed keepalive records in one CultMesh store;
|
||||
10. deploy/restart/alarm execution through the same Rust decision engine;
|
||||
11. recovery of fast local targets like Odin without waiting behind slow remote
|
||||
Yggdrasil checks.
|
||||
|
||||
Current plan surface: `idunn.swarm_surgery_plan.v1` for profile
|
||||
`starfire-local` treats the Muninn Rust lanes, Odin's local provider-health
|
||||
lane, Stonks daemon health, Weksa daemon health, VoidBot stack health, and
|
||||
Nightwing Gjallar framebuffer composition health as completed substrate cuts.
|
||||
Muninn's long-running `serve` bodies now publish
|
||||
`idunn.daemon_health` over RUDP themselves; Starfire publishes to local Idunn,
|
||||
while Nightwing and Raven publish to the configured Idunn RUDP health endpoint
|
||||
using their target daemon ids and health contracts. The Muninn restart and
|
||||
health wrappers require explicit `-IdunnRudpHealth` or `IDUNN_RUDP_HEALTH`;
|
||||
there is no baked Starfire LAN default. `muninn --health` is an explicit
|
||||
diagnostic publisher for the same typed health document, not live ownership.
|
||||
Odin
|
||||
publishes `odin.cultnet-rudp-provider-health` after each provider refresh.
|
||||
Stonks publishes `stonks.cultnet-rudp-market-health` after each serialized
|
||||
market refresh. Weksa publishes `weksa.cultnet-rudp-provider-health` after each
|
||||
serialized provider witness refresh. VoidBot publishes
|
||||
`voidbot.cultnet-rudp-stack-health` after each GameCult Local Orchestrator
|
||||
pulse. Gjallar publishes
|
||||
`gjallar.cultnet-rudp-framebuffer-composition-health` from the C# Nightwing
|
||||
framebuffer service. Mimir Eve dashboard publishes
|
||||
`mimir.cultnet-rudp-provider-health` from the Nightwing systemd broker, and the
|
||||
same process publishes `nightwing.cultnet-rudp-eve-dashboard-health` for the
|
||||
Nightwing dashboard service itself. The Nightwing Eve browser reference now runs
|
||||
as `Mimir.EveBrowserReference`, serving
|
||||
the same static lowering and publishing
|
||||
`nightwing.cultnet-rudp-browser-reference-health` from its own service process.
|
||||
Live Idunn cycles accept these records as health truth; missing or stale
|
||||
publication becomes typed missing-publication state.
|
||||
Raven's Muninn scheduled-task repair remains a separate ops invariant:
|
||||
`GameCult-Muninn` is the only live Muninn scheduled task. Health fails if
|
||||
obsolete activation or video-proof tasks still exist, and the live Raven
|
||||
`serve` process must carry its own
|
||||
`--idunn-rudp-health`, `--idunn-daemon`, and `--idunn-health-contract`
|
||||
arguments.
|
||||
|
||||
Next: keep moving the remaining Yggdrasil deployments off product/deck checks and
|
||||
continue runtime-by-runtime until debug probes are unable to masquerade as
|
||||
daemon truth.
|
||||
Heimdall has now crossed the first live transport line: the Yggdrasil runtime
|
||||
publishes `heimdall.cultnet-rudp-provider-health`, writes a daemon-owned
|
||||
boundary witness at `/srv/heimdall/cultcache/heimdall.service.cc`, and the
|
||||
deploy lane ships the required `CultLib` snapshot beside the app artifact.
|
||||
Heimdall still owes Odin ingestion of that boundary store plus the later
|
||||
redacted auth-document witness export, but it is no longer waiting on basic
|
||||
RUDP keepalive surgery. Weksa now publishes daemon-owned provider
|
||||
advertisement, operator state, Eve surface, command boundary, and transport
|
||||
profile records in its provider store, accepts MiMo VoiceDesign commands over
|
||||
CultNet/RUDP command documents, and records deleted product command lanes as
|
||||
non-authority. Odin local discovery can ingest those records. The Weksa start
|
||||
and restart wrappers require explicit `-IdunnRudpHealth` or
|
||||
`WEKSA_IDUNN_RUDP_HEALTH`; there is no localhost Idunn default. Stonks now
|
||||
publishes daemon-owned provider advertisement,
|
||||
market snapshot, Eve surface, command boundary, and transport profile records in
|
||||
its CultCache store, and Odin local discovery can ingest those records; product
|
||||
routes are not provider transport. StreamPixels now has a
|
||||
service-owned CultCache boundary store at
|
||||
`E:\Projects\StreamPixels\.streampixels-data\cultcache\streampixels.service.cc`
|
||||
containing provider advertisement, command boundary, transport profile, and an
|
||||
Idunn health summary, and Odin local discovery can ingest it. The live
|
||||
Yggdrasil deployment now keeps
|
||||
`/srv/streampixels/env/service.env` wired for
|
||||
explicit `STREAMPIXELS_IDUNN_RUDP_HEALTH` with contract
|
||||
`streampixels.cultnet-rudp-service-health`, publishes the boundary store at
|
||||
`/srv/streampixels/app/.streampixels-data/cultcache/streampixels.service.cc`,
|
||||
and has live Idunn acceptance proof for `yggdrasil-streampixels` through the
|
||||
configured RUDP route. StreamPixels now owes only the final demotion of host
|
||||
checks to deployment/debug witnesses once Odin consumes the typed store.
|
||||
Repixelizer now has a daemon-owned Verse runtime witness in
|
||||
`src/repixelizer/verse_state.py`: the live GUI runtime writes provider
|
||||
advertisement, Eve surface state, runtime config, auth projection, queue/job
|
||||
records, command boundary, transport profile, and `idunn.daemon_health` into
|
||||
the configured `.cc` store, and publishes Idunn RUDP health when
|
||||
`GC_ACCESS_IDUNN_RUDP_HEALTH` is configured. Repixelizer product web and host
|
||||
supervisor checks are deployment/debug witnesses;
|
||||
absent RUDP health is a visible missing-publication state, not fallback truth.
|
||||
VoidBot, Mimir, and
|
||||
the Nightwing Eve runtime services still owe provider advertisement and
|
||||
command-boundary RUDP publication before their renderer surfaces can be derived
|
||||
from typed state alone. Gjallar consumes Odin's accepted provider-state
|
||||
snapshot over CultNet/RUDP; Odin no longer hosts a browser-deck lowering bridge
|
||||
for it to consume. Raven Muninn task action repair is no longer queued: the live
|
||||
target is the single `GameCult-Muninn` serve task, while obsolete activation and
|
||||
video-proof tasks are removed and treated as health failures if they return.
|
||||
|
||||
Vili's Node daemon now has an in-process Idunn RUDP publisher for
|
||||
`vili.cultnet-rudp-animation-health`, and local smoke proof shows Idunn accepts
|
||||
that record over `cultnet.transport.rudp.v0`. Vili also writes
|
||||
`.vili\vili.service.cc` with daemon-owned provider advertisement, operator
|
||||
state, Eve surface, command boundary, and transport profile records. Odin local
|
||||
provider discovery can ingest that typed store, including the Vili command
|
||||
boundary and transport profile. That is now live Raven proof as well: Odin's
|
||||
`scripts\restart-vili.ps1` refreshes the Raven runtime from the authoritative
|
||||
local Vili and CultLib files, reinstalls the hidden `GameCult\Vili` task with
|
||||
`--idunn-rudp-health` supplied by explicit `-IdunnRudpHealth`,
|
||||
`VILI_IDUNN_RUDP_HEALTH`, or `IDUNN_RUDP_HEALTH`, and restarts it. Live Idunn
|
||||
accepts `vili.cultnet-rudp-animation-health` through the configured RUDP route.
|
||||
|
||||
No ad hoc JSON manifest, product endpoint, port socket, or browser-deck bridge
|
||||
may become the live state owner. Debug projections are fine when they name the
|
||||
`.cc` record, CultNet document, or CultMesh publication behind them.
|
||||
|
|
@ -1,5 +1,12 @@
|
|||
# Transport Shortcut Inventory
|
||||
|
||||
> **Path note, 2026-09-05.** Idunn was extracted to
|
||||
> https://github.com/GameCult/Idunn. Entries below citing `scripts/idunn-*.ps1`,
|
||||
> `scripts/health-idunn-*`, `scripts/notify-idunn-*` or `scripts/start-idunn-local.ps1`
|
||||
> refer to paths that moved to `gamecult-ops/scripts/idunn/`; unit files and Idunn
|
||||
> documentation moved to the Idunn repository. This is a dated ledger and the
|
||||
> entries are left as written.
|
||||
|
||||
Status date: 2026-07-03
|
||||
|
||||
## Authority Map
|
||||
|
|
@ -191,7 +198,7 @@ Deletion line: delete endpoint overrides and fallback health/input paths before
|
|||
| Loki Chrome observer | Chrome extension ingest and CDP probing are local observation lowerings. Loki now writes its daemon-owned snapshot, provider advertisement, Eve surface, command boundary, transport profile, debug/page snapshot, and Idunn health records through `state/loki.service.ccmp`, and only announces to Odin when an explicit Odin CultMesh/RUDP endpoint is configured. | Keep browser-extension HTTP as local input ergonomics only; do not restore text `.cc` witness sidecars or future-CultMesh prose as durable Verse state. |
|
||||
| Repixelizer service boundary store | The GUI runtime writes provider advertisement, Eve surface state, runtime config, auth projection, queue snapshot, job/job-event records, command boundary, transport profile, and `idunn.daemon_health` to the configured `.cc` witness store. It publishes Idunn RUDP health when `GC_ACCESS_IDUNN_RUDP_HEALTH` is configured; otherwise the transport profile reports missing RUDP health publication. | Keep queue/job ownership in `GuiJobManager` until a deliberate typed-store ownership move, and keep HTTP/systemd/nginx as deployment/debug witnesses only. |
|
||||
| Vili / Weksa | Vili publishes provider, operator, command, transport, motion request, and motion job records in its service CultCache store. HTTP/WS are operator/debug lowerings, JSON sidecars require explicit debug export, and the Vili smoke probe requires an explicit base URL. Weksa accepts commands over CultNet/RUDP, records deleted HTTP command lanes as non-authority, writes JSON mirrors only when debug export is explicit, and constructs its live provider advertisement from daemon-owned code rather than docs fixtures. Vili Idunn health, Weksa Idunn health, and Weksa startup publication are explicit/env-configured, not baked endpoint defaults. | Keep renderer, fixtures, and debug endpoints outside provider transport and command ownership, and route future Vili/Weksa command intake through typed records rather than JSON mirrors. |
|
||||
| Gjallar | Consumes Odin accepted provider state through CultNet/RUDP snapshot input only; no WebSocket deck scrape, direct provider WebSocket receiver, or baked Starfire RUDP service endpoint remains. | Keep Nightwing framebuffer composition derived from Odin-owned provider state over RUDP, with launch config generated from Odin/CultMesh discovery or explicit operator config. |
|
||||
| Gjallar | Runs headless beside Odin and Idunn on Yggdrasil, consumes Odin accepted provider state through CultNet/RUDP snapshot input, and publishes `gjallar.overview`; no WebSocket deck scrape, direct provider WebSocket receiver, baked Starfire endpoint, or live Nightwing framebuffer body remains. | Keep Yggdrasil aggregate membership/layout derived from Odin-owned provider state; EveCanvas, browser, TUI, and optional framebuffer clients lower the published tree without becoming owners. |
|
||||
| Idunn surgery/profile records | Migrated target profiles name daemon-owned RUDP health plus daemon-owned CultCache/CultMesh stores. Swarm targets no longer carry health commands, desired daemon records publish `health_command: None`, `--health-command` fails closed, and missing health becomes a non-actuating missing-publication observation instead of a probe result. | Rename legacy schema fields in a later schema migration if consumers can move together. |
|
||||
| Mimir Nightwing Eve dashboard/browser reference | Publish daemon-owned command boundaries and transport profiles with supervisor lifecycle authority and HTTP/WebSocket/static HTTP as lowerings, not compatibility transport authority. The Eve dashboard broker no longer imports arbitrary remote WebSocket deck providers or invents a StreamPixels SSH/LAN provider. Active proof/relay branch scripts require explicit endpoint config instead of baked Starfire/Raven LAN routes. | Keep Odin/Nightwing consumers reading the typed CultMesh/CultCache witnesses rather than service probes; add new remote surfaces through Odin/CultMesh ingestion, not broker launch args. |
|
||||
| Mimir OBS diagnostic sink | OBS route is labelled and configured as a debug sink; Mimir owns composition and Yggdrasil/site publication remains the publication path. | Keep OBS outside Verse discovery, provider ownership, and publication authority. |
|
||||
|
|
@ -677,7 +684,13 @@ Deletion line: delete endpoint overrides and fallback health/input paths before
|
|||
- Muninn/sleipnir Odin startup and catalog path cut: `crates\muninn-daemon` and `crates\sleipnir-daemon` now store Odin as `cultmesh://odin/rendezvous/provider-catalog` / `--odin-cultmesh-uri` and resolve it through Rust CultMesh only at RUDP catalog publish/pull boundaries. The old `--odin-cultmesh-rudp` flag is fail-closed in both daemons. Odin launchers for Raven/Starfire/Nightwing Muninn and Raven Sleipnir now pass `--odin-cultmesh-uri` / `ODIN_CULTMESH_URI` instead of raw endpoint flags.
|
||||
- Muninn/sleipnir Rust verification passed: `cargo test -p muninn-daemon odin_cultmesh`, `cargo test -p muninn-daemon request_stream_requires_odin_cultmesh_command_route`, `cargo test -p sleipnir-daemon odin_cultmesh`, `cargo test -p sleipnir-daemon rejects_removed_command_rudp_bind`, `cargo test --manifest-path vendor\cultmesh-rs\Cargo.toml resolves_rudp_endpoint_from_cultmesh_uri_bootstrap_env`, and `cargo test --manifest-path vendor\cultmesh-rs\Cargo.toml cultmesh_rudp_endpoint` passed. `cargo test -p muninn-daemon --no-run`, `cargo test -p sleipnir-daemon --no-run`, PowerShell parser checks for touched launchers, and `git diff --check` on touched Rust/script files also passed.
|
||||
- C# CultMesh Odin URI resolver added: `E:\Projects\CultLib\src\GameCult.Mesh\CultMesh.cs` now exposes `CultMesh.ResolveRudpEndpoint(...)`, accepts `cultmesh://` targets, resolves them through `CULTMESH_URI_<AUTHORITY>_RUDP` / `<AUTHORITY>_CULTMESH_RUDP_ENDPOINT`, and the string `CreateRudpClient(...)` overload now resolves through that CultMesh boundary instead of accepting only raw `rudp://` endpoints.
|
||||
- Gjallar Odin startup publication cut: `E:\Projects\Gjallar\src\Gjallar\Program.cs` now stores Odin startup publication as `--odin-cultmesh-uri` / `GJALLAR_ODIN_CULTMESH_URI`, defaults to `cultmesh://odin/rendezvous/provider-catalog`, rejects `--odin-cultmesh-rudp` / `GJALLAR_ODIN_CULTMESH_RUDP`, and removed its local Odin host/port parser. Gjallar publishes through `CultMesh.ResolveRudpEndpoint(...)`; docs now describe the CultMesh URI authority instead of a raw document-ingress override.
|
||||
- Historical, unadmitted Gjallar URI experiment: an `E:\Projects\Gjallar`
|
||||
body attempted to replace raw Odin RUDP flags with `--odin-cultmesh-uri`.
|
||||
That body is not the canonical source or deployed release. The live
|
||||
`F:\Projects\Gjallar` release `d683faa558351327d987918d1e8b8f79886dc9cb`
|
||||
accepts `--odin-cultnet-rudp` and `--odin-cultmesh-rudp`; its Yggdrasil unit
|
||||
uses both against `10.77.0.1:17871`. Treat the URI experiment and its checks
|
||||
as rejected branch evidence, not a completed transport cut.
|
||||
- Aetheria Odin announcement path cut: `E:\Projects\Aetheria\Aetheria.State.Daemon\Program.cs` collapsed `OdinCultMeshRudpEndpoints` into a single `OdinCultMeshUri`, defaults to `cultmesh://odin/rendezvous/provider-catalog`, rejects both `--odin-cultmesh-rudp` and the previous `--odin-cultnet-rudp` alias as announcement targets, advertises provider announcement routes as `transport: cultmesh`, and publishes through the shared CultMesh client URI resolution path.
|
||||
- C# Odin URI verification passed: `dotnet build E:\Projects\CultLib\src\GameCult.Mesh\GameCult.Mesh.csproj --no-restore -p:OutDir=E:\Projects\.codex-build\cultmesh-out\`, `dotnet build E:\Projects\Gjallar\src\Gjallar\Gjallar.csproj --no-restore`, and isolated-output `dotnet build E:\Projects\Aetheria\Aetheria.State.Daemon\Aetheria.State.Daemon.csproj --no-restore -p:OutDir=E:\Projects\.codex-build\aetheria-daemon-out\` passed. The normal Aetheria output build was blocked by a running `Aetheria.State.Daemon` process holding DLLs open, so verification used `OutDir`; focused scans found no surviving raw Odin CultMesh RUDP config path outside intentional removed-option guards and this inventory.
|
||||
- VoidBot Bifrost startup health side-door cut: `E:\Projects\VoidBot\scripts\start-voidbot-stack.ps1` no longer reads `BIFROST_HEALTH_URL`, curls Bifrost `/healthz`, or starts `BIFROST_ROOT\compose.local.yaml` based on product HTTP health. Stack startup now verifies `BIFROST_CULTMESH_COMMAND_URI`, `BIFROST_CULTMESH_STORE_PATH`, the Bifrost CultMesh command processor, and exports the typed provider store when missing. VoidBot current maps and handoff notes now describe Bifrost readiness as the CultMesh command lane, not Docker/product HTTP health.
|
||||
|
|
@ -691,10 +704,10 @@ Deletion line: delete endpoint overrides and fallback health/input paths before
|
|||
- Bifrost provider surface HTTP probe cut: `E:\Projects\Bifrost\tools\provider-advertisement.mjs` no longer accepts `--health-url`, `--ready-url`, `BIFROST_HEALTH_URL`, or `BIFROST_READY_URL` when building/exporting provider surfaces. Operator readiness now derives from typed CultMesh/CultCache stores, governance/request stores, and typed bridge command metadata; `/healthz` and `/readyz` remain product smoke endpoints only and cannot feed Odin-facing provider status.
|
||||
- Bifrost test-suite HTTP bridge fixture cut: `E:\Projects\Bifrost\tests\Bifrost.Web.Tests\BridgeCliTests.cs` no longer spins up a fake localhost `HttpListener` bridge, no longer teaches `/bridge/actions/*`, `/dispatch/runs/*`, `/transport/receipts`, or `/governance/receipts` as accepted receipt paths, and uses typed `BIFROST_CULTMESH_COMMAND_ID` provenance or explicit removed-config negative checks instead of `BIFROST_BRIDGE_BASE_URL` / `BIFROST_BRIDGE_TOKEN` success fixtures.
|
||||
- Bifrost bridge CLI test verification passed: `DOTNET_ROLL_FORWARD=Major dotnet test E:\Projects\Bifrost\tests\Bifrost.Web.Tests\Bifrost.Web.Tests.csproj --no-restore --filter FullyQualifiedName~BridgeCliTests` passed 30/30, and focused scans found no fake bridge server, localhost listener, deleted bridge route fixture, or old base-url/token success assertion in `BridgeCliTests.cs`.
|
||||
- Gjallar Odin snapshot input cut: `E:\Projects\Gjallar\src\Gjallar\Program.cs` no longer accepts `--odin-cultnet-rudp` / `GJALLAR_ODIN_CULTNET_RUDP` as the live provider-state snapshot input. Gjallar now uses `--odin-cultmesh-uri` / `GJALLAR_ODIN_CULTMESH_URI`, defaults to `cultmesh://odin/rendezvous/provider-catalog`, resolves the concrete RUDP endpoint through `CultMesh.ResolveRudpEndpoint(...)` at the transport boundary, and publishes its runtime config/transport profile with the CultMesh URI rather than a raw host:port.
|
||||
- Gjallar Idunn deployment cut: `E:\Projects\Odin\scripts\deploy-nightwing-gjallar.ps1` now writes `GJALLAR_ODIN_CULTMESH_URI` into the systemd drop-in and rejects `GJALLAR_ODIN_CULTNET_RUDP` / `ODIN_CULTNET_RUDP` before build, transfer, or restart work can begin. Gjallar README, architecture notes, and state map now describe Odin input as a CultMesh snapshot URI, not direct CultNet/RUDP endpoint configuration.
|
||||
- Gjallar Odin URI input verification passed: `dotnet build E:\Projects\Gjallar\src\Gjallar\Gjallar.csproj --no-restore` passed; PowerShell parser check passed for `deploy-nightwing-gjallar.ps1`; stale `Gjallar.dll --odin-cultnet-rudp 127.0.0.1:17871 ...` fails before renderer startup; stale `GJALLAR_ODIN_CULTNET_RUDP=127.0.0.1:17871 Gjallar.dll ...` exits nonzero with the removed-env error; Idunn deploy with `ODIN_CULTNET_RUDP=127.0.0.1:17871` exits 1 with the removed-env error; focused scans found no surviving raw Gjallar Odin snapshot input path outside removed-config guards and this inventory.
|
||||
- `gamecult-ops` Gjallar unit cut: `E:\Projects\gamecult-ops\scripts\gjallar.service` no longer requires `ODIN_CULTNET_RUDP` or launches Gjallar with `--odin-cultnet-rudp`. The unit rejects stale raw Odin endpoint env, defaults `GJALLAR_ODIN_CULTMESH_URI` to `cultmesh://odin/rendezvous/provider-catalog`, validates the value as a CultMesh URI, and passes `--odin-cultmesh-uri` to Gjallar. Nightwing visible-ops archive tombstones, inventory, and the Nightwing CultMesh worker tunnel runbook now teach the CultMesh URI route instead of a raw Odin socket.
|
||||
- Current Gjallar transport admission: Idunn runs the headless Yggdrasil body,
|
||||
Odin owns the accepted snapshot at `10.77.0.1:17871`, and Gjallar publishes
|
||||
`gjallar.overview` back over the same RUDP substrate. Nightwing deployment and
|
||||
framebuffer units are retired rather than adapted to the unadmitted URI path.
|
||||
- Loki Chrome extension HTTP ingest cut: `E:\Projects\Loki\src\loki-daemon.mjs` no longer imports `node:http`, opens a localhost extension ingest server, serves `/health` or `/state`, accepts `/ingest/chrome-extension`, advertises `chrome-extension-ingest`, or publishes `gamecult.loki.chrome_extension_report.v0`, `gamecult.loki.chrome_debug_probe.v0`, or `gamecult.loki.chrome_page_snapshot.v0` witness routes. The daemon is CDP-observation-only until browser-origin observations have a CultMesh/native binding. `--extension-host` and `--extension-port` fail closed, the unpacked extension is an archived status stub with no localhost host permissions, and the old extension-ingest smoke test is now a removed-path guard.
|
||||
- Loki verification passed: bundled Node syntax checks passed for `src\loki-daemon.mjs`, the extension service worker/popup, and Loki smoke tests; direct `node test\fixture-cdp-smoke.mjs` passed; direct `node test\extension-ingest-smoke.mjs` passed and proves `--extension-port` is rejected before startup. Focused scans found no remaining Loki extension HTTP ingest server, `/ingest/chrome-extension`, `LOKI_EXTENSION_PORT`, Chrome debugger/page snapshot action names, extension host permissions, or advertised extension/debug/page snapshot witness routes outside the intentional removed-option guard.
|
||||
- Bifrost web bridge route cut: `E:\Projects\Bifrost\src\Bifrost.Web\Program.cs` no longer maps `/bridge/actions/*`, `/dispatch/runs/*`, `/transport/receipts`, or `/governance/receipts` at all. The old local bridge token HTTP handlers, `BuildBridgeCaller`, and local bridge token gate were deleted from the product web app. `PlatformEndpointsTests` now proves the old routes are `404 NotFound` and do not write bridge action, dispatch run, transport receipt, or governance receipt rows.
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,2 +1,2 @@
|
|||
@echo off
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File E:\Projects\Odin\scripts\activate-muninn-raven-av-srt.ps1
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File %~dp0activate-muninn-raven-av-srt.ps1
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
@echo off
|
||||
if not "%IDUNN_ACTUATOR%"=="1" (
|
||||
echo This deployment wrapper is an Idunn actuator. Configure Idunn; do not deploy manually.
|
||||
exit /b 1
|
||||
)
|
||||
if /I not "%IDUNN_COMMAND_AUTHORITY%"=="idunn-daemon" (
|
||||
echo This deployment wrapper is an Idunn actuator. Configure Idunn; do not deploy manually.
|
||||
exit /b 1
|
||||
)
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File E:\Projects\Odin\scripts\deploy-nightwing-gjallar.ps1
|
||||
|
|
@ -1,158 +0,0 @@
|
|||
param(
|
||||
[string] $GjallarRoot = "E:\Projects\Gjallar",
|
||||
[string] $CultLibRoot = "E:\Projects\CultLib",
|
||||
[string] $CultMathRoot = "E:\Projects\CultMath",
|
||||
[string] $SshTarget = "nwroot",
|
||||
[string] $RemoteDir = "/opt/gamecult/gjallar",
|
||||
[string] $CultCachePath = "/var/lib/gamecult/gjallar/cultcache/gjallar.service.cc",
|
||||
[string] $OdinCultMeshUri = $(if ($env:GJALLAR_ODIN_CULTMESH_URI) { $env:GJALLAR_ODIN_CULTMESH_URI } elseif ($env:ODIN_CULTMESH_URI) { $env:ODIN_CULTMESH_URI } else { "cultmesh://odin/rendezvous/provider-catalog" }),
|
||||
[string] $IdunnRudpHealth = $(if ($env:GJALLAR_IDUNN_RUDP_HEALTH) { $env:GJALLAR_IDUNN_RUDP_HEALTH } else { $env:IDUNN_RUDP_HEALTH }),
|
||||
[string] $IdunnDaemon = "nightwing-gjallar",
|
||||
[string] $IdunnHealthContract = "gjallar.cultnet-rudp-framebuffer-composition-health",
|
||||
[string] $UpstreamRemote = "origin",
|
||||
[string] $UpstreamBranch = "main"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
function Remove-ScratchPath {
|
||||
param(
|
||||
[string] $ScratchRoot,
|
||||
[string] $TargetPath
|
||||
)
|
||||
|
||||
if (-not (Test-Path -LiteralPath $TargetPath)) {
|
||||
return
|
||||
}
|
||||
|
||||
$resolvedScratch = (Resolve-Path -LiteralPath $ScratchRoot).Path
|
||||
$resolvedTarget = (Resolve-Path -LiteralPath $TargetPath).Path
|
||||
if (-not $resolvedTarget.StartsWith($resolvedScratch, [StringComparison]::OrdinalIgnoreCase)) {
|
||||
throw "Refusing to remove scratch path outside scratch root: $resolvedTarget"
|
||||
}
|
||||
|
||||
Remove-Item -LiteralPath $TargetPath -Recurse -Force
|
||||
}
|
||||
|
||||
function Export-GitArchive {
|
||||
param(
|
||||
[string] $RepoRoot,
|
||||
[string] $Ref,
|
||||
[string] $Destination,
|
||||
[string] $TarPath
|
||||
)
|
||||
|
||||
Remove-ScratchPath -ScratchRoot (Split-Path -Parent $Destination) -TargetPath $Destination
|
||||
New-Item -ItemType Directory -Force -Path $Destination | Out-Null
|
||||
git -C $RepoRoot archive --format=tar --output=$TarPath $Ref
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "git archive failed for $RepoRoot $Ref"
|
||||
}
|
||||
tar -xf $TarPath -C $Destination
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "source extraction failed for $TarPath"
|
||||
}
|
||||
}
|
||||
|
||||
if ($env:IDUNN_ACTUATOR -ne "1" -or $env:IDUNN_COMMAND_AUTHORITY -ne "idunn-daemon") {
|
||||
throw "This deployment script is an Idunn actuator. Agents must configure Idunn release targets and let Idunn run deployment; do not invoke deploy scripts manually."
|
||||
}
|
||||
if ($env:GJALLAR_ODIN_CULTNET_RUDP -or $env:ODIN_CULTNET_RUDP) {
|
||||
throw "GJALLAR_ODIN_CULTNET_RUDP and ODIN_CULTNET_RUDP were removed. Configure GJALLAR_ODIN_CULTMESH_URI or ODIN_CULTMESH_URI with a cultmesh:// Odin route."
|
||||
}
|
||||
if ([string]::IsNullOrWhiteSpace($OdinCultMeshUri) -or -not $OdinCultMeshUri.StartsWith("cultmesh://", [StringComparison]::OrdinalIgnoreCase)) {
|
||||
throw "Odin CultMesh URI must be supplied by GJALLAR_ODIN_CULTMESH_URI, ODIN_CULTMESH_URI, or -OdinCultMeshUri and must start with cultmesh://."
|
||||
}
|
||||
if ([string]::IsNullOrWhiteSpace($IdunnRudpHealth)) {
|
||||
throw "Idunn RUDP health endpoint must be supplied by GJALLAR_IDUNN_RUDP_HEALTH, IDUNN_RUDP_HEALTH, or -IdunnRudpHealth; no WireGuard endpoint default is allowed."
|
||||
}
|
||||
|
||||
$sourceRef = "$UpstreamRemote/$UpstreamBranch"
|
||||
$scratchRoot = Join-Path $GjallarRoot "scratch"
|
||||
$releaseSource = Join-Path $scratchRoot "idunn-release-source"
|
||||
$cultLibRelease = Join-Path $scratchRoot "CultLib"
|
||||
$cultMathRelease = Join-Path $scratchRoot "CultMath"
|
||||
$releaseTarPath = Join-Path $scratchRoot "gjallar-source-release.tar"
|
||||
$cultLibTarPath = Join-Path $scratchRoot "cultlib-source-release.tar"
|
||||
$cultMathTarPath = Join-Path $scratchRoot "cultmath-source-release.tar"
|
||||
$publishDir = Join-Path $scratchRoot "publish\gjallar"
|
||||
$tarPath = Join-Path $GjallarRoot "scratch\gjallar-publish.tar"
|
||||
$projectPath = Join-Path $releaseSource "src\Gjallar\Gjallar.csproj"
|
||||
$manifestPath = Join-Path $publishDir "gamecult-gjallar-deploy-manifest.txt"
|
||||
|
||||
git -C $GjallarRoot fetch --prune $UpstreamRemote $UpstreamBranch
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "git fetch failed for $GjallarRoot $sourceRef"
|
||||
}
|
||||
|
||||
$commit = (git -C $GjallarRoot rev-parse $sourceRef).Trim()
|
||||
if ([string]::IsNullOrWhiteSpace($commit)) {
|
||||
throw "Could not determine Gjallar git revision."
|
||||
}
|
||||
|
||||
$cultLibCommit = (git -C $CultLibRoot rev-parse HEAD).Trim()
|
||||
if ([string]::IsNullOrWhiteSpace($cultLibCommit)) {
|
||||
throw "Could not determine CultLib git revision."
|
||||
}
|
||||
|
||||
$cultMathCommit = (git -C $CultMathRoot rev-parse HEAD).Trim()
|
||||
if ([string]::IsNullOrWhiteSpace($cultMathCommit)) {
|
||||
throw "Could not determine CultMath git revision."
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $scratchRoot | Out-Null
|
||||
Remove-ScratchPath -ScratchRoot $scratchRoot -TargetPath $publishDir
|
||||
Export-GitArchive -RepoRoot $GjallarRoot -Ref $sourceRef -Destination $releaseSource -TarPath $releaseTarPath
|
||||
Export-GitArchive -RepoRoot $CultLibRoot -Ref $cultLibCommit -Destination $cultLibRelease -TarPath $cultLibTarPath
|
||||
Export-GitArchive -RepoRoot $CultMathRoot -Ref $cultMathCommit -Destination $cultMathRelease -TarPath $cultMathTarPath
|
||||
|
||||
dotnet publish $projectPath -c Release -r linux-x64 --self-contained true -o $publishDir
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "dotnet publish failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
$dllPath = Join-Path $publishDir "Gjallar.dll"
|
||||
$hash = (Get-FileHash $dllPath -Algorithm SHA256).Hash.ToLowerInvariant()
|
||||
$deployedAt = [DateTimeOffset]::UtcNow.ToString("O")
|
||||
@(
|
||||
"schema=gamecult.gjallar.deployment_manifest.v1"
|
||||
"upstreamRemote=$UpstreamRemote"
|
||||
"upstreamBranch=$UpstreamBranch"
|
||||
"sourceRef=$sourceRef"
|
||||
"gitCommit=$commit"
|
||||
"cultLibCommit=$cultLibCommit"
|
||||
"cultMathCommit=$cultMathCommit"
|
||||
"artifact=Gjallar.dll"
|
||||
"sha256=$hash"
|
||||
"deployedAtUtc=$deployedAt"
|
||||
) | Set-Content -Encoding ASCII -LiteralPath $manifestPath
|
||||
|
||||
tar -cf $tarPath -C $publishDir .
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "tar failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
scp.exe $tarPath "${SshTarget}:/tmp/gjallar-publish.tar"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "scp failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
$cultCacheDir = if ($CultCachePath.LastIndexOf('/') -gt 0) { $CultCachePath.Substring(0, $CultCachePath.LastIndexOf('/')) } else { "." }
|
||||
$dropIn = @"
|
||||
[Service]
|
||||
Environment=GJALLAR_CULTCACHE_PATH=$CultCachePath
|
||||
Environment=GJALLAR_ODIN_CULTMESH_URI=$OdinCultMeshUri
|
||||
Environment=GJALLAR_IDUNN_RUDP_HEALTH=$IdunnRudpHealth
|
||||
Environment=GJALLAR_IDUNN_DAEMON=$IdunnDaemon
|
||||
Environment=GJALLAR_IDUNN_HEALTH_CONTRACT=$IdunnHealthContract
|
||||
"@
|
||||
$dropInBase64 = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($dropIn))
|
||||
|
||||
ssh.exe $SshTarget "mkdir -p '$RemoteDir' '$cultCacheDir' /etc/systemd/system/gjallar.service.d && tar -xf /tmp/gjallar-publish.tar -C '$RemoteDir' && chmod +x '$RemoteDir/Gjallar' && printf '%s' '$dropInBase64' | base64 -d > /etc/systemd/system/gjallar.service.d/idunn-rudp-health.conf && systemctl daemon-reload && systemctl restart gjallar.service && systemctl is-active --quiet gjallar.service"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "remote deploy or restart failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
Write-Host "Gjallar deployed to Nightwing."
|
||||
Write-Host " gitCommit=$commit"
|
||||
Write-Host " sha256=$hash"
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
param(
|
||||
[string] $LocalSleipnirExe = "E:\Projects\Odin\target\release\sleipnir.exe",
|
||||
[string] $LocalSleipnirExe = (Join-Path (Split-Path -Parent $PSScriptRoot) "target\release\sleipnir.exe"),
|
||||
[string] $RavenHost = "raven",
|
||||
[string] $RemoteSleipnirExe = "C:\Meta\Odin\Sleipnir\sleipnir.exe",
|
||||
[string] $SshUser = "madman's lullaby",
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@ if /I not "%IDUNN_COMMAND_AUTHORITY%"=="idunn-daemon" (
|
|||
echo This deployment wrapper is an Idunn actuator. Configure Idunn; do not deploy manually.
|
||||
exit /b 1
|
||||
)
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File E:\Projects\Odin\scripts\deploy-yggdrasil-heimdall.ps1
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File %~dp0deploy-yggdrasil-heimdall.ps1
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
param(
|
||||
[string] $SshTarget = "yggdrasil",
|
||||
[string] $RepoRoot = "E:\Projects\Heimdall",
|
||||
[string] $CultLibRoot = "E:\Projects\CultLib",
|
||||
[string] $RepoRoot = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "Heimdall"),
|
||||
[string] $CultLibRoot = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "CultLib"),
|
||||
[string] $AppUser = "heimdall",
|
||||
[string] $RemoteAppHome = "/srv/heimdall",
|
||||
[string] $RemoteTarballName = "heimdall-source.tar",
|
||||
[string] $RemoteCultLibTarballName = "heimdall-cultlib.tar",
|
||||
[string] $DeployScript = "E:\Projects\gamecult-ops\scripts\deploy-heimdall.sh",
|
||||
[string] $CheckScript = "E:\Projects\gamecult-ops\scripts\check-heimdall.sh",
|
||||
[string] $DeployScript = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "gamecult-ops\scripts\deploy-heimdall.sh"),
|
||||
[string] $CheckScript = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "gamecult-ops\scripts\check-heimdall.sh"),
|
||||
[string] $UpstreamRemote = "origin",
|
||||
[string] $UpstreamBranch = "main",
|
||||
[string] $CultLibUpstreamRemote = "origin",
|
||||
|
|
@ -42,7 +42,7 @@ if ([string]::IsNullOrWhiteSpace($cultLibCommit)) {
|
|||
throw "Could not determine CultLib git revision."
|
||||
}
|
||||
|
||||
$scratch = Join-Path "E:\Projects\Odin\scratch\idunn-deploy" "yggdrasil-heimdall"
|
||||
$scratch = Join-Path (Join-Path (Split-Path -Parent $PSScriptRoot) "scratch\idunn-deploy") "yggdrasil-heimdall"
|
||||
$sourceTarPath = Join-Path $scratch $RemoteTarballName
|
||||
$cultLibTarPath = Join-Path $scratch $RemoteCultLibTarballName
|
||||
$manifestPath = Join-Path $scratch "deployment-manifest.txt"
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@ if /I not "%IDUNN_COMMAND_AUTHORITY%"=="idunn-daemon" (
|
|||
echo This deployment wrapper is an Idunn actuator. Configure Idunn; do not deploy manually.
|
||||
exit /b 1
|
||||
)
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File E:\Projects\Odin\scripts\deploy-yggdrasil-repixelizer.ps1
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File %~dp0deploy-yggdrasil-repixelizer.ps1
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
param(
|
||||
[string] $SshTarget = "yggdrasil",
|
||||
[string] $RepoRoot = "E:\Projects\repixelizer",
|
||||
[string] $CultLibRoot = "E:\Projects\CultLib",
|
||||
[string] $RepoRoot = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "repixelizer"),
|
||||
[string] $CultLibRoot = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "CultLib"),
|
||||
[string] $AppUser = "repixelizer",
|
||||
[string] $RemoteAppHome = "/srv/repixelizer",
|
||||
[string] $RemoteTarballName = "repixelizer-source.tar",
|
||||
[string] $RemoteCultLibTarballName = "repixelizer-cultlib.tar",
|
||||
[string] $DeployScript = "E:\Projects\gamecult-ops\scripts\deploy-repixelizer-gui.sh",
|
||||
[string] $CheckScript = "E:\Projects\gamecult-ops\scripts\check-repixelizer-gui.sh",
|
||||
[string] $DeployScript = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "gamecult-ops\scripts\deploy-repixelizer-gui.sh"),
|
||||
[string] $CheckScript = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "gamecult-ops\scripts\check-repixelizer-gui.sh"),
|
||||
[string] $UpstreamRemote = "origin",
|
||||
[string] $UpstreamBranch = "main",
|
||||
[string] $CultLibUpstreamRemote = "origin",
|
||||
|
|
@ -43,7 +43,7 @@ if ([string]::IsNullOrWhiteSpace($cultLibCommit)) {
|
|||
throw "Could not determine CultLib git revision."
|
||||
}
|
||||
|
||||
$scratch = Join-Path "E:\Projects\Odin\scratch\idunn-deploy" "yggdrasil-repixelizer"
|
||||
$scratch = Join-Path (Join-Path (Split-Path -Parent $PSScriptRoot) "scratch\idunn-deploy") "yggdrasil-repixelizer"
|
||||
$sourceTarPath = Join-Path $scratch $RemoteTarballName
|
||||
$cultLibTarPath = Join-Path $scratch $RemoteCultLibTarballName
|
||||
$manifestPath = Join-Path $scratch "deployment-manifest.txt"
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ if ([string]::IsNullOrWhiteSpace($commit)) {
|
|||
throw "Could not determine git revision for $RepoRoot $sourceRef"
|
||||
}
|
||||
|
||||
$scratch = Join-Path "E:\Projects\Odin\scratch\idunn-deploy" $AppId
|
||||
$scratch = Join-Path (Join-Path (Split-Path -Parent $PSScriptRoot) "scratch\idunn-deploy") $AppId
|
||||
$tarPath = Join-Path $scratch $RemoteTarballName
|
||||
$manifestPath = Join-Path $scratch "deployment-manifest.txt"
|
||||
New-Item -ItemType Directory -Force -Path $scratch | Out-Null
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@ if /I not "%IDUNN_COMMAND_AUTHORITY%"=="idunn-daemon" (
|
|||
echo This deployment wrapper is an Idunn actuator. Configure Idunn; do not deploy manually.
|
||||
exit /b 1
|
||||
)
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File E:\Projects\Odin\scripts\deploy-yggdrasil-streampixels.ps1
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File %~dp0deploy-yggdrasil-streampixels.ps1
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
param(
|
||||
[string] $SshTarget = "yggdrasil",
|
||||
[string] $RepoRoot = "E:\Projects\StreamPixels",
|
||||
[string] $CultLibRoot = "E:\Projects\CultLib",
|
||||
[string] $RepoRoot = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "StreamPixels"),
|
||||
[string] $CultLibRoot = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "CultLib"),
|
||||
[string] $AppUser = "streampixels",
|
||||
[string] $RemoteAppHome = "/srv/streampixels",
|
||||
[string] $RemoteTarballName = "streampixels-source.tar",
|
||||
[string] $RemoteCultLibTarballName = "streampixels-cultlib.tar",
|
||||
[string] $DeployScript = "E:\Projects\gamecult-ops\scripts\deploy-streampixels-preview.sh",
|
||||
[string] $CheckScript = "E:\Projects\gamecult-ops\scripts\check-streampixels-preview.sh",
|
||||
[string] $DeployScript = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "gamecult-ops\scripts\deploy-streampixels-preview.sh"),
|
||||
[string] $CheckScript = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "gamecult-ops\scripts\check-streampixels-preview.sh"),
|
||||
[string] $UpstreamRemote = "origin",
|
||||
[string] $UpstreamBranch = "main",
|
||||
[string] $CultLibUpstreamRemote = "origin",
|
||||
|
|
@ -42,7 +42,7 @@ if ([string]::IsNullOrWhiteSpace($cultLibCommit)) {
|
|||
throw "Could not determine CultLib git revision."
|
||||
}
|
||||
|
||||
$scratch = Join-Path "E:\Projects\Odin\scratch\idunn-deploy" "yggdrasil-streampixels"
|
||||
$scratch = Join-Path (Join-Path (Split-Path -Parent $PSScriptRoot) "scratch\idunn-deploy") "yggdrasil-streampixels"
|
||||
$sourceTarPath = Join-Path $scratch $RemoteTarballName
|
||||
$cultLibTarPath = Join-Path $scratch $RemoteCultLibTarballName
|
||||
$manifestPath = Join-Path $scratch "deployment-manifest.txt"
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
@echo off
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File E:\Projects\Odin\scripts\health-idunn-swarm-deployment-coverage.ps1
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
$ErrorActionPreference = "Stop"
|
||||
|
||||
. (Join-Path $PSScriptRoot "idunn-deployment-targets.ps1")
|
||||
|
||||
$unknown = @($IdunnDeploymentTargets | Where-Object { $_.Status -notin @("enforced", "runtime-enforced", "blocked", "external-owned", "not-runtime", "archived") })
|
||||
$enforcedWithoutDeploy = @($IdunnDeploymentTargets | Where-Object { $_.Status -eq "enforced" -and [string]::IsNullOrWhiteSpace($_.Deploy) })
|
||||
$enforcedWithoutHealth = @($IdunnDeploymentTargets | Where-Object { $_.Status -in @("enforced", "runtime-enforced") -and $_.Id -ne "idunn" -and [string]::IsNullOrWhiteSpace($_.Health) })
|
||||
$enforcedWithoutUpstream = @($IdunnDeploymentTargets | Where-Object { $_.Status -eq "enforced" -and ([string]::IsNullOrWhiteSpace($_.UpstreamRemote) -or [string]::IsNullOrWhiteSpace($_.UpstreamBranch)) })
|
||||
$enforcedWithoutRollout = @($IdunnDeploymentTargets | Where-Object { $_.Status -eq "enforced" -and ([string]::IsNullOrWhiteSpace($_.RolloutStrategy) -or [string]::IsNullOrWhiteSpace($_.StateMigration) -or [string]::IsNullOrWhiteSpace($_.ZeroDowntime)) })
|
||||
$blockedWithoutReason = @($IdunnDeploymentTargets | Where-Object { $_.Status -in @("blocked", "external-owned") -and [string]::IsNullOrWhiteSpace($_.Reason) })
|
||||
$deployScriptsWithoutIdunnGuard = @(
|
||||
$IdunnDeploymentTargets |
|
||||
Where-Object { $_.Status -eq "enforced" -and -not [string]::IsNullOrWhiteSpace($_.Deploy) } |
|
||||
Where-Object {
|
||||
if ($_.Deploy -match '^sudo -n /usr/local/libexec/idunn-yggdrasil deploy [a-z0-9-]+$') {
|
||||
return $false
|
||||
}
|
||||
-not (Test-Path -LiteralPath $_.Deploy) -or
|
||||
-not ((Get-Content -Raw -LiteralPath $_.Deploy) -match 'IDUNN_ACTUATOR')
|
||||
}
|
||||
)
|
||||
$knownActuatorPaths = @{}
|
||||
foreach ($target in $IdunnDeploymentTargets) {
|
||||
foreach ($path in @($target.Deploy, $target.Restart) + @($target.Aliases)) {
|
||||
if (-not [string]::IsNullOrWhiteSpace($path) -and (Test-Path -LiteralPath $path)) {
|
||||
$knownActuatorPaths[[System.IO.Path]::GetFullPath($path).ToLowerInvariant()] = $target.Id
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($path in $IdunnDeploymentSharedActuators) {
|
||||
if (-not [string]::IsNullOrWhiteSpace($path)) {
|
||||
$knownActuatorPaths[[System.IO.Path]::GetFullPath($path).ToLowerInvariant()] = "shared"
|
||||
}
|
||||
}
|
||||
$guardedActuatorsWithoutCatalog = @(
|
||||
Get-ChildItem -LiteralPath $PSScriptRoot -File |
|
||||
Where-Object {
|
||||
$_.Name -match '^(deploy|restart)-.*\.(ps1|cmd)$' -and
|
||||
(Get-Content -Raw -LiteralPath $_.FullName) -match 'IDUNN_ACTUATOR' -and
|
||||
-not $knownActuatorPaths.ContainsKey([System.IO.Path]::GetFullPath($_.FullName).ToLowerInvariant())
|
||||
}
|
||||
)
|
||||
|
||||
$issues = @()
|
||||
if ($unknown.Count) {
|
||||
$issues += "unknown status: $($unknown.Id -join ', ')"
|
||||
}
|
||||
if ($enforcedWithoutDeploy.Count) {
|
||||
$issues += "enforced target missing deploy command: $($enforcedWithoutDeploy.Id -join ', ')"
|
||||
}
|
||||
if ($enforcedWithoutHealth.Count) {
|
||||
$issues += "enforced target missing health command: $($enforcedWithoutHealth.Id -join ', ')"
|
||||
}
|
||||
if ($enforcedWithoutUpstream.Count) {
|
||||
$issues += "enforced target missing upstream remote/branch: $($enforcedWithoutUpstream.Id -join ', ')"
|
||||
}
|
||||
if ($enforcedWithoutRollout.Count) {
|
||||
$issues += "enforced target missing rollout/migration/downtime contract: $($enforcedWithoutRollout.Id -join ', ')"
|
||||
}
|
||||
if ($deployScriptsWithoutIdunnGuard.Count) {
|
||||
$issues += "enforced deploy script missing Idunn actuator guard: $($deployScriptsWithoutIdunnGuard.Id -join ', ')"
|
||||
}
|
||||
if ($guardedActuatorsWithoutCatalog.Count) {
|
||||
$issues += "guarded deploy/restart actuator missing Idunn catalog entry: $($guardedActuatorsWithoutCatalog.Name -join ', ')"
|
||||
}
|
||||
if ($blockedWithoutReason.Count) {
|
||||
$issues += "blocked/external target missing reason: $($blockedWithoutReason.Id -join ', ')"
|
||||
}
|
||||
|
||||
if ($issues.Count) {
|
||||
throw "Idunn deployment target catalog is incoherent: $($issues -join '; ')"
|
||||
}
|
||||
|
||||
$enforced = @($IdunnDeploymentTargets | Where-Object { $_.Status -eq "enforced" })
|
||||
$runtimeEnforced = @($IdunnDeploymentTargets | Where-Object { $_.Status -eq "runtime-enforced" })
|
||||
$blocked = @($IdunnDeploymentTargets | Where-Object { $_.Status -eq "blocked" })
|
||||
$external = @($IdunnDeploymentTargets | Where-Object { $_.Status -eq "external-owned" })
|
||||
$archived = @($IdunnDeploymentTargets | Where-Object { $_.Status -eq "archived" })
|
||||
Write-Host "Idunn deployment catalog coherent: $($IdunnDeploymentTargets.Count) targets, $($enforced.Count) deploy-enforced with upstream rollout contracts, $($runtimeEnforced.Count) runtime-enforced, $($blocked.Count) blocked, $($external.Count) external-owned, $($archived.Count) archived, $($knownActuatorPaths.Count) cataloged actuator paths."
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
@echo off
|
||||
echo health-nightwing-gjallar.cmd archived: Gjallar health is daemon-published over CultNet/RUDP as gjallar.cultnet-rudp-framebuffer-composition-health. Use health-nightwing-gjallar.ps1 only as an explicit witness inspection, not Idunn health truth.
|
||||
exit /b 2
|
||||
|
|
@ -1,133 +0,0 @@
|
|||
param(
|
||||
[string] $GjallarRoot = "E:\Projects\Gjallar",
|
||||
[string] $SshTarget = "nightwing",
|
||||
[string] $RemoteManifest = "/opt/gamecult/gjallar/gamecult-gjallar-deploy-manifest.txt",
|
||||
[string] $RemoteStatus = "/var/log/gjallar.status",
|
||||
[string] $RemoteCultCache = "/var/lib/gamecult/gjallar/cultcache/gjallar.service.cc",
|
||||
[int] $MaxStatusAgeSeconds = 120,
|
||||
[int] $MinCatalogProviders = 1,
|
||||
[int] $MinComposedProviders = 1
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
function Fail-IdunnHealth {
|
||||
param(
|
||||
[string] $State,
|
||||
[string] $Message
|
||||
)
|
||||
|
||||
Write-Output "idunn.health.state=$State"
|
||||
throw $Message
|
||||
}
|
||||
|
||||
ssh.exe -o BatchMode=yes -o ConnectTimeout=5 $SshTarget "systemctl is-active --quiet gjallar.service"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Fail-IdunnHealth -State "failed" -Message "gjallar.service is not active on Nightwing."
|
||||
}
|
||||
|
||||
$localCommit = (git -C $GjallarRoot rev-parse HEAD).Trim()
|
||||
if ([string]::IsNullOrWhiteSpace($localCommit)) {
|
||||
throw "Could not determine local Gjallar git revision."
|
||||
}
|
||||
|
||||
$manifest = ssh.exe -o BatchMode=yes -o ConnectTimeout=5 $SshTarget "cat '$RemoteManifest' 2>/dev/null"
|
||||
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($manifest)) {
|
||||
Fail-IdunnHealth -State "stale-deployment" -Message "Nightwing Gjallar deploy manifest is missing."
|
||||
}
|
||||
|
||||
$remoteCommit = ""
|
||||
foreach ($line in $manifest) {
|
||||
if ($line -like "gitCommit=*") {
|
||||
$remoteCommit = $line.Substring("gitCommit=".Length).Trim()
|
||||
}
|
||||
}
|
||||
|
||||
if ($remoteCommit -ne $localCommit) {
|
||||
Fail-IdunnHealth -State "stale-deployment" -Message "Nightwing Gjallar deploy is stale. remote=$remoteCommit local=$localCommit"
|
||||
}
|
||||
|
||||
$statusJson = ssh.exe -o BatchMode=yes -o ConnectTimeout=5 $SshTarget "cat '$RemoteStatus' 2>/dev/null"
|
||||
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($statusJson)) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Gjallar status witness is missing at $RemoteStatus."
|
||||
}
|
||||
|
||||
$status = $statusJson | ConvertFrom-Json
|
||||
if ($status.schema -ne "gamecult.gjallar.frame.v1") {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Gjallar status witness has unexpected schema '$($status.schema)'."
|
||||
}
|
||||
|
||||
$updatedAt = [DateTimeOffset]::Parse($status.updatedAtUtc)
|
||||
$ageSeconds = ([DateTimeOffset]::UtcNow - $updatedAt.ToUniversalTime()).TotalSeconds
|
||||
if ($ageSeconds -gt $MaxStatusAgeSeconds) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Gjallar status witness is stale ($([math]::Round($ageSeconds))s old)."
|
||||
}
|
||||
|
||||
if ($status.status -ne "rendered") {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Gjallar framebuffer status is '$($status.status)', expected rendered."
|
||||
}
|
||||
|
||||
if ($null -eq $status.cultCacheWitness -or $status.cultCacheWitness.status -ne "published") {
|
||||
$detail = if ($null -eq $status.cultCacheWitness) { "missing cultCacheWitness status" } else { $status.cultCacheWitness.error }
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Gjallar has not published the daemon-owned CultCache witness. $detail"
|
||||
}
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace([string]$status.receive.lastAttemptStatus)) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Gjallar status witness is missing receive.lastAttemptStatus."
|
||||
}
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace([string]$status.receive.lastSuccessfulAtUtc)) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Gjallar status witness is missing receive.lastSuccessfulAtUtc."
|
||||
}
|
||||
|
||||
if ([int]$status.receive.staleAfterSeconds -le 0) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Gjallar status witness has invalid receive.staleAfterSeconds=$($status.receive.staleAfterSeconds)."
|
||||
}
|
||||
|
||||
if ($null -eq $status.receive.consecutiveFailures) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Gjallar status witness is missing receive.consecutiveFailures."
|
||||
}
|
||||
|
||||
if ($status.receive.status -ne "catalog-composed") {
|
||||
$detail = $status.receive.error
|
||||
if ([string]::IsNullOrWhiteSpace($detail)) {
|
||||
$detail = $status.receive.providerFetchError
|
||||
}
|
||||
Fail-IdunnHealth -State "dependency-unavailable" -Message "Nightwing Gjallar receive status is '$($status.receive.status)', expected catalog-composed. $detail"
|
||||
}
|
||||
|
||||
if ([int]$status.receive.catalogProviders -lt $MinCatalogProviders) {
|
||||
Fail-IdunnHealth -State "dependency-unavailable" -Message "Nightwing Gjallar catalog is empty: catalogProviders=$($status.receive.catalogProviders), expected at least $MinCatalogProviders."
|
||||
}
|
||||
|
||||
if ([int]$status.receive.composedProviders -lt $MinComposedProviders) {
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Gjallar composed no provider panels: composedProviders=$($status.receive.composedProviders), expected at least $MinComposedProviders."
|
||||
}
|
||||
|
||||
if ($null -eq $status.idunnRudpHealth -or $status.idunnRudpHealth.status -ne "published") {
|
||||
$detail = if ($null -eq $status.idunnRudpHealth) { "missing idunnRudpHealth status" } else { $status.idunnRudpHealth.error }
|
||||
Fail-IdunnHealth -State "degraded" -Message "Nightwing Gjallar has not published daemon-owned Idunn RUDP health. $detail"
|
||||
}
|
||||
|
||||
$cultCacheStat = ssh.exe -o BatchMode=yes -o ConnectTimeout=5 $SshTarget "stat -c '%s %Y' '$RemoteCultCache' 2>/dev/null"
|
||||
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($cultCacheStat)) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Gjallar CultCache witness is missing at $RemoteCultCache."
|
||||
}
|
||||
|
||||
$cultCacheParts = $cultCacheStat.Trim() -split '\s+'
|
||||
if ($cultCacheParts.Length -lt 2) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Gjallar CultCache witness stat output was malformed: $cultCacheStat"
|
||||
}
|
||||
|
||||
$cultCacheSize = [int64]$cultCacheParts[0]
|
||||
$cultCacheModifiedUtc = [DateTimeOffset]::FromUnixTimeSeconds([int64]$cultCacheParts[1])
|
||||
$cultCacheAgeSeconds = ([DateTimeOffset]::UtcNow - $cultCacheModifiedUtc).TotalSeconds
|
||||
if ($cultCacheSize -le 0) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Gjallar CultCache witness at $RemoteCultCache is empty."
|
||||
}
|
||||
|
||||
if ($cultCacheAgeSeconds -gt $MaxStatusAgeSeconds) {
|
||||
Fail-IdunnHealth -State "failed" -Message "Nightwing Gjallar CultCache witness is stale ($([math]::Round($cultCacheAgeSeconds))s old)."
|
||||
}
|
||||
|
||||
Write-Host "Nightwing Gjallar is active, deployed at $localCommit, and composing $($status.receive.composedProviders)/$($status.receive.catalogProviders) providers."
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
param(
|
||||
[string] $StateDir = "E:\Projects\Odin\scratch\odin",
|
||||
[string] $StateDir = (Join-Path (Split-Path -Parent $PSScriptRoot) "scratch\odin"),
|
||||
[int] $MaxSilenceSeconds = 120,
|
||||
[string] $CultNetRudpBind = "0.0.0.0:17871"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
param(
|
||||
[string] $VoidBotRoot = "E:\Projects\VoidBot",
|
||||
[string] $VoidBotRoot = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "VoidBot"),
|
||||
[int] $MaxOrchestratorAgeSeconds = 180,
|
||||
[int] $MaxCultMeshStoreAgeSeconds = 180
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,306 +0,0 @@
|
|||
$repoRoot = Split-Path -Parent $PSScriptRoot
|
||||
|
||||
$IdunnDeploymentSharedActuators = @(
|
||||
"$repoRoot\scripts\deploy-yggdrasil-source-app.ps1"
|
||||
)
|
||||
|
||||
$IdunnDeploymentTargets = @(
|
||||
[pscustomobject]@{
|
||||
Id = "odin"
|
||||
Repo = "Odin"
|
||||
LocalPath = "E:\Projects\Odin"
|
||||
Host = "starfire"
|
||||
Service = "odin-coordinator"
|
||||
Status = "runtime-enforced"
|
||||
Health = "daemon-published-rudp:odin.cultnet-rudp-provider-health"
|
||||
Deploy = $null
|
||||
Restart = "$repoRoot\scripts\restart-odin.ps1"
|
||||
Aliases = @("$repoRoot\scripts\restart-odin.cmd")
|
||||
Reason = "Central Idunn keeps Odin's all-seer/rendezvous daemon alive; Odin owns Verse discovery while Idunn owns lifecycle actuation."
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Id = "idunn"
|
||||
Repo = "Odin"
|
||||
LocalPath = "E:\Projects\Odin"
|
||||
Host = "starfire"
|
||||
Service = "idunn swarm supervisor"
|
||||
Status = "runtime-enforced"
|
||||
Health = $null
|
||||
Deploy = $null
|
||||
Restart = $null
|
||||
Aliases = @()
|
||||
Reason = "start-idunn-local.ps1 is the bootstrap for Idunn itself; it is not a deploy/restart actuator over another daemon."
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Id = "hermodr"
|
||||
Repo = "Odin"
|
||||
LocalPath = "E:\Projects\Odin"
|
||||
Host = "starfire"
|
||||
Service = "Hermodr browser lowering"
|
||||
Status = "runtime-enforced"
|
||||
Health = "daemon-published-rudp:hermodr.cultnet-rudp-browser-lowering-health"
|
||||
Deploy = $null
|
||||
Restart = "$repoRoot\scripts\restart-hermodr.ps1"
|
||||
Aliases = @()
|
||||
Reason = "Idunn keeps Hermodr's browser lowering alive; Hermodr publishes its own RUDP health while Odin remains the CultMesh discovery authority."
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Id = "stonks"
|
||||
Repo = "Stonks"
|
||||
LocalPath = "E:\Projects\Stonks"
|
||||
Host = "starfire"
|
||||
Service = "stonks daemon"
|
||||
Status = "runtime-enforced"
|
||||
Health = "daemon-published-rudp:stonks.cultnet-rudp-market-health"
|
||||
Deploy = $null
|
||||
Restart = "$repoRoot\scripts\restart-stonks.cmd"
|
||||
Aliases = @()
|
||||
Reason = "Stonks publishes market/provider state and daemon health through CultMesh/CultNet; local restart is an Idunn actuator only."
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Id = "weksa"
|
||||
Repo = "weksa"
|
||||
LocalPath = "E:\Projects\weksa"
|
||||
Host = "starfire"
|
||||
Service = "weksa daemon"
|
||||
Status = "runtime-enforced"
|
||||
Health = "daemon-published-rudp:weksa.cultnet-rudp-provider-health"
|
||||
Deploy = $null
|
||||
Restart = "$repoRoot\scripts\restart-weksa.cmd"
|
||||
Aliases = @()
|
||||
Reason = "Weksa provider state and health are daemon-owned CultMesh/CultNet records; local restart is an Idunn actuator only."
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Id = "starfire-muninn"
|
||||
Repo = "Odin"
|
||||
LocalPath = "E:\Projects\Odin"
|
||||
Host = "starfire"
|
||||
Service = "muninn serve --host starfire"
|
||||
Status = "runtime-enforced"
|
||||
Health = "daemon-published-rudp:muninn.cultnet-rudp-local-telemetry-and-quest-access"
|
||||
Deploy = $null
|
||||
Restart = "$repoRoot\scripts\restart-starfire-muninn.ps1"
|
||||
Aliases = @("$repoRoot\scripts\restart-starfire-muninn.cmd")
|
||||
Reason = "Central Idunn keeps Starfire-local Muninn alive for Quest access and local telemetry surfaces."
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Id = "raven-muninn"
|
||||
Repo = "Odin"
|
||||
LocalPath = "E:\Projects\Odin"
|
||||
Host = "raven"
|
||||
Service = "muninn serve --host raven"
|
||||
Status = "runtime-enforced"
|
||||
Health = "daemon-published-rudp:muninn.cultnet-rudp-remote-telemetry-health"
|
||||
Deploy = $null
|
||||
Restart = "$repoRoot\scripts\restart-muninn.ps1"
|
||||
Aliases = @("$repoRoot\scripts\restart-muninn.cmd")
|
||||
Reason = "Central Idunn keeps Raven Muninn's remote telemetry posture alive without activating A/V capture as part of keepalive."
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Id = "nightwing-muninn"
|
||||
Repo = "Odin"
|
||||
LocalPath = "E:\Projects\Odin"
|
||||
Host = "nightwing"
|
||||
Service = "muninn serve --host nightwing"
|
||||
Status = "runtime-enforced"
|
||||
Health = "daemon-published-rudp:muninn.cultnet-rudp-remote-telemetry-and-move-hid"
|
||||
Deploy = $null
|
||||
Restart = "$repoRoot\scripts\restart-nightwing-muninn.ps1"
|
||||
Aliases = @("$repoRoot\scripts\restart-nightwing-muninn.cmd")
|
||||
Reason = "Central Idunn reaches Nightwing over SSH and keeps the host-local Muninn Move HID daemon alive."
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Id = "vili"
|
||||
Repo = "Vili"
|
||||
LocalPath = "E:\Projects\Vili"
|
||||
Host = "raven"
|
||||
Service = "GameCult\\Vili"
|
||||
Status = "runtime-enforced"
|
||||
Health = "daemon-published-rudp:vili.cultnet-rudp-animation-health"
|
||||
Deploy = $null
|
||||
Restart = "$repoRoot\scripts\restart-vili.cmd"
|
||||
Aliases = @("$repoRoot\scripts\restart-vili.ps1")
|
||||
Reason = "Central Idunn keeps Raven Vili's typed motion daemon alive; command requests and health are CultMesh/CultNet-owned."
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Id = "raven-sleipnir"
|
||||
Repo = "Odin"
|
||||
LocalPath = "E:\Projects\Odin"
|
||||
Host = "raven"
|
||||
Service = "sleipnir --host raven"
|
||||
Status = "runtime-enforced"
|
||||
Health = "daemon-published-rudp:sleipnir.cultnet-rudp-input-mirror-health"
|
||||
Deploy = "$repoRoot\scripts\deploy-raven-sleipnir.ps1"
|
||||
Restart = "$repoRoot\scripts\restart-raven-sleipnir.ps1"
|
||||
Aliases = @()
|
||||
Reason = "Central Idunn reaches Raven over SSH and keeps Sleipnir's hidden scheduled task alive while Sleipnir publishes daemon-owned RUDP health."
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Id = "nightwing-gjallar"
|
||||
Repo = "Gjallar"
|
||||
LocalPath = "E:\Projects\Gjallar"
|
||||
Host = "nightwing"
|
||||
Service = "gjallar.service"
|
||||
Status = "enforced"
|
||||
Health = "daemon-published-rudp:gjallar.cultnet-rudp-framebuffer-composition-health"
|
||||
Deploy = "$repoRoot\scripts\deploy-nightwing-gjallar.ps1"
|
||||
Restart = "$repoRoot\scripts\restart-nightwing-gjallar.ps1"
|
||||
Aliases = @("$repoRoot\scripts\deploy-nightwing-gjallar.cmd", "$repoRoot\scripts\restart-nightwing-gjallar.cmd")
|
||||
UpstreamRemote = "origin"
|
||||
UpstreamBranch = "main"
|
||||
RolloutStrategy = "restart-after-verified-build"
|
||||
StateMigration = "daemon-owned-noop"
|
||||
ZeroDowntime = "restart-required"
|
||||
Reason = "Nightwing framebuffer compositor has a committed artifact manifest and automatic Idunn deploy lane."
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Id = "yggdrasil-voidbot"
|
||||
Repo = "VoidBot"
|
||||
LocalPath = "/srv/build/VoidBot"
|
||||
Host = "yggdrasil"
|
||||
Service = "voidbot.service"
|
||||
Status = "enforced"
|
||||
Health = "daemon-published-rudp:voidbot.cultnet-rudp-stack-health"
|
||||
Deploy = "sudo -n /usr/local/libexec/idunn-yggdrasil deploy voidbot"
|
||||
Restart = "sudo -n /usr/local/libexec/idunn-yggdrasil restart voidbot"
|
||||
Aliases = @()
|
||||
UpstreamRemote = "origin"
|
||||
UpstreamBranch = "main"
|
||||
RolloutStrategy = "restart-after-verified-build"
|
||||
StateMigration = "daemon-owned-noop"
|
||||
ZeroDowntime = "restart-required"
|
||||
Reason = "Yggdrasil-local Idunn deploys upstream VoidBot releases through the narrow root-owned manifest; local checkouts have no deployment authority."
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Id = "yggdrasil-bifrost"
|
||||
Repo = "Bifrost"
|
||||
LocalPath = "E:\Projects\Bifrost"
|
||||
Host = "yggdrasil"
|
||||
Service = "bifrost.service"
|
||||
Status = "blocked"
|
||||
Health = $null
|
||||
Deploy = $null
|
||||
Restart = $null
|
||||
Aliases = @()
|
||||
Reason = "Committed Bifrost HEAD currently expects UserAccounts.HeimdallAccountId, but Yggdrasil's production database lacks that column and EF reports no pending migration. Idunn must not enforce Bifrost freshness until the Bifrost schema migration path is fixed."
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Id = "yggdrasil-streampixels"
|
||||
Repo = "StreamPixels"
|
||||
LocalPath = "E:\Projects\StreamPixels"
|
||||
Host = "yggdrasil"
|
||||
Service = "streampixels-service/streampixels-web"
|
||||
Status = "enforced"
|
||||
Health = "daemon-published-rudp:streampixels.cultnet-rudp-service-health"
|
||||
Deploy = "$repoRoot\scripts\deploy-yggdrasil-streampixels.cmd"
|
||||
Restart = $null
|
||||
Aliases = @("$repoRoot\scripts\deploy-yggdrasil-streampixels.ps1")
|
||||
UpstreamRemote = "origin"
|
||||
UpstreamBranch = "main"
|
||||
RolloutStrategy = "restart-after-verified-build"
|
||||
StateMigration = "daemon-owned-noop"
|
||||
ZeroDowntime = "restart-required"
|
||||
Reason = "Idunn packages upstream origin/main for StreamPixels, runs the existing ops deploy/check scripts, and verifies the remote manifest."
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Id = "yggdrasil-heimdall"
|
||||
Repo = "Heimdall"
|
||||
LocalPath = "E:\Projects\Heimdall"
|
||||
Host = "yggdrasil"
|
||||
Service = "heimdall.service"
|
||||
Status = "enforced"
|
||||
Health = "daemon-published-rudp:heimdall.cultnet-rudp-provider-health"
|
||||
Deploy = "$repoRoot\scripts\deploy-yggdrasil-heimdall.cmd"
|
||||
Restart = $null
|
||||
Aliases = @("$repoRoot\scripts\deploy-yggdrasil-heimdall.ps1")
|
||||
UpstreamRemote = "origin"
|
||||
UpstreamBranch = "main"
|
||||
RolloutStrategy = "restart-after-verified-build"
|
||||
StateMigration = "daemon-owned-noop"
|
||||
ZeroDowntime = "restart-required"
|
||||
Reason = "Idunn packages upstream origin/main for Heimdall, runs the existing ops deploy/check scripts, and verifies the remote manifest."
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Id = "yggdrasil-repixelizer"
|
||||
Repo = "repixelizer"
|
||||
LocalPath = "E:\Projects\repixelizer"
|
||||
Host = "yggdrasil"
|
||||
Service = "repixelizer-gui.service"
|
||||
Status = "enforced"
|
||||
Health = "daemon-published-rudp:repixelizer.cultnet-rudp-service-health"
|
||||
Deploy = "$repoRoot\scripts\deploy-yggdrasil-repixelizer.cmd"
|
||||
Restart = $null
|
||||
Aliases = @("$repoRoot\scripts\deploy-yggdrasil-repixelizer.ps1")
|
||||
UpstreamRemote = "origin"
|
||||
UpstreamBranch = "main"
|
||||
RolloutStrategy = "restart-after-verified-build"
|
||||
StateMigration = "daemon-owned-noop"
|
||||
ZeroDowntime = "restart-required"
|
||||
Reason = "Idunn packages upstream origin/main for repixelizer, runs the existing ops deploy/check scripts, and verifies the remote manifest."
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Id = "github-pages-gamecult-site"
|
||||
Repo = "gamecult-site"
|
||||
LocalPath = "E:\Projects\gamecult-site"
|
||||
Host = "github-pages"
|
||||
Service = "gamecult.org/www"
|
||||
Status = "external-owned"
|
||||
Health = $null
|
||||
Deploy = $null
|
||||
Restart = $null
|
||||
Aliases = @()
|
||||
Reason = "GitHub Actions/Pages owns deployment freshness; Idunn should ingest workflow/deployment status before claiming automatic deploy authority."
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Id = "eve-ipad-evecanvas"
|
||||
Repo = "Eve"
|
||||
LocalPath = "E:\Projects\Eve"
|
||||
Host = "eve-ipad"
|
||||
Service = "org.gamecult.evecanvas"
|
||||
Status = "blocked"
|
||||
Health = $null
|
||||
Deploy = $null
|
||||
Restart = $null
|
||||
Aliases = @()
|
||||
Reason = "Jailbroken iPad native app deployment exists only as an operator runbook; no safe noninteractive Idunn deploy command yet."
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Id = "periwinkle-eve-android"
|
||||
Repo = "Eve"
|
||||
LocalPath = "E:\Projects\Eve"
|
||||
Host = "periwinkle"
|
||||
Service = "Eve Android proof APK"
|
||||
Status = "blocked"
|
||||
Health = $null
|
||||
Deploy = $null
|
||||
Restart = $null
|
||||
Aliases = @()
|
||||
Reason = "Android USB install requires on-device approval; Idunn must not claim automatic deploy authority until that boundary is solved."
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Id = "nightwing-eve-dashboard"
|
||||
Repo = "Mimir"
|
||||
LocalPath = "E:\Projects\Mimir"
|
||||
Host = "nightwing"
|
||||
Service = "nightwing-eve-dashboard.service"
|
||||
Status = "archived"
|
||||
Health = $null
|
||||
Deploy = $null
|
||||
Restart = $null
|
||||
Aliases = @("$repoRoot\scripts\restart-nightwing-eve-dashboard.cmd")
|
||||
Reason = "Nightwing Eve dashboard's old HTTP/WebSocket broker is archived. Rebuild it only as typed CultMesh/Odin state publication plus renderer lowering before restoring Idunn lifecycle authority."
|
||||
},
|
||||
[pscustomobject]@{
|
||||
Id = "nightwing-eve-browser-reference"
|
||||
Repo = "Eve"
|
||||
LocalPath = "E:\Projects\Eve"
|
||||
Host = "nightwing"
|
||||
Service = "nightwing-eve-browser-reference.service"
|
||||
Status = "runtime-enforced"
|
||||
Health = "daemon-published-rudp:nightwing.cultnet-rudp-browser-reference-health"
|
||||
Deploy = $null
|
||||
Restart = "$repoRoot\scripts\restart-nightwing-eve-browser-reference.ps1"
|
||||
Aliases = @("$repoRoot\scripts\restart-nightwing-eve-browser-reference.cmd")
|
||||
Reason = "Nightwing Eve browser reference publishes daemon-owned boundary witnesses and RUDP health; systemd restart is an Idunn actuator only."
|
||||
}
|
||||
)
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
param(
|
||||
[string] $TaskName = "Idunn Local Keepalive",
|
||||
[int] $IntervalSeconds = 30
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$repoRoot = Split-Path -Parent $PSScriptRoot
|
||||
$scriptPath = Join-Path $repoRoot "scripts\start-idunn-local.ps1"
|
||||
$powershell = Join-Path $env:SystemRoot "System32\WindowsPowerShell\v1.0\powershell.exe"
|
||||
$taskCommand = "`"$powershell`" -NoProfile -NonInteractive -ExecutionPolicy Bypass -File `"$scriptPath`" -IntervalSeconds $IntervalSeconds"
|
||||
|
||||
& schtasks.exe /Create /TN $TaskName /SC ONLOGON /TR $taskCommand /F | Out-Null
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
$startupDir = [Environment]::GetFolderPath("Startup")
|
||||
$startupScript = Join-Path $startupDir "$TaskName.cmd"
|
||||
$cmd = "@echo off`r`ncd /d `"$repoRoot`"`r`n$taskCommand`r`n"
|
||||
[System.IO.File]::WriteAllText($startupScript, $cmd, [System.Text.UTF8Encoding]::new($false))
|
||||
Write-Host "Scheduled task install was denied; installed Startup folder launcher instead:"
|
||||
Write-Host " $startupScript"
|
||||
} else {
|
||||
Write-Host "Installed scheduled task: $TaskName"
|
||||
}
|
||||
|
||||
Write-Host "Starting Idunn watchdogs now..."
|
||||
& $scriptPath -IntervalSeconds $IntervalSeconds
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "idunn-yggdrasil must run through its narrow sudo boundary" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
action="${1:-}"
|
||||
target="${2:-}"
|
||||
source_commit="${3:-}"
|
||||
repository_full_name="${4:-}"
|
||||
upstream_ref="${5:-}"
|
||||
release_authority_id="${6:-}"
|
||||
release_authority_sha256="${7:-}"
|
||||
deployment_request_id="${8:-}"
|
||||
requires_bifrost_authority="${9:-false}"
|
||||
compose=/srv/compose/yggdrasil-apps.yaml
|
||||
|
||||
require_release_lineage() {
|
||||
case "$target" in
|
||||
epiphany|bifrost-persona-feedback) target_requires_bifrost_authority=true ;;
|
||||
voidbot|heimdall|repixelizer|streampixels) target_requires_bifrost_authority=false ;;
|
||||
*) echo "deployment target has no release-authority policy: $target" >&2; exit 1 ;;
|
||||
esac
|
||||
if [ "$requires_bifrost_authority" != "$target_requires_bifrost_authority" ]; then
|
||||
echo "caller release-authority mode does not match root policy for $target" >&2
|
||||
exit 1
|
||||
fi
|
||||
requires_bifrost_authority="$target_requires_bifrost_authority"
|
||||
case "$source_commit" in
|
||||
*[!0-9a-f]*|'') echo "invalid or missing IDUNN_SOURCE_COMMIT" >&2; exit 1 ;;
|
||||
esac
|
||||
[ "${#source_commit}" -eq 40 ] || { echo "IDUNN_SOURCE_COMMIT must be 40 hex characters" >&2; exit 1; }
|
||||
[ -n "$repository_full_name" ] || { echo "missing repository identity" >&2; exit 1; }
|
||||
[ -n "$upstream_ref" ] || { echo "missing upstream ref" >&2; exit 1; }
|
||||
[ -n "$deployment_request_id" ] || { echo "missing Idunn deployment request id" >&2; exit 1; }
|
||||
case "$requires_bifrost_authority" in
|
||||
true)
|
||||
[ -n "$release_authority_id" ] || { echo "missing Bifrost release authority id" >&2; exit 1; }
|
||||
case "$release_authority_sha256" in
|
||||
*[!0-9a-f]*|'') echo "invalid or missing Bifrost release authority digest" >&2; exit 1 ;;
|
||||
esac
|
||||
[ "${#release_authority_sha256}" -eq 64 ] || { echo "Bifrost release authority digest must be 64 hex characters" >&2; exit 1; }
|
||||
/usr/local/bin/idunn validate-release-authority \
|
||||
--store /var/lib/gamecult/idunn/yggdrasil.keepalive.cc \
|
||||
--release-authority-store /srv/bifrost/state/repository-release-authority.cc \
|
||||
--repository-full-name "$repository_full_name" \
|
||||
--upstream-ref "$upstream_ref" \
|
||||
--source-revision "$source_commit" \
|
||||
--release-authority-id "$release_authority_id" \
|
||||
--release-authority-sha256 "$release_authority_sha256"
|
||||
;;
|
||||
false)
|
||||
[ -z "$release_authority_id" ] || { echo "legacy release cannot claim Bifrost authority id" >&2; exit 1; }
|
||||
[ -z "$release_authority_sha256" ] || { echo "legacy release cannot claim Bifrost authority digest" >&2; exit 1; }
|
||||
;;
|
||||
*) echo "invalid Bifrost authority requirement mode" >&2; exit 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
case "$action:$target" in
|
||||
restart:heimdall)
|
||||
exec docker compose -f "$compose" restart heimdall
|
||||
;;
|
||||
restart:repixelizer)
|
||||
exec docker compose -f "$compose" restart repixelizer
|
||||
;;
|
||||
restart:streampixels)
|
||||
docker compose -f "$compose" restart streampixels-service streampixels-web
|
||||
;;
|
||||
deploy:voidbot|restart:voidbot|deploy:epiphany|restart:epiphany)
|
||||
manifest="/srv/odin/deploy-manifests/$target"
|
||||
if [ ! -x "$manifest" ] || [ ! -O "$manifest" ]; then
|
||||
echo "root-owned executable deploy manifest is not installed: $manifest" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ "$action" = deploy ]; then
|
||||
require_release_lineage
|
||||
fi
|
||||
IDUNN_ACTUATOR=1 IDUNN_COMMAND_AUTHORITY=idunn-daemon \
|
||||
IDUNN_SOURCE_COMMIT="$source_commit" \
|
||||
IDUNN_REPOSITORY_FULL_NAME="$repository_full_name" \
|
||||
IDUNN_UPSTREAM_REF="$upstream_ref" \
|
||||
BIFROST_RELEASE_AUTHORITY_ID="$release_authority_id" \
|
||||
BIFROST_RELEASE_AUTHORITY_SHA256="$release_authority_sha256" \
|
||||
IDUNN_DEPLOYMENT_REQUEST_ID="$deployment_request_id" \
|
||||
IDUNN_REQUIRES_BIFROST_AUTHORITY="$requires_bifrost_authority" \
|
||||
exec "$manifest" "$action"
|
||||
;;
|
||||
deploy:heimdall|deploy:repixelizer|deploy:streampixels|deploy:bifrost-persona-feedback)
|
||||
manifest="/srv/odin/deploy-manifests/$target"
|
||||
if [ ! -x "$manifest" ] || [ ! -O "$manifest" ]; then
|
||||
echo "root-owned executable deploy manifest is not installed: $manifest" >&2
|
||||
exit 1
|
||||
fi
|
||||
require_release_lineage
|
||||
IDUNN_ACTUATOR=1 IDUNN_COMMAND_AUTHORITY=idunn-daemon \
|
||||
IDUNN_SOURCE_COMMIT="$source_commit" \
|
||||
IDUNN_REPOSITORY_FULL_NAME="$repository_full_name" \
|
||||
IDUNN_UPSTREAM_REF="$upstream_ref" \
|
||||
BIFROST_RELEASE_AUTHORITY_ID="$release_authority_id" \
|
||||
BIFROST_RELEASE_AUTHORITY_SHA256="$release_authority_sha256" \
|
||||
IDUNN_DEPLOYMENT_REQUEST_ID="$deployment_request_id" \
|
||||
IDUNN_REQUIRES_BIFROST_AUTHORITY="$requires_bifrost_authority" \
|
||||
exec "$manifest"
|
||||
;;
|
||||
*)
|
||||
echo "unsupported Idunn Yggdrasil actuator request: $action $target" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
[Unit]
|
||||
Description=Idunn Yggdrasil-local lifecycle coordinator
|
||||
After=network-online.target docker.service
|
||||
Wants=network-online.target
|
||||
Requires=docker.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=idunn
|
||||
Group=idunn
|
||||
ExecStart=/usr/local/bin/idunn --swarm-profile yggdrasil-local --repo-root /srv/odin/source --store /var/lib/gamecult/idunn/yggdrasil.keepalive.cc --release-authority-store /srv/bifrost/state/repository-release-authority.cc --rudp-health-bind 10.77.0.1:17870 --command-timeout-seconds 3600 --execute
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
TimeoutStopSec=20
|
||||
KillSignal=SIGINT
|
||||
UMask=027
|
||||
PrivateTmp=yes
|
||||
ProtectHome=yes
|
||||
ProtectSystem=full
|
||||
ReadWritePaths=/var/lib/gamecult/idunn /srv/build /srv/voidbot
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -1 +0,0 @@
|
|||
idunn ALL=(root) NOPASSWD: /usr/local/libexec/idunn-yggdrasil *
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
@echo off
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File E:\Projects\Odin\scripts\notify-idunn-operator-alarm.ps1
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$bifrostRoot = "E:\Projects\Bifrost"
|
||||
$publisherScript = Join-Path $bifrostRoot "tools\operator-notification.mjs"
|
||||
|
||||
if (-not (Test-Path -LiteralPath $publisherScript)) {
|
||||
throw "Bifrost operator-notification publisher is missing at $publisherScript."
|
||||
}
|
||||
|
||||
Push-Location -LiteralPath $bifrostRoot
|
||||
try {
|
||||
$arguments = @($publisherScript, "publish-idunn-alarm")
|
||||
if ($env:IDUNN_OPERATOR_ALARM_DRY_RUN -in @("1", "true", "yes", "on")) {
|
||||
$arguments += "--dry-run"
|
||||
}
|
||||
& node @arguments
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Bifrost operator-notification publisher exited with code $LASTEXITCODE."
|
||||
}
|
||||
} finally {
|
||||
Pop-Location
|
||||
}
|
||||
|
|
@ -7,4 +7,4 @@ if /I not "%IDUNN_COMMAND_AUTHORITY%"=="idunn-daemon" (
|
|||
echo restart-muninn.cmd is an Idunn actuator wrapper. Redeploy by poking Idunn; direct service restart is not an owned path. 1>&2
|
||||
exit /b 1
|
||||
)
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File E:\Projects\Odin\scripts\restart-muninn.ps1
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File %~dp0restart-muninn.ps1
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@ if /I not "%IDUNN_COMMAND_AUTHORITY%"=="idunn-daemon" (
|
|||
echo restart-nightwing-eve-browser-reference.cmd is an Idunn actuator wrapper. Redeploy by poking Idunn; direct service restart is not an owned path. 1>&2
|
||||
exit /b 1
|
||||
)
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File E:\Projects\Odin\scripts\restart-nightwing-eve-browser-reference.ps1
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File %~dp0restart-nightwing-eve-browser-reference.ps1
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
@echo off
|
||||
if not "%IDUNN_ACTUATOR%"=="1" (
|
||||
echo restart-nightwing-gjallar.cmd is an Idunn actuator wrapper. Redeploy by poking Idunn; direct service restart is not an owned path. 1>&2
|
||||
exit /b 1
|
||||
)
|
||||
if /I not "%IDUNN_COMMAND_AUTHORITY%"=="idunn-daemon" (
|
||||
echo restart-nightwing-gjallar.cmd is an Idunn actuator wrapper. Redeploy by poking Idunn; direct service restart is not an owned path. 1>&2
|
||||
exit /b 1
|
||||
)
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File E:\Projects\Odin\scripts\restart-nightwing-gjallar.ps1
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
param(
|
||||
[string] $SshTarget = "nwroot",
|
||||
[string] $Service = "gjallar.service"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
if ($env:IDUNN_ACTUATOR -ne "1" -or $env:IDUNN_COMMAND_AUTHORITY -ne "idunn-daemon") {
|
||||
throw "restart-nightwing-gjallar.ps1 is an Idunn actuator body. Redeploy by poking Idunn; direct service restart is not an owned path."
|
||||
}
|
||||
|
||||
ssh.exe -o BatchMode=yes -o ConnectTimeout=5 $SshTarget "systemctl restart $Service && systemctl is-active --quiet $Service"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Remote restart failed for $Service on $SshTarget with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
Write-Host "Restarted $Service on $SshTarget."
|
||||
|
|
@ -7,4 +7,4 @@ if /I not "%IDUNN_COMMAND_AUTHORITY%"=="idunn-daemon" (
|
|||
echo restart-nightwing-muninn.cmd is an Idunn actuator wrapper. Redeploy by poking Idunn; direct service restart is not an owned path. 1>&2
|
||||
exit /b 1
|
||||
)
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File E:\Projects\Odin\scripts\restart-nightwing-muninn.ps1 -DiscoverMoveState -ClaimUsbMoves
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File %~dp0restart-nightwing-muninn.ps1 -DiscoverMoveState -ClaimUsbMoves
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@ if /I not "%IDUNN_COMMAND_AUTHORITY%"=="idunn-daemon" (
|
|||
echo restart-odin.cmd is an Idunn actuator wrapper. Redeploy by poking Idunn; direct service restart is not an owned path. 1>&2
|
||||
exit /b 1
|
||||
)
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -ExecutionPolicy Bypass -File E:\Projects\Odin\scripts\restart-odin.ps1
|
||||
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -ExecutionPolicy Bypass -File %~dp0restart-odin.ps1
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
param(
|
||||
[string] $StateDir = "E:\Projects\Odin\scratch\odin",
|
||||
[string] $StateDir = (Join-Path (Split-Path -Parent $PSScriptRoot) "scratch\odin"),
|
||||
[string] $CultNetRudpBind = "0.0.0.0:17871",
|
||||
[string] $IdunnRudpHealth = $(if ($env:ODIN_IDUNN_RUDP_HEALTH) { $env:ODIN_IDUNN_RUDP_HEALTH } else { $env:IDUNN_RUDP_HEALTH }),
|
||||
[string] $IdunnDaemon = "odin",
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
@echo off
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File E:\Projects\Odin\scripts\restart-muninn.ps1
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File %~dp0restart-muninn.ps1
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@ if /I not "%IDUNN_COMMAND_AUTHORITY%"=="idunn-daemon" (
|
|||
echo restart-starfire-muninn.cmd is an Idunn actuator wrapper. Redeploy by poking Idunn; direct service restart is not an owned path. 1>&2
|
||||
exit /b 1
|
||||
)
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File E:\Projects\Odin\scripts\restart-starfire-muninn.ps1
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File %~dp0restart-starfire-muninn.ps1
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@ if /I not "%IDUNN_COMMAND_AUTHORITY%"=="idunn-daemon" (
|
|||
echo restart-stonks.cmd is an Idunn actuator body. Redeploy by poking Idunn; direct service restart is not an owned path. 1>&2
|
||||
exit /b 1
|
||||
)
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File E:\Projects\Odin\scripts\restart-stonks.ps1
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File %~dp0restart-stonks.ps1
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$stonksRoot = "E:\Projects\Stonks"
|
||||
$stonksRoot = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "Stonks")
|
||||
$stateDir = Join-Path $stonksRoot "scratch\stonks"
|
||||
$pidPath = Join-Path $stateDir "stonks.pid"
|
||||
$startScript = Join-Path $stonksRoot "scripts\start-stonks.ps1"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
param(
|
||||
[string] $RavenHost = "raven",
|
||||
[string] $LocalViliRoot = "E:\Projects\Vili",
|
||||
[string] $LocalCultLibRoot = "E:\Projects\CultLib",
|
||||
[string] $LocalViliRoot = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "Vili"),
|
||||
[string] $LocalCultLibRoot = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "CultLib"),
|
||||
[string] $RemoteViliRoot = "E:\Projects\Vili",
|
||||
[int] $Port = 8824,
|
||||
[string] $HostName = "0.0.0.0",
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@ if /I not "%IDUNN_COMMAND_AUTHORITY%"=="idunn-daemon" (
|
|||
echo restart-weksa.cmd is an Idunn actuator body. Redeploy by poking Idunn; direct service restart is not an owned path. 1>&2
|
||||
exit /b 1
|
||||
)
|
||||
call E:\Projects\weksa\scripts\restart-weksa-daemon.cmd
|
||||
call %~dp0..\..\weksa\scripts\restart-weksa-daemon.cmd
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
$ErrorActionPreference = "Stop"
|
||||
|
||||
. (Join-Path $PSScriptRoot "idunn-deployment-targets.ps1")
|
||||
|
||||
$IdunnDeploymentTargets |
|
||||
Sort-Object Status, Id |
|
||||
Select-Object Id, Repo, Host, Service, Status, Reason |
|
||||
Format-Table -AutoSize -Wrap
|
||||
|
|
@ -1,179 +0,0 @@
|
|||
param(
|
||||
[int] $StaleAfterSeconds = 120,
|
||||
[string] $StateDir = "E:\Projects\Odin\scratch\idunn"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$repoRoot = Split-Path -Parent $PSScriptRoot
|
||||
$idunnExe = Join-Path $repoRoot "target\debug\idunn.exe"
|
||||
$operatorAlarmCommand = Join-Path $repoRoot "scripts\notify-idunn-operator-alarm.cmd"
|
||||
$pidPath = Join-Path $StateDir "idunn.pid"
|
||||
$storePath = Join-Path $StateDir "idunn.keepalive.cc"
|
||||
$outLog = Join-Path $StateDir "idunn.out.log"
|
||||
$errLog = Join-Path $StateDir "idunn.err.log"
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $StateDir | Out-Null
|
||||
|
||||
function Get-IdunnStartupDetail {
|
||||
$detail = ""
|
||||
if (Test-Path -LiteralPath $outLog) { $detail += Get-Content -Raw -LiteralPath $outLog }
|
||||
if (Test-Path -LiteralPath $errLog) { $detail += Get-Content -Raw -LiteralPath $errLog }
|
||||
return $detail
|
||||
}
|
||||
|
||||
function Move-CorruptIdunnStoreAside {
|
||||
param(
|
||||
[string] $StorePath
|
||||
)
|
||||
|
||||
if (-not (Test-Path -LiteralPath $StorePath)) {
|
||||
return $null
|
||||
}
|
||||
|
||||
$timestamp = Get-Date -Format "yyyyMMdd-HHmmss"
|
||||
$corruptPath = Join-Path $StateDir "idunn.keepalive.corrupt-$timestamp.cc"
|
||||
Move-Item -LiteralPath $StorePath -Destination $corruptPath -Force
|
||||
Remove-Item -LiteralPath "$StorePath.lock" -Force -ErrorAction SilentlyContinue
|
||||
Write-Host "Archived corrupt Idunn store to $corruptPath"
|
||||
return $corruptPath
|
||||
}
|
||||
|
||||
function Start-IdunnProcess {
|
||||
param(
|
||||
[string] $IdunnExe,
|
||||
[object[]] $Arguments,
|
||||
[string] $RepoRoot,
|
||||
[string] $OutLog,
|
||||
[string] $ErrLog,
|
||||
[string] $PidPath
|
||||
)
|
||||
|
||||
$process = Start-Process -FilePath $IdunnExe `
|
||||
-ArgumentList $Arguments `
|
||||
-WorkingDirectory $RepoRoot `
|
||||
-WindowStyle Hidden `
|
||||
-PassThru `
|
||||
-RedirectStandardOutput $OutLog `
|
||||
-RedirectStandardError $ErrLog
|
||||
$process.Id | Set-Content -Encoding ASCII -LiteralPath $PidPath
|
||||
Start-Sleep -Seconds 2
|
||||
return $process
|
||||
}
|
||||
|
||||
if (-not (Test-Path -LiteralPath $idunnExe)) {
|
||||
Push-Location -LiteralPath $repoRoot
|
||||
try {
|
||||
& cargo build -p idunn-daemon
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "cargo build -p idunn-daemon failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
} finally {
|
||||
Pop-Location
|
||||
}
|
||||
}
|
||||
|
||||
function Test-IdunnSupervisorHealthy {
|
||||
param(
|
||||
[string] $PidPath,
|
||||
[string] $StorePath,
|
||||
[int] $StaleAfterSeconds
|
||||
)
|
||||
|
||||
if (-not (Test-Path -LiteralPath $PidPath)) {
|
||||
return $false
|
||||
}
|
||||
|
||||
$pidText = (Get-Content -LiteralPath $PidPath -Raw).Trim()
|
||||
if ($pidText -notmatch "^\d+$") {
|
||||
Remove-Item -LiteralPath $PidPath -Force -ErrorAction SilentlyContinue
|
||||
return $false
|
||||
}
|
||||
|
||||
$process = Get-Process -Id ([int] $pidText) -ErrorAction SilentlyContinue
|
||||
if ($null -eq $process) {
|
||||
Remove-Item -LiteralPath $PidPath -Force -ErrorAction SilentlyContinue
|
||||
return $false
|
||||
}
|
||||
|
||||
if (Test-Path -LiteralPath $StorePath) {
|
||||
$storeAgeSeconds = ([DateTime]::UtcNow - (Get-Item -LiteralPath $StorePath).LastWriteTimeUtc).TotalSeconds
|
||||
if ($storeAgeSeconds -le $StaleAfterSeconds) {
|
||||
return $true
|
||||
}
|
||||
|
||||
Write-Host "Idunn swarm store is stale ($([math]::Round($storeAgeSeconds))s old). Restarting supervisor."
|
||||
} else {
|
||||
$processAgeSeconds = ([DateTime]::UtcNow - $process.StartTime.ToUniversalTime()).TotalSeconds
|
||||
if ($processAgeSeconds -le $StaleAfterSeconds) {
|
||||
return $true
|
||||
}
|
||||
|
||||
Write-Host "Idunn supervisor never wrote $StorePath within $StaleAfterSeconds seconds. Restarting supervisor."
|
||||
}
|
||||
|
||||
Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -LiteralPath $PidPath -Force -ErrorAction SilentlyContinue
|
||||
return $false
|
||||
}
|
||||
|
||||
if (Test-IdunnSupervisorHealthy -PidPath $pidPath -StorePath $storePath -StaleAfterSeconds $StaleAfterSeconds) {
|
||||
Write-Host "Idunn swarm supervisor already running."
|
||||
return
|
||||
}
|
||||
|
||||
$arguments = @(
|
||||
"--swarm-profile", "starfire-local",
|
||||
"--repo-root", $repoRoot,
|
||||
"--store", $storePath,
|
||||
"--rudp-health-bind", "0.0.0.0:17870",
|
||||
"--command-timeout-seconds", "600",
|
||||
"--execute"
|
||||
)
|
||||
|
||||
if (Test-Path -LiteralPath $operatorAlarmCommand) {
|
||||
$arguments += @("--operator-alarm-command", $operatorAlarmCommand)
|
||||
}
|
||||
|
||||
$process = Start-IdunnProcess `
|
||||
-IdunnExe $idunnExe `
|
||||
-Arguments $arguments `
|
||||
-RepoRoot $repoRoot `
|
||||
-OutLog $outLog `
|
||||
-ErrLog $errLog `
|
||||
-PidPath $pidPath
|
||||
|
||||
if ($process.HasExited) {
|
||||
$detail = Get-IdunnStartupDetail
|
||||
if ($detail -like "*failed to decode MessagePack*" -and (Test-Path -LiteralPath $storePath)) {
|
||||
Move-CorruptIdunnStoreAside -StorePath $storePath | Out-Null
|
||||
$process = Start-IdunnProcess `
|
||||
-IdunnExe $idunnExe `
|
||||
-Arguments $arguments `
|
||||
-RepoRoot $repoRoot `
|
||||
-OutLog $outLog `
|
||||
-ErrLog $errLog `
|
||||
-PidPath $pidPath
|
||||
}
|
||||
}
|
||||
|
||||
if ($process.HasExited) {
|
||||
$detail = Get-IdunnStartupDetail
|
||||
throw "Idunn swarm supervisor exited immediately with code $($process.ExitCode).`n$detail"
|
||||
}
|
||||
|
||||
Write-Host "Started Idunn swarm supervisor as PID $($process.Id)."
|
||||
Write-Host " store: $storePath"
|
||||
|
||||
function ConvertTo-WindowsArgument {
|
||||
param([string] $Value)
|
||||
if ($Value -notmatch '[\s"]') {
|
||||
return $Value
|
||||
}
|
||||
return '"' + ($Value -replace '(\\*)"', '$1$1\"' -replace '(\\+)$', '$1$1') + '"'
|
||||
}
|
||||
|
||||
function Join-WindowsArguments {
|
||||
param([object[]] $Arguments)
|
||||
return (($Arguments | ForEach-Object { ConvertTo-WindowsArgument -Value ([string] $_) }) -join " ")
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
param(
|
||||
[string] $StateDir = "E:\Projects\Odin\scratch\odin",
|
||||
[string] $StateDir = (Join-Path (Split-Path -Parent $PSScriptRoot) "scratch\odin"),
|
||||
[string] $CultNetRudpBind = "0.0.0.0:17871",
|
||||
[string] $IdunnRudpHealth = $(if ($env:ODIN_IDUNN_RUDP_HEALTH) { $env:ODIN_IDUNN_RUDP_HEALTH } else { $env:IDUNN_RUDP_HEALTH }),
|
||||
[string] $IdunnDaemon = "odin",
|
||||
|
|
@ -39,7 +39,7 @@ if (Test-Path $pidPath) {
|
|||
Remove-Item -LiteralPath $pidPath -Force
|
||||
}
|
||||
|
||||
$env:NODE_PATH = "E:\Projects\CultLib\packages"
|
||||
$env:NODE_PATH = (Join-Path (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)) "CultLib\packages")
|
||||
$args = @(
|
||||
$scriptPath,
|
||||
"--stateDir", $StateDir,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
param(
|
||||
[string] $StateDir = "E:\Projects\Odin\scratch\Hermodr"
|
||||
[string] $StateDir = (Join-Path (Split-Path -Parent $PSScriptRoot) "scratch\Hermodr")
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
param(
|
||||
[string] $StateDir = "E:\Projects\Odin\scratch\odin"
|
||||
[string] $StateDir = (Join-Path (Split-Path -Parent $PSScriptRoot) "scratch\odin")
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
|
|
|||
|
|
@ -6,15 +6,16 @@ import { createRequire } from "node:module";
|
|||
import { dirname, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const cultCachePackage = resolve(repoRoot, "../CultLib/packages/cultcache-ts/package.json");
|
||||
const {
|
||||
CultCache,
|
||||
SingleFileMessagePackBackingStore,
|
||||
defineDocumentType,
|
||||
inspectCultCacheBytes,
|
||||
} = createRequire("E:/Projects/CultLib/packages/cultcache-ts/package.json")("cultcache-ts");
|
||||
} = createRequire(cultCachePackage)("cultcache-ts");
|
||||
|
||||
const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const schemaPath = "E:/Projects/EpiphanyAgent/schemas/cultnet/gamecult.persona_state.v0.schema.json";
|
||||
const schemaPath = resolve(repoRoot, "../Epiphany/schemas/cultnet/gamecult.persona_state.v0.schema.json");
|
||||
const storePath = resolve(repoRoot, "personas/gjallar.persona_state.cc");
|
||||
const recordKey = "persona:gjallar";
|
||||
const schemaVersion = "gamecult.persona_state.v0";
|
||||
|
|
@ -205,12 +206,12 @@ function buildPersonaState() {
|
|||
}),
|
||||
],
|
||||
incubation: [
|
||||
thought("csharp-cultmesh-body", "Gjallar has an executable C# Nightwing body that consumes Odin's accepted provider-state snapshot over CultNet/RUDP and renders the live multi-scale terminal dashboard.", {
|
||||
thought("csharp-cultmesh-body", "Gjallar has an executable headless C# body on Yggdrasil that consumes Odin's accepted provider-state snapshot and publishes one typed aggregate Eve surface.", {
|
||||
status: "active",
|
||||
question: "Which native CultMesh subscription should become Gjallar's long-lived input once the snapshot contract is no longer enough?",
|
||||
actionImplication: "Keep composition in Gjallar, discovery in Odin, and provider truth in each daemon's Eve/CultUI surface.",
|
||||
intensity: 0.76,
|
||||
tags: ["csharp", "nightwing", "runtime"],
|
||||
tags: ["csharp", "yggdrasil", "runtime"],
|
||||
}),
|
||||
],
|
||||
},
|
||||
|
|
@ -240,7 +241,7 @@ function buildPersonaState() {
|
|||
riskLevel: "medium",
|
||||
target: target("runtime", "gjallar-native-cultmesh", "Gjallar native CultMesh input path"),
|
||||
summary: "Promote Gjallar's Odin input from CultNet/RUDP snapshots to a native CultMesh subscription when the subscription contract is ready.",
|
||||
rationale: "Gjallar's C# Nightwing body exists; the remaining work is subscription ergonomics, not a web bridge migration.",
|
||||
rationale: "Gjallar's C# Yggdrasil body exists; the remaining work is subscription ergonomics, not a renderer migration.",
|
||||
urgency: 0.62,
|
||||
confidence: 0.74,
|
||||
constraints: [
|
||||
|
|
|
|||
|
|
@ -1,308 +0,0 @@
|
|||
# Idunn
|
||||
|
||||
Idunn is the keepalive daemon for the Odin swarm.
|
||||
|
||||
In plain language: Idunn is the little service whose job is to know which
|
||||
GameCult daemons are supposed to be alive, bring them back after a reboot or
|
||||
crash, watch whether they are still healthy, and raise a clear alarm when a
|
||||
human needs to intervene.
|
||||
|
||||
It is named for Idunn, the keeper of the apples that keep the gods young. The
|
||||
job is not glamorous. That is the point. Good infrastructure should make
|
||||
important things boring.
|
||||
|
||||
## What Idunn Is For
|
||||
|
||||
GameCult has many daemons: Odin, Bifrost, VoidBot, Mimir, Heimdall, Eve
|
||||
providers, service workers, renderers, bridges, and local machine helpers. Each
|
||||
one owns its own work, but each one should not have to carry its own private
|
||||
lifecycle machinery.
|
||||
|
||||
Idunn centralizes that lifecycle work:
|
||||
|
||||
- start known daemons after machine boot;
|
||||
- ensure deployed daemon artifacts match the desired target revision;
|
||||
- restart daemons after crashes;
|
||||
- watch health and freshness signals;
|
||||
- avoid restarting services when authority is unclear;
|
||||
- record every deployment/restart request and result as typed state;
|
||||
- record release targets, deployment artifacts, state migrations, and rollout
|
||||
results as typed state;
|
||||
- escalate to an operator through Bifrost when human action is needed.
|
||||
|
||||
The desired shape is simple:
|
||||
|
||||
```text
|
||||
Odin knows what exists.
|
||||
Idunn keeps it alive.
|
||||
Bifrost carries operator/public crossings.
|
||||
Each daemon owns its own work and health publication.
|
||||
```
|
||||
|
||||
## Who It Helps
|
||||
|
||||
Idunn is for anyone running a local GameCult swarm or operating a hosted
|
||||
GameCult machine.
|
||||
|
||||
For a developer, Idunn should mean fewer mystery services to restart by hand.
|
||||
For an operator, Idunn should mean health problems become visible, witnessed,
|
||||
and routed to the right place. For daemon authors, Idunn should mean they can
|
||||
publish health, transport profiles, and command boundaries over CultNet RUDP
|
||||
instead of building one more private watchdog.
|
||||
|
||||
## Current State
|
||||
|
||||
Idunn is a Rust daemon inside Odin's Cargo workspace. Starfire and Yggdrasil
|
||||
run separate host-local swarm profiles. Starfire owns its local adjunct daemons
|
||||
and remote display/telemetry lanes. Yggdrasil owns its hosted release targets,
|
||||
including VoidBot. Each target declares a daemon-owned health contract and keeps
|
||||
its own interval and deploy/restart authority. Daemon truth comes from typed
|
||||
CultNet/RUDP publication and daemon-owned boundary stores. Shell scripts remain
|
||||
deployment, restart, and manual diagnostic lowerings only; they do not satisfy
|
||||
health.
|
||||
The scheduler and continuity witness now belong to one Rust process instead of
|
||||
a PowerShell-herded pile of one-daemon workers.
|
||||
|
||||
VoidBot deployment authority is deliberately absent from `starfire-local`.
|
||||
Pushing VoidBot's upstream `main` branch is the release input; Yggdrasil-local
|
||||
Idunn observes `/srv/build/VoidBot` and invokes only
|
||||
`sudo -n /usr/local/libexec/idunn-yggdrasil deploy voidbot`. The privileged
|
||||
actuator delegates deploy and restart to the root-owned executable
|
||||
`/srv/odin/deploy-manifests/voidbot`. A developer checkout is not a deployment
|
||||
target and agents must not create a local keepalive or deploy path for VoidBot.
|
||||
Each cycle fetches `origin/main` in `/srv/build/VoidBot` and compares it with
|
||||
`DEPLOYED_REVISION` in `/srv/voidbot/deploy/deployment.env`. Drift owns the
|
||||
deployment decision. An unavailable fetch or witness raises an operator alarm
|
||||
instead of guessing. The privileged manifest must atomically update that
|
||||
witness only after the new release is verified; Idunn rejects an otherwise
|
||||
successful command when the witness has not converged.
|
||||
|
||||
```text
|
||||
scratch/idunn/idunn.keepalive.cc
|
||||
```
|
||||
|
||||
## Run It
|
||||
|
||||
From `E:\Projects\Odin`:
|
||||
|
||||
```powershell
|
||||
npm run idunn:build
|
||||
npm run idunn:start -- --daemon demo --rudp-health-bind <idunn-rudp-health-bind>
|
||||
```
|
||||
|
||||
`--rudp-health-bind` is explicit. Bare one-daemon Idunn does not open a
|
||||
localhost health ingress.
|
||||
|
||||
Install the local Starfire boot watchdog:
|
||||
|
||||
```powershell
|
||||
.\scripts\install-idunn-startup.ps1
|
||||
```
|
||||
|
||||
That task starts one `idunn.exe` swarm supervisor at user logon. The Rust
|
||||
runtime owns the target catalog for Odin, Stonks, Muninn, the enforced
|
||||
Yggdrasil source artifact lanes, and the Nightwing display services. The
|
||||
current Mimir dashboard is observed but not restarted until its restart
|
||||
authority is named.
|
||||
|
||||
It also starts `idunn-swarm-deployment-coverage`, which watches the deployment
|
||||
target catalog in `scripts/idunn-deployment-targets.ps1`. A repo/service is not
|
||||
allowed to vanish into shrug-space: it is either enforced by Idunn, explicitly
|
||||
blocked with the missing authority named, external-owned, or not a runtime.
|
||||
|
||||
To record that a daemon has not published health, run a manual target without a
|
||||
matching `idunn.daemon_health` RUDP publication:
|
||||
|
||||
```powershell
|
||||
npm run idunn:start -- --daemon demo --restart-command "echo restart demo"
|
||||
```
|
||||
|
||||
Idunn writes a non-actuating missing-publication health record and plans from
|
||||
that typed absence. It does not run a local health command to decide daemon
|
||||
truth.
|
||||
|
||||
To actually allow restart/deploy actuation after typed health planning decides
|
||||
one is needed:
|
||||
|
||||
```powershell
|
||||
npm run idunn:start -- --daemon demo --deploy-command "echo deploy demo" --restart-command "echo restart demo" --execute
|
||||
```
|
||||
|
||||
To keep watching on a resident interval:
|
||||
|
||||
```powershell
|
||||
npm run idunn:start -- --daemon demo --interval-seconds 30
|
||||
```
|
||||
|
||||
To run the built-in Starfire-local swarm profile directly:
|
||||
|
||||
```powershell
|
||||
npm run idunn:start -- --swarm-profile starfire-local --repo-root E:\Projects\Odin --execute
|
||||
```
|
||||
|
||||
The Yggdrasil service runs the hosted profile directly:
|
||||
|
||||
```sh
|
||||
/usr/local/bin/idunn --swarm-profile yggdrasil-local --repo-root /srv/odin/source --store /var/lib/gamecult/idunn/yggdrasil.keepalive.cc --rudp-health-bind 10.77.0.1:17870 --execute
|
||||
```
|
||||
|
||||
Optional store override:
|
||||
|
||||
```powershell
|
||||
npm run idunn:start -- --daemon demo --store E:\path\to\idunn.keepalive.cc
|
||||
```
|
||||
|
||||
## What Daemons Should Publish
|
||||
|
||||
Idunn should not guess private service truth. A daemon should publish:
|
||||
|
||||
- its service id and Verse id;
|
||||
- where its durable `.cc` state or witness lives;
|
||||
- a health or freshness signal;
|
||||
- the command boundary for deployment or artifact refresh, if one exists;
|
||||
- the command boundary for restart or recovery, if one exists;
|
||||
- what operator action is needed when automatic recovery is unsafe.
|
||||
|
||||
If that information is missing, Idunn should fail closed and create an operator
|
||||
alarm instead of improvising.
|
||||
|
||||
For the repo swarm, deployment ownership begins with catalog coverage. Use:
|
||||
|
||||
```powershell
|
||||
.\scripts\show-idunn-deployment-targets.ps1
|
||||
.\scripts\health-idunn-swarm-deployment-coverage.cmd
|
||||
```
|
||||
|
||||
The enforced targets are Nightwing Gjallar plus the Yggdrasil source artifact
|
||||
lanes whose ops runbooks can produce and verify deployment manifests. Each
|
||||
enforced target must declare upstream remote/branch, rollout strategy, state
|
||||
migration authority, and zero-downtime capability. Idunn deploys the declared
|
||||
upstream `main` revision, not arbitrary local `HEAD`. Bifrost is blocked until
|
||||
its production database migration path is coherent; mobile device installs
|
||||
remain blocked at their physical approval boundaries; GitHub Pages remains
|
||||
external-owned.
|
||||
|
||||
## Typed Records
|
||||
|
||||
- `idunn.desired_daemon.v1`
|
||||
- `idunn.daemon_health.v1`
|
||||
- `idunn.keepalive_decision.v1`
|
||||
- `idunn.deployment_request.v1`
|
||||
- `idunn.deployment_result.v1`
|
||||
- `idunn.release_target.v1`
|
||||
- `idunn.deployment_artifact.v1`
|
||||
- `idunn.state_migration_plan.v1`
|
||||
- `idunn.state_migration_result.v1`
|
||||
- `idunn.rollout_plan.v1`
|
||||
- `idunn.rollout_result.v1`
|
||||
- `idunn.restart_request.v1`
|
||||
- `idunn.restart_result.v1`
|
||||
- `idunn.operator_alarm.v1`
|
||||
- `idunn.daemon_surgery_plan.v1`
|
||||
- `idunn.daemon_transport_profile.v1`
|
||||
- `idunn.command_boundary.v1`
|
||||
- `idunn.runtime_transport_check.v1`
|
||||
- `idunn.rudp_health_ingress.v1`
|
||||
|
||||
Idunn publishes one `idunn.daemon_surgery_plan.v1` record per swarm target when
|
||||
the swarm starts. Those records make the CultNet/RUDP migration queue explicit:
|
||||
owner, objective, current mechanism, intended authority, cut line,
|
||||
steps, blockers, severity, and status.
|
||||
|
||||
It also publishes one `idunn.daemon_transport_profile.v1` and one
|
||||
`idunn.command_boundary.v1` per target. The desired daemon record links to
|
||||
both. The transport profile names `cultnet.transport.rudp.v0` as the target and
|
||||
marks daemon publication and daemon-owned witness stores as the health
|
||||
substrate. The command boundary names restart, deploy, health, and alarm
|
||||
authority separately; health authority belongs to daemon-published RUDP state.
|
||||
|
||||
At startup Idunn also publishes `idunn.runtime_transport_check.v1`, currently a
|
||||
loopback CultNet hello over `cultnet.transport.rudp.v0`. That proves Idunn's
|
||||
Rust body can use the RUDP substrate before it asks the rest of the swarm to
|
||||
walk through the same door.
|
||||
|
||||
For deploy-enforced targets, startup also publishes `idunn.release_target.v1`,
|
||||
`idunn.deployment_artifact.v1`, `idunn.state_migration_plan.v1`, and
|
||||
`idunn.rollout_plan.v1`. During deployment, Idunn runs any declared
|
||||
daemon-owned migration command before the deploy command; a failed migration
|
||||
stops the rollout and raises an operator alarm. Zero downtime is recorded only
|
||||
when the target declares a real in-place, blue/green, or rolling strategy;
|
||||
otherwise Idunn says `restart-required` and verifies that path honestly.
|
||||
|
||||
Deploy scripts are Idunn actuators. Agents should configure the target catalog,
|
||||
release target, command boundary, migration command, and daemon publication
|
||||
surface, then let Idunn run the rollout. Direct script execution without
|
||||
`IDUNN_ACTUATOR=1` fails on purpose; the little hand reaching for the deploy
|
||||
button has been removed from the machine.
|
||||
|
||||
`scripts/start-idunn-local.ps1` launches the local swarm with
|
||||
`--rudp-health-bind 0.0.0.0:17870` so host-local and explicitly configured peers
|
||||
can publish to the configured Idunn health endpoint. It accepts raw
|
||||
`idunn.daemon_health` document puts on the canonical CNR0 RUDP `schema` channel
|
||||
and writes them into the keepalive store. That is daemon-owned health
|
||||
publication, not restart/deploy authority. On Windows, UDP reset reports from
|
||||
closed one-shot publishers are treated as nonfatal ingress noise so one accepted
|
||||
health frame cannot kill the listener.
|
||||
|
||||
When a fresh daemon-published RUDP health record exists for a target, Idunn uses
|
||||
that record for keepalive planning. The record must match the daemon id, health
|
||||
contract, RUDP transport, and freshness window. If it is absent or stale, Idunn
|
||||
publishes a missing-publication observation and raises/plans from that typed
|
||||
absence instead of running a local health probe.
|
||||
|
||||
The active transport cut is no longer "make the daemons speak RUDP at all."
|
||||
Nightwing Gjallar now consumes Odin's accepted
|
||||
`surface:gamecult.network.status` snapshot over CultNet/RUDP, so every active
|
||||
Starfire-local daemon target now publishes daemon-owned RUDP health plus typed
|
||||
boundary state. The remaining debt is deleting bridge-only lowerings and
|
||||
xenos-boundary ingestion shims without letting them reclaim ownership. Odin
|
||||
still owes removal of hashed-store/C# witness shims once direct interoperable
|
||||
witness publication is ready.
|
||||
|
||||
Muninn media uses a codec-owned prediction model, not a custom visual-delta
|
||||
codec. The canonical LAN profile is
|
||||
`muninn.rudp.low_latency_h264_lan.v1`: NVENC H.264 owns inter-frame prediction,
|
||||
motion search, residuals, keyframe production, and the actual lossy visual
|
||||
encoding; CultNet/RUDP owns bounded delivery of typed video access units, audio
|
||||
packets, receiver feedback, retransmit pressure, expiry, and keyframe requests.
|
||||
Late media is dropped when it misses the fixed latency budget. Optical flow,
|
||||
foveation, ROI maps, or stochastic patch experiments may become future Muninn
|
||||
profiles only after this hardware-codec RUDP path is measured and proven
|
||||
insufficient.
|
||||
|
||||
Raven Muninn task actions are also an explicit ops invariant: Task Scheduler
|
||||
must execute `wscript.exe //B //Nologo` hidden launcher actions directly for
|
||||
`GameCult-Muninn`, `GameCult-Muninn-Activate`, and
|
||||
`GameCult-Muninn-VideoProof`, never raw `.cmd` wrappers, and the hidden VBS
|
||||
layer must call `.ps1` launchers directly instead of `cmdPath` trampolines.
|
||||
Those three live Raven tasks have been repaired and verified. The repair
|
||||
actuator now uploads its Raven PowerShell body with `sftp` and runs a tiny
|
||||
cleanup wrapper, so the hidden-task repair does not hit Windows command-line
|
||||
limits before it can run. The long-running Muninn serve bodies on Raven,
|
||||
Nightwing, and Starfire now also carry their own `--idunn-rudp-health`,
|
||||
`--idunn-daemon`, and `--idunn-health-contract` arguments, and live Idunn
|
||||
accepts those daemon-owned health records directly instead of relying on
|
||||
one-shot health commands for the truth.
|
||||
|
||||
From here on out, the work is not "teach another daemon to speak." It is
|
||||
"delete the witness masks and keep ownership where it belongs."
|
||||
|
||||
Rust no longer gets to claim the transport is imaginary:
|
||||
`vendor/cultnet-rs` includes the canonical CNR0 `cultnet.transport.rudp.v0`
|
||||
session path for acknowledged CultNet messages over UDP. That is substrate
|
||||
only. Idunn still marks daemon profiles as
|
||||
`migration-required` until each daemon actually publishes health and command
|
||||
boundary records through that path.
|
||||
|
||||
## Boundaries
|
||||
|
||||
Idunn is not Odin. It does not decide which Verses exist.
|
||||
|
||||
Idunn is not Bifrost. It does not own public crossings, Discord delivery, owner
|
||||
DMs, or governance transport.
|
||||
|
||||
Idunn is not Eve. It does not own presentation.
|
||||
|
||||
Idunn is the keeper of continuity. If a daemon should be alive, Idunn should
|
||||
know that, check it, help it recover, and leave a witness trail sharp enough
|
||||
that nobody has to guess what happened.
|
||||
|
|
@ -410,12 +410,9 @@ async function readOdinSurfaceProviderCatalog(options) {
|
|||
"hermodr-browser-lowering-odin-surface",
|
||||
odinRudpConnectionId,
|
||||
resolveHermodrRudpEndpoint(options.odinCultMeshUri, options),
|
||||
{
|
||||
connectTimeoutMs: 2_000,
|
||||
maxFragmentBytes: 1200,
|
||||
maxPendingReliablePackets: 512,
|
||||
hermodrRudpPeerOptions({
|
||||
resolveCultMeshRudpEndpoint: (uri) => resolveHermodrRudpEndpoint(uri, options),
|
||||
},
|
||||
}),
|
||||
);
|
||||
try {
|
||||
const keys = [
|
||||
|
|
@ -445,12 +442,9 @@ async function readOdinProviderAdvertisements(options) {
|
|||
"hermodr-browser-lowering-odin",
|
||||
odinRudpConnectionId,
|
||||
resolveHermodrRudpEndpoint(options.odinCultMeshUri, options),
|
||||
{
|
||||
connectTimeoutMs: 2_000,
|
||||
maxFragmentBytes: 1200,
|
||||
maxPendingReliablePackets: 512,
|
||||
hermodrRudpPeerOptions({
|
||||
resolveCultMeshRudpEndpoint: (uri) => resolveHermodrRudpEndpoint(uri, options),
|
||||
},
|
||||
}),
|
||||
);
|
||||
try {
|
||||
const response = await requestCultNetRawSnapshot(
|
||||
|
|
@ -561,6 +555,16 @@ function normalizeRudpEndpoint(endpoint) {
|
|||
return text.startsWith("rudp://") ? text : `rudp://${text}`;
|
||||
}
|
||||
|
||||
function hermodrRudpPeerOptions(overrides = {}) {
|
||||
return {
|
||||
bindHost: "0.0.0.0",
|
||||
connectTimeoutMs: 2_000,
|
||||
maxFragmentBytes: 1200,
|
||||
maxPendingReliablePackets: 512,
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
async function readProviderSurface(options, catalog, providerId, surfaceId = "") {
|
||||
const selectedSurfaceId = surfaceId || providerId;
|
||||
const recordKeys = surfaceRecordKeys(catalog, providerId, selectedSurfaceId);
|
||||
|
|
@ -608,12 +612,9 @@ async function readOdinProviderSurface(options, providerId, surfaceId = provider
|
|||
"hermodr-browser-lowering-odin-provider-surface",
|
||||
odinRudpConnectionId,
|
||||
resolveHermodrRudpEndpoint(options.odinCultMeshUri, options),
|
||||
{
|
||||
connectTimeoutMs: 2_000,
|
||||
maxFragmentBytes: 1200,
|
||||
maxPendingReliablePackets: 512,
|
||||
hermodrRudpPeerOptions({
|
||||
resolveCultMeshRudpEndpoint: (uri) => resolveHermodrRudpEndpoint(uri, options),
|
||||
},
|
||||
}),
|
||||
);
|
||||
try {
|
||||
const candidates = recordKeys.length ? recordKeys : [surfaceId, `surface:${surfaceId}`, providerId, `surface:${providerId}`];
|
||||
|
|
@ -626,7 +627,7 @@ async function readOdinProviderSurface(options, providerId, surfaceId = provider
|
|||
{ timeoutMs: 4_000, messageIdPrefix: "hermodr-odin-provider-surface" },
|
||||
);
|
||||
const state = normalizeSurfaceState(decodeMessagePack(bufferFromPayload(document.payload)), document.recordKey);
|
||||
if (!state?.surface?.root || state.surface.id !== surfaceId) continue;
|
||||
if (!state?.surface?.root) continue;
|
||||
return {
|
||||
providerId,
|
||||
documentProviderId: state.providerId,
|
||||
|
|
@ -972,7 +973,7 @@ function normalizeSurfaceState(value, recordKey) {
|
|||
title: value.title || String(providerId),
|
||||
version: value.version || 0,
|
||||
updatedAt: value.updatedAt || value.updated_at || null,
|
||||
surface: value.surface || null,
|
||||
surface: value.surface ? normalizeEveSurfaceTree(value.surface) : null,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1173,11 +1174,7 @@ async function getProviderRudpPeer(endpoint) {
|
|||
"hermodr-browser-lowering-provider",
|
||||
providerRudpConnectionId,
|
||||
key,
|
||||
{
|
||||
connectTimeoutMs: 2_000,
|
||||
maxFragmentBytes: 1200,
|
||||
maxPendingReliablePackets: 512,
|
||||
},
|
||||
hermodrRudpPeerOptions(),
|
||||
).catch((error) => {
|
||||
providerRudpPeers.delete(key);
|
||||
throw error;
|
||||
|
|
@ -1457,7 +1454,9 @@ module.exports = {
|
|||
createBrowserCatalog,
|
||||
createHermodrBridge,
|
||||
findProviderCdnRoute,
|
||||
hermodrRudpPeerOptions,
|
||||
normalizeStateBindingSource,
|
||||
normalizeProviderAdvertisement,
|
||||
normalizeSurfaceState,
|
||||
surfaceRecordKeys,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ async function main() {
|
|||
}
|
||||
return (await meshNodePromise).cache;
|
||||
},
|
||||
onDocumentPutRaw: (document) => {
|
||||
onDocumentPutRaw: async (document) => {
|
||||
if (observedRudpDocuments < 40) {
|
||||
observedRudpDocuments += 1;
|
||||
console.error(
|
||||
|
|
@ -84,9 +84,7 @@ async function main() {
|
|||
);
|
||||
}
|
||||
liveProviderRegistry.ingestDocument(document, document.remote);
|
||||
persistRudpDocumentPut(document).catch((error) => {
|
||||
console.error("CultMesh/RUDP document persist failed:", error.message);
|
||||
});
|
||||
await persistRudpDocumentPut(document);
|
||||
},
|
||||
});
|
||||
await cultMeshRudpDocumentServer.start();
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@ function buildConfig(argv) {
|
|||
endpoint: String(args["idunn-rudp-health"]),
|
||||
daemonId: String(args["idunn-daemon"] || "odin"),
|
||||
healthContract: String(args["idunn-health-contract"] || "odin.cultnet-rudp-provider-health"),
|
||||
privateKeyPath: args["idunn-health-private-key"]
|
||||
? String(args["idunn-health-private-key"])
|
||||
: "",
|
||||
sourceRuntimeId: String(args["idunn-source-runtime"] || "odin-coordinator"),
|
||||
} : null;
|
||||
const interfaceBindingStores = String(
|
||||
args.interfaceBindingStore ||
|
||||
|
|
|
|||
|
|
@ -77,8 +77,9 @@ function createCultMeshRudpDocumentServer(options) {
|
|||
},
|
||||
onDocumentPutRaw: (document) => {
|
||||
if (typeof options.onDocumentPutRaw === "function") {
|
||||
options.onDocumentPutRaw(document);
|
||||
return options.onDocumentPutRaw(document);
|
||||
}
|
||||
return undefined;
|
||||
},
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ function defineOdinDocuments(defineDocumentType) {
|
|||
return {
|
||||
interfaceBindingDefinition: null,
|
||||
evePluginAdvertisementDefinition: null,
|
||||
ghostlightSchemaCatalogDefinition: null,
|
||||
heimdallCommandBoundaryDefinition: null,
|
||||
heimdallTransportProfileDefinition: null,
|
||||
idunnCommandBoundaryDefinition: null,
|
||||
|
|
@ -95,6 +96,15 @@ function defineOdinDocuments(defineDocumentType) {
|
|||
name: (value) => value?.pluginId || value?.plugin?.id || "plugin",
|
||||
schema: parseObjectDocument("Eve plugin advertisement"),
|
||||
});
|
||||
const ghostlightSchemaCatalogDefinition = defineDocumentType({
|
||||
type: "ghostlight.schema_catalog",
|
||||
schemaName: "ghostlight.schema_catalog",
|
||||
schemaId: "ghostlight.schema_catalog.v1",
|
||||
schemaVersion: "ghostlight.schema_catalog.v1",
|
||||
global: false,
|
||||
name: (value) => value?.providerId || "gamecult.ghostlight.dungeon",
|
||||
schema: parseObjectDocument("Ghostlight public schema catalog"),
|
||||
});
|
||||
const heimdallCommandBoundaryDefinition = defineDocumentType({
|
||||
type: "heimdall.command_boundary",
|
||||
schemaName: "heimdall.command_boundary",
|
||||
|
|
@ -477,6 +487,7 @@ function defineOdinDocuments(defineDocumentType) {
|
|||
return {
|
||||
interfaceBindingDefinition,
|
||||
evePluginAdvertisementDefinition,
|
||||
ghostlightSchemaCatalogDefinition,
|
||||
heimdallCommandBoundaryDefinition,
|
||||
heimdallTransportProfileDefinition,
|
||||
interfaceLayoutDefinition,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
"use strict";
|
||||
|
||||
const dgram = require("dgram");
|
||||
const crypto = require("crypto");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const { createRequire } = require("module");
|
||||
|
||||
|
|
@ -26,15 +28,32 @@ const { encode } = requireCultNet("@msgpack/msgpack");
|
|||
|
||||
const CULTNET_RUDP_PROTOCOL_ID = "cultnet.transport.rudp.v0";
|
||||
const IDUNN_HEALTH_RUDP_CONNECTION_ID = 0x1d0d0001;
|
||||
const SIGNED_HEALTH_SCHEMA = "idunn.signed_daemon_health.v1";
|
||||
const SIGNATURE_DOMAIN = Buffer.from("gamecult.provider-health.signature.v1\0", "utf8");
|
||||
const ID_DOMAIN = Buffer.from("gamecult.provider-health.identity.v1\0", "utf8");
|
||||
const SIGNING_PURPOSE = Buffer.from(SIGNED_HEALTH_SCHEMA, "utf8");
|
||||
|
||||
function createIdunnRudpHealthPublisher(options) {
|
||||
if (!options) return null;
|
||||
const endpoint = parseEndpoint(options.endpoint);
|
||||
return {
|
||||
const publisher = {
|
||||
daemonId: options.daemonId,
|
||||
endpoint,
|
||||
healthContract: options.healthContract,
|
||||
publisherIncarnationId: crypto.randomUUID(),
|
||||
publisherSequence: 0,
|
||||
sourceRuntimeId: options.sourceRuntimeId || "odin-coordinator",
|
||||
};
|
||||
if (options.privateKeyPath) {
|
||||
publisher.privateKey = crypto.createPrivateKey(fs.readFileSync(options.privateKeyPath));
|
||||
publisher.publicKey = rawEd25519PublicKey(publisher.privateKey);
|
||||
publisher.signerIdentityId = crypto
|
||||
.createHash("sha256")
|
||||
.update(ID_DOMAIN)
|
||||
.update(publisher.publicKey)
|
||||
.digest("hex");
|
||||
}
|
||||
return publisher;
|
||||
}
|
||||
|
||||
async function publishIdunnRudpHealth(publisher, health) {
|
||||
|
|
@ -61,34 +80,28 @@ async function publishIdunnRudpHealth(publisher, health) {
|
|||
);
|
||||
|
||||
const observedAt = health.observedAt || new Date().toISOString();
|
||||
const record = {
|
||||
daemonId: publisher.daemonId,
|
||||
state: health.state,
|
||||
detail: health.detail,
|
||||
const signed = publisher.privateKey
|
||||
? signedHealthPayload(publisher, health, observedAt)
|
||||
: null;
|
||||
const payload = signed?.payload || encode([
|
||||
publisher.daemonId,
|
||||
health.state,
|
||||
String(health.detail || "").slice(0, 512),
|
||||
observedAt,
|
||||
healthContract: publisher.healthContract,
|
||||
publicationSource: "daemon-published",
|
||||
transport: CULTNET_RUDP_PROTOCOL_ID,
|
||||
};
|
||||
const payload = encode([
|
||||
record.daemonId,
|
||||
record.state,
|
||||
record.detail,
|
||||
record.observedAt,
|
||||
record.healthContract,
|
||||
record.publicationSource,
|
||||
record.transport,
|
||||
publisher.healthContract,
|
||||
"daemon-published",
|
||||
CULTNET_RUDP_PROTOCOL_ID,
|
||||
]);
|
||||
const message = {
|
||||
schemaVersion: "cultnet.document_put_raw.v0",
|
||||
messageId: `odin-health:${publisher.daemonId}:${observedAt.replace(/[:.]/g, "-")}`,
|
||||
document: {
|
||||
schemaId: "idunn.daemon_health",
|
||||
schemaId: signed ? SIGNED_HEALTH_SCHEMA : "idunn.daemon_health",
|
||||
recordKey: publisher.daemonId,
|
||||
storedAt: observedAt,
|
||||
payloadEncoding: "messagepack",
|
||||
payload,
|
||||
sourceRuntimeId: "odin-coordinator",
|
||||
sourceRuntimeId: publisher.sourceRuntimeId,
|
||||
sourceRole: "daemon-health-publisher",
|
||||
tags: [CULTNET_RUDP_PROTOCOL_ID],
|
||||
},
|
||||
|
|
@ -117,6 +130,58 @@ async function publishIdunnRudpHealth(publisher, health) {
|
|||
}
|
||||
}
|
||||
|
||||
function signedHealthPayload(publisher, health, observedAt) {
|
||||
publisher.publisherSequence += 1;
|
||||
const observedAtUnixMillis = Date.parse(observedAt);
|
||||
if (!Number.isSafeInteger(observedAtUnixMillis) || observedAtUnixMillis <= 0) {
|
||||
throw new Error("Idunn signed health observation time is invalid.");
|
||||
}
|
||||
const unsigned = [
|
||||
SIGNED_HEALTH_SCHEMA,
|
||||
publisher.daemonId,
|
||||
publisher.healthContract,
|
||||
publisher.sourceRuntimeId,
|
||||
health.state,
|
||||
String(health.detail || "").slice(0, 512),
|
||||
publisher.signerIdentityId,
|
||||
publisher.publisherIncarnationId,
|
||||
publisher.publisherSequence,
|
||||
observedAtUnixMillis,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
"ed25519",
|
||||
new Uint8Array(),
|
||||
false,
|
||||
];
|
||||
const unsignedPayload = encode(unsigned);
|
||||
const signature = crypto.sign(null, signingMessage(unsignedPayload), publisher.privateKey);
|
||||
const statement = unsigned.slice();
|
||||
statement[15] = new Uint8Array(signature);
|
||||
return { payload: encode(statement), statement, unsignedPayload };
|
||||
}
|
||||
|
||||
function signingMessage(payload) {
|
||||
const purposeLength = Buffer.alloc(8);
|
||||
purposeLength.writeBigUInt64BE(BigInt(SIGNING_PURPOSE.length));
|
||||
const payloadLength = Buffer.alloc(8);
|
||||
payloadLength.writeBigUInt64BE(BigInt(payload.length));
|
||||
return Buffer.concat([
|
||||
SIGNATURE_DOMAIN,
|
||||
purposeLength,
|
||||
SIGNING_PURPOSE,
|
||||
payloadLength,
|
||||
Buffer.from(payload),
|
||||
]);
|
||||
}
|
||||
|
||||
function rawEd25519PublicKey(privateKey) {
|
||||
const der = crypto.createPublicKey(privateKey).export({ type: "spki", format: "der" });
|
||||
if (der.length < 32) throw new Error("Ed25519 public key export is too short.");
|
||||
return Buffer.from(der.subarray(der.length - 32));
|
||||
}
|
||||
|
||||
async function bindSocket(socket, endpoint) {
|
||||
await new Promise((resolve, reject) => {
|
||||
socket.once("error", reject);
|
||||
|
|
@ -254,4 +319,6 @@ module.exports = {
|
|||
CULTNET_RUDP_PROTOCOL_ID,
|
||||
createIdunnRudpHealthPublisher,
|
||||
publishIdunnRudpHealth,
|
||||
signedHealthPayload,
|
||||
signingMessage,
|
||||
};
|
||||
|
|
|
|||
21
test/ghostlight-discovery-documents.test.cjs
Normal file
21
test/ghostlight-discovery-documents.test.cjs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
"use strict";
|
||||
|
||||
const assert = require("node:assert/strict");
|
||||
const test = require("node:test");
|
||||
|
||||
const { defineOdinDocuments } = require("../src/odin/documents.cjs");
|
||||
|
||||
test("Odin persists Ghostlight's public schema catalog envelope", () => {
|
||||
const documents = defineOdinDocuments((definition) => definition);
|
||||
const catalog = documents.ghostlightSchemaCatalogDefinition;
|
||||
|
||||
assert.equal(catalog.type, "ghostlight.schema_catalog");
|
||||
assert.equal(catalog.schemaId, "ghostlight.schema_catalog.v1");
|
||||
assert.equal(catalog.schemaVersion, "ghostlight.schema_catalog.v1");
|
||||
assert.equal(catalog.name({ providerId: "gamecult.ghostlight.dungeon" }), "gamecult.ghostlight.dungeon");
|
||||
});
|
||||
|
||||
test("Odin's unavailable-runtime projection includes the Ghostlight catalog slot", () => {
|
||||
const documents = defineOdinDocuments(null);
|
||||
assert.equal(documents.ghostlightSchemaCatalogDefinition, null);
|
||||
});
|
||||
|
|
@ -6,10 +6,18 @@ const test = require("node:test");
|
|||
const {
|
||||
createBrowserCatalog,
|
||||
findProviderCdnRoute,
|
||||
hermodrRudpPeerOptions,
|
||||
normalizeProviderAdvertisement,
|
||||
normalizeSurfaceState,
|
||||
surfaceRecordKeys,
|
||||
} = require("../src/hermodr-daemon.cjs");
|
||||
|
||||
test("Hermodr outbound RUDP peers bind beyond loopback", () => {
|
||||
const options = hermodrRudpPeerOptions();
|
||||
assert.equal(options.bindHost, "0.0.0.0");
|
||||
assert.equal(options.connectTimeoutMs, 2_000);
|
||||
});
|
||||
|
||||
const provider = normalizeProviderAdvertisement({
|
||||
providerId: "fixture.game",
|
||||
title: "Fixture game",
|
||||
|
|
@ -36,6 +44,24 @@ test("surface reads prefer the provider-advertised record reference", () => {
|
|||
assert.equal(surfaceRecordKeys(catalog, "fixture.game", "fixture.world")[0], "cultmesh://fixture/surfaces/world");
|
||||
});
|
||||
|
||||
test("surface-state normalization lowers MessagePack array records", () => {
|
||||
const state = normalizeSurfaceState([
|
||||
"gjallar.overview",
|
||||
"Gjallar",
|
||||
7,
|
||||
"2026-08-25T00:00:00Z",
|
||||
[
|
||||
"gjallar.overview.surface",
|
||||
["root", "dashboard", { title: "Gjallar" }, [], [], [], { mode: "weighted-bisect" }, {}],
|
||||
[],
|
||||
],
|
||||
], "gjallar.overview");
|
||||
|
||||
assert.equal(state.surface.id, "gjallar.overview.surface");
|
||||
assert.equal(state.surface.root.kind, "dashboard");
|
||||
assert.equal(state.surface.root.layout.mode, "weighted-bisect");
|
||||
});
|
||||
|
||||
test("CDN routing follows the asset URI provider instead of a product name", () => {
|
||||
const catalog = createBrowserCatalog([provider]);
|
||||
const route = findProviderCdnRoute(catalog, "cultmesh://fixture.game/assets/player");
|
||||
|
|
|
|||
65
test/idunn-signed-health.test.cjs
Normal file
65
test/idunn-signed-health.test.cjs
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
"use strict";
|
||||
|
||||
const assert = require("node:assert/strict");
|
||||
const crypto = require("node:crypto");
|
||||
const test = require("node:test");
|
||||
|
||||
const {
|
||||
signedHealthPayload,
|
||||
signingMessage,
|
||||
} = require("../src/odin/idunn-rudp.cjs");
|
||||
|
||||
test("Odin signs the complete canonical provider-health statement", () => {
|
||||
const { privateKey, publicKey } = crypto.generateKeyPairSync("ed25519");
|
||||
const publicDer = publicKey.export({ type: "spki", format: "der" });
|
||||
const rawPublicKey = Buffer.from(publicDer.subarray(publicDer.length - 32));
|
||||
const signerIdentityId = crypto
|
||||
.createHash("sha256")
|
||||
.update(Buffer.from("gamecult.provider-health.identity.v1\0"))
|
||||
.update(rawPublicKey)
|
||||
.digest("hex");
|
||||
const publisher = {
|
||||
daemonId: "yggdrasil-odin",
|
||||
healthContract: "odin.cultnet-rudp-provider-health",
|
||||
privateKey,
|
||||
publisherIncarnationId: "24e0dc7f-6a92-4aa8-9f56-fb513d265e13",
|
||||
publisherSequence: 0,
|
||||
signerIdentityId,
|
||||
sourceRuntimeId: "odin-yggdrasil",
|
||||
};
|
||||
|
||||
const signed = signedHealthPayload(
|
||||
publisher,
|
||||
{ state: "active", detail: "catalog current" },
|
||||
"2026-08-21T12:34:56.789Z",
|
||||
);
|
||||
|
||||
assert.equal(signed.statement[0], "idunn.signed_daemon_health.v1");
|
||||
assert.equal(signed.statement[1], "yggdrasil-odin");
|
||||
assert.equal(signed.statement[2], "odin.cultnet-rudp-provider-health");
|
||||
assert.equal(signed.statement[3], "odin-yggdrasil");
|
||||
assert.equal(signed.statement[8], 1);
|
||||
assert.equal(signed.statement[9], 1787315696789);
|
||||
assert.equal(signed.statement[15].byteLength, 64);
|
||||
assert.equal(
|
||||
crypto.verify(
|
||||
null,
|
||||
signingMessage(signed.unsignedPayload),
|
||||
publicKey,
|
||||
Buffer.from(signed.statement[15]),
|
||||
),
|
||||
true,
|
||||
);
|
||||
|
||||
const tampered = Buffer.from(signed.unsignedPayload);
|
||||
tampered[tampered.length - 1] ^= 1;
|
||||
assert.equal(
|
||||
crypto.verify(
|
||||
null,
|
||||
signingMessage(tampered),
|
||||
publicKey,
|
||||
Buffer.from(signed.statement[15]),
|
||||
),
|
||||
false,
|
||||
);
|
||||
});
|
||||
2
vendor/cultcache-rs/.gitignore
vendored
2
vendor/cultcache-rs/.gitignore
vendored
|
|
@ -1,2 +0,0 @@
|
|||
/target
|
||||
Cargo.lock
|
||||
27
vendor/cultcache-rs/Cargo.toml
vendored
27
vendor/cultcache-rs/Cargo.toml
vendored
|
|
@ -1,27 +0,0 @@
|
|||
[package]
|
||||
name = "cultcache-rs"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[workspace]
|
||||
members = ["cultcache-rs-derive"]
|
||||
|
||||
[lib]
|
||||
name = "cultcache_rs"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
cultcache-rs-derive = { path = "cultcache-rs-derive" }
|
||||
fs2 = "0.4"
|
||||
rmp-serde = "1.3"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_bytes = "0.11"
|
||||
serde_json = "1"
|
||||
uuid = { version = "1", features = ["v4"] }
|
||||
|
||||
[dev-dependencies]
|
||||
pretty_assertions = "1.4"
|
||||
tempfile = "3"
|
||||
332
vendor/cultcache-rs/README.md
vendored
332
vendor/cultcache-rs/README.md
vendored
|
|
@ -1,332 +0,0 @@
|
|||
# CultCache Rust
|
||||
|
||||
`cultcache-rs` is the Rust port of the useful part of GameCult's CultCache:
|
||||
a polymorphism-aware in-memory cache that remembers through pluggable backing
|
||||
stores.
|
||||
|
||||
Consumer code should think in domain types:
|
||||
|
||||
```rust
|
||||
let player = cache.get_required::<PlayerData>("player:meta")?;
|
||||
cache.put("player:meta", &player)?;
|
||||
```
|
||||
|
||||
The persistence layer should deal with envelopes, routing, MessagePack payload
|
||||
bytes, and schema identity. Application code should not paw at loose JSON files
|
||||
like a sad little bureaucrat with a clipboard.
|
||||
|
||||
## What It Is
|
||||
|
||||
CultCache is a domain cache with persistence adapters.
|
||||
|
||||
- `CultCache` is the query and mutation surface.
|
||||
- Domain structs implement `DatabaseEntry`.
|
||||
- Entries are stored behind a `type::key` identity, so multiple entry types
|
||||
can share a logical key without colliding.
|
||||
- Each payload is encoded directly from the known `DatabaseEntry` type into
|
||||
MessagePack bytes.
|
||||
- Backing stores are adapters, not the public data model.
|
||||
- Writes persist to the resolved backing store before the in-memory cache is
|
||||
updated.
|
||||
- Type-specific backing stores beat generic backing stores.
|
||||
- `SingleFileMessagePackBackingStore` is the first concrete store and guards
|
||||
file access with a sidecar lock file.
|
||||
|
||||
This is not an ORM, not a database, and not distributed consensus in a novelty
|
||||
hat. If multiple processes write the same backing file, use an external lock or
|
||||
a coordinator.
|
||||
|
||||
## Current API
|
||||
|
||||
```rust
|
||||
use cultcache_rs::{CultCache, DatabaseEntry, SingleFileMessagePackBackingStore};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
|
||||
#[cultcache(type = "settings")]
|
||||
struct Settings {
|
||||
#[cultcache(key = 0)]
|
||||
theme: String,
|
||||
|
||||
#[cultcache(key = 1, default)]
|
||||
retries: u32,
|
||||
}
|
||||
|
||||
let mut cache = CultCache::new();
|
||||
cache.register_entry_type::<Settings>()?;
|
||||
cache.add_generic_backing_store(SingleFileMessagePackBackingStore::new("cache.cc"));
|
||||
cache.pull_all_backing_stores()?;
|
||||
|
||||
cache.put("app", &Settings {
|
||||
theme: "ash".to_string(),
|
||||
retries: 3,
|
||||
})?;
|
||||
|
||||
let settings = cache.get_required::<Settings>("app")?;
|
||||
# Ok::<(), anyhow::Error>(())
|
||||
```
|
||||
|
||||
For a closed set of entries, generate a registry instead of repeating yourself:
|
||||
|
||||
```rust
|
||||
use cultcache_rs::cultcache_registry;
|
||||
|
||||
cultcache_registry!(GameCultEntries {
|
||||
Settings,
|
||||
PlayerData,
|
||||
});
|
||||
|
||||
let mut cache = CultCache::new();
|
||||
cache.register_registry(GameCultEntries)?;
|
||||
```
|
||||
|
||||
The important part is that callers retrieve domain values directly:
|
||||
|
||||
```rust
|
||||
let settings: Settings = cache.get_required("app")?;
|
||||
let all_settings: Vec<Settings> = cache.get_all()?;
|
||||
```
|
||||
|
||||
The cache is the ergonomic surface. The backing store is the memory prosthetic.
|
||||
|
||||
## How This Maps From Original CultCache
|
||||
|
||||
The original C# CultCache relies on runtime reflection:
|
||||
|
||||
- cacheable models inherit from `DatabaseEntry`
|
||||
- the cache scans child classes at startup
|
||||
- `Get<T>(id)` returns a `T`
|
||||
- optional `INamedEntry` enables name lookup
|
||||
- optional field/property indexes are registered by member name
|
||||
- backing stores pull/push/delete `DatabaseEntry` values
|
||||
|
||||
Rust does not have C#-style assembly scanning or runtime subclass discovery.
|
||||
The closest honest Rust translation is:
|
||||
|
||||
- domain structs implement a marker trait, `DatabaseEntry`
|
||||
- the derive macro generates a positional array formatter from explicit integer
|
||||
field slots
|
||||
- the envelope carries the polymorphic type discriminator
|
||||
- unknown persisted type ids fail closed instead of constructing arbitrary
|
||||
runtime types
|
||||
- a generated registry should eventually replace repetitive manual
|
||||
registration
|
||||
|
||||
Manual `register_entry_type::<T>()` is still accepted, but entry identity no
|
||||
longer needs a hand-written impl: `#[derive(DatabaseEntry)]` declares it beside
|
||||
the domain type. `cultcache_registry!` provides the current generated resolver
|
||||
surface for a closed entry set.
|
||||
|
||||
## Intended Rust Ergonomics
|
||||
|
||||
The target user-facing shape should be:
|
||||
|
||||
```rust
|
||||
#[derive(Clone, DatabaseEntry)]
|
||||
#[cultcache(type = "player")]
|
||||
pub struct PlayerData {
|
||||
#[cultcache(key = 0)]
|
||||
pub id: String,
|
||||
|
||||
#[cultcache(key = 1)]
|
||||
pub name: String,
|
||||
|
||||
#[cultcache(key = 2)]
|
||||
pub faction: String,
|
||||
}
|
||||
|
||||
let mut cache = CultCache::builder()
|
||||
.with_generated_entries(game_entries())
|
||||
.with_generic_store(SingleFileMessagePackBackingStore::new("cache.cc"))
|
||||
.build()?;
|
||||
|
||||
cache.pull_all_backing_stores()?;
|
||||
let player = cache.get_required::<PlayerData>("player:ari")?;
|
||||
```
|
||||
|
||||
The current `cultcache_registry!` macro is deliberately simple. The remaining
|
||||
ergonomic endpoint is automatic inventory or build-script generation so users
|
||||
do not have to maintain the registry list by hand.
|
||||
|
||||
The registry is the Rust equivalent of C# reflection and MessagePack resolver
|
||||
setup. It should know:
|
||||
|
||||
- entry type id
|
||||
- generated MessagePack/serde formatter path
|
||||
- Rust type name / schema name
|
||||
- optional store domain route
|
||||
- optional name key extractor
|
||||
- optional secondary indexes
|
||||
- optional global singleton marker
|
||||
|
||||
In other words: code generation should restore the original CultCache feeling
|
||||
without pretending Rust has runtime reflection hiding under the floorboards.
|
||||
|
||||
## Current Surface
|
||||
|
||||
- `CultCache::new`
|
||||
- `register_entry_type::<T>`
|
||||
- `add_generic_backing_store`
|
||||
- `add_backing_store`
|
||||
- `pull_all_backing_stores`
|
||||
- `get::<T>`
|
||||
- `get_required::<T>`
|
||||
- `get_envelope::<T>`
|
||||
- `get_required_envelope::<T>`
|
||||
- `get_all::<T>`
|
||||
- `put::<T>`
|
||||
- `put_envelope::<T>`
|
||||
- `update::<T>`
|
||||
- `delete::<T>`
|
||||
- `snapshot`
|
||||
- `SingleFileMessagePackBackingStore`
|
||||
|
||||
## Backing Store Routing
|
||||
|
||||
Generic store:
|
||||
|
||||
```rust
|
||||
cache.add_generic_backing_store(SingleFileMessagePackBackingStore::new("cache.cc"));
|
||||
```
|
||||
|
||||
Type-specific store:
|
||||
|
||||
```rust
|
||||
cache.add_backing_store(
|
||||
SingleFileMessagePackBackingStore::new("players.cc"),
|
||||
["player"],
|
||||
);
|
||||
```
|
||||
|
||||
When writing a `PlayerData`, the cache checks type-specific stores first. If none
|
||||
match, it writes to the first generic store. Later matching stores are mirrors.
|
||||
|
||||
This mirrors the C# behavior:
|
||||
|
||||
- specific domain stores own their domain
|
||||
- the first generic store is the primary generic write target
|
||||
- later generic stores mirror writes
|
||||
- this is not multi-master
|
||||
|
||||
## Persistence Semantics
|
||||
|
||||
`put` persists before mutating the in-memory cache. If persistence fails, the
|
||||
cache does not pretend the write succeeded.
|
||||
|
||||
The envelope is MessagePack, and the payload inside each envelope is also raw
|
||||
MessagePack bytes encoded from the registered concrete `DatabaseEntry` type.
|
||||
That avoids the old bootstrap path where payloads were normalized through
|
||||
`serde_json::Value`.
|
||||
|
||||
For bit-compatible neighbors, that also enables a real fast lane:
|
||||
|
||||
- `get_envelope::<T>()` exports the canonical persisted bytes for a typed entry
|
||||
- `put_envelope::<T>()` ingests the same envelope into another cache instance
|
||||
without re-encoding the payload first
|
||||
|
||||
It still decodes once for validation and typed reads. We are not pretending one
|
||||
`Vec<u8>` became metaphysically zero-copy because we believed in it harder. But
|
||||
the stupid decode/re-encode loop is gone.
|
||||
|
||||
The `DatabaseEntry` derive does not trust Rust source field order as the durable
|
||||
schema. Every persisted member must declare a stable integer slot:
|
||||
|
||||
```rust
|
||||
#[derive(Clone, DatabaseEntry)]
|
||||
#[cultcache(type = "player")]
|
||||
pub struct PlayerData {
|
||||
#[cultcache(key = 0)]
|
||||
pub id: String,
|
||||
|
||||
#[cultcache(key = 1)]
|
||||
pub name: String,
|
||||
|
||||
#[cultcache(key = 2, default)]
|
||||
pub level: u32,
|
||||
}
|
||||
```
|
||||
|
||||
The derive emits a tuple/array formatter. Gaps serialize as nil. Missing fields
|
||||
marked `default` use `Default::default()` when older payloads are read. Deleted
|
||||
field slots should stay reserved until an explicit store migration rewrites the
|
||||
data.
|
||||
|
||||
The single-file MessagePack store rewrites an atomic snapshot. That is a sane
|
||||
starting point for small typed state surfaces, settings, Epiphany agent memory,
|
||||
heartbeat state, and other compact control-plane data. Large corpora should use
|
||||
a sharded store or a real database instead of asking one file to become a
|
||||
warehouse and then acting wounded when physics invoices us.
|
||||
|
||||
The single-file store uses a sidecar lock file for shared reads and exclusive
|
||||
writes. That protects ordinary multi-process access to the same file. It is
|
||||
still not a multi-master replication protocol, and it is not a substitute for a
|
||||
coordinator when higher-level write ordering matters.
|
||||
|
||||
## Near-Term Ergonomic Improvements
|
||||
|
||||
1. **Derive macro**
|
||||
- `#[derive(DatabaseEntry)]`
|
||||
- `#[cultcache(type = "...")]`
|
||||
- `#[cultcache(key = N)]` on every persisted field
|
||||
- tuple/array formatter generation landed
|
||||
- optional `#[cultcache(name)]`, `#[cultcache(index)]`, and
|
||||
`#[cultcache(global)]` are still future work
|
||||
|
||||
2. **Generated registry**
|
||||
- a `CultCacheRegistry` trait
|
||||
- `cache.register_registry(GameCultEntries)`
|
||||
- basic macro registry landed
|
||||
- automatic inventory/build-script generation and store routes are future work
|
||||
|
||||
3. **Name and index lookups**
|
||||
- `cache.get_by_name::<T>("Potion")`
|
||||
- `cache.get_by_index::<T>("faction", "Lucent")`
|
||||
- generated extractors instead of reflection strings
|
||||
|
||||
4. **Schema/version metadata**
|
||||
- schema version in the envelope or payload metadata
|
||||
- explicit migration hooks
|
||||
- refusal on unknown persisted entry types unless a migration/resolver is
|
||||
installed
|
||||
|
||||
5. **Projection helpers**
|
||||
- JSON projection for review and git diffs
|
||||
- vector stripping / large-field elision for agent memory surfaces
|
||||
|
||||
## Why Not Skip Registration Immediately?
|
||||
|
||||
Rust can only deserialize polymorphic data into concrete types if something
|
||||
maps the persisted `type` discriminator to the Rust type. In C#, reflection and
|
||||
MessagePack resolvers can discover a closed `DatabaseEntry` inheritance tree at
|
||||
runtime and route it through known formatters. In Rust, that map has to come from
|
||||
somewhere:
|
||||
|
||||
- explicit registration
|
||||
- a generated registry
|
||||
- a macro inventory crate
|
||||
- a hand-written resolver
|
||||
|
||||
Explicit registration is the simplest honest implementation. Generated registry
|
||||
is the ergonomic destination. Hand-written resolver tables are the punishment
|
||||
we give ourselves if we get lazy.
|
||||
|
||||
## Security Model
|
||||
|
||||
CultCache should never parse arbitrary structured data into arbitrary runtime
|
||||
types. It only accepts persisted envelopes whose `type` discriminator resolves
|
||||
to a known `DatabaseEntry` type registered in the cache or generated registry.
|
||||
|
||||
That is the Rust version of the original trick:
|
||||
|
||||
- C# refuses to store objects outside the `DatabaseEntry` root type.
|
||||
- Runtime-visible `DatabaseEntry` subclasses get dedicated formatters.
|
||||
- Unknown or unregistered types are rejected.
|
||||
- MessagePack payload bytes deserialize through known concrete formatters, not
|
||||
an open-world type loader or generic structured-value bridge.
|
||||
|
||||
The derive/registry work should preserve that shape. Its job is to remove
|
||||
manual registration ceremony, not to loosen the closed-world boundary.
|
||||
|
||||
## License
|
||||
|
||||
Private GameCult infrastructure for now. Public packaging can wait until the
|
||||
API grows enough teeth to deserve strangers.
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
[package]
|
||||
name = "cultcache-rs-derive"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
proc-macro2 = "1"
|
||||
quote = "1"
|
||||
syn = { version = "2", features = ["derive", "parsing"] }
|
||||
243
vendor/cultcache-rs/cultcache-rs-derive/src/lib.rs
vendored
243
vendor/cultcache-rs/cultcache-rs-derive/src/lib.rs
vendored
|
|
@ -1,243 +0,0 @@
|
|||
use proc_macro::TokenStream;
|
||||
use quote::format_ident;
|
||||
use quote::quote;
|
||||
use syn::Data;
|
||||
use syn::DeriveInput;
|
||||
use syn::Fields;
|
||||
use syn::LitInt;
|
||||
use syn::LitStr;
|
||||
use syn::Type;
|
||||
use syn::parse_macro_input;
|
||||
|
||||
#[proc_macro_derive(DatabaseEntry, attributes(cultcache))]
|
||||
pub fn derive_database_entry(input: TokenStream) -> TokenStream {
|
||||
let input = parse_macro_input!(input as DeriveInput);
|
||||
let ident = input.ident.clone();
|
||||
let mut entry_type: Option<LitStr> = None;
|
||||
let mut schema_name: Option<LitStr> = None;
|
||||
|
||||
for attribute in input
|
||||
.attrs
|
||||
.iter()
|
||||
.filter(|attr| attr.path().is_ident("cultcache"))
|
||||
{
|
||||
let parse_result = attribute.parse_nested_meta(|meta| {
|
||||
if meta.path.is_ident("type") {
|
||||
entry_type = Some(meta.value()?.parse()?);
|
||||
Ok(())
|
||||
} else if meta.path.is_ident("schema") {
|
||||
schema_name = Some(meta.value()?.parse()?);
|
||||
Ok(())
|
||||
} else {
|
||||
Err(meta.error("unsupported cultcache attribute"))
|
||||
}
|
||||
});
|
||||
if let Err(error) = parse_result {
|
||||
return error.to_compile_error().into();
|
||||
}
|
||||
}
|
||||
|
||||
let Some(entry_type) = entry_type else {
|
||||
return syn::Error::new_spanned(
|
||||
ident,
|
||||
"DatabaseEntry derive requires #[cultcache(type = \"...\")]",
|
||||
)
|
||||
.to_compile_error()
|
||||
.into();
|
||||
};
|
||||
let schema_name = schema_name.unwrap_or_else(|| LitStr::new(&ident.to_string(), ident.span()));
|
||||
|
||||
let fields = match input.data {
|
||||
Data::Struct(data) => match data.fields {
|
||||
Fields::Named(fields) => fields.named,
|
||||
_ => {
|
||||
return syn::Error::new_spanned(
|
||||
ident,
|
||||
"DatabaseEntry derive requires a named struct",
|
||||
)
|
||||
.to_compile_error()
|
||||
.into();
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
return syn::Error::new_spanned(ident, "DatabaseEntry derive requires a struct")
|
||||
.to_compile_error()
|
||||
.into();
|
||||
}
|
||||
};
|
||||
|
||||
let mut slots: Vec<CultCacheSlot> = Vec::new();
|
||||
for field in fields {
|
||||
let Some(field_ident) = field.ident else {
|
||||
return syn::Error::new_spanned(field.ty, "DatabaseEntry derive requires named fields")
|
||||
.to_compile_error()
|
||||
.into();
|
||||
};
|
||||
let mut key: Option<usize> = None;
|
||||
let mut default = false;
|
||||
for attribute in field
|
||||
.attrs
|
||||
.iter()
|
||||
.filter(|attr| attr.path().is_ident("cultcache"))
|
||||
{
|
||||
let parse_result = attribute.parse_nested_meta(|meta| {
|
||||
if meta.path.is_ident("key") {
|
||||
let value: LitInt = meta.value()?.parse()?;
|
||||
key = Some(value.base10_parse()?);
|
||||
Ok(())
|
||||
} else if meta.path.is_ident("default") {
|
||||
default = true;
|
||||
Ok(())
|
||||
} else {
|
||||
Err(meta.error("unsupported field cultcache attribute"))
|
||||
}
|
||||
});
|
||||
if let Err(error) = parse_result {
|
||||
return error.to_compile_error().into();
|
||||
}
|
||||
}
|
||||
let Some(key) = key else {
|
||||
return syn::Error::new_spanned(
|
||||
field_ident,
|
||||
"DatabaseEntry fields require #[cultcache(key = N)]",
|
||||
)
|
||||
.to_compile_error()
|
||||
.into();
|
||||
};
|
||||
if slots.iter().any(|slot| slot.key == key) {
|
||||
return syn::Error::new_spanned(
|
||||
field_ident,
|
||||
format!("duplicate DatabaseEntry slot {key}"),
|
||||
)
|
||||
.to_compile_error()
|
||||
.into();
|
||||
}
|
||||
slots.push(CultCacheSlot {
|
||||
key,
|
||||
ident: field_ident,
|
||||
ty: field.ty,
|
||||
default,
|
||||
});
|
||||
}
|
||||
slots.sort_by_key(|slot| slot.key);
|
||||
let max_slot = slots.iter().map(|slot| slot.key).max().unwrap_or(0);
|
||||
|
||||
let serialize_elements = (0..=max_slot).map(|slot| {
|
||||
if let Some(field) = slots.iter().find(|field| field.key == slot) {
|
||||
let field_ident = &field.ident;
|
||||
quote! {
|
||||
tuple.serialize_element(&self.#field_ident)?;
|
||||
}
|
||||
} else {
|
||||
quote! {
|
||||
tuple.serialize_element(&())?;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let option_declarations = slots.iter().map(|field| {
|
||||
let variable = format_ident!("slot_{}", field.key);
|
||||
let ty = &field.ty;
|
||||
quote! {
|
||||
let mut #variable: ::std::option::Option<#ty> = ::std::option::Option::None;
|
||||
}
|
||||
});
|
||||
|
||||
let deserialize_match_arms = (0..=max_slot).map(|slot| {
|
||||
if let Some(field) = slots.iter().find(|field| field.key == slot) {
|
||||
let variable = format_ident!("slot_{}", field.key);
|
||||
let ty = &field.ty;
|
||||
quote! {
|
||||
#slot => {
|
||||
#variable = seq.next_element::<#ty>()?;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
quote! {
|
||||
#slot => {
|
||||
let _ = seq.next_element::<::serde::de::IgnoredAny>()?;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let build_fields = slots.iter().map(|field| {
|
||||
let field_ident = &field.ident;
|
||||
let variable = format_ident!("slot_{}", field.key);
|
||||
if field.default {
|
||||
quote! {
|
||||
#field_ident: #variable.unwrap_or_default()
|
||||
}
|
||||
} else {
|
||||
let field_name = field_ident.to_string();
|
||||
quote! {
|
||||
#field_ident: #variable.ok_or_else(|| ::serde::de::Error::missing_field(#field_name))?
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
quote! {
|
||||
impl ::cultcache_rs::DatabaseEntry for #ident {
|
||||
const TYPE: &'static str = #entry_type;
|
||||
const SCHEMA_NAME: &'static str = #schema_name;
|
||||
}
|
||||
|
||||
impl ::serde::Serialize for #ident {
|
||||
fn serialize<S>(&self, serializer: S) -> ::std::result::Result<S::Ok, S::Error>
|
||||
where
|
||||
S: ::serde::Serializer,
|
||||
{
|
||||
use ::serde::ser::SerializeTuple;
|
||||
let mut tuple = serializer.serialize_tuple(#max_slot + 1)?;
|
||||
#(#serialize_elements)*
|
||||
tuple.end()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> ::serde::Deserialize<'de> for #ident {
|
||||
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
|
||||
where
|
||||
D: ::serde::Deserializer<'de>,
|
||||
{
|
||||
struct CultCacheVisitor;
|
||||
|
||||
impl<'de> ::serde::de::Visitor<'de> for CultCacheVisitor {
|
||||
type Value = #ident;
|
||||
|
||||
fn expecting(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||
formatter.write_str(concat!("a CultCache array for ", stringify!(#ident)))
|
||||
}
|
||||
|
||||
fn visit_seq<A>(self, mut seq: A) -> ::std::result::Result<Self::Value, A::Error>
|
||||
where
|
||||
A: ::serde::de::SeqAccess<'de>,
|
||||
{
|
||||
#(#option_declarations)*
|
||||
let mut index = 0usize;
|
||||
while index <= #max_slot {
|
||||
match index {
|
||||
#(#deserialize_match_arms)*
|
||||
_ => unreachable!(),
|
||||
}
|
||||
index += 1;
|
||||
}
|
||||
while let ::std::option::Option::Some(_) = seq.next_element::<::serde::de::IgnoredAny>()? {}
|
||||
Ok(#ident {
|
||||
#(#build_fields),*
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
deserializer.deserialize_tuple(#max_slot + 1, CultCacheVisitor)
|
||||
}
|
||||
}
|
||||
}
|
||||
.into()
|
||||
}
|
||||
|
||||
struct CultCacheSlot {
|
||||
key: usize,
|
||||
ident: syn::Ident,
|
||||
ty: Type,
|
||||
default: bool,
|
||||
}
|
||||
121
vendor/cultcache-rs/examples/cultcache_interop.rs
vendored
121
vendor/cultcache-rs/examples/cultcache_interop.rs
vendored
|
|
@ -1,121 +0,0 @@
|
|||
use anyhow::Result;
|
||||
use anyhow::anyhow;
|
||||
use cultcache_rs::CultCache;
|
||||
use cultcache_rs::DatabaseEntry;
|
||||
use cultcache_rs::SingleFileMessagePackBackingStore;
|
||||
use serde_json::json;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
const INTEROP_TYPE: &str = "cultcache.interop-note";
|
||||
const INTEROP_SCHEMA_VERSION: &str = "cultcache.interop_note.v1";
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
|
||||
#[cultcache(type = "cultcache.interop-note", schema = "CultCacheInteropNote")]
|
||||
struct CultCacheInteropNote {
|
||||
#[cultcache(key = 0)]
|
||||
schema_version: String,
|
||||
#[cultcache(key = 1)]
|
||||
document_id: String,
|
||||
#[cultcache(key = 2)]
|
||||
author_runtime_id: String,
|
||||
#[cultcache(key = 3)]
|
||||
title: String,
|
||||
#[cultcache(key = 4)]
|
||||
body: String,
|
||||
#[cultcache(key = 5, default)]
|
||||
tags: Vec<String>,
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let mut args = std::env::args().skip(1);
|
||||
let mode = args
|
||||
.next()
|
||||
.ok_or_else(|| anyhow!("expected mode: write | read"))?;
|
||||
let options = parse_args(args.collect());
|
||||
let file = require_arg(&options, "file")?;
|
||||
|
||||
match mode.as_str() {
|
||||
"write" => write_note(file, require_arg(&options, "runtime-id")?)?,
|
||||
"read" => read_note(file)?,
|
||||
_ => return Err(anyhow!("unknown mode {mode}")),
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn write_note(file: &str, runtime_id: &str) -> Result<()> {
|
||||
let mut cache = build_cache(file)?;
|
||||
cache.pull_all_backing_stores()?;
|
||||
let note = CultCacheInteropNote {
|
||||
schema_version: INTEROP_SCHEMA_VERSION.to_string(),
|
||||
document_id: format!("note:{runtime_id}"),
|
||||
author_runtime_id: runtime_id.to_string(),
|
||||
title: format!("{runtime_id} wrote a CultCache note"),
|
||||
body: "The v1 store format is the contract.".to_string(),
|
||||
tags: vec![
|
||||
runtime_id.to_string(),
|
||||
"rust".to_string(),
|
||||
"interop".to_string(),
|
||||
],
|
||||
};
|
||||
cache.put(¬e.document_id, ¬e)?;
|
||||
print_note(¬e)
|
||||
}
|
||||
|
||||
fn read_note(file: &str) -> Result<()> {
|
||||
let mut cache = build_cache(file)?;
|
||||
cache.pull_all_backing_stores()?;
|
||||
let notes = cache.get_all::<CultCacheInteropNote>()?;
|
||||
let note = notes
|
||||
.first()
|
||||
.ok_or_else(|| anyhow!("no {INTEROP_TYPE} records found"))?;
|
||||
print_note(note)
|
||||
}
|
||||
|
||||
fn build_cache(file: &str) -> Result<CultCache> {
|
||||
let mut cache = CultCache::new();
|
||||
cache.register_entry_type::<CultCacheInteropNote>()?;
|
||||
cache.add_generic_backing_store(SingleFileMessagePackBackingStore::new(file));
|
||||
Ok(cache)
|
||||
}
|
||||
|
||||
fn print_note(note: &CultCacheInteropNote) -> Result<()> {
|
||||
println!(
|
||||
"{}",
|
||||
serde_json::to_string(&json!({
|
||||
"schemaVersion": note.schema_version,
|
||||
"documentId": note.document_id,
|
||||
"authorRuntimeId": note.author_runtime_id,
|
||||
"title": note.title,
|
||||
"body": note.body,
|
||||
"tags": note.tags,
|
||||
}))?
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn parse_args(args: Vec<String>) -> BTreeMap<String, String> {
|
||||
let mut parsed = BTreeMap::new();
|
||||
let mut index = 0;
|
||||
while index < args.len() {
|
||||
let token = &args[index];
|
||||
if !token.starts_with("--") {
|
||||
index += 1;
|
||||
continue;
|
||||
}
|
||||
let name = token.trim_start_matches("--").to_string();
|
||||
let value = args
|
||||
.get(index + 1)
|
||||
.cloned()
|
||||
.unwrap_or_else(|| panic!("missing value for --{name}"));
|
||||
parsed.insert(name, value);
|
||||
index += 2;
|
||||
}
|
||||
parsed
|
||||
}
|
||||
|
||||
fn require_arg<'a>(options: &'a BTreeMap<String, String>, name: &str) -> Result<&'a str> {
|
||||
options
|
||||
.get(name)
|
||||
.map(String::as_str)
|
||||
.ok_or_else(|| anyhow!("missing required argument --{name}"))
|
||||
}
|
||||
919
vendor/cultcache-rs/src/lib.rs
vendored
919
vendor/cultcache-rs/src/lib.rs
vendored
|
|
@ -1,919 +0,0 @@
|
|||
use anyhow::Context;
|
||||
use anyhow::Result;
|
||||
use anyhow::anyhow;
|
||||
use serde::Serialize;
|
||||
use serde::de::DeserializeOwned;
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::BTreeSet;
|
||||
use std::fs;
|
||||
use std::fs::File;
|
||||
use std::fs::OpenOptions;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
|
||||
extern crate self as cultcache_rs;
|
||||
|
||||
pub use cultcache_rs_derive::DatabaseEntry;
|
||||
|
||||
pub trait DatabaseEntry: Serialize + DeserializeOwned + Clone + Send + 'static {
|
||||
const TYPE: &'static str;
|
||||
const SCHEMA_NAME: &'static str = "DatabaseEntry";
|
||||
}
|
||||
|
||||
pub trait CultCacheRegistry {
|
||||
fn register_entries(&self, cache: &mut CultCache) -> Result<()>;
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! cultcache_registry {
|
||||
($name:ident { $($entry:ty),* $(,)? }) => {
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
pub struct $name;
|
||||
|
||||
impl $crate::CultCacheRegistry for $name {
|
||||
fn register_entries(&self, cache: &mut $crate::CultCache) -> ::anyhow::Result<()> {
|
||||
$(
|
||||
cache.register_entry_type::<$entry>()?;
|
||||
)*
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CultCacheEnvelope {
|
||||
pub key: String,
|
||||
#[serde(rename = "type")]
|
||||
pub r#type: String,
|
||||
#[serde(with = "serde_bytes")]
|
||||
pub payload: Vec<u8>,
|
||||
pub stored_at: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub schema_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
||||
struct PersistedStoreSnapshot(
|
||||
String,
|
||||
Vec<PersistedSchemaCatalogEntry>,
|
||||
Vec<PersistedRecord>,
|
||||
);
|
||||
|
||||
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
||||
struct PersistedSchemaCatalogEntry(
|
||||
String,
|
||||
String,
|
||||
String,
|
||||
String,
|
||||
String,
|
||||
Vec<String>,
|
||||
Vec<PersistedSchemaCatalogMember>,
|
||||
);
|
||||
|
||||
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
||||
struct PersistedSchemaCatalogMember(
|
||||
u32,
|
||||
String,
|
||||
String,
|
||||
bool,
|
||||
bool,
|
||||
Option<String>,
|
||||
bool,
|
||||
Option<String>,
|
||||
);
|
||||
|
||||
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
||||
struct PersistedRecord(
|
||||
String,
|
||||
String,
|
||||
String,
|
||||
#[serde(with = "serde_bytes")] Vec<u8>,
|
||||
);
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||
pub struct PushAllOptions {
|
||||
pub soft: bool,
|
||||
}
|
||||
|
||||
pub trait CacheBackingStore: Send {
|
||||
fn pull_all(&self) -> Result<Vec<CultCacheEnvelope>>;
|
||||
fn push(&mut self, entry: &CultCacheEnvelope) -> Result<()>;
|
||||
fn delete(&mut self, entry: &CultCacheEnvelope) -> Result<()>;
|
||||
|
||||
fn push_all(&mut self, entries: &[CultCacheEnvelope], _options: PushAllOptions) -> Result<()> {
|
||||
let existing = self.pull_all()?;
|
||||
for entry in existing {
|
||||
self.delete(&entry)?;
|
||||
}
|
||||
for entry in entries {
|
||||
self.push(entry)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct SingleFileMessagePackBackingStore {
|
||||
path: PathBuf,
|
||||
}
|
||||
|
||||
impl SingleFileMessagePackBackingStore {
|
||||
pub fn new(path: impl Into<PathBuf>) -> Self {
|
||||
Self { path: path.into() }
|
||||
}
|
||||
|
||||
pub fn path(&self) -> &Path {
|
||||
&self.path
|
||||
}
|
||||
|
||||
fn read_all_unlocked(&self) -> Result<Vec<CultCacheEnvelope>> {
|
||||
if !self.path.exists() {
|
||||
return Ok(Vec::new());
|
||||
}
|
||||
let bytes = fs::read(&self.path)
|
||||
.with_context(|| format!("failed to read {}", self.path.display()))?;
|
||||
if bytes.is_empty() {
|
||||
return Ok(Vec::new());
|
||||
}
|
||||
decode_store_snapshot(&bytes)
|
||||
.or_else(|_| rmp_serde::from_slice(&bytes))
|
||||
.with_context(|| format!("failed to decode MessagePack {}", self.path.display()))
|
||||
}
|
||||
|
||||
fn write_all_unlocked(&self, entries: &[CultCacheEnvelope]) -> Result<()> {
|
||||
if let Some(parent) = self.path.parent() {
|
||||
fs::create_dir_all(parent)
|
||||
.with_context(|| format!("failed to create {}", parent.display()))?;
|
||||
}
|
||||
let bytes = rmp_serde::to_vec(&encode_store_snapshot(entries))
|
||||
.context("failed to encode MessagePack")?;
|
||||
let tmp_path = temporary_path_for(&self.path);
|
||||
fs::write(&tmp_path, bytes)
|
||||
.with_context(|| format!("failed to write {}", tmp_path.display()))?;
|
||||
if self.path.exists() {
|
||||
fs::remove_file(&self.path)
|
||||
.with_context(|| format!("failed to replace {}", self.path.display()))?;
|
||||
}
|
||||
fs::rename(&tmp_path, &self.path).with_context(|| {
|
||||
format!(
|
||||
"failed to move {} to {}",
|
||||
tmp_path.display(),
|
||||
self.path.display()
|
||||
)
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn with_shared_lock<T>(&self, action: impl FnOnce() -> Result<T>) -> Result<T> {
|
||||
let lock = self.open_lock_file()?;
|
||||
fs2::FileExt::lock_shared(&lock)
|
||||
.with_context(|| format!("failed to lock {}", self.lock_path().display()))?;
|
||||
let result = action();
|
||||
fs2::FileExt::unlock(&lock)
|
||||
.with_context(|| format!("failed to unlock {}", self.lock_path().display()))?;
|
||||
result
|
||||
}
|
||||
|
||||
fn with_exclusive_lock<T>(&self, action: impl FnOnce() -> Result<T>) -> Result<T> {
|
||||
let lock = self.open_lock_file()?;
|
||||
fs2::FileExt::lock_exclusive(&lock)
|
||||
.with_context(|| format!("failed to lock {}", self.lock_path().display()))?;
|
||||
let result = action();
|
||||
fs2::FileExt::unlock(&lock)
|
||||
.with_context(|| format!("failed to unlock {}", self.lock_path().display()))?;
|
||||
result
|
||||
}
|
||||
|
||||
fn open_lock_file(&self) -> Result<File> {
|
||||
let lock_path = self.lock_path();
|
||||
if let Some(parent) = lock_path.parent() {
|
||||
fs::create_dir_all(parent)
|
||||
.with_context(|| format!("failed to create {}", parent.display()))?;
|
||||
}
|
||||
OpenOptions::new()
|
||||
.create(true)
|
||||
.read(true)
|
||||
.truncate(false)
|
||||
.write(true)
|
||||
.open(&lock_path)
|
||||
.with_context(|| format!("failed to open {}", lock_path.display()))
|
||||
}
|
||||
|
||||
fn lock_path(&self) -> PathBuf {
|
||||
let mut lock_name = self
|
||||
.path
|
||||
.file_name()
|
||||
.map(|value| value.to_os_string())
|
||||
.unwrap_or_else(|| "cultcache.cc".into());
|
||||
lock_name.push(".lock");
|
||||
self.path.with_file_name(lock_name)
|
||||
}
|
||||
}
|
||||
|
||||
impl CacheBackingStore for SingleFileMessagePackBackingStore {
|
||||
fn pull_all(&self) -> Result<Vec<CultCacheEnvelope>> {
|
||||
self.with_shared_lock(|| self.read_all_unlocked())
|
||||
}
|
||||
|
||||
fn push(&mut self, entry: &CultCacheEnvelope) -> Result<()> {
|
||||
self.with_exclusive_lock(|| {
|
||||
let mut entries = self.read_all_unlocked()?;
|
||||
entries.retain(|candidate| entry_id(candidate) != entry_id(entry));
|
||||
entries.push(entry.clone());
|
||||
entries.sort_by_key(entry_id);
|
||||
self.write_all_unlocked(&entries)
|
||||
})
|
||||
}
|
||||
|
||||
fn delete(&mut self, entry: &CultCacheEnvelope) -> Result<()> {
|
||||
self.with_exclusive_lock(|| {
|
||||
let mut entries = self.read_all_unlocked()?;
|
||||
entries.retain(|candidate| entry_id(candidate) != entry_id(entry));
|
||||
self.write_all_unlocked(&entries)
|
||||
})
|
||||
}
|
||||
|
||||
fn push_all(&mut self, entries: &[CultCacheEnvelope], _options: PushAllOptions) -> Result<()> {
|
||||
self.with_exclusive_lock(|| {
|
||||
let mut entries = entries.to_vec();
|
||||
entries.sort_by_key(entry_id);
|
||||
self.write_all_unlocked(&entries)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
struct CultCacheStoreRegistration {
|
||||
store: Box<dyn CacheBackingStore>,
|
||||
types: BTreeSet<String>,
|
||||
}
|
||||
|
||||
pub struct CultCache {
|
||||
definitions: BTreeMap<String, &'static str>,
|
||||
entries: BTreeMap<String, CultCacheEnvelope>,
|
||||
stores: Vec<CultCacheStoreRegistration>,
|
||||
}
|
||||
|
||||
impl CultCache {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
definitions: BTreeMap::new(),
|
||||
entries: BTreeMap::new(),
|
||||
stores: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn register_entry_type<T: DatabaseEntry>(&mut self) -> Result<()> {
|
||||
if T::TYPE.trim().is_empty() {
|
||||
return Err(anyhow!(
|
||||
"CultCache entry types must declare a non-empty type"
|
||||
));
|
||||
}
|
||||
if let Some(existing_schema) = self.definitions.get(T::TYPE)
|
||||
&& *existing_schema != T::SCHEMA_NAME
|
||||
{
|
||||
return Err(anyhow!(
|
||||
"CultCache already has a different definition registered for type {:?}",
|
||||
T::TYPE
|
||||
));
|
||||
}
|
||||
self.definitions.insert(T::TYPE.to_string(), T::SCHEMA_NAME);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn register_document_type<T: DatabaseEntry>(&mut self) -> Result<()> {
|
||||
self.register_entry_type::<T>()
|
||||
}
|
||||
|
||||
pub fn register_registry<R: CultCacheRegistry>(&mut self, registry: R) -> Result<&mut Self> {
|
||||
registry.register_entries(self)?;
|
||||
Ok(self)
|
||||
}
|
||||
|
||||
pub fn add_backing_store(
|
||||
&mut self,
|
||||
store: impl CacheBackingStore + 'static,
|
||||
types: impl IntoIterator<Item = impl Into<String>>,
|
||||
) {
|
||||
self.stores.push(CultCacheStoreRegistration {
|
||||
store: Box::new(store),
|
||||
types: types.into_iter().map(Into::into).collect(),
|
||||
});
|
||||
}
|
||||
|
||||
pub fn add_generic_backing_store(&mut self, store: impl CacheBackingStore + 'static) {
|
||||
self.add_backing_store(store, Vec::<String>::new());
|
||||
}
|
||||
|
||||
pub fn pull_all_backing_stores(&mut self) -> Result<()> {
|
||||
self.entries.clear();
|
||||
let known_types: BTreeSet<String> = self.definitions.keys().cloned().collect();
|
||||
for registration in &mut self.stores {
|
||||
for entry in registration.store.pull_all()? {
|
||||
if !known_types.contains(&entry.r#type) {
|
||||
return Err(anyhow!(
|
||||
"No schema is registered for persisted entry type {:?}",
|
||||
entry.r#type
|
||||
));
|
||||
}
|
||||
self.entries.insert(entry_id(&entry), entry);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn get<T: DatabaseEntry>(&self, key: &str) -> Result<Option<T>> {
|
||||
self.require_entry_type::<T>()?;
|
||||
let Some(entry) = self.entries.get(&entry_id_parts(T::TYPE, key)) else {
|
||||
return Ok(None);
|
||||
};
|
||||
let payload = rmp_serde::from_slice(&entry.payload).with_context(|| {
|
||||
format!(
|
||||
"failed to decode CultCache entry {:?} at key {:?} as {}",
|
||||
T::TYPE,
|
||||
key,
|
||||
T::SCHEMA_NAME
|
||||
)
|
||||
})?;
|
||||
Ok(Some(payload))
|
||||
}
|
||||
|
||||
pub fn get_required<T: DatabaseEntry>(&self, key: &str) -> Result<T> {
|
||||
self.get::<T>(key)?
|
||||
.ok_or_else(|| anyhow!("CultCache has no {:?} entry at key {:?}", T::TYPE, key))
|
||||
}
|
||||
|
||||
pub fn get_envelope<T: DatabaseEntry>(&self, key: &str) -> Result<Option<CultCacheEnvelope>> {
|
||||
self.require_entry_type::<T>()?;
|
||||
Ok(self.entries.get(&entry_id_parts(T::TYPE, key)).cloned())
|
||||
}
|
||||
|
||||
pub fn get_required_envelope<T: DatabaseEntry>(&self, key: &str) -> Result<CultCacheEnvelope> {
|
||||
self.get_envelope::<T>(key)?
|
||||
.ok_or_else(|| anyhow!("CultCache has no {:?} envelope at key {:?}", T::TYPE, key))
|
||||
}
|
||||
|
||||
pub fn get_all<T: DatabaseEntry>(&self) -> Result<Vec<T>> {
|
||||
self.require_entry_type::<T>()?;
|
||||
let mut values = Vec::new();
|
||||
for entry in self.entries.values() {
|
||||
if entry.r#type != T::TYPE {
|
||||
continue;
|
||||
}
|
||||
values.push(rmp_serde::from_slice(&entry.payload).with_context(|| {
|
||||
format!(
|
||||
"failed to decode CultCache entry {:?} at key {:?} as {}",
|
||||
T::TYPE,
|
||||
entry.key,
|
||||
T::SCHEMA_NAME
|
||||
)
|
||||
})?);
|
||||
}
|
||||
Ok(values)
|
||||
}
|
||||
|
||||
pub fn put<T: DatabaseEntry>(&mut self, key: impl Into<String>, value: &T) -> Result<T> {
|
||||
self.require_entry_type::<T>()?;
|
||||
let key = key.into();
|
||||
let payload = rmp_serde::to_vec(value).with_context(|| {
|
||||
format!(
|
||||
"failed to encode CultCache entry {:?} at key {:?} as {}",
|
||||
T::TYPE,
|
||||
key,
|
||||
T::SCHEMA_NAME
|
||||
)
|
||||
})?;
|
||||
let parsed: T = rmp_serde::from_slice(&payload).with_context(|| {
|
||||
format!(
|
||||
"failed to validate CultCache entry {:?} at key {:?} as {}",
|
||||
T::TYPE,
|
||||
key,
|
||||
T::SCHEMA_NAME
|
||||
)
|
||||
})?;
|
||||
let entry = CultCacheEnvelope {
|
||||
key: key.clone(),
|
||||
r#type: T::TYPE.to_string(),
|
||||
payload,
|
||||
stored_at: now_utc_second(),
|
||||
schema_id: Some(T::TYPE.to_string()),
|
||||
};
|
||||
let route = self.resolve_route_indices(T::TYPE);
|
||||
let Some(primary_index) = route.first().copied() else {
|
||||
return Err(anyhow!(
|
||||
"No backing store is registered for entry type {:?}",
|
||||
T::TYPE
|
||||
));
|
||||
};
|
||||
self.stores[primary_index].store.push(&entry)?;
|
||||
for mirror_index in route.iter().skip(1).copied() {
|
||||
self.stores[mirror_index].store.push(&entry)?;
|
||||
}
|
||||
self.entries.insert(entry_id(&entry), entry);
|
||||
Ok(parsed)
|
||||
}
|
||||
|
||||
pub fn put_envelope<T: DatabaseEntry>(&mut self, entry: CultCacheEnvelope) -> Result<T> {
|
||||
self.require_entry_type::<T>()?;
|
||||
if entry.r#type != T::TYPE {
|
||||
return Err(anyhow!(
|
||||
"CultCache envelope type {:?} does not match registered Rust type {:?}",
|
||||
entry.r#type,
|
||||
T::TYPE
|
||||
));
|
||||
}
|
||||
if entry.key.trim().is_empty() {
|
||||
return Err(anyhow!(
|
||||
"CultCache envelope keys for type {:?} must be non-empty",
|
||||
T::TYPE
|
||||
));
|
||||
}
|
||||
if entry.stored_at.trim().is_empty() {
|
||||
return Err(anyhow!(
|
||||
"CultCache envelope stored_at for type {:?} must be non-empty",
|
||||
T::TYPE
|
||||
));
|
||||
}
|
||||
|
||||
let parsed: T = rmp_serde::from_slice(&entry.payload).with_context(|| {
|
||||
format!(
|
||||
"failed to validate CultCache envelope {:?} at key {:?} as {}",
|
||||
T::TYPE,
|
||||
entry.key,
|
||||
T::SCHEMA_NAME
|
||||
)
|
||||
})?;
|
||||
let route = self.resolve_route_indices(T::TYPE);
|
||||
let Some(primary_index) = route.first().copied() else {
|
||||
return Err(anyhow!(
|
||||
"No backing store is registered for entry type {:?}",
|
||||
T::TYPE
|
||||
));
|
||||
};
|
||||
self.stores[primary_index].store.push(&entry)?;
|
||||
for mirror_index in route.iter().skip(1).copied() {
|
||||
self.stores[mirror_index].store.push(&entry)?;
|
||||
}
|
||||
self.entries.insert(entry_id(&entry), entry);
|
||||
Ok(parsed)
|
||||
}
|
||||
|
||||
pub fn put_raw_envelope(&mut self, entry: CultCacheEnvelope) -> Result<()> {
|
||||
if !self.definitions.contains_key(&entry.r#type) {
|
||||
return Err(anyhow!(
|
||||
"No entry type registered for CultCache envelope type {:?}",
|
||||
entry.r#type
|
||||
));
|
||||
}
|
||||
if entry.key.trim().is_empty() {
|
||||
return Err(anyhow!(
|
||||
"CultCache envelope keys for type {:?} must be non-empty",
|
||||
entry.r#type
|
||||
));
|
||||
}
|
||||
if entry.stored_at.trim().is_empty() {
|
||||
return Err(anyhow!(
|
||||
"CultCache envelope stored_at for type {:?} must be non-empty",
|
||||
entry.r#type
|
||||
));
|
||||
}
|
||||
let route = self.resolve_route_indices(&entry.r#type);
|
||||
let Some(primary_index) = route.first().copied() else {
|
||||
return Err(anyhow!(
|
||||
"No backing store is registered for entry type {:?}",
|
||||
entry.r#type
|
||||
));
|
||||
};
|
||||
self.stores[primary_index].store.push(&entry)?;
|
||||
for mirror_index in route.iter().skip(1).copied() {
|
||||
self.stores[mirror_index].store.push(&entry)?;
|
||||
}
|
||||
self.entries.insert(entry_id(&entry), entry);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn update<T, F>(&mut self, key: &str, updater: F) -> Result<T>
|
||||
where
|
||||
T: DatabaseEntry,
|
||||
F: FnOnce(Option<T>) -> T,
|
||||
{
|
||||
let current = self.get::<T>(key)?;
|
||||
self.put::<T>(key.to_string(), &updater(current))
|
||||
}
|
||||
|
||||
pub fn delete<T: DatabaseEntry>(&mut self, key: &str) -> Result<bool> {
|
||||
self.require_entry_type::<T>()?;
|
||||
let id = entry_id_parts(T::TYPE, key);
|
||||
let Some(entry) = self.entries.get(&id).cloned() else {
|
||||
return Ok(false);
|
||||
};
|
||||
let route = self.resolve_route_indices(T::TYPE);
|
||||
let Some(primary_index) = route.first().copied() else {
|
||||
return Err(anyhow!(
|
||||
"No backing store is registered for entry type {:?}",
|
||||
T::TYPE
|
||||
));
|
||||
};
|
||||
self.stores[primary_index].store.delete(&entry)?;
|
||||
for mirror_index in route.iter().skip(1).copied() {
|
||||
self.stores[mirror_index].store.delete(&entry)?;
|
||||
}
|
||||
self.entries.remove(&id);
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
pub fn snapshot(&self) -> Vec<CultCacheEnvelope> {
|
||||
self.entries.values().cloned().collect()
|
||||
}
|
||||
|
||||
fn require_entry_type<T: DatabaseEntry>(&self) -> Result<()> {
|
||||
match self.definitions.get(T::TYPE) {
|
||||
Some(schema_name) if *schema_name == T::SCHEMA_NAME => Ok(()),
|
||||
_ => Err(anyhow!(
|
||||
"CultCache entry type {:?} is not registered on this cache instance",
|
||||
T::TYPE
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
fn resolve_route_indices(&self, type_id: &str) -> Vec<usize> {
|
||||
let type_specific: Vec<usize> = self
|
||||
.stores
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter_map(|(index, registration)| {
|
||||
registration.types.contains(type_id).then_some(index)
|
||||
})
|
||||
.collect();
|
||||
if !type_specific.is_empty() {
|
||||
return type_specific;
|
||||
}
|
||||
self.stores
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter_map(|(index, registration)| registration.types.is_empty().then_some(index))
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for CultCache {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
fn entry_id(entry: &CultCacheEnvelope) -> String {
|
||||
entry_id_parts(&entry.r#type, &entry.key)
|
||||
}
|
||||
|
||||
fn entry_id_parts(r#type: &str, key: &str) -> String {
|
||||
format!("{type}::{key}", type = r#type)
|
||||
}
|
||||
|
||||
fn now_utc_second() -> String {
|
||||
chrono::Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Secs, true)
|
||||
}
|
||||
|
||||
fn encode_store_snapshot(entries: &[CultCacheEnvelope]) -> PersistedStoreSnapshot {
|
||||
let mut schema_names = BTreeMap::<String, String>::new();
|
||||
for entry in entries {
|
||||
schema_names.insert(
|
||||
entry
|
||||
.schema_id
|
||||
.clone()
|
||||
.unwrap_or_else(|| entry.r#type.clone()),
|
||||
entry.r#type.clone(),
|
||||
);
|
||||
}
|
||||
|
||||
let catalog = schema_names
|
||||
.into_iter()
|
||||
.map(|(schema_id, document_type)| {
|
||||
PersistedSchemaCatalogEntry(
|
||||
schema_id.clone(),
|
||||
document_type,
|
||||
format!("{schema_id}.v1"),
|
||||
schema_id.clone(),
|
||||
format!(
|
||||
"{{\"schemaName\":\"{}\",\"schemaVersion\":\"{}.v1\",\"members\":[]}}",
|
||||
escape_json_string(&schema_id),
|
||||
escape_json_string(&schema_id)
|
||||
),
|
||||
vec![schema_id],
|
||||
Vec::new(),
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
let records = entries
|
||||
.iter()
|
||||
.map(|entry| {
|
||||
PersistedRecord(
|
||||
entry.key.clone(),
|
||||
entry
|
||||
.schema_id
|
||||
.clone()
|
||||
.unwrap_or_else(|| entry.r#type.clone()),
|
||||
entry.stored_at.clone(),
|
||||
entry.payload.clone(),
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
|
||||
PersistedStoreSnapshot("cultcache.store.v1".to_string(), catalog, records)
|
||||
}
|
||||
|
||||
fn decode_store_snapshot(bytes: &[u8]) -> Result<Vec<CultCacheEnvelope>> {
|
||||
let snapshot: PersistedStoreSnapshot =
|
||||
rmp_serde::from_slice(bytes).context("failed to decode CultCache v1 snapshot")?;
|
||||
if snapshot.0 != "cultcache.store.v1" {
|
||||
return Err(anyhow!("unsupported CultCache snapshot {}", snapshot.0));
|
||||
}
|
||||
|
||||
let catalog = snapshot
|
||||
.1
|
||||
.into_iter()
|
||||
.map(|entry| (entry.0, entry.1))
|
||||
.collect::<BTreeMap<_, _>>();
|
||||
snapshot
|
||||
.2
|
||||
.into_iter()
|
||||
.map(|record| {
|
||||
let r#type = catalog.get(&record.1).cloned().ok_or_else(|| {
|
||||
anyhow!(
|
||||
"CultCache record {:?} references missing schema {:?}",
|
||||
record.0,
|
||||
record.1
|
||||
)
|
||||
})?;
|
||||
Ok(CultCacheEnvelope {
|
||||
key: record.0,
|
||||
r#type,
|
||||
stored_at: record.2,
|
||||
payload: record.3,
|
||||
schema_id: Some(record.1),
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn escape_json_string(value: &str) -> String {
|
||||
value.replace('\\', "\\\\").replace('"', "\\\"")
|
||||
}
|
||||
|
||||
fn temporary_path_for(path: &Path) -> PathBuf {
|
||||
let mut file_name = path
|
||||
.file_name()
|
||||
.map(|value| value.to_os_string())
|
||||
.unwrap_or_else(|| "cultcache.cc".into());
|
||||
file_name.push(format!(".{}.tmp", uuid::Uuid::new_v4()));
|
||||
path.with_file_name(file_name)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
|
||||
#[cultcache(type = "settings")]
|
||||
struct Settings {
|
||||
#[cultcache(key = 0)]
|
||||
theme: String,
|
||||
#[cultcache(key = 1, default)]
|
||||
retries: u32,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
|
||||
#[cultcache(type = "note")]
|
||||
struct Note {
|
||||
#[cultcache(key = 0)]
|
||||
title: String,
|
||||
#[cultcache(key = 1)]
|
||||
body: String,
|
||||
}
|
||||
|
||||
cultcache_registry!(TestEntries { Settings, Note });
|
||||
|
||||
#[test]
|
||||
fn familiar_cultcache_flow_persists_and_reloads_typed_documents() -> Result<()> {
|
||||
let temp = tempfile::tempdir()?;
|
||||
let store_path = temp.path().join("cache.cc");
|
||||
let settings = Settings {
|
||||
theme: "ash".to_string(),
|
||||
retries: 3,
|
||||
};
|
||||
|
||||
let mut cache = CultCache::new();
|
||||
cache.register_entry_type::<Settings>()?;
|
||||
cache.add_generic_backing_store(SingleFileMessagePackBackingStore::new(&store_path));
|
||||
cache.pull_all_backing_stores()?;
|
||||
cache.put("app", &settings)?;
|
||||
assert_eq!(cache.get_required::<Settings>("app")?, settings);
|
||||
|
||||
let mut reloaded = CultCache::new();
|
||||
reloaded.register_entry_type::<Settings>()?;
|
||||
reloaded.add_generic_backing_store(SingleFileMessagePackBackingStore::new(&store_path));
|
||||
reloaded.pull_all_backing_stores()?;
|
||||
assert_eq!(reloaded.get_required::<Settings>("app")?, settings);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn entry_identity_is_polymorphic_by_type_and_key() -> Result<()> {
|
||||
let temp = tempfile::tempdir()?;
|
||||
let store_path = temp.path().join("cache.cc");
|
||||
let mut cache = CultCache::new();
|
||||
cache.register_registry(TestEntries)?;
|
||||
cache.add_generic_backing_store(SingleFileMessagePackBackingStore::new(&store_path));
|
||||
|
||||
cache.put(
|
||||
"shared",
|
||||
&Settings {
|
||||
theme: "green".to_string(),
|
||||
retries: 1,
|
||||
},
|
||||
)?;
|
||||
cache.put(
|
||||
"shared",
|
||||
&Note {
|
||||
title: "same key".to_string(),
|
||||
body: "different type".to_string(),
|
||||
},
|
||||
)?;
|
||||
|
||||
assert_eq!(cache.snapshot().len(), 2);
|
||||
assert_eq!(cache.get_required::<Note>("shared")?.title, "same key");
|
||||
assert_eq!(cache.get_required::<Settings>("shared")?.theme, "green");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn type_specific_store_routes_before_generic_store() -> Result<()> {
|
||||
let temp = tempfile::tempdir()?;
|
||||
let generic_path = temp.path().join("generic.cc");
|
||||
let settings_path = temp.path().join("settings.cc");
|
||||
let mut cache = CultCache::new();
|
||||
cache.register_entry_type::<Settings>()?;
|
||||
cache.register_entry_type::<Note>()?;
|
||||
cache.add_generic_backing_store(SingleFileMessagePackBackingStore::new(&generic_path));
|
||||
cache.add_backing_store(
|
||||
SingleFileMessagePackBackingStore::new(&settings_path),
|
||||
["settings"],
|
||||
);
|
||||
|
||||
cache.put(
|
||||
"app",
|
||||
&Settings {
|
||||
theme: "ash".to_string(),
|
||||
retries: 3,
|
||||
},
|
||||
)?;
|
||||
cache.put(
|
||||
"memo",
|
||||
&Note {
|
||||
title: "hello".to_string(),
|
||||
body: "world".to_string(),
|
||||
},
|
||||
)?;
|
||||
|
||||
let generic_entries = SingleFileMessagePackBackingStore::new(&generic_path).pull_all()?;
|
||||
let settings_entries = SingleFileMessagePackBackingStore::new(&settings_path).pull_all()?;
|
||||
assert_eq!(generic_entries[0].r#type, "note");
|
||||
assert_eq!(settings_entries[0].r#type, "settings");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn update_and_delete_follow_the_cache_api() -> Result<()> {
|
||||
let temp = tempfile::tempdir()?;
|
||||
let store_path = temp.path().join("cache.cc");
|
||||
let mut cache = CultCache::new();
|
||||
cache.register_entry_type::<Settings>()?;
|
||||
cache.add_generic_backing_store(SingleFileMessagePackBackingStore::new(&store_path));
|
||||
|
||||
let updated = cache.update::<Settings, _>("app", |current| {
|
||||
let mut current = current.unwrap_or(Settings {
|
||||
theme: "ash".to_string(),
|
||||
retries: 0,
|
||||
});
|
||||
current.retries += 1;
|
||||
current
|
||||
})?;
|
||||
assert_eq!(updated.retries, 1);
|
||||
assert!(cache.delete::<Settings>("app")?);
|
||||
assert!(cache.get::<Settings>("app")?.is_none());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pull_rejects_unregistered_persisted_entry_type() -> Result<()> {
|
||||
let temp = tempfile::tempdir()?;
|
||||
let store_path = temp.path().join("cache.cc");
|
||||
let mut store = SingleFileMessagePackBackingStore::new(&store_path);
|
||||
store.push(&CultCacheEnvelope {
|
||||
key: "unknown".to_string(),
|
||||
r#type: "unregistered".to_string(),
|
||||
payload: rmp_serde::to_vec(&1_u8)?,
|
||||
stored_at: now_utc_second(),
|
||||
schema_id: Some("unregistered".to_string()),
|
||||
})?;
|
||||
|
||||
let mut cache = CultCache::new();
|
||||
cache.add_generic_backing_store(SingleFileMessagePackBackingStore::new(&store_path));
|
||||
let error = cache.pull_all_backing_stores().unwrap_err();
|
||||
assert!(
|
||||
error
|
||||
.to_string()
|
||||
.contains("No schema is registered for persisted entry type")
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn payload_is_binary_messagepack_not_json_value() -> Result<()> {
|
||||
let temp = tempfile::tempdir()?;
|
||||
let store_path = temp.path().join("cache.cc");
|
||||
let mut cache = CultCache::new();
|
||||
cache.register_entry_type::<Settings>()?;
|
||||
cache.add_generic_backing_store(SingleFileMessagePackBackingStore::new(&store_path));
|
||||
cache.put(
|
||||
"app",
|
||||
&Settings {
|
||||
theme: "ash".to_string(),
|
||||
retries: 3,
|
||||
},
|
||||
)?;
|
||||
|
||||
let entry = cache.snapshot().remove(0);
|
||||
let decoded: Settings = rmp_serde::from_slice(&entry.payload)?;
|
||||
assert_eq!(decoded.theme, "ash");
|
||||
assert!(!entry.payload.is_empty());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn corrupted_payload_fails_during_typed_retrieval() -> Result<()> {
|
||||
let temp = tempfile::tempdir()?;
|
||||
let store_path = temp.path().join("cache.cc");
|
||||
let mut store = SingleFileMessagePackBackingStore::new(&store_path);
|
||||
store.push(&CultCacheEnvelope {
|
||||
key: "app".to_string(),
|
||||
r#type: "settings".to_string(),
|
||||
payload: vec![0xc1],
|
||||
stored_at: now_utc_second(),
|
||||
schema_id: Some("settings".to_string()),
|
||||
})?;
|
||||
|
||||
let mut cache = CultCache::new();
|
||||
cache.register_entry_type::<Settings>()?;
|
||||
cache.add_generic_backing_store(SingleFileMessagePackBackingStore::new(&store_path));
|
||||
cache.pull_all_backing_stores()?;
|
||||
let error = cache.get_required::<Settings>("app").unwrap_err();
|
||||
assert!(
|
||||
error
|
||||
.to_string()
|
||||
.contains("failed to decode CultCache entry")
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn put_envelope_reuses_existing_messagepack_payload() -> Result<()> {
|
||||
let temp = tempfile::tempdir()?;
|
||||
let origin_store = temp.path().join("origin.cc");
|
||||
let target_store = temp.path().join("target.cc");
|
||||
|
||||
let mut origin = CultCache::new();
|
||||
origin.register_entry_type::<Settings>()?;
|
||||
origin.add_generic_backing_store(SingleFileMessagePackBackingStore::new(&origin_store));
|
||||
origin.put(
|
||||
"app",
|
||||
&Settings {
|
||||
theme: "ash".to_string(),
|
||||
retries: 3,
|
||||
},
|
||||
)?;
|
||||
|
||||
let envelope = origin.get_required_envelope::<Settings>("app")?;
|
||||
|
||||
let mut target = CultCache::new();
|
||||
target.register_entry_type::<Settings>()?;
|
||||
target.add_generic_backing_store(SingleFileMessagePackBackingStore::new(&target_store));
|
||||
let applied = target.put_envelope::<Settings>(envelope.clone())?;
|
||||
|
||||
assert_eq!(
|
||||
applied,
|
||||
Settings {
|
||||
theme: "ash".to_string(),
|
||||
retries: 3,
|
||||
}
|
||||
);
|
||||
assert_eq!(target.get_required::<Settings>("app")?, applied);
|
||||
assert_eq!(
|
||||
target.get_required_envelope::<Settings>("app")?.payload,
|
||||
envelope.payload
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
1233
vendor/cultmesh-rs/Cargo.lock
generated
vendored
1233
vendor/cultmesh-rs/Cargo.lock
generated
vendored
File diff suppressed because it is too large
Load diff
20
vendor/cultmesh-rs/Cargo.toml
vendored
20
vendor/cultmesh-rs/Cargo.toml
vendored
|
|
@ -1,20 +0,0 @@
|
|||
[package]
|
||||
name = "cultmesh-rs"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
name = "cultmesh_rs"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
cultcache-rs = { path = "../cultcache-rs" }
|
||||
cultnet-rs = { path = "../cultnet-rs" }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
|
||||
[dev-dependencies]
|
||||
pretty_assertions = "1.4.1"
|
||||
rmp-serde = "1"
|
||||
tempfile = "3"
|
||||
1261
vendor/cultmesh-rs/src/lib.rs
vendored
1261
vendor/cultmesh-rs/src/lib.rs
vendored
File diff suppressed because it is too large
Load diff
2
vendor/cultnet-rs/.gitignore
vendored
2
vendor/cultnet-rs/.gitignore
vendored
|
|
@ -1,2 +0,0 @@
|
|||
/target
|
||||
Cargo.lock
|
||||
32
vendor/cultnet-rs/Cargo.toml
vendored
32
vendor/cultnet-rs/Cargo.toml
vendored
|
|
@ -1,32 +0,0 @@
|
|||
[package]
|
||||
name = "cultnet-rs"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
license = "MIT"
|
||||
description = "CultNet-style typed MessagePack messaging, direct-pipe framing, security helpers, and CultCache replication for Rust runtimes."
|
||||
|
||||
[lib]
|
||||
name = "cultnet_rs"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
aes-gcm = "0.10"
|
||||
anyhow = "1"
|
||||
base64 = "0.22"
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
cultcache-rs = { path = "../cultcache-rs" }
|
||||
hmac = "0.12"
|
||||
rand = "0.9"
|
||||
rmp-serde = "1.3"
|
||||
rmpv = { version = "1.3", features = ["with-serde"] }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_bytes = "0.11"
|
||||
serde_json = "1"
|
||||
sha2 = "0.10"
|
||||
socket2 = "0.5"
|
||||
uuid = { version = "1", features = ["v4"] }
|
||||
|
||||
[dev-dependencies]
|
||||
pretty_assertions = "1.4"
|
||||
tempfile = "3"
|
||||
96
vendor/cultnet-rs/README.md
vendored
96
vendor/cultnet-rs/README.md
vendored
|
|
@ -1,96 +0,0 @@
|
|||
# CultNet RS
|
||||
|
||||
`cultnet-rs` is the Rust sibling of `cultnet-ts`: typed MessagePack messages,
|
||||
4-byte length-prefixed direct-pipe framing, stop-and-wait RUDP message delivery,
|
||||
CultLib-shaped security helpers, and CultCache replication without making
|
||||
callers paw through raw envelopes like we lost a bet.
|
||||
|
||||
The contract is intentionally boring:
|
||||
|
||||
- `cultnet.schema.v0` sends schema-versioned MessagePack objects.
|
||||
- `gamecult.networking.v0` maps the legacy C# union shape explicitly.
|
||||
- schema discovery uses explicit catalog request/response messages; no inbound
|
||||
auto-detect sludge.
|
||||
- document put/delete/snapshot messages move typed CultCache entries.
|
||||
- raw document put/snapshot messages preserve canonical MessagePack payload
|
||||
bytes for bit-compatible neighbors.
|
||||
- `cultnet.transport.rudp.v0` carries one CultNet message per acknowledged UDP
|
||||
datagram with timeout/retry semantics.
|
||||
- hello messages advertise `supportedMutationContracts`, so callers discover
|
||||
which document types are read-only, which accept typed intents, which
|
||||
authority owns the mutation, and which receipt documents prove the outcome.
|
||||
- payloads are decoded through registered Rust types before entering the cache.
|
||||
|
||||
This crate is not an HTTP wrapper. It is the wire vocabulary Epiphany,
|
||||
Ghostlight, VoidBot, and the rest of the swarm can share.
|
||||
|
||||
The public API surface is the schema plus its mutation contracts. A runtime does
|
||||
not expose a pile of bespoke verbs and hope everyone remembers the ritual; it
|
||||
advertises typed documents, typed intents, and typed receipts. Polite machines
|
||||
knock on the contract before touching the furniture.
|
||||
|
||||
## Receipts
|
||||
|
||||
```powershell
|
||||
cargo test
|
||||
```
|
||||
|
||||
The initial tests prove:
|
||||
|
||||
- CultLib-compatible AES-GCM string encryption and HMAC session tokens
|
||||
- 4-byte big-endian MessagePack framing
|
||||
- schema-versioned message round trips
|
||||
- legacy `gamecult.networking.v0` login mapping
|
||||
- schema discovery catalog responses with canonical JSON schema hashes
|
||||
- CultCache snapshot replication through registered typed documents
|
||||
- raw snapshot replication that preserves the original payload bytes
|
||||
- document mutation contract advertisement through hello frames and registries
|
||||
- acknowledged localhost UDP delivery through `cultnet.transport.rudp.v0`
|
||||
|
||||
## RUDP Transport
|
||||
|
||||
`cultnet.transport.rudp.v0` is the Rust crate's first non-TCP daemon transport.
|
||||
It is intentionally small: one CultNet message becomes one UDP data packet, the
|
||||
receiver sends an acknowledgement packet, and the sender retries until the ack
|
||||
arrives or the retry budget is spent.
|
||||
|
||||
This is a daemon health/control substrate, not a bulk stream transport. It does
|
||||
not fragment oversized messages, multiplex streams, or promise congestion
|
||||
control. Large snapshots should stay in CultCache/CultMesh storage and move by
|
||||
document reference or a later chunking contract. The useful invariant is simple:
|
||||
Rust runtimes can now move a typed CultNet message across UDP without reaching
|
||||
for TCP as the hidden truth path.
|
||||
|
||||
## Schema Discovery
|
||||
|
||||
`cultnet-rs` now ships a built-in schema registry for the shared swarm contract
|
||||
surface:
|
||||
|
||||
- core wire messages
|
||||
- legacy `gamecult.networking.v0` auth/sample payloads
|
||||
- schema catalog request/response messages
|
||||
- the canonical `ghostlight.agent-state` document payload schema
|
||||
|
||||
Use `builtin_schema_registry()` when you want the standard catalog, or register
|
||||
your own closed-world schema set with `CultNetSchemaRegistry`. Discovery stays
|
||||
explicit on purpose: peers advertise only the contracts they were compiled to
|
||||
understand, the same way CultCache only consumes the document types you
|
||||
registered instead of pretending polymorphism is a public park.
|
||||
|
||||
## Local Fast Lane
|
||||
|
||||
`cultnet-rs` now mirrors the raw replication seam from `cultnet-ts`:
|
||||
|
||||
- `cultnet.document_put_raw.v0`
|
||||
- `cultnet.snapshot_response_raw.v0`
|
||||
|
||||
Those messages carry the exact persisted MessagePack payload bytes from
|
||||
CultCache along with the typed envelope metadata. Combined with
|
||||
`CultCache::put_envelope::<T>()`, that lets a bit-compatible neighbor ingest the
|
||||
document without re-encoding the payload first.
|
||||
|
||||
That still is not zero-copy in the religious sense. Frames allocate, bytes move,
|
||||
and the receiving cache still decodes once to keep typed reads and validation
|
||||
honest. The win is narrower and realer: identical payload bytes stop getting
|
||||
decoded into generic sludge and then encoded right back into the same bytes for
|
||||
no reason.
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://github.com/GameCult/cultnet-ts/contracts/cultnet.document-delete.schema.json",
|
||||
"title": "CultNet Document Delete Message",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"schemaVersion",
|
||||
"messageId",
|
||||
"schemaId",
|
||||
"recordKey"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"schemaVersion": { "const": "cultnet.document_delete.v0" },
|
||||
"messageId": { "type": "string", "minLength": 1 },
|
||||
"schemaId": { "type": "string", "minLength": 1 },
|
||||
"recordKey": { "type": "string", "minLength": 1 }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://github.com/GameCult/cultnet-ts/contracts/cultnet.document-mutation-contract.schema.json",
|
||||
"title": "CultNet Document Mutation Contract",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"documentType",
|
||||
"operations",
|
||||
"authority"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"documentType": { "type": "string", "minLength": 1 },
|
||||
"payloadSchemaVersion": { "type": "string", "minLength": 1 },
|
||||
"operations": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": ["snapshot", "documentPut", "documentDelete", "intentSubmit", "receiptWatch"]
|
||||
}
|
||||
},
|
||||
"authority": {
|
||||
"type": "string",
|
||||
"enum": ["readOnly", "localUser", "coordinator", "runtime", "denied"]
|
||||
},
|
||||
"intentDocumentTypes": {
|
||||
"type": "array",
|
||||
"items": { "type": "string", "minLength": 1 }
|
||||
},
|
||||
"receiptDocumentTypes": {
|
||||
"type": "array",
|
||||
"items": { "type": "string", "minLength": 1 }
|
||||
},
|
||||
"notes": {
|
||||
"type": "array",
|
||||
"items": { "type": "string", "minLength": 1 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://github.com/GameCult/cultnet-ts/contracts/cultnet.document-put-raw.schema.json",
|
||||
"title": "CultNet Raw Document Put Message",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"schemaVersion",
|
||||
"messageId",
|
||||
"document"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"schemaVersion": { "const": "cultnet.document_put_raw.v0" },
|
||||
"messageId": { "type": "string", "minLength": 1 },
|
||||
"document": {
|
||||
"$ref": "./cultnet.raw-document-record.schema.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://github.com/GameCult/cultnet-ts/contracts/cultnet.document-put.schema.json",
|
||||
"title": "CultNet Document Put Message",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"schemaVersion",
|
||||
"messageId",
|
||||
"document"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"schemaVersion": { "const": "cultnet.document_put.v0" },
|
||||
"messageId": { "type": "string", "minLength": 1 },
|
||||
"document": {
|
||||
"$ref": "./cultnet.document-record.schema.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://github.com/GameCult/cultnet-ts/contracts/cultnet.document-record.schema.json",
|
||||
"title": "CultNet Document Record",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"schemaId",
|
||||
"recordKey",
|
||||
"storedAt",
|
||||
"payload"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"schemaId": { "type": "string", "minLength": 1 },
|
||||
"recordKey": { "type": "string", "minLength": 1 },
|
||||
"storedAt": { "type": "string", "minLength": 1 },
|
||||
"payload": {},
|
||||
"sourceRuntimeId": { "type": "string", "minLength": 1 },
|
||||
"sourceAgentId": { "type": "string", "minLength": 1 },
|
||||
"sourceRole": { "type": "string", "minLength": 1 },
|
||||
"tags": {
|
||||
"type": "array",
|
||||
"items": { "type": "string", "minLength": 1 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://github.com/GameCult/cultnet-ts/contracts/cultnet.error.schema.json",
|
||||
"title": "CultNet Error Message",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"schemaVersion",
|
||||
"error"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"schemaVersion": { "const": "cultnet.error.v0" },
|
||||
"error": { "type": "string", "minLength": 1 }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://github.com/GameCult/cultnet-ts/contracts/cultnet.hello.schema.json",
|
||||
"title": "CultNet Hello Message",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"schemaVersion",
|
||||
"runtimeId",
|
||||
"runtimeKind"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"schemaVersion": { "const": "cultnet.hello.v0" },
|
||||
"runtimeId": { "type": "string", "minLength": 1 },
|
||||
"runtimeKind": { "type": "string", "minLength": 1 },
|
||||
"agentId": { "type": "string", "minLength": 1 },
|
||||
"role": { "type": "string", "minLength": 1 },
|
||||
"displayName": { "type": "string", "minLength": 1 },
|
||||
"supportedDocumentTypes": {
|
||||
"type": "array",
|
||||
"items": { "type": "string", "minLength": 1 }
|
||||
},
|
||||
"supportedMutationContracts": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "./cultnet.document-mutation-contract.schema.json"
|
||||
}
|
||||
},
|
||||
"supportedMessageVersions": {
|
||||
"type": "array",
|
||||
"items": { "type": "string", "minLength": 1 }
|
||||
},
|
||||
"transportProfiles": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "./cultnet.transport-profile.schema.json"
|
||||
}
|
||||
},
|
||||
"supportsSchemaCatalog": { "type": "boolean" }
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue