@xyne/workflow-sdk 3.2.45 → 3.2.47
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.
- package/dist/agents/agent-step.d.ts +5 -5
- package/dist/agents/contract.d.ts +5 -5
- package/dist/agents/host-agent-step.d.ts +7 -7
- package/dist/agents/pi-session-runtime.d.ts +4 -4
- package/dist/common/credentials.d.ts +43 -0
- package/dist/common/credentials.d.ts.map +1 -1
- package/dist/common/credentials.js +34 -0
- package/dist/common/credentials.js.map +1 -1
- package/dist/connectors/builtin/builtin-connector.d.ts +1 -1
- package/dist/connectors/builtin/builtin-connector.d.ts.map +1 -1
- package/dist/connectors/builtin/builtin-connector.js +6 -4
- package/dist/connectors/builtin/builtin-connector.js.map +1 -1
- package/dist/connectors/builtin/credentials.d.ts +8 -0
- package/dist/connectors/builtin/credentials.d.ts.map +1 -1
- package/dist/connectors/builtin/credentials.js +14 -0
- package/dist/connectors/builtin/credentials.js.map +1 -1
- package/dist/connectors/builtin/steps/classifier-agent.step.d.ts +176 -0
- package/dist/connectors/builtin/steps/classifier-agent.step.d.ts.map +1 -0
- package/dist/connectors/builtin/steps/classifier-agent.step.js +248 -0
- package/dist/connectors/builtin/steps/classifier-agent.step.js.map +1 -0
- package/dist/connectors/builtin/steps/cycle.step.d.ts +4 -4
- package/dist/connectors/builtin/steps/http-request.step.d.ts +4 -4
- package/dist/connectors/builtin/steps/map.step.d.ts +15 -4
- package/dist/connectors/builtin/steps/map.step.d.ts.map +1 -1
- package/dist/connectors/builtin/steps/map.step.js +51 -18
- package/dist/connectors/builtin/steps/map.step.js.map +1 -1
- package/dist/connectors/builtin/steps/parallel.step.d.ts +4 -4
- package/dist/conversational-flow/create.d.ts +15 -2
- package/dist/conversational-flow/create.d.ts.map +1 -1
- package/dist/conversational-flow/create.js +29 -10
- package/dist/conversational-flow/create.js.map +1 -1
- package/dist/conversational-flow/edit.d.ts +21 -20
- package/dist/conversational-flow/edit.d.ts.map +1 -1
- package/dist/conversational-flow/edit.js +204 -286
- package/dist/conversational-flow/edit.js.map +1 -1
- package/dist/conversational-flow/index.d.ts +8 -3
- package/dist/conversational-flow/index.d.ts.map +1 -1
- package/dist/conversational-flow/index.js +7 -2
- package/dist/conversational-flow/index.js.map +1 -1
- package/dist/conversational-flow/internals.d.ts +51 -0
- package/dist/conversational-flow/internals.d.ts.map +1 -0
- package/dist/conversational-flow/internals.js +163 -0
- package/dist/conversational-flow/internals.js.map +1 -0
- package/dist/conversational-flow/lookup-edit.d.ts +96 -0
- package/dist/conversational-flow/lookup-edit.d.ts.map +1 -0
- package/dist/conversational-flow/lookup-edit.js +266 -0
- package/dist/conversational-flow/lookup-edit.js.map +1 -0
- package/dist/conversational-flow/lookups.d.ts +46 -0
- package/dist/conversational-flow/lookups.d.ts.map +1 -0
- package/dist/conversational-flow/lookups.js +145 -0
- package/dist/conversational-flow/lookups.js.map +1 -0
- package/dist/conversational-flow/read.d.ts.map +1 -1
- package/dist/conversational-flow/read.js +48 -7
- package/dist/conversational-flow/read.js.map +1 -1
- package/dist/conversational-flow/router-edit.d.ts +53 -0
- package/dist/conversational-flow/router-edit.d.ts.map +1 -0
- package/dist/conversational-flow/router-edit.js +191 -0
- package/dist/conversational-flow/router-edit.js.map +1 -0
- package/dist/conversational-flow/routers.d.ts +92 -0
- package/dist/conversational-flow/routers.d.ts.map +1 -0
- package/dist/conversational-flow/routers.js +286 -0
- package/dist/conversational-flow/routers.js.map +1 -0
- package/dist/conversational-flow/settle.d.ts +26 -0
- package/dist/conversational-flow/settle.d.ts.map +1 -0
- package/dist/conversational-flow/settle.js +59 -0
- package/dist/conversational-flow/settle.js.map +1 -0
- package/dist/conversational-flow/tree.d.ts +15 -1
- package/dist/conversational-flow/tree.d.ts.map +1 -1
- package/dist/conversational-flow/tree.js +28 -0
- package/dist/conversational-flow/tree.js.map +1 -1
- package/dist/conversational-flow/turn.d.ts +2 -0
- package/dist/conversational-flow/turn.d.ts.map +1 -1
- package/dist/conversational-flow/turn.js +26 -7
- package/dist/conversational-flow/turn.js.map +1 -1
- package/dist/conversational-flow/types.d.ts +50 -3
- package/dist/conversational-flow/types.d.ts.map +1 -1
- package/dist/conversational-flow/types.js +35 -0
- package/dist/conversational-flow/types.js.map +1 -1
- package/dist/engine/config-validator.js +2 -2
- package/dist/engine/config-validator.js.map +1 -1
- package/dist/engine/variable-resolver.js +1 -1
- package/dist/engine/variable-resolver.js.map +1 -1
- package/dist/engine/workflow-executor.d.ts.map +1 -1
- package/dist/engine/workflow-executor.js +10 -0
- package/dist/engine/workflow-executor.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/runtime/workflow-runtime.d.ts.map +1 -1
- package/dist/runtime/workflow-runtime.js +3 -0
- package/dist/runtime/workflow-runtime.js.map +1 -1
- package/dist/steps/base-step.d.ts.map +1 -1
- package/dist/steps/base-step.js +1 -0
- package/dist/steps/base-step.js.map +1 -1
- package/dist/testing/mock-context.d.ts.map +1 -1
- package/dist/testing/mock-context.js +1 -0
- package/dist/testing/mock-context.js.map +1 -1
- package/dist/types/context.d.ts +15 -0
- package/dist/types/context.d.ts.map +1 -1
- package/dist/types/known-types.d.ts +1 -0
- package/dist/types/known-types.d.ts.map +1 -1
- package/dist/types/known-types.js +1 -0
- package/dist/types/known-types.js.map +1 -1
- package/dist/util/variable-ref.d.ts +1 -1
- package/dist/util/variable-ref.d.ts.map +1 -1
- package/dist/util/variable-ref.js +1 -1
- package/dist/util/variable-ref.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLASSIFIER_AGENT — put something in one of the classes you name, with a
|
|
3
|
+
* measure of how sure the model was.
|
|
4
|
+
*
|
|
5
|
+
* ## What it is not
|
|
6
|
+
*
|
|
7
|
+
* Despite the name it has nothing in common with `RUN_AGENT`: no session, no
|
|
8
|
+
* tools, no streaming, no turns, nothing kept between runs. It is one HTTP call
|
|
9
|
+
* that sends the thing to classify and the classes, and returns one of them.
|
|
10
|
+
* The step does not act on the answer — a CONDITIONAL, SWITCH or GO_TO after it
|
|
11
|
+
* does.
|
|
12
|
+
*
|
|
13
|
+
* ## The model behind it
|
|
14
|
+
*
|
|
15
|
+
* A "System One" model: one that answers typed questions rather than writing
|
|
16
|
+
* prose. TypeSafe's Jev is one; any endpoint speaking the same contract is
|
|
17
|
+
* another, which is why the endpoint is configuration and no vendor is named in
|
|
18
|
+
* the code.
|
|
19
|
+
*
|
|
20
|
+
* POST <endpoint> Authorization: Bearer <key>
|
|
21
|
+
* { "model": "<model>", "state": <what to classify>,
|
|
22
|
+
* "questions": { "class": { "type": "choice",
|
|
23
|
+
* "instructions": "<the question>",
|
|
24
|
+
* "criteria": { "<class>": "<what it means>" } } } }
|
|
25
|
+
*
|
|
26
|
+
* → { "answers": { "class": { "choice": "…", "probabilities": { … },
|
|
27
|
+
* "confidence": 0.74 } }, "usage": { … } }
|
|
28
|
+
*
|
|
29
|
+
* ## Confidence
|
|
30
|
+
*
|
|
31
|
+
* `confidence` is how concentrated the probabilities are: one clear peak is
|
|
32
|
+
* high, a flat spread is low. Set `minConfidence` with a `fallbackClass` and a
|
|
33
|
+
* shaky answer becomes that class instead — so a flow can ask again rather than
|
|
34
|
+
* act on a guess. `belowConfidence` says it happened; `probabilities` always
|
|
35
|
+
* carries what the model actually thought.
|
|
36
|
+
*/
|
|
37
|
+
import { z } from 'zod';
|
|
38
|
+
import { BaseActionStep } from '../../../steps/base-step.js';
|
|
39
|
+
import { BuiltinStepType } from '../../../types/known-types.js';
|
|
40
|
+
import { BUILTIN_ENDPOINT_KEY } from '../credentials.js';
|
|
41
|
+
import { markCredentialField } from '../../../util/credential-slot-schema.js';
|
|
42
|
+
import { applyResolvedCredentialAuth, CredentialNameSchema } from '../../../common/credentials.js';
|
|
43
|
+
import { variableRef } from '../../../types/workflow-config.js';
|
|
44
|
+
import { assertPublicHttpUrl } from './ssrf-guard.js';
|
|
45
|
+
import { DEFAULT_CLASSIFIER_ENDPOINT } from '../../../conversational-flow/types.js';
|
|
46
|
+
export { DEFAULT_CLASSIFIER_ENDPOINT } from '../../../conversational-flow/types.js';
|
|
47
|
+
/** The one question this step asks, and the field its answer comes back under. */
|
|
48
|
+
const QUESTION = 'class';
|
|
49
|
+
/** Answers worth trying again: rate limited, and overloaded. */
|
|
50
|
+
const RETRY_STATUS = new Set([429, 529]);
|
|
51
|
+
// ─── Config ───
|
|
52
|
+
export const ClassifierAgentStepConfigSchema = z.object({
|
|
53
|
+
input: z
|
|
54
|
+
.union([z.string(), z.record(z.string(), z.unknown()), z.array(z.unknown())])
|
|
55
|
+
.describe('What to classify — the message, or an object of everything the model should weigh. Supports {{variable}} refs'),
|
|
56
|
+
instructions: z
|
|
57
|
+
.string()
|
|
58
|
+
.min(1)
|
|
59
|
+
.describe('The question put to the model, e.g. "Which screen answers this message?"'),
|
|
60
|
+
classes: z
|
|
61
|
+
.record(z.string().min(1), z.string().min(1))
|
|
62
|
+
.describe('The classes to choose between: each key is what the step answers, each value describes when it applies. The description is what the model reads, so write it for a reader who has never seen this flow'),
|
|
63
|
+
model: z.string().min(1).default('jev-latest').describe('Model id at that endpoint'),
|
|
64
|
+
credentialName: variableRef(CredentialNameSchema.describe('The service to ask: an “Endpoint & API key” credential holding where it lives and the key it takes. Without one, the default endpoint is called unauthenticated')).optional(),
|
|
65
|
+
minConfidence: z
|
|
66
|
+
.number()
|
|
67
|
+
.min(0)
|
|
68
|
+
.max(1)
|
|
69
|
+
.optional()
|
|
70
|
+
.describe('Below this, answer `fallbackClass` instead of the model\'s pick — so the flow can ask again rather than act on a guess'),
|
|
71
|
+
fallbackClass: z
|
|
72
|
+
.string()
|
|
73
|
+
.min(1)
|
|
74
|
+
.optional()
|
|
75
|
+
.describe('What to answer when the model is less sure than `minConfidence`. Needs `minConfidence`'),
|
|
76
|
+
timeoutMs: z.number().int().positive().default(15_000).describe('How long to wait for the answer'),
|
|
77
|
+
maxAttempts: z.number().int().min(1).max(5).default(3).describe('Attempts when the service is rate limited or overloaded'),
|
|
78
|
+
});
|
|
79
|
+
// ─── Output ───
|
|
80
|
+
const ClassifierAgentStepOutputSchema = z.object({
|
|
81
|
+
class: z.string(),
|
|
82
|
+
confidence: z.number(),
|
|
83
|
+
probabilities: z.record(z.string(), z.number()),
|
|
84
|
+
belowConfidence: z.boolean(),
|
|
85
|
+
model: z.string(),
|
|
86
|
+
usage: z.object({ inputTokens: z.number(), outputTokens: z.number() }),
|
|
87
|
+
});
|
|
88
|
+
// ─── Step ───
|
|
89
|
+
export class ClassifierAgentStep extends BaseActionStep {
|
|
90
|
+
type = BuiltinStepType.CLASSIFIER_AGENT;
|
|
91
|
+
name = 'Classifier';
|
|
92
|
+
description = 'Put something in one of the classes you name — which screen answers a message, which team a ticket belongs to — and say how sure the model was';
|
|
93
|
+
configSchema = ClassifierAgentStepConfigSchema;
|
|
94
|
+
outputSchema = ClassifierAgentStepOutputSchema;
|
|
95
|
+
category = 'integration';
|
|
96
|
+
icon = 'list-tree';
|
|
97
|
+
credentialSlots = [{ name: 'credentialName', required: false }];
|
|
98
|
+
/** Where the model lives and the key it takes — both from the credential. */
|
|
99
|
+
credential = [BUILTIN_ENDPOINT_KEY];
|
|
100
|
+
decorateConfigSchema(jsonSchema) {
|
|
101
|
+
const props = jsonSchema['properties'];
|
|
102
|
+
if (props?.['credentialName']) {
|
|
103
|
+
props['credentialName'] = markCredentialField(props['credentialName'], this.credential);
|
|
104
|
+
}
|
|
105
|
+
return jsonSchema;
|
|
106
|
+
}
|
|
107
|
+
/** `class` is one of the configured classes, so downstream pickers offer them. */
|
|
108
|
+
resolveOutputJsonSchema(config) {
|
|
109
|
+
const classes = config['classes'];
|
|
110
|
+
const names = classes && typeof classes === 'object' && !Array.isArray(classes) ? Object.keys(classes) : [];
|
|
111
|
+
const fallback = typeof config['fallbackClass'] === 'string' ? config['fallbackClass'] : undefined;
|
|
112
|
+
const values = [...new Set([...names, ...(fallback ? [fallback] : [])])];
|
|
113
|
+
return {
|
|
114
|
+
type: 'object',
|
|
115
|
+
properties: {
|
|
116
|
+
class: values.length > 0 ? { type: 'string', enum: values } : { type: 'string' },
|
|
117
|
+
confidence: { type: 'number' },
|
|
118
|
+
probabilities: { type: 'object', additionalProperties: { type: 'number' } },
|
|
119
|
+
belowConfidence: { type: 'boolean' },
|
|
120
|
+
model: { type: 'string' },
|
|
121
|
+
usage: {
|
|
122
|
+
type: 'object',
|
|
123
|
+
properties: { inputTokens: { type: 'number' }, outputTokens: { type: 'number' } },
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
async execute(config, ctx) {
|
|
129
|
+
const names = Object.keys(config.classes);
|
|
130
|
+
if (names.length < 2) {
|
|
131
|
+
throw new Error('CLASSIFIER_AGENT needs at least two classes to choose between.');
|
|
132
|
+
}
|
|
133
|
+
if (config.fallbackClass !== undefined && config.minConfidence === undefined) {
|
|
134
|
+
throw new Error('CLASSIFIER_AGENT: `fallbackClass` needs `minConfidence` to say when to use it.');
|
|
135
|
+
}
|
|
136
|
+
// Where to ask and the key to ask with both come from the credential, so a
|
|
137
|
+
// workflow moves between services without being edited.
|
|
138
|
+
const credential = ctx.credentials['credentialName'];
|
|
139
|
+
const endpoint = credential?.authType === 'endpoint_key' ? credential.values.endpoint : DEFAULT_CLASSIFIER_ENDPOINT;
|
|
140
|
+
await assertPublicHttpUrl(endpoint);
|
|
141
|
+
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
142
|
+
if (credential)
|
|
143
|
+
applyResolvedCredentialAuth(headers, credential);
|
|
144
|
+
const body = JSON.stringify({
|
|
145
|
+
model: config.model,
|
|
146
|
+
state: config.input,
|
|
147
|
+
questions: {
|
|
148
|
+
[QUESTION]: { type: 'choice', instructions: config.instructions, criteria: config.classes },
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
const answer = await this.ask(config, endpoint, headers, body);
|
|
152
|
+
const chosen = str(answer['choice']);
|
|
153
|
+
if (!chosen)
|
|
154
|
+
throw new Error('CLASSIFIER_AGENT: the service answered without a choice.');
|
|
155
|
+
const confidence = num(answer['confidence']) ?? 0;
|
|
156
|
+
const below = config.minConfidence !== undefined && confidence < config.minConfidence;
|
|
157
|
+
return {
|
|
158
|
+
class: below && config.fallbackClass ? config.fallbackClass : chosen,
|
|
159
|
+
confidence,
|
|
160
|
+
probabilities: numbers(answer['probabilities']),
|
|
161
|
+
belowConfidence: below,
|
|
162
|
+
model: str(answer['__model']) ?? config.model,
|
|
163
|
+
usage: { inputTokens: num(answer['__inputTokens']) ?? 0, outputTokens: num(answer['__outputTokens']) ?? 0 },
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
/** One call, retried while the service says it is busy. */
|
|
167
|
+
async ask(config, endpoint, headers, body) {
|
|
168
|
+
let lastBusy = '';
|
|
169
|
+
for (let attempt = 1; attempt <= config.maxAttempts; attempt++) {
|
|
170
|
+
const controller = new AbortController();
|
|
171
|
+
const timer = setTimeout(() => controller.abort(), config.timeoutMs);
|
|
172
|
+
let response;
|
|
173
|
+
try {
|
|
174
|
+
response = await fetch(endpoint, { method: 'POST', headers, body, signal: controller.signal });
|
|
175
|
+
}
|
|
176
|
+
catch (err) {
|
|
177
|
+
clearTimeout(timer);
|
|
178
|
+
if (err instanceof DOMException && err.name === 'AbortError') {
|
|
179
|
+
throw new Error(`CLASSIFIER_AGENT timed out after ${String(config.timeoutMs)}ms`);
|
|
180
|
+
}
|
|
181
|
+
throw err;
|
|
182
|
+
}
|
|
183
|
+
clearTimeout(timer);
|
|
184
|
+
const text = await response.text();
|
|
185
|
+
if (response.ok)
|
|
186
|
+
return flatten(text);
|
|
187
|
+
// The service's own message, which says what it disliked.
|
|
188
|
+
const message = detail(text) ?? `${String(response.status)} ${response.statusText}`;
|
|
189
|
+
if (!RETRY_STATUS.has(response.status) || attempt === config.maxAttempts) {
|
|
190
|
+
throw new Error(`CLASSIFIER_AGENT: ${message}`);
|
|
191
|
+
}
|
|
192
|
+
lastBusy = message;
|
|
193
|
+
await sleep(200 * 2 ** (attempt - 1));
|
|
194
|
+
}
|
|
195
|
+
throw new Error(`CLASSIFIER_AGENT: ${lastBusy}`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
// ─── Reading the answer ───
|
|
199
|
+
/** The answer to our one question, with the response's own model and usage alongside. */
|
|
200
|
+
function flatten(text) {
|
|
201
|
+
let parsed;
|
|
202
|
+
try {
|
|
203
|
+
parsed = JSON.parse(text);
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
throw new Error('CLASSIFIER_AGENT: the service answered with something that is not JSON.');
|
|
207
|
+
}
|
|
208
|
+
const body = rec(parsed);
|
|
209
|
+
const answer = rec(rec(body['answers'])[QUESTION]);
|
|
210
|
+
const usage = rec(body['usage']);
|
|
211
|
+
return {
|
|
212
|
+
...answer,
|
|
213
|
+
__model: body['model'],
|
|
214
|
+
__inputTokens: usage['input_tokens'],
|
|
215
|
+
__outputTokens: usage['output_tokens'],
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
function detail(text) {
|
|
219
|
+
try {
|
|
220
|
+
const body = rec(JSON.parse(text));
|
|
221
|
+
return str(body['message']) ?? str(body['error']) ?? str(body['detail']);
|
|
222
|
+
}
|
|
223
|
+
catch {
|
|
224
|
+
return text.trim() ? text.trim().slice(0, 300) : undefined;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
function sleep(ms) {
|
|
228
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
229
|
+
}
|
|
230
|
+
function rec(v) {
|
|
231
|
+
return v && typeof v === 'object' && !Array.isArray(v) ? v : {};
|
|
232
|
+
}
|
|
233
|
+
function str(v) {
|
|
234
|
+
return typeof v === 'string' && v !== '' ? v : undefined;
|
|
235
|
+
}
|
|
236
|
+
function num(v) {
|
|
237
|
+
return typeof v === 'number' && Number.isFinite(v) ? v : undefined;
|
|
238
|
+
}
|
|
239
|
+
function numbers(v) {
|
|
240
|
+
const out = {};
|
|
241
|
+
for (const [k, value] of Object.entries(rec(v))) {
|
|
242
|
+
const n = num(value);
|
|
243
|
+
if (n !== undefined)
|
|
244
|
+
out[k] = n;
|
|
245
|
+
}
|
|
246
|
+
return out;
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=classifier-agent.step.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classifier-agent.step.js","sourceRoot":"","sources":["../../../../src/connectors/builtin/steps/classifier-agent.step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AAEpF,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AAEpF,kFAAkF;AAClF,MAAM,QAAQ,GAAG,OAAO,CAAC;AAEzB,gEAAgE;AAChE,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAEzC,iBAAiB;AAEjB,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,KAAK,EAAE,CAAC;S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@ -38,19 +38,19 @@ export declare const CycleStepConfigSchema: z.ZodObject<{
|
|
|
38
38
|
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
39
39
|
maxIterations: z.ZodDefault<z.ZodNumber>;
|
|
40
40
|
}, "strip", z.ZodTypeAny, {
|
|
41
|
+
input: Record<string, unknown>;
|
|
41
42
|
body: z.objectOutputType<{
|
|
42
43
|
id: z.ZodString;
|
|
43
44
|
type: z.ZodString;
|
|
44
45
|
}, z.ZodTypeAny, "passthrough">[];
|
|
45
46
|
maxIterations: number;
|
|
46
|
-
input: Record<string, unknown>;
|
|
47
47
|
}, {
|
|
48
48
|
body: z.objectInputType<{
|
|
49
49
|
id: z.ZodString;
|
|
50
50
|
type: z.ZodString;
|
|
51
51
|
}, z.ZodTypeAny, "passthrough">[];
|
|
52
|
-
maxIterations?: number | undefined;
|
|
53
52
|
input?: Record<string, unknown> | undefined;
|
|
53
|
+
maxIterations?: number | undefined;
|
|
54
54
|
}>;
|
|
55
55
|
export type CycleStepConfig = z.infer<typeof CycleStepConfigSchema>;
|
|
56
56
|
export interface CycleStepOutput extends Record<string, unknown> {
|
|
@@ -79,19 +79,19 @@ export declare class CycleStep extends BaseControlFlowStep<typeof CycleStepConfi
|
|
|
79
79
|
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
80
80
|
maxIterations: z.ZodDefault<z.ZodNumber>;
|
|
81
81
|
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
input: Record<string, unknown>;
|
|
82
83
|
body: z.objectOutputType<{
|
|
83
84
|
id: z.ZodString;
|
|
84
85
|
type: z.ZodString;
|
|
85
86
|
}, z.ZodTypeAny, "passthrough">[];
|
|
86
87
|
maxIterations: number;
|
|
87
|
-
input: Record<string, unknown>;
|
|
88
88
|
}, {
|
|
89
89
|
body: z.objectInputType<{
|
|
90
90
|
id: z.ZodString;
|
|
91
91
|
type: z.ZodString;
|
|
92
92
|
}, z.ZodTypeAny, "passthrough">[];
|
|
93
|
-
maxIterations?: number | undefined;
|
|
94
93
|
input?: Record<string, unknown> | undefined;
|
|
94
|
+
maxIterations?: number | undefined;
|
|
95
95
|
}>;
|
|
96
96
|
readonly outputSchema: z.ZodObject<{
|
|
97
97
|
rounds: z.ZodNumber;
|
|
@@ -538,11 +538,10 @@ export declare const HttpRequestStepConfigSchema: z.ZodObject<{
|
|
|
538
538
|
queryParams?: Record<string, string> | undefined;
|
|
539
539
|
}, {
|
|
540
540
|
url: string;
|
|
541
|
+
credentialName?: string | undefined;
|
|
541
542
|
timeoutMs?: number | undefined;
|
|
542
543
|
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
|
|
543
|
-
credentialName?: string | undefined;
|
|
544
544
|
headers?: Record<string, string> | undefined;
|
|
545
|
-
queryParams?: Record<string, string> | undefined;
|
|
546
545
|
body?: {
|
|
547
546
|
mode: "none";
|
|
548
547
|
} | {
|
|
@@ -580,6 +579,7 @@ export declare const HttpRequestStepConfigSchema: z.ZodObject<{
|
|
|
580
579
|
enabled?: boolean | undefined;
|
|
581
580
|
}[] | undefined;
|
|
582
581
|
} | undefined;
|
|
582
|
+
queryParams?: Record<string, string> | undefined;
|
|
583
583
|
response?: {
|
|
584
584
|
type: "json";
|
|
585
585
|
bodySchema?: Record<string, unknown> | undefined;
|
|
@@ -903,11 +903,10 @@ export declare class HttpRequestStep extends BaseActionStep<typeof HttpRequestSt
|
|
|
903
903
|
queryParams?: Record<string, string> | undefined;
|
|
904
904
|
}, {
|
|
905
905
|
url: string;
|
|
906
|
+
credentialName?: string | undefined;
|
|
906
907
|
timeoutMs?: number | undefined;
|
|
907
908
|
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
|
|
908
|
-
credentialName?: string | undefined;
|
|
909
909
|
headers?: Record<string, string> | undefined;
|
|
910
|
-
queryParams?: Record<string, string> | undefined;
|
|
911
910
|
body?: {
|
|
912
911
|
mode: "none";
|
|
913
912
|
} | {
|
|
@@ -945,6 +944,7 @@ export declare class HttpRequestStep extends BaseActionStep<typeof HttpRequestSt
|
|
|
945
944
|
enabled?: boolean | undefined;
|
|
946
945
|
}[] | undefined;
|
|
947
946
|
} | undefined;
|
|
947
|
+
queryParams?: Record<string, string> | undefined;
|
|
948
948
|
response?: {
|
|
949
949
|
type: "json";
|
|
950
950
|
bodySchema?: Record<string, unknown> | undefined;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MAP step — iterate an array and run one `body` per item CONCURRENTLY.
|
|
3
3
|
*
|
|
4
|
-
* Like LOOP (resolves a source array, single `body`) but
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Like LOOP (resolves a source array, single `body`) but items run in parallel
|
|
5
|
+
* rather than sequentially — for cases where N dynamically-discovered items
|
|
6
|
+
* each need the same processing (e.g. validate the PAN of each of N owners).
|
|
7
|
+
* `concurrency` bounds how many are in flight; omit it for unbounded, or set
|
|
8
|
+
* it to 1 when each item is expensive enough that they must run one at a time
|
|
9
|
+
* (and unlike LOOP, MAP still collects every item's outputs). Whatever the
|
|
10
|
+
* bound, `items` stays index-aligned with the source.
|
|
11
|
+
*
|
|
12
|
+
* Each iteration runs in its own scope keyed by the node-path frame
|
|
8
13
|
* `map_x:item#<i>`, so a WAIT inside an iteration parks that iteration's own
|
|
9
14
|
* gate; multiple iterations can pause at once and resume independently — the
|
|
10
15
|
* same durable model PARALLEL uses (the executor's node-path records ARE the
|
|
@@ -36,18 +41,21 @@ export declare const MapStepConfigSchema: z.ZodObject<{
|
|
|
36
41
|
id: z.ZodString;
|
|
37
42
|
type: z.ZodString;
|
|
38
43
|
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
44
|
+
concurrency: z.ZodOptional<z.ZodNumber>;
|
|
39
45
|
}, "strip", z.ZodTypeAny, {
|
|
40
46
|
body: z.objectOutputType<{
|
|
41
47
|
id: z.ZodString;
|
|
42
48
|
type: z.ZodString;
|
|
43
49
|
}, z.ZodTypeAny, "passthrough">[];
|
|
44
50
|
source: string;
|
|
51
|
+
concurrency?: number | undefined;
|
|
45
52
|
}, {
|
|
46
53
|
body: z.objectInputType<{
|
|
47
54
|
id: z.ZodString;
|
|
48
55
|
type: z.ZodString;
|
|
49
56
|
}, z.ZodTypeAny, "passthrough">[];
|
|
50
57
|
source: string;
|
|
58
|
+
concurrency?: number | undefined;
|
|
51
59
|
}>;
|
|
52
60
|
export type MapStepConfig = z.infer<typeof MapStepConfigSchema>;
|
|
53
61
|
/** One iteration's result — its top-level step outputs (or an error). */
|
|
@@ -77,18 +85,21 @@ export declare class MapStep extends BaseControlFlowStep<typeof MapStepConfigSch
|
|
|
77
85
|
id: z.ZodString;
|
|
78
86
|
type: z.ZodString;
|
|
79
87
|
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
88
|
+
concurrency: z.ZodOptional<z.ZodNumber>;
|
|
80
89
|
}, "strip", z.ZodTypeAny, {
|
|
81
90
|
body: z.objectOutputType<{
|
|
82
91
|
id: z.ZodString;
|
|
83
92
|
type: z.ZodString;
|
|
84
93
|
}, z.ZodTypeAny, "passthrough">[];
|
|
85
94
|
source: string;
|
|
95
|
+
concurrency?: number | undefined;
|
|
86
96
|
}, {
|
|
87
97
|
body: z.objectInputType<{
|
|
88
98
|
id: z.ZodString;
|
|
89
99
|
type: z.ZodString;
|
|
90
100
|
}, z.ZodTypeAny, "passthrough">[];
|
|
91
101
|
source: string;
|
|
102
|
+
concurrency?: number | undefined;
|
|
92
103
|
}>;
|
|
93
104
|
readonly outputSchema: z.ZodObject<{
|
|
94
105
|
count: z.ZodNumber;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.step.d.ts","sourceRoot":"","sources":["../../../../src/connectors/builtin/steps/map.step.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"map.step.d.ts","sourceRoot":"","sources":["../../../../src/connectors/builtin/steps/map.step.ts"],"names":[],"mappings":"AA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YAAY;IAClC,SAAkB,eAAe;;;OAEtB;IAEF,WAAW,CAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,MAAM,CAAC,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAM9B,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAavD,OAAO,CACpB,MAAM,EAAE,aAAa,EACrB,GAAG,EAAE,2BAA2B,GAC/B,OAAO,CAAC,aAAa,CAAC;CAgG1B"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MAP step — iterate an array and run one `body` per item CONCURRENTLY.
|
|
3
3
|
*
|
|
4
|
-
* Like LOOP (resolves a source array, single `body`) but
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Like LOOP (resolves a source array, single `body`) but items run in parallel
|
|
5
|
+
* rather than sequentially — for cases where N dynamically-discovered items
|
|
6
|
+
* each need the same processing (e.g. validate the PAN of each of N owners).
|
|
7
|
+
* `concurrency` bounds how many are in flight; omit it for unbounded, or set
|
|
8
|
+
* it to 1 when each item is expensive enough that they must run one at a time
|
|
9
|
+
* (and unlike LOOP, MAP still collects every item's outputs). Whatever the
|
|
10
|
+
* bound, `items` stays index-aligned with the source.
|
|
11
|
+
*
|
|
12
|
+
* Each iteration runs in its own scope keyed by the node-path frame
|
|
8
13
|
* `map_x:item#<i>`, so a WAIT inside an iteration parks that iteration's own
|
|
9
14
|
* gate; multiple iterations can pause at once and resume independently — the
|
|
10
15
|
* same durable model PARALLEL uses (the executor's node-path records ARE the
|
|
@@ -28,7 +33,8 @@ import { BranchSignal, blockedJumpError } from '../../../engine/branch-signal.js
|
|
|
28
33
|
// ─── Config ───
|
|
29
34
|
export const MapStepConfigSchema = z.object({
|
|
30
35
|
source: z.string().min(1).describe('Path to the array to map over (e.g. steps.extract.output.owners). Supports {{variable}} refs'),
|
|
31
|
-
body: z.array(z.object({ id: z.string(), type: z.string() }).passthrough()).describe('Steps to execute for each item —
|
|
36
|
+
body: z.array(z.object({ id: z.string(), type: z.string() }).passthrough()).describe('Steps to execute for each item — items run concurrently up to `concurrency`'),
|
|
37
|
+
concurrency: z.number().int().positive().optional().describe('Max iterations in flight at once. Omit for unbounded (every item starts immediately); 1 runs items strictly one after another'),
|
|
32
38
|
});
|
|
33
39
|
const MapStepOutputSchema = z.object({
|
|
34
40
|
count: z.number(),
|
|
@@ -77,19 +83,46 @@ export class MapStep extends BaseControlFlowStep {
|
|
|
77
83
|
}
|
|
78
84
|
const items = sourceValue;
|
|
79
85
|
const body = config.body;
|
|
80
|
-
// Run
|
|
81
|
-
//
|
|
82
|
-
// re-
|
|
83
|
-
//
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
// Run iterations in their own scopes keyed by node-path `map_x:item#<i>`.
|
|
87
|
+
// A paused iteration throws PauseStep; on resume the MAP re-enters and
|
|
88
|
+
// re-walks all iterations — completed ones memo-skip from their records,
|
|
89
|
+
// the parked one(s) resume. No saved state lives here.
|
|
90
|
+
//
|
|
91
|
+
// `concurrency` bounds how many run at once. Workers pull from a shared
|
|
92
|
+
// cursor and write into `settled` by item index, so the result array is
|
|
93
|
+
// identical in shape and order to the Promise.allSettled it replaces —
|
|
94
|
+
// completion order never leaks into it. Omitted concurrency starts one
|
|
95
|
+
// worker per item, which is exactly the previous behaviour.
|
|
96
|
+
const settled = new Array(items.length);
|
|
97
|
+
const workerCount = Math.min(config.concurrency ?? items.length, items.length);
|
|
98
|
+
let cursor = 0;
|
|
99
|
+
const worker = async () => {
|
|
100
|
+
for (let i = cursor++; i < items.length; i = cursor++) {
|
|
101
|
+
const item = items[i];
|
|
102
|
+
try {
|
|
103
|
+
const iterScope = cloneScope(ctx.workflow);
|
|
104
|
+
iterScope.steps['__map'] = {
|
|
105
|
+
type: 'MAP',
|
|
106
|
+
output: { currentItem: item, currentIndex: i, totalItems: items.length },
|
|
107
|
+
};
|
|
108
|
+
await ctx.walkBranch(body, iterScope, 'item', i);
|
|
109
|
+
settled[i] = {
|
|
110
|
+
status: 'fulfilled',
|
|
111
|
+
value: { index: i, item, steps: collectBranchSteps(body, iterScope) },
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
// Including PauseStep: a parked iteration must not stop the worker
|
|
116
|
+
// from picking up the remaining items, since allSettled did not
|
|
117
|
+
// stop the others either. The pause is re-raised after the loop.
|
|
118
|
+
settled[i] = { status: 'rejected', reason: err };
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
// allSettled, not all: a worker already catches everything inside its own loop, but if one
|
|
123
|
+
// ever threw outside it, `all` would reject while the other workers were still running and
|
|
124
|
+
// still filling `settled` — and the loop below reads every slot.
|
|
125
|
+
await Promise.allSettled(Array.from({ length: workerCount }, () => worker()));
|
|
93
126
|
const results = [];
|
|
94
127
|
let pausedCount = 0;
|
|
95
128
|
let firstExternalRef;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.step.js","sourceRoot":"","sources":["../../../../src/connectors/builtin/steps/map.step.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"map.step.js","sourceRoot":"","sources":["../../../../src/connectors/builtin/steps/map.step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAElG,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,C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oBACd,KAAK,EACH,KAAK,CAAC,MAAM,YAAY,KAAK;wBAC3B,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO;wBACtB,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;iBAC3B,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,uEAAuE;QACvE,yEAAyE;QACzE,4EAA4E;QAC5E,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;YACpB,MAAM,MAAM,GACV,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,wBAAwB,CAAC;YAC9F,MAAM,IAAI,SAAS,CACjB,MAAM,EACN,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,SAAS,CAC/E,CAAC;QACJ,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;QAC1C,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IACjD,CAAC;CACF"}
|
|
@@ -151,6 +151,7 @@ export declare class ParallelStep extends BaseControlFlowStep<typeof ParallelSte
|
|
|
151
151
|
reason: string;
|
|
152
152
|
}>]>>;
|
|
153
153
|
}, "strip", z.ZodTypeAny, {
|
|
154
|
+
mode: "allSettled";
|
|
154
155
|
branches: Record<string, {
|
|
155
156
|
status: "fulfilled";
|
|
156
157
|
steps: Record<string, {
|
|
@@ -160,8 +161,8 @@ export declare class ParallelStep extends BaseControlFlowStep<typeof ParallelSte
|
|
|
160
161
|
status: "rejected";
|
|
161
162
|
reason: string;
|
|
162
163
|
}>;
|
|
163
|
-
mode: "allSettled";
|
|
164
164
|
}, {
|
|
165
|
+
mode: "allSettled";
|
|
165
166
|
branches: Record<string, {
|
|
166
167
|
status: "fulfilled";
|
|
167
168
|
steps: Record<string, {
|
|
@@ -171,7 +172,6 @@ export declare class ParallelStep extends BaseControlFlowStep<typeof ParallelSte
|
|
|
171
172
|
status: "rejected";
|
|
172
173
|
reason: string;
|
|
173
174
|
}>;
|
|
174
|
-
mode: "allSettled";
|
|
175
175
|
}>, z.ZodObject<{
|
|
176
176
|
mode: z.ZodLiteral<"race">;
|
|
177
177
|
branch: z.ZodString;
|
|
@@ -205,6 +205,7 @@ export declare class ParallelStep extends BaseControlFlowStep<typeof ParallelSte
|
|
|
205
205
|
reason: string;
|
|
206
206
|
}>]>>;
|
|
207
207
|
}, "strip", z.ZodTypeAny, {
|
|
208
|
+
mode: "race";
|
|
208
209
|
branch: string;
|
|
209
210
|
branches: Record<string, {
|
|
210
211
|
status: "fulfilled";
|
|
@@ -215,8 +216,8 @@ export declare class ParallelStep extends BaseControlFlowStep<typeof ParallelSte
|
|
|
215
216
|
status: "rejected";
|
|
216
217
|
reason: string;
|
|
217
218
|
}>;
|
|
218
|
-
mode: "race";
|
|
219
219
|
}, {
|
|
220
|
+
mode: "race";
|
|
220
221
|
branch: string;
|
|
221
222
|
branches: Record<string, {
|
|
222
223
|
status: "fulfilled";
|
|
@@ -227,7 +228,6 @@ export declare class ParallelStep extends BaseControlFlowStep<typeof ParallelSte
|
|
|
227
228
|
status: "rejected";
|
|
228
229
|
reason: string;
|
|
229
230
|
}>;
|
|
230
|
-
mode: "race";
|
|
231
231
|
}>]>;
|
|
232
232
|
readonly category: "control";
|
|
233
233
|
readonly icon = "columns";
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* CYCLE conversation input { screen: 'start', text: '' }
|
|
5
5
|
* └ SWITCH route on screen
|
|
6
6
|
* ├ start — the first screen: a greeting, no options yet
|
|
7
|
-
* ├ ai_router — typed text → an agent picks the screen
|
|
7
|
+
* ├ ai_router — typed text → a classifier (or an agent) picks the screen
|
|
8
8
|
* ├ done — Finish
|
|
9
9
|
* └ default → start
|
|
10
10
|
*
|
|
@@ -21,8 +21,21 @@ export interface NewConversationalFlow {
|
|
|
21
21
|
kind: typeof CONVERSATIONAL_FLOW_KIND;
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
+
/** How typed messages are routed. A classifier model, or an agent asked for JSON. */
|
|
25
|
+
export type NewRouter = {
|
|
26
|
+
kind: 'classifier';
|
|
27
|
+
model?: string;
|
|
28
|
+
credentialName?: string;
|
|
29
|
+
/** Below this, send them back to the first screen instead of guessing. */
|
|
30
|
+
minConfidence?: number;
|
|
31
|
+
} | {
|
|
32
|
+
kind: 'agent';
|
|
33
|
+
agentSlug?: string;
|
|
34
|
+
};
|
|
24
35
|
export declare function createConversationalFlow(options?: {
|
|
25
|
-
/**
|
|
36
|
+
/** How typed text is routed. A classifier model unless an agent is asked for. */
|
|
37
|
+
router?: NewRouter;
|
|
38
|
+
/** The agent that routes typed messages; can be set later. Same as `router: { kind: 'agent', agentSlug }`. */
|
|
26
39
|
agentSlug?: string;
|
|
27
40
|
greeting?: string;
|
|
28
41
|
/** Title of the first screen, and the conversation header on it. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/conversational-flow/create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAIlE,eAAO,MAAM,wBAAwB,wBAAwB,CAAC;AAE9D,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,cAAc,CAAC;IACvB,4EAA4E;IAC5E,QAAQ,EAAE;QAAE,IAAI,EAAE,OAAO,wBAAwB,CAAA;KAAE,CAAC;CACrD;AAED,wBAAgB,wBAAwB,CAAC,OAAO,GAAE;IAChD,
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/conversational-flow/create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;A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