@operad-io/engine 0.1.1 → 0.3.0

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 (81) hide show
  1. package/config.schema.json +2 -1
  2. package/package.json +1 -1
  3. package/src/config/config.ts +74 -45
  4. package/src/flow/types.ts +4 -0
  5. package/src/flow/validate.ts +5 -0
  6. package/src/http/index.ts +2 -0
  7. package/src/http/plugins.ts +68 -0
  8. package/src/http/server.ts +342 -48
  9. package/src/kernel/decide.ts +115 -30
  10. package/src/kernel/state.ts +9 -0
  11. package/src/kernel/types.ts +25 -40
  12. package/src/log/open-log.ts +2 -5
  13. package/src/log/sqlite.ts +127 -85
  14. package/src/log/types.ts +35 -9
  15. package/src/loop/code-watch.ts +108 -2
  16. package/src/loop/older-code.ts +3 -4
  17. package/src/loop/serve.ts +122 -95
  18. package/src/notify/notify.ts +2 -6
  19. package/src/platform/atomic-write.ts +163 -0
  20. package/src/platform/file-lock.ts +43 -21
  21. package/src/platform/git-program.ts +108 -0
  22. package/src/platform/index.ts +3 -0
  23. package/src/platform/kept-workers.ts +290 -0
  24. package/src/platform/process-group.ts +11 -3
  25. package/src/platform/sqlite-open.ts +20 -6
  26. package/src/platform/sqlite-schema.ts +30 -0
  27. package/src/platform/step-reap.ts +33 -18
  28. package/src/platform/watch.ts +1 -11
  29. package/src/plugin/action-schema.ts +59 -1
  30. package/src/plugin/choice-info.ts +133 -0
  31. package/src/plugin/context.ts +279 -0
  32. package/src/plugin/declared-flows.ts +3 -10
  33. package/src/plugin/errors.ts +9 -0
  34. package/src/plugin/freeze.ts +12 -0
  35. package/src/plugin/harness.ts +28 -0
  36. package/src/plugin/index.ts +8 -7
  37. package/src/plugin/install.ts +265 -17
  38. package/src/plugin/keys.ts +2 -12
  39. package/src/plugin/load.ts +47 -23
  40. package/src/plugin/logger.ts +14 -0
  41. package/src/plugin/open-store.ts +0 -6
  42. package/src/plugin/question-form.ts +323 -0
  43. package/src/plugin/registry.ts +519 -76
  44. package/src/plugin/secrets.ts +14 -24
  45. package/src/plugin/semver.ts +52 -0
  46. package/src/plugin/settings.ts +1 -9
  47. package/src/plugin/sqlite-store.ts +94 -64
  48. package/src/plugin/store.ts +5 -0
  49. package/src/plugin/types.ts +575 -21
  50. package/src/plugin/validate.ts +402 -26
  51. package/src/runner/answer.ts +26 -68
  52. package/src/runner/ask.ts +227 -28
  53. package/src/runner/cancel.ts +10 -7
  54. package/src/runner/grants.ts +2 -2
  55. package/src/runner/index.ts +1 -3
  56. package/src/runner/limits.ts +2 -2
  57. package/src/runner/runner.ts +15 -14
  58. package/src/runner/service.ts +52 -19
  59. package/src/runner/step-worker.ts +9 -0
  60. package/src/testing/answer.ts +69 -0
  61. package/src/testing/clock-manual.ts +152 -0
  62. package/src/testing/config.ts +16 -0
  63. package/src/testing/fs.ts +172 -0
  64. package/src/testing/home.ts +43 -0
  65. package/src/testing/index.ts +19 -0
  66. package/src/testing/types.ts +2 -0
  67. package/src/testing/world.ts +9 -2
  68. package/src/trigger/kernel.ts +13 -46
  69. package/src/trigger/rules.ts +22 -12
  70. package/src/trigger/types.ts +2 -6
  71. package/src/util.ts +99 -0
  72. package/src/views/event-line.ts +22 -0
  73. package/src/views/history.ts +36 -19
  74. package/src/views/live-logs.ts +313 -0
  75. package/src/views/pending.ts +23 -5
  76. package/src/views/presentation.ts +629 -81
  77. package/src/views/running.ts +5 -5
  78. package/src/views/settings.ts +205 -66
  79. package/src/views/types.ts +8 -2
  80. package/src/views/uploads.ts +15 -7
  81. package/triggers.schema.json +4 -0
