deltafold 0.0.0-stage → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +280 -2
  3. package/dist/changelog.d.ts +116 -0
  4. package/dist/changelog.d.ts.map +1 -0
  5. package/dist/changelog.js +304 -0
  6. package/dist/changelog.js.map +1 -0
  7. package/dist/document-BZcZo9nr.js +171 -0
  8. package/dist/document-BZcZo9nr.js.map +1 -0
  9. package/dist/document-DWHsgywm.d.ts +257 -0
  10. package/dist/document-DWHsgywm.d.ts.map +1 -0
  11. package/dist/html.d.ts +8 -0
  12. package/dist/html.d.ts.map +1 -0
  13. package/dist/html.js +13 -0
  14. package/dist/html.js.map +1 -0
  15. package/dist/index.d.ts +378 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +2058 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/markdown.d.ts +8 -0
  20. package/dist/markdown.d.ts.map +1 -0
  21. package/dist/markdown.js +16 -0
  22. package/dist/markdown.js.map +1 -0
  23. package/dist/mdast-DiRsYwPU.js +108 -0
  24. package/dist/mdast-DiRsYwPU.js.map +1 -0
  25. package/dist/package-BfBYnaCz.d.ts +1125 -0
  26. package/dist/package-BfBYnaCz.d.ts.map +1 -0
  27. package/dist/rolldown-runtime-D8jQpDG7.js +12 -0
  28. package/package.json +64 -3
  29. package/src/features/documents/changelog.ts +450 -0
  30. package/src/features/documents/document.ts +357 -0
  31. package/src/features/documents/index.ts +4 -0
  32. package/src/features/documents/public-document.ts +31 -0
  33. package/src/features/documents/sections.ts +44 -0
  34. package/src/features/execution/executor.ts +826 -0
  35. package/src/features/execution/handler.ts +257 -0
  36. package/src/features/execution/settlement.ts +49 -0
  37. package/src/features/package.ts +32 -0
  38. package/src/features/planning/guide.ts +56 -0
  39. package/src/features/planning/history.ts +174 -0
  40. package/src/features/planning/identifiers.ts +43 -0
  41. package/src/features/planning/resolve-error.ts +201 -0
  42. package/src/features/planning/resolve.ts +724 -0
  43. package/src/features/planning/rewrite.ts +331 -0
  44. package/src/features/planning/validate.ts +388 -0
  45. package/src/foundation/action.ts +188 -0
  46. package/src/foundation/change.ts +147 -0
  47. package/src/foundation/instruction.ts +110 -0
  48. package/src/foundation/migration.ts +236 -0
  49. package/src/foundation/plan.ts +245 -0
  50. package/src/foundation/rule.ts +74 -0
  51. package/src/foundation/shortcut.ts +79 -0
  52. package/src/foundation/template.ts +28 -0
  53. package/src/foundation/version.ts +78 -0
  54. package/src/index.ts +22 -0
  55. package/src/renderers/html.ts +12 -0
  56. package/src/renderers/markdown.ts +12 -0
  57. package/src/renderers/mdast.ts +120 -0
  58. package/src/types.ts +2 -0
