@relayflows/sdk 2.0.27 → 2.0.29

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 (128) hide show
  1. package/dist/authored-flow-executor.d.ts +8 -1
  2. package/dist/authored-flow-executor.d.ts.map +1 -1
  3. package/dist/authored-flow-executor.js +16 -7
  4. package/dist/authored-flow-executor.js.map +1 -1
  5. package/dist/authored-flow-lifecycle.d.ts +68 -1
  6. package/dist/authored-flow-lifecycle.d.ts.map +1 -1
  7. package/dist/authored-flow-lifecycle.js +108 -10
  8. package/dist/authored-flow-lifecycle.js.map +1 -1
  9. package/dist/authored-flow-operation.d.ts +9 -1
  10. package/dist/authored-flow-operation.d.ts.map +1 -1
  11. package/dist/authored-flow-operation.js +7 -1
  12. package/dist/authored-flow-operation.js.map +1 -1
  13. package/dist/authored-node-entry.js +4 -0
  14. package/dist/authored-node-entry.js.map +1 -1
  15. package/dist/authored-node-runner.d.ts.map +1 -1
  16. package/dist/authored-node-runner.js +2 -1
  17. package/dist/authored-node-runner.js.map +1 -1
  18. package/dist/authored-promise-graph.d.ts +19 -4
  19. package/dist/authored-promise-graph.d.ts.map +1 -1
  20. package/dist/authored-promise-graph.js +44 -19
  21. package/dist/authored-promise-graph.js.map +1 -1
  22. package/dist/authored-root.d.ts +2 -0
  23. package/dist/authored-root.d.ts.map +1 -1
  24. package/dist/authored-root.js +2 -0
  25. package/dist/authored-root.js.map +1 -1
  26. package/dist/authored-step-graph.d.ts +83 -0
  27. package/dist/authored-step-graph.d.ts.map +1 -0
  28. package/dist/authored-step-graph.js +217 -0
  29. package/dist/authored-step-graph.js.map +1 -0
  30. package/dist/authored-step-index.d.ts +36 -0
  31. package/dist/authored-step-index.d.ts.map +1 -1
  32. package/dist/authored-step-index.js +68 -15
  33. package/dist/authored-step-index.js.map +1 -1
  34. package/dist/authored-step-output.d.ts +3 -0
  35. package/dist/authored-step-output.d.ts.map +1 -1
  36. package/dist/authored-step-output.js +4 -2
  37. package/dist/authored-step-output.js.map +1 -1
  38. package/dist/authored-worker-step.d.ts +3 -1
  39. package/dist/authored-worker-step.d.ts.map +1 -1
  40. package/dist/authored-worker-step.js +25 -6
  41. package/dist/authored-worker-step.js.map +1 -1
  42. package/dist/cli/direct-run.d.ts.map +1 -1
  43. package/dist/cli/direct-run.js +5 -2
  44. package/dist/cli/direct-run.js.map +1 -1
  45. package/dist/cli/run.d.ts +2 -0
  46. package/dist/cli/run.d.ts.map +1 -1
  47. package/dist/cli/run.js +9 -5
  48. package/dist/cli/run.js.map +1 -1
  49. package/dist/cli/status.d.ts +12 -0
  50. package/dist/cli/status.d.ts.map +1 -1
  51. package/dist/cli/status.js +39 -1
  52. package/dist/cli/status.js.map +1 -1
  53. package/dist/cli/step-excerpt.d.ts +48 -0
  54. package/dist/cli/step-excerpt.d.ts.map +1 -0
  55. package/dist/cli/step-excerpt.js +302 -0
  56. package/dist/cli/step-excerpt.js.map +1 -0
  57. package/dist/cli/step-failure.d.ts.map +1 -1
  58. package/dist/cli/step-failure.js +9 -20
  59. package/dist/cli/step-failure.js.map +1 -1
  60. package/dist/cli-commands.d.ts +8 -0
  61. package/dist/cli-commands.d.ts.map +1 -1
  62. package/dist/cli-commands.js +6 -0
  63. package/dist/cli-commands.js.map +1 -1
  64. package/dist/cli.d.ts +2 -0
  65. package/dist/cli.d.ts.map +1 -1
  66. package/dist/cli.js +38 -7
  67. package/dist/cli.js.map +1 -1
  68. package/dist/failure-kinds.d.ts +10 -2
  69. package/dist/failure-kinds.d.ts.map +1 -1
  70. package/dist/failure-kinds.js.map +1 -1
  71. package/dist/journal-client.d.ts +8 -2
  72. package/dist/journal-client.d.ts.map +1 -1
  73. package/dist/journal-client.js +22 -6
  74. package/dist/journal-client.js.map +1 -1
  75. package/dist/llm-worker.d.ts +2 -1
  76. package/dist/llm-worker.d.ts.map +1 -1
  77. package/dist/llm-worker.js +5 -2
  78. package/dist/llm-worker.js.map +1 -1
  79. package/dist/local-agent.d.ts +1 -1
  80. package/dist/local-agent.d.ts.map +1 -1
  81. package/dist/local-agent.js +8 -3
  82. package/dist/local-agent.js.map +1 -1
  83. package/dist/preflight.d.ts.map +1 -1
  84. package/dist/preflight.js +29 -3
  85. package/dist/preflight.js.map +1 -1
  86. package/dist/promise-ancestry.d.ts +20 -0
  87. package/dist/promise-ancestry.d.ts.map +1 -0
  88. package/dist/promise-ancestry.js +104 -0
  89. package/dist/promise-ancestry.js.map +1 -0
  90. package/dist/validate.d.ts.map +1 -1
  91. package/dist/validate.js +7 -0
  92. package/dist/validate.js.map +1 -1
  93. package/dist/worker-cli.d.ts +7 -0
  94. package/dist/worker-cli.d.ts.map +1 -1
  95. package/dist/worker-cli.js +42 -10
  96. package/dist/worker-cli.js.map +1 -1
  97. package/dist/worker-slots.d.ts +42 -0
  98. package/dist/worker-slots.d.ts.map +1 -0
  99. package/dist/worker-slots.js +94 -0
  100. package/dist/worker-slots.js.map +1 -0
  101. package/package.json +2 -2
  102. package/src/authored-flow-executor.ts +22 -3
  103. package/src/authored-flow-lifecycle.ts +111 -16
  104. package/src/authored-flow-operation.ts +10 -0
  105. package/src/authored-node-entry.ts +4 -1
  106. package/src/authored-node-runner.ts +2 -1
  107. package/src/authored-promise-graph.ts +46 -19
  108. package/src/authored-root.ts +4 -0
  109. package/src/authored-step-graph.ts +246 -0
  110. package/src/authored-step-index.ts +90 -13
  111. package/src/authored-step-output.ts +7 -3
  112. package/src/authored-worker-step.ts +25 -6
  113. package/src/cli/direct-run.ts +5 -2
  114. package/src/cli/run.ts +11 -4
  115. package/src/cli/status.ts +50 -1
  116. package/src/cli/step-excerpt.ts +332 -0
  117. package/src/cli/step-failure.ts +9 -20
  118. package/src/cli-commands.ts +6 -0
  119. package/src/cli.ts +40 -9
  120. package/src/failure-kinds.ts +10 -2
  121. package/src/journal-client.ts +25 -6
  122. package/src/llm-worker.ts +7 -2
  123. package/src/local-agent.ts +8 -2
  124. package/src/preflight.ts +37 -2
  125. package/src/promise-ancestry.ts +98 -0
  126. package/src/validate.ts +7 -0
  127. package/src/worker-cli.ts +41 -9
  128. package/src/worker-slots.ts +92 -0
