@ontrails/core 1.0.0-beta.2 → 1.0.0-beta.21

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/CHANGELOG.md +283 -5
  2. package/README.md +113 -33
  3. package/package.json +11 -1
  4. package/src/activation-provenance.ts +111 -0
  5. package/src/activation-source-compatibility.ts +430 -0
  6. package/src/activation-source-projection.ts +221 -0
  7. package/src/activation-source.ts +91 -0
  8. package/src/blob-ref.ts +51 -0
  9. package/src/branded.ts +1 -1
  10. package/src/compose-batch.ts +69 -0
  11. package/src/compose-schema.ts +36 -0
  12. package/src/context.ts +44 -10
  13. package/src/contour.ts +346 -0
  14. package/src/derive.ts +59 -18
  15. package/src/detours.ts +8 -0
  16. package/src/draft.ts +342 -0
  17. package/src/error-projection.ts +51 -0
  18. package/src/errors.ts +309 -48
  19. package/src/execute.ts +1577 -0
  20. package/src/fire.ts +1169 -0
  21. package/src/index.ts +477 -32
  22. package/src/internal/fork-ctx.ts +69 -0
  23. package/src/layer-projection.ts +193 -0
  24. package/src/layer.ts +43 -6
  25. package/src/observe.ts +361 -0
  26. package/src/path-security.ts +1 -1
  27. package/src/permits.ts +12 -0
  28. package/src/redaction/patterns.ts +6 -3
  29. package/src/resilience.ts +11 -11
  30. package/src/resource-config.ts +792 -0
  31. package/src/resource.ts +194 -0
  32. package/src/result.ts +36 -4
  33. package/src/run.ts +76 -0
  34. package/src/schedule-runtime.ts +689 -0
  35. package/src/schedule.ts +326 -0
  36. package/src/serialization.ts +119 -39
  37. package/src/signal-diagnostics.ts +633 -0
  38. package/src/signal-ref.ts +87 -0
  39. package/src/signal.ts +104 -0
  40. package/src/store/accessor-protocol.ts +56 -0
  41. package/src/store/index.ts +4 -0
  42. package/src/structured-examples.ts +248 -0
  43. package/src/surface-derivation.ts +91 -0
  44. package/src/surface-filter.ts +176 -0
  45. package/src/surface-versioning.ts +42 -0
  46. package/src/topo.ts +769 -57
  47. package/src/tracing.ts +345 -0
  48. package/src/trail.ts +1161 -29
  49. package/src/trails/derive-trail.ts +842 -0
  50. package/src/trails/index.ts +9 -0
  51. package/src/trails/ingest.ts +139 -0
  52. package/src/trails-db.ts +208 -0
  53. package/src/transport-error-map.ts +174 -0
  54. package/src/type-utils.ts +87 -0
  55. package/src/types.ts +254 -12
  56. package/src/validate-established-topo.ts +69 -0
  57. package/src/validate-topo.ts +442 -35
  58. package/src/validation.ts +152 -4
  59. package/src/version-marker.ts +716 -0
  60. package/src/version-resolution.ts +308 -0
  61. package/src/version-runtime.ts +120 -0
  62. package/src/webhook.ts +278 -0
  63. package/src/workspace.ts +1 -1
  64. package/src/zod-wrappers.ts +72 -0
  65. package/.turbo/turbo-build.log +0 -1
  66. package/.turbo/turbo-lint.log +0 -3
  67. package/.turbo/turbo-typecheck.log +0 -1
  68. package/dist/adapters.d.ts +0 -39
  69. package/dist/adapters.d.ts.map +0 -1
  70. package/dist/adapters.js +0 -2
  71. package/dist/adapters.js.map +0 -1
  72. package/dist/blob-ref.d.ts +0 -20
  73. package/dist/blob-ref.d.ts.map +0 -1
  74. package/dist/blob-ref.js +0 -22
  75. package/dist/blob-ref.js.map +0 -1
  76. package/dist/branded.d.ts +0 -36
  77. package/dist/branded.d.ts.map +0 -1
  78. package/dist/branded.js +0 -89
  79. package/dist/branded.js.map +0 -1
  80. package/dist/collections.d.ts +0 -31
  81. package/dist/collections.d.ts.map +0 -1
  82. package/dist/collections.js +0 -60
  83. package/dist/collections.js.map +0 -1
  84. package/dist/context.d.ts +0 -10
  85. package/dist/context.d.ts.map +0 -1
  86. package/dist/context.js +0 -15
  87. package/dist/context.js.map +0 -1
  88. package/dist/derive.d.ts +0 -33
  89. package/dist/derive.d.ts.map +0 -1
  90. package/dist/derive.js +0 -122
  91. package/dist/derive.js.map +0 -1
  92. package/dist/errors.d.ts +0 -83
  93. package/dist/errors.d.ts.map +0 -1
  94. package/dist/errors.js +0 -142
  95. package/dist/errors.js.map +0 -1
  96. package/dist/event.d.ts +0 -45
  97. package/dist/event.d.ts.map +0 -1
  98. package/dist/event.js +0 -17
  99. package/dist/event.js.map +0 -1
  100. package/dist/fetch.d.ts +0 -15
  101. package/dist/fetch.d.ts.map +0 -1
  102. package/dist/fetch.js +0 -102
  103. package/dist/fetch.js.map +0 -1
  104. package/dist/guards.d.ts +0 -17
  105. package/dist/guards.d.ts.map +0 -1
  106. package/dist/guards.js +0 -25
  107. package/dist/guards.js.map +0 -1
  108. package/dist/health.d.ts +0 -18
  109. package/dist/health.d.ts.map +0 -1
  110. package/dist/health.js +0 -5
  111. package/dist/health.js.map +0 -1
  112. package/dist/hike.d.ts +0 -36
  113. package/dist/hike.d.ts.map +0 -1
  114. package/dist/hike.js +0 -20
  115. package/dist/hike.js.map +0 -1
  116. package/dist/index.d.ts +0 -34
  117. package/dist/index.d.ts.map +0 -1
  118. package/dist/index.js +0 -38
  119. package/dist/index.js.map +0 -1
  120. package/dist/job.d.ts +0 -24
  121. package/dist/job.d.ts.map +0 -1
  122. package/dist/job.js +0 -17
  123. package/dist/job.js.map +0 -1
  124. package/dist/layer.d.ts +0 -17
  125. package/dist/layer.d.ts.map +0 -1
  126. package/dist/layer.js +0 -21
  127. package/dist/layer.js.map +0 -1
  128. package/dist/path-security.d.ts +0 -28
  129. package/dist/path-security.d.ts.map +0 -1
  130. package/dist/path-security.js +0 -63
  131. package/dist/path-security.js.map +0 -1
  132. package/dist/patterns/bulk.d.ts +0 -15
  133. package/dist/patterns/bulk.d.ts.map +0 -1
  134. package/dist/patterns/bulk.js +0 -14
  135. package/dist/patterns/bulk.js.map +0 -1
  136. package/dist/patterns/change.d.ts +0 -10
  137. package/dist/patterns/change.d.ts.map +0 -1
  138. package/dist/patterns/change.js +0 -10
  139. package/dist/patterns/change.js.map +0 -1
  140. package/dist/patterns/date-range.d.ts +0 -10
  141. package/dist/patterns/date-range.d.ts.map +0 -1
  142. package/dist/patterns/date-range.js +0 -10
  143. package/dist/patterns/date-range.js.map +0 -1
  144. package/dist/patterns/index.d.ts +0 -9
  145. package/dist/patterns/index.d.ts.map +0 -1
  146. package/dist/patterns/index.js +0 -9
  147. package/dist/patterns/index.js.map +0 -1
  148. package/dist/patterns/pagination.d.ts +0 -18
  149. package/dist/patterns/pagination.d.ts.map +0 -1
  150. package/dist/patterns/pagination.js +0 -18
  151. package/dist/patterns/pagination.js.map +0 -1
  152. package/dist/patterns/progress.d.ts +0 -11
  153. package/dist/patterns/progress.d.ts.map +0 -1
  154. package/dist/patterns/progress.js +0 -11
  155. package/dist/patterns/progress.js.map +0 -1
  156. package/dist/patterns/sorting.d.ts +0 -13
  157. package/dist/patterns/sorting.d.ts.map +0 -1
  158. package/dist/patterns/sorting.js +0 -10
  159. package/dist/patterns/sorting.js.map +0 -1
  160. package/dist/patterns/status.d.ts +0 -15
  161. package/dist/patterns/status.d.ts.map +0 -1
  162. package/dist/patterns/status.js +0 -9
  163. package/dist/patterns/status.js.map +0 -1
  164. package/dist/patterns/timestamps.d.ts +0 -10
  165. package/dist/patterns/timestamps.d.ts.map +0 -1
  166. package/dist/patterns/timestamps.js +0 -10
  167. package/dist/patterns/timestamps.js.map +0 -1
  168. package/dist/redaction/index.d.ts +0 -4
  169. package/dist/redaction/index.d.ts.map +0 -1
  170. package/dist/redaction/index.js +0 -3
  171. package/dist/redaction/index.js.map +0 -1
  172. package/dist/redaction/patterns.d.ts +0 -9
  173. package/dist/redaction/patterns.d.ts.map +0 -1
  174. package/dist/redaction/patterns.js +0 -39
  175. package/dist/redaction/patterns.js.map +0 -1
  176. package/dist/redaction/redactor.d.ts +0 -27
  177. package/dist/redaction/redactor.d.ts.map +0 -1
  178. package/dist/redaction/redactor.js +0 -89
  179. package/dist/redaction/redactor.js.map +0 -1
  180. package/dist/resilience.d.ts +0 -34
  181. package/dist/resilience.d.ts.map +0 -1
  182. package/dist/resilience.js +0 -164
  183. package/dist/resilience.js.map +0 -1
  184. package/dist/result.d.ts +0 -57
  185. package/dist/result.d.ts.map +0 -1
  186. package/dist/result.js +0 -145
  187. package/dist/result.js.map +0 -1
  188. package/dist/serialization.d.ts +0 -27
  189. package/dist/serialization.d.ts.map +0 -1
  190. package/dist/serialization.js +0 -115
  191. package/dist/serialization.js.map +0 -1
  192. package/dist/topo.d.ts +0 -18
  193. package/dist/topo.d.ts.map +0 -1
  194. package/dist/topo.js +0 -74
  195. package/dist/topo.js.map +0 -1
  196. package/dist/trail.d.ts +0 -83
  197. package/dist/trail.d.ts.map +0 -1
  198. package/dist/trail.js +0 -16
  199. package/dist/trail.js.map +0 -1
  200. package/dist/types.d.ts +0 -46
  201. package/dist/types.d.ts.map +0 -1
  202. package/dist/types.js +0 -2
  203. package/dist/types.js.map +0 -1
  204. package/dist/validate-topo.d.ts +0 -24
  205. package/dist/validate-topo.d.ts.map +0 -1
  206. package/dist/validate-topo.js +0 -108
  207. package/dist/validate-topo.js.map +0 -1
  208. package/dist/validation.d.ts +0 -27
  209. package/dist/validation.d.ts.map +0 -1
  210. package/dist/validation.js +0 -134
  211. package/dist/validation.js.map +0 -1
  212. package/dist/workspace.d.ts +0 -25
  213. package/dist/workspace.d.ts.map +0 -1
  214. package/dist/workspace.js +0 -57
  215. package/dist/workspace.js.map +0 -1
  216. package/src/__tests__/blob-ref.test.ts +0 -103
  217. package/src/__tests__/branded.test.ts +0 -148
  218. package/src/__tests__/collections.test.ts +0 -126
  219. package/src/__tests__/context.test.ts +0 -66
  220. package/src/__tests__/derive.test.ts +0 -159
  221. package/src/__tests__/errors.test.ts +0 -309
  222. package/src/__tests__/event.test.ts +0 -82
  223. package/src/__tests__/fetch.test.ts +0 -217
  224. package/src/__tests__/guards.test.ts +0 -102
  225. package/src/__tests__/hike.test.ts +0 -117
  226. package/src/__tests__/job.test.ts +0 -98
  227. package/src/__tests__/layer.test.ts +0 -224
  228. package/src/__tests__/path-security.test.ts +0 -114
  229. package/src/__tests__/patterns.test.ts +0 -273
  230. package/src/__tests__/redaction.test.ts +0 -244
  231. package/src/__tests__/resilience.test.ts +0 -246
  232. package/src/__tests__/result.test.ts +0 -155
  233. package/src/__tests__/serialization.test.ts +0 -236
  234. package/src/__tests__/topo.test.ts +0 -184
  235. package/src/__tests__/trail.test.ts +0 -179
  236. package/src/__tests__/validate-topo.test.ts +0 -201
  237. package/src/__tests__/validation.test.ts +0 -283
  238. package/src/__tests__/workspace.test.ts +0 -183
  239. package/src/adapters.ts +0 -68
  240. package/src/event.ts +0 -77
  241. package/src/health.ts +0 -23
  242. package/src/hike.ts +0 -77
  243. package/src/job.ts +0 -20
  244. package/tsconfig.json +0 -9
  245. package/tsconfig.tsbuildinfo +0 -1
