@xyne/workflow-sdk 3.2.21 → 3.2.22

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.
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Schema-authoring helpers for principal-reference fields (approval `assignee`,
3
+ * access grants). A field marked with one of these formats is rendered by the
4
+ * UI's host-supplied `PrincipalPicker` slot; the stored value is an opaque
5
+ * `{ kind, id }` reference the authorizer resolves. The SDK never interprets it.
6
+ */
7
+ /**
8
+ * JSON Schema `format` marker for a principal reference. Whether the field holds
9
+ * one principal or a list is the field's own `type` (`object` vs `array`) — the
10
+ * builder derives multi-select from that, so a single format marker suffices.
11
+ */
12
+ export declare const PRINCIPAL_FORMAT = "principal";
13
+ /**
14
+ * Stamp `format: 'principal'` onto the named properties of a config JSON Schema,
15
+ * so the builder renders the host's `PrincipalPicker` for them. Works for both
16
+ * single (`type: 'object'`) and list (`type: 'array'`) fields — the author
17
+ * declares the type; this only adds the marker.
18
+ *
19
+ * Mirrors {@link markAttachmentFields}. Use it in a step's
20
+ * `decorateConfigSchema` for its `assignee`-style fields.
21
+ */
22
+ export declare function markPrincipalFields(jsonSchema: Record<string, unknown>, fields: readonly string[]): Record<string, unknown>;
23
+ //# sourceMappingURL=principal-field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"principal-field.d.ts","sourceRoot":"","sources":["../../src/authz/principal-field.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAE5C;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,MAAM,EAAE,SAAS,MAAM,EAAE,GACxB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWzB"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Schema-authoring helpers for principal-reference fields (approval `assignee`,
3
+ * access grants). A field marked with one of these formats is rendered by the
4
+ * UI's host-supplied `PrincipalPicker` slot; the stored value is an opaque
5
+ * `{ kind, id }` reference the authorizer resolves. The SDK never interprets it.
6
+ */
7
+ /**
8
+ * JSON Schema `format` marker for a principal reference. Whether the field holds
9
+ * one principal or a list is the field's own `type` (`object` vs `array`) — the
10
+ * builder derives multi-select from that, so a single format marker suffices.
11
+ */
12
+ export const PRINCIPAL_FORMAT = 'principal';
13
+ /**
14
+ * Stamp `format: 'principal'` onto the named properties of a config JSON Schema,
15
+ * so the builder renders the host's `PrincipalPicker` for them. Works for both
16
+ * single (`type: 'object'`) and list (`type: 'array'`) fields — the author
17
+ * declares the type; this only adds the marker.
18
+ *
19
+ * Mirrors {@link markAttachmentFields}. Use it in a step's
20
+ * `decorateConfigSchema` for its `assignee`-style fields.
21
+ */
22
+ export function markPrincipalFields(jsonSchema, fields) {
23
+ const props = jsonSchema['properties'];
24
+ if (!props)
25
+ return jsonSchema;
26
+ for (const field of fields) {
27
+ const prop = props[field];
28
+ if (!prop)
29
+ continue;
30
+ props[field] = { ...prop, format: PRINCIPAL_FORMAT };
31
+ }
32
+ return jsonSchema;
33
+ }
34
+ //# sourceMappingURL=principal-field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"principal-field.js","sourceRoot":"","sources":["../../src/authz/principal-field.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAE5C;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CACjC,UAAmC,EACnC,MAAyB;IAEzB,MAAM,KAAK,GAAG,UAAU,CAAC,YAAY,CAExB,CAAC;IACd,IAAI,CAAC,KAAK;QAAE,OAAO,UAAU,CAAC;IAC9B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI;YAAE,SAAS;QACpB,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;IACvD,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyne/workflow-sdk",
3
- "version": "3.2.21",
3
+ "version": "3.2.22",
4
4
  "description": "Workflow engine SDK — steps, triggers, executor, agents, and a framework-agnostic HTTP router.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -1,35 +0,0 @@
