@ontrails/core 1.0.0-beta.11 → 1.0.0-beta.13
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.
- package/.turbo/turbo-lint.log +1 -1
- package/CHANGELOG.md +67 -30
- package/README.md +19 -19
- package/dist/context.d.ts +1 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +5 -4
- package/dist/context.js.map +1 -1
- package/dist/derive.d.ts +8 -3
- package/dist/derive.d.ts.map +1 -1
- package/dist/derive.js +7 -7
- package/dist/derive.js.map +1 -1
- package/dist/event.d.ts +4 -41
- package/dist/event.d.ts.map +1 -1
- package/dist/event.js +4 -14
- package/dist/event.js.map +1 -1
- package/dist/execute.d.ts +11 -9
- package/dist/execute.d.ts.map +1 -1
- package/dist/execute.js +34 -151
- package/dist/execute.js.map +1 -1
- package/dist/gate.d.ts +17 -0
- package/dist/gate.d.ts.map +1 -0
- package/dist/gate.js +21 -0
- package/dist/gate.js.map +1 -0
- package/dist/index.d.ts +10 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/layer.d.ts +5 -16
- package/dist/layer.d.ts.map +1 -1
- package/dist/layer.js +3 -20
- package/dist/layer.js.map +1 -1
- package/dist/provision-config.d.ts +22 -0
- package/dist/provision-config.d.ts.map +1 -0
- package/dist/provision-config.js +210 -0
- package/dist/provision-config.js.map +1 -0
- package/dist/provision.d.ts +71 -0
- package/dist/provision.d.ts.map +1 -0
- package/dist/provision.js +56 -0
- package/dist/provision.js.map +1 -0
- package/dist/run.d.ts +27 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +34 -0
- package/dist/run.js.map +1 -0
- package/dist/service-config.d.ts +22 -0
- package/dist/service-config.d.ts.map +1 -0
- package/dist/service-config.js +210 -0
- package/dist/service-config.js.map +1 -0
- package/dist/service.d.ts +39 -37
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +21 -21
- package/dist/service.js.map +1 -1
- package/dist/signal.d.ts +33 -0
- package/dist/signal.d.ts.map +1 -0
- package/dist/signal.js +17 -0
- package/dist/signal.js.map +1 -0
- package/dist/topo.d.ts +10 -10
- package/dist/topo.d.ts.map +1 -1
- package/dist/topo.js +48 -35
- package/dist/topo.js.map +1 -1
- package/dist/trail.d.ts +19 -17
- package/dist/trail.d.ts.map +1 -1
- package/dist/trail.js +5 -4
- package/dist/trail.js.map +1 -1
- package/dist/types.d.ts +26 -9
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -1
- package/dist/types.js.map +1 -1
- package/dist/validate-topo.d.ts +2 -2
- package/dist/validate-topo.js +31 -31
- package/dist/validate-topo.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/context.test.ts +8 -8
- package/src/__tests__/execute.test.ts +124 -122
- package/src/__tests__/{layer.test.ts → gate.test.ts} +26 -26
- package/src/__tests__/{dispatch.test.ts → run.test.ts} +39 -39
- package/src/__tests__/service-config.test.ts +228 -0
- package/src/__tests__/service.test.ts +71 -71
- package/src/__tests__/{event.test.ts → signal.test.ts} +15 -15
- package/src/__tests__/topo.test.ts +54 -54
- package/src/__tests__/trail-permit.test.ts +60 -0
- package/src/__tests__/trail.test.ts +58 -58
- package/src/__tests__/type-utils.test.ts +3 -3
- package/src/__tests__/validate-topo.test.ts +38 -38
- package/src/context.ts +5 -4
- package/src/derive.ts +8 -8
- package/src/event.ts +11 -73
- package/src/execute.ts +59 -238
- package/src/{layer.ts → gate.ts} +13 -13
- package/src/index.ts +26 -21
- package/src/provision-config.ts +373 -0
- package/src/provision.ts +148 -0
- package/src/{dispatch.ts → run.ts} +8 -8
- package/src/signal.ts +65 -0
- package/src/topo.ts +74 -52
- package/src/trail.ts +30 -23
- package/src/types.ts +30 -10
- package/src/validate-topo.ts +33 -33
- package/tsconfig.tsbuildinfo +1 -1
- package/src/service.ts +0 -139
package/dist/execute.js
CHANGED
|
@@ -1,32 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Centralized trail execution pipeline.
|
|
3
3
|
*
|
|
4
|
-
* Validates input, builds context, composes
|
|
4
|
+
* Validates input, builds context, composes gates, and runs the
|
|
5
5
|
* implementation. Surfaces (CLI, MCP, HTTP) delegate here instead
|
|
6
6
|
* of reimplementing the pipeline.
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import { composeGates } from './gate.js';
|
|
9
9
|
import { createTrailContext } from './context.js';
|
|
10
10
|
import { InternalError } from './errors.js';
|
|
11
11
|
import { Result } from './result.js';
|
|
12
|
-
import {
|
|
12
|
+
import { createProvisionLookup } from './provision.js';
|
|
13
|
+
import { resolveProvisions } from './provision-config.js';
|
|
13
14
|
import { validateInput } from './validation.js';
|
|
14
15
|
// ---------------------------------------------------------------------------
|
|
15
16
|
// Context resolution
|
|
16
17
|
// ---------------------------------------------------------------------------
|
|
17
|
-
|
|
18
|
-
* Build a TrailContext from options.
|
|
19
|
-
*
|
|
20
|
-
* Resolution order:
|
|
21
|
-
* 1. Factory (`createContext`) or `createTrailContext()` defaults.
|
|
22
|
-
* 2. Partial `ctx` overrides merged on top.
|
|
23
|
-
* 3. `signal` override takes final precedence.
|
|
24
|
-
*/
|
|
25
|
-
const resolveContext = async (options) => {
|
|
26
|
-
const seed = options?.createContext
|
|
27
|
-
? await options.createContext()
|
|
28
|
-
: createTrailContext();
|
|
29
|
-
const base = seed.service ? seed : createTrailContext(seed);
|
|
18
|
+
const applyContextOverrides = (base, options) => {
|
|
30
19
|
const withOverrides = options?.ctx
|
|
31
20
|
? {
|
|
32
21
|
...base,
|
|
@@ -34,155 +23,49 @@ const resolveContext = async (options) => {
|
|
|
34
23
|
extensions: { ...base.extensions, ...options.ctx.extensions },
|
|
35
24
|
}
|
|
36
25
|
: base;
|
|
37
|
-
|
|
38
|
-
? { ...withOverrides,
|
|
26
|
+
return options?.abortSignal
|
|
27
|
+
? { ...withOverrides, abortSignal: options.abortSignal }
|
|
39
28
|
: withOverrides;
|
|
40
|
-
if (options?.ctx?.extensions !== undefined ||
|
|
41
|
-
resolved.service === undefined) {
|
|
42
|
-
const bound = { ...resolved };
|
|
43
|
-
bound.service = createServiceLookup(() => bound);
|
|
44
|
-
return bound;
|
|
45
|
-
}
|
|
46
|
-
return resolved;
|
|
47
|
-
};
|
|
48
|
-
const singletonServices = new WeakMap();
|
|
49
|
-
/** In-flight service creation promises, keyed by service × context. */
|
|
50
|
-
const pendingCreations = new WeakMap();
|
|
51
|
-
const hasOwnServiceOverride = (overrides, id) => overrides !== undefined && Object.hasOwn(overrides, id);
|
|
52
|
-
const toServiceContext = (ctx) => ({
|
|
53
|
-
cwd: ctx.cwd,
|
|
54
|
-
env: ctx.env,
|
|
55
|
-
workspaceRoot: ctx.workspaceRoot,
|
|
56
|
-
});
|
|
57
|
-
const toServiceContextKey = (ctx) => JSON.stringify({
|
|
58
|
-
cwd: ctx.cwd,
|
|
59
|
-
env: Object.entries(ctx.env ?? {}).toSorted(([left], [right]) => left.localeCompare(right)),
|
|
60
|
-
workspaceRoot: ctx.workspaceRoot,
|
|
61
|
-
});
|
|
62
|
-
const toInternalServiceError = (id, error) => {
|
|
63
|
-
const cause = error instanceof Error ? error : undefined;
|
|
64
|
-
const message = cause?.message ?? String(error);
|
|
65
|
-
return new InternalError(`Service "${id}" failed to resolve: ${message}`, {
|
|
66
|
-
...(cause ? { cause } : {}),
|
|
67
|
-
context: { serviceId: id },
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
const getCachedSingletonService = (declaredService, serviceContext) => {
|
|
71
|
-
const scopedCache = singletonServices.get(declaredService);
|
|
72
|
-
if (scopedCache === undefined) {
|
|
73
|
-
return { found: false, value: undefined };
|
|
74
|
-
}
|
|
75
|
-
const key = toServiceContextKey(serviceContext);
|
|
76
|
-
if (!scopedCache.has(key)) {
|
|
77
|
-
return { found: false, value: undefined };
|
|
78
|
-
}
|
|
79
|
-
return {
|
|
80
|
-
found: true,
|
|
81
|
-
value: scopedCache.get(key),
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
const getProvidedService = (ctx, overrides, declaredService, serviceContext) => {
|
|
85
|
-
const { id } = declaredService;
|
|
86
|
-
if (hasOwnServiceOverride(overrides, id)) {
|
|
87
|
-
return Result.ok(overrides[id]);
|
|
88
|
-
}
|
|
89
|
-
if (Object.hasOwn(ctx.extensions ?? {}, id)) {
|
|
90
|
-
return Result.ok(ctx.extensions?.[id]);
|
|
91
|
-
}
|
|
92
|
-
const cached = getCachedSingletonService(declaredService, serviceContext);
|
|
93
|
-
if (cached.found) {
|
|
94
|
-
return Result.ok(cached.value);
|
|
95
|
-
}
|
|
96
|
-
return undefined;
|
|
97
|
-
};
|
|
98
|
-
const getSingletonServiceCache = (declaredService) => {
|
|
99
|
-
const existing = singletonServices.get(declaredService);
|
|
100
|
-
if (existing !== undefined) {
|
|
101
|
-
return existing;
|
|
102
|
-
}
|
|
103
|
-
const created = new Map();
|
|
104
|
-
singletonServices.set(declaredService, created);
|
|
105
|
-
return created;
|
|
106
|
-
};
|
|
107
|
-
const doCreateServiceInstance = async (declaredService, serviceContext) => {
|
|
108
|
-
try {
|
|
109
|
-
const created = await declaredService.create(serviceContext);
|
|
110
|
-
if (created.isErr()) {
|
|
111
|
-
return Result.err(created.error);
|
|
112
|
-
}
|
|
113
|
-
const instance = created.unwrap();
|
|
114
|
-
getSingletonServiceCache(declaredService).set(toServiceContextKey(serviceContext), instance);
|
|
115
|
-
return Result.ok(instance);
|
|
116
|
-
}
|
|
117
|
-
catch (error) {
|
|
118
|
-
return Result.err(toInternalServiceError(declaredService.id, error));
|
|
119
|
-
}
|
|
120
29
|
};
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
30
|
+
const bindProvisionLookup = (resolved, options) => {
|
|
31
|
+
if (options?.ctx?.extensions === undefined &&
|
|
32
|
+
resolved.provision !== undefined) {
|
|
33
|
+
return resolved;
|
|
34
|
+
}
|
|
35
|
+
const bound = { ...resolved };
|
|
36
|
+
const lookup = createProvisionLookup(() => bound);
|
|
37
|
+
bound.provision = lookup;
|
|
38
|
+
return bound;
|
|
129
39
|
};
|
|
130
40
|
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
41
|
+
* Build a TrailContext from options.
|
|
42
|
+
*
|
|
43
|
+
* Resolution order:
|
|
44
|
+
* 1. Factory (`createContext`) or `createTrailContext()` defaults.
|
|
45
|
+
* 2. Partial `ctx` overrides merged on top.
|
|
46
|
+
* 3. `abortSignal` override takes final precedence.
|
|
134
47
|
*/
|
|
135
|
-
const
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
trackPendingCreation(declaredService, key, promise);
|
|
143
|
-
try {
|
|
144
|
-
return await promise;
|
|
145
|
-
}
|
|
146
|
-
finally {
|
|
147
|
-
pendingCreations.get(declaredService)?.delete(key);
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
const resolveServiceInstance = async (declaredService, ctx, serviceContext, overrides) => getProvidedService(ctx, overrides, declaredService, serviceContext) ??
|
|
151
|
-
(await createServiceInstance(declaredService, serviceContext));
|
|
152
|
-
const withResolvedServices = (ctx, resolvedServices) => {
|
|
153
|
-
const extensions = { ...ctx.extensions, ...resolvedServices };
|
|
154
|
-
const resolvedCtx = { ...ctx, extensions };
|
|
155
|
-
resolvedCtx.service = createServiceLookup(() => resolvedCtx);
|
|
156
|
-
return resolvedCtx;
|
|
157
|
-
};
|
|
158
|
-
const resolveServices = async (trail, ctx, overrides) => {
|
|
159
|
-
if (trail.services.length === 0) {
|
|
160
|
-
return Result.ok(ctx);
|
|
161
|
-
}
|
|
162
|
-
const resolvedServices = {};
|
|
163
|
-
const serviceContext = toServiceContext(ctx);
|
|
164
|
-
for (const declaredService of trail.services) {
|
|
165
|
-
const resolved = await resolveServiceInstance(declaredService, ctx, serviceContext, overrides);
|
|
166
|
-
if (resolved.isErr()) {
|
|
167
|
-
return resolved;
|
|
168
|
-
}
|
|
169
|
-
resolvedServices[declaredService.id] = resolved.unwrap();
|
|
170
|
-
}
|
|
171
|
-
return Result.ok(withResolvedServices(ctx, resolvedServices));
|
|
48
|
+
const resolveContext = async (options) => {
|
|
49
|
+
const seed = options?.createContext
|
|
50
|
+
? await options.createContext()
|
|
51
|
+
: createTrailContext();
|
|
52
|
+
const base = seed.provision ? seed : createTrailContext(seed);
|
|
53
|
+
const resolved = applyContextOverrides(base, options);
|
|
54
|
+
return bindProvisionLookup(resolved, options);
|
|
172
55
|
};
|
|
173
56
|
const prepareContext = async (trail, options) => {
|
|
174
57
|
const baseCtx = await resolveContext(options);
|
|
175
|
-
return await
|
|
58
|
+
return await resolveProvisions(trail, baseCtx, options?.provisions, options?.configValues);
|
|
176
59
|
};
|
|
177
|
-
const runTrail = async (trail, input, ctx,
|
|
178
|
-
const impl =
|
|
60
|
+
const runTrail = async (trail, input, ctx, gates) => {
|
|
61
|
+
const impl = composeGates([...gates], trail, trail.blaze);
|
|
179
62
|
return await impl(input, ctx);
|
|
180
63
|
};
|
|
181
64
|
// ---------------------------------------------------------------------------
|
|
182
65
|
// Pipeline
|
|
183
66
|
// ---------------------------------------------------------------------------
|
|
184
67
|
/**
|
|
185
|
-
* Execute a trail through the standard validate-context-
|
|
68
|
+
* Execute a trail through the standard validate-context-gates-run pipeline.
|
|
186
69
|
*
|
|
187
70
|
* The function never throws -- unexpected exceptions are caught and
|
|
188
71
|
* returned as `Result.err(InternalError)`.
|
|
@@ -197,7 +80,7 @@ export const executeTrail = async (trail, rawInput, options) => {
|
|
|
197
80
|
if (resolvedCtx.isErr()) {
|
|
198
81
|
return resolvedCtx;
|
|
199
82
|
}
|
|
200
|
-
return await runTrail(trail, validated.value, resolvedCtx.value, options?.
|
|
83
|
+
return await runTrail(trail, validated.value, resolvedCtx.value, options?.gates ?? []);
|
|
201
84
|
}
|
|
202
85
|
catch (error) {
|
|
203
86
|
const message = error instanceof Error ? error.message : String(error);
|
package/dist/execute.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../src/execute.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../src/execute.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA8BhD,8EAA8E;AAC9E,qBAAqB;AACrB,8EAA8E;AAE9E,MAAM,qBAAqB,GAAG,CAC5B,IAAsB,EACtB,OAA6B,EACX,EAAE;IACpB,MAAM,aAAa,GAAG,OAAO,EAAE,GAAG;QAChC,CAAC,CAAC;YACE,GAAG,IAAI;YACP,GAAG,OAAO,CAAC,GAAG;YACd,UAAU,EAAE,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE;SAC9D;QACH,CAAC,CAAC,IAAI,CAAC;IAET,OAAO,OAAO,EAAE,WAAW;QACzB,CAAC,CAAC,EAAE,GAAG,aAAa,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE;QACxD,CAAC,CAAC,aAAa,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAC1B,QAA0B,EAC1B,OAA6B,EACf,EAAE;IAChB,IACE,OAAO,EAAE,GAAG,EAAE,UAAU,KAAK,SAAS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,MAAM,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAChC,CAAC,CAAC;AAEF,8EAA8E;AAC9E,WAAW;AACX,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAC/B,KAAe,EACf,QAAiB,EACjB,OAA6B,EACI,EAAE;IACnC,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,aAAa,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACvD,IAAI,SAAS,CAAC,KAAK,EAAE,EAAE,CAAC;YACtB,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACzD,IAAI,WAAW,CAAC,KAAK,EAAE,EAAE,CAAC;YACxB,OAAO,WAAW,CAAC;QACrB,CAAC;QAED,OAAO,MAAM,QAAQ,CACnB,KAAK,EACL,SAAS,CAAC,KAAK,EACf,WAAW,CAAC,KAAK,EACjB,OAAO,EAAE,KAAK,IAAI,EAAE,CACrB,CAAC;IACJ,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;IAChD,CAAC;AACH,CAAC,CAAC"}
|
package/dist/gate.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Trail } from './trail.js';
|
|
2
|
+
import type { Implementation } from './types.js';
|
|
3
|
+
/** A composable gate that wraps trail implementations. */
|
|
4
|
+
export interface Gate {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly description?: string | undefined;
|
|
7
|
+
/** Wrap a trail's implementation, returning a new implementation. */
|
|
8
|
+
wrap<I, O>(trail: Trail<I, O>, implementation: Implementation<I, O>): Implementation<I, O>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Apply gates outermost-first: gates[0] wraps gates[1] wraps ... wraps
|
|
12
|
+
* the base implementation.
|
|
13
|
+
*
|
|
14
|
+
* An empty gates array returns the implementation unchanged.
|
|
15
|
+
*/
|
|
16
|
+
export declare const composeGates: <I, O>(gates: readonly Gate[], trail: Trail<I, O>, implementation: Implementation<I, O>) => Implementation<I, O>;
|
|
17
|
+
//# sourceMappingURL=gate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../src/gate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAMjD,0DAA0D;AAC1D,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1C,qEAAqE;IACrE,IAAI,CAAC,CAAC,EAAE,CAAC,EACP,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAClB,cAAc,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,GACnC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CACzB;AAMD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,CAAC,EAC/B,OAAO,SAAS,IAAI,EAAE,EACtB,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAClB,gBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,KACnC,cAAc,CAAC,CAAC,EAAE,CAAC,CAUrB,CAAC"}
|
package/dist/gate.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Composition
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
/**
|
|
5
|
+
* Apply gates outermost-first: gates[0] wraps gates[1] wraps ... wraps
|
|
6
|
+
* the base implementation.
|
|
7
|
+
*
|
|
8
|
+
* An empty gates array returns the implementation unchanged.
|
|
9
|
+
*/
|
|
10
|
+
export const composeGates = (gates, trail, implementation) => {
|
|
11
|
+
// Fold right so gates[0] is the outermost wrapper.
|
|
12
|
+
let result = implementation;
|
|
13
|
+
for (let i = gates.length - 1; i >= 0; i -= 1) {
|
|
14
|
+
const gate = gates[i];
|
|
15
|
+
if (gate) {
|
|
16
|
+
result = gate.wrap(trail, result);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=gate.js.map
|
package/dist/gate.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate.js","sourceRoot":"","sources":["../src/gate.ts"],"names":[],"mappings":"AAmBA,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,KAAsB,EACtB,KAAkB,EAClB,cAAoC,EACd,EAAE;IACxB,mDAAmD;IACnD,IAAI,MAAM,GAAG,cAAc,CAAC;IAC5B,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
export { Result } from './result.js';
|
|
2
2
|
export { TrailsError, ValidationError, AmbiguousError, AssertionError, NotFoundError, AlreadyExistsError, ConflictError, PermissionError, TimeoutError, RateLimitError, NetworkError, InternalError, AuthError, CancelledError, exitCodeMap, statusCodeMap, jsonRpcCodeMap, retryableMap, isRetryable, isTrailsError, } from './errors.js';
|
|
3
3
|
export type { ErrorCategory } from './errors.js';
|
|
4
|
-
export type { Implementation, TrailContext, TrailContextInit,
|
|
4
|
+
export type { Implementation, TrailContext, TrailContextInit, CrossFn, BasePermit, PermitRequirement, ProgressCallback, ProgressEvent, Logger, ProvisionLookup, } from './types.js';
|
|
5
|
+
export { TRAILHEAD_KEY } from './types.js';
|
|
5
6
|
export { createTrailContext } from './context.js';
|
|
6
|
-
export {
|
|
7
|
-
export type {
|
|
7
|
+
export { createProvisionLookup, findDuplicateProvisionId, isProvision, provision, } from './provision.js';
|
|
8
|
+
export type { AnyProvision, Provision, ProvisionContext, ProvisionOverrideMap, ProvisionSpec, } from './provision.js';
|
|
8
9
|
export { trail } from './trail.js';
|
|
9
10
|
export type { AnyTrail, Intent, Trail, TrailSpec, TrailExample, } from './trail.js';
|
|
10
11
|
export type { TrailInput, TrailOutput, TrailResult } from './type-utils.js';
|
|
11
12
|
export { inputOf, outputOf } from './type-utils.js';
|
|
13
|
+
export { signal } from './signal.js';
|
|
14
|
+
export type { AnySignal, Signal, SignalSpec } from './signal.js';
|
|
12
15
|
export { event } from './event.js';
|
|
13
16
|
export type { AnyEvent, Event, EventSpec } from './event.js';
|
|
14
17
|
export { topo } from './topo.js';
|
|
15
18
|
export type { Topo } from './topo.js';
|
|
16
19
|
export { validateTopo } from './validate-topo.js';
|
|
17
20
|
export type { TopoIssue } from './validate-topo.js';
|
|
18
|
-
export {
|
|
19
|
-
export type {
|
|
21
|
+
export { composeGates } from './gate.js';
|
|
22
|
+
export type { Gate } from './gate.js';
|
|
20
23
|
export { deriveFields } from './derive.js';
|
|
21
24
|
export type { Field, FieldOverride } from './derive.js';
|
|
22
25
|
export { executeTrail } from './execute.js';
|
|
23
26
|
export type { ExecuteTrailOptions } from './execute.js';
|
|
24
|
-
export {
|
|
25
|
-
export type {
|
|
27
|
+
export { run } from './run.js';
|
|
28
|
+
export type { RunOptions } from './run.js';
|
|
26
29
|
export { validateInput, validateOutput, formatZodIssues, zodToJsonSchema, } from './validation.js';
|
|
27
30
|
export { serializeError, deserializeError } from './serialization.js';
|
|
28
31
|
export type { SerializedError } from './serialization.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,WAAW,EACX,aAAa,EACb,cAAc,EACd,YAAY,EACZ,WAAW,EACX,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,YAAY,EACV,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,
|
|
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,WAAW,EACX,aAAa,EACb,cAAc,EACd,YAAY,EACZ,WAAW,EACX,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,aAAa,EAA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,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
CHANGED
|
@@ -2,27 +2,29 @@
|
|
|
2
2
|
export { Result } from './result.js';
|
|
3
3
|
// Errors
|
|
4
4
|
export { TrailsError, ValidationError, AmbiguousError, AssertionError, NotFoundError, AlreadyExistsError, ConflictError, PermissionError, TimeoutError, RateLimitError, NetworkError, InternalError, AuthError, CancelledError, exitCodeMap, statusCodeMap, jsonRpcCodeMap, retryableMap, isRetryable, isTrailsError, } from './errors.js';
|
|
5
|
+
export { TRAILHEAD_KEY } from './types.js';
|
|
5
6
|
// Context factory
|
|
6
7
|
export { createTrailContext } from './context.js';
|
|
7
|
-
//
|
|
8
|
-
export {
|
|
8
|
+
// Provision
|
|
9
|
+
export { createProvisionLookup, findDuplicateProvisionId, isProvision, provision, } from './provision.js';
|
|
9
10
|
// Trail
|
|
10
11
|
export { trail } from './trail.js';
|
|
11
12
|
export { inputOf, outputOf } from './type-utils.js';
|
|
12
|
-
//
|
|
13
|
+
// Signal
|
|
14
|
+
export { signal } from './signal.js';
|
|
13
15
|
export { event } from './event.js';
|
|
14
16
|
// Topo
|
|
15
17
|
export { topo } from './topo.js';
|
|
16
18
|
// Topo validation
|
|
17
19
|
export { validateTopo } from './validate-topo.js';
|
|
18
|
-
//
|
|
19
|
-
export {
|
|
20
|
+
// Gate
|
|
21
|
+
export { composeGates } from './gate.js';
|
|
20
22
|
// Derive
|
|
21
23
|
export { deriveFields } from './derive.js';
|
|
22
24
|
// Execute
|
|
23
25
|
export { executeTrail } from './execute.js';
|
|
24
|
-
//
|
|
25
|
-
export {
|
|
26
|
+
// Run
|
|
27
|
+
export { run } from './run.js';
|
|
26
28
|
// Validation
|
|
27
29
|
export { validateInput, validateOutput, formatZodIssues, zodToJsonSchema, } from './validation.js';
|
|
28
30
|
// Serialization
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,WAAW,EACX,aAAa,EACb,cAAc,EACd,YAAY,EACZ,WAAW,EACX,aAAa,GACd,MAAM,aAAa,CAAC;
|
|
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,WAAW,EACX,aAAa,EACb,cAAc,EACd,YAAY,EACZ,WAAW,EACX,aAAa,GACd,MAAM,aAAa,CAAC;AAgBrB,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,kBAAkB;AAClB,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,YAAY;AACZ,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,WAAW,EACX,SAAS,GACV,MAAM,gBAAgB,CAAC;AASxB,QAAQ;AACR,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAWnC,OAAO,EAAE,OAAO,EAAE,QA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B,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"}
|
package/dist/layer.d.ts
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
readonly description?: string | undefined;
|
|
7
|
-
/** Wrap a trail's implementation, returning a new implementation */
|
|
8
|
-
wrap<I, O>(trail: Trail<I, O>, implementation: Implementation<I, O>): Implementation<I, O>;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Apply layers outermost-first: layers[0] wraps layers[1] wraps ... wraps
|
|
12
|
-
* the base implementation.
|
|
13
|
-
*
|
|
14
|
-
* An empty layers array returns the implementation unchanged.
|
|
15
|
-
*/
|
|
16
|
-
export declare const composeLayers: <I, O>(layers: readonly Layer[], trail: Trail<I, O>, implementation: Implementation<I, O>) => Implementation<I, O>;
|
|
1
|
+
import type { Gate } from './gate.js';
|
|
2
|
+
/** Backward-compatible alias while `Layer` migrates to `Gate`. */
|
|
3
|
+
export type Layer = Gate;
|
|
4
|
+
/** Backward-compatible alias while `composeLayers()` migrates to `composeGates()`. */
|
|
5
|
+
export declare const composeLayers: <I, O>(gates: readonly Gate[], trail: import("./trail.js").Trail<I, O>, implementation: import("./types.js").Implementation<I, O>) => import("./types.js").Implementation<I, O>;
|
|
17
6
|
//# sourceMappingURL=layer.d.ts.map
|
package/dist/layer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layer.d.ts","sourceRoot":"","sources":["../src/layer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"layer.d.ts","sourceRoot":"","sources":["../src/layer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,kEAAkE;AAClE,MAAM,MAAM,KAAK,GAAG,IAAI,CAAC;AAEzB,sFAAsF;AACtF,eAAO,MAAM,aAAa,iLAAe,CAAC"}
|
package/dist/layer.js
CHANGED
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Apply layers outermost-first: layers[0] wraps layers[1] wraps ... wraps
|
|
6
|
-
* the base implementation.
|
|
7
|
-
*
|
|
8
|
-
* An empty layers array returns the implementation unchanged.
|
|
9
|
-
*/
|
|
10
|
-
export const composeLayers = (layers, trail, implementation) => {
|
|
11
|
-
// Fold right so layers[0] is the outermost wrapper
|
|
12
|
-
let result = implementation;
|
|
13
|
-
for (let i = layers.length - 1; i >= 0; i -= 1) {
|
|
14
|
-
const layer = layers[i];
|
|
15
|
-
if (layer) {
|
|
16
|
-
result = layer.wrap(trail, result);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
1
|
+
import { composeGates } from './gate.js';
|
|
2
|
+
/** Backward-compatible alias while `composeLayers()` migrates to `composeGates()`. */
|
|
3
|
+
export const composeLayers = composeGates;
|
|
21
4
|
//# sourceMappingURL=layer.js.map
|
package/dist/layer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layer.js","sourceRoot":"","sources":["../src/layer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"layer.js","sourceRoot":"","sources":["../src/layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAMzC,sFAAsF;AACtF,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provision resolution pipeline.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from execute.ts to keep both modules under the 400 LOC ceiling.
|
|
5
|
+
* Handles config validation, singleton caching, concurrent-creation dedup,
|
|
6
|
+
* and the full resolve-or-create flow for declared provisions.
|
|
7
|
+
*/
|
|
8
|
+
import type { ProvisionOverrideMap } from './provision.js';
|
|
9
|
+
import type { AnyTrail } from './trail.js';
|
|
10
|
+
import type { TrailContext } from './types.js';
|
|
11
|
+
import { Result } from './result.js';
|
|
12
|
+
type ConfigValues = Readonly<Record<string, Record<string, unknown>>>;
|
|
13
|
+
/**
|
|
14
|
+
* Resolve all declared provisions for a trail.
|
|
15
|
+
*
|
|
16
|
+
* Validates per-provision config, checks overrides and caches, and creates
|
|
17
|
+
* new instances as needed. Returns an enriched context with all provision
|
|
18
|
+
* instances injected into extensions.
|
|
19
|
+
*/
|
|
20
|
+
export declare const resolveProvisions: (trail: AnyTrail, ctx: TrailContext, overrides?: ProvisionOverrideMap, configValues?: ConfigValues) => Promise<Result<TrailContext, Error>>;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=provision-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provision-config.d.ts","sourceRoot":"","sources":["../src/provision-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAGV,oBAAoB,EACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAOrC,KAAK,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;AA0TtE;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAC5B,OAAO,QAAQ,EACf,KAAK,YAAY,EACjB,YAAY,oBAAoB,EAChC,eAAe,YAAY,KAC1B,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,CAsBrC,CAAC"}
|