Delete obsolete snapshot asset client
This commit is contained in:
parent
57def92a52
commit
580a4c37b8
3 changed files with 6 additions and 63 deletions
|
|
@ -61,7 +61,6 @@ import {
|
|||
} from "./aetheria-rts-local-documents.js";
|
||||
|
||||
const connectionId = 0x43554c54;
|
||||
const cultMeshCdnAssetBlobSchemaId = "gamecult.cultmesh.cdn.asset_blob.v1";
|
||||
|
||||
type AetheriaPublicationDocumentSpec = CultMeshPublicationDocumentBinding & {
|
||||
readonly localPath: string;
|
||||
|
|
@ -272,33 +271,6 @@ export class AetheriaCultMeshClient {
|
|||
return this.aetheria.daemon.assetManifest();
|
||||
}
|
||||
|
||||
public async assetBlob(uri: string): Promise<{ bytes: Uint8Array; mimeType: string }> {
|
||||
const recordKey = normalizeCultMeshAssetUri(uri);
|
||||
const document = CultMesh.documentFromPublication(
|
||||
{
|
||||
kind: "peer-snapshot",
|
||||
peer: () => this.peer(),
|
||||
endpoint: this.resolvedRudpEndpoint(),
|
||||
},
|
||||
cultMeshCdnAssetBlobSchemaId,
|
||||
recordKey,
|
||||
{
|
||||
documentId: recordKey,
|
||||
routeHint: this.queryVerse.context.routeHint,
|
||||
sourceId: recordKey,
|
||||
timeoutMs: 1500,
|
||||
pollMs: 50,
|
||||
messageIdPrefix: `${this.runtimeId}:asset`,
|
||||
},
|
||||
);
|
||||
const bytes = normalizeAssetBlob(await document.latest(this.queryContext()));
|
||||
const manifest = await this.assetManifest().catch(() => null);
|
||||
return {
|
||||
bytes,
|
||||
mimeType: resolveAssetMimeType(recordKey, manifest),
|
||||
};
|
||||
}
|
||||
|
||||
public queryDiagnostics(): Readonly<Record<string, AetheriaRuntimeGameQueryDiagnostic>> {
|
||||
return describeAetheriaRuntimeGameQueryHandles(this.queries);
|
||||
}
|
||||
|
|
@ -623,14 +595,6 @@ function normalizeDaemonTarget(target: string | AetheriaCultMeshDaemonTarget): R
|
|||
};
|
||||
}
|
||||
|
||||
function normalizeCultMeshAssetUri(uri: string): string {
|
||||
const value = (uri ?? "").trim();
|
||||
if (!value.toLowerCase().startsWith("cultmesh://")) {
|
||||
throw new Error(`Aetheria asset URI must be CultMesh-native: ${value}`);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
function managedViewportRecordKey(prefix: string, request: ViewportRequest): string {
|
||||
const minX = Math.min(finiteNumber(request.minX), finiteNumber(request.maxX));
|
||||
const minY = Math.min(finiteNumber(request.minY), finiteNumber(request.maxY));
|
||||
|
|
@ -651,30 +615,6 @@ function finiteNumber(value: unknown): number {
|
|||
return typeof value === "number" && Number.isFinite(value) ? value : 0;
|
||||
}
|
||||
|
||||
function normalizeAssetBlob(value: unknown): Uint8Array {
|
||||
if (value instanceof Uint8Array)
|
||||
return value;
|
||||
if (Array.isArray(value))
|
||||
return Uint8Array.from(value.map(entry => typeof entry === "number" ? entry : 0));
|
||||
throw new Error("Aetheria CultMesh CDN asset blob did not decode to bytes.");
|
||||
}
|
||||
|
||||
function resolveAssetMimeType(recordKey: string, manifest: AssetManifestDocument | null): string {
|
||||
const entry = manifest?.assets.find(candidate => candidate.ref.uri === recordKey);
|
||||
return entry?.ref.mimeType?.trim() || mimeTypeFromUri(recordKey);
|
||||
}
|
||||
|
||||
function mimeTypeFromUri(uri: string): string {
|
||||
const normalized = uri.toLowerCase();
|
||||
if (normalized.endsWith(".jpg") || normalized.endsWith(".jpeg"))
|
||||
return "image/jpeg";
|
||||
if (normalized.endsWith(".svg"))
|
||||
return "image/svg+xml";
|
||||
if (normalized.endsWith(".png") || normalized.startsWith("cultmesh://"))
|
||||
return "image/png";
|
||||
return "application/octet-stream";
|
||||
}
|
||||
|
||||
async function retryTransientPublicationRead<T>(read: () => Promise<T>): Promise<T> {
|
||||
let lastError: unknown;
|
||||
for (let attempt = 0; attempt < 40; attempt += 1) {
|
||||
|
|
|
|||
|
|
@ -20821,8 +20821,10 @@ static void RequireManagedContentOnlyAssetDelivery(string root)
|
|||
"org.gamecult.aetheria.state",
|
||||
"Runtime",
|
||||
"AetheriaRuntimeDaemonDocuments.cs");
|
||||
var electronPath = Path.Combine(root, "Aetheria.Rts.Web", "Electron", "aetheria-cultmesh.ts");
|
||||
var daemon = File.ReadAllText(daemonPath);
|
||||
var documents = File.ReadAllText(documentsPath);
|
||||
var electron = File.ReadAllText(electronPath);
|
||||
var forbidden = new[]
|
||||
{
|
||||
"CultMeshCdnAssetBlob",
|
||||
|
|
@ -20831,7 +20833,8 @@ static void RequireManagedContentOnlyAssetDelivery(string root)
|
|||
};
|
||||
var surviving = forbidden
|
||||
.Where(symbol => daemon.Contains(symbol, StringComparison.Ordinal) ||
|
||||
documents.Contains(symbol, StringComparison.Ordinal))
|
||||
documents.Contains(symbol, StringComparison.Ordinal) ||
|
||||
electron.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
if (surviving.Length > 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ embedded Ymir spatial kernel, but Ymir does not become a second state owner.
|
|||
Outputs:
|
||||
The daemon publishes typed state documents, committed facts, operation receipts,
|
||||
simulation frames, SoA/native view descriptors, scalar and vector field
|
||||
documents, render splats, entity/object render rows, asset manifests, CultMesh
|
||||
CDN asset blobs, and Eve/CultUI surfaces.
|
||||
documents, render splats, entity/object render rows, typed CultMesh artifact
|
||||
manifests, managed content sessions, and Eve/CultUI surfaces.
|
||||
|
||||
Derived state:
|
||||
Unity GameObjects, Electron canvases, Hermodr browser nodes, Godot scene nodes,
|
||||
|
|
|
|||
Loading…
Reference in a new issue