@runtypelabs/sdk 0.1.1
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/README.md +398 -0
- package/dist/batch-builder.d.ts +106 -0
- package/dist/batch-builder.d.ts.map +1 -0
- package/dist/batch-builder.js +124 -0
- package/dist/batch-builder.js.map +1 -0
- package/dist/batches-namespace.d.ts +132 -0
- package/dist/batches-namespace.d.ts.map +1 -0
- package/dist/batches-namespace.js +128 -0
- package/dist/batches-namespace.js.map +1 -0
- package/dist/client.d.ts +121 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +485 -0
- package/dist/client.js.map +1 -0
- package/dist/endpoints.d.ts +560 -0
- package/dist/endpoints.d.ts.map +1 -0
- package/dist/endpoints.js +725 -0
- package/dist/endpoints.js.map +1 -0
- package/dist/eval-builder.d.ts +216 -0
- package/dist/eval-builder.d.ts.map +1 -0
- package/dist/eval-builder.js +225 -0
- package/dist/eval-builder.js.map +1 -0
- package/dist/evals-namespace.d.ts +205 -0
- package/dist/evals-namespace.d.ts.map +1 -0
- package/dist/evals-namespace.js +208 -0
- package/dist/evals-namespace.js.map +1 -0
- package/dist/flow-builder.d.ts +620 -0
- package/dist/flow-builder.d.ts.map +1 -0
- package/dist/flow-builder.js +565 -0
- package/dist/flow-builder.js.map +1 -0
- package/dist/flow-result.d.ts +117 -0
- package/dist/flow-result.d.ts.map +1 -0
- package/dist/flow-result.js +175 -0
- package/dist/flow-result.js.map +1 -0
- package/dist/flows-namespace.d.ts +430 -0
- package/dist/flows-namespace.d.ts.map +1 -0
- package/dist/flows-namespace.js +679 -0
- package/dist/flows-namespace.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +76 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts-namespace.d.ts +236 -0
- package/dist/prompts-namespace.d.ts.map +1 -0
- package/dist/prompts-namespace.js +222 -0
- package/dist/prompts-namespace.js.map +1 -0
- package/dist/runtype.d.ts +232 -0
- package/dist/runtype.d.ts.map +1 -0
- package/dist/runtype.js +367 -0
- package/dist/runtype.js.map +1 -0
- package/dist/stream-utils.d.ts +58 -0
- package/dist/stream-utils.d.ts.map +1 -0
- package/dist/stream-utils.js +348 -0
- package/dist/stream-utils.js.map +1 -0
- package/dist/transform.d.ts +21 -0
- package/dist/transform.d.ts.map +1 -0
- package/dist/transform.js +170 -0
- package/dist/transform.js.map +1 -0
- package/dist/types.d.ts +626 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* FlowBuilder - Fluent builder for constructing dispatch configurations
|
|
4
|
+
*
|
|
5
|
+
* Provides a chainable API for building flows with steps, making flow
|
|
6
|
+
* construction more readable and type-safe.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { FlowBuilder } from '@runtypelabs/sdk'
|
|
11
|
+
*
|
|
12
|
+
* const config = new FlowBuilder()
|
|
13
|
+
* .createFlow({ name: "My Flow" })
|
|
14
|
+
* .withRecord({ name: "Record", type: "data", metadata: { key: "value" } })
|
|
15
|
+
* .fetchUrl({ name: "Fetch", url: "https://api.example.com", outputVariable: "data" })
|
|
16
|
+
* .prompt({ name: "Process", model: "gpt-4", userPrompt: "Analyze: {{data}}" })
|
|
17
|
+
* .withOptions({ streamResponse: true, flowMode: "virtual" })
|
|
18
|
+
* .build()
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.ClientFlowBuilder = exports.FlowBuilder = void 0;
|
|
23
|
+
exports.createExternalTool = createExternalTool;
|
|
24
|
+
const flow_result_1 = require("./flow-result");
|
|
25
|
+
const stream_utils_1 = require("./stream-utils");
|
|
26
|
+
// ============================================================================
|
|
27
|
+
// FlowBuilder Class
|
|
28
|
+
// ============================================================================
|
|
29
|
+
class FlowBuilder {
|
|
30
|
+
constructor() {
|
|
31
|
+
this.flowConfig = { name: 'Untitled Flow' };
|
|
32
|
+
this.steps = [];
|
|
33
|
+
this.optionsConfig = {};
|
|
34
|
+
this.stepCounter = 0;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Initialize the flow with a name and optional description.
|
|
38
|
+
* Use this for virtual/one-off flows or when specifying flowMode in run().
|
|
39
|
+
*/
|
|
40
|
+
createFlow(config) {
|
|
41
|
+
this.flowConfig = config;
|
|
42
|
+
this.existingFlowId = undefined; // Clear any existing flow reference
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Define a flow for upsert - creates if it doesn't exist, updates if steps changed.
|
|
47
|
+
* This is the recommended pattern for code-first flow management.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const result = await new FlowBuilder()
|
|
52
|
+
* .upsertFlow({
|
|
53
|
+
* name: 'My Flow',
|
|
54
|
+
* createVersionOnChange: true
|
|
55
|
+
* })
|
|
56
|
+
* .prompt({ name: 'Analyze', model: 'gpt-4o', userPrompt: '...' })
|
|
57
|
+
* .run(apiClient, { streamResponse: true })
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
upsertFlow(config) {
|
|
61
|
+
const { createVersionOnChange, allowOverwriteExternalChanges, ...flowConfig } = config;
|
|
62
|
+
this.flowConfig = flowConfig;
|
|
63
|
+
this.existingFlowId = undefined; // Clear any existing flow reference
|
|
64
|
+
// Auto-set upsert mode and options
|
|
65
|
+
this.optionsConfig = {
|
|
66
|
+
...this.optionsConfig,
|
|
67
|
+
flowMode: 'upsert',
|
|
68
|
+
upsertOptions: {
|
|
69
|
+
createVersionOnChange: createVersionOnChange ?? true,
|
|
70
|
+
...(allowOverwriteExternalChanges !== undefined && { allowOverwriteExternalChanges }),
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Use an existing flow by ID instead of defining steps inline
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* const result = await new FlowBuilder()
|
|
81
|
+
* .useExistingFlow('flow_abc123')
|
|
82
|
+
* .withRecord({ name: 'Test', type: 'data' })
|
|
83
|
+
* .run(apiClient, { streamResponse: true })
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
useExistingFlow(flowId) {
|
|
87
|
+
this.existingFlowId = flowId;
|
|
88
|
+
this.steps = []; // Clear any inline steps
|
|
89
|
+
return this;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Set the record configuration
|
|
93
|
+
*/
|
|
94
|
+
withRecord(config) {
|
|
95
|
+
this.recordConfig = config;
|
|
96
|
+
return this;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Set conversation messages
|
|
100
|
+
*/
|
|
101
|
+
withMessages(messages) {
|
|
102
|
+
this.messagesConfig = messages;
|
|
103
|
+
return this;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Set dispatch options
|
|
107
|
+
*/
|
|
108
|
+
withOptions(options) {
|
|
109
|
+
this.optionsConfig = { ...this.optionsConfig, ...options };
|
|
110
|
+
return this;
|
|
111
|
+
}
|
|
112
|
+
// ============================================================================
|
|
113
|
+
// Step Methods
|
|
114
|
+
// ============================================================================
|
|
115
|
+
/**
|
|
116
|
+
* Add a prompt step
|
|
117
|
+
*/
|
|
118
|
+
prompt(config) {
|
|
119
|
+
this.addStep('prompt', config.name, {
|
|
120
|
+
model: config.model,
|
|
121
|
+
userPrompt: config.userPrompt,
|
|
122
|
+
text: config.userPrompt, // backward compat
|
|
123
|
+
systemPrompt: config.systemPrompt,
|
|
124
|
+
previousMessages: config.previousMessages,
|
|
125
|
+
outputVariable: config.outputVariable,
|
|
126
|
+
responseFormat: config.responseFormat,
|
|
127
|
+
temperature: config.temperature,
|
|
128
|
+
maxTokens: config.maxTokens,
|
|
129
|
+
reasoning: config.reasoning,
|
|
130
|
+
streamOutput: config.streamOutput,
|
|
131
|
+
tools: config.tools,
|
|
132
|
+
}, config.enabled);
|
|
133
|
+
return this;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Add a fetch URL step
|
|
137
|
+
*/
|
|
138
|
+
fetchUrl(config) {
|
|
139
|
+
this.addStep('fetch-url', config.name, {
|
|
140
|
+
http: {
|
|
141
|
+
url: config.url,
|
|
142
|
+
method: config.method || 'GET',
|
|
143
|
+
headers: config.headers,
|
|
144
|
+
body: config.body,
|
|
145
|
+
},
|
|
146
|
+
fetchMethod: config.fetchMethod,
|
|
147
|
+
firecrawl: config.firecrawl,
|
|
148
|
+
outputVariable: config.outputVariable,
|
|
149
|
+
errorHandling: config.errorHandling,
|
|
150
|
+
streamOutput: config.streamOutput,
|
|
151
|
+
}, config.enabled);
|
|
152
|
+
return this;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Add a transform data step
|
|
156
|
+
*/
|
|
157
|
+
transformData(config) {
|
|
158
|
+
this.addStep('transform-data', config.name, {
|
|
159
|
+
script: config.script,
|
|
160
|
+
outputVariable: config.outputVariable,
|
|
161
|
+
streamOutput: config.streamOutput,
|
|
162
|
+
}, config.enabled);
|
|
163
|
+
return this;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Add a set variable step
|
|
167
|
+
*/
|
|
168
|
+
setVariable(config) {
|
|
169
|
+
this.addStep('set-variable', config.name, {
|
|
170
|
+
variableName: config.variableName,
|
|
171
|
+
value: config.value,
|
|
172
|
+
}, config.enabled);
|
|
173
|
+
return this;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Add a conditional step
|
|
177
|
+
*/
|
|
178
|
+
conditional(config) {
|
|
179
|
+
this.addStep('conditional', config.name, {
|
|
180
|
+
condition: config.condition,
|
|
181
|
+
trueSteps: config.trueSteps || [],
|
|
182
|
+
falseSteps: config.falseSteps || [],
|
|
183
|
+
}, config.enabled);
|
|
184
|
+
return this;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Add a search step
|
|
188
|
+
*/
|
|
189
|
+
search(config) {
|
|
190
|
+
this.addStep('search', config.name, {
|
|
191
|
+
provider: config.provider,
|
|
192
|
+
query: config.query,
|
|
193
|
+
maxResults: config.maxResults,
|
|
194
|
+
outputVariable: config.outputVariable,
|
|
195
|
+
returnCitations: config.returnCitations,
|
|
196
|
+
errorHandling: config.errorHandling,
|
|
197
|
+
streamOutput: config.streamOutput,
|
|
198
|
+
}, config.enabled);
|
|
199
|
+
return this;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Add a send email step
|
|
203
|
+
*/
|
|
204
|
+
sendEmail(config) {
|
|
205
|
+
this.addStep('send-email', config.name, {
|
|
206
|
+
to: config.to,
|
|
207
|
+
from: config.from || 'no-reply@messages.runtype.com',
|
|
208
|
+
subject: config.subject,
|
|
209
|
+
html: config.html,
|
|
210
|
+
outputVariable: config.outputVariable,
|
|
211
|
+
errorHandling: config.errorHandling,
|
|
212
|
+
streamOutput: config.streamOutput,
|
|
213
|
+
}, config.enabled);
|
|
214
|
+
return this;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Add a send stream step
|
|
218
|
+
*/
|
|
219
|
+
sendStream(config) {
|
|
220
|
+
this.addStep('send-stream', config.name, {
|
|
221
|
+
message: config.message,
|
|
222
|
+
}, config.enabled);
|
|
223
|
+
return this;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Add a retrieve record step
|
|
227
|
+
*/
|
|
228
|
+
retrieveRecord(config) {
|
|
229
|
+
this.addStep('retrieve-record', config.name, {
|
|
230
|
+
recordType: config.recordType,
|
|
231
|
+
recordName: config.recordName,
|
|
232
|
+
fieldsToInclude: config.fieldsToInclude,
|
|
233
|
+
fieldsToExclude: config.fieldsToExclude,
|
|
234
|
+
outputVariable: config.outputVariable,
|
|
235
|
+
streamOutput: config.streamOutput,
|
|
236
|
+
}, config.enabled);
|
|
237
|
+
return this;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Add an upsert record step
|
|
241
|
+
*/
|
|
242
|
+
upsertRecord(config) {
|
|
243
|
+
this.addStep('upsert-record', config.name, {
|
|
244
|
+
recordType: config.recordType,
|
|
245
|
+
recordName: config.recordName,
|
|
246
|
+
sourceVariable: config.sourceVariable,
|
|
247
|
+
mergeStrategy: config.mergeStrategy,
|
|
248
|
+
outputVariable: config.outputVariable,
|
|
249
|
+
errorHandling: config.errorHandling,
|
|
250
|
+
streamOutput: config.streamOutput,
|
|
251
|
+
}, config.enabled);
|
|
252
|
+
return this;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Add a vector search step
|
|
256
|
+
*/
|
|
257
|
+
vectorSearch(config) {
|
|
258
|
+
this.addStep('vector-search', config.name, {
|
|
259
|
+
query: config.query,
|
|
260
|
+
recordType: config.recordType,
|
|
261
|
+
embeddingModel: config.embeddingModel,
|
|
262
|
+
limit: config.limit,
|
|
263
|
+
threshold: config.threshold,
|
|
264
|
+
outputVariable: config.outputVariable,
|
|
265
|
+
includeDistance: config.includeDistance,
|
|
266
|
+
streamOutput: config.streamOutput,
|
|
267
|
+
}, config.enabled);
|
|
268
|
+
return this;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Add a generate embedding step
|
|
272
|
+
*/
|
|
273
|
+
generateEmbedding(config) {
|
|
274
|
+
this.addStep('generate-embedding', config.name, {
|
|
275
|
+
inputSource: 'text',
|
|
276
|
+
text: config.text,
|
|
277
|
+
embeddingModel: config.embeddingModel,
|
|
278
|
+
maxLength: config.maxLength,
|
|
279
|
+
outputVariable: config.outputVariable,
|
|
280
|
+
streamOutput: config.streamOutput,
|
|
281
|
+
}, config.enabled);
|
|
282
|
+
return this;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Add a wait until step
|
|
286
|
+
*/
|
|
287
|
+
waitUntil(config) {
|
|
288
|
+
this.addStep('wait-until', config.name, {
|
|
289
|
+
delayMs: config.delayMs,
|
|
290
|
+
continueOnTimeout: config.continueOnTimeout,
|
|
291
|
+
poll: config.poll,
|
|
292
|
+
outputVariable: config.outputVariable,
|
|
293
|
+
errorHandling: config.errorHandling,
|
|
294
|
+
streamOutput: config.streamOutput,
|
|
295
|
+
}, config.enabled);
|
|
296
|
+
return this;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Add a send event step
|
|
300
|
+
*/
|
|
301
|
+
sendEvent(config) {
|
|
302
|
+
this.addStep('send-event', config.name, {
|
|
303
|
+
provider: config.provider,
|
|
304
|
+
eventName: config.eventName,
|
|
305
|
+
properties: config.properties,
|
|
306
|
+
outputVariable: config.outputVariable,
|
|
307
|
+
errorHandling: config.errorHandling,
|
|
308
|
+
streamOutput: config.streamOutput,
|
|
309
|
+
}, config.enabled);
|
|
310
|
+
return this;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Add a send text step
|
|
314
|
+
*/
|
|
315
|
+
sendText(config) {
|
|
316
|
+
this.addStep('send-text', config.name, {
|
|
317
|
+
to: config.to,
|
|
318
|
+
from: config.from,
|
|
319
|
+
message: config.message,
|
|
320
|
+
outputVariable: config.outputVariable,
|
|
321
|
+
errorHandling: config.errorHandling,
|
|
322
|
+
streamOutput: config.streamOutput,
|
|
323
|
+
}, config.enabled);
|
|
324
|
+
return this;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Add a fetch GitHub step
|
|
328
|
+
*/
|
|
329
|
+
fetchGitHub(config) {
|
|
330
|
+
this.addStep('fetch-github', config.name, {
|
|
331
|
+
repository: config.repository,
|
|
332
|
+
branch: config.branch,
|
|
333
|
+
path: config.path,
|
|
334
|
+
outputVariable: config.outputVariable,
|
|
335
|
+
streamOutput: config.streamOutput,
|
|
336
|
+
}, config.enabled);
|
|
337
|
+
return this;
|
|
338
|
+
}
|
|
339
|
+
// ============================================================================
|
|
340
|
+
// Build Method
|
|
341
|
+
// ============================================================================
|
|
342
|
+
/**
|
|
343
|
+
* Build the final dispatch request configuration
|
|
344
|
+
*/
|
|
345
|
+
build() {
|
|
346
|
+
// Determine the flow configuration
|
|
347
|
+
const flow = this.existingFlowId
|
|
348
|
+
? { id: this.existingFlowId }
|
|
349
|
+
: { name: this.flowConfig.name, steps: this.steps };
|
|
350
|
+
const request = { flow };
|
|
351
|
+
// Add record config if set
|
|
352
|
+
if (this.recordConfig) {
|
|
353
|
+
request.record = this.recordConfig;
|
|
354
|
+
}
|
|
355
|
+
// Add messages if set
|
|
356
|
+
if (this.messagesConfig) {
|
|
357
|
+
request.messages = this.messagesConfig;
|
|
358
|
+
}
|
|
359
|
+
// Add options if any are set
|
|
360
|
+
if (Object.keys(this.optionsConfig).length > 0) {
|
|
361
|
+
request.options = this.optionsConfig;
|
|
362
|
+
}
|
|
363
|
+
return request;
|
|
364
|
+
}
|
|
365
|
+
async run(client, options, callbacks) {
|
|
366
|
+
const config = this.build();
|
|
367
|
+
// Merge run options with builder options (run options take precedence)
|
|
368
|
+
if (options) {
|
|
369
|
+
config.options = { ...config.options, ...options };
|
|
370
|
+
}
|
|
371
|
+
const response = await client.dispatch(config);
|
|
372
|
+
// If callbacks provided, process stream immediately
|
|
373
|
+
if (callbacks) {
|
|
374
|
+
return (0, stream_utils_1.processStream)(response, callbacks);
|
|
375
|
+
}
|
|
376
|
+
// Otherwise return FlowResult for later processing
|
|
377
|
+
return new flow_result_1.FlowResult(response);
|
|
378
|
+
}
|
|
379
|
+
// ============================================================================
|
|
380
|
+
// Private Helpers
|
|
381
|
+
// ============================================================================
|
|
382
|
+
addStep(type, name, config, enabled = true) {
|
|
383
|
+
this.stepCounter++;
|
|
384
|
+
// Clean undefined values from config
|
|
385
|
+
const cleanConfig = {};
|
|
386
|
+
for (const [key, value] of Object.entries(config)) {
|
|
387
|
+
if (value !== undefined) {
|
|
388
|
+
cleanConfig[key] = value;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
this.steps.push({
|
|
392
|
+
id: `step-${this.stepCounter}`,
|
|
393
|
+
type,
|
|
394
|
+
name,
|
|
395
|
+
order: this.stepCounter,
|
|
396
|
+
enabled,
|
|
397
|
+
config: cleanConfig,
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
exports.FlowBuilder = FlowBuilder;
|
|
402
|
+
// ============================================================================
|
|
403
|
+
// ClientFlowBuilder - FlowBuilder bound to a client
|
|
404
|
+
// ============================================================================
|
|
405
|
+
/**
|
|
406
|
+
* FlowBuilder that is bound to a client for direct execution
|
|
407
|
+
*
|
|
408
|
+
* @example
|
|
409
|
+
* ```typescript
|
|
410
|
+
* // Via RuntypeClient.flow()
|
|
411
|
+
* const result = await runtype
|
|
412
|
+
* .flow('My Flow')
|
|
413
|
+
* .fetchUrl({ name: 'Fetch', url: '...', outputVariable: 'data' })
|
|
414
|
+
* .prompt({ name: 'Process', model: 'gpt-4', userPrompt: '...' })
|
|
415
|
+
* .run({ streamResponse: true })
|
|
416
|
+
*
|
|
417
|
+
* const data = await result.getResult('Process')
|
|
418
|
+
* ```
|
|
419
|
+
*/
|
|
420
|
+
class ClientFlowBuilder extends FlowBuilder {
|
|
421
|
+
constructor(client, name) {
|
|
422
|
+
super();
|
|
423
|
+
this.boundClient = client;
|
|
424
|
+
this.createFlow({ name });
|
|
425
|
+
}
|
|
426
|
+
async run(arg1, arg2, arg3, arg4) {
|
|
427
|
+
const config = this.build();
|
|
428
|
+
// Determine arguments
|
|
429
|
+
let runOptions;
|
|
430
|
+
let runCallbacks;
|
|
431
|
+
let localTools;
|
|
432
|
+
let dispatchClient = this.boundClient;
|
|
433
|
+
// Helper to check if object is local tools map (not options or callbacks)
|
|
434
|
+
const isLocalTools = (obj) => obj && typeof obj === 'object' &&
|
|
435
|
+
!isStreamCallbacks(obj) &&
|
|
436
|
+
!('streamResponse' in obj) && // Not options
|
|
437
|
+
!('dispatch' in obj); // Not client
|
|
438
|
+
// Parse arguments based on types
|
|
439
|
+
if (arg1) {
|
|
440
|
+
if (typeof arg1 === 'object' && 'dispatch' in arg1) {
|
|
441
|
+
// arg1 is client (ignored)
|
|
442
|
+
if (arg2) {
|
|
443
|
+
if (isStreamCallbacks(arg2)) {
|
|
444
|
+
runCallbacks = arg2;
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
runOptions = arg2;
|
|
448
|
+
if (arg3 && isStreamCallbacks(arg3)) {
|
|
449
|
+
runCallbacks = arg3;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
else if (isLocalTools(arg1)) {
|
|
455
|
+
// arg1 is local tools
|
|
456
|
+
localTools = arg1;
|
|
457
|
+
if (arg2 && isStreamCallbacks(arg2)) {
|
|
458
|
+
runCallbacks = arg2;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
// arg1 is options
|
|
463
|
+
runOptions = arg1;
|
|
464
|
+
if (arg2) {
|
|
465
|
+
if (isLocalTools(arg2)) {
|
|
466
|
+
localTools = arg2;
|
|
467
|
+
if (arg3 && isStreamCallbacks(arg3)) {
|
|
468
|
+
runCallbacks = arg3;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
else if (isStreamCallbacks(arg2)) {
|
|
472
|
+
runCallbacks = arg2;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
// Merge run options with builder options
|
|
478
|
+
if (runOptions) {
|
|
479
|
+
config.options = { ...config.options, ...runOptions };
|
|
480
|
+
}
|
|
481
|
+
// Execute with local tools if provided
|
|
482
|
+
if (localTools) {
|
|
483
|
+
// Cast boundClient to RuntypeClient to access runWithLocalTools
|
|
484
|
+
// This assumes boundClient is a RuntypeClient which has the new method
|
|
485
|
+
if ('runWithLocalTools' in dispatchClient) {
|
|
486
|
+
// If callbacks are provided, use streaming mode, otherwise use standard mode
|
|
487
|
+
// runWithLocalTools handles both depending on args
|
|
488
|
+
if (runCallbacks) {
|
|
489
|
+
return dispatchClient.runWithLocalTools(config, localTools, runCallbacks);
|
|
490
|
+
}
|
|
491
|
+
return dispatchClient.runWithLocalTools(config, localTools);
|
|
492
|
+
}
|
|
493
|
+
else {
|
|
494
|
+
throw new Error('Client does not support local tools execution');
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
const response = await dispatchClient.dispatch(config);
|
|
498
|
+
// If callbacks provided, process stream immediately
|
|
499
|
+
if (runCallbacks) {
|
|
500
|
+
return (0, stream_utils_1.processStream)(response, runCallbacks);
|
|
501
|
+
}
|
|
502
|
+
// Otherwise return FlowResult for later processing
|
|
503
|
+
return new flow_result_1.FlowResult(response);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
exports.ClientFlowBuilder = ClientFlowBuilder;
|
|
507
|
+
/**
|
|
508
|
+
* Type guard to check if an object is StreamCallbacks
|
|
509
|
+
*/
|
|
510
|
+
function isStreamCallbacks(obj) {
|
|
511
|
+
if (!obj || typeof obj !== 'object')
|
|
512
|
+
return false;
|
|
513
|
+
// Check for any of the callback properties
|
|
514
|
+
return ('onFlowStart' in obj ||
|
|
515
|
+
'onStepStart' in obj ||
|
|
516
|
+
'onStepChunk' in obj ||
|
|
517
|
+
'onStepComplete' in obj ||
|
|
518
|
+
'onFlowComplete' in obj ||
|
|
519
|
+
'onError' in obj);
|
|
520
|
+
}
|
|
521
|
+
// ============================================================================
|
|
522
|
+
// Runtime Tool Helpers
|
|
523
|
+
// ============================================================================
|
|
524
|
+
/**
|
|
525
|
+
* Create an external runtime tool definition.
|
|
526
|
+
*
|
|
527
|
+
* External tools make HTTP requests to external APIs with support for
|
|
528
|
+
* variable substitution in URLs and headers.
|
|
529
|
+
*
|
|
530
|
+
* Special internal variables are available for auth:
|
|
531
|
+
* - `{{_internal.auth_token}}` - Bearer token for Runtype API auth
|
|
532
|
+
* - `{{_internal.user_id}}` - Current user ID
|
|
533
|
+
* - `{{_internal.org_id}}` - Current organization ID
|
|
534
|
+
*
|
|
535
|
+
* @example
|
|
536
|
+
* ```typescript
|
|
537
|
+
* const listFlowsTool = createExternalTool({
|
|
538
|
+
* name: 'list_flows',
|
|
539
|
+
* description: 'List all flows in the workspace',
|
|
540
|
+
* parametersSchema: {
|
|
541
|
+
* type: 'object',
|
|
542
|
+
* properties: {
|
|
543
|
+
* limit: { type: 'number', description: 'Max results', default: 20 }
|
|
544
|
+
* }
|
|
545
|
+
* },
|
|
546
|
+
* url: 'https://api.runtype.com/v1/flows',
|
|
547
|
+
* method: 'GET',
|
|
548
|
+
* headers: { Authorization: '{{_internal.auth_token}}' }
|
|
549
|
+
* })
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
552
|
+
function createExternalTool(config) {
|
|
553
|
+
return {
|
|
554
|
+
name: config.name,
|
|
555
|
+
description: config.description,
|
|
556
|
+
toolType: 'external',
|
|
557
|
+
parametersSchema: config.parametersSchema,
|
|
558
|
+
config: {
|
|
559
|
+
url: config.url,
|
|
560
|
+
method: config.method || 'POST',
|
|
561
|
+
headers: config.headers,
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
//# sourceMappingURL=flow-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-builder.js","sourceRoot":"","sources":["../src/flow-builder.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;AAilCH,gDAmBC;AAjmCD,+CAA0C;AAC1C,iDAA8C;AAoY9C,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E,MAAa,WAAW;IAAxB;QACU,eAAU,GAAe,EAAE,IAAI,EAAE,eAAe,EAAE,CAAA;QAClD,UAAK,GAAe,EAAE,CAAA;QAGtB,kBAAa,GAAoB,EAAE,CAAA;QACnC,gBAAW,GAAG,CAAC,C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