@ontrails/core 1.0.0-beta.1 → 1.0.0-beta.11
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 +121 -0
- package/README.md +54 -11
- package/dist/context.d.ts +2 -2
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +12 -7
- package/dist/context.js.map +1 -1
- package/dist/derive.d.ts +1 -1
- package/dist/derive.d.ts.map +1 -1
- package/dist/derive.js +4 -1
- package/dist/derive.js.map +1 -1
- package/dist/dispatch.d.ts +27 -0
- package/dist/dispatch.d.ts.map +1 -0
- package/dist/dispatch.js +34 -0
- package/dist/dispatch.js.map +1 -0
- package/dist/event.d.ts +2 -2
- package/dist/event.d.ts.map +1 -1
- package/dist/event.js +1 -1
- package/dist/event.js.map +1 -1
- package/dist/execute.d.ts +33 -0
- package/dist/execute.d.ts.map +1 -0
- package/dist/execute.js +207 -0
- package/dist/execute.js.map +1 -0
- package/dist/index.d.ts +12 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/patterns/status.d.ts +1 -1
- package/dist/result.d.ts.map +1 -1
- package/dist/result.js +15 -4
- package/dist/result.js.map +1 -1
- package/dist/serialization.d.ts.map +1 -1
- package/dist/serialization.js +45 -7
- package/dist/serialization.js.map +1 -1
- package/dist/service.d.ts +69 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +56 -0
- package/dist/service.js.map +1 -0
- package/dist/topo.d.ts +11 -4
- package/dist/topo.d.ts.map +1 -1
- package/dist/topo.js +43 -18
- package/dist/topo.js.map +1 -1
- package/dist/trail.d.ts +21 -10
- package/dist/trail.d.ts.map +1 -1
- package/dist/trail.js +5 -2
- package/dist/trail.js.map +1 -1
- package/dist/type-utils.d.ts +24 -0
- package/dist/type-utils.d.ts.map +1 -0
- package/dist/type-utils.js +12 -0
- package/dist/type-utils.js.map +1 -0
- package/dist/types.d.ts +10 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/validate-topo.d.ts +2 -2
- package/dist/validate-topo.d.ts.map +1 -1
- package/dist/validate-topo.js +75 -9
- package/dist/validate-topo.js.map +1 -1
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +34 -3
- package/dist/validation.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/context.test.ts +16 -5
- package/src/__tests__/derive.test.ts +44 -0
- package/src/__tests__/dispatch.test.ts +181 -0
- package/src/__tests__/event.test.ts +5 -5
- package/src/__tests__/execute.test.ts +523 -0
- package/src/__tests__/layer.test.ts +14 -113
- package/src/__tests__/serialization.test.ts +166 -1
- package/src/__tests__/service.test.ts +197 -0
- package/src/__tests__/topo.test.ts +171 -78
- package/src/__tests__/trail.test.ts +119 -37
- package/src/__tests__/type-utils.test.ts +90 -0
- package/src/__tests__/validate-topo.test.ts +140 -19
- package/src/__tests__/validation.test.ts +53 -0
- package/src/context.ts +18 -9
- package/src/derive.ts +12 -2
- package/src/dispatch.ts +54 -0
- package/src/event.ts +3 -3
- package/src/execute.ts +345 -0
- package/src/index.ts +39 -18
- package/src/result.ts +18 -4
- package/src/serialization.ts +56 -11
- package/src/service.ts +139 -0
- package/src/topo.ts +66 -27
- package/src/trail.ts +36 -13
- package/src/type-utils.ts +45 -0
- package/src/types.ts +11 -2
- package/src/validate-topo.ts +92 -10
- package/src/validation.ts +35 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/hike.d.ts +0 -36
- package/dist/hike.d.ts.map +0 -1
- package/dist/hike.js +0 -20
- package/dist/hike.js.map +0 -1
- package/src/__tests__/hike.test.ts +0 -117
- package/src/__tests__/job.test.ts +0 -98
- package/src/adapters.ts +0 -68
- package/src/health.ts +0 -23
- package/src/hike.ts +0 -77
- package/src/job.ts +0 -20
package/.turbo/turbo-lint.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,126 @@
|
|
|
1
1
|
# @ontrails/core
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.11
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add services as a first-class primitive.
|
|
8
|
+
|
|
9
|
+
Services make infrastructure dependencies declarative, injectable, and governable. Define a service with `service()`, declare it on a trail with `services: [db]`, and access it with `db.from(ctx)` or `ctx.service()`.
|
|
10
|
+
|
|
11
|
+
**Core:** `service()` factory, `ServiceSpec<T>`, `ServiceContext`, singleton resolution in `executeTrail`, in-flight creation dedup, `isService` guard, `findDuplicateServiceId`, topo service discovery and validation, `services` field on trail specs.
|
|
12
|
+
|
|
13
|
+
**Testing:** Auto-resolution of `mock` factories in `testAll`, `testExamples`, `testContracts`, and `testFollows`. Explicit `services` overrides with correct precedence (`explicit > ctx.extensions > auto-mock`). Service mock propagation through follow graphs.
|
|
14
|
+
|
|
15
|
+
**Warden:** `service-declarations` rule validates `db.from(ctx)` and `ctx.service()` usage matches declared `services: [...]`. `service-exists` rule validates declared service IDs resolve in project context. Scope-aware AST walking skips nested function boundaries.
|
|
16
|
+
|
|
17
|
+
**Surfaces:** Service overrides thread through `dispatch` and `blaze` on CLI, MCP, and HTTP.
|
|
18
|
+
|
|
19
|
+
**Introspection:** Survey and surface map outputs include service graph. Topo exposes `.services`, `.getService()`, `.hasService()`, `.listServices()`, `.serviceIds()`, `.serviceCount`.
|
|
20
|
+
|
|
21
|
+
**Docs:** ADR-009 accepted. Unified services guide, updated vocabulary, getting-started, architecture, and package READMEs.
|
|
22
|
+
|
|
23
|
+
## 1.0.0-beta.10
|
|
24
|
+
|
|
25
|
+
### Minor Changes
|
|
26
|
+
|
|
27
|
+
- Cleanup and hardening pass across all packages.
|
|
28
|
+
|
|
29
|
+
**core**: Deduplicate `DispatchOptions` as type alias of `ExecuteTrailOptions`. Replace `TrailContext` index signature with typed `extensions` field for type safety. Deep-merge `extensions` in `executeTrail` context resolution. Remove unused `Surface` type, `adapters.ts`, `health.ts`, and `job.ts` proof-of-concept from published package.
|
|
30
|
+
|
|
31
|
+
**cli**: Remove vestigial `kind` checks from build. Run `validateTopo()` automatically in `blaze()` with opt-out via `validate: false`.
|
|
32
|
+
|
|
33
|
+
**http**: Remove vestigial `kind` checks from build. Run `validateTopo()` automatically in `blaze()` with opt-out.
|
|
34
|
+
|
|
35
|
+
**mcp**: Remove vestigial `kind` checks from build. Run `validateTopo()` automatically in `blaze()` with opt-out.
|
|
36
|
+
|
|
37
|
+
**warden**: Project-aware rule context preserved in trail wrappers.
|
|
38
|
+
|
|
39
|
+
## 1.0.0-beta.9
|
|
40
|
+
|
|
41
|
+
### Minor Changes
|
|
42
|
+
|
|
43
|
+
- Consolidated improvements across all surface packages.
|
|
44
|
+
|
|
45
|
+
**core**: Add `TrailResult<T>` utility type, `topo.ids()` and `topo.count` accessors, `dispatch()` for headless trail execution, and extract shared `executeTrail` pipeline used by CLI/MCP/HTTP.
|
|
46
|
+
|
|
47
|
+
**http**: Detect route path collisions and return `Result` from `buildHttpRoutes()`, wire request `AbortSignal` through to trail context, and make write → POST mapping explicit in intent-to-method lookup.
|
|
48
|
+
|
|
49
|
+
**mcp**: Return `Result` from `buildMcpTools()` on collision instead of throwing.
|
|
50
|
+
|
|
51
|
+
**cli**: Verify exception catching via centralized `executeTrail`.
|
|
52
|
+
|
|
53
|
+
**testing**: Follow context awareness improvements.
|
|
54
|
+
|
|
55
|
+
**warden**: Refactor rules as composable trails with examples.
|
|
56
|
+
|
|
57
|
+
**schema**: Error code and empty body fixes.
|
|
58
|
+
|
|
59
|
+
## 1.0.0-beta.8
|
|
60
|
+
|
|
61
|
+
## 1.0.0-beta.7
|
|
62
|
+
|
|
63
|
+
## 1.0.0-beta.6
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- Fix Codex review findings on type-utils and follow-declarations.
|
|
68
|
+
|
|
69
|
+
**core**: `inputOf()`/`outputOf()` now preserve the exact Zod schema subtype instead of widening to `z.ZodType`.
|
|
70
|
+
|
|
71
|
+
**warden**: `follow-declarations` rule now recognizes single-object trail overload, detects any context parameter name (not just `ctx`), matches destructured `follow()` calls, resolves const identifiers in `follow` arrays, and restricts run body extraction to top-level config properties.
|
|
72
|
+
|
|
73
|
+
## 1.0.0-beta.5
|
|
74
|
+
|
|
75
|
+
### Minor Changes
|
|
76
|
+
|
|
77
|
+
- Type utilities and follow-declarations warden rule.
|
|
78
|
+
|
|
79
|
+
**core**: Add `TrailInput<T>`, `TrailOutput<T>` utility types and `inputOf()`, `outputOf()` runtime schema accessors.
|
|
80
|
+
|
|
81
|
+
**warden**: Add `follow-declarations` rule — statically analyzes `ctx.follow()` calls against declared `follow: [...]` arrays. Errors on undeclared calls, warns on unused declarations.
|
|
82
|
+
|
|
83
|
+
## 1.0.0-beta.4
|
|
84
|
+
|
|
85
|
+
### Major Changes
|
|
86
|
+
|
|
87
|
+
- API simplification: unified trail model, intent enum, run, metadata.
|
|
88
|
+
|
|
89
|
+
**BREAKING CHANGES:**
|
|
90
|
+
|
|
91
|
+
- `hike()` removed — use `trail()` with optional `follow: [...]` field
|
|
92
|
+
- `follows` renamed to `follow` (singular, matching `ctx.follow()`)
|
|
93
|
+
- `topo.hikes` removed — single `topo.trails` map
|
|
94
|
+
- `kind: 'hike'` removed — everything is `kind: 'trail'`
|
|
95
|
+
- `readOnly`/`destructive` booleans replaced by `intent: 'read' | 'write' | 'destroy'`
|
|
96
|
+
- `implementation` field renamed to `run`
|
|
97
|
+
- `markers` field renamed to `metadata`
|
|
98
|
+
- `testHike` renamed to `testFollows`, `HikeScenario` to `FollowScenario`
|
|
99
|
+
- `blaze()` now returns the surface handle (`Command` for CLI, `Server` for MCP)
|
|
100
|
+
|
|
101
|
+
## 1.0.0-beta.3
|
|
102
|
+
|
|
103
|
+
### Minor Changes
|
|
104
|
+
|
|
105
|
+
- Bug fixes across all surface packages found via parallel Codex review.
|
|
106
|
+
|
|
107
|
+
**core**: Fix Result.toJson false circular detection on DAGs, deserializeError subclass round-trip, topo cross-kind ID collisions, validateTopo multi-node cycle detection, error example input validation bypass, and deriveFields array type collapse.
|
|
108
|
+
|
|
109
|
+
**cli**: Switch blaze to parseAsync for proper async error handling, add boolean flag negation (--no-flag), and strict number parsing that rejects partial input.
|
|
110
|
+
|
|
111
|
+
**mcp**: Align BlobRef with core (including ReadableStream support) and detect tool-name collisions after normalization.
|
|
112
|
+
|
|
113
|
+
**testing**: Include hikes in testContracts validation, with follow-context awareness.
|
|
114
|
+
|
|
115
|
+
**warden**: Collect hike detour targets, validate detour refs in hike specs, and stop implementation-returns-result from walking into nested function bodies.
|
|
116
|
+
|
|
117
|
+
## 1.0.0-beta.2
|
|
118
|
+
|
|
119
|
+
### Patch Changes
|
|
120
|
+
|
|
121
|
+
- Fix workspace dependency resolution in published packages. Now using bun publish
|
|
122
|
+
which correctly replaces workspace:^ with actual version numbers.
|
|
123
|
+
|
|
3
124
|
## 1.0.0-beta.1
|
|
4
125
|
|
|
5
126
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -11,25 +11,23 @@ import { z } from 'zod';
|
|
|
11
11
|
const greet = trail('greet', {
|
|
12
12
|
input: z.object({ name: z.string().describe('Who to greet') }),
|
|
13
13
|
output: z.object({ message: z.string() }),
|
|
14
|
-
|
|
14
|
+
intent: 'read',
|
|
15
15
|
examples: [
|
|
16
16
|
{ name: 'Hello', input: { name: 'World' }, expected: { message: 'Hello, World!' } },
|
|
17
17
|
],
|
|
18
|
-
|
|
18
|
+
run: (input) => Result.ok({ message: `Hello, ${input.name}!` }),
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
const app = topo('myapp', { greet });
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Trails compose other trails through `follow` and `ctx.follow()`:
|
|
25
25
|
|
|
26
26
|
```typescript
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const onboard = hike('entity.onboard', {
|
|
30
|
-
follows: ['entity.add', 'entity.relate'],
|
|
27
|
+
const onboard = trail('entity.onboard', {
|
|
28
|
+
follow: ['entity.add', 'entity.relate'],
|
|
31
29
|
input: z.object({ name: z.string(), type: z.string() }),
|
|
32
|
-
|
|
30
|
+
run: async (input, ctx) => {
|
|
33
31
|
const added = await ctx.follow('entity.add', input);
|
|
34
32
|
if (added.isErr()) return added;
|
|
35
33
|
return Result.ok({ entity: added.value });
|
|
@@ -43,11 +41,56 @@ const onboard = hike('entity.onboard', {
|
|
|
43
41
|
|
|
44
42
|
| Export | What it does |
|
|
45
43
|
| --- | --- |
|
|
46
|
-
| `trail(id, spec)` | Define
|
|
47
|
-
| `hike(id, spec)` | Define a composition that follows other trails via `ctx.follow()` |
|
|
44
|
+
| `trail(id, spec)` | Define a unit of work with typed input and `Result` output; use `follow` for composition |
|
|
48
45
|
| `event(id, spec)` | Define a server-originated push with a typed data schema |
|
|
46
|
+
| `service(id, spec)` | Define an infrastructure dependency with `create`, `dispose`, and optional `mock` |
|
|
49
47
|
| `topo(name, ...modules)` | Collect trail modules into a queryable topology |
|
|
50
|
-
| `validateTopo(topo)` | Structural validation:
|
|
48
|
+
| `validateTopo(topo)` | Structural validation: follow targets exist, no cycles, examples parse, output schemas present |
|
|
49
|
+
|
|
50
|
+
### Execution
|
|
51
|
+
|
|
52
|
+
| Export | What it does |
|
|
53
|
+
| --- | --- |
|
|
54
|
+
| `executeTrail(trail, rawInput, options?)` | Centralized execution pipeline: validates input, builds context, composes layers, runs the implementation. Never throws -- exceptions become `Result.err(InternalError)`. |
|
|
55
|
+
| `dispatch(topo, id, input, options?)` | Headless trail execution by ID. Looks up the trail in the topo, then delegates to `executeTrail`. Returns `Result.err(NotFoundError)` if the ID is not registered. |
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
// executeTrail — surface adapters use this directly
|
|
59
|
+
const result = await executeTrail(greet, { name: 'Alice' });
|
|
60
|
+
|
|
61
|
+
// dispatch — no-surface execution by trail ID
|
|
62
|
+
const result = await dispatch(app, 'greet', { name: 'Alice' });
|
|
63
|
+
if (result.isOk()) console.log(result.value);
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Topo accessors
|
|
67
|
+
|
|
68
|
+
Beyond the `trail(id, spec)` builder, `Topo` exposes these accessors:
|
|
69
|
+
|
|
70
|
+
| Accessor | What it returns |
|
|
71
|
+
| --- | --- |
|
|
72
|
+
| `topo.ids()` | `string[]` of all registered trail IDs |
|
|
73
|
+
| `topo.count` | Number of registered trails |
|
|
74
|
+
| `topo.get(id)` | The `Trail` with that ID, or `undefined` |
|
|
75
|
+
| `topo.has(id)` | Whether a trail ID is registered |
|
|
76
|
+
| `topo.list()` | All registered trails as an array |
|
|
77
|
+
|
|
78
|
+
### Type utilities
|
|
79
|
+
|
|
80
|
+
| Export | What it does |
|
|
81
|
+
| --- | --- |
|
|
82
|
+
| `TrailInput<T>` | Extract the input type from a `Trail` |
|
|
83
|
+
| `TrailOutput<T>` | Extract the output type from a `Trail` |
|
|
84
|
+
| `TrailResult<T>` | `Result<TrailOutput<T>, Error>` -- the Result type for a trail's output |
|
|
85
|
+
| `inputOf(trail)` | Get the input Zod schema from a trail instance |
|
|
86
|
+
| `outputOf(trail)` | Get the output Zod schema (or `undefined`) from a trail instance |
|
|
87
|
+
|
|
88
|
+
### Execution option types
|
|
89
|
+
|
|
90
|
+
| Type | What it describes |
|
|
91
|
+
| --- | --- |
|
|
92
|
+
| `ExecuteTrailOptions` | Options for `executeTrail`: `ctx`, `signal`, `layers`, `createContext` |
|
|
93
|
+
| `DispatchOptions` | Same shape as `ExecuteTrailOptions`; forwarded by `dispatch` |
|
|
51
94
|
|
|
52
95
|
### Result
|
|
53
96
|
|
package/dist/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TrailContext } from './types.js';
|
|
1
|
+
import type { TrailContext, TrailContextInit } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Create a TrailContext with sensible defaults.
|
|
4
4
|
*
|
|
@@ -6,5 +6,5 @@ import type { TrailContext } from './types.js';
|
|
|
6
6
|
* - `signal` defaults to a fresh, non-aborted `AbortSignal`
|
|
7
7
|
* - All other fields come from `overrides`
|
|
8
8
|
*/
|
|
9
|
-
export declare const createTrailContext: (overrides?: Partial<
|
|
9
|
+
export declare const createTrailContext: (overrides?: Partial<TrailContextInit>) => TrailContext;
|
|
10
10
|
//# sourceMappingURL=context.d.ts.map
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAMjE;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAC7B,YAAY,OAAO,CAAC,gBAAgB,CAAC,KACpC,YAUF,CAAC"}
|
package/dist/context.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createServiceLookup } from './service.js';
|
|
1
2
|
/**
|
|
2
3
|
* Create a TrailContext with sensible defaults.
|
|
3
4
|
*
|
|
@@ -5,11 +6,15 @@
|
|
|
5
6
|
* - `signal` defaults to a fresh, non-aborted `AbortSignal`
|
|
6
7
|
* - All other fields come from `overrides`
|
|
7
8
|
*/
|
|
8
|
-
export const createTrailContext = (overrides) =>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
export const createTrailContext = (overrides) => {
|
|
10
|
+
const ctx = {
|
|
11
|
+
cwd: process.cwd(),
|
|
12
|
+
env: process.env,
|
|
13
|
+
requestId: Bun.randomUUIDv7(),
|
|
14
|
+
signal: new AbortController().signal,
|
|
15
|
+
...overrides,
|
|
16
|
+
};
|
|
17
|
+
ctx.service = overrides?.service ?? createServiceLookup(() => ctx);
|
|
18
|
+
return ctx;
|
|
19
|
+
};
|
|
15
20
|
//# sourceMappingURL=context.js.map
|
package/dist/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAOnD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,SAAqC,EACvB,EAAE;IAChB,MAAM,GAAG,GAAG;QACV,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAClB,GAAG,EAAE,OAAO,CAAC,GAAyC;QACtD,SAAS,EAAE,GAAG,CAAC,YAAY,EAAE;QAC7B,MAAM,EAAE,IAAI,eAAe,EAAE,CAAC,MAAM;QACpC,GAAG,SAAS;KACU,CAAC;IACzB,GAAG,CAAC,OAAO,GAAG,SAAS,EAAE,OAAO,IAAI,mBAAmB,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;IACnE,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
|
package/dist/derive.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { z } from 'zod';
|
|
|
8
8
|
/** A surface-agnostic field descriptor derived from a Zod schema. */
|
|
9
9
|
export interface Field {
|
|
10
10
|
readonly name: string;
|
|
11
|
-
readonly type: 'string' | 'number' | 'boolean' | 'enum' | 'multiselect';
|
|
11
|
+
readonly type: 'string' | 'number' | 'boolean' | 'enum' | 'multiselect' | 'string[]' | 'number[]';
|
|
12
12
|
readonly label: string;
|
|
13
13
|
readonly required: boolean;
|
|
14
14
|
readonly default?: unknown | undefined;
|
package/dist/derive.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../src/derive.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,CAAC,E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,eAAO,MAAM,YAAY,GACvB,QAAQ,CAAC,CAAC,OAAO,EACjB,YAAY,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KACxC,KAAK,EAeP,CAAC"}
|
package/dist/derive.js
CHANGED
|
@@ -60,7 +60,10 @@ const fieldTypeByDef = {
|
|
|
60
60
|
const entries = element._zod.def['entries'];
|
|
61
61
|
return { options: Object.values(entries), type: 'multiselect' };
|
|
62
62
|
}
|
|
63
|
-
return {
|
|
63
|
+
return {
|
|
64
|
+
options: undefined,
|
|
65
|
+
type: elementType === 'number' ? 'number[]' : 'string[]',
|
|
66
|
+
};
|
|
64
67
|
},
|
|
65
68
|
boolean: () => ({ options: undefined, type: 'boolean' }),
|
|
66
69
|
enum: (s) => {
|
package/dist/derive.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derive.js","sourceRoot":"","sources":["../src/derive.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"derive.js","sourceRoot":"","sources":["../src/derive.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAyDH,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,4DAA4D;AAC5D,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAU,EAAE,CACvC,GAAG;KACA,UAAU,CAAC,iBAAiB,EAAE,OAAO,CAAC;KACtC,UAAU,CAAC,uBAAuB,EAAE,OAAO,CAAC;KAC5C,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;AAS7C,8DAA8D;AAC9D,MAAM,YAAY,GAAG,CAAC,OAAqB,EAAgB,EAAE,CAC3D,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,CAAiB,CAAC;AAEhD,4DAA4D;AAC5D,MAAM,oBAAoB,GAAG,CAC3B,KAAmB,EACnB,KAA0C,EACpC,EAAE;IACR,IAAI,KAAK,CAAC,WAAW,EA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AC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACjE,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Headless trail execution — the "no-surface" surface.
|
|
3
|
+
*
|
|
4
|
+
* Looks up a trail by ID in a topo, then delegates to `executeTrail`.
|
|
5
|
+
* Returns a `Result` and never throws.
|
|
6
|
+
*/
|
|
7
|
+
import type { Topo } from './topo.js';
|
|
8
|
+
import type { ExecuteTrailOptions } from './execute.js';
|
|
9
|
+
import { Result } from './result.js';
|
|
10
|
+
/** Options forwarded to `executeTrail` from `dispatch`. */
|
|
11
|
+
export type DispatchOptions = ExecuteTrailOptions;
|
|
12
|
+
/**
|
|
13
|
+
* Execute a trail by ID from a topo without mounting a surface.
|
|
14
|
+
*
|
|
15
|
+
* Resolves the trail from the topo, then runs it through the standard
|
|
16
|
+
* `executeTrail` pipeline. Returns `Result.err(NotFoundError)` if the
|
|
17
|
+
* trail ID is not registered. Never throws — unexpected exceptions are
|
|
18
|
+
* returned as `Result.err(InternalError)`.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const result = await dispatch(myTopo, 'greet', { name: 'Alice' });
|
|
23
|
+
* if (result.isOk()) console.log(result.value);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare const dispatch: (topo: Topo, id: string, input: unknown, options?: DispatchOptions) => Promise<Result<unknown, Error>>;
|
|
27
|
+
//# sourceMappingURL=dispatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAMrC,2DAA2D;AAC3D,MAAM,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAMlD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ,GACnB,MAAM,IAAI,EACV,IAAI,MAAM,EACV,OAAO,OAAO,EACd,UAAU,eAAe,KACxB,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAUhC,CAAC"}
|
package/dist/dispatch.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Headless trail execution — the "no-surface" surface.
|
|
3
|
+
*
|
|
4
|
+
* Looks up a trail by ID in a topo, then delegates to `executeTrail`.
|
|
5
|
+
* Returns a `Result` and never throws.
|
|
6
|
+
*/
|
|
7
|
+
import { executeTrail } from './execute.js';
|
|
8
|
+
import { NotFoundError } from './errors.js';
|
|
9
|
+
import { Result } from './result.js';
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
// dispatch()
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
/**
|
|
14
|
+
* Execute a trail by ID from a topo without mounting a surface.
|
|
15
|
+
*
|
|
16
|
+
* Resolves the trail from the topo, then runs it through the standard
|
|
17
|
+
* `executeTrail` pipeline. Returns `Result.err(NotFoundError)` if the
|
|
18
|
+
* trail ID is not registered. Never throws — unexpected exceptions are
|
|
19
|
+
* returned as `Result.err(InternalError)`.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const result = await dispatch(myTopo, 'greet', { name: 'Alice' });
|
|
24
|
+
* if (result.isOk()) console.log(result.value);
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export const dispatch = (topo, id, input, options) => {
|
|
28
|
+
const trail = topo.get(id);
|
|
29
|
+
if (trail === undefined) {
|
|
30
|
+
return Promise.resolve(Result.err(new NotFoundError(`Trail "${id}" not found in topo "${topo.name}"`)));
|
|
31
|
+
}
|
|
32
|
+
return executeTrail(trail, input, options);
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=dispatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AASrC,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,IAAU,EACV,EAAU,EACV,KAAc,EACd,OAAyB,EACQ,EAAE;IACnC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC3B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,OAAO,CAAC,OAAO,CACpB,MAAM,CAAC,GAAG,CACR,IAAI,aAAa,CAAC,UAAU,EAAE,wBAAwB,IAAI,CAAC,IAAI,GAAG,CAAC,CACpE,CACF,CAAC;IACJ,CAAC;IACD,OAAO,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC,CAAC"}
|
package/dist/event.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { z } from 'zod';
|
|
|
5
5
|
export interface EventSpec<T> {
|
|
6
6
|
readonly payload: z.ZodType<T>;
|
|
7
7
|
readonly description?: string | undefined;
|
|
8
|
-
readonly
|
|
8
|
+
readonly metadata?: Readonly<Record<string, unknown>> | undefined;
|
|
9
9
|
/** Trail IDs that produce this event (e.g. the trails it originates from). */
|
|
10
10
|
readonly from?: readonly string[] | undefined;
|
|
11
11
|
}
|
|
@@ -14,7 +14,7 @@ export interface Event<T> {
|
|
|
14
14
|
readonly kind: 'event';
|
|
15
15
|
readonly payload: z.ZodType<T>;
|
|
16
16
|
readonly description?: string | undefined;
|
|
17
|
-
readonly
|
|
17
|
+
readonly metadata?: Readonly<Record<string, unknown>> | undefined;
|
|
18
18
|
/** Trail IDs that produce this event (e.g. the trails it originates from). */
|
|
19
19
|
readonly from?: readonly string[] | undefined;
|
|
20
20
|
}
|
package/dist/event.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../src/event.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAM7B,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC/B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../src/event.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAM7B,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC/B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAClE,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CAC/C;AAMD,MAAM,WAAW,KAAK,CAAC,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC/B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAClE,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CAC/C;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AACnE,wBAAgB,KAAK,CAAC,CAAC,EACrB,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAC3C,KAAK,CAAC,CAAC,CAAC,CAAC;AAkBZ,2DAA2D;AAC3D,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC"}
|
package/dist/event.js
CHANGED
|
@@ -10,7 +10,7 @@ export function event(idOrSpec, maybeSpec) {
|
|
|
10
10
|
from: resolvedSpec.from ? Object.freeze([...resolvedSpec.from]) : undefined,
|
|
11
11
|
id: resolvedId,
|
|
12
12
|
kind: 'event',
|
|
13
|
-
|
|
13
|
+
metadata: resolvedSpec.metadata,
|
|
14
14
|
payload: resolvedSpec.payload,
|
|
15
15
|
});
|
|
16
16
|
}
|
package/dist/event.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.js","sourceRoot":"","sources":["../src/event.ts"],"names":[],"mappings":"AAAA;;GAEG;AAwDH,MAAM,UAAU,KAAK,CACnB,QAA2D,EAC3D,SAAwB;IAExB,MAAM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AC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized trail execution pipeline.
|
|
3
|
+
*
|
|
4
|
+
* Validates input, builds context, composes layers, and runs the
|
|
5
|
+
* implementation. Surfaces (CLI, MCP, HTTP) delegate here instead
|
|
6
|
+
* of reimplementing the pipeline.
|
|
7
|
+
*/
|
|
8
|
+
import type { AnyTrail } from './trail.js';
|
|
9
|
+
import type { Layer } from './layer.js';
|
|
10
|
+
import type { ServiceOverrideMap } from './service.js';
|
|
11
|
+
import type { TrailContextInit } from './types.js';
|
|
12
|
+
import { Result } from './result.js';
|
|
13
|
+
/** Options for executeTrail. */
|
|
14
|
+
export interface ExecuteTrailOptions {
|
|
15
|
+
/** Partial context overrides merged on top of the base context. */
|
|
16
|
+
readonly ctx?: Partial<TrailContextInit> | undefined;
|
|
17
|
+
/** AbortSignal override (takes final precedence over ctx and factory). */
|
|
18
|
+
readonly signal?: AbortSignal | undefined;
|
|
19
|
+
/** Layers to compose around the implementation. */
|
|
20
|
+
readonly layers?: readonly Layer[] | undefined;
|
|
21
|
+
/** Factory that produces a base TrailContext (takes precedence over defaults). */
|
|
22
|
+
readonly createContext?: (() => TrailContextInit | Promise<TrailContextInit>) | undefined;
|
|
23
|
+
/** Explicit service instance overrides keyed by service ID. */
|
|
24
|
+
readonly services?: ServiceOverrideMap | undefined;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Execute a trail through the standard validate-context-layers-run pipeline.
|
|
28
|
+
*
|
|
29
|
+
* The function never throws -- unexpected exceptions are caught and
|
|
30
|
+
* returned as `Result.err(InternalError)`.
|
|
31
|
+
*/
|
|
32
|
+
export declare const executeTrail: (trail: AnyTrail, rawInput: unknown, options?: ExecuteTrailOptions) => Promise<Result<unknown, Error>>;
|
|
33
|
+
//# sourceMappingURL=execute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../src/execute.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAGV,kBAAkB,EACnB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAgB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAKjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAYrC,gCAAgC;AAChC,MAAM,WAAW,mBAAmB;IAClC,mEAAmE;IACnE,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,SAAS,CAAC;IACrD,0EAA0E;IAC1E,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC1C,mDAAmD;IACnD,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,KAAK,EAAE,GAAG,SAAS,CAAC;IAC/C,kFAAkF;IAClF,QAAQ,CAAC,aAAa,CAAC,EACnB,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,GACpD,SAAS,CAAC;IACd,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;CACpD;AA0QD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GACvB,OAAO,QAAQ,EACf,UAAU,OAAO,EACjB,UAAU,mBAAmB,KAC5B,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAsBhC,CAAC"}
|