@ontrails/core 1.0.0-beta.14 → 1.0.0-beta.16

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 (314) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/README.md +73 -24
  3. package/package.json +11 -4
  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/context.ts +28 -4
  11. package/src/contour.ts +344 -0
  12. package/src/cross-batch.ts +69 -0
  13. package/src/cross-schema.ts +36 -0
  14. package/src/detours.ts +8 -0
  15. package/src/draft.ts +60 -52
  16. package/src/error-projection.ts +51 -0
  17. package/src/errors.ts +245 -48
  18. package/src/execute.ts +1250 -40
  19. package/src/fire.ts +1169 -0
  20. package/src/index.ts +383 -49
  21. package/src/internal/fork-ctx.ts +69 -0
  22. package/src/layer-projection.ts +192 -0
  23. package/src/layer.ts +81 -0
  24. package/src/observe.ts +361 -0
  25. package/src/path-security.ts +1 -1
  26. package/src/permits.ts +12 -0
  27. package/src/redaction/patterns.ts +6 -3
  28. package/src/resilience.ts +11 -11
  29. package/src/resource-config.ts +792 -0
  30. package/src/resource.ts +175 -0
  31. package/src/result.ts +18 -0
  32. package/src/run.ts +7 -6
  33. package/src/schedule-runtime.ts +689 -0
  34. package/src/schedule.ts +324 -0
  35. package/src/serialization.ts +90 -55
  36. package/src/signal-diagnostics.ts +633 -0
  37. package/src/signal-ref.ts +87 -0
  38. package/src/signal.ts +37 -0
  39. package/src/store/accessor-protocol.ts +56 -0
  40. package/src/store/index.ts +4 -0
  41. package/src/structured-examples.ts +245 -0
  42. package/src/surface-derivation.ts +91 -0
  43. package/src/surface-filter.ts +176 -0
  44. package/src/topo.ts +710 -59
  45. package/src/tracing.ts +345 -0
  46. package/src/trail.ts +347 -33
  47. package/src/trails/derive-trail.ts +842 -0
  48. package/src/trails/index.ts +9 -0
  49. package/src/trails/ingest.ts +138 -0
  50. package/src/{internal/trails-db.ts → trails-db.ts} +50 -31
  51. package/src/transport-error-map.ts +174 -0
  52. package/src/type-utils.ts +17 -2
  53. package/src/types.ts +208 -17
  54. package/src/validate-established-topo.ts +8 -2
  55. package/src/validate-topo.ts +244 -13
  56. package/src/validation.ts +58 -1
  57. package/src/webhook.ts +276 -0
  58. package/src/workspace.ts +1 -1
  59. package/src/zod-wrappers.ts +72 -0
  60. package/.turbo/turbo-build.log +0 -1
  61. package/.turbo/turbo-lint.log +0 -3
  62. package/.turbo/turbo-typecheck.log +0 -1
  63. package/dist/adapters.d.ts +0 -39
  64. package/dist/adapters.d.ts.map +0 -1
  65. package/dist/adapters.js +0 -2
  66. package/dist/adapters.js.map +0 -1
  67. package/dist/blob-ref.d.ts +0 -20
  68. package/dist/blob-ref.d.ts.map +0 -1
  69. package/dist/blob-ref.js +0 -22
  70. package/dist/blob-ref.js.map +0 -1
  71. package/dist/branded.d.ts +0 -36
  72. package/dist/branded.d.ts.map +0 -1
  73. package/dist/branded.js +0 -89
  74. package/dist/branded.js.map +0 -1
  75. package/dist/collections.d.ts +0 -31
  76. package/dist/collections.d.ts.map +0 -1
  77. package/dist/collections.js +0 -60
  78. package/dist/collections.js.map +0 -1
  79. package/dist/context.d.ts +0 -10
  80. package/dist/context.d.ts.map +0 -1
  81. package/dist/context.js +0 -21
  82. package/dist/context.js.map +0 -1
  83. package/dist/derive.d.ts +0 -44
  84. package/dist/derive.d.ts.map +0 -1
  85. package/dist/derive.js +0 -149
  86. package/dist/derive.js.map +0 -1
  87. package/dist/dispatch.d.ts +0 -27
  88. package/dist/dispatch.d.ts.map +0 -1
  89. package/dist/dispatch.js +0 -34
  90. package/dist/dispatch.js.map +0 -1
  91. package/dist/draft.d.ts +0 -28
  92. package/dist/draft.d.ts.map +0 -1
  93. package/dist/draft.js +0 -156
  94. package/dist/draft.js.map +0 -1
  95. package/dist/errors.d.ts +0 -83
  96. package/dist/errors.d.ts.map +0 -1
  97. package/dist/errors.js +0 -142
  98. package/dist/errors.js.map +0 -1
  99. package/dist/event.d.ts +0 -8
  100. package/dist/event.d.ts.map +0 -1
  101. package/dist/event.js +0 -7
  102. package/dist/event.js.map +0 -1
  103. package/dist/execute.d.ts +0 -35
  104. package/dist/execute.d.ts.map +0 -1
  105. package/dist/execute.js +0 -90
  106. package/dist/execute.js.map +0 -1
  107. package/dist/fetch.d.ts +0 -15
  108. package/dist/fetch.d.ts.map +0 -1
  109. package/dist/fetch.js +0 -102
  110. package/dist/fetch.js.map +0 -1
  111. package/dist/gate.d.ts +0 -17
  112. package/dist/gate.d.ts.map +0 -1
  113. package/dist/gate.js +0 -21
  114. package/dist/gate.js.map +0 -1
  115. package/dist/guards.d.ts +0 -17
  116. package/dist/guards.d.ts.map +0 -1
  117. package/dist/guards.js +0 -25
  118. package/dist/guards.js.map +0 -1
  119. package/dist/health.d.ts +0 -18
  120. package/dist/health.d.ts.map +0 -1
  121. package/dist/health.js +0 -5
  122. package/dist/health.js.map +0 -1
  123. package/dist/index.d.ts +0 -48
  124. package/dist/index.d.ts.map +0 -1
  125. package/dist/index.js +0 -51
  126. package/dist/index.js.map +0 -1
  127. package/dist/internal/topo-saves.d.ts +0 -47
  128. package/dist/internal/topo-saves.d.ts.map +0 -1
  129. package/dist/internal/topo-saves.js +0 -310
  130. package/dist/internal/topo-saves.js.map +0 -1
  131. package/dist/internal/topo-store-read.d.ts +0 -67
  132. package/dist/internal/topo-store-read.d.ts.map +0 -1
  133. package/dist/internal/topo-store-read.js +0 -222
  134. package/dist/internal/topo-store-read.js.map +0 -1
  135. package/dist/internal/topo-store.d.ts +0 -12
  136. package/dist/internal/topo-store.d.ts.map +0 -1
  137. package/dist/internal/topo-store.js +0 -571
  138. package/dist/internal/topo-store.js.map +0 -1
  139. package/dist/internal/trails-db.d.ts +0 -16
  140. package/dist/internal/trails-db.d.ts.map +0 -1
  141. package/dist/internal/trails-db.js +0 -118
  142. package/dist/internal/trails-db.js.map +0 -1
  143. package/dist/job.d.ts +0 -24
  144. package/dist/job.d.ts.map +0 -1
  145. package/dist/job.js +0 -17
  146. package/dist/job.js.map +0 -1
  147. package/dist/layer.d.ts +0 -6
  148. package/dist/layer.d.ts.map +0 -1
  149. package/dist/layer.js +0 -4
  150. package/dist/layer.js.map +0 -1
  151. package/dist/path-security.d.ts +0 -28
  152. package/dist/path-security.d.ts.map +0 -1
  153. package/dist/path-security.js +0 -63
  154. package/dist/path-security.js.map +0 -1
  155. package/dist/patterns/bulk.d.ts +0 -15
  156. package/dist/patterns/bulk.d.ts.map +0 -1
  157. package/dist/patterns/bulk.js +0 -14
  158. package/dist/patterns/bulk.js.map +0 -1
  159. package/dist/patterns/change.d.ts +0 -10
  160. package/dist/patterns/change.d.ts.map +0 -1
  161. package/dist/patterns/change.js +0 -10
  162. package/dist/patterns/change.js.map +0 -1
  163. package/dist/patterns/date-range.d.ts +0 -10
  164. package/dist/patterns/date-range.d.ts.map +0 -1
  165. package/dist/patterns/date-range.js +0 -10
  166. package/dist/patterns/date-range.js.map +0 -1
  167. package/dist/patterns/index.d.ts +0 -9
  168. package/dist/patterns/index.d.ts.map +0 -1
  169. package/dist/patterns/index.js +0 -9
  170. package/dist/patterns/index.js.map +0 -1
  171. package/dist/patterns/pagination.d.ts +0 -18
  172. package/dist/patterns/pagination.d.ts.map +0 -1
  173. package/dist/patterns/pagination.js +0 -18
  174. package/dist/patterns/pagination.js.map +0 -1
  175. package/dist/patterns/progress.d.ts +0 -11
  176. package/dist/patterns/progress.d.ts.map +0 -1
  177. package/dist/patterns/progress.js +0 -11
  178. package/dist/patterns/progress.js.map +0 -1
  179. package/dist/patterns/sorting.d.ts +0 -13
  180. package/dist/patterns/sorting.d.ts.map +0 -1
  181. package/dist/patterns/sorting.js +0 -10
  182. package/dist/patterns/sorting.js.map +0 -1
  183. package/dist/patterns/status.d.ts +0 -15
  184. package/dist/patterns/status.d.ts.map +0 -1
  185. package/dist/patterns/status.js +0 -9
  186. package/dist/patterns/status.js.map +0 -1
  187. package/dist/patterns/timestamps.d.ts +0 -10
  188. package/dist/patterns/timestamps.d.ts.map +0 -1
  189. package/dist/patterns/timestamps.js +0 -10
  190. package/dist/patterns/timestamps.js.map +0 -1
  191. package/dist/provision-config.d.ts +0 -22
  192. package/dist/provision-config.d.ts.map +0 -1
  193. package/dist/provision-config.js +0 -210
  194. package/dist/provision-config.js.map +0 -1
  195. package/dist/provision.d.ts +0 -71
  196. package/dist/provision.d.ts.map +0 -1
  197. package/dist/provision.js +0 -56
  198. package/dist/provision.js.map +0 -1
  199. package/dist/redaction/index.d.ts +0 -4
  200. package/dist/redaction/index.d.ts.map +0 -1
  201. package/dist/redaction/index.js +0 -3
  202. package/dist/redaction/index.js.map +0 -1
  203. package/dist/redaction/patterns.d.ts +0 -9
  204. package/dist/redaction/patterns.d.ts.map +0 -1
  205. package/dist/redaction/patterns.js +0 -39
  206. package/dist/redaction/patterns.js.map +0 -1
  207. package/dist/redaction/redactor.d.ts +0 -27
  208. package/dist/redaction/redactor.d.ts.map +0 -1
  209. package/dist/redaction/redactor.js +0 -89
  210. package/dist/redaction/redactor.js.map +0 -1
  211. package/dist/resilience.d.ts +0 -34
  212. package/dist/resilience.d.ts.map +0 -1
  213. package/dist/resilience.js +0 -164
  214. package/dist/resilience.js.map +0 -1
  215. package/dist/result.d.ts +0 -57
  216. package/dist/result.d.ts.map +0 -1
  217. package/dist/result.js +0 -156
  218. package/dist/result.js.map +0 -1
  219. package/dist/run.d.ts +0 -27
  220. package/dist/run.d.ts.map +0 -1
  221. package/dist/run.js +0 -34
  222. package/dist/run.js.map +0 -1
  223. package/dist/serialization.d.ts +0 -27
  224. package/dist/serialization.d.ts.map +0 -1
  225. package/dist/serialization.js +0 -153
  226. package/dist/serialization.js.map +0 -1
  227. package/dist/service-config.d.ts +0 -22
  228. package/dist/service-config.d.ts.map +0 -1
  229. package/dist/service-config.js +0 -210
  230. package/dist/service-config.js.map +0 -1
  231. package/dist/service.d.ts +0 -71
  232. package/dist/service.d.ts.map +0 -1
  233. package/dist/service.js +0 -56
  234. package/dist/service.js.map +0 -1
  235. package/dist/signal.d.ts +0 -33
  236. package/dist/signal.d.ts.map +0 -1
  237. package/dist/signal.js +0 -17
  238. package/dist/signal.js.map +0 -1
  239. package/dist/topo-store.d.ts +0 -48
  240. package/dist/topo-store.d.ts.map +0 -1
  241. package/dist/topo-store.js +0 -175
  242. package/dist/topo-store.js.map +0 -1
  243. package/dist/topo.d.ts +0 -25
  244. package/dist/topo.d.ts.map +0 -1
  245. package/dist/topo.js +0 -112
  246. package/dist/topo.js.map +0 -1
  247. package/dist/trail.d.ts +0 -96
  248. package/dist/trail.d.ts.map +0 -1
  249. package/dist/trail.js +0 -20
  250. package/dist/trail.js.map +0 -1
  251. package/dist/type-utils.d.ts +0 -24
  252. package/dist/type-utils.d.ts.map +0 -1
  253. package/dist/type-utils.js +0 -12
  254. package/dist/type-utils.js.map +0 -1
  255. package/dist/types.d.ts +0 -71
  256. package/dist/types.d.ts.map +0 -1
  257. package/dist/types.js +0 -3
  258. package/dist/types.js.map +0 -1
  259. package/dist/validate-established-topo.d.ts +0 -76
  260. package/dist/validate-established-topo.d.ts.map +0 -1
  261. package/dist/validate-established-topo.js +0 -43
  262. package/dist/validate-established-topo.js.map +0 -1
  263. package/dist/validate-topo.d.ts +0 -24
  264. package/dist/validate-topo.d.ts.map +0 -1
  265. package/dist/validate-topo.js +0 -176
  266. package/dist/validate-topo.js.map +0 -1
  267. package/dist/validation.d.ts +0 -27
  268. package/dist/validation.d.ts.map +0 -1
  269. package/dist/validation.js +0 -165
  270. package/dist/validation.js.map +0 -1
  271. package/dist/workspace.d.ts +0 -25
  272. package/dist/workspace.d.ts.map +0 -1
  273. package/dist/workspace.js +0 -57
  274. package/dist/workspace.js.map +0 -1
  275. package/src/__tests__/blob-ref.test.ts +0 -103
  276. package/src/__tests__/branded.test.ts +0 -148
  277. package/src/__tests__/collections.test.ts +0 -126
  278. package/src/__tests__/context.test.ts +0 -77
  279. package/src/__tests__/derive.test.ts +0 -260
  280. package/src/__tests__/errors.test.ts +0 -309
  281. package/src/__tests__/execute.test.ts +0 -525
  282. package/src/__tests__/fetch.test.ts +0 -217
  283. package/src/__tests__/gate.test.ts +0 -125
  284. package/src/__tests__/guards.test.ts +0 -102
  285. package/src/__tests__/path-security.test.ts +0 -114
  286. package/src/__tests__/patterns.test.ts +0 -273
  287. package/src/__tests__/redaction.test.ts +0 -244
  288. package/src/__tests__/resilience.test.ts +0 -246
  289. package/src/__tests__/result.test.ts +0 -155
  290. package/src/__tests__/run.test.ts +0 -181
  291. package/src/__tests__/serialization.test.ts +0 -401
  292. package/src/__tests__/service-config.test.ts +0 -228
  293. package/src/__tests__/service.test.ts +0 -197
  294. package/src/__tests__/signal.test.ts +0 -82
  295. package/src/__tests__/topo-store-read.test.ts +0 -251
  296. package/src/__tests__/topo-store.test.ts +0 -469
  297. package/src/__tests__/topo.test.ts +0 -277
  298. package/src/__tests__/trail-permit.test.ts +0 -60
  299. package/src/__tests__/trail.test.ts +0 -261
  300. package/src/__tests__/trails-db.test.ts +0 -191
  301. package/src/__tests__/type-utils.test.ts +0 -90
  302. package/src/__tests__/validate-topo.test.ts +0 -489
  303. package/src/__tests__/validation.test.ts +0 -336
  304. package/src/__tests__/workspace.test.ts +0 -183
  305. package/src/event.ts +0 -15
  306. package/src/gate.ts +0 -44
  307. package/src/internal/topo-saves.ts +0 -429
  308. package/src/internal/topo-store-read.ts +0 -473
  309. package/src/internal/topo-store.ts +0 -1087
  310. package/src/provision-config.ts +0 -373
  311. package/src/provision.ts +0 -148
  312. package/src/topo-store.ts +0 -301
  313. package/tsconfig.json +0 -9
  314. 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 {
@@ -11,104 +12,353 @@ export {
11
12
  AlreadyExistsError,
12
13
  ConflictError,
13
14
  PermissionError,
15
+ PermitError,
14
16
  TimeoutError,
15
17
  RateLimitError,
16
18
  NetworkError,
17
19
  InternalError,
18
20
  AuthError,
19
21
  CancelledError,
22
+ DerivationError,
23
+ RecoverableCompletionError,
24
+ codesByCategory,
25
+ errorClasses,
26
+ errorCategories,
20
27
  exitCodeMap,
21
28
  statusCodeMap,
22
29
  jsonRpcCodeMap,
23
30
  retryableMap,
31
+ RetryExhaustedError,
24
32
  isRetryable,
25
33
  isTrailsError,
26
34
  } from './errors.js';
27
- export type { ErrorCategory } from './errors.js';
35
+ export type {
36
+ DynamicErrorClassRegistryEntry,
37
+ ErrorCategory,
38
+ ErrorCategoryCodes,
39
+ ErrorClassConstructor,
40
+ ErrorClassRegistryEntry,
41
+ FixedErrorClassRegistryEntry,
42
+ } from './errors.js';
43
+ export {
44
+ createSurfaceErrorMapper,
45
+ mapSurfaceError,
46
+ projectErrorClassSurface,
47
+ projectPublicSurfaceError,
48
+ projectSurfaceError,
49
+ surfaceErrorMap,
50
+ surfaceErrorRegistry,
51
+ surfaceNames,
52
+ } from './transport-error-map.js';
53
+ export type {
54
+ ErrorClassSurfaceProjection,
55
+ SurfaceErrorCode,
56
+ SurfaceErrorMapper,
57
+ SurfaceErrorMappings,
58
+ SurfaceErrorProjection,
59
+ SurfaceName,
60
+ } from './transport-error-map.js';
61
+ export {
62
+ INTERNAL_ERROR_PUBLIC_MESSAGE,
63
+ projectErrorDiagnostics,
64
+ redactErrorContext,
65
+ redactErrorStack,
66
+ redactErrorString,
67
+ } from './error-projection.js';
68
+ export type { ErrorDiagnosticsProjection } from './error-projection.js';
28
69
 
29
70
  // Types
30
71
  export type {
72
+ Detour,
73
+ DetourAttempt,
31
74
  Implementation,
32
75
  TrailContext,
33
76
  TrailContextInit,
77
+ CrossBatchOptions,
34
78
  CrossFn,
35
- BasePermit,
79
+ FireFn,
80
+ LogLevel,
81
+ LogFormatter,
82
+ LogRecord,
83
+ LogSink,
36
84
  PermitRequirement,
37
85
  ProgressCallback,
38
86
  ProgressEvent,
39
87
  Logger,
40
- ProvisionLookup,
88
+ ResourceLookup,
89
+ } from './types.js';
90
+ export { basePermitSchema } from './permits.js';
91
+ export type { BasePermit } from './permits.js';
92
+ export {
93
+ LAYER_INPUTS_KEY,
94
+ SURFACE_KEY,
95
+ SURFACE_LAYER_NAMES_KEY,
41
96
  } from './types.js';
42
- export { TRAILHEAD_KEY } from './types.js';
97
+ export {
98
+ ACTIVATION_PROVENANCE_KEY,
99
+ buildActivationProvenanceTraceAttrs,
100
+ getActivationProvenance,
101
+ withActivationProvenance,
102
+ } from './activation-provenance.js';
103
+ export type {
104
+ ActivationProvenance,
105
+ ActivationProvenanceCarrier,
106
+ ActivationProvenanceSource,
107
+ } from './activation-provenance.js';
43
108
 
44
109
  // Context factory
45
- export { createTrailContext } from './context.js';
110
+ export { createTrailContext, passthroughTrace } from './context.js';
46
111
 
47
- // Provision
112
+ // Resource
48
113
  export {
49
- createProvisionLookup,
50
- findDuplicateProvisionId,
51
- isProvision,
52
- provision,
53
- } from './provision.js';
114
+ createResourceLookup,
115
+ findDuplicateResourceId,
116
+ isResource,
117
+ resource,
118
+ } from './resource.js';
119
+ export { drainResources, resolveResourceConfig } from './resource-config.js';
54
120
  export type {
55
- AnyProvision,
56
- Provision,
57
- ProvisionContext,
58
- ProvisionOverrideMap,
59
- ProvisionSpec,
60
- } from './provision.js';
121
+ ResourceConfigValues,
122
+ ResourceDrainReport,
123
+ } from './resource-config.js';
124
+ export type {
125
+ AnyResource,
126
+ Resource,
127
+ ResourceContext,
128
+ ResourceOverrideMap,
129
+ ResourceSpec,
130
+ ResourceUnmockable,
131
+ } from './resource.js';
61
132
 
