@orthograph/prove 0.0.0-stage → 0.1.0-next.1

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 (245) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +2 -2
  3. package/dist/index.d.ts +32 -0
  4. package/dist/index.js +32 -0
  5. package/dist/modules/build/internal/manifest.d.ts +15 -0
  6. package/dist/modules/build/internal/manifest.js +38 -0
  7. package/dist/modules/build/service.d.ts +2 -0
  8. package/dist/modules/build/service.js +74 -0
  9. package/dist/modules/build/types.d.ts +39 -0
  10. package/dist/modules/build/types.js +4 -0
  11. package/dist/modules/environments/internal/collector.d.ts +2 -0
  12. package/dist/modules/environments/internal/collector.js +5 -0
  13. package/dist/modules/environments/internal/config.d.ts +32 -0
  14. package/dist/modules/environments/internal/config.js +42 -0
  15. package/dist/modules/environments/internal/identity.d.ts +3 -0
  16. package/dist/modules/environments/internal/identity.js +17 -0
  17. package/dist/modules/environments/internal/logbook.d.ts +10 -0
  18. package/dist/modules/environments/internal/logbook.js +23 -0
  19. package/dist/modules/environments/internal/process.d.ts +41 -0
  20. package/dist/modules/environments/internal/process.js +103 -0
  21. package/dist/modules/environments/internal/secrets.d.ts +9 -0
  22. package/dist/modules/environments/internal/secrets.js +23 -0
  23. package/dist/modules/environments/internal/status.d.ts +7 -0
  24. package/dist/modules/environments/internal/status.js +31 -0
  25. package/dist/modules/environments/service.d.ts +2 -0
  26. package/dist/modules/environments/service.js +97 -0
  27. package/dist/modules/environments/types.d.ts +80 -0
  28. package/dist/modules/environments/types.js +4 -0
  29. package/dist/modules/evals/internal/calls.d.ts +19 -0
  30. package/dist/modules/evals/internal/calls.js +168 -0
  31. package/dist/modules/evals/internal/evidence.d.ts +13 -0
  32. package/dist/modules/evals/internal/evidence.js +29 -0
  33. package/dist/modules/evals/internal/run.d.ts +12 -0
  34. package/dist/modules/evals/internal/run.js +85 -0
  35. package/dist/modules/evals/internal/secrets.d.ts +5 -0
  36. package/dist/modules/evals/internal/secrets.js +72 -0
  37. package/dist/modules/evals/service.d.ts +2 -0
  38. package/dist/modules/evals/service.js +29 -0
  39. package/dist/modules/evals/testing.d.ts +12 -0
  40. package/dist/modules/evals/testing.js +15 -0
  41. package/dist/modules/evals/types.d.ts +43 -0
  42. package/dist/modules/evals/types.js +1 -0
  43. package/dist/modules/impact/internal/changed.d.ts +6 -0
  44. package/dist/modules/impact/internal/changed.js +34 -0
  45. package/dist/modules/impact/internal/closure.d.ts +12 -0
  46. package/dist/modules/impact/internal/closure.js +69 -0
  47. package/dist/modules/impact/internal/digest.d.ts +1 -0
  48. package/dist/modules/impact/internal/digest.js +2 -0
  49. package/dist/modules/impact/internal/files.d.ts +11 -0
  50. package/dist/modules/impact/internal/files.js +48 -0
  51. package/dist/modules/impact/internal/ledger.d.ts +5 -0
  52. package/dist/modules/impact/internal/ledger.js +25 -0
  53. package/dist/modules/impact/internal/linked.d.ts +4 -0
  54. package/dist/modules/impact/internal/linked.js +56 -0
  55. package/dist/modules/impact/internal/scan.d.ts +12 -0
  56. package/dist/modules/impact/internal/scan.js +66 -0
  57. package/dist/modules/impact/service.d.ts +2 -0
  58. package/dist/modules/impact/service.js +88 -0
  59. package/dist/modules/impact/types.d.ts +109 -0
  60. package/dist/modules/impact/types.js +1 -0
  61. package/dist/modules/journeys/internal/checks.d.ts +25 -0
  62. package/dist/modules/journeys/internal/checks.js +155 -0
  63. package/dist/modules/journeys/internal/d1-facts.d.ts +10 -0
  64. package/dist/modules/journeys/internal/d1-facts.js +53 -0
  65. package/dist/modules/journeys/internal/database-facts.d.ts +2 -0
  66. package/dist/modules/journeys/internal/database-facts.js +41 -0
  67. package/dist/modules/journeys/internal/device.d.ts +16 -0
  68. package/dist/modules/journeys/internal/device.js +68 -0
  69. package/dist/modules/journeys/internal/keepers.d.ts +6 -0
  70. package/dist/modules/journeys/internal/keepers.js +6 -0
  71. package/dist/modules/journeys/internal/load.d.ts +4 -0
  72. package/dist/modules/journeys/internal/load.js +94 -0
  73. package/dist/modules/journeys/internal/stand-call.d.ts +10 -0
  74. package/dist/modules/journeys/internal/stand-call.js +22 -0
  75. package/dist/modules/journeys/internal/subject.d.ts +8 -0
  76. package/dist/modules/journeys/internal/subject.js +15 -0
  77. package/dist/modules/journeys/internal/world.d.ts +70 -0
  78. package/dist/modules/journeys/internal/world.js +133 -0
  79. package/dist/modules/journeys/service.d.ts +2 -0
  80. package/dist/modules/journeys/service.js +231 -0
  81. package/dist/modules/journeys/types.d.ts +132 -0
  82. package/dist/modules/journeys/types.js +5 -0
  83. package/dist/modules/portal-feed/internal/listen.d.ts +10 -0
  84. package/dist/modules/portal-feed/internal/listen.js +32 -0
  85. package/dist/modules/portal-feed/service.d.ts +2 -0
  86. package/dist/modules/portal-feed/service.js +6 -0
  87. package/dist/modules/portal-feed/types.d.ts +30 -0
  88. package/dist/modules/portal-feed/types.js +5 -0
  89. package/dist/modules/promote/internal/environment.d.ts +6 -0
  90. package/dist/modules/promote/internal/environment.js +10 -0
  91. package/dist/modules/promote/internal/gate.d.ts +9 -0
  92. package/dist/modules/promote/internal/gate.js +37 -0
  93. package/dist/modules/promote/internal/publishing.d.ts +23 -0
  94. package/dist/modules/promote/internal/publishing.js +21 -0
  95. package/dist/modules/promote/service.d.ts +2 -0
  96. package/dist/modules/promote/service.js +112 -0
  97. package/dist/modules/promote/types.d.ts +54 -0
  98. package/dist/modules/promote/types.js +8 -0
  99. package/dist/modules/prove/internal/changed-run.d.ts +9 -0
  100. package/dist/modules/prove/internal/changed-run.js +14 -0
  101. package/dist/modules/prove/internal/device-host.d.ts +16 -0
  102. package/dist/modules/prove/internal/device-host.js +60 -0
  103. package/dist/modules/prove/internal/empty-world.d.ts +5 -0
  104. package/dist/modules/prove/internal/empty-world.js +26 -0
  105. package/dist/modules/prove/internal/exercise.d.ts +35 -0
  106. package/dist/modules/prove/internal/exercise.js +47 -0
  107. package/dist/modules/prove/internal/proof-verdicts.d.ts +5 -0
  108. package/dist/modules/prove/internal/proof-verdicts.js +37 -0
  109. package/dist/modules/prove/internal/report.d.ts +35 -0
  110. package/dist/modules/prove/internal/report.js +169 -0
  111. package/dist/modules/prove/internal/staged.d.ts +9 -0
  112. package/dist/modules/prove/internal/staged.js +30 -0
  113. package/dist/modules/prove/internal/stand.d.ts +40 -0
  114. package/dist/modules/prove/internal/stand.js +155 -0
  115. package/dist/modules/prove/internal/structured.d.ts +78 -0
  116. package/dist/modules/prove/internal/structured.js +55 -0
  117. package/dist/modules/prove/internal/test-run.d.ts +7 -0
  118. package/dist/modules/prove/internal/test-run.js +63 -0
  119. package/dist/modules/prove/service.d.ts +2 -0
  120. package/dist/modules/prove/service.js +98 -0
  121. package/dist/modules/prove/types.d.ts +120 -0
  122. package/dist/modules/prove/types.js +5 -0
  123. package/dist/modules/publish/internal/bundle.d.ts +24 -0
  124. package/dist/modules/publish/internal/bundle.js +46 -0
  125. package/dist/modules/publish/internal/env.d.ts +3 -0
  126. package/dist/modules/publish/internal/env.js +2 -0
  127. package/dist/modules/publish/internal/plan.d.ts +28 -0
  128. package/dist/modules/publish/internal/plan.js +28 -0
  129. package/dist/modules/publish/internal/registry.d.ts +24 -0
  130. package/dist/modules/publish/internal/registry.js +55 -0
  131. package/dist/modules/publish/internal/sea.d.ts +20 -0
  132. package/dist/modules/publish/internal/sea.js +77 -0
  133. package/dist/modules/publish/internal/source.d.ts +4 -0
  134. package/dist/modules/publish/internal/source.js +41 -0
  135. package/dist/modules/publish/internal/stage.d.ts +14 -0
  136. package/dist/modules/publish/internal/stage.js +95 -0
  137. package/dist/modules/publish/internal/tap.d.ts +22 -0
  138. package/dist/modules/publish/internal/tap.js +61 -0
  139. package/dist/modules/publish/service.d.ts +2 -0
  140. package/dist/modules/publish/service.js +99 -0
  141. package/dist/modules/publish/types.d.ts +80 -0
  142. package/dist/modules/publish/types.js +4 -0
  143. package/dist/modules/releases/internal/http.d.ts +12 -0
  144. package/dist/modules/releases/internal/http.js +14 -0
  145. package/dist/modules/releases/internal/stale.d.ts +13 -0
  146. package/dist/modules/releases/internal/stale.js +43 -0
  147. package/dist/modules/releases/service.d.ts +2 -0
  148. package/dist/modules/releases/service.js +59 -0
  149. package/dist/modules/releases/types.d.ts +81 -0
  150. package/dist/modules/releases/types.js +6 -0
  151. package/dist/modules/secrets/internal/file.d.ts +5 -0
  152. package/dist/modules/secrets/internal/file.js +25 -0
  153. package/dist/modules/secrets/service.d.ts +2 -0
  154. package/dist/modules/secrets/service.js +38 -0
  155. package/dist/modules/secrets/types.d.ts +44 -0
  156. package/dist/modules/secrets/types.js +7 -0
  157. package/dist/modules/server-config/internal/jsonc.d.ts +2 -0
  158. package/dist/modules/server-config/internal/jsonc.js +29 -0
  159. package/dist/modules/server-config/service.d.ts +2 -0
  160. package/dist/modules/server-config/service.js +21 -0
  161. package/dist/modules/server-config/types.d.ts +22 -0
  162. package/dist/modules/server-config/types.js +3 -0
  163. package/dist/modules/sinks/internal/axiom.d.ts +29 -0
  164. package/dist/modules/sinks/internal/axiom.js +25 -0
  165. package/dist/modules/sinks/internal/keychain.d.ts +2 -0
  166. package/dist/modules/sinks/internal/keychain.js +13 -0
  167. package/dist/modules/sinks/service.d.ts +2 -0
  168. package/dist/modules/sinks/service.js +26 -0
  169. package/dist/modules/sinks/types.d.ts +37 -0
  170. package/dist/modules/sinks/types.js +5 -0
  171. package/dist/modules/telemetry/internal/axiom-source.d.ts +2 -0
  172. package/dist/modules/telemetry/internal/axiom-source.js +108 -0
  173. package/dist/modules/telemetry/internal/binary.d.ts +11 -0
  174. package/dist/modules/telemetry/internal/binary.js +66 -0
  175. package/dist/modules/telemetry/internal/config.d.ts +13 -0
  176. package/dist/modules/telemetry/internal/config.js +22 -0
  177. package/dist/modules/telemetry/internal/file-metrics.d.ts +2 -0
  178. package/dist/modules/telemetry/internal/file-metrics.js +60 -0
  179. package/dist/modules/telemetry/internal/file-source.d.ts +2 -0
  180. package/dist/modules/telemetry/internal/file-source.js +38 -0
  181. package/dist/modules/telemetry/internal/journey-root.d.ts +44 -0
  182. package/dist/modules/telemetry/internal/journey-root.js +36 -0
  183. package/dist/modules/telemetry/internal/local.d.ts +11 -0
  184. package/dist/modules/telemetry/internal/local.js +57 -0
  185. package/dist/modules/telemetry/internal/otlp.d.ts +15 -0
  186. package/dist/modules/telemetry/internal/otlp.js +53 -0
  187. package/dist/modules/telemetry/internal/private-keys.d.ts +7 -0
  188. package/dist/modules/telemetry/internal/private-keys.js +28 -0
  189. package/dist/modules/telemetry/internal/process.d.ts +27 -0
  190. package/dist/modules/telemetry/internal/process.js +96 -0
  191. package/dist/modules/telemetry/internal/runs.d.ts +17 -0
  192. package/dist/modules/telemetry/internal/runs.js +48 -0
  193. package/dist/modules/telemetry/service.d.ts +9 -0
  194. package/dist/modules/telemetry/service.js +48 -0
  195. package/dist/modules/telemetry/types.d.ts +138 -0
  196. package/dist/modules/telemetry/types.js +13 -0
  197. package/dist/modules/test-worlds/internal/lifetime.d.ts +3 -0
  198. package/dist/modules/test-worlds/internal/lifetime.js +19 -0
  199. package/dist/modules/test-worlds/service.d.ts +2 -0
  200. package/dist/modules/test-worlds/service.js +35 -0
  201. package/dist/modules/test-worlds/types.d.ts +41 -0
  202. package/dist/modules/test-worlds/types.js +4 -0
  203. package/dist/modules/trace-trees/service.d.ts +2 -0
  204. package/dist/modules/trace-trees/service.js +40 -0
  205. package/dist/modules/trace-trees/types.d.ts +9 -0
  206. package/dist/modules/trace-trees/types.js +1 -0
  207. package/dist/modules/verdicts/internal/proof.d.ts +24 -0
  208. package/dist/modules/verdicts/internal/proof.js +59 -0
  209. package/dist/modules/verdicts/service.d.ts +16 -0
  210. package/dist/modules/verdicts/service.js +71 -0
  211. package/dist/modules/verdicts/types.d.ts +80 -0
  212. package/dist/modules/verdicts/types.js +4 -0
  213. package/dist/modules/warm/internal/source.d.ts +7 -0
  214. package/dist/modules/warm/internal/source.js +27 -0
  215. package/dist/modules/warm/service.d.ts +2 -0
  216. package/dist/modules/warm/service.js +76 -0
  217. package/dist/modules/warm/types.d.ts +43 -0
  218. package/dist/modules/warm/types.js +4 -0
  219. package/dist/modules/watch/internal/choose.d.ts +20 -0
  220. package/dist/modules/watch/internal/choose.js +24 -0
  221. package/dist/modules/watch/internal/evidence.d.ts +9 -0
  222. package/dist/modules/watch/internal/evidence.js +26 -0
  223. package/dist/modules/watch/internal/report.d.ts +18 -0
  224. package/dist/modules/watch/internal/report.js +59 -0
  225. package/dist/modules/watch/internal/tasks.d.ts +5 -0
  226. package/dist/modules/watch/internal/tasks.js +35 -0
  227. package/dist/modules/watch/service.d.ts +2 -0
  228. package/dist/modules/watch/service.js +38 -0
  229. package/dist/modules/watch/types.d.ts +44 -0
  230. package/dist/modules/watch/types.js +4 -0
  231. package/dist/modules/world/internal/ports.d.ts +8 -0
  232. package/dist/modules/world/internal/ports.js +30 -0
  233. package/dist/modules/world/internal/wrangler.d.ts +46 -0
  234. package/dist/modules/world/internal/wrangler.js +112 -0
  235. package/dist/modules/world/service.d.ts +2 -0
  236. package/dist/modules/world/service.js +46 -0
  237. package/dist/modules/world/types.d.ts +97 -0
  238. package/dist/modules/world/types.js +4 -0
  239. package/dist/modules/world-clock/internal/door.d.ts +8 -0
  240. package/dist/modules/world-clock/internal/door.js +9 -0
  241. package/dist/modules/world-clock/service.d.ts +2 -0
  242. package/dist/modules/world-clock/service.js +9 -0
  243. package/dist/modules/world-clock/types.d.ts +34 -0
  244. package/dist/modules/world-clock/types.js +1 -0
  245. package/package.json +38 -3