package/src/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  // Result
2
- export { Result } from './result.js';
2
+ export { Result, resultAccessorNames } from './result.js';
3
+ export type { ResultAccessorName } from './result.js';
3
4
 
4
5
  // Errors
5
6
  export {
@@ -8,79 +9,507 @@ export {
8
9
  AmbiguousError,
9
10
  AssertionError,
10
11
  NotFoundError,
12
+ VersionNotSupportedError,
11
13
  AlreadyExistsError,
12
14
  ConflictError,
13
15
  PermissionError,
16
+ PermitError,
14
17
  TimeoutError,
15
18
  RateLimitError,
16
19
  NetworkError,
17
20
  InternalError,
18
21
  AuthError,
19
22
  CancelledError,
23
+ DerivationError,
24
+ RecoverableCompletionError,
25
+ codesByCategory,
26
+ errorClasses,
27
+ errorCategories,
20
28
  exitCodeMap,
21
29
  statusCodeMap,
22
30
  jsonRpcCodeMap,
23
31
  retryableMap,
32
+ RetryExhaustedError,
24
33
  isRetryable,
25
34
  isTrailsError,
26
35
  } from './errors.js';
27
- export type { ErrorCategory } from './errors.js';
36
+ export type {
37
+ DynamicErrorClassRegistryEntry,
38
+ ErrorCategory,
39
+ ErrorCategoryCodes,
40
+ ErrorClassConstructor,
41
+ ErrorClassRegistryEntry,
42
+ FixedErrorClassRegistryEntry,
43
+ } from './errors.js';
44
+ export {
45
+ createSurfaceErrorMapper,
46
+ mapSurfaceError,
47
+ projectErrorClassSurface,
48
+ projectPublicSurfaceError,
49
+ projectSurfaceError,
50
+ surfaceErrorMap,
51
+ surfaceErrorRegistry,
52
+ surfaceNames,
53
+ } from './transport-error-map.js';
54
+ export type {
55
+ ErrorClassSurfaceProjection,
56
+ SurfaceErrorCode,
57
+ SurfaceErrorMapper,
58
+ SurfaceErrorMappings,
59
+ SurfaceErrorProjection,
60
+ SurfaceName,
61
+ } from './transport-error-map.js';
62
+ export {
63
+ INTERNAL_ERROR_PUBLIC_MESSAGE,
64
+ projectErrorDiagnostics,
65
+ redactErrorContext,
66
+ redactErrorStack,
67
+ redactErrorString,
68
+ } from './error-projection.js';
69
+ export type { ErrorDiagnosticsProjection } from './error-projection.js';
28
70
 
29
71
  // Types
30
72
  export type {
73
+ Detour,
74
+ DetourAttempt,
31
75
  Implementation,
32
76
  TrailContext,
33
- FollowFn,
77
+ TrailContextInit,
78
+ ComposeBatchOptions,
79
+ ComposeOptions,
80
+ ComposeFn,
81
+ FireFn,
82
+ LogLevel,
83
+ LogFormatter,
84
+ LogRecord,
85
+ LogSink,
86
+ PermitRequirement,
34
87
  ProgressCallback,
35
88
  ProgressEvent,
36
89
  Logger,
37
- Surface,
90
+ ResourceLookup,
91
+ } from './types.js';
92
+ export { basePermitSchema } from './permits.js';
93
+ export type { BasePermit } from './permits.js';
94
+ export {
95
+ LAYER_INPUTS_KEY,
96
+ SURFACE_KEY,
97
+ SURFACE_LAYER_NAMES_KEY,
38
98
  } from './types.js';
99
+ export {
100
+ ACTIVATION_PROVENANCE_KEY,
101
+ buildActivationProvenanceTraceAttrs,
102
+ getActivationProvenance,
103
+ withActivationProvenance,
104
+ } from './activation-provenance.js';
105
+ export type {
106
+ ActivationProvenance,
107
+ ActivationProvenanceCarrier,
108
+ ActivationProvenanceSource,
109
+ } from './activation-provenance.js';
39
110
 
40
111
  // Context factory
41
- export { createTrailContext } from './context.js';
112
+ export { createTrailContext, passthroughTrace } from './context.js';
113
+
114
+ // Resource
115
+ export {
116
+ createResourceLookup,
117
+ findDuplicateResourceId,
118
+ isResource,
119
+ resource,
120
+ } from './resource.js';
121
+ export { drainResources, resolveResourceConfig } from './resource-config.js';
122
+ export type {
123
+ ResourceConfigValues,
124
+ ResourceDrainReport,
125
+ } from './resource-config.js';
126
+ export type {
127
+ AnyResource,
128
+ Resource,
129
+ ResourceContext,
130
+ ResourceOverrideMap,
131
+ ResourceSpec,
132
+ ResourceUnmockable,
133
+ } from './resource.js';
42
134
 
43
135
  // Trail
44
- export { trail } from './trail.js';
45
- export type { AnyTrail, Trail, TrailSpec, TrailExample } from './trail.js';
136
+ export {
137
+ activationSourceKinds,
138
+ getActivationWherePredicate,
139
+ isActivationEntrySpec,
140
+ isActivationSource,
141
+ isKnownActivationSourceKind,
142
+ } from './activation-source.js';
143
+ export type {
144
+ ActivationEntry,
145
+ ActivationEntrySpec,
146
+ ActivationSource,
147
+ ActivationSourceKind,
148
+ ActivationSourceMeta,
149
+ ActivationSourceRef,
150
+ ActivationWhere,
151
+ ActivationWhereExample,
152
+ ActivationWherePredicate,
153
+ ActivationWhereSpec,
154
+ BuiltinActivationSourceKind,
155
+ } from './activation-source.js';
156
+ export {
157
+ activationSourceDeclarationSignature,
158
+ activationSourceKey,
159
+ projectActivationSourceDeclaration,
160
+ } from './activation-source-projection.js';
161
+ export type { ActivationSourceProjection } from './activation-source-projection.js';
162
+ export {
163
+ deriveSupportedTrailVersions,
164
+ getTrailVersionEntryKind,
165
+ hasDeprecatedTrailVersionGuidance,
166
+ intentValues,
167
+ isArchivedTrailVersionEntry,
168
+ isDeprecatedTrailVersionEntry,
169
+ isLiveTrailVersionEntry,
170
+ trail,
171
+ } from './trail.js';
172
+ export {
173
+ TRAIL_VERSION_MARKER_LENGTH,
174
+ TRAIL_VERSION_MARKER_MIN_PREFIX_LENGTH,
175
+ assertTrailVersionMarker,
176
+ assertUniqueTrailVersionMarkers,
177
+ canonicalizeTrailVersionMarkerContent,
178
+ deriveCurrentTrailVersionMarker,
179
+ deriveCurrentTrailVersionMarkerContent,
180
+ deriveShortestUnambiguousTrailVersionMarkerPrefix,
181
+ deriveTrailVersionEntryMarker,
182
+ deriveTrailVersionEntryMarkerContent,
183
+ deriveTrailVersionMarker,
184
+ deriveTrailVersionMarkers,
185
+ normalizeTrailVersionMarkerPrefix,
186
+ resolveTrailVersionMarkerPrefix,
187
+ } from './version-marker.js';
188
+ export {
189
+ parseTrailIdVersionReference,
190
+ resolveTrailVersion,
191
+ } from './version-resolution.js';
192
+ export type {
193
+ AnyTrail,
194
+ BlazeInput,
195
+ Intent,
196
+ Trail,
197
+ TrailVersionEntry,
198
+ TrailVersionEntryKind,
199
+ TrailVersionArchivedStatus,
200
+ TrailVersionDeprecatedStatus,
201
+ TrailVersionForkEntry,
202
+ TrailVersionRevisionEntry,
203
+ TrailVersions,
204
+ TrailVersionStatus,
205
+ TrailVersionTranspose,
206
+ TrailVersionTransposeInput,
207
+ TrailVersionTransposeOutput,
208
+ TrailSpec,
209
+ TrailExample,
210
+ TrailExampleSignalAssertion,
211
+ TrailVisibility,
212
+ VersionContract,
213
+ VersionEntry,
214
+ } from './trail.js';
215
+ export type {
216
+ TrailVersionMarkerBinding,
217
+ TrailVersionMarkerRecord,
218
+ TrailVersionMarkerResolution,
219
+ } from './version-marker.js';
220
+ export type {
221
+ ParsedTrailVersionReference,
222
+ ResolvedTrailVersion,
223
+ TrailVersionReference,
224
+ } from './version-resolution.js';
225
+ export {
226
+ filterSurfaceTrails,
227
+ matchesTrailPattern,
228
+ shouldIncludeTrailForSurface,
229
+ } from './surface-filter.js';
230
+ export type { SurfaceFilterOptions } from './surface-filter.js';
231
+ export { deriveSurfaceTrailVersionProjections } from './surface-versioning.js';
232
+ export type { SurfaceTrailVersionProjection } from './surface-versioning.js';
233
+ export {
234
+ shouldValidateSurfaceTopo,
235
+ validateSurfaceTopo,
236
+ withSurfaceLayerNames,
237
+ withSurfaceMarker,
238
+ } from './surface-derivation.js';
239
+ export type {
240
+ BaseSurfaceOptions,
241
+ SurfaceConfigValues,
242
+ SurfaceSelectionOptions,
243
+ SurfaceMarkedContext,
244
+ SurfaceValidationOptions,
245
+ } from './surface-derivation.js';
246
+ export {
247
+ deriveStructuredSignalExamples,
248
+ deriveStructuredTrailExamples,
249
+ } from './structured-examples.js';
250
+ export type {
251
+ StructuredSignalExample,
252
+ StructuredSignalExampleProvenance,
253
+ StructuredTrailExample,
254
+ StructuredTrailExampleKind,
255
+ StructuredTrailExampleProvenance,
256
+ StructuredTrailExampleSignalAssertion,
257
+ } from './structured-examples.js';
46
258
 
47
- // Hike
48
- export { hike } from './hike.js';
49
- export type { AnyHike, Hike, HikeSpec } from './hike.js';
259
+ // Type utilities
260
+ export type {
261
+ ComposeInput,
262
+ TrailInput,
263
+ TrailOutput,
264
+ TrailResult,
265
+ } from './type-utils.js';
266
+ export { inputOf, outputOf } from './type-utils.js';
50
267
 
51
- // Event
52
- export { event } from './event.js';
53
- export type { AnyEvent, Event, EventSpec } from './event.js';
268
+ // Signal
269
+ export { signal } from './signal.js';
270
+ export type { AnySignal, Signal, SignalSpec } from './signal.js';
271
+ export { schedule, validateScheduleSource } from './schedule.js';
272
+ export type {
273
+ ScheduleSource,
274
+ ScheduleSpec,
275
+ ScheduleValidationIssue,
276
+ } from './schedule.js';
277
+ export {
278
+ getWebhookHeader,
279
+ getWebhookHeaders,
280
+ validateWebhookSource,
281
+ verifyWebhookRequest,
282
+ webhook,
283
+ webhookMethods,
284
+ } from './webhook.js';
285
+ export type {
286
+ WebhookMethod,
287
+ WebhookMethodInput,
288
+ WebhookSource,
289
+ WebhookSpec,
290
+ WebhookValidationIssue,
291
+ WebhookVerify,
292
+ WebhookVerifyHeaders,
293
+ WebhookVerifyRequest,
294
+ } from './webhook.js';
295
+ export { createScheduleRuntime } from './schedule-runtime.js';
296
+ export type {
297
+ ScheduleCronFactory,
298
+ ScheduleCronHandler,
299
+ ScheduleCronJob,
300
+ ScheduleRuntime,
301
+ ScheduleRuntimeLogger,
302
+ ScheduleRuntimeOptions,
303
+ ScheduleRuntimeRegistrationReport,
304
+ ScheduleRuntimeRunRecord,
305
+ ScheduleRuntimeRunStatus,
306
+ ScheduleRuntimeSkipReason,
307
+ ScheduleRuntimeStartReport,
308
+ ScheduleRuntimeState,
309
+ ScheduleRuntimeStopReport,
310
+ ScheduleRuntimeWarning,
311
+ ScheduleRuntimeWarningCode,
312
+ } from './schedule-runtime.js';
313
+ export {
314
+ SIGNAL_DIAGNOSTICS_SINK_KEY,
315
+ SIGNAL_DIAGNOSTICS_STRICT_MODE_KEY,
316
+ createSignalFireSuppressedDiagnostic,
317
+ createSignalHandlerFailedDiagnostic,
318
+ createSignalHandlerRejectedDiagnostic,
319
+ createSignalInvalidDiagnostic,
320
+ createSignalPredicateFailedDiagnostic,
321
+ createSignalUnknownDiagnostic,
322
+ recordSignalDiagnostic,
323
+ shouldPromoteSignalDiagnostic,
324
+ signalDiagnosticDefinitions,
325
+ summarizeSignalPayload,
326
+ } from './signal-diagnostics.js';
327
+ export type {
328
+ CreateSignalFireSuppressedDiagnosticInput,
329
+ CreateSignalHandlerDiagnosticInput,
330
+ CreateSignalInvalidDiagnosticInput,
331
+ SignalDiagnostic,
332
+ SignalDiagnosticCategory,
333
+ SignalDiagnosticCause,
334
+ SignalDiagnosticCode,
335
+ SignalDiagnosticCommonInput,
336
+ SignalDiagnosticContext,
337
+ SignalDiagnosticLevel,
338
+ SignalDiagnosticPathSegment,
339
+ SignalDiagnosticRecordResult,
340
+ SignalDiagnosticSchemaIssue,
341
+ SignalDiagnosticSink,
342
+ SignalDiagnosticOrigin,
343
+ SignalDiagnosticSourceLocation,
344
+ SignalDiagnosticStrictMode,
345
+ SignalFireSuppressedDiagnostic,
346
+ SignalHandlerFailedDiagnostic,
347
+ SignalHandlerRejectedDiagnostic,
348
+ SignalInvalidDiagnostic,
349
+ SignalPredicateFailedDiagnostic,
350
+ SignalPayloadShape,
351
+ SignalPayloadSummary,
352
+ SignalUnknownDiagnostic,
353
+ } from './signal-diagnostics.js';
354
+ export {
355
+ attachLateBoundSignalRef,
356
+ cloneSignalWithId,
357
+ createLateBoundSignalMarker,
358
+ getLateBoundSignalRef,
359
+ parseLateBoundSignalMarker,
360
+ } from './signal-ref.js';
361
+ export type {
362
+ LateBoundSignalMarker,
363
+ LateBoundSignalRef,
364
+ } from './signal-ref.js';
365
+
366
+ // Contour
367
+ export { contour } from './contour.js';
368
+ export {
369
+ CONTOUR_ID_METADATA,
370
+ getContourIdMetadata,
371
+ getContourReferences,
372
+ } from './contour.js';
373
+ export type {
374
+ AnyContour,
375
+ Contour,
376
+ ContourIdBrand,
377
+ ContourIdMetadata,
378
+ ContourIdSchema,
379
+ ContourIdValue,
380
+ ContourOptions,
381
+ ContourReference,
382
+ } from './contour.js';
54
383
 
55
384
  // Topo
56
385
  export { topo } from './topo.js';
57
- export type { Topo } from './topo.js';
386
+ export type { Topo, TopoIdentity } from './topo.js';
387
+
388
+ // Generic trails-db helpers (shared framework infrastructure per ADR-0014).
389
+ // The topo-store public API that previously lived here moved to
390
+ // `@ontrails/topographer` per ADR-0042.
391
+ export {
392
+ deriveTrailsDbPath,
393
+ deriveTrailsDir,
394
+ ensureSubsystemSchema,
395
+ ensureTrailsWorkspace,
396
+ openReadTrailsDb,
397
+ openWriteTrailsDb,
398
+ WORKSPACE_GITIGNORE_CONTENT,
399
+ WORKSPACE_GITIGNORE_LINES,
400
+ } from './trails-db.js';
401
+ export type {
402
+ EnsureSubsystemSchemaOptions,
403
+ TrailsDbLocationOptions,
404
+ } from './trails-db.js';
405
+
406
+ // Draft state
407
+ export {
408
+ DRAFT_ID_PREFIX,
409
+ deriveDraftReport,
410
+ isDraftId,
411
+ validateDraftFreeTopo,
412
+ } from './draft.js';
413
+ export type {
414
+ DraftDependency,
415
+ DraftDependencyKind,
416
+ DraftFinding,
417
+ DraftReport,
418
+ } from './draft.js';
58
419
 
59
420
  // Topo validation
60
421
  export { validateTopo } from './validate-topo.js';
61
422
  export type { TopoIssue } from './validate-topo.js';
423
+ export { validateEstablishedTopo } from './validate-established-topo.js';
62
424
 
63
425
  // Layer
64
426
  export { composeLayers } from './layer.js';
65
- export type { Layer } from './layer.js';
66
-
67
- // Health
68
- export type { HealthStatus, HealthResult } from './health.js';
69
-
70
- // Adapters
427
+ export type { Layer, LayerInputSchema } from './layer.js';
428
+ export {
429
+ collectAttachedTypedLayers,
430
+ LAYER_FIELD_RESERVED_NAMES,
431
+ LAYER_FIELD_RESERVED_NAMES_KEBAB,
432
+ projectLayerFieldName,
433
+ } from './layer-projection.js';
71
434
  export type {
72
- IndexAdapter,
73
- StorageAdapter,
74
- CacheAdapter,
75
- SearchOptions,
76
- SearchResult,
77
- StorageOptions,
78
- } from './adapters.js';
435
+ AttachedLayerScope,
436
+ AttachedTypedLayer,
437
+ LayerFieldProjection,
438
+ LayerFieldRenameReason,
439
+ ProjectedLayerField,
440
+ RenamedLayerFieldProjection,
441
+ } from './layer-projection.js';
79
442
 