@@ -1,6 +1,7 @@
1
1
  import { END, type FlowDefinition, type Step } from "../flow/types.ts";
2
2
  import type { FactCause, JsonValue } from "../log/types.ts";
3
3
  import { MAX_TRIGGER_HOPS } from "../trigger/types.ts";
4
+ import type { Actor, AskQuestion, AskQuestionAnswer } from "../plugin/types.ts";
4
5
  import type {
5
6
  Decision,
6
7
  Effect,
@@ -15,6 +16,9 @@ import type {
15
16
  StepInterruptedPayload,
16
17
  } from "./types.ts";
17
18
  import { inputCause } from "./types.ts";
19
+ import { storedChoiceInfo, type ChoiceInfoMap } from "../plugin/choice-info.ts";
20
+ import { answersJson, normalizeAnswers, storedAnswers, storedQuestions } from "../plugin/question-form.ts";
21
+ import { isRecord } from "../util.ts";
18
22
 
19
23
  /** The default number of times a run may enter the same step. */
20
24
  export const DEFAULT_MAX_VISITS = 10;
@@ -37,7 +41,7 @@ function edgesOf(step: Step): Readonly<Record<string, string>> {
37
41
  /** The result names the step may produce. */
38
42
  /** The `message` a step's data carries, as a field to spread into a payload. */
39
43
  function messageField(data: JsonValue | undefined): { readonly message?: string } {
40
- if (typeof data !== "object" || data === null || Array.isArray(data)) return {};
44
+ if (!isRecord(data)) return {};
41
45
  const message = (data as { readonly message?: unknown }).message;
42
46
  return typeof message === "string" && message.length > 0 ? { message } : {};
43
47
  }
@@ -60,6 +64,9 @@ interface AskedVia {
60
64
  readonly waitId: string;
61
65
  readonly prompt: string;
62
66
  readonly choices: readonly string[];
67
+ readonly choiceInfo: ChoiceInfoMap | undefined;
68
+ /** The form the step asked, when it asked one. */
69
+ readonly questions: readonly AskQuestion[] | undefined;
63
70
  readonly resume: JsonValue;
64
71
  }
65
72
 
@@ -69,8 +76,13 @@ interface AnsweredAsk {
69
76
  readonly step: string;
70
77
  readonly prompt: string;
71
78
  readonly resume: JsonValue;
72
- readonly choice: string;
79
+ readonly choice: string | null;
80
+ /** The person's answer to each question, when the question was a form. */
81
+ readonly answers?: readonly AskQuestionAnswer[] | undefined;
82
+ /** The form the person answered, so a resumed step can name each answer. */
83
+ readonly questions?: readonly AskQuestion[] | undefined;
73
84
  readonly note: string | null;
85
+ readonly actor: Actor | null;
74
86
  }
75
87
 
76
88
  type EnterVia = {
@@ -81,10 +93,6 @@ type EnterVia = {
81
93
  readonly answered?: AnsweredAsk;
82
94
  };
83
95
 
84
- function isPlainRecord(value: unknown): value is Record<string, JsonValue> {
85
- return typeof value === "object" && value !== null && !Array.isArray(value);
86
- }
87
-
88
96
  /**
89
97
  * The params the step runs again with after its question was answered: the
90
98
  * params it had, the session it left, and the answer. Anything the step did
@@ -95,27 +103,52 @@ function resumedParams(base: JsonValue, answered: AnsweredAsk): JsonValue {
95
103
  const session =
96
104
  typeof resume === "string"
97
105
  ? resume
98
- : isPlainRecord(resume) && typeof resume.session === "string"
106
+ : isRecord(resume) && typeof resume.session === "string"
99
107
  ? resume.session
100
108
  : undefined;
101
109
  return {
102
- ...(isPlainRecord(base) ? base : {}),
110
+ ...(isRecord(base) ? base : {}),
103
111
  ...(session === undefined ? {} : { resumeSession: session }),
104
112
  askAnswer: {
105
113
  prompt: answered.prompt,
106
- choice: answered.choice,
114
+ ...(answered.choice === null ? {} : { choice: answered.choice }),
115
+ ...(answered.answers === undefined ? {} : { answers: answersJson(answered.answers) }),
116
+ ...(answered.questions === undefined ? {} : { questions: answered.questions as unknown as JsonValue }),
107
117
  ...(answered.note === null ? {} : { note: answered.note }),
118
+ ...(answered.actor === null ? {} : { actor: { via: answered.actor.via, id: answered.actor.id } }),
108
119
  },
109
120
  };
110
121
  }
111
122
 
123
+ /**
124
+ * The edge a form's answer takes in the wait step that caught the timeout: the
125
+ * one the asker named, else the answer's own choice when it is an edge, else
126
+ * the step's first choice that is an edge.
127
+ */
128
+ function formEdge(
129
+ step: Step,
130
+ resume: JsonValue,
131
+ choice: string | undefined,
132
+ ): string | undefined {
133
+ const edges = edgesOf(step);
134
+ const named = isRecord(resume) && typeof resume.choice === "string" ? resume.choice : undefined;
135
+ if (named !== undefined && edges[named] !== undefined) return named;
136
+ if (choice !== undefined && edges[choice] !== undefined) return choice;
137
+ if (step.kind === "wait_person") {
138
+ for (const candidate of step.params.choices) {
139
+ if (edges[candidate] !== undefined) return candidate;
140
+ }
141
+ }
142
+ return undefined;
143
+ }
144
+
112
145
  /** The one-time permission the call the step asked about gets, if it named one. */
113
146
  function grantsFrom(answered: AnsweredAsk): readonly Grant[] | undefined {
114
147
  const resume = answered.resume;
115
- if (!isPlainRecord(resume)) return undefined;
148
+ if (!isRecord(resume)) return undefined;
116
149
  const grant = resume.grant;
117
150
  if (
118
- !isPlainRecord(grant) ||
151
+ !isRecord(grant) ||
119
152
  (grant.kind !== "command" && grant.kind !== "path") ||
120
153
  typeof grant.value !== "string" ||
121
154
  grant.value.length === 0
@@ -133,7 +166,7 @@ function grantsFrom(answered: AnsweredAsk): readonly Grant[] | undefined {
133
166
  }
134
167
  }
135
168
  if (approves.size === 0) approves.add("approve");
136
- if (!approves.has(answered.choice)) return undefined;
169
+ if (answered.choice === null || !approves.has(answered.choice)) return undefined;
137
170
  return [
138
171
  {
139
172
  waitId: answered.waitId,
@@ -147,10 +180,10 @@ function grantsFrom(answered: AnsweredAsk): readonly Grant[] | undefined {
147
180
  /** The question in the data of a `waiting` result, when it is well formed. */
148
181
  function askedIn(result: string, data: unknown): AskedVia | undefined {
149
182
  if (result !== "waiting") return undefined;
150
- if (typeof data !== "object" || data === null || Array.isArray(data)) {
183
+ if (!isRecord(data)) {
151
184
  return undefined;
152
185
  }
153
- const record = data as Record<string, unknown>;
186
+ const record = data;
154
187
  if (typeof record.waitId !== "string" || record.waitId.length === 0) {
155
188
  return undefined;
156
189
  }
@@ -162,16 +195,18 @@ function askedIn(result: string, data: unknown): AskedVia | undefined {
162
195
  waitId: record.waitId,
163
196
  prompt: record.prompt,
164
197
  choices,
198
+ choiceInfo: storedChoiceInfo(record.choiceInfo, choices),
199
+ questions: storedQuestions(record.questions),
165
200
  resume: (record.resume ?? null) as JsonValue,
166
201
  };
167
202
  }
168
203
 
169
204
  /** The step a result names, when its data came from a step that stopped. */
170
205
  function stepNameOf(data: unknown): string | undefined {
171
- if (typeof data !== "object" || data === null || Array.isArray(data)) {
206
+ if (!isRecord(data)) {
172
207
  return undefined;
173
208
  }
174
- const step = (data as Record<string, unknown>).step;
209
+ const step = data.step;
175
210
  return typeof step === "string" && step.length > 0 ? step : undefined;
176
211
  }
177
212
 
@@ -344,13 +379,22 @@ export function decide(
344
379
  const waitId = asked?.waitId ?? `${step.id}:${visit}`;
345
380
  const own = [...step.params.choices];
346
381
  const allowed = new Set([...own, ...(step.params.lateChoices ?? [])]);
382
+ // A form shows its questions, never the choices of the wait step that
383
+ // caught the timeout.
384
+ const questions = asked?.questions;
347
385
  const choices =
348
- asked !== undefined &&
349
- asked.choices.length > 0 &&
350
- asked.choices.every((choice) => allowed.has(choice))
386
+ questions !== undefined && questions.length > 0 && asked !== undefined
351
387
  ? [...asked.choices]
352
- : own;
388
+ : asked !== undefined &&
389
+ asked.choices.length > 0 &&
390
+ asked.choices.every((choice) => allowed.has(choice))
391
+ ? [...asked.choices]
392
+ : own;
353
393
  const prompt = asked?.prompt ?? waitPrompt(step.params, via);
394
+ const choiceInfo = storedChoiceInfo(
395
+ asked?.choiceInfo ?? step.params.choiceInfo,
396
+ choices,
397
+ );
354
398
  push(
355
399
  "waiting_for_person",
356
400
  {
@@ -358,11 +402,19 @@ export function decide(
358
402
  step: step.id,
359
403
  prompt,
360
404
  choices,
405
+ ...(choiceInfo === undefined ? {} : { choiceInfo }),
406
+ ...(questions === undefined ? {} : { questions }),
361
407
  waitKind: "step",
362
408
  effectId: null,
363
409
  ...(asked === undefined || via === undefined
364
410
  ? {}
365
- : { ask: { step: via.step, resume: asked.resume } }),
411
+ : {
412
+ ask: {
413
+ step: via.step,
414
+ resume: asked.resume,
415
+ ...(questions === undefined ? {} : { questions }),
416
+ },
417
+ }),
366
418
  },
367
419
  enteredSeq,
368
420
  );
@@ -372,6 +424,7 @@ export function decide(
372
424
  step: step.id,
373
425
  prompt,
374
426
  choices,
427
+ ...(choiceInfo === undefined ? {} : { choiceInfo }),
375
428
  waitKind: "step",
376
429
  });
377
430
  return;
@@ -543,21 +596,37 @@ export function decide(
543
596
 
544
597
  case "person_answer": {
545
598
  const wait = state.wait;
546
- if (
547
- state.status !== "waiting_person" ||
548
- wait === null ||
549
- wait.id !== input.waitId ||
550
- !wait.choices.includes(input.choice)
551
- ) {
599
+ const questions = wait?.questions;
600
+ const isForm = questions !== undefined && questions.length > 0;
601
+ const given = isForm ? storedAnswers(input.answers, questions) : undefined;
602
+ const lone = isForm && given === undefined && input.choice !== undefined && wait !== null && wait.choices.includes(input.choice);
603
+ const acceptable =
604
+ state.status === "waiting_person" &&
605
+ wait !== null &&
606
+ wait.id === input.waitId &&
607
+ (isForm
608
+ ? given !== undefined || lone
609
+ : input.choice !== undefined && wait.choices.includes(input.choice));
610
+ if (!acceptable) {
552
611
  return { facts, effects };
553
612
  }
613
+ const answers =
614
+ isForm && questions !== undefined && wait !== null
615
+ ? (given ??
616
+ normalizeAnswers(
617
+ [{ id: questions[0]?.id, choices: [input.choice] }],
618
+ questions,
619
+ ) ??
620
+ null)
621
+ : null;
554
622
  const answerSeq = push(
555
623
  "person_answered",
556
624
  {
557
625
  waitId: wait.id,
558
626
  step: wait.step,
559
- choice: input.choice,
627
+ choice: input.choice ?? null,
560
628
  note: input.note ?? null,
629
+ ...(answers === null ? {} : { answers: answersJson(answers) }),
561
630
  waitKind: wait.kind,
562
631
  actor: { via: input.actor.via, id: input.actor.id },
563
632
  ...(wait.ask === undefined
@@ -567,6 +636,9 @@ export function decide(
567
636
  step: wait.ask.step,
568
637
  prompt: wait.prompt,
569
638
  resume: wait.ask.resume,
639
+ ...(wait.ask.questions === undefined
640
+ ? {}
641
+ : { questions: wait.ask.questions }),
570
642
  },
571
643
  }),
572
644
  },
@@ -587,9 +659,19 @@ export function decide(
587
659
  endRun("failed", `unknown step ${wait.step}`, answerSeq);
588
660
  return { facts, effects };
589
661
  }
662
+ // A form's answer is not one of the wait step's choices: the edge it
663
+ // takes is the one the asker named, else the wait's first choice. The
664
+ // answer itself is what reaches the step that asked.
665
+ const edge = isForm
666
+ ? formEdge(step, wait.ask?.resume ?? null, input.choice)
667
+ : (input.choice as string);
668
+ if (edge === undefined) {
669
+ endRun("failed", "no edge for the answer to a form", answerSeq);
670
+ return { facts, effects };
671
+ }
590
672
  takeEdge(
591
673
  step,
592
- input.choice,
674
+ edge,
593
675
  answerSeq,
594
676
  undefined,
595
677
  undefined,
@@ -600,8 +682,11 @@ export function decide(
600
682
  step: wait.ask.step,
601
683
  prompt: wait.prompt,
602
684
  resume: wait.ask.resume,
603
- choice: input.choice,
685
+ choice: input.choice ?? null,
686
+ answers: answers === null ? undefined : answers,
687
+ ...(questions === undefined ? {} : { questions }),
604
688
  note: input.note ?? null,
689
+ actor: { via: input.actor.via, id: input.actor.id },
605
690
  },
606
691
  );
607
692
  return { facts, effects };
@@ -178,6 +178,10 @@ export function evolve(state: KernelState, fact: NewFact): KernelState {
178
178
  step: payload.step,
179
179
  prompt: payload.prompt,
180
180
  choices: payload.choices,
181
+ ...(payload.choiceInfo === undefined
182
+ ? {}
183
+ : { choiceInfo: payload.choiceInfo }),
184
+ ...(payload.questions === undefined ? {} : { questions: payload.questions }),
181
185
  kind: payload.waitKind,
182
186
  effectId: payload.effectId,
183
187
  ...(payload.ask === undefined ? {} : { ask: payload.ask }),
@@ -218,7 +222,12 @@ export function evolve(state: KernelState, fact: NewFact): KernelState {
218
222
  prompt: payload.ask.prompt,
219
223
  resume: payload.ask.resume,
220
224
  choice: payload.choice,
225
+ ...(payload.answers === undefined ? {} : { answers: payload.answers }),
226
+ ...(payload.ask.questions === undefined
227
+ ? {}
228
+ : { questions: payload.ask.questions }),
221
229
  note: payload.note,
230
+ actor: payload.actor,
222
231
  },
223
232
  lastSeq,
224
233
  };
@@ -1,6 +1,6 @@
1
1
  import type { EndStatus, Replay, StepKind } from "../flow/types.ts";
2
2
  import type { FactCause, JsonValue, NewFact } from "../log/types.ts";
3
- import type { Actor } from "../plugin/types.ts";
3
+ import type { Actor, AskQuestion, AskQuestionAnswer, ChoiceInfo } from "../plugin/types.ts";
4
4
 
5
5
  /** The kinds of fact the kernel writes. */
6
6
  export type FactKind =
@@ -56,6 +56,7 @@ export interface NotifyPendingEffect {
56
56
  readonly step: string;
57
57
  readonly prompt: string;
58
58
  readonly choices: readonly string[];
59
+ readonly choiceInfo?: Readonly<Record<string, ChoiceInfo>> | undefined;
59
60
  readonly waitKind: WaitKind;
60
61
  }
61
62
 
@@ -126,7 +127,10 @@ export interface StepResultInput extends InputBase {
126
127
  export interface PersonAnswerInput extends InputBase {
127
128
  readonly kind: "person_answer";
128
129
  readonly waitId: string;
129
- readonly choice: string;
130
+ /** The one choice a question of choices takes; absent for a form's answer. */
131
+ readonly choice?: string;
132
+ /** The person's answer to each question, when the question was a form. */
133
+ readonly answers?: readonly AskQuestionAnswer[];
130
134
  readonly note?: string;
131
135
  /** Who answered: a person through a client. */
132
136
  readonly actor: Actor;
@@ -170,8 +174,14 @@ export interface AnsweredAskState {
170
174
  readonly step: string;
171
175
  readonly prompt: string;
172
176
  readonly resume: JsonValue;
173
- readonly choice: string;
177
+ readonly choice: string | null;
178
+ /** The person's answer to each question, when the question was a form. */
179
+ readonly answers?: readonly AskQuestionAnswer[] | undefined;
180
+ /** The form the person answered, so a resumed step can name each answer. */
181
+ readonly questions?: readonly AskQuestion[] | undefined;
174
182
  readonly note: string | null;
183
+ /** Who answered, so a late answer can record a grant with the same person. */
184
+ readonly actor: Actor | null;
175
185
  }
176
186
 
177
187
  /** What a flow wait took over from a step that asked and ran out of grace. */
@@ -180,6 +190,8 @@ export interface AskedWait {
180
190
  readonly step: string;
181
191
  /** What the step left to carry on with: a session and the call asked about. */
182
192
  readonly resume: JsonValue;
193
+ /** The form the step asked, when it asked one. */
194
+ readonly questions?: readonly AskQuestion[] | undefined;
183
195
  }
184
196
 
185
197
  export interface PendingEffect {
@@ -200,6 +212,9 @@ export interface PendingWait {
200
212
  readonly step: string;
201
213
  readonly prompt: string;
202
214
  readonly choices: readonly string[];
215
+ readonly choiceInfo?: Readonly<Record<string, ChoiceInfo>> | undefined;
216
+ /** The form the person fills in, when the question was one. */
217
+ readonly questions?: readonly AskQuestion[] | undefined;
203
218
  readonly kind: WaitKind;
204
219
  readonly effectId: string | null;
205
220
  readonly ask?: AskedWait | undefined;
@@ -253,36 +268,12 @@ export interface RunStartedPayload {
253
268
  readonly trigger?: StartTrigger;
254
269
  }
255
270
 
256
- export interface TriggerReceivedPayload {
257
- readonly source: string;
258
- readonly type: string;
259
- readonly key: string;
260
- readonly summary?: string;
261
- readonly link?: string;
262
- readonly hops: number;
263
- }
264
-
265
- export interface TriggerSkippedPayload {
266
- readonly source: string;
267
- readonly type: string;
268
- readonly key: string;
269
- readonly hops: number;
270
- readonly reason: string;
271
- }
272
-
273
271
  export interface StepEnteredPayload {
274
272
  readonly step: string;
275
273
  readonly visit: number;
276
274
  readonly kind: StepKind;
277
275
  }
278
276
 
279
- /** A runner began executing an effect; `pid` is the process that did. */
280
- export interface StepStartedPayload {
281
- readonly step: string;
282
- readonly effectId: string;
283
- readonly pid: number;
284
- }
285
-
286
277
  export interface EffectRequestedPayload {
287
278
  readonly effectId: string;
288
279
  readonly effect: PendingEffectKind;
@@ -303,17 +294,14 @@ export interface StepResultPayload {
303
294
  readonly data: JsonValue;
304
295
  }
305
296
 
306
- export interface EdgeTakenPayload {
307
- readonly step: string;
308
- readonly result: string;
309
- readonly target: string;
310
- }
311
-
312
297
  export interface WaitingForPersonPayload {
313
298
  readonly waitId: string;
314
299
  readonly step: string;
315
300
  readonly prompt: string;
316
301
  readonly choices: string[];
302
+ readonly choiceInfo?: Readonly<Record<string, ChoiceInfo>> | undefined;
303
+ /** The form the person fills in, when the question was one. */
304
+ readonly questions?: readonly AskQuestion[] | undefined;
317
305
  readonly waitKind: WaitKind;
318
306
  readonly effectId: string | null;
319
307
  readonly ask?: AskedWait;
@@ -322,7 +310,9 @@ export interface WaitingForPersonPayload {
322
310
  export interface PersonAnsweredPayload {
323
311
  readonly waitId: string;
324
312
  readonly step: string;
325
- readonly choice: string;
313
+ readonly choice: string | null;
314
+ /** The person's answer to each question, when the question was a form. */
315
+ readonly answers?: readonly AskQuestionAnswer[] | undefined;
326
316
  readonly note: string | null;
327
317
  readonly waitKind: WaitKind;
328
318
  readonly actor: Actor | null;
@@ -331,6 +321,7 @@ export interface PersonAnsweredPayload {
331
321
  readonly step: string;
332
322
  readonly prompt: string;
333
323
  readonly resume: JsonValue;
324
+ readonly questions?: readonly AskQuestion[] | undefined;
334
325
  };
335
326
  }
336
327
 
@@ -354,12 +345,6 @@ export interface CrashLoopStoppedPayload {
354
345
  readonly recoveries: number;
355
346
  }
356
347
 
357
- export interface VisitLimitReachedPayload {
358
- readonly step: string;
359
- readonly visits: number;
360
- readonly limit: number;
361
- }
362
-
363
348
  /** The cause a fact gets when an input produces it directly. */
364
349
  export function inputCause(input: Input): FactCause {
365
350
  return input.inputId ?? input.kind;
@@ -1,17 +1,14 @@
1
- /** Opening a log by backend name, without reading repository configuration. */
1
+ /** Opening a log file without reading repository configuration. */
2
2
 
3
3
  import { openSqliteLogBackend } from "./sqlite.ts";
4
4
  import type { LogBackend, LogBackendOptions } from "./types.ts";
5
5
 
6
- export type LogBackendName = "sqlite";
7
-
8
6
  export interface OpenLogOptions extends LogBackendOptions {
9
- readonly backend: LogBackendName;
10
7
  /** The database file. */
11
8
  readonly path: string;
12
9
  }
13
10
 
14
- /** Open the log a store uses. The caller decides the backend; this reads no config. */
11
+ /** Open the log a store uses; this reads no config. */
15
12
  export function openLog(options: OpenLogOptions): LogBackend {
16
13
  return openSqliteLogBackend(options.path, options);
17
14
  }