package/LICENSE ADDED
@@ -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.
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # Temporary Holding Version
1
+ # @orthograph/prove
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Worlds, journeys, evidence from telemetry, the evals. Built; what each part does and how far it goes is in the package map in `docs/canon/status.md`.
@@ -0,0 +1,32 @@
1
+ export { Prove } from "#modules/prove/service.js";
2
+ export { coverageLine, leftOut } from "#modules/evals/testing.js";
3
+ export { ProveFailed, type FailureDetail, type JourneyDetail, type ProveReport, type Report, type StepDetail } from "#modules/prove/types.js";
4
+ export { Worlds } from "#modules/world/service.js";
5
+ export { WorldFailed, type ChainStand, type Running } from "#modules/world/types.js";
6
+ export { Build } from "#modules/build/service.js";
7
+ export { BuildFailed, type Built } from "#modules/build/types.js";
8
+ export { Environments } from "#modules/environments/service.js";
9
+ export { EnvironmentFailed, type LogbookSetup, type Status as EnvironmentStatus, type Up as EnvironmentUp } from "#modules/environments/types.js";
10
+ export { Impact } from "#modules/impact/service.js";
11
+ export type { Impact as ImpactReport } from "#modules/impact/types.js";
12
+ export { AxiomSource, Collectors, FileMetrics, FileSource, PROVE_SPAN_PREFIX } from "#modules/telemetry/service.js";
13
+ export { Watch } from "#modules/watch/service.js";
14
+ export { WatchFailed, type SourceName as WatchSource, type Watched } from "#modules/watch/types.js";
15
+ export { CollectorFailed, SourceFailed, type Collector, type Log, type MetricPoint, type MetricsSource, type Span, type Trace, type TraceSource, type Wanted } from "#modules/telemetry/types.js";
16
+ export { Sinks } from "#modules/sinks/service.js";
17
+ export { SinksFailed, type Resolved as ResolvedSinks } from "#modules/sinks/types.js";
18
+ export { TraceTrees } from "#modules/trace-trees/service.js";
19
+ export { Releases } from "#modules/releases/service.js";
20
+ export { ReleaseFailed, SHIPPED, type Env as ReleaseEnv, type Shipping, type StaleIn } from "#modules/releases/types.js";
21
+ export { TestWorlds } from "#modules/test-worlds/service.js";
22
+ export { TestWorldFailed, type TestWorld } from "#modules/test-worlds/types.js";
23
+ export { Verdicts } from "#modules/verdicts/service.js";
24
+ export { VerdictsFailed, type Result as VerdictResult, type TokenSource } from "#modules/verdicts/types.js";
25
+ export { Secrets } from "#modules/secrets/service.js";
26
+ export { SecretsRefused, type SecretRow } from "#modules/secrets/types.js";
27
+ export { Promote } from "#modules/promote/service.js";
28
+ export { PromoteFailed, PromoteRefused, type Promoted, type Target as PromoteTarget } from "#modules/promote/types.js";
29
+ export { Publish } from "#modules/publish/service.js";
30
+ export { PublishFailed, type Binary as PublishedBinary, type Published, type PublishTarget } from "#modules/publish/types.js";
31
+ export { PortalFeed } from "#modules/portal-feed/service.js";
32
+ export { PortalFeedFailed, type PortalFeedOptions } from "#modules/portal-feed/types.js";
package/dist/index.js ADDED
@@ -0,0 +1,32 @@
1
+ // @orthograph/prove: worlds (made and destroyed), journeys, evidence from telemetry, the evals. Never runs in production.
2
+ export { Prove } from "#modules/prove/service.js";
3
+ export { coverageLine, leftOut } from "#modules/evals/testing.js";
4
+ export { ProveFailed } from "#modules/prove/types.js";
5
+ export { Worlds } from "#modules/world/service.js";
6
+ export { WorldFailed } from "#modules/world/types.js";
7
+ export { Build } from "#modules/build/service.js";
8
+ export { BuildFailed } from "#modules/build/types.js";
9
+ export { Environments } from "#modules/environments/service.js";
10
+ export { EnvironmentFailed } from "#modules/environments/types.js";
11
+ export { Impact } from "#modules/impact/service.js";
12
+ export { AxiomSource, Collectors, FileMetrics, FileSource, PROVE_SPAN_PREFIX } from "#modules/telemetry/service.js";
13
+ export { Watch } from "#modules/watch/service.js";
14
+ export { WatchFailed } from "#modules/watch/types.js";
15
+ export { CollectorFailed, SourceFailed } from "#modules/telemetry/types.js";
16
+ export { Sinks } from "#modules/sinks/service.js";
17
+ export { SinksFailed } from "#modules/sinks/types.js";
18
+ export { TraceTrees } from "#modules/trace-trees/service.js";
19
+ export { Releases } from "#modules/releases/service.js";
20
+ export { ReleaseFailed, SHIPPED } from "#modules/releases/types.js";
21
+ export { TestWorlds } from "#modules/test-worlds/service.js";
22
+ export { TestWorldFailed } from "#modules/test-worlds/types.js";
23
+ export { Verdicts } from "#modules/verdicts/service.js";
24
+ export { VerdictsFailed } from "#modules/verdicts/types.js";
25
+ export { Secrets } from "#modules/secrets/service.js";
26
+ export { SecretsRefused } from "#modules/secrets/types.js";
27
+ export { Promote } from "#modules/promote/service.js";
28
+ export { PromoteFailed, PromoteRefused } from "#modules/promote/types.js";
29
+ export { Publish } from "#modules/publish/service.js";
30
+ export { PublishFailed } from "#modules/publish/types.js";
31
+ export { PortalFeed } from "#modules/portal-feed/service.js";
32
+ export { PortalFeedFailed } from "#modules/portal-feed/types.js";
@@ -0,0 +1,15 @@
1
+ import { Effect } from "effect";
2
+ import { BuildFailed } from "../types.ts";
3
+ export declare const digest: (file: string) => string;
4
+ /** The digest of a folder: each file's path and bytes, in path order. The portal's client is judged by it (K19). */
5
+ export declare const treeDigest: (dir: string) => string;
6
+ export declare const failure: (error: unknown) => BuildFailed;
7
+ export declare const io: <A>(work: () => A) => Effect.Effect<A, BuildFailed, never>;
8
+ /** Legacy records are deliberately not inferred from whatever source happens to be present now. */
9
+ export declare const read: (dir: string, revision: string) => Effect.Effect<{
10
+ revision: string;
11
+ commit: string;
12
+ sha256: string;
13
+ main: string;
14
+ portal: string | null;
15
+ } | undefined, BuildFailed, never>;
@@ -0,0 +1,38 @@
1
+ import { createHash } from "node:crypto";
2
+ import { existsSync, readFileSync, readdirSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { Effect, Schema } from "effect";
5
+ import { BuildFailed } from "../types.js";
6
+ export const digest = (file) => createHash("sha256").update(readFileSync(file)).digest("hex");
7
+ const filesUnder = (dir) => readdirSync(dir, { recursive: true, withFileTypes: true }).filter((e) => e.isFile()).map((e) => join(e.parentPath, e.name).slice(dir.length + 1)).sort();
8
+ /** The digest of a folder: each file's path and bytes, in path order. The portal's client is judged by it (K19). */
9
+ export const treeDigest = (dir) => filesUnder(dir).reduce((hash, file) => hash.update(`${file}\0${digest(join(dir, file))}\n`), createHash("sha256")).digest("hex");
10
+ export const failure = (error) => new BuildFailed({ message: String(error).replace(/^Error: /, "") });
11
+ export const io = (work) => Effect.try({ try: work, catch: failure });
12
+ const Manifest = Schema.Struct({
13
+ schemaVersion: Schema.Literal(1), source: Schema.Literal("clean"),
14
+ revision: Schema.String, commit: Schema.String.check(Schema.isPattern(/^[0-9a-f]{40}$/)),
15
+ sha256: Schema.String.check(Schema.isPattern(/^[0-9a-f]{64}$/)),
16
+ /** The portal's prebuilt client the revision ships (K19): its digest, or null when it shipped none. A record from before this has no key, and means none. */
17
+ portal: Schema.optionalKey(Schema.NullOr(Schema.Struct({ sha256: Schema.String.check(Schema.isPattern(/^[0-9a-f]{64}$/)) }))),
18
+ });
19
+ /** Legacy records are deliberately not inferred from whatever source happens to be present now. */
20
+ export const read = (dir, revision) => Effect.gen(function* () {
21
+ const main = join(dir, "main.js");
22
+ const record = join(dir, "bundle.json");
23
+ if (!existsSync(main) && !existsSync(record))
24
+ return undefined;
25
+ if (!existsSync(main) || !existsSync(record))
26
+ return yield* new BuildFailed({ message: `the artefact of ${revision} is incomplete: move its local cache aside, then run ortho build and ortho prove --env test` });
27
+ const raw = yield* io(() => JSON.parse(readFileSync(record, "utf8")));
28
+ const manifest = yield* Schema.decodeUnknownEffect(Manifest)(raw).pipe(Effect.mapError(() => new BuildFailed({ message: `the artefact of ${revision} has no trusted clean-source provenance: move its local cache aside, then run ortho build and ortho prove --env test` })));
29
+ if (manifest.revision !== revision || !manifest.commit.startsWith(revision))
30
+ return yield* new BuildFailed({ message: `the artefact's source commit does not match ${revision}` });
31
+ const actual = yield* io(() => digest(main));
32
+ if (actual !== manifest.sha256)
33
+ return yield* new BuildFailed({ message: `${main} no longer matches the hash recorded when it was built` });
34
+ const shipped = manifest.portal?.sha256 ?? null;
35
+ if (shipped !== null && (!existsSync(join(dir, "portal")) || treeDigest(join(dir, "portal")) !== shipped))
36
+ return yield* new BuildFailed({ message: `${join(dir, "portal")} no longer matches the client recorded when ${revision} was built` });
37
+ return { revision, commit: manifest.commit, sha256: actual, main, portal: shipped };
38
+ });
@@ -0,0 +1,2 @@
1
+ import { type BuildApi } from "./types.ts";
2
+ export declare const Build: BuildApi;
@@ -0,0 +1,74 @@
1
+ import { Names } from "orthograph/server";
2
+ import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
3
+ import { dirname, join, resolve } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { spawnSync } from "node:child_process";
6
+ import { Effect } from "effect";
7
+ import { ServerConfig } from "#modules/server-config/service.js";
8
+ import { BuildFailed } from "./types.js";
9
+ import { digest, io, read, treeDigest } from "./internal/manifest.js";
10
+ const wrangler = join(dirname(fileURLToPath(import.meta.resolve("wrangler/package.json"))), "bin/wrangler.js");
11
+ const artefacts = (root, revision) => join(resolve(root), Names.folder, "artefacts", revision);
12
+ const git = (root, ...args) => Effect.gen(function* () {
13
+ const run = yield* io(() => spawnSync("git", args, { cwd: root, encoding: "utf8" }));
14
+ if (run.status !== 0)
15
+ return yield* new BuildFailed({ message: `${resolve(root)} is not in a git repository, and the revision is the git commit (${run.stderr?.trim() || run.error?.message || `git exited ${run.status}`})` });
16
+ return run.stdout.trim();
17
+ });
18
+ const revision = (root) => git(root, "rev-parse", "--short", "HEAD");
19
+ const dirty = (root) => git(root, "status", "--porcelain").pipe(Effect.map((out) => out.length > 0));
20
+ const unchanged = (root, commit) => Effect.gen(function* () {
21
+ if ((yield* dirty(root)) || (yield* git(root, "rev-parse", "HEAD")) !== commit)
22
+ return yield* new BuildFailed({ message: "the source changed while proving: commit it and prove again" });
23
+ });
24
+ const find = (root, rev) => read(artefacts(root, rev), rev);
25
+ /** Only tooling environment reaches the bundler. No account credential is needed by a local dry run. */
26
+ const toolingEnv = (env) => Object.fromEntries(Object.entries(env).filter(([name]) => /^(PATH|HOME|TMPDIR|TMP|TEMP|LANG|LC_.*|HTTPS?_PROXY|NO_PROXY|NODE_EXTRA_CA_CERTS|SSL_CERT_FILE)$/i.test(name)));
27
+ const build = (root, env = {}) => Effect.gen(function* () {
28
+ const rev = yield* revision(root);
29
+ if (yield* dirty(root))
30
+ return yield* new BuildFailed({ message: `refused: the working tree differs from ${rev}: commit or stash what changed before building a deployable bundle` });
31
+ const commit = yield* git(root, "rev-parse", "HEAD");
32
+ const held = yield* find(root, rev);
33
+ const generated = resolve(root, "generated/server/wrangler.jsonc");
34
+ if (!existsSync(generated))
35
+ return yield* new BuildFailed({ message: `${generated} is missing: run nx sync first` });
36
+ // The portal's prebuilt client ships with the revision, beside the bundle (K19); a machine that has none builds a revision without it.
37
+ const client = ServerConfig.clientOf(root);
38
+ // A revision is its bundle and its client: one held with another client (or none, or one where there was none) is not this build, and is never overwritten.
39
+ if (held !== undefined) {
40
+ const wanted = client === undefined ? null : yield* io(() => treeDigest(client));
41
+ if (held.portal !== wanted) {
42
+ return yield* new BuildFailed({ message: `the artefact of ${rev} was built ${held.portal === null ? "without the portal's client" : "with another portal client"} and the client here is ${wanted === null ? "not built" : "another one"}: move .ortho/artefacts/${rev} aside, then run ortho build and ortho prove --env test` });
43
+ }
44
+ yield* unchanged(root, held.commit);
45
+ return { ...held, dirty: false };
46
+ }
47
+ const dir = artefacts(root, rev);
48
+ yield* io(() => mkdirSync(dirname(dir), { recursive: true }));
49
+ return yield* Effect.acquireUseRelease(io(() => mkdtempSync(`${dir}-building-`)), (scratch) => Effect.gen(function* () {
50
+ const main = join(scratch, "main.js");
51
+ // The dry run reads a config derived from the generated one (absolute paths, and the client as static assets); it lives beside the scratch folder, not in it.
52
+ const config = `${scratch}.wrangler.jsonc`;
53
+ yield* io(() => writeFileSync(config, ServerConfig.derive(root, readFileSync(generated, "utf8"), client)));
54
+ const run = yield* io(() => spawnSync(process.execPath, [wrangler, "deploy", "--dry-run", "--outdir", scratch, "--config", config], {
55
+ cwd: resolve(root), encoding: "utf8", env: { ...toolingEnv(env), CI: "1", WRANGLER_SEND_METRICS: "false" }, maxBuffer: 64 * 1024 * 1024,
56
+ }));
57
+ if (run.status !== 0 || !existsSync(main))
58
+ return yield* new BuildFailed({ message: `wrangler couldn't build the bundle:\n${run.stderr || run.stdout || run.error?.message || `exit ${run.status}`}` });
59
+ if ((yield* dirty(root)) || (yield* git(root, "rev-parse", "HEAD")) !== commit)
60
+ return yield* new BuildFailed({ message: "the source changed while bundling: commit it and build again" });
61
+ if (client !== undefined)
62
+ yield* io(() => cpSync(client, join(scratch, "portal"), { recursive: true }));
63
+ const sha256 = yield* io(() => digest(main));
64
+ const portal = client === undefined ? null : { sha256: yield* io(() => treeDigest(join(scratch, "portal"))) };
65
+ yield* io(() => writeFileSync(join(scratch, "bundle.json"), JSON.stringify({ schemaVersion: 1, source: "clean", revision: rev, commit, sha256, portal }) + "\n"));
66
+ // Publish only a complete clean build. A concurrent winner is reused; its files are never overwritten.
67
+ const winner = yield* find(root, rev);
68
+ if (winner !== undefined)
69
+ return { ...winner, dirty: false };
70
+ yield* io(() => renameSync(scratch, dir));
71
+ return { revision: rev, commit, sha256, main: join(dir, "main.js"), portal: portal?.sha256 ?? null, dirty: false };
72
+ }), (scratch) => io(() => { rmSync(scratch, { recursive: true, force: true }); rmSync(`${scratch}.wrangler.jsonc`, { force: true }); }).pipe(Effect.ignore));
73
+ });
74
+ export const Build = { revision, build, dirty, find, unchanged };
@@ -0,0 +1,39 @@
1
+ import { type Effect } from "effect";
2
+ declare const BuildFailed_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
3
+ readonly _tag: "BuildFailed";
4
+ } & Readonly<A>;
5
+ export declare class BuildFailed extends BuildFailed_base<{
6
+ readonly message: string;
7
+ }> {
8
+ }
9
+ /** One revision's artefact, kept at `.ortho/artefacts/<revision>/main.js`. */
10
+ export interface Built {
11
+ /** The git commit, `git rev-parse --short HEAD`. */
12
+ readonly revision: string;
13
+ /** Full source commit, captured by the immutable manifest. */
14
+ readonly commit: string;
15
+ /** Bare hex, as `/_ortho/bundle` reports it. */
16
+ readonly sha256: string;
17
+ /** Absolute path of the bundle. */
18
+ readonly main: string;
19
+ /** The digest of the portal's prebuilt client this revision ships beside the bundle (`portal/`), or null when it shipped none (K19). */
20
+ readonly portal: string | null;
21
+ }
22
+ export interface BuildApi {
23
+ /** The project's revision: the git commit. A project outside git has none, and can't build. */
24
+ readonly revision: (root: string) => Effect.Effect<string, BuildFailed>;
25
+ /**
26
+ * Build a clean revision once with no credentials. A dirty tree is refused before touching any artefact.
27
+ * Existing trusted artefacts are immutable and reused. The environment is supplied by the caller, never read here.
28
+ */
29
+ readonly build: (root: string, env?: Readonly<Record<string, string | undefined>>) => Effect.Effect<Built & {
30
+ readonly dirty: boolean;
31
+ }, BuildFailed>;
32
+ /** Whether the working tree differs from the commit (`git status --porcelain`, so ignored files don't count): the revision's source is then not what is on disk. */
33
+ /** Require the same clean full commit before consuming a proof or publishing its captured source. */
34
+ readonly unchanged: (root: string, commit: string) => Effect.Effect<void, BuildFailed>;
35
+ readonly dirty: (root: string) => Effect.Effect<boolean, BuildFailed>;
36
+ /** A revision's kept artefact, checked against the hash recorded when it was built; none if it was never built. */
37
+ readonly find: (root: string, revision: string) => Effect.Effect<Built | undefined, BuildFailed>;
38
+ }
39
+ export {};
@@ -0,0 +1,4 @@
1
+ // A build: the revision's Worker, bundled once. Every environment runs this file unchanged (D3 #6).
2
+ import { Data } from "effect";
3
+ export class BuildFailed extends Data.TaggedError("BuildFailed") {
4
+ }
@@ -0,0 +1,2 @@
1
+ /** Where the collector writes, under the environment's folder. */
2
+ export declare const telemetryDir: (dir: string) => string;
@@ -0,0 +1,5 @@
1
+ // An environment that hosts worlds has a collector of its own: a process that lives and dies with the environment,
2
+ // so what a world's journeys did is on disk beside the environment, and a prove that is killed leaves nothing behind.
3
+ import { join } from "node:path";
4
+ /** Where the collector writes, under the environment's folder. */
5
+ export const telemetryDir = (dir) => join(dir, "telemetry");
@@ -0,0 +1,32 @@
1
+ export interface Describe {
2
+ readonly name: string;
3
+ readonly revision: string;
4
+ readonly sha256: string;
5
+ /** The bundle `Build.build` kept. */
6
+ readonly main: string;
7
+ /** The portal's client the revision ships (`<artefact>/portal`): the Worker's static assets (K19). */
8
+ readonly portal?: string;
9
+ /** An environment that records telemetry sends it to a collector of its own (`OTLP_URL`). */
10
+ readonly otlp?: string;
11
+ /** An environment that hosts worlds with lifetimes says so (`ORTHO_WORLDS`). */
12
+ readonly worlds?: boolean;
13
+ /** Where the logbook is, which the portal route reads (`ORTHO_LOGBOOK_URL`). */
14
+ readonly logbook?: string;
15
+ }
16
+ /**
17
+ * The portal's client a revision ships, as the verified record says: its `portal/` folder when `bundle.json` records a client and its digest
18
+ * matched (`Build.find` checked it), and nothing otherwise. A folder the record does not name is not the revision's, however it got there.
19
+ */
20
+ export declare const portalOf: (built: {
21
+ readonly main: string;
22
+ readonly portal: string | null;
23
+ }) => string | undefined;
24
+ /** The logbook an environment's config names, if it names one. */
25
+ export declare const logbookOf: (configText: string) => string | undefined;
26
+ /**
27
+ * `generated/server/wrangler.jsonc` with its source swapped for the built file and `no_bundle`, its database and worker
28
+ * named for the environment, and the bundle's revision and hash as vars, which is where `/_ortho/bundle` gets them. The portal's
29
+ * client, when the revision shipped one, is the Worker's static assets (K19).
30
+ * Secrets are not here: they go in the env file.
31
+ */
32
+ export declare const environmentConfig: (root: string, baseText: string, d: Describe) => string;
@@ -0,0 +1,42 @@
1
+ // The environment's own wrangler config: the generated server's, running the built bundle unchanged.
2
+ import { Names } from "orthograph/server";
3
+ import { dirname, join, resolve } from "node:path";
4
+ import { ServerConfig } from "#modules/server-config/service.js";
5
+ /**
6
+ * The portal's client a revision ships, as the verified record says: its `portal/` folder when `bundle.json` records a client and its digest
7
+ * matched (`Build.find` checked it), and nothing otherwise. A folder the record does not name is not the revision's, however it got there.
8
+ */
9
+ export const portalOf = (built) => built.portal === null ? undefined : join(dirname(built.main), "portal");
10
+ /** The logbook an environment's config names, if it names one. */
11
+ export const logbookOf = (configText) => (ServerConfig.parse(configText).vars ?? {})["ORTHO_LOGBOOK_URL"];
12
+ /**
13
+ * `generated/server/wrangler.jsonc` with its source swapped for the built file and `no_bundle`, its database and worker
14
+ * named for the environment, and the bundle's revision and hash as vars, which is where `/_ortho/bundle` gets them. The portal's
15
+ * client, when the revision shipped one, is the Worker's static assets (K19).
16
+ * Secrets are not here: they go in the env file.
17
+ */
18
+ export const environmentConfig = (root, baseText, d) => {
19
+ const base = ServerConfig.parse(baseText);
20
+ const config = {
21
+ ...base,
22
+ name: `${base.name}-${d.name}`,
23
+ main: d.main,
24
+ no_bundle: true,
25
+ d1_databases: (base.d1_databases ?? []).map((db) => ({
26
+ ...db,
27
+ database_name: `${String(db["database_name"])}-${d.name}`,
28
+ migrations_dir: resolve(root, "generated/server", String(db["migrations_dir"] ?? "migrations")),
29
+ })),
30
+ ...(d.portal === undefined ? {} : { assets: ServerConfig.assets(d.portal) }),
31
+ vars: {
32
+ ...base.vars,
33
+ [Names.variable("ENVIRONMENT")]: d.name,
34
+ [Names.variable("REVISION")]: d.revision,
35
+ [Names.variable("BUNDLE_SHA256")]: d.sha256,
36
+ ...(d.worlds ? { [Names.variable("WORLDS")]: "1" } : {}),
37
+ ...(d.otlp ? { OTLP_URL: d.otlp } : {}),
38
+ ...(d.logbook ? { [Names.variable("LOGBOOK_URL")]: d.logbook } : {}),
39
+ },
40
+ };
41
+ return `// Generated by ortho env up from generated/server/wrangler.jsonc. Do not edit.\n${JSON.stringify(config, null, 2)}\n`;
42
+ };
@@ -0,0 +1,3 @@
1
+ import { type EnvironmentsApi } from "../types.ts";
2
+ /** PID is the existing lifecycle identity: an ordinary CLI restart or rollback cannot reuse the old proof boundary. */
3
+ export declare const verify: EnvironmentsApi["verify"];
@@ -0,0 +1,17 @@
1
+ import { Effect, Schema } from "effect";
2
+ import { EnvironmentFailed } from "../types.js";
3
+ import { status } from "./status.js";
4
+ const Bundle = Schema.Struct({ revision: Schema.String, sha256: Schema.String });
5
+ /** PID is the existing lifecycle identity: an ordinary CLI restart or rollback cannot reuse the old proof boundary. */
6
+ export const verify = ({ root, name, pid, revision, sha256 }) => Effect.gen(function* () {
7
+ const before = yield* status(root, name);
8
+ if (before.state !== "up" || before.pid !== pid)
9
+ return yield* new EnvironmentFailed({ message: `${name} restarted or stopped while proving its bundle` });
10
+ const raw = yield* Effect.tryPromise({ try: () => fetch(`${before.url}/_ortho/bundle`, { headers: { connection: "close" } }).then((r) => r.json()), catch: () => new EnvironmentFailed({ message: `${name} did not report its bundle` }) });
11
+ const reported = yield* Schema.decodeUnknownEffect(Bundle)(raw).pipe(Effect.mapError(() => new EnvironmentFailed({ message: `${name} did not report a revision and bundle hash` })));
12
+ const after = yield* status(root, name);
13
+ if (after.state !== "up" || after.pid !== pid)
14
+ return yield* new EnvironmentFailed({ message: `${name} restarted or stopped while proving its bundle` });
15
+ if (reported.revision !== revision || reported.sha256 !== sha256)
16
+ return yield* new EnvironmentFailed({ message: `${name} runs ${reported.revision} sha256:${reported.sha256}, not the proved bundle ${revision} sha256:${sha256}` });
17
+ });
@@ -0,0 +1,10 @@
1
+ import { Effect } from "effect";
2
+ import { type LogbookSetup } from "../types.ts";
3
+ /** Start the logbook in `dir`, return once it answers `/health`; stopped again if it never does. */
4
+ export declare const startLogbook: (dir: string, wanted: number | undefined, policy: LogbookSetup) => Effect.Effect<{
5
+ state: "up";
6
+ name: string;
7
+ url: string;
8
+ port: number;
9
+ pid: number;
10
+ }, import("../types.ts").EnvironmentFailed, never>;
@@ -0,0 +1,23 @@
1
+ // The logbook as an environment: its own worker (`@orthograph/logbook`), run by `wrangler dev` with the token policy
2
+ // the caller names, its state, pid and port beside the other environments' (D3 #33, #56).
3
+ import { mkdirSync } from "node:fs";
4
+ import { Effect, Schedule } from "effect";
5
+ import { Logbook } from "@orthograph/logbook";
6
+ import {} from "../types.js";
7
+ import { failed, io } from "./status.js";
8
+ import { choosePort, files, reap, spawnDetached, writePort } from "./process.js";
9
+ const answers = (url) => Effect.tryPromise({ try: () => fetch(`${url}/health`).then((r) => r.ok), catch: () => false }).pipe(Effect.flatMap((ok) => (ok ? Effect.void : Effect.fail(false))));
10
+ /** Start the logbook in `dir`, return once it answers `/health`; stopped again if it never does. */
11
+ export const startLogbook = (dir, wanted, policy) => Effect.gen(function* () {
12
+ const f = files(dir);
13
+ yield* io(dir, () => mkdirSync(f.state, { recursive: true }));
14
+ yield* reap(dir);
15
+ const port = yield* choosePort(dir, wanted).pipe(Effect.mapError(failed));
16
+ const jwksUrl = yield* Logbook.discoverJwks(policy.issuer).pipe(Effect.mapError((e) => failed(`the logbook can't trust ${policy.issuer}: ${e.message}`)));
17
+ const run = Logbook.launch({ port, state: f.state, policy: { issuer: policy.issuer, jwksUrl, repository: policy.repository, refs: policy.refs, workflows: policy.workflows } });
18
+ yield* io(dir, () => writePort(dir, port));
19
+ const child = yield* spawnDetached(run, f.log, f.pid);
20
+ const url = `http://127.0.0.1:${port}`;
21
+ yield* Effect.suspend(() => child.exitCode !== null ? Effect.fail("exited") : answers(url).pipe(Effect.mapError(() => "silent"))).pipe(Effect.retry({ schedule: Schedule.spaced("250 millis"), times: 480, while: (e) => e !== "exited" }), Effect.tapError(() => reap(dir)), Effect.mapError((e) => failed(e === "exited" ? `the logbook exited (${child.exitCode}); see ${f.log}` : `the logbook didn't answer within 120 s; see ${f.log}`)));
22
+ return { state: "up", name: "logbook", url, port, pid: child.pid };
23
+ });