@ontrails/core 1.0.0-beta.15 → 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 (348) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +61 -16
  3. package/package.json +9 -8
  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/context.ts +4 -0
  10. package/src/{internal/cross-batch.ts → cross-batch.ts} +3 -11
  11. package/src/detours.ts +8 -0
  12. package/src/draft.ts +4 -0
  13. package/src/error-projection.ts +51 -0
  14. package/src/errors.ts +192 -39
  15. package/src/execute.ts +443 -44
  16. package/src/fire.ts +965 -91
  17. package/src/index.ts +285 -38
  18. package/src/layer-projection.ts +192 -0
  19. package/src/layer.ts +32 -1
  20. package/src/observe.ts +361 -0
  21. package/src/permits.ts +12 -0
  22. package/src/redaction/patterns.ts +6 -3
  23. package/src/resilience.ts +8 -8
  24. package/src/resource-config.ts +477 -44
  25. package/src/resource.ts +21 -1
  26. package/src/result.ts +18 -0
  27. package/src/run.ts +2 -2
  28. package/src/schedule-runtime.ts +689 -0
  29. package/src/schedule.ts +324 -0
  30. package/src/serialization.ts +90 -57
  31. package/src/signal-diagnostics.ts +633 -0
  32. package/src/{internal/signal-ref.ts → signal-ref.ts} +1 -1
  33. package/src/signal.ts +37 -0
  34. package/src/store/accessor-protocol.ts +5 -5
  35. package/src/structured-examples.ts +245 -0
  36. package/src/surface-derivation.ts +91 -0
  37. package/src/surface-filter.ts +7 -13
  38. package/src/topo.ts +386 -6
  39. package/src/tracing.ts +345 -0
  40. package/src/trail.ts +168 -22
  41. package/src/trails/derive-trail.ts +1 -1
  42. package/src/trails/ingest.ts +7 -15
  43. package/src/{internal/trails-db.ts → trails-db.ts} +42 -21
  44. package/src/transport-error-map.ts +146 -28
  45. package/src/types.ts +82 -28
  46. package/src/validate-established-topo.ts +6 -0
  47. package/src/validate-topo.ts +212 -5
  48. package/src/validation.ts +58 -1
  49. package/src/webhook.ts +276 -0
  50. package/src/{internal/zod-wrappers.ts → zod-wrappers.ts} +0 -6
  51. package/.turbo/turbo-build.log +0 -1
  52. package/.turbo/turbo-lint.log +0 -3
  53. package/.turbo/turbo-typecheck.log +0 -1
  54. package/dist/blob-ref.d.ts +0 -20
  55. package/dist/blob-ref.d.ts.map +0 -1
  56. package/dist/blob-ref.js +0 -22
  57. package/dist/blob-ref.js.map +0 -1
  58. package/dist/branded.d.ts +0 -36
  59. package/dist/branded.d.ts.map +0 -1
  60. package/dist/branded.js +0 -89
  61. package/dist/branded.js.map +0 -1
  62. package/dist/collections.d.ts +0 -31
  63. package/dist/collections.d.ts.map +0 -1
  64. package/dist/collections.js +0 -60
  65. package/dist/collections.js.map +0 -1
  66. package/dist/context.d.ts +0 -22
  67. package/dist/context.d.ts.map +0 -1
  68. package/dist/context.js +0 -37
  69. package/dist/context.js.map +0 -1
  70. package/dist/contour.d.ts +0 -81
  71. package/dist/contour.d.ts.map +0 -1
  72. package/dist/contour.js +0 -176
  73. package/dist/contour.js.map +0 -1
  74. package/dist/cross-schema.d.ts +0 -18
  75. package/dist/cross-schema.d.ts.map +0 -1
  76. package/dist/cross-schema.js +0 -29
  77. package/dist/cross-schema.js.map +0 -1
  78. package/dist/derive.d.ts +0 -44
  79. package/dist/derive.d.ts.map +0 -1
  80. package/dist/derive.js +0 -149
  81. package/dist/derive.js.map +0 -1
  82. package/dist/draft.d.ts +0 -28
  83. package/dist/draft.d.ts.map +0 -1
  84. package/dist/draft.js +0 -157
  85. package/dist/draft.js.map +0 -1
  86. package/dist/errors.d.ts +0 -141
  87. package/dist/errors.d.ts.map +0 -1
  88. package/dist/errors.js +0 -185
  89. package/dist/errors.js.map +0 -1
  90. package/dist/execute.d.ts +0 -52
  91. package/dist/execute.d.ts.map +0 -1
  92. package/dist/execute.js +0 -511
  93. package/dist/execute.js.map +0 -1
  94. package/dist/fetch.d.ts +0 -15
  95. package/dist/fetch.d.ts.map +0 -1
  96. package/dist/fetch.js +0 -102
  97. package/dist/fetch.js.map +0 -1
  98. package/dist/fire.d.ts +0 -43
  99. package/dist/fire.d.ts.map +0 -1
  100. package/dist/fire.js +0 -185
  101. package/dist/fire.js.map +0 -1
  102. package/dist/guards.d.ts +0 -17
  103. package/dist/guards.d.ts.map +0 -1
  104. package/dist/guards.js +0 -25
  105. package/dist/guards.js.map +0 -1
  106. package/dist/index.d.ts +0 -59
  107. package/dist/index.d.ts.map +0 -1
  108. package/dist/index.js +0 -61
  109. package/dist/index.js.map +0 -1
  110. package/dist/internal/cross-batch.d.ts +0 -44
  111. package/dist/internal/cross-batch.d.ts.map +0 -1
  112. package/dist/internal/cross-batch.js +0 -58
  113. package/dist/internal/cross-batch.js.map +0 -1
  114. package/dist/internal/fork-ctx.d.ts +0 -41
  115. package/dist/internal/fork-ctx.d.ts.map +0 -1
  116. package/dist/internal/fork-ctx.js +0 -47
  117. package/dist/internal/fork-ctx.js.map +0 -1
  118. package/dist/internal/signal-ref.d.ts +0 -15
  119. package/dist/internal/signal-ref.d.ts.map +0 -1
  120. package/dist/internal/signal-ref.js +0 -41
  121. package/dist/internal/signal-ref.js.map +0 -1
  122. package/dist/internal/topo-saves.d.ts +0 -53
  123. package/dist/internal/topo-saves.d.ts.map +0 -1
  124. package/dist/internal/topo-saves.js +0 -449
  125. package/dist/internal/topo-saves.js.map +0 -1
  126. package/dist/internal/topo-snapshots.d.ts +0 -57
  127. package/dist/internal/topo-snapshots.d.ts.map +0 -1
  128. package/dist/internal/topo-snapshots.js +0 -372
  129. package/dist/internal/topo-snapshots.js.map +0 -1
  130. package/dist/internal/topo-store-read.d.ts +0 -70
  131. package/dist/internal/topo-store-read.d.ts.map +0 -1
  132. package/dist/internal/topo-store-read.js +0 -221
  133. package/dist/internal/topo-store-read.js.map +0 -1
  134. package/dist/internal/topo-store.d.ts +0 -26
  135. package/dist/internal/topo-store.d.ts.map +0 -1
  136. package/dist/internal/topo-store.js +0 -621
  137. package/dist/internal/topo-store.js.map +0 -1
  138. package/dist/internal/tracing.d.ts +0 -98
  139. package/dist/internal/tracing.d.ts.map +0 -1
  140. package/dist/internal/tracing.js +0 -102
  141. package/dist/internal/tracing.js.map +0 -1
  142. package/dist/internal/trails-db.d.ts +0 -16
  143. package/dist/internal/trails-db.d.ts.map +0 -1
  144. package/dist/internal/trails-db.js +0 -118
  145. package/dist/internal/trails-db.js.map +0 -1
  146. package/dist/internal/zod-wrappers.d.ts +0 -40
  147. package/dist/internal/zod-wrappers.d.ts.map +0 -1
  148. package/dist/internal/zod-wrappers.js +0 -59
  149. package/dist/internal/zod-wrappers.js.map +0 -1
  150. package/dist/layer.d.ts +0 -23
  151. package/dist/layer.d.ts.map +0 -1
  152. package/dist/layer.js +0 -21
  153. package/dist/layer.js.map +0 -1
  154. package/dist/path-security.d.ts +0 -28
  155. package/dist/path-security.d.ts.map +0 -1
  156. package/dist/path-security.js +0 -63
  157. package/dist/path-security.js.map +0 -1
  158. package/dist/patterns/bulk.d.ts +0 -15
  159. package/dist/patterns/bulk.d.ts.map +0 -1
  160. package/dist/patterns/bulk.js +0 -14
  161. package/dist/patterns/bulk.js.map +0 -1
  162. package/dist/patterns/change.d.ts +0 -10
  163. package/dist/patterns/change.d.ts.map +0 -1
  164. package/dist/patterns/change.js +0 -10
  165. package/dist/patterns/change.js.map +0 -1
  166. package/dist/patterns/date-range.d.ts +0 -10
  167. package/dist/patterns/date-range.d.ts.map +0 -1
  168. package/dist/patterns/date-range.js +0 -10
  169. package/dist/patterns/date-range.js.map +0 -1
  170. package/dist/patterns/index.d.ts +0 -9
  171. package/dist/patterns/index.d.ts.map +0 -1
  172. package/dist/patterns/index.js +0 -9
  173. package/dist/patterns/index.js.map +0 -1
  174. package/dist/patterns/pagination.d.ts +0 -18
  175. package/dist/patterns/pagination.d.ts.map +0 -1
  176. package/dist/patterns/pagination.js +0 -18
  177. package/dist/patterns/pagination.js.map +0 -1
  178. package/dist/patterns/progress.d.ts +0 -11
  179. package/dist/patterns/progress.d.ts.map +0 -1
  180. package/dist/patterns/progress.js +0 -11
  181. package/dist/patterns/progress.js.map +0 -1
  182. package/dist/patterns/sorting.d.ts +0 -13
  183. package/dist/patterns/sorting.d.ts.map +0 -1
  184. package/dist/patterns/sorting.js +0 -10
  185. package/dist/patterns/sorting.js.map +0 -1
  186. package/dist/patterns/status.d.ts +0 -15
  187. package/dist/patterns/status.d.ts.map +0 -1
  188. package/dist/patterns/status.js +0 -9
  189. package/dist/patterns/status.js.map +0 -1
  190. package/dist/patterns/timestamps.d.ts +0 -10
  191. package/dist/patterns/timestamps.d.ts.map +0 -1
  192. package/dist/patterns/timestamps.js +0 -10
  193. package/dist/patterns/timestamps.js.map +0 -1
  194. package/dist/redaction/index.d.ts +0 -4
  195. package/dist/redaction/index.d.ts.map +0 -1
  196. package/dist/redaction/index.js +0 -3
  197. package/dist/redaction/index.js.map +0 -1
  198. package/dist/redaction/patterns.d.ts +0 -9
  199. package/dist/redaction/patterns.d.ts.map +0 -1
  200. package/dist/redaction/patterns.js +0 -39
  201. package/dist/redaction/patterns.js.map +0 -1
  202. package/dist/redaction/redactor.d.ts +0 -27
  203. package/dist/redaction/redactor.d.ts.map +0 -1
  204. package/dist/redaction/redactor.js +0 -89
  205. package/dist/redaction/redactor.js.map +0 -1
  206. package/dist/resilience.d.ts +0 -34
  207. package/dist/resilience.d.ts.map +0 -1
  208. package/dist/resilience.js +0 -164
  209. package/dist/resilience.js.map +0 -1
  210. package/dist/resource-config.d.ts +0 -22
  211. package/dist/resource-config.d.ts.map +0 -1
  212. package/dist/resource-config.js +0 -210
  213. package/dist/resource-config.js.map +0 -1
  214. package/dist/resource.d.ts +0 -74
  215. package/dist/resource.d.ts.map +0 -1
  216. package/dist/resource.js +0 -61
  217. package/dist/resource.js.map +0 -1
  218. package/dist/result.d.ts +0 -57
  219. package/dist/result.d.ts.map +0 -1
  220. package/dist/result.js +0 -156
  221. package/dist/result.js.map +0 -1
  222. package/dist/run.d.ts +0 -28
  223. package/dist/run.d.ts.map +0 -1
  224. package/dist/run.js +0 -35
  225. package/dist/run.js.map +0 -1
  226. package/dist/serialization.d.ts +0 -27
  227. package/dist/serialization.d.ts.map +0 -1
  228. package/dist/serialization.js +0 -154
  229. package/dist/serialization.js.map +0 -1
  230. package/dist/signal.d.ts +0 -33
  231. package/dist/signal.d.ts.map +0 -1
  232. package/dist/signal.js +0 -17
  233. package/dist/signal.js.map +0 -1
  234. package/dist/store/accessor-protocol.d.ts +0 -51
  235. package/dist/store/accessor-protocol.d.ts.map +0 -1
  236. package/dist/store/accessor-protocol.js +0 -2
  237. package/dist/store/accessor-protocol.js.map +0 -1
  238. package/dist/store/index.d.ts +0 -2
  239. package/dist/store/index.d.ts.map +0 -1
  240. package/dist/store/index.js +0 -2
  241. package/dist/store/index.js.map +0 -1
  242. package/dist/surface-filter.d.ts +0 -13
  243. package/dist/surface-filter.d.ts.map +0 -1
  244. package/dist/surface-filter.js +0 -76
  245. package/dist/surface-filter.js.map +0 -1
  246. package/dist/topo-store.d.ts +0 -62
  247. package/dist/topo-store.d.ts.map +0 -1
  248. package/dist/topo-store.js +0 -319
  249. package/dist/topo-store.js.map +0 -1
  250. package/dist/topo.d.ts +0 -39
  251. package/dist/topo.d.ts.map +0 -1
  252. package/dist/topo.js +0 -241
  253. package/dist/topo.js.map +0 -1
  254. package/dist/trail.d.ts +0 -163
  255. package/dist/trail.d.ts.map +0 -1
  256. package/dist/trail.js +0 -75
  257. package/dist/trail.js.map +0 -1
  258. package/dist/trails/derive-trail.d.ts +0 -66
  259. package/dist/trails/derive-trail.d.ts.map +0 -1
  260. package/dist/trails/derive-trail.js +0 -378
  261. package/dist/trails/derive-trail.js.map +0 -1
  262. package/dist/trails/index.d.ts +0 -5
  263. package/dist/trails/index.d.ts.map +0 -1
  264. package/dist/trails/index.js +0 -3
  265. package/dist/trails/index.js.map +0 -1
  266. package/dist/trails/ingest.d.ts +0 -24
  267. package/dist/trails/ingest.d.ts.map +0 -1
  268. package/dist/trails/ingest.js +0 -63
  269. package/dist/trails/ingest.js.map +0 -1
  270. package/dist/transport-error-map.d.ts +0 -106
  271. package/dist/transport-error-map.d.ts.map +0 -1
  272. package/dist/transport-error-map.js +0 -24
  273. package/dist/transport-error-map.js.map +0 -1
  274. package/dist/type-checks.test-d.d.ts +0 -71
  275. package/dist/type-checks.test-d.d.ts.map +0 -1
  276. package/dist/type-checks.test-d.js +0 -12
  277. package/dist/type-checks.test-d.js.map +0 -1
  278. package/dist/type-utils.d.ts +0 -33
  279. package/dist/type-utils.d.ts.map +0 -1
  280. package/dist/type-utils.js +0 -12
  281. package/dist/type-utils.js.map +0 -1
  282. package/dist/types.d.ts +0 -177
  283. package/dist/types.d.ts.map +0 -1
  284. package/dist/types.js +0 -3
  285. package/dist/types.js.map +0 -1
  286. package/dist/validate-established-topo.d.ts +0 -76
  287. package/dist/validate-established-topo.d.ts.map +0 -1
  288. package/dist/validate-established-topo.js +0 -43
  289. package/dist/validate-established-topo.js.map +0 -1
  290. package/dist/validate-topo.d.ts +0 -24
  291. package/dist/validate-topo.d.ts.map +0 -1
  292. package/dist/validate-topo.js +0 -193
  293. package/dist/validate-topo.js.map +0 -1
  294. package/dist/validation.d.ts +0 -27
  295. package/dist/validation.d.ts.map +0 -1
  296. package/dist/validation.js +0 -165
  297. package/dist/validation.js.map +0 -1
  298. package/dist/workspace.d.ts +0 -25
  299. package/dist/workspace.d.ts.map +0 -1
  300. package/dist/workspace.js +0 -57
  301. package/dist/workspace.js.map +0 -1
  302. package/src/__tests__/blob-ref.test.ts +0 -103
  303. package/src/__tests__/branded.test.ts +0 -148
  304. package/src/__tests__/collections.test.ts +0 -126
  305. package/src/__tests__/context.test.ts +0 -77
  306. package/src/__tests__/contour.test.ts +0 -263
  307. package/src/__tests__/derive-trail.test.ts +0 -668
  308. package/src/__tests__/derive.test.ts +0 -260
  309. package/src/__tests__/errors.test.ts +0 -427
  310. package/src/__tests__/execute.test.ts +0 -1563
  311. package/src/__tests__/fetch.test.ts +0 -217
  312. package/src/__tests__/fire.test.ts +0 -1056
  313. package/src/__tests__/fork-ctx.test.ts +0 -83
  314. package/src/__tests__/guards.test.ts +0 -102
  315. package/src/__tests__/ingest.test.ts +0 -191
  316. package/src/__tests__/layer.test.ts +0 -125
  317. package/src/__tests__/path-security.test.ts +0 -114
  318. package/src/__tests__/patterns.test.ts +0 -273
  319. package/src/__tests__/redaction.test.ts +0 -244
  320. package/src/__tests__/resilience.test.ts +0 -246
  321. package/src/__tests__/resource.test.ts +0 -204
  322. package/src/__tests__/result.test.ts +0 -155
  323. package/src/__tests__/run.test.ts +0 -181
  324. package/src/__tests__/serialization.test.ts +0 -401
  325. package/src/__tests__/service-config.test.ts +0 -224
  326. package/src/__tests__/signal.test.ts +0 -82
  327. package/src/__tests__/surface-filter.test.ts +0 -196
  328. package/src/__tests__/topo-store-read.test.ts +0 -256
  329. package/src/__tests__/topo-store.test.ts +0 -869
  330. package/src/__tests__/topo.test.ts +0 -573
  331. package/src/__tests__/trail-permit.test.ts +0 -60
  332. package/src/__tests__/trail.test.ts +0 -426
  333. package/src/__tests__/trails-db.test.ts +0 -198
  334. package/src/__tests__/transport-error-map.test.ts +0 -82
  335. package/src/__tests__/type-utils.test.ts +0 -118
  336. package/src/__tests__/validate-topo.test.ts +0 -611
  337. package/src/__tests__/validation.test.ts +0 -336
  338. package/src/__tests__/workspace.test.ts +0 -183
  339. package/src/__tests__/zod-wrappers.test.ts +0 -62
  340. package/src/internal/topo-snapshots.ts +0 -517
  341. package/src/internal/topo-store-read.ts +0 -481
  342. package/src/internal/topo-store.ts +0 -1192
  343. package/src/internal/tracing.ts +0 -187
  344. package/src/topo-store.ts +0 -510
  345. package/src/type-checks.test-d.ts +0 -106
  346. package/tsconfig.json +0 -9
  347. package/tsconfig.tests.json +0 -10
  348. package/tsconfig.tsbuildinfo +0 -1
