omnius 1.0.607 → 1.0.609

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/library.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { discoverCapabilities, discoveryDocsRoot, discoverySchemaVersion, findDiscoveryCatalogPath, loadDiscoveryCatalog, rankCapabilities, showCapability, } from "./discovery.js";
2
- export type { DiscoveryCatalog, DiscoveryEntry, DiscoveryInterface, DiscoveryKind, DiscoveryQueryOptions, DiscoveryReference, DiscoveryResult, } from "./discovery.js";
1
+ export { discoverCapabilities, discoveryBootstrap, discoveryDocsRoot, DISCOVERY_KINDS, discoverySchemaVersion, findDiscoveryCatalogPath, loadDiscoveryCatalog, rankCapabilities, showCapability, } from "./discovery.js";
2
+ export type { DiscoveryCatalog, DiscoveryBootstrap, DiscoveryEntry, DiscoveryExample, DiscoveryFailureMode, DiscoveryInterface, DiscoveryKind, DiscoveryQueryOptions, DiscoveryReference, DiscoveryResult, DiscoveryStep, DiscoveryVerification, } from "./discovery.js";
3
3
  export { assertServiceVersion, compareOmniusVersions, getServiceVersion, isVersionGatedExecutionRequest, OmniusVersionError, parseOmniusVersion, } from "./service-version.js";
4
4
  export type { ServiceVersionInfo } from "./service-version.js";
5
5
  export { buildProviderHeaders, detectProviderDescriptor, listProviderDescriptors, providerUrl, resolveProviderDescriptor, resolveProviderTransport, UnknownProviderProtocolError, } from "./providerRegistry.js";
