@ontrails/core 1.0.0-beta.13 → 1.0.0-beta.15

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 (287) hide show
  1. package/.turbo/turbo-lint.log +1 -1
  2. package/CHANGELOG.md +17 -0
  3. package/README.md +19 -14
  4. package/dist/branded.d.ts +1 -1
  5. package/dist/branded.d.ts.map +1 -1
  6. package/dist/branded.js +1 -1
  7. package/dist/branded.js.map +1 -1
  8. package/dist/context.d.ts +13 -1
  9. package/dist/context.d.ts.map +1 -1
  10. package/dist/context.js +19 -3
  11. package/dist/context.js.map +1 -1
  12. package/dist/contour.d.ts +81 -0
  13. package/dist/contour.d.ts.map +1 -0
  14. package/dist/contour.js +176 -0
  15. package/dist/contour.js.map +1 -0
  16. package/dist/cross-schema.d.ts +18 -0
  17. package/dist/cross-schema.d.ts.map +1 -0
  18. package/dist/cross-schema.js +29 -0
  19. package/dist/cross-schema.js.map +1 -0
  20. package/dist/derive.d.ts +6 -0
  21. package/dist/derive.d.ts.map +1 -1
  22. package/dist/derive.js +29 -5
  23. package/dist/derive.js.map +1 -1
  24. package/dist/draft.d.ts +28 -0
  25. package/dist/draft.d.ts.map +1 -0
  26. package/dist/draft.js +157 -0
  27. package/dist/draft.js.map +1 -0
  28. package/dist/errors.d.ts +62 -4
  29. package/dist/errors.d.ts.map +1 -1
  30. package/dist/errors.js +44 -1
  31. package/dist/errors.js.map +1 -1
  32. package/dist/execute.d.ts +26 -9
  33. package/dist/execute.d.ts.map +1 -1
  34. package/dist/execute.js +441 -20
  35. package/dist/execute.js.map +1 -1
  36. package/dist/fire.d.ts +43 -0
  37. package/dist/fire.d.ts.map +1 -0
  38. package/dist/fire.js +185 -0
  39. package/dist/fire.js.map +1 -0
  40. package/dist/index.d.ts +33 -17
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +26 -12
  43. package/dist/index.js.map +1 -1
  44. package/dist/internal/cross-batch.d.ts +44 -0
  45. package/dist/internal/cross-batch.d.ts.map +1 -0
  46. package/dist/internal/cross-batch.js +58 -0
  47. package/dist/internal/cross-batch.js.map +1 -0
  48. package/dist/internal/fork-ctx.d.ts +41 -0
  49. package/dist/internal/fork-ctx.d.ts.map +1 -0
  50. package/dist/internal/fork-ctx.js +47 -0
  51. package/dist/internal/fork-ctx.js.map +1 -0
  52. package/dist/internal/signal-ref.d.ts +15 -0
  53. package/dist/internal/signal-ref.d.ts.map +1 -0
  54. package/dist/internal/signal-ref.js +41 -0
  55. package/dist/internal/signal-ref.js.map +1 -0
  56. package/dist/internal/topo-saves.d.ts +53 -0
  57. package/dist/internal/topo-saves.d.ts.map +1 -0
  58. package/dist/internal/topo-saves.js +449 -0
  59. package/dist/internal/topo-saves.js.map +1 -0
  60. package/dist/internal/topo-snapshots.d.ts +57 -0
  61. package/dist/internal/topo-snapshots.d.ts.map +1 -0
  62. package/dist/internal/topo-snapshots.js +372 -0
  63. package/dist/internal/topo-snapshots.js.map +1 -0
  64. package/dist/internal/topo-store-read.d.ts +70 -0
  65. package/dist/internal/topo-store-read.d.ts.map +1 -0
  66. package/dist/internal/topo-store-read.js +221 -0
  67. package/dist/internal/topo-store-read.js.map +1 -0
  68. package/dist/internal/topo-store.d.ts +26 -0
  69. package/dist/internal/topo-store.d.ts.map +1 -0
  70. package/dist/internal/topo-store.js +621 -0
  71. package/dist/internal/topo-store.js.map +1 -0
  72. package/dist/internal/tracing.d.ts +98 -0
  73. package/dist/internal/tracing.d.ts.map +1 -0
  74. package/dist/internal/tracing.js +102 -0
  75. package/dist/internal/tracing.js.map +1 -0
  76. package/dist/internal/trails-db.d.ts +16 -0
  77. package/dist/internal/trails-db.d.ts.map +1 -0
  78. package/dist/internal/trails-db.js +118 -0
  79. package/dist/internal/trails-db.js.map +1 -0
  80. package/dist/internal/zod-wrappers.d.ts +40 -0
  81. package/dist/internal/zod-wrappers.d.ts.map +1 -0
  82. package/dist/internal/zod-wrappers.js +59 -0
  83. package/dist/internal/zod-wrappers.js.map +1 -0
  84. package/dist/layer.d.ts +22 -5
  85. package/dist/layer.d.ts.map +1 -1
  86. package/dist/layer.js +20 -3
  87. package/dist/layer.js.map +1 -1
  88. package/dist/path-security.d.ts +1 -1
  89. package/dist/path-security.d.ts.map +1 -1
  90. package/dist/path-security.js +1 -1
  91. package/dist/path-security.js.map +1 -1
  92. package/dist/resilience.d.ts +1 -1
  93. package/dist/resilience.d.ts.map +1 -1
  94. package/dist/resilience.js +3 -3
  95. package/dist/resilience.js.map +1 -1
  96. package/dist/resource-config.d.ts +22 -0
  97. package/dist/resource-config.d.ts.map +1 -0
  98. package/dist/resource-config.js +210 -0
  99. package/dist/resource-config.js.map +1 -0
  100. package/dist/resource.d.ts +74 -0
  101. package/dist/resource.d.ts.map +1 -0
  102. package/dist/resource.js +61 -0
  103. package/dist/resource.js.map +1 -0
  104. package/dist/run.d.ts +4 -3
  105. package/dist/run.d.ts.map +1 -1
  106. package/dist/run.js +5 -4
  107. package/dist/run.js.map +1 -1
  108. package/dist/serialization.d.ts.map +1 -1
  109. package/dist/serialization.js +2 -1
  110. package/dist/serialization.js.map +1 -1
  111. package/dist/store/accessor-protocol.d.ts +51 -0
  112. package/dist/store/accessor-protocol.d.ts.map +1 -0
  113. package/dist/store/accessor-protocol.js +2 -0
  114. package/dist/store/accessor-protocol.js.map +1 -0
  115. package/dist/store/index.d.ts +2 -0
  116. package/dist/store/index.d.ts.map +1 -0
  117. package/dist/store/index.js +2 -0
  118. package/dist/store/index.js.map +1 -0
  119. package/dist/surface-filter.d.ts +13 -0
  120. package/dist/surface-filter.d.ts.map +1 -0
  121. package/dist/surface-filter.js +76 -0
  122. package/dist/surface-filter.js.map +1 -0
  123. package/dist/topo-store.d.ts +62 -0
  124. package/dist/topo-store.d.ts.map +1 -0
  125. package/dist/topo-store.js +319 -0
  126. package/dist/topo-store.js.map +1 -0
  127. package/dist/topo.d.ts +23 -9
  128. package/dist/topo.d.ts.map +1 -1
  129. package/dist/topo.js +175 -46
  130. package/dist/topo.js.map +1 -1
  131. package/dist/trail.d.ts +86 -19
  132. package/dist/trail.d.ts.map +1 -1
  133. package/dist/trail.js +59 -4
  134. package/dist/trail.js.map +1 -1
  135. package/dist/trails/derive-trail.d.ts +66 -0
  136. package/dist/trails/derive-trail.d.ts.map +1 -0
  137. package/dist/trails/derive-trail.js +378 -0
  138. package/dist/trails/derive-trail.js.map +1 -0
  139. package/dist/trails/index.d.ts +5 -0
  140. package/dist/trails/index.d.ts.map +1 -0
  141. package/dist/trails/index.js +3 -0
  142. package/dist/trails/index.js.map +1 -0
  143. package/dist/trails/ingest.d.ts +24 -0
  144. package/dist/trails/ingest.d.ts.map +1 -0
  145. package/dist/trails/ingest.js +63 -0
  146. package/dist/trails/ingest.js.map +1 -0
  147. package/dist/transport-error-map.d.ts +106 -0
  148. package/dist/transport-error-map.d.ts.map +1 -0
  149. package/dist/transport-error-map.js +24 -0
  150. package/dist/transport-error-map.js.map +1 -0
  151. package/dist/type-checks.test-d.d.ts +71 -0
  152. package/dist/type-checks.test-d.d.ts.map +1 -0
  153. package/dist/type-checks.test-d.js +12 -0
  154. package/dist/type-checks.test-d.js.map +1 -0
  155. package/dist/type-utils.d.ts +11 -2
  156. package/dist/type-utils.d.ts.map +1 -1
  157. package/dist/type-utils.js.map +1 -1
  158. package/dist/types.d.ts +113 -7
  159. package/dist/types.d.ts.map +1 -1
  160. package/dist/types.js.map +1 -1
  161. package/dist/validate-established-topo.d.ts +76 -0
  162. package/dist/validate-established-topo.d.ts.map +1 -0
  163. package/dist/validate-established-topo.js +43 -0
  164. package/dist/validate-established-topo.js.map +1 -0
  165. package/dist/validate-topo.d.ts.map +1 -1
  166. package/dist/validate-topo.js +27 -8
  167. package/dist/validate-topo.js.map +1 -1
  168. package/dist/workspace.d.ts +1 -1
  169. package/dist/workspace.d.ts.map +1 -1
  170. package/dist/workspace.js +1 -1
  171. package/dist/workspace.js.map +1 -1
  172. package/package.json +10 -1
  173. package/src/__tests__/branded.test.ts +5 -5
  174. package/src/__tests__/context.test.ts +3 -3
  175. package/src/__tests__/contour.test.ts +263 -0
  176. package/src/__tests__/derive-trail.test.ts +668 -0
  177. package/src/__tests__/derive.test.ts +58 -1
  178. package/src/__tests__/errors.test.ts +118 -0
  179. package/src/__tests__/execute.test.ts +1179 -141
  180. package/src/__tests__/fire.test.ts +1056 -0
  181. package/src/__tests__/fork-ctx.test.ts +83 -0
  182. package/src/__tests__/ingest.test.ts +191 -0
  183. package/src/__tests__/{gate.test.ts → layer.test.ts} +21 -21
  184. package/src/__tests__/path-security.test.ts +7 -7
  185. package/src/__tests__/resilience.test.ts +8 -8
  186. package/src/__tests__/resource.test.ts +204 -0
  187. package/src/__tests__/run.test.ts +13 -13
  188. package/src/__tests__/service-config.test.ts +28 -32
  189. package/src/__tests__/surface-filter.test.ts +196 -0
  190. package/src/__tests__/topo-store-read.test.ts +256 -0
  191. package/src/__tests__/topo-store.test.ts +869 -0
  192. package/src/__tests__/topo.test.ts +350 -54
  193. package/src/__tests__/trail.test.ts +189 -24
  194. package/src/__tests__/trails-db.test.ts +198 -0
  195. package/src/__tests__/transport-error-map.test.ts +82 -0
  196. package/src/__tests__/type-utils.test.ts +29 -1
  197. package/src/__tests__/validate-topo.test.ts +305 -16
  198. package/src/__tests__/workspace.test.ts +6 -6
  199. package/src/__tests__/zod-wrappers.test.ts +62 -0
  200. package/src/branded.ts +1 -1
  201. package/src/context.ts +24 -4
  202. package/src/contour.ts +344 -0
  203. package/src/cross-schema.ts +36 -0
  204. package/src/derive.ts +39 -8
  205. package/src/draft.ts +338 -0
  206. package/src/errors.ts +62 -18
  207. package/src/execute.ts +840 -29
  208. package/src/fire.ts +295 -0
  209. package/src/index.ts +142 -26
  210. package/src/internal/cross-batch.ts +77 -0
  211. package/src/internal/fork-ctx.ts +69 -0
  212. package/src/internal/signal-ref.ts +87 -0
  213. package/src/internal/topo-snapshots.ts +517 -0
  214. package/src/internal/topo-store-read.ts +481 -0
  215. package/src/internal/topo-store.ts +1192 -0
  216. package/src/internal/tracing.ts +187 -0
  217. package/src/internal/trails-db.ts +187 -0
  218. package/src/internal/zod-wrappers.ts +78 -0
  219. package/src/layer.ts +50 -0
  220. package/src/path-security.ts +1 -1
  221. package/src/resilience.ts +3 -3
  222. package/src/{provision-config.ts → resource-config.ts} +109 -123
  223. package/src/resource.ts +155 -0
  224. package/src/run.ts +5 -4
  225. package/src/serialization.ts +2 -0
  226. package/src/store/accessor-protocol.ts +56 -0
  227. package/src/store/index.ts +4 -0
  228. package/src/surface-filter.ts +182 -0
  229. package/src/topo-store.ts +510 -0
  230. package/src/topo.ts +328 -57
  231. package/src/trail.ts +199 -31
  232. package/src/trails/derive-trail.ts +842 -0
  233. package/src/trails/index.ts +9 -0
  234. package/src/trails/ingest.ts +146 -0
  235. package/src/transport-error-map.ts +56 -0
  236. package/src/type-checks.test-d.ts +106 -0
  237. package/src/type-utils.ts +17 -2
  238. package/src/types.ts +148 -11
  239. package/src/validate-established-topo.ts +63 -0
  240. package/src/validate-topo.ts +37 -9
  241. package/src/workspace.ts +1 -1
  242. package/tsconfig.tests.json +10 -0
  243. package/tsconfig.tsbuildinfo +1 -1
  244. package/dist/adapters.d.ts +0 -39
  245. package/dist/adapters.d.ts.map +0 -1
  246. package/dist/adapters.js +0 -2
  247. package/dist/adapters.js.map +0 -1
  248. package/dist/dispatch.d.ts +0 -27
  249. package/dist/dispatch.d.ts.map +0 -1
  250. package/dist/dispatch.js +0 -34
  251. package/dist/dispatch.js.map +0 -1
  252. package/dist/event.d.ts +0 -8
  253. package/dist/event.d.ts.map +0 -1
  254. package/dist/event.js +0 -7
  255. package/dist/event.js.map +0 -1
  256. package/dist/gate.d.ts +0 -17
  257. package/dist/gate.d.ts.map +0 -1
  258. package/dist/gate.js +0 -21
  259. package/dist/gate.js.map +0 -1
  260. package/dist/health.d.ts +0 -18
  261. package/dist/health.d.ts.map +0 -1
  262. package/dist/health.js +0 -5
  263. package/dist/health.js.map +0 -1
  264. package/dist/job.d.ts +0 -24
  265. package/dist/job.d.ts.map +0 -1
  266. package/dist/job.js +0 -17
  267. package/dist/job.js.map +0 -1
  268. package/dist/provision-config.d.ts +0 -22
  269. package/dist/provision-config.d.ts.map +0 -1
  270. package/dist/provision-config.js +0 -210
  271. package/dist/provision-config.js.map +0 -1
  272. package/dist/provision.d.ts +0 -71
  273. package/dist/provision.d.ts.map +0 -1
  274. package/dist/provision.js +0 -56
  275. package/dist/provision.js.map +0 -1
  276. package/dist/service-config.d.ts +0 -22
  277. package/dist/service-config.d.ts.map +0 -1
  278. package/dist/service-config.js +0 -210
  279. package/dist/service-config.js.map +0 -1
  280. package/dist/service.d.ts +0 -71
  281. package/dist/service.d.ts.map +0 -1
  282. package/dist/service.js +0 -56
  283. package/dist/service.js.map +0 -1
  284. package/src/__tests__/service.test.ts +0 -197
  285. package/src/event.ts +0 -15
  286. package/src/gate.ts +0 -44
  287. package/src/provision.ts +0 -148
