trugs-runner 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 (146) hide show
  1. trugs_runner-0.1.0/LICENSE +202 -0
  2. trugs_runner-0.1.0/NOTICE +4 -0
  3. trugs_runner-0.1.0/PKG-INFO +15 -0
  4. trugs_runner-0.1.0/README.md +359 -0
  5. trugs_runner-0.1.0/pyproject.toml +23 -0
  6. trugs_runner-0.1.0/setup.cfg +4 -0
  7. trugs_runner-0.1.0/src/executable_trug/__init__.py +6 -0
  8. trugs_runner-0.1.0/src/executable_trug/__main__.py +10 -0
  9. trugs_runner-0.1.0/src/executable_trug/actions.py +631 -0
  10. trugs_runner-0.1.0/src/executable_trug/actions_record.py +708 -0
  11. trugs_runner-0.1.0/src/executable_trug/admission.py +830 -0
  12. trugs_runner-0.1.0/src/executable_trug/authoring.py +420 -0
  13. trugs_runner-0.1.0/src/executable_trug/bindings.py +123 -0
  14. trugs_runner-0.1.0/src/executable_trug/captured.py +177 -0
  15. trugs_runner-0.1.0/src/executable_trug/cli.py +148 -0
  16. trugs_runner-0.1.0/src/executable_trug/composition.py +176 -0
  17. trugs_runner-0.1.0/src/executable_trug/content.py +513 -0
  18. trugs_runner-0.1.0/src/executable_trug/discussion.py +321 -0
  19. trugs_runner-0.1.0/src/executable_trug/gate_admission.py +548 -0
  20. trugs_runner-0.1.0/src/executable_trug/gates.py +184 -0
  21. trugs_runner-0.1.0/src/executable_trug/gateway.py +65 -0
  22. trugs_runner-0.1.0/src/executable_trug/gateway_client.py +215 -0
  23. trugs_runner-0.1.0/src/executable_trug/gateway_config.py +230 -0
  24. trugs_runner-0.1.0/src/executable_trug/gateway_protocol.py +423 -0
  25. trugs_runner-0.1.0/src/executable_trug/gateway_server.py +501 -0
  26. trugs_runner-0.1.0/src/executable_trug/gateway_transport.py +60 -0
  27. trugs_runner-0.1.0/src/executable_trug/identity.py +83 -0
  28. trugs_runner-0.1.0/src/executable_trug/json_codec.py +344 -0
  29. trugs_runner-0.1.0/src/executable_trug/maintenance.py +151 -0
  30. trugs_runner-0.1.0/src/executable_trug/model.py +474 -0
  31. trugs_runner-0.1.0/src/executable_trug/model_admission.py +374 -0
  32. trugs_runner-0.1.0/src/executable_trug/model_call_record.py +691 -0
  33. trugs_runner-0.1.0/src/executable_trug/person.py +143 -0
  34. trugs_runner-0.1.0/src/executable_trug/pin.py +100 -0
  35. trugs_runner-0.1.0/src/executable_trug/process.py +351 -0
  36. trugs_runner-0.1.0/src/executable_trug/program.py +605 -0
  37. trugs_runner-0.1.0/src/executable_trug/providers/__init__.py +1 -0
  38. trugs_runner-0.1.0/src/executable_trug/providers/local_vllm.py +405 -0
  39. trugs_runner-0.1.0/src/executable_trug/providers/sol.py +591 -0
  40. trugs_runner-0.1.0/src/executable_trug/rail.py +35 -0
  41. trugs_runner-0.1.0/src/executable_trug/record.py +1025 -0
  42. trugs_runner-0.1.0/src/executable_trug/record_schema.py +423 -0
  43. trugs_runner-0.1.0/src/executable_trug/record_use.py +165 -0
  44. trugs_runner-0.1.0/src/executable_trug/reference_positions.py +192 -0
  45. trugs_runner-0.1.0/src/executable_trug/runner.py +1243 -0
  46. trugs_runner-0.1.0/src/executable_trug/snapshot.py +1144 -0
  47. trugs_runner-0.1.0/src/executable_trug/state.py +285 -0
  48. trugs_runner-0.1.0/src/executable_trug/step_protocol.py +280 -0
  49. trugs_runner-0.1.0/src/executable_trug/storage.py +351 -0
  50. trugs_runner-0.1.0/src/executable_trug/views.py +262 -0
  51. trugs_runner-0.1.0/src/executable_trug/vocabulary.py +117 -0
  52. trugs_runner-0.1.0/src/trugs_runner/__init__.py +4 -0
  53. trugs_runner-0.1.0/src/trugs_runner/author/__init__.py +8 -0
  54. trugs_runner-0.1.0/src/trugs_runner/author/builder.py +236 -0
  55. trugs_runner-0.1.0/src/trugs_runner/nodes/__init__.py +30 -0
  56. trugs_runner-0.1.0/src/trugs_runner/nodes/discussion.py +152 -0
  57. trugs_runner-0.1.0/src/trugs_runner/nodes/interface.py +105 -0
  58. trugs_runner-0.1.0/src/trugs_runner/nodes/person.py +80 -0
  59. trugs_runner-0.1.0/src/trugs_runner/nodes/tool.py +43 -0
  60. trugs_runner-0.1.0/src/trugs_runner/nodes/worker.py +34 -0
  61. trugs_runner-0.1.0/src/trugs_runner.egg-info/PKG-INFO +15 -0
  62. trugs_runner-0.1.0/src/trugs_runner.egg-info/SOURCES.txt +144 -0
  63. trugs_runner-0.1.0/src/trugs_runner.egg-info/dependency_links.txt +1 -0
  64. trugs_runner-0.1.0/src/trugs_runner.egg-info/requires.txt +7 -0
  65. trugs_runner-0.1.0/src/trugs_runner.egg-info/top_level.txt +2 -0
  66. trugs_runner-0.1.0/tests/test_action_cycles.py +204 -0
  67. trugs_runner-0.1.0/tests/test_action_views.py +448 -0
  68. trugs_runner-0.1.0/tests/test_actions_record.py +976 -0
  69. trugs_runner-0.1.0/tests/test_actions_v2.py +1441 -0
  70. trugs_runner-0.1.0/tests/test_admission.py +363 -0
  71. trugs_runner-0.1.0/tests/test_approve_and_record.py +314 -0
  72. trugs_runner-0.1.0/tests/test_audit_repairs.py +185 -0
  73. trugs_runner-0.1.0/tests/test_authoring_v2.py +473 -0
  74. trugs_runner-0.1.0/tests/test_bindings.py +324 -0
  75. trugs_runner-0.1.0/tests/test_bounded_tool_loop.py +309 -0
  76. trugs_runner-0.1.0/tests/test_cli_v2.py +225 -0
  77. trugs_runner-0.1.0/tests/test_composition.py +131 -0
  78. trugs_runner-0.1.0/tests/test_container_required_checks.py +95 -0
  79. trugs_runner-0.1.0/tests/test_content.py +136 -0
  80. trugs_runner-0.1.0/tests/test_continue_v2.py +354 -0
  81. trugs_runner-0.1.0/tests/test_cutover.py +227 -0
  82. trugs_runner-0.1.0/tests/test_development_ladder.py +505 -0
  83. trugs_runner-0.1.0/tests/test_development_orchestration.py +2477 -0
  84. trugs_runner-0.1.0/tests/test_development_v2.py +734 -0
  85. trugs_runner-0.1.0/tests/test_discussion_v2.py +861 -0
  86. trugs_runner-0.1.0/tests/test_documented_invocations.py +202 -0
  87. trugs_runner-0.1.0/tests/test_end_to_end.py +522 -0
  88. trugs_runner-0.1.0/tests/test_evaluator_optimizer.py +245 -0
  89. trugs_runner-0.1.0/tests/test_evidence_capture.py +224 -0
  90. trugs_runner-0.1.0/tests/test_faq_answer.py +1047 -0
  91. trugs_runner-0.1.0/tests/test_gate_admission.py +906 -0
  92. trugs_runner-0.1.0/tests/test_gate_replay.py +413 -0
  93. trugs_runner-0.1.0/tests/test_gateway_checks.py +1038 -0
  94. trugs_runner-0.1.0/tests/test_gateway_commands.py +273 -0
  95. trugs_runner-0.1.0/tests/test_gateway_lifecycle.py +375 -0
  96. trugs_runner-0.1.0/tests/test_gateway_protocol.py +356 -0
  97. trugs_runner-0.1.0/tests/test_gateway_records.py +447 -0
  98. trugs_runner-0.1.0/tests/test_gateway_runner.py +631 -0
  99. trugs_runner-0.1.0/tests/test_gateway_views.py +182 -0
  100. trugs_runner-0.1.0/tests/test_graph.py +100 -0
  101. trugs_runner-0.1.0/tests/test_json_codec.py +168 -0
  102. trugs_runner-0.1.0/tests/test_ladder_edges.py +183 -0
  103. trugs_runner-0.1.0/tests/test_local_vllm_provider.py +494 -0
  104. trugs_runner-0.1.0/tests/test_model_admission.py +636 -0
  105. trugs_runner-0.1.0/tests/test_model_v2.py +692 -0
  106. trugs_runner-0.1.0/tests/test_node_library.py +287 -0
  107. trugs_runner-0.1.0/tests/test_node_library_discussion.py +285 -0
  108. trugs_runner-0.1.0/tests/test_parity_baseline.py +265 -0
  109. trugs_runner-0.1.0/tests/test_person_v2.py +869 -0
  110. trugs_runner-0.1.0/tests/test_phase1_exit_compatibility.py +23 -0
  111. trugs_runner-0.1.0/tests/test_pin_atomic.py +237 -0
  112. trugs_runner-0.1.0/tests/test_pr10_repairs.py +252 -0
  113. trugs_runner-0.1.0/tests/test_pr10_result_review.py +232 -0
  114. trugs_runner-0.1.0/tests/test_process_diagnostics.py +379 -0
  115. trugs_runner-0.1.0/tests/test_program.py +314 -0
  116. trugs_runner-0.1.0/tests/test_rail.py +98 -0
  117. trugs_runner-0.1.0/tests/test_record_append.py +340 -0
  118. trugs_runner-0.1.0/tests/test_record_compare.py +182 -0
  119. trugs_runner-0.1.0/tests/test_record_erasure.py +653 -0
  120. trugs_runner-0.1.0/tests/test_record_faults.py +464 -0
  121. trugs_runner-0.1.0/tests/test_record_inspection.py +181 -0
  122. trugs_runner-0.1.0/tests/test_record_read.py +360 -0
  123. trugs_runner-0.1.0/tests/test_record_schema.py +222 -0
  124. trugs_runner-0.1.0/tests/test_record_start.py +271 -0
  125. trugs_runner-0.1.0/tests/test_record_transition.py +26 -0
  126. trugs_runner-0.1.0/tests/test_reference_positions.py +640 -0
  127. trugs_runner-0.1.0/tests/test_release_coverage.py +826 -0
  128. trugs_runner-0.1.0/tests/test_repetition_v2.py +504 -0
  129. trugs_runner-0.1.0/tests/test_resume.py +267 -0
  130. trugs_runner-0.1.0/tests/test_route_gates.py +341 -0
  131. trugs_runner-0.1.0/tests/test_router.py +225 -0
  132. trugs_runner-0.1.0/tests/test_scripted_model.py +237 -0
  133. trugs_runner-0.1.0/tests/test_snapshot_capture.py +498 -0
  134. trugs_runner-0.1.0/tests/test_snapshot_publication.py +315 -0
  135. trugs_runner-0.1.0/tests/test_snapshot_readmission.py +855 -0
  136. trugs_runner-0.1.0/tests/test_sol_provider.py +755 -0
  137. trugs_runner-0.1.0/tests/test_state_merge.py +170 -0
  138. trugs_runner-0.1.0/tests/test_state_rules.py +142 -0
  139. trugs_runner-0.1.0/tests/test_step_protocol_v2.py +403 -0
  140. trugs_runner-0.1.0/tests/test_step_streams.py +288 -0
  141. trugs_runner-0.1.0/tests/test_step_timeout.py +108 -0
  142. trugs_runner-0.1.0/tests/test_storage.py +143 -0
  143. trugs_runner-0.1.0/tests/test_test_container.py +1010 -0
  144. trugs_runner-0.1.0/tests/test_v2_parity_mapping.py +529 -0
  145. trugs_runner-0.1.0/tests/test_validate_once.py +245 -0
  146. trugs_runner-0.1.0/tests/test_vocabulary.py +90 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,4 @@