80
443
  // Derive
81
- export { deriveFields } from './derive.js';
444
+ export { deriveCliPath, deriveFields } from './derive.js';
82
445
  export type { Field, FieldOverride } from './derive.js';
83
446
 
447
+ // Compose schema
448
+ export { buildComposeValidationSchema } from './compose-schema.js';
449
+ export {
450
+ claimNextComposeBatchIndex,
451
+ createComposeBatchValidationResults,
452
+ normalizeComposeBatchConcurrency,
453
+ } from './compose-batch.js';
454
+
455
+ // Execute
456
+ export { DETOUR_MAX_ATTEMPTS_CAP } from './detours.js';
457
+ export { executeTrail } from './execute.js';
458
+ export type { ExecuteTrailOptions } from './execute.js';
459
+
460
+ // Intrinsic tracing
461
+ export {
462
+ clearTraceSink,
463
+ createActivationTraceRecord,
464
+ createTraceRecord,
465
+ getTraceContext,
466
+ getTraceSink,
467
+ NOOP_SINK,
468
+ registerTraceSink,
469
+ TRACE_CONTEXT_KEY,
470
+ traceContextFromRecord,
471
+ writeActivationTraceRecord,
472
+ } from './tracing.js';
473
+ export type {
474
+ ActivationTraceRecordName,
475
+ SignalTraceRecordName,
476
+ TraceContext,
477
+ TraceRecord,
478
+ TraceSink,
479
+ } from './tracing.js';
480
+ export type { TraceFn } from './types.js';
481
+
482
+ // Observe
483
+ export {
484
+ createObserveLogger,
485
+ isLogSink,
486
+ isLogger,
487
+ isObserveInput,
488
+ isTraceSink,
489
+ normalizeObserve,
490
+ } from './observe.js';
491
+ export type {
492
+ ObserveCapabilities,
493
+ ObserveConfig,
494
+ ObserveInput,
495
+ TopoOptions,
496
+ } from './observe.js';
497
+
498
+ // Run
499
+ export { run } from './run.js';
500
+ export type { RunOptions } from './run.js';
501
+
502
+ // Trail factories
503
+ export { deriveTrail, ingest } from './trails/index.js';
504
+ export type {
505
+ DeriveTrailInput,
506
+ DeriveTrailOperation,
507
+ DeriveTrailOutput,
508
+ DeriveTrailSpec,
509
+ IngestOptions,
510
+ IngestTransform,
511
+ } from './trails/index.js';
512
+
84
513
  // Validation