62
133
  // Trail
63
- export { trail } from './trail.js';
134
+ export {
135
+ activationSourceKinds,
136
+ getActivationWherePredicate,
137
+ isActivationEntrySpec,
138
+ isActivationSource,
139
+ isKnownActivationSourceKind,
140
+ } from './activation-source.js';
141
+ export type {
142
+ ActivationEntry,
143
+ ActivationEntrySpec,
144
+ ActivationSource,
145
+ ActivationSourceKind,
146
+ ActivationSourceMeta,
147
+ ActivationSourceRef,
148
+ ActivationWhere,
149
+ ActivationWhereExample,
150
+ ActivationWherePredicate,
151
+ ActivationWhereSpec,
152
+ BuiltinActivationSourceKind,
153
+ } from './activation-source.js';
154
+ export {
155
+ activationSourceDeclarationSignature,
156
+ activationSourceKey,
157
+ projectActivationSourceDeclaration,
158
+ } from './activation-source-projection.js';
159
+ export type { ActivationSourceProjection } from './activation-source-projection.js';
160
+ export { intentValues, trail } from './trail.js';
64
161
  export type {
65
162
  AnyTrail,
163
+ BlazeInput,
66
164
  Intent,
67
165
  Trail,
68
166
  TrailSpec,
69
167
  TrailExample,
168
+ TrailExampleSignalAssertion,
169
+ TrailVisibility,
70
170
  } from './trail.js';