1
+ TRUGS runner
2
+ Copyright 2026 TRUGS LLC
3
+
4
+ Licensed under the Apache License, Version 2.0.
@@ -0,0 +1,15 @@
1
+ Metadata-Version: 2.4
2
+ Name: trugs-runner
3
+ Version: 0.1.0
4
+ Summary: The TRUGS runner offers and records actions against a fixed graph.
5
+ License: Apache-2.0
6
+ Requires-Python: >=3.11
7
+ License-File: LICENSE
8
+ License-File: NOTICE
9
+ Requires-Dist: jsonschema<5,>=4.19
10
+ Requires-Dist: trugs-tools<3.0.0,>=2.0.0
11
+ Provides-Extra: dev
12
+ Requires-Dist: pytest>=8; extra == "dev"
13
+ Requires-Dist: ruff==0.16.5; extra == "dev"
14
+ Requires-Dist: trugs-tools==2.2.0; extra == "dev"
15
+ Dynamic: license-file
@@ -0,0 +1,359 @@
1
+ # the TRUGS runner records and checks work against a fixed graph.
2
+
3
+ [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
4
+ [![check](https://github.com/TRUGS-LLC/TRUGS-RUNNER/actions/workflows/check.yml/badge.svg)](https://github.com/TRUGS-LLC/TRUGS-RUNNER/actions/workflows/check.yml)
5
+ [![run](https://github.com/TRUGS-LLC/TRUGS-RUNNER/actions/workflows/run.yml/badge.svg)](https://github.com/TRUGS-LLC/TRUGS-RUNNER/actions/workflows/run.yml)
6
+
7
+ An agent can fail by leaving the declared path or by taking a permitted step that is wrong. A rail is a TRUG that a person orders in advance, declaring the steps, permissions and evidence needed to move on. The TRUGS runner validates and captures the rail once at the start and never lets a run change it. Gates admit evidence, not claims. A deterministic oracle decides completion by checking conditions written down in advance; it never judges the quality of the work.
8
+
9
+ ## Run it
10
+
11
+ ```sh
12
+ export PYTHONPATH=src
13
+ G=examples/letter-classification/letter-classification.trug.json
14
+ W="$PWD/examples/letter-classification/workers/deterministic_worker.py"
15
+
16
+ python3 -m executable_trug pin $G # record what each program is
17
+ python3 examples/letter-classification/driver.py --worker-command "python3 $W" \
18
+ --run-dir /tmp/run --word Strawberry --head-file letter-head.json
19
+ ```
20
+
21
+ The worker command uses an absolute path because capabilities run from the
22
+ captured snapshot directory. External workers are explicit driver adapter resources, separate
23
+ from the declared definition files.
24
+
25
+ It classifies each character of the word as R or not-R, one agent call per character,
26
+ and exits `0`.
27
+
28
+ A run that stops part way — the driver killed, the machine restarted — retains its
29
+ committed record. The head file is saved only when the driver returns, so after an
30
+ interruption it may be absent or stale. First stop and wait for the old driver and
31
+ **all capability/worker processes and their descendants**; killing the driver alone
32
+ does not establish that they stopped. After a restart, confirm none survived or
33
+ were restarted. Keep other drivers and external writers stopped during recovery.
34
+ `--processes-stopped` declares your confirmation; it does not stop processes for you.
35
+
36
+ Recover the current head by verifying the record without executing an action,
37
+ then continue with that exact external head:
38
+
39
+ ```sh
40
+ python3 examples/letter-classification/driver.py --run-dir /tmp/run --recover-head --processes-stopped --head-file letter-head.json
41
+ python3 examples/letter-classification/driver.py --worker-command "python3 $W" --run-dir /tmp/run --expected-head letter-head.json --head-file letter-head.json --processes-stopped
42
+ ```
43
+
44
+ Recovery requires `--head-file` and `--processes-stopped`, and cannot be combined
45
+ with `--expected-head` or person input. Invalid record/content is refused. Continue
46
+ still refuses a stale head; it never refreshes the supplied head automatically.
47
+
48
+ An action whose observation is committed is routed without invoking it again.
49
+ An unsafe action with a committed intent but no accepted observation reports
50
+ `invocation_unresolved` (exit `2`), preserving its effect and state rather than
51
+ repeating it. Recover the newly recorded halt head using the first command again;
52
+ continuation at that head returns the same halt (exit `21`). An operator must
53
+ separately choose retry or abandon through the public continuation surface; this
54
+ driver never chooses a recovery resolution automatically.
55
+
56
+ ## The part that matters
57
+
58
+ Run it again with a worker that always answers `record_r`:
59
+
60
+ ```sh
61
+ python3 examples/letter-classification/driver.py --worker-command "python3 $W --always-record-r" \
62
+ --run-dir /tmp/wrong --word Strawberry
63
+ ```
64
+
65
+ Same number of steps. Every receipt written. Every gate passed. Exit `21` — the
66
+ oracle caught it.
67
+
68
+ That split is the design. The per-step gate asks only *did the required thing
69
+ happen?*, which is cheap enough to run every step. Whether the conditions the task
70
+ stated now hold is a separate question, answered once at the end by something exact.
71
+
72
+ Note what the oracle is never asked. It does not judge whether the work was *good* —
73
+ correctness is a judgment about intent, and anything that forms judgments is an opinion
74
+ rather than an instrument. It checks *completion*: conditions written down in advance.
75
+ And it only ever checks conditions it can decide **without running what the agent
76
+ produced**, because an artifact that has to be run to be judged authors every input to
77
+ the verdict. This oracle reads receipts; it executes nothing the agent wrote. See
78
+ [CONCEPTS.md](CONCEPTS.md).
79
+
80
+ ## Scope
81
+
82
+ This software does not include self-modifying TRUGS: graphs that change their own structure while they run.
83
+
84
+ ## Honest limits
85
+
86
+ The TRUGS runner offers and records; it does not confine.
87
+
88
+ - **It is not a security boundary, and it does not contain the worker.** A worker
89
+ runs as an ordinary process under the host's identity, launched by a capability. It
90
+ is kept from the oracle, the receipts and the result programs only by being given no
91
+ path to them — not by isolation. A worker able to look can find them, and anything
92
+ it does before stating its choice has happened whether or not the rail then refuses
93
+ the choice. A deployment that runs an untrusted worker must contain it itself — in a
94
+ VM, for example; a locked-down system is a different layer from this one. The rail
95
+ is a step up from instructions a model may ignore, not a sandbox.
96
+ - **It measures no model.** The bundled worker decides by comparison, not judgment.
97
+ Nothing measured against it says anything about an AI model.
98
+ - **The graph never rewrites itself.** It is fixed for the life of a run. See
99
+ [Scope](#scope).
100
+ - **The run directory is trusted.** `record.read_record()` with its defaults,
101
+ `rail.read_state()` and `cli.inspect()` verify the complete canonical entry chain
102
+ and referenced content; inspection reports content loss separately. A retained
103
+ earlier head supplied to complete verification anchors the verified prefix at
104
+ that sequence. `read_record(verify_payloads=False)` verifies the chain only.
105
+ Ordinary reads during start and continue resolve the position, input, state,
106
+ pending links and gate operands needed for the current operation. They check
107
+ format support and the supplied latest head, validate the current protocol,
108
+ state and gates, and validate new entries before publication. They do not rehash
109
+ earlier entries or content and report `chain_integrity: null`. On this path a
110
+ retained head establishes agreement with the stored latest-head tuple, without
111
+ establishing prefix integrity. Someone able to replace all bytes and the caller's
112
+ retained head can still rewrite the history consistently. The chain does not
113
+ authenticate who acted. See [Record §5](SPEC/SPEC-261003-run-record.md#5-covering-digest-sdk-verification-and-limits).
114
+ - **The actor is declared, not authenticated.** Every invocation is checked against
115
+ the root's `actor`; the rail cannot tell which process is calling it. Modal edges
116
+ naming any other actor — the worker's `SHALL_NOT` edges included — are not checked
117
+ at run time, because no other actor makes requests of the rail.
118
+ - **Definitions are captured at start.** Start validates and captures the rail.
119
+ Before each step, the engine compares the captured files with their recorded
120
+ fingerprints and stops with a report if they differ. Installed edits affect new runs. Snapshot
121
+ storage is trusted local storage, not a confinement mechanism for workers.
122
+ - **A refusal never selects a route.** A permission refusal preserves the position;
123
+ other ordinary execution refusals halt the run for a person. Installed edits
124
+ cannot change the definitions used by that run.
125
+ - **Stops retain their reason, cursor and unresolved intent.** When recovery is
126
+ offered, continue accepts an explicit retry or abandon choice with the retained
127
+ head and process confirmation.
128
+ - **Authoring run stops at a person pause.** It carries returned heads through
129
+ start/continue and reports the pause for an explicit person submission.
130
+ - **Model content has three admitted paths at this release.** It proceeds only
131
+ to a person inside the declared discussion form, by an exact whole-result check
132
+ against independently bound input, or to `unverified`.
133
+ - **The pattern rails keep that boundary.** The router and bounded tool loop use
134
+ program workers; the evaluator-optimizer uses a person to review model drafts.
135
+ They do not show a model evaluating a model, gateway tool calling, child rails
136
+ or fan-out.
137
+ - **Compliance uses the pinned checker.** `make check` includes `trug compliance`
138
+ against the stored baseline; use the [pinned checking environment](#verify) to
139
+ compare results.
140
+
141
+ ## Pattern rails
142
+
143
+ See the [examples index](examples/README.md) for all four examples and four pattern rails.
144
+
145
+ - [Approve and record](patterns/approve-and-record/) shows a person's exact acceptance governing a recording effect, with a custom node beside library nodes.
146
+ - [Router](patterns/router/) checks a program worker's proposed route against captured choices before invoking its declared tool.
147
+ - [Bounded tool loop](patterns/bounded-tool-loop/) alternates a program worker and a tool up to a declared return bound, then asks a person.
148
+ - [Evaluator-optimizer](patterns/evaluator-optimizer/) binds a person's recorded feedback into the next model draft and reaches a summary and person pause at the round limit.
149
+
150
+ ## Reference
151
+
152
+ See [COMMANDS.md](COMMANDS.md) for authoring, gateway, record and maintenance operations.
153
+ The command blocks below are kept here as executable reference examples.
154
+
155
+ ### Authoring and execution reference
156
+
157
+ Run from an empty working directory with the engine installed, or with an absolute
158
+ `PYTHONPATH` pointing to this checkout's `src`; all commands in this block exit 0.
159
+
160
+ <!-- PR13 commands -->
161
+ ```bash
162
+ python3 -m executable_trug create draft
163
+ python3 -m executable_trug pin draft/rail.json
164
+ python3 -m executable_trug check draft/rail.json
165
+ python3 -m executable_trug test draft/rail.json --samples draft/samples.json > tests.json
166
+ python3 -m executable_trug run draft/rail.json --input-file draft/input.json --run-dir auto-run --snapshot-store "$PWD/snapshots" > pause.json
167
+ python3 -m executable_trug start draft/rail.json --input-file draft/input.json --run-dir run --snapshot-store "$PWD/snapshots" > start.json
168
+ python3 -c 'import json; json.dump(json.load(open("start.json"))["head"], open("head.json", "w"))'
169
+ python3 -m executable_trug continue --run-dir run --expected-head head.json > work.json
170
+ python3 -c 'import json; json.dump(json.load(open("work.json"))["head"], open("head.json", "w"))'
171
+ python3 -m executable_trug continue --run-dir run --expected-head head.json > person.json
172
+ python3 -c 'import json; json.dump(json.load(open("person.json"))["head"], open("head.json", "w"))'
173
+ python3 -m executable_trug continue --run-dir run --expected-head head.json --person-input-file draft/accept.json > terminal.json
174
+ ```
175
+
176
+ ### Model gateway reference
177
+
178
+ Set `GATEWAY_CONFIG` to the gateway configuration's absolute path; start this in a
179
+ separate terminal and wait for its `ready` event.
180
+
181
+ <!-- PR7 gateway daemon -->
182
+ ```bash
183
+ python3 -m executable_trug.gateway --config "$GATEWAY_CONFIG"
184
+ ```
185
+
186
+ For a model rail, set `GRAPH`, `INPUT` and `SAMPLES` to its graph, JSON input and
187
+ samples, `SNAPSHOTS` to its snapshot store, and `GATEWAY_SOCKET` to the configured
188
+ control socket. These are alternative operations: the first creates a fresh run;
189
+ the last uses an existing `run` and its complete retained head in `head.json`.
190
+
191
+ <!-- PR7 operator commands -->
192
+ ```bash
193
+ python3 -m executable_trug run "$GRAPH" --input-file "$INPUT" --run-dir gateway-run --snapshot-store "$SNAPSHOTS" --gateway-socket "$GATEWAY_SOCKET" > gateway-result.json
194
+ python3 -m executable_trug test "$GRAPH" --samples "$SAMPLES" --gateway-socket "$GATEWAY_SOCKET" > gateway-tests.json
195
+ python3 -m executable_trug continue --run-dir run --expected-head head.json --gateway-socket "$GATEWAY_SOCKET" > gateway-step.json
196
+ ```
197
+
198
+ ### Gateway checker reference
199
+
200
+ The offline checker reads retained cases; replace the uppercase placeholders with
201
+ your case and output paths, using new output and log paths.
202
+
203
+ <!-- PR8 gateway checker offline -->
204
+ ```bash
205
+ python3 scripts/check-model-gateway.py verify OUTPUT/ordinary --expectations OUTPUT/ordinary/expectations.json
206
+ python3 scripts/check-model-gateway.py replay OUTPUT
207
+ python3 scripts/check-model-gateway.py capture CASE
208
+ python3 scripts/check-model-gateway.py bundle OUTPUT > OFFLINE.log
209
+ python3 scripts/check-model-gateway.py extract --log OFFLINE.log --output EXTRACTED
210
+ ```
211
+
212
+ Live checks require an explicit `live` command and a separately started operator
213
+ gateway; replace the socket, model and output placeholders with your configuration.
214
+ These calls use a provider and are separate from offline verification.
215
+
216
+ <!-- PR8 gateway checker live -->
217
+ ```bash
218
+ python3 scripts/check-model-gateway.py live --provider sol --gateway-socket /operator/runtime/control.sock --model MODEL --output OUTPUT
219
+ python3 scripts/check-model-gateway.py live --provider local-vllm --gateway-socket /operator/runtime/control.sock --model MODEL --output OUTPUT
220
+ ```
221
+
222
+ ### Local maintenance reference
223
+
224
+ These commands inspect the authoring walkthrough's paused `auto-run` and erase its
225
+ content after explicit process and external-writer quiescence confirmations.
226
+ The confirmation arguments declare that the processes have stopped; they do not
227
+ stop them.
228
+
229
+ <!-- PR18 maintenance commands -->
230
+ ```bash
231
+ python3 -c 'import json; from executable_trug.maintenance import inspect_record; json.dump(inspect_record("auto-run"), open("inspection.json", "w"))'
232
+ python3 -c 'import json; from executable_trug.maintenance import erase; head = json.load(open("pause.json"))["head"]; json.dump(erase("auto-run", head, processes_stopped=True, external_writers_stopped=True), open("erased.json", "w"))'
233
+ ```
234
+
235
+ ## What just happened
236
+
237
+ The graph is [`letter-classification.trug.json`](examples/letter-classification/letter-classification.trug.json).
238
+ For each character it ran this cycle:
239
+
240
+ 1. a capability read the next character
241
+ 2. a worker was asked for one choice — `record_r` or `record_not_r`
242
+ 3. the runtime ran the program that choice named, which wrote a receipt
243
+ 4. a gate confirmed the receipt existed
244
+ 5. the index advanced, and the cycle repeated
245
+
246
+ When the word ran out, a **deterministic oracle** checked every receipt against the
247
+ rule the task stated, and decided whether the run had met it.
248
+
249
+ A separately configured worker can be supplied with `--worker-command`.
250
+ The worker needs no tools and no file access. It answers with one line.
251
+
252
+ ## Make your own
253
+
254
+ To compose library and custom nodes on one Python page, see [Author a rail](src/trugs_runner/README.md).
255
+
256
+ See [`examples/letter-classification/README.md`](examples/letter-classification/README.md)
257
+ for the file layout and the steps. In short: author a graph using TRUGS nouns and
258
+ prepositions, give every node its complete list of outcomes, name in the root's
259
+ `actor` property the actor that drives the run and give it a `MAY` edge to each
260
+ capability it may have invoked, install the programs the graph names, `pin` them, and
261
+ write an oracle.
262
+
263
+ If you cannot write a deterministic oracle for a step, the specifics have not been
264
+ stated precisely enough yet — a fact about the specification, not about the step. If you
265
+ can only write one by running what the agent produced, see
266
+ [CONCEPTS.md](CONCEPTS.md) before you rely on its verdict.
267
+
268
+ ## Verify
269
+
270
+ The pinned container checks use the locked image and dependency files in
271
+ `tests/container/`. Preparation fetches prerequisites; build and checks run offline.
272
+ Run the pinned checks below:
273
+
274
+ ```sh
275
+ scripts/test-container prepare --python 3.11
276
+ scripts/test-container build --python 3.11
277
+ scripts/test-container run --python 3.11 -- make check
278
+ scripts/test-container prepare --python 3.14
279
+ scripts/test-container build --python 3.14
280
+ scripts/test-container run --python 3.14 -- make check
281
+ ```
282
+
283
+ Inside the prepared environment, `make check` runs format, lint, tests, graph
284
+ validation and compliance with the same pinned tools as CI. The examples use that
285
+ environment with `PYTHONPATH=src`.
286
+
287
+ ## Choosing from a second TRUG
288
+
289
+ An executable TRUG can name another TRUG as pinned data and gate a worker's choice
290
+ against it: a `DATA` node with a `path` and `digest`, and a `SUBJECT_TO` edge carrying
291
+ the state key it constrains and what an admissible node is — the property it must
292
+ carry (`requires`) and, optionally, its node type. A value proposed for that key must be
293
+ the id of such a node in the data TRUG, or the rail refuses it, commits nothing of it,
294
+ and halts the run. Changing the data TRUG makes the graph inadmissible until
295
+ re-pinned.
296
+ [`examples/faq-answer/`](examples/faq-answer/) shows one such choice — a question
297
+ answered from an FAQ TRUG. A gate fails closed: admission refuses a malformed gate, or any other edge to
298
+ `DATA`, rather than ignoring it.
299
+
300
+ ## What the rail refuses, and what it does not control
301
+
302
+ The rail constrains what **the rail** does with an actor's request and a worker's
303
+ choice. It does not constrain what a worker **program** does while it runs.
304
+
305
+ Refused **before anything is invoked** — nothing runs:
306
+
307
+ - an invocation the graph does not permit the programme's actor — a `SHALL_NOT` edge,
308
+ or no `SHALL` or `MAY` edge at all. The programme position stays unchanged
309
+ while the refusal is recorded;
310
+ - an invocation the step budget leaves no room for. The run halts.
311
+
312
+ Refused **after the capability ran, before an observation** — a result that fails
313
+ the step protocol or state admission, such as an undeclared state key. No state
314
+ patch or observation from that result is committed, and the cursor does not move.
315
+ The intent and refusal evidence remain, and the run halts at that node.
316
+
317
+ A **route-gate halt** happens after the observation and admitted state have been
318
+ committed. If the gate cannot select an admitted route, the run keeps that
319
+ observation and state and records a halt without a transition or cursor move.
320
+ The capability, and any worker it ran, have already acted in either case; effects
321
+ outside the rail are not undone. See [Actions §12](SPEC/SPEC-261005-actions-gates-and-step-protocol.md).
322
+
323
+ Execution refusals report a reason and retained head; recorded refusals append to
324
+ `record/entries/`. Parser and keyword errors report before starting work.
325
+ State changes refused before an observation and refused cursor moves stay
326
+ uncommitted; referenced diagnostics and refusal evidence remain available in
327
+ private `content/objects/`.
328
+
329
+ Each invocation is two-phase: an intent naming the node, capability and attempt is
330
+ committed before the capability runs, and the observation after it. If a run stops
331
+ between the two, whether the capability acted is unknown, so the rail never invokes it
332
+ again: `continue` reports the unresolved invocation for a person. Safe-to-repeat actions
333
+ use the retained request; retry and abandon are explicit continuation choices.
334
+
335
+ Admission also refuses a capability or data path that is absolute or resolves outside
336
+ the install root, through `..` or a symbolic link, and a graph in which one actor holds
337
+ conflicting modals (`SHALL_NOT` and `MAY`, say) toward the same capability.
338
+
339
+ ## More
340
+
341
+ A TRUG is defined by the [TRUGS specification](https://github.com/TRUGS-LLC/TRUGS);
342
+ start with [GETTING_STARTED.md](https://github.com/TRUGS-LLC/TRUGS/blob/main/GETTING_STARTED.md).
343
+ The validator and language come from [trugs-tools](https://github.com/TRUGS-LLC/TRUGS-TOOLS).
344
+ The [design record](SPEC/README.md) names the eleven specifications.
345
+
346
+ [CONCEPTS.md](CONCEPTS.md) — what makes a graph an executable TRUG, the failure modes
347
+ it addresses, and why the oracle is deterministic.
348
+
349
+ [`examples/faq-answer/`](examples/faq-answer/) — one executable TRUG choosing an
350
+ answer from a pinned FAQ TRUG, with the rail refusing a choice the FAQ does not hold.
351
+
352
+ [`examples/development-orchestration/`](examples/development-orchestration/) — seven
353
+ independently runnable development-role TRUGs composed into one provider-neutral,
354
+ fixture-only lifecycle that pauses for a human decision.
355
+
356
+ ## License
357
+
358
+ Apache 2.0. Copyright 2026 TRUGS LLC — see
359
+ [LICENSE](LICENSE) and [NOTICE](NOTICE).
@@ -0,0 +1,23 @@
1
+ [project]
2
+ name = "trugs-runner"
3
+ version = "0.1.0"
4
+ description = "The TRUGS runner offers and records actions against a fixed graph."
5
+ license = {text = "Apache-2.0"}
6
+ requires-python = ">=3.11"
7
+ dependencies = ["jsonschema>=4.19,<5", "trugs-tools>=2.0.0,<3.0.0"]
8
+
9
+ [project.optional-dependencies]
10
+ # Pinned exactly: an unpinned linter makes the gate fail on its release
11
+ # schedule rather than on this repository's changes.
12
+ # Pin trugs-tools so local and CI checks use the same toolchain.
13
+ dev = ["pytest>=8", "ruff==0.16.5", "trugs-tools==2.2.0"]
14
+
15
+ [build-system]
16
+ requires = ["setuptools>=68"]
17
+ build-backend = "setuptools.build_meta"
18
+
19
+ [tool.setuptools.packages.find]
20
+ where = ["src"]
21
+
22
+ [tool.setuptools]
23
+ license-files = ["LICENSE", "NOTICE"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,6 @@
1
+ # Copyright 2026 TRUGS LLC
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ """The TRUGS runner offers and records actions against a fixed graph."""
5
+
6
+ __all__ = ["rail", "vocabulary"]
@@ -0,0 +1,10 @@
1
+ # Copyright 2026 TRUGS LLC
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ """Entry point for `python -m executable_trug`."""
5
+
6
+ import sys
7
+
8
+ from .cli import main
9
+
10
+ sys.exit(main())