deltafold 0.2.0 → 0.2.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 (48) hide show
  1. package/README.md +33 -1
  2. package/dist/changelog.d.ts +10 -10
  3. package/dist/changelog.js +4 -4
  4. package/dist/changelog.js.map +1 -1
  5. package/dist/{document-BZcZo9nr.js → document-HfPyYxEd.js} +20 -20
  6. package/dist/{document-BZcZo9nr.js.map → document-HfPyYxEd.js.map} +1 -1
  7. package/dist/{document-DWHsgywm.d.ts → document-gtXeGFJR.d.ts} +41 -41
  8. package/dist/{document-DWHsgywm.d.ts.map → document-gtXeGFJR.d.ts.map} +1 -1
  9. package/dist/html.d.ts +2 -2
  10. package/dist/html.js +2 -2
  11. package/dist/html.js.map +1 -1
  12. package/dist/index.d.ts +437 -105
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +750 -273
  15. package/dist/index.js.map +1 -1
  16. package/dist/markdown.d.ts +2 -2
  17. package/dist/markdown.js +2 -2
  18. package/dist/markdown.js.map +1 -1
  19. package/dist/{mdast-DiRsYwPU.js → mdast-Oqkh0Gs1.js} +2 -2
  20. package/dist/{mdast-DiRsYwPU.js.map → mdast-Oqkh0Gs1.js.map} +1 -1
  21. package/dist/{package-BfBYnaCz.d.ts → package-CA5R57IC.d.ts} +117 -112
  22. package/dist/{package-BfBYnaCz.d.ts.map → package-CA5R57IC.d.ts.map} +1 -1
  23. package/package.json +3 -3
  24. package/src/features/documents/changelog.ts +8 -8
  25. package/src/features/documents/document.ts +39 -39
  26. package/src/features/documents/index.ts +2 -2
  27. package/src/features/execution/executor.ts +485 -313
  28. package/src/features/execution/handler.ts +30 -30
  29. package/src/features/execution/interaction.ts +11 -11
  30. package/src/features/execution/observation.ts +489 -0
  31. package/src/features/execution/observer.ts +395 -0
  32. package/src/features/package.ts +3 -3
  33. package/src/features/planning/history.ts +10 -10
  34. package/src/features/planning/identifiers.ts +7 -4
  35. package/src/features/planning/resolve-error.ts +13 -13
  36. package/src/features/planning/resolve.ts +11 -4
  37. package/src/features/planning/validate.ts +1 -1
  38. package/src/foundation/action.ts +17 -17
  39. package/src/foundation/change.ts +10 -10
  40. package/src/foundation/instruction.ts +5 -5
  41. package/src/foundation/migration.ts +12 -12
  42. package/src/foundation/plan.ts +23 -18
  43. package/src/foundation/rule.ts +6 -6
  44. package/src/foundation/shortcut.ts +6 -6
  45. package/src/foundation/version.ts +6 -6
  46. package/src/index.ts +14 -12
  47. package/src/renderers/html.ts +1 -1
  48. package/src/renderers/markdown.ts +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D8jQpDG7.js";
2
- import { Array as Array$1, Cause, Context, Data, Deferred, Duration, Effect, Equal, Exit, Fiber, Graph, Layer, Option, Order, Predicate, Result, Schema, Scope, SemVer } from "effect";
2
+ import { Array as Array$1, Cause, Clock, Context, Data, Deferred, Duration, Effect, Equal, Exit, Fiber, Graph, Layer, Option, Order, Predicate, Result, Schema, Scope, SemVer, Semaphore } from "effect";
3
3
  import dedentText from "dedent";
4
4
  // src/foundation/action.ts