@@ -0,0 +1,83 @@
1
+ import { type AuthoredStepEdges } from './authored-step-index.js';
2
+ /**
3
+ * The named DAG an authored body draws, recorded as it runs.
4
+ *
5
+ * An authored flow is plain TypeScript, so the shape Cloud wants to draw — which
6
+ * `f.agent` waited for which — is not declared anywhere. It is, however, a fact
7
+ * the runtime already holds: the promise graph (`authored-promise-graph.ts`)
8
+ * records, for every promise the body creates, what triggered it, what resolved
9
+ * it, and which context created it. A step's causal predecessors are the step
10
+ * promises reachable backward from the context that invoked it.
11
+ *
12
+ * Three rules make that walk an answer rather than an approximation:
13
+ *
14
+ * 1. **Stop at steps.** A step promise is a frontier; what it waited for is its
15
+ * own `after`, not ours.
16
+ * 2. **Expand an aggregate that waited for every member.** The runtime links a
17
+ * combinator's aggregate only to the member whose settlement settled it.
18
+ * That member is the whole answer when the aggregate settled on the first
19
+ * member that could decide it — a rejected `all`, a fulfilled `any`, any
20
+ * `race` — and a fraction of it when the aggregate had to wait for all of
21
+ * them: a fulfilled `all`, a rejected `any`, every `allSettled`. Which case
22
+ * applies is known only once the aggregate settles, so it is decided when a
23
+ * walk reaches the aggregate (`registerAggregate`, `promiseOutcome`).
24
+ * 3. **Reduce transitively.** `a → b → c` reaches both `a` and `b` from `c`;
25
+ * `a` is an ancestor of `b`, so it is dropped.
26
+ *
27
+ * Cost is bounded, not quadratic. Each invocation context's frontier is
28
+ * memoized, and a walk that reaches an already-answered context takes its
29
+ * answer instead of re-walking the history behind it — so a long sequential
30
+ * body walks a few nodes per step. A walk that still exceeds `walkLimit` stops
31
+ * and says so (`afterTruncated`) rather than guessing silently.
32
+ *
33
+ * This is observational metadata: it never gates execution, and it changes no
34
+ * step id, admission key or resume identity.
35
+ */
36
+ export declare const MAX_WALK = 10000;
37
+ type Combinator = 'all' | 'allSettled' | 'any' | 'race';
38
+ type Outcome = 'pending' | 'fulfilled' | 'rejected';
39
+ export declare class AuthoredStepGraph {
40
+ private readonly causesOf;
41
+ private readonly walkLimit;
42
+ private readonly stepPromises;
43
+ private readonly aggregates;
44
+ private readonly contexts;
45
+ private readonly nodes;
46
+ private readonly edges;
47
+ constructor(causesOf: (asyncId: number) => readonly number[], walkLimit?: number);
48
+ /** A combinator's aggregate and its members, for expansion once it settles. */
49
+ registerAggregate(aggregateId: number, promise: Promise<unknown>, combinator: Combinator, members: readonly number[]): void;
50
+ /**
51
+ * Record a step invoked from `contextId`. `promiseId` is the step's own
52
+ * promise, when the promise graph saw it, so later walks stop there.
53
+ */
54
+ registerStep(step: string, promiseId: number | undefined, contextId: number, label?: string): AuthoredStepEdges;
55
+ edgesOf(step: string): AuthoredStepEdges | undefined;
56
+ /** Drop the walk state; recorded edges stay readable for late record writes. */
57
+ release(): void;
58
+ private frontierOf;
59
+ /** The members an aggregate waited for beyond its own resolution edge. */
60
+ private waitedFor;
61
+ /**
62
+ * Drop every candidate that is an ancestor of another candidate. The
63
+ * reduction reads recorded `after` lists; when one it reads is incomplete,
64
+ * a redundant ancestor can survive, and the result says so.
65
+ */
66
+ private reduce;
67
+ private orderOf;
68
+ }
69
+ /**
70
+ * Whether a promise has settled, and how, read without attaching a handler.
71
+ *
72
+ * Attaching one would mark an author's rejected aggregate as handled and hide
73
+ * an unhandled rejection the process would otherwise report, so the state is
74
+ * read the one public way that has no such effect: Node's own inspection.
75
+ * `customInspect`, `getters` and `showProxy` keep author code and proxy traps
76
+ * from running; `depth: 0` and the length caps keep the rendered value small.
77
+ * Every option the match depends on is set here, because `inspect` fills the
78
+ * rest from `util.inspect.defaultOptions`, which any code in the process can
79
+ * change — `colors: true` there would wrap `<rejected>` in ANSI escapes.
80
+ */
81
+ export declare function promiseOutcome(promise: Promise<unknown>): Outcome;
82
+ export {};
83
+ //# sourceMappingURL=authored-step-graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authored-step-graph.d.ts","sourceRoot":"","sources":["../src/authored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ACH,OAAO,CAAC,MAAM;IAmCd,OAAO,CAAC,OAAO;CAGhB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAOjE"}
@@ -0,0 +1,217 @@
1
+ import { inspect } from 'node:util';
2
+ import { MAX_AFTER, displayLabel } from './authored-step-index.js';
3
+ /**
4
+ * The named DAG an authored body draws, recorded as it runs.
5
+ *
6
+ * An authored flow is plain TypeScript, so the shape Cloud wants to draw — which
7
+ * `f.agent` waited for which — is not declared anywhere. It is, however, a fact
8
+ * the runtime already holds: the promise graph (`authored-promise-graph.ts`)
9
+ * records, for every promise the body creates, what triggered it, what resolved
10
+ * it, and which context created it. A step's causal predecessors are the step
11
+ * promises reachable backward from the context that invoked it.
12
+ *
13
+ * Three rules make that walk an answer rather than an approximation:
14
+ *
15
+ * 1. **Stop at steps.** A step promise is a frontier; what it waited for is its
16
+ * own `after`, not ours.
17
+ * 2. **Expand an aggregate that waited for every member.** The runtime links a
18
+ * combinator's aggregate only to the member whose settlement settled it.
19
+ * That member is the whole answer when the aggregate settled on the first
20
+ * member that could decide it — a rejected `all`, a fulfilled `any`, any
21
+ * `race` — and a fraction of it when the aggregate had to wait for all of
22
+ * them: a fulfilled `all`, a rejected `any`, every `allSettled`. Which case
23
+ * applies is known only once the aggregate settles, so it is decided when a
24
+ * walk reaches the aggregate (`registerAggregate`, `promiseOutcome`).
25
+ * 3. **Reduce transitively.** `a → b → c` reaches both `a` and `b` from `c`;
26
+ * `a` is an ancestor of `b`, so it is dropped.
27
+ *
28
+ * Cost is bounded, not quadratic. Each invocation context's frontier is
29
+ * memoized, and a walk that reaches an already-answered context takes its
30
+ * answer instead of re-walking the history behind it — so a long sequential
31
+ * body walks a few nodes per step. A walk that still exceeds `walkLimit` stops
32
+ * and says so (`afterTruncated`) rather than guessing silently.
33
+ *
34
+ * This is observational metadata: it never gates execution, and it changes no
35
+ * step id, admission key or resume identity.
36
+ */
37
+ export const MAX_WALK = 10_000;
38
+ /** The settlement on which a combinator had waited for every member. */
39
+ const EXPANDS_ON = {
40
+ all: 'fulfilled',
41
+ allSettled: 'always',
42
+ any: 'rejected',
43
+ race: undefined,
44
+ };
45
+ export class AuthoredStepGraph {
46
+ causesOf;
47
+ walkLimit;
48
+ stepPromises = new Map();
49
+ aggregates = new Map();
50
+ contexts = new Map();
51
+ nodes = new Map();
52
+ edges = new Map();
53
+ constructor(causesOf, walkLimit = MAX_WALK) {
54
+ this.causesOf = causesOf;
55
+ this.walkLimit = walkLimit;
56
+ }
57
+ /** A combinator's aggregate and its members, for expansion once it settles. */
58
+ registerAggregate(aggregateId, promise, combinator, members) {
59
+ const expandsOn = EXPANDS_ON[combinator];
60
+ if (expandsOn === undefined || members.length === 0)
61
+ return;
62
+ this.aggregates.set(aggregateId, { promise, expandsOn, members });
63
+ }
64
+ /**
65
+ * Record a step invoked from `contextId`. `promiseId` is the step's own
66
+ * promise, when the promise graph saw it, so later walks stop there.
67
+ */
68
+ registerStep(step, promiseId, contextId, label) {
69
+ const frontier = this.frontierOf(contextId);
70
+ this.nodes.set(step, { order: this.nodes.size, after: frontier.steps, truncated: frontier.truncated });
71
+ if (promiseId !== undefined)
72
+ this.stepPromises.set(promiseId, step);
73
+ const truncated = frontier.truncated || frontier.steps.length > MAX_AFTER;
74
+ const edges = Object.freeze({
75
+ ...displayLabel(label),
76
+ ...(frontier.steps.length === 0 ? {} : { after: Object.freeze(frontier.steps.slice(0, MAX_AFTER)) }),
77
+ ...(truncated ? { afterTruncated: true } : {}),
78
+ });
79
+ this.edges.set(step, edges);
80
+ return edges;
81
+ }
82
+ edgesOf(step) {
83
+ return this.edges.get(step);
84
+ }
85
+ /** Drop the walk state; recorded edges stay readable for late record writes. */
86
+ release() {
87
+ this.stepPromises.clear();
88
+ this.aggregates.clear();
89
+ this.contexts.clear();
90
+ this.nodes.clear();
91
+ }
92
+ frontierOf(start) {
93
+ const memo = this.contexts.get(start);
94
+ if (memo !== undefined)
95
+ return memo;
96
+ const candidates = new Set();
97
+ let truncated = false;
98
+ const visited = new Set([start]);
99
+ const queue = [start];
100
+ // Breadth-first, so that a walk cut short by the limit has already found
101
+ // the nearest predecessors and lost only distant history.
102
+ for (let head = 0; head < queue.length; head++) {
103
+ const current = queue[head];
104
+ const step = this.stepPromises.get(current);
105
+ if (step !== undefined) {
106
+ candidates.add(step);
107
+ continue;
108
+ }
109
+ const answered = current === start ? undefined : this.contexts.get(current);
110
+ if (answered !== undefined) {
111
+ for (const found of answered.steps)
112
+ candidates.add(found);
113
+ truncated ||= answered.truncated;
114
+ continue;
115
+ }
116
+ for (const id of [...this.waitedFor(current), ...this.causesOf(current)]) {
117
+ if (visited.has(id))
118
+ continue;
119
+ // At the limit, stop growing the walk but still drain what is queued:
120
+ // those nodes are already known and cost one lookup each.
121
+ if (visited.size >= this.walkLimit) {
122
+ truncated = true;
123
+ break;
124
+ }
125
+ visited.add(id);
126
+ queue.push(id);
127
+ }
128
+ }
129
+ const reduced = this.reduce(candidates);
130
+ const frontier = Object.freeze({ steps: reduced.steps, truncated: truncated || reduced.truncated });
131
+ this.contexts.set(start, frontier);
132
+ return frontier;
133
+ }
134
+ /** The members an aggregate waited for beyond its own resolution edge. */
135
+ waitedFor(asyncId) {
136
+ const aggregate = this.aggregates.get(asyncId);
137
+ if (aggregate === undefined)
138
+ return [];
139
+ if (aggregate.expandsOn === 'always')
140
+ return aggregate.members;
141
+ if (aggregate.outcome === undefined) {
142
+ const outcome = promiseOutcome(aggregate.promise);
143
+ if (outcome !== 'pending')
144
+ aggregate.outcome = outcome;
145
+ }
146
+ return aggregate.outcome === aggregate.expandsOn ? aggregate.members : [];
147
+ }
148
+ /**
149
+ * Drop every candidate that is an ancestor of another candidate. The
150
+ * reduction reads recorded `after` lists; when one it reads is incomplete,
151
+ * a redundant ancestor can survive, and the result says so.
152
+ */
153
+ reduce(candidates) {
154
+ const ordered = [...candidates].sort((a, b) => this.orderOf(a) - this.orderOf(b));
155
+ if (ordered.length <= 1)
156
+ return { steps: ordered, truncated: false };
157
+ // An ancestor is always registered before its descendant, so nothing
158
+ // older than the oldest candidate can be one: the walk stops there.
159
+ const oldest = this.orderOf(ordered[0]);
160
+ const reached = new Set();
161
+ // Predecessor lists are read through cursors, never copied onto the stack, and every entry
162
+ // inspected counts toward the limit — duplicates included — so a wide fan-in bounds both
163
+ // allocation and work, not just the number of distinct steps reached.
164
+ const stack = [];
165
+ const pushList = (values) => {
166
+ if (values !== undefined && values.length > 0)
167
+ stack.push({ values, next: 0 });
168
+ };
169
+ for (const step of ordered)
170
+ pushList(this.nodes.get(step)?.after);
171
+ let inspected = 0;
172
+ let truncated = ordered.some((step) => this.nodes.get(step)?.truncated === true);
173
+ while (stack.length > 0) {
174
+ const frame = stack[stack.length - 1];
175
+ const step = frame.values[frame.next++];
176
+ if (frame.next === frame.values.length)
177
+ stack.pop();
178
+ if (++inspected > this.walkLimit) {
179
+ truncated = true;
180
+ break;
181
+ }
182
+ if (reached.has(step))
183
+ continue;
184
+ reached.add(step);
185
+ const node = this.nodes.get(step);
186
+ if (node === undefined || node.order <= oldest)
187
+ continue;
188
+ truncated ||= node.truncated;
189
+ pushList(node.after);
190
+ }
191
+ return { steps: ordered.filter((step) => !reached.has(step)), truncated };
192
+ }
193
+ orderOf(step) {
194
+ return this.nodes.get(step)?.order ?? -1;
195
+ }
196
+ }
197
+ /**
198
+ * Whether a promise has settled, and how, read without attaching a handler.
199
+ *
200
+ * Attaching one would mark an author's rejected aggregate as handled and hide
201
+ * an unhandled rejection the process would otherwise report, so the state is
202
+ * read the one public way that has no such effect: Node's own inspection.
203
+ * `customInspect`, `getters` and `showProxy` keep author code and proxy traps
204
+ * from running; `depth: 0` and the length caps keep the rendered value small.
205
+ * Every option the match depends on is set here, because `inspect` fills the
206
+ * rest from `util.inspect.defaultOptions`, which any code in the process can
207
+ * change — `colors: true` there would wrap `<rejected>` in ANSI escapes.
208
+ */
209
+ export function promiseOutcome(promise) {
210
+ const shown = inspect(promise, {
211
+ depth: 0, customInspect: false, getters: false, showProxy: true, colors: false,
212
+ compact: 3, sorted: false, maxArrayLength: 0, maxStringLength: 0, breakLength: Infinity,
213
+ });
214
+ const state = /^[^{]*\{\s*<(pending|rejected)>/u.exec(shown)?.[1];
215
+ return state === 'pending' ? 'pending' : state === 'rejected' ? 'rejected' : 'fulfilled';
216
+ }
217
+ //# sourceMappingURL=authored-step-graph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authored-step-graph.js","sourceRoot":"","sources":["../src/authored-step-graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,YAAY,EAA0B,MAAM,0BAA0B,CAAC;AAE3F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC;AAiB/B,wEAAwE;AACxE,MAAM,UAAU,GAAiE;IAC/E,GAAG,EAAE,WAAW;IAChB,UAAU,EAAE,QAAQ;IACpB,GAAG,EAAE,UAAU;IACf,IAAI,EAAE,SAAS;CAChB,CAAC;AAUF,MAAM,OAAO,iBAAiB;IAQT;IACA;IARF,YAAY,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzC,UAAU,GAAG,IAAI,GAAG,EAAqB,CAAC;IAC1C,QAAQ,GAAG,IAAI,GAAG,EAAoB,CAAC;IACvC,KAAK,GAAG,IAAI,GAAG,EAAoB,CAAC;IACpC,KAAK,GAAG,IAAI,GAAG,EAA6B,CAAC;IAE9D,YACmB,QAAgD,EAChD,YAAY,QAAQ;QADpB,aAAQ,GAAR,QAAQ,CAAwC;QAChD,cAAS,GAAT,SAAS,CAAW;IACpC,CAAC;IAEJ,+EAA+E;IAC/E,iBAAiB,CACf,WAAmB,EACnB,OAAyB,EACzB,UAAsB,EACtB,OAA0B;QAE1B,MAAM,SAAS,GAAG,UAAU,CAAC,UAAU,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AC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC;IAC5E,CAAC;IAEO,OAAO,CAAC,IAAY;QAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC;IAC3C,CAAC;CACF;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,cAAc,CAAC,OAAyB;IACtD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,EAAE;QAC7B,KAAK,EAAE,CAAC,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK;QAC9E,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,WAAW,EAAE,QAAQ;KACxF,CAAC,CAAC;IACH,MAAM,KAAK,GAAG,kCAAkC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAClE,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC;AAC3F,CAAC"}
@@ -48,7 +48,37 @@ export interface AuthoredStepRecord {
48
48
  * `<step>` — saying which is the difference between an index and a guess.
49
49
  */
50
50
  readonly kernelStep?: string;
51
+ /**
52
+ * Human name for the step: the author-chosen `f.agent` or `f.hook` name,
53
+ * whole or not at all (`displayLabel`).
54
+ */
55
+ readonly label?: string;
56
+ /**
57
+ * The steps this one causally waited for, transitively reduced
58
+ * (`authored-step-graph.ts`). Absent means none were found, not unknown.
59
+ */
60
+ readonly after?: readonly string[];
61
+ /** Present when `after` is incomplete: the walk hit its limit or the list its cap. */
62
+ readonly afterTruncated?: true;
51
63
  }
64
+ /** The graph fields one authored step carries on every record about it. */
65
+ export type AuthoredStepEdges = Pick<AuthoredStepRecord, 'label' | 'after' | 'afterTruncated'>;
66
+ /** Most predecessors one record lists; the rest are marked `afterTruncated`. */
67
+ export declare const MAX_AFTER = 32;
68
+ /** Longest label a record carries. A longer one is omitted, never cut. */
69
+ export declare const MAX_LABEL = 256;
70
+ /**
71
+ * A label, whole, or nothing.
72
+ *
73
+ * A label is displayed and persisted by Cloud after its redactor runs, and the
74
+ * redactor matches whole secret values: a label cut mid-secret would arrive as
75
+ * an unredactable prefix. So a label is never truncated — one over the bound
76
+ * is dropped — and only author-chosen names are labels at all. Commands are
77
+ * not: they carry literal tokens and URLs, so `f.run` has no label.
78
+ */
79
+ export declare function displayLabel(label: string | undefined): {
80
+ readonly label?: string;
81
+ };
52
82
  /**
53
83
  * Append one record, or do nothing when there is no root to append to.
54
84
  *
@@ -78,5 +108,11 @@ export declare function alsoRecord(journal: JournalClient, rootRunId: string | u
78
108
  * Records this version does not recognise are skipped rather than trusted.
79
109
  */
80
110
  export declare function readAuthoredStepIndex(journal: JournalClient, rootRunId: string): Promise<AuthoredStepRecord[]>;
111
+ /**
112
+ * The fold itself, over messages already read from the stream in append
113
+ * order — by `readAuthoredStepIndex` through the daemon, or by `flows status`
114
+ * straight from the journal file, which must agree with it record for record.
115
+ */
116
+ export declare function foldAuthoredStepRecords(messages: Iterable<unknown>, index?: Map<string, AuthoredStepRecord>): Map<string, AuthoredStepRecord>;
81
117
  export {};
82
118
  //# sourceMappingURL=authored-step-index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"authored-step-index.d.ts","sourceRoot":"","sources":["../src/authored-step-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,oBAAoB,mBAAmB,CAAC;AAErD,oEAAoE;AACpE,QAAA,MAAM,WAAW,gCAAgC,CAAC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AC,GACxC,OAAO,CAAC,MAAM,CAAC,CAOjB;AAED;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,aAAa,EACtB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAY/B;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,EAC3B,KAAK,GAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAa,GACjD,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAiBjC"}
@@ -30,6 +30,22 @@ const RECORD_KIND = 'relayflows.authored-step.v1';
30
30
  * exists so a hostile or buggy id cannot make one record unbounded.
31
31
  */
32
32
  const FIELD_CHARS = 256;
33
+ /** Most predecessors one record lists; the rest are marked `afterTruncated`. */
34
+ export const MAX_AFTER = 32;
35
+ /** Longest label a record carries. A longer one is omitted, never cut. */
36
+ export const MAX_LABEL = 256;
37
+ /**
38
+ * A label, whole, or nothing.
39
+ *
40
+ * A label is displayed and persisted by Cloud after its redactor runs, and the
41
+ * redactor matches whole secret values: a label cut mid-secret would arrive as
42
+ * an unredactable prefix. So a label is never truncated — one over the bound
43
+ * is dropped — and only author-chosen names are labels at all. Commands are
44
+ * not: they carry literal tokens and URLs, so `f.run` has no label.
45
+ */
46
+ export function displayLabel(label) {
47
+ return label === undefined || label.trim() === '' || label.length > MAX_LABEL ? {} : { label };
48
+ }
33
49
  /**
34
50
  * Append one record, or do nothing when there is no root to append to.
35
51
  *
@@ -53,6 +69,10 @@ export async function recordAuthoredChild(journal, rootRunId, record) {
53
69
  ...(record.completionReason === undefined ? {} : { completionReason: bound(record.completionReason) }),
54
70
  ...(record.kernelStep === undefined || record.kernelStep === record.step
55
71
  ? {} : { kernelStep: bound(record.kernelStep) }),
72
+ ...displayLabel(record.label),
73
+ ...(record.after === undefined ? {} : { after: record.after.slice(0, MAX_AFTER).map(bound) }),
74
+ ...(record.afterTruncated === true || (record.after?.length ?? 0) > MAX_AFTER
75
+ ? { afterTruncated: true } : {}),
56
76
  });
57
77
  }
58
78
  /**
@@ -83,26 +103,54 @@ export async function readAuthoredStepIndex(journal, rootRunId) {
83
103
  let offset = 0;
84
104
  for (;;) {
85
105
  const page = await journal.streamRead(rootRunId, AUTHORED_STEP_STREAM, offset, 1000);
86
- for (const message of page.messages) {
87
- // `stream.read` returns either the envelope or the bare message,
88
- // matching how the executor reads predicate verdicts.
89
- const raw = message.message ?? message;
90
- if (!isAuthoredStepRecord(raw))
91
- continue;
92
- const previous = index.get(raw.step);
93
- // An `admitted` record arriving after a `completed` one (a resumed body
94
- // re-admitting the same child under its stable admission key) must not
95
- // un-complete it.
96
- if (previous?.state === 'completed' && raw.state === 'admitted')
97
- continue;
98
- index.set(raw.step, raw);
99
- }
106
+ // `stream.read` returns either the envelope or the bare message,
107
+ // matching how the executor reads predicate verdicts.
108
+ foldAuthoredStepRecords(page.messages.map((message) => message.message ?? message), index);
100
109
  if (page.messages.length === 0 || page.next_offset <= offset)
101
110
  break;
102
111
  offset = page.next_offset;
103
112
  }
104
113
  return [...index.values()];
105
114
  }
115
+ /**
116
+ * The fold itself, over messages already read from the stream in append
117
+ * order — by `readAuthoredStepIndex` through the daemon, or by `flows status`
118
+ * straight from the journal file, which must agree with it record for record.
119
+ */
120
+ export function foldAuthoredStepRecords(messages, index = new Map()) {
121
+ for (const raw of messages) {
122
+ if (!isAuthoredStepRecord(raw))
123
+ continue;
124
+ const previous = index.get(raw.step);
125
+ if (previous === undefined) {
126
+ index.set(raw.step, raw);
127
+ continue;
128
+ }
129
+ // An `admitted` record arriving after a `completed` one (a resumed body
130
+ // re-admitting the same child under its stable admission key) must not
131
+ // un-complete it. Either way, graph fields one record lacks are taken from
132
+ // the other: a completion written without them (or a re-admission that
133
+ // adds them, over a root an older runtime began) must not erase them.
134
+ const keepPrevious = previous.state === 'completed' && raw.state === 'admitted';
135
+ index.set(raw.step, withGraphFrom(keepPrevious ? previous : raw, keepPrevious ? raw : previous));
136
+ }
137
+ return index;
138
+ }
139
+ /** `primary`, with any `label` / `after` it lacks taken from `fallback`. */
140
+ function withGraphFrom(primary, fallback) {
141
+ const label = primary.label ?? fallback.label;
142
+ // `after` and `afterTruncated` travel together: a truncated walk that found
143
+ // no predecessor journals the flag alone, and it must survive the fold.
144
+ const hasEdges = (record) => record.after !== undefined || record.afterTruncated === true;
145
+ const edges = hasEdges(primary) ? primary : fallback;
146
+ const { label: _label, after: _after, afterTruncated: _truncated, ...lifecycle } = primary;
147
+ return {
148
+ ...lifecycle,
149
+ ...(label === undefined ? {} : { label }),
150
+ ...(edges.after === undefined ? {} : { after: edges.after }),
151
+ ...(edges.afterTruncated === true ? { afterTruncated: true } : {}),
152
+ };
153
+ }
106
154
  function isAuthoredStepRecord(value) {
107
155
  if (typeof value !== 'object' || value === null || Array.isArray(value))
108
156
  return false;
@@ -112,7 +160,12 @@ function isAuthoredStepRecord(value) {
112
160
  && typeof record.runId === 'string' && record.runId.length > 0
113
161
  && (record.state === 'admitted' || record.state === 'completed')
114
162
  && (record.completionReason === undefined || typeof record.completionReason === 'string')
115
- && (record.kernelStep === undefined || typeof record.kernelStep === 'string');
163
+ && (record.kernelStep === undefined || typeof record.kernelStep === 'string')
164
+ && (record.label === undefined || (typeof record.label === 'string' && record.label.length <= MAX_LABEL))
165
+ && (record.after === undefined || (Array.isArray(record.after)
166
+ && record.after.length <= MAX_AFTER
167
+ && record.after.every((step) => typeof step === 'string' && step.length > 0)))
168
+ && (record.afterTruncated === undefined || record.afterTruncated === true);
116
169
  }
117
170
  function bound(value) {
118
171
  return value.length <= FIELD_CHARS ? value : `${value.slice(0, FIELD_CHARS)}…`;
@@ -1 +1 @@
1
- {"version":3,"file":"authored-step-index.js","sourceRoot":"","sources":["../src/authored-step-index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,gBAAgB,CAAC;A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IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ,CAAC;WAC1E,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,IAAI,SAAS,CAAC,CAAC;WACtG,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;eACzD,MAAM,CAAC,KAAK,CAAC,MAAM,IAAI,SAAS;eAChC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;WAC7E,CAAC,MAAM,CAAC,cAAc,KAAK,SAAS,IAAI,MAAM,CAAC,cAAc,KAAK,IAAI,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,KAAK,CAAC,KAAa;IAC1B,OAAO,KAAK,CAAC,MAAM,IAAI,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC;AACjF,CAAC"}
@@ -2,6 +2,7 @@ import { type FlowCompletionReason } from '@relayflows/surface';
2
2
  import type { JournalClient } from './journal-client.js';
3
3
  import type { CompletionReason as ProtocolCompletionReason, RunCompletionReason as ProtocolRunCompletionReason, RunOutcome } from './protocol.js';
4
4
  import type { AuthoredFlowJournalStep } from './authored-flow-executor.js';
5
+ import { type AuthoredStepEdges } from './authored-step-index.js';
5
6
  /**
6
7
  * What an authored operation needs in order to leave readable evidence:
7
8
  * the root run its child index belongs to, and the data dir whose journals
@@ -12,6 +13,8 @@ import type { AuthoredFlowJournalStep } from './authored-flow-executor.js';
12
13
  export interface AuthoredStepContext {
13
14
  readonly rootRunId?: string;
14
15
  readonly dataDir?: string;
16
+ /** The step's label and causal predecessors, carried on every record about it. */
17
+ readonly stepEdges?: (step: string) => AuthoredStepEdges | undefined;
15
18
  }
16
19
  /**
17
20
  * Shared by every `f.*` verb that lowers to one kernel step run in isolation:
@@ -1 +1 @@
1
- {"version":3,"file":"authored-step-output.d.ts","sourceRoot":"","sources":["../src/authored-step-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAErI,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,IAAI,wBAAwB,EAAE,mBAAmB,IAAI,2BAA2B,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAClJ,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAK3E;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,uBAAuB,EAAE,EACvC,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,OAAO,CAAC,CAkClB;AAED,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,uBAAuB,EAAE,EACvC,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,MAAM,CAAC,CAkBjB;AAqBD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,wBAAwB,CAG3F;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IA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AAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,wBAAwB,CAG3F;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,2BAA2B,CAGjG;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,oBAAoB,CAG3F"}
@@ -34,7 +34,8 @@ export async function readCompletedStepOutput(journal, runId, stepId, journalSte
34
34
  throw protocolViolation(runId, `journal has no step.completed for "${stepId}"`);
35
35
  }
36
36
  const reason = completed.payload.completionReason;
37
- journalSteps.push(Object.freeze({ id: stepId, runId, completionReason: reason }));
37
+ const edges = context.stepEdges?.(stepId);
38
+ journalSteps.push(Object.freeze({ id: stepId, runId, completionReason: reason, ...edges }));
38
39
  if (reason !== 'success') {
39
40
  let message = `journal step "${stepId}" completed with ${reason}`;
40
41
  let details;
@@ -55,11 +56,12 @@ export async function readCompletedStepOutput(journal, runId, stepId, journalSte
55
56
  message += await alsoRecord(journal, context.rootRunId, {
56
57
  step: stepId, runId, state: 'completed', completionReason: reason,
57
58
  ...(details?.stepId === undefined ? {} : { kernelStep: details.stepId }),
59
+ ...edges,
58
60
  });
59
61
  throw new AuthoredFlowExecutionError('step_failed', message, reason, runId, { ...details, ...where });
60
62
  }
61
63
  await recordAuthoredChild(journal, context.rootRunId, {
62
- step: stepId, runId, state: 'completed', completionReason: reason,
64
+ step: stepId, runId, state: 'completed', completionReason: reason, ...edges,
63
65
  });
64
66
  return completed.payload.output;
65
67
  }
@@ -1 +1 @@
1
- {"version":3,"file":"authored-step-output.js","sourceRoot":"","sources":["../src/authored-step-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,uBAAuB,EAA6B,MAAM,qBAAqB,CAAC;AACrI,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAKtE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,kBAAkB,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C,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,KAAc;IAC1D,OAAO,OAAO,KAAK,KAAK,QAAQ;WAC1B,uBAA6C,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACtE,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAa,EAAE,MAAc;IACtD,OAAO,IAAI,0BAA0B,CACnC,4BAA4B,EAC5B,MAAM,EACN,SAAS,EACT,KAAK,CACN,CAAC;AACJ,CAAC"}
@@ -7,7 +7,9 @@ import type { AuthoredFlowJournalStep } from './authored-flow-executor.js';
7
7
  /** Agent and LLM calls share the exact declarative preflight and lease wait. */
8
8
  export declare function authoredWorkerRunner(definition: {
9
9
  name: string;
10
- }, journal: JournalClient, flowPath: string, journalSteps: AuthoredFlowJournalStep[], waitOptions: RunLifecycleOptions, localAgentStream?: string, budget?: AuthoredBudget, headerBudget?: unknown, rootRunId?: string): {
10
+ }, journal: JournalClient, flowPath: string, journalSteps: AuthoredFlowJournalStep[], waitOptions: RunLifecycleOptions, localAgentStream?: string, budget?: AuthoredBudget, headerBudget?: unknown, rootRunId?: string, workerCapacity?: number, stepEdges?: AuthoredStepContext['stepEdges']): {
11
+ /** Refuse every agent/LLM call still waiting for a worker slot (body teardown). */
12
+ stop(reason: unknown): void;
11
13
  agent(id: string, options: AgentOptions, verification?: NamedGate): Promise<AgentResult>;
12
14
  llm(id: string, prompt: string, options?: LlmOptions, verification?: NamedGate): Promise<unknown>;
13
15
  };
@@ -1 +1 @@
1
- {"version":3,"file":"authored-worker-step.d.ts","sourceRoot":"","sources":["../src/authored-worker-step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAG5F,OAAO,EAAmB,KAAK,mBAAmB,EAAkB,MAAM,cAAc,CAAC;AAGzF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAA4E,KAAK,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAC/I,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAQ3E,gFAAgF;AAChF,wBAAgB,oBAAoB,CAClC,UAAU,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EACtE,YAAY,EAAE,uBAAuB,EAAE,EAAE,WAAW,EAAE,mBAAmB,EACzE,gBAAgB,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,cAAc,EAAE,YAAY,CAAC,EAAE,OAAO,EAC1E,SAAS,CAAC,EAAE,MAAM;cAiGA,MAAM,WAAW,YAAY,iBAAiB,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;YAgEhF,MAAM,UAAU,MAAM,YAAY,UAAU,iBAAiB,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC;EAmB1G;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,uBAAuB,EAAE,EAAE,MAAM,EAAE,cAAc,EACrG,OAAO,GAAE,mBAAwB,IAGnB,IAAI,MAAM,EAAE,SAAS,MAAM,EAAE,kBAAgB,EAAE,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