@memberjunction/ai-agents 5.38.0 → 5.39.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 (87) hide show
  1. package/dist/ArtifactToolManager.d.ts +13 -0
  2. package/dist/ArtifactToolManager.d.ts.map +1 -1
  3. package/dist/ArtifactToolManager.js +60 -1
  4. package/dist/ArtifactToolManager.js.map +1 -1
  5. package/dist/agent-run-watchdog.d.ts +109 -0
  6. package/dist/agent-run-watchdog.d.ts.map +1 -0
  7. package/dist/agent-run-watchdog.js +278 -0
  8. package/dist/agent-run-watchdog.js.map +1 -0
  9. package/dist/agent-types/loop-agent-prompt-params.d.ts +13 -0
  10. package/dist/agent-types/loop-agent-prompt-params.d.ts.map +1 -1
  11. package/dist/agent-types/loop-agent-prompt-params.js +3 -1
  12. package/dist/agent-types/loop-agent-prompt-params.js.map +1 -1
  13. package/dist/agent-types/loop-agent-response-type.d.ts +12 -3
  14. package/dist/agent-types/loop-agent-response-type.d.ts.map +1 -1
  15. package/dist/agent-types/loop-agent-response-type.js.map +1 -1
  16. package/dist/agent-types/loop-agent-type.d.ts.map +1 -1
  17. package/dist/agent-types/loop-agent-type.js +29 -1
  18. package/dist/agent-types/loop-agent-type.js.map +1 -1
  19. package/dist/artifact-tools/DataSnapshotToolLibrary.js +2 -2
  20. package/dist/artifact-tools/JSONToolLibrary.d.ts.map +1 -1
  21. package/dist/artifact-tools/JSONToolLibrary.js +7 -1
  22. package/dist/artifact-tools/JSONToolLibrary.js.map +1 -1
  23. package/dist/base-agent.d.ts +53 -1
  24. package/dist/base-agent.d.ts.map +1 -1
  25. package/dist/base-agent.js +209 -9
  26. package/dist/base-agent.js.map +1 -1
  27. package/dist/index.d.ts +2 -0
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +2 -0
  30. package/dist/index.js.map +1 -1
  31. package/dist/pipeline/coerce.d.ts +43 -0
  32. package/dist/pipeline/coerce.d.ts.map +1 -0
  33. package/dist/pipeline/coerce.js +92 -0
  34. package/dist/pipeline/coerce.js.map +1 -0
  35. package/dist/pipeline/index.d.ts +20 -0
  36. package/dist/pipeline/index.d.ts.map +1 -0
  37. package/dist/pipeline/index.js +20 -0
  38. package/dist/pipeline/index.js.map +1 -0
  39. package/dist/pipeline/jsonpath-eval.d.ts +29 -0
  40. package/dist/pipeline/jsonpath-eval.d.ts.map +1 -0
  41. package/dist/pipeline/jsonpath-eval.js +144 -0
  42. package/dist/pipeline/jsonpath-eval.js.map +1 -0
  43. package/dist/pipeline/operators.d.ts +15 -0
  44. package/dist/pipeline/operators.d.ts.map +1 -0
  45. package/dist/pipeline/operators.js +332 -0
  46. package/dist/pipeline/operators.js.map +1 -0
  47. package/dist/pipeline/path.d.ts +16 -0
  48. package/dist/pipeline/path.d.ts.map +1 -0
  49. package/dist/pipeline/path.js +34 -0
  50. package/dist/pipeline/path.js.map +1 -0
  51. package/dist/pipeline/pipeline-docs.d.ts +6 -0
  52. package/dist/pipeline/pipeline-docs.d.ts.map +1 -0
  53. package/dist/pipeline/pipeline-docs.js +137 -0
  54. package/dist/pipeline/pipeline-docs.js.map +1 -0
  55. package/dist/pipeline/pipeline-executor.d.ts +72 -0
  56. package/dist/pipeline/pipeline-executor.d.ts.map +1 -0
  57. package/dist/pipeline/pipeline-executor.js +326 -0
  58. package/dist/pipeline/pipeline-executor.js.map +1 -0
  59. package/dist/pipeline/pipeline-registry.d.ts +24 -0
  60. package/dist/pipeline/pipeline-registry.d.ts.map +1 -0
  61. package/dist/pipeline/pipeline-registry.js +28 -0
  62. package/dist/pipeline/pipeline-registry.js.map +1 -0
  63. package/dist/pipeline/pipeline.types.d.ts +89 -0
  64. package/dist/pipeline/pipeline.types.d.ts.map +1 -0
  65. package/dist/pipeline/pipeline.types.js +13 -0
  66. package/dist/pipeline/pipeline.types.js.map +1 -0
  67. package/dist/pipeline/predicate.d.ts +23 -0
  68. package/dist/pipeline/predicate.d.ts.map +1 -0
  69. package/dist/pipeline/predicate.js +306 -0
  70. package/dist/pipeline/predicate.js.map +1 -0
  71. package/dist/pipeline/providers/action-provider.d.ts +21 -0
  72. package/dist/pipeline/providers/action-provider.d.ts.map +1 -0
  73. package/dist/pipeline/providers/action-provider.js +24 -0
  74. package/dist/pipeline/providers/action-provider.js.map +1 -0
  75. package/dist/pipeline/providers/artifact-tool-provider.d.ts +20 -0
  76. package/dist/pipeline/providers/artifact-tool-provider.d.ts.map +1 -0
  77. package/dist/pipeline/providers/artifact-tool-provider.js +27 -0
  78. package/dist/pipeline/providers/artifact-tool-provider.js.map +1 -0
  79. package/dist/pipeline/providers/serialize.d.ts +23 -0
  80. package/dist/pipeline/providers/serialize.d.ts.map +1 -0
  81. package/dist/pipeline/providers/serialize.js +99 -0
  82. package/dist/pipeline/providers/serialize.js.map +1 -0
  83. package/dist/pipeline/template.d.ts +18 -0
  84. package/dist/pipeline/template.d.ts.map +1 -0
  85. package/dist/pipeline/template.js +47 -0
  86. package/dist/pipeline/template.js.map +1 -0
  87. package/package.json +19 -17