171
+ export {
172
+ filterSurfaceTrails,
173
+ matchesTrailPattern,
174
+ shouldIncludeTrailForSurface,
175
+ } from './surface-filter.js';
176
+ export type { SurfaceFilterOptions } from './surface-filter.js';
177
+ export {
178
+ shouldValidateSurfaceTopo,
179
+ validateSurfaceTopo,
180
+ withSurfaceLayerNames,
181
+ withSurfaceMarker,
182
+ } from './surface-derivation.js';
183
+ export type {
184
+ BaseSurfaceOptions,
185
+ SurfaceConfigValues,
186
+ SurfaceSelectionOptions,
187
+ SurfaceMarkedContext,
188
+ SurfaceValidationOptions,
189
+ } from './surface-derivation.js';
190
+ export {
191
+ deriveStructuredSignalExamples,
192
+ deriveStructuredTrailExamples,
193
+ } from './structured-examples.js';
194
+ export type {
195
+ StructuredSignalExample,
196
+ StructuredSignalExampleProvenance,
197
+ StructuredTrailExample,
198
+ StructuredTrailExampleKind,
199
+ StructuredTrailExampleProvenance,
200
+ StructuredTrailExampleSignalAssertion,
201
+ } from './structured-examples.js';
71
202
 
72
203
  // Type utilities
