Daemon serves through a runtime port: Idunn write lease or hand-run socket lock

serve(runtime) listens first, writes the state root only once the runtime
holds it, answers Idunn's route challenge ahead of the cross-site refusal,
and fences on lease loss. --health is deleted; the pid file and /proc
reclaim move behind the hand-run runtime. Adds scripts/idunn-entry.mjs,
the kimodo and SOMA-X gitlinks, encode_texts for the child, and tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-24 00:23:07 +02:00
commit 956fdf8ff8
13 changed files with 659 additions and 134 deletions

View file

@ -40,6 +40,20 @@ def load_encoder(hf_home, mntp_id, supervised_id, dtype):
return LLM2Vec(model=model, tokenizer=tokenizer)
def encode_texts(model, texts):
"""Each text wrapped in the chat header and encoded alone: (vector bytes, seconds) lists."""
vectors, encode_seconds = [], []
for text in texts:
began = time.perf_counter()
features = model.tokenize([chat_header(text)])
with torch.no_grad():
vector = model.forward(features).detach().cpu().to(torch.float32)[0]
assert vector.shape == (EMBEDDING_DIM,)
vectors.append(vector.numpy().tobytes())
encode_seconds.append(time.perf_counter() - began)
return vectors, encode_seconds
def main() -> int:
apply_thread_cap(os.environ)
texts = json.load(sys.stdin)["texts"]
@ -53,15 +67,7 @@ def main() -> int:
p.requires_grad = False
load_seconds = time.perf_counter() - started
vectors, encode_seconds = [], []
for text in texts:
began = time.perf_counter()
features = model.tokenize([chat_header(text)])
with torch.no_grad():
vector = model.forward(features).detach().cpu().to(torch.float32)[0]
assert vector.shape == (EMBEDDING_DIM,)
vectors.append(vector.numpy().tobytes())
encode_seconds.append(time.perf_counter() - began)
vectors, encode_seconds = encode_texts(model, texts)
out.write_bytes(msgpack.packb({
"vectors": vectors,
@ -75,4 +81,5 @@ def main() -> int:
return 0
sys.exit(main())
if __name__ == "__main__":
sys.exit(main())