85
514
  export {
86
515
  validateInput,
@@ -88,6 +517,10 @@ export {
88
517
  formatZodIssues,
89
518
  zodToJsonSchema,
90
519
  } from './validation.js';
520
+ export {
521
+ stripDefaultWrappers,
522
+ stripDefaultsFromShape,
523
+ } from './zod-wrappers.js';
91
524
 
92
525
  // Serialization
93
526
  export { serializeError, deserializeError } from './serialization.js';
@@ -98,7 +531,7 @@ export {
98
531
  retry,
99
532
  withTimeout,
100
533
  shouldRetry,
101
- getBackoffDelay,
534
+ deriveBackoffDelay,
102
535
  } from './resilience.js';
103
536
  export type { RetryOptions } from './resilience.js';
104
537
 
@@ -113,7 +546,7 @@ export {
113
546
  nonEmptyString,
114
547
  positiveInt,
115
548
  shortId,
116
- hashId,
549
+ deriveIdHash,
117
550
  } from './branded.js';
118
551
  export type {
119
552
  Branded,
@@ -124,15 +557,27 @@ export type {
124
557
  } from './branded.js';
125
558
 
126
559
  // Path Security
127
- export { securePath, isPathSafe, resolveSafePath } from './path-security.js';
560
+ export { securePath, isPathSafe, deriveSafePath } from './path-security.js';
128
561
 
129
562
  // Workspace
130
563
  export {
131
564
  findWorkspaceRoot,
132
565
  isInsideWorkspace,
133
- getRelativePath,
566
+ deriveRelativePath,
134
567
  } from './workspace.js';
135
568
 
569
+ // Blob
570
+ export {
571
+ BLOB_REF_SCHEMA_META_KEY,
572
+ blobRefDescriptorSchema,
573
+ blobRefJsonSchema,
574
+ blobRefSchema,
575
+ createBlobRef,
576
+ isBlobRef,
577
+ toBlobRefDescriptor,
578
+ } from './blob-ref.js';
579
+ export type { BlobRef, BlobRefDescriptor } from './blob-ref.js';
580
+
136
581
  // Guards
137
582
  export {
138
583
  isDefined,
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Internal helper for "forking" a trail context.
3
+ *
4
+ * Several execution sites need to derive a child context from a parent
5
+ * context while **resetting** a well-known set of bound closures (`compose`,
6
+ * `fire`, `resource`). Those closures capture the parent scope, so reusing
7
+ * them on the child would re-enter execution with the wrong attribution,
8
+ * the wrong resource scope, or the wrong fan-out identity. The reset list
9
+ * is the same at every fork site.
10
+ *
11
+ * Codifying the reset list in one helper keeps that contract in a single
12
+ * place. Callers supply the overrides they need (typically `env`,
13
+ * `extensions`, and `logger`) and let the helper handle the reset.
14
+ *
15
+ * This module is internal — do not export it from the package entry point.
16
+ *
17
+ * @remarks
18
+ * The helper is intentionally generic over the concrete context shape. Some
19
+ * callers work with the fully-resolved `TrailContext` produced inside the
20
+ * executor; others work with `Partial<TrailContextInit>` during consumer
21
+ * context derivation in `fire.ts`. Both shapes share the same reset keys.
22
+ */
23
+
24
+ import type { TrailContext, TrailContextInit } from '../types.js';
25
+
26
+ /** Keys cleared by default when forking a context. */
27
+ export type ForkCtxResetKey = 'compose' | 'fire' | 'resource';
28
+
29
+ /** Override fields callers are allowed to apply when forking a context. */
30
+ export type ForkCtxOverrides = Readonly<
31
+ Partial<Pick<TrailContext, 'env' | 'extensions' | 'logger'>>
32
+ >;
33
+
34
+ const DEFAULT_RESET_KEYS: readonly ForkCtxResetKey[] = [
35
+ 'compose',
36
+ 'fire',
37
+ 'resource',
38
+ ];
39
+
40
+ /**
41
+ * Fork a parent context into a child context.
42
+ *
43
+ * Spreads the parent, clears each reset key to `undefined`, and applies the
44
+ * supplied overrides last so callers may replace logger, env, and extensions
45
+ * with branch-local values.
46
+ *
47
+ * The generic parameter is constrained to the minimal shape the helper
48
+ * reads and writes. This lets the helper serve both `TrailContext`
49
+ * (executor scope) and `Partial<TrailContextInit>` (fire-consumer scope)
50
+ * without widening the public surface of either type.
51
+ */
52
+ export const forkCtx = <
53
+ TCtx extends Partial<
54
+ Pick<
55
+ TrailContextInit,
56
+ 'compose' | 'env' | 'extensions' | 'fire' | 'logger' | 'resource'
57
+ >
58
+ >,
59
+ >(
60
+ parentCtx: TCtx,
61
+ overrides: ForkCtxOverrides = {},
62
+ reset: readonly ForkCtxResetKey[] = DEFAULT_RESET_KEYS
63
+ ): TCtx => {
64
+ const forked: TCtx = { ...parentCtx };
65
+ for (const key of reset) {
66
+ forked[key as keyof TCtx] = undefined as TCtx[keyof TCtx];
67
+ }
68
+ return { ...forked, ...overrides };
69
+ };