@@ -0,0 +1,106 @@
1
+ import type { ErrorCategory, TrailsError } from './errors.js';
2
+ export declare const transportNames: readonly ["cli", "http", "mcp"];
3
+ export type TransportName = (typeof transportNames)[number];
4
+ export type TransportErrorMapper<T> = (error: TrailsError) => T;
5
+ export type TransportErrorMappings<T> = Record<ErrorCategory, T>;
6
+ /**
7
+ * Union of every transport-specific error code emitted by {@link transportErrorMap}.
8
+ *
9
+ * @remarks
10
+ * Previously parameterised by transport (`TransportErrorCode<'cli'>` etc.), but
11
+ * the generic collapsed to `number` because the underlying maps were typed as
12
+ * `Record<ErrorCategory, number>`. With `as const satisfies` on the maps the
13
+ * per-transport literals are now observable, but TypeScript cannot narrow
14
+ * `transportErrorMap[transport][error.category]` through a generic
15
+ * `TTransport` without an unsound cast. The non-generic union honestly reflects
16
+ * what `mapTransportError` returns at the call site.
17
+ */
18
+ export type TransportErrorCode = (typeof transportErrorMap)[TransportName][ErrorCategory];
19
+ export declare const createTransportErrorMapper: <T>(mappings: TransportErrorMappings<T>) => TransportErrorMapper<T>;
20
+ export declare const transportErrorMap: {
21
+ readonly cli: {
22
+ readonly auth: 9;
23
+ readonly cancelled: 130;
24
+ readonly conflict: 3;
25
+ readonly internal: 8;
26
+ readonly network: 7;
27
+ readonly not_found: 2;
28
+ readonly permission: 4;
29
+ readonly rate_limit: 6;
30
+ readonly timeout: 5;
31
+ readonly validation: 1;
32
+ };
33
+ readonly http: {
34
+ readonly auth: 401;
35
+ readonly cancelled: 499;
36
+ readonly conflict: 409;
37
+ readonly internal: 500;
38
+ readonly network: 502;
39
+ readonly not_found: 404;
40
+ readonly permission: 403;
41
+ readonly rate_limit: 429;
42
+ readonly timeout: 504;
43
+ readonly validation: 400;
44
+ };
45
+ readonly mcp: {
46
+ readonly auth: -32600;
47
+ readonly cancelled: -32603;
48
+ readonly conflict: -32603;
49
+ readonly internal: -32603;
50
+ readonly network: -32603;
51
+ readonly not_found: -32601;
52
+ readonly permission: -32600;
53
+ readonly rate_limit: -32603;
54
+ readonly timeout: -32603;
55
+ readonly validation: -32602;
56
+ };
57
+ };
58
+ export declare const transportErrorRegistry: {
59
+ readonly cli: {
60
+ readonly map: TransportErrorMapper<9 | 130 | 3 | 8 | 7 | 2 | 4 | 6 | 5 | 1>;
61
+ readonly values: {
62
+ readonly auth: 9;
63
+ readonly cancelled: 130;
64
+ readonly conflict: 3;
65
+ readonly internal: 8;
66
+ readonly network: 7;
67
+ readonly not_found: 2;
68
+ readonly permission: 4;
69
+ readonly rate_limit: 6;
70
+ readonly timeout: 5;
71
+ readonly validation: 1;
72
+ };
73
+ };
74
+ readonly http: {
75
+ readonly map: TransportErrorMapper<401 | 499 | 409 | 500 | 502 | 404 | 403 | 429 | 504 | 400>;
76
+ readonly values: {
77
+ readonly auth: 401;
78
+ readonly cancelled: 499;
79
+ readonly conflict: 409;
80
+ readonly internal: 500;
81
+ readonly network: 502;
82
+ readonly not_found: 404;
83
+ readonly permission: 403;
84
+ readonly rate_limit: 429;
85
+ readonly timeout: 504;
86
+ readonly validation: 400;
87
+ };
88
+ };
89
+ readonly mcp: {
90
+ readonly map: TransportErrorMapper<-32600 | -32603 | -32601 | -32602>;
91
+ readonly values: {
92
+ readonly auth: -32600;
93
+ readonly cancelled: -32603;
94
+ readonly conflict: -32603;
95
+ readonly internal: -32603;
96
+ readonly network: -32603;
97
+ readonly not_found: -32601;
98
+ readonly permission: -32600;
99
+ readonly rate_limit: -32603;
100
+ readonly timeout: -32603;
101
+ readonly validation: -32602;
102
+ };
103
+ };
104
+ };
105
+ export declare const mapTransportError: (transport: TransportName, error: TrailsError) => TransportErrorCode;
106
+ //# sourceMappingURL=transport-error-map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport-error-map.d.ts","sourceRoot":"","sources":["../src/transport-error-map.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG9D,eAAO,MAAM,cAAc,iCAAkC,CAAC;AAE9D,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5D,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,KAAK,CAAC,CAAC;AAEhE,MAAM,MAAM,sBAAsB,CAAC,CAAC,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;AAEjE;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,kBAAkB,GAC5B,CAAC,OAAO,iBAAiB,CAAC,CAAC,aAAa,CAAC,CAAC,aAAa,CAAC,CAAC;AAE3D,eAAO,MAAM,0BAA0B,GACpC,CAAC,EAAE,UAAU,sBAAsB,CAAC,CAAC,CAAC,KAAG,oBAAoB,CAAC,CAAC,CAEtC,CAAC;AAE7B,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAI4C,CAAC;AAE3E,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAazB,CAAC;AAEX,eAAO,MAAM,iBAAiB,GAC5B,WAAW,aAAa,EACxB,OAAO,WAAW,KACjB,kBAAkE,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { exitCodeMap, jsonRpcCodeMap, statusCodeMap } from './errors.js';
2
+ export const transportNames = ['cli', 'http', 'mcp'];
3
+ export const createTransportErrorMapper = (mappings) => (error) => mappings[error.category];
4
+ export const transportErrorMap = {
5
+ cli: exitCodeMap,
6
+ http: statusCodeMap,
7
+ mcp: jsonRpcCodeMap,
8
+ };
9
+ export const transportErrorRegistry = {
10
+ cli: {
11
+ map: createTransportErrorMapper(transportErrorMap.cli),
12
+ values: transportErrorMap.cli,
13
+ },
14
+ http: {
15
+ map: createTransportErrorMapper(transportErrorMap.http),
16
+ values: transportErrorMap.http,
17
+ },
18
+ mcp: {
19
+ map: createTransportErrorMapper(transportErrorMap.mcp),
20
+ values: transportErrorMap.mcp,
21
+ },
22
+ };
23
+ export const mapTransportError = (transport, error) => transportErrorMap[transport][error.category];
24
+ //# sourceMappingURL=transport-error-map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport-error-map.js","sourceRoot":"","sources":["../src/transport-error-map.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEzE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAU,CAAC;AAuB9D,MAAM,CAAC,MAAM,0BAA0B,GACrC,CAAI,QAAmC,EAA2B,EAAE,CACpE,CAAC,KAAK,EAAE,EAAE,CACR,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAE7B,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,GAAG,EAAE,WAAW;IAChB,IAAI,EAAE,aAAa;IACnB,GAAG,EAAE,cAAc;CACqD,CAAC;AAE3E,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,GAAG,EAAE;QACH,GAAG,EAAE,0BAA0B,CAAC,iBAAiB,CAAC,GAAG,CAAC;QACtD,MAAM,EAAE,iBAAiB,CAAC,GAAG;KAC9B;IACD,IAAI,EAAE;QACJ,GAAG,EAAE,0BAA0B,CAAC,iBAAiB,CAAC,IAAI,CAAC;QACvD,MAAM,EAAE,iBAAiB,CAAC,IAAI;KAC/B;IACD,GAAG,EAAE;QACH,GAAG,EAAE,0BAA0B,CAAC,iBAAiB,CAAC,GAAG,CAAC;QACtD,MAAM,EAAE,iBAAiB,CAAC,GAAG;KAC9B;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,SAAwB,EACxB,KAAkB,EACE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Compile-time type assertions for type-utils.
3
+ *
4
+ * This file lives in src/ (not __tests__/) so it is included in the
5
+ * typecheck pass. It contains no runtime code — only type-level
6
+ * assertions that fail the build when type inference regresses.
7
+ *
8
+ * Assertion types are exported to satisfy `noUnusedLocals` but are not
9
+ * re-exported from the package index.
10
+ */
11
+ import type { Trail } from './trail.js';
12
+ import type { CrossInput, TrailInput } from './type-utils.js';
13
+ /** A trail with crossInput declared. */
14
+ type CrossTrail = Trail<{
15
+ name: string;
16
+ }, {
17
+ id: string;
18
+ }, {
19
+ forkedFrom: string;
20
+ }>;
21
+ /** A trail without crossInput. */
22
+ type PlainTrail = Trail<{
23
+ name: string;
24
+ }, {
25
+ id: string;
26
+ }>;
27
+ type WithCrossInput = CrossInput<CrossTrail>;
28
+ type AssertMerged = WithCrossInput extends {
29
+ name: string;
30
+ forkedFrom: string;
31
+ } ? true : false;
32
+ export type Merged = [AssertMerged] extends [true] ? 'pass' : never;
33
+ type WithoutCrossInput = CrossInput<PlainTrail>;
34
+ type BaseInput = TrailInput<PlainTrail>;
35
+ type AssertFallback1 = WithoutCrossInput extends BaseInput ? true : false;
36
+ type AssertFallback2 = BaseInput extends WithoutCrossInput ? true : false;
37
+ export type Fallback = [AssertFallback1, AssertFallback2] extends [true, true] ? 'pass' : never;
38
+ /**
39
+ * When a trail has crossInput, the blaze's first parameter must include
40
+ * both the public input fields AND the crossInput fields. Before the fix,
41
+ * blaze was typed as Implementation<I, O>, losing the CI fields.
42
+ */
43
+ type CrossBlazeParam = Parameters<CrossTrail['blaze']>[0];
44
+ type AssertBlazeHasCrossFields = CrossBlazeParam extends {
45
+ name: string;
46
+ forkedFrom: string;
47
+ } ? true : false;
48
+ export type BlazeWithCross = [AssertBlazeHasCrossFields] extends [true] ? 'pass' : never;
49
+ type PlainBlazeParam = Parameters<PlainTrail['blaze']>[0];
50
+ type AssertPlainBlazeIsInput = PlainBlazeParam extends {
51
+ name: string;
52
+ } ? true : false;
53
+ type AssertPlainBlazeNoExtra = {
54
+ name: string;
55
+ } extends PlainBlazeParam ? true : false;
56
+ export type BlazeWithoutCross = [
57
+ AssertPlainBlazeIsInput,
58
+ AssertPlainBlazeNoExtra
59
+ ] extends [true, true] ? 'pass' : never;
60
+ type AssertDefault = Trail<{
61
+ x: number;
62
+ }, {
63
+ y: number;
64
+ }> extends Trail<{
65
+ x: number;
66
+ }, {
67
+ y: number;
68
+ }, never> ? true : false;
69
+ export type Default = [AssertDefault] extends [true] ? 'pass' : never;
70
+ export {};
71
+ //# sourceMappingURL=type-checks.test-d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-checks.test-d.d.ts","sourceRoot":"","sources":["../src/type-checks.test-d.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAM9D,wCAAwC;AACxC,KAAK,UAAU,GAAG,KAAK,CACrB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAChB;IA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M,GACN,KAAK,CAAC;AAGV,KAAK,eAAe,GAAG,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE1D,KAAK,uBAAuB,GAAG,eAAe,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GACnE,IAAI,GACJ,KAAK,CAAC;AACV,KAAK,uBAAuB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,SAAS,eAAe,GACnE,IAAI,GACJ,KAAK,CAAC;AACV,MAAM,MAAM,iBAAiB,GAAG;IAC9B,uBAAuB;IACvB,uBAAuB;CACxB,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,GAClB,MAAM,GACN,KAAK,CAAC;AAOV,KAAK,aAAa,GAChB,KAAK,CAAC;IAAE,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE;IAAE,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,SAAS,KAAK,CAC/C;IAAE,CAAC,EAAE,MAAM,CAAA;CAAE,EACb;IAAE,CAAC,EAAE,MAAM,CAAA;CAAE,EACb,KAAK,CACN,GACG,IAAI,GACJ,KAAK,CAAC;AACZ,MAAM,MAAM,OAAO,GAAG,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Compile-time type assertions for type-utils.
3
+ *
4
+ * This file lives in src/ (not __tests__/) so it is included in the
5
+ * typecheck pass. It contains no runtime code — only type-level
6
+ * assertions that fail the build when type inference regresses.
7
+ *
8
+ * Assertion types are exported to satisfy `noUnusedLocals` but are not
9
+ * re-exported from the package index.
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=type-checks.test-d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-checks.test-d.js","sourceRoot":"","sources":["../src/type-checks.test-d.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
@@ -4,9 +4,18 @@
4
4
  import type { Result } from './result.js';
