@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/.turbo/turbo-lint.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,22 +1,59 @@
|
|
|
1
1
|
# @ontrails/core
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.13
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Trail-native vocabulary cutover. Breaking API field renames across all packages:
|
|
8
|
+
|
|
9
|
+
- Trail spec: `run:` → `blaze:`, `follow:` → `crosses:`, `services:` → `provisions:`, `metadata:` → `meta:`, `emits:` → `signals:`
|
|
10
|
+
- Runtime: `ctx.follow()` → `ctx.cross()`, `ctx.emit()` → `ctx.signal()`, `ctx.signal` (abort) → `ctx.abortSignal`
|
|
11
|
+
- Entry points: `blaze(app)` → `trailhead(app)`
|
|
12
|
+
- Package rename: `@ontrails/crumbs` → `@ontrails/tracker`
|
|
13
|
+
- Wrapper types: `Layer` → `Gate`, `layers`/`middleware` → `gates`
|
|
14
|
+
- Transport: `surface` → `trailhead`, `adapter` → `connector`
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 6944147: Complete trifecta for config, permits, and tracker (formerly tracks)
|
|
19
|
+
|
|
20
|
+
- **config**: Add `configProvision`, `configGate`, `config.trail`, and `config.workspace` trails with full `defineConfig`, `resolve`, `describe`, `explain`, `doctor`, and code generation support
|
|
21
|
+
- **permits**: Add `authService` and `auth.verify` trail for runtime authorization checks
|
|
22
|
+
- **tracker**: Rename tracks to tracker; add `trackerProvision` and `tracker.status` trail for structured signal tracking
|
|
23
|
+
- **cli**: Fix build flag handling and improve bootstrap scaffolding
|
|
24
|
+
- **testing**: Expand test context helpers and example-based testing utilities
|
|
25
|
+
- **core/mcp/http**: Internal alignment for provision and composition updates
|
|
26
|
+
|
|
27
|
+
## 1.0.0-beta.12
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Complete trifecta for config, permits, and tracker (formerly tracks)
|
|
32
|
+
|
|
33
|
+
- **config**: Add `configProvision`, `config.gate`, `config.trail`, and `config.workspace` trails with full `defineConfig`, `resolve`, `describe`, `explain`, `doctor`, and code generation support
|
|
34
|
+
- **permits**: Add `authProvision` and `auth.verify` trail for runtime authorization checks
|
|
35
|
+
- **tracker**: Rename tracks to tracker; add `trackerProvision` and `tracker.status` trail for structured event tracking
|
|
36
|
+
- **cli**: Fix build flag handling and improve bootstrap scaffolding
|
|
37
|
+
- **testing**: Expand test context helpers and example-based testing utilities
|
|
38
|
+
- **core/mcp/http**: Internal alignment for provision and composition updates
|
|
39
|
+
|
|
3
40
|
## 1.0.0-beta.11
|
|
4
41
|
|
|
5
42
|
### Minor Changes
|
|
6
43
|
|
|
7
|
-
- Add
|
|
44
|
+
- Add provisions as a first-class primitive.
|
|
8
45
|
|
|
9
|
-
|
|
46
|
+
Provisions make infrastructure dependencies declarative, injectable, and governable. Define a provision with `provision()`, declare it on a trail with `provisions: [db]`, and access it with `db.from(ctx)` or `ctx.provision()`.
|
|
10
47
|
|
|
11
|
-
**Core:** `
|
|
48
|
+
**Core:** `provision()` factory, `ProvisionSpec<T>`, `ProvisionContext`, singleton resolution in `executeTrail`, in-flight creation dedup, `isProvision` guard, `findDuplicateProvisionId`, topo provision discovery and validation, `provisions` field on trail specs.
|
|
12
49
|
|
|
13
|
-
**Testing:** Auto-resolution of `mock` factories in `testAll`, `testExamples`, `testContracts`, and `
|
|
50
|
+
**Testing:** Auto-resolution of `mock` factories in `testAll`, `testExamples`, `testContracts`, and `testCrosses`. Explicit `services` overrides with correct precedence (`explicit > ctx.extensions > auto-mock`). Service mock propagation through crossing graphs.
|
|
14
51
|
|
|
15
|
-
**Warden:** `
|
|
52
|
+
**Warden:** `provision-declarations` rule validates `db.from(ctx)` and `ctx.provision()` usage matches declared `provisions: [...]`. `provision-exists` rule validates declared provision IDs resolve in project context. Scope-aware AST walking skips nested function boundaries.
|
|
16
53
|
|
|
17
|
-
**
|
|
54
|
+
**Trailheads:** Provision overrides thread through `run` and `trailhead` on CLI, MCP, and HTTP.
|
|
18
55
|
|
|
19
|
-
**Introspection:** Survey and
|
|
56
|
+
**Introspection:** Survey and trailhead map outputs include provision graph. Topo exposes `.provisions`, `.getProvision()`, `.hasProvision()`, `.listProvisions()`, `.provisionIds()`, `.provisionCount`.
|
|
20
57
|
|
|
21
58
|
**Docs:** ADR-009 accepted. Unified services guide, updated vocabulary, getting-started, architecture, and package READMEs.
|
|
22
59
|
|
|
@@ -26,13 +63,13 @@
|
|
|
26
63
|
|
|
27
64
|
- Cleanup and hardening pass across all packages.
|
|
28
65
|
|
|
29
|
-
**core**: Deduplicate `
|
|
66
|
+
**core**: Deduplicate `RunOptions` 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 `Trailhead` type, `connectors.ts`, `health.ts`, and `job.ts` proof-of-concept from published package.
|
|
30
67
|
|
|
31
|
-
**cli**: Remove vestigial `kind` checks from build. Run `validateTopo()` automatically in `
|
|
68
|
+
**cli**: Remove vestigial `kind` checks from build. Run `validateTopo()` automatically in `trailhead()` with opt-out via `validate: false`.
|
|
32
69
|
|
|
33
|
-
**http**: Remove vestigial `kind` checks from build. Run `validateTopo()` automatically in `
|
|
70
|
+
**http**: Remove vestigial `kind` checks from build. Run `validateTopo()` automatically in `trailhead()` with opt-out.
|
|
34
71
|
|
|
35
|
-
**mcp**: Remove vestigial `kind` checks from build. Run `validateTopo()` automatically in `
|
|
72
|
+
**mcp**: Remove vestigial `kind` checks from build. Run `validateTopo()` automatically in `trailhead()` with opt-out.
|
|
36
73
|
|
|
37
74
|
**warden**: Project-aware rule context preserved in trail wrappers.
|
|
38
75
|
|
|
@@ -40,9 +77,9 @@
|
|
|
40
77
|
|
|
41
78
|
### Minor Changes
|
|
42
79
|
|
|
43
|
-
- Consolidated improvements across all
|
|
80
|
+
- Consolidated improvements across all trailhead packages.
|
|
44
81
|
|
|
45
|
-
**core**: Add `TrailResult<T>` utility type, `topo.ids()` and `topo.count` accessors, `
|
|
82
|
+
**core**: Add `TrailResult<T>` utility type, `topo.ids()` and `topo.count` accessors, `run()` for headless trail execution, and extract shared `executeTrail` pipeline used by CLI/MCP/HTTP.
|
|
46
83
|
|
|
47
84
|
**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
85
|
|
|
@@ -50,7 +87,7 @@
|
|
|
50
87
|
|
|
51
88
|
**cli**: Verify exception catching via centralized `executeTrail`.
|
|
52
89
|
|
|
53
|
-
**testing**:
|
|
90
|
+
**testing**: Cross-context awareness improvements.
|
|
54
91
|
|
|
55
92
|
**warden**: Refactor rules as composable trails with examples.
|
|
56
93
|
|
|
@@ -64,21 +101,21 @@
|
|
|
64
101
|
|
|
65
102
|
### Patch Changes
|
|
66
103
|
|
|
67
|
-
- Fix Codex review findings on type-utils and
|
|
104
|
+
- Fix Codex review findings on type-utils and cross-declarations.
|
|
68
105
|
|
|
69
106
|
**core**: `inputOf()`/`outputOf()` now preserve the exact Zod schema subtype instead of widening to `z.ZodType`.
|
|
70
107
|
|
|
71
|
-
**warden**: `
|
|
108
|
+
**warden**: `cross-declarations` rule now recognizes single-object trail overload, detects any context parameter name (not just `ctx`), matches destructured `cross()` calls, resolves const identifiers in `crosses` arrays, and restricts blaze body extraction to top-level config properties.
|
|
72
109
|
|
|
73
110
|
## 1.0.0-beta.5
|
|
74
111
|
|
|
75
112
|
### Minor Changes
|
|
76
113
|
|
|
77
|
-
- Type utilities and
|
|
114
|
+
- Type utilities and cross-declarations warden rule.
|
|
78
115
|
|
|
79
116
|
**core**: Add `TrailInput<T>`, `TrailOutput<T>` utility types and `inputOf()`, `outputOf()` runtime schema accessors.
|
|
80
117
|
|
|
81
|
-
**warden**: Add `
|
|
118
|
+
**warden**: Add `cross-declarations` rule — statically analyzes `ctx.cross()` calls against declared `crosses: [...]` arrays. Errors on undeclared calls, warns on unused declarations.
|
|
82
119
|
|
|
83
120
|
## 1.0.0-beta.4
|
|
84
121
|
|
|
@@ -88,29 +125,29 @@
|
|
|
88
125
|
|
|
89
126
|
**BREAKING CHANGES:**
|
|
90
127
|
|
|
91
|
-
- `hike()` removed — use `trail()` with optional `
|
|
92
|
-
- `follows` renamed to `
|
|
128
|
+
- `hike()` removed — use `trail()` with optional `crosses: [...]` field
|
|
129
|
+
- `follows` renamed to `crosses` (matching `ctx.cross()`)
|
|
93
130
|
- `topo.hikes` removed — single `topo.trails` map
|
|
94
131
|
- `kind: 'hike'` removed — everything is `kind: 'trail'`
|
|
95
132
|
- `readOnly`/`destructive` booleans replaced by `intent: 'read' | 'write' | 'destroy'`
|
|
96
133
|
- `implementation` field renamed to `run`
|
|
97
134
|
- `markers` field renamed to `metadata`
|
|
98
|
-
- `testHike` renamed to `
|
|
99
|
-
- `
|
|
135
|
+
- `testHike` renamed to `testCrosses`, `HikeScenario` to `CrossScenario`
|
|
136
|
+
- `trailhead()` now returns the trailhead handle (`Command` for CLI, `Server` for MCP)
|
|
100
137
|
|
|
101
138
|
## 1.0.0-beta.3
|
|
102
139
|
|
|
103
140
|
### Minor Changes
|
|
104
141
|
|
|
105
|
-
- Bug fixes across all
|
|
142
|
+
- Bug fixes across all trailhead packages found via parallel Codex review.
|
|
106
143
|
|
|
107
144
|
**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
145
|
|
|
109
|
-
**cli**: Switch
|
|
146
|
+
**cli**: Switch trailhead to parseAsync for proper async error handling, add boolean flag negation (--no-flag), and strict number parsing that rejects partial input.
|
|
110
147
|
|
|
111
148
|
**mcp**: Align BlobRef with core (including ReadableStream support) and detect tool-name collisions after normalization.
|
|
112
149
|
|
|
113
|
-
**testing**: Include hikes in testContracts validation, with
|
|
150
|
+
**testing**: Include hikes in testContracts validation, with cross-context awareness.
|
|
114
151
|
|
|
115
152
|
**warden**: Collect hike detour targets, validate detour refs in hike specs, and stop implementation-returns-result from walking into nested function bodies.
|
|
116
153
|
|
|
@@ -136,9 +173,9 @@
|
|
|
136
173
|
- Initial v1 beta release of the Trails framework.
|
|
137
174
|
|
|
138
175
|
- **@ontrails/core** — Result type, error taxonomy, trail/hike/event/topo, validateTopo, validateInput/Output, deriveFields, patterns, redaction, branded types, resilience
|
|
139
|
-
- **@ontrails/cli** — CLI
|
|
140
|
-
- **@ontrails/mcp** — MCP
|
|
141
|
-
- **@ontrails/logging** — Structured logging, sinks, formatters, LogTape
|
|
142
|
-
- **@ontrails/testing** — testAll, testExamples, testTrail, testHike, testContracts, testDetours,
|
|
176
|
+
- **@ontrails/cli** — CLI trailhead connector, Commander integration, flag derivation, gates
|
|
177
|
+
- **@ontrails/mcp** — MCP trailhead connector, tool generation, annotations, progress bridge
|
|
178
|
+
- **@ontrails/logging** — Structured logging, sinks, formatters, LogTape connector
|
|
179
|
+
- **@ontrails/testing** — testAll, testExamples, testTrail, testHike, testContracts, testDetours, trailhead harnesses
|
|
143
180
|
- **@ontrails/warden** — AST-based code convention rules via oxc-parser, drift detection, CI formatters
|
|
144
|
-
- **@ontrails/schema** —
|
|
181
|
+
- **@ontrails/schema** — Trailhead map generation, hashing, semantic diffing
|
package/README.md
CHANGED
|
@@ -15,20 +15,20 @@ const greet = trail('greet', {
|
|
|
15
15
|
examples: [
|
|
16
16
|
{ name: 'Hello', input: { name: 'World' }, expected: { message: 'Hello, World!' } },
|
|
17
17
|
],
|
|
18
|
-
|
|
18
|
+
blaze: (input) => Result.ok({ message: `Hello, ${input.name}!` }),
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
const app = topo('myapp', { greet });
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
Trails compose other trails through `
|
|
24
|
+
Trails compose other trails through `crosses` and `ctx.cross()`:
|
|
25
25
|
|
|
26
26
|
```typescript
|
|
27
27
|
const onboard = trail('entity.onboard', {
|
|
28
|
-
|
|
28
|
+
crosses: ['entity.add', 'entity.relate'],
|
|
29
29
|
input: z.object({ name: z.string(), type: z.string() }),
|
|
30
|
-
|
|
31
|
-
const added = await ctx.
|
|
30
|
+
blaze: async (input, ctx) => {
|
|
31
|
+
const added = await ctx.cross('entity.add', input);
|
|
32
32
|
if (added.isErr()) return added;
|
|
33
33
|
return Result.ok({ entity: added.value });
|
|
34
34
|
},
|
|
@@ -41,25 +41,25 @@ const onboard = trail('entity.onboard', {
|
|
|
41
41
|
|
|
42
42
|
| Export | What it does |
|
|
43
43
|
| --- | --- |
|
|
44
|
-
| `trail(id, spec)` | Define a unit of work with typed input and `Result` output; use `
|
|
45
|
-
| `
|
|
46
|
-
| `
|
|
44
|
+
| `trail(id, spec)` | Define a unit of work with typed input and `Result` output; use `crosses` for composition |
|
|
45
|
+
| `signal(id, spec)` | Define a server-originated notification with a typed data schema |
|
|
46
|
+
| `provision(id, spec)` | Define an infrastructure dependency with `create`, `dispose`, and optional `mock` |
|
|
47
47
|
| `topo(name, ...modules)` | Collect trail modules into a queryable topology |
|
|
48
|
-
| `validateTopo(topo)` | Structural validation:
|
|
48
|
+
| `validateTopo(topo)` | Structural validation: cross targets exist, no cycles, examples parse, output schemas present |
|
|
49
49
|
|
|
50
50
|
### Execution
|
|
51
51
|
|
|
52
52
|
| Export | What it does |
|
|
53
53
|
| --- | --- |
|
|
54
|
-
| `executeTrail(trail, rawInput, options?)` | Centralized execution pipeline: validates input, builds context, composes
|
|
55
|
-
| `
|
|
54
|
+
| `executeTrail(trail, rawInput, options?)` | Centralized execution pipeline: validates input, builds context, composes gates, runs the implementation. Never throws -- exceptions become `Result.err(InternalError)`. |
|
|
55
|
+
| `run(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
56
|
|
|
57
57
|
```typescript
|
|
58
|
-
// executeTrail —
|
|
58
|
+
// executeTrail — trailheads use this directly
|
|
59
59
|
const result = await executeTrail(greet, { name: 'Alice' });
|
|
60
60
|
|
|
61
|
-
//
|
|
62
|
-
const result = await
|
|
61
|
+
// run — no-trailhead execution by trail ID
|
|
62
|
+
const result = await run(app, 'greet', { name: 'Alice' });
|
|
63
63
|
if (result.isOk()) console.log(result.value);
|
|
64
64
|
```
|
|
65
65
|
|
|
@@ -89,8 +89,8 @@ Beyond the `trail(id, spec)` builder, `Topo` exposes these accessors:
|
|
|
89
89
|
|
|
90
90
|
| Type | What it describes |
|
|
91
91
|
| --- | --- |
|
|
92
|
-
| `ExecuteTrailOptions` | Options for `executeTrail`: `ctx`, `
|
|
93
|
-
| `
|
|
92
|
+
| `ExecuteTrailOptions` | Options for `executeTrail`: `ctx`, `abortSignal`, `gates`, `createContext` |
|
|
93
|
+
| `RunOptions` | Same shape as `ExecuteTrailOptions`; forwarded by `run` |
|
|
94
94
|
|
|
95
95
|
### Result
|
|
96
96
|
|
|
@@ -112,7 +112,7 @@ result.unwrapOr(fallback); // Value or fallback
|
|
|
112
112
|
|
|
113
113
|
### Error taxonomy
|
|
114
114
|
|
|
115
|
-
13 error classes across 10 categories. Each maps deterministically to exit codes, HTTP status, and JSON-RPC codes on every
|
|
115
|
+
13 error classes across 10 categories. Each maps deterministically to exit codes, HTTP status, and JSON-RPC codes on every trailhead.
|
|
116
116
|
|
|
117
117
|
| Category | Classes | HTTP | Retryable |
|
|
118
118
|
| --- | --- | --- | --- |
|
|
@@ -127,7 +127,7 @@ result.unwrapOr(fallback); // Value or fallback
|
|
|
127
127
|
| `auth` | `AuthError` | 401 | No |
|
|
128
128
|
| `cancelled` | `CancelledError` | 499 | No |
|
|
129
129
|
|
|
130
|
-
The developer returns `Result.err(new NotFoundError(...))`. The framework maps it to the right code on every
|
|
130
|
+
The developer returns `Result.err(new NotFoundError(...))`. The framework maps it to the right code on every trailhead.
|
|
131
131
|
|
|
132
132
|
### Other exports
|
|
133
133
|
|
|
@@ -136,7 +136,7 @@ The developer returns `Result.err(new NotFoundError(...))`. The framework maps i
|
|
|
136
136
|
- **Resilience** -- `retry`, `withTimeout`, `shouldRetry`, `getBackoffDelay`
|
|
137
137
|
- **Serialization** -- `serializeError`, `deserializeError`
|
|
138
138
|
- **Branded types** -- `uuid`, `email`, `nonEmptyString`, `positiveInt`
|
|
139
|
-
- **
|
|
139
|
+
- **Gates** -- cross-cutting gates via `composeGates`
|
|
140
140
|
- **Guards and collections** -- `isDefined`, `chunk`, `dedupe`, `groupBy`, `sortBy`
|
|
141
141
|
- **Patterns** (`@ontrails/core/patterns`) -- reusable Zod schemas for pagination, bulk ops, timestamps, sorting
|
|
142
142
|
- **Redaction** (`@ontrails/core/redaction`) -- strip sensitive data before logging
|
package/dist/context.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { TrailContext, TrailContextInit } from './types.js';
|
|
|
3
3
|
* Create a TrailContext with sensible defaults.
|
|
4
4
|
*
|
|
5
5
|
* - `requestId` defaults to `Bun.randomUUIDv7()` (sortable v7 UUID)
|
|
6
|
-
* - `
|
|
6
|
+
* - `abortSignal` defaults to a fresh, non-aborted `AbortSignal`
|
|
7
7
|
* - All other fields come from `overrides`
|
|
8
8
|
*/
|
|
9
9
|
export declare const createTrailContext: (overrides?: Partial<TrailContextInit>) => TrailContext;
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,YAWF,CAAC"}
|
package/dist/context.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createProvisionLookup } from './provision.js';
|
|
2
2
|
/**
|
|
3
3
|
* Create a TrailContext with sensible defaults.
|
|
4
4
|
*
|
|
5
5
|
* - `requestId` defaults to `Bun.randomUUIDv7()` (sortable v7 UUID)
|
|
6
|
-
* - `
|
|
6
|
+
* - `abortSignal` defaults to a fresh, non-aborted `AbortSignal`
|
|
7
7
|
* - All other fields come from `overrides`
|
|
8
8
|
*/
|
|
9
9
|
export const createTrailContext = (overrides) => {
|
|
10
10
|
const ctx = {
|
|
11
|
+
abortSignal: new AbortController().signal,
|
|
11
12
|
cwd: process.cwd(),
|
|
12
13
|
env: process.env,
|
|
13
14
|
requestId: Bun.randomUUIDv7(),
|
|
14
|
-
signal: new AbortController().signal,
|
|
15
15
|
...overrides,
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
const lookup = overrides?.provision ?? createProvisionLookup(() => ctx);
|
|
18
|
+
ctx.provision = lookup;
|
|
18
19
|
return ctx;
|
|
19
20
|
};
|
|
20
21
|
//# 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":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAOvD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,SAAqC,EACvB,EAAE;IAChB,MAAM,GAAG,GAAG;QACV,WAAW,EAAE,IAAI,eAAe,EAAE,CAAC,MAAM;QACzC,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAClB,GAAG,EAAE,OAAO,CAAC,GAAyC;QACtD,SAAS,EAAE,GAAG,CAAC,YAAY,EAAE;QAC7B,GAAG,SAAS;KACU,CAAC;IACzB,MAAM,MAAM,GAAG,SAAS,EAAE,SAAS,IAAI,qBAAqB,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;IACxE,GAAG,CAAC,SAAS,GAAG,MAAM,CAAC;IACvB,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
|
package/dist/derive.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Schema-driven field derivation for @ontrails/core
|
|
3
3
|
*
|
|
4
|
-
* Introspects Zod v4 schemas to produce a
|
|
5
|
-
* that UI
|
|
4
|
+
* Introspects Zod v4 schemas to produce a runtime-agnostic Field[] descriptor
|
|
5
|
+
* that UI consumers (CLI prompts, web forms, etc.) can consume.
|
|
6
6
|
*/
|
|
7
7
|
import type { z } from 'zod';
|
|
8
|
-
/** A
|
|
8
|
+
/** A runtime-agnostic field descriptor derived from a Zod schema. */
|
|
9
9
|
export interface Field {
|
|
10
10
|
readonly name: string;
|
|
11
11
|
readonly type: 'string' | 'number' | 'boolean' | 'enum' | 'multiselect' | 'string[]' | 'number[]';
|
|
@@ -29,5 +29,10 @@ export interface FieldOverride {
|
|
|
29
29
|
hint?: string | undefined;
|
|
30
30
|
}[] | undefined;
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Derive a runtime-agnostic Field[] from a Zod object schema.
|
|
34
|
+
*
|
|
35
|
+
* Uses Zod v4's `_zod.def` for introspection. Returns fields sorted by name.
|
|
36
|
+
*/
|
|
32
37
|
export declare const deriveFields: (schema: z.ZodType, overrides?: Record<string, FieldOverride>) => Field[];
|
|
33
38
|
//# sourceMappingURL=derive.d.ts.map
|
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,EAAE,MA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ACR,QAAQ,GACR,SAAS,GACT,MAAM,GACN,aAAa,GACb,UAAU,GACV,UAAU,CAAC;IACf,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,OAAO,CAAC,EACb,SAAS;QACP,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAC3B,EAAE,GACH,SAAS,CAAC;CACf;AAED,qDAAqD;AACrD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,OAAO,CAAC,EACb,SAAS;QACP,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAC3B,EAAE,GACH,SAAS,CAAC;CACf;AAiKD;;;;GAIG;AACH,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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Schema-driven field derivation for @ontrails/core
|
|
3
3
|
*
|
|
4
|
-
* Introspects Zod v4 schemas to produce a
|
|
5
|
-
* that UI
|
|
4
|
+
* Introspects Zod v4 schemas to produce a runtime-agnostic Field[] descriptor
|
|
5
|
+
* that UI consumers (CLI prompts, web forms, etc.) can consume.
|
|
6
6
|
*/
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
// Helpers
|
|
@@ -96,11 +96,6 @@ const buildOptions = (rawOptions, overrideOptions) => {
|
|
|
96
96
|
// ---------------------------------------------------------------------------
|
|
97
97
|
// Public API
|
|
98
98
|
// ---------------------------------------------------------------------------
|
|
99
|
-
/**
|
|
100
|
-
* Derive a surface-agnostic Field[] from a Zod object schema.
|
|
101
|
-
*
|
|
102
|
-
* Uses Zod v4's `_zod.def` for introspection. Returns fields sorted by name.
|
|
103
|
-
*/
|
|
104
99
|
/** Derive a single field from a shape entry. */
|
|
105
100
|
const deriveField = (key, value, overrides) => {
|
|
106
101
|
const { inner, required, defaultValue, description } = unwrap(value);
|
|
@@ -110,6 +105,11 @@ const deriveField = (key, value, overrides) => {
|
|
|
110
105
|
const options = buildOptions(rawOptions, override?.options);
|
|
111
106
|
return { default: defaultValue, label, name: key, options, required, type };
|
|
112
107
|
};
|
|
108
|
+
/**
|
|
109
|
+
* Derive a runtime-agnostic Field[] from a Zod object schema.
|
|
110
|
+
*
|
|
111
|
+
* Uses Zod v4's `_zod.def` for introspection. Returns fields sorted by name.
|
|
112
|
+
*/
|
|
113
113
|
export const deriveFields = (schema, overrides) => {
|
|
114
114
|
const s = schema;
|
|
115
115
|
if (s._zod.def['type'] !== 'object') {
|
package/dist/derive.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,E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IAC5D,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC9E,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,MAAiB,EACjB,SAAyC,EAChC,EAAE;IACX,MAAM,CAAC,GAAG,MAAiC,CAAC;IAC5C,IAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAY,KAAK,QAAQ,EAAE,CAAC;QAChD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAA6C,CAAC;IAC9E,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CACxD,WAAW,CAAC,GAAG,EAAE,KAAK,EAAE,SAAS,CAAC,CACnC,CAAC;IACF,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACjE,CAAC,CAAC"}
|
package/dist/event.d.ts
CHANGED
|
@@ -1,45 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*/
|
|
4
|
-
import type { z } from 'zod';
|
|
5
|
-
export interface EventSpec<T> {
|
|
6
|
-
readonly payload: z.ZodType<T>;
|
|
7
|
-
readonly description?: string | undefined;
|
|
8
|
-
readonly metadata?: Readonly<Record<string, unknown>> | undefined;
|
|
9
|
-
/** Trail IDs that produce this event (e.g. the trails it originates from). */
|
|
10
|
-
readonly from?: readonly string[] | undefined;
|
|
11
|
-
}
|
|
12
|
-
export interface Event<T> {
|
|
13
|
-
readonly id: string;
|
|
14
|
-
readonly kind: 'event';
|
|
15
|
-
readonly payload: z.ZodType<T>;
|
|
16
|
-
readonly description?: string | undefined;
|
|
17
|
-
readonly metadata?: Readonly<Record<string, unknown>> | undefined;
|
|
18
|
-
/** Trail IDs that produce this event (e.g. the trails it originates from). */
|
|
19
|
-
readonly from?: readonly string[] | undefined;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Create an event definition.
|
|
23
|
-
*
|
|
24
|
-
* An event is a named payload schema describing something that happened.
|
|
25
|
-
* Returns a frozen object with `kind: "event"` and all spec fields.
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```typescript
|
|
29
|
-
* // ID as first argument
|
|
30
|
-
* const updated = event("entity.updated", {
|
|
31
|
-
* payload: EntityUpdatedSchema,
|
|
32
|
-
* from: ["entity.add", "entity.update"],
|
|
33
|
-
* });
|
|
2
|
+
* Legacy event aliases for the signal model.
|
|
34
3
|
*
|
|
35
|
-
*
|
|
36
|
-
* const updated = event({ id: "entity.updated", payload: ..., from: [...] });
|
|
37
|
-
* ```
|
|
4
|
+
* Keep this file as a compatibility seam while the repo-wide cutover lands.
|
|
38
5
|
*/
|
|
39
|
-
export
|
|
40
|
-
export
|
|
41
|
-
readonly id: string;
|
|
42
|
-
}): Event<T>;
|
|
43
|
-
/** Existential type for heterogeneous event collections */
|
|
44
|
-
export type AnyEvent = Event<unknown>;
|
|
6
|
+
export { signal as event } from './signal.js';
|
|
7
|
+
export type { AnySignal, AnySignal as AnyEvent, Signal, Signal as Event, SignalSpec, SignalSpec as EventSpec, } from './signal.js';
|
|
45
8
|
//# sourceMappingURL=event.d.ts.map
|
package/dist/event.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../src/event.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../src/event.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,IAAI,KAAK,EAAE,MAAM,aAAa,CAAC;AAC9C,YAAY,EACV,SAAS,EACT,SAAS,IAAI,QAAQ,EACrB,MAAM,EACN,MAAM,IAAI,KAAK,EACf,UAAU,EACV,UAAU,IAAI,SAAS,GACxB,MAAM,aAAa,CAAC"}
|
package/dist/event.js
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Legacy event aliases for the signal model.
|
|
3
|
+
*
|
|
4
|
+
* Keep this file as a compatibility seam while the repo-wide cutover lands.
|
|
3
5
|
*/
|
|
4
|
-
export
|
|
5
|
-
const resolvedId = typeof idOrSpec === 'string' ? idOrSpec : idOrSpec.id;
|
|
6
|
-
// oxlint-disable-next-line no-non-null-assertion -- overload guarantees maybeSpec when idOrSpec is string
|
|
7
|
-
const resolvedSpec = typeof idOrSpec === 'string' ? maybeSpec : idOrSpec;
|
|
8
|
-
return Object.freeze({
|
|
9
|
-
description: resolvedSpec.description,
|
|
10
|
-
from: resolvedSpec.from ? Object.freeze([...resolvedSpec.from]) : undefined,
|
|
11
|
-
id: resolvedId,
|
|
12
|
-
kind: 'event',
|
|
13
|
-
metadata: resolvedSpec.metadata,
|
|
14
|
-
payload: resolvedSpec.payload,
|
|
15
|
-
});
|
|
16
|
-
}
|
|
6
|
+
export { signal as event } from './signal.js';
|
|
17
7
|
//# sourceMappingURL=event.js.map
|
package/dist/event.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.js","sourceRoot":"","sources":["../src/event.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"event.js","sourceRoot":"","sources":["../src/event.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,IAAI,KAAK,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/execute.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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
8
|
import type { AnyTrail } from './trail.js';
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
9
|
+
import type { Gate } from './gate.js';
|
|
10
|
+
import type { ProvisionOverrideMap } from './provision.js';
|
|
11
11
|
import type { TrailContextInit } from './types.js';
|
|
12
12
|
import { Result } from './result.js';
|
|
13
13
|
/** Options for executeTrail. */
|
|
@@ -15,16 +15,18 @@ export interface ExecuteTrailOptions {
|
|
|
15
15
|
/** Partial context overrides merged on top of the base context. */
|
|
16
16
|
readonly ctx?: Partial<TrailContextInit> | undefined;
|
|
17
17
|
/** AbortSignal override (takes final precedence over ctx and factory). */
|
|
18
|
-
readonly
|
|
19
|
-
/**
|
|
20
|
-
readonly
|
|
18
|
+
readonly abortSignal?: AbortSignal | undefined;
|
|
19
|
+
/** Gates to compose around the implementation. */
|
|
20
|
+
readonly gates?: readonly Gate[] | undefined;
|
|
21
21
|
/** Factory that produces a base TrailContext (takes precedence over defaults). */
|
|
22
22
|
readonly createContext?: (() => TrailContextInit | Promise<TrailContextInit>) | undefined;
|
|
23
|
-
/** Explicit
|
|
24
|
-
readonly
|
|
23
|
+
/** Explicit provision instance overrides keyed by provision ID. */
|
|
24
|
+
readonly provisions?: ProvisionOverrideMap | undefined;
|
|
25
|
+
/** Config values for provisions that declare a `config` schema, keyed by provision ID. */
|
|
26
|
+
readonly configValues?: Readonly<Record<string, Record<string, unknown>>> | undefined;
|
|
25
27
|
}
|
|
26
28
|
/**
|
|
27
|
-
* Execute a trail through the standard validate-context-
|
|
29
|
+
* Execute a trail through the standard validate-context-gates-run pipeline.
|
|
28
30
|
*
|
|
29
31
|
* The function never throws -- unexpected exceptions are caught and
|
|
30
32
|
* returned as `Result.err(InternalError)`.
|
package/dist/execute.d.ts.map
CHANGED
|
@@ -1 +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,
|
|
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,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAgB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAKjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAarC,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,WAAW,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/C,kDAAkD;IAClD,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,IAAI,EAAE,GAAG,SAAS,CAAC;IAC7C,kFAAkF;IAClF,QAAQ,CAAC,aAAa,CAAC,EACnB,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,GACpD,SAAS,CAAC;IACd,mEAAmE;IACnE,QAAQ,CAAC,UAAU,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAC;IACvD,0FAA0F;IAC1F,QAAQ,CAAC,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