@ontrails/core 1.0.0-beta.3 → 1.0.0-beta.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/CHANGELOG.md +305 -8
  2. package/README.md +114 -33
  3. package/package.json +11 -1
  4. package/src/activation-provenance.ts +111 -0
  5. package/src/activation-source-compatibility.ts +430 -0
  6. package/src/activation-source-projection.ts +221 -0
  7. package/src/activation-source.ts +91 -0
  8. package/src/blob-ref.ts +51 -0
  9. package/src/branded.ts +1 -1
  10. package/src/compose-batch.ts +69 -0
  11. package/src/compose-schema.ts +36 -0
  12. package/src/context.ts +44 -10
  13. package/src/contour.ts +346 -0
  14. package/src/derive.ts +241 -16
  15. package/src/detours.ts +8 -0
  16. package/src/draft.ts +342 -0
  17. package/src/error-projection.ts +51 -0
  18. package/src/errors.ts +335 -48
  19. package/src/execute.ts +1577 -0
  20. package/src/fire.ts +1169 -0
  21. package/src/index.ts +495 -34
  22. package/src/internal/fork-ctx.ts +69 -0
  23. package/src/layer-projection.ts +193 -0
  24. package/src/layer.ts +43 -6
  25. package/src/observe.ts +361 -0
  26. package/src/path-security.ts +1 -1
  27. package/src/permits.ts +12 -0
  28. package/src/redaction/patterns.ts +6 -3
  29. package/src/resilience.ts +11 -11
  30. package/src/resource-config.ts +792 -0
  31. package/src/resource.ts +194 -0
  32. package/src/result.ts +18 -0
  33. package/src/run.ts +76 -0
  34. package/src/schedule-runtime.ts +689 -0
  35. package/src/schedule.ts +326 -0
  36. package/src/serialization.ts +92 -55
  37. package/src/signal-diagnostics.ts +633 -0
  38. package/src/signal-ref.ts +87 -0
  39. package/src/signal.ts +104 -0
  40. package/src/store/accessor-protocol.ts +56 -0
  41. package/src/store/index.ts +4 -0
  42. package/src/structured-examples.ts +248 -0
  43. package/src/surface-derivation.ts +91 -0
  44. package/src/surface-filter.ts +176 -0
  45. package/src/surface-versioning.ts +42 -0
  46. package/src/topo.ts +769 -67
  47. package/src/tracing.ts +345 -0
  48. package/src/trail.ts +1168 -30
  49. package/src/trails/derive-trail.ts +842 -0
  50. package/src/trails/index.ts +9 -0
  51. package/src/trails/ingest.ts +139 -0
  52. package/src/trails-db.ts +206 -0
  53. package/src/transport-error-map.ts +174 -0
  54. package/src/type-utils.ts +87 -0
  55. package/src/types.ts +254 -12
  56. package/src/validate-established-topo.ts +69 -0
  57. package/src/validate-topo.ts +393 -45
  58. package/src/validation.ts +152 -4
  59. package/src/version-marker.ts +716 -0
  60. package/src/version-resolution.ts +308 -0
  61. package/src/version-runtime.ts +120 -0
  62. package/src/webhook.ts +278 -0
  63. package/src/workspace.ts +1 -1
  64. package/src/zod-wrappers.ts +72 -0
  65. package/.turbo/turbo-build.log +0 -1
  66. package/.turbo/turbo-lint.log +0 -3
  67. package/.turbo/turbo-typecheck.log +0 -1
  68. package/dist/adapters.d.ts +0 -39
  69. package/dist/adapters.d.ts.map +0 -1
  70. package/dist/adapters.js +0 -2
  71. package/dist/adapters.js.map +0 -1
  72. package/dist/blob-ref.d.ts +0 -20
  73. package/dist/blob-ref.d.ts.map +0 -1
  74. package/dist/blob-ref.js +0 -22
  75. package/dist/blob-ref.js.map +0 -1
  76. package/dist/branded.d.ts +0 -36
  77. package/dist/branded.d.ts.map +0 -1
  78. package/dist/branded.js +0 -89
  79. package/dist/branded.js.map +0 -1
  80. package/dist/collections.d.ts +0 -31
  81. package/dist/collections.d.ts.map +0 -1
  82. package/dist/collections.js +0 -60
  83. package/dist/collections.js.map +0 -1
  84. package/dist/context.d.ts +0 -10
  85. package/dist/context.d.ts.map +0 -1
  86. package/dist/context.js +0 -15
  87. package/dist/context.js.map +0 -1
  88. package/dist/derive.d.ts +0 -33
  89. package/dist/derive.d.ts.map +0 -1
  90. package/dist/derive.js +0 -125
  91. package/dist/derive.js.map +0 -1
  92. package/dist/errors.d.ts +0 -83
  93. package/dist/errors.d.ts.map +0 -1
  94. package/dist/errors.js +0 -142
  95. package/dist/errors.js.map +0 -1
  96. package/dist/event.d.ts +0 -45
  97. package/dist/event.d.ts.map +0 -1
  98. package/dist/event.js +0 -17
  99. package/dist/event.js.map +0 -1
  100. package/dist/fetch.d.ts +0 -15
  101. package/dist/fetch.d.ts.map +0 -1
  102. package/dist/fetch.js +0 -102
  103. package/dist/fetch.js.map +0 -1
  104. package/dist/guards.d.ts +0 -17
  105. package/dist/guards.d.ts.map +0 -1
  106. package/dist/guards.js +0 -25
  107. package/dist/guards.js.map +0 -1
  108. package/dist/health.d.ts +0 -18
  109. package/dist/health.d.ts.map +0 -1
  110. package/dist/health.js +0 -5
  111. package/dist/health.js.map +0 -1
  112. package/dist/hike.d.ts +0 -36
  113. package/dist/hike.d.ts.map +0 -1
  114. package/dist/hike.js +0 -20
  115. package/dist/hike.js.map +0 -1
  116. package/dist/index.d.ts +0 -36
  117. package/dist/index.d.ts.map +0 -1
  118. package/dist/index.js +0 -40
  119. package/dist/index.js.map +0 -1
  120. package/dist/job.d.ts +0 -24
  121. package/dist/job.d.ts.map +0 -1
  122. package/dist/job.js +0 -17
  123. package/dist/job.js.map +0 -1
  124. package/dist/layer.d.ts +0 -17
  125. package/dist/layer.d.ts.map +0 -1
  126. package/dist/layer.js +0 -21
  127. package/dist/layer.js.map +0 -1
  128. package/dist/path-security.d.ts +0 -28
  129. package/dist/path-security.d.ts.map +0 -1
  130. package/dist/path-security.js +0 -63
  131. package/dist/path-security.js.map +0 -1
  132. package/dist/patterns/bulk.d.ts +0 -15
  133. package/dist/patterns/bulk.d.ts.map +0 -1
  134. package/dist/patterns/bulk.js +0 -14
  135. package/dist/patterns/bulk.js.map +0 -1
  136. package/dist/patterns/change.d.ts +0 -10
  137. package/dist/patterns/change.d.ts.map +0 -1
  138. package/dist/patterns/change.js +0 -10
  139. package/dist/patterns/change.js.map +0 -1
  140. package/dist/patterns/date-range.d.ts +0 -10
  141. package/dist/patterns/date-range.d.ts.map +0 -1
  142. package/dist/patterns/date-range.js +0 -10
  143. package/dist/patterns/date-range.js.map +0 -1
  144. package/dist/patterns/index.d.ts +0 -9
  145. package/dist/patterns/index.d.ts.map +0 -1
  146. package/dist/patterns/index.js +0 -9
  147. package/dist/patterns/index.js.map +0 -1
  148. package/dist/patterns/pagination.d.ts +0 -18
  149. package/dist/patterns/pagination.d.ts.map +0 -1
  150. package/dist/patterns/pagination.js +0 -18
  151. package/dist/patterns/pagination.js.map +0 -1
  152. package/dist/patterns/progress.d.ts +0 -11
  153. package/dist/patterns/progress.d.ts.map +0 -1
  154. package/dist/patterns/progress.js +0 -11
  155. package/dist/patterns/progress.js.map +0 -1
  156. package/dist/patterns/sorting.d.ts +0 -13
  157. package/dist/patterns/sorting.d.ts.map +0 -1
  158. package/dist/patterns/sorting.js +0 -10
  159. package/dist/patterns/sorting.js.map +0 -1
  160. package/dist/patterns/status.d.ts +0 -15
  161. package/dist/patterns/status.d.ts.map +0 -1
  162. package/dist/patterns/status.js +0 -9
  163. package/dist/patterns/status.js.map +0 -1
  164. package/dist/patterns/timestamps.d.ts +0 -10
  165. package/dist/patterns/timestamps.d.ts.map +0 -1
  166. package/dist/patterns/timestamps.js +0 -10
  167. package/dist/patterns/timestamps.js.map +0 -1
  168. package/dist/redaction/index.d.ts +0 -4
  169. package/dist/redaction/index.d.ts.map +0 -1
  170. package/dist/redaction/index.js +0 -3
  171. package/dist/redaction/index.js.map +0 -1
  172. package/dist/redaction/patterns.d.ts +0 -9
  173. package/dist/redaction/patterns.d.ts.map +0 -1
  174. package/dist/redaction/patterns.js +0 -39
  175. package/dist/redaction/patterns.js.map +0 -1
  176. package/dist/redaction/redactor.d.ts +0 -27
  177. package/dist/redaction/redactor.d.ts.map +0 -1
  178. package/dist/redaction/redactor.js +0 -89
  179. package/dist/redaction/redactor.js.map +0 -1
  180. package/dist/resilience.d.ts +0 -34
  181. package/dist/resilience.d.ts.map +0 -1
  182. package/dist/resilience.js +0 -164
  183. package/dist/resilience.js.map +0 -1
  184. package/dist/result.d.ts +0 -57
  185. package/dist/result.d.ts.map +0 -1
  186. package/dist/result.js +0 -156
  187. package/dist/result.js.map +0 -1
  188. package/dist/serialization.d.ts +0 -27
  189. package/dist/serialization.d.ts.map +0 -1
  190. package/dist/serialization.js +0 -153
  191. package/dist/serialization.js.map +0 -1
  192. package/dist/topo.d.ts +0 -18
  193. package/dist/topo.d.ts.map +0 -1
  194. package/dist/topo.js +0 -80
  195. package/dist/topo.js.map +0 -1
  196. package/dist/trail.d.ts +0 -83
  197. package/dist/trail.d.ts.map +0 -1
  198. package/dist/trail.js +0 -16
  199. package/dist/trail.js.map +0 -1
  200. package/dist/types.d.ts +0 -46
  201. package/dist/types.d.ts.map +0 -1
  202. package/dist/types.js +0 -2
  203. package/dist/types.js.map +0 -1
  204. package/dist/validate-topo.d.ts +0 -24
  205. package/dist/validate-topo.d.ts.map +0 -1
  206. package/dist/validate-topo.js +0 -156
  207. package/dist/validate-topo.js.map +0 -1
  208. package/dist/validation.d.ts +0 -27
  209. package/dist/validation.d.ts.map +0 -1
  210. package/dist/validation.js +0 -134
  211. package/dist/validation.js.map +0 -1
  212. package/dist/workspace.d.ts +0 -25
  213. package/dist/workspace.d.ts.map +0 -1
  214. package/dist/workspace.js +0 -57
  215. package/dist/workspace.js.map +0 -1
  216. package/src/__tests__/blob-ref.test.ts +0 -103
  217. package/src/__tests__/branded.test.ts +0 -148
  218. package/src/__tests__/collections.test.ts +0 -126
  219. package/src/__tests__/context.test.ts +0 -66
  220. package/src/__tests__/derive.test.ts +0 -203
  221. package/src/__tests__/errors.test.ts +0 -309
  222. package/src/__tests__/event.test.ts +0 -82
  223. package/src/__tests__/fetch.test.ts +0 -217
  224. package/src/__tests__/guards.test.ts +0 -102
  225. package/src/__tests__/hike.test.ts +0 -117
  226. package/src/__tests__/job.test.ts +0 -98
  227. package/src/__tests__/layer.test.ts +0 -224
  228. package/src/__tests__/path-security.test.ts +0 -114
  229. package/src/__tests__/patterns.test.ts +0 -273
  230. package/src/__tests__/redaction.test.ts +0 -244
  231. package/src/__tests__/resilience.test.ts +0 -246
  232. package/src/__tests__/result.test.ts +0 -155
  233. package/src/__tests__/serialization.test.ts +0 -401
  234. package/src/__tests__/topo.test.ts +0 -220
  235. package/src/__tests__/trail.test.ts +0 -179
  236. package/src/__tests__/validate-topo.test.ts +0 -280
  237. package/src/__tests__/validation.test.ts +0 -283
  238. package/src/__tests__/workspace.test.ts +0 -183
  239. package/src/adapters.ts +0 -68
  240. package/src/event.ts +0 -77
  241. package/src/health.ts +0 -23
  242. package/src/hike.ts +0 -77
  243. package/src/job.ts +0 -20
  244. package/tsconfig.json +0 -9
  245. package/tsconfig.tsbuildinfo +0 -1
