millrace-os 0.23.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 (58) hide show
  1. millrace_os-0.23.0/LICENSE +201 -0
  2. millrace_os-0.23.0/PKG-INFO +77 -0
  3. millrace_os-0.23.0/README.md +56 -0
  4. millrace_os-0.23.0/docs/api-foundations.md +91 -0
  5. millrace_os-0.23.0/docs/architecture/legacy-disposition.md +82 -0
  6. millrace_os-0.23.0/docs/compatibility/release-1-contract-inventory.md +142 -0
  7. millrace_os-0.23.0/docs/foundation.md +33 -0
  8. millrace_os-0.23.0/docs/router-operation.md +95 -0
  9. millrace_os-0.23.0/docs/tmux-foundations.md +62 -0
  10. millrace_os-0.23.0/pyproject.toml +44 -0
  11. millrace_os-0.23.0/src/millrace_os/__init__.py +3 -0
  12. millrace_os-0.23.0/src/millrace_os/api.py +803 -0
  13. millrace_os-0.23.0/src/millrace_os/assets/bootstrap.html +6 -0
  14. millrace_os-0.23.0/src/millrace_os/assets/bootstrap.js +30 -0
  15. millrace_os-0.23.0/src/millrace_os/assets/recovery.html +6 -0
  16. millrace_os-0.23.0/src/millrace_os/auth.py +99 -0
  17. millrace_os-0.23.0/src/millrace_os/cli.py +420 -0
  18. millrace_os-0.23.0/src/millrace_os/config.py +174 -0
  19. millrace_os-0.23.0/src/millrace_os/contracts.py +399 -0
  20. millrace_os-0.23.0/src/millrace_os/credentials.py +76 -0
  21. millrace_os-0.23.0/src/millrace_os/paths.py +161 -0
  22. millrace_os-0.23.0/src/millrace_os/process.py +278 -0
  23. millrace_os-0.23.0/src/millrace_os/providers.py +36 -0
  24. millrace_os-0.23.0/src/millrace_os/recovery/__init__.py +5 -0
  25. millrace_os-0.23.0/src/millrace_os/recovery/bootstrap.js +30 -0
  26. millrace_os-0.23.0/src/millrace_os/recovery/runtime.py +30 -0
  27. millrace_os-0.23.0/src/millrace_os/router_client.py +119 -0
  28. millrace_os-0.23.0/src/millrace_os/router_workers.py +513 -0
  29. millrace_os-0.23.0/src/millrace_os/schemas/contracts.json +2540 -0
  30. millrace_os-0.23.0/src/millrace_os/schemas/openapi.json +6150 -0
  31. millrace_os-0.23.0/src/millrace_os/schemas/registry.json +210 -0
  32. millrace_os-0.23.0/src/millrace_os/service.py +358 -0
  33. millrace_os-0.23.0/src/millrace_os/storage/__init__.py +12 -0
  34. millrace_os-0.23.0/src/millrace_os/storage/database.py +390 -0
  35. millrace_os-0.23.0/src/millrace_os/storage/errors.py +17 -0
  36. millrace_os-0.23.0/src/millrace_os/storage/migrations/001_initial.sql +12 -0
  37. millrace_os-0.23.0/src/millrace_os/tmux_provider.py +1181 -0
  38. millrace_os-0.23.0/src/millrace_os/workflow_drafts.py +571 -0
  39. millrace_os-0.23.0/tests/compatibility/test_ownership.py +14 -0
  40. millrace_os-0.23.0/tests/compatibility/test_records.py +74 -0
  41. millrace_os-0.23.0/tests/contracts/test_api.py +122 -0
  42. millrace_os-0.23.0/tests/contracts/test_auth.py +231 -0
  43. millrace_os-0.23.0/tests/contracts/test_recovery.py +55 -0
  44. millrace_os-0.23.0/tests/contracts/test_schemas.py +68 -0
  45. millrace_os-0.23.0/tests/foundation/test_cli.py +171 -0
  46. millrace_os-0.23.0/tests/foundation/test_config.py +131 -0
  47. millrace_os-0.23.0/tests/foundation/test_packaging.py +117 -0
  48. millrace_os-0.23.0/tests/foundation/test_paths.py +34 -0
  49. millrace_os-0.23.0/tests/foundation/test_process.py +64 -0
  50. millrace_os-0.23.0/tests/foundation/test_service.py +317 -0
  51. millrace_os-0.23.0/tests/foundation/test_storage.py +186 -0
  52. millrace_os-0.23.0/tests/integration/conftest.py +281 -0
  53. millrace_os-0.23.0/tests/integration/test_router_instances.py +1155 -0
  54. millrace_os-0.23.0/tests/integration/test_router_planes.py +754 -0
  55. millrace_os-0.23.0/tests/integration/test_workflow_drafts.py +1017 -0
  56. millrace_os-0.23.0/tests/providers/test_tmux_provider.py +284 -0
  57. millrace_os-0.23.0/tests/providers/test_tmux_real.py +188 -0
  58. millrace_os-0.23.0/uv.lock +451 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,77 @@
