protocol69 runHiddenEmbed — distributed hidden-state embedding over SkyMesh
Make hidden-state embedding a first-class protocol69 work type so the native node fleet (gaming PC,
R1s, future boxes) produces the contextual flux-vector DB via the sovereign dispatch protocol instead
of ad-hoc fat-station HTTP. Browser-WebGPU agents run TinyLlama generation and CANNOT produce the
qwen-896 embeddings the DB lives in, so embedding work is executed by a native agent that calls a
local qwen fat-station /hidden-embed.
The contract (all three layers MUST agree on this)
Gateway base: https://skymesh.forkjoin.ai (prod) / http://127.0.0.1:8788 (dev). NEW routes are
flag-gated by SKYMESH_EMBED_ENABLED (default false) so deploying the prod worker is safe.
1. ENQUEUE POST {gateway}/protocol69/embed/offer
Body: { "batchId": string, "items": [{ "key": string, "tokens": number[] }], "model": "qwen2.5-0.5b", "dim": 896 }
- Creates one workflow per item, single leg:
workKind:"runHiddenEmbed",executor:"nativeEmbed",state:"pending", carrying{key, tokens, model, dim, certificate}(the constant antiqueue cert). - Returns
{ ok:true, batchId, enqueued: number }. Idempotent onkey(skip keys already filled).
2. CLAIM POST {gateway}/protocol69/work/claim (existing route, extend matching)
Body: { "agentId": string, "skills": ["runHiddenEmbed"] }
- Returns
{ status:"claimed", work:{ workflowId, dispatchId, legId, cacheKey, key, tokens, model, dim, certificate, workKind:"runHiddenEmbed" } }or{ status:"idle", work:null }.
3. ACK POST {gateway}/protocol69/work/ack (existing route, store projection)
Body: { "ackKind":"legAck", "legAck":{ schemaVersion, contractId, certificate, workflowId, legId, dispatchId, cacheKey, workKind:"runHiddenEmbed", resultHash, provenance, projection:{ key, dim, embedB64 } } }
embedB64= base64 of the little-endian f32 embedding (dimfloats). Gateway stores it keyed bykey, marks the workflow filled.- Certificate fields MUST equal the constant antiqueue control-plane cert (validated exact, MeshCacheNodeDO ~509-516).
4. RESULT GET {gateway}/protocol69/embed/result?batchId=...&since=...
Returns { results: [{ key, dim, embedB64 }], done: number, total: number } (paged). Lets the
dispatcher collect fills without re-claiming.
Layers
- Gateway (
apps/skymesh/src/durables/MeshCacheNodeDO.ts): the 4 routes above, flag-gated. - Native agent (
distributed-inference/src/bin/protocol69-embed-agent.rs): claim→POST local/hidden-embed→ack loop. Args:--skymesh-url,--fat-station-url(local qwen),--agent-id. Reuse the claim/ack structs + cert constant fromprotocol69-monster-coordinator.rs. - Dispatcher (
open-source/flux-vector/scripts/embed-via-protocol69.ts): read a word list + vocab, tokenize, enqueue in batches, poll RESULT, write decoded f32 →~/.flux-embed/ctxemb.json(resume-aware; skip keys already present). Mirrorsembed-via-mesh.tsbut over the gateway.
Consistency invariant
The native agent's local fat-station MUST load the SAME knot/model (qwen, 896-dim) as the existing R1-built DB, or embeddings won't share a space. The gaming PC redeploy = native qwen fat-station + this agent pointed at it.