73
- export type { TrailInput, TrailOutput, TrailResult } from './type-utils.js';
204
+ export type {
205
+ CrossInput,
206
+ TrailInput,
207
+ TrailOutput,
208
+ TrailResult,
209
+ } from './type-utils.js';
74
210
  export { inputOf, outputOf } from './type-utils.js';
75
211
 
76
212
  // Signal
77
213
  export { signal } from './signal.js';
78
214
  export type { AnySignal, Signal, SignalSpec } from './signal.js';
79
- export { event } from './event.js';
80
- export type { AnyEvent, Event, EventSpec } from './event.js';
215
+ export { schedule, validateScheduleSource } from './schedule.js';
216
+ export type {
217
+ ScheduleSource,
218
+ ScheduleSpec,
219
+ ScheduleValidationIssue,
220
+ } from './schedule.js';
221
+ export {
222
+ getWebhookHeader,
223
+ getWebhookHeaders,
224
+ validateWebhookSource,
225
+ verifyWebhookRequest,
226
+ webhook,
227
+ webhookMethods,
228
+ } from './webhook.js';
229
+ export type {
230
+ WebhookMethod,
231
+ WebhookMethodInput,
232
+ WebhookSource,
233
+ WebhookSpec,
234
+ WebhookValidationIssue,
235
+ WebhookVerify,
236
+ WebhookVerifyHeaders,
237
+ WebhookVerifyRequest,
238
+ } from './webhook.js';
239
+ export { createScheduleRuntime } from './schedule-runtime.js';
240
+ export type {
241
+ ScheduleCronFactory,
242
+ ScheduleCronHandler,
243
+ ScheduleCronJob,
244
+ ScheduleRuntime,
245
+ ScheduleRuntimeLogger,
246
+ ScheduleRuntimeOptions,
247
+ ScheduleRuntimeRegistrationReport,
248
+ ScheduleRuntimeRunRecord,
249
+ ScheduleRuntimeRunStatus,
250
+ ScheduleRuntimeSkipReason,
251
+ ScheduleRuntimeStartReport,
252
+ ScheduleRuntimeState,
253
+ ScheduleRuntimeStopReport,
254
+ ScheduleRuntimeWarning,
255
+ ScheduleRuntimeWarningCode,
256
+ } from './schedule-runtime.js';
257
+ export {
258
+ SIGNAL_DIAGNOSTICS_SINK_KEY,
259
+ SIGNAL_DIAGNOSTICS_STRICT_MODE_KEY,
260
+ createSignalFireSuppressedDiagnostic,
261
+ createSignalHandlerFailedDiagnostic,
262
+ createSignalHandlerRejectedDiagnostic,
263
+ createSignalInvalidDiagnostic,
264
+ createSignalPredicateFailedDiagnostic,
265
+ createSignalUnknownDiagnostic,
266
+ recordSignalDiagnostic,
267
+ shouldPromoteSignalDiagnostic,
268
+ signalDiagnosticDefinitions,
269
+ summarizeSignalPayload,
270
+ } from './signal-diagnostics.js';
271
+ export type {
272
+ CreateSignalFireSuppressedDiagnosticInput,
273
+ CreateSignalHandlerDiagnosticInput,
274
+ CreateSignalInvalidDiagnosticInput,
275
+ SignalDiagnostic,
276
+ SignalDiagnosticCategory,
277
+ SignalDiagnosticCause,
278
+ SignalDiagnosticCode,
279
+ SignalDiagnosticCommonInput,
280
+ SignalDiagnosticContext,
281
+ SignalDiagnosticLevel,
282
+ SignalDiagnosticPathSegment,
283
+ SignalDiagnosticRecordResult,
284
+ SignalDiagnosticSchemaIssue,
285
+ SignalDiagnosticSink,
286
+ SignalDiagnosticOrigin,
287
+ SignalDiagnosticSourceLocation,
288
+ SignalDiagnosticStrictMode,
289
+ SignalFireSuppressedDiagnostic,
290
+ SignalHandlerFailedDiagnostic,
291
+ SignalHandlerRejectedDiagnostic,
292
+ SignalInvalidDiagnostic,
293
+ SignalPredicateFailedDiagnostic,
294
+ SignalPayloadShape,
295
+ SignalPayloadSummary,
296
+ SignalUnknownDiagnostic,
297
+ } from './signal-diagnostics.js';
298
+ export {
299
+ attachLateBoundSignalRef,
300
+ cloneSignalWithId,
301
+ createLateBoundSignalMarker,
302
+ getLateBoundSignalRef,
303
+ parseLateBoundSignalMarker,
304
+ } from './signal-ref.js';
305
+ export type {
306
+ LateBoundSignalMarker,
307
+ LateBoundSignalRef,
308
+ } from './signal-ref.js';
309
+
310
+ // Contour
311
+ export { contour } from './contour.js';
312
+ export {
313
+ CONTOUR_ID_METADATA,
314
+ getContourIdMetadata,
315
+ getContourReferences,
316
+ } from './contour.js';
317
+ export type {
318
+ AnyContour,
319
+ Contour,
320
+ ContourIdBrand,
321
+ ContourIdMetadata,
322
+ ContourIdSchema,
323
+ ContourIdValue,
324
+ ContourOptions,
325
+ ContourReference,
326
+ } from './contour.js';
81
327
 