package/dist/fet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IAAI,GAAG,EAAE,CAAC;QAC3B,OAAO,IAAI,aAAa,CAAC,iBAAiB,QAAQ,CAAC,MAAM,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,cAAc,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAC5B,KAA6B,EAC7B,IAAkB,EACgB,EAAE;IACpC,IAAI,QAAkB,CAAC;IAEvB,IAAI,CAAC;QACH,QAAQ,GAAG,MAAM,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,QAAQ,CAAC,EAAE,EAAE,CAAC;QAChB,OAAO,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC7C,CAAC,CAAC"}
package/dist/fire.d.ts DELETED
@@ -1,43 +0,0 @@
1
- /**
2
- * Signal emission and auto-activation.
3
- *
4
- * `createFireFn(topo, producerCtx?, executor)` returns a `FireFn` bound to
5
- * a topo. Calling `fire(signalId, payload)` looks up the signal, validates
6
- * the payload against its schema, finds every trail with the signal in its
7
- * `on:` array, and invokes each consumer via the supplied executor.
8
- *
9
- * The `executor` parameter is an indirection that lets `execute.ts` pass in
10
- * `executeTrail` without `fire.ts` importing it directly — keeping the two
11
- * modules dependency-cycle-free.
12
- *
13
- * Consumer contexts inherit the producer's full ctx (logger, extensions,
14
- * resources, abortSignal, requestId, env, workspaceRoot, permit) with
15
- * `fire` rebound to the same closure so consumers can fan out further.
16
- * Each consumer gets its own derived context so sibling fan-out branches do
17
- * not share mutable top-level state. The consumer logger is derived from the
18
- * producer logger as a child tagged with `signalId` and `consumerId` when
19
- * `logger.child` exists.
20
- *
21
- * Error semantics match the fire-and-forget framing: producers get
22
- * `Result.ok(undefined)` unless the signal id is unknown or the payload
23
- * fails schema validation. Consumer errors are logged via the producer's
24
- * logger but do NOT propagate back to the producer. Consumers that need
25
- * transactional coupling should use `crosses:`.
26
- */
27
- import { Result } from './result.js';
28
- import type { Topo } from './topo.js';
29
- import type { AnyTrail } from './trail.js';
30
- import type { FireFn, TrailContextInit } from './types.js';
31
- /** Signature execute.ts passes in to avoid a fire ↔ execute import cycle. */
32
- export type ConsumerExecutor = (consumer: AnyTrail, input: unknown, ctx: Partial<TrailContextInit>) => Promise<Result<unknown, Error>>;
33
- /**
34
- * Build a `FireFn` closure bound to a topo.
35
- *
36
- * When `producerCtx` is provided, consumer trails activated via `on:`
37
- * inherit the producer's logger, extensions, resources, abortSignal,
38
- * requestId, env, workspaceRoot, and permit. `ctx.fire` on the consumer
39
- * is rebound to the same closure so consumers can emit downstream
40
- * signals naturally.
41
- */
42
- export declare const createFireFn: (topo: Topo, producerCtx: TrailContextInit | undefined, executor: ConsumerExecutor) => FireFn;
43
- //# sourceMappingURL=fire.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fire.d.ts","sourceRoot":"","sources":["../src/fire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAU,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnE,6EAA6E;AAC7E,MAAM,MAAM,gBAAgB,GAAG,CAC7B,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,OAAO,CAAC,gBAAgB,CAAC,KAC3B,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAyKrC;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GACvB,MAAM,IAAI,EACV,aAAa,gBAAgB,GAAG,SAAS,EACzC,UAAU,gBAAgB,KACzB,MAyEF,CAAC"}
package/dist/fire.js DELETED
@@ -1,185 +0,0 @@
1
- /**
2
- * Signal emission and auto-activation.
3
- *
4
- * `createFireFn(topo, producerCtx?, executor)` returns a `FireFn` bound to
5
- * a topo. Calling `fire(signalId, payload)` looks up the signal, validates
6
- * the payload against its schema, finds every trail with the signal in its
7
- * `on:` array, and invokes each consumer via the supplied executor.
8
- *
9
- * The `executor` parameter is an indirection that lets `execute.ts` pass in
10
- * `executeTrail` without `fire.ts` importing it directly — keeping the two
11
- * modules dependency-cycle-free.
12
- *
13
- * Consumer contexts inherit the producer's full ctx (logger, extensions,
14
- * resources, abortSignal, requestId, env, workspaceRoot, permit) with
15
- * `fire` rebound to the same closure so consumers can fan out further.
16
- * Each consumer gets its own derived context so sibling fan-out branches do
17
- * not share mutable top-level state. The consumer logger is derived from the
18
- * producer logger as a child tagged with `signalId` and `consumerId` when
19
- * `logger.child` exists.
20
- *
21
- * Error semantics match the fire-and-forget framing: producers get
22
- * `Result.ok(undefined)` unless the signal id is unknown or the payload
23
- * fails schema validation. Consumer errors are logged via the producer's
24
- * logger but do NOT propagate back to the producer. Consumers that need
25
- * transactional coupling should use `crosses:`.
26
- */
27
- import { NotFoundError, ValidationError } from './errors.js';
28
- import { forkCtx } from './internal/fork-ctx.js';
29
- import { Result } from './result.js';
30
- const FIRE_STACK_KEY = '__trails_fire_stack';
31
- /**
32
- * Maximum depth for signal fan-out chains.
33
- *
34
- * Cycle detection catches re-entrant fires of the same signal ID (A→B→A),
35
- * but a chain of distinct signals (A→B→C→D→...) bypasses it. This limit
36
- * prevents runaway fan-out in pathological topologies.
37
- */
38
- const MAX_FIRE_DEPTH = 16;
39
- const getFireStack = (ctx) => {
40
- const value = ctx?.extensions?.[FIRE_STACK_KEY];
41
- return Array.isArray(value) ? value : [];
42
- };
43
- const deriveConsumerLogger = (producerCtx, signalId, consumerId) => producerCtx?.logger?.child?.({ consumerId, signalId }) ?? producerCtx?.logger;
44
- const deriveConsumerEnv = (producerCtx) => producerCtx?.env ? { ...producerCtx.env } : undefined;
45
- const deriveConsumerExtensions = (producerCtx, signalId) => ({
46
- ...producerCtx?.extensions,
47
- [FIRE_STACK_KEY]: [...getFireStack(producerCtx), signalId],
48
- });
49
- const deriveConsumerCtx = (producerCtx, signalId, consumerId) => producerCtx
50
- ? forkCtx(producerCtx, {
51
- env: deriveConsumerEnv(producerCtx),
52
- extensions: deriveConsumerExtensions(producerCtx, signalId),
53
- logger: deriveConsumerLogger(producerCtx, signalId, consumerId),
54
- })
55
- : {};
56
- /**
57
- * Fan out a validated signal payload to its consumer trails.
58
- *
59
- * @remarks
60
- * Consumers fan out in parallel by design. Signal delivery is fire-and-forget
61
- * notification, not ordered orchestration; if one consumer depends on another,
62
- * the dependency belongs in `crosses:` instead of sibling signal sequencing.
63
- *
64
- * `Promise.allSettled` preserves failure isolation and waits for every branch
65
- * to settle. Each consumer gets its own derived context so sibling branches do
66
- * not share mutable top-level state while they overlap. Re-entrant suppression
67
- * elsewhere in this module is still based on signal-id membership in the
68
- * current fire stack: it prevents infinite loops, but it can over-suppress
69
- * legitimate diamond re-fires. Per-path provenance is a documented future
70
- * direction rather than part of the pre-v1 runtime contract.
71
- */
72
- const fanOutToConsumers = async (consumers, payload, signalId, producerCtx, bindFire, executor, logger) => {
73
- const settled = await Promise.allSettled(consumers.map(async (consumer) => {
74
- const consumerCtx = bindFire(deriveConsumerCtx(producerCtx, signalId, consumer.id));
75
- const consumerResult = await executor(consumer, payload, consumerCtx);
76
- if (consumerResult.isErr()) {
77
- (consumerCtx.logger ?? logger)?.warn('Signal consumer failed', {
78
- consumerId: consumer.id,
79
- error: consumerResult.error.message,
80
- signalId,
81
- });
82
- }
83
- return consumer.id;
84
- }));
85
- for (const [index, entry] of settled.entries()) {
86
- if (entry.status !== 'rejected') {
87
- continue;
88
- }
89
- // `executeTrail` normalizes throws into `Result.err`, so reaching this
90
- // branch means the executor (or the warn call above) rejected
91
- // unexpectedly. Log at debug to preserve provenance without propagating
92
- // the failure to the producer (fire-and-forget semantics).
93
- logger?.debug('Signal consumer rejected unexpectedly', {
94
- consumerId: consumers[index]?.id,
95
- error: entry.reason instanceof Error
96
- ? entry.reason.message
97
- : String(entry.reason),
98
- signalId,
99
- });
100
- }
101
- };
102
- const resolveFireDispatch = (topo, signalId, payload) => {
103
- const signal = topo.signals.get(signalId);
104
- if (signal === undefined) {
105
- return Result.err(new NotFoundError(`Signal "${signalId}" not found in topo "${topo.name}"`));
106
- }
107
- const parsed = signal.payload.safeParse(payload);
108
- if (!parsed.success) {
109
- return Result.err(new ValidationError(`Invalid payload for signal "${signalId}": ${parsed.error.message}`));
110
- }
111
- return Result.ok({
112
- consumers: topo.list().filter((trail) => trail.on.includes(signalId)),
113
- payload: parsed.data,
114
- });
115
- };
116
- const resolveSignalId = (signalOrId) => {
117
- if (typeof signalOrId === 'string') {
118
- return Result.ok(signalOrId);
119
- }
120
- if (typeof signalOrId === 'object' &&
121
- signalOrId !== null &&
122
- 'id' in signalOrId &&
123
- typeof signalOrId.id === 'string') {
124
- return Result.ok(signalOrId.id);
125
- }
126
- return Result.err(new ValidationError('ctx.fire() requires a signal id string or a Signal value'));
127
- };
128
- /**
129
- * Build a `FireFn` closure bound to a topo.
130
- *
131
- * When `producerCtx` is provided, consumer trails activated via `on:`
132
- * inherit the producer's logger, extensions, resources, abortSignal,
133
- * requestId, env, workspaceRoot, and permit. `ctx.fire` on the consumer
134
- * is rebound to the same closure so consumers can emit downstream
135
- * signals naturally.
136
- */
137
- export const createFireFn = (topo, producerCtx, executor) => {
138
- const bindConsumerFire = (consumerCtx) => ({
139
- ...consumerCtx,
140
- // Pre-bind fire on the consumer ctx as a safety net for direct
141
- // executeTrail calls that skip the topo-aware path. In the normal
142
- // fan-out flow below, bindFireToCtx in execute.ts rebinds fire to
143
- // the fully-traced ctx before the blaze runs, so this assignment
144
- // is superseded — but keeping it makes consumerCtx self-sufficient
145
- // for any caller that inspects it pre-execution.
146
- fire: createFireFn(topo, consumerCtx, executor),
147
- });
148
- const dispatchFire = async (signalId, payload) => {
149
- const dispatch = resolveFireDispatch(topo, signalId, payload);
150
- if (dispatch.isErr()) {
151
- return Result.err(dispatch.error);
152
- }
153
- await fanOutToConsumers(dispatch.value.consumers, dispatch.value.payload, signalId, producerCtx, bindConsumerFire, executor, producerCtx?.logger);
154
- return Result.ok();
155
- };
156
- /** Return an early Result if the fire should be suppressed, or null to proceed. */
157
- const guardFire = (signalId, stack) => {
158
- if (stack.length >= MAX_FIRE_DEPTH) {
159
- producerCtx?.logger?.warn('Signal fan-out depth limit reached — skipping fire', { depth: stack.length, signalId });
160
- return Result.ok();
161
- }
162
- if (stack.includes(signalId)) {
163
- producerCtx?.logger?.debug('Signal fan-out suppressed due to cycle', {
164
- fireStack: [...stack],
165
- signalId,
166
- });
167
- producerCtx?.logger?.warn('Signal cycle detected — skipping re-entrant fire', { fireStack: [...stack], signalId });
168
- return Result.ok();
169
- }
170
- return null;
171
- };
172
- const fireImpl = async (signalOrId, payload) => {
173
- const resolved = resolveSignalId(signalOrId);
174
- if (resolved.isErr()) {
175
- return Result.err(resolved.error);
176
- }
177
- const suppressed = guardFire(resolved.value, getFireStack(producerCtx));
178
- if (suppressed) {
179
- return suppressed;
180
- }
181
- return await dispatchFire(resolved.value, payload);
182
- };
183
- return fireImpl;
184
- };
185
- //# sourceMappingURL=fire.js.map
package/dist/fire.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"fire.js","sourceRoot":"","sources":["../src/fire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;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,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC,CAAC;IACF,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC"}
package/dist/guards.d.ts DELETED
@@ -1,17 +0,0 @@
1
- /**
2
- * Type guards and assertion helpers for @ontrails/core.
3
- */
4
- /** Narrows `T | null | undefined` to `T`. */
5
- export declare const isDefined: <T>(value?: T | null | undefined) => value is T;
6
- /** Returns true when `value` is a string with length > 0. */
7
- export declare const isNonEmptyString: (value?: unknown) => value is string;
8
- /** Returns true when `value` is a plain object (not an array, Date, etc.). */
9
- export declare const isPlainObject: (value: unknown) => value is Record<string, unknown>;
10
- /** Checks that `obj` is an object with the given key present. */
11
- export declare const hasProperty: <K extends string>(obj: unknown, key: K) => obj is Record<K, unknown>;
12
- /**
13
- * Exhaustive switch helper. Place in the `default` branch to get a compile
14
- * error when a union case is unhandled.
15
- */
16
- export declare const assertNever: (value: never) => never;
17
- //# sourceMappingURL=guards.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../src/guards.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,6CAA6C;AAC7C,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,QAAQ,CAAC,GAAG,IAAI,GAAG,SAAS,KAAG,KAAK,IAAI,CAC9B,CAAC;AAExC,6DAA6D;AAC7D,eAAO,MAAM,gBAAgB,GAAI,QAAQ,OAAO,KAAG,KAAK,IAAI,MACb,CAAC;AAEhD,8EAA8E;AAC9E,eAAO,MAAM,aAAa,GACxB,OAAO,OAAO,KACb,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAMjC,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,MAAM,EAC1C,KAAK,OAAO,EACZ,KAAK,CAAC,KACL,GAAG,IAAI,MAAM,CAAC,CAAC,EAAE,OAAO,CAC4B,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,KAAK,KAAG,KAE1C,CAAC"}
package/dist/guards.js DELETED
@@ -1,25 +0,0 @@
1
- /**
2
- * Type guards and assertion helpers for @ontrails/core.
3
- */
4
- /** Narrows `T | null | undefined` to `T`. */
5
- export const isDefined = (value) => value !== null && value !== undefined;
6
- /** Returns true when `value` is a string with length > 0. */
7
- export const isNonEmptyString = (value) => typeof value === 'string' && value.length > 0;
8
- /** Returns true when `value` is a plain object (not an array, Date, etc.). */
9
- export const isPlainObject = (value) => {
10
- if (typeof value !== 'object' || value === null) {
11
- return false;
12
- }
13
- const proto = Object.getPrototypeOf(value);
14
- return proto === Object.prototype || proto === null;
15
- };
16
- /** Checks that `obj` is an object with the given key present. */
17
- export const hasProperty = (obj, key) => typeof obj === 'object' && obj !== null && key in obj;
18
- /**
19
- * Exhaustive switch helper. Place in the `default` branch to get a compile
20
- * error when a union case is unhandled.
21
- */
22
- export const assertNever = (value) => {
23
- throw new Error(`Unexpected value: ${String(value)}`);
24
- };
25
- //# sourceMappingURL=guards.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"guards.js","sourceRoot":"","sources":["../src/guards.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,6CAA6C;AAC7C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAI,KAA4B,EAAc,EAAE,CACvE,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAExC,6DAA6D;AAC7D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAe,EAAmB,EAAE,CACnE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AAEhD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,KAAc,EACoB,EAAE;IACpC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAY,CAAC;IACtD,OAAO,KAAK,KAAK,MAAM,CAAC,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC;AACtD,CAAC,CAAC;AAEF,iEAAiE;AACjE,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,GAAY,EACZ,GAAM,EACqB,EAAE,CAC7B,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,CAAC;AAExD;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAY,EAAS,EAAE;IACjD,MAAM,IAAI,KAAK,CAAC,qBAAqB,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACxD,CAAC,CAAC"}
package/dist/index.d.ts DELETED
@@ -1,59 +0,0 @@
1
- export { Result } from './result.js';
2
- export { TrailsError, ValidationError, AmbiguousError, AssertionError, NotFoundError, AlreadyExistsError, ConflictError, PermissionError, TimeoutError, RateLimitError, NetworkError, InternalError, AuthError, CancelledError, DerivationError, errorCategories, exitCodeMap, statusCodeMap, jsonRpcCodeMap, retryableMap, RetryExhaustedError, isRetryable, isTrailsError, } from './errors.js';
3
- export type { ErrorCategory } from './errors.js';
4
- export { createTransportErrorMapper, mapTransportError, transportErrorMap, transportErrorRegistry, transportNames, } from './transport-error-map.js';
5
- export type { TransportErrorCode, TransportErrorMapper, TransportErrorMappings, TransportName, } from './transport-error-map.js';
6
- export type { Detour, DetourAttempt, Implementation, TrailContext, TrailContextInit, CrossBatchOptions, CrossFn, FireFn, BasePermit, PermitRequirement, ProgressCallback, ProgressEvent, Logger, ResourceLookup, } from './types.js';
7
- export { TRAILHEAD_KEY } from './types.js';
8
- export { createTrailContext, passthroughTrace } from './context.js';
9
- export { createResourceLookup, findDuplicateResourceId, isResource, resource, } from './resource.js';
10
- export type { AnyResource, Resource, ResourceContext, ResourceOverrideMap, ResourceSpec, } from './resource.js';
11
- export { trail } from './trail.js';
12
- export type { AnyTrail, BlazeInput, Intent, Trail, TrailSpec, TrailExample, TrailVisibility, } from './trail.js';
13
- export { filterSurfaceTrails, matchesTrailPattern, shouldIncludeTrailForSurface, } from './surface-filter.js';
14
- export type { SurfaceFilterOptions } from './surface-filter.js';
15
- export type { CrossInput, TrailInput, TrailOutput, TrailResult, } from './type-utils.js';
16
- export { inputOf, outputOf } from './type-utils.js';
17
- export { signal } from './signal.js';
18
- export type { AnySignal, Signal, SignalSpec } from './signal.js';
19
- export { contour } from './contour.js';
20
- export { CONTOUR_ID_METADATA, getContourIdMetadata, getContourReferences, } from './contour.js';
21
- export type { AnyContour, Contour, ContourIdBrand, ContourIdMetadata, ContourIdSchema, ContourIdValue, ContourOptions, ContourReference, } from './contour.js';
22
- export { topo } from './topo.js';
23
- export type { Topo, TopoIdentity } from './topo.js';
24
- export { createTopoSnapshot, createMockTopoStore, createTopoStore, listTopoSnapshots, pinTopoSnapshot, topoStore, unpinTopoSnapshot, } from './topo-store.js';
25
- export type { CreateTopoSnapshotInput, ListTopoSnapshotsOptions, MockTopoStoreSeed, ReadOnlyTopoStore, TopoSnapshot, TopoStoreExportRecord, TopoStoreResourceRecord, TopoStoreRef, TopoStoreTrailDetailRecord, TopoStoreTrailRecord, } from './topo-store.js';
26
- export { DRAFT_ID_PREFIX, deriveDraftReport, isDraftId, validateDraftFreeTopo, } from './draft.js';
27
- export type { DraftDependency, DraftDependencyKind, DraftFinding, DraftReport, } from './draft.js';
28
- export { validateTopo } from './validate-topo.js';
29
- export type { TopoIssue } from './validate-topo.js';
30
- export { validateEstablishedTopo } from './validate-established-topo.js';
31
- export { composeLayers } from './layer.js';
32
- export type { Layer } from './layer.js';
33
- export { deriveCliPath, deriveFields } from './derive.js';
34
- export type { Field, FieldOverride } from './derive.js';
35
- export { buildCrossValidationSchema } from './cross-schema.js';
36
- export { executeTrail } from './execute.js';
37
- export type { ExecuteTrailOptions } from './execute.js';
38
- export { clearTraceSink, createTraceRecord, getTraceContext, getTraceSink, NOOP_SINK, registerTraceSink, TRACE_CONTEXT_KEY, } from './internal/tracing.js';
39
- export type { TraceContext, TraceRecord, TraceSink, } from './internal/tracing.js';
40
- export type { TraceFn } from './types.js';
41
- export { run } from './run.js';
42
- export type { RunOptions } from './run.js';
43
- export { deriveTrail, ingest } from './trails/index.js';
44
- export type { DeriveTrailInput, DeriveTrailOperation, DeriveTrailOutput, DeriveTrailSpec, IngestOptions, IngestTransform, } from './trails/index.js';
45
- export { validateInput, validateOutput, formatZodIssues, zodToJsonSchema, } from './validation.js';
46
- export { serializeError, deserializeError } from './serialization.js';
47
- export type { SerializedError } from './serialization.js';
48
- export { retry, withTimeout, shouldRetry, deriveBackoffDelay, } from './resilience.js';
49
- export type { RetryOptions } from './resilience.js';
50
- export { brand, unbrand, uuid, email, nonEmptyString, positiveInt, shortId, deriveIdHash, } from './branded.js';
51
- export type { Branded, UUID, Email, NonEmptyString, PositiveInt, } from './branded.js';
52
- export { securePath, isPathSafe, deriveSafePath } from './path-security.js';
53
- export { findWorkspaceRoot, isInsideWorkspace, deriveRelativePath, } from './workspace.js';
54
- export { createBlobRef, isBlobRef } from './blob-ref.js';
55
- export type { BlobRef } from './blob-ref.js';
56
- export { isDefined, isNonEmptyString, isPlainObject, hasProperty, assertNever, } from './guards.js';
57
- export { chunk, dedupe, groupBy, sortBy, isNonEmptyArray, } from './collections.js';
58
- export type { NonEmptyArray, DeepPartial, Prettify, AtLeastOne, } from './collections.js';
59
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EACL,WAAW,EACX,eAAe,EACf,cAAc,EACd,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,aAAa,EACb,SAAS,EACT,cAAc,EACd,eA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AAO,EACP,IAAI,EACJ,KAAK,EACL,cAAc,EACd,WAAW,EACX,OAAO,EACP,YAAY,GACb,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,OAAO,EACP,IAAI,EACJ,KAAK,EACL,cAAc,EACd,WAAW,GACZ,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAG5E,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACzD,YAAY,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG7C,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,WAAW,GACZ,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,MAAM,EACN,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,aAAa,EACb,WAAW,EACX,QAAQ,EACR,UAAU,GACX,MAAM,kBAAkB,CAAC"}
package/dist/index.js DELETED
@@ -1,61 +0,0 @@
1
- // Result
2
- export { Result } from './result.js';
3
- // Errors
4
- export { TrailsError, ValidationError, AmbiguousError, AssertionError, NotFoundError, AlreadyExistsError, ConflictError, PermissionError, TimeoutError, RateLimitError, NetworkError, InternalError, AuthError, CancelledError, DerivationError, errorCategories, exitCodeMap, statusCodeMap, jsonRpcCodeMap, retryableMap, RetryExhaustedError, isRetryable, isTrailsError, } from './errors.js';
5
- export { createTransportErrorMapper, mapTransportError, transportErrorMap, transportErrorRegistry, transportNames, } from './transport-error-map.js';
6
- export { TRAILHEAD_KEY } from './types.js';
7
- // Context factory
8
- export { createTrailContext, passthroughTrace } from './context.js';
9
- // Resource
10
- export { createResourceLookup, findDuplicateResourceId, isResource, resource, } from './resource.js';
11
- // Trail
12
- export { trail } from './trail.js';
13
- export { filterSurfaceTrails, matchesTrailPattern, shouldIncludeTrailForSurface, } from './surface-filter.js';
14
- export { inputOf, outputOf } from './type-utils.js';
15
- // Signal
16
- export { signal } from './signal.js';
17
- // Contour
18
- export { contour } from './contour.js';
19
- export { CONTOUR_ID_METADATA, getContourIdMetadata, getContourReferences, } from './contour.js';
20
- // Topo
21
- export { topo } from './topo.js';
22
- export { createTopoSnapshot, createMockTopoStore, createTopoStore, listTopoSnapshots, pinTopoSnapshot, topoStore, unpinTopoSnapshot, } from './topo-store.js';
23
- // Draft state
24
- export { DRAFT_ID_PREFIX, deriveDraftReport, isDraftId, validateDraftFreeTopo, } from './draft.js';
25
- // Topo validation
26
- export { validateTopo } from './validate-topo.js';
27
- export { validateEstablishedTopo } from './validate-established-topo.js';
28
- // Layer
29
- export { composeLayers } from './layer.js';
30
- // Derive
31
- export { deriveCliPath, deriveFields } from './derive.js';
32
- // Cross schema
33
- export { buildCrossValidationSchema } from './cross-schema.js';
34
- // Execute
35
- export { executeTrail } from './execute.js';
36
- // Intrinsic tracing
37
- export { clearTraceSink, createTraceRecord, getTraceContext, getTraceSink, NOOP_SINK, registerTraceSink, TRACE_CONTEXT_KEY, } from './internal/tracing.js';
38
- // Run
39
- export { run } from './run.js';
40
- // Trail factories
41
- export { deriveTrail, ingest } from './trails/index.js';
42
- // Validation
43
- export { validateInput, validateOutput, formatZodIssues, zodToJsonSchema, } from './validation.js';
44
- // Serialization
45
- export { serializeError, deserializeError } from './serialization.js';
46
- // Resilience
47
- export { retry, withTimeout, shouldRetry, deriveBackoffDelay, } from './resilience.js';
48
- // Fetch — fromFetch is available as Result.fromFetch()
49
- // Branded types
50
- export { brand, unbrand, uuid, email, nonEmptyString, positiveInt, shortId, deriveIdHash, } from './branded.js';
51
- // Path Security
52
- export { securePath, isPathSafe, deriveSafePath } from './path-security.js';
53
- // Workspace
54
- export { findWorkspaceRoot, isInsideWorkspace, deriveRelativePath, } from './workspace.js';
55
- // Blob
56
- export { createBlobRef, isBlobRef } from './blob-ref.js';
57
- // Guards
58
- export { isDefined, isNonEmptyString, isPlainObject, hasProperty, assertNever, } from './guards.js';
59
- // Collections
60
- export { chunk, dedupe, groupBy, sortBy, isNonEmptyArray, } from './collections.js';
61
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,SAAS;AACT,OAAO,EACL,WAAW,EACX,eAAe,EACf,cAAc,EACd,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,aAAa,EACb,SAAS,EACT,cAAc,EACd,eAAe,EACf,eAAe,EACf,WAAW,EACX,aAAa,EACb,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,aAAa,GACd,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,0BAA0B,EAC1B,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,cAAc,GACf,MAAM,0BAA0B,CAAC;AAyBlC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,kBAAkB;AAClB,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEpE,WAAW;AACX,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,UAAU,EACV,QAAQ,GACT,MAAM,eAAe,CAAC;AASvB,QAAQ;AACR,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAUnC,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,4BAA4B,GAC7B,MAAM,qBAAqB,CAAC;AAU7B,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEpD,SAAS;AACT,OAAO,EAAE,MAAM,EAAE,MAAM,aA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BAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtE,aAAa;AACb,OAAO,EACL,KAAK,EACL,WAAW,EACX,WAAW,EACX,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAGzB,uDAAuD;AAEvD,gBAAgB;AAChB,OAAO,EACL,KAAK,EACL,OAAO,EACP,IAAI,EACJ,KAAK,EACL,cAAc,EACd,WAAW,EACX,OAAO,EACP,YAAY,GACb,MAAM,cAAc,CAAC;AAStB,gBAAgB;AAChB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE5E,YAAY;AACZ,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAExB,OAAO;AACP,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAGzD,SAAS;AACT,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,WAAW,GACZ,MAAM,aAAa,CAAC;AAErB,cAAc;AACd,OAAO,EACL,KAAK,EACL,MAAM,EACN,OAAO,EACP,MAAM,EACN,eAAe,GAChB,MAAM,kBAAkB,CAAC"}
@@ -1,44 +0,0 @@
1
- /**
2
- * Shared helpers for `ctx.cross([...])` batch execution.
3
- *
4
- * These helpers normalize batch options, produce validation results, and
5
- * implement the unlimited/limited worker-pool execution strategies used by
6
- * both the real executor (`packages/core/src/execute.ts`) and the scenario
7
- * runner in `@ontrails/testing`. Extracting them here keeps the validation
8
- * rule, error message, and worker-pool semantics authored in one place so
9
- * the two call sites cannot drift.
10
- *
11
- * @internal
12
- */
13
- import { Result } from '../result.js';
14
- import type { CrossBatchOptions } from '../types.js';
15
- /**
16
- * Validate the `concurrency` option on a batch `ctx.cross()` call.
17
- *
18
- * Returns `Ok(undefined)` when no limit is requested, `Ok(n)` when a
19
- * positive integer is supplied, and `Err(ValidationError)` for any other
20
- * value. The error message is load-bearing: callers and tests depend on
21
- * the exact string.
22
- *
23
- * @internal
24
- */
25
- export declare const normalizeCrossBatchConcurrency: (options: CrossBatchOptions | undefined) => Result<number | undefined, Error>;
26
- /**
27
- * Produce one validation-error result per call, preserving the original
28
- * call order. Used when `normalizeCrossBatchConcurrency` fails so the caller
29
- * can surface a uniform batch shape to the trail implementation.
30
- *
31
- * @internal
32
- */
33
- export declare const createCrossBatchValidationResults: <TCall>(calls: readonly TCall[], error: Error) => Result<unknown, Error>[];
34
- /**
35
- * Claim the next branch index from a shared counter. Safe to call from
36
- * multiple worker coroutines because JavaScript is single-threaded between
37
- * awaits — the read/increment pair runs without interleaving.
38
- *
39
- * @internal
40
- */
41
- export declare const claimNextCrossBatchIndex: <TCall>(nextIndex: {
42
- value: number;
43
- }, calls: readonly TCall[]) => number | undefined;
44
- //# sourceMappingURL=cross-batch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cross-batch.d.ts","sourceRoot":"","sources":["../../src/internal/cross-batch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD;;;;;;;;;GASG;AACH,eAAO,MAAM,8BAA8B,GACzC,SAAS,iBAAiB,GAAG,SAAS,KACrC,MAAM,CAAC,MAAM,GAAG,SAAS,EAAE,KAAK,CAelC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC,GAAI,KAAK,EACrD,OAAO,SAAS,KAAK,EAAE,EACvB,OAAO,KAAK,KACX,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,EAAwC,CAAC;AAElE;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GAAI,KAAK,EAC5C,WAAW;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EAC5B,OAAO,SAAS,KAAK,EAAE,KACtB,MAAM,GAAG,SAQX,CAAC"}
@@ -1,58 +0,0 @@
1
- /**
2
- * Shared helpers for `ctx.cross([...])` batch execution.
3
- *
4
- * These helpers normalize batch options, produce validation results, and
5
- * implement the unlimited/limited worker-pool execution strategies used by
6
- * both the real executor (`packages/core/src/execute.ts`) and the scenario
7
- * runner in `@ontrails/testing`. Extracting them here keeps the validation
8
- * rule, error message, and worker-pool semantics authored in one place so
9
- * the two call sites cannot drift.
10
- *
11
- * @internal
12
- */
13
- import { ValidationError } from '../errors.js';
14
- import { Result } from '../result.js';
15
- /**
16
- * Validate the `concurrency` option on a batch `ctx.cross()` call.
17
- *
18
- * Returns `Ok(undefined)` when no limit is requested, `Ok(n)` when a
19
- * positive integer is supplied, and `Err(ValidationError)` for any other
20
- * value. The error message is load-bearing: callers and tests depend on
21
- * the exact string.
22
- *
23
- * @internal
24
- */
25
- export const normalizeCrossBatchConcurrency = (options) => {
26
- const concurrency = options?.concurrency;
27
- if (concurrency === undefined) {
28
- return Result.ok();
29
- }
30
- if (!Number.isInteger(concurrency) || concurrency < 1) {
31
- return Result.err(new ValidationError('ctx.cross() batch concurrency must be a positive integer'));
32
- }
33
- return Result.ok(concurrency);
34
- };
35
- /**
36
- * Produce one validation-error result per call, preserving the original
37
- * call order. Used when `normalizeCrossBatchConcurrency` fails so the caller
38
- * can surface a uniform batch shape to the trail implementation.
39
- *
40
- * @internal
41
- */
42
- export const createCrossBatchValidationResults = (calls, error) => calls.map(() => Result.err(error));
43
- /**
44
- * Claim the next branch index from a shared counter. Safe to call from
45
- * multiple worker coroutines because JavaScript is single-threaded between
46
- * awaits — the read/increment pair runs without interleaving.
47
- *
48
- * @internal
49
- */
50
- export const claimNextCrossBatchIndex = (nextIndex, calls) => {
51
- if (nextIndex.value >= calls.length) {
52
- return undefined;
53
- }
54
- const branchIndex = nextIndex.value;
55
- nextIndex.value += 1;
56
- return branchIndex;
57
- };
58
- //# sourceMappingURL=cross-batch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cross-batch.js","sourceRoot":"","sources":["../../src/internal/cross-batch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAC5C,OAAsC,EACH,EAAE;IACrC,MAAM,WAAW,GAAG,OAAO,EAAE,WAAW,CAAC;IACzC,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,MAAM,CAAC,EAAE,EAAE,CAAC;IACrB,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;QACtD,OAAO,MAAM,CAAC,GAAG,CACf,IAAI,eAAe,CACjB,0DAA0D,CAC3D,CACF,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC;AAChC,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAC/C,KAAuB,EACvB,KAAY,EACc,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AAElE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,SAA4B,EAC5B,KAAuB,EACH,EAAE;IACtB,IAAI,SAAS,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACpC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,WAAW,GAAG,SAAS,CAAC,KAAK,CAAC;IACpC,SAAS,CAAC,KAAK,IAAI,CAAC,CAAC;IACrB,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC"}
@@ -1,41 +0,0 @@
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
- import type { TrailContext, TrailContextInit } from '../types.js';
24
- /** Keys cleared by default when forking a context. */
25
- export type ForkCtxResetKey = 'cross' | 'fire' | 'resource';
26
- /** Override fields callers are allowed to apply when forking a context. */
27
- export type ForkCtxOverrides = Readonly<Partial<Pick<TrailContext, 'env' | 'extensions' | 'logger'>>>;
28
- /**
29
- * Fork a parent context into a child context.
30
- *
31
- * Spreads the parent, clears each reset key to `undefined`, and applies the
32
- * supplied overrides last so callers may replace logger, env, and extensions
33
- * with branch-local values.
34
- *
35
- * The generic parameter is constrained to the minimal shape the helper
36
- * reads and writes. This lets the helper serve both `TrailContext`
37
- * (executor scope) and `Partial<TrailContextInit>` (fire-consumer scope)
38
- * without widening the public surface of either type.
39
- */
40
- export declare const forkCtx: <TCtx extends Partial<Pick<TrailContextInit, "cross" | "env" | "extensions" | "fire" | "logger" | "resource">>>(parentCtx: TCtx, overrides?: ForkCtxOverrides, reset?: readonly ForkCtxResetKey[]) => TCtx;
41
- //# sourceMappingURL=fork-ctx.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fork-ctx.d.ts","sourceRoot":"","sources":["../../src/internal/fork-ctx.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAElE,sDAAsD;AACtD,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC;AAE5D,2EAA2E;AAC3E,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CACrC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,GAAG,YAAY,GAAG,QAAQ,CAAC,CAAC,CAC7D,CAAC;AAQF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,OAAO,GAClB,IAAI,SAAS,OAAO,CAClB,IAAI,CACF,gBAAgB,EAChB,OAAO,GAAG,KAAK,GAAG,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CAChE,CACF,EAED,WAAW,IAAI,EACf,YAAW,gBAAqB,EAChC,QAAO,SAAS,eAAe,EAAuB,KACrD,IAMF,CAAC"}