cozy-runtime 0.1.0__tar.gz

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 (202) hide show
  1. cozy_runtime-0.1.0/.dockerignore +12 -0
  2. cozy_runtime-0.1.0/.github/workflows/ci.yaml +93 -0
  3. cozy_runtime-0.1.0/.github/workflows/platform-macos-mps.yaml +103 -0
  4. cozy_runtime-0.1.0/.github/workflows/platform-windows-cuda.yaml +124 -0
  5. cozy_runtime-0.1.0/.github/workflows/publish.yaml +48 -0
  6. cozy_runtime-0.1.0/.gitignore +14 -0
  7. cozy_runtime-0.1.0/.python-version +1 -0
  8. cozy_runtime-0.1.0/PKG-INFO +23 -0
  9. cozy_runtime-0.1.0/README.md +509 -0
  10. cozy_runtime-0.1.0/base-distributions.json +18 -0
  11. cozy_runtime-0.1.0/checks/architecture.py +873 -0
  12. cozy_runtime-0.1.0/corpus/__init__.py +0 -0
  13. cozy_runtime-0.1.0/corpus/cases/__init__.py +0 -0
  14. cozy_runtime-0.1.0/corpus/cases/baseline.py +175 -0
  15. cozy_runtime-0.1.0/corpus/cases/devices.py +131 -0
  16. cozy_runtime-0.1.0/corpus/cases/dynamics.py +156 -0
  17. cozy_runtime-0.1.0/corpus/cases/lifecycle.py +224 -0
  18. cozy_runtime-0.1.0/corpus/cases/mutation.py +146 -0
  19. cozy_runtime-0.1.0/corpus/cases/opaque.py +222 -0
  20. cozy_runtime-0.1.0/corpus/cases/planted.py +131 -0
  21. cozy_runtime-0.1.0/corpus/h3.py +288 -0
  22. cozy_runtime-0.1.0/corpus/harness.py +133 -0
  23. cozy_runtime-0.1.0/corpus/job/package.toml +6 -0
  24. cozy_runtime-0.1.0/corpus/job/structural_census.py +183 -0
  25. cozy_runtime-0.1.0/corpus/package/package.toml +12 -0
  26. cozy_runtime-0.1.0/corpus/package/sdxl_gpu.py +336 -0
  27. cozy_runtime-0.1.0/corpus/pipeline/package.toml +9 -0
  28. cozy_runtime-0.1.0/corpus/pipeline/sdxl_txt2img.py +202 -0
  29. cozy_runtime-0.1.0/corpus/run_case.py +115 -0
  30. cozy_runtime-0.1.0/corpus/sdxl.py +99 -0
  31. cozy_runtime-0.1.0/corpus/sdxl_pipeline.py +118 -0
  32. cozy_runtime-0.1.0/corpus/sdxl_real.py +75 -0
  33. cozy_runtime-0.1.0/corpus/tenant/package.toml +11 -0
  34. cozy_runtime-0.1.0/corpus/tenant/tiny_tenant.py +140 -0
  35. cozy_runtime-0.1.0/examples/marco-polo/README.md +51 -0
  36. cozy_runtime-0.1.0/examples/marco-polo/marco_polo_package/__init__.py +29 -0
  37. cozy_runtime-0.1.0/examples/marco-polo/package.toml +2 -0
  38. cozy_runtime-0.1.0/examples/marco-polo/pyproject.toml +23 -0
  39. cozy_runtime-0.1.0/examples/marco-polo/uv.lock +214 -0
  40. cozy_runtime-0.1.0/packages/cozy-runtime-cuda-kernels/.gitignore +3 -0
  41. cozy_runtime-0.1.0/packages/cozy-runtime-cuda-kernels/CMakeLists.txt +37 -0
  42. cozy_runtime-0.1.0/packages/cozy-runtime-cuda-kernels/LICENSE +202 -0
  43. cozy_runtime-0.1.0/packages/cozy-runtime-cuda-kernels/NOTICE +108 -0
  44. cozy_runtime-0.1.0/packages/cozy-runtime-cuda-kernels/UPSTREAM.md +18 -0
  45. cozy_runtime-0.1.0/packages/cozy-runtime-cuda-kernels/native/binding.cpp +114 -0
  46. cozy_runtime-0.1.0/packages/cozy-runtime-cuda-kernels/native/dtype_dispatch.cuh +219 -0
  47. cozy_runtime-0.1.0/packages/cozy-runtime-cuda-kernels/native/rms_rope.cu +384 -0
  48. cozy_runtime-0.1.0/packages/cozy-runtime-cuda-kernels/native/rope_device.cuh +99 -0
  49. cozy_runtime-0.1.0/packages/cozy-runtime-cuda-kernels/native/utils.cuh +112 -0
  50. cozy_runtime-0.1.0/packages/cozy-runtime-cuda-kernels/pyproject.toml +17 -0
  51. cozy_runtime-0.1.0/packages/cozy-runtime-cuda-kernels/src/cozy_runtime_cuda_kernels/_C.pyi +14 -0
  52. cozy_runtime-0.1.0/packages/cozy-runtime-cuda-kernels/src/cozy_runtime_cuda_kernels/__init__.py +47 -0
  53. cozy_runtime-0.1.0/pyproject.toml +179 -0
  54. cozy_runtime-0.1.0/src/cozy/worker/v1/SOURCE +8 -0
  55. cozy_runtime-0.1.0/src/cozy/worker/v1/weights_limits.py +26 -0
  56. cozy_runtime-0.1.0/src/cozy/worker/v1/wire_version.py +3 -0
  57. cozy_runtime-0.1.0/src/cozy/worker/v1/worker_pb2.py +359 -0
  58. cozy_runtime-0.1.0/src/cozy/worker/v1/worker_pb2.pyi +2566 -0
  59. cozy_runtime-0.1.0/src/cozy/worker/v1/worker_pb2_grpc.py +942 -0
  60. cozy_runtime-0.1.0/src/cozy_runtime/__init__.py +15 -0
  61. cozy_runtime-0.1.0/src/cozy_runtime/_interpreter.py +13 -0
  62. cozy_runtime-0.1.0/src/cozy_runtime/author/__init__.py +254 -0
  63. cozy_runtime-0.1.0/src/cozy_runtime/author/_app.py +248 -0
  64. cozy_runtime-0.1.0/src/cozy_runtime/author/_assets.py +270 -0
  65. cozy_runtime-0.1.0/src/cozy_runtime/author/_codec.py +713 -0
  66. cozy_runtime-0.1.0/src/cozy_runtime/author/_color.py +45 -0
  67. cozy_runtime-0.1.0/src/cozy_runtime/author/_context.py +134 -0
  68. cozy_runtime-0.1.0/src/cozy_runtime/author/_decode.py +1420 -0
  69. cozy_runtime-0.1.0/src/cozy_runtime/author/_defaults.py +229 -0
  70. cozy_runtime-0.1.0/src/cozy_runtime/author/_demand.py +125 -0
  71. cozy_runtime-0.1.0/src/cozy_runtime/author/_describe.py +312 -0
  72. cozy_runtime-0.1.0/src/cozy_runtime/author/_errors.py +169 -0
  73. cozy_runtime-0.1.0/src/cozy_runtime/author/_invoke.py +770 -0
  74. cozy_runtime-0.1.0/src/cozy_runtime/author/_loader.py +930 -0
  75. cozy_runtime-0.1.0/src/cozy_runtime/author/_markers.py +184 -0
  76. cozy_runtime-0.1.0/src/cozy_runtime/author/_media.py +101 -0
  77. cozy_runtime-0.1.0/src/cozy_runtime/author/_model.py +935 -0
  78. cozy_runtime-0.1.0/src/cozy_runtime/author/_observations.py +318 -0
  79. cozy_runtime-0.1.0/src/cozy_runtime/author/_services.py +1097 -0
  80. cozy_runtime-0.1.0/src/cozy_runtime/author/_signature.py +371 -0
  81. cozy_runtime-0.1.0/src/cozy_runtime/author/_walker.py +171 -0
  82. cozy_runtime-0.1.0/src/cozy_runtime/author/_weights.py +661 -0
  83. cozy_runtime-0.1.0/src/cozy_runtime/author/fakes.py +322 -0
  84. cozy_runtime-0.1.0/src/cozy_runtime/canonical_json.py +46 -0
  85. cozy_runtime-0.1.0/src/cozy_runtime/cli/__init__.py +1 -0
  86. cozy_runtime-0.1.0/src/cozy_runtime/cli/describe.py +188 -0
  87. cozy_runtime-0.1.0/src/cozy_runtime/cli/fit.py +123 -0
  88. cozy_runtime-0.1.0/src/cozy_runtime/cli/host.py +479 -0
  89. cozy_runtime-0.1.0/src/cozy_runtime/cli/io.py +109 -0
  90. cozy_runtime-0.1.0/src/cozy_runtime/cli/main.py +246 -0
  91. cozy_runtime-0.1.0/src/cozy_runtime/cli/model_contract_proof.py +955 -0
  92. cozy_runtime-0.1.0/src/cozy_runtime/cli/native_wheel_proof.py +284 -0
  93. cozy_runtime-0.1.0/src/cozy_runtime/cli/new.py +220 -0
  94. cozy_runtime-0.1.0/src/cozy_runtime/cli/package_prepare.py +244 -0
  95. cozy_runtime-0.1.0/src/cozy_runtime/cli/payload.py +320 -0
  96. cozy_runtime-0.1.0/src/cozy_runtime/cli/run.py +678 -0
  97. cozy_runtime-0.1.0/src/cozy_runtime/cli/runtime_worker.py +236 -0
  98. cozy_runtime-0.1.0/src/cozy_runtime/cli/version.py +48 -0
  99. cozy_runtime-0.1.0/src/cozy_runtime/derive/__init__.py +7 -0
  100. cozy_runtime-0.1.0/src/cozy_runtime/derive/h3-dit-quantization-plan.json +5478 -0
  101. cozy_runtime-0.1.0/src/cozy_runtime/derive/identity.py +56 -0
  102. cozy_runtime-0.1.0/src/cozy_runtime/derive/microscale.py +391 -0
  103. cozy_runtime-0.1.0/src/cozy_runtime/derive/quantization.py +730 -0
  104. cozy_runtime-0.1.0/src/cozy_runtime/derive/safetensors_io.py +306 -0
  105. cozy_runtime-0.1.0/src/cozy_runtime/internal/__init__.py +1 -0
  106. cozy_runtime-0.1.0/src/cozy_runtime/internal/accel.py +463 -0
  107. cozy_runtime-0.1.0/src/cozy_runtime/internal/anima_optimization.py +586 -0
  108. cozy_runtime-0.1.0/src/cozy_runtime/internal/base_observation.py +358 -0
  109. cozy_runtime-0.1.0/src/cozy_runtime/internal/bindings.py +125 -0
  110. cozy_runtime-0.1.0/src/cozy_runtime/internal/canonical.py +260 -0
  111. cozy_runtime-0.1.0/src/cozy_runtime/internal/child_env.py +174 -0
  112. cozy_runtime-0.1.0/src/cozy_runtime/internal/config.py +418 -0
  113. cozy_runtime-0.1.0/src/cozy_runtime/internal/contract.py +596 -0
  114. cozy_runtime-0.1.0/src/cozy_runtime/internal/delivery.py +182 -0
  115. cozy_runtime-0.1.0/src/cozy_runtime/internal/derive.py +978 -0
  116. cozy_runtime-0.1.0/src/cozy_runtime/internal/descriptor.py +645 -0
  117. cozy_runtime-0.1.0/src/cozy_runtime/internal/discovery.py +231 -0
  118. cozy_runtime-0.1.0/src/cozy_runtime/internal/egress.py +478 -0
  119. cozy_runtime-0.1.0/src/cozy_runtime/internal/encoding/__init__.py +143 -0
  120. cozy_runtime-0.1.0/src/cozy_runtime/internal/encoding/formats.py +765 -0
  121. cozy_runtime-0.1.0/src/cozy_runtime/internal/encoding/leaves.py +463 -0
  122. cozy_runtime-0.1.0/src/cozy_runtime/internal/encoding/selection.py +837 -0
  123. cozy_runtime-0.1.0/src/cozy_runtime/internal/encoding/vectors/fp8-rowwise-keepdim.json +1 -0
  124. cozy_runtime-0.1.0/src/cozy_runtime/internal/encoding/vectors/fp8-rowwise.json +1 -0
  125. cozy_runtime-0.1.0/src/cozy_runtime/internal/encoding/vectors/fp8-scaled-scalar-weight-only.json +1 -0
  126. cozy_runtime-0.1.0/src/cozy_runtime/internal/encoding/vectors/fp8-scaled-scalar.json +1 -0
  127. cozy_runtime-0.1.0/src/cozy_runtime/internal/encoding/vectors/mxfp8.json +1 -0
  128. cozy_runtime-0.1.0/src/cozy_runtime/internal/executor.py +2256 -0
  129. cozy_runtime-0.1.0/src/cozy_runtime/internal/exits.py +31 -0
  130. cozy_runtime-0.1.0/src/cozy_runtime/internal/fill.py +2308 -0
  131. cozy_runtime-0.1.0/src/cozy_runtime/internal/forensics.py +143 -0
  132. cozy_runtime-0.1.0/src/cozy_runtime/internal/host_paths.py +18 -0
  133. cozy_runtime-0.1.0/src/cozy_runtime/internal/hostfacts.py +178 -0
  134. cozy_runtime-0.1.0/src/cozy_runtime/internal/instruments.py +146 -0
  135. cozy_runtime-0.1.0/src/cozy_runtime/internal/jit_cache.py +103 -0
  136. cozy_runtime-0.1.0/src/cozy_runtime/internal/liveness.py +109 -0
  137. cozy_runtime-0.1.0/src/cozy_runtime/internal/local.py +1728 -0
  138. cozy_runtime-0.1.0/src/cozy_runtime/internal/model_config.py +50 -0
  139. cozy_runtime-0.1.0/src/cozy_runtime/internal/native_dependency_probe.py +70 -0
  140. cozy_runtime-0.1.0/src/cozy_runtime/internal/native_operator_runner.py +63 -0
  141. cozy_runtime-0.1.0/src/cozy_runtime/internal/native_seat_probe.py +61 -0
  142. cozy_runtime-0.1.0/src/cozy_runtime/internal/native_wheel.py +897 -0
  143. cozy_runtime-0.1.0/src/cozy_runtime/internal/package_environment.py +1607 -0
  144. cozy_runtime-0.1.0/src/cozy_runtime/internal/pathkey.py +19 -0
  145. cozy_runtime-0.1.0/src/cozy_runtime/internal/placement_materialization.py +467 -0
  146. cozy_runtime-0.1.0/src/cozy_runtime/internal/planfacts.py +212 -0
  147. cozy_runtime-0.1.0/src/cozy_runtime/internal/probe.py +1101 -0
  148. cozy_runtime-0.1.0/src/cozy_runtime/internal/proctree.py +1245 -0
  149. cozy_runtime-0.1.0/src/cozy_runtime/internal/pull.py +1180 -0
  150. cozy_runtime-0.1.0/src/cozy_runtime/internal/readiness.py +333 -0
  151. cozy_runtime-0.1.0/src/cozy_runtime/internal/refusal.py +12 -0
  152. cozy_runtime-0.1.0/src/cozy_runtime/internal/residency.py +541 -0
  153. cozy_runtime-0.1.0/src/cozy_runtime/internal/resolution.py +956 -0
  154. cozy_runtime-0.1.0/src/cozy_runtime/internal/sandbox.py +174 -0
  155. cozy_runtime-0.1.0/src/cozy_runtime/internal/schema.py +278 -0
  156. cozy_runtime-0.1.0/src/cozy_runtime/internal/seam.py +224 -0
  157. cozy_runtime-0.1.0/src/cozy_runtime/internal/spawn.py +118 -0
  158. cozy_runtime-0.1.0/src/cozy_runtime/internal/trampoline.py +149 -0
  159. cozy_runtime-0.1.0/src/cozy_runtime/internal/warm.py +170 -0
  160. cozy_runtime-0.1.0/src/cozy_runtime/internal/weights_sink.py +580 -0
  161. cozy_runtime-0.1.0/src/cozy_runtime/internal/witness.py +269 -0
  162. cozy_runtime-0.1.0/src/cozy_runtime/internal/worker/__init__.py +16 -0
  163. cozy_runtime-0.1.0/src/cozy_runtime/internal/worker/acquire.py +887 -0
  164. cozy_runtime-0.1.0/src/cozy_runtime/internal/worker/attempts.py +2667 -0
  165. cozy_runtime-0.1.0/src/cozy_runtime/internal/worker/child.py +1201 -0
  166. cozy_runtime-0.1.0/src/cozy_runtime/internal/worker/control.py +481 -0
  167. cozy_runtime-0.1.0/src/cozy_runtime/internal/worker/downloads.py +133 -0
  168. cozy_runtime-0.1.0/src/cozy_runtime/internal/worker/grants.py +944 -0
  169. cozy_runtime-0.1.0/src/cozy_runtime/internal/worker/lanes.py +324 -0
  170. cozy_runtime-0.1.0/src/cozy_runtime/internal/worker/ledger.py +659 -0
  171. cozy_runtime-0.1.0/src/cozy_runtime/internal/worker/model_source_prepare.py +260 -0
  172. cozy_runtime-0.1.0/src/cozy_runtime/internal/worker/observe.py +245 -0
  173. cozy_runtime-0.1.0/src/cozy_runtime/internal/worker/package_prepare.py +1012 -0
  174. cozy_runtime-0.1.0/src/cozy_runtime/internal/worker/plan.py +944 -0
  175. cozy_runtime-0.1.0/src/cozy_runtime/internal/worker/records.py +77 -0
  176. cozy_runtime-0.1.0/src/cozy_runtime/internal/worker/refusal.py +138 -0
  177. cozy_runtime-0.1.0/src/cozy_runtime/internal/worker/session.py +5166 -0
  178. cozy_runtime-0.1.0/src/cozy_runtime/internal/worker/triage.py +282 -0
  179. cozy_runtime-0.1.0/src/cozy_runtime/internal/worker/weights.py +952 -0
  180. cozy_runtime-0.1.0/src/cozy_runtime/protocol/__init__.py +37 -0
  181. cozy_runtime-0.1.0/src/cozy_runtime/protocol/documents.py +200 -0
  182. cozy_runtime-0.1.0/src/cozy_runtime/py.typed +0 -0
  183. cozy_runtime-0.1.0/tests/observations/probe-cuda-sm89.json +1215 -0
  184. cozy_runtime-0.1.0/tests/test_author_surface.py +273 -0
  185. cozy_runtime-0.1.0/tests/test_capability_grants.py +59 -0
  186. cozy_runtime-0.1.0/tests/test_device_lanes.py +456 -0
  187. cozy_runtime-0.1.0/tests/test_device_qualification.py +214 -0
  188. cozy_runtime-0.1.0/tests/test_end_to_end.py +722 -0
  189. cozy_runtime-0.1.0/tests/test_local_boot_liveness.py +201 -0
  190. cozy_runtime-0.1.0/tests/test_package_acquisition.py +92 -0
  191. cozy_runtime-0.1.0/tests/test_proven_wedge.py +273 -0
  192. cozy_runtime-0.1.0/tests/test_publish_derivation.py +432 -0
  193. cozy_runtime-0.1.0/tests/test_pull_stream_liveness.py +326 -0
  194. cozy_runtime-0.1.0/tests/test_runtime_weights_exchange.py +317 -0
  195. cozy_runtime-0.1.0/tests/test_schema_projection.py +88 -0
  196. cozy_runtime-0.1.0/tests/test_shared_lane.py +803 -0
  197. cozy_runtime-0.1.0/tests/test_vendored_protocol.py +124 -0
  198. cozy_runtime-0.1.0/tests/test_weights_upload.py +202 -0
  199. cozy_runtime-0.1.0/uv.lock +1162 -0
  200. cozy_runtime-0.1.0/vectors/es6-numbers.txt +4561 -0
  201. cozy_runtime-0.1.0/vendor/TENSORFS.md +24 -0
  202. cozy_runtime-0.1.0/vendor/tensorfs-0.0.8-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl +0 -0