82
328
  // Topo
83
329
  export { topo } from './topo.js';
84
- export type { Topo } from './topo.js';
85
- export {
86
- createMockTopoStore,
87
- createTopoStore,
88
- topoStore,
89
- } from './topo-store.js';
90
- export type {
91
- MockTopoStoreSeed,
92
- ReadOnlyTopoStore,
93
- TopoStoreExportRecord,
94
- TopoStoreProvisionRecord,
95
- TopoStoreRef,
96
- TopoStoreTrailDetailRecord,
97
- TopoStoreTrailRecord,
98
- } from './topo-store.js';
330
+ export type { Topo, TopoIdentity } from './topo.js';
331
+
332
+ // Generic trails-db helpers (shared framework infrastructure per ADR-0014).
333
+ // The topo-store public API that previously lived here moved to
334
+ // `@ontrails/topographer` per ADR-0042.
335
+ export {
336
+ deriveTrailsDbPath,
337
+ deriveTrailsDir,
338
+ ensureSubsystemSchema,
339
+ ensureTrailsWorkspace,
340
+ openReadTrailsDb,
341
+ openWriteTrailsDb,
342
+ WORKSPACE_GITIGNORE_CONTENT,
343
+ WORKSPACE_GITIGNORE_LINES,
344
+ } from './trails-db.js';
345
+ export type {
346
+ EnsureSubsystemSchemaOptions,
347
+ TrailsDbLocationOptions,
348
+ } from './trails-db.js';
99
349
 