5
5
  var action_exports = /* @__PURE__ */ __exportAll({
@@ -28,7 +28,7 @@ var action_exports = /* @__PURE__ */ __exportAll({
28
28
  * });
29
29
  * ```
30
30
  *
31
- * @since @next
31
+ * @since 0.0.1
32
32
  */
33
33
  const define$1 = (kind, options = {}) => {
34
34
  const describe = options.describe ?? (() => kind);
@@ -48,7 +48,7 @@ const define$1 = (kind, options = {}) => {
48
48
  /**
49
49
  * Mentions an action in prose without declaring another occurrence.
50
50
  *
51
- * @since @next
51
+ * @since 0.0.1
52
52
  */
53
53
  const ref = (action) => ({
54
54
  _tag: "ActionRef",
@@ -57,7 +57,7 @@ const ref = (action) => ({
57
57
  /**
58
58
  * Declares steps that run one after another.
59
59
  *
60
- * @since @next
60
+ * @since 0.0.1
61
61
  */
62
62
  const sequence = (children) => ({
63
63
  _tag: "Sequence",
@@ -67,20 +67,20 @@ const sequence = (children) => ({
67
67
  * Declares independent branches that may run concurrently. Each branch can be a single
68
68
  * step or a sequence.
69
69
  *
70
- * @since @next
70
+ * @since 0.0.1
71
71
  */
72
72
  const parallel = (branches, options = {}) => ({
73
73
  _tag: "Parallel",
74
74
  branches,
75
75
  concurrency: options.concurrency ?? "unbounded"
76
76
  });
77
- /** @since @next */
77
+ /** @since 0.0.1 */
78
78
  const isAction = (value) => Predicate.isTagged(value, "Action") && Predicate.hasProperty(value, "id");
79
- /** @since @next */
79
+ /** @since 0.0.1 */
80
80
  const isRef = (value) => Predicate.isTagged(value, "ActionRef");
81
- /** @since @next */
81
+ /** @since 0.0.1 */
82
82
  const isSequence = (value) => Predicate.isTagged(value, "Sequence");
83
- /** @since @next */
83
+ /** @since 0.0.1 */
84
84
  const isParallel = (value) => Predicate.isTagged(value, "Parallel");
85
85
  // src/foundation/template.ts
86
86
  const placeholder = "\0";
@@ -142,10 +142,10 @@ function make$6(id, metadata = {}, relations = {}) {
142
142
  * `;
143
143
  * ```
144
144
  *
145
- * @since @next
145
+ * @since 0.0.1
146
146
  */
147
147
  const define = () => ({ make: make$6 });
148
- /** @since @next */
148
+ /** @since 0.0.1 */
149
149
  const isChange = (value) => Predicate.isTagged(value, "Change");
150
150
  // src/features/execution/settlement.ts
151
151
  const SettlementReference = Context.Reference("deltafold/Settlement", { defaultValue: () => ({
@@ -195,18 +195,18 @@ const adaptPromise = (options) => {
195
195
  var handler_exports = /* @__PURE__ */ __exportAll({
196
196
  UnexpectedHandlerError: () => UnexpectedHandlerError,
197
197
  VerificationFailed: () => VerificationFailed,
198
- effect: () => effect$2,
198
+ effect: () => effect$3,
199
199
  isHandler: () => isHandler,
200
200
  manual: () => manual,
201
201
  manualEffect: () => manualEffect,
202
202
  prepared: () => prepared,
203
- promise: () => promise$1,
203
+ promise: () => promise$2,
204
204
  skip: () => skip
205
205
  });
206
206
  /**
207
207
  * A person confirmed manual work, and the handler's `verify` check returned `false`.
208
208
  *
209
- * @since @next
209
+ * @since 0.2.0
210
210
  */
211
211
  var VerificationFailed = class extends Data.TaggedError("VerificationFailed") {
212
212
  get message() {
@@ -218,7 +218,7 @@ var VerificationFailed = class extends Data.TaggedError("VerificationFailed") {
218
218
  * recognized, or its prepare phase returned something other than `Handler.prepared` or
219
219
  * `Handler.skip`.
220
220
  *
221
- * @since @next
221
+ * @since 0.0.1
222
222
  */
223
223
  var UnexpectedHandlerError = class extends Data.TaggedError("UnexpectedHandlerError") {
224
224
  get message() {
@@ -236,7 +236,7 @@ function prepared(value) {
236
236
  /**
237
237
  * Ends a prepare phase by skipping the occurrence. The apply phase does not run.
238
238
  *
239
- * @since @next
239
+ * @since 0.1.0
240
240
  */
241
241
  const skip = (reason) => ({
242
242
  [PreparationTypeId]: PreparationTypeId,
@@ -249,17 +249,17 @@ const applyStep = (apply) => ({
249
249
  _tag: "Apply",
250
250
  apply
251
251
  });
252
- const TypeId$1 = "~deltafold/Handler";
253
- /** @since @next */
254
- const isHandler = (value) => Predicate.hasProperty(value, TypeId$1);
252
+ const TypeId$2 = "~deltafold/Handler";
253
+ /** @since 0.0.1 */
254
+ const isHandler = (value) => Predicate.hasProperty(value, TypeId$2);
255
255
  const make$5 = (action, prepares, prepare) => ({
256
- [TypeId$1]: TypeId$1,
256
+ [TypeId$2]: TypeId$2,
257
257
  action,
258
258
  performer: "automated",
259
259
  prepares,
260
260
  prepare
261
261
  });
262
- function promise$1(action, run, options) {
262
+ function promise$2(action, run, options) {
263
263
  const adaptCallback = adaptPromise(options ?? {});
264
264
  const unexpected = (phase, cause) => new UnexpectedHandlerError({
265
265
  actionId: action.id,
@@ -278,7 +278,7 @@ function promise$1(action, run, options) {
278
278
  }))))));
279
279
  return make$5(action, true, () => prepare);
280
280
  }
281
- function effect$2(action, run) {
281
+ function effect$3(action, run) {
282
282
  if (Predicate.isFunction(run)) {
283
283
  const apply = Effect.asVoid(Effect.suspend(() => run(action.payload)));
284
284
  return make$5(action, false, (scope) => Effect.succeed(applyStep(Scope.provide(apply, scope))));
@@ -290,7 +290,7 @@ const verified = (action, check) => Effect.flatMap(check, (passed) => passed ? E
290
290
  kind: action.kind
291
291
  })));
292
292
  const makeManual = (action, verify) => ({
293
- [TypeId$1]: TypeId$1,
293
+ [TypeId$2]: TypeId$2,
294
294
  action,
295
295
  performer: "manual",
296
296
  prepares: false,
@@ -316,13 +316,342 @@ function manualEffect(action, options) {
316
316
  if (verify === void 0) return makeManual(action, void 0);
317
317
  return makeManual(action, (scope) => Scope.provide(verified(action, Effect.suspend(() => verify(action.payload))), scope));
318
318
  }
319
+ // src/features/execution/observation.ts
320
+ const stepIdsOf = (plan) => (occurrence) => plan.steps.find((step) => step.migration === occurrence.migration && step.direction === occurrence.direction)?.id ?? occurrence.migration.id;
321
+ /** Declared occurrences behind an occurrence, through nested replacements, in order. */
322
+ const leavesOf = (occurrence) => occurrence.origin._tag === "Declared" ? [occurrence] : occurrence.origin.replaces.flatMap(leavesOf);
323
+ const sourcesOf = (occurrence, stepIdOf) => [...new Set(leavesOf(occurrence).map(stepIdOf))];
324
+ const occurrencesOfNode = (node) => {
325
+ switch (node._tag) {
326
+ case "Occurrence": return [node];
327
+ case "Sequence": return node.children.flatMap(occurrencesOfNode);
328
+ }
329
+ return node.branches.flatMap(occurrencesOfNode);
330
+ };
331
+ const stepInfoOf = (step, index, plan, stepIdOf) => {
332
+ const occurrences = occurrencesOfNode(step.node);
333
+ const base = {
334
+ id: step.id,
335
+ index,
336
+ migration: step.migration.id,
337
+ direction: step.direction,
338
+ from: step.from.id,
339
+ to: step.to.id,
340
+ occurrences: occurrences.map((occurrence) => occurrence.id),
341
+ absorbs: [...new Set(occurrences.flatMap((occurrence) => sourcesOf(occurrence, stepIdOf)))].filter((id) => id !== step.id)
342
+ };
343
+ if (occurrences.length > 0) return {
344
+ ...base,
345
+ kind: "execute"
346
+ };
347
+ if (!step.omitted) return {
348
+ ...base,
349
+ kind: "prose"
350
+ };
351
+ const omitted = plan.explanations.find((explanation) => explanation._tag === "OmittedStep" && explanation.migration.id === step.migration.id && explanation.direction === step.direction);
352
+ return {
353
+ ...base,
354
+ kind: "omitted",
355
+ reason: omitted?._tag === "OmittedStep" && omitted.reason === "all-actions-removed" ? "all-actions-removed" : "noop"
356
+ };
357
+ };
358
+ const actionInfoOf = (occurrence, step, stepIdOf) => ({
359
+ occurrence: occurrence.id,
360
+ action: occurrence.action.id,
361
+ kind: occurrence.action.kind,
362
+ description: occurrence.action.description,
363
+ migration: occurrence.migration.id,
364
+ direction: occurrence.direction,
365
+ step,
366
+ origin: occurrence.origin._tag === "Declared" ? { _tag: "Declared" } : {
367
+ _tag: "Replacement",
368
+ rule: occurrence.origin.rule.id,
369
+ replaces: occurrence.origin.replaces.map((replaced) => replaced.id)
370
+ },
371
+ sources: sourcesOf(occurrence, stepIdOf)
372
+ });
373
+ /**
374
+ * Reads a handler error's tag once, so a getter cannot pass the check with one value and
375
+ * return another. A tag that cannot be read, even by a throwing getter, is absent.
376
+ */
377
+ const errorTagOf = (error) => {
378
+ try {
379
+ if (!Predicate.hasProperty(error, "_tag")) return void 0;
380
+ const tag = error._tag;
381
+ return typeof tag === "string" ? tag : void 0;
382
+ } catch {
383
+ return;
384
+ }
385
+ };
386
+ /** Copies only the fields observers may see. */
387
+ const summaryOf$1 = (outcome) => {
388
+ switch (outcome._tag) {
389
+ case "Completed": return outcome.performer === "manual" ? {
390
+ _tag: "Completed",
391
+ performer: "manual",
392
+ confirmation: outcome.confirmation
393
+ } : {
394
+ _tag: "Completed",
395
+ performer: "automated"
396
+ };
397
+ case "Skipped": return {
398
+ _tag: "Skipped",
399
+ reason: outcome.reason
400
+ };
401
+ case "Declined": return { _tag: "Declined" };
402
+ case "Failed": return {
403
+ _tag: "Failed",
404
+ phase: outcome.phase,
405
+ errorTag: errorTagOf(outcome.error)
406
+ };
407
+ case "Interrupted": return {
408
+ _tag: "Interrupted",
409
+ phase: outcome.phase,
410
+ reason: outcome.reason,
411
+ settled: outcome.settled
412
+ };
413
+ case "Unattempted": return { _tag: "Unattempted" };
414
+ case "WouldExecute": return {
415
+ _tag: "WouldExecute",
416
+ evaluated: outcome.evaluated,
417
+ performer: outcome.performer
418
+ };
419
+ case "WouldSkip": return {
420
+ _tag: "WouldSkip",
421
+ reason: outcome.reason
422
+ };
423
+ case "Undetermined": return {
424
+ _tag: "Undetermined",
425
+ reason: outcome.reason,
426
+ performer: outcome.performer
427
+ };
428
+ }
429
+ return {
430
+ _tag: "PreparationFailed",
431
+ errorTag: errorTagOf(outcome.error)
432
+ };
433
+ };
434
+ const emptyCounts = () => ({
435
+ Completed: 0,
436
+ Skipped: 0,
437
+ Declined: 0,
438
+ Failed: 0,
439
+ Interrupted: 0,
440
+ Unattempted: 0,
441
+ WouldExecute: 0,
442
+ WouldSkip: 0,
443
+ Undetermined: 0,
444
+ PreparationFailed: 0,
445
+ unsettled: 0
446
+ });
447
+ const noop$1 = {
448
+ runStarted: Effect.void,
449
+ stepStarted: () => Effect.void,
450
+ stepSettled: () => Effect.void,
451
+ phaseStarted: () => Effect.void,
452
+ settled: () => Effect.void,
453
+ runFinished: () => Effect.void,
454
+ interrupted: Effect.void,
455
+ failures: []
456
+ };
457
+ /**
458
+ * Delivery is awaited and serialized: one event at a time, to each observer in order.
459
+ * Counters change under the same lock, so each event's progress is consistent with the
460
+ * order observers see. Observer failures are recorded and never reach the run.
461
+ */
462
+ const makeEmitter = (options) => Effect.gen(function* () {
463
+ const { plan, observers, outcomes, stopped, grace, retain } = options;
464
+ if (observers.length === 0) return noop$1;
465
+ const stepIdOf = stepIdsOf(plan);
466
+ const lock = yield* Semaphore.make(1);
467
+ const failures = [];
468
+ const run = {
469
+ id: options.runId,
470
+ mode: options.mode,
471
+ from: plan.from.id,
472
+ to: plan.to.id,
473
+ route: plan.route.id
474
+ };
475
+ const steps = plan.steps.map((step, index) => stepInfoOf(step, index, plan, stepIdOf));
476
+ const infoOf = new Map(plan.steps.map((step, index) => [step, steps[index]]));
477
+ const ownerOf = /* @__PURE__ */ new Map();
478
+ for (const info of steps) for (const id of info.occurrences) ownerOf.set(id, info.id);
479
+ const state = {
480
+ seq: 0,
481
+ running: /* @__PURE__ */ new Set(),
482
+ actionsFinished: 0,
483
+ stepsFinished: 0,
484
+ started: false,
485
+ finished: false,
486
+ delivering: void 0
487
+ };
488
+ const stepsTotal = steps.filter((info) => info.kind !== "omitted").length;
489
+ const progress = () => ({
490
+ steps: {
491
+ total: stepsTotal,
492
+ finished: state.stepsFinished
493
+ },
494
+ actions: {
495
+ total: plan.occurrences.length,
496
+ running: state.running.size,
497
+ finished: state.actionsFinished
498
+ }
499
+ });
500
+ const countsOf = (occurrences, inFlight) => {
501
+ const counts = emptyCounts();
502
+ for (const occurrence of occurrences) {
503
+ const outcome = outcomes.get(occurrence.id);
504
+ if (outcome === void 0 && inFlight && state.running.has(occurrence.id)) {
505
+ counts.Interrupted += 1;
506
+ counts.unsettled += 1;
507
+ continue;
508
+ }
509
+ const tag = outcome?._tag ?? "Unattempted";
510
+ counts[tag] += 1;
511
+ if (outcome?._tag === "Interrupted" && !outcome.settled) counts.unsettled += 1;
512
+ }
513
+ return counts;
514
+ };
515
+ /**
516
+ * Interrupts an abandoned delivery without waiting for it to stop. The run's services
517
+ * stay open until it does.
518
+ */
519
+ const abandon = (fiber) => Effect.map(Effect.forkDetach(Fiber.interrupt(fiber)), retain);
520
+ /**
521
+ * Bounds a delivery once the run has been stopped, or always when `bounded` is set.
522
+ * The callback runs in its own fiber, with the run's services, so a delivery that
523
+ * cannot be interrupted is still abandoned when the bound passes.
524
+ */
525
+ const deliver = (observer, event, bounded) => Effect.uninterruptibleMask((restore) => Effect.gen(function* () {
526
+ const fiber = yield* Effect.forkDetach(Effect.interruptible(observer.notify(event)), { startImmediately: true });
527
+ const limit = bounded ? Effect.sleep(grace) : Effect.andThen(Deferred.await(stopped), Effect.sleep(grace));
528
+ const result = yield* restore(Effect.raceFirst(Effect.map(Fiber.await(fiber), (exit) => Option.some(Exit.isSuccess(exit) ? exit.value : exit)), Effect.as(limit, Option.none()))).pipe(Effect.onInterrupt(() => abandon(fiber)));
529
+ if (Option.isNone(result)) yield* abandon(fiber);
530
+ return result;
531
+ }));
532
+ const record = (observer, event, result) => {
533
+ if (Option.isNone(result)) failures.push({
534
+ observer,
535
+ event: event._tag,
536
+ seq: event.seq,
537
+ reason: "abandoned",
538
+ cause: Cause.interrupt()
539
+ });
540
+ else if (Exit.isFailure(result.value)) failures.push({
541
+ observer,
542
+ event: event._tag,
543
+ seq: event.seq,
544
+ reason: "failed",
545
+ cause: result.value.cause
546
+ });
547
+ };
548
+ /** Delivers an event to each observer from `first` on, in order. */
549
+ const deliverFrom = (event, first, bounded) => Effect.gen(function* () {
550
+ for (const [offset, observer] of observers.slice(first).entries()) {
551
+ const index = first + offset;
552
+ state.delivering = {
553
+ event,
554
+ observer: index
555
+ };
556
+ record(index, event, yield* deliver(observer, event, bounded));
557
+ }
558
+ state.delivering = void 0;
559
+ });
560
+ const emit = (update, build, bounded = false) => lock.withPermits(1)(Effect.gen(function* () {
561
+ update();
562
+ const timestamp = yield* Clock.currentTimeMillis;
563
+ const event = build({
564
+ run,
565
+ seq: state.seq,
566
+ timestamp,
567
+ progress: progress()
568
+ });
569
+ state.seq += 1;
570
+ yield* deliverFrom(event, 0, bounded);
571
+ }));
572
+ const stepEvent = (step) => infoOf.get(step) ?? stepInfoOf(step, -1, plan, stepIdOf);
573
+ const actionOf = (occurrence) => actionInfoOf(occurrence, ownerOf.get(occurrence.id) ?? stepIdOf(occurrence), stepIdOf);
574
+ const finish = (status, report, bounded) => emit(() => {
575
+ state.finished = true;
576
+ }, (base) => ({
577
+ ...base,
578
+ _tag: "RunFinished",
579
+ status,
580
+ counts: countsOf(plan.occurrences, !report),
581
+ report
582
+ }), bounded);
583
+ /**
584
+ * Ends the stream after fiber interruption. The delivery the interruption cut short is
585
+ * abandoned. If it was `RunFinished`, the observers that had not received it get a
586
+ * report-less one with the same `seq` instead, so each observer hears exactly one.
587
+ */
588
+ const interrupted = Effect.suspend(() => {
589
+ const cut = state.delivering;
590
+ if (cut !== void 0) {
591
+ record(cut.observer, cut.event, Option.none());
592
+ state.delivering = void 0;
593
+ }
594
+ if (!state.started) return Effect.void;
595
+ if (!state.finished) return finish("interrupted", false, true);
596
+ if (cut?.event._tag !== "RunFinished") return Effect.void;
597
+ const event = {
598
+ ...cut.event,
599
+ status: "interrupted",
600
+ counts: countsOf(plan.occurrences, true),
601
+ report: false
602
+ };
603
+ return lock.withPermits(1)(deliverFrom(event, cut.observer + 1, true));
604
+ });
605
+ return {
606
+ runStarted: emit(() => {
607
+ state.started = true;
608
+ }, (base) => ({
609
+ ...base,
610
+ _tag: "RunStarted",
611
+ steps
612
+ })),
613
+ stepStarted: (step) => emit(() => {}, (base) => ({
614
+ ...base,
615
+ _tag: "StepStarted",
616
+ step: stepEvent(step)
617
+ })),
618
+ stepSettled: (step) => emit(() => {
619
+ state.stepsFinished += 1;
620
+ }, (base) => ({
621
+ ...base,
622
+ _tag: "StepSettled",
623
+ step: stepEvent(step),
624
+ counts: countsOf(occurrencesOfNode(step.node), false)
625
+ })),
626
+ phaseStarted: (occurrence, phase) => emit(() => {
627
+ state.running.add(occurrence.id);
628
+ }, (base) => ({
629
+ ...base,
630
+ _tag: "ActionPhaseStarted",
631
+ action: actionOf(occurrence),
632
+ phase
633
+ })),
634
+ settled: (occurrence) => Effect.suspend(() => !outcomes.has(occurrence.id) && !state.running.has(occurrence.id) ? Effect.void : emit(() => {
635
+ state.running.delete(occurrence.id);
636
+ state.actionsFinished += 1;
637
+ }, (base) => ({
638
+ ...base,
639
+ _tag: "ActionSettled",
640
+ action: actionOf(occurrence),
641
+ outcome: summaryOf$1(outcomes.get(occurrence.id) ?? { _tag: "Unattempted" })
642
+ }))),
643
+ runFinished: (status) => finish(status, true, false),
644
+ interrupted,
645
+ failures
646
+ };
647
+ });
319
648
  // src/features/execution/executor.ts
320
649
  var executor_exports = /* @__PURE__ */ __exportAll({
321
650
  ExecutionFailed: () => ExecutionFailed,
322
651
  ExecutionInterrupted: () => ExecutionInterrupted,
323
652
  HandlerCoverageError: () => HandlerCoverageError,
324
653
  InteractionUnavailable: () => InteractionUnavailable,
325
- effect: () => effect$1,
654
+ effect: () => effect$2,
326
655
  runPromise: () => runPromise
327
656
  });
328
657
  const HandlerCoverageBase = Data.TaggedError("HandlerCoverageError");
@@ -332,7 +661,7 @@ const HandlerCoverageBase = Data.TaggedError("HandlerCoverageError");
332
661
  * For an occurrence that a rule produced, the issue names the rule and the occurrences
333
662
  * it replaced.
334
663
  *
335
- * @since @next
664
+ * @since 0.0.1
336
665
  */
337
666
  var HandlerCoverageError = class extends HandlerCoverageBase {
338
667
  get message() {
@@ -344,7 +673,7 @@ const InteractionUnavailableBase = Data.TaggedError("InteractionUnavailable");
344
673
  * The plan has manual handlers, and the run has no `interaction` to ask a person. The
345
674
  * run fails before any handler phase or prompt.
346
675
  *
347
- * @since @next
676
+ * @since 0.2.0
348
677
  */
349
678
  var InteractionUnavailable = class extends InteractionUnavailableBase {
350
679
  get message() {
@@ -357,7 +686,7 @@ const ExecutionFailedBase = Data.TaggedError("ExecutionFailed");
357
686
  * An occurrence failed, or a person declined manual work. Execution stopped admitting
358
687
  * new actions; started ones settled.
359
688
  *
360
- * @since @next
689
+ * @since 0.0.1
361
690
  */
362
691
  var ExecutionFailed = class extends ExecutionFailedBase {
363
692
  get message() {
@@ -374,7 +703,7 @@ const interruptedBy = {
374
703
  * Explicit cancellation, a configured timeout, or a handler's own interruption stopped
375
704
  * execution.
376
705
  *
377
- * @since @next
706
+ * @since 0.0.1
378
707
  */
379
708
  var ExecutionInterrupted = class extends ExecutionInterruptedBase {
380
709
  get message() {
@@ -418,7 +747,7 @@ const coverage = (plan, handlers) => {
418
747
  issues
419
748
  };
420
749
  };
421
- const report = (plan, mode, status, outcomes, bodiesStarted) => ({
750
+ const report = (plan, mode, status, outcomes, bodiesStarted, observation = []) => ({
422
751
  _tag: "Report",
423
752
  mode,
424
753
  status,
@@ -430,7 +759,8 @@ const report = (plan, mode, status, outcomes, bodiesStarted) => ({
430
759
  outcome: outcomes.get(occurrence.id) ?? { _tag: "Unattempted" }
431
760
  })),
432
761
  bodiesStarted,
433
- persistence: "none"
762
+ persistence: "none",
763
+ observation: [...observation]
434
764
  });
435
765
  const failureOf = (cause) => ({
436
766
  error: Option.getOrUndefined(Cause.findErrorOption(cause)),
@@ -458,9 +788,12 @@ const logCleanupFailure = (owner) => (cause) => Effect.logError("deltafold: clea
458
788
  const makeControl = (options, subscribe) => Effect.gen(function* () {
459
789
  const halt = { reason: void 0 };
460
790
  const cancelled = yield* Deferred.make();
791
+ /** Completes on cancellation or a timeout. Observer deliveries are bounded from then on. */
792
+ const stopped = yield* Deferred.make();
461
793
  const settleTimeout = options.settleTimeout ?? Duration.seconds(5);
462
794
  const stop = (reason) => {
463
795
  halt.reason ??= reason;
796
+ if (reason === "cancelled" || reason === "timeout") Deferred.doneUnsafe(stopped, Exit.void);
464
797
  };
465
798
  let cancellationArrived = false;
466
799
  subscribe?.(() => {
@@ -501,7 +834,9 @@ const makeControl = (options, subscribe) => Effect.gen(function* () {
501
834
  halt,
502
835
  stop,
503
836
  runPhase,
504
- isCancelled: () => cancellationArrived
837
+ isCancelled: () => cancellationArrived,
838
+ stopped,
839
+ settleTimeout
505
840
  };
506
841
  });
507
842
  /**
@@ -523,10 +858,6 @@ const inScope = (retain, occurrenceId, use, onCleanupFailure) => Effect.uninterr
523
858
  }
524
859
  return yield* used;
525
860
  })).pipe(Effect.asVoid);
526
- const interrupted = (plan, mode, reason, outcomes, bodiesStarted) => new ExecutionInterrupted({
527
- reason,
528
- report: report(plan, mode, "interrupted", outcomes, bodiesStarted)
529
- });
530
861
  /**
531
862
  * The outcome of a phase that did not succeed. `undefined` when it succeeded. An Effect
532
863
  * handler that interrupted itself stops admission.
@@ -548,235 +879,303 @@ const unsuccessful = (phase, result, stop) => {
548
879
  };
549
880
  }
550
881
  };
551
- const execute = (plan, resolved, interaction, options, subscribe, retain) => Effect.gen(function* () {
882
+ /**
883
+ * Creates the run's event emitter, and sends observers a report-less `RunFinished` if
884
+ * the fiber running `body` is interrupted.
885
+ */
886
+ const observed = (plan, mode, observation, control, outcomes, retain, body) => Effect.gen(function* () {
887
+ const emitter = yield* makeEmitter({
888
+ plan,
889
+ mode,
890
+ runId: observation.runId,
891
+ observers: observation.observers,
892
+ outcomes,
893
+ stopped: control.stopped,
894
+ grace: control.settleTimeout,
895
+ retain
896
+ });
897
+ return yield* Effect.onInterrupt(body(emitter), () => emitter.interrupted);
898
+ });
899
+ const execute = (plan, resolved, interaction, observation, options, subscribe, retain) => Effect.gen(function* () {
552
900
  const outcomes = /* @__PURE__ */ new Map();
553
- const { halt, stop, runPhase, isCancelled } = yield* makeControl(options, subscribe);
901
+ const control = yield* makeControl(options, subscribe);
902
+ const { halt, stop, runPhase, isCancelled } = control;
554
903
  let bodiesStarted = false;
555
- const runOccurrence = (occurrence) => {
556
- if (halt.reason !== void 0) return Effect.void;
557
- const handler = resolved.get(occurrence.id);
558
- if (handler === void 0) return Effect.void;
559
- let phase = "prepare";
560
- const end = (outcome) => {
561
- outcomes.set(occurrence.id, outcome);
562
- return exitOf(outcome);
563
- };
564
- const fail = (cause) => {
565
- stop("failure");
566
- return end({
567
- _tag: "Failed",
568
- phase,
569
- ...failureOf(cause)
570
- });
571
- };
572
- const use = (scope, unsettled) => Effect.gen(function* () {
573
- let step;
574
- if (handler.prepares) {
575
- const preparation = yield* runPhase(handler.prepare(scope), unsettled);
576
- const stopped = unsuccessful("prepare", preparation, stop);
577
- if (stopped !== void 0) return end(stopped);
578
- if (preparation._tag !== "Done") return Exit.void;
579
- if (Exit.isFailure(preparation.exit)) return fail(preparation.exit.cause);
580
- step = preparation.exit.value;
581
- if (step._tag === "Apply" && halt.reason === "cancelled") return Exit.void;
582
- } else {
583
- const started = yield* Effect.exit(handler.prepare(scope));
584
- if (Exit.isFailure(started)) return fail(started.cause);
585
- step = started.value;
586
- }
587
- if (step._tag === "Skip") return end({
588
- _tag: "Skipped",
589
- reason: step.reason
590
- });
591
- if (step._tag === "Confirm") {
592
- if (interaction === void 0) return Exit.void;
593
- phase = "confirmation";
594
- bodiesStarted = true;
595
- const asked = yield* runPhase(interaction.confirm({ occurrence }), unsettled, "untimed");
596
- const unanswered = unsuccessful("confirmation", asked, stop);
597
- if (unanswered !== void 0) return end(unanswered);
598
- if (asked._tag !== "Done") return Exit.void;
599
- if (Exit.isFailure(asked.exit)) return fail(asked.exit.cause);
600
- if (asked.exit.value === "declined") {
601
- stop("failure");
602
- return end({ _tag: "Declined" });
603
- }
604
- if (step.verify === void 0) return end({
605
- _tag: "Completed",
606
- performer: "manual",
607
- confirmation: "asserted"
608
- });
609
- phase = "verification";
610
- if (isCancelled()) return end({
611
- _tag: "Interrupted",
904
+ return yield* observed(plan, "execute", observation, control, outcomes, retain, (emitter) => Effect.gen(function* () {
905
+ const runOccurrence = (occurrence) => {
906
+ if (halt.reason !== void 0) return Effect.void;
907
+ const handler = resolved.get(occurrence.id);
908
+ if (handler === void 0) return Effect.void;
909
+ let phase = "prepare";
910
+ const end = (outcome) => {
911
+ outcomes.set(occurrence.id, outcome);
912
+ return exitOf(outcome);
913
+ };
914
+ const fail = (cause) => {
915
+ stop("failure");
916
+ return end({
917
+ _tag: "Failed",
612
918
  phase,
613
- reason: "cancelled",
614
- settled: true
919
+ ...failureOf(cause)
920
+ });
921
+ };
922
+ const admitted = () => handler.prepares ? !isCancelled() : halt.reason === void 0;
923
+ const use = (scope, unsettled) => Effect.gen(function* () {
924
+ let step;
925
+ if (handler.prepares) {
926
+ yield* emitter.phaseStarted(occurrence, "prepare");
927
+ if (halt.reason !== void 0) return Exit.void;
928
+ const preparation = yield* runPhase(handler.prepare(scope), unsettled);
929
+ const stopped = unsuccessful("prepare", preparation, stop);
930
+ if (stopped !== void 0) return end(stopped);
931
+ if (preparation._tag !== "Done") return Exit.void;
932
+ if (Exit.isFailure(preparation.exit)) return fail(preparation.exit.cause);
933
+ step = preparation.exit.value;
934
+ if (step._tag === "Apply" && halt.reason === "cancelled") return Exit.void;
935
+ } else {
936
+ const started = yield* Effect.exit(handler.prepare(scope));
937
+ if (Exit.isFailure(started)) return fail(started.cause);
938
+ step = started.value;
939
+ }
940
+ if (step._tag === "Skip") return end({
941
+ _tag: "Skipped",
942
+ reason: step.reason
615
943
  });
616
- const checked = yield* runPhase(step.verify, unsettled);
617
- const unchecked = unsuccessful("verification", checked, stop);
618
- if (unchecked !== void 0) return end(unchecked);
619
- if (checked._tag !== "Done") return Exit.void;
620
- if (Exit.isFailure(checked.exit)) return fail(checked.exit.cause);
944
+ if (step._tag === "Confirm") {
945
+ if (interaction === void 0) return Exit.void;
946
+ phase = "confirmation";
947
+ yield* emitter.phaseStarted(occurrence, "confirmation");
948
+ if (!admitted()) return Exit.void;
949
+ bodiesStarted = true;
950
+ const asked = yield* runPhase(interaction.confirm({ occurrence }), unsettled, "untimed");
951
+ const unanswered = unsuccessful("confirmation", asked, stop);
952
+ if (unanswered !== void 0) return end(unanswered);
953
+ if (asked._tag !== "Done") return Exit.void;
954
+ if (Exit.isFailure(asked.exit)) return fail(asked.exit.cause);
955
+ if (asked.exit.value === "declined") {
956
+ stop("failure");
957
+ return end({ _tag: "Declined" });
958
+ }
959
+ if (step.verify === void 0) return end({
960
+ _tag: "Completed",
961
+ performer: "manual",
962
+ confirmation: "asserted"
963
+ });
964
+ phase = "verification";
965
+ const unverified = () => end({
966
+ _tag: "Interrupted",
967
+ phase: "verification",
968
+ reason: "cancelled",
969
+ settled: true
970
+ });
971
+ if (isCancelled()) return unverified();
972
+ yield* emitter.phaseStarted(occurrence, "verification");
973
+ if (isCancelled()) return unverified();
974
+ const checked = yield* runPhase(step.verify, unsettled);
975
+ const unchecked = unsuccessful("verification", checked, stop);
976
+ if (unchecked !== void 0) return end(unchecked);
977
+ if (checked._tag !== "Done") return Exit.void;
978
+ if (Exit.isFailure(checked.exit)) return fail(checked.exit.cause);
979
+ return end({
980
+ _tag: "Completed",
981
+ performer: "manual",
982
+ confirmation: "verified"
983
+ });
984
+ }
985
+ phase = "apply";
986
+ yield* emitter.phaseStarted(occurrence, "apply");
987
+ if (!admitted()) return Exit.void;
988
+ bodiesStarted = true;
989
+ const applied = yield* runPhase(step.apply, unsettled);
990
+ const stopped = unsuccessful("apply", applied, stop);
991
+ if (stopped !== void 0) return end(stopped);
992
+ if (applied._tag !== "Done") return Exit.void;
993
+ if (Exit.isFailure(applied.exit)) return fail(applied.exit.cause);
621
994
  return end({
622
995
  _tag: "Completed",
623
- performer: "manual",
624
- confirmation: "verified"
996
+ performer: "automated"
625
997
  });
626
- }
627
- phase = "apply";
628
- bodiesStarted = true;
629
- const applied = yield* runPhase(step.apply, unsettled);
630
- const stopped = unsuccessful("apply", applied, stop);
631
- if (stopped !== void 0) return end(stopped);
632
- if (applied._tag !== "Done") return Exit.void;
633
- if (Exit.isFailure(applied.exit)) return fail(applied.exit.cause);
634
- return end({
635
- _tag: "Completed",
636
- performer: "automated"
637
998
  });
638
- });
639
- const onCleanupFailure = (cause) => Effect.suspend(() => {
640
- const outcome = outcomes.get(occurrence.id);
641
- if (outcome?._tag === "Interrupted") return logCleanupFailure({ occurrence: occurrence.id })(cause);
642
- stop("failure");
643
- outcomes.set(occurrence.id, {
644
- _tag: "Failed",
645
- phase,
646
- ...failureOf(outcome?._tag === "Failed" ? Cause.combine(outcome.cause, cause) : cause)
999
+ const onCleanupFailure = (cause) => Effect.suspend(() => {
1000
+ const outcome = outcomes.get(occurrence.id);
1001
+ if (outcome?._tag === "Interrupted") return logCleanupFailure({ occurrence: occurrence.id })(cause);
1002
+ stop("failure");
1003
+ outcomes.set(occurrence.id, {
1004
+ _tag: "Failed",
1005
+ phase,
1006
+ ...failureOf(outcome?._tag === "Failed" ? Cause.combine(outcome.cause, cause) : cause)
1007
+ });
1008
+ return Effect.void;
647
1009
  });
648
- return Effect.void;
649
- });
650
- return inScope(retain, occurrence.id, use, onCleanupFailure);
651
- };
652
- const runNode = (node) => {
653
- switch (node._tag) {
654
- case "Occurrence": return runOccurrence(node);
655
- case "Sequence": return Effect.forEach(node.children, runNode, { discard: true });
1010
+ return Effect.andThen(inScope(retain, occurrence.id, use, onCleanupFailure), emitter.settled(occurrence));
1011
+ };
1012
+ const runNode = (node) => {
1013
+ switch (node._tag) {
1014
+ case "Occurrence": return runOccurrence(node);
1015
+ case "Sequence": return Effect.forEach(node.children, runNode, { discard: true });
1016
+ }
1017
+ return forEachBranch(node.branches, node.concurrency, runNode);
1018
+ };
1019
+ yield* emitter.runStarted;
1020
+ for (const step of plan.steps) {
1021
+ if (halt.reason !== void 0) break;
1022
+ if (step.omitted) continue;
1023
+ yield* emitter.stepStarted(step);
1024
+ yield* runNode(step.node);
1025
+ yield* emitter.stepSettled(step);
656
1026
  }
657
- return forEachBranch(node.branches, node.concurrency, runNode);
658
- };
659
- for (const step of plan.steps) {
660
- if (halt.reason !== void 0) break;
661
- yield* runNode(step.node);
662
- }
663
- if (halt.reason === void 0) return report(plan, "execute", "completed", outcomes, bodiesStarted);
664
- if (halt.reason === "failure") {
665
- const result = report(plan, "execute", "failed", outcomes, bodiesStarted);
666
- return yield* new ExecutionFailed({
1027
+ const reason = halt.reason;
1028
+ const status = reason === void 0 ? "completed" : reason === "failure" ? "failed" : "interrupted";
1029
+ yield* emitter.runFinished(status);
1030
+ const result = report(plan, "execute", status, outcomes, bodiesStarted, emitter.failures);
1031
+ if (reason === void 0) return result;
1032
+ if (reason === "failure") return yield* new ExecutionFailed({
667
1033
  failures: result.occurrences.filter((entry) => entry.outcome._tag === "Failed"),
668
1034
  declined: result.occurrences.filter((entry) => entry.outcome._tag === "Declined"),
669
1035
  report: result
670
1036
  });
671
- }
672
- return yield* interrupted(plan, "execute", halt.reason, outcomes, bodiesStarted);
1037
+ return yield* new ExecutionInterrupted({
1038
+ reason,
1039
+ report: result
1040
+ });
1041
+ }));
673
1042
  });
674
- const dryRun = (plan, resolved, options, subscribe, retain) => Effect.gen(function* () {
1043
+ const dryRun = (plan, resolved, observation, options, subscribe, retain) => Effect.gen(function* () {
675
1044
  const outcomes = /* @__PURE__ */ new Map();
676
- const { halt, stop, runPhase } = yield* makeControl(options, subscribe);
1045
+ const control = yield* makeControl(options, subscribe);
1046
+ const { halt, stop, runPhase } = control;
677
1047
  let failedAt;
678
- /** Runs a prepare phase in the occurrence's scope and records what it predicts. */
679
- const prepare = (id, handler) => {
680
- const end = (outcome) => {
681
- outcomes.set(id, outcome);
682
- return exitOf(outcome);
1048
+ return yield* observed(plan, "dry-run", observation, control, outcomes, retain, (emitter) => Effect.gen(function* () {
1049
+ const settle = (occurrence, outcome) => {
1050
+ outcomes.set(occurrence.id, outcome);
1051
+ return emitter.settled(occurrence);
683
1052
  };
684
- const use = (scope, unsettled) => Effect.gen(function* () {
685
- const preparation = yield* runPhase(handler.prepare(scope), unsettled);
686
- const stopped = unsuccessful("prepare", preparation, stop);
687
- if (stopped !== void 0) return end(stopped);
688
- if (preparation._tag !== "Done") return Exit.void;
689
- if (Exit.isFailure(preparation.exit)) {
690
- failedAt = id;
691
- return end({
692
- _tag: "PreparationFailed",
693
- ...failureOf(preparation.exit.cause)
1053
+ /** Runs a prepare phase in the occurrence's scope and records what it predicts. */
1054
+ const prepare = (occurrence, handler) => {
1055
+ const id = occurrence.id;
1056
+ const end = (outcome) => {
1057
+ outcomes.set(id, outcome);
1058
+ return exitOf(outcome);
1059
+ };
1060
+ const use = (scope, unsettled) => Effect.gen(function* () {
1061
+ yield* emitter.phaseStarted(occurrence, "prepare");
1062
+ if (halt.reason !== void 0) return Exit.void;
1063
+ const preparation = yield* runPhase(handler.prepare(scope), unsettled);
1064
+ const stopped = unsuccessful("prepare", preparation, stop);
1065
+ if (stopped !== void 0) return end(stopped);
1066
+ if (preparation._tag !== "Done") return Exit.void;
1067
+ if (Exit.isFailure(preparation.exit)) {
1068
+ failedAt = id;
1069
+ return end({
1070
+ _tag: "PreparationFailed",
1071
+ ...failureOf(preparation.exit.cause)
1072
+ });
1073
+ }
1074
+ const step = preparation.exit.value;
1075
+ return end(step._tag === "Skip" ? {
1076
+ _tag: "WouldSkip",
1077
+ reason: step.reason
1078
+ } : {
1079
+ _tag: "WouldExecute",
1080
+ evaluated: true,
1081
+ performer: handler.performer
694
1082
  });
695
- }
696
- const step = preparation.exit.value;
697
- return end(step._tag === "Skip" ? {
698
- _tag: "WouldSkip",
699
- reason: step.reason
700
- } : {
701
- _tag: "WouldExecute",
702
- evaluated: true,
703
- performer: handler.performer
704
1083
  });
705
- });
706
- const onCleanupFailure = (cause) => Effect.suspend(() => {
707
- const outcome = outcomes.get(id);
708
- if (outcome?._tag === "Interrupted") return logCleanupFailure({ occurrence: id })(cause);
709
- failedAt ??= id;
710
- outcomes.set(id, {
711
- _tag: "PreparationFailed",
712
- ...failureOf(outcome?._tag === "PreparationFailed" ? Cause.combine(outcome.cause, cause) : cause)
1084
+ const onCleanupFailure = (cause) => Effect.suspend(() => {
1085
+ const outcome = outcomes.get(id);
1086
+ if (outcome?._tag === "Interrupted") return logCleanupFailure({ occurrence: id })(cause);
1087
+ failedAt ??= id;
1088
+ outcomes.set(id, {
1089
+ _tag: "PreparationFailed",
1090
+ ...failureOf(outcome?._tag === "PreparationFailed" ? Cause.combine(outcome.cause, cause) : cause)
1091
+ });
1092
+ return Effect.void;
713
1093
  });
714
- return Effect.void;
1094
+ return Effect.andThen(inScope(retain, id, use, onCleanupFailure), emitter.settled(occurrence));
1095
+ };
1096
+ /** Returns whether the node would or might change state. */
1097
+ const visit = (node, dirty) => Effect.gen(function* () {
1098
+ if (node._tag === "Sequence") {
1099
+ let current = dirty;
1100
+ for (const child of node.children) current = yield* visit(child, current);
1101
+ return current;
1102
+ }
1103
+ if (node._tag === "Parallel") {
1104
+ let changed = dirty;
1105
+ for (const branch of node.branches) changed = (yield* visit(branch, dirty)) || changed;
1106
+ return changed;
1107
+ }
1108
+ const handler = resolved.get(node.id);
1109
+ if (handler === void 0 || halt.reason !== void 0) return dirty;
1110
+ if (failedAt !== void 0) {
1111
+ yield* settle(node, {
1112
+ _tag: "Undetermined",
1113
+ reason: `Execution would stop at the failed preparation of "${failedAt}".`,
1114
+ performer: handler.performer
1115
+ });
1116
+ return true;
1117
+ }
1118
+ if (!handler.prepares) {
1119
+ yield* settle(node, {
1120
+ _tag: "WouldExecute",
1121
+ evaluated: false,
1122
+ performer: handler.performer
1123
+ });
1124
+ return true;
1125
+ }
1126
+ if (dirty) {
1127
+ yield* settle(node, {
1128
+ _tag: "Undetermined",
1129
+ reason: "The prepare phase depends on earlier actions that a dry run does not apply.",
1130
+ performer: handler.performer
1131
+ });
1132
+ return true;
1133
+ }
1134
+ yield* prepare(node, handler);
1135
+ return outcomes.get(node.id)?._tag !== "WouldSkip";
715
1136
  });
716
- return inScope(retain, id, use, onCleanupFailure);
717
- };
718
- /** Returns whether the node would or might change state. */
719
- const visit = (node, dirty) => Effect.gen(function* () {
720
- if (node._tag === "Sequence") {
721
- let current = dirty;
722
- for (const child of node.children) current = yield* visit(child, current);
723
- return current;
724
- }
725
- if (node._tag === "Parallel") {
726
- let changed = dirty;
727
- for (const branch of node.branches) changed = (yield* visit(branch, dirty)) || changed;
728
- return changed;
1137
+ yield* emitter.runStarted;
1138
+ let dirty = false;
1139
+ for (const step of plan.steps) {
1140
+ if (halt.reason !== void 0) break;
1141
+ if (step.omitted) continue;
1142
+ yield* emitter.stepStarted(step);
1143
+ dirty = yield* visit(step.node, dirty);
1144
+ yield* emitter.stepSettled(step);
729
1145
  }
730
- const handler = resolved.get(node.id);
731
- if (handler === void 0 || halt.reason !== void 0) return dirty;
732
- if (failedAt !== void 0) {
733
- outcomes.set(node.id, {
734
- _tag: "Undetermined",
735
- reason: `Execution would stop at the failed preparation of "${failedAt}".`,
736
- performer: handler.performer
1146
+ const reason = halt.reason;
1147
+ if (reason !== void 0 && reason !== "failure") {
1148
+ yield* emitter.runFinished("interrupted");
1149
+ return yield* new ExecutionInterrupted({
1150
+ reason,
1151
+ report: report(plan, "dry-run", "interrupted", outcomes, false, emitter.failures)
737
1152
  });
738
- return true;
739
1153
  }
740
- if (!handler.prepares) {
741
- outcomes.set(node.id, {
742
- _tag: "WouldExecute",
743
- evaluated: false,
744
- performer: handler.performer
745
- });
746
- return true;
747
- }
748
- if (dirty) {
749
- outcomes.set(node.id, {
750
- _tag: "Undetermined",
751
- reason: "The prepare phase depends on earlier actions that a dry run does not apply.",
752
- performer: handler.performer
753
- });
754
- return true;
755
- }
756
- yield* prepare(node.id, handler);
757
- return outcomes.get(node.id)?._tag !== "WouldSkip";
758
- });
759
- let dirty = false;
760
- for (const step of plan.steps) dirty = yield* visit(step.node, dirty);
761
- if (halt.reason !== void 0 && halt.reason !== "failure") return yield* interrupted(plan, "dry-run", halt.reason, outcomes, false);
762
- return report(plan, "dry-run", failedAt === void 0 ? "would-complete" : "would-fail", outcomes, false);
1154
+ const status = failedAt === void 0 ? "would-complete" : "would-fail";
1155
+ yield* emitter.runFinished(status);
1156
+ return report(plan, "dry-run", status, outcomes, false, emitter.failures);
1157
+ }));
763
1158
  });
764
1159
  const run = (plan, options, subscribe, retain) => {
765
1160
  const handlers = options.handlers ?? [];
766
1161
  const interaction = options.interaction;
1162
+ const observation = {
1163
+ observers: options.observers ?? [],
1164
+ runId: options.runId
1165
+ };
767
1166
  return Effect.gen(function* () {
768
1167
  const checked = coverage(plan, handlers);
769
1168
  if (checked.issues.length > 0) return yield* new HandlerCoverageError({
770
1169
  issues: checked.issues,
771
1170
  report: report(plan, options.dryRun === true ? "dry-run" : "execute", "not-started", /* @__PURE__ */ new Map(), false)
772
1171
  });
773
- if (options.dryRun === true) return yield* dryRun(plan, checked.resolved, options, subscribe, retain);
1172
+ if (options.dryRun === true) return yield* dryRun(plan, checked.resolved, observation, options, subscribe, retain);
774
1173
  const manual = plan.occurrences.filter((occurrence) => checked.resolved.get(occurrence.id)?.performer === "manual");
775
1174
  if (manual.length > 0 && interaction === void 0) return yield* new InteractionUnavailable({
776
1175
  occurrences: manual,
777
1176
  report: report(plan, "execute", "not-started", /* @__PURE__ */ new Map(), false)
778
1177
  });
779
- return yield* execute(plan, checked.resolved, interaction, options, subscribe, retain);
1178
+ return yield* execute(plan, checked.resolved, interaction, observation, options, subscribe, retain);
780
1179
  });
781
1180
  };
782
1181
  /**
@@ -793,11 +1192,12 @@ const run = (plan, options, subscribe, retain) => {
793
1192
  *
794
1193
  * To cancel, interrupt the fiber. Interruption reaches running actions and aborts the
795
1194
  * signal passed to Promise callbacks. The effect then ends as interrupted, without a
796
- * report.
1195
+ * report. Observers receive a final `RunFinished` event without a report, delivered
1196
+ * within `settleTimeout`.
797
1197
  *
798
- * @since @next
1198
+ * @since 0.0.1
799
1199
  */
800
- const effect$1 = (plan, options) => run(plan, options, void 0, () => {});
1200
+ const effect$2 = (plan, options) => run(plan, options, void 0, () => {});
801
1201
  /**
802
1202
  * Runs a plan and returns a Promise. It rejects with `HandlerCoverageError`,
803
1203
  * `InteractionUnavailable`, `ExecutionFailed`, or `ExecutionInterrupted`, each carrying
@@ -812,7 +1212,7 @@ const effect$1 = (plan, options) => run(plan, options, void 0, () => {});
812
1212
  * until it settles, possibly forever, and close in that order. A cleanup failure after
813
1213
  * the Promise resolved is logged through Effect.
814
1214
  *
815
- * @since @next
1215
+ * @since 0.0.1
816
1216
  */
817
1217
  const runPromise = (plan, options) => {
818
1218
  const { signal } = options;
@@ -856,9 +1256,9 @@ const runPromise = (plan, options) => {
856
1256
  // src/features/execution/interaction.ts
857
1257
  var interaction_exports = /* @__PURE__ */ __exportAll({
858
1258
  UnexpectedInteractionError: () => UnexpectedInteractionError,
859
- effect: () => effect,
1259
+ effect: () => effect$1,
860
1260
  isInteraction: () => isInteraction,
861
- promise: () => promise
1261
+ promise: () => promise$1
862
1262
  });
863
1263
  /**
864
1264
  * A Promise interaction rejected with a value that none of its declared error guards
@@ -866,7 +1266,7 @@ var interaction_exports = /* @__PURE__ */ __exportAll({
866
1266
  * `"confirmed"` or `"declined"` (`invalid-answer`). An invalid answer is never kept: it
867
1267
  * may be text that the person typed.
868
1268
  *
869
- * @since @next
1269
+ * @since 0.2.0
870
1270
  */
871
1271
  var UnexpectedInteractionError = class extends Data.TaggedError("UnexpectedInteractionError") {
872
1272
  get message() {
@@ -879,9 +1279,9 @@ const checkAnswer = (request) => (answer) => isAnswer(answer) ? Effect.succeed(a
879
1279
  reason: "invalid-answer",
880
1280
  cause: void 0
881
1281
  }));
882
- const TypeId = "~deltafold/Interaction";
883
- /** @since @next */
884
- const isInteraction = (value) => Predicate.hasProperty(value, TypeId);
1282
+ const TypeId$1 = "~deltafold/Interaction";
1283
+ /** @since 0.2.0 */
1284
+ const isInteraction = (value) => Predicate.hasProperty(value, TypeId$1);
885
1285
  /**
886
1286
  * Confirms manual work with a Promise callback. It receives `{ signal, services }`: an
887
1287
  * `AbortSignal` that aborts when the run is cancelled, so it can stop asking, and the
@@ -900,12 +1300,12 @@ const isInteraction = (value) => Predicate.hasProperty(value, TypeId);
900
1300
  * );
901
1301
  * ```
902
1302
  *
903
- * @since @next
1303
+ * @since 0.2.0
904
1304
  */
905
- const promise = (confirm, options) => {
1305
+ const promise$1 = (confirm, options) => {
906
1306
  const adapt = adaptPromise(options ?? {});
907
1307
  return {
908
- [TypeId]: TypeId,
1308
+ [TypeId$1]: TypeId$1,
909
1309
  confirm: (request) => adapt((context) => confirm(request, context), (cause) => new UnexpectedInteractionError({
910
1310
  occurrenceId: request.occurrence.id,
911
1311
  reason: "rejected",
@@ -917,24 +1317,24 @@ const promise = (confirm, options) => {
917
1317
  * Confirms manual work with an Effect, which keeps its own errors and services and
918
1318
  * stops through Effect interruption when the run is cancelled.
919
1319
  *
920
- * @since @next
1320
+ * @since 0.2.0
921
1321
  */
922
- const effect = (confirm) => ({
923
- [TypeId]: TypeId,
1322
+ const effect$1 = (confirm) => ({
1323
+ [TypeId$1]: TypeId$1,
924
1324
  confirm: (request) => Effect.flatMap(Effect.suspend(() => confirm(request)), checkAnswer(request))
925
1325
  });
926
1326
  // src/features/planning/resolve-error.ts
927
1327
  /**
928
1328
  * The history's declarations are invalid. Resolution needs a valid history.
929
1329
  *
930
- * @since @next
1330
+ * @since 0.0.1
931
1331
  */
932
1332
  var InvalidHistory = class extends Data.TaggedError("InvalidHistory") {
933
1333
  get message() {
934
1334
  return `The history has ${this.issues.length} declaration issue(s): ${this.issues.map((issue) => issue.message).join(" ")}`;
935
1335
  }
936
1336
  };
937
- /** @since @next */
1337
+ /** @since 0.0.1 */
938
1338
  var UnknownVersion = class extends Data.TaggedError("UnknownVersion") {
939
1339
  get message() {
940
1340
  return `Version "${this.version}" is not registered in the history.`;
@@ -944,7 +1344,7 @@ var UnknownVersion = class extends Data.TaggedError("UnknownVersion") {
944
1344
  * No declared route connects the versions. This never means that no work is needed:
945
1345
  * declare `Migration.noop` for a supported zero-work transition.
946
1346
  *
947
- * @since @next
1347
+ * @since 0.0.1
948
1348
  */
949
1349
  var UnsupportedRoute = class extends Data.TaggedError("UnsupportedRoute") {
950
1350
  get message() {
@@ -955,7 +1355,7 @@ var UnsupportedRoute = class extends Data.TaggedError("UnsupportedRoute") {
955
1355
  /**
956
1356
  * Several routes connect the versions and no selection or policy chose one.
957
1357
  *
958
- * @since @next
1358
+ * @since 0.0.1
959
1359
  */
960
1360
  var AmbiguousRoute = class extends Data.TaggedError("AmbiguousRoute") {
961
1361
  get message() {
@@ -967,7 +1367,7 @@ var AmbiguousRoute = class extends Data.TaggedError("AmbiguousRoute") {
967
1367
  /**
968
1368
  * The `route` option names no candidate route.
969
1369
  *
970
- * @since @next
1370
+ * @since 0.0.1
971
1371
  */
972
1372
  var UnknownRoute = class extends Data.TaggedError("UnknownRoute") {
973
1373
  get message() {
@@ -977,7 +1377,7 @@ var UnknownRoute = class extends Data.TaggedError("UnknownRoute") {
977
1377
  /**
978
1378
  * Rules rewrite a sequence back into itself.
979
1379
  *
980
- * @since @next
1380
+ * @since 0.0.1
981
1381
  */
982
1382
  var RewriteCycle = class extends Data.TaggedError("RewriteCycle") {
983
1383
  get message() {
@@ -987,7 +1387,7 @@ var RewriteCycle = class extends Data.TaggedError("RewriteCycle") {
987
1387
  /**
988
1388
  * Rules can produce different results depending on which applies first.
989
1389
  *
990
- * @since @next
1390
+ * @since 0.0.1
991
1391
  */
992
1392
  var ConflictingRewrites = class extends Data.TaggedError("ConflictingRewrites") {
993
1393
  get message() {
@@ -998,7 +1398,7 @@ var ConflictingRewrites = class extends Data.TaggedError("ConflictingRewrites")
998
1398
  * Optimization explored too many states or chained too many rule applications, for
999
1399
  * example because a rule keeps growing the sequence.
1000
1400
  *
1001
- * @since @next
1401
+ * @since 0.0.1
1002
1402
  */
1003
1403
  var RewriteLimitExceeded = class extends Data.TaggedError("RewriteLimitExceeded") {
1004
1404
  get message() {
@@ -1008,7 +1408,7 @@ var RewriteLimitExceeded = class extends Data.TaggedError("RewriteLimitExceeded"
1008
1408
  /**
1009
1409
  * More candidate routes exist than the resolver enumerates.
1010
1410
  *
1011
- * @since @next
1411
+ * @since 0.0.1
1012
1412
  */
1013
1413
  var TooManyRoutes = class extends Data.TaggedError("TooManyRoutes") {
1014
1414
  get message() {
@@ -1061,8 +1461,10 @@ const resolveGuide = (content, retained, declaredId) => {
1061
1461
  const escape = (value, separators) => value.replace(separators, "\\$&");
1062
1462
  const occurrencePart = (id) => escape(id, /[\\/()+]/g);
1063
1463
  const routePart = (id) => escape(id, /[\\>[\]]/g);
1464
+ /** A plan step: `<migration>` forward, `<migration>/revert` in reverse. */
1465
+ const stepId = (migration, direction) => direction === "forward" ? occurrencePart(migration.id) : `${occurrencePart(migration.id)}/revert`;
1064
1466
  /** `<migration>/<action>` forward, `<migration>/revert/<action>` in reverse. */
1065
- const declaredOccurrenceId = (migration, direction, action) => direction === "forward" ? `${occurrencePart(migration.id)}/${occurrencePart(action.id)}` : `${occurrencePart(migration.id)}/revert/${occurrencePart(action.id)}`;
1467
+ const declaredOccurrenceId = (migration, direction, action) => `${stepId(migration, direction)}/${occurrencePart(action.id)}`;
1066
1468
  /**
1067
1469
  * `<rule>(<replaced>+<replaced>)/<action>`. Replaced identifiers are complete occurrence
1068
1470
  * identifiers, so they nest without further escaping.
@@ -1671,6 +2073,7 @@ const buildPlan = (context, from, to, direction, edges) => {
1671
2073
  const [stepFrom, stepTo] = member.direction === "forward" ? [member.migration.from, member.migration.to] : [member.migration.to, member.migration.from];
1672
2074
  return {
1673
2075
  _tag: "Step",
2076
+ id: stepId(member.migration, member.direction),
1674
2077
  migration: member.migration,
1675
2078
  direction: member.direction,
1676
2079
  from: stepFrom,
@@ -1914,7 +2317,7 @@ var history_exports = /* @__PURE__ */ __exportAll({
1914
2317
  * `make` does not throw. Use `History.validate` to list declaration issues;
1915
2318
  * resolution fails with `InvalidHistory` when there are any.
1916
2319
  *
1917
- * @since @next
2320
+ * @since 0.0.1
1918
2321
  */
1919
2322
  const make$4 = (declarations) => ({
1920
2323
  _tag: "History",
@@ -1923,7 +2326,7 @@ const make$4 = (declarations) => ({
1923
2326
  rules: declarations.rules ?? [],
1924
2327
  shortcuts: declarations.shortcuts ?? []
1925
2328
  });
1926
- /** @since @next */
2329
+ /** @since 0.0.1 */
1927
2330
  const isHistory = (value) => Predicate.isTagged(value, "History");
1928
2331
  const contexts = /* @__PURE__ */ new WeakMap();
1929
2332
  const prepare = (history) => {
@@ -1939,7 +2342,7 @@ const prepare = (history) => {
1939
2342
  /**
1940
2343
  * Lists declaration issues in a deterministic order. An empty list means valid.
1941
2344
  *
1942
- * @since @next
2345
+ * @since 0.0.1
1943
2346
  */
1944
2347
  const validate = (history) => prepare(history).issues;
1945
2348
  const valid = (history) => {
@@ -1959,19 +2362,19 @@ const valid = (history) => {
1959
2362
  * if (Result.isSuccess(result)) console.log(result.success.route.id);
1960
2363
  * ```
1961
2364
  *
1962
- * @since @next
2365
+ * @since 0.0.1
1963
2366
  */
1964
2367
  const resolve = (history, options) => Result.flatMap(valid(history), (context) => resolve$1(context, options));
1965
2368
  /**
1966
2369
  * Destinations reachable by upgrade from a version, with their candidate routes.
1967
2370
  *
1968
- * @since @next
2371
+ * @since 0.0.1
1969
2372
  */
1970
2373
  const upgrades = (history, options) => reachableFrom(history, options.from, "upgrade");
1971
2374
  /**
1972
2375
  * Destinations reachable by downgrade from a version, with their candidate routes.
1973
2376
  *
1974
- * @since @next
2377
+ * @since 0.0.1
1975
2378
  */
1976
2379
  const downgrades = (history, options) => reachableFrom(history, options.from, "downgrade");
1977
2380
  const reachableFrom = (history, from, kind) => Result.flatMap(valid(history), (context) => Result.map(lookup(context, from), (version) => destinations(context, version, kind)));
@@ -2023,7 +2426,7 @@ const prose = (strings, values, context) => {
2023
2426
  * `;
2024
2427
  * ```
2025
2428
  *
2026
- * @since @next
2429
+ * @since 0.0.1
2027
2430
  */
2028
2431
  const instruction = (action) => (strings, ...values) => ({
2029
2432
  _tag: "Instruction",
@@ -2038,7 +2441,7 @@ var migration_exports = /* @__PURE__ */ __exportAll({
2038
2441
  noop: () => noop,
2039
2442
  withRevert: () => withRevert
2040
2443
  });
2041
- /** @since @next */
2444
+ /** @since 0.0.1 */
2042
2445
  const isMigration = (value) => Predicate.isTagged(value, "Migration");
2043
2446
  const isStep = (value) => isAction(value) || isInstruction(value) || isSequence(value) || isParallel(value);
2044
2447
  const validateStep = (step, context) => {
@@ -2109,7 +2512,7 @@ const content = (strings, values, context) => {
2109
2512
  * `;
2110
2513
  * ```
2111
2514
  *
2112
- * @since @next
2515
+ * @since 0.0.1
2113
2516
  */
2114
2517
  const make$3 = (id, options) => (strings, ...values) => ({
2115
2518
  _tag: "Migration",
@@ -2127,7 +2530,7 @@ const make$3 = (id, options) => (strings, ...values) => ({
2127
2530
  * like any migration. Do not use it to hide missing support for changes that need
2128
2531
  * instructions.
2129
2532
  *
2130
- * @since @next
2533
+ * @since 0.0.1
2131
2534
  */
2132
2535
  const noop = (id, options) => ({
2133
2536
  _tag: "Migration",
@@ -2154,12 +2557,86 @@ const noop = (id, options) => ({
2154
2557
  * `;
2155
2558
  * ```
2156
2559
  *
2157
- * @since @next
2560
+ * @since 0.0.1
2158
2561
  */
2159
2562
  const withRevert = (migration) => (strings, ...values) => ({
2160
2563
  ...migration,
2161
2564
  revert: content(strings, values, `Revert of migration "${migration.id}"`)
2162
2565
  });
2566
+ // src/features/execution/observer.ts
2567
+ var observer_exports = /* @__PURE__ */ __exportAll({
2568
+ effect: () => effect,
2569
+ isObserver: () => isObserver,
2570
+ promise: () => promise,
2571
+ sync: () => sync
2572
+ });
2573
+ const TypeId = "~deltafold/Observer";
2574
+ /** @since 0.2.1 */
2575
+ const isObserver = (value) => Predicate.hasProperty(value, TypeId);
2576
+ var AsyncSyncObserver = class extends Error {
2577
+ name = "AsyncSyncObserver";
2578
+ message = "An Observer.sync callback returned a Promise. Use Observer.promise for asynchronous callbacks.";
2579
+ };
2580
+ /**
2581
+ * Observes with a synchronous callback. A thrown value is recorded as an observation
2582
+ * failure.
2583
+ *
2584
+ * @example
2585
+ * ```ts
2586
+ * Observer.sync((event) => {
2587
+ * if (event._tag === "ActionSettled") console.error(event.action.occurrence, event.outcome._tag);
2588
+ * });
2589
+ * ```
2590
+ *
2591
+ * @since 0.2.1
2592
+ */
2593
+ const sync = (callback) => ({
2594
+ [TypeId]: TypeId,
2595
+ notify: (event) => Effect.sync(() => {
2596
+ try {
2597
+ const result = callback(event);
2598
+ if (!Predicate.isPromiseLike(result)) return Exit.void;
2599
+ Promise.resolve(result).catch(() => void 0);
2600
+ return Exit.fail(new AsyncSyncObserver());
2601
+ } catch (cause) {
2602
+ return Exit.fail(cause);
2603
+ }
2604
+ })
2605
+ });
2606
+ /**
2607
+ * Observes with a Promise callback. The executor waits for the Promise. The `signal`
2608
+ * aborts when the executor stops waiting: after cancellation or a timeout, once the
2609
+ * settlement grace period has passed, or when the execution is interrupted. A services
2610
+ * layer that `Executor.runPromise` built stays open until an abandoned Promise settles.
2611
+ *
2612
+ * @since 0.2.1
2613
+ */
2614
+ const promise = (callback) => ({
2615
+ [TypeId]: TypeId,
2616
+ notify: (event) => Effect.suspend(() => {
2617
+ let pending;
2618
+ return Effect.promise((signal) => {
2619
+ const settles = new Promise((resolve) => resolve(callback(event, { signal }))).then(() => Exit.void, (cause) => Exit.fail(cause));
2620
+ pending = settles;
2621
+ return settles;
2622
+ }).pipe(Effect.onInterrupt(() => pending === void 0 ? Effect.void : Effect.promise(() => pending ?? Promise.resolve())));
2623
+ })
2624
+ });
2625
+ /**
2626
+ * Observes with an Effect. Its services become requirements of the execution. Its
2627
+ * failures are recorded as observation failures and never fail the execution.
2628
+ *
2629
+ * @example
2630
+ * ```ts
2631
+ * Observer.effect((event) => Effect.logDebug(event._tag));
2632
+ * ```
2633
+ *
2634
+ * @since 0.2.1
2635
+ */
2636
+ const effect = (callback) => ({
2637
+ [TypeId]: TypeId,
2638
+ notify: (event) => Effect.exit(Effect.suspend(() => callback(event)))
2639
+ });
2163
2640
  // src/features/package.ts
2164
2641
  var package_exports = /* @__PURE__ */ __exportAll({
2165
2642
  isPackage: () => isPackage,
@@ -2174,14 +2651,14 @@ var package_exports = /* @__PURE__ */ __exportAll({
2174
2651
  * export const widgets = Package.make("@acme/widgets", { history });
2175
2652
  * ```
2176
2653
  *
2177
- * @since @next
2654
+ * @since 0.0.1
2178
2655
  */
2179
2656
  const make$2 = (name, options) => ({
2180
2657
  _tag: "Package",
2181
2658
  name,
2182
2659
  history: options.history
2183
2660
  });
2184
- /** @since @next */
2661
+ /** @since 0.0.1 */
2185
2662
  const isPackage = (value) => Predicate.isTagged(value, "Package");
2186
2663
  // src/foundation/plan.ts
2187
2664
  var plan_exports = /* @__PURE__ */ __exportAll({
@@ -2191,7 +2668,7 @@ var plan_exports = /* @__PURE__ */ __exportAll({
2191
2668
  /**
2192
2669
  * Whether the plan has no action occurrences. An empty plan is valid.
2193
2670
  *
2194
- * @since @next
2671
+ * @since 0.0.1
2195
2672
  */
2196
2673
  const isEmpty = (plan) => plan.occurrences.length === 0;
2197
2674
  /**
@@ -2199,7 +2676,7 @@ const isEmpty = (plan) => plan.occurrences.length === 0;
2199
2676
  * loaded plans whose action union is not known statically. Executors still reject
2200
2677
  * missing handlers before any action body runs.
2201
2678
  *
2202
- * @since @next
2679
+ * @since 0.0.1
2203
2680
  */
2204
2681
  const withRuntimeCoverage = (plan) => ({
2205
2682
  ...plan,
@@ -2232,7 +2709,7 @@ var rule_exports = /* @__PURE__ */ __exportAll({
2232
2709
  * });
2233
2710
  * ```
2234
2711
  *
2235
- * @since @next
2712
+ * @since 0.0.1
2236
2713
  */
2237
2714
  const replace = (id, options) => ({
2238
2715
  _tag: "Rule",
@@ -2240,7 +2717,7 @@ const replace = (id, options) => ({
2240
2717
  match: options.match,
2241
2718
  replacement: options.replacement
2242
2719
  });
2243
- /** @since @next */
2720
+ /** @since 0.0.1 */
2244
2721
  const isRule = (value) => Predicate.isTagged(value, "Rule");
2245
2722
  // src/foundation/shortcut.ts
2246
2723
  var shortcut_exports = /* @__PURE__ */ __exportAll({
@@ -2261,7 +2738,7 @@ var shortcut_exports = /* @__PURE__ */ __exportAll({
2261
2738
  * });
2262
2739
  * ```
2263
2740
  *
2264
- * @since @next
2741
+ * @since 0.0.1
2265
2742
  */
2266
2743
  const make$1 = (id, options) => ({
2267
2744
  _tag: "Shortcut",
@@ -2272,7 +2749,7 @@ const make$1 = (id, options) => ({
2272
2749
  migrations: options.migrations,
2273
2750
  cost: options.cost
2274
2751
  });
2275
- /** @since @next */
2752
+ /** @since 0.0.1 */
2276
2753
  const isShortcut = (value) => Predicate.isTagged(value, "Shortcut");
2277
2754
  // src/foundation/version.ts
2278
2755
  var version_exports = /* @__PURE__ */ __exportAll({
@@ -2289,7 +2766,7 @@ var version_exports = /* @__PURE__ */ __exportAll({
2289
2766
  * const v100 = Version.make("1.0.0", { previous: v0, changes: [timeoutRenamed] });
2290
2767
  * ```
2291
2768
  *
2292
- * @since @next
2769
+ * @since 0.0.1
2293
2770
  */
2294
2771
  const make = (id, options) => ({
2295
2772
  _tag: "Version",
@@ -2297,7 +2774,7 @@ const make = (id, options) => ({
2297
2774
  previous: options.previous,
2298
2775
  changes: options.changes
2299
2776
  });
2300
- /** @since @next */
2777
+ /** @since 0.0.1 */
2301
2778
  const isVersion = (value) => Predicate.isTagged(value, "Version");
2302
2779
  /**
2303
2780
  * Annotates a version with release metadata.
@@ -2310,13 +2787,13 @@ const isVersion = (value) => Predicate.isTagged(value, "Version");
2310
2787
  * });
2311
2788
  * ```
2312
2789
  *
2313
- * @since @next
2790
+ * @since 0.0.1
2314
2791
  */
2315
2792
  const withMetadata = (version, metadata) => ({
2316
2793
  _tag: "Release",
2317
2794
  version,
2318
2795
  metadata
2319
2796
  });
2320
- export { action_exports as Action, change_exports as Change, executor_exports as Executor, handler_exports as Handler, history_exports as History, interaction_exports as Interaction, migration_exports as Migration, package_exports as Package, plan_exports as Plan, rule_exports as Rule, shortcut_exports as Shortcut, version_exports as Version };
2797
+ export { action_exports as Action, change_exports as Change, executor_exports as Executor, handler_exports as Handler, history_exports as History, interaction_exports as Interaction, migration_exports as Migration, observer_exports as Observer, package_exports as Package, plan_exports as Plan, rule_exports as Rule, shortcut_exports as Shortcut, version_exports as Version };
2321
2798
 
2322
2799
  //# sourceMappingURL=index.js.map