@@ -1,153 +0,0 @@
1
- /**
2
- * Serialization utilities for @ontrails/core
3
- *
4
- * Safe JSON parsing/stringifying and error serialization/deserialization
5
- * for transport across process boundaries.
6
- */
7
- import { ValidationError, AmbiguousError, AssertionError, NotFoundError, AlreadyExistsError, ConflictError, PermissionError, TimeoutError, RateLimitError, NetworkError, InternalError, AuthError, CancelledError, isTrailsError, } from './errors.js';
8
- import { Result } from './result.js';
9
- // ---------------------------------------------------------------------------
10
- // Internal helpers (defined before usage)
11
- // ---------------------------------------------------------------------------
12
- /** Build options object without including undefined context. */
13
- const buildOpts = (context) => {
14
- if (context !== undefined) {
15
- return { context };
16
- }
17
- return {};
18
- };
19
- const errorFactories = {
20
- auth: (msg, opts) => new AuthError(msg, opts),
21
- cancelled: (msg, opts) => new CancelledError(msg, opts),
22
- conflict: (msg, opts) => new ConflictError(msg, opts),
23
- internal: (msg, opts) => new InternalError(msg, opts),
24
- network: (msg, opts) => new NetworkError(msg, opts),
25
- not_found: (msg, opts) => new NotFoundError(msg, opts),
26
- permission: (msg, opts) => new PermissionError(msg, opts),
27
- rate_limit: (msg, opts, retryAfter) => {
28
- const rlOpts = {
29
- ...opts,
30
- };
31
- if (retryAfter !== undefined) {
32
- rlOpts.retryAfter = retryAfter;
33
- }
34
- return new RateLimitError(msg, rlOpts);
35
- },
36
- timeout: (msg, opts) => new TimeoutError(msg, opts),
37
- validation: (msg, opts) => new ValidationError(msg, opts),
38
- };
39
- const createErrorByCategory = (category, message, context, retryAfter) => {
40
- const opts = buildOpts(context);
41
- const factory = errorFactories[category] ?? errorFactories.internal;
42
- return factory(message, opts, retryAfter);
43
- };
44
- /** Map error class names to their constructors for precise round-tripping. */
45
- const errorConstructorsByName = {
46
- AlreadyExistsError: (msg, opts) => new AlreadyExistsError(msg, opts),
47
- AmbiguousError: (msg, opts) => new AmbiguousError(msg, opts),
48
- AssertionError: (msg, opts) => new AssertionError(msg, opts),
49
- AuthError: (msg, opts) => new AuthError(msg, opts),
50
- CancelledError: (msg, opts) => new CancelledError(msg, opts),
51
- ConflictError: (msg, opts) => new ConflictError(msg, opts),
52
- InternalError: (msg, opts) => new InternalError(msg, opts),
53
- NetworkError: (msg, opts) => new NetworkError(msg, opts),
54
- NotFoundError: (msg, opts) => new NotFoundError(msg, opts),
55
- PermissionError: (msg, opts) => new PermissionError(msg, opts),
56
- RateLimitError: (msg, opts, retryAfter) => {
57
- const rlOpts = {
58
- ...opts,
59
- };
60
- if (retryAfter !== undefined) {
61
- rlOpts.retryAfter = retryAfter;
62
- }
63
- return new RateLimitError(msg, rlOpts);
64
- },
65
- TimeoutError: (msg, opts) => new TimeoutError(msg, opts),
66
- ValidationError: (msg, opts) => new ValidationError(msg, opts),
67
- };
68
- // ---------------------------------------------------------------------------
69
- // Error serialization
70
- // ---------------------------------------------------------------------------
71
- /** Extract structured data from an Error for transport. */
72
- export const serializeError = (error) => {
73
- const result = {
74
- message: error.message,
75
- name: error.name,
76
- stack: error.stack,
77
- };
78
- if (isTrailsError(error)) {
79
- return {
80
- ...result,
81
- category: error.category,
82
- context: error.context,
83
- retryAfter: error instanceof RateLimitError ? error.retryAfter : undefined,
84
- retryable: error.retryable,
85
- };
86
- }
87
- return result;
88
- };
89
- /** Reconstruct a TrailsError from serialized data. */
90
- export const deserializeError = (data) => {
91
- const opts = buildOpts(data.context);
92
- const nameFactory = errorConstructorsByName[data.name];
93
- const error = nameFactory
94
- ? nameFactory(data.message, opts, data.retryAfter)
95
- : createErrorByCategory(data.category ?? 'internal', data.message, data.context, data.retryAfter);
96
- if (data.stack) {
97
- error.stack = data.stack;
98
- }
99
- return error;
100
- };
101
- // ---------------------------------------------------------------------------
102
- // Safe JSON
103
- // ---------------------------------------------------------------------------
104
- /** Parse a JSON string, returning a Result instead of throwing. */
105
- export const safeParse = (json) => {
106
- try {
107
- return Result.ok(JSON.parse(json));
108
- }
109
- catch (error) {
110
- return Result.err(new ValidationError('Invalid JSON', {
111
- cause: error instanceof Error ? error : new Error(String(error)),
112
- context: { input: json.slice(0, 200) },
113
- }));
114
- }
115
- };
116
- /** Stringify a value, returning a Result. Handles circular references. */
117
- export const safeStringify = (value) => {
118
- try {
119
- // Track the current ancestor chain, not every object ever visited.
120
- // This allows shared references in a DAG while still detecting cycles.
121
- const stack = [];
122
- const keys = [];
123
- const json = JSON.stringify(value, function json(key, val) {
124
- if (stack.length > 0) {
125
- // `this` is the object that contains `key`. Trim the stack back
126
- // to `this` so we only track the current ancestor path.
127
- const thisIndex = stack.lastIndexOf(this);
128
- stack.splice(thisIndex + 1);
129
- keys.splice(thisIndex);
130
- }
131
- if (typeof val === 'object' && val !== null) {
132
- if (stack.includes(val)) {
133
- return '[Circular]';
134
- }
135
- stack.push(val);
136
- keys.push(key);
137
- }
138
- return val;
139
- });
140
- if (json === undefined) {
141
- return Result.err(new InternalError('Value is not JSON-serializable', {
142
- context: { type: typeof value },
143
- }));
144
- }
145
- return Result.ok(json);
146
- }
147
- catch (error) {
148
- return Result.err(new InternalError('Failed to stringify value', {
149
- cause: error instanceof Error ? error : new Error(String(error)),
150
- }));
151
- }
152
- };
153
- //# sourceMappingURL=serialization.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serialization.js","sourceRoot":"","sources":["../src/serialization.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,eAAe,EACf,cAAc,EACd,cAAc,EACd,aAAa,EAC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AC;gBACD,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBAChB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACjB,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC,CAAC,CAAC;QACH,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,OAAO,MAAM,CAAC,GAAG,CACf,IAAI,aAAa,CAAC,gCAAgC,EAAE;gBAClD,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,KAAK,EAAE;aAChC,CAAC,CACH,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,MAAM,CAAC,GAAG,CACf,IAAI,aAAa,CAAC,2BAA2B,EAAE;YAC7C,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SACjE,CAAC,CACH,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
package/dist/topo.d.ts DELETED
@@ -1,18 +0,0 @@
1
- /**
2
- * Application entry point — scans module exports to build a topology graph.
3
- */
4
- import type { AnyEvent } from './event.js';
5
- import type { AnyHike } from './hike.js';
6
- import type { AnyTrail } from './trail.js';
7
- export interface Topo {
8
- readonly name: string;
9
- readonly trails: ReadonlyMap<string, AnyTrail>;
10
- readonly hikes: ReadonlyMap<string, AnyHike>;
11
- readonly events: ReadonlyMap<string, AnyEvent>;
12
- get(id: string): AnyTrail | AnyHike | undefined;
13
- has(id: string): boolean;
14
- list(): (AnyTrail | AnyHike)[];
15
- listEvents(): AnyEvent[];
16
- }
17
- export declare const topo: (name: string, ...modules: Record<string, unknown>[]) => Topo;
18
- //# sourceMappingURL=topo.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"topo.d.ts","sourceRoot":"","sources":["../src/topo.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAM3C,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC/C,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7C,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC/C,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;IAChD,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,IAAI,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,EAAE,CAAC;IAC/B,UAAU,IAAI,QAAQ,EAAE,CAAC;CAC1B;AA6FD,eAAO,MAAM,IAAI,GACf,MAAM,MAAM,EACZ,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KACpC,IAcF,CAAC"}
package/dist/topo.js DELETED
@@ -1,80 +0,0 @@
1
- /**
2
- * Application entry point — scans module exports to build a topology graph.
3
- */
4
- import { ValidationError } from './errors.js';
5
- const isRegistrable = (value) => {
6
- if (typeof value !== 'object' || value === null) {
7
- return false;
8
- }
9
- const { kind } = value;
10
- return kind === 'trail' || kind === 'hike' || kind === 'event';
11
- };
12
- // ---------------------------------------------------------------------------
13
- // Topo implementation
14
- // ---------------------------------------------------------------------------
15
- const createTopo = (name, trails, hikes, events) => ({
16
- events,
17
- get(id) {
18
- return trails.get(id) ?? hikes.get(id);
19
- },
20
- has(id) {
21
- return trails.has(id) || hikes.has(id);
22
- },
23
- hikes,
24
- list() {
25
- return [...trails.values(), ...hikes.values()];
26
- },
27
- listEvents() {
28
- return [...events.values()];
29
- },
30
- name,
31
- trails,
32
- });
33
- // ---------------------------------------------------------------------------
34
- // topo()
35
- // ---------------------------------------------------------------------------
36
- /** Register a single registrable value into the appropriate map. */
37
- const register = (value, trails, hikes, events) => {
38
- const { id } = value;
39
- const registrars = {
40
- event: () => {
41
- if (events.has(id)) {
42
- throw new ValidationError(`Duplicate event ID: "${id}"`);
43
- }
44
- events.set(id, value);
45
- },
46
- hike: () => {
47
- if (hikes.has(id)) {
48
- throw new ValidationError(`Duplicate hike ID: "${id}"`);
49
- }
50
- if (trails.has(id)) {
51
- throw new ValidationError(`ID collision: hike "${id}" conflicts with an existing trail of the same ID`);
52
- }
53
- hikes.set(id, value);
54
- },
55
- trail: () => {
56
- if (trails.has(id)) {
57
- throw new ValidationError(`Duplicate trail ID: "${id}"`);
58
- }
59
- if (hikes.has(id)) {
60
- throw new ValidationError(`ID collision: trail "${id}" conflicts with an existing hike of the same ID`);
61
- }
62
- trails.set(id, value);
63
- },
64
- };
65
- registrars[value.kind]?.();
66
- };
67
- export const topo = (name, ...modules) => {
68
- const trails = new Map();
69
- const hikes = new Map();
70
- const events = new Map();
71
- for (const mod of modules) {
72
- for (const value of Object.values(mod)) {
73
- if (isRegistrable(value)) {
74
- register(value, trails, hikes, events);
75
- }
76
- }
77
- }
78
- return createTopo(name, trails, hikes, events);
79
- };
80
- //# sourceMappingURL=topo.js.map
package/dist/topo.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"topo.js","sourceRoot":"","sources":["../src/topo.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA0B9C,MAAM,aAAa,GAAG,CAAC,KAAc,EAAwB,EAAE;IAC7D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CA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K,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;YACvC,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;YACzC,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC,CAAC"}
package/dist/trail.d.ts DELETED
@@ -1,83 +0,0 @@
1
- import type { z } from 'zod';
2
- import type { FieldOverride } from './derive.js';
3
- import type { Result } from './result.js';
4
- import type { Implementation, TrailContext } from './types.js';
5
- /**
6
- * A named example for documentation and testing.
7
- *
8
- * The `input` field accepts `Partial<I>` so that fields with schema defaults
9
- * (e.g. `z.number().default(20)`) can be omitted from examples. The schema
10
- * fills in defaults at validation time.
11
- */
12
- export interface TrailExample<I, O> {
13
- /** Human-readable name */
14
- readonly name: string;
15
- /** Optional description of what this example demonstrates */
16
- readonly description?: string | undefined;
17
- /** The input value — fields with schema defaults may be omitted */
18
- readonly input: Partial<I>;
19
- /** Expected output for success-path examples */
20
- readonly expected?: O | undefined;
21
- /** Error class name for error-path examples */
22
- readonly error?: string | undefined;
23
- }
24
- /** Everything needed to define a trail (minus the id) */
25
- export interface TrailSpec<I, O> {
26
- /** Zod schema for validating input */
27
- readonly input: z.ZodType<I>;
28
- /** Zod schema for validating output (optional — some trails are fire-and-forget) */
29
- readonly output?: z.ZodType<O> | undefined;
30
- /** The pure function that does the work (sync or async authoring) */
31
- readonly implementation: Implementation<I, O>;
32
- /** Human-readable description */
33
- readonly description?: string | undefined;
34
- /** Named examples for docs and testing */
35
- readonly examples?: readonly TrailExample<I, O>[] | undefined;
36
- /** Trail is read-only (no side effects) */
37
- readonly readOnly?: boolean | undefined;
38
- /** Trail is destructive (deletes or overwrites data) */
39
- readonly destructive?: boolean | undefined;
40
- /** Trail is idempotent (safe to retry) */
41
- readonly idempotent?: boolean | undefined;
42
- /** Arbitrary metadata for tooling and filtering */
43
- readonly markers?: Readonly<Record<string, unknown>> | undefined;
44
- /** Named sets of downstream trail IDs that may be invoked */
45
- readonly detours?: Readonly<Record<string, readonly string[]>> | undefined;
46
- /** Per-field overrides for deriveFields() (labels, hints, options) */
47
- readonly fields?: Readonly<Record<string, FieldOverride>> | undefined;
48
- }
49
- /** A fully-defined trail — the unit of work in the Trails system */
50
- export interface Trail<I, O> extends Omit<TrailSpec<I, O>, 'implementation'> {
51
- readonly kind: 'trail';
52
- readonly id: string;
53
- readonly implementation: Implementation<I, O>;
54
- }
55
- /**
56
- * Create a trail definition.
57
- *
58
- * Returns a frozen object with `kind: "trail"` and all spec fields.
59
- * The trail is inert until handed to a runner.
60
- *
61
- * @example
62
- * ```typescript
63
- * // ID as first argument (recommended for human authoring)
64
- * const show = trail("entity.show", {
65
- * input: z.object({ name: z.string() }),
66
- * implementation: (input) => Result.ok(entity),
67
- * });
68
- *
69
- * // Full spec object (for programmatic generation)
70
- * const show = trail({
71
- * id: "entity.show",
72
- * input: z.object({ name: z.string() }),
73
- * implementation: (input) => Result.ok(entity),
74
- * });
75
- * ```
76
- */
77
- export declare function trail<I, O>(id: string, spec: TrailSpec<I, O>): Trail<I, O>;
78
- export declare function trail<I, O>(spec: TrailSpec<I, O> & {
79
- readonly id: string;
80
- }): Trail<I, O>;
81
- export type AnyTrail = Trail<any, any>;
82
- export type { Implementation, TrailContext, Result };
83
- //# sourceMappingURL=trail.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"trail.d.ts","sourceRoot":"","sources":["../src/trail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,cAAc,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Y,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC"}
package/dist/trail.js DELETED
@@ -1,16 +0,0 @@
1
- export function trail(idOrSpec, maybeSpec) {
2
- const resolved = typeof idOrSpec === 'string'
3
- ? { id: idOrSpec, spec: maybeSpec }
4
- : { id: idOrSpec.id, spec: idOrSpec };
5
- if (!resolved.spec) {
6
- throw new TypeError('trail() requires a spec when an id is provided');
7
- }
8
- const { implementation, ...spec } = resolved.spec;
9
- return Object.freeze({
10
- ...spec,
11
- id: resolved.id,
12
- implementation: async (input, ctx) => await implementation(input, ctx),
13
- kind: 'trail',
14
- });
15
- }
16
- //# sourceMappingURL=trail.js.map
package/dist/trail.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"trail.js","sourceRoot":"","sources":["../src/trail.ts"],"names":[],"mappings":"AAqGA,MAAM,UAAU,KAAK,CACnB,QAA8D,EAC9D,SAA2B;IAE3B,MAAM,QAAQ,GACZ,OAAO,QAAQ,KAAK,QAAQ;QAC1B,CAAC,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;QACnC,CAAC,CAAC,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAE1C,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,IAAI,SAAS,CAAC,gDAAgD,CAAC,CAAC;IACxE,CAAC;IAED,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC;IAElD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,GAAG,IAAI;QACP,EAAE,EAAE,QAAQ,CAAC,EAAE;QACf,cAAc,EAAE,KAAK,EAAE,KAAQ,EAAE,GAAiB,EAAE,EAAE,CACpD,MAAM,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC;QAClC,IAAI,EAAE,OAAgB;KACvB,CAAC,CAAC;AACL,CAAC"}
package/dist/types.d.ts DELETED
@@ -1,46 +0,0 @@
1
- import type { Result } from './result.js';
2
- /**
3
- * Trail implementation — sync or async.
4
- *
5
- * Authors can return `Result` directly or wrap it in a `Promise`. The framework
6
- * normalizes with `await` at every call site, so both forms work transparently.
7
- */
8
- 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 FollowFn = <O>(id: string, input: unknown) => Promise<Result<O, Error>>;
11
- /** Callback for reporting progress from long-running trails */
12
- export type ProgressCallback = (event: ProgressEvent) => void;
13
- /** Structured progress event emitted during trail execution */
14
- export interface ProgressEvent {
15
- readonly type: 'start' | 'progress' | 'complete' | 'error';
16
- readonly current?: number | undefined;
17
- readonly total?: number | undefined;
18
- readonly message?: string | undefined;
19
- readonly ts: string;
20
- }
21
- /** Minimal logger interface — implementations can bridge to any logging library */
22
- export interface Logger {
23
- readonly name?: string | undefined;
24
- trace(message: string, data?: Record<string, unknown>): void;
25
- debug(message: string, data?: Record<string, unknown>): void;
26
- info(message: string, data?: Record<string, unknown>): void;
27
- warn(message: string, data?: Record<string, unknown>): void;
28
- error(message: string, data?: Record<string, unknown>): void;
29
- fatal(message: string, data?: Record<string, unknown>): void;
30
- child(context: Record<string, unknown>): Logger;
31
- }
32
- /** Runtime context threaded through every trail execution */
33
- export interface TrailContext {
34
- readonly requestId: string;
35
- readonly signal: AbortSignal;
36
- readonly follow?: FollowFn | undefined;
37
- readonly permit?: unknown | undefined;
38
- readonly workspaceRoot?: string | undefined;
39
- readonly logger?: Logger | undefined;
40
- readonly progress?: ProgressCallback | undefined;
41
- readonly cwd?: string | undefined;
42
- readonly env?: Record<string, string | undefined> | undefined;
43
- readonly [key: string]: unknown;
44
- }
45
- export type Surface = 'cli' | 'mcp' | 'http' | 'ws';
46
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.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C;AAED,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,IAAI,CAAC"}
package/dist/types.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
package/dist/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -1,24 +0,0 @@
1
- /**
2
- * Structural validation for a Topo graph.
3
- *
4
- * Checks hike follows references, example input validity, event origin
5
- * references, and output schema completeness. Returns a Result with all
6
- * issues collected into a single ValidationError.
7
- */
8
- import { ValidationError } from './errors.js';
9
- import { Result } from './result.js';
10
- import type { Topo } from './topo.js';
11
- export interface TopoIssue {
12
- readonly trailId: string;
13
- readonly rule: string;
14
- readonly message: string;
15
- }
16
- /**
17
- * Validate the structural integrity of a Topo graph.
18
- *
19
- * Checks follows references, example inputs, event origins, and output
20
- * schema presence. Returns `Result.ok()` when no issues are found, or
21
- * `Result.err(ValidationError)` with all issues in the error context.
22
- */
23
- export declare const validateTopo: (topo: Topo) => Result<void, ValidationError>;
24
- //# sourceMappingURL=validate-topo.d.ts.map
@@ -1 +0,0 @@
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;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;AA+JD;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,IAAI,KAAG,MAAM,CAAC,IAAI,EAAE,eAAe,CAmBrE,CAAC"}
@@ -1,156 +0,0 @@
1
- /**
2
- * Structural validation for a Topo graph.
3
- *
4
- * Checks hike follows references, example input validity, event origin
5
- * references, and output schema completeness. Returns a Result with all
6
- * issues collected into a single ValidationError.
7
- */
8
- import { ValidationError } from './errors.js';
9
- import { Result } from './result.js';
10
- import { validateInput } from './validation.js';
11
- // ---------------------------------------------------------------------------
12
- // Validators
13
- // ---------------------------------------------------------------------------
14
- const WHITE = 0;
15
- const GRAY = 1;
16
- const BLACK = 2;
17
- /** Build an adjacency list and initial color map from hikes. */
18
- const buildFollowGraph = (hikes) => {
19
- const graph = new Map();
20
- for (const [id, h] of hikes) {
21
- graph.set(id, h.follows);
22
- }
23
- const color = new Map();
24
- for (const id of graph.keys()) {
25
- color.set(id, WHITE);
26
- }
27
- return { color, graph };
28
- };
29
- /** Detect multi-node cycles in the hike follow graph via DFS. */
30
- const detectFollowCycles = (hikes) => {
31
- const issues = [];
32
- const { color, graph } = buildFollowGraph(hikes);
33
- const dfs = (node, path) => {
34
- color.set(node, GRAY);
35
- for (const next of graph.get(node) ?? []) {
36
- if (!graph.has(next)) {
37
- continue;
38
- }
39
- const c = color.get(next) ?? WHITE;
40
- if (c === GRAY) {
41
- const cycle = [...path.slice(path.indexOf(next)), next];
42
- issues.push({
43
- message: `Cycle detected: ${cycle.join(' → ')}`,
44
- rule: 'follow-cycle',
45
- trailId: next,
46
- });
47
- }
48
- else if (c === WHITE) {
49
- dfs(next, [...path, next]);
50
- }
51
- }
52
- color.set(node, BLACK);
53
- };
54
- for (const id of graph.keys()) {
55
- if (color.get(id) === WHITE) {
56
- dfs(id, [id]);
57
- }
58
- }
59
- return issues;
60
- };
61
- const checkFollows = (hikes, topo) => {
62
- const issues = [];
63
- for (const [id, hike] of hikes) {
64
- for (const followId of hike.follows) {
65
- if (followId === id) {
66
- issues.push({
67
- message: `Hike follows itself`,
68
- rule: 'no-self-follow',
69
- trailId: id,
70
- });
71
- }
72
- else if (!topo.has(followId)) {
73
- issues.push({
74
- message: `Follows "${followId}" which is not in the topo`,
75
- rule: 'follows-exist',
76
- trailId: id,
77
- });
78
- }
79
- }
80
- }
81
- issues.push(...detectFollowCycles(hikes));
82
- return issues;
83
- };
84
- const checkOneExample = (id, example, inputSchema, hasOutput) => {
85
- const issues = [];
86
- const result = validateInput(inputSchema, example.input);
87
- if (result.isErr() && example.error !== 'ValidationError') {
88
- issues.push({
89
- message: `Example "${example.name}" input does not parse against schema`,
90
- rule: 'example-input-valid',
91
- trailId: id,
92
- });
93
- }
94
- if (example.expected !== undefined && !hasOutput) {
95
- issues.push({
96
- message: `Example "${example.name}" has expected output but trail has no output schema`,
97
- rule: 'output-schema-present',
98
- trailId: id,
99
- });
100
- }
101
- return issues;
102
- };
103
- const checkExamples = (trails) => {
104
- const issues = [];
105
- for (const [id, trail] of trails) {
106
- if (!trail.examples) {
107
- continue;
108
- }
109
- for (const example of trail.examples) {
110
- issues.push(...checkOneExample(id, example, trail.input, !!trail.output));
111
- }
112
- }
113
- return issues;
114
- };
115
- const checkEventOrigins = (events, topo) => {
116
- const issues = [];
117
- for (const [id, evt] of events) {
118
- if (!evt.from) {
119
- continue;
120
- }
121
- for (const originId of evt.from) {
122
- if (!topo.has(originId)) {
123
- issues.push({
124
- message: `Event origin "${originId}" is not in the topo`,
125
- rule: 'event-origin-exists',
126
- trailId: id,
127
- });
128
- }
129
- }
130
- }
131
- return issues;
132
- };
133
- // ---------------------------------------------------------------------------
134
- // Public API
135
- // ---------------------------------------------------------------------------
136
- /**
137
- * Validate the structural integrity of a Topo graph.
138
- *
139
- * Checks follows references, example inputs, event origins, and output
140
- * schema presence. Returns `Result.ok()` when no issues are found, or
141
- * `Result.err(ValidationError)` with all issues in the error context.
142
- */
143
- export const validateTopo = (topo) => {
144
- const issues = [
145
- ...checkFollows(topo.hikes, topo),
146
- ...checkExamples(topo.trails),
147
- ...checkEventOrigins(topo.events, topo),
148
- ];
149
- if (issues.length === 0) {
150
- return Result.ok();
151
- }
152
- return Result.err(new ValidationError(`Topo validation failed with ${issues.length} issue(s)`, {
153
- context: { issues },
154
- }));
155
- };
156
- //# sourceMappingURL=validate-topo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate-topo.js","sourceRoot":"","sources":["../src/validate-topo.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAYhD,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E,MAAM,KAAK,GAAG,CAAC,CAAC;AAChB,MAAM,IAAI,GAAG,CAAC,CAAC;AACf,MAAM,KAAK,GAAG,CAAC,CAAC;AAEhB,gEAAgE;AAChE,MAAM,gBAAgB,GAAG,CACvB,KAAmC,EAInC,EAAE;IACF,MAAM,KAAK,GAAG,IAAI,GAAG,EAA6B,CAAC;IACnD,KAAK,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC;QAC5B,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IACxC,KAAK,MAAM,EAAE,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;QAC9B,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC1B,CAAC,CAAC;AAEF,iEAAiE;AACjE,MAAM,kBAAkB,GAAG,CACzB,KAAmC,EACtB,EAAE;IACf,MAAM,MAAM,GAAgB,EAAE,CAAC;IAC/B,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAE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