100
350
  // Draft state
101
351
  export {
102
352
  DRAFT_ID_PREFIX,
103
- analyzeDraftState,
353
+ deriveDraftReport,
104
354
  isDraftId,
105
- validateEstablishedTopo as validateDraftFreeTopo,
355
+ validateDraftFreeTopo,
106
356
  } from './draft.js';
107
357
  export type {
108
358
  DraftDependency,
109
359
  DraftDependencyKind,
110
360
  DraftFinding,
111
- DraftStateAnalysis,
361
+ DraftReport,
112
362
  } from './draft.js';
113
363
 
114
364
  // Topo validation
@@ -116,22 +366,94 @@ export { validateTopo } from './validate-topo.js';
116
366
  export type { TopoIssue } from './validate-topo.js';
117
367
  export { validateEstablishedTopo } from './validate-established-topo.js';
118
368
 
119
- // Gate
120
- export { composeGates } from './gate.js';
121
- export type { Gate } from './gate.js';
369
+ // Layer
370
+ export { composeLayers } from './layer.js';
371
+ export type { Layer, LayerInputSchema } from './layer.js';
372
+ export {
373
+ collectAttachedTypedLayers,
374
+ LAYER_FIELD_RESERVED_NAMES,
375
+ LAYER_FIELD_RESERVED_NAMES_KEBAB,
376
+ projectLayerFieldName,
377
+ } from './layer-projection.js';
378
+ export type {
379
+ AttachedLayerScope,
380
+ AttachedTypedLayer,
381
+ LayerFieldProjection,
382
+ LayerFieldRenameReason,
383
+ ProjectedLayerField,
384
+ RenamedLayerFieldProjection,
385
+ } from './layer-projection.js';
122
386
 