5
5
  import type { AnyTrail, Trail } from './trail.js';
6
6
  /** Extract the input type from a Trail. */
7
- export type TrailInput<T extends AnyTrail> = T extends Trail<infer I, any> ? I : never;
7
+ export type TrailInput<T extends AnyTrail> = T extends Trail<infer I, any, any> ? I : never;
8
8
  /** Extract the output type from a Trail. */
9
- export type TrailOutput<T extends AnyTrail> = T extends Trail<any, infer O> ? O : never;
9
+ export type TrailOutput<T extends AnyTrail> = T extends Trail<any, infer O, any> ? O : never;
10
+ /**
11
+ * Extract the cross-callable input type from a trail.
12
+ *
13
+ * When a trail declares `crossInput`, callers via `ctx.cross()` must pass
14
+ * both the public input fields and the composition-only fields. This type
15
+ * merges both schemas so the compiler enforces the full shape at the call
16
+ * site. Falls back to plain `TrailInput<T>` when no `crossInput` exists.
17
+ */
18
+ export type CrossInput<T extends AnyTrail> = T extends Trail<infer I, any, infer CI> ? [CI] extends [never] ? I : I & CI : never;
10
19
  /**
11
20
  * Extracts the full `Result<Output, Error>` type from a trail definition.
12
21
  *
@@ -1 +1 @@
1
- {"version":3,"file":"type-utils.d.ts","sourceRoot":"","sources":["../src/type-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAQlD,2CAA2C;AAC3C,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,QAAQ,IACvC,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAE5C,4CAA4C;AAC5C,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,QAAQ,IACxC,CAAC,SAAS,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAE5C;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,QAA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AC,CAAC;AAQ5E,kFAAkF;AAClF,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,QAAQ,EAAE,OAAO,CAAC,KAAG,CAAC,CAAC,OAAO,CACnD,CAAC;AAEd,+FAA+F;AAC/F,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,QAAQ,EAAE,OAAO,CAAC,KAAG,CAAC,CAAC,QAAQ,CACpD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"type-utils.js","sourceRoot":"","sources":["../src/type-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AA8BH,mCAAmC;AAEnC,8EAA8E;AAC9E,2BAA2B;AAC3B,8EAA8E;AAE9E,kFAAkF;AAClF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAqB,KAAQ,EAAc,EAAE,CAClE,KAAK,CAAC,KAAK,CAAC;AAEd,+FAA+F;AAC/F,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAqB,KAAQ,EAAe,EAAE,CACpE,KAAK,CAAC,MAAM,CAAC"}
1
+ {"version":3,"file":"type-utils.js","sourceRoot":"","sources":["../src/type-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AA6CH,mCAAmC;AAEnC,8EAA8E;AAC9E,2BAA2B;AAC3B,8EAA8E;AAE9E,kFAAkF;AAClF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAqB,KAAQ,EAAc,EAAE,CAClE,KAAK,CAAC,KAAK,CAAC;AAEd,+FAA+F;AAC/F,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAqB,KAAQ,EAAe,EAAE,CACpE,KAAK,CAAC,MAAM,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1,4 +1,40 @@
1
+ import type { TrailsError } from './errors.js';
1
2
  import type { Result } from './result.js';
3
+ import type { Signal } from './signal.js';
4
+ import type { AnyTrail } from './trail.js';
5
+ import type { CrossInput, TrailOutput } from './type-utils.js';
6
+ /** A recovery path that activates when a trail's blaze fails with a matching error. */
7
+ export interface Detour<Input, Output, TErr extends TrailsError = TrailsError> {
8
+ readonly on: abstract new (...args: any[]) => TErr;
9
+ readonly maxAttempts?: number | undefined;
10
+ readonly recover: (attempt: DetourAttempt<Input, TErr>, ctx: TrailContext) => Promise<Result<Output, TrailsError>>;
11
+ }
12
+ /** Context passed to a detour's recover function on each attempt. */
13
+ export interface DetourAttempt<Input, TErr extends TrailsError = TrailsError> {
14
+ /** 1-indexed attempt number */
15
+ readonly attempt: number;
16
+ /** The matched error */
17
+ readonly error: TErr;
18
+ /** Original trail input */
19
+ readonly input: Input;
20
+ }
21
+ type CrossBatchCall<TTarget extends AnyTrail | string = AnyTrail | string> = TTarget extends AnyTrail ? readonly [trail: TTarget, input: CrossInput<TTarget>] : readonly [id: string, input: unknown];
22
+ type CrossBatchResult<TTarget extends AnyTrail | string> = TTarget extends AnyTrail ? Result<TrailOutput<TTarget>, Error> : Result<unknown, Error>;
23
+ type CrossBatchResults<TCalls extends readonly CrossBatchCall[]> = {
24
+ readonly [K in keyof TCalls]: TCalls[K] extends readonly [
25
+ infer TTarget,
26
+ unknown
27
+ ] ? TTarget extends AnyTrail | string ? CrossBatchResult<TTarget> : never : never;
28
+ };
29
+ /** Runtime options for batch `ctx.cross([...])` calls. */
30
+ export interface CrossBatchOptions {
31
+ /**
32
+ * Maximum number of branches to execute concurrently.
33
+ *
34
+ * Omit for unbounded concurrency. `1` is equivalent to sequential execution.
35
+ */
36
+ readonly concurrency?: number | undefined;
37
+ }
2
38
  /**
3
39
  * Trail implementation — sync or async.
4
40
  *
@@ -6,12 +42,65 @@ import type { Result } from './result.js';
6
42
  * normalizes with `await` at every call site, so both forms work transparently.
7
43
  */