@@ -0,0 +1,306 @@
1
+ /**
2
+ * @fileoverview Safe predicate language for the `where` operator. Grammar:
3
+ *
4
+ * expr := or
5
+ * or := and ( 'or' and )*
6
+ * and := not ( 'and' not )*
7
+ * not := 'not' not | primary
8
+ * primary:= '(' expr ')' | comparison
9
+ * comparison := path OP value
10
+ * OP := '==' | '!=' | '<=' | '>=' | '<' | '>'
11
+ * | 'contains' | 'startsWith' | 'endsWith' | 'matches' | 'in'
12
+ * value := string | number | true | false | null | today | now | '[' value (',' value)* ']'
13
+ *
14
+ * Parsed with a hand-written recursive-descent parser — never `eval`'d. The `matches` operator
15
+ * compiles a user regex behind a ReDoS guard (length cap + star-height check; see {@link safeRegex});
16
+ * everything else is plain comparison. This is the security spine for LLM-authored filters.
17
+ *
18
+ * @module @memberjunction/ai-agents
19
+ */
20
+ import safeRegexCheck from 'safe-regex';
21
+ import { getValue } from './path.js';
22
+ /**
23
+ * Hard cap on the source length of a `matches` pattern. The pattern is LLM-authored, so this bounds
24
+ * the parsing surface; the real ReDoS defense is {@link safeRegex}'s star-height check below.
25
+ */
26
+ const MAX_REGEX_PATTERN_LENGTH = 200;
27
+ const SYMBOL_OPS = ['==', '!=', '<=', '>=', '<', '>'];
28
+ const WORD_OPS = ['contains', 'startsWith', 'endsWith', 'matches', 'in'];
29
+ const STOP_CHARS = new Set([' ', '\t', '\n', '=', '!', '<', '>', '(', ')', ',']);
30
+ /** Parse a predicate string into an AST. Throws with a clear message on malformed input. */
31
+ export function parsePredicate(src) {
32
+ const parser = new PredicateParser(src);
33
+ const ast = parser.ParseExpr();
34
+ parser.ExpectEnd();
35
+ return ast;
36
+ }
37
+ /** Evaluate a parsed predicate against one element. */
38
+ export function evaluatePredicate(ast, element) {
39
+ switch (ast.kind) {
40
+ case 'and':
41
+ return ast.nodes.every((n) => evaluatePredicate(n, element));
42
+ case 'or':
43
+ return ast.nodes.some((n) => evaluatePredicate(n, element));
44
+ case 'not':
45
+ return !evaluatePredicate(ast.node, element);
46
+ case 'cmp':
47
+ return evaluateComparison(ast, element);
48
+ }
49
+ }
50
+ class PredicateParser {
51
+ constructor(s) {
52
+ this.s = s;
53
+ this.pos = 0;
54
+ }
55
+ ParseExpr() {
56
+ return this.parseOr();
57
+ }
58
+ ExpectEnd() {
59
+ this.ws();
60
+ if (this.pos < this.s.length) {
61
+ throw new Error(`Unexpected "${this.s.slice(this.pos)}" in predicate`);
62
+ }
63
+ }
64
+ parseOr() {
65
+ const nodes = [this.parseAnd()];
66
+ while (this.matchWord('or')) {
67
+ nodes.push(this.parseAnd());
68
+ }
69
+ return nodes.length === 1 ? nodes[0] : { kind: 'or', nodes };
70
+ }
71
+ parseAnd() {
72
+ const nodes = [this.parseNot()];
73
+ while (this.matchWord('and')) {
74
+ nodes.push(this.parseNot());
75
+ }
76
+ return nodes.length === 1 ? nodes[0] : { kind: 'and', nodes };
77
+ }
78
+ parseNot() {
79
+ if (this.matchWord('not')) {
80
+ return { kind: 'not', node: this.parseNot() };
81
+ }
82
+ return this.parsePrimary();
83
+ }
84
+ parsePrimary() {
85
+ this.ws();
86
+ if (this.s[this.pos] === '(') {
87
+ this.pos++;
88
+ const e = this.ParseExpr();
89
+ this.ws();
90
+ if (this.s[this.pos] !== ')') {
91
+ throw new Error('Unbalanced parentheses in predicate');
92
+ }
93
+ this.pos++;
94
+ return e;
95
+ }
96
+ return this.parseComparison();
97
+ }
98
+ parseComparison() {
99
+ const path = this.scanPath();
100
+ const op = this.scanOp();
101
+ const value = op === 'in' ? this.scanArray() : this.scanValue();
102
+ return { kind: 'cmp', path, op, value };
103
+ }
104
+ scanPath() {
105
+ this.ws();
106
+ const start = this.pos;
107
+ while (this.pos < this.s.length && !STOP_CHARS.has(this.s[this.pos])) {
108
+ this.pos++;
109
+ }
110
+ const path = this.s.slice(start, this.pos);
111
+ if (!path) {
112
+ throw new Error(`Expected a field name at position ${start} in predicate`);
113
+ }
114
+ return path;
115
+ }
116
+ scanOp() {
117
+ this.ws();
118
+ for (const op of SYMBOL_OPS) {
119
+ if (this.s.startsWith(op, this.pos)) {
120
+ this.pos += op.length;
121
+ return op;
122
+ }
123
+ }
124
+ for (const op of WORD_OPS) {
125
+ if (this.matchWord(op)) {
126
+ return op;
127
+ }
128
+ }
129
+ throw new Error(`Expected a comparison operator at position ${this.pos} in predicate`);
130
+ }
131
+ scanArray() {
132
+ this.ws();
133
+ if (this.s[this.pos] !== '[') {
134
+ throw new Error('"in" expects a [list] of values');
135
+ }
136
+ this.pos++;
137
+ const items = [];
138
+ this.ws();
139
+ if (this.s[this.pos] === ']') {
140
+ this.pos++;
141
+ return items;
142
+ }
143
+ do {
144
+ items.push(this.scanValue());
145
+ this.ws();
146
+ } while (this.s[this.pos] === ',' && ++this.pos);
147
+ this.ws();
148
+ if (this.s[this.pos] !== ']') {
149
+ throw new Error('Unterminated [list] in predicate');
150
+ }
151
+ this.pos++;
152
+ return items;
153
+ }
154
+ scanValue() {
155
+ this.ws();
156
+ const c = this.s[this.pos];
157
+ if (c === "'" || c === '"') {
158
+ return this.scanString(c);
159
+ }
160
+ if (c === '-' || (c >= '0' && c <= '9')) {
161
+ return this.scanNumber();
162
+ }
163
+ const word = this.scanWord();
164
+ if (word === '') {
165
+ throw new Error(`Expected a value at position ${this.pos} in predicate`);
166
+ }
167
+ switch (word.toLowerCase()) {
168
+ case 'true':
169
+ return true;
170
+ case 'false':
171
+ return false;
172
+ case 'null':
173
+ return null;
174
+ case 'today':
175
+ return new Date().toISOString().slice(0, 10);
176
+ case 'now':
177
+ return new Date().toISOString();
178
+ default:
179
+ return word; // lenient: an unquoted bareword is treated as a string
180
+ }
181
+ }
182
+ scanString(quote) {
183
+ this.pos++; // opening quote
184
+ const start = this.pos;
185
+ while (this.pos < this.s.length && this.s[this.pos] !== quote) {
186
+ this.pos++;
187
+ }
188
+ const str = this.s.slice(start, this.pos);
189
+ if (this.s[this.pos] !== quote) {
190
+ throw new Error('Unterminated string literal in predicate');
191
+ }
192
+ this.pos++; // closing quote
193
+ return str;
194
+ }
195
+ scanNumber() {
196
+ const start = this.pos;
197
+ if (this.s[this.pos] === '-') {
198
+ this.pos++;
199
+ }
200
+ while (this.pos < this.s.length && /[0-9.]/.test(this.s[this.pos])) {
201
+ this.pos++;
202
+ }
203
+ const n = Number(this.s.slice(start, this.pos));
204
+ if (!Number.isFinite(n)) {
205
+ throw new Error(`Invalid number at position ${start} in predicate`);
206
+ }
207
+ return n;
208
+ }
209
+ scanWord() {
210
+ const start = this.pos;
211
+ while (this.pos < this.s.length && !STOP_CHARS.has(this.s[this.pos]) && this.s[this.pos] !== ']') {
212
+ this.pos++;
213
+ }
214
+ return this.s.slice(start, this.pos);
215
+ }
216
+ ws() {
217
+ while (this.pos < this.s.length && /\s/.test(this.s[this.pos])) {
218
+ this.pos++;
219
+ }
220
+ }
221
+ /** Match a whole keyword (case-insensitive) followed by a word boundary; consume on success. */
222
+ matchWord(word) {
223
+ this.ws();
224
+ const slice = this.s.slice(this.pos, this.pos + word.length);
225
+ if (slice.toLowerCase() !== word.toLowerCase()) {
226
+ return false;
227
+ }
228
+ const after = this.s[this.pos + word.length];
229
+ if (after !== undefined && !STOP_CHARS.has(after) && after !== '[') {
230
+ return false; // part of a longer identifier
231
+ }
232
+ this.pos += word.length;
233
+ return true;
234
+ }
235
+ }
236
+ function evaluateComparison(cmp, element) {
237
+ const actual = getValue(element, cmp.path) ?? null;
238
+ switch (cmp.op) {
239
+ case '==':
240
+ return looseEquals(actual, cmp.value);
241
+ case '!=':
242
+ return !looseEquals(actual, cmp.value);
243
+ case '<':
244
+ return compare(actual, cmp.value) < 0;
245
+ case '>':
246
+ return compare(actual, cmp.value) > 0;
247
+ case '<=':
248
+ return compare(actual, cmp.value) <= 0;
249
+ case '>=':
250
+ return compare(actual, cmp.value) >= 0;
251
+ case 'contains':
252
+ return Array.isArray(actual)
253
+ ? actual.some((a) => looseEquals(a, cmp.value))
254
+ : String(actual).includes(String(cmp.value));
255
+ case 'startsWith':
256
+ return String(actual).startsWith(String(cmp.value));
257
+ case 'endsWith':
258
+ return String(actual).endsWith(String(cmp.value));
259
+ case 'matches':
260
+ return safeRegex(String(cmp.value)).test(String(actual));
261
+ case 'in':
262
+ return cmp.value.some((v) => looseEquals(actual, v));
263
+ default:
264
+ return false;
265
+ }
266
+ }
267
+ function looseEquals(a, b) {
268
+ if (a === b) {
269
+ return true;
270
+ }
271
+ return String(a) === String(b);
272
+ }
273
+ /** Numeric comparison when both sides are numeric; otherwise lexicographic on their string forms. */
274
+ function compare(a, b) {
275
+ const na = Number(a);
276
+ const nb = Number(b);
277
+ if (Number.isFinite(na) && Number.isFinite(nb)) {
278
+ return na - nb;
279
+ }
280
+ const sa = String(a);
281
+ const sb = String(b);
282
+ return sa < sb ? -1 : sa > sb ? 1 : 0;
283
+ }
284
+ /**
285
+ * Compile an LLM-authored `matches` pattern into a RegExp, guarding against catastrophic
286
+ * backtracking (ReDoS). `new RegExp(pattern).test(longString)` runs synchronously on the event
287
+ * loop, so a pattern like `(a+)+$` against a long value can hang the whole Node process. We bound
288
+ * the pattern length and reject patterns whose star height > 1 (the structural source of
289
+ * exponential backtracking) via `safe-regex`. Both failure modes throw a clear, agent-facing
290
+ * message so the model can rephrase the filter rather than wedge the server.
291
+ */
292
+ function safeRegex(pattern) {
293
+ if (pattern.length > MAX_REGEX_PATTERN_LENGTH) {
294
+ throw new Error(`Regex in "matches" is too long (${pattern.length} > ${MAX_REGEX_PATTERN_LENGTH} chars). Simplify the pattern or use contains/startsWith/endsWith.`);
295
+ }
296
+ if (!safeRegexCheck(pattern)) {
297
+ throw new Error(`Regex in "matches" was rejected as unsafe (risk of catastrophic backtracking, e.g. nested quantifiers like "(a+)+"). Rewrite it without nested/overlapping repetition, or use contains/startsWith/endsWith.`);
298
+ }
299
+ try {
300
+ return new RegExp(pattern);
301
+ }
302
+ catch (e) {
303
+ throw new Error(`Invalid regex in "matches": ${e.message}`);
304
+ }
305
+ }
306
+ //# sourceMappingURL=predicate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"predicate.js","sourceRoot":"","sources":["../../src/pipeline/predicate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,cAAc,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC;;;GAGG;AACH,MAAM,wBAAwB,GAAG,GAAG,CAAC;AASrC,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACtD,MAAM,QAAQ,GAAG,CAAC,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AACzE,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,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IACnB,CAAC;IACD,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACrB,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACrB,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,SAAS,CAAC,OAAe;IAC9B,IAAI,OAAO,CAAC,MAAM,GAAG,wBAAwB,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CACX,mCAAmC,OAAO,CAAC,MAAM,MAAM,wBAAwB,oEAAoE,CACtJ,CAAC;IACN,CAAC;IACD,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CACX,6MAA6M,CAChN,CAAC;IACN,CAAC;IACD,IAAI,CAAC;QACD,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,+BAAgC,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;IAC3E,CAAC;AACL,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @fileoverview Exposes a MemberJunction Action as a pipeline capability. Execution is supplied as a
3
+ * `runner` closure by the agent (which owns the action engine + resolved action entity), so this
4
+ * file never imports base-agent. Emits the action's result as a STRUCTURED value.
5
+ *
6
+ * @module @memberjunction/ai-agents
7
+ */
8
+ import { ActionResult } from '@memberjunction/actions-base';
9
+ import { PipeValue, PipelineInvocable, PipelineStepResult } from '../pipeline.types.js';
10
+ /** Runs one already-resolved Action with the given params and returns its full result. */
11
+ export type PipelineActionRunner = (params: Record<string, unknown>) => Promise<ActionResult>;
12
+ export declare class ActionInvocable implements PipelineInvocable {
13
+ readonly toolName: string;
14
+ private readonly runner;
15
+ readonly providerKind: "Action";
16
+ /** Actions ignore the raw upstream `input` (the executor injects `pipeInto`/templates into params). */
17
+ readonly isSource = true;
18
+ constructor(toolName: string, runner: PipelineActionRunner);
19
+ invoke(_input: PipeValue, params: Record<string, unknown>): Promise<PipelineStepResult>;
20
+ }
21
+ //# sourceMappingURL=action-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-provider.d.ts","sourceRoot":"","sources":["../../../src/pipeline/providers/action-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGrF,0FAA0F;AAC1F,MAAM,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;AAE9F,qBAAa,eAAgB,YAAW,iBAAiB;aAMjC,QAAQ,EAAE,MAAM;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAN3B,SAAgB,YAAY,EAAG,QAAQ,CAAU;IACjD,uGAAuG;IACvG,SAAgB,QAAQ,QAAQ;gBAGZ,QAAQ,EAAE,MAAM,EACf,MAAM,EAAE,oBAAoB;IAGpC,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAYvG"}
@@ -0,0 +1,24 @@
1
+ import { structureActionResult } from './serialize.js';
2
+ export class ActionInvocable {
3
+ constructor(toolName, runner) {
4
+ this.toolName = toolName;
5
+ this.runner = runner;
6
+ this.providerKind = 'Action';
7
+ /** Actions ignore the raw upstream `input` (the executor injects `pipeInto`/templates into params). */
8
+ this.isSource = true;
9
+ }
10
+ async invoke(_input, params) {
11
+ try {
12
+ const result = await this.runner(params);
13
+ const logRef = { providerKind: 'Action', actionExecutionLogId: result.LogEntry?.ID };
14
+ if (!result.Success) {
15
+ return { output: null, success: false, error: result.Message ?? `Action "${this.toolName}" failed.`, logRef };
16
+ }
17
+ return { output: structureActionResult(result), success: true, logRef };
18
+ }
19
+ catch (e) {
20
+ return { output: null, success: false, error: e.message, logRef: { providerKind: 'Action' } };
21
+ }
22
+ }
23
+ }
24
+ //# sourceMappingURL=action-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-provider.js","sourceRoot":"","sources":["../../../src/pipeline/providers/action-provider.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAKpD,MAAM,OAAO,eAAe;IAKxB,YACoB,QAAgB,EACf,MAA4B;QAD7B,aAAQ,GAAR,QAAQ,CAAQ;QACf,WAAM,GAAN,MAAM,CAAsB;QANjC,iBAAY,GAAG,QAAiB,CAAC;QACjD,uGAAuG;QACvF,aAAQ,GAAG,IAAI,CAAC;IAK7B,CAAC;IAEG,KAAK,CAAC,MAAM,CAAC,MAAiB,EAAE,MAA+B;QAClE,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACzC,MAAM,MAAM,GAAG,EAAE,YAAY,EAAE,QAAiB,EAAE,oBAAoB,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE,EAAE,CAAC;YAC9F,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBAClB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,OAAO,IAAI,WAAW,IAAI,CAAC,QAAQ,WAAW,EAAE,MAAM,EAAE,CAAC;YAClH,CAAC;YACD,OAAO,EAAE,MAAM,EAAE,qBAAqB,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAC5E,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAG,CAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,CAAC;QAC7G,CAAC;IACL,CAAC;CACJ"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @fileoverview Exposes an artifact tool as a pipeline capability. The target artifact is selected at
3
+ * call time via a `params.artifactId`. Execution is a `runner` closure bound to the agent's
4
+ * ArtifactToolManager. Emits the tool's `data` as a STRUCTURED value.
5
+ *
6
+ * @module @memberjunction/ai-agents
7
+ */
8
+ import { ArtifactToolResult } from '@memberjunction/ai-core-plus';
9
+ import { PipeValue, PipelineInvocable, PipelineStepResult } from '../pipeline.types.js';
10
+ /** Runs one artifact tool (resolving the target artifact from `params.artifactId`). */
11
+ export type PipelineArtifactRunner = (toolName: string, params: Record<string, unknown>) => Promise<ArtifactToolResult>;
12
+ export declare class ArtifactToolInvocable implements PipelineInvocable {
13
+ readonly toolName: string;
14
+ private readonly runner;
15
+ readonly providerKind: "ArtifactTool";
16
+ readonly isSource = true;
17
+ constructor(toolName: string, runner: PipelineArtifactRunner);
18
+ invoke(_input: PipeValue, params: Record<string, unknown>): Promise<PipelineStepResult>;
19
+ }
20
+ //# sourceMappingURL=artifact-tool-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-tool-provider.d.ts","sourceRoot":"","sources":["../../../src/pipeline/providers/artifact-tool-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGrF,uFAAuF;AACvF,MAAM,MAAM,sBAAsB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAExH,qBAAa,qBAAsB,YAAW,iBAAiB;aAKvC,QAAQ,EAAE,MAAM;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAL3B,SAAgB,YAAY,EAAG,cAAc,CAAU;IACvD,SAAgB,QAAQ,QAAQ;gBAGZ,QAAQ,EAAE,MAAM,EACf,MAAM,EAAE,sBAAsB;IAGtC,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAgBvG"}
@@ -0,0 +1,27 @@
1
+ import { structureArtifactData } from './serialize.js';
2
+ export class ArtifactToolInvocable {
3
+ constructor(toolName, runner) {
4
+ this.toolName = toolName;
5
+ this.runner = runner;
6
+ this.providerKind = 'ArtifactTool';
7
+ this.isSource = true;
8
+ }
9
+ async invoke(_input, params) {
10
+ try {
11
+ const result = await this.runner(this.toolName, params);
12
+ if (!result.success) {
13
+ return {
14
+ output: null,
15
+ success: false,
16
+ error: result.errorMessage ?? `Artifact tool "${this.toolName}" failed.`,
17
+ logRef: { providerKind: 'ArtifactTool' },
18
+ };
19
+ }
20
+ return { output: structureArtifactData(result.data), success: true, logRef: { providerKind: 'ArtifactTool' } };
21
+ }
22
+ catch (e) {
23
+ return { output: null, success: false, error: e.message, logRef: { providerKind: 'ArtifactTool' } };
24
+ }
25
+ }
26
+ }
27
+ //# sourceMappingURL=artifact-tool-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-tool-provider.js","sourceRoot":"","sources":["../../../src/pipeline/providers/artifact-tool-provider.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAKpD,MAAM,OAAO,qBAAqB;IAI9B,YACoB,QAAgB,EACf,MAA8B;QAD/B,aAAQ,GAAR,QAAQ,CAAQ;QACf,WAAM,GAAN,MAAM,CAAwB;QALnC,iBAAY,GAAG,cAAuB,CAAC;QACvC,aAAQ,GAAG,IAAI,CAAC;IAK7B,CAAC;IAEG,KAAK,CAAC,MAAM,CAAC,MAAiB,EAAE,MAA+B;QAClE,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YACxD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBAClB,OAAO;oBACH,MAAM,EAAE,IAAI;oBACZ,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,MAAM,CAAC,YAAY,IAAI,kBAAkB,IAAI,CAAC,QAAQ,WAAW;oBACxE,MAAM,EAAE,EAAE,YAAY,EAAE,cAAc,EAAE;iBAC3C,CAAC;YACN,CAAC;YACD,OAAO,EAAE,MAAM,EAAE,qBAAqB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE,CAAC;QACnH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAG,CAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE,CAAC;QACnH,CAAC;IACL,CAAC;CACJ"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @fileoverview Adapters that turn each capability's native result into a structured {@link PipeValue}.
3
+ * The whole point of the object model: do NOT stringify here — emit the structure so downstream
4
+ * operators can bind to properties.
5
+ *
6
+ * @module @memberjunction/ai-agents
7
+ */
8
+ import { ActionResult } from '@memberjunction/actions-base';
9
+ import { PipeValue } from '../pipeline.types.js';
10
+ /**
11
+ * Structure an Action's output as a value: one output param → its value; many → an object keyed by
12
+ * name; none → the Message. String values that are clearly JSON are parsed so structured operators
13
+ * work on real action payloads (e.g. a RunView that returns its rows as a JSON string).
14
+ */
15
+ export declare function structureActionResult(result: ActionResult): PipeValue;
16
+ /**
17
+ * Structure arbitrary artifact-tool `data` as a value. `get_full` returns a
18
+ * `{ content, encoding, sizeBytes }` envelope — unwrap it to the real content (parsing JSON text)
19
+ * so a `get_full` source composes directly with the operators (`where`/`select`/…). Other tools
20
+ * return their data directly.
21
+ */
22
+ export declare function structureArtifactData(data: unknown): PipeValue;
23
+ //# sourceMappingURL=serialize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../../src/pipeline/providers/serialize.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,CAYrE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,CAa9D"}
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Structure an Action's output as a value: one output param → its value; many → an object keyed by
3
+ * name; none → the Message. String values that are clearly JSON are parsed so structured operators
4
+ * work on real action payloads (e.g. a RunView that returns its rows as a JSON string).
5
+ */
6
+ export function structureActionResult(result) {
7
+ const outputs = (result.Params ?? []).filter((p) => p.Type === 'Output');
8
+ if (outputs.length === 1) {
9
+ return coerceMaybeJson(outputs[0].Value);
10
+ }
11
+ if (outputs.length > 1) {
12
+ return outputs.reduce((acc, p) => {
13
+ acc[p.Name] = coerceMaybeJson(p.Value);
14
+ return acc;
15
+ }, {});
16
+ }
17
+ return result.Message ?? null;
18
+ }
19
+ /**
20
+ * Structure arbitrary artifact-tool `data` as a value. `get_full` returns a
21
+ * `{ content, encoding, sizeBytes }` envelope — unwrap it to the real content (parsing JSON text)
22
+ * so a `get_full` source composes directly with the operators (`where`/`select`/…). Other tools
23
+ * return their data directly.
24
+ */
25
+ export function structureArtifactData(data) {
26
+ if (isGetFullEnvelope(data)) {
27
+ const env = data;
28
+ if (typeof env.content === 'string' && env.encoding !== 'base64') {
29
+ return coerceMaybeJson(env.content);
30
+ }
31
+ return env.content; // base64/binary — leave as-is
32
+ }
33
+ const rows = unwrapRowsEnvelope(data);
34
+ if (rows !== undefined) {
35
+ return rows;
36
+ }
37
+ return coerceMaybeJson(data);
38
+ }
39
+ /**
40
+ * Tabular artifact tools (`get_rows` on CSV / Excel / Data Snapshot / Search Result Set) wrap their
41
+ * rows in an envelope — `{ rows: [...], total, ... }`. Object-aware operators (`where`/`select`/
42
+ * `distinct`/`sort`) need a bare array, so unwrap to the rows array directly: the agent shouldn't
43
+ * have to know the envelope shape and lead every tabular pipeline with `{ "jsonpath": "$.rows[*]" }`.
44
+ *
45
+ * Pagination metadata (`total`/`totalRows`/`truncated`) is intentionally dropped from the pipe — the
46
+ * agent controls paging via the tool's own `start`/`count` params, not by reading it back mid-flow.
47
+ *
48
+ * Returns `undefined` (not unwrapped) when `data` isn't a rows-envelope, so the caller falls through.
49
+ */
50
+ function unwrapRowsEnvelope(data) {
51
+ if (data !== null &&
52
+ typeof data === 'object' &&
53
+ !Array.isArray(data) &&
54
+ Array.isArray(data.rows)) {
55
+ return data.rows;
56
+ }
57
+ return undefined;
58
+ }
59
+ function isGetFullEnvelope(d) {
60
+ return (d !== null &&
61
+ typeof d === 'object' &&
62
+ !Array.isArray(d) &&
63
+ 'content' in d &&
64
+ 'sizeBytes' in d);
65
+ }
66
+ /**
67
+ * Pass values through; parse strings that are *clearly* a JSON object/array so structured operators
68
+ * can bind to them (e.g. an Action that returns its rows as a JSON string).
69
+ *
70
+ * Deliberately conservative: we only attempt a parse when the trimmed string both opens AND closes
71
+ * with matching JSON delimiters (`{…}` / `[…]`) AND the parse yields an object/array. This avoids
72
+ * mis-parsing prose like `"[Note: see attached]"` or `"{TBD}"` (a leading bracket alone isn't enough),
73
+ * and never coerces a bare JSON scalar (`"42"`, `"true"`) — those stay strings. A string that isn't
74
+ * unambiguously a JSON container is returned verbatim.
75
+ *
76
+ * Known nuance: an Action returning structured data vs. the same data as a JSON string still converge
77
+ * here by design (that's the point — operators shouldn't care which). What we will NOT do is guess at
78
+ * partial/ambiguous text.
79
+ */
80
+ function coerceMaybeJson(v) {
81
+ if (typeof v !== 'string') {
82
+ return v;
83
+ }
84
+ const t = v.trim();
85
+ const looksLikeContainer = (t.startsWith('{') && t.endsWith('}')) || (t.startsWith('[') && t.endsWith(']'));
86
+ if (!looksLikeContainer) {
87
+ return v;
88
+ }
89
+ try {
90
+ const parsed = JSON.parse(t);
91
+ // Only treat it as structured if it actually parsed to an object/array — never a coincidental
92
+ // scalar — otherwise hand back the original string untouched.
93
+ return parsed !== null && typeof parsed === 'object' ? parsed : v;
94
+ }
95
+ catch {
96
+ return v;
97
+ }
98
+ }
99
+ //# sourceMappingURL=serialize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../../src/pipeline/providers/serialize.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAoB;IACtD,MAAM,OAAO,GAAG,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;IACzE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,OAAO,OAAO,CAAC,MAAM,CAA6B,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;YACzD,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC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IAAK,CAAY,CAC/B,CAAC;AACN,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAS,eAAe,CAAC,CAAU;IAC/B,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;QACxB,OAAO,CAAc,CAAC;IAC1B,CAAC;IACD,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACnB,MAAM,kBAAkB,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5G,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACtB,OAAO,CAAC,CAAC;IACb,CAAC;IACD,IAAI,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAc,CAAC;QAC1C,8FAA8F;QAC9F,8DAA8D;QAC9D,OAAO,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACtE,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,CAAC,CAAC;IACb,CAAC;AACL,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @fileoverview `{{ path }}` templating for `tool` stage params. Resolves against a scope of named
3
+ * bindings: `$` is the current upstream value, plus any `map` element binding (e.g. `row`) or `let`
4
+ * binding. Paths use the shared field-path grammar (no eval).
5
+ *
6
+ * - A param whose value is exactly one `{{ path }}` resolves to the RAW value (object/number/array).
7
+ * - A param with embedded `{{ path }}` inside other text does string interpolation (coerced to text).
8
+ *
9
+ * @module @memberjunction/ai-agents
10
+ */
11
+ import { PipeValue } from './pipeline.types.js';
12
+ /** Binding scope: `$` = current upstream value; other keys = map/let bindings. */
13
+ export type TemplateScope = Record<string, PipeValue>;
14
+ /** Recursively resolve templates in a tool's `with` params object. */
15
+ export declare function resolveParams(params: Record<string, unknown>, scope: TemplateScope): Record<string, unknown>;
16
+ /** Resolve a scoped path like `row.Email` or `$.Results[0].Name`. Throws on an unknown binding. */
17
+ export declare function resolvePath(path: string, scope: TemplateScope): PipeValue | undefined;
18
+ //# sourceMappingURL=template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/pipeline/template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAI7C,kFAAkF;AAClF,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAKtD,sEAAsE;AACtE,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE5G;AAuBD,mGAAmG;AACnG,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,GAAG,SAAS,GAAG,SAAS,CAiBrF"}
@@ -0,0 +1,47 @@
1
+ import { getValue } from './path.js';
2
+ import { valueToText } from './coerce.js';
3
+ const WHOLE = /^\s*\{\{\s*([^}]+?)\s*\}\}\s*$/;
4
+ const EMBEDDED = /\{\{\s*([^}]+?)\s*\}\}/g;
5
+ /** Recursively resolve templates in a tool's `with` params object. */
6
+ export function resolveParams(params, scope) {
7
+ return resolveValue(params, scope);
8
+ }
9
+ function resolveValue(value, scope) {
10
+ if (typeof value === 'string') {
11
+ return resolveString(value, scope);
12
+ }
13
+ if (Array.isArray(value)) {
14
+ return value.map((v) => resolveValue(v, scope));
15
+ }
16
+ if (value !== null && typeof value === 'object') {
17
+ return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, resolveValue(v, scope)]));
18
+ }
19
+ return value;
20
+ }
21
+ function resolveString(s, scope) {
22
+ const whole = WHOLE.exec(s);
23
+ if (whole) {
24
+ return resolvePath(whole[1], scope); // raw value
25
+ }
26
+ return s.replace(EMBEDDED, (_m, path) => valueToText(resolvePath(path, scope) ?? null));
27
+ }
28
+ /** Resolve a scoped path like `row.Email` or `$.Results[0].Name`. Throws on an unknown binding. */
29
+ export function resolvePath(path, scope) {
30
+ const trimmed = path.trim();
31
+ const varMatch = /^[A-Za-z_$][A-Za-z0-9_]*/.exec(trimmed);
32
+ if (!varMatch) {
33
+ throw new Error(`Invalid template path "{{${path}}}"`);
34
+ }
35
+ const varName = varMatch[0];
36
+ if (!(varName in scope)) {
37
+ const available = Object.keys(scope).join(', ');
38
+ throw new Error(`Unknown binding "${varName}" in {{${path}}}. Available: ${available}`);
39
+ }
40
+ const root = scope[varName];
41
+ let rest = trimmed.slice(varName.length);
42
+ if (rest.startsWith('.')) {
43
+ rest = rest.slice(1);
44
+ }
45
+ return rest === '' ? root : getValue(root, rest);
46
+ }
47
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/pipeline/template.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAKvC,MAAM,KAAK,GAAG,gCAAgC,CAAC;AAC/C,MAAM,QAAQ,GAAG,yBAAyB,CAAC;AAE3C,sEAAsE;AACtE,MAAM,UAAU,aAAa,CAAC,MAA+B,EAAE,KAAoB;IAC/E,OAAO,YAAY,CAAC,MAAM,EAAE,KAAK,CAA4B,CAAC;AAClE,CAAC;AAED,SAAS,YAAY,CAAC,KAAc,EAAE,KAAoB;IACtD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;IACD,IAAI,KAAK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