omnius 1.0.923 → 1.0.925

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.
Files changed (239) hide show
  1. package/dist/{providerRegistry.d.ts → _types/backend-vllm/providerRegistry.d.ts} +0 -1
  2. package/dist/_types/backend-vllm/types.d.ts +209 -0
  3. package/dist/_types/execution/av/media-capability.d.ts +94 -0
  4. package/dist/_types/execution/delegation-contract.d.ts +102 -0
  5. package/dist/_types/execution/evidence.d.ts +68 -0
  6. package/dist/_types/execution/html-source-evidence.d.ts +65 -0
  7. package/dist/_types/execution/mcp/types.d.ts +169 -0
  8. package/dist/_types/execution/mutation-contract.d.ts +102 -0
  9. package/dist/_types/execution/nol/artifacts.d.ts +39 -0
  10. package/dist/_types/execution/nol/checkpoint-edits.d.ts +98 -0
  11. package/dist/_types/execution/nol/distributions.d.ts +128 -0
  12. package/dist/_types/execution/nol/gguf-checkpoint-edits.d.ts +194 -0
  13. package/dist/_types/execution/nol/gguf-control-reader.d.ts +224 -0
  14. package/dist/_types/execution/nol/lora-exports.d.ts +129 -0
  15. package/dist/_types/execution/nol/neuronary.d.ts +212 -0
  16. package/dist/_types/execution/nol/pytorch-control-reader.d.ts +143 -0
  17. package/dist/_types/execution/nol/qwen35-head-sites.d.ts +61 -0
  18. package/dist/_types/execution/nol/worker-assets.d.ts +82 -0
  19. package/dist/_types/execution/nol/worker-protocol.d.ts +94 -0
  20. package/dist/_types/execution/page-content-source.d.ts +40 -0
  21. package/dist/_types/execution/rapid-computer-use/artifact-store.d.ts +21 -0
  22. package/dist/_types/execution/rapid-computer-use/contracts.d.ts +320 -0
  23. package/dist/_types/execution/rapid-computer-use/decision.d.ts +70 -0
  24. package/dist/_types/execution/rapid-computer-use/desktop-verification.d.ts +23 -0
  25. package/dist/_types/execution/rapid-computer-use/geometry.d.ts +57 -0
  26. package/dist/_types/execution/rapid-computer-use/planner.d.ts +78 -0
  27. package/dist/_types/execution/rapid-computer-use/trace.d.ts +80 -0
  28. package/dist/_types/execution/rapid-computer-use/visual.d.ts +48 -0
  29. package/dist/_types/execution/shell-runs.d.ts +78 -0
  30. package/dist/_types/execution/streamed-web-source.d.ts +64 -0
  31. package/dist/_types/execution/tools/browser-page-fallback.d.ts +25 -0
  32. package/dist/_types/execution/tools/network-egress-policy.d.ts +30 -0
  33. package/dist/_types/execution/tools/pdf-native-tables.d.ts +46 -0
  34. package/dist/_types/execution/tools/todo-store.d.ts +133 -0
  35. package/dist/_types/execution/tools/web-fetch.d.ts +57 -0
  36. package/dist/_types/execution/tools/workboard.d.ts +1223 -0
  37. package/dist/_types/execution/types.d.ts +549 -0
  38. package/dist/_types/execution/web-source.d.ts +14 -0
  39. package/dist/_types/memory/artifactReviewSourceIndex.d.ts +133 -0
  40. package/dist/_types/memory/contextMemoryLedger.d.ts +213 -0
  41. package/dist/_types/memory/db.d.ts +12 -0
  42. package/dist/_types/memory/embeddings.d.ts +36 -0
  43. package/dist/_types/memory/immutableEvidenceStore.d.ts +165 -0
  44. package/dist/_types/memory/memoryIngestion.d.ts +65 -0
  45. package/dist/_types/memory/memoryTypes.d.ts +312 -0
  46. package/dist/_types/memory/sourceCorpusStore.d.ts +331 -0
  47. package/dist/_types/memory/structuredMemoryStore.d.ts +105 -0
  48. package/dist/_types/memory/unifiedMemoryStore.d.ts +127 -0
  49. package/dist/_types/memory/virtualMemory.d.ts +187 -0
  50. package/dist/_types/orchestrator/agentic-page-content-receipt.d.ts +20 -0
  51. package/dist/_types/orchestrator/agentic-web-fetch-receipt.d.ts +20 -0
  52. package/dist/_types/orchestrator/agenticRunner.d.ts +5219 -0
  53. package/dist/_types/orchestrator/app-state.d.ts +171 -0
  54. package/dist/_types/orchestrator/artifactClaimCritic.d.ts +63 -0
  55. package/dist/_types/orchestrator/artifactQuality.d.ts +15 -0
  56. package/dist/_types/orchestrator/artifactSemanticIntegrity.d.ts +203 -0
  57. package/dist/_types/orchestrator/canonical-context-projection.d.ts +254 -0
  58. package/dist/_types/orchestrator/canonical-source-body-projection.d.ts +51 -0
  59. package/dist/_types/orchestrator/completion-review-pending.d.ts +24 -0
  60. package/dist/_types/orchestrator/completionContract.d.ts +103 -0
  61. package/dist/_types/orchestrator/completionFinalization.d.ts +224 -0
  62. package/dist/_types/orchestrator/completionLedger.d.ts +429 -0
  63. package/dist/_types/orchestrator/completionReadiness.d.ts +234 -0
  64. package/dist/_types/orchestrator/context-admission.d.ts +93 -0
  65. package/dist/_types/orchestrator/context-dump-retention.d.ts +25 -0
  66. package/dist/_types/orchestrator/context-fabric.d.ts +133 -0
  67. package/dist/_types/orchestrator/contextEngine.d.ts +68 -0
  68. package/dist/_types/orchestrator/contextWindowDump.d.ts +327 -0
  69. package/dist/_types/orchestrator/convergence-breaker.d.ts +225 -0
  70. package/dist/_types/orchestrator/convergence-progress.d.ts +66 -0
  71. package/dist/_types/orchestrator/deliveryCoverage.d.ts +181 -0
  72. package/dist/_types/orchestrator/document-persistence-goal-binding.d.ts +106 -0
  73. package/dist/_types/orchestrator/durable-document-worker.d.ts +85 -0
  74. package/dist/_types/orchestrator/evidenceBranch.d.ts +291 -0
  75. package/dist/_types/orchestrator/expected-inference-response.d.ts +55 -0
  76. package/dist/_types/orchestrator/expectedOutcomeContract.d.ts +58 -0
  77. package/dist/_types/orchestrator/failure-taxonomy.d.ts +36 -0
  78. package/dist/_types/orchestrator/focusSupervisor.d.ts +436 -0
  79. package/dist/_types/orchestrator/forced-update-requirement-recovery.d.ts +105 -0
  80. package/dist/_types/orchestrator/hooks.d.ts +100 -0
  81. package/dist/_types/orchestrator/inference-pressure.d.ts +61 -0
  82. package/dist/_types/orchestrator/integrationClosure.d.ts +89 -0
  83. package/dist/_types/orchestrator/interruption-lifecycle.d.ts +154 -0
  84. package/dist/_types/orchestrator/live-memory-passages.d.ts +51 -0
  85. package/dist/_types/orchestrator/liveVirtualContext.d.ts +84 -0
  86. package/dist/_types/orchestrator/memory-compiler.d.ts +254 -0
  87. package/dist/_types/orchestrator/memory-consolidation.d.ts +134 -0
  88. package/dist/_types/orchestrator/model-router.d.ts +17 -0
  89. package/dist/_types/orchestrator/modelResponseDiagnostics.d.ts +71 -0
  90. package/dist/_types/orchestrator/nativeRequirementAmendment.d.ts +63 -0
  91. package/dist/_types/orchestrator/nol/coordinator.d.ts +204 -0
  92. package/dist/_types/orchestrator/nol/datasets.d.ts +58 -0
  93. package/dist/_types/orchestrator/nol/discovery.d.ts +286 -0
  94. package/dist/_types/orchestrator/nol/evaluation.d.ts +59 -0
  95. package/dist/_types/orchestrator/nol/model-validation.d.ts +198 -0
  96. package/dist/_types/orchestrator/nol/statistics.d.ts +142 -0
  97. package/dist/_types/orchestrator/nol/store.d.ts +133 -0
  98. package/dist/_types/orchestrator/nol/variant-registry.d.ts +292 -0
  99. package/dist/_types/orchestrator/ollama-context-policy.d.ts +34 -0
  100. package/dist/_types/orchestrator/personality.d.ts +66 -0
  101. package/dist/_types/orchestrator/prompt-cache.d.ts +24 -0
  102. package/dist/_types/orchestrator/remote-inference-fallback.d.ts +224 -0
  103. package/dist/_types/orchestrator/remote-inference-policy.d.ts +58 -0
  104. package/dist/_types/orchestrator/request-budget.d.ts +75 -0
  105. package/dist/_types/orchestrator/requirementCoverage.d.ts +69 -0
  106. package/dist/_types/orchestrator/reviewedInterpretation.d.ts +111 -0
  107. package/dist/_types/orchestrator/runEvents.d.ts +115 -0
  108. package/dist/_types/orchestrator/runtime-rollout.d.ts +63 -0
  109. package/dist/_types/orchestrator/semanticVerification.d.ts +135 -0
  110. package/dist/_types/orchestrator/source-wide-extraction.d.ts +202 -0
  111. package/dist/_types/orchestrator/steeringIntake.d.ts +123 -0
  112. package/dist/_types/orchestrator/structured-memory-extraction-worker.d.ts +89 -0
  113. package/dist/_types/orchestrator/structuredMemoryInference.d.ts +62 -0
  114. package/dist/_types/orchestrator/successful-procedure-memory.d.ts +127 -0
  115. package/dist/_types/orchestrator/supportedAnswer.d.ts +68 -0
  116. package/dist/_types/orchestrator/taskEffectEvidence.d.ts +38 -0
  117. package/dist/_types/orchestrator/taskExecutionSnapshot.d.ts +67 -0
  118. package/dist/_types/orchestrator/taskObjective.d.ts +310 -0
  119. package/dist/_types/orchestrator/taskObjectiveContinuation.d.ts +134 -0
  120. package/dist/_types/orchestrator/taskRequirementReview.d.ts +246 -0
  121. package/dist/_types/orchestrator/taskRequirements.d.ts +80 -0
  122. package/dist/_types/orchestrator/taskSemanticAdmission.d.ts +159 -0
  123. package/dist/_types/orchestrator/taskWorkDelegation.d.ts +147 -0
  124. package/dist/_types/orchestrator/taskWorkPlan.d.ts +177 -0
  125. package/dist/_types/orchestrator/telegram-passive-history.d.ts +42 -0
  126. package/dist/_types/orchestrator/terminalTaskReport.d.ts +91 -0
  127. package/dist/_types/orchestrator/todoObservability.d.ts +147 -0
  128. package/dist/_types/orchestrator/tool-exposure-policy.d.ts +100 -0
  129. package/dist/_types/orchestrator/trajectory-checkpoint.d.ts +159 -0
  130. package/dist/_types/orchestrator/types.d.ts +185 -0
  131. package/dist/_types/schemas/dispatch.d.ts +53 -0
  132. package/dist/_types/schemas/feature-workflow.d.ts +362 -0
  133. package/dist/_types/schemas/messages.d.ts +15 -0
  134. package/dist/_types/schemas/nol-assets.d.ts +955 -0
  135. package/dist/_types/schemas/nol-json.d.ts +2 -0
  136. package/dist/_types/schemas/nol.d.ts +3995 -0
  137. package/dist/_types/schemas/patch.d.ts +47 -0
  138. package/dist/_types/schemas/plan.d.ts +47 -0
  139. package/dist/_types/schemas/repoProfile.d.ts +116 -0
  140. package/dist/_types/schemas/retrieval.d.ts +44 -0
  141. package/dist/_types/schemas/task.d.ts +57 -0
  142. package/dist/_types/schemas/tools.d.ts +16 -0
  143. package/dist/_types/schemas/verification.d.ts +31 -0
  144. package/dist/api/py-embed.js +3353 -1829
  145. package/dist/assets/nol-checkpoint-editor.py +701 -0
  146. package/dist/assets/nol-gguf-checkpoint-editor.py +785 -0
  147. package/dist/assets/nol-gguf-control-reader.py +428 -0
  148. package/dist/assets/nol-gne-tools-worker.py +425 -0
  149. package/dist/assets/nol-gne-worker.py +1081 -0
  150. package/dist/assets/nol-lora-exporter.py +349 -0
  151. package/dist/assets/nol-pytorch-control-reader.py +470 -0
  152. package/dist/assets/nol-transformers-nnsight-worker.py +512 -0
  153. package/dist/assets/nol-transformers-peft-validation-worker.py +385 -0
  154. package/dist/assets/nol-transformers-peft-worker.py +488 -0
  155. package/dist/assets/nol-transformers-research-worker.py +472 -0
  156. package/dist/assets/nol-transformers-worker.py +920 -0
  157. package/dist/assets/nol-vllm-owned-worker.py +803 -0
  158. package/dist/assets/nol-vllm-runtime.py +695 -0
  159. package/dist/assets/nol-vllm-tokenizer.py +93 -0
  160. package/dist/assets/nol-vllm-worker.py +201 -0
  161. package/dist/computer-use/configured-planner.d.ts +37 -0
  162. package/dist/computer-use/configured-point.d.ts +35 -0
  163. package/dist/computer-use/host-session.d.ts +60 -0
  164. package/dist/computer-use/runner-ui-port.d.ts +37 -0
  165. package/dist/computer-use/session-review.d.ts +14 -0
  166. package/dist/computer-use/task-spec.d.ts +84 -0
  167. package/dist/discovery.d.ts +16 -2
  168. package/dist/index.js +2 -2
  169. package/dist/library.d.ts +94 -10
  170. package/dist/library.js +144003 -87414
  171. package/dist/memory-maintenance-worker.js +1676 -511
  172. package/dist/nol/cpu-control-reader-profile.d.ts +93 -0
  173. package/dist/nol/cpu-control-reader-service.d.ts +87 -0
  174. package/dist/nol/cuda-lease.d.ts +111 -0
  175. package/dist/nol/cuda-mutations.d.ts +34 -0
  176. package/dist/nol/export-runtime-config.d.ts +114 -0
  177. package/dist/nol/export-service.d.ts +143 -0
  178. package/dist/nol/facade.d.ts +147 -0
  179. package/dist/nol/gguf-cpu-control-reader-profile.d.ts +106 -0
  180. package/dist/nol/gguf-cpu-control-reader-service.d.ts +91 -0
  181. package/dist/nol/gguf-model-control-verifier.d.ts +120 -0
  182. package/dist/nol/gguf-parameter-inventory.d.ts +28 -0
  183. package/dist/nol/gne-adapter.d.ts +134 -0
  184. package/dist/nol/gne-agent-evaluation.d.ts +84 -0
  185. package/dist/nol/gne-profile.d.ts +124 -0
  186. package/dist/nol/gne-tools-profile.d.ts +148 -0
  187. package/dist/nol/gne-tools-transport.d.ts +194 -0
  188. package/dist/nol/model-actions.d.ts +662 -0
  189. package/dist/nol/model-control-verifier.d.ts +135 -0
  190. package/dist/nol/model-json-scorer.d.ts +13 -0
  191. package/dist/nol/model-runtime-config.d.ts +830 -0
  192. package/dist/nol/model-serving.d.ts +130 -0
  193. package/dist/nol/model-subject-adapter.d.ts +72 -0
  194. package/dist/nol/model-validation-factory.d.ts +113 -0
  195. package/dist/nol/neuronary-catalog.d.ts +130 -0
  196. package/dist/nol/orphan-custody.d.ts +72 -0
  197. package/dist/nol/peft-conformance.d.ts +48 -0
  198. package/dist/nol/peft-control-types.d.ts +137 -0
  199. package/dist/nol/peft-control-verifier.d.ts +8 -0
  200. package/dist/nol/peft-model-actions.d.ts +41 -0
  201. package/dist/nol/peft-model-authority.d.ts +146 -0
  202. package/dist/nol/peft-model-controls.d.ts +20 -0
  203. package/dist/nol/peft-model-host.d.ts +47 -0
  204. package/dist/nol/peft-model-profile.d.ts +161 -0
  205. package/dist/nol/peft-model-runtime-config.d.ts +174 -0
  206. package/dist/nol/peft-model-subject-adapter.d.ts +36 -0
  207. package/dist/nol/peft-validation.d.ts +105 -0
  208. package/dist/nol/persistent-parameter-inventory.d.ts +32 -0
  209. package/dist/nol/runtime.d.ts +100 -0
  210. package/dist/nol/sqlite-store.d.ts +80 -0
  211. package/dist/nol/transformers-adapter.d.ts +119 -0
  212. package/dist/nol/transformers-nnsight.d.ts +87 -0
  213. package/dist/nol/transformers-peft.d.ts +107 -0
  214. package/dist/nol/transformers-research.d.ts +114 -0
  215. package/dist/nol/variant-service.d.ts +143 -0
  216. package/dist/nol/variant-store.d.ts +51 -0
  217. package/dist/nol/vllm-actions.d.ts +774 -0
  218. package/dist/nol/vllm-adapter.d.ts +1473 -0
  219. package/dist/nol/vllm-authority.d.ts +55 -0
  220. package/dist/nol/vllm-conformance.d.ts +662 -0
  221. package/dist/nol/vllm-profile.d.ts +850 -0
  222. package/dist/nol/vllm-protocol.d.ts +1505 -0
  223. package/dist/nol/vllm-runtime-config.d.ts +120 -0
  224. package/dist/nol/vllm-runtime.d.ts +34 -0
  225. package/dist/nol/vllm-startup.d.ts +235 -0
  226. package/dist/omni-setup-worker.js +3433 -1909
  227. package/dist/service-version.d.ts +0 -1
  228. package/dist/tui/async-process.d.ts +27 -0
  229. package/dist/tui/native/worker.js +3 -1
  230. package/dist/tui/telegram-action-session-registry.d.ts +136 -0
  231. package/dist/tui/telegram-cognition-queue.d.ts +154 -0
  232. package/dist/tui/telegram-context-packet-v2.d.ts +99 -0
  233. package/dist/tui/telegram-input-ownership.d.ts +78 -0
  234. package/dist/tui/telegram-turn-contract-v2.d.ts +62 -0
  235. package/dist/update-worker-runtime.js +4216 -2603
  236. package/docs/DISCOVERY.json +389 -0
  237. package/docs/DISCOVERY.md +4 -0
  238. package/npm-shrinkwrap.json +28 -12
  239. package/package.json +3 -2