123
387
  // Derive
124
388
  export { deriveCliPath, deriveFields } from './derive.js';
125
389
  export type { Field, FieldOverride } from './derive.js';
126
390
 
391
+ // Cross schema
392
+ export { buildCrossValidationSchema } from './cross-schema.js';
393
+ export {
394
+ claimNextCrossBatchIndex,
395
+ createCrossBatchValidationResults,
396
+ normalizeCrossBatchConcurrency,
397
+ } from './cross-batch.js';
398
+
127
399
  // Execute
400
+ export { DETOUR_MAX_ATTEMPTS_CAP } from './detours.js';
128
401
  export { executeTrail } from './execute.js';
129
402
  export type { ExecuteTrailOptions } from './execute.js';
130
403
 
404
+ // Intrinsic tracing
405
+ export {
406
+ clearTraceSink,
407
+ createActivationTraceRecord,
408
+ createTraceRecord,
409
+ getTraceContext,
410
+ getTraceSink,
411
+ NOOP_SINK,
412
+ registerTraceSink,
413
+ TRACE_CONTEXT_KEY,
414
+ traceContextFromRecord,
415
+ writeActivationTraceRecord,
416
+ } from './tracing.js';
417
+ export type {
418
+ ActivationTraceRecordName,
419
+ SignalTraceRecordName,
420
+ TraceContext,
421
+ TraceRecord,
422
+ TraceSink,
423
+ } from './tracing.js';
424
+ export type { TraceFn } from './types.js';
425
+
426
+ // Observe
427
+ export {
428
+ createObserveLogger,
429
+ isLogSink,
430
+ isLogger,
431
+ isObserveInput,
432
+ isTraceSink,
433
+ normalizeObserve,
434
+ } from './observe.js';
435
+ export type {
436
+ ObserveCapabilities,
437
+ ObserveConfig,
438
+ ObserveInput,
439
+ TopoOptions,
440
+ } from './observe.js';
441
+
131
442
  // Run