@@ -0,0 +1,257 @@
1
+ import { f as Version, t as Package } from "./package-BfBYnaCz.js";
2
+ import { Pipeable } from "effect";
3
+ /** @since @next */
4
+ type Text = {
5
+ readonly _tag: "Text";
6
+ readonly value: string;
7
+ };
8
+ /** @since @next */
9
+ type Code = {
10
+ readonly _tag: "Code";
11
+ readonly value: string;
12
+ };
13
+ /** @since @next */
14
+ type Link = {
15
+ readonly _tag: "Link";
16
+ readonly url: string;
17
+ readonly children: ReadonlyArray<Inline>;
18
+ };
19
+ /** @since @next */
20
+ type Strong = {
21
+ readonly _tag: "Strong";
22
+ readonly children: ReadonlyArray<Inline>;
23
+ };
24
+ /** @since @next */
25
+ type Emphasis = {
26
+ readonly _tag: "Emphasis";
27
+ readonly children: ReadonlyArray<Inline>;
28
+ };
29
+ /**
30
+ * Phrasing content.
31
+ *
32
+ * @since @next
33
+ */
34
+ type Inline = Text | Code | Link | Strong | Emphasis;
35
+ /** @since @next */
36
+ type Paragraph = {
37
+ readonly _tag: "Paragraph";
38
+ readonly children: ReadonlyArray<Inline>;
39
+ };
40
+ /** @since @next */
41
+ type List = {
42
+ readonly _tag: "List";
43
+ readonly ordered: boolean;
44
+ /** One entry per item. */
45
+ readonly items: ReadonlyArray<ReadonlyArray<Block>>;
46
+ };
47
+ /** @since @next */
48
+ type CodeBlock = {
49
+ readonly _tag: "CodeBlock";
50
+ readonly value: string;
51
+ readonly lang: string | undefined;
52
+ };
53
+ /** @since @next */
54
+ type Title = Pipeable.Pipeable & {
55
+ readonly _tag: "Title";
56
+ readonly children: ReadonlyArray<Inline>;
57
+ /** An absolute heading level. Absent means the level follows section nesting. */
58
+ readonly level: number | undefined;
59
+ };
60
+ /**
61
+ * A titled part of a document. Its `id` must be unique within the containing release,
62
+ * or within the document outside releases.
63
+ *
64
+ * @since @next
65
+ */
66
+ type Section = Pipeable.Pipeable & {
67
+ readonly _tag: "Section";
68
+ readonly id: string;
69
+ readonly title: Title | undefined;
70
+ /** Content inserted before the title. */
71
+ readonly before: ReadonlyArray<Block>;
72
+ /** Content inserted after the title, before the body. */
73
+ readonly after: ReadonlyArray<Block>;
74
+ readonly children: ReadonlyArray<Block>;
75
+ /** Set on a release section, which scopes the identifiers of its sections. */
76
+ readonly release: Version | undefined;
77
+ };
78
+ /** @since @next */
79
+ type Block = Paragraph | List | CodeBlock | Section;
80
+ /**
81
+ * A complete document returned by changelog builders.
82
+ *
83
+ * @since @next
84
+ */
85
+ type Document = {
86
+ readonly _tag: "Document";
87
+ readonly kind: "change" | "release" | "history" | "upgrade" | "downgrade";
88
+ readonly children: ReadonlyArray<Block>;
89
+ };
90
+ /**
91
+ * Text, or inline nodes.
92
+ *
93
+ * @since @next
94
+ */
95
+ type InlineInput = string | Inline | ReadonlyArray<string | Inline>;
96
+ /** @since @next */
97
+ declare const Text: (value: string) => Text;
98
+ /** @since @next */
99
+ declare const Code: (value: string) => Code;
100
+ /** @since @next */
101
+ declare const Link: (text: InlineInput, url: string) => Link;
102
+ /** @since @next */
103
+ declare const Strong: (children: InlineInput) => Strong;
104
+ /** @since @next */
105
+ declare const Emphasis: (children: InlineInput) => Emphasis;
106
+ /** @since @next */
107
+ declare const Paragraph: (children: InlineInput) => Paragraph;
108
+ /** @since @next */
109
+ declare const CodeBlock: (value: string, options?: {
110
+ readonly lang?: string;
111
+ }) => CodeBlock;
112
+ /**
113
+ * Builds a list. Each item is text, an inline node, a block, or several blocks.
114
+ *
115
+ * @since @next
116
+ */
117
+ declare const List: (items: ReadonlyArray<string | Inline | Block | ReadonlyArray<Block>>, options?: {
118
+ readonly ordered?: boolean;
119
+ }) => List;
120
+ /**
121
+ * An insertion point inside a plugin's scope.
122
+ *
123
+ * @since @next
124
+ */
125
+ type Anchor = {
126
+ readonly _tag: "Anchor";
127
+ readonly part: "title" | "body";
128
+ readonly position: "pre" | "post";
129
+ };
130
+ declare const makeTitle: (text: InlineInput, options?: {
131
+ readonly level?: number;
132
+ }) => Title;
133
+ /**
134
+ * Builds a title. `Document.Title.pre` and `Document.Title.post` are the insertion points
135
+ * around a scoped section's title.
136
+ *
137
+ * @since @next
138
+ */
139
+ declare const Title: typeof makeTitle & {
140
+ pre: Anchor;
141
+ post: Anchor;
142
+ };
143
+ /**
144
+ * The insertion points around a scoped section's body.
145
+ *
146
+ * @since @next
147
+ */
148
+ declare const Body: {
149
+ readonly pre: Anchor;
150
+ readonly post: Anchor;
151
+ };
152
+ /** @since @next */
153
+ declare const Section: (id: string, options?: SectionOptions) => Section;
154
+ type SectionOptions = {
155
+ readonly title?: Title | string;
156
+ readonly children?: ReadonlyArray<Block>;
157
+ };
158
+ /**
159
+ * Sets an absolute heading level on a title. Levels outside 1 to 6 fail at render time.
160
+ *
161
+ * @since @next
162
+ */
163
+ declare const withLevel: (level: number) => (title: Title) => Title;
164
+ /**
165
+ * Sets the title of a section.
166
+ *
167
+ * @since @next
168
+ */
169
+ declare const withTitle: (title: Title | string) => (section: Section) => Section;
170
+ /**
171
+ * Appends blocks to a section's body.
172
+ *
173
+ * @since @next
174
+ */
175
+ declare const append: (...blocks: ReadonlyArray<Block>) => (section: Section) => Section;
176
+ declare const DocumentError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
177
+ readonly _tag: "DocumentError";
178
+ } & Readonly<A>;
179
+ /**
180
+ * A document structure that cannot be rendered.
181
+ *
182
+ * @since @next
183
+ */
184
+ declare class DocumentError extends DocumentError_base<{
185
+ readonly reason: "duplicate-section" | "heading-level" | "reserved-id";
186
+ readonly message: string;
187
+ }> {}
188
+ /**
189
+ * Release-scoped plugins run once per included release.
190
+ *
191
+ * @since @next
192
+ */
193
+ declare const Release = "release";
194
+ /**
195
+ * History-scoped plugins run once per history document.
196
+ *
197
+ * @since @next
198
+ */
199
+ declare const History = "history";
200
+ /** @since @next */
201
+ type ReleaseContext<M> = {
202
+ readonly package: Package;
203
+ readonly version: Version;
204
+ readonly metadata: M;
205
+ };
206
+ /** @since @next */
207
+ type HistoryContext<M> = {
208
+ readonly package: Package;
209
+ readonly releases: ReadonlyArray<ReleaseContext<M>>;
210
+ };
211
+ /**
212
+ * Plugin output: blocks to insert, or `null` for nothing.
213
+ *
214
+ * @since @next
215
+ */
216
+ type PluginOutput = Block | ReadonlyArray<Block> | null;
217
+ /**
218
+ * Where a plugin's content goes. `scope` is `Document.Release`, once per included
219
+ * release, or `Document.History`, once per history document. `at` is
220
+ * `Document.Title.pre`, `Document.Title.post`, `Document.Body.pre`, or
221
+ * `Document.Body.post` of that scope's section. Each insertion point receives every
222
+ * plugin's content in configuration order.
223
+ *
224
+ * @since @next
225
+ */
226
+ type PluginOptions<M> = {
227
+ readonly scope: typeof Release;
228
+ readonly at: Anchor;
229
+ readonly resolve: (context: ReleaseContext<M>) => PluginOutput;
230
+ } | {
231
+ readonly scope: typeof History;
232
+ readonly at: Anchor;
233
+ readonly resolve: (context: HistoryContext<M>) => PluginOutput;
234
+ };
235
+ /**
236
+ * Contributes content at an insertion point. Plugins work on format-neutral content:
237
+ * they must not fetch metadata or execute migrations. Output is inserted once and is not
238
+ * processed by other plugins.
239
+ *
240
+ * @since @next
241
+ */
242
+ type Plugin<M> = {
243
+ readonly _tag: "Plugin";
244
+ readonly id: string;
245
+ } & PluginOptions<M>;
246
+ /** @since @next */
247
+ declare const makePlugin: <M>(id: string, options: PluginOptions<M>) => Plugin<M>;
248
+ /**
249
+ * `Document.Plugin.make`
250
+ *
251
+ * @since @next
252
+ */
253
+ declare const Plugin: {
254
+ readonly make: typeof makePlugin;
255
+ };
256
+ export { Text as C, withTitle as D, withLevel as E, Strong as S, append as T, PluginOptions as _, CodeBlock as a, ReleaseContext as b, Emphasis as c, Inline as d, InlineInput as f, Plugin as g, Paragraph as h, Code as i, History as l, List as m, Block as n, Document as o, Link as p, Body as r, DocumentError as s, Anchor as t, HistoryContext as u, PluginOutput as v, Title as w, Section as x, Release as y };
257
+ //# sourceMappingURL=document-DWHsgywm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-DWHsgywm.d.ts","names":[],"sources":["../src/features/documents/document.ts"],"mappings":";;;KAMY;WAAkB;WAAuB;;;KAEzC;WAAkB;WAAuB;;;KAEzC;WACF;WACA;WACA,UAAU,cAAc;;;KAGtB;WAAoB;WAAyB,UAAU,cAAc;;;KAErE;WAAsB;WAA2B,UAAU,cAAc;;;;;;;KAOzE,SAAS,OAAO,OAAO,OAAO,SAAS;;KAGvC;WAAuB;WAA4B,UAAU,cAAc;;;KAE3E;WACF;WACA;;WAEA,OAAO,cAAc,cAAc;;;KAGjC;WACF;WACA;WACA;;;KAIE,QAAQ,SAAS;WACnB;WACA,UAAU,cAAc;;WAExB;;;;;;;;KASE,UAAU,SAAS;WACrB;WACA;WACA,OAAO;;WAEP,QAAQ,cAAc;;WAEtB,OAAO,cAAc;WACrB,UAAU,cAAc;;WAExB,SAAS;;;KAIP,QAAQ,YAAY,OAAO,YAAY;;;;;;KAOvC;WACF;WACA;WACA,UAAU,cAAc;;;;;;;KAQtB,uBAAuB,SAAS,uBAAuB;;cAuBtD,OAAI,kBAAoB;;cAExB,OAAI,kBAAoB;;cAExB,OAAI,MAAU,aAAW,gBAAgB;;cAMzC,SAAM,UAAc,gBAAc;;cAKlC,WAAQ,UAAc,gBAAc;;cAKpC,YAAS,UAAc,gBAAc;;cAKrC,YAAS,eAAiB;WAAsB;MAAuB;;;;;;cAWvE,OAAI,OACT,uBAAuB,SAAS,QAAQ,cAAc,SAAO;WAChD;MAClB;;;;;;KAgBS;WACF;WACA;WACA;;cAcJ,YAAS,MAAU,aAAW;WAAsB;MAAwB;;;;;;;cASrE,cAAK;;;;;;;;;cAUL;WAAS,KAAG;WAAyB,MAAI;;;cAMzC,UAAO,YAAc,UAAW,mBAAsB;KAW9D;WACK,QAAQ;WACR,WAAW,cAAc;;;;;;;cAsBtB,YAAS,mBACP,OACN,UAAQ;;;;;;cAQJ,YAAS,OACb,oBAAc,SACZ,YAAU;;;;;;cAQR,YAAM,QACN,cAAc,YAAM,SACtB,YAAU;;;;;;;;;cAQR,sBAAsB;WACzB;WACA;;;;;;;cAUG;;;;;;cAMA;;KAGD,eAAe;WACjB,SAAS;WACT,SAAS;WACT,UAAU;;;KAIR,eAAe;WACjB,SAAS;WACT,UAAU,cAAc,eAAe;;;;;;;KAQrC,eAAe,QAAQ,cAAc;;;;;;;;;;KAWrC,cAAc;WAEd,cAAc;WACd,IAAI;WACJ,UAAU,SAAS,eAAe,OAAO;;WAGzC,cAAc;WACd,IAAI;WACJ,UAAU,SAAS,eAAe,OAAO;;;;;;;;;KAUzC,OAAO;WAAgB;WAAyB;IAAe,cAAc;;cAG5E,aAAc,GAAC,YAAY,SAAW,cAAc,OAAK,OAAO;;;;;;cAWhE;WAAW,aAAI"}
package/dist/html.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { o as Document } from "./document-DWHsgywm.js";
2
+ /**
3
+ * Renders a document as an HTML fragment. Throws `DocumentError` for unsupported structure.
4
+ *
5
+ * @since @next
6
+ */
7
+ export declare const render: (document: Document) => string;
8
+ //# sourceMappingURL=html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.d.ts","names":[],"sources":["../src/renderers/html.ts"],"mappings":";;;;;;qBAWa,SAAM,UAAc"}
package/dist/html.js ADDED
@@ -0,0 +1,13 @@
1
+ import { t as toMdast } from "./mdast-DiRsYwPU.js";
2
+ import { toHtml } from "hast-util-to-html";
3
+ import { toHast } from "mdast-util-to-hast";
4
+ // src/renderers/html.ts
5
+ /**
6
+ * Renders a document as an HTML fragment. Throws `DocumentError` for unsupported structure.
7
+ *
8
+ * @since @next
9
+ */
10
+ const render = (document) => toHtml(toHast(toMdast(document)));
11
+ export { render };
12
+
13
+ //# sourceMappingURL=html.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.js","names":[],"sources":["../src/renderers/html.ts"],"sourcesContent":["import { toHtml } from \"hast-util-to-html\";\nimport { toHast } from \"mdast-util-to-hast\";\n\nimport type { Document } from \"../features/documents/document.ts\";\nimport { toMdast } from \"./mdast.ts\";\n\n/**\n * Renders a document as an HTML fragment. Throws `DocumentError` for unsupported structure.\n *\n * @since @next\n */\nexport const render = (document: Document): string => toHtml(toHast(toMdast(document)));\n"],"mappings":";;;;;;;;;AAWA,MAAa,UAAU,aAA+B,OAAO,OAAO,QAAQ,QAAQ,CAAC,CAAC"}
@@ -0,0 +1,378 @@
1
+ import { _ as Any$1, a as Occurrence, c as shortcut_d_exports, g as change_d_exports, i as Coverage, l as rule_d_exports, n as package_d_exports, o as Plan, p as version_d_exports, r as history_d_exports, s as plan_d_exports, u as migration_d_exports, v as action_d_exports } from "./package-BfBYnaCz.js";
2
+ import { Cause, Context, Duration, Effect, Layer, Schema } from "effect";
3
+ /** The union of an object type's property values. */
4
+ type ValueOf<T> = T[keyof T];
5
+ declare namespace handler_d_exports {
6
+ export { ActionId, Any, EffectOptions, Error, ErrorGuard, Handler, Phase, PromiseContext, PromiseOptions$1 as PromiseOptions, ServiceMap, Services, UnexpectedHandlerError, effect$1 as effect, isHandler, promise };
7
+ }
8
+ /**
9
+ * Where a handler failure happened.
10
+ *
11
+ * @since @next
12
+ */
13
+ type Phase = "precondition" | "body";
14
+ declare const UnexpectedHandlerError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
15
+ readonly _tag: "UnexpectedHandlerError";
16
+ } & Readonly<A>;
17
+ /**
18
+ * A Promise handler rejected or threw a value that none of its declared error guards
19
+ * recognized.
20
+ *
21
+ * @since @next
22
+ */
23
+ declare class UnexpectedHandlerError extends UnexpectedHandlerError_base<{
24
+ readonly actionId: string;
25
+ readonly kind: string;
26
+ readonly phase: Phase;
27
+ readonly cause: unknown;
28
+ }> {
29
+ get message(): string;
30
+ }
31
+ declare const TypeId = "~deltafold/Handler";
32
+ /**
33
+ * Implements one action instance. `E` and `R` are the errors and Effect services of the
34
+ * body and precondition together.
35
+ *
36
+ * @since @next
37
+ */
38
+ type Handler<out A extends Any$1, out E = never, out R = never> = {
39
+ readonly [TypeId]: typeof TypeId;
40
+ readonly action: A;
41
+ /** Runs the action body. */
42
+ readonly body: Effect.Effect<void, E, R>;
43
+ /** Decides whether the body applies. `false` skips the occurrence. */
44
+ readonly precondition: Effect.Effect<boolean, E, R> | undefined;
45
+ /** Explains a skip when the precondition returns `false`. */
46
+ readonly skipReason: string;
47
+ };
48
+ /**
49
+ * Any handler.
50
+ *
51
+ * @since @next
52
+ */
53
+ type Any = Handler<Any$1, any, any>;
54
+ /**
55
+ * The errors of a handler or a union of handlers.
56
+ *
57
+ * @since @next
58
+ */
59
+ type Error<H> = H extends Handler<any, infer E, any> ? E : never;
60
+ /**
61
+ * The Effect services of a handler or a union of handlers.
62
+ *
63
+ * @since @next
64
+ */
65
+ type Services<H> = H extends Handler<any, any, infer R> ? R : never;
66
+ /**
67
+ * The action identifiers implemented by a handler or a union of handlers.
68
+ *
69
+ * @since @next
70
+ */
71
+ type ActionId<H> = H extends Handler<infer A, any, any> ? A["id"] : never;
72
+ /** @since @next */
73
+ declare const isHandler: (value: unknown) => value is Any;
74
+ type SkipReason<P> = string | ((payload: P) => string);
75
+ /**
76
+ * Named Effect services that a Promise handler declares.
77
+ *
78
+ * @since @next
79
+ */
80
+ type ServiceMap = {
81
+ readonly [name: string | symbol]: Context.Key<any, any>;
82
+ };
83
+ type NoServices = Record<never, never>;
84
+ /**
85
+ * The second argument of Promise handler callbacks: the `AbortSignal` that
86
+ * `Effect.tryPromise` aborts on interruption, and the declared services, resolved.
87
+ *
88
+ * @since @next
89
+ */
90
+ type PromiseContext<S extends ServiceMap = NoServices> = {
91
+ readonly signal: AbortSignal;
92
+ readonly services: { readonly [K in keyof S]: S[K]["Service"]; };
93
+ };
94
+ type ServiceIds<S extends ServiceMap> = ValueOf<{ [K in keyof S]: S[K] extends Context.Key<infer I, any> ? I : never; }>;
95
+ /**
96
+ * Recognizes a declared rejection: a schema, or a type guard such as an `instanceof`
97
+ * check. Guards must declare their parameter type, for example
98
+ * `(cause: unknown): cause is NotFound => cause instanceof NotFound`.
99
+ *
100
+ * @since @next
101
+ */
102
+ type ErrorGuard = Schema.Top | ((cause: unknown) => cause is any);
103
+ type GuardedError<G> = G extends Schema.Top ? G["Type"] : G extends ((cause: unknown) => cause is infer E) ? E : never;
104
+ /** @since @next */
105
+ type PromiseOptions$1<P, S extends ServiceMap, G extends ReadonlyArray<ErrorGuard>> = {
106
+ /** Effect services resolved for the callbacks and added to the handler requirements. */
107
+ readonly services?: S;
108
+ /**
109
+ * Guards for rejections that keep their own type. Other rejections become
110
+ * `UnexpectedHandlerError`. A guard does not prove that the callback throws only
111
+ * those errors.
112
+ */
113
+ readonly errors?: G;
114
+ /** Read-only precondition. Returning `false` skips the occurrence. */
115
+ readonly when?: (payload: P, context: PromiseContext<S>) => boolean | PromiseLike<boolean>;
116
+ readonly skipReason?: SkipReason<P>;
117
+ };
118
+ /**
119
+ * Implements an action with Promise callbacks. The callbacks run lazily through
120
+ * `Effect.tryPromise`, and receive its `AbortSignal` and the declared services in
121
+ * their second argument.
122
+ *
123
+ * @example
124
+ * ```ts
125
+ * Handler.promise(
126
+ * updateRemoteConfig,
127
+ * async (payload, { signal, services: { editor } }) => {
128
+ * await editor.update(payload, { signal });
129
+ * },
130
+ * { services: { editor: ConfigEditor } },
131
+ * );
132
+ * ```
133
+ *
134
+ * @since @next
135
+ */
136
+ declare const promise: <A extends Any$1, const S extends ServiceMap = NoServices, const G extends ReadonlyArray<ErrorGuard> = []>(action: A, run: (payload: A["payload"], context: PromiseContext<S>) => PromiseLike<unknown>, options?: PromiseOptions$1<A["payload"], S, G>) => Handler<A, GuardedError<G[number]> | UnexpectedHandlerError, ServiceIds<S>>;
137
+ /** @since @next */
138
+ type EffectOptions<P, E, R> = {
139
+ /** Read-only precondition. Succeeding with `false` skips the occurrence. */
140
+ readonly when?: (payload: P) => Effect.Effect<boolean, E, R>;
141
+ readonly skipReason?: SkipReason<P>;
142
+ };
143
+ /**
144
+ * Implements an action with an Effect. The body keeps its own errors and services, and
145
+ * stops through native Effect interruption.
146
+ *
147
+ * @since @next
148
+ */
149
+ declare const effect$1: <A extends Any$1, E = never, R = never, E2 = never, R2 = never>(action: A, run: (payload: A["payload"]) => Effect.Effect<unknown, E, R>, options?: EffectOptions<A["payload"], E2, R2>) => Handler<A, E | E2, R | R2>;
150
+ declare namespace executor_d_exports {
151
+ export { CoverageIssue, Errors, ExecutionError, ExecutionFailed, ExecutionInterrupted, HandlerCoverageError, InterruptReason, OccurrenceReport, Options, Outcome, PromiseOptions, Report, Requirements, Uncovered, effect, runPromise };
152
+ }
153
+ /**
154
+ * What happened to one occurrence, or what a dry run predicts.
155
+ *
156
+ * @since @next
157
+ */
158
+ type Outcome<E = unknown> = {
159
+ readonly _tag: "Completed";
160
+ } | {
161
+ readonly _tag: "Skipped";
162
+ readonly reason: string;
163
+ } | {
164
+ readonly _tag: "Failed";
165
+ readonly phase: Phase;
166
+ /** The typed failure, when the cause has one. Defects only appear in `cause`. */
167
+ readonly error: E | undefined;
168
+ readonly cause: Cause.Cause<E>;
169
+ } | {
170
+ readonly _tag: "Interrupted";
171
+ readonly phase: Phase;
172
+ /** `handler`: an Effect handler interrupted itself. */
173
+ readonly reason: InterruptReason;
174
+ /**
175
+ * Whether the interrupted work is known to have stopped. An interrupted Promise
176
+ * that has not settled within the grace period may still be changing external
177
+ * state.
178
+ */
179
+ readonly settled: boolean;
180
+ } |
181
+ /** Not started because execution stopped first. */
182
+ {
183
+ readonly _tag: "Unattempted";
184
+ } | {
185
+ readonly _tag: "WouldExecute";
186
+ readonly evaluated: boolean;
187
+ } | {
188
+ readonly _tag: "WouldSkip";
189
+ readonly reason: string;
190
+ } | {
191
+ readonly _tag: "Undetermined";
192
+ readonly reason: string;
193
+ } | {
194
+ readonly _tag: "PreconditionFailed";
195
+ readonly error: E | undefined;
196
+ readonly cause: Cause.Cause<E>;
197
+ };
198
+ /** @since @next */
199
+ type OccurrenceReport<A extends Any$1 = Any$1, E = unknown> = {
200
+ readonly occurrence: Occurrence<A>;
201
+ readonly outcome: Outcome<E>;
202
+ };
203
+ /** @since @next */
204
+ type Report<A extends Any$1 = Any$1, E = unknown> = {
205
+ readonly _tag: "Report";
206
+ readonly mode: "execute" | "dry-run";
207
+ readonly status: "completed" | "failed" | "interrupted" | "not-started" | "would-complete" | "would-fail";
208
+ readonly from: string;
209
+ readonly to: string;
210
+ readonly route: string;
211
+ /** Every occurrence in plan order. */
212
+ readonly occurrences: ReadonlyArray<OccurrenceReport<A, E>>;
213
+ /** Whether any action body started. A started body may have partially changed state. */
214
+ readonly bodiesStarted: boolean;
215
+ /** Progress is not persisted. Rerunning the plan repeats completed actions. */
216
+ readonly persistence: "none";
217
+ };
218
+ /**
219
+ * A handler is missing, duplicated, or bound to a different definition.
220
+ *
221
+ * @since @next
222
+ */
223
+ type CoverageIssue = {
224
+ readonly _tag: "Missing" | "Duplicate" | "Mismatched";
225
+ readonly occurrenceId: string;
226
+ readonly actionId: string;
227
+ readonly description: string;
228
+ readonly migrationId: string;
229
+ /** The rule that produced the occurrence, for replacements. */
230
+ readonly rule: string | undefined;
231
+ /** The occurrences a replacement stands for, so the missing handler is discoverable. */
232
+ readonly replaces: ReadonlyArray<{
233
+ readonly occurrenceId: string;
234
+ readonly description: string;
235
+ }>;
236
+ };
237
+ declare const HandlerCoverageBase: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => Cause.YieldableError & {
238
+ readonly _tag: "HandlerCoverageError";
239
+ } & Readonly<A>;
240
+ /**
241
+ * Handler coverage failed before any precondition or body ran. Every occurrence needs
242
+ * exactly one handler, for the same action definition: the same identifier, kind, and
243
+ * payload. For an occurrence that a rule produced, the issue names the rule and the
244
+ * occurrences it replaced.
245
+ *
246
+ * @since @next
247
+ */
248
+ declare class HandlerCoverageError<A extends Any$1 = Any$1> extends HandlerCoverageBase<{
249
+ readonly issues: ReadonlyArray<CoverageIssue>;
250
+ readonly report: Report<A, never>;
251
+ }> {
252
+ get message(): string;
253
+ }
254
+ declare const ExecutionFailedBase: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => Cause.YieldableError & {
255
+ readonly _tag: "ExecutionFailed";
256
+ } & Readonly<A>;
257
+ /**
258
+ * An occurrence failed. Execution stopped admitting new actions; started ones settled.
259
+ *
260
+ * @since @next
261
+ */
262
+ declare class ExecutionFailed<A extends Any$1 = Any$1, E = unknown> extends ExecutionFailedBase<{
263
+ readonly failures: ReadonlyArray<OccurrenceReport<A, E>>;
264
+ readonly report: Report<A, E>;
265
+ }> {
266
+ get message(): string;
267
+ }
268
+ declare const ExecutionInterruptedBase: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => Cause.YieldableError & {
269
+ readonly _tag: "ExecutionInterrupted";
270
+ } & Readonly<A>;
271
+ /**
272
+ * Why an execution or an occurrence was interrupted: explicit cancellation, a configured
273
+ * timeout, or an Effect handler that interrupted itself.
274
+ *
275
+ * @since @next
276
+ */
277
+ type InterruptReason = "cancelled" | "timeout" | "handler";
278
+ /**
279
+ * Explicit cancellation, a configured timeout, or a handler's own interruption stopped
280
+ * execution.
281
+ *
282
+ * @since @next
283
+ */
284
+ declare class ExecutionInterrupted<A extends Any$1 = Any$1, E = unknown> extends ExecutionInterruptedBase<{
285
+ readonly reason: InterruptReason;
286
+ readonly report: Report<A, E>;
287
+ }> {
288
+ get message(): string;
289
+ }
290
+ /** @since @next */
291
+ type ExecutionError<A extends Any$1, E> = HandlerCoverageError<A> | ExecutionFailed<A, E> | ExecutionInterrupted<A, E>;
292
+ /**
293
+ * Action identifiers of a statically covered plan that no handler in the array
294
+ * implements.
295
+ *
296
+ * @since @next
297
+ */
298
+ type Uncovered<A extends Any$1, H, C extends Coverage> = "runtime" extends C ? never : A extends Any$1 ? string extends A["id"] ? never : A["id"] extends ActionId<H> ? never : A["id"] : never;
299
+ /** Rejects a handler array that leaves statically known actions uncovered, naming them. */
300
+ type CoverageCheck<A extends Any$1, H, C extends Coverage> = [Uncovered<A, H, C>] extends [never] ? unknown : {
301
+ readonly handlers: `Missing a handler for action "${Uncovered<A, H, C>}"`;
302
+ };
303
+ /**
304
+ * Errors an execution can report for its occurrences.
305
+ *
306
+ * @since @next
307
+ */
308
+ type Errors<H> = Error<H>;
309
+ /**
310
+ * Effect services an execution requires: the services of its handlers.
311
+ *
312
+ * @since @next
313
+ */
314
+ type Requirements<H> = Services<H>;
315
+ /** @since @next */
316
+ type Options<H extends Any> = {
317
+ readonly handlers?: ReadonlyArray<H>;
318
+ /**
319
+ * Evaluate preconditions without running any action body. A precondition that may
320
+ * depend on an earlier action is reported `Undetermined`, because the dry run does not
321
+ * apply that action.
322
+ */
323
+ readonly dryRun?: boolean;
324
+ /**
325
+ * Per-occurrence limit for a precondition or body. Exceeding it interrupts that action
326
+ * and stops admitting new ones. It applies to dry-run preconditions too.
327
+ */
328
+ readonly timeout?: Duration.Input;
329
+ /**
330
+ * How long to wait for an interrupted Promise callback to settle before reporting it
331
+ * as possibly still running. Defaults to 5 seconds.
332
+ */
333
+ readonly settleTimeout?: Duration.Input;
334
+ };
335
+ /**
336
+ * Runs a plan as an Effect. Coverage is checked before any precondition or body runs.
337
+ * Steps are sequential barriers; parallel groups run their branches concurrently. On
338
+ * failure, no new action starts, and actions already running settle before the effect
339
+ * fails with the partial report.
340
+ *
341
+ * To cancel, interrupt the fiber. Interruption reaches running actions and aborts the
342
+ * signal passed to Promise callbacks. The effect then ends as interrupted, without a
343
+ * report.
344
+ *
345
+ * @since @next
346
+ */
347
+ declare const effect: <A extends Any$1, C extends Coverage, H extends Any = never>(plan: Plan<A, C>, options: Options<H> & CoverageCheck<A, H, C>) => Effect.Effect<Report<A, Errors<H>>, ExecutionError<A, Errors<H>>, Requirements<H>>;
348
+ type ServicesOption<R, LE> = [R] extends [never] ? {
349
+ /** Handlers without Effect services need none. */
350
+ readonly services?: Context.Context<never> | Layer.Layer<never, LE>;
351
+ } : {
352
+ /** Supplies the handlers' Effect services. */
353
+ readonly services: Context.Context<R> | Layer.Layer<R, LE>;
354
+ };
355
+ /** @since @next */
356
+ type PromiseOptions<H extends Any> = Options<H> & {
357
+ /**
358
+ * Explicit cancellation. Aborting stops admission, interrupts running actions, and
359
+ * rejects with `ExecutionInterrupted` and the partial report.
360
+ */
361
+ readonly signal?: AbortSignal;
362
+ };
363
+ /**
364
+ * Runs a plan and returns a Promise. It rejects with `HandlerCoverageError`,
365
+ * `ExecutionFailed`, or `ExecutionInterrupted`, each carrying the partial report.
366
+ * Building a supplied services layer can also reject with the layer's own error,
367
+ * without a report.
368
+ *
369
+ * A services layer is built for this run and finalized when the run ends. A services
370
+ * context stays owned by the caller. A Promise callback that ignores its signal can keep
371
+ * running after cancellation or a timeout, beyond `settleTimeout`, and so after the
372
+ * run's layer resources are finalized; the report marks it as possibly still running.
373
+ *
374
+ * @since @next
375
+ */
376
+ declare const runPromise: <A extends Any$1, C extends Coverage, H extends Any = never, LE = never>(plan: Plan<A, C>, options: PromiseOptions<H> & ServicesOption<Requirements<H>, LE> & CoverageCheck<A, H, C>) => Promise<Report<A, Errors<H>>>;
377
+ export { action_d_exports as Action, change_d_exports as Change, executor_d_exports as Executor, handler_d_exports as Handler, history_d_exports as History, migration_d_exports as Migration, package_d_exports as Package, plan_d_exports as Plan, rule_d_exports as Rule, shortcut_d_exports as Shortcut, version_d_exports as Version };
378
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":["Action.Any","PromiseOptions","effect","Handler.Phase","Action.Any","Plan.Coverage","Handler.ActionId","Handler.Error","Handler.Services","Handler.Any","Plan.Plan"],"sources":["../src/types.ts","../src/features/execution/handler.ts","../src/features/execution/executor.ts"],"mappings":";;;KACY,QAAQ,KAAK,QAAQ;;;;;;;;;KCUrB;;;;;;;;;;cAQC,+BAA+B;WAClC;WACA;WACA,OAAO;WACP;;MAEI;;cAKR;;;;;;;KAQM,YAAY,UAAUA,WAAgB,eAAe;YACtD,gBAAgB;WACjB,QAAQ;;WAER,MAAM,OAAO,aAAa,GAAG;;WAE7B,cAAc,OAAO,gBAAgB,GAAG;;WAExC;;;;;;;KAQE,MAAM,QAAQA;;;;;;KAOd,MAAM,KAAK,UAAU,mBAAmB,UAAU;;;;;;KAOlD,SAAS,KAAK,UAAU,wBAAwB,KAAK;;;;;;KAOrD,SAAS,KAAK,UAAU,cAAc,eAAe;;cAGpD,YAAS,mBAAqB,SAAS;KAE/C,WAAW,gBAAgB,SAAS;;;;;;KAa7B;YAAyB,wBAAwB,QAAQ;;KAGhE,aAAa;;;;;;;KAQN,eAAe,UAAU,aAAa;WACxC,QAAQ;WACR,sBAAsB,WAAW,IAAI,EAAE;;KAG5C,WAAW,UAAU,cAAc,WACtC,WAAW,IAAI,EAAE,WAAW,QAAQ,UAAU,UAAU;;;;;;;;KAU9C,aAAa,OAAO,QAAQ,mBAAmB;KAEtD,aAAa,KAAK,UA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