8
44
  export type Implementation<I, O> = (input: I, ctx: TrailContext) => Result<O, Error> | Promise<Result<O, Error>>;
9
- /** Invoke another trail by id — used for trail composition */
10
- export type CrossFn = <O>(id: string, input: unknown) => Promise<Result<O, Error>>;
11
- /** Resolve a provision instance from the current trail context. */
12
- export type ProvisionLookup = <T = unknown>(provisionOrId: {
45
+ /**
46
+ * Invoke another trail used for trail composition.
47
+ *
48
+ * Two call shapes:
49
+ *
50
+ * - **By trail object** (typed): `ctx.cross(showGist, { id })` — the compiler
51
+ * infers `I` and `O` from the trail's schemas, so the result is fully typed.
52
+ * - **By string id** (untyped escape hatch): `ctx.cross('gist.show', { id })`
53
+ * — returns `Result<O, Error>` where `O` defaults to `unknown`.
54
+ * - **By batch**: `ctx.cross([[showGist, { id }], ['audit.log', payload]])`
55
+ * — executes every crossing concurrently and resolves once all results are
56
+ * available. Result ordering always matches the input tuple ordering. Pass
57
+ * `{ concurrency: N }` as the second argument to limit how many branches
58
+ * run at once.
59
+ */
60
+ export interface CrossFn {
61
+ <const TCalls extends readonly CrossBatchCall[]>(calls: TCalls, options?: CrossBatchOptions): Promise<CrossBatchResults<TCalls>>;
62
+ <T extends AnyTrail>(trail: T, input: CrossInput<T>): Promise<Result<TrailOutput<T>, Error>>;
63
+ <O = unknown>(id: string, input: unknown): Promise<Result<O, Error>>;
64
+ }
65
+ /**
66
+ * Emit a signal — used for signal-driven activation.
67
+ *
68
+ * Fan-out to consumer trails (those with the signal in their `on:` array) is
69
+ * the framework's responsibility. Producers get `Result.ok(undefined)` unless
70
+ * the signal id is unknown or the payload fails schema validation. Consumer
71
+ * errors are logged but do not propagate back to the producer. Consumers fan
72
+ * out in parallel, each with its own derived context. Runtime cycle
73
+ * suppression is still signal-id-based against the current fire stack: it
74
+ * prevents re-entrant loops but can over-suppress legitimate diamond
75
+ * re-fires, with a debug breadcrumb and a warn emitted when suppression happens.
76
+ *
77
+ * Two call shapes are supported:
78
+ *
79
+ * - **By id** (base shape): `ctx.fire('order.placed', { ... })`. Matches
80
+ * the shape of `ctx.cross`; payload is typed as `unknown` and validated
81
+ * against the signal's schema at the fire boundary.
82
+ * - **By signal value** (progressive disclosure): `ctx.fire(orderPlaced, payload)`
83
+ * where `orderPlaced` is a `Signal<T>`. The compiler enforces that
84
+ * `payload` matches the signal's declared schema type at the call site,
85
+ * on top of the runtime validation.
86
+ */
87
+ export interface FireFn {
88
+ <T>(signal: Signal<T>, payload: T): Promise<Result<void, Error>>;
89
+ (signalId: string, payload: unknown): Promise<Result<void, Error>>;
90
+ }
91
+ /** Resolve a resource instance from the current trail context. */
92
+ export type ResourceLookup = <T = unknown>(resourceOrId: {
13
93
  readonly id: string;
14
94
  } | string) => T;
95
+ /**
96
+ * Wrap the execution of `fn` in a child trace span.
97
+ *
98
+ * Creates a nested span under the current trail's root trace record, times
99
+ * the callback, records success or failure (including error category), and
100
+ * writes the completed span to the registered sink. Errors thrown by `fn`
101
+ * are recorded on the span and then rethrown — tracing never swallows them.
102
+ */
103
+ export type TraceFn = <T>(label: string, fn: () => T | Promise<T>) => Promise<T>;
15
104
  /** Callback for reporting progress from long-running trails */
16
105
  export type ProgressCallback = (event: ProgressEvent) => void;
17
106
  /** Structured progress event emitted during trail execution */
@@ -45,6 +134,12 @@ export interface TrailContext {
45
134
  readonly requestId: string;
46
135
  readonly abortSignal: AbortSignal;
47
136
  readonly cross?: CrossFn | undefined;
137
+ /**
138
+ * Emit a signal by id. Fans out to every trail with the signal in its
139
+ * `on:` declaration. Bound by the runner that holds the topo (typically
140
+ * `run()`); undefined when a context is constructed without topo access.
141
+ */
142
+ readonly fire?: FireFn | undefined;
48
143
  readonly permit?: BasePermit;
49
144
  readonly workspaceRoot?: string | undefined;
50
145
  readonly logger?: Logger | undefined;
@@ -52,7 +147,16 @@ export interface TrailContext {
52
147
  readonly cwd?: string | undefined;
53
148
  readonly env?: Record<string, string | undefined> | undefined;
54
149
  readonly extensions?: Readonly<Record<string, unknown>> | undefined;
55
- readonly provision?: ProvisionLookup | undefined;
150
+ readonly resource?: ResourceLookup | undefined;
151
+ /**
152
+ * Wrap a callback in a child trace span.
153
+ *
154
+ * Always present on contexts produced by `executeTrail` or
155
+ * `createTrailContext`. Optional on the interface so manually constructed
156
+ * contexts (tests, ad-hoc compositions) don't have to supply one — call
157
+ * sites tolerate `undefined` by falling back to a no-op passthrough.
158
+ */
159
+ readonly trace?: TraceFn | undefined;
56
160
  }
57
161
  /**
58
162
  * Permit requirement declared on a trail spec.
@@ -65,7 +169,9 @@ export type PermitRequirement = {
65
169
  readonly scopes: readonly string[];
66
170
  } | 'public';
67
171
  /** Input shape used to seed a runtime TrailContext before resolution. */
68
- export type TrailContextInit = Omit<TrailContext, 'provision'> & {
69
- readonly provision?: ProvisionLookup | undefined;
172
+ export type TrailContextInit = Omit<TrailContext, 'resource' | 'trace'> & {
173
+ readonly resource?: ResourceLookup | undefined;
174
+ readonly trace?: TraceFn | undefined;
70
175
  };
176
+ export {};
71
177
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,EAAE,CAAC,IAAI,CACjC,KAAK,EAAE,CAAC,EACR,GAAG,EAAE,YAAY,KACd,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AAElD,8DAA8D;AAC9D,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,EACtB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,OAAO,KACX,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AAE/B,mEAAmE;AACnE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,GAAG,OAAO,EACxC,aAAa,EAAE;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,KAC5C,CAAC,CAAC;AAEP,+DAA+D;AAC/D,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;AAE9D,+DAA+D;AAC/D,MAAM,WAAW,aAAa;IAC5B,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AK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACtC,CAAC"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAgDA,6DAA6D;AAC7D,MAAM,CAAC,MAAM,aAAa,GAAG,oBAA6B,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAyKA,6DAA6D;AAC7D,MAAM,CAAC,MAAM,aAAa,GAAG,oBAA6B,CAAC"}
@@ -0,0 +1,76 @@
1
+ import { ValidationError } from './errors.js';
2
+ import { Result } from './result.js';
3
+ import type { Topo } from './topo.js';
4
+ /**
5
+ * Validate that a topo is ready for established outputs.
6
+ *
7
+ * Established surfaces still require the authored graph to be structurally
8
+ * valid, and they must also reject any remaining draft state.
9
+ */
10
+ export declare const validateEstablishedTopo: (topo: Topo) => {
11
+ readonly error: ValidationError;
12
+ isOk(): this is {
13
+ readonly value: never;
14
+ isOk(): this is /*elided*/ any;
15
+ isErr(): this is /*elided*/ any;
16
+ map<U>(fn: (value: never) => U): Result<U, ValidationError>;
17
+ flatMap<U, F = ValidationError>(fn: (value: never) => Result<U, F>): Result<U, ValidationError | F>;
18
+ mapErr<F>(_fn: (error: ValidationError) => F): Result<never, F>;
19
+ match<U>(handlers: {
20
+ ok: (value: never) => U;
21
+ err: (error: ValidationError) => U;
22
+ }): U;
23
+ unwrap(): never;
24
+ unwrapOr(_fallback: never): never;
25
+ };
26
+ isErr(): this is /*elided*/ any;
27
+ map<U>(_fn: (value: never) => U): Result<U, ValidationError>;
28
+ flatMap<U, F = ValidationError>(_fn: (value: never) => Result<U, F>): Result<U, ValidationError | F>;
29
+ mapErr<F>(fn: (error: ValidationError) => F): Result<never, F>;
30
+ match<U>(handlers: {
31
+ ok: (value: never) => U;
32
+ err: (error: ValidationError) => U;
33
+ }): U;
34
+ unwrap(): never;
35
+ unwrapOr<T>(fallback: T): T;
36
+ } | {
37
+ readonly value: void;
38
+ isOk(): this is /*elided*/ any;
39
+ isErr(): this is {
40
+ readonly error: never;
41
+ isOk(): this is {
42
+ readonly value: never;
43
+ isOk(): this is /*elided*/ any;
44
+ isErr(): this is /*elided*/ any;
45
+ map<U>(fn: (value: never) => U): Result<U, never>;
46
+ flatMap<U, F = never>(fn: (value: never) => Result<U, F>): Result<U, F>;
47
+ mapErr<F>(_fn: (error: never) => F): Result<never, F>;
48
+ match<U>(handlers: {
49
+ ok: (value: never) => U;
50
+ err: (error: never) => U;
51
+ }): U;
52
+ unwrap(): never;
53
+ unwrapOr(_fallback: never): never;
54
+ };
55
+ isErr(): this is /*elided*/ any;
56
+ map<U>(_fn: (value: never) => U): Result<U, never>;
57
+ flatMap<U, F = never>(_fn: (value: never) => Result<U, F>): Result<U, F>;
58
+ mapErr<F>(fn: (error: never) => F): Result<never, F>;
59
+ match<U>(handlers: {
60
+ ok: (value: never) => U;
61
+ err: (error: never) => U;
62
+ }): U;
63
+ unwrap(): never;
64
+ unwrapOr<T>(fallback: T): T;
65
+ };
66
+ map<U>(fn: (value: void) => U): Result<U, never>;
67
+ flatMap<U, F = never>(fn: (value: void) => Result<U, F>): Result<U, F>;
68
+ mapErr<F>(_fn: (error: never) => F): Result<void, F>;
69
+ match<U>(handlers: {
70
+ ok: (value: void) => U;
71
+ err: (error: never) => U;
72
+ }): U;
73
+ unwrap(): void;
74
+ unwrapOr(_fallback: void): void;
75
+ };
76
+ //# sourceMappingURL=validate-established-topo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-established-topo.d.ts","sourceRoot":"","sources":["../src/validate-established-topo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AA0CtC;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYjD,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { ValidationError } from './errors.js';
2
+ import { Result } from './result.js';
3
+ import { validateDraftFreeTopo } from './draft.js';
4
+ import { validateTopo } from './validate-topo.js';
5
+ const PROJECTION_BLOCKING_RULES = new Set([
6
+ 'cross-cycle',
7
+ 'cross-exists',
8
+ 'no-self-cross',
9
+ 'resource-exists',
10
+ 'signal-origin-exists',
11
+ ]);
12
+ const keepProjectionBlockingIssues = (result) => {
13
+ if (result.isOk()) {
14
+ return result;
15
+ }
16
+ const issues = result.error.context?.issues;
17
+ const remainingIssues = issues?.filter((issue) => PROJECTION_BLOCKING_RULES.has(issue.rule));
18
+ if (remainingIssues === undefined || remainingIssues.length === 0) {
19
+ return Result.ok();
20
+ }
21
+ return Result.err(new ValidationError(`Topo validation failed with ${remainingIssues.length} issue(s)`, {
22
+ cause: result.error,
23
+ context: { issues: remainingIssues },
24
+ }));
25
+ };
26
+ /**
27
+ * Validate that a topo is ready for established outputs.
28
+ *
29
+ * Established surfaces still require the authored graph to be structurally
30
+ * valid, and they must also reject any remaining draft state.
31
+ */
32
+ export const validateEstablishedTopo = (topo) => {
33
+ const structural = keepProjectionBlockingIssues(validateTopo(topo));
34
+ if (structural.isErr()) {
35
+ return structural;
36
+ }
37
+ const established = validateDraftFreeTopo(topo);
38
+ if (established.isErr()) {
39
+ return established;
40
+ }
41
+ return Result.ok();
42
+ };
43
+ //# sourceMappingURL=validate-established-topo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-established-topo.js","sourceRoot":"","sources":["../src/validate-established-topo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,qBAAqB,EAAE,MAAM,Y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AW,CAAC;IACrB,CAAC;IAED,OAAO,MAAM,CAAC,EAAE,EAAE,CAAC;AACrB,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"validate-topo.d.ts","sourceRoot":"","sources":["../src/validate-topo.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAQtC,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAsLD;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,IAAI,KAAG,MAAM,CAAC,IAAI,EAAE,eAAe,CAoBrE,CAAC"}
1
+ {"version":3,"file":"validate-topo.d.ts","sourceRoot":"","sources":["../src/validate-topo.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAQtC,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AA8MD;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,IAAI,KAAG,MAAM,CAAC,IAAI,EAAE,eAAe,CAqBrE,CAAC"}