132
443
  export { run } from './run.js';
133
444
  export type { RunOptions } from './run.js';
134
445
 
446
+ // Trail factories
447
+ export { deriveTrail, ingest } from './trails/index.js';
448
+ export type {
449
+ DeriveTrailInput,
450
+ DeriveTrailOperation,
451
+ DeriveTrailOutput,
452
+ DeriveTrailSpec,
453
+ IngestOptions,
454
+ IngestTransform,
455
+ } from './trails/index.js';
456
+
135
457
  // Validation
136
458
  export {
137
459
  validateInput,
@@ -139,6 +461,10 @@ export {
139
461
  formatZodIssues,
140
462
  zodToJsonSchema,
141
463
  } from './validation.js';
464
+ export {
465
+ stripDefaultWrappers,
466
+ stripDefaultsFromShape,
467
+ } from './zod-wrappers.js';
142
468
 
143
469
  // Serialization
144
470
  export { serializeError, deserializeError } from './serialization.js';
@@ -149,7 +475,7 @@ export {
149
475
  retry,
150
476
  withTimeout,
151
477
  shouldRetry,
152
- getBackoffDelay,
478
+ deriveBackoffDelay,
153
479
  } from './resilience.js';
154
480
  export type { RetryOptions } from './resilience.js';
155
481
 
@@ -164,7 +490,7 @@ export {
164
490
  nonEmptyString,
165
491
  positiveInt,
166
492
  shortId,
167
- hashId,
493
+ deriveIdHash,
168
494
  } from './branded.js';
169
495
  export type {
170
496
  Branded,
@@ -175,18 +501,26 @@ export type {
175
501
  } from './branded.js';
176
502
 
177
503
  // Path Security
178
- export { securePath, isPathSafe, resolveSafePath } from './path-security.js';
504
+ export { securePath, isPathSafe, deriveSafePath } from './path-security.js';
179
505
 
180
506
  // Workspace
181
507
  export {
182
508
  findWorkspaceRoot,
183
509
  isInsideWorkspace,
184
- getRelativePath,
510
+ deriveRelativePath,
185
511
  } from './workspace.js';
186
512
 
187
513
  // Blob
188
- export { createBlobRef, isBlobRef } from './blob-ref.js';
189
- export type { BlobRef } from './blob-ref.js';
514
+ export {
515
+ BLOB_REF_SCHEMA_META_KEY,
516
+ blobRefDescriptorSchema,
517
+ blobRefJsonSchema,
518
+ blobRefSchema,
519
+ createBlobRef,
520
+ isBlobRef,
521
+ toBlobRefDescriptor,
522
+ } from './blob-ref.js';
523
+ export type { BlobRef, BlobRefDescriptor } from './blob-ref.js';
190
524
 
191
525
  // Guards
192
526
  export {
@@ -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 (`cross`,
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 = 'cross' | '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
+ 'cross',
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
+ 'cross' | '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
+ };