1
- /**
2
- * Recomputing an agent's arithmetic, safely.
3
- *
4
- * A derived value (a growth rate, a ratio, a total) appears **nowhere** in the
5
- * source, so there is no passage to quote and no page to open — the only honest
6
- * provenance is *these inputs, combined this way*. Given both, the arithmetic
7
- * stops being a claim and becomes checkable: the reader is shown a ✓ when the
8
- * numbers reproduce and a ⚠ when they don't. LLM arithmetic is the least reliable
9
- * step in the pipeline, and this makes it the most verified.
10
- *
11
- * Inputs are referenced **positionally** (`#1`, `#2`) rather than by name or cell.
12
- * That is the security property, not a convenience: the grammar then contains no
13
- * identifiers at all, so an expression *cannot* name anything outside the inputs
14
- * array. No `eval`, no `Function`, no scope to escape into — the worst a
15
- * malformed expression can do is fail to parse.
16
- */
17
- /**
18
- * Evaluate `expr` over `inputs`, or `undefined` when it cannot be evaluated
19
- * with certainty.
20
- *
21
- * `undefined` is deliberately indistinguishable between "malformed" and
22
- * "unsupported": in either case the UI shows the expression without a verdict.
23
- * Showing a wrong ✓ would be worse than showing none.
24
- */
25
- export declare function evaluateExpression(expr: string, inputs: number[]): number | undefined;
26
- /**
27
- * Parse a number out of a cited value as it appears in a document —
28
- * `"₹36,816.00"`, `"1 234,5"`, `"(1,200)"` (accounting negative), `"12%"`.
29
- *
30
- * Needed because an input's value arrives as source text, not a number, and a
31
- * verification that only worked on already-clean numbers would rarely fire on
32
- * real documents. Returns `undefined` when there is no unambiguous number.
33
- */
34
- export declare function parseNumericValue(value: unknown): number | undefined;
35
- //# sourceMappingURL=expression-eval.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"expression-eval.d.ts","sourceRoot":"","sources":["../../src/common/expression-eval.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAwHH;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAIrF;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAyCpE"}
@@ -1,214 +0,0 @@
1
- /**
2
- * Recomputing an agent's arithmetic, safely.
3
- *
4
- * A derived value (a growth rate, a ratio, a total) appears **nowhere** in the
5
- * source, so there is no passage to quote and no page to open — the only honest
6
- * provenance is *these inputs, combined this way*. Given both, the arithmetic
7
- * stops being a claim and becomes checkable: the reader is shown a ✓ when the
8
- * numbers reproduce and a ⚠ when they don't. LLM arithmetic is the least reliable
9
- * step in the pipeline, and this makes it the most verified.
10
- *
11
- * Inputs are referenced **positionally** (`#1`, `#2`) rather than by name or cell.
12
- * That is the security property, not a convenience: the grammar then contains no
13
- * identifiers at all, so an expression *cannot* name anything outside the inputs
14
- * array. No `eval`, no `Function`, no scope to escape into — the worst a
15
- * malformed expression can do is fail to parse.
16
- */
17
- function tokenize(expr) {
18
- const out = [];
19
- let i = 0;
20
- while (i < expr.length) {
21
- const ch = expr[i];
22
- if (/\s/.test(ch)) {
23
- i++;
24
- continue;
25
- }
26
- if (ch === '#') {
27
- const m = /^#(\d+)/.exec(expr.slice(i));
28
- if (!m)
29
- return null;
30
- const idx = Number(m[1]);
31
- if (!Number.isInteger(idx) || idx < 1)
32
- return null;
33
- out.push({ t: 'ref', i: idx - 1 }); // `#1` is inputs[0] — 1-based reads naturally
34
- i += m[0].length;
35
- continue;
36
- }
37
- if (/[0-9.]/.test(ch)) {
38
- const m = /^\d*\.?\d+/.exec(expr.slice(i));
39
- if (!m)
40
- return null;
41
- out.push({ t: 'num', v: Number(m[0]) });
42
- i += m[0].length;
43
- continue;
44
- }
45
- if (ch === '+' || ch === '-' || ch === '*' || ch === '/') {
46
- out.push({ t: 'op', v: ch });
47
- i++;
48
- continue;
49
- }
50
- if (ch === '(') {
51
- out.push({ t: 'lparen' });
52
- i++;
53
- continue;
54
- }
55
- if (ch === ')') {
56
- out.push({ t: 'rparen' });
57
- i++;
58
- continue;
59
- }
60
- // Anything else — a letter, a call, a property access — is not in the
61
- // language. Refuse rather than try to interpret it.
62
- return null;
63
- }
64
- return out.length > 0 ? out : null;
65
- }
66
- /**
67
- * Recursive-descent over `expr := term (('+'|'-') term)*`,
68
- * `term := factor (('*'|'/') factor)*`, `factor := '-'? (num | ref | '(' expr ')')`.
69
- */
70
- function parseAndEval(tokens, inputs) {
71
- let pos = 0;
72
- let failed = false;
73
- const fail = () => { failed = true; return undefined; };
74
- const factor = () => {
75
- const tok = tokens[pos];
76
- if (!tok)
77
- return fail();
78
- if (tok.t === 'op' && tok.v === '-') { // unary minus
79
- pos++;
80
- const v = factor();
81
- return v === undefined ? undefined : -v;
82
- }
83
- if (tok.t === 'num') {
84
- pos++;
85
- return tok.v;
86
- }
87
- if (tok.t === 'ref') {
88
- pos++;
89
- const v = inputs[tok.i];
90
- // A reference past the inputs it was given is a malformed citation, not a zero.
91
- return v === undefined || !Number.isFinite(v) ? fail() : v;
92
- }
93
- if (tok.t === 'lparen') {
94
- pos++;
95
- const v = expression();
96
- if (failed)
97
- return undefined;
98
- if (tokens[pos]?.t !== 'rparen')
99
- return fail();
100
- pos++;
101
- return v;
102
- }
103
- return fail();
104
- };
105
- const term = () => {
106
- let left = factor();
107
- if (left === undefined)
108
- return undefined;
109
- for (;;) {
110
- const tok = tokens[pos];
111
- if (!tok || tok.t !== 'op' || (tok.v !== '*' && tok.v !== '/'))
112
- return left;
113
- pos++;
114
- const right = factor();
115
- if (right === undefined)
116
- return undefined;
117
- // Division by zero yields Infinity/NaN — not a number a reader can verify.
118
- if (tok.v === '/' && right === 0)
119
- return fail();
120
- left = tok.v === '*' ? left * right : left / right;
121
- }
122
- };
123
- const expression = () => {
124
- let left = term();
125
- if (left === undefined)
126
- return undefined;
127
- for (;;) {
128
- const tok = tokens[pos];
129
- if (!tok || tok.t !== 'op' || (tok.v !== '+' && tok.v !== '-'))
130
- return left;
131
- pos++;
132
- const right = term();
133
- if (right === undefined)
134
- return undefined;
135
- left = tok.v === '+' ? left + right : left - right;
136
- }
137
- };
138
- const result = expression();
139
- // Trailing tokens mean we understood only a prefix — that is a parse failure,
140
- // not a partial answer.
141
- if (failed || pos !== tokens.length || result === undefined)
142
- return undefined;
143
- return Number.isFinite(result) ? result : undefined;
144
- }
145
- /**
146
- * Evaluate `expr` over `inputs`, or `undefined` when it cannot be evaluated
147
- * with certainty.
148
- *
149
- * `undefined` is deliberately indistinguishable between "malformed" and
150
- * "unsupported": in either case the UI shows the expression without a verdict.
151
- * Showing a wrong ✓ would be worse than showing none.
152
- */
153
- export function evaluateExpression(expr, inputs) {
154
- const tokens = tokenize(expr);
155
- if (!tokens)
156
- return undefined;
157
- return parseAndEval(tokens, inputs);
158
- }
159
- /**
160
- * Parse a number out of a cited value as it appears in a document —
161
- * `"₹36,816.00"`, `"1 234,5"`, `"(1,200)"` (accounting negative), `"12%"`.
162
- *
163
- * Needed because an input's value arrives as source text, not a number, and a
164
- * verification that only worked on already-clean numbers would rarely fire on
165
- * real documents. Returns `undefined` when there is no unambiguous number.
166
- */
167
- export function parseNumericValue(value) {
168
- if (typeof value === 'number')
169
- return Number.isFinite(value) ? value : undefined;
170
- if (typeof value !== 'string')
171
- return undefined;
172
- let s = value.trim();
173
- if (!s)
174
- return undefined;
175
- // Accounting negatives: (1,200) === -1200
176
- let negative = false;
177
- if (/^\(.*\)$/.test(s)) {
178
- negative = true;
179
- s = s.slice(1, -1);
180
- }
181
- // Strip currency symbols, spaces and percent — keep digits, separators, sign.
182
- s = s.replace(/[^\d.,\-+]/g, '');
183
- if (!s)
184
- return undefined;
185
- // Which separator is the decimal point?
186
- // both present → the LAST one ("1.234,5" European, "1,234.5" Anglo)
187
- // one, repeated → thousands ("1,234,567")
188
- // one, followed by exactly 3 digits → thousands ("1,200" is twelve hundred,
189
- // not 1.2 — the case that makes a lone
190
- // separator genuinely ambiguous)
191
- // otherwise → decimal ("1,5" European, "1.5" Anglo)
192
- const lastComma = s.lastIndexOf(',');
193
- const lastDot = s.lastIndexOf('.');
194
- if (lastComma !== -1 && lastDot !== -1) {
195
- if (lastComma > lastDot)
196
- s = s.replace(/\./g, '').replace(',', '.');
197
- else
198
- s = s.replace(/,/g, '');
199
- }
200
- else if (lastComma !== -1 || lastDot !== -1) {
201
- const sep = lastComma !== -1 ? ',' : '.';
202
- const occurrences = s.split(sep).length - 1;
203
- const tail = s.slice(s.lastIndexOf(sep) + 1);
204
- const isThousands = occurrences > 1 || /^\d{3}$/.test(tail);
205
- s = isThousands
206
- ? s.split(sep).join('')
207
- : s.replace(sep, '.');
208
- }
209
- const n = Number(s);
210
- if (!Number.isFinite(n))
211
- return undefined;
212
- return negative ? -n : n;
213
- }
214
- //# sourceMappingURL=expression-eval.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"expression-eval.js","sourceRoot":"","sources":["../../src/common/expression-eval.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAUH,SAAS,QAAQ,CAAC,IAAY;IAC5B,MAAM,GAAG,GAAY,EAAE,CAAC;IACxB,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC;QACpB,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;YAAC,CAAC,EAAE,CAAC;YAAC,SAAS;QAAC,CAAC;QAErC,IAAI,EAAE,KAAK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{@link AuthContext} (the principal).
5
- * The SDK never interprets `metadata` — it's an opaque claims bag (teamIds,
6
- * roles, deptId, …). Scoping is derived from the principal by host hooks.
7
- */
8
- /** The authenticated principal, produced by the host's `authenticate()` hook. */
9
- export interface AuthContext {
10
- userId: string;
11
- /** Host-defined claims — workspaceId, tenantId, teamIds, roles, etc. Opaque to the SDK. */
12
- metadata: Record<string, unknown>;
13
- }
14
- /** Verbs the scope hooks can differentiate on. Resource types extend this over time. */
15
- export type WorkflowAction = 'workflow.list' | 'workflow.read' | 'workflow.write' | 'workflow.trigger' | 'execution.list' | 'execution.read' | 'execution.write';
16
- /**
17
- * One node in the host's scope hierarchy — what the UI renders in the scope
18
- * navigator. The host (not the SDK) decides what a node represents
19
- * (department, team, project); `kind` is a display label only.
20
- */
21
- export interface ScopeNode {
22
- /** Opaque scope id — matches `WorkflowRecord.scope`. */
23
- id: string;
24
- label: string;
25
- /** Display grouping/icon hint, e.g. 'Department' | 'Team'. Not used for routing. */
26
- kind?: string;
27
- parentId?: string | null;
28
- hasChildren?: boolean;
29
- counts?: {
30
- workflows?: number;
31
- running?: number;
32
- };
33
- }
34
- /**
35
- * What the UI bootstraps from on load. Drives the scope navigator and gates
36
- * cross-scope ("admin") affordances.
37
- */
38
- export interface SessionDescriptor {
39
- userId: string;
40
- /** Top-level scopes the principal can reach. */
41
- scopes: ScopeNode[];
42
- /** Opaque capability flags, e.g. 'workflow.list.crossScope' for an admin view. */
43
- capabilities: string[];
44
- }
45
- //# sourceMappingURL=principal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"principal.d.ts","sourceRoot":"","sources":["../../src/common/principal.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,iFAAiF;AACjF,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,2FAA2F;IAC3F,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,wFAAwF;AACxF,MAAM,MAAM,cAAc,GACtB,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,kBAAkB,GAClB,gBAAgB,GAChB,gBAAgB,GAChB,iBAAiB,CAAC;AAEtB;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,wDAAwD;IACxD,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,oFAAoF;IACpF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACnD;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,kFAAkF;IAClF,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB"}
@@ -1,9 +0,0 @@
1
- /**
2
- * Principal + authorization descriptors — browser-safe shared types.
3
- *
4
- * The host authenticates a request into an {@link AuthContext} (the principal).
5
- * The SDK never interprets `metadata` — it's an opaque claims bag (teamIds,
6
- * roles, deptId, …). Scoping is derived from the principal by host hooks.
7
- */
8
- export {};
9
- //# sourceMappingURL=principal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"principal.js","sourceRoot":"","sources":["../../src/common/principal.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -1,247 +0,0 @@
1
- /**
2
- * TRANSFORM step — pure data manipulation.
3
- *
4
- * Applies a sequence of operations to the workflow context:
5
- * - set: write a value at a dotted path
6
- * - rename: move a value from one path to another
7
- * - remove: delete a value at a dotted path
8
- * - copy: copy a value from one path to another
9
- *
10
- * No services, no credentials — pure deterministic logic.
11
- */
12
- import { z } from 'zod';
13
- import { BaseActionStep } from '../base-step.js';
14
- import type { StepExecutionContext } from '../base-step.js';
15
- import { BuiltinStepType } from '../../types/known-types.js';
16
- import type { StepCategory } from '../../types/categories.js';
17
- export declare const TransformOpSchema: z.ZodDiscriminatedUnion<"op", [z.ZodObject<{
18
- op: z.ZodLiteral<"set">;
19
- path: z.ZodString;
20
- value: z.ZodUnknown;
21
- }, "strip", z.ZodTypeAny, {
22
- op: "set";
23
- path: string;
24
- value?: unknown;
25
- }, {
26
- op: "set";
27
- path: string;
28
- value?: unknown;
29
- }>, z.ZodObject<{
30
- op: z.ZodLiteral<"rename">;
31
- from: z.ZodString;
32
- to: z.ZodString;
33
- }, "strip", z.ZodTypeAny, {
34
- op: "rename";
35
- from: string;
36
- to: string;
37
- }, {
38
- op: "rename";
39
- from: string;
40
- to: string;
41
- }>, z.ZodObject<{
42
- op: z.ZodLiteral<"remove">;
43
- path: z.ZodString;
44
- }, "strip", z.ZodTypeAny, {
45
- op: "remove";
46
- path: string;
47
- }, {
48
- op: "remove";
49
- path: string;
50
- }>, z.ZodObject<{
51
- op: z.ZodLiteral<"copy">;
52
- from: z.ZodString;
53
- to: z.ZodString;
54
- }, "strip", z.ZodTypeAny, {
55
- op: "copy";
56
- from: string;
57
- to: string;
58
- }, {
59
- op: "copy";
60
- from: string;
61
- to: string;
62
- }>]>;
63
- export type TransformOp = z.infer<typeof TransformOpSchema>;
64
- export declare const TransformStepConfigSchema: z.ZodObject<{
65
- operations: z.ZodArray<z.ZodDiscriminatedUnion<"op", [z.ZodObject<{
66
- op: z.ZodLiteral<"set">;
67
- path: z.ZodString;
68
- value: z.ZodUnknown;
69
- }, "strip", z.ZodTypeAny, {
70
- op: "set";
71
- path: string;
72
- value?: unknown;
73
- }, {
74
- op: "set";
75
- path: string;
76
- value?: unknown;
77
- }>, z.ZodObject<{
78
- op: z.ZodLiteral<"rename">;
79
- from: z.ZodString;
80
- to: z.ZodString;
81
- }, "strip", z.ZodTypeAny, {
82
- op: "rename";
83
- from: string;
84
- to: string;
85
- }, {
86
- op: "rename";
87
- from: string;
88
- to: string;
89
- }>, z.ZodObject<{
90
- op: z.ZodLiteral<"remove">;
91
- path: z.ZodString;
92
- }, "strip", z.ZodTypeAny, {
93
- op: "remove";
94
- path: string;
95
- }, {
96
- op: "remove";
97
- path: string;
98
- }>, z.ZodObject<{
99
- op: z.ZodLiteral<"copy">;
100
- from: z.ZodString;
101
- to: z.ZodString;
102
- }, "strip", z.ZodTypeAny, {
103
- op: "copy";
104
- from: string;
105
- to: string;
106
- }, {
107
- op: "copy";
108
- from: string;
109
- to: string;
110
- }>]>, "many">;
111
- }, "strip", z.ZodTypeAny, {
112
- operations: ({
113
- op: "set";
114
- path: string;
115
- value?: unknown;
116
- } | {
117
- op: "rename";
118
- from: string;
119
- to: string;
120
- } | {
121
- op: "remove";
122
- path: string;
123
- } | {
124
- op: "copy";
125
- from: string;
126
- to: string;
127
- })[];
128
- }, {
129
- operations: ({
130
- op: "set";
131
- path: string;
132
- value?: unknown;
133
- } | {
134
- op: "rename";
135
- from: string;
136
- to: string;
137
- } | {
138
- op: "remove";
139
- path: string;
140
- } | {
141
- op: "copy";
142
- from: string;
143
- to: string;
144
- })[];
145
- }>;
146
- export type TransformStepConfig = z.infer<typeof TransformStepConfigSchema>;
147
- export interface TransformStepOutput extends Record<string, unknown> {
148
- applied: number;
149
- }
150
- export declare class TransformStep extends BaseActionStep<typeof TransformStepConfigSchema, TransformStepOutput> {
151
- readonly type = BuiltinStepType.TRANSFORM;
152
- readonly name = "Transform";
153
- readonly description = "Apply data transformations to the workflow context";
154
- readonly configSchema: z.ZodObject<{
155
- operations: z.ZodArray<z.ZodDiscriminatedUnion<"op", [z.ZodObject<{
156
- op: z.ZodLiteral<"set">;
157
- path: z.ZodString;
158
- value: z.ZodUnknown;
159
- }, "strip", z.ZodTypeAny, {
160
- op: "set";
161
- path: string;
162
- value?: unknown;
163
- }, {
164
- op: "set";
165
- path: string;
166
- value?: unknown;
167
- }>, z.ZodObject<{
168
- op: z.ZodLiteral<"rename">;
169
- from: z.ZodString;
170
- to: z.ZodString;
171
- }, "strip", z.ZodTypeAny, {
172
- op: "rename";
173
- from: string;
174
- to: string;
175
- }, {
176
- op: "rename";
177
- from: string;
178
- to: string;
179
- }>, z.ZodObject<{
180
- op: z.ZodLiteral<"remove">;
181
- path: z.ZodString;
182
- }, "strip", z.ZodTypeAny, {
183
- op: "remove";
184
- path: string;
185
- }, {
186
- op: "remove";
187
- path: string;
188
- }>, z.ZodObject<{
189
- op: z.ZodLiteral<"copy">;
190
- from: z.ZodString;
191
- to: z.ZodString;
192
- }, "strip", z.ZodTypeAny, {
193
- op: "copy";
194
- from: string;
195
- to: string;
196
- }, {
197
- op: "copy";
198
- from: string;
199
- to: string;
200
- }>]>, "many">;
201
- }, "strip", z.ZodTypeAny, {
202
- operations: ({
203
- op: "set";
204
- path: string;
205
- value?: unknown;
206
- } | {
207
- op: "rename";
208
- from: string;
209
- to: string;
210
- } | {
211
- op: "remove";
212
- path: string;
213
- } | {
214
- op: "copy";
215
- from: string;
216
- to: string;
217
- })[];
218
- }, {
219
- operations: ({
220
- op: "set";
221
- path: string;
222
- value?: unknown;
223
- } | {
224
- op: "rename";
225
- from: string;
226
- to: string;
227
- } | {
228
- op: "remove";
229
- path: string;
230
- } | {
231
- op: "copy";
232
- from: string;
233
- to: string;
234
- })[];
235
- }>;
236
- readonly outputSchema: z.ZodObject<{
237
- applied: z.ZodNumber;
238
- }, "strip", z.ZodTypeAny, {
239
- applied: number;
240
- }, {
241
- applied: number;
242
- }>;
243
- readonly category: StepCategory;
244
- readonly icon = "filter";
245
- execute(config: TransformStepConfig, ctx: StepExecutionContext): Promise<TransformStepOutput>;
246
- }
247
- //# sourceMappingURL=transform.step.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transform.step.d.ts","sourceRoot":"","sources":["../../../src/steps/builtin/transform.step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OA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RANSFORM step — pure data manipulation.
3
- *
4
- * Applies a sequence of operations to the workflow context:
5
- * - set: write a value at a dotted path
6
- * - rename: move a value from one path to another
7
- * - remove: delete a value at a dotted path
8
- * - copy: copy a value from one path to another
9
- *
10
- * No services, no credentials — pure deterministic logic.
11
- */
12
- import { z } from 'zod';
13
- import { BaseActionStep } from '../base-step.js';
14
- import { BuiltinStepType } from '../../types/known-types.js';
15
- import { resolvePath } from '../../engine/variable-resolver.js';
16
- // ─── Config ───
17
- const SetOpSchema = z.object({
18
- op: z.literal('set'),
19
- path: z.string().min(1).describe('Dotted path where the value will be written'),
20
- value: z.unknown().describe('Value to set at the path'),
21
- });
22
- const RenameOpSchema = z.object({
23
- op: z.literal('rename'),
24
- from: z.string().min(1).describe('Source dotted path'),
25
- to: z.string().min(1).describe('Destination dotted path'),
26
- });
27
- const RemoveOpSchema = z.object({
28
- op: z.literal('remove'),
29
- path: z.string().min(1).describe('Dotted path to delete'),
30
- });
31
- const CopyOpSchema = z.object({
32
- op: z.literal('copy'),
33
- from: z.string().min(1).describe('Source dotted path'),
34
- to: z.string().min(1).describe('Destination dotted path'),
35
- });
36
- export const TransformOpSchema = z.discriminatedUnion('op', [
37
- SetOpSchema,
38
- RenameOpSchema,
39
- RemoveOpSchema,
40
- CopyOpSchema,
41
- ]);
42
- export const TransformStepConfigSchema = z.object({
43
- operations: z.array(TransformOpSchema).min(1).describe('Sequence of data transformation operations to apply'),
44
- });
45
- const TransformStepOutputSchema = z.object({
46
- applied: z.number(),
47
- });
48
- // ─── Helpers ───
49
- /**
50
- * Set a value at a dotted path on a target object.
51
- * Creates intermediate objects as needed.
52
- */
53
- function setAtPath(target, path, value) {
54
- const parts = path.split('.');
55
- let current = target;
56
- for (let i = 0; i < parts.length - 1; i++) {
57
- const key = parts[i];
58
- if (current[key] === undefined ||
59
- current[key] === null ||
60
- typeof current[key] !== 'object') {
61
- current[key] = {};
62
- }
63
- current = current[key];
64
- }
65
- current[parts[parts.length - 1]] = value;
66
- }
67
- /**
68
- * Delete a value at a dotted path.
69
- */
70
- function deleteAtPath(target, path) {
71
- const parts = path.split('.');
72
- let current = target;
73
- for (let i = 0; i < parts.length - 1; i++) {
74
- const key = parts[i];
75
- if (current[key] === undefined ||
76
- current[key] === null ||
77
- typeof current[key] !== 'object') {
78
- return false;
79
- }
80
- current = current[key];
81
- }
82
- const lastKey = parts[parts.length - 1];
83
- if (lastKey in current) {
84
- delete current[lastKey];
85
- return true;
86
- }
87
- return false;
88
- }
89
- // ─── Step ───
90
- export class TransformStep extends BaseActionStep {
91
- type = BuiltinStepType.TRANSFORM;
92
- name = 'Transform';
93
- description = 'Apply data transformations to the workflow context';
94
- configSchema = TransformStepConfigSchema;
95
- outputSchema = TransformStepOutputSchema;
96
- category = 'data';
97
- icon = 'filter';
98
- async execute(config, ctx) {
99
- let applied = 0;
100
- // Operate on the steps record
101
- const data = ctx.workflow.steps;
102
- for (const op of config.operations) {
103
- switch (op.op) {
104
- case 'set':
105
- setAtPath(data, op.path, op.value);
106
- applied++;
107
- break;
108
- case 'rename': {
109
- const value = resolvePath(ctx.workflow, op.from);
110
- if (value !== undefined) {
111
- setAtPath(data, op.to, value);
112
- deleteAtPath(data, op.from);
113
- applied++;
114
- }
115
- break;
116
- }
117
- case 'remove':
118
- if (deleteAtPath(data, op.path)) {
119
- applied++;
120
- }
121
- break;
122
- case 'copy': {
123
- const val = resolvePath(ctx.workflow, op.from);
124
- if (val !== undefined) {
125
- setAtPath(data, op.to, val);
126
- applied++;
127
- }
128
- break;
129
- }
130
- }
131
- }
132
- return { applied };
133
- }
134
- }
135
- //# sourceMappingURL=transform.step.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transform.step.js","sourceRoot":"","sources":["../../../src/steps/builtin/transform.step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE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1
- /**
2
- * Attachment — opaque reference to a file managed by the host's StorageAdapter.
3
- *
4
- * Used everywhere the framework carries a file:
5
- * - Trigger inputs (uploaded via `POST /uploads`, attached to `context.trigger.attachments`)
6
- * - Resume payloads (uploaded with feedback in a review-gate retry)
7
- * - Step inputs (rerunFromStep with attachments in configOverrides)
8
- *
9
- * The framework never opens `data` — it's a host-defined reference (URL,
10
- * blob ID, signed token, `mem://uuid`). Steps that need the bytes call
11
- * `StorageAdapter.read()` via a service the host registers.
12
- */
13
- export interface Attachment {
14
- /** Original filename — e.g. "contract.pdf". */
15
- name: string;
16
- /** MIME type — e.g. "application/pdf", "image/png". */
17
- mimeType: string;
18
- /** Opaque host reference. Framework treats this as a string. */
19
- data: string;
20
- /** Size in bytes — set by storage after upload. Useful for UI display + size budgets. */
21
- size?: number;
22
- }
23
- //# sourceMappingURL=attachment.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../../src/types/attachment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,UAAU;IACzB,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,yFAAyF;IACzF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=attachment.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attachment.js","sourceRoot":"","sources":["../../src/types/attachment.ts"],"names":[],"mappings":""}
@@ -1,34 +0,0 @@
1
- /**
2
- * ResumePayload — the unified shape for resuming a paused execution.
3
- *
4
- * One contract for every pause type:
5
- * - Mid-execution agent pauses (tool approval, input required, user interrupted)
6
- * - Review gates (`onComplete: 'review'`)
7
- *
8
- * The router validates incoming bodies into this shape; persistence stores it
9
- * verbatim; the executor and step `onResume` handlers consume it.
10
- */
11
- import type { Attachment } from './attachment.js';
12
- /**
13
- * Alias for {@link Attachment} kept for clarity at call sites that historically
14
- * said "resume attachment". The shape is shared across the framework.
15
- */
16
- export type ResumeAttachment = Attachment;
17
- /**
18
- * What the user decided.
19
- * - `approve`: continue from a mid-pause OR advance past a review gate
20
- * - `retry`: re-execute the current step with `priorState` + `feedback` (review gate)
21
- * - `abort`: cancel the execution
22
- */
23
- export type ResumeAction = 'approve' | 'retry' | 'abort';
24
- /** Payload from the host when resuming a paused execution. */
25
- export interface ResumePayload {
26
- action: ResumeAction;
27
- /** User-provided text input (form feedback, instruction, additional context). */
28
- feedback?: string;
29
- /** Files uploaded alongside the feedback. Opaque references — host resolves. */
30
- attachments?: ResumeAttachment[];
31
- /** Step-specific extras from custom form fields. Opaque to the framework. */
32
- data?: Record<string, unknown>;
33
- }
34
- //# sourceMappingURL=resume-payload.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resume-payload.d.ts","sourceRoot":"","sources":["../../src/types/resume-payload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAEzD,8DAA8D;AAC9D,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,YAAY,CAAC;IACrB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gFAAgF;IAChF,WAAW,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACjC,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC"}
@@ -1,12 +0,0 @@
1
- /**
2
- * ResumePayload — the unified shape for resuming a paused execution.
3
- *
4
- * One contract for every pause type:
5
- * - Mid-execution agent pauses (tool approval, input required, user interrupted)
6
- * - Review gates (`onComplete: 'review'`)
7
- *
8
- * The router validates incoming bodies into this shape; persistence stores it
9
- * verbatim; the executor and step `onResume` handlers consume it.
10
- */
11
- export {};
12
- //# sourceMappingURL=resume-payload.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resume-payload.js","sourceRoot":"","sources":["../../src/types/resume-payload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
@@ -1,42 +0,0 @@
1
- /**
2
- * Executable upload safety check.
3
- *
4
- * Allow-by-default with a deny-list of known dangerous types — covers the
5
- * common attack surface (native binaries, scripts that auto-run, installers,
6
- * macro-enabled Office docs) without forcing workflow authors to enumerate
7
- * every safe MIME type.
8
- *
9
- * Two checks run in parallel so spoofed MIME types alone can't bypass:
10
- * 1. MIME type matches the deny-list
11
- * 2. Filename extension matches the deny-list
12
- *
13
- * Either match blocks the upload. To accept executables (e.g. a security-
14
- * analysis workflow that intentionally examines binaries), the host opts
15
- * in via `RuntimeOptions.allowExecutableUploads = true`.
16
- */
17
- /**
18
- * MIME types treated as executable / unsafe (lowercase — input is also
19
- * lowercased before comparison).
20
- */
21
- export declare const BLOCKED_EXECUTABLE_MIME_TYPES: ReadonlySet<string>;
22
- /**
23
- * File extensions treated as executable / unsafe (case-insensitive, no dot).
24
- * The check uses the LAST extension so `report.exe.txt` is treated as text
25
- * (Windows shows the trailing extension, which is what the user actually sees).
26
- */
27
- export declare const BLOCKED_EXECUTABLE_EXTENSIONS: ReadonlySet<string>;
28
- /**
29
- * Extract the lowercase extension (no dot) from a filename, or '' if none.
30
- * A leading dot doesn't count — `.bashrc` has no extension, not "bashrc".
31
- */
32
- export declare function extensionOf(name: string): string;
33
- /**
34
- * Returns a human-readable reason if the file should be blocked as
35
- * executable, or `null` if it's safe.
36
- *
37
- * Always check both the MIME type and the filename — clients can spoof one
38
- * but rarely both. This is defense-in-depth, not authoritative malware
39
- * detection (run real AV at the storage layer for that).
40
- */
41
- export declare function isExecutable(mimeType: string, name: string): string | null;
42
- //# sourceMappingURL=executable-check.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"executable-check.d.ts","sourceRoot":"","sources":["../../src/util/executable-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;GAGG;AACH,eAAO,MAAM,6BAA6B,EAAE,WAAW,CAAC,MAAM,CAwC5D,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,EAAE,WAAW,CAAC,MAAM,CAmB5D,CAAC;AAEH;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIhD;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAS1E"}
@@ -1,115 +0,0 @@
1
- /**
2
- * Executable upload safety check.
3
- *
4
- * Allow-by-default with a deny-list of known dangerous types — covers the
5
- * common attack surface (native binaries, scripts that auto-run, installers,
6
- * macro-enabled Office docs) without forcing workflow authors to enumerate
7
- * every safe MIME type.
8
- *
9
- * Two checks run in parallel so spoofed MIME types alone can't bypass:
10
- * 1. MIME type matches the deny-list
11
- * 2. Filename extension matches the deny-list
12
- *
13
- * Either match blocks the upload. To accept executables (e.g. a security-
14
- * analysis workflow that intentionally examines binaries), the host opts
15
- * in via `RuntimeOptions.allowExecutableUploads = true`.
16
- */
17
- /**
18
- * MIME types treated as executable / unsafe (lowercase — input is also
19
- * lowercased before comparison).
20
- */
21
- export const BLOCKED_EXECUTABLE_MIME_TYPES = new Set([
22
- // Native binaries
23
- 'application/x-msdownload',
24
- 'application/x-msdos-program',
25
- 'application/x-executable',
26
- 'application/x-mach-binary',
27
- 'application/vnd.microsoft.portable-executable',
28
- 'application/x-msi',
29
- 'application/x-ms-installer',
30
- // Shell + Windows scripts
31
- 'application/x-sh',
32
- 'application/x-shellscript',
33
- 'application/x-bat',
34
- 'application/x-csh',
35
- 'application/x-cmd',
36
- 'application/x-msmetafile',
37
- // JavaScript / ECMAScript
38
- 'text/javascript',
39
- 'application/javascript',
40
- 'application/ecmascript',
41
- 'application/x-javascript',
42
- // Java / Flash
43
- 'application/java-archive',
44
- 'application/x-java-archive',
45
- 'application/x-java-jnlp-file',
46
- 'application/x-shockwave-flash',
47
- // Installer / package formats that bundle executables
48
- 'application/vnd.android.package-archive',
49
- 'application/x-debian-package',
50
- 'application/x-rpm',
51
- // Macro-enabled Office documents (lowercased — IANA tokens are case-insensitive)
52
- 'application/vnd.ms-word.document.macroenabled.12',
53
- 'application/vnd.ms-word.template.macroenabled.12',
54
- 'application/vnd.ms-excel.sheet.macroenabled.12',
55
- 'application/vnd.ms-excel.template.macroenabled.12',
56
- 'application/vnd.ms-excel.addin.macroenabled.12',
57
- 'application/vnd.ms-excel.sheet.binary.macroenabled.12',
58
- 'application/vnd.ms-powerpoint.presentation.macroenabled.12',
59
- 'application/vnd.ms-powerpoint.template.macroenabled.12',
60
- 'application/vnd.ms-powerpoint.addin.macroenabled.12',
61
- ]);
62
- /**
63
- * File extensions treated as executable / unsafe (case-insensitive, no dot).
64
- * The check uses the LAST extension so `report.exe.txt` is treated as text
65
- * (Windows shows the trailing extension, which is what the user actually sees).
66
- */
67
- export const BLOCKED_EXECUTABLE_EXTENSIONS = new Set([
68
- // Windows
69
- 'exe', 'msi', 'com', 'scr', 'cmd', 'bat', 'ps1', 'psm1',
70
- 'vbs', 'vbe', 'wsf', 'wsh', 'hta', 'cpl', 'lnk',
71
- 'dll', 'sys', 'drv', 'ocx',
72
- // macOS / Unix
73
- 'app', 'dmg', 'pkg',
74
- 'sh', 'bash', 'zsh', 'fish', 'csh', 'ksh', 'command', 'tool',
75
- // Java / Flash
76
- 'jar', 'war', 'jnlp', 'swf',
77
- // Mobile installers
78
- 'apk', 'ipa', 'xap',
79
- // Linux installers
80
- 'deb', 'rpm', 'run', 'bin',
81
- // JavaScript (auto-executes in browser / Node contexts)
82
- 'js', 'mjs', 'cjs',
83
- // Macro-enabled Office
84
- 'docm', 'dotm', 'xlsm', 'xltm', 'xlam', 'xlsb',
85
- 'pptm', 'potm', 'ppam', 'ppsm', 'sldm',
86
- ]);
87
- /**
88
- * Extract the lowercase extension (no dot) from a filename, or '' if none.
89
- * A leading dot doesn't count — `.bashrc` has no extension, not "bashrc".
90
- */
91
- export function extensionOf(name) {
92
- const dot = name.lastIndexOf('.');
93
- if (dot <= 0 || dot === name.length - 1)
94
- return '';
95
- return name.slice(dot + 1).toLowerCase();
96
- }
97
- /**
98
- * Returns a human-readable reason if the file should be blocked as
99
- * executable, or `null` if it's safe.
100
- *
101
- * Always check both the MIME type and the filename — clients can spoof one
102
- * but rarely both. This is defense-in-depth, not authoritative malware
103
- * detection (run real AV at the storage layer for that).
104
- */
105
- export function isExecutable(mimeType, name) {
106
- if (BLOCKED_EXECUTABLE_MIME_TYPES.has(mimeType.toLowerCase())) {
107
- return `Executable MIME type "${mimeType}" is not allowed.`;
108
- }
109
- const ext = extensionOf(name);
110
- if (ext && BLOCKED_EXECUTABLE_EXTENSIONS.has(ext)) {
111
- return `Files with .${ext} extension are not allowed.`;
112
- }
113
- return null;
114
- }
115
- //# sourceMappingURL=executable-check.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"executable-check.js","sourceRoot":"","sources":["../../src/util/executable-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAwB,IAAI,GAAG,CAAC;IACxE,kBAAkB;IAClB,0BAA0B;IAC1B,6BAA6B;IAC7B,0BAA0B;IAC1B,2BAA2B;IAC3B,+CAA+C;IAC/C,mBAAmB;IACnB,4BAA4B;IAC5B,0BAA0B;IAC1B,kBAAkB;IAClB,2BAA2B;IAC3B,mBAAmB;IACnB,mBAAmB;IACnB,mBAAmB;IACnB,0BAA0B;IAC1B,0BAA0B;IAC1B,iBAAiB;IACjB,wBAAwB;IACx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