package/dist/library.js CHANGED
@@ -4,14 +4,32 @@ import { createRequire as __omnius_createRequire } from "node:module"; import {
4
4
  import { existsSync, readFileSync } from "node:fs";
5
5
  import { dirname, resolve } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
- var DISCOVERY_SCHEMA_VERSION = "1.0.0";
7
+ var DISCOVERY_KINDS = [
8
+ "capability",
9
+ "layer",
10
+ "module",
11
+ "workflow",
12
+ "runtime",
13
+ "store",
14
+ "provider",
15
+ "tool",
16
+ "api",
17
+ "command",
18
+ "skill",
19
+ "guide",
20
+ "config",
21
+ "operation"
22
+ ];
23
+ var DISCOVERY_SCHEMA_VERSION = "2.0.0";
8
24
  var DEFAULT_LIMIT = 20;
9
25
  var MAX_LIMIT = 200;
10
26
  function discoveryCandidates() {
11
27
  const here = dirname(fileURLToPath(import.meta.url));
12
28
  const configured = process.env["OMNIUS_DOCS_ROOT"]?.trim();
29
+ if (configured) {
30
+ return [configured.endsWith(".json") ? resolve(configured) : resolve(configured, "DISCOVERY.json")];
31
+ }
13
32
  const candidates = [
14
- configured ? configured.endsWith(".json") ? resolve(configured) : resolve(configured, "DISCOVERY.json") : "",
15
33
  // Published package: dist/index.js or dist/library.js -> ../docs.
16
34
  resolve(here, "..", "docs", "DISCOVERY.json"),
17
35
  // Workspace source/dist layouts.
@@ -30,7 +48,7 @@ function findDiscoveryCatalogPath() {
30
48
  function isDiscoveryEntry(value) {
31
49
  if (!value || typeof value !== "object") return false;
32
50
  const item = value;
33
- return typeof item["id"] === "string" && typeof item["kind"] === "string" && typeof item["title"] === "string" && typeof item["summary"] === "string";
51
+ return typeof item["id"] === "string" && typeof item["kind"] === "string" && DISCOVERY_KINDS.includes(item["kind"]) && typeof item["title"] === "string" && typeof item["summary"] === "string";
34
52
  }
35
53
  function loadDiscoveryCatalog() {
36
54
  const path = findDiscoveryCatalogPath();
@@ -43,6 +61,13 @@ function loadDiscoveryCatalog() {
43
61
  if (typeof parsed.schema_version !== "string" || !Array.isArray(parsed.entries) || !parsed.entries.every(isDiscoveryEntry)) {
44
62
  throw new Error(`Invalid Omnius discovery catalog: ${path}`);
45
63
  }
64
+ const expectedMajor = DISCOVERY_SCHEMA_VERSION.split(".")[0];
65
+ const actualMajor = parsed.schema_version.split(".")[0];
66
+ if (actualMajor !== expectedMajor) {
67
+ throw new Error(
68
+ `Unsupported Omnius discovery schema ${parsed.schema_version}; this runtime requires ${expectedMajor}.x`
69
+ );
70
+ }
46
71
  return {
47
72
  ...parsed,
48
73
  schema_version: parsed.schema_version,
@@ -70,6 +95,25 @@ function scoreEntry(entry, query) {
70
95
  ...(entry.references ?? []).map((item) => `${item.type} ${item.target} ${item.relation ?? ""}`)
71
96
  ].join(" ")
72
97
  );
98
+ const operational = normalized(JSON.stringify({
99
+ layer: entry.layer,
100
+ audiences: entry.audiences,
101
+ use_when: entry.use_when,
102
+ avoid_when: entry.avoid_when,
103
+ inputs: entry.inputs,
104
+ outputs: entry.outputs,
105
+ workflow: entry.workflow,
106
+ examples: entry.examples,
107
+ verification: entry.verification,
108
+ failure_modes: entry.failure_modes,
109
+ state: entry.state,
110
+ safety: entry.safety,
111
+ prerequisites: entry.prerequisites,
112
+ source_of_truth: entry.source_of_truth,
113
+ capabilities: entry["capabilities"],
114
+ configuration: entry["configuration"],
115
+ runtime_requirements: entry["runtime_requirements"]
116
+ }));
73
117
  let score = 0;
74
118
  if (id === q) score += 1e3;
75
119
  if (aliases.includes(q)) score += 800;
@@ -98,6 +142,10 @@ function scoreEntry(entry, query) {
98
142
  score += 3;
99
143
  matched = true;
100
144
  }
145
+ if (tokens(operational).includes(token)) {
146
+ score += 5;
147
+ matched = true;
148
+ }
101
149
  if (matched) matchedTokens++;
102
150
  }
103
151
  if (queryTokens.length > 0 && matchedTokens === queryTokens.length) score += 50;
@@ -106,10 +154,10 @@ function scoreEntry(entry, query) {
106
154
  function discoverCapabilities(query = "", options = {}, catalog = loadDiscoveryCatalog()) {
107
155
  const limit = Math.min(MAX_LIMIT, Math.max(1, Math.floor(options.limit ?? DEFAULT_LIMIT)));
108
156
  const offset = Math.max(0, Math.floor(options.offset ?? 0));
109
- return rankCapabilities(query, options.kind, catalog).slice(offset, offset + limit);
157
+ return rankCapabilities(query, options.kind, catalog, options).slice(offset, offset + limit);
110
158
  }
111
- function rankCapabilities(query = "", kind, catalog = loadDiscoveryCatalog()) {
112
- return catalog.entries.filter((entry) => !kind || entry.kind === kind).map((entry) => ({ score: scoreEntry(entry, query), entry })).filter((result) => !query.trim() || result.score > 0).sort((a, b) => b.score - a.score || a.entry.id.localeCompare(b.entry.id));
159
+ function rankCapabilities(query = "", kind, catalog = loadDiscoveryCatalog(), options = {}) {
160
+ return catalog.entries.filter((entry) => !kind || entry.kind === kind).filter((entry) => !options.layer || entry.layer === options.layer).filter((entry) => !options.audience || (entry.audiences ?? []).includes(options.audience)).filter((entry) => options.includeInternal || entry.maturity !== "internal").map((entry) => ({ score: scoreEntry(entry, query), entry })).filter((result) => !query.trim() || result.score > 0).sort((a, b) => b.score - a.score || a.entry.id.localeCompare(b.entry.id));
113
161
  }
114
162
  function showCapability(id, catalog = loadDiscoveryCatalog()) {
115
163
  const exact = catalog.entries.find((entry) => entry.id === id);
@@ -119,8 +167,18 @@ function showCapability(id, catalog = loadDiscoveryCatalog()) {
119
167
  (entry) => normalized(entry.id) === wanted || normalized(entry.title) === wanted || (entry.aliases ?? []).some((alias) => normalized(alias) === wanted)
120
168
  );
121
169
  }
170
+ function discoveryBootstrap(catalog = loadDiscoveryCatalog()) {
171
+ return catalog.bootstrap ?? {
172
+ strategy: ["discover intent", "expand one stable id", "inspect the live contract", "act", "verify"],
173
+ start_here: ["overview"]
174
+ };
175
+ }
122
176
  function discoverySchemaVersion() {
123
- return DISCOVERY_SCHEMA_VERSION;
177
+ try {
178
+ return loadDiscoveryCatalog().schema_version;
179
+ } catch {
180
+ return DISCOVERY_SCHEMA_VERSION;
181
+ }
124
182
  }
125
183
  function discoveryDocsRoot() {
126
184
  const catalog = findDiscoveryCatalogPath();
@@ -927,6 +985,7 @@ var PROVIDER_PRESETS = [
927
985
  }
928
986
  ];
929
987
  export {
988
+ DISCOVERY_KINDS,
930
989
  OmniusVersionError,
931
990
  UnknownProviderProtocolError,
932
991
  assertServiceVersion,
@@ -934,6 +993,7 @@ export {
934
993
  compareOmniusVersions,
935
994
  detectProviderDescriptor,
936
995
  discoverCapabilities,
996
+ discoveryBootstrap,
937
997
  discoveryDocsRoot,
938
998
  discoverySchemaVersion,
939
999
  findDiscoveryCatalogPath,
@@ -0,0 +1,195 @@
1
+ #!/usr/bin/env python3
2
+ """Pinned Microsoft VibeVoice-ASR JSONL worker managed by Omnius.
3
+
4
+ This worker never installs dependencies or downloads weights intentionally.
5
+ The Node runtime owns setup, revision pinning, disk checks, and CUDA selection.
6
+ """
7
+
8
+ import argparse
9
+ import json
10
+ import os
11
+ import sys
12
+ import time
13
+ from pathlib import Path
14
+
15
+
16
+ def emit(payload):
17
+ print(json.dumps(payload, ensure_ascii=False), flush=True)
18
+
19
+
20
+ def check_only():
21
+ required = [
22
+ "OMNIUS_VIBEVOICE_MODEL_ID",
23
+ "OMNIUS_VIBEVOICE_MODEL_REVISION",
24
+ "OMNIUS_VIBEVOICE_TOKENIZER_ID",
25
+ "OMNIUS_VIBEVOICE_TOKENIZER_REVISION",
26
+ ]
27
+ missing = [key for key in required if not os.environ.get(key)]
28
+ emit({"type": "check", "ok": not missing, "missing": missing})
29
+ return 0 if not missing else 2
30
+
31
+
32
+ def normalize_seconds(value):
33
+ if value is None:
34
+ return 0.0
35
+ if isinstance(value, (int, float)):
36
+ return float(value)
37
+ text = str(value).strip()
38
+ if not text:
39
+ return 0.0
40
+ parts = text.split(":")
41
+ try:
42
+ if len(parts) == 3:
43
+ return float(parts[0]) * 3600 + float(parts[1]) * 60 + float(parts[2])
44
+ if len(parts) == 2:
45
+ return float(parts[0]) * 60 + float(parts[1])
46
+ return float(text)
47
+ except ValueError:
48
+ return 0.0
49
+
50
+
51
+ class VibeVoiceWorker:
52
+ def __init__(self):
53
+ import torch
54
+ from huggingface_hub import snapshot_download
55
+ from vibevoice.modular.modeling_vibevoice_asr import VibeVoiceASRForConditionalGeneration
56
+ from vibevoice.processor.vibevoice_asr_processor import VibeVoiceASRProcessor
57
+
58
+ if not torch.cuda.is_available():
59
+ raise RuntimeError("CUDA is unavailable; CPU fallback is forbidden for VibeVoice ASR")
60
+ visible = os.environ.get("CUDA_VISIBLE_DEVICES", "").strip()
61
+ if not visible or "," in visible:
62
+ raise RuntimeError("exactly one CUDA_VISIBLE_DEVICES entry is required")
63
+ self.torch = torch
64
+ self.model_id = os.environ["OMNIUS_VIBEVOICE_MODEL_ID"]
65
+ self.model_revision = os.environ["OMNIUS_VIBEVOICE_MODEL_REVISION"]
66
+ tokenizer_id = os.environ["OMNIUS_VIBEVOICE_TOKENIZER_ID"]
67
+ tokenizer_revision = os.environ["OMNIUS_VIBEVOICE_TOKENIZER_REVISION"]
68
+ model_path = snapshot_download(
69
+ repo_id=self.model_id,
70
+ revision=self.model_revision,
71
+ local_files_only=True,
72
+ )
73
+ tokenizer_path = snapshot_download(
74
+ repo_id=tokenizer_id,
75
+ revision=tokenizer_revision,
76
+ local_files_only=True,
77
+ allow_patterns=["*.json", "*.model", "*.txt", "merges.txt", "vocab.json", "tokenizer*"],
78
+ )
79
+ self.processor = VibeVoiceASRProcessor.from_pretrained(
80
+ model_path,
81
+ language_model_pretrained_name=tokenizer_path,
82
+ local_files_only=True,
83
+ )
84
+ self.model = VibeVoiceASRForConditionalGeneration.from_pretrained(
85
+ model_path,
86
+ dtype=torch.bfloat16,
87
+ attn_implementation=os.environ.get("OMNIUS_VIBEVOICE_ATTN", "sdpa"),
88
+ local_files_only=True,
89
+ ).to("cuda:0")
90
+ self.model.eval()
91
+ emit({
92
+ "type": "ready",
93
+ "pid": os.getpid(),
94
+ "device": torch.cuda.get_device_name(0),
95
+ "computeCapability": ".".join(str(part) for part in torch.cuda.get_device_capability(0)),
96
+ "totalMemoryBytes": torch.cuda.get_device_properties(0).total_memory,
97
+ "cudaVisibleDevices": visible,
98
+ "modelId": self.model_id,
99
+ "modelRevision": self.model_revision,
100
+ })
101
+
102
+ def transcribe(self, request):
103
+ file_path = str(request.get("file") or "")
104
+ if not file_path or not Path(file_path).is_file():
105
+ raise ValueError("a readable audio file is required")
106
+ context = str(request.get("context") or "").strip() or None
107
+ started = time.monotonic()
108
+ inputs = self.processor(
109
+ audio=[file_path],
110
+ return_tensors="pt",
111
+ padding=True,
112
+ context_info=context,
113
+ )
114
+ inputs = {
115
+ key: value.to("cuda:0") if isinstance(value, self.torch.Tensor) else value
116
+ for key, value in inputs.items()
117
+ }
118
+ generation = {
119
+ "max_new_tokens": int(os.environ.get("OMNIUS_VIBEVOICE_MAX_NEW_TOKENS", "32768")),
120
+ "do_sample": False,
121
+ "pad_token_id": self.processor.pad_id,
122
+ "eos_token_id": self.processor.tokenizer.eos_token_id,
123
+ }
124
+ with self.torch.inference_mode():
125
+ output_ids = self.model.generate(**inputs, **generation)
126
+ input_length = inputs["input_ids"].shape[1]
127
+ generated_ids = output_ids[0, input_length:]
128
+ raw_text = self.processor.decode(generated_ids, skip_special_tokens=True)
129
+ parsed = self.processor.post_process_transcription(raw_text)
130
+ warnings = []
131
+ segments = []
132
+ speakers = []
133
+ for item in parsed:
134
+ text = str(item.get("text") or "").strip()
135
+ speaker = str(item.get("speaker_id") or "").strip()
136
+ if speaker and speaker not in speakers:
137
+ speakers.append(speaker)
138
+ segments.append({
139
+ "startMs": round(normalize_seconds(item.get("start_time")) * 1000),
140
+ "endMs": round(normalize_seconds(item.get("end_time")) * 1000),
141
+ "text": text,
142
+ **({"speakerId": speaker} if speaker else {}),
143
+ })
144
+ if not segments and raw_text.strip():
145
+ warnings.append("VibeVoice structured output could not be parsed; raw transcription was preserved")
146
+ text = " ".join(segment["text"] for segment in segments if segment["text"]).strip()
147
+ if not text:
148
+ text = raw_text.strip()
149
+ duration_ms = max((segment["endMs"] for segment in segments), default=0)
150
+ return {
151
+ "text": text,
152
+ "rawText": raw_text,
153
+ "segments": segments,
154
+ "speakers": speakers,
155
+ "durationMs": duration_ms or None,
156
+ "engineId": "vibevoice-transformers",
157
+ "modelId": "vibevoice-asr-7b",
158
+ "device": self.torch.cuda.get_device_name(0),
159
+ "warnings": warnings,
160
+ "latencyMs": round((time.monotonic() - started) * 1000),
161
+ }
162
+
163
+
164
+ def serve():
165
+ try:
166
+ worker = VibeVoiceWorker()
167
+ except Exception as exc:
168
+ emit({"type": "error", "message": f"model activation failed: {exc}"})
169
+ return 1
170
+ for line in sys.stdin:
171
+ try:
172
+ request = json.loads(line)
173
+ request_id = str(request.get("id") or "")
174
+ if request.get("action") != "transcribe":
175
+ raise ValueError(f"unknown action: {request.get('action')}")
176
+ emit({"type": "result", "id": request_id, "result": worker.transcribe(request)})
177
+ except Exception as exc:
178
+ emit({"type": "error", "id": locals().get("request_id", ""), "message": str(exc)})
179
+ return 0
180
+
181
+
182
+ def main():
183
+ parser = argparse.ArgumentParser()
184
+ parser.add_argument("--check", action="store_true")
185
+ parser.add_argument("--serve", action="store_true")
186
+ args = parser.parse_args()
187
+ if args.check:
188
+ return check_only()
189
+ if args.serve:
190
+ return serve()
191
+ parser.error("use --check or --serve")
192
+
193
+
194
+ if __name__ == "__main__":
195
+ raise SystemExit(main())
@@ -293350,6 +293350,151 @@ init_camera_capture();
293350
293350
  var MM_DIR = join9(homedir9(), ".omnius", "multimodal-episodes");
293351
293351
  var MM_INDEX = join9(MM_DIR, "index.json");
293352
293352
 
293353
+ // packages/execution/dist/asr/registry.js
293354
+ var VIBEVOICE_ASR_MODEL_REVISION = "d0c9efdb8d614685062c04425d91e01b6f37d944";
293355
+ var VIBEVOICE_ASR_WEIGHTS_BYTES = 17348198410;
293356
+ var whisperCapabilities = Object.freeze({
293357
+ file: true,
293358
+ pcmStream: true,
293359
+ partials: true,
293360
+ diarization: false,
293361
+ segmentTimestamps: true,
293362
+ wordTimestamps: true,
293363
+ languageDetection: true,
293364
+ languageHints: true,
293365
+ contextPrompt: false,
293366
+ sampleRates: [16e3]
293367
+ });
293368
+ function whisperModel(engineId, id, label) {
293369
+ return {
293370
+ id,
293371
+ engineId,
293372
+ label,
293373
+ detail: `${label} Whisper transcription model`,
293374
+ upstreamModelId: id,
293375
+ license: "MIT",
293376
+ languages: ["multilingual"],
293377
+ capabilities: whisperCapabilities,
293378
+ resources: {
293379
+ cpuSupported: engineId === "transcribe-cli",
293380
+ architectures: ["x64", "arm64"],
293381
+ notes: engineId === "transcribe-cli" ? ["Managed transcribe-cli runtime; implementation may use faster-whisper or ONNX."] : ["CUDA is required by Omnius unless an explicit local override is configured."]
293382
+ }
293383
+ };
293384
+ }
293385
+ var WHISPER_MODEL_IDS = ["tiny", "base", "small", "medium", "large-v3"];
293386
+ var whisperModels = (engineId) => WHISPER_MODEL_IDS.map((id) => whisperModel(engineId, id, id === "large-v3" ? "Large v3" : id[0].toUpperCase() + id.slice(1)));
293387
+ var ASR_ENGINES = Object.freeze([
293388
+ {
293389
+ id: "openai-whisper",
293390
+ label: "OpenAI Whisper",
293391
+ detail: "Local CUDA Whisper for reliable live and file transcription",
293392
+ provider: "OpenAI",
293393
+ runtime: "python",
293394
+ setupMode: "managed",
293395
+ models: whisperModels("openai-whisper")
293396
+ },
293397
+ {
293398
+ id: "transcribe-cli",
293399
+ label: "transcribe-cli",
293400
+ detail: "Managed faster-whisper/ONNX bridge for live and file transcription",
293401
+ provider: "transcribe-cli",
293402
+ runtime: "node",
293403
+ setupMode: "managed",
293404
+ models: whisperModels("transcribe-cli")
293405
+ },
293406
+ {
293407
+ id: "nemotron-streaming",
293408
+ label: "NVIDIA Nemotron Speech Streaming",
293409
+ detail: "Low-latency English streaming ASR",
293410
+ provider: "NVIDIA",
293411
+ runtime: "python",
293412
+ setupMode: "managed",
293413
+ models: [
293414
+ {
293415
+ id: "nemotron-speech-streaming-en-0.6b",
293416
+ engineId: "nemotron-streaming",
293417
+ label: "Nemotron Speech Streaming 0.6B",
293418
+ detail: "English streaming model with partial transcripts",
293419
+ upstreamModelId: "nvidia/nemotron-speech-streaming-en-0.6b",
293420
+ languages: ["en"],
293421
+ capabilities: {
293422
+ file: true,
293423
+ pcmStream: true,
293424
+ partials: true,
293425
+ diarization: false,
293426
+ segmentTimestamps: false,
293427
+ wordTimestamps: false,
293428
+ languageDetection: false,
293429
+ languageHints: false,
293430
+ contextPrompt: false,
293431
+ sampleRates: [16e3]
293432
+ },
293433
+ resources: {
293434
+ parameterCount: "0.6B",
293435
+ minimumCudaComputeCapability: 7.5,
293436
+ cpuSupported: false,
293437
+ architectures: ["x64", "arm64"],
293438
+ notes: ["Requires a compatible CUDA-enabled NeMo runtime."]
293439
+ }
293440
+ }
293441
+ ]
293442
+ },
293443
+ {
293444
+ id: "vibevoice-transformers",
293445
+ label: "Microsoft VibeVoice ASR",
293446
+ detail: "Long-form multilingual ASR with speakers, timestamps, and context prompts",
293447
+ provider: "Microsoft Research",
293448
+ runtime: "python",
293449
+ setupMode: "managed",
293450
+ models: [
293451
+ {
293452
+ id: "vibevoice-asr-7b",
293453
+ engineId: "vibevoice-transformers",
293454
+ label: "VibeVoice ASR 7B",
293455
+ detail: "Up to 60-minute structured transcription in more than 50 languages",
293456
+ upstreamModelId: "microsoft/VibeVoice-ASR",
293457
+ upstreamRevision: VIBEVOICE_ASR_MODEL_REVISION,
293458
+ license: "MIT",
293459
+ languages: ["multilingual", "code-switching", "51 languages"],
293460
+ capabilities: {
293461
+ file: true,
293462
+ pcmStream: false,
293463
+ partials: false,
293464
+ diarization: true,
293465
+ segmentTimestamps: true,
293466
+ wordTimestamps: false,
293467
+ languageDetection: true,
293468
+ languageHints: false,
293469
+ contextPrompt: true,
293470
+ maxAudioSeconds: 3600,
293471
+ sampleRates: [24e3]
293472
+ },
293473
+ resources: {
293474
+ parameterCount: "9B (7B language decoder)",
293475
+ weightsBytes: VIBEVOICE_ASR_WEIGHTS_BYTES,
293476
+ minimumCudaComputeCapability: 8,
293477
+ minimumGpuMemoryBytes: 24 * 1024 ** 3,
293478
+ cpuSupported: false,
293479
+ architectures: ["x64", "arm64"],
293480
+ notes: [
293481
+ "BF16 checkpoint split across eight safetensors shards.",
293482
+ "Not incremental PCM streaming; use it for completed utterances and files.",
293483
+ "Activation is fail-closed and never falls back to CPU or another GPU."
293484
+ ]
293485
+ }
293486
+ }
293487
+ ]
293488
+ }
293489
+ ]);
293490
+
293491
+ // packages/execution/dist/asr/vibevoice-runtime.js
293492
+ init_process_async();
293493
+ init_model_store();
293494
+ var INSTALL_TIMEOUT_MS2 = 45 * 6e4;
293495
+ var ACTIVATE_TIMEOUT_MS = 20 * 6e4;
293496
+ var REQUEST_TIMEOUT_MS = 90 * 6e4;
293497
+
293353
293498
  // packages/execution/dist/tools/asr-listen.js
293354
293499
  init_hf_media_models();
293355
293500
  init_cuda_device_filter();
@@ -293408,7 +293553,7 @@ init_system_deps();
293408
293553
  init_process_kill();
293409
293554
 
293410
293555
  // packages/cli/src/daemon.ts
293411
- var OMNIUS_DIR = join14(homedir14(), ".omnius");
293556
+ var OMNIUS_DIR = process.env["OMNIUS_HOME"]?.trim() || join14(homedir14(), ".omnius");
293412
293557
  var PID_FILE = join14(OMNIUS_DIR, "daemon.pid");
293413
293558
  var DEFAULT_PORT2 = 11435;
293414
293559
  var LOCK_INITIALIZATION_GRACE_MS = 5e3;
@@ -293968,6 +294113,27 @@ async function startDaemon(port = getDaemonPort()) {
293968
294113
  }
293969
294114
  }
293970
294115
  }
294116
+ async function stopDaemonAtPort(port = getDaemonPort()) {
294117
+ if (await managedDaemonServiceMatchesPort(port)) {
294118
+ const stopped = await runUserSystemctl(["stop", "omnius-daemon.service"]);
294119
+ if (stopped.ok && await waitForDaemonStopped(port)) return true;
294120
+ }
294121
+ const wasRunning = await isDaemonRunning(port);
294122
+ const reclaimed = await reclaimOwnedDaemonListener(port);
294123
+ if (!reclaimed.ok) return false;
294124
+ const claimCleared = await reclaimStaleDaemonEndpointClaim(port);
294125
+ return claimCleared && (wasRunning || reclaimed.action === "cleared");
294126
+ }
294127
+ async function quiesceDaemonForUpdate(port = getDaemonPort()) {
294128
+ if (await managedDaemonServiceMatchesPort(port)) {
294129
+ const stopped = await runUserSystemctl(["stop", "omnius-daemon.service"]);
294130
+ return stopped.ok && await waitForDaemonStopped(port);
294131
+ }
294132
+ if (!await isDaemonRunning(port)) {
294133
+ return daemonPortIsFree(port);
294134
+ }
294135
+ return stopDaemonAtPort(port);
294136
+ }
293971
294137
 
293972
294138
  // packages/cli/src/update-service.ts
293973
294139
  import { spawn as spawn2, spawnSync } from "node:child_process";
@@ -294099,6 +294265,19 @@ function writeUpdateState(state, paths = resolveUpdatePaths()) {
294099
294265
  ensurePrivateDirectories(paths);
294100
294266
  atomicPrivateJson(paths.stateFile, state);
294101
294267
  }
294268
+ function updateLockOwner(paths, operationId, pid) {
294269
+ atomicPrivateJson(paths.lockFile, { operation_id: operationId, pid });
294270
+ }
294271
+ function adoptUpdateWorker(operationId, pid, paths = resolveUpdatePaths()) {
294272
+ const state = readUpdateState(paths);
294273
+ if (!state || state.operation_id !== operationId || state.status !== "running") {
294274
+ throw new Error("Update worker could not adopt its durable operation state");
294275
+ }
294276
+ updateLockOwner(paths, operationId, pid);
294277
+ const adopted = { ...state, pid, updated_at: (/* @__PURE__ */ new Date()).toISOString() };
294278
+ writeUpdateState(adopted, paths);
294279
+ return adopted;
294280
+ }
294102
294281
  function releaseUpdateLock(paths = resolveUpdatePaths(), operationId) {
294103
294282
  try {
294104
294283
  if (operationId) {
@@ -294256,6 +294435,7 @@ function installGlobalPackageStreaming(input) {
294256
294435
  }
294257
294436
  async function runVerifiedUpdateTransaction(initial, dependencies, paths = resolveUpdatePaths()) {
294258
294437
  let state = initial;
294438
+ let daemonQuiesced = false;
294259
294439
  const target = assertExactUpdateTarget(initial.target_version);
294260
294440
  const npmPath = resolveNpmPath();
294261
294441
  const env = {
@@ -294267,6 +294447,15 @@ async function runVerifiedUpdateTransaction(initial, dependencies, paths = resol
294267
294447
  OMNIUS_UPDATE_COORDINATED: "1"
294268
294448
  };
294269
294449
  try {
294450
+ if (dependencies.quiesceDaemon) {
294451
+ state = transition(state, { phase: "daemon_quiescing" }, paths);
294452
+ if (!await dependencies.quiesceDaemon()) {
294453
+ throw new Error(
294454
+ `Could not safely stop the daemon at ${state.daemon_endpoint ?? "the configured endpoint"} before updating`
294455
+ );
294456
+ }
294457
+ daemonQuiesced = true;
294458
+ }
294270
294459
  const prefixProbe = runSync(npmPath, ["prefix", "-g"], { env, timeout: 1e4 });
294271
294460
  state = transition(state, {
294272
294461
  phase: "installing",
@@ -294291,13 +294480,19 @@ async function runVerifiedUpdateTransaction(initial, dependencies, paths = resol
294291
294480
  }, paths);
294292
294481
  state = transition(state, { phase: "daemon_restarting" }, paths);
294293
294482
  if (!await dependencies.restartDaemon(target)) {
294294
- throw new Error("The daemon restart command did not produce a verified target runtime");
294483
+ throw new Error(
294484
+ `The daemon restart at ${state.daemon_endpoint ?? "the configured endpoint"} did not produce Omnius v${target}`
294485
+ );
294295
294486
  }
294487
+ daemonQuiesced = false;
294296
294488
  const daemon = await dependencies.observeDaemon();
294297
294489
  if (!daemon || daemon.bootVersion !== target) {
294298
294490
  throw new Error(`Daemon verification failed: expected ${target}, observed ${daemon?.bootVersion ?? "unreachable"}`);
294299
294491
  }
294300
- if (daemon.bootPackageHash && daemon.bootPackageHash !== evidence.packageHash) {
294492
+ if (!daemon.bootPackageHash) {
294493
+ throw new Error("Daemon package verification failed: the restarted runtime did not report a boot package hash");
294494
+ }
294495
+ if (daemon.bootPackageHash !== evidence.packageHash) {
294301
294496
  throw new Error(
294302
294497
  `Daemon package verification failed: boot hash ${daemon.bootPackageHash} does not match installed hash ${evidence.packageHash}`
294303
294498
  );
@@ -294325,12 +294520,21 @@ async function runVerifiedUpdateTransaction(initial, dependencies, paths = resol
294325
294520
  return state;
294326
294521
  } catch (error) {
294327
294522
  const message = error instanceof Error ? error.message : String(error);
294523
+ let recoveryNote;
294524
+ if (daemonQuiesced && dependencies.recoverDaemon) {
294525
+ try {
294526
+ const recovered = await dependencies.recoverDaemon();
294527
+ recoveryNote = recovered ? "The prior daemon was restarted after the failed update." : "The daemon could not be recovered automatically after the failed update.";
294528
+ } catch (recoveryError) {
294529
+ recoveryNote = `Daemon recovery failed: ${recoveryError instanceof Error ? recoveryError.message : String(recoveryError)}`;
294530
+ }
294531
+ }
294328
294532
  state = transition(state, {
294329
294533
  status: "failed",
294330
294534
  phase: "failed",
294331
294535
  completed_at: (/* @__PURE__ */ new Date()).toISOString(),
294332
294536
  error: message,
294333
- remediation: permissionRemediation(message)
294537
+ remediation: [permissionRemediation(message), recoveryNote].filter(Boolean).join(" ") || void 0
294334
294538
  }, paths);
294335
294539
  return state;
294336
294540
  } finally {
@@ -294633,7 +294837,7 @@ async function main() {
294633
294837
  const operationId = arg("operation");
294634
294838
  const target = arg("target");
294635
294839
  const endpoint = arg("endpoint") || "http://127.0.0.1:11435";
294636
- const state = readUpdateState(paths);
294840
+ const state = adoptUpdateWorker(operationId, process.pid, paths);
294637
294841
  if (!state || state.operation_id !== operationId || state.target_version !== target) {
294638
294842
  throw new Error("Update worker state does not match its operation arguments");
294639
294843
  }
@@ -294643,7 +294847,9 @@ async function main() {
294643
294847
  const finalState = await runVerifiedUpdateTransaction(
294644
294848
  state,
294645
294849
  {
294850
+ quiesceDaemon: () => quiesceDaemonForUpdate(port),
294646
294851
  restartDaemon: (expected) => restartDaemon(port, expected),
294852
+ recoverDaemon: () => restartDaemon(port),
294647
294853
  observeDaemon: async () => {
294648
294854
  const identity = await getDaemonReportedIdentity(port);
294649
294855
  return identity ? { bootVersion: identity.bootVersion, bootPackageHash: identity.bootPackageHash } : null;
@@ -33,6 +33,7 @@ export default defineConfig({
33
33
  themeConfig: {
34
34
  nav: [
35
35
  { text: "Discover", link: "/DISCOVERY" },
36
+ { text: "System Map", link: "/architecture/agent-system-map" },
36
37
  { text: "Guide", link: "/getting-started/install" },
37
38
  { text: "REST", link: "/reference/rest-api" },
38
39
  { text: "Commands", link: "/reference/slash-commands" },
@@ -107,6 +108,7 @@ export default defineConfig({
107
108
  {
108
109
  text: "Architecture",
109
110
  items: [
111
+ { text: "Agent System Map", link: "/architecture/agent-system-map" },
110
112
  { text: "Overview", link: "/architecture/overview" },
111
113
  ],
112
114
  },