@@ -0,0 +1,12 @@
1
+ .git
2
+ .worktrees
3
+ .venv
4
+ **/.venv
5
+ **/__pycache__
6
+ .mypy_cache
7
+ .pytest_cache
8
+ .ruff_cache
9
+ .artifacts
10
+ build
11
+ dist
12
+ *.pyc
@@ -0,0 +1,93 @@
1
+ name: ci
2
+ on: [push, pull_request]
3
+ jobs:
4
+ # BUILD + LINT + TYPES + BOUNDARY SCANS. Nothing here asserts that a source file contains
5
+ # a particular string, and nothing here is a behaviour test — that is the `end-to-end` job.
6
+ checks:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v4
10
+ - uses: astral-sh/setup-uv@v7
11
+ - run: uv python install 3.12
12
+ - run: uv sync
13
+ - run: >-
14
+ uv run python -c "import sys, sysconfig;
15
+ assert sys.implementation.name == 'cpython' and sys.version_info[:2] == (3, 12)
16
+ and sysconfig.get_config_var('Py_GIL_DISABLED') != 1"
17
+ - run: uv run ruff check .
18
+ # Formatting is a DETERMINISM check: one canonical rendering of the tree, so a diff is
19
+ # only ever a change of meaning. The generated `worker_pb2*` bindings are excluded in
20
+ # pyproject's `extend-exclude` — protoc's output is a copied artifact.
21
+ - run: uv run mypy
22
+ - run: uv run ruff format --check .
23
+ - name: Reproduce the CPython 3.12 Runtime wheel
24
+ run: |
25
+ set -euo pipefail
26
+ a=$(mktemp -d)
27
+ b=$(mktemp -d)
28
+ SOURCE_DATE_EPOCH=946684800 uv build --wheel --out-dir "$a"
29
+ SOURCE_DATE_EPOCH=946684800 uv build --wheel --out-dir "$b"
30
+ cmp "$a"/*.whl "$b"/*.whl
31
+ # AST import/dependency scans over the package boundaries, plus the frozen ES6 number
32
+ # vectors replayed through the real RFC 8785 writer.
33
+ - run: uv run python checks/architecture.py
34
+
35
+ # THE BEHAVIOUR GATE: two real runs against a real build, no mocks. The public CLI is
36
+ # installed from a freshly built wheel into a venv that has nothing else, then describes,
37
+ # replays the descriptor byte-for-byte, serves a request through the invocation kernel,
38
+ # walks the exit-code matrix, and runs a job through the real two-process worker.
39
+ end-to-end:
40
+ runs-on: ubuntu-latest
41
+ timeout-minutes: 20
42
+ steps:
43
+ - uses: actions/checkout@v4
44
+ - uses: astral-sh/setup-uv@v7
45
+ - run: uv python install 3.12
46
+ - run: uv sync
47
+ - run: uv run pytest
48
+
49
+ # THE VENDORED-DRIFT GATE (#536d). `src/cozy/worker/v1/` is a COPY of another repo's
50
+ # generated output, and a copy is only a copy while somebody compares the bytes.
51
+ #
52
+ # The checker is worker-protocol's own `scripts/vendored-diff.sh`, invoked rather than
53
+ # reimplemented: a drift checker with its own drifting generator would be its own
54
+ # punchline. It regenerates from the .proto with the pinned toolchain and byte-compares
55
+ # against what is vendored here.
56
+ #
57
+ # PINNED, not floating: `WORKER_PROTOCOL_SHA` is the protocol commit these bytes were
58
+ # generated from. Bumping it and re-copying `gen/python/cozy` over `src/cozy` is one
59
+ # change, and this job is what refuses the half of it that was forgotten.
60
+ drift:
61
+ runs-on: ubuntu-latest
62
+ env:
63
+ WORKER_PROTOCOL_SHA: 9a1e3eefdc94004a3053deedc497215422e83ac5
64
+ steps:
65
+ - uses: actions/checkout@v4
66
+ # SELF-ARMING, not skipped-by-default. worker-protocol-v2 is a private sibling and
67
+ # `github.token` is scoped to THIS repository, so the byte-diff needs a read
68
+ # credential only the owner can mint. Rather than sit red forever or hide behind a
69
+ # hand-flipped variable, the job detects the credential and runs the moment it
70
+ # exists — and says loudly, in the run's annotations, when it does not.
71
+ - id: credential
72
+ run: |
73
+ if [ -n "${{ secrets.WORKER_PROTOCOL_TOKEN }}" ]; then
74
+ echo "present=yes" >> "$GITHUB_OUTPUT"
75
+ else
76
+ echo "present=no" >> "$GITHUB_OUTPUT"
77
+ echo "::warning title=vendored-drift check not run::WORKER_PROTOCOL_TOKEN is not set, so cozy-creator/worker-protocol-v2 cannot be checked out and the byte-for-byte vendored-drift check did not run. Release validation must retain a recorded local drift check."
78
+ fi
79
+ - if: steps.credential.outputs.present == 'yes'
80
+ uses: actions/checkout@v4
81
+ with:
82
+ repository: cozy-creator/worker-protocol-v2
83
+ ref: ${{ env.WORKER_PROTOCOL_SHA }}
84
+ path: .worker-protocol
85
+ token: ${{ secrets.WORKER_PROTOCOL_TOKEN }}
86
+ - if: steps.credential.outputs.present == 'yes'
87
+ uses: astral-sh/setup-uv@v7
88
+ - if: steps.credential.outputs.present == 'yes'
89
+ uses: actions/setup-go@v5
90
+ with:
91
+ go-version: stable
92
+ - if: steps.credential.outputs.present == 'yes'
93
+ run: .worker-protocol/scripts/vendored-diff.sh src
@@ -0,0 +1,103 @@
1
+ name: platform-macos-mps
2
+ # cr-021's two macOS jobs. MANUALLY TRIGGERED ONLY — never on push/PR/schedule.
3
+ # `probe` is the hardware probe: a live run on rented Apple Silicon that BANKS what the
4
+ # machine actually exposes (chip class, MPS availability, allocator numbers, which dtypes
5
+ # serve and which refuse) as an uploaded transcript. Every claim in cr-021's
6
+ # AcceleratorFacts record is a line in that transcript or it is not a fact yet.
7
+ on:
8
+ workflow_dispatch:
9
+ inputs:
10
+ runner:
11
+ description: >-
12
+ macos-15 = standard M1 3-core ($0.062/min); macos-15-xlarge = M2 Pro 5-core
13
+ ($0.102/min) and is the only class that can prove bf16.
14
+ type: choice
15
+ default: macos-15
16
+ options: [macos-15, macos-15-xlarge, macos-26, macos-26-xlarge]
17
+
18
+ jobs:
19
+ probe:
20
+ runs-on: ${{ inputs.runner }}
21
+ timeout-minutes: 20
22
+ steps:
23
+ # No checkout: the subject is the MACHINE, not the tree. Keeping the probe independent
24
+ # of repo source also keeps it runnable while the source is being edited elsewhere.
25
+ - name: machine facts
26
+ run: |
27
+ set -x
28
+ uname -m
29
+ sw_vers
30
+ sysctl -n machdep.cpu.brand_string
31
+ sysctl -n hw.memsize
32
+ sysctl -n hw.ncpu
33
+ system_profiler SPDisplaysDataType
34
+
35
+ - name: install torch
36
+ run: |
37
+ curl -LsSf https://astral.sh/uv/install.sh | sh
38
+ export PATH="$HOME/.local/bin:$PATH"
39
+ uv python install 3.14
40
+ uv venv --python 3.14 .venv
41
+ uv pip install --python .venv/bin/python 'torch>=2.13,<3'
42
+ .venv/bin/python -c 'import torch; print(torch.__version__)'
43
+
44
+ - name: mps probe
45
+ run: |
46
+ export PATH="$HOME/.local/bin:$PATH"
47
+ cat > probe.py <<'PY'
48
+ import platform, sys, torch
49
+
50
+ def leg(name, fn):
51
+ # Every leg reports typed: SERVES with its value, or REFUSED with the exception
52
+ # class and message. A refusal is a RESULT here, not an error.
53
+ try:
54
+ print(f"{name}: SERVES {fn()}")
55
+ except Exception as e:
56
+ print(f"{name}: REFUSED {type(e).__name__}: {e}")
57
+
58
+ print("python:", sys.version.split()[0])
59
+ print("platform:", platform.platform(), platform.machine())
60
+ print("torch:", torch.__version__)
61
+ print("mps.is_built:", torch.backends.mps.is_built())
62
+ print("mps.is_available:", torch.backends.mps.is_available())
63
+ print("has torch.mps.Event:", hasattr(torch.mps, "Event"))
64
+ print("has torch.mps.Stream:", hasattr(torch.mps, "Stream"))
65
+ print("has set_per_process_memory_fraction:",
66
+ hasattr(torch.mps, "set_per_process_memory_fraction"))
67
+
68
+ d = "mps"
69
+ leg("fp32 matmul", lambda: (torch.randn(512, 512, device=d) @
70
+ torch.randn(512, 512, device=d)).sum().item())
71
+ leg("fp16 matmul", lambda: (torch.randn(512, 512, device=d, dtype=torch.float16) @
72
+ torch.randn(512, 512, device=d, dtype=torch.float16)).sum().item())
73
+ leg("bf16 matmul", lambda: (torch.randn(512, 512, device=d, dtype=torch.bfloat16) @
74
+ torch.randn(512, 512, device=d, dtype=torch.bfloat16)).sum().item())
75
+ leg("fp16 conv2d", lambda: torch.nn.Conv2d(4, 8, 3, padding=1).to(d, torch.float16)(
76
+ torch.randn(1, 4, 64, 64, device=d, dtype=torch.float16)).shape)
77
+ leg("fp16 sdpa", lambda: torch.nn.functional.scaled_dot_product_attention(
78
+ *[torch.randn(1, 4, 128, 64, device=d, dtype=torch.float16)] * 3).shape)
79
+ torch.mps.synchronize()
80
+
81
+ # The ledger's two axes collapse to one under unified memory; these are the exact
82
+ # allocator numbers cr-021 says the ledger reads.
83
+ for n in ("current_allocated_memory", "driver_allocated_memory",
84
+ "recommended_max_memory"):
85
+ leg(f"mps.{n}", getattr(torch.mps, n))
86
+
87
+ # fp8 must refuse on MPS: the dtypes EXIST in torch, the op path does not.
88
+ for n in ("float8_e4m3fn", "float8_e5m2"):
89
+ print(f"dtype torch.{n} exists:", hasattr(torch, n))
90
+ leg(f"fp8 {n} on mps", lambda n=n: torch.zeros(
91
+ 16, 16, device=d, dtype=getattr(torch, n)).dtype)
92
+ leg(f"fp8 {n} matmul on mps", lambda n=n: torch._scaled_mm(
93
+ torch.zeros(16, 16, device=d, dtype=getattr(torch, n)),
94
+ torch.zeros(16, 16, device=d, dtype=getattr(torch, n)).t(),
95
+ scale_a=torch.ones(1, device=d), scale_b=torch.ones(1, device=d)).dtype)
96
+ PY
97
+ .venv/bin/python probe.py 2>&1 | tee transcript.txt
98
+
99
+ - uses: actions/upload-artifact@v4
100
+ if: always()
101
+ with:
102
+ name: macos-mps-transcript-${{ inputs.runner }}
103
+ path: transcript.txt
@@ -0,0 +1,124 @@
1
+ name: platform-windows-cuda
2
+ # cr-020 hardware probe. MANUALLY TRIGGERED ONLY — never on push/PR/schedule. Not a test
3
+ # suite: a live run on a Windows+NVIDIA machine that BANKS what it exposes — the driver model
4
+ # (WDDM is the whole point of cr-020 item 6), the commit charge that makes Windows' free-RAM
5
+ # number dishonest, the CUDA allocator numbers, and which rungs serve vs refuse typed.
6
+ #
7
+ # It targets a SELF-HOSTED label, so it runs on nothing until a rented box registers itself
8
+ # under that label (see cr-020's provisioning script). Card tiers, all consumer — the class a
9
+ # real Windows user actually owns:
10
+ # windows-4090-sm89 primary. sm89 → fp8 compute SERVES.
11
+ # windows-3090-sm86 sm86 → fp8 compute REFUSES typed. This is the consumer no-fp8 path.
12
+ # windows-5090-sm120 forward tier. sm120 → fp8 compute expected to serve; stock and Windows
13
+ # image support are verified live at rent time, never assumed.
14
+ # The fp8 verdict is asserted against the capability the CARD reports (>= sm89), so one file
15
+ # proves the serve on two tiers and the refusal on the third without per-tier branching.
16
+ on:
17
+ workflow_dispatch:
18
+ inputs:
19
+ runner_label:
20
+ description: 'Self-hosted label of the rented Windows box.'
21
+ type: choice
22
+ default: windows-4090-sm89
23
+ options: [windows-4090-sm89, windows-3090-sm86, windows-5090-sm120]
24
+ torch_index:
25
+ description: 'PyTorch wheel index. Cozy starts at CUDA 13.0.'
26
+ type: string
27
+ default: https://download.pytorch.org/whl/cu130
28
+
29
+ jobs:
30
+ probe:
31
+ runs-on: ${{ inputs.runner_label }}
32
+ timeout-minutes: 60
33
+ defaults:
34
+ run:
35
+ shell: powershell
36
+ steps:
37
+ # No checkout: the subject is the MACHINE, not the tree.
38
+ - name: driver and WDDM facts
39
+ run: |
40
+ nvidia-smi
41
+ nvidia-smi --query-gpu=name,driver_version,compute_cap,memory.total --format=csv
42
+ # Driver model: WDDM levies a commit charge for ALL VRAM, TCC does not. cr-020 item 6
43
+ # prices host RAM off the commit-corrected number, so the model must be recorded, and
44
+ # the commit counters below are the measurement that replaces ComfyUI's constants.
45
+ nvidia-smi -q | Select-String -Pattern 'Driver Model','Current DM','Pending DM'
46
+ Get-CimInstance Win32_VideoController | Format-List Name,DriverVersion,AdapterRAM
47
+ Get-CimInstance Win32_OperatingSystem |
48
+ Format-List Caption,Version,TotalVisibleMemorySize,FreePhysicalMemory
49
+ "committed_bytes: " + (Get-Counter '\Memory\Committed Bytes').CounterSamples.CookedValue
50
+ "commit_limit: " + (Get-Counter '\Memory\Commit Limit').CounterSamples.CookedValue
51
+
52
+ - name: install torch
53
+ run: |
54
+ irm https://astral.sh/uv/install.ps1 | iex
55
+ $env:PATH = "$env:USERPROFILE\.local\bin;$env:PATH"
56
+ uv python install 3.14
57
+ uv venv --python 3.14 .venv
58
+ uv pip install --python .venv\Scripts\python.exe 'torch>=2.13,<3' --index-url ${{ inputs.torch_index }}
59
+ .venv\Scripts\python.exe -c "import torch; print(torch.__version__, torch.version.cuda)"
60
+
61
+ - name: cuda probe
62
+ run: |
63
+ $env:PATH = "$env:USERPROFILE\.local\bin;$env:PATH"
64
+ @'
65
+ import platform, sys, torch
66
+
67
+ def leg(name, fn):
68
+ # Typed both ways: SERVES with its value, or REFUSED with the exception class.
69
+ # A refusal is a RESULT here, not an error.
70
+ try:
71
+ print(f"{name}: SERVES {fn()}")
72
+ return True
73
+ except Exception as e:
74
+ print(f"{name}: REFUSED {type(e).__name__}: {e}")
75
+ return False
76
+
77
+ print("python:", sys.version.split()[0])
78
+ print("platform:", platform.platform(), platform.machine())
79
+ print("torch:", torch.__version__, "cuda:", torch.version.cuda)
80
+ print("cuda.is_available:", torch.cuda.is_available())
81
+ p = torch.cuda.get_device_properties(0)
82
+ cap = torch.cuda.get_device_capability(0)
83
+ print("device:", p.name, "capability:", cap, "total_bytes:", p.total_memory)
84
+ print("mem_get_info (free,total):", torch.cuda.mem_get_info(0))
85
+
86
+ d = "cuda"
87
+ leg("fp32 matmul", lambda: (torch.randn(1024, 1024, device=d) @
88
+ torch.randn(1024, 1024, device=d)).sum().item())
89
+ leg("fp16 matmul", lambda: (torch.randn(1024, 1024, device=d, dtype=torch.float16) @
90
+ torch.randn(1024, 1024, device=d, dtype=torch.float16)).sum().item())
91
+ leg("bf16 matmul", lambda: (torch.randn(1024, 1024, device=d, dtype=torch.bfloat16) @
92
+ torch.randn(1024, 1024, device=d, dtype=torch.bfloat16)).sum().item())
93
+ leg("fp16 conv2d", lambda: torch.nn.Conv2d(4, 8, 3, padding=1).to(d, torch.float16)(
94
+ torch.randn(1, 4, 128, 128, device=d, dtype=torch.float16)).shape)
95
+ torch.cuda.synchronize()
96
+
97
+ for n in ("memory_allocated", "max_memory_allocated", "memory_reserved"):
98
+ print(f"cuda.{n}:", getattr(torch.cuda, n)(0))
99
+
100
+ # The fp8 arm. The DTYPES exist on every build; the COMPUTE path is sm89+. Asserting
101
+ # the verdict against the reported capability is what makes 3090 vs 4090 a RESULT.
102
+ for n in ("float8_e4m3fn", "float8_e5m2"):
103
+ print(f"dtype torch.{n} exists:", hasattr(torch, n))
104
+ leg(f"fp8 {n} tensor", lambda n=n: torch.zeros(
105
+ 64, 64, device=d, dtype=getattr(torch, n)).dtype)
106
+
107
+ served = leg("fp8 e4m3 _scaled_mm", lambda: torch._scaled_mm(
108
+ torch.zeros(64, 64, device=d, dtype=torch.float8_e4m3fn),
109
+ torch.zeros(64, 64, device=d, dtype=torch.float8_e4m3fn).t(),
110
+ scale_a=torch.ones(1, device=d), scale_b=torch.ones(1, device=d),
111
+ out_dtype=torch.bfloat16).dtype)
112
+
113
+ expected = cap >= (8, 9)
114
+ print(f"VERDICT fp8_compute: expected={expected} observed={served} capability={cap}")
115
+ if served != expected:
116
+ raise SystemExit(f"fp8 compute verdict violated on capability {cap}")
117
+ '@ | Set-Content -Encoding utf8 probe.py
118
+ .venv\Scripts\python.exe probe.py 2>&1 | Tee-Object -FilePath transcript.txt
119
+
120
+ - uses: actions/upload-artifact@v4
121
+ if: always()
122
+ with:
123
+ name: windows-cuda-transcript-${{ inputs.runner_label }}
124
+ path: transcript.txt
@@ -0,0 +1,48 @@
1
+ name: Publish to PyPI
2
+
3
+ # Publication IS the tag push (cozy-eval's pattern). No local publish —
4
+ # this workflow is the single release procedure.
5
+ on:
6
+ push:
7
+ tags:
8
+ - 'v*'
9
+
10
+ jobs:
11
+ publish:
12
+ runs-on: ubuntu-latest
13
+ environment: pypi
14
+ # Hang bound, not a work budget.
15
+ timeout-minutes: 20
16
+ permissions:
17
+ contents: read # checkout on a private/org repo
18
+ id-token: write # PyPI trusted publishing (OIDC)
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+
22
+ - uses: astral-sh/setup-uv@v7
23
+
24
+ - run: uv python install 3.12
25
+
26
+ # --locked: fail loudly if uv.lock drifts from pyproject.toml instead of
27
+ # silently resolving versions nothing ever saw.
28
+ - run: uv sync --locked
29
+
30
+ # ci.yaml owns lint + types + the behaviour gate on every push; the publish
31
+ # gate re-runs the architecture fences against the exact tagged tree rather
32
+ # than trusting that the tag points at a commit CI already saw.
33
+ - name: Fences
34
+ run: uv run python checks/architecture.py
35
+
36
+ - name: Version matches tag
37
+ run: |
38
+ TAG="${GITHUB_REF_NAME#v}"
39
+ VER="$(uv run python -c 'import tomllib;print(tomllib.load(open("pyproject.toml","rb"))["project"]["version"])')"
40
+ if [ "$TAG" != "$VER" ]; then
41
+ echo "tag v$TAG != pyproject version $VER"; exit 1
42
+ fi
43
+
44
+ - name: Build (sdist + pure-py wheel)
45
+ run: uv build
46
+
47
+ - name: Publish (trusted publishing)
48
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,14 @@
1
+ target/
2
+ __pycache__/
3
+ *.pyc
4
+ .venv/
5
+ dist/
6
+ *.egg-info/
7
+ corpus/.venv/
8
+ results/
9
+ corpus/package/imports/
10
+ corpus/pipeline/imports/
11
+ # tokenizer vocabularies: bundled package assets, staged by the harness, not committed
12
+ corpus/pipeline/tokenizer/
13
+ corpus/pipeline/tokenizer_2/
14
+ outputs/
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,23 @@
1
+ Metadata-Version: 2.5
2
+ Name: cozy-runtime
3
+ Version: 0.1.0
4
+ Summary: Cozy v2 worker runtime: author surface, worker, executor
5
+ Requires-Python: <3.13,>=3.12
6
+ Requires-Dist: cryptography>=45
7
+ Requires-Dist: grpcio>=1.76
8
+ Requires-Dist: msgspec>=0.19
9
+ Requires-Dist: packaging>=24
10
+ Requires-Dist: pillow<13,>=12
11
+ Requires-Dist: protobuf>=6.31
12
+ Provides-Extra: corpus
13
+ Requires-Dist: diffusers>=0.36; extra == 'corpus'
14
+ Requires-Dist: torch<3,>=2.13; extra == 'corpus'
15
+ Requires-Dist: transformers<5,>=4.40; extra == 'corpus'
16
+ Provides-Extra: cuda-kernels
17
+ Requires-Dist: cozy-runtime-cuda-kernels==0.1.0+torch2.13cu130; (sys_platform == 'linux' and platform_machine == 'x86_64') and extra == 'cuda-kernels'
18
+ Provides-Extra: derive
19
+ Requires-Dist: torch<3,>=2.13; extra == 'derive'
20
+ Provides-Extra: media
21
+ Requires-Dist: av<19,>=18.1; extra == 'media'
22
+ Provides-Extra: model-execution
23
+ Requires-Dist: tensorfs==0.0.8; extra == 'model-execution'