@@ -0,0 +1,803 @@
1
+ #!/usr/bin/env python3
2
+ """Inert ownership/admission companion for a proposed eager vLLM startup worker.
3
+
4
+ Only the lazy native-worker factory imports NNsight. CPU fixture classes may be
5
+ passed directly; that seam is not a native compatibility or placement proof.
6
+ Routine calls are not physical CUDA-kernel counts. Unknown work is rejected.
7
+ """
8
+ import contextlib
9
+ import hashlib
10
+ import importlib.metadata
11
+ import importlib.util
12
+ import json
13
+ import math
14
+ import os
15
+ from pathlib import Path
16
+ import re
17
+ import select
18
+ import stat
19
+ import struct
20
+ import sysconfig
21
+ import time
22
+
23
+ VERSION = "omnius.nol.vllm-startup.v2"
24
+ PRIVATE = "omnius.nol.vllm-private.v1"
25
+ SHA = re.compile(r"^[a-f0-9]{64}$")
26
+ GPU = re.compile(r"^GPU-[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$", re.I)
27
+ ROUTINES = ("block_table_warmup", "kv_zeroer_warmup", "qwen_causal_conv1d", "qwen_post_conv_1", "qwen_post_conv_2", "qwen_post_conv_16", "qwen_gating_delta", "sampler_warmup")
28
+ # This is a source-owned designation boundary, never a request/environment flag.
29
+ # Root must install an exact reviewed runtime after the user's designation.
30
+ NATIVE_RUNTIME_DESIGNATION = {"modelDigest":"ec51c81fe0bd6a94ac364936367a5d2b307ef7482af38232d6e09f47ac989f8a","inventoryDigest":"7e7c60008b3fa872ce219d6847aa56c7972884314918c48d7b0db63fb3e1947d","dependencyLockPath":"/home/roko/Documents/Projects/Adjacent/omnius/omnius/.aiwg/research/sources/vllm-0.27.1/requirements.lock","dependencyLockSha256":"6c074e3ac3817c43e024133c386aa8ca90154151165ac84ed61667ddb7599fe9","maxRuntimeBytes":34359738368,"maxRuntimeFiles":200000}
31
+ RUNTIME_SHA = "92998612f884bd49a7823608ae6897c73192344e534176086a0dbd6ec2c2ba89"
32
+ EXECUTABLE = re.compile(r"(?:\.py|\.pyc|\.pyd|\.dll|\.dylib|\.ptx|\.cubin|\.pth|\.so(?:\.[0-9]+)*)$", re.I)
33
+ SOURCE_PINS = {
34
+ "vllm/platforms/cuda.py": "ea6cade0bc560dcafea09bef8d30249b949e322ed8696ff02c6d20fa250640d2",
35
+ "vllm/utils/mem_utils.py": "c56776468121f217e205df157289bc90a2ea3719d3ce3d63c597efe3cfd66919",
36
+ "vllm/outputs.py": "44e2ea5d8a34403a99a867b42806e8102b3d9e7b1a0f735af26e6650cc482342",
37
+ "vllm/v1/engine/output_processor.py": "7cd99f14e0c0dc5f8cd69100d12489abfddee21d5fb3d6594a713beeefe3cdb0",
38
+ "vllm/v1/metrics/stats.py": "7682d3086bf5395f163f423677485432ee2c035aada2f370c0f82b291e53ca47",
39
+ "vllm/v1/metrics/loggers.py": "d5a91626cf79118f98ae6438c842cb30fc44ca14463c7e2af5871e3da8e51bcf",
40
+ "vllm/v1/worker/worker_base.py": "7da44338c2645ebf03d23394e452b31a8e3da1011fd1b42fcfcccfe99551b3fe",
41
+ "vllm/model_executor/layers/linear.py": "d0662fddc4785419002320a4d9eb5183c9268051ebcf31f1c8276e8529633308",
42
+ "vllm/model_executor/layers/activation.py": "24fa82b26c7be0ff4b9953ee26247eb6bbb7a23bbdc631651ea3978ecc3f79ea",
43
+ "vllm/model_executor/models/qwen3_next.py": "e195dc4d5522a8cce5399cb35d9d96d6e5a0c07bf9460ef6912c840dcb7a6dc9",
44
+ "vllm/model_executor/models/qwen2_moe.py": "a35f10db36c4bdb2a4a6314474512589f73a04d12e69206a633e345b3755d4db",
45
+ "vllm/sampling_params.py": "cc040f9b21e373be3fa5f47c0f3a50e77229dede20cae6a8019f2b7f5ce365cf",
46
+ "vllm/v1/core/sched/scheduler.py": "c67bda2886b52865ddafabaae7d797c359e930752f374421a33e537d94a5f45a",
47
+ "vllm/tokenizers/detokenizer_utils.py": "e17ef23dae7bbb1db5875024c249567b988d8611b560d095c3f786d1e697fe11",
48
+ "vllm/v1/engine/detokenizer.py": "213d71cf6eefcea061b28b656cf8a08af60c9f3513403e724b16876995f3de93",
49
+ "vllm/v1/engine/llm_engine.py": "46caab7b8a09d74321ef7a64683e8019b2187810725c80a15298cf9f51f1df03",
50
+ "vllm/entrypoints/llm.py": "3bb98c9bff8d018902f4352bb5f81f1b4d13276ba1c3f18a9ec11d9a5aa5a57a",
51
+ "nnsight/modeling/vllm/engines/engine.py": "1c8d3bd653c4dca8474339988d9f8fbbf1dd9139d09a12372b2f8fa04b110f34",
52
+ "nnsight/modeling/vllm/workers/GPUWorker.py": "30f29bfb96c7b68a33ed3a6e8d92f40ce1fd9fdcf50d089d3d204acd3ac3dbea",
53
+ "nnsight/modeling/vllm/model_runners/GPUModelRunner.py": "4c1baef9af53eca2d3d6f16a287113c6f7be33125c49a6417cd54f2a3bc0a8ff",
54
+ "nnsight/modeling/vllm/vllm.py": "5d3f77dd7afff4fb6ac31f5fe867f2fcafe2b7abfb1a4d7578b92ce4fbe76b32",
55
+ "vllm/v1/worker/gpu_worker.py": "50134ca3a147f5470e556437cbd40a13ea05b098efbac6553d5ea2f3e5f7ff57",
56
+ "vllm/v1/worker/gpu_model_runner.py": "993f2c926012241bcb8cc7f568c8e82968e4d81ca125641c831ecf501aac02ac",
57
+ "vllm/v1/engine/core.py": "6fdd067f54e5d42c57ff413e292685f5bdf6f343498d85c9262567f1eb746916",
58
+ "vllm/v1/executor/uniproc_executor.py": "4625c8e59aef1482600b02204701d348d7f716427581d3cf23b06bff9b056abe",
59
+ "vllm/model_executor/warmup/kernel_warmup.py": "452ae5db905110df8eb7aac90a93ac80863d166f8ea7d52b8cec02c477477aed",
60
+ "vllm/model_executor/warmup/qwen_triton_warmup.py": "2b08d94662e7b04ce61c0f7a818e0cd1768fe7602a89df04ec6148f62fe3acdb",
61
+ "vllm/model_executor/models/qwen3_5.py": "29a9e4c1d4ac5158b1981a526020ea6ddfe3d0fa0ac70c91c018f273ffc4ec96",
62
+ }
63
+
64
+
65
+ class Rejected(RuntimeError):
66
+ def __init__(self, message, code="INVALID", fatal=True):
67
+ super().__init__(message)
68
+ self.code, self.fatal = code, fatal
69
+
70
+
71
+ def require(value, message, code="INVALID"):
72
+ if not value:
73
+ raise Rejected(message, code)
74
+
75
+
76
+ def fields(value, required, optional=()):
77
+ require(type(value) is dict and set(required) <= set(value) and set(value) <= set(required) | set(optional), "Unknown or missing fields")
78
+
79
+
80
+ def integer(value, low, high):
81
+ require(type(value) is int and low <= value <= high, "Integer allowance exceeded", "CAPACITY")
82
+ return value
83
+
84
+
85
+ def canonical(value):
86
+ return json.dumps(value, sort_keys=True, separators=(",", ":"), ensure_ascii=False, allow_nan=False)
87
+
88
+
89
+ def digest(value):
90
+ return hashlib.sha256(canonical(value).encode()).hexdigest()
91
+
92
+
93
+ def finite_json(value):
94
+ if type(value) is dict:
95
+ for child in value.values(): finite_json(child)
96
+ elif type(value) is list:
97
+ for child in value: finite_json(child)
98
+ elif type(value) is float:
99
+ require(math.isfinite(value), "Nonfinite JSON")
100
+
101
+
102
+ def no_duplicates(pairs):
103
+ value = {}
104
+ for key, child in pairs:
105
+ require(key not in value, "Duplicate JSON key")
106
+ value[key] = child
107
+ return value
108
+
109
+
110
+ def parse_json(raw):
111
+ value = json.loads(raw, object_pairs_hook=no_duplicates, parse_constant=lambda _: (_ for _ in ()).throw(Rejected("Nonfinite JSON")))
112
+ finite_json(value)
113
+ return value
114
+
115
+
116
+ def plan(value):
117
+ fields(value, ("schema", "binding", "gpuUuid", "reservedMiB", "requestPolicyDigest", "engine", "limits", "source"))
118
+ require(value["schema"] == VERSION and type(value["gpuUuid"]) is str and GPU.fullmatch(value["gpuUuid"]), "Exact startup version/GPU required")
119
+ integer(value["reservedMiB"], 1024, 131072)
120
+ binding = value["binding"]
121
+ fields(binding, ("schema", "id", "backend", "modelDigest", "architectureMapDigest", "runtimeBuildDigest", "dependencyLockDigest", "tokenizerDigest", "chatTemplateDigest", "contextLimit"))
122
+ require(binding["schema"] == "omnius.nol.runtime.v1" and binding["backend"] == "vllm" and type(binding["id"]) is str and re.fullmatch(r"[A-Za-z0-9][A-Za-z0-9_.:-]{0,159}", binding["id"]), "Exact vLLM binding required")
123
+ for key in ("modelDigest", "architectureMapDigest", "runtimeBuildDigest", "dependencyLockDigest", "tokenizerDigest", "chatTemplateDigest"):
124
+ require(type(binding[key]) is str and SHA.fullmatch(binding[key]), "Full runtime/model identity required", "IDENTITY")
125
+ integer(binding["contextLimit"], 1, 1048576)
126
+ require(type(value["requestPolicyDigest"]) is str and SHA.fullmatch(value["requestPolicyDigest"]), "Exact request policy digest required", "IDENTITY")
127
+ source = value["source"]
128
+ fields(source, ("workerSha256", "companionSha256", "runtimeSha256"))
129
+ for item in source.values(): require(type(item) is str and SHA.fullmatch(item), "Full worker source identities required", "IDENTITY")
130
+ engine = value["engine"]
131
+ fields(engine, ("dtype", "maxModelLen", "maxNumBatchedTokens", "maxNumSeqs", "kvCacheBytes", "seed", "tensorParallelSize", "pipelineParallelSize", "dataParallelSize", "executor", "enforceEager", "chunkedPrefill", "prefixCaching", "asyncScheduling", "taps", "speculative", "lora", "logStats"))
132
+ require(engine["logStats"] is True, "Native RequestStateStats must be enabled", "UNSUPPORTED")
133
+ require(engine["dtype"] == "bfloat16" and engine["executor"] == "uni" and engine["enforceEager"] is True and
134
+ all(type(engine[key]) is int and engine[key] == 1 for key in ("maxNumSeqs", "tensorParallelSize", "pipelineParallelSize", "dataParallelSize")) and
135
+ all(engine[key] is False for key in ("chunkedPrefill", "prefixCaching", "asyncScheduling", "speculative", "lora")) and engine["taps"] == [],
136
+ "Only bounded sync eager single-rank legacy startup is supported", "UNSUPPORTED")
137
+ integer(engine["maxModelLen"], 1, min(256, binding["contextLimit"]))
138
+ integer(engine["maxNumBatchedTokens"], engine["maxModelLen"], 256)
139
+ integer(engine["kvCacheBytes"], 1048576, min(1073741824, value["reservedMiB"] * 1048576))
140
+ integer(engine["seed"], 0, 4294967295)
141
+ limits = value["limits"]
142
+ fields(limits, ("maxProfileCalls", "maxDummyForwards", "maxForwardPositions", "maxRoutineCalls", "maxRoutinePositions", "maxSamplerDrawRows", "maxCaptureBytes", "maxCaptures", "maxGeneratedTokens", "maxLoadBytes", "maxGateMs"))
143
+ integer(limits["maxProfileCalls"], 1, 2)
144
+ integer(limits["maxDummyForwards"], 1, 4)
145
+ integer(limits["maxForwardPositions"], engine["maxNumBatchedTokens"], 1024)
146
+ integer(limits["maxRoutineCalls"], 1, 64)
147
+ integer(limits["maxRoutinePositions"], 1, 4096)
148
+ integer(limits["maxSamplerDrawRows"], 0, 16)
149
+ require(all(limits[key] == 0 and type(limits[key]) is int for key in ("maxCaptureBytes", "maxCaptures", "maxGeneratedTokens")), "Capture/generation remain unsupported", "UNSUPPORTED")
150
+ integer(limits["maxLoadBytes"], 1, 68719476736)
151
+ integer(limits["maxGateMs"], 1, 900000)
152
+ return parse_json(canonical(value))
153
+
154
+
155
+ def source_inventory():
156
+ versions = {name: importlib.metadata.version(name) for name in ("vllm", "nnsight", "torch", "transformers")}
157
+ require(versions == {"vllm": "0.27.1", "nnsight": "0.8.2", "torch": "2.13.0", "transformers": "5.22.1"} or
158
+ versions == {"vllm": "0.27.1", "nnsight": "0.8.2", "torch": "2.13.0+cu130", "transformers": "5.22.1"}, "Unreviewed runtime versions", "UNSUPPORTED")
159
+ observed = {}
160
+ for name, expected in SOURCE_PINS.items():
161
+ package = name.split("/", 1)[0]
162
+ path = Path(importlib.metadata.distribution(package).locate_file(name))
163
+ require(not path.is_symlink() and path.is_file() and path.stat().st_size <= 4194304, "Unbounded/symlink source pin", "IDENTITY")
164
+ actual = hashlib.sha256(path.read_bytes()).hexdigest()
165
+ require(actual == expected, "Reviewed runtime source changed", "IDENTITY")
166
+ observed[name] = actual
167
+ return {"versions": versions, "sourcePins": observed}
168
+
169
+
170
+ def file_identity(path, remaining):
171
+ """Bounded full bytes, including executable pyc; never import the file."""
172
+ path = Path(path)
173
+ flags = os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK
174
+ fd = os.open(path, flags)
175
+ try:
176
+ before = os.fstat(fd)
177
+ require(stat.S_ISREG(before.st_mode) and 0 <= before.st_size <= remaining, "Runtime inventory file allowance exceeded", "CAPACITY")
178
+ value, count = hashlib.sha256(), 0
179
+ while True:
180
+ block = os.read(fd, min(1048576, remaining - count + 1))
181
+ if not block: break
182
+ count += len(block)
183
+ require(count <= remaining, "Runtime inventory byte allowance exceeded", "CAPACITY")
184
+ value.update(block)
185
+ after = os.fstat(fd)
186
+ require((before.st_dev, before.st_ino, before.st_size, before.st_mtime_ns, before.st_ctime_ns, before.st_mode) ==
187
+ (after.st_dev, after.st_ino, after.st_size, after.st_mtime_ns, after.st_ctime_ns, after.st_mode) and count == before.st_size,
188
+ "Runtime file changed during inventory", "IDENTITY")
189
+ return {"sha256": value.hexdigest(), "sizeBytes": count}
190
+ finally: os.close(fd)
191
+
192
+
193
+ def runtime_inventory(lock_path, expected_lock_sha256, max_bytes, max_files):
194
+ """Full installed executable inventory, not a claim to trace CUDA kernels.
195
+
196
+ Python -B does NOT disable reading pyc. Include unlisted cache files under
197
+ every installed code root, wheel metadata, interpreter and relevant env.
198
+ This function is stdlib-only and never imports a framework or creates a model.
199
+ """
200
+ integer(max_bytes, 1, 68719476736); integer(max_files, 1, 400000)
201
+ require(type(lock_path) is str and Path(lock_path).is_absolute() and SHA.fullmatch(expected_lock_sha256 or ""), "Pinned absolute dependency lock required", "IDENTITY")
202
+ spent, seen, stamps, roots = 0, {}, {}, set()
203
+
204
+ def stamp(path):
205
+ s = os.stat(path, follow_symlinks=False)
206
+ require(stat.S_ISREG(s.st_mode), "Runtime inventory type changed", "IDENTITY")
207
+ return (s.st_dev, s.st_ino, s.st_size, s.st_mtime_ns, s.st_ctime_ns, s.st_mode)
208
+
209
+ def pinned(path):
210
+ nonlocal spent
211
+ path = Path(path)
212
+ require(not path.is_symlink(), "Runtime code symlink is unsupported", "IDENTITY")
213
+ name = str(path.absolute())
214
+ if name in seen: return seen[name]
215
+ require(len(seen) < max_files, "Runtime inventory file allowance exceeded", "CAPACITY")
216
+ before = stamp(path)
217
+ info = file_identity(path, max_bytes - spent)
218
+ require(stamp(path) == before, "Runtime inventory file changed", "IDENTITY")
219
+ spent += info["sizeBytes"]; seen[name], stamps[name] = info, before
220
+ return info
221
+
222
+ lock = pinned(lock_path)
223
+ require(lock["sha256"] == expected_lock_sha256, "Dependency lock changed", "IDENTITY")
224
+ executable = pinned(Path(os.path.realpath(os.sys.executable)))
225
+ packages = []
226
+ distributions = sorted(importlib.metadata.distributions(), key=lambda d: str(d.metadata.get("Name", "")).lower())
227
+ require(len(distributions) <= 4096, "Runtime distribution allowance exceeded", "CAPACITY")
228
+ names = set()
229
+ for distribution in distributions:
230
+ name = distribution.metadata.get("Name", "")
231
+ require(type(name) is str and name and name.lower() not in names, "Duplicate/unnamed runtime distribution", "IDENTITY")
232
+ names.add(name.lower()); entries = []
233
+ files = sorted(distribution.files or [], key=str)
234
+ require(files and len(files) <= max_files, "Missing/unbounded wheel inventory", "IDENTITY")
235
+ for relative in files:
236
+ text = str(relative)
237
+ if not (EXECUTABLE.search(text) or text.endswith(("/METADATA", "/WHEEL", "/RECORD", "/entry_points.txt"))): continue
238
+ path = Path(distribution.locate_file(relative))
239
+ entries.append({"path": text, **pinned(path)})
240
+ # Include cache files missing from wheel RECORD. A top-level module
241
+ # contributes its parent; a package contributes its exact code root.
242
+ if text.endswith(".py") and not text.startswith("../"):
243
+ first = Path(text).parts[0]
244
+ root = Path(distribution.locate_file(first))
245
+ roots.add(root if root.is_dir() else root.parent)
246
+ packages.append({"name": name, "version": distribution.version, "files": len(entries), "digest": digest(entries)})
247
+ caches, discovered, walked_roots = [], [], []
248
+ for root in sorted(roots, key=lambda p: (len(p.parts), str(p))):
249
+ if any(root == prior or prior in root.parents for prior in walked_roots): continue
250
+ walked_roots.append(root)
251
+ require(root.is_dir() and not root.is_symlink(), "Runtime code root changed", "IDENTITY")
252
+ # Never follow directory symlinks. Hash all executable cache payloads,
253
+ # including optimized/unrecorded pyc; merely setting -B is insufficient.
254
+ for directory, directories, files in os.walk(root, followlinks=False):
255
+ require(len(directories) + len(files) <= max_files, "Runtime directory allowance exceeded", "CAPACITY")
256
+ for name in directories:
257
+ require(not Path(directory, name).is_symlink(), "Runtime code directory symlink", "IDENTITY")
258
+ for name in sorted(files):
259
+ if EXECUTABLE.search(name):
260
+ path = Path(directory, name)
261
+ missing = str(path.absolute()) not in seen
262
+ entry = {"path": str(path.absolute()), **pinned(path)}
263
+ if name.endswith(".pyc"): caches.append(entry)
264
+ if missing: discovered.append(entry)
265
+ require(len(caches) <= max_files, "Runtime bytecode allowance exceeded", "CAPACITY")
266
+ # Explicit names avoid accidentally disclosing unrelated credentials whose
267
+ # names happen to share a framework prefix. Unknown vLLM execution knobs
268
+ # require review instead of silently changing the frozen engine.
269
+ env_keys = ("PATH", "HOME", "TMPDIR", "LANG", "LC_ALL", "HIP_VISIBLE_DEVICES", "ROCR_VISIBLE_DEVICES", "CUDA_VISIBLE_DEVICES", "CUDA_MODULE_LOADING", "NVIDIA_VISIBLE_DEVICES", "PYTHONPATH", "PYTHONHOME", "PYTHONNOUSERSITE", "PYTHONPYCACHEPREFIX", "PYTHONDONTWRITEBYTECODE", "PYTORCH_CUDA_ALLOC_CONF", "PYTORCH_ALLOC_CONF", "TORCHINDUCTOR_CACHE_DIR", "TRITON_CACHE_DIR", "HF_HUB_OFFLINE", "TRANSFORMERS_OFFLINE", "VLLM_USE_V1", "VLLM_USE_V2_MODEL_RUNNER", "VLLM_ENABLE_V1_MULTIPROCESSING", "VLLM_WORKER_MULTIPROC_METHOD", "VLLM_USE_DEEP_GEMM", "VLLM_USE_FLASHINFER_SAMPLER", "VLLM_DEEP_GEMM_WARMUP", "VLLM_FLASHINFER_AUTOTUNE_SKIP_OPS", "VLLM_TARGET_DEVICE", "VLLM_LOGGING_LEVEL", "VLLM_ATTENTION_BACKEND", "VLLM_PLUGINS", "VLLM_ALLOW_INSECURE_SERIALIZATION")
270
+ require(not any(key.startswith("VLLM_") and key not in env_keys for key in os.environ), "Unreviewed vLLM environment option", "IDENTITY")
271
+ relevant = {key: os.environ[key] for key in env_keys if key in os.environ}
272
+ stdlib = []
273
+ cache_paths = {entry["path"] for entry in caches}
274
+ stdlib_roots = set(Path(p) for key, p in sysconfig.get_paths().items() if key in ("stdlib", "platstdlib"))
275
+ for root in sorted(stdlib_roots, key=str):
276
+ require(root.is_dir() and not root.is_symlink(), "Unreviewed Python stdlib root", "IDENTITY")
277
+ for directory, directories, files in os.walk(root, followlinks=False):
278
+ # Different installations' site-packages are not the active venv.
279
+ # Active installed packages are covered by wheel roots above.
280
+ directories[:] = [name for name in directories if name not in ("site-packages", "dist-packages")]
281
+ require(len(directories) + len(files) <= max_files, "Python stdlib directory allowance exceeded", "CAPACITY")
282
+ for name in directories: require(not Path(directory, name).is_symlink(), "Python stdlib symlink", "IDENTITY")
283
+ for name in sorted(files):
284
+ if EXECUTABLE.search(name):
285
+ path = Path(directory, name)
286
+ entry = {"path": str(path.absolute()), **pinned(path)}
287
+ stdlib.append(entry)
288
+ if name.endswith(".pyc") and entry["path"] not in cache_paths:
289
+ caches.append(entry); cache_paths.add(entry["path"])
290
+ library = None
291
+ if sysconfig.get_config_var("Py_ENABLE_SHARED"):
292
+ path = Path(sysconfig.get_config_var("LIBDIR"), sysconfig.get_config_var("LDLIBRARY")).resolve(strict=True)
293
+ library = {"path": str(path), **pinned(path)}
294
+ archives = []
295
+ for item in os.sys.path:
296
+ if item and str(item).endswith((".zip", ".egg")) and Path(item).exists():
297
+ archives.append({"path": str(Path(item).absolute()), **pinned(item)})
298
+ # No generic environment or credentials are emitted; only executable/runtime
299
+ # flags are frozen. CUDA_VISIBLE_DEVICES must still be scoped by the lease.
300
+ require(len(canonical(relevant).encode()) <= 65536, "Runtime environment allowance exceeded", "CAPACITY")
301
+ body = {"schema": "omnius.nol.vllm-runtime-inventory.v1", "pythonVersion": os.sys.version.split()[0],
302
+ "pythonExecutable": executable, "pythonCacheTag": os.sys.implementation.cache_tag,
303
+ "pythonRuntimeLibrary": library, "pythonStdlib": {"files": len(stdlib), "digest": digest(stdlib)},
304
+ "pythonImportArchives": archives, "pythonImportPathDigest": digest(os.sys.path),
305
+ "bytecodeMagic": importlib.util.MAGIC_NUMBER.hex(), "optimization": os.sys.flags.optimize, "isolated": bool(os.sys.flags.isolated), "userSiteDisabled": bool(os.sys.flags.no_user_site), "bytecodeWritesDisabled": bool(os.sys.flags.dont_write_bytecode) and os.sys.dont_write_bytecode,
306
+ "dependencyLock": lock, "packages": packages, "bytecode": {"files": len(caches), "digest": digest(sorted(caches, key=lambda x: x["path"]))},
307
+ "unrecordedExecutable": {"files": len(discovered), "digest": digest(sorted(discovered, key=lambda x: x["path"]))},
308
+ "environment": relevant, "files": len(seen), "bytes": spent,
309
+ "scope": "installed_wheel_code_metadata_stdlib_executable_bytecode_interpreter_and_lock_not_driver_or_future_JIT_artifacts",
310
+ "nativeConformance": "unverified", "capabilityAuthority": "none"}
311
+ for path, expected in stamps.items():
312
+ require(stamp(path) == expected, "Runtime changed during complete inventory", "IDENTITY")
313
+ return {**body, "inventoryDigest": digest(body)}
314
+
315
+
316
+ class Admission:
317
+ def __init__(self, startup):
318
+ self.plan = plan(startup)
319
+ self.phase, self.epoch = "created", 0
320
+ self.counts = {"profileCalls": 0, "dummyForwards": 0, "forwardPositions": 0, "observedModelForwards": 0,
321
+ "routineCalls": 0, "routinePositions": 0, "samplerDrawRows": 0, "captures": 0,
322
+ "captureBytes": 0, "generatedTokens": 0, "unknownAttempts": 0}
323
+ self.routines, self.active = [], None
324
+ self.grant_used = False
325
+ self.model_load_wall_seconds = None
326
+
327
+ def deny(self, message, code="ADMISSION"):
328
+ self.counts["unknownAttempts"] += 1
329
+ self.phase = "poisoned"
330
+ raise Rejected(message, code)
331
+
332
+ def begin_load(self):
333
+ if self.phase != "created": self.deny("Load cannot be replayed")
334
+ self.phase = "loading"
335
+
336
+ def resident(self):
337
+ if self.phase != "loading": self.deny("Resident event out of order")
338
+ self.phase = "awaiting_placement"
339
+
340
+ def confirm(self):
341
+ if self.phase != "awaiting_placement" or self.grant_used: self.deny("Placement grant out of order or replayed")
342
+ self.grant_used, self.phase = True, "initializing"
343
+
344
+ def charge(self, counter, amount, limit):
345
+ if self.phase != "initializing": self.deny("Startup computation precedes actual host placement")
346
+ integer(amount, 0, 1048576)
347
+ if self.counts[counter] + amount > self.plan["limits"][limit]: self.deny("Startup work allowance exhausted: counter=" + counter + " current=" + str(self.counts[counter]) + " request=" + str(amount) + " limit=" + str(self.plan["limits"][limit]), "CAPACITY")
348
+ self.counts[counter] += amount
349
+
350
+ @contextlib.contextmanager
351
+ def profile(self):
352
+ self.charge("profileCalls", 1, "maxProfileCalls")
353
+ yield
354
+
355
+ @contextlib.contextmanager
356
+ def forward(self, positions):
357
+ if self.active is not None: self.deny("Nested/unclassified model forward")
358
+ self.charge("dummyForwards", 1, "maxDummyForwards")
359
+ self.charge("forwardPositions", integer(positions, 1, self.plan["engine"]["maxNumBatchedTokens"]), "maxForwardPositions")
360
+ self.active = {"kind": "forward", "observed": 0}
361
+ try:
362
+ yield
363
+ if self.active["observed"] != 1: self.deny("Admitted forward was not independently observed exactly once")
364
+ finally:
365
+ self.active = None
366
+
367
+ def model_forward(self):
368
+ if self.phase == "request" and getattr(self, "request_bridge", None) is not None:
369
+ return self.request_bridge.observed_root()
370
+ if self.phase != "initializing" or self.active is None or self.active["kind"] != "forward": self.deny("Unclassified real model forward")
371
+ self.active["observed"] += 1
372
+ if self.active["observed"] > 1: self.deny("Multiple real forwards under one admission")
373
+ self.counts["observedModelForwards"] += 1
374
+
375
+ @contextlib.contextmanager
376
+ def routine(self, name, positions=0):
377
+ if name not in ROUTINES or self.active is not None: self.deny("Unknown or nested native warmup routine")
378
+ self.charge("routineCalls", 1, "maxRoutineCalls")
379
+ self.charge("routinePositions", positions, "maxRoutinePositions")
380
+ self.routines.append({"name": name, "positions": positions})
381
+ self.active = {"kind": "routine", "name": name}
382
+ try: yield
383
+ finally: self.active = None
384
+
385
+ def sampler_draw(self, rows):
386
+ if self.phase == "request" and getattr(self, "request_bridge", None) is not None:
387
+ return self.request_bridge.observed_sampler(rows)
388
+ if self.active is None or self.active.get("name") != "sampler_warmup": self.deny("Unclassified synthetic sampler draw")
389
+ self.charge("samplerDrawRows", rows, "maxSamplerDrawRows")
390
+
391
+ def finish(self):
392
+ if self.phase != "initializing" or self.active is not None or self.counts["unknownAttempts"] or self.counts["profileCalls"] < 1 or self.counts["dummyForwards"] < 1 or self.counts["observedModelForwards"] != self.counts["dummyForwards"]: self.deny("Startup cannot finish with unknown/active/unobserved work")
393
+ if getattr(self, "requires_native_startup", False) and not getattr(self, "native_startup_completed", False): self.deny("Actual upstream startup did not complete")
394
+ self.phase = "ready"
395
+ return self.receipt()
396
+
397
+ def stop(self):
398
+ self.phase = "stopping"
399
+
400
+ def receipt(self):
401
+ return {"schema": "omnius.nol.vllm-startup-observation.v1", "phase": self.phase, "counts": dict(self.counts),
402
+ "routines": list(self.routines), "routineUnit": "logical_native_routine_invocations_not_physical_CUDA_kernel_count",
403
+ "nativeConformance": "unverified", "capabilityAuthority": "none",
404
+ "performance": {"schema": "omnius.nol.vllm-startup-performance.v1", "modelLoadWallSeconds": self.model_load_wall_seconds,
405
+ "modelLoadDefinition": "monotonic_super_load_model_weights_and_nnsight_envoy_setup_excluding_manual_gates_and_later_warmup",
406
+ "sharedOncePerWorker": True, "nativeRequestStatsEnabled": True, "memory": None,
407
+ "memoryUnavailableReason": "no_independent_memory_observer_in_startup_wire"}}
408
+
409
+
410
+ def process_start():
411
+ raw = Path("/proc/self/stat").read_text()
412
+ value = raw[raw.rfind(")") + 2:].split()[19]
413
+ require(value.isdigit() and int(value) > 0, "Process identity unavailable", "IDENTITY")
414
+ return value
415
+
416
+
417
+ def write_frame(fd, value, maximum=65536):
418
+ raw = canonical(value).encode()
419
+ require(0 < len(raw) <= maximum, "Private frame capacity exceeded", "CAPACITY")
420
+ payload = struct.pack(">I", len(raw)) + raw
421
+ while payload:
422
+ count = os.write(fd, payload)
423
+ require(count > 0, "Private channel closed", "CUSTODY")
424
+ payload = payload[count:]
425
+
426
+
427
+ def read_frame(fd, maximum, deadline):
428
+ def exact(size):
429
+ parts = []
430
+ while size:
431
+ remaining = deadline - time.monotonic()
432
+ require(remaining > 0, "Private placement channel timed out; process custody retained", "CUSTODY")
433
+ require(select.select([fd], [], [], remaining)[0], "Private placement channel timed out", "CUSTODY")
434
+ raw = os.read(fd, size)
435
+ require(raw, "Private placement channel closed", "CUSTODY")
436
+ parts.append(raw); size -= len(raw)
437
+ return b"".join(parts)
438
+ size = struct.unpack(">I", exact(4))[0]
439
+ require(0 < size <= maximum, "Private channel frame exceeds allowance", "CAPACITY")
440
+ return parse_json(exact(size).decode("utf8"))
441
+
442
+
443
+ class PrivatePlacement:
444
+ def __init__(self, identity, startup, event_fd=3, grant_fd=4):
445
+ fields(identity, ("sessionId", "jobId", "ownerId", "generation", "loadNonce"))
446
+ require(all(type(identity[key]) is str and 1 <= len(identity[key]) <= 1024 and not any(ord(char) < 32 for char in identity[key]) for key in ("sessionId", "jobId", "ownerId", "loadNonce")), "Bounded private ownership required", "IDENTITY")
447
+ integer(identity["generation"], 1, 9007199254740991)
448
+ require(type(event_fd) is int and type(grant_fd) is int and event_fd > 2 and grant_fd > 2 and event_fd != grant_fd, "Separate inherited private descriptors required", "CUSTODY")
449
+ self.identity, self.startup = dict(identity), plan(startup)
450
+ self.event_fd, self.grant_fd, self.used = event_fd, grant_fd, set()
451
+ for fd in (event_fd, grant_fd):
452
+ mode = os.fstat(fd).st_mode
453
+ require(stat.S_ISFIFO(mode) or stat.S_ISSOCK(mode), "Private inherited pipes required", "CUSTODY")
454
+
455
+ def await_grant(self, kind, placement=None):
456
+ require(kind in ("authorize_load", "confirm_placement") and kind not in self.used, "Private authority replay", "CUSTODY")
457
+ self.used.add(kind)
458
+ event = {"schema": PRIVATE, "kind": kind, **self.identity, "pid": os.getpid(), "startIdentity": process_start(),
459
+ "gpuUuid": self.startup["gpuUuid"], "planDigest": digest(self.startup)}
460
+ if placement is not None: event["resident"] = placement
461
+ write_frame(self.event_fd, event)
462
+ grant = read_frame(self.grant_fd, 65536, time.monotonic() + self.startup["limits"]["maxGateMs"] / 1000)
463
+ require(grant == {**event, "grant": "proceed"}, "Private grant identity/scope/source/replay mismatch", "CUSTODY")
464
+ return event
465
+
466
+
467
+ class NativeSourceGuards:
468
+ """Guards pinned upstream calls in a dedicated one-rank worker process.
469
+
470
+ The dependency port admits explicit CPU fixture modules, never a native
471
+ compatibility receipt. No imports or model constructors occur here.
472
+ Accounting is logical model/routine calls; allocations, CUDA initialization
473
+ and internal physical kernel launches are NOT exhaustively traced.
474
+ """
475
+ NOOPS = ("deepseek_v4_mhc_warmup", "flashinfer_sparse_mla_decode_autotune_warmup", "deepseek_v4_sparse_mla_attention_warmup", "minimax_m3_msa_warmup")
476
+ DENIED = ("kimi_k3_triton_warmup", "fa4_cutedsl_warmup", "sparse_mla_triton_warmup", "_warmup_ll_bf16_router_gemm", "cutedsl_warmup", "deep_gemm_warmup", "flashinfer_autotune")
477
+
478
+ def __init__(self, controller, torch_module, modules):
479
+ self.controller, self.torch, self.modules = controller, torch_module, dict(modules)
480
+ self.handles, self.patches, self.runner = [], [], None
481
+ self.allocator_peak_observed, self.allocator_reset_calls, self.allocator_available = 0, 0, False
482
+ self.warming, self.started, self.completed, self.armed = False, False, False, False
483
+ self.profile_hook, self.prior_profiler = self._python_forward, None
484
+ self.controller.requires_native_startup = True
485
+
486
+ def _patch(self, obj, name, wrapper):
487
+ owner = (obj.__module__ + "." + obj.__qualname__) if isinstance(obj, type) else getattr(obj, "__name__", type(obj).__module__ + "." + type(obj).__qualname__)
488
+ qualified = str(owner)[:384] + "." + str(name)[:128]
489
+ require(hasattr(obj, name), "Pinned native call is missing: " + qualified, "IDENTITY")
490
+ original = getattr(obj, name)
491
+ require(callable(original), "Pinned native call is not callable: " + qualified, "IDENTITY")
492
+ self.patches.append((obj, name, original)); setattr(obj, name, wrapper(original))
493
+
494
+ def _module_call(self, module, args):
495
+ c = self.controller
496
+ if c.phase not in ("initializing", "request") or c.active is None: c.deny("Module forward before placement or outside admitted work")
497
+
498
+ def _python_forward(self, frame, event, arg):
499
+ # Also catch direct Python .forward() calls that bypass nn.Module's
500
+ # __call__ prehooks during loading. This is deliberately not described
501
+ # as a trace of native C++/CUDA kernels or arbitrary foreign threads.
502
+ if event == "call" and frame.f_code.co_name in ("forward", "forward_native") and frame.f_locals.get("self") is not self.controller:
503
+ if self.controller.phase not in ("initializing", "request") or self.controller.active is None:
504
+ self.controller.deny("Direct forward before placement or outside admitted startup")
505
+
506
+ def begin(self, worker):
507
+ require(not self.started, "Native guard cannot be replayed", "CUSTODY")
508
+ self.validate_configuration(worker)
509
+ require(self.controller.phase == "loading", "Guard must precede device initialization", "CUSTODY")
510
+ if not self.armed: self.arm()
511
+ require(os.sys.getprofile() is self.profile_hook, "Startup forward guard changed", "CUSTODY")
512
+ self.started = True
513
+
514
+ def arm(self):
515
+ # The real factory arms before an engine constructor can run plugins,
516
+ # worker constructors or weight loading. CPU fixtures may arm in begin.
517
+ require(not self.armed and self.controller.phase == "loading", "Forward guard arming replay", "CUSTODY")
518
+ self.install_allocator_observer()
519
+ self.prior_profiler = os.sys.getprofile()
520
+ require(self.prior_profiler is None, "Foreign Python profiler is unsupported", "UNSUPPORTED")
521
+ os.sys.setprofile(self.profile_hook)
522
+ self.handles.append(self.torch.nn.modules.module.register_module_forward_pre_hook(self._module_call))
523
+ self.install_sampler_guard()
524
+ self.armed = True
525
+
526
+ def install_allocator_observer(self):
527
+ cuda = getattr(self.torch, "cuda", None)
528
+ self.allocator_available = cuda is not None and all(callable(getattr(cuda, key, None)) for key in ("current_device", "memory_allocated", "memory_reserved", "max_memory_allocated", "get_allocator_backend"))
529
+ if not self.allocator_available: return
530
+ def reset_wrapper(original):
531
+ def invoke(*args, **kwargs):
532
+ # Preserve upstream's exact resets; add none. The load profiler
533
+ # resets its counter at entry/exit, so retain the earlier peak.
534
+ self.memory_snapshot()
535
+ self.allocator_reset_calls += 1
536
+ require(self.allocator_reset_calls <= 1024, "Allocator reset observation allowance", "CAPACITY")
537
+ return original(*args, **kwargs)
538
+ return invoke
539
+ for api in (cuda, getattr(self.torch, "accelerator", None)):
540
+ if api is not None and callable(getattr(api, "reset_peak_memory_stats", None)):
541
+ self._patch(api, "reset_peak_memory_stats", reset_wrapper)
542
+
543
+ def memory_snapshot(self):
544
+ if not self.allocator_available: return None
545
+ cuda = self.torch.cuda
546
+ require(cuda.current_device() == 0, "Allocator snapshot escaped scoped CUDA device", "IDENTITY")
547
+ if cuda.get_allocator_backend() != "native": return None
548
+ allocated, reserved, current_peak = (getattr(cuda, name)(0) for name in ("memory_allocated", "memory_reserved", "max_memory_allocated"))
549
+ for value in (allocated, reserved, current_peak): integer(value, 0, 128 * 1073741824)
550
+ require(reserved >= allocated and current_peak >= allocated, "Allocator observation ordering differs", "IDENTITY")
551
+ self.allocator_peak_observed = max(self.allocator_peak_observed, current_peak)
552
+ return {"schema": "omnius.nol.vllm-cuda-allocator.v1", "logicalDevice": 0, "gpuUuid": self.controller.plan["gpuUuid"], "allocatorBackend": "native",
553
+ "allocatedBytes": allocated, "reservedBytes": reserved, "currentEpochPeakAllocatedBytes": current_peak,
554
+ "observedWorkerPeakAllocatedBytes": self.allocator_peak_observed, "observedPublicPeakResetCalls": self.allocator_reset_calls,
555
+ "scope": "process_torch_cuda_allocator_observed_cumulative_peak_including_load_warmup_and_prior_requests",
556
+ "peakDefinition": "maximum_before_source_reviewed_public_peak_resets_and_current_snapshot_not_driver_or_per_trial_kernel_peak"}
557
+
558
+ def validate_configuration(self, worker):
559
+ v, p = worker.vllm_config, self.controller.plan
560
+ parallel, scheduler, cache, model, compilation = v.parallel_config, v.scheduler_config, v.cache_config, v.model_config, v.compilation_config
561
+ require(os.environ.get("VLLM_USE_FLASHINFER_SAMPLER") == "0", "Source-owned native PyTorch GPU sampler changed", "IDENTITY")
562
+ require(str(v.device_config.device) in ("cuda", "cuda:0"), "Only the sole scoped CUDA device is admitted; no CPU fallback", "UNSUPPORTED")
563
+ require(all(getattr(parallel, key) == 1 for key in ("tensor_parallel_size", "pipeline_parallel_size", "data_parallel_size")) and parallel.distributed_executor_backend == "uni", "Only the scoped in-process rank is supported", "UNSUPPORTED")
564
+ require(not getattr(parallel, "enable_eplb", False) and not getattr(parallel, "enable_elastic_ep", False) and not getattr(worker, "use_v2_model_runner", False), "Unreviewed elastic/V2 path", "UNSUPPORTED")
565
+ require(getattr(parallel, "worker_extension_cls", None) in (None, "") and os.environ.get("VLLM_ENABLE_V1_MULTIPROCESSING") == "0" and os.environ.get("VLLM_USE_V2_MODEL_RUNNER") == "0" and os.environ.get("VLLM_PLUGINS") == "", "Unreviewed subprocess/plugin/extension path", "UNSUPPORTED")
566
+ require(str(model.dtype) == "torch.bfloat16" and model.enforce_eager is True and model.quantization is None and model.max_model_len == p["engine"]["maxModelLen"], "Native model precision/context differs", "IDENTITY")
567
+ require(getattr(model.hf_config, "model_type", None) == "qwen3_5" and getattr(model.hf_text_config, "num_hidden_layers", None) == 32 and getattr(model.hf_text_config, "hidden_size", None) == 2560 and not getattr(model.hf_text_config, "num_experts", None), "Only pinned dense Qwen3.5 text geometry is supported", "UNSUPPORTED")
568
+ require(model.multimodal_config is not None and model.multimodal_config.language_model_only is True, "Multimodal profiling needs separate admission", "UNSUPPORTED")
569
+ require(str(getattr(compilation.mode, "name", compilation.mode)) == "NONE" and str(getattr(compilation.cudagraph_mode, "name", compilation.cudagraph_mode)) == "NONE", "Compilation/CUDA graphs are not admitted", "UNSUPPORTED")
570
+ require(scheduler.max_num_seqs == 1 and scheduler.max_num_batched_tokens == p["engine"]["maxNumBatchedTokens"] and not scheduler.enable_chunked_prefill and not getattr(scheduler, "async_scheduling", False), "Unreviewed scheduler geometry", "UNSUPPORTED")
571
+ require(cache.kv_cache_memory_bytes == p["engine"]["kvCacheBytes"] and cache.enable_prefix_caching is False and v.speculative_config is None and v.lora_config is None and v.weight_transfer_config is None, "Unreviewed cache/adapter/weight-transfer path", "UNSUPPORTED")
572
+ require(v.kernel_config.enable_jit_warmup is False and v.kernel_config.enable_cutedsl_warmup is False and v.kernel_config.enable_flashinfer_autotune is False and os.environ.get("VLLM_USE_DEEP_GEMM") == "0", "Unknown JIT/autotune path is not admitted", "UNSUPPORTED")
573
+
574
+ def bind(self, runner):
575
+ require(self.started and self.runner is None and self.controller.phase == "loading", "Native observer bind out of order", "CUSTODY")
576
+ require(os.sys.getprofile() is self.profile_hook, "Pre-placement forward guard changed during load", "CUSTODY")
577
+ require(hasattr(runner, "nnsight_model") and hasattr(runner, "nnsight_requests") and hasattr(runner, "nnsight_persistent_objects"), "NNsight load state was not preserved", "IDENTITY")
578
+ topk = getattr(getattr(runner, "sampler", None), "topk_topp_sampler", None)
579
+ expected = self.modules["topk_sampler_type"]
580
+ forward = getattr(topk, "forward", None)
581
+ require(type(topk) is expected and getattr(forward, "__self__", None) is topk and
582
+ getattr(forward, "__func__", None) is expected.forward_native,
583
+ "Actual CUDA top-k/top-p sampler differs from pinned native PyTorch implementation", "IDENTITY")
584
+ self.runner = runner
585
+ self.handles.append(runner.get_model().register_forward_pre_hook(lambda module, args: self.controller.model_forward()))
586
+
587
+ def _routine(self, name, positions, original, *args, **kwargs):
588
+ c = self.controller
589
+ # These operators also occur inside an already admitted real forward.
590
+ if c.active is not None and c.active.get("kind") in ("forward", "request"): return original(*args, **kwargs)
591
+ if not self.warming: c.deny("Native routine outside upstream warmup")
592
+ with c.routine(name, positions): return original(*args, **kwargs)
593
+
594
+ def install_warmup_calls(self, worker):
595
+ import importlib
596
+ kernel, qwen, post = (self.modules[key] for key in ("kernel", "qwen", "post_conv"))
597
+ self._patch(kernel, "warm_v1_block_table_kernels", lambda original: lambda *a, **k: self._routine("block_table_warmup", 0, original, *a, **k))
598
+ zeroer = getattr(self.runner, "_kv_block_zeroer", None)
599
+ if zeroer is not None:
600
+ self._patch(zeroer, "warmup", lambda original: lambda *a, **k: self._routine("kv_zeroer_warmup", 0, original, *a, **k))
601
+ self._patch(qwen, "_warm_causal_conv1d_fwd_kernel", lambda original: lambda *a, **k: self._routine("qwen_causal_conv1d", 1, original, *a, **k))
602
+ self._patch(qwen, "_warm_fused_sigmoid_gating_delta_rule_update_kernel", lambda original: lambda *a, **k: self._routine("qwen_gating_delta", 1, original, *a, **k))
603
+
604
+ def post_wrapper(original):
605
+ def invoke(*args, **kwargs):
606
+ positions = int((args[0] if args else kwargs["conv_output"]).shape[0])
607
+ if positions not in (1, 2, 16) and self.controller.active is None: self.controller.deny("Unreviewed Qwen post-convolution geometry")
608
+ return self._routine("qwen_post_conv_" + str(positions), positions, original, *args, **kwargs)
609
+ return invoke
610
+ self._patch(post, "fused_post_conv_prep", post_wrapper)
611
+
612
+ for name in self.NOOPS:
613
+ def wrap_noop(original, name=name):
614
+ def invoke(*args, **kwargs):
615
+ require(self.warming and worker.vllm_config.model_config.hf_config.model_type == "qwen3_5", "Unreviewed foreign model dispatcher", "UNSUPPORTED")
616
+ # Pinned upstream Qwen predicates return without kernels.
617
+ # Execute those predicates instead of skipping dispatcher work.
618
+ return original(*args, **kwargs)
619
+ return invoke
620
+ # The pinned dispatcher imports MiniMax locally inside its function;
621
+ # patch the real owning module so that import gets this wrapper.
622
+ owner = importlib.import_module("vllm.model_executor.warmup.minimax_m3_msa_warmup") if name == "minimax_m3_msa_warmup" else kernel
623
+ self._patch(owner, name, wrap_noop)
624
+ for name in self.DENIED:
625
+ self._patch(kernel, name, lambda original, name=name: lambda *a, **k: self.controller.deny("Unexpected native warmup branch: " + name))
626
+
627
+ def install_sampler_guard(self):
628
+ # Profile_run samples before compile_or_warm_up_model. Install this
629
+ # guard before loading, not only in the later kernel dispatcher.
630
+ def sample_wrapper(original):
631
+ def invoke(instance, *args, **kwargs):
632
+ logits = args[0] if args else kwargs["logits"]
633
+ self.controller.sampler_draw(int(logits.shape[0]))
634
+ return original(instance, *args, **kwargs)
635
+ return invoke
636
+ self._patch(self.modules["sampler_type"], "forward", sample_wrapper)
637
+
638
+ @contextlib.contextmanager
639
+ def warmup(self, worker):
640
+ require(self.started and self.runner is worker.model_runner and self.controller.phase == "initializing" and not self.warming and not self.completed, "Warmup before placement or replayed", "CUSTODY")
641
+ self.validate_configuration(worker)
642
+ names = [group.backend.get_name() for groups in self.runner.attn_groups for group in groups]
643
+ require(names and all(name in ("FLASH_ATTN", "GDN_ATTN") for name in names), "Unreviewed attention/warmup dispatcher backend", "UNSUPPORTED")
644
+ require(tuple(self.torch.cuda.get_device_capability()) == (8, 0), "This startup protocol is scoped to A100", "UNSUPPORTED")
645
+ self.install_warmup_calls(worker); self.warming = True
646
+ try:
647
+ yield
648
+ self.completed = self.controller.native_startup_completed = True
649
+ finally: self.warming = False
650
+
651
+ def close(self):
652
+ if os.sys.getprofile() is self.profile_hook: os.sys.setprofile(self.prior_profiler)
653
+ for handle in reversed(self.handles): handle.remove()
654
+ self.handles.clear()
655
+ for obj, name, original in reversed(self.patches): setattr(obj, name, original)
656
+ self.patches.clear()
657
+
658
+
659
+ def owned_worker_class(base_worker, runner_type, controller, placement, native_guards=None):
660
+ """Same-instance runner subclass preserves the NNsight replacement/envoys.
661
+ Explicit fake classes exercise order only. They cannot mint native receipts.
662
+ """
663
+ class OwnedRunner(runner_type):
664
+ def profile_run(self):
665
+ with controller.profile(): return super().profile_run()
666
+
667
+ def _dummy_run(self, num_tokens, *args, **kwargs):
668
+ require(not kwargs.get("is_graph_capturing"), "CUDA graph capture unsupported", "UNSUPPORTED")
669
+ with controller.forward(num_tokens): return super()._dummy_run(num_tokens, *args, **kwargs)
670
+
671
+ def _dummy_sampler_run(self, hidden_states):
672
+ rows = int(hidden_states.shape[0])
673
+ with controller.routine("sampler_warmup", rows): return super()._dummy_sampler_run(hidden_states)
674
+
675
+ def execute_model(self, scheduler_output, intermediate_tensors=None):
676
+ bridge = getattr(controller, "request_bridge", None)
677
+ if bridge is None: controller.deny("Generation bridge is not installed", "UNSUPPORTED")
678
+ require(intermediate_tensors is None, "Pipeline tensors unsupported", "UNSUPPORTED")
679
+ bridge.before_execute(scheduler_output)
680
+ with bridge.scope("execute"):
681
+ return super().execute_model(scheduler_output, intermediate_tensors)
682
+
683
+ def _model_forward(self, *args, **kwargs):
684
+ bridge = getattr(controller, "request_bridge", None)
685
+ if controller.phase == "initializing": return super()._model_forward(*args, **kwargs)
686
+ require(bridge is not None and not args, "Fixed model-forward bridge required", "CUSTODY")
687
+ with bridge.model_forward(kwargs): return super()._model_forward(**kwargs)
688
+
689
+ def sample_tokens(self, *args, **kwargs):
690
+ bridge = getattr(controller, "request_bridge", None)
691
+ require(bridge is not None, "Fixed sampler bridge required", "CUSTODY")
692
+ with bridge.scope("sample"): return super().sample_tokens(*args, **kwargs)
693
+
694
+ def _sample(self, *args, **kwargs):
695
+ bridge = getattr(controller, "request_bridge", None)
696
+ require(bridge is not None, "Fixed actual-sample witness required", "CUSTODY")
697
+ with bridge.sampling():
698
+ result = super()._sample(*args, **kwargs)
699
+ bridge.sampled(result)
700
+ return result
701
+ def capture_model(self, *args, **kwargs): controller.deny("CUDA capture is unsupported", "UNSUPPORTED")
702
+
703
+ class OwnedWorker(base_worker):
704
+ def init_device(self):
705
+ if native_guards is not None: native_guards.begin(self)
706
+ super().init_device()
707
+ require(type(self.model_runner) is runner_type, "NNsight legacy runner replacement missing", "UNSUPPORTED")
708
+ self.model_runner.__class__ = OwnedRunner
709
+
710
+ def load_model(self, *args, **kwargs):
711
+ # Inherits NNsight's existing runner.load_model: one actual load,
712
+ # then its envoy/tokenizer/request state; no replacement constructor.
713
+ started = time.monotonic()
714
+ result = super().load_model(*args, **kwargs)
715
+ elapsed = time.monotonic() - started
716
+ require(math.isfinite(elapsed) and 0 <= elapsed <= 7200, "Model load observation is invalid", "IDENTITY")
717
+ controller.model_load_wall_seconds = elapsed
718
+ if native_guards is not None: native_guards.bind(self.model_runner)
719
+ controller.resident()
720
+ placement.await_grant("confirm_placement")
721
+ controller.confirm()
722
+ return result
723
+
724
+ def compile_or_warm_up_model(self):
725
+ # No silent no-op or skipped warmup. This foundation intentionally
726
+ # refuses the still-unvalidated dispatcher before calling it.
727
+ if native_guards is None:
728
+ controller.deny("Native warmup coverage requires separate model-specific conformance", "UNSUPPORTED")
729
+ with native_guards.warmup(self):
730
+ return super().compile_or_warm_up_model()
731
+
732
+ return OwnedWorker
733
+
734
+
735
+ def runtime_module():
736
+ # Leaf module is exact-source pinned, stdlib-only and never imports frameworks.
737
+ import sys
738
+ path = Path(__file__).resolve().with_name("nol-vllm-runtime.py")
739
+ require(not path.is_symlink() and path.is_file() and path.stat().st_size <= 1048576 and hashlib.sha256(path.read_bytes()).hexdigest() == RUNTIME_SHA, "Pinned request runtime changed", "IDENTITY")
740
+ name = "_nol_vllm_runtime"
741
+ if name in sys.modules:
742
+ require(getattr(sys.modules[name], "__file__", None) == str(path), "Runtime module collision", "IDENTITY")
743
+ return sys.modules[name]
744
+ spec = importlib.util.spec_from_file_location(name, path)
745
+ module = importlib.util.module_from_spec(spec)
746
+ sys.modules[name] = module
747
+ spec.loader.exec_module(module)
748
+ return module
749
+
750
+
751
+ def native_worker_class(controller, placement):
752
+ # Deliberately hard-unavailable until root installs the exact user-designated
753
+ # runtime. Neither request JSON, a passed flag nor an environment override can
754
+ # install that source-owned designation.
755
+ if NATIVE_RUNTIME_DESIGNATION is None:
756
+ raise Rejected("Native startup activation awaits model-specific conformance; no framework import attempted", "UNSUPPORTED")
757
+ designated = NATIVE_RUNTIME_DESIGNATION
758
+ fields(designated, ("modelDigest", "inventoryDigest", "dependencyLockPath", "dependencyLockSha256", "maxRuntimeBytes", "maxRuntimeFiles"))
759
+ require(isinstance(placement, PrivatePlacement) and "authorize_load" in placement.used and placement.startup == controller.plan, "Actual private load authority required before imports", "CUSTODY")
760
+ require(os.environ.get("VLLM_ENABLE_V1_MULTIPROCESSING") == "0" and os.environ.get("VLLM_USE_V2_MODEL_RUNNER") == "0" and os.environ.get("VLLM_PLUGINS") == "", "Explicit in-process plugin-free runtime required before imports", "UNSUPPORTED")
761
+ require(os.environ.get("VLLM_ALLOW_INSECURE_SERIALIZATION") in (None, "0"), "Insecure generic serialization unsupported", "UNSUPPORTED")
762
+ require(os.environ.get("VLLM_USE_FLASHINFER_SAMPLER") == "0", "Source-owned native PyTorch GPU sampler required before imports", "UNSUPPORTED")
763
+ require(controller.plan["binding"]["modelDigest"] == designated["modelDigest"] and controller.plan["binding"]["runtimeBuildDigest"] == designated["inventoryDigest"] and controller.plan["binding"]["dependencyLockDigest"] == designated["dependencyLockSha256"], "Designated native model/runtime differs", "IDENTITY")
764
+ actual = runtime_inventory(designated["dependencyLockPath"], designated["dependencyLockSha256"], designated["maxRuntimeBytes"], designated["maxRuntimeFiles"])
765
+ require(actual["inventoryDigest"] == designated["inventoryDigest"], "Complete native runtime inventory changed", "IDENTITY")
766
+ require(actual["isolated"] and actual["userSiteDisabled"] and actual["bytecodeWritesDisabled"], "Isolated designated interpreter required before imports", "UNSUPPORTED")
767
+ source_inventory()
768
+ return _materialize_native_worker(controller, placement)
769
+
770
+
771
+ def _materialize_native_worker(controller, placement):
772
+ """Real upstream types; called only behind the source-owned designation.
773
+ Importing these types never constructs an LLM/model here. The initialized
774
+ NNsight runner is subclassed in place by owned_worker_class.
775
+ """
776
+ import importlib
777
+ torch_module = importlib.import_module("torch")
778
+ base = importlib.import_module("nnsight.modeling.vllm.workers.GPUWorker").NNsightGPUWorker
779
+ runner = importlib.import_module("nnsight.modeling.vllm.model_runners.GPUModelRunner").NNsightGPUModelRunner
780
+ modules = {
781
+ "kernel": importlib.import_module("vllm.model_executor.warmup.kernel_warmup"),
782
+ "qwen": importlib.import_module("vllm.model_executor.warmup.qwen_triton_warmup"),
783
+ "post_conv": importlib.import_module("vllm.third_party.flash_linear_attention.ops.fused_gdn_prefill_post_conv"),
784
+ "sampler_type": importlib.import_module("vllm.v1.sample.sampler").Sampler,
785
+ "topk_sampler_type": importlib.import_module("vllm.v1.sample.ops.topk_topp_sampler").TopKTopPSampler,
786
+ }
787
+ guards = NativeSourceGuards(controller, torch_module, modules)
788
+ guards.arm()
789
+ result = owned_worker_class(base, runner, controller, placement, guards)
790
+ result._nol_source_guards = guards
791
+ return _publish_native_worker_class(result)
792
+
793
+
794
+ def _publish_native_worker_class(worker_type):
795
+ """vLLM 0.27.1 accepts a qualified string, not a class object. Uni uses
796
+ this same interpreter/module, preserving the exact private guard closure.
797
+ The symbol is installed once; MP/remote reconstruction is unsupported.
798
+ """
799
+ name = "NolOwnedNNsightGPUWorker"
800
+ require(name not in globals() and isinstance(worker_type, type), "Owned worker class registration replay", "CUSTODY")
801
+ worker_type.__module__, worker_type.__qualname__ = __name__, name
802
+ globals()[name] = worker_type
803
+ return worker_type