1
+ Metadata-Version: 2.4
2
+ Name: millrace-os
3
+ Version: 0.23.0
4
+ Summary: A local headless service for independent Millrace workflow instances.
5
+ Author: Millrace
6
+ License-Expression: Apache-2.0
7
+ License-File: LICENSE
8
+ Requires-Dist: fastapi==0.116.1
9
+ Requires-Dist: pydantic==2.11.9
10
+ Requires-Dist: uvicorn==0.35.0
11
+ Requires-Dist: playwright==1.55.0 ; extra == 'browser'
12
+ Requires-Dist: pytest==9.0.2 ; extra == 'dev'
13
+ Requires-Dist: ruff==0.14.14 ; extra == 'dev'
14
+ Requires-Dist: httpx==0.28.1 ; extra == 'dev'
15
+ Requires-Dist: millrace-plus[router]>=0.23.0,<0.24.0 ; extra == 'router'
16
+ Requires-Python: >=3.12
17
+ Provides-Extra: browser
18
+ Provides-Extra: dev
19
+ Provides-Extra: router
20
+ Description-Content-Type: text/markdown
21
+
22
+ <div align="center">
23
+ <p>
24
+ <a href="https://pypi.org/project/millrace-os/"><img alt="PyPI v0.23.0" src="https://img.shields.io/badge/pypi-v0.23.0-orange.svg"></a>
25
+ <a href="https://www.python.org/downloads/"><img alt="Python 3.12+" src="https://img.shields.io/badge/python-3.12+-blue.svg"></a>
26
+ <a href="https://github.com/tim-osterhus/millrace-os/blob/main/LICENSE"><img alt="Apache-2.0 license" src="https://img.shields.io/badge/license-Apache--2.0-green.svg"></a>
27
+ </p>
28
+ <img
29
+ src="https://raw.githubusercontent.com/tim-osterhus/millrace/main/docs/assets/images/millrace-icon-signal-transparent-glow.png"
30
+ alt="Millrace signal mark"
31
+ width="180"
32
+ />
33
+ <h1>Millrace OS</h1>
34
+ </div>
35
+
36
+ Millrace OS is a local service and command-line client for operating independent Millrace workflow instances.
37
+
38
+ Use it to inspect runs, submit exact control requests, and publish workflow edits through one authenticated loopback API. Core owns instance inventory, execution, receipts, planes, and writer state. OS owns named state-home selections, drafts, and the lifetime of its controller calls.
39
+
40
+ Millrace OS 0.23.0 requires Python 3.12 or later. Native daemon identity and stop controls support macOS; other platforms fail closed for those controls.
41
+
42
+ Install the base service independently, or include the optional public router controls:
43
+
44
+ ```bash
45
+ python -m pip install 'millrace-os==0.23.0'
46
+ python -m pip install 'millrace-os[router]==0.23.0'
47
+ ```
48
+
49
+ The router extra selects `millrace-plus[router]>=0.23.0,<0.24.0`, which supplies Core transitively. Base service startup does not import Core or Plus. Router operations refuse unavailable or incompatible components. The selected release uses Core, Plus, and OS 0.23.0 with `millrace-router-execution/v2`. Matching version numbers do not establish execution-contract compatibility or native provider qualification.
50
+
51
+ Start the installed service and inspect a configured Core home:
52
+
53
+ ```bash
54
+ millrace-os serve --router-state-home main=/absolute/path/to/core-state
55
+ millrace-os router instances --home main
56
+ millrace-os router inspect --home main --instance INSTANCE_ID --run RUN_ID
57
+ millrace-os router request --home main --file saved-request.json
58
+ ```
59
+
60
+ The service creates an owner-only bearer credential. The client reads that configured credential and sends it only to the explicit loopback endpoint. See [router operation](https://github.com/tim-osterhus/millrace-os/blob/v0.23.0/docs/router-operation.md) for authoring and control examples.
61
+
62
+ ## Receipts and controller ownership
63
+
64
+ A request file contains the complete `millrace-router-request/v2` envelope, including its request ID, target IDs, expected state version, and payload. OS forwards it unchanged. A queued receipt means Core admitted the request. It does not mean the request applied or its writers stopped.
65
+
66
+ OS tracks every public call that could acquire Core's controller lock. The first shutdown requests pause and drains those calls before closing HTTP and local storage. A second deliberate shutdown requests Core cancellation. Unrelated provider-hosted processes retain their own lifecycle.
67
+
68
+ Workflow Apply freezes a draft, pauses its exact run, observes quiescence and final call drain, validates, publishes the files, and submits the revision. It leaves the run paused with a pending revision. Acceptance requires an explicit later request. Core decides whether acceptance can continue runnable planes.
69
+
70
+ ## Source boundaries
71
+
72
+ - `router_client.py` calls public Plus controls and catalog functions.
73
+ - `router_workers.py` owns bounded controller and control-ingress calls.
74
+ - `workflow_drafts.py` stores drafts and serializes cooperating OS publications.
75
+ - `api.py`, `contracts.py`, and `cli.py` define the shared HTTP and headless client surface.
76
+
77
+ The browser is optional. Existing bootstrap and recovery pages remain available, and deterministic authoring needs neither a browser nor a model. Read [API foundations](https://github.com/tim-osterhus/millrace-os/blob/v0.23.0/docs/api-foundations.md), [service foundations](https://github.com/tim-osterhus/millrace-os/blob/v0.23.0/docs/foundation.md), and [legacy disposition](https://github.com/tim-osterhus/millrace-os/blob/v0.23.0/docs/architecture/legacy-disposition.md) for the retained trust and storage contracts. The package uses the [Apache 2.0 license](https://github.com/tim-osterhus/millrace-os/blob/v0.23.0/LICENSE).
@@ -0,0 +1,56 @@
1
+ <div align="center">
2
+ <p>
3
+ <a href="https://pypi.org/project/millrace-os/"><img alt="PyPI v0.23.0" src="https://img.shields.io/badge/pypi-v0.23.0-orange.svg"></a>
4
+ <a href="https://www.python.org/downloads/"><img alt="Python 3.12+" src="https://img.shields.io/badge/python-3.12+-blue.svg"></a>
5
+ <a href="https://github.com/tim-osterhus/millrace-os/blob/main/LICENSE"><img alt="Apache-2.0 license" src="https://img.shields.io/badge/license-Apache--2.0-green.svg"></a>
6
+ </p>
7
+ <img
8
+ src="https://raw.githubusercontent.com/tim-osterhus/millrace/main/docs/assets/images/millrace-icon-signal-transparent-glow.png"
9
+ alt="Millrace signal mark"
10
+ width="180"
11
+ />
12
+ <h1>Millrace OS</h1>
13
+ </div>
14
+
15
+ Millrace OS is a local service and command-line client for operating independent Millrace workflow instances.
16
+
17
+ Use it to inspect runs, submit exact control requests, and publish workflow edits through one authenticated loopback API. Core owns instance inventory, execution, receipts, planes, and writer state. OS owns named state-home selections, drafts, and the lifetime of its controller calls.
18
+
19
+ Millrace OS 0.23.0 requires Python 3.12 or later. Native daemon identity and stop controls support macOS; other platforms fail closed for those controls.
20
+
21
+ Install the base service independently, or include the optional public router controls:
22
+
23
+ ```bash
24
+ python -m pip install 'millrace-os==0.23.0'
25
+ python -m pip install 'millrace-os[router]==0.23.0'
26
+ ```
27
+
28
+ The router extra selects `millrace-plus[router]>=0.23.0,<0.24.0`, which supplies Core transitively. Base service startup does not import Core or Plus. Router operations refuse unavailable or incompatible components. The selected release uses Core, Plus, and OS 0.23.0 with `millrace-router-execution/v2`. Matching version numbers do not establish execution-contract compatibility or native provider qualification.
29
+
30
+ Start the installed service and inspect a configured Core home:
31
+
32
+ ```bash
33
+ millrace-os serve --router-state-home main=/absolute/path/to/core-state
34
+ millrace-os router instances --home main
35
+ millrace-os router inspect --home main --instance INSTANCE_ID --run RUN_ID
36
+ millrace-os router request --home main --file saved-request.json
37
+ ```
38
+
39
+ The service creates an owner-only bearer credential. The client reads that configured credential and sends it only to the explicit loopback endpoint. See [router operation](https://github.com/tim-osterhus/millrace-os/blob/v0.23.0/docs/router-operation.md) for authoring and control examples.
40
+
41
+ ## Receipts and controller ownership
42
+
43
+ A request file contains the complete `millrace-router-request/v2` envelope, including its request ID, target IDs, expected state version, and payload. OS forwards it unchanged. A queued receipt means Core admitted the request. It does not mean the request applied or its writers stopped.
44
+
45
+ OS tracks every public call that could acquire Core's controller lock. The first shutdown requests pause and drains those calls before closing HTTP and local storage. A second deliberate shutdown requests Core cancellation. Unrelated provider-hosted processes retain their own lifecycle.
46
+
47
+ Workflow Apply freezes a draft, pauses its exact run, observes quiescence and final call drain, validates, publishes the files, and submits the revision. It leaves the run paused with a pending revision. Acceptance requires an explicit later request. Core decides whether acceptance can continue runnable planes.
48
+
49
+ ## Source boundaries
50
+
51
+ - `router_client.py` calls public Plus controls and catalog functions.
52
+ - `router_workers.py` owns bounded controller and control-ingress calls.
53
+ - `workflow_drafts.py` stores drafts and serializes cooperating OS publications.
54
+ - `api.py`, `contracts.py`, and `cli.py` define the shared HTTP and headless client surface.
55
+
56
+ The browser is optional. Existing bootstrap and recovery pages remain available, and deterministic authoring needs neither a browser nor a model. Read [API foundations](https://github.com/tim-osterhus/millrace-os/blob/v0.23.0/docs/api-foundations.md), [service foundations](https://github.com/tim-osterhus/millrace-os/blob/v0.23.0/docs/foundation.md), and [legacy disposition](https://github.com/tim-osterhus/millrace-os/blob/v0.23.0/docs/architecture/legacy-disposition.md) for the retained trust and storage contracts. The package uses the [Apache 2.0 license](https://github.com/tim-osterhus/millrace-os/blob/v0.23.0/LICENSE).
@@ -0,0 +1,91 @@
1
+ # OS API foundations
2
+
3
+ The retained foundation implements local trust and OS-owned version-one contracts. Millrace OS 0.23.0 adds the public router mapping documented in `router-operation.md`. Core retains durable execution and receipt authority. Historical released OS/provider gates remain separate evidence.
4
+
5
+ `millrace-os serve` creates the owner-only bearer credential. CLI/script clients
6
+ read that explicitly configured credential file and send `Authorization: Bearer
7
+ <token>` over the configured loopback endpoint. File possession is not an HTTP
8
+ session. `millrace-os open` authenticates an HTTP nonce-mint request and opens the
9
+ browser with the nonce only in the fragment. `open --recovery` requests a separate
10
+ recovery nonce and opens `/recovery`. No nonce is printed by the CLI. The service
11
+ must be running at the configured host and port; the CLI does not follow redirects
12
+ or use HTTP proxies for credential-bearing requests.
13
+
14
+ The browser immediately clears its fragment, then exchanges the nonce using a
15
+ same-origin POST. The response sets an HttpOnly, SameSite=Strict, host-only cookie
16
+ with a 15-minute expiry and returns a CSRF token held only in JavaScript memory.
17
+ The cookie is intentionally not Secure because the service uses HTTP on explicit
18
+ loopback. A browser mutation requires that cookie, exact configured Origin, and
19
+ `X-CSRF-Token`. An explicit bearer header selects bearer authentication; a bad
20
+ bearer is never rescued by a cookie. Every supplied Origin must match, including
21
+ bearer requests. Minting and rotation require bearer authentication. CORS is
22
+ absent, Host is checked against bind configuration, and forwarded headers do not
23
+ select the trusted origin. Aliases such as localhost and 127.0.0.1 are distinct.
24
+
25
+ Nonces use 256 bits of randomness, expire after 60 seconds, and are single use.
26
+ At most 32 outstanding nonces and 16 sessions exist. Expiry is monotonic; capacity
27
+ refuses with 429. `millrace-os rotate-credential` uses an authenticated local POST,
28
+ atomically replaces the credential, and invalidates every existing session and
29
+ nonce. Restart also clears transient trust. Rotation requires a running service;
30
+ there is no offline fallback that leaves its in-memory bearer valid.
31
+
32
+ The package-owned recovery bundle consists of `assets/recovery.html` and the
33
+ separate `recovery/bootstrap.js` resource. The recovery-owned script is served at
34
+ `/recovery/bootstrap.js`; the normal landing page uses its own
35
+ `assets/bootstrap.js` at `/assets/bootstrap.js`. Recovery does not load that
36
+ normal asset, `/`, normal HTML, preferences, operational SQLite or lower providers.
37
+ Missing normal landing HTML returns 503. The recovery shell itself returns 200;
38
+ public readiness returns 503 if storage is unsafe. Authenticated recovery
39
+ `diagnostics` returns 200 with a bounded error code and no raw exception, path,
40
+ credential or state content. A recovery-scoped session cannot access normal API
41
+ reads even when the store is healthy. Corrupt, future and migration-failed stores
42
+ are preserved by the P01 storage boundary. No recovery reset, database deletion,
43
+ receipt rewriting or lower-state mutation endpoint exists in this packet.
44
+
45
+ ## Route contract
46
+
47
+ Only `/health`, `/ready` and `/api/v1/health` expose the public minimal
48
+ `{"status":"ok"|"unavailable"}`. HTML and script routes expose static bootstrap
49
+ assets only. Every other data route requires bearer or cookie authentication.
50
+
51
+ - `GET /api/v1/version`, `/diagnostics`, `/identity` and `/contracts`: typed read
52
+ envelopes with OS authority, observation time, redaction and foundation-only
53
+ compatibility; no fabricated lower-layer cursor.
54
+ - `GET /api/v1/contracts/{contract_id}/1/{sha256}`: authenticated immutable schema
55
+ identity/digest lookup. Invalid path syntax is 422; unknown valid identity is 404.
56
+ - `GET /api/v1/providers` and `/actions`: empty, explicitly unavailable foundations,
57
+ with `limit` 1–100 (default 20). Valid cursors are refused with 409 because no
58
+ paging continuation exists yet. Malformed cursors and unknown query keys are 422.
59
+ - `POST /api/v1/actions/{action_id}:invoke`: bounded `target_id` input and required
60
+ `Idempotency-Key` / `X-Correlation-Id` identifiers. Invalid input is 422; every
61
+ well-formed action is 409 `action_unavailable`. No success, receipt, job or
62
+ provider invocation is fabricated. Pending and unknown remain distinct future
63
+ outcomes; a caller observation deadline cannot imply completion.
64
+ - `GET /api/v1/events`: authenticated, one small `availability` event followed by
65
+ closure. It explicitly declares non-durable scope and unavailable replay, emits
66
+ no ID, and retains no history or provider buffers. Eight concurrent responses
67
+ maximum; excess is 429. Malformed Last-Event-ID is 422; any syntactically valid
68
+ Last-Event-ID is 409 `event_replay_unavailable`. This is not P05 SSE qualification.
69
+ - `POST /api/v1/auth/bootstrap`, `/auth/exchange`, `/auth/rotate`: bounded typed trust
70
+ inputs and outputs. Rotation returns only status. Exchange needs exact Origin.
71
+ - `GET /api/v1/recovery/diagnostics`: authenticated, redacted, storage-independent.
72
+
73
+ Documented router GET routes additionally accept exact home/target query keys. Unknown or duplicate router query keys are refused. JSON mutations are capped at 4096 bytes, including chunked bodies, and require application/json. Only exact router draft file-set/per-file PUT uploads permit 1 MiB of encoded JSON. Auth/Origin checks happen
74
+ before input validation or handlers. Unknown input fields are forbidden. Public
75
+ validation errors never include rejected values. Error envelopes are stable and
76
+ bounded; this foundation does not claim a diagnostic record or receipt exists.
77
+
78
+ `contracts.py` authors distinct reads, errors, action inputs/outputs, receipts,
79
+ events and storage models. `api.export_artifacts(app)` generates deterministic
80
+ OpenAPI 3.1 and JSON Schema 2020-12 artifacts plus a version/digest registry. All
81
+ three JSON files are packaged wheel resources and checked byte-for-byte by tests.
82
+
83
+ ## Router contracts
84
+
85
+ `RouterRead` reports exact Core data with Core authority and an observation time. It never inherits foundation-only compatibility or redaction claims. Validation includes a typed `validation_context` and positive observed `run_state_version` for run-aware validation. Nested plane/node settings remain intact.
86
+
87
+ `RouterCallObservation` separates owned-call phase from the immutable Core receipt. Queued, applied, and refused receipts retain their exact IDs, request digest, plane target, state version, and stop sets. An applied pause receipt does not establish final writer drain. OS worker errors remain sanitized OS errors, never fabricated refused Core receipts.
88
+
89
+ Router controls use tracked non-daemon workers. Core is imported lazily through the public Plus execution/v2 handshake. Missing or mismatched Core produces a typed router availability error without changing foundation trust/readiness. Catalog authoring imports independently and does not require Core.
90
+
91
+ The packaged JSON schemas and OpenAPI derive from the source models/routes through the existing exporter. Session mutations document Origin and CSRF requirements. The original action shell and foundation SSE remain separate unavailable/non-durable surfaces.
@@ -0,0 +1,82 @@
1
+ # Release 1 legacy disposition and ownership ledger
2
+
3
+ ## Current v0.23 guidance
4
+
5
+ This document preserves the frozen Release 1 historical record below. Its package identities, artifact paths, SHA-256 values, refusal rules, and selected-plan/daemon commands describe that historical release. They are not current v0.23 installation or operating requirements.
6
+
7
+ Millrace OS 0.23.0 operates through public Plus/Core router controls. Read [router operation](../router-operation.md) for current requests, receipts, draft Apply, explicit continuation, and shutdown. Current graphs use `millrace-router/v3`, stores use `millrace-router-store/v7`, and the execution contract is `millrace-router-execution/v2`. Old stores remain paired with their matching historical runtime and environment. No migration or private-state access is supplied.
8
+
9
+ For historical Core paths removed from the active tree, use preserved Git object `af2ceb0ab10d1b265b4ec65c9658e16c66b71a6b:PATH` in the Core repository. For the exact earlier identity/digest rows below, use their recorded commit and artifact path. Historical Plus paths use the recorded commit, or preserved object `ad91c7f31cfb24b2fc3793b54efd90848a7f7327:PATH` in the Plus repository. These references preserve access without restoring obsolete runtime requirements.
10
+
11
+ The historical `uv.lock` row is retained verbatim. P8b omits that stale lock. P8d creates and verifies the new registry-only lock after Core and Plus 0.23.0 publication.
12
+
13
+ ## Frozen Release 1 record
14
+
15
+
16
+ **Status:** frozen for Packet 01. **Authority:** read-only evidence only; this
17
+ document does not authorize importing a private runtime, mutating a historical
18
+ checkout, or reconstructing an unavailable contract.
19
+
20
+ ## Method and decision vocabulary
21
+
22
+ The inventory was performed against the frozen checkouts under
23
+ `dev/` and `ref/` in the original coordination workspace. The historical
24
+ checkouts remain read-only. A disposition means:
25
+
26
+ | Decision | Meaning in Release 1 |
27
+ | --- | --- |
28
+ | **retain** | Keep the concept or public boundary, with a new implementation owned by the named Packet. |
29
+ | **adapt** | Preserve the user-visible contract only after mapping it to a pinned released public contract. |
30
+ | **preserve as evidence** | Keep the historical source, test, fixture, or digest as provenance; it is not runtime input. |
31
+ | **retire** | Do not copy, import, emulate, or provide a compatibility shim for the surface. |
32
+
33
+ Every row has a current owner. A later Packet may consume this ledger and the
34
+ compatibility inventory, but it may not silently promote evidence to runtime
35
+ authority.
36
+
37
+ ## Historical source and contract ledger
38
+
39
+ | Evidence surface | Evidence reviewed | Disposition | Reason | Current owner | Safety / negative-test evidence |
40
+ | --- | --- | --- | --- | --- | --- |
41
+ | Millrace compiler, immutable selected plans, graph routes, terminal actions, and schema declarations | `dev/source/millrace/src/millrace/compiler/`, `contracts/`, `kernel/`; released v0.22.2 tag | adapt | Later packets need selected-plan identity and route facts, not the old implementation or private tables. | Packet 02 (contracts) | Refuse missing/changed identity, unsupported schema, stale generation, and unsupported compatibility profiles. |
42
+ | Durable queues, runs, waits, interventions, traces, artifacts, and runner sessions | `dev/source/millrace/src/millrace/substrate/`, `kernel/`, `operator/`; `docs/how-millrace-works.md` | adapt | These are lower-layer authority. Packet 01 owns only OS state needed to boot; it must not create a second workflow scheduler. | Packets 02–06 | No private runtime database reads or writes; state corruption, future schema, and contradictory authority remain refusal paths. |
43
+ | Public CLI reads and actions | `docs/v0.22-compatibility.md`, `docs/errors.md`, `docs/daemon-lifecycle.md`, `src/millrace/adapters/cli/` | preserve as evidence | The exact released command and error contract is pinned in the compatibility inventory. Packet 01 does not reimplement it. | Packets 02–06 | Absent commands return a current refusal; v0.20/v0.21 aliases are not restored. |
44
+ | Runner boundary and provider-hosted process ownership | `src/millrace/adapters/runner_contract.py`, `codex-runner.md`, `millforge-runner.md` | retain | Provider processes are injected external dependencies; OS shutdown closes only OS-owned resources. | Packet 01 boundary; Packets 05–06 adapters | No provider callback, credential, process, or external effect is started or stopped by foundation shutdown. |
45
+ | Millrace Plus workflow packages and advisory skills | `dev/assets/millrace-plus` v0.22.2 release line and package tests | adapt | Package data may be imported by later validation, but it cannot register executable authority or a plugin. | Packet 02 | Package identity and member version pins are exact; absent package behavior is refused. |
46
+ | LAD stage prompts, including Builder/Checker/Fixer/Recovery roles | `dev/workflow/lad/millrace/{planning,execution,learning}/` | preserve as evidence | Prompt text explains workflow intent; it is not a kernel scheduler, runtime database, or authorization source. | Packets 02–07 | No stage prompt can change queue, route, approval, capability, or durable state by itself. |
47
+ | Historical tests, fixtures, schemas, and release QA | `dev/source/millrace/tests/`, `dev/assets/millrace-plus/tests/`, `dev/source/millmux/docs/`, `ref/` | preserve as evidence | Tests identify safety and negative cases to carry forward; their fixtures are not copied into the new service. | Packet 01 evidence; consuming Packet | Negative cases include corrupt/future state, stale identity, unsafe permissions, redaction, orphan risk, and unsupported commands. |
48
+ | Redaction and secret boundaries | Millrace runner configuration docs, lower-layer error matrices, and legacy agent evidence | adapt | Keep no-secrets-in-artifacts, owner-only local credentials, and public-safe projections. | Packet 01 for credentials; Packet 04 for evidence | Credential values never appear in health, logs, docs, or artifacts; provider secrets and adapter config secrets are refused. |
49
+ | Recovery and restart behavior | `docs/daemon-lifecycle.md`, runner-session architecture, Millmux lifecycle QA | retain | Restart must classify durable state and leave external workers/processes alone unless an owned public contract later proves a supported action. | Packet 01 for OS state; Packets 05–06 for adapters | Corrupt/incompatible state exposes typed recovery; unverified external effects are never guessed successful. |
50
+ | Mission Control information architecture | historical `millrace-web` references, operator/status/doctor projections, and Millmux cockpit QA | preserve as evidence | The Release 1 browser endpoint starts with an immutable health/recovery shell; normal Mission Control is later scope. | Packet 06 | No UI-only state becomes authority and no Tauri sidecar is required to boot the foundation. |
51
+ | Millracer | `dev/harness/millracer`, tag `v0.3.0`, README and release tests | preserve as evidence; retire as runtime dependency | Millracer remains historical QA/harness evidence. It is not a Release 1 runner, provider, scheduler, or compatibility target. | Packet 01 ledger; no runtime owner | No Millracer import, process launch, credential use, or v0.20/v0.21 compatibility is permitted. |
52
+
53
+ The obsolete **second-runtime** assumption is explicitly retired; the matrix
54
+ and rules below use that term as the boundary label for audits and negative
55
+ tests.
56
+
57
+ ## Explicit obsolete assumptions
58
+
59
+ | Assumption | Disposition | Refusal rule |
60
+ | --- | --- | --- |
61
+ | A second runtime (Node, Cargo, Tauri, or a sidecar) is required to run Millrace OS | retire | The wheel and service must run on Python 3.12 plus the standard library. A missing later UI does not block health/recovery. |
62
+ | Millmux is mandatory for foundation startup | retire | Packet 01 starts without Millmux. A later adapter may consume only its pinned public protocol; no private storage or CLI scraping substitutes for it. |
63
+ | Tauri-only browser/control surface | retire | The fixed loopback HTTP shell is the only Packet 01 browser surface. Native packaging is later scope. |
64
+ | v0.20 or v0.21 state/config/CLI compatibility | retire | Existing old state is not read, migrated, repaired, or rewritten. The service refuses incompatible state visibly. |
65
+ | Legacy scaffold or copied runtime database | retire | No historical scaffold or private database file is copied into `src/millrace_os/` or tests. |
66
+
67
+ ## Ownership boundary for Packet 01
68
+
69
+ Packet 01 owns only the standalone package metadata, configuration and
70
+ credential paths, OS-local SQLite state, recovery shell, service lifecycle,
71
+ and this evidence ledger. Packet 01 does not own DTOs, workflow routes,
72
+ providers, actions, events, Mission Control, qualification, candidate
73
+ authoring, remote access, or dynamic plugins. Later packets must consume
74
+ `docs/compatibility/release-1-contract-inventory.md` as a named input.
75
+
76
+ ## v0.23 headless router successor
77
+
78
+ The v0.23 service supersedes only the earlier prohibition on service ownership of controller execution. OS owns bounded public Core call workers and their drain/join lifecycle. Core/Plus retain invocation, child-process, writer, receipt, and hold authority. The existing unrelated provider-hosted-process shutdown boundary remains intact.
79
+
80
+ The router client uses public Plus controls and execution/v2. It adds no Core-private imports, graph parser, scheduler, provider registry, durable OS job registry, or run-state mirror. Named configured state homes select Core authority. The existing SQLite schema stores no duplicate router rows.
81
+
82
+ Manual workflow Apply uses OS-owned frozen drafts and a cooperating per-instance publication lock outside Core's instances directory. Apply pauses, drains, validates, publishes, and submits. It leaves explicit acceptance and continuation to later operator requests. Automatic continuation and a later-stop ordering guard remain deferred. Existing bootstrap/recovery assets and local trust/path/process-identity protections remain in force.